[med-svn] [amos] 05/08: Imported Upstream version 3.1.0
Afif Elghraoui
afif-guest at moszumanska.debian.org
Wed Aug 12 07:58:45 UTC 2015
This is an automated email from the git hooks/post-receive script.
afif-guest pushed a commit to branch master
in repository amos.
commit 060e85d5a21c60b5cf299cee0186dd11bb5db516
Author: Afif Elghraoui <afif at ghraoui.name>
Date: Tue Aug 11 22:56:43 2015 -0700
Imported Upstream version 3.1.0
---
AUTHORS | 22 +
COPYING | 114 +
INSTALL | 302 +
Makefile.am | 11 +
Makefile.in | 736 ++
NEWS | 124 +
README | 199 +
THANKS | 31 +
aclocal.m4 | 957 ++
config.h.in | 254 +
config/amos.m4 | 577 ++
config/amos.mk | 81 +
config/compile | 136 +
config/config.guess | 1561 +++
config/config.rpath | 548 +
config/config.sub | 1686 ++++
config/depcomp | 630 ++
config/getopt.m4 | 47 +
config/install-sh | 520 +
config/missing | 376 +
config/mkinstalldirs | 162 +
config/onceonly_2_57.m4 | 86 +
config/perlmodules.m4 | 36 +
config/strtod.m4 | 24 +
config/strtol.m4 | 21 +
configure | 10016 +++++++++++++++++++
configure.ac | 310 +
doc/AMOScmp.README | 109 +
doc/Makefile.am | 14 +
doc/Makefile.in | 475 +
doc/amosvalidate.README | 1 +
doc/hawkeye.README | 1 +
doc/minimus.README | 114 +
doc/portability.README | 20 +
doc/runAmos.README | 215 +
src/AMOS/BankStream_AMOS.cc | 379 +
src/AMOS/BankStream_AMOS.hh | 494 +
src/AMOS/Bank_AMOS.cc | 1326 +++
src/AMOS/Bank_AMOS.hh | 1283 +++
src/AMOS/ContigEdge_AMOS.cc | 85 +
src/AMOS/ContigEdge_AMOS.hh | 144 +
src/AMOS/ContigIterator_AMOS.cc | 252 +
src/AMOS/ContigIterator_AMOS.hh | 328 +
src/AMOS/ContigLink_AMOS.cc | 81 +
src/AMOS/ContigLink_AMOS.hh | 146 +
src/AMOS/Contig_AMOS.cc | 545 +
src/AMOS/Contig_AMOS.hh | 449 +
src/AMOS/Edge_AMOS.cc | 167 +
src/AMOS/Edge_AMOS.hh | 219 +
src/AMOS/Feature_AMOS.cc | 143 +
src/AMOS/Feature_AMOS.hh | 208 +
src/AMOS/Fragment_AMOS.cc | 212 +
src/AMOS/Fragment_AMOS.hh | 255 +
src/AMOS/Group_AMOS.cc | 147 +
src/AMOS/Group_AMOS.hh | 169 +
src/AMOS/IDMap_AMOS.cc | 669 ++
src/AMOS/IDMap_AMOS.hh | 717 ++
src/AMOS/Index_AMOS.cc | 327 +
src/AMOS/Index_AMOS.hh | 437 +
src/AMOS/Kmer_AMOS.cc | 247 +
src/AMOS/Kmer_AMOS.hh | 358 +
src/AMOS/Layout_AMOS.cc | 142 +
src/AMOS/Layout_AMOS.hh | 155 +
src/AMOS/Library_AMOS.cc | 89 +
src/AMOS/Library_AMOS.hh | 127 +
src/AMOS/Link_AMOS.cc | 241 +
src/AMOS/Link_AMOS.hh | 291 +
src/AMOS/Makefile.am | 127 +
src/AMOS/Makefile.in | 1191 +++
src/AMOS/Message_AMOS.cc | 240 +
src/AMOS/Message_AMOS.hh | 554 +
src/AMOS/Motif_AMOS.cc | 87 +
src/AMOS/Motif_AMOS.hh | 115 +
src/AMOS/Overlap_AMOS.cc | 199 +
src/AMOS/Overlap_AMOS.hh | 270 +
src/AMOS/Read_AMOS.cc | 297 +
src/AMOS/Read_AMOS.hh | 318 +
src/AMOS/ScaffoldEdge_AMOS.cc | 85 +
src/AMOS/ScaffoldEdge_AMOS.hh | 145 +
src/AMOS/ScaffoldLink_AMOS.cc | 80 +
src/AMOS/ScaffoldLink_AMOS.hh | 144 +
src/AMOS/Scaffold_AMOS.cc | 187 +
src/AMOS/Scaffold_AMOS.hh | 203 +
src/AMOS/Sequence_AMOS.cc | 335 +
src/AMOS/Sequence_AMOS.hh | 458 +
src/AMOS/Universal_AMOS.cc | 216 +
src/AMOS/Universal_AMOS.hh | 267 +
src/AMOS/banktest.cc | 231 +
src/AMOS/databanks_AMOS.hh | 16 +
src/AMOS/datatypes_AMOS.cc | 360 +
src/AMOS/datatypes_AMOS.hh | 473 +
src/AMOS/exceptions_AMOS.hh | 279 +
src/AMOS/foundation_AMOS.hh | 25 +
src/AMOS/inttypes_AMOS.hh | 209 +
src/AMOS/maptest.cc | 28 +
src/AMOS/messages_AMOS.hh | 15 +
src/AMOS/msgtest.cc | 88 +
src/AMOS/streamtest.cc | 88 +
src/AMOS/umdtest.cc | 21 +
src/AMOS/universals_AMOS.cc | 165 +
src/AMOS/universals_AMOS.hh | 610 ++
src/AMOS/utility_AMOS.cc | 88 +
src/AMOS/utility_AMOS.hh | 380 +
src/Align/Makefile.am | 300 +
src/Align/Makefile.in | 1216 +++
src/Align/align.cc | 7169 +++++++++++++
src/Align/align.hh | 771 ++
src/Align/align_poly.cc | 6929 +++++++++++++
src/Align/align_poly.hh | 760 ++
src/Align/arrive.cc | 87 +
src/Align/arrive2.cc | 697 ++
src/Align/count-kmers.cc | 499 +
src/Align/count-qmers.cc | 544 +
src/Align/find-tandem.cc | 310 +
src/Align/frg-umd-merge.cc | 256 +
src/Align/gap-links.cc | 114 +
src/Align/genome-complexity-fast.cc | 1144 +++
src/Align/hash-overlap.cc | 1374 +++
src/Align/hash-overlap.hh | 161 +
src/Align/kmer-count.cc | 162 +
src/Align/kmer-cov-plot.cc | 377 +
src/Align/kmer-cov.cc | 546 +
src/Align/make-consensus.cc | 1321 +++
src/Align/make-consensus_poly.cc | 1262 +++
src/Align/maligntest.cc | 202 +
src/Align/matrix.hh | 53 +
src/Align/merge-contigs.cc | 920 ++
src/Align/missing-reads.cc | 280 +
src/Align/overlap-align.cc | 364 +
src/Align/ovl-degr-dist.cc | 329 +
src/Align/qmer-filter.cc | 32 +
src/Align/readinfo2cam.cc | 1294 +++
src/Align/running-cmp.cc | 91 +
src/Align/show-ma-asm.cc | 1332 +++
src/Align/sim-cover-depth.cc | 251 +
src/Align/sim-cover2.cc | 633 ++
src/Align/sim-shotgun.cc | 347 +
src/Align/simple-overlap.cc | 437 +
src/Align/simple-overlap.hh | 52 +
src/Align/test-align.cc | 176 +
src/Align/verify-layout.cc | 130 +
src/Bambus/Bundler/Bundler.cc | 377 +
src/Bambus/Bundler/Chainer.pl | 365 +
src/Bambus/Bundler/FilterEdgesByCluster.cc | 313 +
src/Bambus/Bundler/Joiner.pl | 145 +
src/Bambus/Bundler/Makefile.am | 85 +
src/Bambus/Bundler/Makefile.in | 823 ++
src/Bambus/Bundler/MarkRepeats.cc | 400 +
src/Bambus/Bundler/OrientContigs.cc | 1831 ++++
src/Bambus/Bundler/Utilities_Bundler.cc | 457 +
src/Bambus/Bundler/Utilities_Bundler.hh | 129 +
src/Bambus/Bundler/clk.cc | 370 +
src/Bambus/Makefile.am | 16 +
src/Bambus/Makefile.in | 570 ++
src/Bambus/Output/Linearize.cc | 323 +
src/Bambus/Output/Makefile.am | 55 +
src/Bambus/Output/Makefile.in | 648 ++
src/Bambus/Output/OutputMotifs.cc | 354 +
src/Bambus/Output/OutputResults.cc | 176 +
src/Bambus/Output/OutputScaffolds.cc | 232 +
src/Bambus/Output/Output_Utils.cc | 665 ++
src/Bambus/Output/Output_Utils.hh | 23 +
src/Bambus/Output/Position.cc | 146 +
src/Bambus/Output/Position.hh | 41 +
src/Bambus/Untangler/AsmLib.pm | 434 +
src/Bambus/Untangler/DotLib.pm | 238 +
src/Bambus/Untangler/Makefile.am | 20 +
src/Bambus/Untangler/Makefile.in | 608 ++
src/Bambus/Untangler/printScaff.pl | 1022 ++
src/Bambus/Untangler/untangle.pl | 544 +
src/Bank/Makefile.am | 313 +
src/Bank/Makefile.in | 1263 +++
src/Bank/bank-clean.cc | 234 +
src/Bank/bank-combine.cc | 93 +
src/Bank/bank-mapping.cc | 251 +
src/Bank/bank-report.cc | 502 +
src/Bank/bank-transact.cc | 509 +
src/Bank/bank-tutorial.cc | 174 +
src/Bank/bank-unlock.pl | 94 +
src/Bank/bank2contig.cc | 546 +
src/Bank/bank2coverage.cc | 299 +
src/Bank/bank2fasta.cc | 272 +
src/Bank/bank2lib.cc | 188 +
src/Bank/bank2scaff.cc | 370 +
src/Bank/dumpContigsAsReads.cc | 202 +
src/Bank/dumpFeatures.cc | 221 +
src/Bank/dumpmates.cc | 207 +
src/Bank/dumpreads.cc | 332 +
src/Bank/extractContig.cc | 124 +
src/Bank/findMissingMates.cc | 512 +
src/Bank/grow-readbank.cc | 275 +
src/Bank/listGCContent.cc | 269 +
src/Bank/listReadPlacedStatus.cc | 217 +
src/Bank/load-overlaps.cc | 502 +
src/Bank/loadFeatures.cc | 220 +
src/Bank/normalizeScaffold.cc | 224 +
src/Bank/partitionBank.cc | 218 +
src/Bank/renameReads.cc | 124 +
src/Bank/resetFragLibrary.cc | 70 +
src/Bank/revScaffold.cc | 173 +
src/Bank/select-reads.cc | 554 +
src/Bank/simpleContigLoader.cc | 286 +
src/Bank/simplifyLibraries.cc | 122 +
src/Bank/updateBankPositions.cc | 143 +
src/Bank/updateClrRanges.cc | 97 +
src/Bank/updateLibSizes.cc | 83 +
src/Casm/Makefile.am | 42 +
src/Casm/Makefile.in | 608 ++
src/Casm/casm-breaks.cc | 918 ++
src/Casm/casm-layout.cc | 2368 +++++
src/Casm/casm-libsize.cc | 93 +
src/CelMsg/CelMsg.cc | 2563 +++++
src/CelMsg/CelMsg.hh | 847 ++
src/CelMsg/Makefile.am | 24 +
src/CelMsg/Makefile.in | 611 ++
src/Common/Makefile.am | 34 +
src/Common/Makefile.in | 629 ++
src/Common/alloc.hh | 108 +
src/Common/amp.cc | 84 +
src/Common/amp.hh | 55 +
src/Common/delcher.cc | 265 +
src/Common/delcher.hh | 142 +
src/Common/delta.cc | 1229 +++
src/Common/delta.hh | 618 ++
src/Common/fasta.cc | 422 +
src/Common/fasta.hh | 51 +
src/Common/fastq.cc | 92 +
src/Common/fastq.hh | 31 +
src/Common/prob.cc | 101 +
src/Common/prob.hh | 23 +
src/Compare/Makefile.am | 22 +
src/Compare/Makefile.in | 564 ++
src/Compare/contig-cmp.cc | 588 ++
src/Contig/ContigUtils.cc | 955 ++
src/Contig/ContigUtils.hh | 46 +
src/Contig/CoverageStats.cc | 184 +
src/Contig/CoverageStats.hh | 59 +
src/Contig/DataStore.cc | 925 ++
src/Contig/DataStore.hh | 137 +
src/Contig/Insert.cc | 279 +
src/Contig/Insert.hh | 96 +
src/Contig/InsertStats.cc | 121 +
src/Contig/InsertStats.hh | 32 +
src/Contig/Makefile.am | 45 +
src/Contig/Makefile.in | 698 ++
src/Contig/olapsFromContig.cc | 637 ++
src/Converters/Makefile.am | 65 +
src/Converters/Makefile.in | 686 ++
src/Converters/ace2contig.pl | 244 +
src/Converters/agp2amos.pl | 80 +
src/Converters/amos2ace.pl | 467 +
src/Converters/amos2frg.pl | 216 +
src/Converters/amos2mates.pl | 123 +
src/Converters/amos2sq.pl | 123 +
src/Converters/arachne2ctg.pl | 87 +
src/Converters/arachne2scaff.pl | 98 +
src/Converters/benchmark2arachne.pl | 274 +
src/Converters/benchmark2ca.pl | 303 +
src/Converters/benchmark2mates.pl | 205 +
src/Converters/benchmark2ta.pl | 183 +
src/Converters/blasr2coords.pl | 30 +
src/Converters/blat2nucmer.pl | 154 +
src/Converters/ca2ctg.pl | 249 +
src/Converters/ca2mates.pl | 156 +
src/Converters/ca2scaff.pl | 257 +
src/Converters/ca2singletons.pl | 168 +
src/Converters/ca2ta.pl | 865 ++
src/Converters/castats.pl | 740 ++
src/Converters/cgb2ctg.pl | 124 +
src/Converters/contig2contig.pl | 77 +
src/Converters/ctg2fasta.pl | 19 +
src/Converters/ctg2umdcontig.pl | 104 +
src/Converters/frg2fasta.pl | 24 +
src/Converters/frg2fastq.pl | 31 +
src/Converters/frg2ta.pl | 312 +
src/Converters/parsecasm.pl | 656 ++
src/Converters/phd2afg.pl | 466 +
src/Converters/scaff2fasta.pl | 314 +
src/Converters/ta2ace.pl | 628 ++
src/Converters/tarchive2amos.pl | 1172 +++
src/Converters/tarchive2ca.pl | 612 ++
src/Converters/toAmos.pl | 2101 ++++
src/Converters/toAmos_new.cc | 1433 +++
src/Converters/toArachne.pl | 768 ++
src/CtgTrim/Makefile.am | 20 +
src/CtgTrim/Makefile.in | 494 +
src/CtgTrim/excl_seqs.pl | 52 +
src/CtgTrim/findChimeras.pl | 196 +
src/CtgTrim/find_ends.pl | 94 +
src/CtgTrim/fixfrg.pl | 46 +
src/CtgTrim/iterate.pl | 70 +
src/CtgTrim/kmers.pl | 46 +
src/CtgTrim/singles.pl | 23 +
src/CtgTrim/tab2ovls.pl | 113 +
src/CtgTrim/trimends.pl | 232 +
src/CtgTrim/trimfrg.pl | 70 +
src/CtgTrim/vecfix.pl | 46 +
src/Experimental/ContigFattener.cc | 1373 +++
src/Experimental/ContigFattener.hh | 83 +
src/Experimental/ContigSequence.cc | 353 +
src/Experimental/ContigSequence.hh | 56 +
src/Experimental/Makefile.am | 293 +
src/Experimental/Makefile.in | 1116 +++
src/Experimental/PersistentUtils.hh | 147 +
src/Experimental/aj_evaluateSequenceOverlaps.pl | 1146 +++
src/Experimental/aj_joinContigs.pl | 712 ++
src/Experimental/aj_lowcomplexityfilter.pl | 73 +
src/Experimental/aj_scaff2amos.pl | 69 +
src/Experimental/aj_scaff2fasta.pl | 176 +
src/Experimental/aligncestat.pl | 133 +
src/Experimental/aligndist.pl | 248 +
src/Experimental/alignextend.pl | 325 +
src/Experimental/analyzeHaplotypes.cc | 444 +
src/Experimental/auto-fix-contigs.cc | 347 +
src/Experimental/autoJoiner.pl | 1869 ++++
src/Experimental/barcode-graph.cc | 232 +
src/Experimental/blasr_alignquality.pl | 131 +
src/Experimental/build-persistent-bank.cc | 264 +
src/Experimental/coords_best.pl | 34 +
src/Experimental/coords_depth.pl | 66 +
src/Experimental/ctg_gc.pl | 54 +
src/Experimental/fasta_filter_raw.pl | 47 +
src/Experimental/fastq_to_mates.pl | 34 +
src/Experimental/fattenContig.cc | 229 +
src/Experimental/filterfastadups.pl | 62 +
src/Experimental/gap-closure-reads.cc | 333 +
src/Experimental/insertGapColumn.cc | 47 +
src/Experimental/link2reads.pl | 147 +
src/Experimental/manageContigs.cc | 238 +
src/Experimental/mate-evolution.cc | 313 +
src/Experimental/persistent-assembly.pl | 80 +
src/Experimental/persistent-fix-contigs.cc | 588 ++
src/Experimental/persistent-fix.pl | 97 +
src/Experimental/persistent-plot-breaks.pl | 82 +
src/Experimental/persistent-read-dist.cc | 417 +
src/Experimental/persistent-unitig.pl | 81 +
src/Experimental/po-align.cc | 812 ++
src/Experimental/read-evolution.cc | 340 +
src/Experimental/revContig.cc | 61 +
src/Experimental/rotateContig.cc | 151 +
src/Experimental/splitContig.cc | 435 +
src/Experimental/splitscafffa.pl | 44 +
src/Experimental/stitchContigs.cc | 230 +
src/Experimental/sw_align.cc | 632 ++
src/Experimental/sw_align.hh | 339 +
src/Experimental/sw_alignscore.hh | 141 +
src/Experimental/tigrinc.cc | 237 +
src/Experimental/tigrinc.hh | 41 +
src/Experimental/trimContig.cc | 171 +
src/Experimental/zipContigs.cc | 572 ++
src/Experimental/zipalign.pl | 510 +
src/Foundation/AMOS_Foundation.cc | 243 +
src/Foundation/AMOS_Foundation.hh | 60 +
src/Foundation/CategoryInformation.cc | 142 +
src/Foundation/CategoryInformation.hh | 71 +
src/Foundation/ConfigFile.cc | 191 +
src/Foundation/ConfigFile.hh | 47 +
src/Foundation/ConfigSection.cc | 588 ++
src/Foundation/ConfigSection.hh | 77 +
src/Foundation/Exceptions.cc | 127 +
src/Foundation/Exceptions.hh | 151 +
src/Foundation/FileSystem.cc | 202 +
src/Foundation/FileSystem.hh | 51 +
src/Foundation/LogCategory.cc | 375 +
src/Foundation/LogCategory.hh | 119 +
src/Foundation/LogMsg.cc | 184 +
src/Foundation/LogMsg.hh | 76 +
src/Foundation/Logger.cc | 705 ++
src/Foundation/Logger.hh | 155 +
src/Foundation/Makefile.am | 35 +
src/Foundation/Makefile.in | 644 ++
src/Foundation/MessageLevel.hh | 37 +
src/Foundation/OptionResult.cc | 483 +
src/Foundation/OptionResult.hh | 132 +
src/Foundation/Options.cc | 736 ++
src/Foundation/Options.hh | 140 +
src/GNU/Makefile.am | 40 +
src/GNU/Makefile.in | 502 +
src/GNU/getopt.c | 1161 +++
src/GNU/getopt1.c | 79 +
src/GNU/getopt_.h | 191 +
src/GNU/getopt_int.h | 129 +
src/GNU/gettext.h | 68 +
src/GNU/gnu.c | 0
src/GNU/strtod.c | 189 +
src/GNU/strtol.c | 432 +
src/Graph/CompositeNode.cc | 1 +
src/Graph/CompositeNode.hh | 43 +
src/Graph/Edge.cc | 44 +
src/Graph/Edge.hh | 93 +
src/Graph/Graph.cc | 291 +
src/Graph/Graph.hh | 119 +
src/Graph/IEdge.hh | 73 +
src/Graph/IGraph.hh | 95 +
src/Graph/INode.hh | 74 +
src/Graph/Makefile.am | 43 +
src/Graph/Makefile.in | 645 ++
src/Graph/Node.cc | 1 +
src/Graph/Node.hh | 116 +
src/Graph/SubGraph.cc | 42 +
src/Graph/SubGraph.hh | 54 +
src/Graph/Test.cc | 138 +
src/Makefile.am | 77 +
src/Makefile.in | 626 ++
src/Message/Makefile.am | 38 +
src/Message/Makefile.in | 596 ++
src/Message/message-count.cc | 187 +
src/Message/message-extract.cc | 191 +
src/Message/message-validate.cc | 146 +
src/PerlModules/AmosFoundation.pm | 375 +
src/PerlModules/AmosLib.pm | 460 +
src/PerlModules/FASTAgrammar.pm | 361 +
src/PerlModules/FASTAiterator.pm | 750 ++
src/PerlModules/FASTAreader.pm | 930 ++
src/PerlModules/FASTArecord.pm | 479 +
src/PerlModules/FASTAwriter.pm | 408 +
src/PerlModules/Foundation.pm | 1863 ++++
src/PerlModules/Makefile.am | 21 +
src/PerlModules/Makefile.in | 536 +
src/PerlModules/ParseFasta.pm | 163 +
src/PerlModules/xfig.pm | 315 +
.../AMOScmp-shortReads-alignmentTrimmed.acf | 87 +
src/Pipeline/AMOScmp-shortReads.acf | 66 +
src/Pipeline/AMOScmp.acf | 42 +
src/Pipeline/FRCurve.acf | 48 +
src/Pipeline/Makefile.am | 38 +
src/Pipeline/Makefile.in | 503 +
src/Pipeline/Minimo.acf | 141 +
src/Pipeline/assembleRNAs.acf | 27 +
src/Pipeline/gene_asm.acf | 34 +
src/Pipeline/goBambus2.py | 391 +
src/Pipeline/minimus.acf | 34 +
src/Pipeline/minimus2-blat.acf | 85 +
src/Pipeline/minimus2.acf | 84 +
src/PythonModules/AMOS.py | 127 +
src/PythonModules/Makefile.am | 7 +
src/PythonModules/Makefile.in | 486 +
src/Sim/Makefile.am | 56 +
src/Sim/Makefile.in | 676 ++
src/Sim/pyrosim.cc | 456 +
src/Sim/rerunMultiTest.pl | 24 +
src/Sim/runMultiTest.pl | 69 +
src/Sim/runTest.pl | 335 +
src/Sim/shotgunSim.cc | 611 ++
src/Sim/summarizeMultiTest.pl | 35 +
src/Sim/tandemCollapse.cc | 439 +
src/Slice/Makefile.am | 27 +
src/Slice/Makefile.in | 617 ++
src/Slice/Slice.h | 284 +
src/Slice/getConsQC.c | 434 +
src/Slice/getConsQV.c | 1356 +++
src/Slice/newmem.c | 68 +
src/Slice/utility.c | 77 +
src/Slice/version.h | 11 +
src/Staden/Makefile.am | 5 +
src/Staden/Makefile.in | 566 ++
src/Staden/progs/Makefile.am | 39 +
src/Staden/progs/Makefile.in | 625 ++
src/Staden/progs/trace_comment.c | 151 +
src/Staden/progs/trace_comments.c | 173 +
src/Staden/progs/trace_convert.c | 613 ++
src/Staden/progs/trace_scf_dump.c | 125 +
src/Staden/progs/trace_seq.c | 188 +
src/Staden/read/Makefile.am | 68 +
src/Staden/read/Makefile.in | 601 ++
src/Staden/read/README | 114 +
src/Staden/read/Read.c | 472 +
src/Staden/read/Read.h | 230 +
src/Staden/read/abi.h | 52 +
src/Staden/read/alf.h | 51 +
src/Staden/read/array.c | 145 +
src/Staden/read/array.h | 85 +
src/Staden/read/calc_crc.h | 20 +
src/Staden/read/compress.c | 620 ++
src/Staden/read/compress.h | 71 +
src/Staden/read/compression.c | 1633 +++
src/Staden/read/compression.h | 271 +
src/Staden/read/ctfCompress.c | 1452 +++
src/Staden/read/error.c | 40 +
src/Staden/read/error.h | 21 +
src/Staden/read/expFileIO.c | 1184 +++
src/Staden/read/expFileIO.h | 327 +
src/Staden/read/files.c | 104 +
src/Staden/read/find.c | 103 +
src/Staden/read/fpoint.c | 68 +
src/Staden/read/fpoint.h | 20 +
src/Staden/read/mach-io.c | 197 +
src/Staden/read/mach-io.h | 112 +
src/Staden/read/misc.h | 120 +
src/Staden/read/misc_scf.c | 281 +
src/Staden/read/open_trace_file.c | 467 +
src/Staden/read/open_trace_file.h | 53 +
src/Staden/read/os.h | 117 +
src/Staden/read/plain.h | 51 +
src/Staden/read/read_alloc.c | 271 +
src/Staden/read/read_scf.c | 462 +
src/Staden/read/scf.h | 435 +
src/Staden/read/scf_extras.c | 234 +
src/Staden/read/scf_extras.h | 22 +
src/Staden/read/seqIOABI.c | 1084 ++
src/Staden/read/seqIOABI.h | 133 +
src/Staden/read/seqIOALF.c | 425 +
src/Staden/read/seqIOCTF.c | 101 +
src/Staden/read/seqIOCTF.h | 36 +
src/Staden/read/seqIOPlain.c | 249 +
src/Staden/read/strings.c | 168 +
src/Staden/read/tar_format.h | 62 +
src/Staden/read/traceType.c | 229 +
src/Staden/read/traceType.h | 76 +
src/Staden/read/translate.c | 887 ++
src/Staden/read/translate.h | 92 +
src/Staden/read/write_scf.c | 461 +
src/Staden/read/xalloc.c | 74 +
src/Staden/read/xalloc.h | 24 +
src/Staden/read/ztr.c | 771 ++
src/Staden/read/ztr.h | 121 +
src/Staden/read/ztr_translate.c | 890 ++
src/Tigger/Contig.hh | 31 +
src/Tigger/Makefile.am | 29 +
src/Tigger/Makefile.in | 585 ++
src/Tigger/Overlap.hh | 62 +
src/Tigger/Read.hh | 40 +
src/Tigger/TiggerIO.cc | 245 +
src/Tigger/Unitigger.cc | 917 ++
src/Tigger/Unitigger.hh | 80 +
src/Utils/Makefile.am | 122 +
src/Utils/Makefile.in | 833 ++
src/Utils/analyzeSNPs.cc | 435 +
src/Utils/benchmark_qual.pl | 44 +
src/Utils/benchmark_seq.pl | 167 +
src/Utils/ctgovl.pl | 270 +
src/Utils/cvgChop.pl | 407 +
src/Utils/cvgStat.cc | 527 +
src/Utils/delta2clr.pl | 146 +
src/Utils/delta2cvg.pl | 129 +
src/Utils/fasta_select_len.pl | 49 +
src/Utils/fasta_to_fastq.pl | 54 +
src/Utils/fastq_rename.pl | 63 +
src/Utils/fastq_to_fasta_fast.pl | 16 +
src/Utils/fastqqc.pl | 233 +
src/Utils/filter_contig.pl | 52 +
src/Utils/filter_seq.pl | 150 +
src/Utils/filterfrg.pl | 69 +
src/Utils/fixfastq.pl | 50 +
src/Utils/gccontent.pl | 46 +
src/Utils/getN50.pl | 65 +
src/Utils/getlengths.pl | 45 +
src/Utils/ktrimfrg.pl | 274 +
src/Utils/listcontigreads.sh | 3 +
src/Utils/nucmer2ovl.pl | 214 +
src/Utils/nucmerAnnotate.pl | 109 +
src/Utils/ovl2OVL.pl | 78 +
src/Utils/preTA.pl | 317 +
src/Utils/preassembleFrgs.pl | 90 +
src/Utils/pullTArchive.pl | 132 +
src/Utils/recallConsensus.cc | 275 +
src/Utils/revFasta.pl | 93 +
src/Utils/runAmos.cc | 792 ++
src/Utils/runTA.pl | 145 +
src/Utils/sort2.pl | 88 +
src/Utils/stats.pl | 266 +
src/Utils/tagsum-reduce.cc | 33 +
src/Utils/translate-fasta.pl | 83 +
src/Utils/trimByOvl.cc | 289 +
src/Utils/updateDeltaClr.pl | 119 +
src/Validation/Makefile.am | 169 +
src/Validation/Makefile.in | 905 ++
src/Validation/amosvalidate.acf | 68 +
src/Validation/analyze-read-depth.cc | 306 +
src/Validation/asmQC.cc | 1852 ++++
src/Validation/asmQC2.cc | 777 ++
src/Validation/astats.cc | 383 +
src/Validation/cavalidate.acf | 38 +
src/Validation/cestat-cov.cc | 368 +
src/Validation/clusterSnps.pl | 112 +
src/Validation/coords2cam.pl | 197 +
src/Validation/find-duplicate-reads.cc | 144 +
src/Validation/find-query-breaks.pl | 305 +
src/Validation/findTcovSnp.pl | 255 +
src/Validation/fixlib.pl | 1325 +++
src/Validation/getFRCvalues.cc | 462 +
src/Validation/getFRCvalues.hh | 55 +
src/Validation/insert-sizes.cc | 374 +
src/Validation/library-histogram.cc | 235 +
src/Validation/list-linked-contigs.cc | 220 +
src/Validation/listSingletonMates.cc | 204 +
src/Validation/listSurrogates.pl | 85 +
src/Validation/postCAqc.pl | 196 +
src/Validation/read-cov-plot.cc | 173 +
src/Validation/scaffoldRange2Ungapped.cc | 220 +
src/Validation/suspiciousfeat2region.pl | 88 +
src/Validation/tiling2cam.pl | 81 +
src/hawkeye/AlignmentInfo.hh | 43 +
src/hawkeye/AssemblyStats.cc | 265 +
src/hawkeye/AssemblyStats.hh | 6 +
src/hawkeye/BufferedLineEdit.cc | 14 +
src/hawkeye/BufferedLineEdit.hh | 22 +
src/hawkeye/CGraphContig.cc | 90 +
src/hawkeye/CGraphContig.hh | 25 +
src/hawkeye/CGraphEdge.cc | 12 +
src/hawkeye/CGraphEdge.hh | 18 +
src/hawkeye/CGraphView.cc | 34 +
src/hawkeye/CGraphView.hh | 27 +
src/hawkeye/CGraphWindow.cc | 251 +
src/hawkeye/CGraphWindow.hh | 46 +
src/hawkeye/ChromoField.cc | 315 +
src/hawkeye/ChromoField.hh | 40 +
src/hawkeye/ChromoPicker.cc | 157 +
src/hawkeye/ChromoPicker.hh | 45 +
src/hawkeye/ChromoStore.cc | 169 +
src/hawkeye/ChromoStore.hh | 45 +
src/hawkeye/ConsensusField.cc | 414 +
src/hawkeye/ConsensusField.hh | 85 +
src/hawkeye/ContigCanvasItem.cc | 22 +
src/hawkeye/ContigCanvasItem.hh | 20 +
src/hawkeye/ContigPicker.cc | 310 +
src/hawkeye/ContigPicker.hh | 6 +
src/hawkeye/CoverageCanvasItem.cc | 50 +
src/hawkeye/CoverageCanvasItem.hh | 38 +
src/hawkeye/CoverageRectCanvasItem.cc | 61 +
src/hawkeye/CoverageRectCanvasItem.hh | 41 +
src/hawkeye/DetailWidget.cc | 67 +
src/hawkeye/DetailWidget.hh | 39 +
src/hawkeye/FeatureBrowser.cc | 312 +
src/hawkeye/FeatureBrowser.hh | 6 +
src/hawkeye/FeatureCanvasItem.cc | 39 +
src/hawkeye/FeatureCanvasItem.hh | 26 +
src/hawkeye/HistogramWidget.cc | 282 +
src/hawkeye/HistogramWidget.hh | 38 +
src/hawkeye/HistogramWindow.cc | 75 +
src/hawkeye/HistogramWindow.hh | 28 +
src/hawkeye/InsertCanvasItem.cc | 86 +
src/hawkeye/InsertCanvasItem.hh | 40 +
src/hawkeye/InsertField.cc | 610 ++
src/hawkeye/InsertField.hh | 87 +
src/hawkeye/InsertPosition.cc | 134 +
src/hawkeye/InsertPosition.hh | 35 +
src/hawkeye/InsertWidget.cc | 1923 ++++
src/hawkeye/InsertWidget.hh | 233 +
src/hawkeye/InsertWindow.cc | 446 +
src/hawkeye/InsertWindow.hh | 97 +
src/hawkeye/LaunchPad.cc | 524 +
src/hawkeye/LaunchPad.hh | 140 +
src/hawkeye/LaunchPadBase.cc | 619 ++
src/hawkeye/LaunchPadBase.hh | 156 +
src/hawkeye/LibraryPicker.cc | 275 +
src/hawkeye/LibraryPicker.hh | 6 +
src/hawkeye/MainWindow.cc | 512 +
src/hawkeye/MainWindow.hh | 126 +
src/hawkeye/Makefile.am | 123 +
src/hawkeye/Makefile.in | 818 ++
src/hawkeye/NChartStats.cc | 106 +
src/hawkeye/NChartStats.hh | 40 +
src/hawkeye/NChartWidget.cc | 572 ++
src/hawkeye/NChartWidget.hh | 55 +
src/hawkeye/NChartWindow.cc | 23 +
src/hawkeye/NChartWindow.hh | 17 +
src/hawkeye/NChartWindowBase.cc | 113 +
src/hawkeye/NChartWindowBase.hh | 61 +
src/hawkeye/NetworkCom.cc | 126 +
src/hawkeye/NetworkCom.hh | 78 +
src/hawkeye/OverviewField.cc | 42 +
src/hawkeye/OverviewField.hh | 36 +
src/hawkeye/QueryWidget.cc | 444 +
src/hawkeye/QueryWidget.hh | 99 +
src/hawkeye/RangeScrollBar.cc | 734 ++
src/hawkeye/RangeScrollBar.hh | 226 +
src/hawkeye/ReadInfo.cc | 51 +
src/hawkeye/ReadInfo.hh | 31 +
src/hawkeye/ReadPicker.cc | 250 +
src/hawkeye/ReadPicker.hh | 6 +
src/hawkeye/RenderSeq.cc | 344 +
src/hawkeye/RenderSeq.hh | 71 +
src/hawkeye/ScaffoldPicker.cc | 250 +
src/hawkeye/ScaffoldPicker.hh | 6 +
src/hawkeye/SelectionWidget.cc | 101 +
src/hawkeye/SelectionWidget.hh | 46 +
src/hawkeye/SplashScreen.cc | 48 +
src/hawkeye/SplashScreen.hh | 27 +
src/hawkeye/TilingField.cc | 797 ++
src/hawkeye/TilingField.hh | 92 +
src/hawkeye/TilingFrame.cc | 565 ++
src/hawkeye/TilingFrame.hh | 104 +
src/hawkeye/UIElements.cc | 169 +
src/hawkeye/UIElements.hh | 68 +
src/hawkeye/hawkeye.pro | 107 +
src/hawkeye/icons/AAI.xpm | 549 +
src/hawkeye/icons/Hawkeye.jpg | Bin 0 -> 94816 bytes
src/hawkeye/icons/Hawkeye.xpm | 562 ++
src/hawkeye/icons/fontdecrease.xpm | 23 +
src/hawkeye/icons/fontincrease.xpm | 23 +
src/hawkeye/icons/pointer_tool.xpm | 21 +
src/hawkeye/icons/rangearrow_down.png | Bin 0 -> 326 bytes
src/hawkeye/icons/rangearrow_down.xpm | 47 +
src/hawkeye/icons/rangearrow_left.png | Bin 0 -> 347 bytes
src/hawkeye/icons/rangearrow_left.xpm | 47 +
src/hawkeye/icons/rangearrow_right.png | Bin 0 -> 337 bytes
src/hawkeye/icons/rangearrow_right.xpm | 47 +
src/hawkeye/icons/rangearrow_up.png | Bin 0 -> 317 bytes
src/hawkeye/icons/rangearrow_up.xpm | 47 +
src/hawkeye/icons/rangebar_horiz.png | Bin 0 -> 242 bytes
src/hawkeye/icons/rangebar_horiz.xpm | 37 +
src/hawkeye/icons/rangebar_vert.png | Bin 0 -> 226 bytes
src/hawkeye/icons/rangebar_vert.xpm | 37 +
src/hawkeye/icons/rangegrip_down.png | Bin 0 -> 276 bytes
src/hawkeye/icons/rangegrip_down.xpm | 25 +
src/hawkeye/icons/rangegrip_left.png | Bin 0 -> 295 bytes
src/hawkeye/icons/rangegrip_left.xpm | 35 +
src/hawkeye/icons/rangegrip_right.png | Bin 0 -> 272 bytes
src/hawkeye/icons/rangegrip_right.xpm | 35 +
src/hawkeye/icons/rangegrip_up.png | Bin 0 -> 262 bytes
src/hawkeye/icons/rangegrip_up.xpm | 25 +
src/hawkeye/icons/rangegroove_horiz.png | Bin 0 -> 210 bytes
src/hawkeye/icons/rangegroove_horiz.xpm | 29 +
src/hawkeye/icons/rangegroove_vert.png | Bin 0 -> 200 bytes
src/hawkeye/icons/rangegroove_vert.xpm | 29 +
src/hawkeye/icons/zoom_in.xpm | 22 +
src/hawkeye/icons/zoom_out.xpm | 22 +
src/hawkeye/main.cc | 145 +
test/minimus/influenza-A/influenza-A.afg | 6002 +++++++++++
test/minimus/influenza-A/influenza-A.qual | 4979 +++++++++
test/minimus/influenza-A/influenza-A.seq | 1587 +++
.../influenza-A/influenza-output.bnk.old/CTG.0.fix | Bin 0 -> 176 bytes
.../influenza-A/influenza-output.bnk.old/CTG.0.var | Bin 0 -> 29764 bytes
.../influenza-A/influenza-output.bnk.old/CTG.ifo | 9 +
.../influenza-A/influenza-output.bnk.old/CTG.map | 9 +
.../influenza-A/influenza-output.bnk.old/FRG.0.fix | Bin 0 -> 3081 bytes
.../influenza-A/influenza-output.bnk.old/FRG.0.var | Bin 0 -> 79 bytes
.../influenza-A/influenza-output.bnk.old/FRG.ifo | 9 +
.../influenza-A/influenza-output.bnk.old/FRG.map | 80 +
.../influenza-A/influenza-output.bnk.old/LAY.0.fix | Bin 0 -> 144 bytes
.../influenza-A/influenza-output.bnk.old/LAY.0.var | Bin 0 -> 3008 bytes
.../influenza-A/influenza-output.bnk.old/LAY.ifo | 9 +
.../influenza-A/influenza-output.bnk.old/LAY.map | 1 +
.../influenza-A/influenza-output.bnk.old/LIB.0.fix | Bin 0 -> 1106 bytes
.../influenza-A/influenza-output.bnk.old/LIB.0.var | Bin 0 -> 711 bytes
.../influenza-A/influenza-output.bnk.old/LIB.ifo | 9 +
.../influenza-A/influenza-output.bnk.old/LIB.map | 80 +
.../influenza-A/influenza-output.bnk.old/OVL.0.fix | Bin 0 -> 23902 bytes
.../influenza-A/influenza-output.bnk.old/OVL.0.var | Bin 0 -> 703 bytes
.../influenza-A/influenza-output.bnk.old/OVL.ifo | 9 +
.../influenza-A/influenza-output.bnk.old/OVL.map | 1 +
.../influenza-A/influenza-output.bnk.old/RED.0.fix | Bin 0 -> 8305 bytes
.../influenza-A/influenza-output.bnk.old/RED.0.var | Bin 0 -> 95290 bytes
.../influenza-A/influenza-output.bnk.old/RED.ifo | 9 +
.../influenza-A/influenza-output.bnk.old/RED.map | 152 +
.../influenza-A/influenza-output.bnk.old/UNV.0.fix | Bin 0 -> 14 bytes
.../influenza-A/influenza-output.bnk.old/UNV.0.var | Bin 0 -> 69 bytes
.../influenza-A/influenza-output.bnk.old/UNV.ifo | 9 +
.../influenza-A/influenza-output.bnk.old/UNV.map | 2 +
.../influenza-A/influenza-output.bnk/CTG.0.0.fix | Bin 0 -> 208 bytes
.../influenza-A/influenza-output.bnk/CTG.0.0.var | Bin 0 -> 30364 bytes
.../influenza-A/influenza-output.bnk/CTG.0.map | 9 +
.../influenza-A/influenza-output.bnk/CTG.ifo | 10 +
.../influenza-A/influenza-output.bnk/FRG.0.0.fix | Bin 0 -> 3081 bytes
.../influenza-A/influenza-output.bnk/FRG.0.0.var | Bin 0 -> 79 bytes
.../influenza-A/influenza-output.bnk/FRG.0.map | 80 +
.../influenza-A/influenza-output.bnk/FRG.ifo | 10 +
.../influenza-A/influenza-output.bnk/LAY.0.0.fix | Bin 0 -> 144 bytes
.../influenza-A/influenza-output.bnk/LAY.0.0.var | Bin 0 -> 3608 bytes
.../influenza-A/influenza-output.bnk/LAY.0.map | 1 +
.../influenza-A/influenza-output.bnk/LAY.ifo | 10 +
.../influenza-A/influenza-output.bnk/LIB.0.0.fix | Bin 0 -> 1106 bytes
.../influenza-A/influenza-output.bnk/LIB.0.0.var | Bin 0 -> 711 bytes
.../influenza-A/influenza-output.bnk/LIB.0.map | 80 +
.../influenza-A/influenza-output.bnk/LIB.ifo | 10 +
.../influenza-A/influenza-output.bnk/OVL.0.0.fix | Bin 0 -> 23902 bytes
.../influenza-A/influenza-output.bnk/OVL.0.0.var | Bin 0 -> 703 bytes
.../influenza-A/influenza-output.bnk/OVL.0.map | 1 +
.../influenza-A/influenza-output.bnk/OVL.ifo | 10 +
.../influenza-A/influenza-output.bnk/RED.0.0.fix | Bin 0 -> 8305 bytes
.../influenza-A/influenza-output.bnk/RED.0.0.var | Bin 0 -> 190429 bytes
.../influenza-A/influenza-output.bnk/RED.0.map | 152 +
.../influenza-A/influenza-output.bnk/RED.ifo | 10 +
.../influenza-A/influenza-output.bnk/UNV.0.0.fix | Bin 0 -> 14 bytes
.../influenza-A/influenza-output.bnk/UNV.0.0.var | Bin 0 -> 69 bytes
.../influenza-A/influenza-output.bnk/UNV.0.map | 2 +
.../influenza-A/influenza-output.bnk/UNV.ifo | 10 +
test/minimus/influenza-A/influenza-output.fasta | 234 +
test/minimus/zgene/zgene2-output.bnk.old/CTG.0.fix | Bin 0 -> 352 bytes
test/minimus/zgene/zgene2-output.bnk.old/CTG.0.var | Bin 0 -> 45674 bytes
test/minimus/zgene/zgene2-output.bnk.old/CTG.ifo | 9 +
test/minimus/zgene/zgene2-output.bnk.old/CTG.map | 17 +
test/minimus/zgene/zgene2-output.bnk.old/LAY.0.fix | Bin 0 -> 288 bytes
test/minimus/zgene/zgene2-output.bnk.old/LAY.0.var | Bin 0 -> 3036 bytes
test/minimus/zgene/zgene2-output.bnk.old/LAY.ifo | 9 +
test/minimus/zgene/zgene2-output.bnk.old/LAY.map | 1 +
test/minimus/zgene/zgene2-output.bnk.old/OVL.0.fix | Bin 0 -> 26486 bytes
test/minimus/zgene/zgene2-output.bnk.old/OVL.0.var | Bin 0 -> 779 bytes
test/minimus/zgene/zgene2-output.bnk.old/OVL.ifo | 9 +
test/minimus/zgene/zgene2-output.bnk.old/OVL.map | 1 +
test/minimus/zgene/zgene2-output.bnk.old/RED.0.fix | Bin 0 -> 8415 bytes
test/minimus/zgene/zgene2-output.bnk.old/RED.0.var | Bin 0 -> 104217 bytes
test/minimus/zgene/zgene2-output.bnk.old/RED.ifo | 9 +
test/minimus/zgene/zgene2-output.bnk.old/RED.map | 154 +
test/minimus/zgene/zgene2-output.bnk.old/UNV.0.fix | Bin 0 -> 14 bytes
test/minimus/zgene/zgene2-output.bnk.old/UNV.0.var | Bin 0 -> 69 bytes
test/minimus/zgene/zgene2-output.bnk.old/UNV.ifo | 9 +
test/minimus/zgene/zgene2-output.bnk.old/UNV.map | 2 +
test/minimus/zgene/zgene2-output.bnk/CTG.0.0.fix | Bin 0 -> 416 bytes
test/minimus/zgene/zgene2-output.bnk/CTG.0.0.var | Bin 0 -> 46278 bytes
test/minimus/zgene/zgene2-output.bnk/CTG.0.map | 17 +
test/minimus/zgene/zgene2-output.bnk/CTG.ifo | 10 +
test/minimus/zgene/zgene2-output.bnk/LAY.0.0.fix | Bin 0 -> 288 bytes
test/minimus/zgene/zgene2-output.bnk/LAY.0.0.var | Bin 0 -> 3640 bytes
test/minimus/zgene/zgene2-output.bnk/LAY.0.map | 1 +
test/minimus/zgene/zgene2-output.bnk/LAY.ifo | 10 +
test/minimus/zgene/zgene2-output.bnk/OVL.0.0.fix | Bin 0 -> 26486 bytes
test/minimus/zgene/zgene2-output.bnk/OVL.0.0.var | Bin 0 -> 779 bytes
test/minimus/zgene/zgene2-output.bnk/OVL.0.map | 1 +
test/minimus/zgene/zgene2-output.bnk/OVL.ifo | 10 +
test/minimus/zgene/zgene2-output.bnk/RED.0.0.fix | Bin 0 -> 8415 bytes
test/minimus/zgene/zgene2-output.bnk/RED.0.0.var | Bin 0 -> 208281 bytes
test/minimus/zgene/zgene2-output.bnk/RED.0.map | 154 +
test/minimus/zgene/zgene2-output.bnk/RED.ifo | 10 +
test/minimus/zgene/zgene2-output.bnk/UNV.0.0.fix | Bin 0 -> 14 bytes
test/minimus/zgene/zgene2-output.bnk/UNV.0.0.var | Bin 0 -> 69 bytes
test/minimus/zgene/zgene2-output.bnk/UNV.0.map | 2 +
test/minimus/zgene/zgene2-output.bnk/UNV.ifo | 10 +
test/minimus/zgene/zgene2-output.fasta | 373 +
test/minimus/zgene/zgene2.afg | 4987 +++++++++
test/minimus/zgene/zgene2.afg.runAmos.log.orig | 66 +
test/minimus/zgene/zgene2.seq | 1955 ++++
823 files changed, 249601 insertions(+)
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..5522e54
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,22 @@
+AMOS authors
+Primary contact <amos-help at lists.sourceforge.net>
+
+The following individuals have contributed to the source-base of AMOS,
+listed alphabetically.
+
+ Arthur Delcher
+ Adam Phillippy
+ Mihai Pop
+ Mike Roberts
+ Michael Schatz
+ Dan Sommer
+
+Parts of the Staden IO_lib software have been integrated into AMOS,
+the authors of the original software are:
+
+ James Bonfield
+ Simon Dear
+ Rodger Staden
+
+
+May 2005
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..7cb8b7b
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,114 @@
+The Artistic License
+
+Preamble
+
+The intent of this document is to state the conditions under which a
+Package may be copied, such that the Copyright Holder maintains some
+semblance of artistic control over the development of the package,
+while giving the users of the package the right to use and distribute
+the Package in a more-or-less customary fashion, plus the right to
+make reasonable modifications.
+
+Definitions:
+ * "Package" refers to the collection of files distributed by the
+ Copyright Holder, and derivatives of that collection of files
+ created through textual modification.
+ * "Standard Version" refers to such a Package if it has not been
+ modified, or has been modified in accordance with the wishes of
+ the Copyright Holder.
+ * "Copyright Holder" is whoever is named in the copyright or
+ copyrights for the package.
+ * "You" is you, if you're thinking about copying or distributing
+ this Package.
+ * "Reasonable copying fee" is whatever you can justify on the
+ basis of media cost, duplication charges, time of people
+ involved, and so on. (You will not be required to justify it to
+ the Copyright Holder, but only to the computing community at
+ large as a market that must bear the fee.)
+ * "Freely Available" means that no fee is charged for the item
+ itself, though there may be fees involved in handling the
+ item. It also means that recipients of the item may redistribute
+ it under the same conditions they received it.
+
+1. You may make and give away verbatim copies of the source form of
+ the Standard Version of this Package without restriction, provided
+ that you duplicate all of the original copyright notices and
+ associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications
+ derived from the Public Domain or from the Copyright Holder. A
+ Package modified in such a way shall still be considered the
+ Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way,
+ provided that you insert a prominent notice in each changed file
+ stating how and when you changed that file, and provided that you
+ do at least ONE of the following:
+
+ a) place your modifications in the Public Domain or otherwise make
+ them Freely Available, such as by posting said modifications to
+ Usenet or an equivalent medium, or placing the modifications on a
+ major archive site such as ftp.uu.net, or by allowing the
+ Copyright Holder to include your modifications in the Standard
+ Version of the Package.
+
+ b) use the modified Package only within your corporation or
+ organization.
+
+ c) rename any non-standard executables so the names do not
+ conflict with standard executables, which must also be provided,
+ and provide a separate manual page for each non-standard
+ executable that clearly documents how it differs from the Standard
+ Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or
+ executable form, provided that you do at least ONE of the
+ following:
+
+ a) distribute a Standard Version of the executables and library
+ files, together with instructions (in the manual page or
+ equivalent) on where to get the Standard Version.
+
+ b) accompany the distribution with the machine-readable source of
+ the Package with your modifications.
+
+ c) accompany any non-standard executables with their corresponding
+ Standard Version executables, giving the non-standard executables
+ non-standard names, and clearly documenting the differences in
+ manual pages (or equivalent), together with instructions on where
+ to get the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of
+ this Package. You may charge any fee you choose for support of this
+ Package. You may not charge a fee for this Package itself. However,
+ you may distribute this Package in aggregate with other (possibly
+ commercial) programs as part of a larger (possibly commercial)
+ software distribution provided that you do not advertise this
+ Package as a product of your own.
+
+6. The scripts and library files supplied as input to or produced as
+ output from the programs of this Package do not automatically fall
+ under the copyright of this Package, but belong to whomever
+ generated them, and may be sold commercially, and may be aggregated
+ with this Package.
+
+7. C or perl subroutines supplied by you and linked into this Package
+ shall not be considered part of this Package.
+
+8. The name of the Copyright Holder may not be used to endorse or
+ promote products derived from this software without specific prior
+ written permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES
+ OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+The End
+This license is approved by the Open Source Initiative
+(www.opensource.org) for certifying software as OSI Certified Open
+Source.
+
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..2550dab
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,302 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+
+ This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+ Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+ 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, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+ 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 you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You need `configure.ac' 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.
+
+ Running `configure' might take a while. 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.
+
+ 6. Often, you can also type `make uninstall' to remove the installed
+ files again.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+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 can use 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 `..'.
+
+ With a non-GNU `make', it is safer 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.
+
+ On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor. Like
+this:
+
+ ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CPP="gcc -E" CXXCPP="g++ -E"
+
+ This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+ By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' 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.
+
+Particular systems
+==================
+
+ On HP-UX, the default C compiler is not ANSI C compatible. If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+ ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+ On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file. The option `-nodtk' can be used as
+a workaround. If GNU CC is not installed, it is therefore recommended
+to try
+
+ ./configure CC="cc"
+
+and if that doesn't work, try
+
+ ./configure CC="cc -nodtk"
+
+ On Solaris, don't put `/usr/ucb' early in your `PATH'. This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+ On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'. It is recommended to use the following options:
+
+ ./configure --prefix=/boot/common
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on. Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS
+ KERNEL-OS
+
+ 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 machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+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.
+
+Defining Variables
+==================
+
+ Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug. Until the bug is fixed you can use this workaround:
+
+ CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+ Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+ Print a summary of the options unique to this package's
+ `configure', and exit. The `short' variant lists options used
+ only in the top level, while the `recursive' variant lists options
+ also present in any nested packages.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--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.
+
+`--prefix=DIR'
+ Use DIR as the installation prefix. *Note Installation Names::
+ for more details, including other options available for fine-tuning
+ the installation locations.
+
+`--no-create'
+`-n'
+ Run the configure checks, but stop before creating any output
+ files.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..fa435fb
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,11 @@
+##-- SUBDIRS TO RECURSE
+SUBDIRS = \
+ src \
+ doc
+
+EXTRA_DIST = test
+
+dist-hook:
+ rm -rf `find $(distdir)/test -type d -name CVS`
+
+ACLOCAL_AMFLAGS = -I config
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..d0cb4e4
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,736 @@
+# 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 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@
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+ $(top_srcdir)/configure AUTHORS COPYING INSTALL NEWS THANKS \
+ config/compile config/config.guess config/config.rpath \
+ config/config.sub config/depcomp config/install-sh \
+ config/missing config/mkinstalldirs
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir dist dist-all distcheck
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d "$(distdir)" \
+ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr "$(distdir)"; }; }
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUBDIRS = \
+ src \
+ doc
+
+EXTRA_DIST = test
+ACLOCAL_AMFLAGS = -I config
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+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: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(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: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) config.h.in $(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)
+ $(am__remove_distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
+ @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
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-hook
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -755 \
+ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r "$(distdir)"
+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 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ 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:
+ @$(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)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile config.h
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(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:
+
+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-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
+ 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 \
+ 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-hdr \
+ 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 pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+
+dist-hook:
+ rm -rf `find $(distdir)/test -type d -name CVS`
+
+# 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/NEWS b/NEWS
new file mode 100644
index 0000000..df18243
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,124 @@
+Welcome to AMOS Assembler. A Modular Open Source Assembler.
+website: <http://amos.sourceforge.net>
+contact: <amos-help at lists.sourceforge.net>
+
+AMOS Assembler NEWS
+===================
+The AMOS consortium is committed to the development of open-source whole genome
+assembly software. The project acronym (AMOS) represents our primary goal -- to
+produce A Modular, Open-Source whole genome assembler. Open-source so that everyone
+is welcome to contribute and help build outstanding assembly tools, and modular in
+nature so that new contributions can be easily inserted into an existing assembly
+pipeline. This modular design will foster the development of new assembly algorithms
+and allow the AMOS project to continually grow and improve in hopes of eventually
+becoming a widely accepted and deployed assembly infrastructure. In this sense,
+AMOS is both a design philosophy and a software system.
+
+
+Version Release History
+=======================
+
+Version 3.1.0 - August 2011
+ * Versioning of AMOS Banks -- all old banks require rebulding
+ * Sample data available at: http://sourceforge.net/projects/amos/files/sample_data/
+ * Added FRCurve pipeline for comparing multiple assemblies of the same data: http://amos.sf.net/frcurve/
+ * New version of Hawkeye using Qt 4 (removed Qt 3 version completely)
+ * make-consensus now handles ambiguous N bases (reported by Mark Rose).
+ * Moved undocumented/prototype code into Experimental directory. Use configure --enable-Experimental to build
+ * Many small updates and bug fixes
+
+Version 3.0.0 - December 2010
+
+ * New version of the scaffolder, Bambus 2.0
+ * New lightweight, parametrable assembler based on Minimus, Minimo
+ * Experimental support for Qt 4 in Hawkeye
+ * Updated unitigger for Minimus, Unitigger
+ * Compute the complexity of a genome with genome-complexity (http://www.biomedcentral.com/1471-2105/11/21)
+ * Utility that can convert large fastq files into a bank, fast2amos
+ * Ability to build only core AMOS binaries with Autoconf
+ * Support for writing SAM format in bank2contig
+ * toAmos now automatically reads mate pairs in FASTA files (reads ending in /1 or .1)
+ * libSlice - correctly compute consensus even with very deep coverage
+ * Many small updates and bug fixes
+
+Version 2.0.5 - March 2008
+
+ * `amosvalidate' assembly validation pipeline released
+
+Version 1.3.1 - June 2005
+
+ * minor release for OSX Tiger and GCC 4.0 compatibility
+ * `AMOScmp' administrative updates
+
+Version 1.3.0 - May 2005
+
+ * `bankViewer' first version released
+ * provides GUI interface for AMOS bank browsing
+ * `libAMOS'
+ * Matepair_t replaced with extra field in Fragment_t
+ * Group_t added for object groups
+ * Link_t added for general object links
+ * Edge_t added for general object edges
+ * Index_t added for object IID indexing
+ * Feature_t object modifed to be more general
+ * Universal_t gained extra status char
+ * ReverseComplement() method added
+ * `tigger' efficiency enhancement
+ * `AmosFoundation.pm' added
+ * `libread' Staden trace IO library packaged
+
+Version 1.2.9 - February 2005
+
+ * `tarchive2amos' bug fixes
+ * `amos2ace' bug fixes
+ * `hash-overlap' self-overlap bug fixed
+ * `tigger' now ignores self-overlaps
+
+Version 1.2.8 - January 2005
+
+ * `minimus'
+ * circular contig bug fixed
+ * layout bug fixed
+ * multiple overlaps between two reads bug fixed
+ * `libAMOS'
+ * Bank_t map partition now a plaintext tab-delimited file
+ * Message_t read() bug fixed
+ * IDMap_t remove() bug fixed
+ * BankStream_t operator()>> bug fixed
+ * `bank-unlock' and `bank-clean' utilities added
+ * `bank-*' tools now report progress
+ * `toAmos' bug fix
+ * `tarchive2amos' bug fix
+ * `amos2ace' bug fix
+
+Version 1.2.7 - November 2004
+
+ * `AMOScmp'
+ * improved conflict resolution
+ * operates on an AMOS bank
+ * `libAMOS'
+ * Feature_t added to Contig_t and Scaffold_t
+ * BankSet_t, BankStreamSet_t, UniversalSet_t added
+ * read/write locks added to Bank_t
+ * Message_t iterator added
+ * documentation updated
+
+Version 1.2.6 - September 2004
+
+ * `minimus' negative offset bug fixed
+ * `make-consensus' ID swapping bug fixed
+ * `AMOScmp' won't bomb if mate information absent from the bank
+
+Version 1.2.5 - September 2004
+
+ * Added `minimus' pipeline for lightweight assembly tasks.
+ * Improved portablity.
+ * Added --enable-FEATURE options to configure for conditional
+ builds.
+
+Version 1.2.3 - August 2004
+
+ * First official release of the AMOS distribution, much work
+ yet to be done.
+ * Added `AMOScmp' comparative assembly pipeline.
+
diff --git a/README b/README
new file mode 100644
index 0000000..b46d3b3
--- /dev/null
+++ b/README
@@ -0,0 +1,199 @@
+Welcome to AMOS Assembler. A Modular Open Source Assembler.
+website: <http://amos.sourceforge.net>
+contact: <amos-help at lists.sourceforge.net>
+
+ AMOS is open source software. Please see the `COPYING' file for
+details. For documentation, please refer to the Documentation
+section. For building and installation instructions please see the
+Installation section.
+
+
+Brief Summary
+=============
+
+ The AMOS consortium is committed to the development of open-source
+whole genome assembly software. The project acronym (AMOS) represents
+our primary goal -- to produce A Modular, Open-Source whole genome
+assembler. Open-source so that everyone is welcome to contribute and
+help build outstanding assembly tools, and modular in nature so that
+new contributions can be easily inserted into an existing assembly
+pipeline. This modular design will foster the development of new
+assembly algorithms and allow the AMOS project to continually grow and
+improve in hopes of eventually becoming a widely accepted and deployed
+assembly infrastructure. In this sense, AMOS is both a design
+philosophy and a software system.
+
+ Because of its modular nature, AMOS cannot be described in one
+paragraph since it is a composite of many different systems. See the
+Pipeline section for quick descriptions of each pipeline, or the
+Documentation section on where to find comprehensive documentation.
+
+
+Installation
+============
+
+ Please follow the instructions in the `INSTALL' file for building
+and installation. The `INSTALL' file is only a generic installation
+document, so any AMOS specific installation notes are listed below.
+
+ Once `make install' is issued, the installed scripts and Perl
+modules must not be moved. Thus, convince yourself of the installation
+directory beforehand and set the $PREFIX variable for `configure'
+accordingly. AMOS makes use of a few custom installation directories
+not mentioned in `INSTALL', they are as follows. $datadir, $libdir and
+$includedir are set by `configure', see `configure --help' for more
+information.
+
+ - Documentation will be installed in $datadir/doc/amos-[version]
+ - AMOS libraries and Perl modules will be installed in $libdir/AMOS
+ - TIGR libraries and Perl modules will be installed in $libdir/TIGR
+ - AMOS headers will be installed in $includedir/AMOS
+ - TIGR headers will be installed in $includedir/TIGR
+
+ In addition, certain parts of the AMOS package require the X
+windowing system along with the Qt libraries. Parameters for these
+packages may be modified with the following options:
+
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+ --with-x use the X Window System
+ --with-Boost-dir=DIR Directory in which to find the ./boost folder for the
+ Boost toolkit
+ --with-qmake-qt4=DIR Path to qmake using Qt version 4.x
+
+Please see the INSTALL file for more information and Cygwin and OS X
+specific instructions.
+
+Dependencies
+============
+
+ The AMOS package makes use of Python and Perl (Practical Extraction
+and Report Language). Python and Perl are available on most systems
+and the latest versions can be downloaded free of charge. AMOS
+requires Perl version 5.6.0 or later. If `perl' or `python' are
+available from your system PATH, all is well, if not you will need to
+instruct `configure' where they are located by setting the
+environment variable PERL and PYTHON to the full path of `perl' and
+`python' respectively (see the Defining Variables section in the
+`INSTALL' file). Some Perl scripts in the AMOS package require
+additional modules that you should install:
+ DBI (http://search.cpan.org/~timb/DBI/)
+ Statistics::Descriptive (http://search.cpan.org/~shlomif/Statistics-Descriptive-3.0100/)
+ XML::Parser (http://search.cpan.org/~msergeant/XML-Parser-2.36/)
+
+ AMOScmp and minimus2 make use of the NUCmer whole genome alignment
+utility which is part of the MUMmer package. If you wish to run AMOScmp,
+you will need download and install MUMmer (available for free from
+<http://mummer.sourceforge.net>). If `nucmer' is available from
+your system PATH, all is well, if not you will need to instruct
+`configure' where it is located by setting the environment variable
+NUCMER to the full path of `nucmer' (see the Defining Variables
+section in the `INSTALL' file).
+
+ The validation pipeline `amosvalidate' also depends on Nucmer, but
+it is not essential to the validation process. If you wish to run
+amosvalidate without the "alignment breakpoints" step, comment out
+steps 600-710 with '#' in the `amosvalidate' script.
+
+ The minimus2-blat pipeline relies on BLAT instead of nucmer.
+
+ The AMOS assembly viewer Hawkeye relies on X windows and the Qt4
+toolkit. Note that the Qt toolkit is somewhat volatile, so it is
+important to install Qt4 and not a newer or older version. If Qt is not
+centrally installed on your system, you will need to do so to make
+use of this graphical viewer. The configure script should be able
+to identify most standard Qt installations, however you may need
+to set the `--with-qmake-qt4' configure option to the location of
+your Qt package. If all else fails, you may have to build the
+viewer independently. If so, make AMOS without hawkeye, and then
+cd into the src/hawkeye directory, run 'qmake', and then 'make'.
+
+
+Documentation
+=============
+
+ Basic documentation for the individual pipelines is located in the
+`doc' subdirectory. Comprehensive documentation can be found on
+the AMOS website <http://amos.sourceforge.net>.
+
+
+Pipeline
+========
+
+ Listed here are the current AMOS pipelines available. Source files
+for the pipelines are in `src/Pipeline' and will be installed in
+$bindir as executable scripts. Please see individual documentation for
+each pipeline in the `doc' directory.
+
+ - minimus -
+ Minimus is an assembly pipeline designed specifically for small
+ data-sets, such as the set of reads covering a specific gene. Note
+ that the code will work for larger assemblies (we have used it to
+ assemble bacterial genomes), however, due to its stringency, the
+ resulting assembly will be highly fragmented. For large and/or
+ complex assemblies the execution of Minimus should be followed by
+ additional processing steps, such as scaffolding.
+
+ - Minimo -
+ Minimo uses the same assembly strategy as minimo but offers more
+ flexibility in the sequence input, output and processing.
+
+ - minimus2
+ minimus2 is an assembly pipeline designed for merging two sequence sets
+ (Example: the contigs generated by two assembly processes)
+ It uses a nucmer based overlap detector instead of the hash-overlap program
+ used by the minimus pipeline.
+
+ - minimus2-blat
+ This pipeline performs the same function as minimus2, but uses BLAT instead
+ of nucmer for the alignments, which provides a speedup.
+
+ - AMOScmp -
+ AMOScmp provides a general overlap-layout-consensus pipeline for
+ assembly, but with a twist. The overlap phase of the process is
+ replaced with an alignment to a reference, i.e. all sequencing reads
+ are aligned to a finished reference sequence and their alignments are
+ used to determine their layout position.
+
+ - AMOScmp-shortReads -
+ Modified version AMOScmp for assembling short reads
+ Differences compared to AMOScmp:
+ * smaller nucmer alignment cluster size (20 vs 65)
+ * smaller make-consensus alignment wiggle value (2 vs 15)
+
+ - AMOScmp-shortReads-alignmentTrimmed -
+ Very similar to AMOScmp-shortReads but it does a reference based alignment
+ trimming of the reads prior to the assembly.
+ Differences compared to AMOScmp-shortReads:
+ * aligns the reads to reference using nucmer
+ * determines zero coverage regions
+ * extracts the read clear ranges from the alignment(delta) file
+ * exrtends the read clear ranges for reads adjacent to zero coverage regions
+ * updates the bank with the new clear ranges
+ * updates the alignment(delta) file with the new read lengths and clear ranges
+
+ - goBambus2 -
+ goBambus2 is a pipeline to drive the Bambus2 modules, designed to
+ scaffold polymorphic and metagenomic data
+
+ - amosvalidate -
+ Amosvalidate is a validation pipeline for genome assemblies. This
+ pipeline includes a collection of methods for ascertaining the
+ quality of an assembly, and examines multiple measures of assembly
+ quality to pinpoint potential mis-assemblies. Validation techniques
+ include mate-pair validation, repeat analysis, coverage analysis,
+ identification of correlated read polymorphisms, and read alignment
+ breakpoint analysis. Regions of the assembly exhibiting multiple
+ signatures of mis-assembly are flagged as suspicious and output by
+ amosvalidate for further examination.
+
+ - hawkeye -
+ Hawkeye is a visual analytics tool for genome assembly analysis and
+ validation, designed to aid in identifying and correcting assembly
+ errors. Hawkeye blends the best practices from information and
+ scientific visualization to facilitate inspection of large-scale
+ assembly data while minimizing the time needed to detect
+ mis-assemblies and make accurate judgments of assembly quality.
+
+
+August 2011
diff --git a/THANKS b/THANKS
new file mode 100644
index 0000000..622a50c
--- /dev/null
+++ b/THANKS
@@ -0,0 +1,31 @@
+AMOS thanks
+Primary contact <amos-help at lists.sourceforge.net>
+
+The AMOS consortium would like to thank the many organizations that
+have provided funding and/or support. Here is a list of these
+organizations, listed in no particular order.
+
+ The National Institutes of Health
+ The National Science Foundation
+ The Institute for Genomic Research
+ Johns Hopkins University
+ The University of Maryland
+ Karolinksa Institutet
+ Marine Biological Laboratory - Woods Hole
+ MRC Laboratory of Molecular Biology
+
+
+In addition to the above organizations, we would also like to thank
+the following individuals for reporting problems, suggesting
+improvements or providing project direction, listed alphabetically.
+
+ Pawel Gajer
+ Wayne Hayes
+ Brian Hunt
+ Steven Salzberg
+ Martin Shumway
+ Cevat Ustun
+ James Yorke
+
+
+May 2005
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..ef5d3ea
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,957 @@
+# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 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.
+
+# 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'.])])
+
+# 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.
+
+# 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.1], [],
+ [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.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 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.
+
+# 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
+# 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 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,
+# 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'.
+ 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
+ ;;
+ 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='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])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 ;;
+ 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
+])
+
+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` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# 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.
+
+# 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"
+ 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 -*-
+
+# 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
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# 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.
+
+# serial 6
+
+# 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)])
+
+
+# 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" ;;
+ 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 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.
+
+# 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 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_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])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# 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.
+
+# serial 5
+
+# 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']);;
+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
+
+ 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 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.
+
+# 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 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
+
+# _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 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
+
+# _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.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [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])
+# 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
+ ;;
+ 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([config/amos.m4])
+m4_include([config/getopt.m4])
+m4_include([config/onceonly_2_57.m4])
+m4_include([config/perlmodules.m4])
+m4_include([config/strtod.m4])
+m4_include([config/strtol.m4])
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..6db427e
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,254 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
+/* Define to 1 if C compiler packs bits hi-order to lo-order */
+#undef BITFIELDS_HTOL
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you have the `dup2' function. */
+#undef HAVE_DUP2
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `floor' function. */
+#undef HAVE_FLOOR
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+
+/* Define to 1 if you have the `getopt_long_only' function. */
+#undef HAVE_GETOPT_LONG_ONLY
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `isascii' function. */
+#undef HAVE_ISASCII
+
+/* Define to 1 if you have the `c' library (-lc). */
+#undef HAVE_LIBC
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the `z' library (-lz). */
+#undef HAVE_LIBZ
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the `localtime' function. */
+#undef HAVE_LOCALTIME
+
+/* Define to 1 if you have the `lstat' function. */
+#undef HAVE_LSTAT
+
+/* Define to 1 if you have the `memmove' function. */
+#undef HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the `mkdir' function. */
+#undef HAVE_MKDIR
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#undef HAVE_NDIR_H
+
+/* Define to 1 if you have the `pow' function. */
+#undef HAVE_POW
+
+/* Define to 1 if you have the `rmdir' function. */
+#undef HAVE_RMDIR
+
+/* Define to 1 if you have the `sqrt' function. */
+#undef HAVE_SQRT
+
+/* Define to 1 if you have the `stat' function. */
+#undef HAVE_STAT
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#undef HAVE_STDBOOL_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strftime' function. */
+#undef HAVE_STRFTIME
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strstr' function. */
+#undef HAVE_STRSTR
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_DIR_H
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_NDIR_H
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the <vfork.h> header file. */
+#undef HAVE_VFORK_H
+
+/* Define to 1 if `fork' works. */
+#undef HAVE_WORKING_FORK
+
+/* Define to 1 if `vfork' works. */
+#undef HAVE_WORKING_VFORK
+
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to the type of arg 1 for `select'. */
+#undef SELECT_TYPE_ARG1
+
+/* Define to the type of args 2, 3 and 4 for `select'. */
+#undef SELECT_TYPE_ARG234
+
+/* Define to the type of arg 5 for `select'. */
+#undef SELECT_TYPE_ARG5
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#undef TM_IN_SYS_TIME
+
+/* Version number of package */
+#undef VERSION
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
+#endif
+
+/* Define to 1 if the X Window System is missing or not being used. */
+#undef X_DISPLAY_MISSING
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to rpl_getopt if the replacement function should be used. */
+#undef getopt
+
+/* Define to rpl_getopt_long if the replacement function should be used. */
+#undef getopt_long
+
+/* Define to rpl_getopt_long_only if the replacement function should be used.
+ */
+#undef getopt_long_only
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef mode_t
+
+/* Define to rpl_optarg if the replacement variable should be used. */
+#undef optarg
+
+/* Define to rpl_optind if the replacement variable should be used. */
+#undef optind
+
+/* Define to rpl_optopt if the replacement variable should be used. */
+#undef optopt
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to rpl_strtod if the replacement function should be used. */
+#undef strtod
+
+/* Define as `fork' if `vfork' does not work. */
+#undef vfork
diff --git a/config/amos.m4 b/config/amos.m4
new file mode 100644
index 0000000..4a9b13b
--- /dev/null
+++ b/config/amos.m4
@@ -0,0 +1,577 @@
+#-- CUSTOM AMOS MACROS --##
+
+##-- AMOS_BUILD_CONDITIONAL([NAME], [DEFAULT]) ---------------------------------
+## sets an automake conditional BUILD_NAME with --enable-NAME --disable-NAME
+## --enable-NAME or --enable-NAME=yes will set BUILD_NAME to TRUE
+## anything else will set BUILD_NAME to FALSE
+##
+AC_DEFUN([AMOS_BUILD_CONDITIONAL],
+[
+AC_ARG_ENABLE([$1],
+ AS_HELP_STRING(--enable-$1,build $1 dependencies @<:@ARG=$2@:>@),
+ [ac_cv_enable_$1=${enableval}],
+ [ac_cv_enable_$1=$2])
+AC_CACHE_CHECK([whether to build $1],
+ [ac_cv_enable_$1],
+ [ac_cv_enable_$1=$2])
+AM_CONDITIONAL([BUILD_$1],
+ [test x"${ac_cv_enable_$1}" = x"yes"])
+])
+
+
+##-- AMOS_C_BITFIELDS ----------------------------------------------------------
+## checks whether C compiler packs bits hi to lo or lo to hi. will set the
+## BITFIELDS_HTOL define if the compiler packs hi to lo, or leave undefined
+## if compiler packs lo to hi. HTOL, that is the compiler packs its bitfields
+## beginning with hi-order bits and moves onward to lo-order bits.
+##
+AC_DEFUN([AMOS_C_BITFIELDS],
+[
+AC_CACHE_CHECK([whether bitfields are packed htol],
+ ac_cv_c_bitfields_htol,
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([[
+
+ struct
+ {
+ unsigned char a : 4;
+ unsigned char b : 4;
+ } bf;
+
+ int
+ main()
+ {
+ char * p = (char *) &bf;
+ *p = 0x12;
+ if (bf.a == 1)
+ exit(0);
+ else
+ exit(-1);
+ }
+
+ ]])],
+ [ac_cv_c_bitfields_htol=yes],
+ [ac_cv_c_bitfields_htol=no],
+ [ac_cv_c_bitfields_htol=no])])
+
+if test x"$ac_cv_c_bitfields_htol" = x"yes"; then
+ AC_DEFINE(BITFIELDS_HTOL, 1,
+ [Define to 1 if C compiler packs bits hi-order to lo-order])
+fi
+])
+
+
+##-- AMOS_QT4 -------------------------------------------------------------------
+# @synopsis AMOS_QT4
+# [--with-qmake-qt4=PATH]
+#
+# @summary Search for Trolltech's Qt GUI framework.
+#
+# Modified to only search for Qt4
+#
+# The following variables are set to either "yes" or "no"
+#
+# have_qt4 // if Qt was found somewhere
+# have_qt4_test // if Qt worked
+#
+# Additionally, the following variables are exported:
+#
+# QT_CXXFLAGS
+# QT_LIBS
+# QT_MOC
+#
+# which respectively contain an "-I" flag pointing to the Qt include
+# directory (and "-DQT_THREAD_SUPPORT" when LIB is "qt-mt"), link
+# flags necessary to link with Qt and X, the name of the meta object
+# compiler and the user interface compiler both with full path, and
+# finaly the variable QTDIR as Trolltech likes to see it defined (if
+# possible).
+#
+# Example lines for Makefile.in:
+#
+# CXXFLAGS = @QT_CXXFLAGS@
+# MOC = @QT_MOC@
+#
+# After the variables have been set, a trial compile and link is
+# performed to check the correct functioning of the meta object
+# compiler. This test may fail when the different detected elements
+# stem from different releases of the Qt framework. In that case, an
+# error message is emitted and configure stops.
+#
+# No common variables such as $LIBS or $CFLAGS are polluted.
+#
+# Options:
+#
+
+# Calls AMOS_PATH_QT_DIRECT (contained in this file) as a subroutine.
+AC_DEFUN([AMOS_QT4],
+[
+ AC_REQUIRE([AC_PROG_CXX])
+ AC_REQUIRE([AC_PATH_X])
+ AC_REQUIRE([AC_PATH_XTRA])
+
+ AC_MSG_CHECKING([for Qt4])
+
+ AC_ARG_WITH([qmake-qt4], [ --with-qmake-qt4=CMD path to qmake])
+
+ if test x"$with_qmake_qt4" = x"no"; then
+ have_qt4="disabled"
+ else
+ have_qt4=no
+
+ if test x"$with_qmake_qt4" = x"yes"; then
+ with_qmake_qt4=
+ fi
+
+ if test x"$with_qmake_qt4" = x; then
+ with_qmake_qt4="`which qmake`"
+ fi
+
+ if test x"$with_qmake_qt4" != x; then
+ if test -x $with_qmake_qt4; then
+ if test `uname` == "Darwin"; then
+ with_qmake_qt4="$with_qmake_qt4 -spec macx-g++"
+ fi
+ QT_QMAKE=$with_qmake_qt4
+ have_qt4=yes
+ fi
+ fi
+ fi
+
+ AC_MSG_RESULT([$have_qt4])
+ AC_SUBST(QT_QMAKE)
+
+
+ # Check if Qt can actually be used as expected
+ AC_MSG_CHECKING(whether Qt4 works)
+ AC_CACHE_VAL(ac_cv_qt_test_result,
+ [
+ ac_cv_qt_test_result="no"
+
+ if test x"$have_qt4" = xyes; then
+ cat > amos_qt.h << EOF
+#include <QObject>
+class Test : public QObject
+{
+Q_OBJECT
+public:
+ Test() {}
+ ~Test() {}
+public slots:
+ void receive() {}
+signals:
+ void send();
+};
+EOF
+
+ cat > amos_qt.$ac_ext << EOF
+
+#include "amos_qt.h"
+#include <QApplication>
+int main( int argc, char **argv )
+{
+ QApplication app( argc, argv );
+ Test t;
+ QObject::connect( &t, SIGNAL(send()), &t, SLOT(receive()) );
+}
+EOF
+
+ cat > amos_qt.pro << EOF
+
+CONFIG += thread
+SOURCES += amos_qt.$ac_ext
+HEADERS += amos_qt.h
+QT += qt3support
+EOF
+
+ if AC_TRY_EVAL("$QT_QMAKE amos_qt.pro -o amos_qt.qmake"); then
+ ## get the make flags from the qmake derived Makefile
+ QT_CXXFLAGS=`grep ^DEFINES amos_qt.qmake | cut -f2 -d'='`
+
+ ## rewrite relative paths to become absolute
+ CWD=`pwd`
+ QT_INC=`grep ^INCPATH amos_qt.qmake | cut -f2 -d'=' | sed "s^-I../^-I$CWD/../^g"`
+ QT_CXXFLAGS="$QT_CXXFLAGS $QT_INC"
+
+ QT_LIBS=`grep ^LIBS amos_qt.qmake | cut -f2 -d'='`
+ QT_LIBS=`echo $QT_LIBS | tr ' ' '\n' | grep -v SUBLIBS | tr '\n' ' '`
+
+ ## now get the moc command from the debug output
+ $QT_QMAKE -d amos_qt.pro -o amos_qt.qmake 2> amos_qt.qmake.err
+ QT_MOC=`grep 'QMAKE_MOC ===' amos_qt.qmake.err | cut -f4 -d'='`
+
+ #echo "MCS: QT_MOC: \"$QT_MOC\""
+ #echo "MCS: QT_CXXFLAGS: \"$QT_CXXFLAGS\""
+ #echo "MCS: QT_LIBS: \"$QT_LIBS\""
+
+ if AC_TRY_EVAL("$QT_MOC amos_qt.h -o moc_amos_qt.$ac_ext"); then
+ if AC_TRY_EVAL("$CXX $QT_CXXFLAGS -c $CXXFLAGS -o moc_amos_qt.o moc_amos_qt.$ac_ext"); then
+ if AC_TRY_EVAL("$CXX $QT_CXXFLAGS -c $CXXFLAGS -o amos_qt.o amos_qt.$ac_ext"); then
+ if AC_TRY_EVAL("$CXX $LIBS -o amos_qt amos_qt.o moc_amos_qt.o $QT_LIBS"); then
+ ac_cv_qt_test_result="yes"
+ fi
+ fi
+ fi
+ fi
+ fi
+
+ if test "$ac_cv_qt_test_result" = "no"; then
+ echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD()
+ sed 's/^/| /' amos_qt.$ac_ext >&AS_MESSAGE_LOG_FD()
+ fi
+
+ fi # if have_qt4
+ ])dnl AC_CACHE_VAL ac_cv_qt_test_result
+ AC_MSG_RESULT([$ac_cv_qt_test_result])
+
+ AC_SUBST(QT_CXXFLAGS)
+ AC_SUBST(QT_LIBS)
+ AC_SUBST(QT_MOC)
+
+ rm -f amos_qt.h moc_amos_qt.$ac_ext moc_amos_qt.o \
+ amos_qt.$ac_ext amos_qt.o amos_qt \
+ amos_qt.pro amos_qt.qmake amos_qt.qmake.err
+
+ have_qt4_test=$ac_cv_qt_test_result
+])
+
+
+
+## -- AMOS LINK TO CA -------------------------------------------------------------
+# @synopsys AMOS_CA
+# [--with-CA-dir=DIR]
+#
+# @summary Directory to use for linking against CA. Used for parsing CA output.
+#
+# The following variables are set to either "yes" or "no"
+#
+# have_ca // if CA was found
+# have_ca_test // if we found the CA files we need
+#
+# Additionally, the following variables are exporteD:
+#
+# which respectively contain an -l flag for CA libraries and a -I flag for the includes.
+#
+# Options:
+#
+# --with-CA-dir=DIR: DIR is equal to $CADIR if you have followed the
+# installation instructions. Header files are in
+# DIR/../../src.
+#
+AC_DEFUN([AMOS_CA],
+[
+ AC_REQUIRE([AC_PROG_CXX])
+ AC_REQUIRE([AC_PATH_X])
+ AC_REQUIRE([AC_PATH_XTRA])
+
+ AC_MSG_CHECKING([for CA])
+
+ AC_ARG_WITH([CA-dir],
+ [ --with-CA-dir=DIR DIR is equal to CADIR if you have followed the
+ installation instructions. Header files are in DIR/../src])
+
+ if test x"$with_CA_dir" = x"no"; then
+ # user disabled Boost. Leave cache alone.
+ have_ca="disabled"
+ else
+ # "yes" is a bogus option
+ if test x"$with_CA_dir" = xyes; then
+ with_CA_dir=
+ fi
+ # check for some answers
+ if test x"$with_CA_dir" != x; then
+ amos_ca_dir="$with_CA_dir"
+ else
+ amos_ca_dir=
+ fi
+ have_ca=no
+ # Check whether we were supplied with the whole answer
+ if test x"$amos_ca_dir" != x; then
+ have_ca=yes
+ fi # all $amos_ca_* are set
+ fi # $have_ca reflects the system status
+ if test x"$have_ca" = xyes; then
+ CA_DIR="$amos_ca_dir"
+ CA_LDADD="$amos_ca_dir/lib/libCA.a"
+ CA_CXXFLAGS="-I$amos_ca_dir/../src -I$amos_ca_dir/../src/AS_MSG -I$amos_ca_dir/../src/AS_UTL -DAMOS_HAVE_CA"
+ # All variables are defined, report the result
+ AC_MSG_RESULT([$have_ca])
+ else
+ # CA was not found
+ CA_LDADD=
+ CA_CXXFLAGS=
+ CA_DIR=
+ AC_MSG_RESULT([$have_ca])
+ fi
+ AC_SUBST(CA_LDADD)
+ AC_SUBST(CA_CXXFLAGS)
+ AC_SUBST(CA_DIR)
+
+ # Check if CA can actually be used as expected
+ AC_MSG_CHECKING(whether CA works)
+ AC_CACHE_VAL(ac_cv_ca_test_result,
+ [
+ ac_cv_ca_test_result="no"
+
+ if test x"$have_ca" = xyes; then
+ cat > amos_ca_test.h << EOF
+#include <utility>
+#include "AS_MSG_pmesg.h"
+
+EOF
+
+ cat > amos_ca_main.$ac_ext << EOF
+#include "amos_ca_test.h"
+
+int main( int argc, char **argv )
+{
+ AS_MSG_setFormatVersion(1);
+
+ GenericMesg pmesg;
+ pmesg.t = MESG_FRG;
+ if (pmesg.t == MESG_FRG) {
+ return 0;
+ } else if (pmesg.t == MESG_CCO) {
+ return 1;
+ }
+}
+EOF
+
+
+ if AC_TRY_EVAL("$CXX $CA_CXXFLAGS -c $CXXFLAGS -o amos_ca_main.o amos_ca_main.$ac_ext"); then
+ if AC_TRY_EVAL("$CXX $LIBS -o amos_ca_main amos_ca_main.o $CA_LDADD"); then
+ ac_cv_ca_test_result="yes"
+ fi
+ fi
+
+ if test "$ac_cv_ca_test_result" = "no"; then
+ echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD()
+ sed 's/^/| /' amos_ca_main.$ac_ext >&AS_MESSAGE_LOG_FD()
+
+ # CA does not work turn it off
+ CA_LDADD=
+ CA_CXXFLAGS=
+ CA_DIR=
+ fi
+
+ fi # if have_ca
+
+ ])dnl AC_CACHE_VAL ac_cv_ca_test_result
+ AC_MSG_RESULT([$ac_cv_ca_test_result])
+ rm -f amos_ca_test.h amos_ca_main.$ac_ext amos_ca_main.o amos_ca_main
+
+ have_ca_test=$ac_cv_ca_test_result
+])
+
+##-- AMOS_BOOST -------------------------------------------------------------------
+# @synopsis AMOS_BOOST
+# [--with-Boost-dir=DIR]
+#
+# @summary Search for Boost Graph Library.
+#
+# Modified to only search for Boost 1.3*
+#
+# The following variables are set to either "yes" or "no"
+#
+# have_boost // if Boost was found somewhere
+# have_boost_test // if Boost worked
+#
+# Additionally, the following variables are exported:
+#
+# BOOST_CXXFLAGS
+# BOOST_DIR
+#
+# which respectively contain an "-I" flag pointing to the Qt include
+# directory (and "-DAMOS_HAVE_BOOST").
+#
+# Example lines for Makefile.in:
+#
+# CXXFLAGS = @BOOST_CXXFLAGS@
+#
+# After the variables have been set, a trial compile and link is
+# performed to check the correct functioning of the meta object
+# compiler. This test may fail when the different detected elements
+# stem from different releases of the Boost framework. In that case, an
+# error message is emitted and configure stops.
+#
+# No common variables such as $LIBS or $CFLAGS are polluted.
+#
+# Options:
+#
+# --with-Boost-dir=DIR: DIR is equal to $BOOSTDIR if you have followed the
+# installation instructions. Header files are in
+# DIR/include/boost-version.
+#
+# --with-Boost-include-dir=DIR
+
+# If some option "=no" or, equivalently, a --without-Boost-* version is
+# given in stead of a --with-Boost-*, "have_boost" is set to "no" and the
+# other variables are set to the empty string.
+
+# Calls AMOS_PATH_BOOST_DIRECT (contained in this file) as a subroutine.
+AC_DEFUN([AMOS_BOOST],
+[
+ AC_REQUIRE([AC_PROG_CXX])
+ AC_REQUIRE([AC_PATH_X])
+ AC_REQUIRE([AC_PATH_XTRA])
+
+ AC_MSG_CHECKING([for Boost])
+
+ AC_ARG_WITH([Boost-dir],
+ [ --with-Boost-dir=DIR DIR is equal to BoostDIR if you have followed the
+ installation instructions. Header files are in DIR/boost])
+
+ if test x"$with_Boost_dir" = x"no"; then
+ # user disabled Boost. Leave cache alone.
+ have_boost="disabled"
+ else
+ # "yes" is a bogus option
+ if test x"$with_Boost_dir" = xyes; then
+ with_Boost_dir=
+ fi
+ # check for some answers
+ if test x"$with_Boost_dir" != x; then
+ amos_boost_dir="$with_Boost_dir"
+ else
+ amos_boost_dir=
+ fi
+ # No Qt unless we discover otherwise
+ have_boost=no
+ # Check whether we were supplied with the whole answer
+ if test x"$amos_boost_dir" != x; then
+ have_boost=yes
+ # Use cached value or do search
+ else
+ AC_CACHE_VAL(ac_cv_have_boost,
+ [
+ # We are not given a solution and there is no cached value
+ AMOS_PATH_BOOST_DIRECT
+ if test x"$amos_boost_dir" = x; then
+ # Problem with finding complete Boost. Cache the known absence of Boost.
+ ac_cv_have_boost="have_boost=no"
+ else
+ # Record where we found Boost for the cache.
+ ac_cv_have_boost="have_boost=yes \
+ amos_boost_dir=$amos_boost_dir"
+ fi
+ ])dnl
+ eval "$ac_cv_have_boost"
+ fi # all $amos_boost_* are set
+ fi # $have_boostreflects the system status
+ if test x"$have_boost" = xyes; then
+ BOOST_CXXFLAGS="-I$amos_boost_dir -DAMOS_HAVE_BOOST"
+ BOOST_DIR="$amos_boost_dir"
+ # All variables are defined, report the result
+ AC_MSG_RESULT([$have_boost])
+ else
+ # Boost was not found
+ BOOST_CXXFLAGS=
+ BOOST_DIR=
+ AC_MSG_RESULT([$have_boost])
+ fi
+ AC_SUBST(BOOST_CXXFLAGS)
+ AC_SUBST(BOOST_DIR)
+
+ # Check if Boost can actually be used as expected
+ AC_MSG_CHECKING(whether Boost works)
+ AC_CACHE_VAL(ac_cv_boost_test_result,
+ [
+ ac_cv_boost_test_result="no"
+
+ if test x"$have_boost" = xyes; then
+ cat > amos_boost_test.h << EOF
+#include <utility>
+#include <boost/config.hpp>
+#include <boost/utility.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/strong_components.hpp>
+#include <boost/graph/graphviz.hpp>
+
+typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> Graph;
+typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;
+typedef boost::graph_traits<Graph>::edge_descriptor Edge;
+typedef boost::graph_traits<Graph>::vertex_iterator VertexIterator;
+
+EOF
+
+ cat > amos_boost_main.$ac_ext << EOF
+#include "amos_boost_test.h"
+
+int main( int argc, char **argv )
+{
+ int num_vertices = 10;
+ int num_edges = num_vertices - 1;
+
+ Graph g(num_vertices);
+ int i = 0;
+ for (i = 0; i < num_edges; i++) {
+ boost::add_edge(i, i+1, g);
+ }
+
+ // access the vertices
+ std::pair<VertexIterator, VertexIterator> iter;
+ for (iter = boost::vertices(g); iter.first != iter.second; ++iter.first) {
+ Vertex source = *iter.first;
+ }
+}
+EOF
+
+
+ if AC_TRY_EVAL("$CXX $BOOST_CXXFLAGS -c $CXXFLAGS -o amos_boost_main.o amos_boost_main.$ac_ext"); then
+ if AC_TRY_EVAL("$CXX $LIBS -o amos_boost_main amos_boost_main.o"); then
+ ac_cv_boost_test_result="yes"
+ fi
+ fi
+
+ if test "$ac_cv_boost_test_result" = "no"; then
+ echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD()
+ sed 's/^/| /' amos_boost_main.$ac_ext >&AS_MESSAGE_LOG_FD()
+
+ # Boost does not work turn it off
+ BOOST_CXXFLAGS=
+ BOOST_DIR=
+ fi
+
+ fi # if have_boost
+
+ ])dnl AC_CACHE_VAL ac_cv_boost_test_result
+ AC_MSG_RESULT([$ac_cv_boost_test_result])
+ rm -f amos_boost_test.h amos_boost_main.$ac_ext amos_boost_main.o amos_boost_main
+
+ have_boost_test=$ac_cv_boost_test_result
+])
+
+
+##-- AMOS_PATH_BOOST_DIRECT -------------------------------------------------------
+# Internal subroutine of AMOS_BOOST
+# Sets if unset:
+# amos_boost_dir
+AC_DEFUN([AMOS_PATH_BOOST_DIRECT],
+[
+ if test x"$amos_boost_dir" = x; then
+ # The following header file is expected to define BOOST_VERSION.
+ boost_direct_test_header=version.hpp
+ # Look for the header file in a standard set of common directories.
+ amos_include_path_list="
+ `ls -dr /opt/boost*/include 2>/dev/null`
+ `ls -dr /usr/local/boost*/include 2>/dev/null`
+ `ls -dr /usr/local/include/boost* 2>/dev/null`
+ `ls -dr /usr/include/boost* 2>/dev/null`
+ /usr/include
+ "
+ if test x"$BOOSTDIR" != x; then
+ amos_include_path_list="
+ $amos_include_path_list
+ $BOOSTDIR/boost
+ "
+ fi
+ for amos_dir in $amos_include_path_list; do
+ if test -r "$amos_dir/boost/$boost_direct_test_header"; then
+ amos_boost_dir="$amos_dir"
+ fi
+ done
+ fi # test $amos_boost_include_dir
+])
+
+
+##-- END OF m4 --##
diff --git a/config/amos.mk b/config/amos.mk
new file mode 100644
index 0000000..b203f06
--- /dev/null
+++ b/config/amos.mk
@@ -0,0 +1,81 @@
+##-- CUSTOM AMOS RULES --##
+
+##-- install-exec-hook
+## execute this custom rule after the global install-exec rule
+##
+install-exec-hook: install-bin-scripts-hook
+
+
+##-- uninstall-hook
+## execute this custom rule after the global uninstall rule
+##
+uninstall-hook: uninstall-bin-scripts-hook
+
+
+
+##-- install-bin-scripts-hook
+## takes list of scripts from $(dist_bin_SCRIPTS) $(bin_SCRIPTS) and:
+## 1) locates the installed script
+## 2) builds them with the below sed commands to assure the shebang and
+## include directives point to the correct locations, and that variable
+## substitution is performed as expected
+## 3) strips their suffix (e.g. ".pl")
+##
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+
+##-- uninstall-bin-scripts-hook
+## takes list of scripts from $(dist_bin_SCRIPTS) $(bin_SCRIPTS) and removes
+## their suffix-stripped versions.
+##
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+
+##-- END OF MAKEFILE --##
diff --git a/config/compile b/config/compile
new file mode 100755
index 0000000..a81e000
--- /dev/null
+++ b/config/compile
@@ -0,0 +1,136 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2003-11-09.00
+
+# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey at cygnus.com>.
+#
+# 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, 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., 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
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake at gnu.org> or send patches to
+# <automake-patches at gnu.org>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to <bug-automake at gnu.org>.
+EOF
+ exit 0
+ ;;
+ -v | --v*)
+ echo "compile $scriptversion"
+ exit 0
+ ;;
+esac
+
+
+prog=$1
+shift
+
+ofile=
+cfile=
+args=
+while test $# -gt 0; do
+ case "$1" in
+ -o)
+ # configure might choose to run compile as `compile cc -o foo foo.c'.
+ # So we do something ugly here.
+ ofile=$2
+ shift
+ case "$ofile" in
+ *.o | *.obj)
+ ;;
+ *)
+ args="$args -o $ofile"
+ ofile=
+ ;;
+ esac
+ ;;
+ *.c)
+ cfile=$1
+ args="$args $1"
+ ;;
+ *)
+ args="$args $1"
+ ;;
+ esac
+ shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+ # If no `-o' option was seen then we might have been invoked from a
+ # pattern rule where we don't need one. That is ok -- this is a
+ # normal compilation that the losing compiler can handle. If no
+ # `.c' file was seen then we are probably linking. That is also
+ # ok.
+ exec "$prog" $args
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file. Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
+while true; do
+ if mkdir $lockdir > /dev/null 2>&1; then
+ break
+ fi
+ sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir $lockdir; exit 1" 1 2 15
+
+# Run the compile.
+"$prog" $args
+status=$?
+
+if test -f "$cofile"; then
+ mv "$cofile" "$ofile"
+fi
+
+rmdir $lockdir
+exit $status
+
+# 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-end: "$"
+# End:
diff --git a/config/config.guess b/config/config.guess
new file mode 100755
index 0000000..da83314
--- /dev/null
+++ b/config/config.guess
@@ -0,0 +1,1561 @@
+#! /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
+# Free Software Foundation, Inc.
+
+timestamp='2009-04-27'
+
+# 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
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per at bothner.com>.
+# Please send patches to <config-patches at gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+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 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."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi at noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # 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
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ sh5el) machine=sh5le-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ *:SolidBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # 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'`
+ 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
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ s390x:SunOS:*:*)
+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+ eval $set_cc_for_build
+ SUN_ARCH="i386"
+ # If there is a compiler, see if it is configured for 64-bit objects.
+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+ # This test works for both compilers.
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ SUN_ARCH="x86_64"
+ fi
+ fi
+ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # 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}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # 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 ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *: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
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 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" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #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);
+
+ 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
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep __LP64__ >/dev/null
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 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 ;;
+ 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}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ 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_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ *:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ *:Interix*:[3456]*)
+ case ${UNAME_MACHINE} in
+ x86)
+ echo i586-pc-interix${UNAME_RELEASE}
+ exit ;;
+ EM64T | authenticamd | genuineintel)
+ echo x86_64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ IA64)
+ echo ia64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ esac ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ arm*:Linux:*:*)
+ eval $set_cc_for_build
+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_EABI__
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ else
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ fi
+ exit ;;
+ avr32*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+ echo cris-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo frv-unknown-linux-gnu
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ or32:Linux:*:*)
+ echo or32-unknown-linux-gnu
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
+ padre:Linux:*:*)
+ echo sparc-unknown-linux-gnu
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit ;;
+ xtensa*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^LIBC/{
+ s: ::g
+ p
+ }'`"
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ 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,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ 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.
+ # 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 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /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; } ;;
+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+ OS_REL='.3'
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ 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 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes at openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf at swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green at stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green at stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
+ echo i586-pc-haiku
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-7:SUPER-UX:*:*)
+ echo sx7-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8:SUPER-UX:*:*)
+ echo sx8-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8R:SUPER-UX:*:*)
+ echo sx8r-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ 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`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
+ i*86:AROS:*:*)
+ echo ${UNAME_MACHINE}-pc-aros
+ exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches at gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config/config.rpath b/config/config.rpath
new file mode 100755
index 0000000..4db13e5
--- /dev/null
+++ b/config/config.rpath
@@ -0,0 +1,548 @@
+#! /bin/sh
+# Output a system dependent set of variables, describing how to set the
+# run time search path of shared libraries in an executable.
+#
+# Copyright 1996-2003 Free Software Foundation, Inc.
+# Taken from GNU libtool, 2001
+# Originally by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
+#
+# 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., 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
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+#
+# The first argument passed to this file is the canonical host specification,
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# should be set by the caller.
+#
+# The set of defined variables is at the end of this script.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+# than 256 bytes, otherwise the compiler driver will dump core. The only
+# known workaround is to choose shorter directory names for the build
+# directory and/or the installation directory.
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+ wl='-Wl,'
+else
+ case "$host_os" in
+ aix*)
+ wl='-Wl,'
+ ;;
+ mingw* | pw32* | os2*)
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ wl='-Wl,'
+ ;;
+ irix5* | irix6* | nonstopux*)
+ wl='-Wl,'
+ ;;
+ newsos6)
+ ;;
+ linux*)
+ case $CC in
+ icc|ecc)
+ wl='-Wl,'
+ ;;
+ ccc)
+ wl='-Wl,'
+ ;;
+ esac
+ ;;
+ osf3* | osf4* | osf5*)
+ wl='-Wl,'
+ ;;
+ sco3.2v5*)
+ ;;
+ solaris*)
+ wl='-Wl,'
+ ;;
+ sunos4*)
+ wl='-Qoption ld '
+ ;;
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ wl='-Wl,'
+ ;;
+ sysv4*MP*)
+ ;;
+ uts4*)
+ ;;
+ esac
+fi
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
+
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+
+case "$host_os" in
+ cygwin* | mingw* | pw32*)
+ # 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
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+ case "$host_os" in
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ fi
+ ;;
+ amigaos*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # Samuel A. Falvo II <kc5tja at dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can use
+ # them.
+ ld_shlibs=no
+ ;;
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ cygwin* | mingw* | pw32*)
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ netbsd*)
+ ;;
+ solaris* | sysv5*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ sunos4*)
+ hardcode_direct=yes
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ if test "$ld_shlibs" = yes; then
+ # Unlike libtool, we use -rpath here, not --rpath, since the documented
+ # option of GNU ld is called -rpath, not --rpath.
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ fi
+else
+ case "$host_os" in
+ aix3*)
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+ aix4* | aix5*)
+ 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
+ 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].*|aix5*)
+ 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
+ fi
+ hardcode_direct=yes
+ hardcode_libdir_separator=':'
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct=yes
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ esac
+ fi
+ # Begin _LT_AC_SYS_LIBPATH_AIX.
+ echo 'int main () { return 0; }' > conftest.c
+ ${CC} ${LDFLAGS} conftest.c -o conftest
+ aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+ if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+ fi
+ if test -z "$aix_libpath"; then
+ aix_libpath="/usr/lib:/lib"
+ fi
+ rm -f conftest.c conftest
+ # End _LT_AC_SYS_LIBPATH_AIX.
+ if test "$aix_use_runtimelinking" = yes; then
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ else
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ fi
+ fi
+ ;;
+ amigaos*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+ bsdi4*)
+ ;;
+ cygwin* | mingw* | pw32*)
+ # 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.
+ hardcode_libdir_flag_spec=' '
+ libext=lib
+ ;;
+ darwin* | rhapsody*)
+ if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then
+ hardcode_direct=no
+ fi
+ ;;
+ dgux*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ ;;
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+ freebsd2.2*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ freebsd2*)
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ ;;
+ freebsd*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ hpux9*)
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ hpux10* | hpux11*)
+ if test "$with_gnu_ld" = no; then
+ case "$host_cpu" in
+ hppa*64*)
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=no
+ ;;
+ ia64*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=no
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ *)
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+ irix5* | irix6* | nonstopux*)
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ netbsd*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ newsos6)
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ openbsd*)
+ hardcode_direct=yes
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ else
+ case "$host_os" in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ osf3*)
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ osf4* | osf5*)
+ if test "$GCC" = yes; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ # Both cc and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ hardcode_libdir_separator=:
+ ;;
+ sco3.2v5*)
+ ;;
+ solaris*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ sunos4*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ ;;
+ sysv4)
+ case $host_vendor in
+ sni)
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ hardcode_direct=no
+ ;;
+ motorola)
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ ;;
+ sysv4.3*)
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ ld_shlibs=yes
+ fi
+ ;;
+ sysv4.2uw2*)
+ hardcode_direct=yes
+ hardcode_minus_L=no
+ ;;
+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*)
+ ;;
+ sysv5*)
+ hardcode_libdir_flag_spec=
+ ;;
+ uts4*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
+libname_spec='lib$name'
+case "$host_os" in
+ aix3*)
+ ;;
+ aix4* | aix5*)
+ ;;
+ amigaos*)
+ ;;
+ beos*)
+ ;;
+ bsdi4*)
+ ;;
+ cygwin* | mingw* | pw32*)
+ shrext=.dll
+ ;;
+ darwin* | rhapsody*)
+ shrext=.dylib
+ ;;
+ dgux*)
+ ;;
+ freebsd1*)
+ ;;
+ freebsd*)
+ ;;
+ gnu*)
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case "$host_cpu" in
+ ia64*)
+ shrext=.so
+ ;;
+ hppa*64*)
+ shrext=.sl
+ ;;
+ *)
+ shrext=.sl
+ ;;
+ esac
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case "$host_os" in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+ *) libsuff= shlibsuff= ;;
+ esac
+ ;;
+ esac
+ ;;
+ linux*oldld* | linux*aout* | linux*coff*)
+ ;;
+ linux*)
+ ;;
+ netbsd*)
+ ;;
+ newsos6)
+ ;;
+ nto-qnx)
+ ;;
+ openbsd*)
+ ;;
+ os2*)
+ libname_spec='$name'
+ shrext=.dll
+ ;;
+ osf3* | osf4* | osf5*)
+ ;;
+ sco3.2v5*)
+ ;;
+ solaris*)
+ ;;
+ sunos4*)
+ ;;
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ ;;
+ sysv4*MP*)
+ ;;
+ uts4*)
+ ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+
+sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
+
+# How to pass a linker flag through the compiler.
+wl="$escaped_wl"
+
+# Static library suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally "so").
+shlibext="$shlibext"
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator="$hardcode_libdir_separator"
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct="$hardcode_direct"
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L="$hardcode_minus_L"
+
+EOF
diff --git a/config/config.sub b/config/config.sub
new file mode 100755
index 0000000..a39437d
--- /dev/null
+++ b/config/config.sub
@@ -0,0 +1,1686 @@
+#! /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
+# Free Software Foundation, Inc.
+
+timestamp='2009-04-17'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# 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
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches at gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 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."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# 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-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/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | 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 \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fido | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | lm32 \
+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
+ | maxq | mb | microblaze | mcore | mep | metag \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64octeon | mips64octeonel \
+ | mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | moxie \
+ | mt \
+ | msp430 \
+ | nios | nios2 \
+ | ns16k | ns32k \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | 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 | strongarm \
+ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | z8k | z80)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+ ms1)
+ basic_machine=mt-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.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | 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-* \
+ | bfin-* | bs2000-* \
+ | 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-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | lm32-* \
+ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64octeon-* | mips64octeonel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | mt-* \
+ | msp430-* \
+ | nios-* | nios2-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | 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-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa*-* \
+ | ymp-* \
+ | z8k-* | z80-*)
+ ;;
+ # Recognize the basic CPU types without company name, with glob match.
+ xtensa*)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aros)
+ basic_machine=i386-pc
+ os=-aros
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ blackfin)
+ basic_machine=bfin-unknown
+ os=-linux
+ ;;
+ blackfin-*)
+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ cegcc)
+ basic_machine=arm-unknown
+ os=-cegcc
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16)
+ basic_machine=cr16-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dicos)
+ basic_machine=i686-pc
+ os=-dicos
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ 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
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m68knommu)
+ basic_machine=m68k-unknown
+ os=-linux
+ ;;
+ m68knommu-*)
+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ os=-mingw32ce
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ parisc)
+ basic_machine=hppa-unknown
+ os=-linux
+ ;;
+ parisc-*)
+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rdos)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sde)
+ basic_machine=mipsisa32-sde
+ os=-elf
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh5el)
+ basic_machine=sh5le-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ 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
+ ;;
+ tile*)
+ basic_machine=tile-unknown
+ os=-linux-gnu
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ z80-*-coff)
+ basic_machine=z80-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -kopensolaris* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* | -aros* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* | -cegcc* \
+ | -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* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -dicos*)
+ os=-dicos
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ score-*)
+ os=-elf
+ ;;
+ spu-*)
+ os=-elf
+ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mep-*)
+ os=-elf
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config/depcomp b/config/depcomp
new file mode 100755
index 0000000..df8eea7
--- /dev/null
+++ b/config/depcomp
@@ -0,0 +1,630 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2009-04-28.21; # UTC
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 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
+# the Free Software Foundation; either version 2, 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/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# 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 outputing 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
+
+# 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|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ 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
+
+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
+ "$@"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$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.
+## 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 '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # 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
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> "$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"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+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$//'`
+ 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=$?
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ 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"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ 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
+ # 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
+ # 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$//'`
+
+ 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"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ 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"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#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
+ ;;
+ 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"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## 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 '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+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" "$@"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$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.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+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
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+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
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E 2>/dev/null |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ 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 "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+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/config/getopt.m4 b/config/getopt.m4
new file mode 100644
index 0000000..5ab3570
--- /dev/null
+++ b/config/getopt.m4
@@ -0,0 +1,47 @@
+# getopt.m4 serial 3
+dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+# The getopt module assume you want GNU getopt, with getopt_long etc,
+# rather than vanilla POSIX getopt. This means your your code should
+# always include <getopt.h> for the getopt prototypes.
+
+AC_DEFUN([gl_GETOPT_SUBSTITUTE],
+[
+ GETOPT_H=getopt.h
+ AC_LIBOBJ([getopt])
+ AC_LIBOBJ([getopt1])
+ AC_DEFINE([optarg], [rpl_optarg],
+ [Define to rpl_optarg if the replacement variable should be used.])
+ AC_DEFINE([optind], [rpl_optind],
+ [Define to rpl_optind if the replacement variable should be used.])
+ AC_DEFINE([optopt], [rpl_optopt],
+ [Define to rpl_optopt if the replacement variable should be used.])
+ AC_DEFINE([getopt], [rpl_getopt],
+ [Define to rpl_getopt if the replacement function should be used.])
+ AC_DEFINE([getopt_long], [rpl_getopt_long],
+ [Define to rpl_getopt_long if the replacement function should be used.])
+ AC_DEFINE([getopt_long_only], [rpl_getopt_long_only],
+ [Define to rpl_getopt_long_only if the replacement function should be used.])
+ AC_SUBST([GETOPT_H])
+])
+
+AC_DEFUN([gl_GETOPT],
+[
+ gl_PREREQ_GETOPT
+
+ GETOPT_H=
+ AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
+ AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
+
+ if test -n "$GETOPT_H"; then
+ gl_GETOPT_SUBSTITUTE
+ fi
+])
+
+# Prerequisites of lib/getopt*.
+AC_DEFUN([gl_PREREQ_GETOPT], [:])
diff --git a/config/install-sh b/config/install-sh
new file mode 100755
index 0000000..6781b98
--- /dev/null
+++ b/config/install-sh
@@ -0,0 +1,520 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2009-04-28.21; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" "" $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t) dst_arg=$2
+ shift;;
+
+ -T) no_target_directory=true;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dst_arg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writeable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ -*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ eval "$initialize_posix_glob"
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
+ shift
+ $posix_glob set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test -z "$d" && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob set +f &&
+
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# 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/config/missing b/config/missing
new file mode 100755
index 0000000..28055d2
--- /dev/null
+++ b/config/missing
@@ -0,0 +1,376 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2009-04-28.21; # UTC
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 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
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, 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/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ autom4te touch the output file, or create a stub one
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ 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
+\`g' are ignored when checking the name.
+
+Send bug reports to <bug-automake at gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
+case $1 in
+ lex*|yacc*)
+ # 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.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $program in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case $f in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te*)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison*|yacc*)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f y.tab.h; then
+ echo >y.tab.h
+ fi
+ if test ! -f y.tab.c; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex*|flex*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f lex.yy.c; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit $?
+ fi
+ ;;
+
+ makeinfo*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '
+ /^@setfilename/{
+ s/.* \([^ ]*\) *$/\1/
+ p
+ q
+ }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ 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.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# 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/config/mkinstalldirs b/config/mkinstalldirs
new file mode 100755
index 0000000..4191a45
--- /dev/null
+++ b/config/mkinstalldirs
@@ -0,0 +1,162 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+
+scriptversion=2009-04-28.21; # UTC
+
+# Original author: Noah Friedman <friedman at prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain.
+#
+# This file is maintained in Automake, please report
+# bugs to <bug-automake at gnu.org> or send patches to
+# <automake-patches at gnu.org>.
+
+nl='
+'
+IFS=" "" $nl"
+errstatus=0
+dirmode=
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
+
+Create each directory DIR (with mode MODE, if specified), including all
+leading file name components.
+
+Report bugs to <bug-automake at gnu.org>."
+
+# process command line arguments
+while test $# -gt 0 ; do
+ case $1 in
+ -h | --help | --h*) # -h for help
+ echo "$usage"
+ exit $?
+ ;;
+ -m) # -m PERM arg
+ shift
+ test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+ dirmode=$1
+ shift
+ ;;
+ --version)
+ echo "$0 $scriptversion"
+ exit $?
+ ;;
+ --) # stop option processing
+ shift
+ break
+ ;;
+ -*) # unknown option
+ echo "$usage" 1>&2
+ exit 1
+ ;;
+ *) # first non-opt arg
+ break
+ ;;
+ esac
+done
+
+for file
+do
+ if test -d "$file"; then
+ shift
+ else
+ break
+ fi
+done
+
+case $# in
+ 0) exit 0 ;;
+esac
+
+# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
+# mkdir -p a/c at the same time, both will detect that a is missing,
+# one will create a, then the other will try to create a and die with
+# a "File exists" error. This is a problem when calling mkinstalldirs
+# from a parallel make. We use --version in the probe to restrict
+# ourselves to GNU mkdir, which is thread-safe.
+case $dirmode in
+ '')
+ if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ echo "mkdir -p -- $*"
+ exec mkdir -p -- "$@"
+ else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ test -d ./-p && rmdir ./-p
+ test -d ./--version && rmdir ./--version
+ fi
+ ;;
+ *)
+ if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
+ test ! -d ./--version; then
+ echo "mkdir -m $dirmode -p -- $*"
+ exec mkdir -m "$dirmode" -p -- "$@"
+ else
+ # Clean up after NextStep and OpenStep mkdir.
+ for d in ./-m ./-p ./--version "./$dirmode";
+ do
+ test -d $d && rmdir $d
+ done
+ fi
+ ;;
+esac
+
+for file
+do
+ case $file in
+ /*) pathcomp=/ ;;
+ *) pathcomp= ;;
+ esac
+ oIFS=$IFS
+ IFS=/
+ set fnord $file
+ shift
+ IFS=$oIFS
+
+ for d
+ do
+ test "x$d" = x && continue
+
+ pathcomp=$pathcomp$d
+ case $pathcomp in
+ -*) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp"
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ else
+ if test ! -z "$dirmode"; then
+ echo "chmod $dirmode $pathcomp"
+ lasterr=
+ chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+ if test ! -z "$lasterr"; then
+ errstatus=$lasterr
+ fi
+ fi
+ fi
+ fi
+
+ pathcomp=$pathcomp/
+ done
+done
+
+exit $errstatus
+
+# 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/config/onceonly_2_57.m4 b/config/onceonly_2_57.m4
new file mode 100644
index 0000000..9fc510e
--- /dev/null
+++ b/config/onceonly_2_57.m4
@@ -0,0 +1,86 @@
+# onceonly_2_57.m4 serial 3
+dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl This file defines some "once only" variants of standard autoconf macros.
+dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
+dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
+dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
+dnl AC_REQUIRE([AC_HEADER_STDC]) like AC_HEADER_STDC
+dnl The advantage is that the check for each of the headers/functions/decls
+dnl will be put only once into the 'configure' file. It keeps the size of
+dnl the 'configure' file down, and avoids redundant output when 'configure'
+dnl is run.
+dnl The drawback is that the checks cannot be conditionalized. If you write
+dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
+dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
+dnl empty, and the check will be inserted before the body of the AC_DEFUNed
+dnl function.
+
+dnl This is like onceonly.m4, except that it uses diversions to named sections
+dnl DEFAULTS and INIT_PREPARE in order to check all requested headers at once,
+dnl thus reducing the size of 'configure'. Works with autoconf-2.57. The
+dnl size reduction is ca. 9%.
+
+dnl Autoconf version 2.57 or newer is recommended.
+AC_PREREQ(2.54)
+
+# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
+# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
+AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
+ :
+ AC_FOREACH([gl_HEADER_NAME], [$1], [
+ AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
+ [./-], [___])), [
+ m4_divert_text([INIT_PREPARE],
+ [gl_header_list="$gl_header_list gl_HEADER_NAME"])
+ gl_HEADERS_EXPANSION
+ AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])),
+ [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.])
+ ])
+ AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
+ [./-], [___])))
+ ])
+])
+m4_define([gl_HEADERS_EXPANSION], [
+ m4_divert_text([DEFAULTS], [gl_header_list=])
+ AC_CHECK_HEADERS([$gl_header_list])
+ m4_define([gl_HEADERS_EXPANSION], [])
+])
+
+# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
+# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
+AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
+ :
+ AC_FOREACH([gl_FUNC_NAME], [$1], [
+ AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
+ m4_divert_text([INIT_PREPARE],
+ [gl_func_list="$gl_func_list gl_FUNC_NAME"])
+ gl_FUNCS_EXPANSION
+ AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
+ [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.])
+ ])
+ AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
+ ])
+])
+m4_define([gl_FUNCS_EXPANSION], [
+ m4_divert_text([DEFAULTS], [gl_func_list=])
+ AC_CHECK_FUNCS([$gl_func_list])
+ m4_define([gl_FUNCS_EXPANSION], [])
+])
+
+# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
+# AC_CHECK_DECLS(DECL1, DECL2, ...).
+AC_DEFUN([AC_CHECK_DECLS_ONCE], [
+ :
+ AC_FOREACH([gl_DECL_NAME], [$1], [
+ AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
+ AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
+ ])
+ AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
+ ])
+])
diff --git a/config/perlmodules.m4 b/config/perlmodules.m4
new file mode 100644
index 0000000..95e8956
--- /dev/null
+++ b/config/perlmodules.m4
@@ -0,0 +1,36 @@
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_perl_modules.html
+dnl
+AC_DEFUN([AC_PROG_PERL_MODULES],[dnl
+ac_perl_modules="$1"
+# Make sure we have perl
+if test -z "$PERL"; then
+ AC_CHECK_PROG(PERL,perl,perl)
+fi
+
+if test "x$PERL" != x; then
+ ac_perl_modules_failed=0
+ for ac_perl_module in $ac_perl_modules; do
+ AC_MSG_CHECKING(for perl module $ac_perl_module)
+
+ # Would be nice to log result here, but can't rely on autoconf internals
+ $PERL "-M$ac_perl_module" -e exit > /dev/null 2>&1
+ if test $? -ne 0; then
+ AC_MSG_RESULT(no);
+ ac_perl_modules_failed=1
+ else
+ AC_MSG_RESULT(ok);
+ fi
+ done
+
+ # Run optional shell commands
+ if test "$ac_perl_modules_failed" = 0; then
+ :
+ $2
+ else
+ :
+ $3
+ fi
+else
+ AC_MSG_WARN(could not find perl)
+fi])dnl
diff --git a/config/strtod.m4 b/config/strtod.m4
new file mode 100644
index 0000000..fb742f7
--- /dev/null
+++ b/config/strtod.m4
@@ -0,0 +1,24 @@
+# strtod.m4 serial 3
+dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_FUNC_STRTOD],
+[
+ AC_REQUIRE([AC_FUNC_STRTOD])
+ if test $ac_cv_func_strtod = no; then
+ AC_DEFINE(strtod, rpl_strtod,
+ [Define to rpl_strtod if the replacement function should be used.])
+ gl_PREREQ_STRTOD
+ fi
+])
+
+# Prerequisites of lib/strtod.c.
+# The need for pow() is already handled by AC_FUNC_STRTOD.
+AC_DEFUN([gl_PREREQ_STRTOD], [
+ AC_REQUIRE([AC_HEADER_STDC])
+ AC_CHECK_FUNCS_ONCE(isascii)
+])
diff --git a/config/strtol.m4 b/config/strtol.m4
new file mode 100644
index 0000000..7740ecc
--- /dev/null
+++ b/config/strtol.m4
@@ -0,0 +1,21 @@
+# strtol.m4 serial 2
+dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gl_FUNC_STRTOL],
+[
+ AC_REPLACE_FUNCS(strtol)
+ if test $ac_cv_func_strtol = no; then
+ gl_PREREQ_STRTOL
+ fi
+])
+
+# Prerequisites of lib/strtol.c.
+AC_DEFUN([gl_PREREQ_STRTOL], [
+ AC_REQUIRE([AC_HEADER_STDC])
+ AC_CHECK_FUNCS_ONCE(isascii)
+])
diff --git a/configure b/configure
new file mode 100755
index 0000000..c4298ff
--- /dev/null
+++ b/configure
@@ -0,0 +1,10016 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.68 for AMOS Assembler 3.1.0.
+#
+# Report bugs to <amos-help at lists.sourceforge.net>.
+#
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+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
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ 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"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ # 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+"$@"}
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf at gnu.org and
+$0: amos-help at lists.sourceforge.net about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO 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'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in #(
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+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'"
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='AMOS Assembler'
+PACKAGE_TARNAME='amos'
+PACKAGE_VERSION='3.1.0'
+PACKAGE_STRING='AMOS Assembler 3.1.0'
+PACKAGE_BUGREPORT='amos-help at lists.sourceforge.net'
+PACKAGE_URL=''
+
+ac_default_prefix=`pwd`
+ac_unique_file="src/AMOS/foundation_AMOS.hh"
+ac_config_libobj_dir=src/GNU
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+gl_func_list=
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+BUILD_BOOST_FALSE
+BUILD_BOOST_TRUE
+BUILD_QT4_FALSE
+BUILD_QT4_TRUE
+BUILD_LIBZ_FALSE
+BUILD_LIBZ_TRUE
+BUILD_all_FALSE
+BUILD_all_TRUE
+BUILD_Experimental_FALSE
+BUILD_Experimental_TRUE
+BUILD_Simulator_FALSE
+BUILD_Simulator_TRUE
+BUILD_minimus_FALSE
+BUILD_minimus_TRUE
+BUILD_AMOScmp_FALSE
+BUILD_AMOScmp_TRUE
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+POW_LIB
+GETOPT_H
+LIBOBJS
+CA_DIR
+CA_CXXFLAGS
+CA_LDADD
+BOOST_DIR
+BOOST_CXXFLAGS
+QT_MOC
+QT_LIBS
+QT_CXXFLAGS
+QT_QMAKE
+X_EXTRA_LIBS
+X_LIBS
+X_PRE_LIBS
+X_CFLAGS
+XMKMF
+EGREP
+GREP
+CPP
+RANLIB
+LN_S
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+ac_ct_CC
+CFLAGS
+CC
+am__fastdepCXX_FALSE
+am__fastdepCXX_TRUE
+CXXDEPMODE
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CXX
+CPPFLAGS
+LDFLAGS
+CXXFLAGS
+CXX
+tigrincludedir
+amosincludedir
+tigrlibdir
+amoslibdir
+BLAT
+SHOWCOORDS
+DELTAFILTER
+NUCMER
+PYTHON
+PERL
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_dependency_tracking
+enable_largefile
+with_x
+with_qmake_qt4
+with_Boost_dir
+with_CA_dir
+enable_AMOScmp
+enable_minimus
+enable_Simulator
+enable_Experimental
+enable_all
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+PERL
+PYTHON
+NUCMER
+DELTAFILTER
+SHOWCOORDS
+BLAT
+CXX
+CXXFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CCC
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+CPPFLAGS
+XMKMF'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $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}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used" >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+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 AMOS Assembler 3.1.0 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/amos]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+X features:
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of AMOS Assembler 3.1.0:";;
+ esac
+ cat <<\_ACEOF
+
+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]
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --disable-largefile omit support for large files
+ --enable-AMOScmp build AMOScmp dependencies [ARG=no]
+ --enable-minimus build minimus dependencies [ARG=no]
+ --enable-Simulator build Simulator dependencies [ARG=no]
+ --enable-Experimental build Experimental dependencies [ARG=no]
+ --enable-all build all dependencies [ARG=yes]
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-x use the X Window System
+ --with-qmake-qt4=CMD path to qmake
+ --with-Boost-dir=DIR DIR is equal to BoostDIR if you have followed the
+ installation instructions. Header files are in DIR/boost
+ --with-CA-dir=DIR DIR is equal to CADIR if you have followed the
+ installation instructions. Header files are in DIR/../src
+
+Some influential environment variables:
+ PERL perl command
+ PYTHON python command
+ NUCMER nucmer command
+ DELTAFILTER delta-filter command
+ SHOWCOORDS show-coords command
+ BLAT blat command
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CC C compiler command
+ CFLAGS C compiler flags
+ CPP C preprocessor
+ XMKMF Path to xmkmf, Makefile generator for X Window System
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <amos-help at lists.sourceforge.net>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+AMOS Assembler configure 3.1.0
+generated by GNU Autoconf 2.68
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+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_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_compile
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+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_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+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_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+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_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # 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
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+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_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { 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_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+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
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+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 :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ---------------------------------------------- ##
+## Report this to amos-help at lists.sourceforge.net ##
+## ---------------------------------------------- ##"
+ ) | sed "s/^/$as_me: WARNING: /" >&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 :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+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
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+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 :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+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
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+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 :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=no"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ eval "$3=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
+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
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+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 :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* 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 $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+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
+
+} # ac_fn_c_check_func
+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 AMOS Assembler $as_me 3.1.0, which was
+generated by GNU Autoconf 2.68. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $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; }
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+gl_func_list="$gl_func_list isascii"
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+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
+
+
+
+
+ac_aux_dir=
+for ac_dir in config "$srcdir"/config; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+
+am__api_version='1.11'
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $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 :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# 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]*)
+ 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;;
+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".
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
+alias in your environment" "$LINENO" 5
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+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"
+ esac
+fi
+
+# 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.
+if test "$cross_compiling" != no; then
+ 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
+{ $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 :
+ $as_echo_n "(cached) " >&6
+else
+ 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
+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_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
+
+fi
+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 :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+ done
+IFS=$as_save_IFS
+
+fi
+
+ test -d ./--version && rmdir ./--version
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+ [\\/$]* | ?:[\\/]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+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_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # 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_AWK="$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
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $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 :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+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
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+ 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
+
+
+# Define the identity of the package.
+ PACKAGE='amos'
+ VERSION='3.1.0'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+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.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+# allow patters relating to CA
+
+
+
+# declare some precious variables
+
+
+
+
+
+
+docdir=${datadir}/doc/${PACKAGE_TARNAME}-${PACKAGE_VERSION}
+
+amoslibdir=${libdir}/AMOS
+
+tigrlibdir=${libdir}/TIGR
+
+amosincludedir=${includedir}/AMOS
+
+tigrincludedir=${includedir}/TIGR
+
+
+# check for programs
+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 ${ac_cv_prog_CXX+:} false; 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
+
+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
+ { $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 ${ac_cv_prog_ac_ct_CXX+:} false; 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
+
+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
+ { $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
+
+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.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5
+$as_echo_n "checking whether the C++ compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+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_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+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; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5
+$as_echo_n "checking for C++ compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+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_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+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; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+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_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { 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_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ 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 run C++ compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+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 :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+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_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+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; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+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_cxx_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+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
+ 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 ${ac_cv_prog_cxx_g+:} false; 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
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+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.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+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
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+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 :
+ $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
+
+
+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 -n "$ac_tool_prefix"; then
+ # 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 :
+ $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}gcc"
+ $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
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # 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 :
+ $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="gcc"
+ $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
+
+ 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
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+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 ${ac_cv_prog_CC+:} false; 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
+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
+
+
+ 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 ${ac_cv_prog_CC+:} false; 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 ${ac_cv_prog_CC+:} false; 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 ${ac_cv_prog_ac_ct_CC+:} false; 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
+
+{ $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 :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+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 :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_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_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+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 :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+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="$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 :
+ $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_CC_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_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+for ac_prog in gawk mawk nawk awk
+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_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # 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_AWK="$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
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; 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, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+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"
+ $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
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+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 :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_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_ac_ct_RANLIB="ranlib"
+ $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_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ 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
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+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
+{ $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; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_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_c_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_c_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_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_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_c_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_c_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 \"$CPP\" 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
+
+# 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 ${ac_cv_path_PERL+:} false; 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=":"
+ ;;
+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
+
+
+# Extract the first word of "python", so it can be a program name with args.
+set dummy python; 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_path_PYTHON+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PYTHON in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PYTHON="$PYTHON" # 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_PYTHON="$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_PYTHON" && ac_cv_path_PYTHON=":"
+ ;;
+esac
+fi
+PYTHON=$ac_cv_path_PYTHON
+if test -n "$PYTHON"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
+$as_echo "$PYTHON" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "nucmer", so it can be a program name with args.
+set dummy nucmer; 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_path_NUCMER+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $NUCMER in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_NUCMER="$NUCMER" # 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_NUCMER="$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_NUCMER" && ac_cv_path_NUCMER=":"
+ ;;
+esac
+fi
+NUCMER=$ac_cv_path_NUCMER
+if test -n "$NUCMER"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NUCMER" >&5
+$as_echo "$NUCMER" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "delta-filter", so it can be a program name with args.
+set dummy delta-filter; 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_path_DELTAFILTER+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DELTAFILTER in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DELTAFILTER="$DELTAFILTER" # 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_DELTAFILTER="$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_DELTAFILTER" && ac_cv_path_DELTAFILTER=":"
+ ;;
+esac
+fi
+DELTAFILTER=$ac_cv_path_DELTAFILTER
+if test -n "$DELTAFILTER"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DELTAFILTER" >&5
+$as_echo "$DELTAFILTER" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "show-coords", so it can be a program name with args.
+set dummy show-coords; 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_path_SHOWCOORDS+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $SHOWCOORDS in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_SHOWCOORDS="$SHOWCOORDS" # 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_SHOWCOORDS="$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_SHOWCOORDS" && ac_cv_path_SHOWCOORDS=":"
+ ;;
+esac
+fi
+SHOWCOORDS=$ac_cv_path_SHOWCOORDS
+if test -n "$SHOWCOORDS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHOWCOORDS" >&5
+$as_echo "$SHOWCOORDS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "blat", so it can be a program name with args.
+set dummy blat; 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_path_BLAT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $BLAT in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_BLAT="$BLAT" # 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_BLAT="$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_BLAT" && ac_cv_path_BLAT=":"
+ ;;
+esac
+fi
+BLAT=$ac_cv_path_BLAT
+if test -n "$BLAT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BLAT" >&5
+$as_echo "$BLAT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+# initialize Python
+# AC_PROG_PYTHON()
+
+# check for Perl modules
+ac_perl_modules="Statistics::Descriptive"
+# Make sure we have perl
+if test -z "$PERL"; 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 ${ac_cv_prog_PERL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PERL"; then
+ ac_cv_prog_PERL="$PERL" # 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_PERL="perl"
+ $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
+PERL=$ac_cv_prog_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
+
+if test "x$PERL" != x; then
+ ac_perl_modules_failed=0
+ for ac_perl_module in $ac_perl_modules; do
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl module $ac_perl_module" >&5
+$as_echo_n "checking for perl module $ac_perl_module... " >&6; }
+
+ # Would be nice to log result here, but can't rely on autoconf internals
+ $PERL "-M$ac_perl_module" -e exit > /dev/null 2>&1
+ if test $? -ne 0; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; };
+ ac_perl_modules_failed=1
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; };
+ fi
+ done
+
+ # Run optional shell commands
+ if test "$ac_perl_modules_failed" = 0; then
+ :
+ LIBSTATISTICS_DESCRIPTIVE_PERL=1
+ else
+ :
+ LIBSTATISTICS_DESCRIPTIVE_PERL=0
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find perl" >&5
+$as_echo "$as_me: WARNING: could not find perl" >&2;}
+fi
+ac_perl_modules="XML::Parser"
+# Make sure we have perl
+if test -z "$PERL"; 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 ${ac_cv_prog_PERL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PERL"; then
+ ac_cv_prog_PERL="$PERL" # 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_PERL="perl"
+ $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
+PERL=$ac_cv_prog_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
+
+if test "x$PERL" != x; then
+ ac_perl_modules_failed=0
+ for ac_perl_module in $ac_perl_modules; do
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl module $ac_perl_module" >&5
+$as_echo_n "checking for perl module $ac_perl_module... " >&6; }
+
+ # Would be nice to log result here, but can't rely on autoconf internals
+ $PERL "-M$ac_perl_module" -e exit > /dev/null 2>&1
+ if test $? -ne 0; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; };
+ ac_perl_modules_failed=1
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; };
+ fi
+ done
+
+ # Run optional shell commands
+ if test "$ac_perl_modules_failed" = 0; then
+ :
+ LIBXML_PARSER_PERL=1
+ else
+ :
+ LIBXML_PARSER_PERL=0
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find perl" >&5
+$as_echo "$as_me: WARNING: could not find perl" >&2;}
+fi
+ac_perl_modules="DBI"
+# Make sure we have perl
+if test -z "$PERL"; 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 ${ac_cv_prog_PERL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PERL"; then
+ ac_cv_prog_PERL="$PERL" # 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_PERL="perl"
+ $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
+PERL=$ac_cv_prog_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
+
+if test "x$PERL" != x; then
+ ac_perl_modules_failed=0
+ for ac_perl_module in $ac_perl_modules; do
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl module $ac_perl_module" >&5
+$as_echo_n "checking for perl module $ac_perl_module... " >&6; }
+
+ # Would be nice to log result here, but can't rely on autoconf internals
+ $PERL "-M$ac_perl_module" -e exit > /dev/null 2>&1
+ if test $? -ne 0; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; };
+ ac_perl_modules_failed=1
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; };
+ fi
+ done
+
+ # Run optional shell commands
+ if test "$ac_perl_modules_failed" = 0; then
+ :
+ LIBDBI_PERL=1
+ else
+ :
+ LIBDBI_PERL=0
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find perl" >&5
+$as_echo "$as_me: WARNING: could not find perl" >&2;}
+fi
+
+# check for libraries
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5
+$as_echo_n "checking for pow in -lm... " >&6; }
+if ${ac_cv_lib_m_pow+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $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 pow ();
+int
+main ()
+{
+return pow ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_pow=yes
+else
+ ac_cv_lib_m_pow=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_m_pow" >&5
+$as_echo "$ac_cv_lib_m_pow" >&6; }
+if test "x$ac_cv_lib_m_pow" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+ LIBS="-lm $LIBS"
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fopen in -lc" >&5
+$as_echo_n "checking for fopen in -lc... " >&6; }
+if ${ac_cv_lib_c_fopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc $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 fopen ();
+int
+main ()
+{
+return fopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_c_fopen=yes
+else
+ ac_cv_lib_c_fopen=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_c_fopen" >&5
+$as_echo "$ac_cv_lib_c_fopen" >&6; }
+if test "x$ac_cv_lib_c_fopen" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBC 1
+_ACEOF
+
+ LIBS="-lc $LIBS"
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lz" >&5
+$as_echo_n "checking for main in -lz... " >&6; }
+if ${ac_cv_lib_z_main+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz $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 :
+ ac_cv_lib_z_main=yes
+else
+ ac_cv_lib_z_main=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_main" >&5
+$as_echo "$ac_cv_lib_z_main" >&6; }
+if test "x$ac_cv_lib_z_main" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBZ 1
+_ACEOF
+
+ LIBS="-lz $LIBS"
+
+fi
+
+case ${LIBS} in
+ *"-lz "*)
+ have_libz=yes
+ ;;
+esac
+
+# check for headers
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+ as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
+$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
+if eval \${$as_ac_Header+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$ac_hdr>
+
+int
+main ()
+{
+if ((DIR *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$as_ac_Header=yes"
+else
+ eval "$as_ac_Header=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$as_ac_Header
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+_ACEOF
+
+ac_header_dirent=$ac_hdr; break
+fi
+
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if ${ac_cv_search_opendir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$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 opendir ();
+int
+main ()
+{
+return opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' dir; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_opendir+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_opendir+:} false; then :
+
+else
+ ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if ${ac_cv_search_opendir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$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 opendir ();
+int
+main ()
+{
+return opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' x; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_opendir+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_opendir+:} false; then :
+
+else
+ ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+fi
+
+
+{ $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 :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_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$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_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 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "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_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_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_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $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 :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_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$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_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 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "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_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_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_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $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 :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
+$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
+if ${ac_cv_header_sys_wait_h+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+
+int
+main ()
+{
+ int s;
+ wait (&s);
+ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_sys_wait_h=yes
+else
+ ac_cv_header_sys_wait_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5
+$as_echo "$ac_cv_header_sys_wait_h" >&6; }
+if test $ac_cv_header_sys_wait_h = yes; then
+
+$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in \
+ fcntl.h \
+ inttypes.h \
+ limits.h \
+ stdlib.h \
+ unistd.h \
+
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+ as_fn_error $? "required header not found please use a supported compiler" "$LINENO" 5
+
+fi
+
+done
+
+
+# check 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 :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdbool.h>
+#ifndef bool
+ "error: bool is not defined"
+#endif
+#ifndef false
+ "error: false is not defined"
+#endif
+#if false
+ "error: false is not 0"
+#endif
+#ifndef true
+ "error: true is not defined"
+#endif
+#if true != 1
+ "error: true is not 1"
+#endif
+#ifndef __bool_true_false_are_defined
+ "error: __bool_true_false_are_defined is not defined"
+#endif
+
+ struct s { _Bool s: 1; _Bool t; } s;
+
+ char a[true == 1 ? 1 : -1];
+ 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'. */
+ char f[(_Bool) 0.0 == false ? 1 : -1];
+ char g[true];
+ char h[sizeof (_Bool)];
+ char i[sizeof s.t];
+ enum { j = false, k = true, l = false * true, m = true * 256 };
+ /* The following fails for
+ HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
+ _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];
+ /* 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
+ */
+ _Bool q = true;
+ _Bool *pq = &q;
+
+int
+main ()
+{
+
+ bool e = &s;
+ *pq |= q;
+ *pq |= ! q;
+ /* Refer to every declared value, to avoid compiler optimizations. */
+ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+ + !m + !n + !o + !p + !q + !pq);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdbool_h=yes
+else
+ ac_cv_header_stdbool_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+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 :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE__BOOL 1
+_ACEOF
+
+
+fi
+
+if test $ac_cv_header_stdbool_h = yes; then
+
+$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
+
+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 :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset cs;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *pcpcc;
+ char **ppc;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ pcpcc = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++pcpcc;
+ ppc = (char**) pcpcc;
+ pcpcc = (char const *const *) ppc;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !cs[0] && !zero.x;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_const=yes
+else
+ ac_cv_c_const=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+$as_echo "#define const /**/" >>confdefs.h
+
+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 :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default"
+if test "x$ac_cv_type_mode_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define mode_t int
+_ACEOF
+
+fi
+
+{ $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 :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <time.h>
+
+int
+main ()
+{
+struct tm tm;
+ int *p = &tm.tm_sec;
+ return !p;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_struct_tm=time.h
+else
+ ac_cv_struct_tm=sys/time.h
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5
+$as_echo "$ac_cv_struct_tm" >&6; }
+if test $ac_cv_struct_tm = sys/time.h; then
+
+$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
+$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
+if ${ac_cv_c_bigendian+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_bigendian=unknown
+ # See if we're dealing with a universal compiler.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __APPLE_CC__
+ not a universal capable compiler
+ #endif
+ typedef int dummy;
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ # Check for potential -arch flags. It is not universal unless
+ # there are at least two -arch flags with different values.
+ ac_arch=
+ ac_prev=
+ for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
+ if test -n "$ac_prev"; then
+ case $ac_word in
+ i?86 | x86_64 | ppc | ppc64)
+ if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
+ ac_arch=$ac_word
+ else
+ ac_cv_c_bigendian=universal
+ break
+ fi
+ ;;
+ esac
+ ac_prev=
+ elif test "x$ac_word" = "x-arch"; then
+ ac_prev=arch
+ fi
+ done
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ if test $ac_cv_c_bigendian = unknown; then
+ # See if sys/param.h defines the BYTE_ORDER macro.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ #include <sys/param.h>
+
+int
+main ()
+{
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
+ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
+ && LITTLE_ENDIAN)
+ bogus endian macros
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ #include <sys/param.h>
+
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_bigendian=yes
+else
+ ac_cv_c_bigendian=no
+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
+ if test $ac_cv_c_bigendian = unknown; then
+ # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
+
+int
+main ()
+{
+#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
+ bogus endian macros
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ # It does; now see whether it defined to _BIG_ENDIAN or not.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
+
+int
+main ()
+{
+#ifndef _BIG_ENDIAN
+ not big endian
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_bigendian=yes
+else
+ ac_cv_c_bigendian=no
+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
+ if test $ac_cv_c_bigendian = unknown; then
+ # Compile a test program.
+ if test "$cross_compiling" = yes; then :
+ # Try to guess by grepping values from an object file.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+short int ascii_mm[] =
+ { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+ short int ascii_ii[] =
+ { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+ int use_ascii (int i) {
+ return ascii_mm[i] + ascii_ii[i];
+ }
+ short int ebcdic_ii[] =
+ { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+ short int ebcdic_mm[] =
+ { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+ int use_ebcdic (int i) {
+ return ebcdic_mm[i] + ebcdic_ii[i];
+ }
+ extern int foo;
+
+int
+main ()
+{
+return use_ascii (foo) == use_ebcdic (foo);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
+ ac_cv_c_bigendian=yes
+ fi
+ if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+ if test "$ac_cv_c_bigendian" = unknown; then
+ ac_cv_c_bigendian=no
+ else
+ # finding both strings is unlikely to happen, but who knows?
+ ac_cv_c_bigendian=unknown
+ fi
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long int l;
+ char c[sizeof (long int)];
+ } u;
+ u.l = 1;
+ return u.c[sizeof (long int) - 1] == 1;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_c_bigendian=no
+else
+ ac_cv_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
+$as_echo "$ac_cv_c_bigendian" >&6; }
+ case $ac_cv_c_bigendian in #(
+ yes)
+ $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
+;; #(
+ no)
+ ;; #(
+ universal)
+
+$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
+
+ ;; #(
+ *)
+ as_fn_error $? "unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+ esac
+
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+ enableval=$enable_largefile;
+fi
+
+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 :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_sys_largefile_CC=no
+ if test "$GCC" != yes; then
+ ac_save_CC=$CC
+ while :; do
+ # IRIX 6.2 and later do not support large files by default,
+ # so use the C compiler's -n32 option if that helps.
+ 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 :
+ break
+fi
+rm -f core conftest.err conftest.$ac_objext
+ CC="$CC -n32"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+ break
+ done
+ CC=$ac_save_CC
+ rm -f conftest.$ac_ext
+ fi
+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 :
+ $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_large_files=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
+#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_large_files=1; 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 whether bitfields are packed htol" >&5
+$as_echo_n "checking whether bitfields are packed htol... " >&6; }
+if ${ac_cv_c_bitfields_htol+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_c_bitfields_htol=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+ struct
+ {
+ unsigned char a : 4;
+ unsigned char b : 4;
+ } bf;
+
+ int
+ main()
+ {
+ char * p = (char *) &bf;
+ *p = 0x12;
+ if (bf.a == 1)
+ exit(0);
+ else
+ exit(-1);
+ }
+
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_c_bitfields_htol=yes
+else
+ ac_cv_c_bitfields_htol=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bitfields_htol" >&5
+$as_echo "$ac_cv_c_bitfields_htol" >&6; }
+
+if test x"$ac_cv_c_bitfields_htol" = x"yes"; then
+
+$as_echo "#define BITFIELDS_HTOL 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5
+$as_echo_n "checking for X... " >&6; }
+
+
+# Check whether --with-x was given.
+if test "${with_x+set}" = set; then :
+ withval=$with_x;
+fi
+
+# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
+if test "x$with_x" = xno; then
+ # The user explicitly disabled X.
+ have_x=disabled
+else
+ case $x_includes,$x_libraries in #(
+ *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #(
+ *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # One or both of the vars are not set, and there is no cached value.
+ac_x_includes=no ac_x_libraries=no
+rm -f -r conftest.dir
+if mkdir conftest.dir; then
+ cd conftest.dir
+ cat >Imakefile <<'_ACEOF'
+incroot:
+ @echo incroot='${INCROOT}'
+usrlibdir:
+ @echo usrlibdir='${USRLIBDIR}'
+libdir:
+ @echo libdir='${LIBDIR}'
+_ACEOF
+ if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then
+ # GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+ for ac_var in incroot usrlibdir libdir; do
+ eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
+ done
+ # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
+ for ac_extension in a so sl dylib la dll; do
+ if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" &&
+ test -f "$ac_im_libdir/libX11.$ac_extension"; then
+ ac_im_usrlibdir=$ac_im_libdir; break
+ fi
+ done
+ # Screen out bogus values from the imake configuration. They are
+ # bogus both because they are the default anyway, and because
+ # using them would break gcc on systems where it needs fixed includes.
+ case $ac_im_incroot in
+ /usr/include) ac_x_includes= ;;
+ *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
+ esac
+ case $ac_im_usrlibdir in
+ /usr/lib | /usr/lib64 | /lib | /lib64) ;;
+ *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
+ esac
+ fi
+ cd ..
+ rm -f -r conftest.dir
+fi
+
+# Standard set of common directories for X headers.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+ac_x_header_dirs='
+/usr/X11/include
+/usr/X11R7/include
+/usr/X11R6/include
+/usr/X11R5/include
+/usr/X11R4/include
+
+/usr/include/X11
+/usr/include/X11R7
+/usr/include/X11R6
+/usr/include/X11R5
+/usr/include/X11R4
+
+/usr/local/X11/include
+/usr/local/X11R7/include
+/usr/local/X11R6/include
+/usr/local/X11R5/include
+/usr/local/X11R4/include
+
+/usr/local/include/X11
+/usr/local/include/X11R7
+/usr/local/include/X11R6
+/usr/local/include/X11R5
+/usr/local/include/X11R4
+
+/usr/X386/include
+/usr/x386/include
+/usr/XFree86/include/X11
+
+/usr/include
+/usr/local/include
+/usr/unsupported/include
+/usr/athena/include
+/usr/local/x11r5/include
+/usr/lpp/Xamples/include
+
+/usr/openwin/include
+/usr/openwin/share/include'
+
+if test "$ac_x_includes" = no; then
+ # Guess where to find include files, by looking for Xlib.h.
+ # First, try using that file with no special directory specified.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <X11/Xlib.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # We can compile using X headers with no special include directory.
+ac_x_includes=
+else
+ for ac_dir in $ac_x_header_dirs; do
+ if test -r "$ac_dir/X11/Xlib.h"; then
+ ac_x_includes=$ac_dir
+ break
+ fi
+done
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+fi # $ac_x_includes = no
+
+if test "$ac_x_libraries" = no; then
+ # Check for the libraries.
+ # See if we find them without any special options.
+ # Don't add to $LIBS permanently.
+ ac_save_LIBS=$LIBS
+ LIBS="-lX11 $LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <X11/Xlib.h>
+int
+main ()
+{
+XrmInitialize ()
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ LIBS=$ac_save_LIBS
+# We can link X programs with no special library path.
+ac_x_libraries=
+else
+ LIBS=$ac_save_LIBS
+for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
+do
+ # Don't even attempt the hair of trying to link an X program!
+ for ac_extension in a so sl dylib la dll; do
+ if test -r "$ac_dir/libX11.$ac_extension"; then
+ ac_x_libraries=$ac_dir
+ break 2
+ fi
+ done
+done
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi # $ac_x_libraries = no
+
+case $ac_x_includes,$ac_x_libraries in #(
+ no,* | *,no | *\'*)
+ # Didn't find X, or a directory has "'" in its name.
+ ac_cv_have_x="have_x=no";; #(
+ *)
+ # Record where we found X for the cache.
+ ac_cv_have_x="have_x=yes\
+ ac_x_includes='$ac_x_includes'\
+ ac_x_libraries='$ac_x_libraries'"
+esac
+fi
+;; #(
+ *) have_x=yes;;
+ esac
+ eval "$ac_cv_have_x"
+fi # $with_x != no
+
+if test "$have_x" != yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5
+$as_echo "$have_x" >&6; }
+ no_x=yes
+else
+ # If each of the values was on the command line, it overrides each guess.
+ test "x$x_includes" = xNONE && x_includes=$ac_x_includes
+ test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
+ # Update the cache value to reflect the command line values.
+ ac_cv_have_x="have_x=yes\
+ ac_x_includes='$x_includes'\
+ ac_x_libraries='$x_libraries'"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5
+$as_echo "libraries $x_libraries, headers $x_includes" >&6; }
+fi
+
+if test "$no_x" = yes; then
+ # Not all programs may use this symbol, but it does not hurt to define it.
+
+$as_echo "#define X_DISPLAY_MISSING 1" >>confdefs.h
+
+ X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
+else
+ if test -n "$x_includes"; then
+ X_CFLAGS="$X_CFLAGS -I$x_includes"
+ fi
+
+ # It would also be nice to do this for all -L options, not just this one.
+ if test -n "$x_libraries"; then
+ X_LIBS="$X_LIBS -L$x_libraries"
+ # For Solaris; some versions of Sun CC require a space after -R and
+ # others require no space. Words are not sufficient . . . .
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5
+$as_echo_n "checking whether -R must be followed by a space... " >&6; }
+ ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
+ ac_xsave_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ X_LIBS="$X_LIBS -R$x_libraries"
+else
+ LIBS="$ac_xsave_LIBS -R $x_libraries"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ X_LIBS="$X_LIBS -R $x_libraries"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: neither works" >&5
+$as_echo "neither works" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_c_werror_flag=$ac_xsave_c_werror_flag
+ LIBS=$ac_xsave_LIBS
+ fi
+
+ # Check for system-dependent libraries X programs must link with.
+ # Do this before checking for the system-independent R6 libraries
+ # (-lICE), since we may need -lsocket or whatever for X linking.
+
+ if test "$ISC" = yes; then
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
+ else
+ # Martyn Johnson says this is needed for Ultrix, if the X
+ # libraries were built with DECnet support. And Karl Berry says
+ # the Alpha needs dnet_stub (dnet does not exist).
+ ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11"
+ 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 XOpenDisplay ();
+int
+main ()
+{
+return XOpenDisplay ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5
+$as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; }
+if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldnet $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 dnet_ntoa ();
+int
+main ()
+{
+return dnet_ntoa ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dnet_dnet_ntoa=yes
+else
+ ac_cv_lib_dnet_dnet_ntoa=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_dnet_dnet_ntoa" >&5
+$as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; }
+if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then :
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
+fi
+
+ if test $ac_cv_lib_dnet_dnet_ntoa = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5
+$as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; }
+if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldnet_stub $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 dnet_ntoa ();
+int
+main ()
+{
+return dnet_ntoa ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dnet_stub_dnet_ntoa=yes
+else
+ ac_cv_lib_dnet_stub_dnet_ntoa=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_dnet_stub_dnet_ntoa" >&5
+$as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; }
+if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then :
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
+fi
+
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS="$ac_xsave_LIBS"
+
+ # msh at cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
+ # to get the SysV transport functions.
+ # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4)
+ # needs -lnsl.
+ # The nsl library prevents programs from opening the X display
+ # on Irix 5.2, according to T.E. Dickey.
+ # The functions gethostbyname, getservbyname, and inet_addr are
+ # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
+ ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname"
+if test "x$ac_cv_func_gethostbyname" = xyes; then :
+
+fi
+
+ if test $ac_cv_func_gethostbyname = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5
+$as_echo_n "checking for gethostbyname in -lnsl... " >&6; }
+if ${ac_cv_lib_nsl_gethostbyname+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnsl $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 gethostbyname ();
+int
+main ()
+{
+return gethostbyname ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_nsl_gethostbyname=yes
+else
+ ac_cv_lib_nsl_gethostbyname=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_nsl_gethostbyname" >&5
+$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; }
+if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then :
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
+fi
+
+ if test $ac_cv_lib_nsl_gethostbyname = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5
+$as_echo_n "checking for gethostbyname in -lbsd... " >&6; }
+if ${ac_cv_lib_bsd_gethostbyname+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lbsd $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 gethostbyname ();
+int
+main ()
+{
+return gethostbyname ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_bsd_gethostbyname=yes
+else
+ ac_cv_lib_bsd_gethostbyname=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_bsd_gethostbyname" >&5
+$as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; }
+if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then :
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd"
+fi
+
+ fi
+ fi
+
+ # lieder at skyler.mavd.honeywell.com says without -lsocket,
+ # socket/setsockopt and other routines are undefined under SCO ODT
+ # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary
+ # on later versions), says Simon Leinen: it contains gethostby*
+ # variants that don't use the name server (or something). -lsocket
+ # must be given before -lnsl if both are needed. We assume that
+ # if connect needs -lnsl, so does gethostbyname.
+ ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect"
+if test "x$ac_cv_func_connect" = xyes; then :
+
+fi
+
+ if test $ac_cv_func_connect = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5
+$as_echo_n "checking for connect in -lsocket... " >&6; }
+if ${ac_cv_lib_socket_connect+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsocket $X_EXTRA_LIBS $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 connect ();
+int
+main ()
+{
+return connect ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_socket_connect=yes
+else
+ ac_cv_lib_socket_connect=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_socket_connect" >&5
+$as_echo "$ac_cv_lib_socket_connect" >&6; }
+if test "x$ac_cv_lib_socket_connect" = xyes; then :
+ X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
+fi
+
+ fi
+
+ # Guillermo Gomez says -lposix is necessary on A/UX.
+ ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove"
+if test "x$ac_cv_func_remove" = xyes; then :
+
+fi
+
+ if test $ac_cv_func_remove = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5
+$as_echo_n "checking for remove in -lposix... " >&6; }
+if ${ac_cv_lib_posix_remove+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lposix $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 remove ();
+int
+main ()
+{
+return remove ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_posix_remove=yes
+else
+ ac_cv_lib_posix_remove=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_posix_remove" >&5
+$as_echo "$ac_cv_lib_posix_remove" >&6; }
+if test "x$ac_cv_lib_posix_remove" = xyes; then :
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
+fi
+
+ fi
+
+ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
+ ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat"
+if test "x$ac_cv_func_shmat" = xyes; then :
+
+fi
+
+ if test $ac_cv_func_shmat = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5
+$as_echo_n "checking for shmat in -lipc... " >&6; }
+if ${ac_cv_lib_ipc_shmat+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lipc $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 shmat ();
+int
+main ()
+{
+return shmat ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_ipc_shmat=yes
+else
+ ac_cv_lib_ipc_shmat=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_ipc_shmat" >&5
+$as_echo "$ac_cv_lib_ipc_shmat" >&6; }
+if test "x$ac_cv_lib_ipc_shmat" = xyes; then :
+ X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
+fi
+
+ fi
+ fi
+
+ # Check for libraries that X11R6 Xt/Xaw programs need.
+ ac_save_LDFLAGS=$LDFLAGS
+ test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
+ # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
+ # check for ICE first), but we must link in the order -lSM -lICE or
+ # we get undefined symbols. So assume we have SM if we have ICE.
+ # These have to be linked with before -lX11, unlike the other
+ # libraries we check for below, so use a different variable.
+ # John Interrante, Karl Berry
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5
+$as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; }
+if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lICE $X_EXTRA_LIBS $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 IceConnectionNumber ();
+int
+main ()
+{
+return IceConnectionNumber ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_ICE_IceConnectionNumber=yes
+else
+ ac_cv_lib_ICE_IceConnectionNumber=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_ICE_IceConnectionNumber" >&5
+$as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; }
+if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then :
+ X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
+fi
+
+ LDFLAGS=$ac_save_LDFLAGS
+
+fi
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt4" >&5
+$as_echo_n "checking for Qt4... " >&6; }
+
+
+# Check whether --with-qmake-qt4 was given.
+if test "${with_qmake_qt4+set}" = set; then :
+ withval=$with_qmake_qt4;
+fi
+
+
+ if test x"$with_qmake_qt4" = x"no"; then
+ have_qt4="disabled"
+ else
+ have_qt4=no
+
+ if test x"$with_qmake_qt4" = x"yes"; then
+ with_qmake_qt4=
+ fi
+
+ if test x"$with_qmake_qt4" = x; then
+ with_qmake_qt4="`which qmake`"
+ fi
+
+ if test x"$with_qmake_qt4" != x; then
+ if test -x $with_qmake_qt4; then
+ if test `uname` == "Darwin"; then
+ with_qmake_qt4="$with_qmake_qt4 -spec macx-g++"
+ fi
+ QT_QMAKE=$with_qmake_qt4
+ have_qt4=yes
+ fi
+ fi
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_qt4" >&5
+$as_echo "$have_qt4" >&6; }
+
+
+
+ # Check if Qt can actually be used as expected
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Qt4 works" >&5
+$as_echo_n "checking whether Qt4 works... " >&6; }
+ if ${ac_cv_qt_test_result+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ ac_cv_qt_test_result="no"
+
+ if test x"$have_qt4" = xyes; then
+ cat > amos_qt.h << EOF
+#include <QObject>
+class Test : public QObject
+{
+Q_OBJECT
+public:
+ Test() {}
+ ~Test() {}
+public slots:
+ void receive() {}
+signals:
+ void send();
+};
+EOF
+
+ cat > amos_qt.$ac_ext << EOF
+
+#include "amos_qt.h"
+#include <QApplication>
+int main( int argc, char **argv )
+{
+ QApplication app( argc, argv );
+ Test t;
+ QObject::connect( &t, SIGNAL(send()), &t, SLOT(receive()) );
+}
+EOF
+
+ cat > amos_qt.pro << EOF
+
+CONFIG += thread
+SOURCES += amos_qt.$ac_ext
+HEADERS += amos_qt.h
+QT += qt3support
+EOF
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$"$QT_QMAKE amos_qt.pro -o amos_qt.qmake"\""; } >&5
+ (eval $"$QT_QMAKE amos_qt.pro -o amos_qt.qmake") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ ## get the make flags from the qmake derived Makefile
+ QT_CXXFLAGS=`grep ^DEFINES amos_qt.qmake | cut -f2 -d'='`
+
+ ## rewrite relative paths to become absolute
+ CWD=`pwd`
+ QT_INC=`grep ^INCPATH amos_qt.qmake | cut -f2 -d'=' | sed "s^-I../^-I$CWD/../^g"`
+ QT_CXXFLAGS="$QT_CXXFLAGS $QT_INC"
+
+ QT_LIBS=`grep ^LIBS amos_qt.qmake | cut -f2 -d'='`
+ QT_LIBS=`echo $QT_LIBS | tr ' ' '\n' | grep -v SUBLIBS | tr '\n' ' '`
+
+ ## now get the moc command from the debug output
+ $QT_QMAKE -d amos_qt.pro -o amos_qt.qmake 2> amos_qt.qmake.err
+ QT_MOC=`grep 'QMAKE_MOC ===' amos_qt.qmake.err | cut -f4 -d'='`
+
+ #echo "MCS: QT_MOC: \"$QT_MOC\""
+ #echo "MCS: QT_CXXFLAGS: \"$QT_CXXFLAGS\""
+ #echo "MCS: QT_LIBS: \"$QT_LIBS\""
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$"$QT_MOC amos_qt.h -o moc_amos_qt.$ac_ext"\""; } >&5
+ (eval $"$QT_MOC amos_qt.h -o moc_amos_qt.$ac_ext") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$"$CXX $QT_CXXFLAGS -c $CXXFLAGS -o moc_amos_qt.o moc_amos_qt.$ac_ext"\""; } >&5
+ (eval $"$CXX $QT_CXXFLAGS -c $CXXFLAGS -o moc_amos_qt.o moc_amos_qt.$ac_ext") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$"$CXX $QT_CXXFLAGS -c $CXXFLAGS -o amos_qt.o amos_qt.$ac_ext"\""; } >&5
+ (eval $"$CXX $QT_CXXFLAGS -c $CXXFLAGS -o amos_qt.o amos_qt.$ac_ext") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$"$CXX $LIBS -o amos_qt amos_qt.o moc_amos_qt.o $QT_LIBS"\""; } >&5
+ (eval $"$CXX $LIBS -o amos_qt amos_qt.o moc_amos_qt.o $QT_LIBS") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ ac_cv_qt_test_result="yes"
+ fi
+ fi
+ fi
+ fi
+ fi
+
+ if test "$ac_cv_qt_test_result" = "no"; then
+ echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' amos_qt.$ac_ext >&5
+ fi
+
+ fi # if have_qt4
+
+fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_qt_test_result" >&5
+$as_echo "$ac_cv_qt_test_result" >&6; }
+
+
+
+
+
+ rm -f amos_qt.h moc_amos_qt.$ac_ext moc_amos_qt.o \
+ amos_qt.$ac_ext amos_qt.o amos_qt \
+ amos_qt.pro amos_qt.qmake amos_qt.qmake.err
+
+ have_qt4_test=$ac_cv_qt_test_result
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boost" >&5
+$as_echo_n "checking for Boost... " >&6; }
+
+
+# Check whether --with-Boost-dir was given.
+if test "${with_Boost_dir+set}" = set; then :
+ withval=$with_Boost_dir;
+fi
+
+
+ if test x"$with_Boost_dir" = x"no"; then
+ # user disabled Boost. Leave cache alone.
+ have_boost="disabled"
+ else
+ # "yes" is a bogus option
+ if test x"$with_Boost_dir" = xyes; then
+ with_Boost_dir=
+ fi
+ # check for some answers
+ if test x"$with_Boost_dir" != x; then
+ amos_boost_dir="$with_Boost_dir"
+ else
+ amos_boost_dir=
+ fi
+ # No Qt unless we discover otherwise
+ have_boost=no
+ # Check whether we were supplied with the whole answer
+ if test x"$amos_boost_dir" != x; then
+ have_boost=yes
+ # Use cached value or do search
+ else
+ if ${ac_cv_have_boost+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ # We are not given a solution and there is no cached value
+
+ if test x"$amos_boost_dir" = x; then
+ # The following header file is expected to define BOOST_VERSION.
+ boost_direct_test_header=version.hpp
+ # Look for the header file in a standard set of common directories.
+ amos_include_path_list="
+ `ls -dr /opt/boost*/include 2>/dev/null`
+ `ls -dr /usr/local/boost*/include 2>/dev/null`
+ `ls -dr /usr/local/include/boost* 2>/dev/null`
+ `ls -dr /usr/include/boost* 2>/dev/null`
+ /usr/include
+ "
+ if test x"$BOOSTDIR" != x; then
+ amos_include_path_list="
+ $amos_include_path_list
+ $BOOSTDIR/boost
+ "
+ fi
+ for amos_dir in $amos_include_path_list; do
+ if test -r "$amos_dir/boost/$boost_direct_test_header"; then
+ amos_boost_dir="$amos_dir"
+ fi
+ done
+ fi # test $amos_boost_include_dir
+
+ if test x"$amos_boost_dir" = x; then
+ # Problem with finding complete Boost. Cache the known absence of Boost.
+ ac_cv_have_boost="have_boost=no"
+ else
+ # Record where we found Boost for the cache.
+ ac_cv_have_boost="have_boost=yes \
+ amos_boost_dir=$amos_boost_dir"
+ fi
+
+fi
+ eval "$ac_cv_have_boost"
+ fi # all $amos_boost_* are set
+ fi # $have_boostreflects the system status
+ if test x"$have_boost" = xyes; then
+ BOOST_CXXFLAGS="-I$amos_boost_dir -DAMOS_HAVE_BOOST"
+ BOOST_DIR="$amos_boost_dir"
+ # All variables are defined, report the result
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_boost" >&5
+$as_echo "$have_boost" >&6; }
+ else
+ # Boost was not found
+ BOOST_CXXFLAGS=
+ BOOST_DIR=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_boost" >&5
+$as_echo "$have_boost" >&6; }
+ fi
+
+
+
+ # Check if Boost can actually be used as expected
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Boost works" >&5
+$as_echo_n "checking whether Boost works... " >&6; }
+ if ${ac_cv_boost_test_result+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ ac_cv_boost_test_result="no"
+
+ if test x"$have_boost" = xyes; then
+ cat > amos_boost_test.h << EOF
+#include <utility>
+#include <boost/config.hpp>
+#include <boost/utility.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/strong_components.hpp>
+#include <boost/graph/graphviz.hpp>
+
+typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> Graph;
+typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;
+typedef boost::graph_traits<Graph>::edge_descriptor Edge;
+typedef boost::graph_traits<Graph>::vertex_iterator VertexIterator;
+
+EOF
+
+ cat > amos_boost_main.$ac_ext << EOF
+#include "amos_boost_test.h"
+
+int main( int argc, char **argv )
+{
+ int num_vertices = 10;
+ int num_edges = num_vertices - 1;
+
+ Graph g(num_vertices);
+ int i = 0;
+ for (i = 0; i < num_edges; i++) {
+ boost::add_edge(i, i+1, g);
+ }
+
+ // access the vertices
+ std::pair<VertexIterator, VertexIterator> iter;
+ for (iter = boost::vertices(g); iter.first != iter.second; ++iter.first) {
+ Vertex source = *iter.first;
+ }
+}
+EOF
+
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$"$CXX $BOOST_CXXFLAGS -c $CXXFLAGS -o amos_boost_main.o amos_boost_main.$ac_ext"\""; } >&5
+ (eval $"$CXX $BOOST_CXXFLAGS -c $CXXFLAGS -o amos_boost_main.o amos_boost_main.$ac_ext") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$"$CXX $LIBS -o amos_boost_main amos_boost_main.o"\""; } >&5
+ (eval $"$CXX $LIBS -o amos_boost_main amos_boost_main.o") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ ac_cv_boost_test_result="yes"
+ fi
+ fi
+
+ if test "$ac_cv_boost_test_result" = "no"; then
+ echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' amos_boost_main.$ac_ext >&5
+
+ # Boost does not work turn it off
+ BOOST_CXXFLAGS=
+ BOOST_DIR=
+ fi
+
+ fi # if have_boost
+
+
+fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_boost_test_result" >&5
+$as_echo "$ac_cv_boost_test_result" >&6; }
+ rm -f amos_boost_test.h amos_boost_main.$ac_ext amos_boost_main.o amos_boost_main
+
+ have_boost_test=$ac_cv_boost_test_result
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CA" >&5
+$as_echo_n "checking for CA... " >&6; }
+
+
+# Check whether --with-CA-dir was given.
+if test "${with_CA_dir+set}" = set; then :
+ withval=$with_CA_dir;
+fi
+
+
+ if test x"$with_CA_dir" = x"no"; then
+ # user disabled Boost. Leave cache alone.
+ have_ca="disabled"
+ else
+ # "yes" is a bogus option
+ if test x"$with_CA_dir" = xyes; then
+ with_CA_dir=
+ fi
+ # check for some answers
+ if test x"$with_CA_dir" != x; then
+ amos_ca_dir="$with_CA_dir"
+ else
+ amos_ca_dir=
+ fi
+ have_ca=no
+ # Check whether we were supplied with the whole answer
+ if test x"$amos_ca_dir" != x; then
+ have_ca=yes
+ fi # all $amos_ca_* are set
+ fi # $have_ca reflects the system status
+ if test x"$have_ca" = xyes; then
+ CA_DIR="$amos_ca_dir"
+ CA_LDADD="$amos_ca_dir/lib/libCA.a"
+ CA_CXXFLAGS="-I$amos_ca_dir/../src -I$amos_ca_dir/../src/AS_MSG -I$amos_ca_dir/../src/AS_UTL -DAMOS_HAVE_CA"
+ # All variables are defined, report the result
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_ca" >&5
+$as_echo "$have_ca" >&6; }
+ else
+ # CA was not found
+ CA_LDADD=
+ CA_CXXFLAGS=
+ CA_DIR=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_ca" >&5
+$as_echo "$have_ca" >&6; }
+ fi
+
+
+
+
+ # Check if CA can actually be used as expected
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CA works" >&5
+$as_echo_n "checking whether CA works... " >&6; }
+ if ${ac_cv_ca_test_result+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ ac_cv_ca_test_result="no"
+
+ if test x"$have_ca" = xyes; then
+ cat > amos_ca_test.h << EOF
+#include <utility>
+#include "AS_MSG_pmesg.h"
+
+EOF
+
+ cat > amos_ca_main.$ac_ext << EOF
+#include "amos_ca_test.h"
+
+int main( int argc, char **argv )
+{
+ AS_MSG_setFormatVersion(1);
+
+ GenericMesg pmesg;
+ pmesg.t = MESG_FRG;
+ if (pmesg.t == MESG_FRG) {
+ return 0;
+ } else if (pmesg.t == MESG_CCO) {
+ return 1;
+ }
+}
+EOF
+
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$"$CXX $CA_CXXFLAGS -c $CXXFLAGS -o amos_ca_main.o amos_ca_main.$ac_ext"\""; } >&5
+ (eval $"$CXX $CA_CXXFLAGS -c $CXXFLAGS -o amos_ca_main.o amos_ca_main.$ac_ext") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$"$CXX $LIBS -o amos_ca_main amos_ca_main.o $CA_LDADD"\""; } >&5
+ (eval $"$CXX $LIBS -o amos_ca_main amos_ca_main.o $CA_LDADD") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ ac_cv_ca_test_result="yes"
+ fi
+ fi
+
+ if test "$ac_cv_ca_test_result" = "no"; then
+ echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' amos_ca_main.$ac_ext >&5
+
+ # CA does not work turn it off
+ CA_LDADD=
+ CA_CXXFLAGS=
+ CA_DIR=
+ fi
+
+ fi # if have_ca
+
+
+fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ca_test_result" >&5
+$as_echo "$ac_cv_ca_test_result" >&6; }
+ rm -f amos_ca_test.h amos_ca_main.$ac_ext amos_ca_main.o amos_ca_main
+
+ have_ca_test=$ac_cv_ca_test_result
+
+
+# check for functions which can be replaced with libGNU modules:
+# getopt strtod strtol
+
+ :
+
+ GETOPT_H=
+ for ac_header in getopt.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "getopt.h" "ac_cv_header_getopt_h" "$ac_includes_default"
+if test "x$ac_cv_header_getopt_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_GETOPT_H 1
+_ACEOF
+
+else
+ GETOPT_H=getopt.h
+fi
+
+done
+
+ for ac_func in getopt_long_only
+do :
+ ac_fn_c_check_func "$LINENO" "getopt_long_only" "ac_cv_func_getopt_long_only"
+if test "x$ac_cv_func_getopt_long_only" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_GETOPT_LONG_ONLY 1
+_ACEOF
+
+else
+ GETOPT_H=getopt.h
+fi
+done
+
+
+ if test -n "$GETOPT_H"; then
+
+ GETOPT_H=getopt.h
+ case " $LIBOBJS " in
+ *" getopt.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS getopt.$ac_objext"
+ ;;
+esac
+
+ case " $LIBOBJS " in
+ *" getopt1.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS getopt1.$ac_objext"
+ ;;
+esac
+
+
+$as_echo "#define optarg rpl_optarg" >>confdefs.h
+
+
+$as_echo "#define optind rpl_optind" >>confdefs.h
+
+
+$as_echo "#define optopt rpl_optopt" >>confdefs.h
+
+
+$as_echo "#define getopt rpl_getopt" >>confdefs.h
+
+
+$as_echo "#define getopt_long rpl_getopt_long" >>confdefs.h
+
+
+$as_echo "#define getopt_long_only rpl_getopt_long_only" >>confdefs.h
+
+
+
+ fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5
+$as_echo_n "checking for working strtod... " >&6; }
+if ${ac_cv_func_strtod+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_strtod=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+$ac_includes_default
+#ifndef strtod
+double strtod ();
+#endif
+int
+main()
+{
+ {
+ /* Some versions of Linux strtod mis-parse strings with leading '+'. */
+ char *string = " +69";
+ char *term;
+ double value;
+ value = strtod (string, &term);
+ if (value != 69 || term != (string + 4))
+ return 1;
+ }
+
+ {
+ /* Under Solaris 2.4, strtod returns the wrong value for the
+ terminating character under some conditions. */
+ char *string = "NaN";
+ char *term;
+ strtod (string, &term);
+ if (term != string && *(term - 1) == 0)
+ return 1;
+ }
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_strtod=yes
+else
+ ac_cv_func_strtod=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5
+$as_echo "$ac_cv_func_strtod" >&6; }
+if test $ac_cv_func_strtod = no; then
+ case " $LIBOBJS " in
+ *" strtod.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS strtod.$ac_objext"
+ ;;
+esac
+
+ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow"
+if test "x$ac_cv_func_pow" = xyes; then :
+
+fi
+
+if test $ac_cv_func_pow = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5
+$as_echo_n "checking for pow in -lm... " >&6; }
+if ${ac_cv_lib_m_pow+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $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 pow ();
+int
+main ()
+{
+return pow ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_pow=yes
+else
+ ac_cv_lib_m_pow=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_m_pow" >&5
+$as_echo "$ac_cv_lib_m_pow" >&6; }
+if test "x$ac_cv_lib_m_pow" = xyes; then :
+ POW_LIB=-lm
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5
+$as_echo "$as_me: WARNING: cannot find library containing definition of pow" >&2;}
+fi
+
+fi
+
+fi
+
+
+
+
+
+ for ac_func in $gl_func_list
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+
+ if test $ac_cv_func_strtod = no; then
+
+$as_echo "#define strtod rpl_strtod" >>confdefs.h
+
+
+
+
+ :
+
+
+
+
+
+
+ fi
+
+
+ ac_fn_c_check_func "$LINENO" "strtol" "ac_cv_func_strtol"
+if test "x$ac_cv_func_strtol" = xyes; then :
+ $as_echo "#define HAVE_STRTOL 1" >>confdefs.h
+
+else
+ case " $LIBOBJS " in
+ *" strtol.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS strtol.$ac_objext"
+ ;;
+esac
+
+fi
+
+
+ if test $ac_cv_func_strtol = no; then
+
+
+
+ :
+
+
+
+
+
+
+ fi
+
+
+# check for functions not in libGNU
+for ac_header in vfork.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default"
+if test "x$ac_cv_header_vfork_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_VFORK_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_func in fork vfork
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+if test "x$ac_cv_func_fork" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5
+$as_echo_n "checking for working fork... " >&6; }
+if ${ac_cv_func_fork_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_fork_works=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* By Ruediger Kuhlmann. */
+ return fork () < 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_fork_works=yes
+else
+ ac_cv_func_fork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5
+$as_echo "$ac_cv_func_fork_works" >&6; }
+
+else
+ ac_cv_func_fork_works=$ac_cv_func_fork
+fi
+if test "x$ac_cv_func_fork_works" = xcross; then
+ case $host in
+ *-*-amigaos* | *-*-msdosdjgpp*)
+ # Override, as these systems have only a dummy fork() stub
+ ac_cv_func_fork_works=no
+ ;;
+ *)
+ ac_cv_func_fork_works=yes
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
+fi
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+if test "x$ac_cv_func_vfork" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5
+$as_echo_n "checking for working vfork... " >&6; }
+if ${ac_cv_func_vfork_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_vfork_works=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Thanks to Paul Eggert for this test. */
+$ac_includes_default
+#include <sys/wait.h>
+#ifdef HAVE_VFORK_H
+# include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+ argument registers are propagated back to the parent. The compiler
+ is told about this with #include <vfork.h>, but some compilers
+ (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a
+ static variable whose address is put into a register that is
+ clobbered by the vfork. */
+static void
+#ifdef __cplusplus
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
+#endif
+{
+ static pid_t child;
+ if (!child) {
+ child = vfork ();
+ if (child < 0) {
+ perror ("vfork");
+ _exit(2);
+ }
+ if (!child) {
+ arg = getpid();
+ write(-1, "", 0);
+ _exit (arg);
+ }
+ }
+}
+
+int
+main ()
+{
+ pid_t parent = getpid ();
+ pid_t child;
+
+ sparc_address_test (0);
+
+ child = vfork ();
+
+ if (child == 0) {
+ /* Here is another test for sparc vfork register problems. This
+ test uses lots of local variables, at least as many local
+ variables as main has allocated so far including compiler
+ temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris
+ 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should
+ reuse the register of parent for one of the local variables,
+ since it will think that parent can't possibly be used any more
+ in this routine. Assigning to the local variable will thus
+ munge parent in the parent process. */
+ pid_t
+ p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+ p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+ /* Convince the compiler that p..p7 are live; otherwise, it might
+ use the same hardware register for all 8 local variables. */
+ if (p != p1 || p != p2 || p != p3 || p != p4
+ || p != p5 || p != p6 || p != p7)
+ _exit(1);
+
+ /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+ from child file descriptors. If the child closes a descriptor
+ before it execs or exits, this munges the parent's descriptor
+ as well. Test for this by closing stdout in the child. */
+ _exit(close(fileno(stdout)) != 0);
+ } else {
+ int status;
+ struct stat st;
+
+ while (wait(&status) != child)
+ ;
+ return (
+ /* Was there some problem with vforking? */
+ child < 0
+
+ /* Did the child fail? (This shouldn't happen.) */
+ || status
+
+ /* Did the vfork/compiler bug occur? */
+ || parent != getpid()
+
+ /* Did the file descriptor bug occur? */
+ || fstat(fileno(stdout), &st) != 0
+ );
+ }
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_vfork_works=yes
+else
+ ac_cv_func_vfork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5
+$as_echo "$ac_cv_func_vfork_works" >&6; }
+
+fi;
+if test "x$ac_cv_func_fork_works" = xcross; then
+ ac_cv_func_vfork_works=$ac_cv_func_vfork
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
+fi
+
+if test "x$ac_cv_func_vfork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h
+
+else
+
+$as_echo "#define vfork fork" >>confdefs.h
+
+fi
+if test "x$ac_cv_func_fork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
+
+fi
+
+for ac_header in sys/select.h sys/socket.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for select" >&5
+$as_echo_n "checking types of arguments for select... " >&6; }
+if ${ac_cv_func_select_args+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
+ for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do
+ for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+
+int
+main ()
+{
+extern int select ($ac_arg1,
+ $ac_arg234, $ac_arg234, $ac_arg234,
+ $ac_arg5);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+ done
+done
+# Provide a safe default value.
+: "${ac_cv_func_select_args=int,int *,struct timeval *}"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_select_args" >&5
+$as_echo "$ac_cv_func_select_args" >&6; }
+ac_save_IFS=$IFS; IFS=','
+set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'`
+IFS=$ac_save_IFS
+shift
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG1 $1
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG234 ($2)
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG5 ($3)
+_ACEOF
+
+rm -f conftest*
+
+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 :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_STRFTIME 1
+_ACEOF
+
+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 :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl $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 strftime ();
+int
+main ()
+{
+return strftime ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_intl_strftime=yes
+else
+ ac_cv_lib_intl_strftime=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_intl_strftime" >&5
+$as_echo "$ac_cv_lib_intl_strftime" >&6; }
+if test "x$ac_cv_lib_intl_strftime" = xyes; then :
+ $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h
+
+LIBS="-lintl $LIBS"
+fi
+
+fi
+done
+
+for ac_func in \
+ dup2 \
+ floor \
+ localtime \
+ lstat \
+ memmove \
+ memset \
+ mkdir \
+ pow \
+ rmdir \
+ sqrt \
+ stat \
+ strchr \
+ strdup \
+ strstr \
+
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+ as_fn_error $? "required function not found please use a supported compiler" "$LINENO" 5
+
+fi
+done
+
+
+# check the platform
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $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 :
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $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 :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+# set the automake build conditionals, e.g. BUILD_AMOScmp
+
+# Check whether --enable-AMOScmp was given.
+if test "${enable_AMOScmp+set}" = set; then :
+ enableval=$enable_AMOScmp; ac_cv_enable_AMOScmp=${enableval}
+else
+ ac_cv_enable_AMOScmp=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build AMOScmp" >&5
+$as_echo_n "checking whether to build AMOScmp... " >&6; }
+if ${ac_cv_enable_AMOScmp+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_enable_AMOScmp=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_AMOScmp" >&5
+$as_echo "$ac_cv_enable_AMOScmp" >&6; }
+ if test x"${ac_cv_enable_AMOScmp}" = x"yes"; then
+ BUILD_AMOScmp_TRUE=
+ BUILD_AMOScmp_FALSE='#'
+else
+ BUILD_AMOScmp_TRUE='#'
+ BUILD_AMOScmp_FALSE=
+fi
+
+
+
+# Check whether --enable-minimus was given.
+if test "${enable_minimus+set}" = set; then :
+ enableval=$enable_minimus; ac_cv_enable_minimus=${enableval}
+else
+ ac_cv_enable_minimus=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build minimus" >&5
+$as_echo_n "checking whether to build minimus... " >&6; }
+if ${ac_cv_enable_minimus+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_enable_minimus=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_minimus" >&5
+$as_echo "$ac_cv_enable_minimus" >&6; }
+ if test x"${ac_cv_enable_minimus}" = x"yes"; then
+ BUILD_minimus_TRUE=
+ BUILD_minimus_FALSE='#'
+else
+ BUILD_minimus_TRUE='#'
+ BUILD_minimus_FALSE=
+fi
+
+
+
+# Check whether --enable-Simulator was given.
+if test "${enable_Simulator+set}" = set; then :
+ enableval=$enable_Simulator; ac_cv_enable_Simulator=${enableval}
+else
+ ac_cv_enable_Simulator=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build Simulator" >&5
+$as_echo_n "checking whether to build Simulator... " >&6; }
+if ${ac_cv_enable_Simulator+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_enable_Simulator=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_Simulator" >&5
+$as_echo "$ac_cv_enable_Simulator" >&6; }
+ if test x"${ac_cv_enable_Simulator}" = x"yes"; then
+ BUILD_Simulator_TRUE=
+ BUILD_Simulator_FALSE='#'
+else
+ BUILD_Simulator_TRUE='#'
+ BUILD_Simulator_FALSE=
+fi
+
+
+
+# Check whether --enable-Experimental was given.
+if test "${enable_Experimental+set}" = set; then :
+ enableval=$enable_Experimental; ac_cv_enable_Experimental=${enableval}
+else
+ ac_cv_enable_Experimental=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build Experimental" >&5
+$as_echo_n "checking whether to build Experimental... " >&6; }
+if ${ac_cv_enable_Experimental+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_enable_Experimental=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_Experimental" >&5
+$as_echo "$ac_cv_enable_Experimental" >&6; }
+ if test x"${ac_cv_enable_Experimental}" = x"yes"; then
+ BUILD_Experimental_TRUE=
+ BUILD_Experimental_FALSE='#'
+else
+ BUILD_Experimental_TRUE='#'
+ BUILD_Experimental_FALSE=
+fi
+
+
+
+# Check whether --enable-all was given.
+if test "${enable_all+set}" = set; then :
+ enableval=$enable_all; ac_cv_enable_all=${enableval}
+else
+ ac_cv_enable_all=yes
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build all" >&5
+$as_echo_n "checking whether to build all... " >&6; }
+if ${ac_cv_enable_all+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_enable_all=yes
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_all" >&5
+$as_echo "$ac_cv_enable_all" >&6; }
+ if test x"${ac_cv_enable_all}" = x"yes"; then
+ BUILD_all_TRUE=
+ BUILD_all_FALSE='#'
+else
+ BUILD_all_TRUE='#'
+ BUILD_all_FALSE=
+fi
+
+
+
+ if test x"${have_libz}" = x"yes"; then
+ BUILD_LIBZ_TRUE=
+ BUILD_LIBZ_FALSE='#'
+else
+ BUILD_LIBZ_TRUE='#'
+ BUILD_LIBZ_FALSE=
+fi
+
+ if test x"${have_qt4_test}" = x"yes"; then
+ BUILD_QT4_TRUE=
+ BUILD_QT4_FALSE='#'
+else
+ BUILD_QT4_TRUE='#'
+ BUILD_QT4_FALSE=
+fi
+
+ if test x"${have_boost_test}" = x"yes"; then
+ BUILD_BOOST_TRUE=
+ BUILD_BOOST_FALSE='#'
+else
+ BUILD_BOOST_TRUE='#'
+ BUILD_BOOST_FALSE=
+fi
+
+
+# makefiles to configure
+ac_config_files="$ac_config_files Makefile doc/Makefile src/Makefile src/GNU/Makefile src/AMOS/Makefile src/Bambus/Makefile src/Bambus/Bundler/Makefile src/Bambus/Output/Makefile src/Bambus/Untangler/Makefile src/Common/Makefile src/Graph/Makefile src/Slice/Makefile src/CelMsg/Makefile src/Message/Makefile src/Bank/Makefile src/Align/Makefile src/Tigger/Makefile src/Compare/Makefile src/Casm/Makefile src/CtgTrim/Makefile src/Sim/Makefile src/Validation/Makefile src/Converters/Makefile sr [...]
+
+
+# make it happen
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\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
+ { $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
+ 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;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+ if test -n "$EXEEXT"; then
+ am__EXEEXT_TRUE=
+ am__EXEEXT_FALSE='#'
+else
+ am__EXEEXT_TRUE='#'
+ am__EXEEXT_FALSE=
+fi
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+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 "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+if test -z "${BUILD_AMOScmp_TRUE}" && test -z "${BUILD_AMOScmp_FALSE}"; then
+ as_fn_error $? "conditional \"BUILD_AMOScmp\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${BUILD_minimus_TRUE}" && test -z "${BUILD_minimus_FALSE}"; then
+ as_fn_error $? "conditional \"BUILD_minimus\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${BUILD_Simulator_TRUE}" && test -z "${BUILD_Simulator_FALSE}"; then
+ as_fn_error $? "conditional \"BUILD_Simulator\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${BUILD_Experimental_TRUE}" && test -z "${BUILD_Experimental_FALSE}"; then
+ as_fn_error $? "conditional \"BUILD_Experimental\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${BUILD_all_TRUE}" && test -z "${BUILD_all_FALSE}"; then
+ as_fn_error $? "conditional \"BUILD_all\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${BUILD_LIBZ_TRUE}" && test -z "${BUILD_LIBZ_FALSE}"; then
+ as_fn_error $? "conditional \"BUILD_LIBZ\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${BUILD_QT4_TRUE}" && test -z "${BUILD_QT4_FALSE}"; then
+ as_fn_error $? "conditional \"BUILD_QT4\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${BUILD_BOOST_TRUE}" && test -z "${BUILD_BOOST_FALSE}"; then
+ as_fn_error $? "conditional \"BUILD_BOOST\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+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
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in #(
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+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'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by AMOS Assembler $as_me 3.1.0, which was
+generated by GNU Autoconf 2.68. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <amos-help at lists.sourceforge.net>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+AMOS Assembler config.status 3.1.0
+configured by $0, generated by GNU Autoconf 2.68,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+ "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+ "src/GNU/Makefile") CONFIG_FILES="$CONFIG_FILES src/GNU/Makefile" ;;
+ "src/AMOS/Makefile") CONFIG_FILES="$CONFIG_FILES src/AMOS/Makefile" ;;
+ "src/Bambus/Makefile") CONFIG_FILES="$CONFIG_FILES src/Bambus/Makefile" ;;
+ "src/Bambus/Bundler/Makefile") CONFIG_FILES="$CONFIG_FILES src/Bambus/Bundler/Makefile" ;;
+ "src/Bambus/Output/Makefile") CONFIG_FILES="$CONFIG_FILES src/Bambus/Output/Makefile" ;;
+ "src/Bambus/Untangler/Makefile") CONFIG_FILES="$CONFIG_FILES src/Bambus/Untangler/Makefile" ;;
+ "src/Common/Makefile") CONFIG_FILES="$CONFIG_FILES src/Common/Makefile" ;;
+ "src/Graph/Makefile") CONFIG_FILES="$CONFIG_FILES src/Graph/Makefile" ;;
+ "src/Slice/Makefile") CONFIG_FILES="$CONFIG_FILES src/Slice/Makefile" ;;
+ "src/CelMsg/Makefile") CONFIG_FILES="$CONFIG_FILES src/CelMsg/Makefile" ;;
+ "src/Message/Makefile") CONFIG_FILES="$CONFIG_FILES src/Message/Makefile" ;;
+ "src/Bank/Makefile") CONFIG_FILES="$CONFIG_FILES src/Bank/Makefile" ;;
+ "src/Align/Makefile") CONFIG_FILES="$CONFIG_FILES src/Align/Makefile" ;;
+ "src/Tigger/Makefile") CONFIG_FILES="$CONFIG_FILES src/Tigger/Makefile" ;;
+ "src/Compare/Makefile") CONFIG_FILES="$CONFIG_FILES src/Compare/Makefile" ;;
+ "src/Casm/Makefile") CONFIG_FILES="$CONFIG_FILES src/Casm/Makefile" ;;
+ "src/CtgTrim/Makefile") CONFIG_FILES="$CONFIG_FILES src/CtgTrim/Makefile" ;;
+ "src/Sim/Makefile") CONFIG_FILES="$CONFIG_FILES src/Sim/Makefile" ;;
+ "src/Validation/Makefile") CONFIG_FILES="$CONFIG_FILES src/Validation/Makefile" ;;
+ "src/Converters/Makefile") CONFIG_FILES="$CONFIG_FILES src/Converters/Makefile" ;;
+ "src/Utils/Makefile") CONFIG_FILES="$CONFIG_FILES src/Utils/Makefile" ;;
+ "src/PerlModules/Makefile") CONFIG_FILES="$CONFIG_FILES src/PerlModules/Makefile" ;;
+ "src/PythonModules/Makefile") CONFIG_FILES="$CONFIG_FILES src/PythonModules/Makefile" ;;
+ "src/Pipeline/Makefile") CONFIG_FILES="$CONFIG_FILES src/Pipeline/Makefile" ;;
+ "src/Staden/Makefile") CONFIG_FILES="$CONFIG_FILES src/Staden/Makefile" ;;
+ "src/Staden/read/Makefile") CONFIG_FILES="$CONFIG_FILES src/Staden/read/Makefile" ;;
+ "src/Staden/progs/Makefile") CONFIG_FILES="$CONFIG_FILES src/Staden/progs/Makefile" ;;
+ "src/Contig/Makefile") CONFIG_FILES="$CONFIG_FILES src/Contig/Makefile" ;;
+ "src/Foundation/Makefile") CONFIG_FILES="$CONFIG_FILES src/Foundation/Makefile" ;;
+ "src/hawkeye/Makefile") CONFIG_FILES="$CONFIG_FILES src/hawkeye/Makefile" ;;
+ "src/Experimental/Makefile") CONFIG_FILES="$CONFIG_FILES src/Experimental/Makefile" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ 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.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+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" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_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 `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ 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'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+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
+
+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"; } &&
+ { $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"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$ac_tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
+ fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_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` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$_am_arg" : 'X\(//\)[^/]' \| \
+ X"$_am_arg" : 'X\(//\)$' \| \
+ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+ # 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 ;;
+ 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" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ 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_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir=$dirpart/$fdir; as_fn_mkdir_p
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+ ;;
+
+ esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+
+# dump some configuration confirmations
+echo \
+"
+-- ${PACKAGE_STRING} Configuration Results --
+ C compiler: ${CC} ${CFLAGS}
+ C++ compiler: ${CXX} ${CXXFLAGS}"
+
+if test x"${GCC}" = x"yes" ; then
+ gcc_version=`${CC} --version | head -n 1`
+ echo " GCC version: ${gcc_version}"
+else
+ gcc_version=''
+fi
+
+echo \
+" Host System type: ${host}
+ Install prefix: ${prefix}
+ Install eprefix: ${exec_prefix}
+
+ See config.h for further configuration information.
+ Email <${PACKAGE_BUGREPORT}> with questions and bug reports.
+"
+
+# alert the user of possible problems
+case "${host}" in
+ *alpha*osf*)
+ case "${CFLAGS} ${CXXFLAGS}" in
+ *-g*)
+ echo "WARNING! TIGR alphas may bomb when -g flag is turned on"
+ echo " use \`configure CFLAGS= CXXFLAGS=' to avoid"
+ ;;
+ esac
+ ;;
+
+ *sparc*solaris*)
+ case "${gcc_version}" in
+ *2.*.*)
+ if test x"${enable_largefile}" != x"no"; then
+ echo "WARNING! TIGR suns using GCC 2.x.x will bomb on largefile support"
+ echo " use \`configure --disable-largefile' to avoid"
+ fi
+ ;;
+ esac
+ ;;
+
+ *x86_64*)
+ case "${gcc_version}" in
+ *3.3.*)
+ echo "WARNING! GCC ${gcc_version} has bugs that affect x86_64 AMOS"
+ echo " please install a newer version of GCC and reconfigure"
+ ;;
+ esac
+ ;;
+esac
+
+case "${gcc_version}" in
+ *2.96.*)
+ echo "WARNING! GCC ${gcc_version} has bugs that affect AMOS"
+ echo " please install a newer version of GCC and reconfigure"
+ ;;
+esac
+
+if test x"${PERL}" = x":" || ! test -x "${PERL}"; then
+ echo "WARNING! perl was not found but is required to run AMOS scripts"
+ echo " install perl if planning on using AMOS scripts"
+fi
+
+if test x"${PYTHON}" = x":" || ! test -x "${PYTHON}"; then
+ echo "WARNING! python was not found but is required to run goBambus2"
+ echo " install python if planning on using goBambus2"
+fi
+
+if test x"${NUCMER}" = x":" || ! test -x "${NUCMER}"; then
+ echo "WARNING! nucmer was not found but is required to run AMOScmp and minimus2"
+ echo " install nucmer if planning on using these programs"
+fi
+
+if test x"${DELTAFILTER}" = x":" || ! test -x "${DELTAFILTER}"; then
+ echo "WARNING! delta-filter was not found but is required to run AMOScmp-shortReads-alignmentTrimmed"
+ echo " install delta-filter if planning on using AMOScmp-shortReads-alignmentTrimmed"
+fi
+
+if test x"${SHOWCOORDS}" = x":" || ! test -x "${DELTAFILTER}"; then
+ echo "WARNING! show-coords was not found but is required to run minimus2"
+ echo " install show-coords if planning on using minimus2"
+fi
+
+if test x"${BLAT}" = x":" || ! test -x "${BLAT}"; then
+ echo "WARNING! BLAT was not found but is required to run minimus2-blat"
+ echo " install BLAT if planning on using minimus2-blat"
+fi
+
+if test x"${have_qt4}" != x"yes"; then
+ echo "WARNING! Qt4 toolkit was not found but is required to run AMOS GUIs"
+ echo " install Qt4 or locate Qt4 with configure to build GUIs"
+ echo " see config.log for more information on what went wrong"
+elif test x"${have_qt4_test}" != x"yes"; then
+ echo "WARNING! Qt4 toolkit malfunctioning but is required to run AMOS GUIs"
+ echo " try compiling GUIs manually or reinstall Qt4 toolkit to build GUIs"
+ echo " see config.log for more information on what went wrong"
+fi
+
+if test x"${have_boost}" != x"yes"; then
+ echo "WARNING! Boost graph toolkit was not found but is required to run parts of the AMOS Scaffolder (Bambus 2)"
+ echo " install Boost or locate Boost with configure to build Scaffolder"
+ echo " see config.log for more information on what went wrong"
+elif test x"${have_boost_test}" != x"yes"; then
+ echo "WARNING! Boost graph toolkit malfunctioning but is required to run parts of the AMOS Scaffolder (Bambus 2)"
+ echo " try compiling manually or reinstall Boost toolkit to build AMOS Scaffolder"
+ echo " see config.log for more information on what went wrong"
+fi
+
+if test x"${have_libz}" != x"yes"; then
+ echo "WARNING! libz was not found but is required for certain read trace IO"
+ echo " install libz if planning on using compressed trace formats"
+fi
+
+if test x"${LIBSTATISTICS_DESCRIPTIVE_PERL}" = x"0"; then
+ echo "WARNING! Statistics::Descriptive Perl module was not found but is required to run some AMOS scripts"
+fi
+
+if test x"${LIBXML_PARSER_PERL}" = x"0"; then
+ echo "WARNING! XML::Parser Perl module was not found but is required to run some AMOS scripts"
+fi
+
+if test x"${LIBDBI_PERL}" = x"0"; then
+ echo "WARNING! DBI Perl module was not found but is required to run some AMOS scripts"
+fi
+##-- END OF CONFIGURE --##
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..82a417d
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,310 @@
+##-- AMOS CONFIGURE --##
+
+# initialize
+AC_PREREQ([2.59])
+AC_INIT([AMOS Assembler],[3.1.0],[amos-help at lists.sourceforge.net],[amos])
+AC_PREFIX_DEFAULT([`pwd`])
+AC_CONFIG_SRCDIR([src/AMOS/foundation_AMOS.hh])
+AC_CONFIG_AUX_DIR([config])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_LIBOBJ_DIR([src/GNU])
+AM_INIT_AUTOMAKE(1.8)
+
+# allow patters relating to CA
+m4_pattern_allow([^AS_UTL])
+m4_pattern_allow([^AS_MSG])
+
+# declare some precious variables
+AC_ARG_VAR(PERL, [perl command])
+AC_ARG_VAR(PYTHON, [python command])
+AC_ARG_VAR(NUCMER, [nucmer command])
+AC_ARG_VAR(DELTAFILTER, [delta-filter command])
+AC_ARG_VAR(SHOWCOORDS, [show-coords command])
+AC_ARG_VAR(BLAT, [blat command])
+AC_SUBST(docdir, [${datadir}/doc/${PACKAGE_TARNAME}-${PACKAGE_VERSION}])
+AC_SUBST(amoslibdir, [${libdir}/AMOS])
+AC_SUBST(tigrlibdir, [${libdir}/TIGR])
+AC_SUBST(amosincludedir, [${includedir}/AMOS])
+AC_SUBST(tigrincludedir, [${includedir}/TIGR])
+
+# check for programs
+AC_PROG_CXX
+AC_PROG_CC
+AC_PROG_AWK
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_RANLIB
+AC_PROG_CPP
+AC_PATH_PROG(PERL, [perl], [:])
+AC_PATH_PROG(PYTHON, [python], [:])
+AC_PATH_PROG(NUCMER, [nucmer], [:])
+AC_PATH_PROG(DELTAFILTER, [delta-filter], [:])
+AC_PATH_PROG(SHOWCOORDS, [show-coords], [:])
+AC_PATH_PROG(BLAT, [blat], [:])
+
+# initialize Python
+# AC_PROG_PYTHON()
+
+# check for Perl modules
+AC_PROG_PERL_MODULES(Statistics::Descriptive, LIBSTATISTICS_DESCRIPTIVE_PERL=1, LIBSTATISTICS_DESCRIPTIVE_PERL=0)
+AC_PROG_PERL_MODULES(XML::Parser, LIBXML_PARSER_PERL=1, LIBXML_PARSER_PERL=0)
+AC_PROG_PERL_MODULES(DBI, LIBDBI_PERL=1, LIBDBI_PERL=0)
+
+# check for libraries
+AC_CHECK_LIB(m, pow)
+AC_CHECK_LIB(c, fopen)
+AC_CHECK_LIB(z, main)
+case ${LIBS} in
+ *"-lz "*)
+ have_libz=yes
+ ;;
+esac
+
+# check for headers
+AC_HEADER_DIRENT
+AC_HEADER_STDC
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS(
+ [ \
+ fcntl.h \
+ inttypes.h \
+ limits.h \
+ stdlib.h \
+ unistd.h \
+ ],
+ [],
+ AC_MSG_ERROR([required header not found please use a supported compiler])
+)
+
+# check for typedefs, structures, and compiler characteristics
+AC_HEADER_STDBOOL
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_TYPE_MODE_T
+AC_STRUCT_TM
+AC_C_BIGENDIAN
+AC_SYS_LARGEFILE
+AMOS_C_BITFIELDS
+AMOS_QT4
+AMOS_BOOST
+AMOS_CA
+
+# check for functions which can be replaced with libGNU modules:
+# getopt strtod strtol
+gl_GETOPT
+gl_FUNC_STRTOD
+gl_FUNC_STRTOL
+
+# check for functions not in libGNU
+AC_FUNC_FORK
+AC_FUNC_SELECT_ARGTYPES
+AC_FUNC_STRFTIME
+AC_CHECK_FUNCS(
+ [ \
+ dup2 \
+ floor \
+ localtime \
+ lstat \
+ memmove \
+ memset \
+ mkdir \
+ pow \
+ rmdir \
+ sqrt \
+ stat \
+ strchr \
+ strdup \
+ strstr \
+ ],
+ [],
+ AC_MSG_ERROR([required function not found please use a supported compiler])
+)
+
+# check the platform
+AC_CANONICAL_HOST
+
+# set the automake build conditionals, e.g. BUILD_AMOScmp
+AMOS_BUILD_CONDITIONAL([AMOScmp], [no])
+AMOS_BUILD_CONDITIONAL([minimus], [no])
+AMOS_BUILD_CONDITIONAL([Simulator], [no])
+AMOS_BUILD_CONDITIONAL([Experimental], [no])
+AMOS_BUILD_CONDITIONAL([all], [yes])
+
+AM_CONDITIONAL(BUILD_LIBZ, [test x"${have_libz}" = x"yes"])
+AM_CONDITIONAL(BUILD_QT4, [test x"${have_qt4_test}" = x"yes"])
+AM_CONDITIONAL(BUILD_BOOST, [test x"${have_boost_test}" = x"yes"])
+
+# makefiles to configure
+AC_CONFIG_FILES(
+ [ \
+ Makefile \
+ doc/Makefile \
+ src/Makefile \
+ src/GNU/Makefile \
+ src/AMOS/Makefile \
+ src/Bambus/Makefile \
+ src/Bambus/Bundler/Makefile \
+ src/Bambus/Output/Makefile \
+ src/Bambus/Untangler/Makefile \
+ src/Common/Makefile \
+ src/Graph/Makefile \
+ src/Slice/Makefile \
+ src/CelMsg/Makefile \
+ src/Message/Makefile \
+ src/Bank/Makefile \
+ src/Align/Makefile \
+ src/Tigger/Makefile \
+ src/Compare/Makefile \
+ src/Casm/Makefile \
+ src/CtgTrim/Makefile \
+ src/Sim/Makefile \
+ src/Validation/Makefile \
+ src/Converters/Makefile \
+ src/Utils/Makefile \
+ src/PerlModules/Makefile \
+ src/PythonModules/Makefile \
+ src/Pipeline/Makefile \
+ src/Staden/Makefile \
+ src/Staden/read/Makefile \
+ src/Staden/progs/Makefile \
+ src/Contig/Makefile \
+ src/Foundation/Makefile \
+ src/hawkeye/Makefile \
+ src/Experimental/Makefile \
+ ]
+)
+
+# make it happen
+AC_OUTPUT
+
+# dump some configuration confirmations
+echo \
+"
+-- ${PACKAGE_STRING} Configuration Results --
+ C compiler: ${CC} ${CFLAGS}
+ C++ compiler: ${CXX} ${CXXFLAGS}"
+
+if test x"${GCC}" = x"yes" ; then
+ gcc_version=`${CC} --version | head -n 1`
+ echo " GCC version: ${gcc_version}"
+else
+ gcc_version=''
+fi
+
+echo \
+" Host System type: ${host}
+ Install prefix: ${prefix}
+ Install eprefix: ${exec_prefix}
+
+ See config.h for further configuration information.
+ Email <${PACKAGE_BUGREPORT}> with questions and bug reports.
+"
+
+# alert the user of possible problems
+case "${host}" in
+ *alpha*osf*)
+ case "${CFLAGS} ${CXXFLAGS}" in
+ *-g*)
+ echo "WARNING! TIGR alphas may bomb when -g flag is turned on"
+ echo " use \`configure CFLAGS= CXXFLAGS=' to avoid"
+ ;;
+ esac
+ ;;
+
+ *sparc*solaris*)
+ case "${gcc_version}" in
+ *2.*.*)
+ if test x"${enable_largefile}" != x"no"; then
+ echo "WARNING! TIGR suns using GCC 2.x.x will bomb on largefile support"
+ echo " use \`configure --disable-largefile' to avoid"
+ fi
+ ;;
+ esac
+ ;;
+
+ *x86_64*)
+ case "${gcc_version}" in
+ *3.3.*)
+ echo "WARNING! GCC ${gcc_version} has bugs that affect x86_64 AMOS"
+ echo " please install a newer version of GCC and reconfigure"
+ ;;
+ esac
+ ;;
+esac
+
+case "${gcc_version}" in
+ *2.96.*)
+ echo "WARNING! GCC ${gcc_version} has bugs that affect AMOS"
+ echo " please install a newer version of GCC and reconfigure"
+ ;;
+esac
+
+if test x"${PERL}" = x":" || ! test -x "${PERL}"; then
+ echo "WARNING! perl was not found but is required to run AMOS scripts"
+ echo " install perl if planning on using AMOS scripts"
+fi
+
+if test x"${PYTHON}" = x":" || ! test -x "${PYTHON}"; then
+ echo "WARNING! python was not found but is required to run goBambus2"
+ echo " install python if planning on using goBambus2"
+fi
+
+if test x"${NUCMER}" = x":" || ! test -x "${NUCMER}"; then
+ echo "WARNING! nucmer was not found but is required to run AMOScmp and minimus2"
+ echo " install nucmer if planning on using these programs"
+fi
+
+if test x"${DELTAFILTER}" = x":" || ! test -x "${DELTAFILTER}"; then
+ echo "WARNING! delta-filter was not found but is required to run AMOScmp-shortReads-alignmentTrimmed"
+ echo " install delta-filter if planning on using AMOScmp-shortReads-alignmentTrimmed"
+fi
+
+if test x"${SHOWCOORDS}" = x":" || ! test -x "${DELTAFILTER}"; then
+ echo "WARNING! show-coords was not found but is required to run minimus2"
+ echo " install show-coords if planning on using minimus2"
+fi
+
+if test x"${BLAT}" = x":" || ! test -x "${BLAT}"; then
+ echo "WARNING! BLAT was not found but is required to run minimus2-blat"
+ echo " install BLAT if planning on using minimus2-blat"
+fi
+
+if test x"${have_qt4}" != x"yes"; then
+ echo "WARNING! Qt4 toolkit was not found but is required to run AMOS GUIs"
+ echo " install Qt4 or locate Qt4 with configure to build GUIs"
+ echo " see config.log for more information on what went wrong"
+elif test x"${have_qt4_test}" != x"yes"; then
+ echo "WARNING! Qt4 toolkit malfunctioning but is required to run AMOS GUIs"
+ echo " try compiling GUIs manually or reinstall Qt4 toolkit to build GUIs"
+ echo " see config.log for more information on what went wrong"
+fi
+
+if test x"${have_boost}" != x"yes"; then
+ echo "WARNING! Boost graph toolkit was not found but is required to run parts of the AMOS Scaffolder (Bambus 2)"
+ echo " install Boost or locate Boost with configure to build Scaffolder"
+ echo " see config.log for more information on what went wrong"
+elif test x"${have_boost_test}" != x"yes"; then
+ echo "WARNING! Boost graph toolkit malfunctioning but is required to run parts of the AMOS Scaffolder (Bambus 2)"
+ echo " try compiling manually or reinstall Boost toolkit to build AMOS Scaffolder"
+ echo " see config.log for more information on what went wrong"
+fi
+
+if test x"${have_libz}" != x"yes"; then
+ echo "WARNING! libz was not found but is required for certain read trace IO"
+ echo " install libz if planning on using compressed trace formats"
+fi
+
+if test x"${LIBSTATISTICS_DESCRIPTIVE_PERL}" = x"0"; then
+ echo "WARNING! Statistics::Descriptive Perl module was not found but is required to run some AMOS scripts"
+fi
+
+if test x"${LIBXML_PARSER_PERL}" = x"0"; then
+ echo "WARNING! XML::Parser Perl module was not found but is required to run some AMOS scripts"
+fi
+
+if test x"${LIBDBI_PERL}" = x"0"; then
+ echo "WARNING! DBI Perl module was not found but is required to run some AMOS scripts"
+fi
+##-- END OF CONFIGURE --##
diff --git a/doc/AMOScmp.README b/doc/AMOScmp.README
new file mode 100644
index 0000000..3c130c4
--- /dev/null
+++ b/doc/AMOScmp.README
@@ -0,0 +1,109 @@
+AMOScmp - The AMOS Comparative Assembler
+
+
+Brief Summary
+=============
+
+ With the rapid growth in the number of sequenced genomes has come
+an increase in the number of organisms for which two or more
+closely-related species have been sequenced. This has created the
+possibility of building a comparative genome assembly algorithm, which
+can assemble a newly sequenced genome by mapping it onto a reference
+genome. The comparative assembler uses MUMmer to align each sequencing
+read to a reference genome. Given this information, the costly
+"overlap" step of assembly can be bypassed by placing each read using
+only its alignment to the reference. The consensus step can then build
+reliable contigs based on these read layouts. Such an approach
+drastically decreases the time and memory requirements for assembly,
+while producing better assemblies given a closely related reference
+genome.
+
+
+Dependencies
+============
+
+ AMOScmp requires the NUCmer whole genome alignment utility which is
+part of the MUMmer package. MUMmer is freely available and can be
+downloaded from:
+
+<http://mummer.sourceforge.net>
+
+Please follow the installation instructions in the `README' file in
+the base directory of this distribution to ensure AMOS can find and
+run `nucmer' successfully.
+
+
+Running
+=======
+
+ Either execute the AMOScmp configuration script directly from
+$bindir OR copy it to your local directory, edit it, and run it with
+the `runAmos' command interpreter. The following variables must be set
+on the command line or added to the script for the pipeline to
+operate properly:
+
+ TGT - The genome reads to map in AMOS message format
+ REF - The reference genome sequence in FASTA format
+
+`AMOScmp -D TGT=<reads> -D REF=<reference> <prefix>'
+ OR
+`runAmos -C AMOScmp -D TGT=<reads> -D REF=<reference> <prefix>'
+
+Where <prefix> will be the output file prefix, <reads> is the input
+AMOS message file, and <reference> is the input FASTA file. Check
+the `runAmos' documentation or type `runAmos --help' for details on
+operating an AMOS pipeline. The AMOScmp pipeline config file can be
+easily modified by the user to add additional processing steps.
+
+The default TGT file is <prefix>.afg and the default REF file is
+<prefix>.1con, thus if our input files are <prefix>.afg and
+<prefix>.1con we can run AMOScmp simply by typing:
+
+`AMOScmp <prefix>'
+
+
+Output
+======
+
+ Output will be a TIGR .contig file and a FASTA .fasta file. The
+TIGR contig file contains the gapped consensus and multi-alignment
+information for the assembly. Each contig sequence is preceded by a
+header line which starts with '##', followed by the gapped consensus
+sequence with gaps represented as a '-' character. Following the
+consensus is the gapped read sequence preceded by a header line
+beginning with '#'. The .fasta file contains all the contigs produced
+by AMOScmp in a multi-FASTA formatted file. These sequences will match
+the sequences in the .contig file, but without the gaps.
+
+ To obtain an ACE format representation of the assembly, we can run
+the following to obtain a <prefix>.ace file:
+
+`bank-report -b <prefix>.bnk CTG > <prefix>.ctg'
+`amos2ace <reads> <prefix>.ctg -o <prefix>.ace'
+
+Where <prefix> is the same as was used in the above section and
+<reads> is the original read input to the assembly pipeline. We can
+simply add these commands to the runAmos config file to produce an ACE
+file every time we run AMOScmp.
+
+
+Example
+=======
+
+ Assume we have a set of Trace Archive data with the names
+`reads.seq', `reads.qual' and `reads.xml' which contain the
+sequence information for a whole-genome assembly task. In addition, we
+have a closely related FASTA-formatted reference genome named
+`reference.1con'. To run the AMOScmp pipeline and generate the default
+output, we would type the following:
+
+`AMOScmp -D TGT=reads.afg -D REF=reference.1con target'
+
+This will generate the default output named `target.contig' and
+`target.fasta'. We could then generate an ACE assembly format file by
+following the instructions in the above section, substituting "target"
+for "<prefix>".
+
+
+December 2004
+
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 0000000..aa5a555
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,14 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+##-- TO BE INSTALLED
+dist_doc_DATA = \
+ AMOScmp.README \
+ runAmos.README \
+ minimus.README \
+ portability.README \
+ hawkeye.README \
+ amosvalidate.README
+
+##-- END OF MAKEFILE --##
diff --git a/doc/Makefile.in b/doc/Makefile.in
new file mode 100644
index 0000000..b75b4ea
--- /dev/null
+++ b/doc/Makefile.in
@@ -0,0 +1,475 @@
+# 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 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@
+DIST_COMMON = $(dist_doc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+subdir = doc
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(docdir)"
+DATA = $(dist_doc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+dist_doc_DATA = \
+ AMOScmp.README \
+ runAmos.README \
+ minimus.README \
+ portability.README \
+ hawkeye.README \
+ amosvalidate.README
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign doc/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign doc/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):
+install-dist_docDATA: $(dist_doc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)"
+ @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
+ done
+
+uninstall-dist_docDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(docdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(docdir)" && rm -f $$files
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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 $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(docdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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 mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_docDATA
+
+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:
+
+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 -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_docDATA
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-dist_docDATA 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 pdf \
+ pdf-am ps ps-am uninstall uninstall-am uninstall-dist_docDATA \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/doc/amosvalidate.README b/doc/amosvalidate.README
new file mode 100644
index 0000000..cb8e330
--- /dev/null
+++ b/doc/amosvalidate.README
@@ -0,0 +1 @@
+See <http://amos.sourceforge.net/forensics>
diff --git a/doc/hawkeye.README b/doc/hawkeye.README
new file mode 100644
index 0000000..1ae5d3a
--- /dev/null
+++ b/doc/hawkeye.README
@@ -0,0 +1 @@
+See <http://amos.sourceforge.net/hawkeye>
diff --git a/doc/minimus.README b/doc/minimus.README
new file mode 100644
index 0000000..04eeb5c
--- /dev/null
+++ b/doc/minimus.README
@@ -0,0 +1,114 @@
+minimus - The AMOS Lightweight Assembler
+
+
+Brief Summary
+=============
+
+ minimus is an assembly pipeline designed specifically for small
+data-sets, such as the set of reads covering a specific gene. Note that
+the code will work for larger assemblies (we have used it to assemble
+bacterial genomes), however, due to its stringency, the resulting assembly
+will be highly fragmented. For large and/or complex assemblies the execution
+of Minimus should be followed by additional processing steps, such as
+scaffolding.
+
+Minimus follows the Overlap-Layout-Consensus paradigm and consists of
+three main modules:
+
+ * overlapper - computes the overlaps between the reads using a
+ modified version of the Smith-Waterman local alignment algorithm
+
+ * tigger - uses the read overlaps to generate the layouts of reads
+ representing individual contigs
+
+ * make-consensus - refines the layouts produced by the tigger to
+ generate accurate multiple alignments within the reads
+
+
+Dependencies
+============
+
+ None.
+
+
+Running
+=======
+
+ Either execute the minimus configuration script directly from
+$bindir OR copy it to your local directory, edit it, and run it with
+the `runAmos' command interpreter. The following variables must be set
+on the command line or added to the script for the pipeline to operate
+properly:
+
+ TGT - The target genome sequences in AMOS message format
+
+`minimus -D TGT=<target> <prefix>'
+ OR
+`runAmos -C minimus -D TGT=<target> <prefix>'
+
+Where <prefix> will be the output file prefix, and <target> is the
+input AMOS message file. Check the `runAmos' documentation or type
+`runAmos --help' for details on operating an AMOS pipeline. The
+minimus pipeline config file can be easily modified by the user to add
+additional processing steps.
+
+ In order to run minimus you need to provide an AMOS formatted file
+of the reads. Such a file (commonly with extension .afg) can be
+generated from a combination of sequence (.seq), quality (.qual), and
+Trace Archive XML (.xml) files using the `tarchive2amos' program which
+will appear in the $bindir directory upon installation.
+
+The default TGT file is <prefix>.afg, thus if our input file is
+<prefix>.afg we can run minimus simply by typing:
+
+`minimus <prefix>'
+
+
+Output
+======
+
+ Output will be a TIGR .contig file and a FastA .fasta file. The
+TIGR contig file contains the gapped consensus and multi-alignment
+information for the assembly. Each contig sequence is preceded by a
+header line which starts with '##', followed by the gapped consensus
+sequence with gaps represented as a '-' character. Following the
+consensus is the gapped read sequence preceded by a header line
+beginning with '#'. The .fasta file contains all the contigs produced
+by AMOScmp in a multi-FastA formatted file. These sequences will match
+the sequences in the .contig file, but without the gaps.
+
+ To obtain an ACE format representation of the assembly, we can run
+the following to obtain a <prefix>.ace file:
+
+`bank-report -b <prefix>.bank CTG > <prefix>.ctg'
+`amos2ace <prefix>.afg <prefix>.ctg'
+
+Where <prefix> is the same as was used in the above section and
+<prefix>.afg is the original input to the assembly pipeline. We can
+simply add these commands to the runAmos config file to produce an ACE
+file every time we run minimus.
+
+
+Example
+=======
+
+ Assume we have a set of Trace Archive data with the names
+`target.seq', `target.qual' and `target.xml' which contain the
+sequence information for a small assembly task. To run the minimus
+pipeline and generate the default output, we would type the following:
+
+`tarchive2amos -o target.seq'
+`minimus -D TGT=target.afg target'
+
+This will generate the default output named `target.contig' and
+`target.fasta'. We could then generate an ACE assembly format file by
+following the instructions in the above section, substituting "target"
+for "<prefix>".
+
+ Minimus is now packaged with two example assemblies. The two examples
+are an Influenza A assembly and a Zebra Fish Gene assembly under the 'test'
+directory. The 'test' directory in located in the main AMOS diretory after you untar
+the AMOS tarball.
+
+
+November 2006
diff --git a/doc/portability.README b/doc/portability.README
new file mode 100644
index 0000000..c5eaa93
--- /dev/null
+++ b/doc/portability.README
@@ -0,0 +1,20 @@
+#-- List of functions and types with portable replacements
+# To use one of these functions in your code, you must:
+# 1) Add '-I$(top_builddir)/src/GNU' to your include path (CPPFLAGS)
+# 2) Link with '$(top_builddir)/src/GNU/libGNU.a' (LDADD)
+# 3) Place:
+# #if HAVE_CONFIG_H
+# #include "config.h"
+# #endif
+# At the top of your source file. autoconf/automake will take care of the rest.
+#
+
+getopt.h
+getopt
+getopt_long
+getopt_long_only
+optarg
+optind
+optopt
+strtod
+strtol
diff --git a/doc/runAmos.README b/doc/runAmos.README
new file mode 100644
index 0000000..f0a9258
--- /dev/null
+++ b/doc/runAmos.README
@@ -0,0 +1,215 @@
+runAmos - The AMOS pipeline executor
+
+
+Brief Summary
+=============
+
+ Most modern assembly programs (such as Celera Assembler or Arachne)
+consist of a series of modules, run in a pipeline fashion. The AMOS
+package includes a generic pipeline executor, runAmos, that allows
+users to define such pipelines. runAmos also includes several useful
+features: logging of the outputs of the modules, ability to start/stop
+at a specific point in the pipeline, as well as a mechanism for
+verifying the presence of the required inputs and for cleaning up the
+temporary files created during assembly.
+
+
+Running runAmos
+===============
+
+ runAmos reads the commands specified in a configuration file and
+executes them. The configuration file and output prefix are passed on
+the command line to the runAmos command interpreter as follows:
+
+runAmos [options] -C <config> [<par1> ... ]
+
+The optional command line parameters will be assigned to variables 0,
+1, ... . In addition, when provided, the first parameter will also be
+assigned to variable PREFIX. In the event no config file (-C
+<config>) is specified, runAmos will use the file specified in the
+environment variable AMOSCONF. This variable may be set in `bash'
+with:
+
+export AMOSCONF=/home/user/myfavorite.acf
+
+ OR in `csh' with:
+
+setenv AMOSCONF /home/user/myfavorite.acf
+
+To view the available runAmos command line options, type `runAmos -h'.
+
+The most important of these options being `-D <definition>', where
+<definition> is of the form NAME=value, e.g. `-D TGT=target.afg'. This
+allows the user to specify inputs to the pipeline by setting variables
+similar to PREFIX. See pipeline documentation for which variables
+should be defined on the command line.
+
+Runing runAmos with both command line option -h and -C will output
+help information specific to the configuration file.
+
+As runAmos executes the steps defined in a configuration file, it
+outputs to the screen the step number and the comment associated with
+each step (if specified). In addition, runAmos creates a log file
+named <prefix>.runAmos.log which contains the output (both stderr and
+stdout) of all commands run. If any of the steps fails, runAmos
+outputs an error message to stderr then exits with a code of 1.
+
+In addition, runAmos can be run implicitly from a configuration file
+using the shell's "shebang" notation. For example, if file "test.acf"
+starts with line:
+
+#!runAmos -C
+
+attempting to execute this file (assuming the "execute" permission is
+set) will be equivalent to running:
+
+runAmos -C test.acf
+
+
+Command line options
+====================
+
+-C <config_file> runAmos will execute the commands in <config_file>
+-s, -start <step> runAmos will begin the execution from step <step> in
+ the configuration file
+-e, -end <step> runAmos will end the execution before step <step> in
+ the configuration file
+-clean runAmos will remove all the files specified in the
+ TEMPS variable
+-ocd runAmos will test that all files specified in the
+ INPUTS variable are available and exit with an error
+ otherwise.
+-D <var_def> specify a variable definition (e.g. INPUTS=myfile) on
+ the command line. Multiple -D options may be specified
+ on the command line.
+
+
+Configuration file syntax
+=========================
+
+ The configuration file consists of a mixture of variable
+definitions, pipeline step definitions, and comments.
+
+
+Variables
+---------
+
+Variables are defined as follows:
+
+VARIABLE = 50
+
+All lines following this definition will recognize $(VARIABLE) and
+replace all instances with the value assigned by the definition (50 in
+this case). The special variable PREFIX is assigned to the first
+command line parameter, as described in the above section. In
+addition, all command line parameters are assigned to numbered
+variables $(0), $(1), ... . $(0) and $(PREFIX) are synonymous.
+
+If you want to require a specific number of command line parameters
+you can use the EXPECT operator anywhere within the configuration file
+(preferrably towards the beginning of the file). For example, `EXPECT 3'
+causes runAmos to exit if fewer than 3 command line parameters are
+provided.
+
+ Special variables INPUTS and TEMPS may be specified in the
+configuration file. The first should contain the required inputs for
+the programs in the pipeline. If the `-ocd' option is provided,
+runAmos will exit with an error if any of the files in the INPUTS
+variable is not present. If the `-clean' option is provided, runAmos
+will remove any file in the current directory that is specified in the
+TEMPS variable.
+
+ runAmos provides two special functions that are useful in processing
+variables:
+
+ $(shell <shell_command>) - evaluates to the output of the command
+<shell_command>
+ $(strip <suffix> <varname>) - strips the suffix <suffix> from the
+end of the variable <varname>
+
+Within the shell operator you can use AMOS variables, however you must
+the paranthesis using the '\' character.
+
+ Examples:
+
+DATE = $(shell date)
+FILE = test.afg
+PERMS = $(shell ls -l $(FILE\))
+PREF = $(strip .afg FILE)
+
+$(DATE) will evaluate to a string containing the current date
+$(PREF) will evaluate to the string "test"
+$(PERMS) will contain the permissions of test.afg as reported by ls
+
+
+Pipeline commands
+-----------------
+
+ Pipeline steps are defined in one of the following ways:
+
+10: runcommand $(PREFIX)
+
+ OR
+
+10:
+runcommand1 $(PREFIX)
+runcommand2 $(PREFIX)
+.
+
+In both cases the step number (10) is specified followed by a
+colon. In the first example the step consists of only one command. If
+the colon is followed by an end-of-line character, the step will
+consist of all the commands listed until a line consisting of a single
+period. Within such a multi-line step, runAmos allows the escaping of the end-of-line character using `\' to indicate the current command is continued on the next line. An example is shown below:
+
+10:
+for i in 1 2 3 4 ;do \
+echo $i; \
+done
+.
+
+Note that step numbers must be strictly increasing within the
+configuration file. runAmos will exit with an error otherwise.
+
+The step numbers can be used as parameters to the `-s' and `-e'
+command line options, to start or end the execution at a specific step
+number.
+
+
+Comments
+--------
+
+ Comments are defined in three manners:
+
+# this is a simple comment
+
+OR
+
+## this is a "step" comment
+
+OR
+
+#? this is part of the config file help information
+
+In the first case, a line beginning with a single `#' character, the
+entire line is ignored by runAmos.
+
+In the second case (line beginning with two `#' characters), the line
+is output to the screen as the step following it is being
+executed. This is useful to provide the user with a some information
+about the commands being run.
+
+In the third case (`#' followed by `?') the line is output when
+runAmos is run with both -h and -C options.
+
+
+Examples
+========
+
+ The `src/Pipeline' directory contains various AMOS configuration
+files for different pipelines. Any of these would suffice as an
+example of an AMOS config file (all files with .acf suffixes).
+
+
+March 2005
+
diff --git a/src/AMOS/BankStream_AMOS.cc b/src/AMOS/BankStream_AMOS.cc
new file mode 100644
index 0000000..a4b8e41
--- /dev/null
+++ b/src/AMOS/BankStream_AMOS.cc
@@ -0,0 +1,379 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 09/24/2003
+//!
+//! \brief Source for BankStream_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "BankStream_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ BankStream_t ================
+const Size_t BankStream_t::DEFAULT_BUFFER_SIZE = 1024;
+const Size_t BankStream_t::MAX_OPEN_PARTITIONS = 2;
+
+
+//----------------------------------------------------- assignEID --------------
+void BankStream_t::assignEID (ID_t iid, const string & eid)
+{
+ ID_t bid = lookupBID (iid);
+ string peid (idmap_m.lookupEID (iid));
+ idmap_m.remove (iid);
+
+ try {
+ triples_m [bid] = idmap_m.insert (iid, eid, bid);
+ }
+ catch (Exception_t) {
+ triples_m [bid] = idmap_m.insert (iid, peid, bid);
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- assignIID --------------
+void BankStream_t::assignIID (const string & eid, ID_t iid)
+{
+ ID_t bid = lookupBID (eid);
+ ID_t piid = idmap_m.lookupIID (eid);
+ idmap_m.remove (eid);
+
+ try {
+ triples_m [bid] = idmap_m.insert (iid, eid, bid);
+ }
+ catch (Exception_t) {
+ triples_m [bid] = idmap_m.insert (piid, eid, bid);
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- clean ------------------
+void BankStream_t::clean()
+{
+ Bank_t::clean();
+
+ init();
+
+ const IDMap_t::HashTriple_t * tp = NULL;
+ triples_m.resize (last_bid_m [version_m] + 1, tp);
+ for ( IDMap_t::const_iterator idmi = getIDMap().begin();
+ idmi != getIDMap().end(); ++ idmi )
+ triples_m [idmi->bid] = idmi;
+}
+
+
+//----------------------------------------------------- concat -----------------
+void BankStream_t::concat (BankStream_t & s)
+{
+ Bank_t::concat (s);
+
+ eof_m = !inrange();
+
+ const IDMap_t::HashTriple_t * tp = NULL;
+ triples_m.resize (last_bid_m [version_m] + 1, tp);
+ for ( IDMap_t::const_iterator idmi = getIDMap().begin();
+ idmi != getIDMap().end(); ++ idmi )
+ triples_m [idmi->bid] = idmi;
+
+ oldPartition_m = NULL;
+}
+
+
+//----------------------------------------------------- ignore -----------------
+BankStream_t & BankStream_t::ignore (bankstreamoff n)
+{
+ if ( ! is_open_m || ! (mode_m & B_READ) )
+ AMOS_THROW_IO ("Cannot ignore: bank not open for reading");
+
+ ID_t lid;
+ BankFlags_t bf;
+ bankstreamoff off;
+ BankPartition_t * partition;
+ Size_t skip = fix_size_m - sizeof (bankstreamoff) - sizeof (BankFlags_t);
+
+ while ( n > 0 && inrange() )
+ {
+ lid = curr_bid_m;
+ partition = localizeBID (lid);
+ off = lid * fix_size_m;
+
+ partition->fix.seekg (off);
+
+ partition->fix.ignore (sizeof (bankstreamoff));
+ readLE (partition->fix, &bf);
+ partition->fix.ignore (skip);
+
+ if ( ! bf.is_removed )
+ -- n;
+ ++ curr_bid_m;
+ }
+
+ oldPartition_m = NULL;
+
+ eof_m = !inrange();
+ return *this;
+}
+
+
+//----------------------------------------------------- open -------------------
+void BankStream_t::open (const std::string & dir, BankMode_t mode, Size_t version, bool inPlace)
+{
+ Bank_t::open (dir, mode, version, inPlace);
+
+ init();
+
+ const IDMap_t::HashTriple_t * tp = NULL;
+ triples_m.resize (last_bid_m [version_m] + 1, tp);
+ for ( IDMap_t::const_iterator idmi = getIDMap().begin();
+ idmi != getIDMap().end(); ++ idmi )
+ triples_m [idmi->bid] = idmi;
+}
+
+
+//----------------------------------------------------- operator>> -------------
+BankStream_t & BankStream_t::operator>> (IBankable_t & obj)
+{
+ if ( ! is_open_m || ! (mode_m & B_READ) )
+ AMOS_THROW_IO ("Cannot stream fetch: bank not open for reading");
+ if ( banktype_m != obj.getNCode() )
+ AMOS_THROW_ARGUMENT ("Cannot stream fetch: incompatible object type");
+ if ( eof() )
+ AMOS_THROW_ARGUMENT ("Cannot stream fetch: beyond end of stream");
+
+ ID_t lid;
+ BankFlags_t flags;
+ bankstreamoff off;
+ bankstreamoff vpos;
+ BankPartition_t * partition;
+ Size_t skip = fix_size_m - sizeof (bankstreamoff) - sizeof (BankFlags_t);
+
+ //-- Seek to the record and read the data
+ flags.is_removed = true;
+ while ( flags.is_removed )
+ {
+ if ( !inrange() )
+ {
+ eof_m = true;
+ return *this;
+ }
+
+ lid = curr_bid_m;
+ partition = localizeBID (lid);
+
+ if (partition != oldPartition_m)
+ {
+ off = lid * fix_size_m;
+ partition->fix.seekg (off);
+ oldPartition_m = partition;
+ }
+
+ readLE (partition->fix, &vpos);
+ readLE (partition->fix, &flags);
+ if ( flags.is_removed )
+ partition->fix.ignore (skip);
+
+ ++ curr_bid_m;
+ }
+
+
+ const IDMap_t::HashTriple_t * trip = triples_m [curr_bid_m - 1];
+ if ( trip == NULL )
+ {
+ obj.iid_m = NULL_ID;
+ obj.eid_m.erase();
+ }
+ else
+ {
+ obj.iid_m = trip->iid;
+ obj.eid_m.assign (trip->eid);
+ }
+
+ obj.flags_m = flags;
+
+ if (fixed_store_only_m)
+ {
+ obj.readRecordFix (partition->fix);
+ }
+ else
+ {
+ partition->var.seekg (vpos);
+ obj.readRecord (partition->fix, partition->var);
+
+ if ( partition->var.fail() )
+ AMOS_THROW_IO ("Unknown file read error in variable stream fetch, bank corrupted");
+ }
+
+ partition->fix.ignore (sizeof (Size_t));
+
+ if ( partition->fix.fail() )
+ AMOS_THROW_IO ("Unknown file read error in fixed stream fetch, bank corrupted");
+
+ return *this;
+}
+
+
+//--------------------------------------------------- operator<< -------------
+BankStream_t & BankStream_t::operator<< (IBankable_t & obj)
+{
+ oldPartition_m = NULL;
+
+ if ( ! is_open_m || ! (mode_m & B_WRITE) )
+ AMOS_THROW_IO ("Cannot stream append: bank not open for writing");
+ if ( banktype_m != obj.getNCode() )
+ AMOS_THROW_ARGUMENT ("Cannot stream append: incompatible object type");
+
+ //-- Insert the ID triple into the map (may throw exception)
+ triples_m.push_back
+ (idmap_m.insert (obj.iid_m, obj.eid_m, last_bid_m [version_m] + 1));
+
+ try {
+ //-- Add another partition if necessary
+ if ( last_bid_m [version_m] == max_bid_m )
+ addPartition (true);
+
+ BankPartition_t * partition = getLastPartition(localizeVersionBID(last_bid_m [version_m] + 1));
+
+ //-- Prepare the object for append
+ obj.flags_m.is_removed = false;
+ obj.flags_m.is_modified = false;
+
+ if ( !ate_m )
+ {
+ partition->fix.seekp (0, ios::end);
+ partition->var.seekp (0, ios::end);
+ ate_m = true;
+ }
+
+ //-- data is written in the following order to the FIX and VAR streams
+ // FIX = [VAR streampos] [BankableFlags] [OBJECT FIX] [VAR size]
+ // VAR = [OBJECT VAR]
+ bankstreamoff fpos = (std::streamoff)partition->fix.tellp();
+ bankstreamoff vpos = (std::streamoff)partition->var.tellp();
+ writeLE (partition->fix, &vpos);
+ writeLE (partition->fix, &(obj.flags_m));
+ obj.writeRecord (partition->fix, partition->var);
+ Size_t vsize = (std::streamoff)partition->var.tellp() - vpos;
+ writeLE (partition->fix, &vsize);
+
+ //-- If fix_size is not yet known, calculate it
+ Size_t fsize = (std::streamoff)partition->fix.tellp() - fpos;
+ if ( fix_size_m == 0 )
+ fix_size_m = fsize;
+
+ if ( fix_size_m != fsize ||
+ partition->fix.fail() ||
+ partition->var.fail() )
+ AMOS_THROW_IO
+ ("Unknown file write error in stream append, bank corrupted");
+
+ ++ nbids_m [version_m];
+ ++ last_bid_m [version_m];
+ }
+ catch (Exception_t) {
+ triples_m.pop_back();
+ idmap_m.remove (obj.iid_m);
+ idmap_m.remove (obj.eid_m);
+ throw;
+ }
+
+ return *this;
+}
+
+
+//----------------------------------------------------- replace ----------------
+void BankStream_t::replace (ID_t iid, IBankable_t & obj)
+{
+ ate_m = false;
+ oldPartition_m = NULL;
+
+ ID_t bid = lookupBID (iid);
+ string peid (idmap_m.lookupEID (iid));
+ idmap_m.remove (iid);
+
+ try {
+ triples_m [bid] = idmap_m.insert (obj.iid_m, obj.eid_m, bid);
+ }
+ catch (Exception_t) {
+ triples_m [bid] = idmap_m.insert (iid, peid, bid);
+ throw;
+ }
+
+ try {
+ replaceBID (bid, obj);
+ }
+ catch (Exception_t) {
+ idmap_m.remove (obj.iid_m);
+ triples_m [bid] = idmap_m.insert (iid, peid, bid);
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- replace ----------------
+void BankStream_t::replace (const string & eid, IBankable_t & obj)
+{
+ ate_m = false;
+ oldPartition_m = NULL;
+
+ ID_t bid = lookupBID (eid);
+ ID_t piid = idmap_m.lookupIID (eid);
+ idmap_m.remove (eid);
+
+ try {
+ triples_m [bid] = idmap_m.insert (obj.iid_m, obj.eid_m, bid);
+ }
+ catch (Exception_t) {
+ triples_m [bid] = idmap_m.insert (piid, eid, bid);
+ throw;
+ }
+
+ try {
+ replaceBID (bid, obj);
+ }
+ catch (Exception_t) {
+ idmap_m.remove (obj.eid_m);
+ triples_m [bid] = idmap_m.insert (piid, eid, bid);
+ throw;
+ }
+}
+
+
+//--------------------------------------------------- replaceByBID -----------
+void BankStream_t::replaceByBID(ID_t bid, IBankable_t & obj)
+{
+ if (bid < 0 || bid > last_bid_m [version_m] )
+ {
+ AMOS_THROW_IO ("Cannot replaceByBID: outside valid bid range");
+ }
+
+ oldPartition_m = NULL;
+
+ if (triples_m[bid])
+ {
+ if (triples_m[bid]->iid)
+ {
+ replace(triples_m[bid]->iid, obj);
+ }
+ else if (!triples_m[bid]->eid.empty())
+ {
+ replace(triples_m[bid]->eid, obj);
+ }
+ else
+ {
+ cerr << "WTF???" << endl;
+ }
+ }
+ else
+ {
+ ate_m = false;
+ replaceBID(bid, obj);
+ triples_m[bid] = idmap_m.insert(obj.iid_m, obj.eid_m, bid);
+ }
+}
+
diff --git a/src/AMOS/BankStream_AMOS.hh b/src/AMOS/BankStream_AMOS.hh
new file mode 100644
index 0000000..44c17bd
--- /dev/null
+++ b/src/AMOS/BankStream_AMOS.hh
@@ -0,0 +1,494 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 07/18/2003
+//!
+//! \brief Header for BankStream_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __BankStream_AMOS_HH
+#define __BankStream_AMOS_HH 1
+
+#include "Bank_AMOS.hh"
+#include <vector>
+
+
+
+
+namespace AMOS {
+
+//================================================ BankStream_t ================
+//! \brief Provides stream functionality for an AMOS data bank
+//!
+//! Allows input and output streaming of an AMOS data bank. This provides a way
+//! to iterate through object without IID or EID tags, since every object in
+//! the bank will be streamed in order regardless of its IDs. It is assumed
+//! that this class will be used to stream many consecutive objects, thus
+//! certain optimizations are made for this use case. For random access and
+//! frequent switches between fetch and append operations, the Bank_t class is
+//! more efficient. For fetching every object in a bank in order, or writing
+//! a large number of objects to a bank, this class is more efficient.
+//!
+//==============================================================================
+class BankStream_t : public Bank_t
+{
+
+protected:
+
+ static const Size_t DEFAULT_BUFFER_SIZE;
+ //!< IO buffer size
+
+ static const Size_t MAX_OPEN_PARTITIONS;
+ //!< Allowable simultaneously open partitions (one for >>, one for <<)
+
+
+ //--------------------------------------------------- init -------------------
+ //! \brief Initializes the stream variables
+ //!
+ void init()
+ {
+ oldPartition_m = NULL;
+ fixed_store_only_m = false;
+ eof_m = false;
+ curr_bid_m = 1;
+ ate_m = false;
+ triples_m . resize (1);
+ }
+
+
+ //--------------------------------------------------- inrange ----------------
+ bool inrange()
+ {
+ return ( curr_bid_m > 0 && curr_bid_m <= last_bid_m [version_m] );
+ }
+
+
+ bool fixed_store_only_m; //!< Just fetch from fixed store
+ bool eof_m; //!< eof error flag
+ ID_t curr_bid_m; //!< BID to be returned on next get
+ bool ate_m; //!< put pointers at end of bank
+ std::vector<const IDMap_t::HashTriple_t *> triples_m; //!< BID,EID,IID map
+
+ BankPartition_t * oldPartition_m;
+
+public:
+
+ enum bankseekdir
+ {
+ BEGIN,
+ CURR,
+ END
+ };
+
+
+ //--------------------------------------------------- BankStream_t -----------
+ //! \brief Constructs an empty BankStream_t of objects with a certain NCode
+ //!
+ //! Initializes members and sets BankStream type to the supplied value. All
+ //! future operations on this bank must be made with a Bankable type that is
+ //! compatibile with the supplied NCode.
+ //!
+ //! Once a BankStream is created with a certain NCode, only objects
+ //! compatible with that NCode can be used with that Bank. For instance, if
+ //! a BankStream is constructed with 'BankStream_t mybank (Read::NCODE);',
+ //! only Read_t objects could be used with mybank. Also, if a static NCode
+ //! member is not available 'BankStream_t mybank (Encode("RED"));'
+ //! will also work.
+ //!
+ //! \param type The type of Bank to construct
+ //!
+ BankStream_t (NCode_t type )
+ : Bank_t (type)
+ {
+ init();
+ triples_m [NULL_ID] = NULL;
+ buffer_size_m = DEFAULT_BUFFER_SIZE;
+ max_partitions_m = MAX_OPEN_PARTITIONS;
+ }
+
+
+ //--------------------------------------------------- BankStream_t -----------
+ BankStream_t (const std::string & type)
+ : Bank_t (type)
+ {
+ init();
+ triples_m [NULL_ID] = NULL;
+ buffer_size_m = DEFAULT_BUFFER_SIZE;
+ max_partitions_m = MAX_OPEN_PARTITIONS;
+ }
+
+
+ //--------------------------------------------------- ~BankStream_t ----------
+ ~BankStream_t()
+ {
+ if ( is_open_m )
+ close();
+ }
+
+
+ //--------------------------------------------------- append -----------------
+ void append (IBankable_t & obj)
+ {
+ operator<< (obj);
+ }
+
+
+ //--------------------------------------------------- assignEID --------------
+ void assignEID (ID_t iid, const std::string & eid);
+
+
+ //--------------------------------------------------- assignIID --------------
+ void assignIID (const std::string & eid, ID_t iid);
+
+
+ //--------------------------------------------------- clean ------------------
+ //! \post Stream reset to the beginning
+ //! \post Invalidates all bankstreamoff's and BID's
+ //!
+ void clean();
+
+
+ //--------------------------------------------------- clear ------------------
+ void clear()
+ {
+ init();
+ Bank_t::clear();
+ }
+
+
+ //--------------------------------------------------- close ------------------
+ void close()
+ {
+ init();
+ Bank_t::close();
+ }
+
+
+ //--------------------------------------------------- concat -----------------
+ //! \post Invalidates all source bankstreamoff's and BID's
+ //!
+ void concat (BankStream_t & source);
+
+
+ //--------------------------------------------------- create -----------------
+ void create (const std::string & dir, BankMode_t mode = B_READ | B_WRITE)
+ {
+ init();
+ Bank_t::create (dir, mode);
+ }
+
+
+ //--------------------------------------------------- destroy ----------------
+ void destroy()
+ {
+ init();
+ Bank_t::destroy();
+ }
+
+
+ //--------------------------------------------------- eof --------------------
+ //! \brief Checks if the end of stream flag has been set
+ //!
+ //! Returns true if a previous IO operation set the end of stream flag,
+ //! returns false if there have been no previous end of stream failures. The
+ //! eof flag only applies to fetch operations, append operations will never
+ //! raise the eof flag. Will return true if bank is closed.
+ //!
+ //! \return true if eof flag has been set, false otherwise
+ //!
+ bool eof() const
+ {
+ return ( is_open_m ? eof_m : true );
+ }
+
+
+ //--------------------------------------------------- fetch ------------------
+ void fetch (ID_t iid, IBankable_t & obj)
+ {
+ Bank_t::fetch (iid, obj);
+ oldPartition_m = NULL;
+ }
+
+ //--------------------------------------------------- fetch ------------------
+ void fetch (const std::string & eid, IBankable_t & obj)
+ {
+ Bank_t::fetch (eid, obj);
+ oldPartition_m = NULL;
+ }
+
+ //--------------------------------------------------- fetchFix ---------------
+ void fetchFix (ID_t iid, IBankable_t & obj)
+ {
+ Bank_t::fetchFix(iid, obj);
+ oldPartition_m = NULL;
+ }
+
+ //--------------------------------------------------- fetchFix ---------------
+ void fetchFix (const std::string & eid, IBankable_t & obj)
+ {
+ Bank_t::fetchFix(eid, obj);
+ oldPartition_m = NULL;
+ }
+
+
+
+ //--------------------------------------------------- ignore -----------------
+ //! \brief Ignores the next n stream objects
+ //!
+ //! Only slightly more efficient than fetching n records. Seeking past the
+ //! end of stream will set the eof flag.
+ //!
+ //! \pre The bank is open for reading
+ //! \param n The number of objects to skip in the stream
+ //! \throws IOException_t
+ //! \return The updated BankStream
+ //!
+ BankStream_t & ignore (bankstreamoff n);
+
+
+ //--------------------------------------------------- open -------------------
+ void open (const std::string & dir, BankMode_t mode = B_READ | B_WRITE, Size_t version = OPEN_LATEST_VERSION, bool inPlace = true);
+
+
+ //--------------------------------------------------- remove -----------------
+ //! \post Invalidates only the BID of the removed object
+ //!
+ void remove (ID_t iid)
+ {
+ ate_m = false;
+
+ ID_t bid = lookupBID (iid);
+ removeBID (bid);
+ triples_m [bid] = NULL;
+ idmap_m . remove (iid);
+
+ oldPartition_m = NULL;
+ }
+
+
+ //--------------------------------------------------- remove -----------------
+ void remove (const std::string & eid)
+ {
+ ate_m = false;
+
+ ID_t bid = lookupBID (eid);
+ removeBID (bid);
+ triples_m [bid] = NULL;
+ idmap_m . remove (eid);
+
+ oldPartition_m = NULL;
+ }
+
+ //--------------------------------------------------- remove -----------------
+ void removeByBID(ID_t bid)
+ {
+ if (bid < 0 || bid > last_bid_m [version_m] )
+ {
+ AMOS_THROW_IO ("Cannot replaceByBID: outside valid bid range");
+ }
+
+ ate_m = false;
+ removeBID(bid);
+
+ if (triples_m[bid])
+ {
+ if (triples_m[bid]->iid)
+ {
+ idmap_m.remove(triples_m[bid]->iid);
+ }
+ else if (!triples_m[bid]->eid.empty())
+ {
+ idmap_m.remove(triples_m[bid]->eid);
+ }
+
+ triples_m[bid] = NULL;
+ }
+
+ oldPartition_m = NULL;
+ }
+
+
+ //--------------------------------------------------- replace ----------------
+ void replace (ID_t iid, IBankable_t & obj);
+
+
+ //--------------------------------------------------- replace ----------------
+ void replace (const std::string & eid, IBankable_t & obj);
+
+
+ //--------------------------------------------------- replaceByBID -----------
+ void replaceByBID(ID_t bid, IBankable_t & obj);
+
+
+
+ //--------------------------------------------------- setFixedStoreOnly ------
+ //! \brief Controls if operator>> should read the fixed store only or with variable store
+ //!
+ //! Controls if operator>> should read the fixed store only, or also read the
+ //! variable store information as well. By default read both stores.
+ //!
+ //! \param onlyFixed If only the fixed store should be read
+ //!
+ void setFixedStoreOnly(bool onlyFixed)
+ {
+ fixed_store_only_m = onlyFixed;
+ }
+
+
+ //--------------------------------------------------- seekg ------------------
+ //! \brief Seeks to a different position in the BankStream
+ //!
+ //! Seek to a position + offest. bankseekdir's are defined as
+ //! BEGIN,CURR,END. Where BEGIN is the start of the stream, CURR is the
+ //! current position in the stream and END is one past the last record in
+ //! the stream. Only slightly more efficient than fetching the same number
+ //! of records. Seeking past the end of stream will set the eof flag.
+ //!
+ //! \pre The bank is open for reading
+ //! \param off Number of records to offset from dir
+ //! \param dir The position from which to begin offest
+ //! \throws IOException_t
+ //! \return The updated BankStream
+ //!
+ BankStream_t & seekg (bankstreamoff off, bankseekdir dir)
+ {
+ if ( ! is_open_m || ! (mode_m & B_READ) )
+ AMOS_THROW_IO ("Cannot seekg: bank not open for reading");
+
+ switch ( dir )
+ {
+ case BEGIN: curr_bid_m = 1; break;
+ case END: curr_bid_m = last_bid_m [version_m] + 1; break;
+ case CURR: break;
+ default: AMOS_THROW ("Cannot seekg: bad bankseekdir value");
+ }
+ ignore (off);
+ oldPartition_m = NULL;
+
+ return *this;
+ }
+
+
+ //--------------------------------------------------- seekg ------------------
+ //! \brief Seeks to a different position in the BankStream
+ //!
+ //! This function is constant time. Seeking past the end of stream will set
+ //! the eof flag. The get pointer is the bank index (BID) of the next object
+ //! to be fetched.
+ //!
+ //! \pre The bank is open for reading
+ //! \param pos The stream position to seek to (1 based bank index)
+ //! \throws IOException_t
+ //! \return The updated BankStream
+ //!
+ BankStream_t & seekg (ID_t pos)
+ {
+ if ( ! is_open_m || ! (mode_m & B_READ) )
+ AMOS_THROW_IO ("Cannot seekg: bank not open for reading");
+
+ if ( pos != curr_bid_m )
+ {
+ curr_bid_m = pos;
+ eof_m = !inrange();
+ }
+
+ oldPartition_m = NULL;
+
+ return *this;
+ }
+
+
+ //--------------------------------------------------- tellg ------------------
+ //! \brief Return the current position of the get pointer
+ //!
+ //! Returns the current position of the get pointer. The get pointer is the
+ //! bank index (BID) of the next object to be fetched. Note that the
+ //! difference between two stream positions does NOT tell you how many objects
+ //! are in between because some of them may be deleted.
+ //!
+ //! \return The current position of the get pointer
+ //!
+ ID_t tellg() const
+ {
+ return curr_bid_m;
+ }
+
+
+ //--------------------------------------------------- tellp ------------------
+ //! \brief Return the current position of the put pointer
+ //!
+ //! Returns the current position of the put pointer. The put pointer is the
+ //! bank index (BID) of the next object to be appended. Note that the
+ //! difference between two stream positions does NOT tell you how many objects
+ //! are in between because some of them may be deleted.
+ //!
+ //! \return The current position of the put pointer
+ //!
+ ID_t tellp() const
+ {
+ return last_bid_m [version_m] + 1;
+ }
+
+
+ //--------------------------------------------------- operator bool() --------
+ //! \brief Cast the BankStream to a bool reflecting the state of !eof()
+ //!
+ //! \return The evaluation of !eof()
+ //!
+ operator bool() const
+ {
+ return !eof();
+ }
+
+
+ //--------------------------------------------------- operator! --------------
+ //! \brief Evaluate eof() and return
+ //!
+ //! \return The evaluation of eof()
+ //!
+ bool operator!() const
+ {
+ return eof();
+ }
+
+
+ //--------------------------------------------------- operator>> -------------
+ //! \brief Fetch the next object in the BankStream
+ //!
+ //! If the operation fails, obj will be unaltered and the eof flag will be
+ //! set, thus the resulting stream will return true for eof(). To iterate
+ //! through all objects in the bank, 'while ( bankstream >> obj )' will
+ //! suffice since the stream returned from the fetch will be cast to a bool
+ //! reflecting the success/failure of the operation.
+ //!
+ //! When called after setFixedStoreOnly(true), then only read the fixed
+ //! store information. For example, reads store clear ranges, lengths, and
+ //! other meta data in the fixed store, and sequences and quality values
+ //! in the variable store.
+ //!
+ //! \pre The bank is open for reading
+ //! \pre obj is compatible with the banktype
+ //! \pre The eof flag is not set
+ //! \throws ArgumentException_t
+ //! \throws IOException_t
+ //! \return The modified BankStream
+ //!
+ BankStream_t & operator>> (IBankable_t & obj);
+
+
+ //--------------------------------------------------- operator<< -------------
+ //! \brief Append a new object to the BankStream
+ //!
+ //! \pre The bank is open for writing
+ //! \pre obj is compatible with the banktype
+ //! \throws ArgumentException_t
+ //! \throws IOException_t
+ //! \return The modified BankStream
+ //!
+ BankStream_t & operator<< (IBankable_t & obj);
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __BankStream_AMOS_HH
diff --git a/src/AMOS/Bank_AMOS.cc b/src/AMOS/Bank_AMOS.cc
new file mode 100644
index 0000000..792a211
--- /dev/null
+++ b/src/AMOS/Bank_AMOS.cc
@@ -0,0 +1,1326 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 09/24/2003
+//!
+//! \brief Source for Bank_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Bank_AMOS.hh"
+#include "Message_AMOS.hh"
+#include <sstream>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <cstdlib>
+#include <cstdio>
+#include <ctime>
+#include <cstring>
+#include <sstream>
+#include <iostream>
+using namespace AMOS;
+using namespace std;
+
+#define _PUBSETBUF_ pubsetbuf
+#ifdef __GNUC__
+# if __GNUC__ < 3
+# undef _PUBSETBUF_
+# define _PUBSETBUF_ setbuf
+# endif
+#endif
+
+#define LOCK_TIME 5
+#define DIR_MODE 00755
+#define FILE_MODE 00644
+
+
+
+
+//================================================ Bank_t ======================
+const Size_t Bank_t::DEFAULT_BUFFER_SIZE = 1024;
+const Size_t Bank_t::DEFAULT_PARTITION_SIZE = 1000000;
+const Size_t Bank_t::MAX_OPEN_PARTITIONS = 20;
+
+const string Bank_t::BANK_VERSION = "3.0";
+
+const string Bank_t::FIX_STORE_SUFFIX = ".fix";
+const string Bank_t::IFO_STORE_SUFFIX = ".ifo";
+const string Bank_t::LCK_STORE_SUFFIX = ".lck";
+const string Bank_t::VAR_STORE_SUFFIX = ".var";
+const string Bank_t::MAP_STORE_SUFFIX = ".map";
+const string Bank_t::TMP_STORE_SUFFIX = ".tmp";
+
+const char Bank_t::WRITE_LOCK_CHAR = 'w';
+const char Bank_t::READ_LOCK_CHAR = 'r';
+
+const int32_t Bank_t::OPEN_LATEST_VERSION = -1;
+
+void Bank_t::copyFile(fstream &in, ofstream &out) {
+ in.seekg(0, std::ios::beg);
+ out << in.rdbuf();
+ out.flush();
+ return;
+
+ in.seekg(0, std::ios::beg);
+
+ char buf[1000];
+ while ( in ) {
+ in.read(buf, 1000);
+ out << buf;
+ }
+ if ( in.bad() )
+ AMOS_THROW_IO ("Cannot create version, error copying existing data");
+}
+
+//----------------------------------------------------- nextVersion ------------
+void Bank_t::nextVersion ( )
+{
+ if ( ! is_open_m || ! (mode_m & B_WRITE) )
+ AMOS_THROW_IO ("Cannot create version, bank not open for writing");
+
+ // copy all partitons and map to the next version
+ version_m++;
+ nversions_m = version_m + 1;
+ // copy size information
+ ID_t *new_nbids = new ID_t[nversions_m];
+ ID_t *new_last = new ID_t[nversions_m];
+ for (ID_t i = 0; i != nversions_m - 1; i++) {
+ new_nbids[i] = nbids_m[i];
+ new_last[i] = last_bid_m[i];
+ }
+ new_nbids[version_m] = new_nbids[version_m - 1];
+ new_last[version_m] = new_last[version_m - 1];
+ delete[] nbids_m;
+ delete[] last_bid_m;
+ nbids_m = new_nbids;
+ last_bid_m = new_last;
+
+ string new_map_name = getMapPath();
+ touchFile (new_map_name, FILE_MODE, true);
+
+ ofstream new_map (new_map_name.c_str());
+ idmap_m.write(new_map);
+ new_map.close();
+
+ // now finally copy all partitions and initialize them
+ for (ID_t i = 0; i != npartitions_m; i++) {
+ copyPartition(i);
+ }
+}
+
+void Bank_t::copyPartition(ID_t &id) {
+ if (id > npartitions_m) {
+ AMOS_THROW_IO("Invalid partition specified for copy");
+ }
+
+ vector<BankPartition_t *>* partitions = partitions_m[id];
+ BankPartition_t * partition = new BankPartition_t (buffer_size_m);
+ partitions->push_back (partition);
+
+ ostringstream ss;
+
+ ss << store_pfx_m << '.' << version_m << '.' << id << FIX_STORE_SUFFIX;
+ partition->fix_name = ss.str();
+ ss.str (NULL_STRING);
+
+ ss << store_pfx_m << '.' << version_m << '.' << id << VAR_STORE_SUFFIX;
+ partition->var_name = ss.str();
+ ss.str (NULL_STRING);
+
+ BankPartition_t * prevVersion = getPartition(id, version_m - 1);
+ touchFile (prevVersion->fix_name, FILE_MODE, false);
+ touchFile (prevVersion->fix_name, FILE_MODE, false);
+
+ ios::openmode mode = ios::binary | ios::trunc | ios::in;
+ touchFile (partition->fix_name, FILE_MODE, true);
+ ofstream output (partition->fix_name.c_str(), (mode | ios::out));
+ copyFile(prevVersion->fix, output);
+ output.close();
+
+ touchFile (partition->var_name, FILE_MODE, true);
+ output.open(partition->var_name.c_str(), (mode | ios::out));
+ copyFile(prevVersion->var, output);
+ output.close();
+}
+
+//----------------------------------------------------- addPartition -----------
+void Bank_t::addPartition (bool create)
+{
+ // add this partition in all versions of the bank
+ vector<BankPartition_t *> * partitions = new vector<BankPartition_t *>();
+
+ for (Size_t i = 0; i < nversions_m; i++) {
+ //-- Allocate the new partition and add it to the list
+ BankPartition_t * partition = new BankPartition_t (buffer_size_m);
+ partitions->push_back (partition);
+
+ try {
+ ostringstream ss;
+
+ ss << store_pfx_m << '.' << i << '.' << npartitions_m << FIX_STORE_SUFFIX;
+ partition->fix_name = ss.str();
+ ss.str (NULL_STRING);
+
+ ss << store_pfx_m << '.' << i << '.' << npartitions_m << VAR_STORE_SUFFIX;
+ partition->var_name = ss.str();
+ ss.str (NULL_STRING);
+
+ //-- Try to create/open the FIX and VAR partition files
+ touchFile (partition->fix_name, FILE_MODE, create);
+ touchFile (partition->var_name, FILE_MODE, create);
+ }
+ catch (Exception_t) {
+ partitions_m.pop_back();
+ delete partition;
+ throw;
+ }
+ }
+ partitions_m.push_back(partitions);
+
+ //-- If partition size is unset, use the default
+ if ( partition_size_m == 0 )
+ partition_size_m = DEFAULT_PARTITION_SIZE;
+
+ //-- New partition, so new max index and number of partitions
+ max_bid_m = ++ npartitions_m * partition_size_m;
+}
+
+
+//----------------------------------------------------- append -----------------
+void Bank_t::append (IBankable_t & obj)
+{
+ //-- Insert the ID triple into the map (may throw exception)
+ idmap_m.insert (obj.iid_m, obj.eid_m, last_bid_m [version_m] + 1);
+
+ try {
+ appendBID (obj);
+ }
+ catch (Exception_t) {
+ idmap_m.remove (obj.iid_m);
+ idmap_m.remove (obj.eid_m);
+ throw;
+ }
+}
+
+//----------------------------------------------------- appendBID --------------
+void Bank_t::appendBID (IBankable_t & obj)
+{
+ if ( ! is_open_m || ! (mode_m & B_WRITE) )
+ AMOS_THROW_IO ("Cannot append, bank not open for writing");
+ if ( banktype_m != obj.getNCode() )
+ AMOS_THROW_ARGUMENT ("Cannot append, incompatible object type");
+
+ //-- Add another partition if necessary
+ if ( last_bid_m [version_m] == max_bid_m )
+ addPartition (true);
+
+ BankPartition_t * partition = getLastPartition(localizeVersionBID(last_bid_m [version_m] + 1));
+
+ //-- Prepare the object for append
+ obj.flags_m.is_removed = false;
+ obj.flags_m.is_modified = false;
+
+ //-- data is written in the following order to the FIX and VAR streams
+ // FIX = [VAR streampos] [BankableFlags] [OBJECT FIX] [VAR size]
+ // VAR = [OBJECT VAR]
+ partition->fix.seekp (0, ios::end);
+ partition->var.seekp (0, ios::end);
+ bankstreamoff fpos = partition->fix.tellp();
+ bankstreamoff vpos = partition->var.tellp();
+ writeLE (partition->fix, &vpos);
+ writeLE (partition->fix, &(obj.flags_m));
+ obj.writeRecord (partition->fix, partition->var);
+ Size_t vsize = (std::streamoff)partition->var.tellp() - vpos;
+ writeLE (partition->fix, &vsize);
+
+ //-- If fix_size is not yet known, calculate it
+ Size_t fsize = (std::streamoff)partition->fix.tellp() - fpos;
+ if ( fix_size_m == 0 )
+ fix_size_m = fsize;
+
+ if ( fix_size_m != fsize ||
+ partition->fix.fail() ||
+ partition->var.fail() )
+ AMOS_THROW_IO ("Unknown file write error in append, bank corrupted");
+
+ ++ nbids_m [version_m];
+ ++ last_bid_m [version_m];
+}
+
+
+//----------------------------------------------------- assignEID --------------
+void Bank_t::assignEID (ID_t iid, const string & eid)
+{
+ ID_t bid = lookupBID (iid);
+ string peid (idmap_m.lookupEID (iid));
+ idmap_m.remove (iid);
+
+ try {
+ idmap_m.insert (iid, eid, bid);
+ }
+ catch (Exception_t) {
+ idmap_m.insert (iid, peid, bid);
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- assignIID --------------
+void Bank_t::assignIID (const string & eid, ID_t iid)
+{
+ ID_t bid = lookupBID (eid);
+ ID_t piid = idmap_m.lookupIID (eid);
+ idmap_m.remove (eid);
+
+ try {
+ idmap_m.insert (iid, eid, bid);
+ }
+ catch (Exception_t) {
+ idmap_m.insert (piid, eid, bid);
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- clean ------------------
+void Bank_t::clean()
+{
+ if ( ! is_open_m || ! (mode_m & B_READ && mode_m & B_WRITE) )
+ AMOS_THROW_IO ("Cannot clean, bank not open for reading and writing");
+
+ //-- Create a temporary bank of similar type and concat this bank to it
+ Bank_t tmpbnk (banktype_m);
+
+ try {
+ //-- Concat this bank to a temporary bank (cleans as a side effect)
+ string tname = store_pfx_m + TMP_STORE_SUFFIX;
+ mkdir (tname.c_str(), DIR_MODE);
+ tmpbnk.create (tname);
+ tmpbnk.concat (*this);
+
+ //-- Reset this bank
+ clear();
+ fix_size_m = tmpbnk.fix_size_m;
+ partition_size_m = tmpbnk.partition_size_m;
+ delete[] last_bid_m;
+ last_bid_m = new ID_t[tmpbnk.nversions_m];
+ for (ID_t i = 0; i != tmpbnk.nversions_m; i++)
+ last_bid_m[i] = tmpbnk.last_bid_m[i];
+ delete[] nbids_m;
+ nbids_m = new ID_t[tmpbnk.nversions_m];
+ for (ID_t i = 0; i != tmpbnk.nversions_m; i++)
+ nbids_m[i] = tmpbnk.nbids_m[i];
+ idmap_m = tmpbnk.idmap_m;
+
+ //-- Link back the now cleaned partitions
+ for ( Size_t i = 0; i != tmpbnk.npartitions_m; ++ i )
+ {
+ while ( i >= npartitions_m )
+ addPartition (true);
+
+ for (Size_t version = 0; version != tmpbnk.nversions_m; ++ version) {
+ unlink ((*partitions_m [i]) [version]->fix_name.c_str());
+ unlink ((*partitions_m [i]) [version]->var_name.c_str());
+ if ( link ((*tmpbnk.partitions_m [i]) [version]->fix_name.c_str(),
+ (*partitions_m [i]) [version]->fix_name.c_str()) ||
+ link ((*tmpbnk.partitions_m [i]) [version]->var_name.c_str(),
+ (* partitions_m [i]) [version]->var_name.c_str()) )
+ AMOS_THROW_IO ("Unknown file link error in clean, bank corrupted");
+ }
+ }
+ }
+ catch (Exception_t) {
+ if ( tmpbnk.isOpen() )
+ tmpbnk.destroy();
+ throw;
+ }
+
+ //-- Destroy the temporary bank
+ tmpbnk.destroy();
+}
+
+
+//----------------------------------------------------- clear ------------------
+void Bank_t::clear () {
+ for (Size_t version = 0; version != nversions_m; ++version) {
+ clearVersion (version, false);
+ }
+ for ( Size_t i = 0; i != npartitions_m; ++ i )
+ {
+ delete (partitions_m[i]);
+ }
+
+ delete[] last_bid_m;
+ delete[] nbids_m;
+
+ nversions_m = 1;
+ last_bid_m = new ID_t[nversions_m];
+ memset(last_bid_m, NULL_ID, nversions_m*sizeof(ID_t));
+ max_bid_m = NULL_ID;
+ nbids_m = new ID_t[nversions_m];
+ memset(nbids_m, NULL_ID, nversions_m*sizeof(ID_t));
+ npartitions_m = 0;
+ partition_size_m = 0;
+ opened_m .clear();
+ partitions_m.clear();
+ idmap_m .clear();
+ idmap_m .setType (banktype_m);
+}
+
+void Bank_t::clearVersion (Size_t &version, bool recreate)
+{
+ if ( ! is_open_m ) return;
+ if ( ! (mode_m & B_WRITE) )
+ AMOS_THROW_IO ("Cannot clear, bank not open for writing");
+
+ //-- Close, unlink and free the partition files
+ for ( Size_t i = 0; i != npartitions_m; ++ i )
+ {
+ (*partitions_m [i]) [version]->fix.close();
+ (*partitions_m [i]) [version]->var.close();
+ unlink ((*partitions_m [i]) [version]->fix_name.c_str());
+ unlink ((*partitions_m [i]) [version]->var_name.c_str());
+ delete ((*partitions_m [i]) [version]);
+
+ if (recreate) {
+ (*partitions_m [i]) [version] = new BankPartition_t( buffer_size_m );
+ try {
+ ostringstream ss;
+
+ ss << store_pfx_m << '.' << version << '.' << i << FIX_STORE_SUFFIX;
+ (*partitions_m [i]) [version]->fix_name = ss.str();
+ ss.str (NULL_STRING);
+
+ ss << store_pfx_m << '.' << version << '.' << i << VAR_STORE_SUFFIX;
+ (*partitions_m [i]) [version]->var_name = ss.str();
+ ss.str (NULL_STRING);
+
+ //-- Try to create/open the FIX and VAR partition files
+ touchFile ((*partitions_m [i]) [version]->fix_name, FILE_MODE, true);
+ touchFile ((*partitions_m [i]) [version]->var_name, FILE_MODE, true);
+ }
+ catch (Exception_t) {
+ delete (*partitions_m [i] ) [version];
+ throw;
+ }
+ }
+ }
+}
+
+
+//----------------------------------------------------- close ------------------
+void Bank_t::close()
+{
+ if ( ! is_open_m ) return;
+
+ if ( (mode_m & B_WRITE) )
+ {
+ //-- Flush MAP partition
+ string map_path = getMapPath();
+ ofstream map_stream (map_path.c_str());
+ if ( ! map_stream.is_open() )
+ AMOS_THROW_IO ("Could not open bank partition, " + map_path);
+
+ idmap_m.write (map_stream);
+
+ if ( map_stream.fail() )
+ AMOS_THROW_IO ("Unknown file write error in close, bank corrupted");
+ map_stream.close();
+ }
+
+ //-- Close/free the partitions
+ for ( Size_t i = 0; i != npartitions_m; i ++ ) {
+ for (Size_t version = 0; version != nversions_m; version++) {
+ delete ((*partitions_m [i]) [version]);
+ }
+ delete partitions_m[i];
+ }
+
+ //-- Sync the IFO partition
+ syncIFO (I_CLOSE);
+
+ //-- Reset
+ init();
+}
+
+
+//----------------------------------------------------- concat -----------------
+void Bank_t::concat (Bank_t & s)
+{
+ if ( ! is_open_m || ! (mode_m & B_WRITE) )
+ AMOS_THROW_IO ("Cannot concat, bank not open for writing");
+ if ( ! s.is_open_m || ! (s.mode_m & B_READ) )
+ AMOS_THROW_IO ("Cannot concat, source bank not open for reading");
+ if ( banktype_m != s.banktype_m )
+ AMOS_THROW_ARGUMENT ("Cannot concat, incompatible bank type");
+
+ Size_t size;
+ Size_t tail = s.fix_size_m - sizeof (bankstreamoff) - sizeof (BankFlags_t);
+ BankFlags_t flags;
+
+ Size_t buffer_size = s.fix_size_m;
+ char * buffer = (char *) SafeMalloc (buffer_size);
+
+ bankstreamoff vpos;
+ BankPartition_t * sp;
+ BankPartition_t * tp = getLastPartition(version_m);
+
+ //-- Set up the BID lookup table
+ const IDMap_t::HashTriple_t * stp = NULL;
+ vector<const IDMap_t::HashTriple_t *> striples (s.last_bid_m [s.version_m] + 1, stp);
+ for ( IDMap_t::const_iterator idmi = s.getIDMap().begin();
+ idmi != s.getIDMap().end(); ++ idmi )
+ striples [idmi->bid] = idmi;
+
+ //-- Seek to the end of current bank
+ tp->fix.seekp (0, ios::end);
+ tp->var.seekp (0, ios::end);
+
+ //-- For each source partition
+ ID_t sbid = 0;
+ for ( Size_t i = 0; i != s.npartitions_m; ++ i )
+ {
+ //-- Seek to the beginning of source partition
+ sp = s.getPartition (i, s.version_m);
+
+ sp->fix.seekg (0);
+
+ while ( true )
+ {
+ //-- Read vpos and Bankable flags, break on EOF
+ readLE (sp->fix, &vpos);
+ readLE (sp->fix, &flags);
+ if ( sp->fix.eof() )
+ break;
+ ++ sbid;
+
+ //-- Ignore record if deleted flag is set
+ if ( flags.is_removed )
+ {
+ sp->fix.ignore (tail);
+ continue;
+ }
+ //-- Skip to the data
+ sp->var.seekg (vpos);
+
+ //-- Get the source triple and add it to the new bank
+ if ( (stp = striples [sbid]) != NULL )
+ idmap_m.insert (stp->iid, stp->eid, last_bid_m [version_m] + 1);
+
+ //-- Add new partition if necessary
+ if ( last_bid_m [version_m] == max_bid_m )
+ {
+ try {
+ addPartition (true);
+ tp = getLastPartition(version_m);
+ }
+ catch (Exception_t) {
+ if ( stp != NULL )
+ {
+ idmap_m.remove (stp->iid);
+ idmap_m.remove (stp->eid);
+ }
+ throw;
+ }
+ }
+
+ //-- Write new vpos and copy Bankable flags
+ vpos = (std::streamoff)tp->var.tellp();
+ writeLE (tp->fix, &vpos);
+ writeLE (tp->fix, &flags);
+
+ //-- Copy object FIX data
+ sp->fix.read (buffer, tail - sizeof (Size_t));
+ readLE (sp->fix, &size);
+ tp->fix.write (buffer, tail - sizeof (Size_t));
+ writeLE (tp->fix, &size);
+
+ //-- Make sure buffer is big enough for VAR data, realloc if needed
+ while ( size > buffer_size )
+ {
+ buffer_size <<= 1;
+ buffer = (char *) SafeRealloc (buffer, buffer_size);
+ }
+
+ //-- Copy object VAR data
+ sp->var.read (buffer, size);
+ tp->var.write (buffer, size);
+
+ //-- Check the streams
+ if ( sp->fix.fail() || sp->var.fail() )
+ AMOS_THROW_IO("Unknown file read error in concat, bank corrupted");
+ if ( tp->fix.fail() || tp->var.fail() )
+ AMOS_THROW_IO("Unknown file write error in concat, bank corrupted");
+
+ ++ nbids_m [version_m];
+ ++ last_bid_m [version_m];
+ }
+ }
+
+ //-- Update fix_size if needed and flush new bank info
+ if ( fix_size_m == 0 )
+ fix_size_m = s.fix_size_m;
+
+ free (buffer);
+}
+
+
+//----------------------------------------------------- create -----------------
+void Bank_t::create (const string & dir, BankMode_t mode)
+{
+ if ( ! (mode & B_WRITE) )
+ AMOS_THROW_IO ("Cannot create, bank not opened for writing");
+ setMode (mode);
+
+ if ( is_open_m ) close();
+
+ //-- Destroy any pre-existing bank
+ if ( exists (dir) )
+ {
+ open (dir, mode); // side effect: resets the mode
+ destroy();
+ }
+
+ //TODO eliminate race conditions
+
+ try {
+ //-- Initialize the bank
+ is_open_m = true;
+ store_dir_m = dir;
+ store_pfx_m = dir + '/' + Decode (banktype_m);
+ mkdir (store_dir_m.c_str(), DIR_MODE);
+
+ nversions_m = 1;
+ version_m = 0;
+ is_inplace_m = true;
+
+ //-- Try to create the IFO and MAP partition files
+ touchFile (store_pfx_m + IFO_STORE_SUFFIX, FILE_MODE, true);
+ touchFile (getMapPath(), FILE_MODE, true);
+
+ //-- Create the IFO partition
+ syncIFO (I_CREATE);
+
+ //-- Try to create the first partition
+ addPartition (true);
+ }
+ catch (Exception_t) {
+ destroy();
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- destroy ----------------
+void Bank_t::destroy()
+{
+ if ( ! is_open_m || ! (mode_m & B_WRITE) )
+ AMOS_THROW_IO ("Cannot destroy, bank not open for writing");
+
+ Size_t nversions = nversions_m;
+
+ //-- Unlink the partitions
+ clear();
+
+ //-- Unlink the IFO and MAP partitions
+ for (Size_t i = 0; i != nversions; i++) {
+ unlink ((getMapPath(i)).c_str());
+ }
+ unlink ((store_pfx_m + IFO_STORE_SUFFIX).c_str());
+ unlink ((store_pfx_m + LCK_STORE_SUFFIX).c_str());
+
+ //-- Remove the dir if empty
+ rmdir (store_dir_m.c_str());
+
+ init();
+}
+
+
+//----------------------------------------------------- exists -----------------
+bool Bank_t::exists (const string & dir) const
+{
+ //-- Return false if insufficient permissions or absent IFO partition
+ string ifo_path (dir + '/' + Decode (banktype_m) + IFO_STORE_SUFFIX);
+ return ( ! access (dir.c_str(), R_OK | X_OK)
+ &&
+ ! access (ifo_path.c_str(), R_OK) );
+}
+
+bool Bank_t::exists (const string & dir, Size_t version ) const
+{
+ //-- Return false if the type of bank is missing
+ if (!exists (dir)) {
+ return false;
+ }
+
+ //-- check for specific version
+ std::ostringstream map_path;
+ map_path << dir << '/' << Decode(banktype_m) << '.' << version << MAP_STORE_SUFFIX;
+
+ return ( ! access (map_path.str().c_str(), R_OK) );
+}
+
+//----------------------------------------------------- fetchBID ---------------
+void Bank_t::fetchBID (ID_t bid, IBankable_t & obj)
+{
+ if ( ! is_open_m || ! (mode_m & B_READ) )
+ AMOS_THROW_IO ("Cannot fetch, bank not open for reading");
+ if (banktype_m != obj.getNCode())
+ AMOS_THROW_ARGUMENT ("Cannot fetch, incompatible object type");
+
+ //-- Seek to the record and read the data
+ BankPartition_t * partition = localizeBID (bid);
+
+ bankstreamoff vpos;
+ bankstreamoff off = bid * fix_size_m;
+ partition->fix.seekg (off);
+ readLE (partition->fix, &vpos);
+ readLE (partition->fix, &(obj.flags_m));
+ partition->var.seekg (vpos);
+ obj.readRecord (partition->fix, partition->var);
+ partition->fix.ignore (sizeof (Size_t));
+
+ if ( partition->fix.fail() || partition->var.fail() )
+ AMOS_THROW_IO ("Unknown file read error in fetch, bank corrupted");
+}
+
+
+void Bank_t::fetchBIDFix(ID_t bid, IBankable_t & obj)
+{
+ if ( ! is_open_m || ! (mode_m & B_READ) )
+ AMOS_THROW_IO ("Cannot fetch, bank not open for reading");
+ if (banktype_m != obj.getNCode())
+ AMOS_THROW_ARGUMENT ("Cannot fetch, incompatible object type");
+
+ //-- Seek to the record and read the data
+ BankPartition_t * partition = localizeBID (bid);
+
+ bankstreamoff vpos;
+ bankstreamoff off = bid * fix_size_m;
+ partition->fix.seekg (off);
+ readLE (partition->fix, &vpos);
+ readLE (partition->fix, &(obj.flags_m));
+ obj.readRecordFix (partition->fix);
+ partition->fix.ignore (sizeof (Size_t));
+
+ if ( partition->fix.fail())
+ AMOS_THROW_IO ("Unknown file read error in fetch, bank corrupted");
+}
+
+
+//----------------------------------------------------- getMaxIID --------------
+ID_t Bank_t::getMaxIID() const
+{
+ ID_t max = NULL_ID;
+ IDMap_t::const_iterator i;
+
+ for ( i = idmap_m.begin(); i != idmap_m.end(); ++ i )
+ if ( i->iid > max ) max = i->iid;
+
+ return max;
+}
+
+//----------------------------------------------------- getMaxBID --------------
+ID_t Bank_t::getMaxBID() const
+{
+ ID_t max = NULL_ID;
+ IDMap_t::const_iterator i;
+
+ for ( i = idmap_m.begin(); i != idmap_m.end(); ++ i )
+ if ( i->bid > max ) max = i->bid;
+
+ return max;
+}
+
+
+//----------------------------------------------------- lookupBID --------------
+ID_t Bank_t::lookupBID (const string & eid) const
+{
+ ID_t bid = idmap_m.lookupBID (eid);
+ if ( bid == NULL_ID || bid > last_bid_m [version_m] )
+ AMOS_THROW_ARGUMENT ((string) "ERROR: lookupBID EID not found: " + eid);
+ return bid;
+}
+
+
+//----------------------------------------------------- lookupBID --------------
+ID_t Bank_t::lookupBID (ID_t iid) const
+{
+ ID_t bid = idmap_m.lookupBID (iid);
+ if ( bid == NULL_ID || bid > last_bid_m [version_m] )
+ {
+ stringstream ss;
+ ss << "IID '" << iid << "' does not exist in bank";
+ AMOS_THROW_ARGUMENT (ss.str());
+ }
+ return bid;
+}
+
+
+//----------------------------------------------------- init -------------------
+void Bank_t::init()
+{
+ if (last_bid_m != NULL) {
+ delete[] last_bid_m;
+ }
+ if (nbids_m != NULL) {
+ delete[] nbids_m;
+ }
+
+ fix_size_m = 0;
+ is_open_m = false;
+ nversions_m = 1;
+ version_m = 0;
+ last_bid_m = new ID_t[nversions_m];
+ memset(last_bid_m, NULL_ID, nversions_m * sizeof(ID_t));
+ max_bid_m = NULL_ID;
+ nbids_m = new ID_t[nversions_m];
+ memset(nbids_m, NULL_ID, nversions_m * sizeof(ID_t));
+ npartitions_m = 0;
+ partition_size_m = 0;
+ opened_m .clear();
+ partitions_m.clear();
+ store_dir_m .erase();
+ store_pfx_m .erase();
+ idmap_m .clear();
+ idmap_m .setType (banktype_m);
+}
+
+
+//----------------------------------------------------- lockIFO ----------------
+void Bank_t::lockIFO()
+{
+ if ( (mode_m & B_SPY) ) return;
+
+ //-- Attempt to obtain the lock once every second for LOCK_TIME seconds
+ string ifo_path (store_pfx_m + IFO_STORE_SUFFIX);
+ string lck_path (store_pfx_m + LCK_STORE_SUFFIX);
+ for ( int i = 0; i < LOCK_TIME; sleep(1), i ++ )
+ if ( ! link (ifo_path.c_str(), lck_path.c_str()) )
+ return;
+
+ AMOS_THROW_IO
+ ((string)"Failed to obtain bank IFO file lock, " + strerror (errno));
+}
+
+
+//----------------------------------------------------- open -------------------
+void Bank_t::open (const string & dir, BankMode_t mode, Size_t version, bool inPlace)
+{
+ if ( is_open_m ) close();
+
+ try {
+ //-- Initialize the bank
+ is_open_m = true;
+ setMode (mode);
+ store_dir_m = dir;
+ store_pfx_m = dir + '/' + Decode (banktype_m);
+
+ is_inplace_m = inPlace;
+
+ //-- Try to open the IFO partition files
+ touchFile (store_pfx_m + IFO_STORE_SUFFIX, FILE_MODE, false);
+
+ //-- Read the IFO partition
+ syncIFO (I_OPEN);
+
+ //-- default to opening the latest version
+ if (version < 0) {
+ version = nversions_m - 1;
+ }
+ //-- make sure user did not request an invalid version
+ if (version >= nversions_m) {
+ AMOS_THROW_IO("Invalid version for bank, specified version does not exist");
+ }
+ version_m = version;
+
+ //-- Read the MAP partition
+ string map_path = getMapPath();
+ touchFile (map_path, FILE_MODE, false);
+ idmap_m.read(map_path);
+
+ //-- create the next version if we are going to be writing
+ if (is_inplace_m == false && (mode_m & B_WRITE) ) {
+ nextVersion();
+ }
+
+ //-- Make sure nothing smells fishy
+ if ( idmap_m.getType() != banktype_m ||
+ idmap_m.getSize() > nbids_m [version_m] ||
+ nbids_m [version_m] > last_bid_m [version_m] ||
+ last_bid_m [version_m] > max_bid_m ||
+ partitions_m.size() != npartitions_m )
+ AMOS_THROW_IO ("Unknown file read error in open, bank corrupted");
+ }
+ catch (Exception_t) {
+ init();
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- openPartition ----------
+Bank_t::BankPartition_t * Bank_t::openPartition (ID_t id, Size_t version)
+{
+ BankPartition_t * partition = (*partitions_m [id]) [version];
+
+ //-- If already open, return it
+ if ( partition->fix.is_open() )
+ return partition;
+
+ try {
+ //-- Open the FIX and VAR partition files
+ ios::openmode mode = ios::binary | ios::ate | ios::in;
+ if ( (mode_m & B_WRITE) )
+ mode |= ios::out;
+
+ partition->fix.open (partition->fix_name.c_str(), mode);
+ if ( ! partition->fix.is_open() )
+ AMOS_THROW_IO ("Could not open bank partition, " + partition->fix_name);
+ partition->var.open (partition->var_name.c_str(), mode);
+ if ( ! partition->var.is_open() )
+ AMOS_THROW_IO ("Could not open bank partition, " + partition->var_name);
+ }
+ catch (Exception_t) {
+ partition->fix.close();
+ partition->var.close();
+ throw;
+ }
+
+ //-- Add it to the open queue, making room if necessary
+ while ( (Size_t)opened_m.size() >= max_partitions_m )
+ {
+ opened_m.front()->fix.close();
+ opened_m.front()->var.close();
+ opened_m.pop_front();
+ }
+ opened_m.push_back (partition);
+
+ return partition;
+}
+
+
+//----------------------------------------------------- removeBID --------------
+void Bank_t::removeBID (ID_t bid)
+{
+ if ( ! is_open_m || ! (mode_m & B_READ && mode_m & B_WRITE) )
+ AMOS_THROW_IO ("Cannot remove, bank not open for reading and writing");
+
+ //-- Seek to FIX record and rewrite
+ BankPartition_t * partition = localizeBID (bid);
+
+ BankFlags_t flags;
+ bankstreamoff off = bid * fix_size_m + sizeof (bankstreamoff);
+ partition->fix.seekg (off);
+ readLE (partition->fix, &flags);
+ flags.is_removed = true;
+ partition->fix.seekp (off);
+ writeLE (partition->fix, &flags);
+
+ if ( partition->fix.fail() || partition->var.fail() )
+ AMOS_THROW_IO ("Unknown file error in remove, bank corrupted");
+
+ -- nbids_m [version_m];
+}
+
+
+//----------------------------------------------------- replace ----------------
+void Bank_t::replace (ID_t iid, IBankable_t & obj)
+{
+ ID_t bid = lookupBID (iid);
+ string peid (idmap_m.lookupEID (iid));
+ idmap_m.remove (iid);
+
+ try {
+ idmap_m.insert (obj.iid_m, obj.eid_m, bid);
+ }
+ catch (Exception_t) {
+ idmap_m.insert (iid, peid, bid);
+ throw;
+ }
+
+ try {
+ replaceBID (bid, obj);
+ }
+ catch (Exception_t) {
+ idmap_m.remove (obj.iid_m);
+ idmap_m.insert (iid, peid, bid);
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- replace ----------------
+void Bank_t::replace (const string & eid, IBankable_t & obj)
+{
+ ID_t bid = lookupBID (eid);
+ ID_t piid = idmap_m.lookupIID (eid);
+ idmap_m.remove (eid);
+
+ try {
+ idmap_m.insert (obj.iid_m, obj.eid_m, bid);
+ }
+ catch (Exception_t) {
+ idmap_m.insert (piid, eid, bid);
+ throw;
+ }
+
+ try {
+ replaceBID (bid, obj);
+ }
+ catch (Exception_t) {
+ idmap_m.remove (obj.eid_m);
+ idmap_m.insert (piid, eid, bid);
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- replaceBID -------------
+void Bank_t::replaceBID (ID_t bid, IBankable_t & obj)
+{
+ if ( ! is_open_m || ! (mode_m & B_READ && mode_m & B_WRITE) )
+ AMOS_THROW_IO ("Cannot replace, bank not open for reading and writing");
+ if ( banktype_m != obj.getNCode() )
+ AMOS_THROW_ARGUMENT ("Cannot replace, incompatible object type");
+
+ //-- Set the modified flag
+ obj.flags_m.is_removed = false;
+ obj.flags_m.is_modified = true;
+
+ //-- Seek to and write new record
+ BankPartition_t * partition = localizeBID (bid);
+
+ bankstreamoff off = bid * fix_size_m;
+ partition->fix.seekp (off);
+ partition->var.seekp (0, ios::end);
+ bankstreamoff vpos = partition->var.tellp();
+ writeLE (partition->fix, &vpos);
+ writeLE (partition->fix, &(obj.flags_m));
+ obj.writeRecord (partition->fix, partition->var);
+ Size_t vsize = (std::streamoff)partition->var.tellp() - vpos;
+ writeLE (partition->fix, &vsize);
+
+ if ( partition->fix.fail() || partition->var.fail() )
+ AMOS_THROW_IO ("Unknown file error in replace, bank corrupted");
+}
+
+
+//----------------------------------------------------- syncIFO ----------------
+void Bank_t::syncIFO (IFOMode_t mode)
+{
+ //-- B_SPY sneak out
+ if ( (mode_m & B_SPY) && mode != I_OPEN )
+ return;
+
+ //-- Generate lock string
+ ostringstream ss;
+ char * user = getenv ("USER");
+ ss << ((mode_m & B_WRITE) ? WRITE_LOCK_CHAR : READ_LOCK_CHAR)
+ << ' ' << getuid() << ' ' << (user == NULL ? "null" : user);
+ string lock (ss.str());
+
+
+ string line;
+ NCode_t banktype;
+ ID_t* nbids_byVersion = NULL;
+ ID_t* last_bid_byVersion = NULL;
+ Size_t fix_size, npartitions, partition_size, nversions;
+ vector<string> locks;
+ vector<string>::iterator vi;
+
+ //-- Obtain a lock on the IFO store
+ lockIFO();
+
+ try {
+
+ //-- Read IFO partition
+ if ( mode == I_OPEN || mode == I_CLOSE )
+ {
+ string ifo_path (store_pfx_m + IFO_STORE_SUFFIX);
+ ifstream ifo_stream (ifo_path.c_str());
+ if ( ! ifo_stream.is_open() )
+ AMOS_THROW_IO ("Could not open bank partition, " + ifo_path);
+
+ getline (ifo_stream, line, '=');
+ ifo_stream >> line; // bank version
+ if ( line != BANK_VERSION )
+ AMOS_THROW_IO
+ ("Could not read bank, expected version: "
+ + BANK_VERSION + ", saw version: " + line);
+ getline (ifo_stream, line, '=');
+ ifo_stream >> banktype; // bank type
+ if ( banktype != banktype_m )
+ AMOS_THROW_IO
+ ("Could not read bank, incompatible type " + Decode (banktype));
+
+ getline (ifo_stream, line, '=');
+ ifo_stream >> nversions; // number of versions
+ getline (ifo_stream, line, '=');
+ nbids_byVersion = new ID_t[nversions];
+ for (ID_t i = 0; i != nversions; i++) {
+ ifo_stream >> nbids_byVersion[i]; // number of objects
+ }
+ last_bid_byVersion = new ID_t[nversions];
+ getline (ifo_stream, line, '=');
+ for (ID_t i = 0; i != nversions; i++) {
+ ifo_stream >> last_bid_byVersion[i]; // last index
+ }
+ getline (ifo_stream, line, '=');
+ ifo_stream >> fix_size; // index size (in bytes)
+ getline (ifo_stream, line, '=');
+ ifo_stream >> npartitions; // number of partitions
+ getline (ifo_stream, line, '=');
+ ifo_stream >> partition_size; // partition size (in indices)
+ getline (ifo_stream, line, '='); // "locks ="
+ getline (ifo_stream, line);
+
+ if ( ifo_stream.fail() )
+ AMOS_THROW_IO ("Unknown file read error in sync, bank corrupted");
+
+ //-- Read existing bank locks
+ bool noskip = (mode == I_OPEN);
+ getline (ifo_stream, line);
+ while ( ifo_stream.good() )
+ {
+ if ( noskip || line != lock )
+ locks.push_back (line); // add bank lock
+ else
+ noskip = true; // skipped self lock
+ getline (ifo_stream, line);
+ }
+ ifo_stream.close();
+
+ //-- If seeing this for the first time
+ if ( mode == I_OPEN )
+ {
+ delete[] nbids_m;
+ nbids_m = new ID_t[nversions];
+ for (ID_t i = 0; i != nversions; i++)
+ nbids_m[i] = nbids_byVersion[i];
+ delete[] last_bid_m;
+ last_bid_m = new ID_t[nversions];
+ for (ID_t i = 0; i != nversions; i++)
+ last_bid_m[i] = last_bid_byVersion[i];
+ fix_size_m = fix_size;
+ partition_size_m = partition_size;
+ nversions_m = nversions;
+
+ //-- Update the partition list
+ try {
+ while ( npartitions > npartitions_m )
+ addPartition (false);
+ }
+ catch (Exception_t) {
+ for ( Size_t i = 0; i != npartitions_m; ++ i ) {
+ for (Size_t j = 0; j != nversions; j++) {
+ delete ((*partitions_m [i]) [j]);
+ }
+ delete (partitions_m[i]);
+ }
+ npartitions_m = 0;
+ throw;
+ }
+ }
+ }
+
+
+ //-- Validate existing locks
+ char ltype = NULL_CHAR;
+ vector<string>::iterator vj;
+ for ( vi = locks.begin(); vi != locks.end(); ++ vi )
+ {
+ vj = vi;
+ ltype = vi->empty() ? NULL_CHAR : (*vi)[0];
+ switch ( ltype )
+ {
+ case READ_LOCK_CHAR:
+ break;
+ case WRITE_LOCK_CHAR:
+ if ( locks.size() == 1 )
+ break;
+ // fall-through
+ default:
+ AMOS_THROW_IO ("Invalid bank partition lock, bank corrupted");
+ }
+ }
+
+
+ //-- B_SPY sneak out
+ if ( mode_m & B_SPY )
+ {
+ if ( ltype == WRITE_LOCK_CHAR )
+ cerr << "WARNING: Disregarding '" << Decode (banktype_m)
+ << "' bank lock, locked by '" + *vj + "'" << endl;
+ return;
+ }
+
+
+ //-- Check existing locks
+ if ( (mode_m & B_READ) && ltype == WRITE_LOCK_CHAR )
+ AMOS_THROW_IO
+ ("Could not open bank for reading, locked by '" + *vj + "'");
+ if ( (mode_m & B_WRITE) && ltype == WRITE_LOCK_CHAR )
+ AMOS_THROW_IO
+ ("Could not open bank for writing, locked by '" + *vj + "'");
+ if ( (mode_m & B_WRITE) && ltype == READ_LOCK_CHAR )
+ AMOS_THROW_IO
+ ("Could not open bank for writing, locked by '" + *vj + "'");
+
+
+ //-- Add new lock
+ if ( mode != I_CLOSE )
+ locks.push_back (lock);
+
+
+ //-- Dump memory if writing
+ if ( (mode_m & B_WRITE) )
+ {
+ delete[] nbids_byVersion;
+ nbids_byVersion = new ID_t[nversions_m];
+ for (ID_t i = 0; i != nversions_m; i++)
+ nbids_byVersion[i] = nbids_m[i];
+ delete[] last_bid_byVersion;
+ last_bid_byVersion = new ID_t[nversions_m];
+ for (ID_t i = 0; i != nversions_m; i++)
+ last_bid_byVersion[i] = last_bid_m[i];
+ fix_size = fix_size_m;
+ npartitions = npartitions_m;
+ partition_size = partition_size_m;
+ nversions = nversions_m;
+ }
+
+
+ //-- Write IFO partition
+ string ifo_path (store_pfx_m + IFO_STORE_SUFFIX);
+ ofstream ifo_stream (ifo_path.c_str());
+ if ( ! ifo_stream.is_open() )
+ AMOS_THROW_IO ("Could not open bank partition, " + ifo_path);
+
+ ifo_stream
+ << "____" << Decode (banktype_m) << " BANK INFORMATION____" << endl
+ << "bank version = " << BANK_VERSION << endl
+ << "bank type = " << banktype_m << endl
+ << "versions = " << nversions << endl
+ << "objects = ";
+ for (ID_t i = 0; i != nversions; i++) {
+ ifo_stream << nbids_byVersion[i] << "\t";
+ }
+ ifo_stream << endl
+ << "indices = ";
+ for (ID_t i = 0; i != nversions; i++) {
+ ifo_stream << last_bid_byVersion[i] << "\t";
+ }
+ ifo_stream << endl
+ << "bytes/index = " << fix_size << endl
+ << "partitions = " << npartitions << endl
+ << "indices/partition = " << partition_size << endl
+ << "locks = " << endl;
+
+ //-- Write updated locks
+ for ( vi = locks.begin(); vi != locks.end(); ++ vi )
+ ifo_stream << *vi << endl;
+
+ if ( ifo_stream.fail() )
+ AMOS_THROW_IO ("Unknown file write error in sync, bank corrupted");
+ ifo_stream.close();
+
+ delete[] nbids_byVersion;
+ delete[] last_bid_byVersion;
+ }
+ catch (Exception_t) {
+ unlockIFO();
+ throw;
+ }
+
+ //-- Release lock on the IFO store
+ unlockIFO();
+}
+
+
+//----------------------------------------------------- touchFile --------------
+void Bank_t::touchFile (const string & path, int mode, bool create)
+{
+ int fd, flags;
+
+ if ( (mode_m & B_SPY) )
+ flags = O_RDONLY;
+ else // need both read/write for file locks
+ flags = O_RDWR;
+
+ if ( create )
+ flags |= O_CREAT | O_TRUNC;
+
+ fd = ::open (path.c_str(), flags, mode);
+ if ( fd == -1 )
+ {
+ if ( create )
+ AMOS_THROW_IO
+ ("Could not create bank file, " + path + ", " + strerror (errno));
+ else
+ AMOS_THROW_IO
+ ("Could not open bank file, " + path + ", " + strerror (errno));
+ }
+
+ fd = ::close (fd);
+ if ( fd == -1 )
+ AMOS_THROW_IO
+ ("Could not close bank file, " + path + ", " + strerror (errno));
+}
+
+
+//----------------------------------------------------- unlockIFO --------------
+void Bank_t::unlockIFO()
+{
+ if ( (mode_m & B_SPY) ) return;
+
+ //-- Attempt to release the lock
+ string lck_path (store_pfx_m + LCK_STORE_SUFFIX);
+ if ( unlink (lck_path.c_str()) )
+ AMOS_THROW_IO
+ ((string)"Failed to release bank IFO file lock, " + strerror (errno));
+}
+
+
+//--------------------------------------------------- BankExists ---------------
+bool AMOS::BankExists (NCode_t ncode, const string & dir)
+{
+ //-- Return false if insufficient permissions or absent IFO partition
+ string ifo_path (dir + '/' + Decode (ncode) + Bank_t::IFO_STORE_SUFFIX);
+ return ( ! access (dir.c_str(), R_OK | X_OK)
+ &&
+ ! access (ifo_path.c_str(), R_OK) );
+}
+
+
+//--------------------------------------------------- PrintBankVersion ---------
+void AMOS::PrintBankVersion (const char * s)
+{
+ cerr << s << " compiled for bank version " << Bank_t::BANK_VERSION << endl;
+}
+
+
+
+//================================================ BankPartition_t =============
+//----------------------------------------------------- BankPartition_t --------
+Bank_t::BankPartition_t::BankPartition_t (Size_t buffer_size)
+{
+ fix_buff = (char *) SafeMalloc (buffer_size);
+ var_buff = (char *) SafeMalloc (buffer_size);
+
+ fix.rdbuf()->_PUBSETBUF_ (fix_buff, buffer_size);
+ var.rdbuf()->_PUBSETBUF_ (var_buff, buffer_size);
+}
+
+
+//----------------------------------------------------- ~BankPartition_t -------
+Bank_t::BankPartition_t::~BankPartition_t()
+{
+ fix.close();
+ var.close();
+
+ free (fix_buff);
+ free (var_buff);
+}
diff --git a/src/AMOS/Bank_AMOS.hh b/src/AMOS/Bank_AMOS.hh
new file mode 100644
index 0000000..f1800f9
--- /dev/null
+++ b/src/AMOS/Bank_AMOS.hh
@@ -0,0 +1,1283 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 07/18/2003
+//!
+//! \brief Header for Bank_t
+//!
+//-- IMPORTANT DEVELOPERS NOTE
+//! \note In an effort to ensure the binary-compatibility of AMOS banks
+//! all disk I/O should be independent of any system-dependent sizes or byte
+//! orders (endian-ness), such as 'int' which can vary in size and be stored
+//! in either big- or little-endian byte order. To avoid these issues, use only
+//! types with known sizes (int32_t for example) and read/write atomic data
+//! with the readLE and writeLE methods which convert strongly-typed ints to
+//! and from little-endian byte order before reading/writing.
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Bank_AMOS_HH
+#define __Bank_AMOS_HH 1
+
+#include "utility_AMOS.hh"
+#include "IDMap_AMOS.hh"
+#include <cstdlib>
+#include <string>
+#include <fstream>
+#include <vector>
+#include <deque>
+#include <sstream>
+
+namespace AMOS {
+
+typedef uint8_t BankMode_t;
+const BankMode_t B_READ = 0x1; //!< protected reading mode
+const BankMode_t B_WRITE = 0x2; //!< protected writing mode
+const BankMode_t B_SPY = 0x4;
+//!< unprotected reading mode, overrides all other modes
+
+
+
+//================================================ IBankable_t =================
+//! \brief Interface for classes that can be stored in an AMOS bank
+//!
+//! All classes derived from this interface class may be stored in a AMOS bank.
+//! Derived classes from this type that you wish to include in an AMOS Bank_t.
+//! This will assure all data types being "banked" will have an iid, eid and
+//! flags field, and will be able to read and write themselves to a bank. To
+//! derive new types, the developer must implement the virtual functions to
+//! ensure the new class can be correctly stored and recovered from a bank.
+//! Each IBankable class should return a unique (static) NCode when getNCode
+//! is called upon, so that the bank dynamically identify the types of virtual
+//! objects.
+//!
+//==============================================================================
+class IBankable_t
+{
+ friend class Bank_t; //!< so the bank class can use the read/writes
+ friend class BankStream_t; //!< so the bank class can use the read/writes
+
+
+protected:
+
+ ID_t iid_m; //!< internal ID (integer AMOS identifier)
+
+ std::string eid_m; //!< external ID (anything you want sans newlines)
+
+ BankFlags_t flags_m; //!< bank flags, derived classes may use "nibble"
+
+
+ //--------------------------------------------------- readRecord -------------
+ //! \brief Read selected class members from a biserial record
+ //!
+ //! Reads the fixed and variable length streams from a biserial record and
+ //! initializes the class members to the values stored within. Used in
+ //! translating a biserial IBankable object, and needed to retrieve objects
+ //! from a bank.
+ //!
+ //! \note This method must be able to interpret the biserial record
+ //! produced by its related function writeRecord.
+ //!
+ //! \param fix The fixed length stream (stores all fixed length members)
+ //! \param var The variable length stream (stores all var length members)
+ //! \pre The get pointer of fix is at the beginning of the record
+ //! \pre The get pointer of var is at the beginning of the record
+ //! \return void
+ //!
+ virtual void readRecord (std::istream & fix, std::istream & var) = 0;
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ //! \brief Read selected class members from a fixed store only
+ //!
+ //! Reads the fixed stream and initializes the class members to the values
+ //! stored within. Used to fetch the fixed portion of a biserial
+ //! IBankable object, and needed to retrieve objects
+ //! from a bank.
+ //!
+ //! \note This method must be able to interpret the biserial record
+ //! produced by its related function writeRecord.
+ //!
+ //! \param fix The fixed length stream (stores all fixed length members)
+ //! \pre The get pointer of fix is at the beginning of the record
+ //! \return void
+ //!
+ virtual void readRecordFix(std::istream & fix) = 0;
+
+
+ //--------------------------------------------------- writeRecord ------------
+ //! \brief Write selected class members to a biserial record
+ //!
+ //! Writes the fixed and variable length streams to a biserial record. Used in
+ //! generating a biserial IBankable object, and needed to commit objects to a
+ //! bank. Should not write the flags, EID, or IID of the object because the
+ //! bank will handle the storage of these fields on its own.
+ //!
+ //! \note This method must be able to produce a biserial record that can
+ //! be read by its related funtion readRecord.
+ //!
+ //! \param fix The fixed length stream (stores all fixed length members)
+ //! \param var The variable length stream (stores all var length members)
+ //! \return void
+ //!
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const = 0;
+
+
+public:
+
+ //--------------------------------------------------- IBankable_t ------------
+ //! \brief Constructs an empty IBankable_t object
+ //!
+ //! Set IID to NULL_ID, comment to empty string and all flags to false.
+ //!
+ IBankable_t ( )
+ {
+ iid_m = NULL_ID;
+ }
+
+
+ //--------------------------------------------------- IBankable_t ------------
+ //! \brief Copy constructor
+ //!
+ IBankable_t (const IBankable_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~IBankable_t -----------
+ //! \brief Virtual destructor
+ //!
+ virtual ~IBankable_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ //! \brief Clears all object data, reinitializes the object
+ //!
+ virtual void clear ( )
+ {
+ iid_m = NULL_ID;
+ eid_m . erase( );
+ flags_m . clear( );
+ }
+
+
+ //--------------------------------------------------- getEID -----------------
+ //! \brief Get the external ID
+ //!
+ //! \return The external ID
+ //!
+ const std::string & getEID ( ) const
+ {
+ return eid_m;
+ }
+
+
+ //--------------------------------------------------- getIID -----------------
+ //! \brief Get the internal ID
+ //!
+ //! \return The internal ID
+ //!
+ ID_t getIID ( ) const
+ {
+ return iid_m;
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ //! \brief Get the AMOS NCode type identifier
+ //!
+ //! \return The AMOS NCode type identifier
+ //!
+ virtual NCode_t getNCode ( ) const = 0;
+
+
+ //--------------------------------------------------- isRemoved --------------
+ //! \brief Check if the object is waiting to be removed from the bank
+ //!
+ //! \note Useful for debugging only
+ //!
+ //! \return true if removed, otherwise false
+ //!
+ bool isRemoved ( ) const
+ {
+ return flags_m . is_removed;
+ }
+
+
+ //--------------------------------------------------- isModified -------------
+ //! \brief Check if the object has been modified
+ //!
+ //! \return true if modified, otherwise false
+ //!
+ bool isModified ( ) const
+ {
+ return flags_m . is_modified;
+ }
+
+
+ //--------------------------------------------------- isFlagA ----------------
+ //! \brief Check the value of flag A
+ //!
+ //! \return The value of flag A
+ //!
+ bool isFlagA ( ) const
+ {
+ return flags_m . is_flagA;
+ }
+
+
+ //--------------------------------------------------- isFlagB ----------------
+ //! \brief Check the value of flag B
+ //!
+ //! \return The value of flag B
+ //!
+ bool isFlagB ( ) const
+ {
+ return flags_m . is_flagB;
+ }
+
+
+ //--------------------------------------------------- setEID -----------------
+ //! \brief Set the external ID
+ //!
+ //! Will only use the characters up to but not including the first newline.
+ //!
+ //! \return void
+ //!
+ void setEID (const std::string & eid)
+ {
+ std::string::size_type s = eid . find (NL_CHAR);
+ if (s == std::string::npos )
+ eid_m = eid;
+ else
+ eid_m . assign (eid, 0, s);
+ }
+
+
+ //--------------------------------------------------- setFlagA ---------------
+ //! \brief Set flag A
+ //!
+ //! Has no effect on the actual object in memory other than setting a flag.
+ //! This is one of two user accessible flags to be used as needed, the other
+ //! is flag B.
+ //!
+ //! \param flag The new flag A value
+ //! \return void
+ //!
+ void setFlagA (bool flag)
+ {
+ flags_m . is_flagA = flag;
+ }
+
+
+ //--------------------------------------------------- setFlagB ---------------
+ //! \brief Set flag B
+ //!
+ //! Has no effect on the actual object in memory other than setting a flag.
+ //! This is one of two user accessible flags to be used as needed, the other
+ //! is flag A.
+ //!
+ //! \param flag The new flag B value
+ //! \return void
+ //!
+ void setFlagB (bool flag)
+ {
+ flags_m . is_flagB = flag;
+ }
+
+
+ //--------------------------------------------------- setIID -----------------
+ //! \brief Set the internal ID
+ //!
+ //! \param iid The new internal ID
+ //! \return void
+ //!
+ void setIID (ID_t iid)
+ {
+ iid_m = iid;
+ }
+
+};
+
+
+
+
+//================================================ Bank_t ======================
+//! \brief An AMOS data bank for efficiently storing Bankable data types
+//!
+//! Efficiently handles large numbers of Bankable data types and stores them
+//! to disk for future retrieval. The bank will upkeep a hash map of IIDs, EIDs
+//! and BIDs. All bank append/fetch style operations can be performed on either
+//! IIDs or EIDs.
+//!
+//! If data not included in a Bankable type needs to be stored in a bank,
+//! please derive a new Bankable type and implement the appropriate virtual
+//! functions to allow the type to be stored in a bank. Developers should note
+//! that the IID, EID, and BIDs are never stored in the data partition, rather
+//! they are stored as an IDMap in a seperate partition.
+//!
+//! A quick review of the identifiers. A BID is a bank identifier used only by
+//! the bank for indexing its contents, and is only useful for debugging
+//! purposes. The BID ordering will be the order in which the objects were
+//! appended (1 based). An IID is the universal AMOS ID that is used for all
+//! object links and most operations (append/fetch). An EID is a external
+//! ID string of arbitrary length, used less often due to the efficiency
+//! sacrifice of dealing with strings (EID) over ints (IID).
+//!
+//==============================================================================
+class Bank_t
+{
+
+protected:
+
+ static const Size_t DEFAULT_BUFFER_SIZE; //!< IO buffer size
+ static const Size_t DEFAULT_PARTITION_SIZE; //!< records per partition
+ static const Size_t MAX_OPEN_PARTITIONS; //!< open partitions
+
+ enum IFOMode_t
+ {
+ I_OPEN,
+ I_CREATE,
+ I_CLOSE
+ };
+
+ //================================================ BankPartition_t ===========
+ //! \brief A single partition of the file-based bank
+ //!
+ //! Unifies the two biserial file streams of a bank partition and handles
+ //! the IO buffers.
+ //!
+ //============================================================================
+ class BankPartition_t
+ {
+
+ private:
+
+ char * fix_buff; //!< The fix IO buffer
+ char * var_buff; //!< The var IO buffer
+
+ public:
+
+ std::string fix_name; //!< The name of the fixed len file
+ std::string var_name; //!< The name of the variable len file
+ std::fstream fix; //!< The fstream for this partition's fix len store
+ std::fstream var; //!< The fstream for this partition's var len store
+
+ //------------------------------------------------- BankPartition_t --------
+ //! \brief Allocates stream buffers for fix and var streams
+ //!
+ BankPartition_t (Size_t buffer_size);
+
+
+ //------------------------------------------------- BankPartition_t --------
+ //! \brief Closes fix and var streams and frees buffer memory
+ //!
+ ~BankPartition_t ( );
+
+ };
+
+
+ //--------------------------------------------------- nextVersion -----------
+ //! \brief Adds a new version to the store
+ //!
+ //! Create datastructured for the next version of this store.
+ //! throw an exception if unable to create/open version
+ //!
+ //! \pre There are adequate permissions in the bank directory
+ //! \post npartitions_m and max_iid_m reflect new partitioning
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void nextVersion ();
+
+ Size_t localizeVersionBID (ID_t bid) {
+ return version_m;
+ }
+
+ std::string getMapPath(Size_t version) {
+ std::ostringstream ss;
+ ss << store_pfx_m << '.' << version << MAP_STORE_SUFFIX;
+ return ss.str();
+ }
+
+ std::string getMapPath() {
+ return getMapPath(version_m);
+ }
+
+ void clearVersion (Size_t &version, bool recreate );
+
+ void copyPartition(ID_t &id);
+
+ void copyFile(std::fstream &in, std::ofstream &out);
+
+ //--------------------------------------------------- addPartition -----------
+ //! \brief Adds a new partition to the partition list
+ //!
+ //! Simply appends a new partition to the list, and leaves it unopened. Will
+ //! throw an exception if unable to create/open partition. If the create flag
+ //! is set, new files will be created and truncated to zero, otherwise its
+ //! contents will be left undisturbed.
+ //!
+ //! \param create Create new file or truncate existing
+ //! \pre There are adequate permissions in the bank directory
+ //! \post npartitions_m and max_iid_m reflect new partitioning
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void addPartition (bool create);
+
+
+ //--------------------------------------------------- appendBID --------------
+ //! \brief Append an object, thus assigning it the last BID
+ //!
+ void appendBID (IBankable_t & obj);
+
+
+ //--------------------------------------------------- fetchBID ---------------
+ //! \brief Fetch an object by BID
+ //!
+ void fetchBID (ID_t bid, IBankable_t & obj);
+
+
+ //--------------------------------------------------- fetchBIDFix ------------
+ //! \brief Fetch the fixed record for an object by BID
+ //!
+ void fetchBIDFix(ID_t iid, IBankable_t & obj);
+
+
+ //--------------------------------------------------- getPartition -----------
+ //! \brief Returns the requested BankPartition, opening it if necessary
+ //!
+ //! Returns the requested (pre-existing) partition, opening it if necessary.
+ //!
+ //! \param id The ID of the requested partition
+ //! \pre There are adequate permissions in the bank directory
+ //! \pre The requested partition is within range (not checked)
+ //! \post The requested partition is open and on the queue
+ //! \post A previously opened partition may have been closed to make room
+ //! \throws IOException_t
+ //! \throws ArgumentException_t
+ //! \return The requested, opened partition
+ //!
+ BankPartition_t * getPartition (ID_t id, Size_t version)
+ {
+ if ( (*partitions_m [id])[version] -> fix . is_open( ) )
+ {
+ (*partitions_m [id])[version]->fix.clear();
+ (*partitions_m [id])[version]->var.clear();
+ return (*partitions_m [id])[version];
+ }
+ else
+ return openPartition (id, version);
+ }
+
+
+ //--------------------------------------------------- getLastPartition -------
+ //! \brief Same as getPartition, but returns the current final partition
+ //!
+ BankPartition_t * getLastPartition ( Size_t version )
+ {
+ return getPartition (npartitions_m - 1, version);
+ }
+
+ //--------------------------------------------------- init -------------------
+ //! \brief Initializes bank variables
+ //!
+ void init ( );
+
+
+ //--------------------------------------------------- localizeBID ------------
+ //! \brief Gets the partition and local identifier
+ //!
+ //! \param bid Lookup the location of this BID (1 based index))
+ //! \pre bid is within range (not checked)
+ //! \post bid will be adjusted to reference the returned partition
+ //! \return The opened bank partition
+ //!
+ BankPartition_t * localizeBID (ID_t & bid)
+ {
+ Size_t version = localizeVersionBID(bid);
+ ID_t pid = (-- bid) / partition_size_m;
+ bid -= pid * partition_size_m;
+ return getPartition (pid, version);
+ }
+
+ //--------------------------------------------------- lockIFO ----------------
+ //! \brief Obtains a file lock on the info store of the current bank
+ //!
+ //! Obtains a file lock on the info store of the current bank. Will throw an
+ //! exception if the lock failed either because the info store does not exist
+ //! or it took too long to obtain the lock. Has no effect if BankMode is set
+ //! to B_SPY.
+ //!
+ //! \post The info store is locked
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void lockIFO ( );
+
+
+ //--------------------------------------------------- openPartition ----------
+ //! \brief Do not use this function, use getPartition instead
+ //!
+ BankPartition_t * openPartition (ID_t id, Size_t version);
+
+
+ //--------------------------------------------------- removeBID --------------
+ //! \brief Remove an object by BID
+ //!
+ void removeBID (ID_t bid);
+
+
+ //--------------------------------------------------- replaceBID -------------
+ //! \brief Replace an object by BID
+ //!
+ void replaceBID (ID_t bid, IBankable_t & obj);
+
+
+ //----------------------------------------------------- setMode --------------
+ //! \brief validates and sets the BankMode
+ //!
+ //! \param mode BankMode_t to check and set
+ //! \pre mode is a valid BankMode_t
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void setMode (BankMode_t mode)
+ {
+ if ( mode & ~(B_READ | B_WRITE | B_SPY) )
+ AMOS_THROW_ARGUMENT ("Invalid BankMode: unknown mode");
+
+ if ( ! mode & (B_READ | B_WRITE | B_SPY) )
+ AMOS_THROW_ARGUMENT ("Invalid BankMode: mode not specified");
+
+ if ( mode & B_SPY )
+ mode = B_SPY | B_READ;
+
+ mode_m = mode;
+ }
+
+
+ //----------------------------------------------------- syncIFO --------------
+ //! \brief Syncs the IFO store with in-memory data
+ //!
+ //! Locks the IFO store if needed, then syncs the IFO store with in-memory
+ //! data. Either as an open, update or close depending on the IFOMode. Use
+ //! I_OPEN if opening the IFO store for the first time, I_CREATE if creating
+ //! a new IFO store or I_CLOSE if ready to close the IFO store. Only I_OPEN
+ //! will have an effect if bank is in B_SPY mode. Will throw an exception
+ //! if any of the bank locks are violated.
+ //!
+ //! \pre The bank is open
+ //! \param mode I_OPEN, I_CREATE or I_CLOSE (cannot OR these together)
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void syncIFO (IFOMode_t mode);
+
+
+ //--------------------------------------------------- touchFile --------------
+ //! \brief Opens or creates a file, throwing exception on failure
+ //!
+ void touchFile (const std::string & path, int mode, bool create);
+
+
+ //--------------------------------------------------- unlockIFO --------------
+ //! \brief Releases the file lock on the info store of the current bank
+ //!
+ //! Releases the file lock on the info store of the current bank. Will throw
+ //! an exception if the unlock failed either because the lock did not exist
+ //! or could not be released. Has no effect if BankMode is set to B_SPY.
+ //!
+ //! \pre The bank is open
+ //! \pre The info store is currently locked
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void unlockIFO ( );
+
+
+ //--------------------------------------------------- Bank_t -----------------
+ //! \brief Copy constructor
+ //!
+ //! Private as to disallow copying
+ //!
+ Bank_t (const Bank_t & source);
+
+
+ //--------------------------------------------------- operator= --------------
+ //! \brief Assignment (copy) operator
+ //!
+ //! Private as to disallow copying
+ //!
+ Bank_t & operator= (const Bank_t & source);
+
+
+ NCode_t banktype_m; //!< the type of objects stored in this bank
+
+ Size_t buffer_size_m; //!< size of the I/O buffer
+ Size_t max_partitions_m; //!< maximum number of open partitions
+
+ bool is_open_m; //!< open status of the bank
+ signed char status_m; //!< bank status
+ BankMode_t mode_m; //!< mode of the bank, B_READ|B_WRITE|B_SPY
+
+ std::string store_dir_m; //!< the disk store directory
+ std::string store_pfx_m; //!< the disk store prefix (including dir)
+ Size_t fix_size_m; //!< size of entire fixed length record
+ Size_t partition_size_m; //!< records per disk store partition
+
+ ID_t *last_bid_m; //!< the last bank bid (1 based);
+ ID_t *nbids_m; //!< number of non-deleted bids:
+
+ ID_t max_bid_m; //!< maximum bid given the current partitioning
+ Size_t npartitions_m; //!< number of partitions
+ std::deque <BankPartition_t *> opened_m; //!< opened partitions
+ std::vector<std::vector<BankPartition_t *>* > partitions_m; //!< all partitions
+
+ IDMap_t idmap_m; //!< the IDMap IID <-> EID to BID
+
+ Size_t version_m; //!<The version we're currently working on
+ Size_t nversions_m; //!<The number of store versions operating
+ bool is_inplace_m; //!< Whether edits go to the current version or a subsequent one
+public:
+
+ typedef int64_t bankstreamoff; //!< 64-bit stream offset for largefiles
+
+ static const std::string BANK_VERSION; //!< current bank version
+
+ static const std::string IFO_STORE_SUFFIX; //!< the informational store
+ static const std::string MAP_STORE_SUFFIX; //!< the ID map store
+ static const std::string LCK_STORE_SUFFIX; //!< the ifo store file lock
+
+ static const std::string FIX_STORE_SUFFIX; //!< the fixed length stores
+ static const std::string VAR_STORE_SUFFIX; //!< the variable length stores
+
+ static const std::string TMP_STORE_SUFFIX; //!< the temporary store
+
+ static const char WRITE_LOCK_CHAR; //!< write lock char
+ static const char READ_LOCK_CHAR; //!< read lock char
+
+ static const int32_t OPEN_LATEST_VERSION; //!< latest version
+
+ //--------------------------------------------------- Bank_t -----------------
+ //! \brief Constructs an empty Bank_t of objects with a certain NCode
+ //!
+ //! Initializes members and sets bank type to the supplied value. All future
+ //! operations on this bank must be made with a Bankable type that is
+ //! compatibile with the supplied NCode.
+ //!
+ //! Once a bank is created with a certain NCode, only objects compatible
+ //! with that NCode can be used with that bank. For instance, if a bank
+ //! is constructed with 'Bank_t mybank (Read_t::NCODE);', only Read_t
+ //! objects could be used with mybank. Also, if a static NCode member is not
+ //! available 'Bank_t mybank ("RED");' will also work.
+ //!
+ //! \param type The type of bank to construct
+ //!
+ Bank_t (NCode_t type)
+ : banktype_m (type), last_bid_m(NULL), nbids_m(NULL)
+ {
+ init( );
+ status_m = 0;
+ buffer_size_m = DEFAULT_BUFFER_SIZE;
+ max_partitions_m = MAX_OPEN_PARTITIONS;
+ nversions_m = 0;
+ }
+
+
+ //--------------------------------------------------- Bank_t -----------------
+ Bank_t (const std::string & type)
+ : banktype_m (Encode(type)), last_bid_m(NULL), nbids_m(NULL)
+ {
+ init( );
+ status_m = 0;
+ buffer_size_m = DEFAULT_BUFFER_SIZE;
+ max_partitions_m = MAX_OPEN_PARTITIONS;
+ nversions_m = 0;
+ }
+
+
+ //--------------------------------------------------- ~Bank_t ----------------
+ //! \brief Destroys a Bank_t object
+ //!
+ //! Frees all occupied memory, flushes all buffers and closes any open files.
+ //!
+ ~Bank_t ( )
+ {
+ if ( is_open_m )
+ close( );
+ }
+
+
+ //--------------------------------------------------- append -----------------
+ //! \brief Appends a Bankable object to the bank
+ //!
+ //! Appends a Bankable object to the bank. The modified and removed flags of
+ //! the object are cleared, because the object is newly appended. If the
+ //! object has a non-empty IID/EID value, the bank will include the IID/EID
+ //! in the IDMap to allow for future IID <-> EID conversions. Note that
+ //! an object can be appended with a NULL IID and EID, but this will make
+ //! it accessible only by iteration via a BankStream_t.
+ //!
+ //! \param obj The Bankable object to append
+ //! \pre The bank is open for writing
+ //! \pre obj is compatible with the current NCode bank type
+ //! \pre There is no IID/EID of this object already in the bank
+ //! \post obj's modified and removed flags are cleared
+ //! \post obj IID/EID and assigned BID are added to the IDMap
+ //! \throws IOException_t
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void append (IBankable_t & obj);
+
+
+ //--------------------------------------------------- assignEID --------------
+ //! \brief Assigns an EID to an existing object
+ //!
+ //! Assigns an EID to an object that currently has only an IID. Only affects
+ //! the IDMap and is therefore much more efficient than the replace method.
+ //! Will throw an exception if the IID does not exist or if the new EID
+ //! already exists.
+ //!
+ //! \param iid The IID of the existing object
+ //! \param eid The EID to assign to the object
+ //! \pre The bank is open for read/writing
+ //! \pre The specified IID exists in the bank
+ //! \pre The new EID does not exist in the bank
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void assignEID (ID_t iid, const std::string & eid);
+
+
+ //--------------------------------------------------- assignIID --------------
+ //! \brief Assigns an object a new IID
+ //!
+ //! Assigns an IID to an object that currently has only an EID. Only affects
+ //! the IDMap and is therefore much more efficient than the replace method.
+ //! Will throw an exception if the IID does not exist or if the new EID
+ //! already exists.
+ //!
+ //! \param eid The EID of the existing object
+ //! \param iid The IID to assign to the object
+ //! \pre The bank is open for read/writing
+ //! \pre The specified EID exists in the bank
+ //! \pre The new IID does not exist in the bank
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void assignIID (const std::string & eid, ID_t iid);
+
+
+ //--------------------------------------------------- clean ------------------
+ //! \brief Reorganizes the bank and removes all residual deleted objects
+ //!
+ //! Removes all objects waiting for deletion from disk. Also cleans up
+ //! rubbish data left over from past replace operations. This is a costly
+ //! operation, as it requires the entire bank be copied to a temporary store.
+ //!
+ //! \pre The bank is open for read/writing
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void clean ( );
+
+
+ //--------------------------------------------------- clear ------------------
+ //! \brief Clears a bank by erasing all it's objects and its ID map
+ //!
+ //! Erases all the objects in a bank, but keeps the bank open at the current
+ //! location. Only throws an exception if the bank is not open for writing.
+ //! Won't complain if some of the partitions won't unlink etc. Has no effect
+ //! on a closed bank.
+ //!
+ //! \pre The bank is open for writing
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void clear ( );
+
+
+ void clearCurrentVersion ( ) {
+ if (version_m != nversions_m - 1) {
+ AMOS_THROW_IO ("Can only clear latest version");
+ }
+ if (nversions_m == 1) {
+ clear();
+ } else {
+ clearVersion (version_m, true );
+ }
+ last_bid_m[version_m] = NULL_ID;
+ nbids_m[version_m] = NULL_ID;
+ opened_m .clear();
+ idmap_m .clear();
+ idmap_m .setType (banktype_m);
+ }
+
+
+ //--------------------------------------------------- close ------------------
+ //! \brief Closes a bank on disk
+ //!
+ //! Flushes all files, closes all files and re-initializes members. Has no
+ //! effect on a closed bank.
+ //!
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void close ( );
+
+
+ //--------------------------------------------------- concat -----------------
+ //! \brief Concatenates another bank to the end of this bank
+ //!
+ //! Conceptually performs an append operation on every object in the source
+ //! bank, but with more efficiency. As a side effect, incoming source records
+ //! are cleaned (see Bank_t::clean() method), therefore removing all objects
+ //! waiting for deletion. The two banks must have entirely disjoint IDMaps.
+ //!
+ //! \note The source bank is unchanged by this operation, however it cannot
+ //! be made a const because of I/O open/close operations.
+ //!
+ //! \param source The bank to concat to the end of the current bank
+ //! \pre The bank is open for writing
+ //! \pre The source bank is open for reading
+ //! \pre source is compatible with the current NCode bank type
+ //! \pre The current and source IDMaps are disjoint
+ //! \post The source bank is unaffected
+ //! \throws IOException_t
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void concat (Bank_t & source);
+
+
+ //--------------------------------------------------- create -----------------
+ //! \brief Forcibly creates and opens a bank on disk
+ //!
+ //! Forcibly creates and opens a bank. Any pre-existing bank of this type
+ //! will be destroyed and any conflicting files will be overwritten if
+ //! permissions allow. If you wish not to overwrite an existing bank, use the
+ //! exists method to first check for a conflicting bank of this type. An open
+ //! bank will first be closed before the new one is created.
+ //!
+ //! \param dir The directory in which to create the bank
+ //! \param mode The mode of the bank (B_READ | B_WRITE)
+ //! \pre mode includes B_WRITE
+ //! \pre sufficient read/write/exe permissions for dir and bank files
+ //! \throws IOException_t
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void create (const std::string & dir, BankMode_t mode = B_READ | B_WRITE);
+
+ //--------------------------------------------------- destroy ----------------
+ //! \brief Closes and removes a bank from disk
+ //!
+ //! Closes the bank and unlinks all files and empty directories. Only throws
+ //! an exception if the bank is not open for writing. Won't complain if some
+ //! of the partitions won't unlink etc.
+ //!
+ //! \pre The bank is open for writing
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void destroy ( );
+
+
+ //--------------------------------------------------- empty ------------------
+ //! \brief Returns true if bank is empty
+ //!
+ bool empty ( ) const
+ {
+ return ( getSize( ) == 0 );
+ }
+
+
+ //--------------------------------------------------- exists -----------------
+ //! \brief Checks for the existence of a another bank with similar type
+ //!
+ //! Only checks for the existence and readability of the info store, does
+ //! not perform any validity checking on the other partitions. Can be called
+ //! while a bank is open or closed.
+ //!
+ //! \param dir The directory in which to look
+ //! \return true if IFO store exists with read permissions, else false
+ //!
+ bool exists (const std::string & dir) const;
+ bool exists (const std::string & dir, Size_t version) const;
+
+ //--------------------------------------------------- existsEID --------------
+ //! \brief Returns true if EID exists in the bank
+ //!
+ bool existsEID (const std::string & eid) const
+ {
+ return (idmap_m . exists (eid));
+ }
+
+
+ //--------------------------------------------------- existsIID --------------
+ //! \brief Returns true if IID exists in the bank
+ //!
+ bool existsIID (ID_t iid) const
+ {
+ return (idmap_m . exists (iid));
+ }
+
+
+ //--------------------------------------------------- fetch ------------------
+ //! \brief Fetches a Bankable object from the bank by its IID
+ //!
+ //! Retrieves an object from the bank by its IID and stores it in a bankable
+ //! object.
+ //!
+ //! \param iid The IID of the object to fetch
+ //! \param obj A Bankable object to store the data
+ //! \pre The bank is open for reading
+ //! \pre The requested IID exists in the bank
+ //! \pre obj is compatible with the current NCode bank type
+ //! \post The desired object data will be loaded into obj
+ //! \throws IOException_t
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void fetch (ID_t iid, IBankable_t & obj)
+ {
+ fetchBID (lookupBID (iid), obj);
+ obj . iid_m = iid;
+ obj . eid_m . assign (idmap_m . lookupEID (iid));
+ }
+
+
+ //--------------------------------------------------- fetch ------------------
+ //! \brief Fetches a Bankable object from the bank by its EID
+ //!
+ void fetch (const std::string & eid, IBankable_t & obj)
+ {
+ fetchBID (lookupBID (eid), obj);
+ obj . iid_m = idmap_m . lookupIID (eid);
+ obj . eid_m . assign (eid);
+ }
+
+
+ //--------------------------------------------------- fetchFix ------------------
+ //! \brief Fetches the fixed length part of a Bankable object by its IID
+ //!
+ void fetchFix(ID_t iid, IBankable_t & obj)
+ {
+ fetchBIDFix (lookupBID (iid), obj);
+ obj . iid_m = iid;
+ obj . eid_m . assign (idmap_m . lookupEID (iid));
+ }
+
+
+ //--------------------------------------------------- fetchFix ------------------
+ //! \brief Fetches the fixed length part of a Bankable object by its EID
+ //!
+ void fetchFix(const std::string & eid, IBankable_t & obj)
+ {
+ fetchBIDFix (lookupBID (eid), obj);
+ obj . iid_m = idmap_m . lookupIID (eid);
+ obj . eid_m . assign (eid);
+ }
+
+
+ //--------------------------------------------------- getIDMap ---------------
+ //! \brief Get the current (IID <-> EID) -> BID map for the bank
+ //!
+ //! Access to the bank's IDMap. One may iterate through the IDMap for a list
+ //! of IDs in the bank. Users may not however directly modify the IDMap,
+ //! because the bank will automatically update the IDMap based on the IDs of
+ //! the objects appended to it. See IDMap_t API for more available methods.
+ //!
+ //! \return A const reference to the bank's IDMap
+ //!
+ const IDMap_t & getIDMap ( ) const
+ {
+ return idmap_m;
+ }
+
+
+ //--------------------------------------------------- getIDMapSize -----------
+ //! \brief Get the number of objects in the Bank with and IID or EID
+ //!
+ //! Returns the total number of ID'ed objects stored in the bank. This number
+ //! only includes object which have an associated IID or EID. Use getSize()
+ //! to get the total number of objects in the bank.
+ //!
+ //! \return The number of ID'ed objects stored in the bank
+ //!
+ Size_t getIDMapSize ( ) const
+ {
+ return idmap_m . getSize( );
+ }
+
+
+ //--------------------------------------------------- getIndexSize -----------
+ //! \brief Get the number of indices used by the bank
+ //!
+ //! Returns the number of BIDs (bank indices) being used by the bank. If we
+ //! imagine the bank as an array, this would be the size of the array. In a
+ //! perfect world, index size would equal the size of the bank (i.e. number of
+ //! records in the bank), however when objects are deleted, instead of
+ //! resizing the entire 'array' the index positions are ignored until a clean
+ //! is issued. Thus, depending on the number of remove operations performed,
+ //! the index size will be greater than or equal to the size of the bank. The
+ //! bigger the gap, the more empty indices there will be and the more
+ //! efficiency problems the bank will suffer. A clean operation will fix all
+ //! this, and make index-size equal size.
+ //!
+ //! \return The number of indices being used
+ //!
+ Size_t getIndexSize ( ) const
+ {
+ return last_bid_m [version_m];
+ }
+
+
+ //--------------------------------------------------- getMaxIID --------------
+ //! \brief Searches through the bank for the largest IID
+ //!
+ //! \note O(n) time complexity
+ //!
+ //! \returns The maximum IID in the bank
+ //!
+ ID_t getMaxIID ( ) const;
+
+ //--------------------------------------------------- getMaxBID --------------
+ //! \brief Searches through the bank for the largest BID
+ //!
+ //! \note O(n) time complexity
+ //!
+ //! \returns The maximum BID in the bank
+ //!
+ ID_t getMaxBID ( ) const;
+
+
+
+
+ //--------------------------------------------------- getSize ----------------
+ //! \brief Get the size of the bank, i.e. the number of stored records
+ //!
+ //! This method returns the total number of objects stored in the bank,
+ //! including anonymous objects which have no associated IID or EID.
+ //!
+ //! \return The size of the bank, or 0 if the bank is empty
+ //!
+ Size_t getSize ( ) const
+ {
+ return nbids_m [version_m];
+ }
+
+
+ //--------------------------------------------------- getStatus --------------
+ //! \brief Get the bank status
+ //!
+ //! Currently the status is set by the user and not written to the bank. So
+ //! don't expect any interesting return values from this method. Status is
+ //! set to zero on object initialization and then left untouched.
+ //!
+ //! \return Return the status of the bank
+ //!
+ signed char getStatus ( ) const
+ {
+ return status_m;
+ }
+
+
+ //--------------------------------------------------- getType ----------------
+ //! \brief Get the unique bank type identifier
+ //!
+ //! Is equivalent to the NCode of the objects stored in the bank.
+ //!
+ //! \return The unique bank type identifier
+ //!
+ NCode_t getType ( ) const
+ {
+ return banktype_m;
+ }
+
+
+ //--------------------------------------------------- isOpen -----------------
+ //! \brief Check the bank's open status
+ //!
+ //! \return true if open, false if closed
+ //!
+ bool isOpen ( ) const
+ {
+ return is_open_m;
+ }
+
+
+ //--------------------------------------------------- lookupBID --------------
+ //! \brief Converts an IID to a BID, throw exception on failure
+ //!
+ //! \throws ArgumentException_t
+ //! \return The BID of the specified IID
+ //!
+ ID_t lookupBID (ID_t iid) const;
+
+
+ //--------------------------------------------------- lookupBID --------------
+ //! \brief Converts an EID to a BID, throw exception on failure
+ //!
+ //! \throws ArgumentException_t
+ //! \return The BID of the specified EID
+ //!
+ ID_t lookupBID (const std::string & eid) const;
+
+
+ //--------------------------------------------------- lookupEID --------------
+ //! \brief Converts an IID to an EID
+ //!
+ //! \return Returns the EID of the IID or empty string on failure
+ //!
+ const std::string & lookupEID (ID_t iid) const
+ {
+ return idmap_m . lookupEID (iid);
+ }
+
+
+ //--------------------------------------------------- lookupIID --------------
+ //! \brief Converts an EID to an IID
+ //!
+ //! \return Returns the IID of the EID or NULL_ID on failure
+ //!
+ ID_t lookupIID (const std::string & eid) const
+ {
+ return idmap_m . lookupIID (eid);
+ }
+
+
+ //--------------------------------------------------- open -------------------
+ //! \brief Opens a bank on disk
+ //!
+ //! Opens a bank on disk, allowing modification/access operations like append
+ //! and fetch to be performed. An open bank will first be closed before the
+ //! new one is opened. Check for the existence of a bank (with the exists
+ //! method) before opening to avoid an exception. If the B_SPY mode is
+ //! activated, only read access to the banks is required, otherwise both
+ //! read and write access is required.
+ //!
+ //! \param dir The resident directory of the bank
+ //! \param mode The mode of the bank (B_READ | B_WRITE | B_SPY)
+ //! \pre At least one of the modes is specified
+ //! \pre The specified directory contains a bank of this type
+ //! \pre sufficient read/write/exe permissions for dir and bank files
+ //! \throws IOException_t
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void open (const std::string & dir, BankMode_t mode = B_READ | B_WRITE, Size_t version = OPEN_LATEST_VERSION, bool inPlace = true);
+
+ //--------------------------------------------------- remove -----------------
+ //! \brief Removes an object from the bank by its IID
+ //!
+ //! Removes the object from the bank. Removed objects will no longer be
+ //! accessible and the EID/IID pair will be removed from the IDMap. However,
+ //! removing an object does not free the disk space the object was occupying
+ //! so an eventual clean operation may be necessary to reduce the physical
+ //! size of the bank.
+ //!
+ //! \param iid The IID of the object to remove
+ //! \pre The bank is open for read/writing
+ //! \pre The IID exists in the bank
+ //! \post The object is conceptually removed from the bank
+ //! \throws IOException_t
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void remove (ID_t iid)
+ {
+ removeBID (lookupBID (iid));
+ idmap_m . remove (iid);
+ }
+
+
+ //--------------------------------------------------- remove -----------------
+ //! \brief Removes an object from the bank by its EID
+ //!
+ void remove (const std::string & eid)
+ {
+ removeBID (lookupBID (eid));
+ idmap_m . remove (eid);
+ }
+
+
+ //--------------------------------------------------- replace ----------------
+ //! \brief Replaces an object in the bank by its IID
+ //!
+ //! Replaces an object in the bank with a given IID. EID/IID pair of the
+ //! replaced object will be removed from the IDMap and the new pair will be
+ //! added. Replaced object will not be fetchable or restoreable, it will be
+ //! overwritten by the new object. The removed flag of the object will be
+ //! cleared but the modified flag will be set. The disk space of the replaced
+ //! object is not freed, therefore an eventual clean operation may be
+ //! necessary to reduce the physical size of the bank.
+ //!
+ //! \param iid The IID of the object to replace
+ //! \param obj The Bankable object to replace old object
+ //! \pre The bank is open for read/writing
+ //! \pre The specified IID exists in the bank
+ //! \pre obj is compatible with the current NCode bank type
+ //! \pre The new object EID does not exist in the bank
+ //! \post obj will replace the object with the given IID
+ //! \post obj's is_modified flag is set
+ //! \throws IOException_t
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void replace (ID_t iid, IBankable_t & obj);
+
+
+ //--------------------------------------------------- replace ----------------
+ //! \brief Replaces an object in the bank by its EID
+ //!
+ void replace (const std::string & eid, IBankable_t & obj);
+
+
+ //--------------------------------------------------- setStatus --------------
+ //! \brief Set the bank status
+ //!
+ //! Currently the status is set by the user and not written to the bank.
+ //! Status is set to zero on object initialization and then left untouched.
+ //!
+ //! \return void
+ //!
+ void setStatus (signed char status)
+ {
+ status_m = status;
+ }
+
+};
+
+
+//--------------------------------------------------- BankExists ---------------
+//! \brief Checks for the accessibility of a bank with certain type
+//!
+//! Only checks for the existence and readability of the info store, does not
+//! perform any validity checking on the other partitions.
+//!
+//! \param ncode The type of bank to look for
+//! \param dir The directory in which to look
+//! \return true if IFO store exists with read permissions, else false
+//!
+bool BankExists (NCode_t ncode, const std::string & dir);
+
+
+//--------------------------------------------------- PrintBankVersion ---------
+//! \brief Prints the bank version a program is compatible with
+//!
+//! \param s The program name
+//! \return void
+//!
+void PrintBankVersion (const char * s);
+
+} // namespace AMOS
+
+#endif // #ifndef __Bank_AMOS_HH
diff --git a/src/AMOS/ContigEdge_AMOS.cc b/src/AMOS/ContigEdge_AMOS.cc
new file mode 100644
index 0000000..9a4a054
--- /dev/null
+++ b/src/AMOS/ContigEdge_AMOS.cc
@@ -0,0 +1,85 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 09/24/2003
+//!
+//! \brief Source for ContigEdge_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "ContigEdge_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ ContigEdge_t ================
+const NCode_t ContigEdge_t::NCODE = M_CONTIGEDGE;
+
+
+//----------------------------------------------------- readMessage ------------
+void ContigEdge_t::readMessage (const Message_t & msg)
+{
+ ContigLink_t::readMessage (msg);
+ IEdge_t::readMessage (msg);
+
+ try {
+ // put ContigEdge_t specifics here
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void ContigEdge_t::readRecord (istream & fix, istream & var)
+{
+ ContigLink_t::readRecord (fix, var);
+ IEdge_t::readRecord (fix, var);
+
+ // put ContigEdge_t specifics here
+}
+
+
+//----------------------------------------------------- readRecordFix ----------
+void ContigEdge_t::readRecordFix (istream & fix)
+{
+ ContigLink_t::readRecordFix (fix);
+ IEdge_t::readRecordFix (fix);
+
+ // put ContigEdge_t specifics here
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void ContigEdge_t::writeMessage (Message_t & msg) const
+{
+ ContigLink_t::writeMessage (msg);
+ IEdge_t::writeMessage (msg);
+
+ try {
+
+ msg . setMessageCode (ContigEdge_t::NCODE);
+
+ // put ContigEdge_t specifics here
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void ContigEdge_t::writeRecord (ostream & fix, ostream & var) const
+{
+ ContigLink_t::writeRecord (fix, var);
+ IEdge_t::writeRecord (fix, var);
+
+ // put ContigEdge_t specifics here
+}
diff --git a/src/AMOS/ContigEdge_AMOS.hh b/src/AMOS/ContigEdge_AMOS.hh
new file mode 100644
index 0000000..27cbf67
--- /dev/null
+++ b/src/AMOS/ContigEdge_AMOS.hh
@@ -0,0 +1,144 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/18/2003
+//!
+//! \brief Header for ContigEdge_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __ContigEdge_AMOS_HH
+#define __ContigEdge_AMOS_HH 1
+
+#include "Edge_AMOS.hh"
+#include "ContigLink_AMOS.hh"
+#include <vector>
+
+
+
+
+namespace AMOS {
+
+//================================================ ContigEdge_t ================
+//! \brief Reliable linking information between two contigs
+//!
+//! Derived from a ContigLink_t, this class represents a reliable link between
+//! two contigs that is usually composed of multiple contig links. A list
+//! of contig edges is generally the output contig scaffolding.
+//!
+//==============================================================================
+ class ContigEdge_t : public ContigLink_t, public IEdge_t
+{
+
+private:
+
+ void setNodeType (NCode_t nodtype);
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //--------------------------------------------------- ContigEdge_t -----------
+ //! \brief Constructs an empty ContigEdge_t object
+ //!
+ ContigEdge_t ( )
+ {
+ // ContigLink_t sets NodeType
+ }
+
+
+ //--------------------------------------------------- ContigEdge_t -----------
+ //! \brief Copy constructor
+ //!
+ ContigEdge_t (const ContigEdge_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~ContigEdge_t ----------
+ //! \brief Destroys a ContigEdge_t object
+ //!
+ ~ContigEdge_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ // ContigLink_t preserves NodeType
+ ContigLink_t::clear( );
+ IEdge_t::clear( );
+ }
+
+
+ //--------------------------------------------------- getContigLinks ---------
+ //! \brief Get the bundle of contig link IIDs that make up this contig edge
+ //!
+ //! \return A vector of contig link IIDs
+ //!
+ const std::vector<ID_t> & getContigLinks ( ) const
+ {
+ return IEdge_t::getLinks( );
+ }
+
+
+ //--------------------------------------------------- getContigLinks ---------
+ //! \brief Get the bundle of contig link IIDs that make up this contig edge
+ //!
+ //! \return A vector of contig link IIDs
+ //!
+ std::vector<ID_t> & getContigLinks ( )
+ {
+ return IEdge_t::getLinks( );
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return ContigEdge_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- setContigLinks ---------
+ //! \brief Set the bundle of contig link IIDs that make up this contig edge
+ //!
+ //! \param links The new vector of contig link IIDs
+ //! \return void
+ //!
+ void setContigLinks (const std::vector<ID_t> & links)
+ {
+ IEdge_t::setLinks (links);
+ }
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __ContigEdge_AMOS_HH
diff --git a/src/AMOS/ContigIterator_AMOS.cc b/src/AMOS/ContigIterator_AMOS.cc
new file mode 100644
index 0000000..47639cf
--- /dev/null
+++ b/src/AMOS/ContigIterator_AMOS.cc
@@ -0,0 +1,252 @@
+// $Id$
+
+#include "ContigIterator_AMOS.hh"
+
+using namespace std;
+using namespace AMOS;
+
+
+TiledRead_t::TiledRead_t(Tile_t tile, Read_t red, int readidx)
+ : m_seq(red.getSeqString(tile.range)),
+ m_qual(red.getQualString(tile.range)),
+ m_readidx(readidx),
+ m_fragid(red.getFragment()),
+ m_iid(red.getIID()),
+ m_eid(red.getEID())
+{
+ int gappos;
+
+ try
+ {
+ for (int i = 0; i < tile.gaps.size(); i++)
+ {
+ gappos = tile.gaps[i] + i;
+ m_seq.insert(gappos, 1, '-');
+
+ char lqv = (gappos > 0) ? m_qual[gappos-1] : -1;
+ char rqv = (gappos < m_qual.size()) ? m_qual[gappos] : -1;
+
+ char gapqv = (lqv < rqv)
+ ? (lqv != -1) ? lqv : rqv
+ : (rqv != -1) ? rqv : lqv;
+
+ m_qual.insert(gappos, 1, gapqv);
+ }
+ }
+ catch(...)
+ {
+ AMOS_THROW_ARGUMENT((string)"Error inserting gaps into read: " + red.getEID());
+ }
+
+ m_loffset = tile.offset;
+ m_roffset = tile.offset + tile.getGappedLength() - 1;
+ m_isRC = tile.range.isReverse();
+
+ int l = m_seq.size();
+
+ for (int i = 0; i < l; i++)
+ {
+ m_seq[i] = toupper(m_seq[i]);
+ }
+}
+
+int32_t ContigIterator_t::s_tilingreadsoffset(0);
+
+ContigIterator_t::ContigIterator_t(Contig_t & ctg, Bank_t * rdbank)
+ : m_tilingreadsoffset(s_tilingreadsoffset)
+{
+ m_gindex = -1;
+ m_uindex = 1;
+
+ m_readBank = rdbank;
+ m_contig = ctg;
+
+ m_consensus = m_contig.getSeqString();
+ m_consqual = m_contig.getQualString();
+
+ vector<Tile_t> & tiling = m_contig.getReadTiling();
+ sort(tiling.begin(), tiling.end(), TileOrderCmp());
+ m_currenttile = 0;
+ m_numreads = tiling.size();
+ s_tilingreadsoffset += m_numreads;
+}
+
+Pos_t ContigIterator_t::uindex() const
+{
+ if (m_consensus[m_gindex] == '-' && m_uindex > 1)
+ {
+ return m_uindex-1;
+ }
+
+ return m_uindex;
+}
+
+void ContigIterator_t::renderTile(Tile_t & tile, int tilingindex)
+{
+ Read_t rd;
+
+ m_readBank->fetch(tile.source, rd);
+ TiledRead_t trd(tile, rd, tilingindex+m_tilingreadsoffset);
+
+ TiledReadList_t::iterator ins = m_tilingreads.insert(m_tilingreads.end(), trd);
+
+ m_ends.push(ins);
+}
+
+
+// Move to the next position
+bool ContigIterator_t::advanceNext()
+{
+ int len = m_consensus.size();
+ if (m_gindex >= len) { return false; }
+
+ if (m_gindex != -1 && m_consensus[m_gindex] != '-') { m_uindex++; }
+ m_gindex++;
+
+ vector<Tile_t> & tiling = m_contig.getReadTiling();
+
+ while ((m_currenttile < m_numreads) && (tiling[m_currenttile].offset <= m_gindex))
+ {
+ renderTile(tiling[m_currenttile], m_currenttile);
+ m_currenttile++;
+ }
+
+ while (!m_ends.empty() && (m_ends.top()->m_roffset < m_gindex))
+ {
+ m_tilingreads.erase(m_ends.top());
+ m_ends.pop();
+ }
+
+ return (m_gindex < len);
+}
+
+// Seek to a random position in the contig
+bool ContigIterator_t::seek(Pos_t gindex)
+{
+ if (gindex >= m_consensus.size()) { return false; }
+
+ bool reuseexistingtiling = (gindex >= m_gindex);
+
+ if (!reuseexistingtiling)
+ {
+ // Can't go backwards, so flush the tiling and reload from scratch
+ m_tilingreads.clear();
+ while (!m_ends.empty()) { m_ends.pop(); }
+ m_currenttile = 0;
+ }
+
+ m_gindex = gindex;
+ m_uindex = m_contig.gap2ungap(gindex);
+
+ // load the reads that overlap this position
+ vector<Tile_t> & tiling = m_contig.getReadTiling();
+
+ while (m_currenttile < m_numreads && tiling[m_currenttile].offset <= m_gindex)
+ {
+ Pos_t roffset = tiling[m_currenttile].offset + tiling[m_currenttile].getGappedLength() - 1;
+ if (roffset >= m_gindex)
+ {
+ // This read covers the seek position
+ renderTile(tiling[m_currenttile], m_currenttile);
+ }
+
+ m_currenttile++;
+ }
+
+ if (reuseexistingtiling)
+ {
+ while (!m_ends.empty() && m_ends.top()->m_roffset < m_gindex)
+ {
+ m_tilingreads.erase(m_ends.top());
+ m_ends.pop();
+ }
+ }
+
+ return true;
+}
+
+
+bool ContigIterator_t::hasSNP() const
+{
+ TiledReadList_t::const_iterator tle;
+
+ char lastbase = ' ';
+ for (tle = m_tilingreads.begin(); tle != m_tilingreads.end(); tle++)
+ {
+ char base = tle->base(m_gindex);
+
+ if (lastbase != ' ' && lastbase != base)
+ {
+ return true;
+ }
+
+ lastbase = base;
+ }
+
+ return false;
+}
+
+BaseStats_t::BaseStats_t(char base)
+ : m_base(base), m_cumqv(0), m_maxqv(0)
+{ }
+
+void BaseStats_t::addRead(TiledReadList_t::const_iterator tile, Pos_t gindex)
+{
+ int qv = tile->qv(gindex);
+ m_cumqv += qv;
+
+ if (qv > m_maxqv) { m_maxqv = qv; }
+
+ m_reads.push_back(tile);
+}
+
+Column_t::Column_t(ContigIterator_t & ci)
+ : m_gindex(ci.gindex()),
+ m_uindex(ci.uindex()),
+ m_cons(ci.cons()),
+ m_cqv(ci.cqv()),
+ m_depth(0)
+{
+ TiledReadList_t::const_iterator tle;
+ map<char, BaseStats_t>::iterator si;
+
+ for (tle = ci.getTilingReads().begin(); tle != ci.getTilingReads().end(); tle++)
+ {
+ assert(m_gindex >= tle->m_loffset &&
+ m_gindex <= tle->m_roffset);
+
+ m_depth++;
+
+ char base = tle->base(m_gindex);
+
+ si = m_baseinfo.find(base);
+ if (si == m_baseinfo.end())
+ {
+ si = m_baseinfo.insert(make_pair(base, BaseStats_t(base))).first;
+ }
+
+ si->second.addRead(tle, m_gindex);
+ }
+}
+
+Column_t ContigIterator_t::getColumn()
+{
+ return Column_t(*this);
+}
+
+vector<BaseStats_t *> Column_t::getBaseInfo()
+{
+ vector<BaseStats_t *> retval;
+
+ for (map<char, BaseStats_t>::iterator si = m_baseinfo.begin();
+ si != m_baseinfo.end();
+ si++)
+ {
+ retval.push_back(&si->second);
+ }
+
+ sort(retval.begin(), retval.end(), BaseStatsCmp());
+
+ return retval;
+}
+
diff --git a/src/AMOS/ContigIterator_AMOS.hh b/src/AMOS/ContigIterator_AMOS.hh
new file mode 100644
index 0000000..4ebcbc3
--- /dev/null
+++ b/src/AMOS/ContigIterator_AMOS.hh
@@ -0,0 +1,328 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Michael Schatz
+//! \date 08/15/2005
+//!
+//! \brief Header for ContigIterator and related classes
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef CONTIG_ITERATOR_HH
+#define CONTIG_ITERATOR_HH 1
+
+#include "Contig_AMOS.hh"
+#include "Read_AMOS.hh"
+
+#include <map>
+#include <list>
+#include <vector>
+#include <string>
+#include <queue>
+#include <functional>
+
+namespace AMOS
+{
+
+/*! @brief A read within a contig "rendered" with gaps inserted
+ *
+ * An enhanced version of a read object which with the sequence and
+ * quality values rendered with the gaps inserted.
+ *
+ */
+
+class TiledRead_t
+{
+public:
+
+ //! The tile information is used to render the sequence from the read. readidx is an index to assign
+ TiledRead_t(Tile_t tile, Read_t red, int readidx);
+
+ //! Returns the base at a given gapped consensus position or ' ' if outside the tiled range
+ char base(Pos_t gindex) const
+ {
+ if (gindex < m_loffset || gindex > m_roffset) { return ' '; }
+ return m_seq[gindex-m_loffset];
+ }
+
+ //! Returns the qv at a given gapped consensus position or -1 if outside the tiled range
+ int qv(Pos_t gindex) const
+ {
+ if (gindex < m_loffset || gindex > m_roffset) { return -1; }
+ return m_qual[gindex-m_loffset] - MIN_QUALITY;
+ }
+
+ //! Callee assigned index for read
+ int32_t m_readidx;
+
+ //! Left offset of the read in the contig
+ Pos_t m_loffset;
+
+ //! Right offset of the read in the contig
+ Pos_t m_roffset;
+
+ //! Boolean indicating if the read has been reversed
+ bool m_isRC;
+
+ //! iid of the read's fragment
+ ID_t m_fragid;
+
+ //! iid of the read
+ ID_t m_iid;
+
+ //! eid of the read
+ std::string m_eid;
+
+private:
+ //! rendered sequence
+ std::string m_seq;
+
+ //! rendered qual
+ std::string m_qual;
+};
+
+typedef std::list<TiledRead_t> TiledReadList_t;
+
+/*! @brief A binary function for determining the canonical sort order for reads
+ *
+ * Sorts by offset, then read length, and finally by iid
+ *
+ */
+
+struct TileOrderCmp
+{
+ bool operator () (const Tile_t & a, const Tile_t & b)
+ {
+ int offdiff = b.offset - a.offset;
+
+ if (offdiff)
+ {
+ if (offdiff < 0) { return false; }
+ return true;
+ }
+
+ int lendiff = (b.getGappedLength()) - (a.getGappedLength());
+
+ if (lendiff)
+ {
+ if (lendiff < 0) { return false; }
+ return true;
+ }
+
+ return (a.source < b.source);
+ }
+};
+
+
+
+
+/*! @brief Maintains statistics the Column_t about reads which share the same base at the current position
+ *
+ * Reads that agree at the current contig position are stored in the same
+ * BaseStats_t object. The object maintains a list of reads that agree, and
+ * some general statistics on the bases that tile that position.
+ *
+ */
+
+class BaseStats_t
+{
+public:
+ //! The base this BaseStats_t will represent
+ BaseStats_t(char base);
+
+ //! The base this BaseStats_t represents
+ char m_base;
+
+ //! The cumulative quality value of the reads that tile the current position that are m_base
+ int m_cumqv;
+
+ //! The maximum quality value of the reads that tile the current position that are m_base
+ int m_maxqv;
+
+ //! A vector of reads that tile the current position that are m_base
+ std::vector<TiledReadList_t::const_iterator> m_reads;
+
+ //! Used to add a read to the BaseStats_t
+ void addRead(TiledReadList_t::const_iterator tile, Pos_t gindex);
+};
+
+
+
+//! Functor for sorting BaseStats_t by count of reads of each base, then cumqv, then maxqv
+struct BaseStatsCmp
+{
+ bool operator() (const BaseStats_t * a, const BaseStats_t * b)
+ {
+ if (a->m_reads.size() == b->m_reads.size())
+ {
+ if (a->m_cumqv == b->m_cumqv)
+ {
+ return a->m_maxqv > b->m_maxqv;
+ }
+
+ return a->m_cumqv > b->m_cumqv;
+ }
+
+ return a->m_reads.size() > b->m_reads.size();
+ }
+};
+
+
+
+class ContigIterator_t;
+
+/*! @brief Maintains data on reads at a given contig position
+ *
+ * Organizes the reads at the current position in the contig
+ * by the base each read has at that position. The reads
+ * are collected into the m_baseinfo map which maps from
+ * base to BaseStats_t. The sortBaseInfo() method can be used
+ * to iterate through each base present at the current position.
+ *
+ * Warning: The column data becomes invalid if the contig iterator
+ * position is changed!
+ *
+ */
+
+class Column_t
+{
+public:
+ //! Object can only be used for a single position!
+ Column_t (ContigIterator_t & ci);
+
+ //! Returns a vector of m_baseinfo sorted by BaseStatsCmp
+ std::vector<BaseStats_t *> getBaseInfo();
+
+ //! 0-based gapped index
+ Pos_t m_gindex;
+
+ //! 1-based ungapped index
+ Pos_t m_uindex;
+
+ //! Current consenus
+ char m_cons;
+
+ //! Consensus quality value
+ int m_cqv;
+
+ //! Total depth of coverage
+ int32_t m_depth;
+
+ //! Map for collecting read information about each base
+ std::map<char, BaseStats_t> m_baseinfo;
+};
+
+
+
+/*! @brief Used for iterating through a contig on a per-consensus position basis
+ *
+ * Internally, the ContigIterator maintains a list of reads which tile the current
+ * contig position. This list can be accessed via the getTilingReads() method. In
+ * addition, you can also use the getColumn() method to create a Column_t object
+ * which sorts the reads by the base at the current consensus position rather
+ * than the position of the read in the layout. Use the
+ * hasSNP() method to determine if the tiling at the current position is uniform
+ * or if it has a SNP.
+ *
+ * Note: You must call advanceNext() or seek() to initialize the object
+ */
+
+class ContigIterator_t
+{
+public:
+ //! Constructor for iterator. You must call seek() or advanceNext() before using
+ ContigIterator_t(Contig_t & ctg, Bank_t * rdbank);
+
+ //! Seek to random position in O(numreads) time. Returns if the current position is valid
+ bool seek(Pos_t gindex);
+
+ //! Advance to next position (gindex+1) in O(maxdepth) time. Returns if the current position is valid
+ bool advanceNext();
+
+ //! Returns the current 1-based ungapped contig position
+ Pos_t uindex() const;
+
+ //! Returns the current 0-based gapped contig position
+ Pos_t gindex() const { return m_gindex; }
+
+ //! Returns if there is a SNP at the current position
+ bool hasSNP() const;
+
+ //! Returns depth at current position
+ int depth() const { return m_tilingreads.size(); }
+
+ //! Returns the consenus at the current position
+ char cons() const { return m_consensus[m_gindex]; }
+
+ //! Returns the consensus quality value at this current position
+ int cqv() const { return m_consqual[m_gindex] - MIN_QUALITY; }
+
+ //! Returns a Column_t of the current position
+ Column_t getColumn();
+
+ //! Get a reference to the contig object
+ const Contig_t & getContig() const { return m_contig; }
+
+
+ //! Get list of reads tiling current position
+ const TiledReadList_t & getTilingReads() const { return m_tilingreads; }
+
+
+
+
+private:
+ //! Renders a particular read by loading sequence and inserting gaps
+ void renderTile(Tile_t & tile, int tilingIndex);
+
+ //! Sort operator for maintain end position queue
+ struct ReadListItEndCmp
+ {
+ bool operator () (const TiledReadList_t::iterator & a, const TiledReadList_t::iterator & b)
+ {
+ return (a->m_roffset > b->m_roffset);
+ }
+ };
+
+ //! Keeps track of the next read to end
+ std::priority_queue<TiledReadList_t::iterator, std::vector<TiledReadList_t::iterator>, ReadListItEndCmp > m_ends;
+
+ //! Pointer to the readbank
+ Bank_t * m_readBank;
+
+ //! Consensus
+ std::string m_consensus;
+
+ //! Consensus quality
+ std::string m_consqual;
+
+ //! Current 0-based gapped contig position
+ Pos_t m_gindex;
+
+ //! Current 1-based ungapped contig position
+ Pos_t m_uindex;
+
+ //! Next read to consider in the tiling
+ int32_t m_currenttile;
+
+ //! Number of reads in the contig
+ int32_t m_numreads;
+
+ //! Contig object
+ Contig_t m_contig;
+
+ //! How many reads have been seen in previous contigs
+ static int32_t s_tilingreadsoffset;
+
+ //! Current offset to use for readidx
+ int32_t m_tilingreadsoffset;
+
+ //! Get List of reads tiling current position
+ TiledReadList_t m_tilingreads;
+};
+
+
+} // namespace AMOS
+
+
+#endif
diff --git a/src/AMOS/ContigLink_AMOS.cc b/src/AMOS/ContigLink_AMOS.cc
new file mode 100644
index 0000000..eff6747
--- /dev/null
+++ b/src/AMOS/ContigLink_AMOS.cc
@@ -0,0 +1,81 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 09/24/2003
+//!
+//! \brief Source for ContigLink_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "ContigLink_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ ContigLink_t ================
+const NCode_t ContigLink_t::NCODE = M_CONTIGLINK;
+
+
+//----------------------------------------------------- readMessage ------------
+void ContigLink_t::readMessage (const Message_t & msg)
+{
+ Link_t::readMessage (msg);
+
+ try {
+ Link_t::setNodeType (NULL_NCODE);
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void ContigLink_t::readRecord (istream & fix, istream & var)
+{
+ Link_t::readRecord (fix, var);
+
+ Link_t::setNodeType (NULL_NCODE);
+}
+
+
+//----------------------------------------------------- readRecordFix ----------
+void ContigLink_t::readRecordFix (istream & fix)
+{
+ Link_t::readRecordFix (fix);
+
+ Link_t::setNodeType (NULL_NCODE);
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void ContigLink_t::writeMessage (Message_t & msg) const
+{
+ Link_t::writeMessage (msg);
+
+ try {
+
+ msg . setMessageCode (ContigLink_t::NCODE);
+
+ // put ContigLink_t specifics here
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void ContigLink_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Link_t::writeRecord (fix, var);
+
+ // put ContigLink_t specifics here
+}
diff --git a/src/AMOS/ContigLink_AMOS.hh b/src/AMOS/ContigLink_AMOS.hh
new file mode 100644
index 0000000..e717527
--- /dev/null
+++ b/src/AMOS/ContigLink_AMOS.hh
@@ -0,0 +1,146 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/18/2003
+//!
+//! \brief Header for ContigLink_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __ContigLink_AMOS_HH
+#define __ContigLink_AMOS_HH 1
+
+#include "Link_AMOS.hh"
+#include "Contig_AMOS.hh"
+#include <utility>
+
+
+
+
+namespace AMOS {
+
+//================================================ ContigLink_t ================
+//! \brief Linking information between two contigs
+//!
+//! A single piece of linking information between two contigs. This evidence is
+//! used in the scaffolding process to determine the order and orientation of
+//! the assembly contigs. These individual links can be bundled together to
+//! form reliable contig edges, as done in scaffolding.
+//!
+//==============================================================================
+class ContigLink_t : public Link_t
+{
+
+private:
+
+ void setNodeType (NCode_t nodtype);
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //--------------------------------------------------- ContigLink_t -----------
+ //! \brief Constructs an empty ContigLink_t object
+ //!
+ //! Sets all members to zero or NULL
+ //!
+ ContigLink_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- ContigLink_t -----------
+ //! \brief Copy constructor
+ //!
+ ContigLink_t (const ContigLink_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~ContigLink_t ----------
+ //! \brief Destroys a ContigLink_t object
+ //!
+ ~ContigLink_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ Link_t::clear( );
+ }
+
+
+ //--------------------------------------------------- getContigs -------------
+ //! \brief Get the pair of contig IIDs joined by this link
+ //!
+ //! \return The first and second contig IIDs joined by this link
+ //!
+ std::pair<ID_t, ID_t> getContigs ( ) const
+ {
+ return Link_t::getNodes( );
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return ContigLink_t::NCODE;
+ }
+
+
+ //----------------------------------------------------- getNodeType ----------
+ NCode_t getNodeType( ) const
+ {
+ return Contig_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- setContigs -------------
+ //! \brief Set the contig IID pair for this link
+ //!
+ //! Only returns the IIDs of the contigs. It is up to the user to keep track
+ //! of where the actual contig objects are stored.
+ //!
+ //! \param contigs The new pair of contig IIDs
+ //! \return void
+ //!
+ void setContigs (std::pair<ID_t, ID_t> contigs)
+ {
+ Link_t::setNodes (contigs);
+ }
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __ContigLink_AMOS_HH
diff --git a/src/AMOS/Contig_AMOS.cc b/src/AMOS/Contig_AMOS.cc
new file mode 100644
index 0000000..22328a5
--- /dev/null
+++ b/src/AMOS/Contig_AMOS.cc
@@ -0,0 +1,545 @@
+////////////////////////////////////////////////////////////////////////////////
+
+//! \file
+//! \author Adam M Phillippy
+//! \date 10/23/2003
+//!
+//! \brief Source for Contig_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Contig_AMOS.hh"
+#include <cctype>
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ Contig_t ====================
+const NCode_t Contig_t::NCODE = M_CONTIG;
+
+
+//----------------------------------------------------- indexGaps --------------
+void Contig_t::indexGaps()
+{
+ if (gapsvalid_m) { return; }
+ gapsvalid_m = true;
+
+ gaps_m.clear();
+
+ Pos_t len = getLength();
+
+ for (Pos_t i = 0; i < len; i++)
+ {
+ if (getBase(i).first == '-')
+ {
+ gaps_m.push_back(i);
+ }
+ }
+}
+
+
+//----------------------------------------------------- gap2ungap --------------
+Pos_t Contig_t::gap2ungap (Pos_t gap)
+{
+ indexGaps();
+
+ int l = gaps_m.size();
+
+ Pos_t retval = gap;
+
+ for (int i = 0; (i < l) && (gaps_m[i] <= gap); i++)
+ {
+ retval--;
+ }
+
+ retval++;
+
+ return retval;
+}
+
+
+//----------------------------------------------------- ungap2gap --------------
+Size_t Contig_t::ungap2gap (Pos_t ungap)
+{
+ indexGaps();
+
+ int l = gaps_m.size();
+
+ Pos_t retval = ungap-1;
+
+ for (int i = 0; (i < l) && (gaps_m[i] <= retval); i++)
+ {
+ retval++;
+ }
+
+ return retval;
+}
+
+
+//----------------------------------------------------- getSpan ----------------
+Size_t Contig_t::getSpan ( ) const
+{
+ Pos_t hi,lo;
+
+
+ if ( reads_m . empty( ) )
+ {
+ lo = hi = 0;
+ }
+ else
+ {
+ vector<Tile_t>::const_iterator ti = reads_m . begin( );
+
+ lo = ti -> offset;
+ hi = ti -> offset + ti -> range . getLength( );
+
+ for ( ++ ti; ti != reads_m . end( ); ++ ti )
+ {
+ if ( ti -> offset < lo )
+ lo = ti -> offset;
+ if ( ti -> offset + ti -> getGappedLength( ) > hi )
+ hi = ti -> offset + ti -> getGappedLength( );
+ }
+ }
+
+ return hi - lo;
+}
+
+
+//----------------------------------------------------- getUngappedLength ------
+Size_t Contig_t::getUngappedLength( ) const
+{
+ Size_t retval = length_m;
+
+ for (Pos_t i = 0; i < length_m; ++ i )
+ if ( ! isalpha (getBase (i) . first) )
+ -- retval;
+
+ return retval;
+}
+
+
+//----------------------------------------------------- getUngappedQualString --
+string Contig_t::getUngappedQualString (Range_t range) const
+{
+ Pos_t lo = range . getLo( );
+ Pos_t hi = range . getHi( );
+
+ //-- Check preconditions
+ if ( lo < 0 || hi > getLength( ) )
+ AMOS_THROW_ARGUMENT ("Invalid quality subrange");
+
+ string retval;
+ retval . reserve (hi - lo);
+ pair<char, char> seqqualc;
+
+ //-- Skip the gaps in the sequence and populate the retval
+ for ( ; lo < hi; lo ++ )
+ {
+ seqqualc = getBase (lo);
+ if ( isalpha (seqqualc . first) )
+ retval . push_back (seqqualc . second);
+ }
+
+ if ( range . isReverse( ) )
+ AMOS::Reverse (retval);
+
+ return retval;
+}
+
+
+//----------------------------------------------------- getUngappedSeqString ---
+string Contig_t::getUngappedSeqString (Range_t range) const
+{
+ Pos_t lo = range . getLo( );
+ Pos_t hi = range . getHi( );
+
+ //-- Check preconditions
+ if ( lo < 0 || hi > getLength( ) )
+ AMOS_THROW_ARGUMENT ("Invalid sequence subrange");
+
+ string retval;
+ retval . reserve (hi - lo);
+ char seqc;
+
+ //-- Skip the gaps in the sequence and populate the retval
+ for ( ; lo < hi; lo ++ )
+ {
+ seqc = getBase (lo) . first;
+ if ( isalpha (seqc) )
+ retval . push_back (seqc);
+ }
+
+ if ( range . isReverse( ) )
+ AMOS::ReverseComplement (retval);
+
+ return retval;
+}
+
+
+//--------------------------------------------------- getFoldCov ---------------
+double Contig_t::getFoldCov ( ) const
+{
+ double cov = 0.0;
+ int contiglen = getLength();
+ if ( (!reads_m.empty()) && (contiglen!=0) )
+ {
+ int totreadlen = 0;
+ vector<Tile_t>::const_iterator ti;
+ for ( ti = reads_m . begin( ); ti != reads_m . end( ); ti ++ )
+ {
+ totreadlen = totreadlen + ti->range.getLength();
+ }
+ cov = (double) totreadlen / (double) contiglen;
+ }
+ return cov;
+}
+
+
+//--------------------------------------------------- getCovStat ---------------
+double Contig_t::getCovStat(const double globalArrivalRate) const
+{
+ const float ln2=0.69314718055994530941723212145818;
+
+ assert(globalArrivalRate != -1);
+ return (getAvgRho() * (globalArrivalRate)) - (ln2 * (reads_m.size() -1));
+}
+
+
+//--------------------------------------------------- getAvgRho ---------------
+double Contig_t::getAvgRho( ) const
+{
+ double avgRho = 1;
+ Pos_t lo, hi;
+ Size_t lenLo, lenHi;
+
+ if ( !reads_m . empty( ) )
+ {
+ vector<Tile_t>::const_iterator ti = reads_m . begin( );
+
+ lo = ti -> offset;
+ lenLo = ti->range.getLength();
+ hi = ti -> offset;
+ lenHi = ti->range.getLength();
+ for ( ++ ti; ti != reads_m . end( ); ++ ti )
+ {
+ if ( ti -> offset < lo || (ti->offset == lo && ti->range.getLength() < lenLo)) {
+ lo = ti -> offset;
+ lenLo = ti->range.getLength();
+ }
+ if ( ti -> offset > hi || (ti->offset == hi && ti->range.getLength() < lenHi)) {
+ hi = ti -> offset;
+ lenHi = ti->range.getLength();
+ }
+ }
+ double avgLen = (double)(lenLo + lenHi) / 2;
+ avgRho = getUngappedLength() - avgLen;
+ if (avgRho <= 0) {
+ avgRho = 1;
+ }
+ }
+
+ return avgRho;
+}
+
+
+//----------------------------------------------------- insertGapColumn --------
+void Contig_t::insertGapColumn (Pos_t gindex)
+{
+ // Insert gap into the consensus
+ string qual(getQualString());
+ string seq(getSeqString());
+
+ if (gindex > seq.length())
+ {
+ AMOS_THROW_ARGUMENT("Invalid position specified for inserting gap column");
+ }
+
+ seq.insert(gindex, "-", 1);
+ qual.insert(gindex, "N", 1); // TODO: Set qv more intelligently
+ setSequence(seq, qual);
+
+ // Adjust the reads
+ vector<Tile_t>::iterator i;
+ for (i = reads_m.begin();
+ i != reads_m.end();
+ i++)
+ {
+ if (i->offset >= gindex)
+ {
+ // insert before read, shift over 1
+ // Don't insert starting gaps
+ i->offset++;
+ }
+ else if (i->getRightOffset() < gindex)
+ {
+ // insert after read, nothing to do
+ }
+ else
+ {
+ // gap inserted into read
+ int gseqpos = gindex - i->offset;
+
+ // create a new vector of gaps, with a gap at gseqpos
+ vector<Pos_t> newgaps;
+
+ // count gaps that occur before gap we are inserting
+ int gapcount = 0;
+ vector<Pos_t>::iterator g;
+ for (g = i->gaps.begin();
+ g != i->gaps.end();
+ g++, gapcount++)
+ {
+ int cgseqpos = *g+gapcount;
+ if (cgseqpos > gseqpos) { break; }
+
+ newgaps.push_back(*g);
+ }
+
+ // Add new gap
+ newgaps.push_back(gseqpos-gapcount);
+
+ // Copy gaps following the inserted gap
+ while (g != i->gaps.end())
+ {
+ newgaps.push_back(*g);
+ g++;
+ }
+
+ i->gaps = newgaps;
+ }
+ }
+}
+
+
+
+//----------------------------------------------------- readMessage ------------
+void Contig_t::readMessage (const Message_t & msg)
+{
+ gapsvalid_m = false;
+ Sequence_t::readMessage (msg);
+
+ try {
+ istringstream ss;
+
+ if ( msg . exists (F_SCAFFOLD) )
+ {
+ ss . str (msg . getField (F_SCAFFOLD));
+ ss >> scf_m;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid fragment link format");
+ ss . clear( );
+ }
+
+ vector<Message_t>::const_iterator i;
+
+ for ( i = msg . getSubMessages( ) . begin( );
+ i != msg . getSubMessages( ) . end( ); i ++ )
+ {
+ if ( i -> getMessageCode( ) == M_TILE )
+ {
+ reads_m . push_back (Tile_t( ));
+ reads_m . back( ) . readMessage (*i);
+ }
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Contig_t::readRecord (istream & fix, istream & var)
+{
+ gapsvalid_m = false;
+ Sequence_t::readRecord (fix, var);
+
+ readLE (fix, &scf_m);
+ Size_t sizet;
+ readLE (fix, &sizet);
+
+ reads_m . resize (sizet);
+ for ( Pos_t i = 0; i < sizet; i ++ )
+ reads_m [i] . readRecord (var);
+}
+
+
+//----------------------------------------------------- readRecordFix ----------
+void Contig_t::readRecordFix (istream & fix)
+{
+ gapsvalid_m = false;
+ Sequence_t::readRecordFix (fix);
+
+ readLE (fix, &scf_m);
+ Size_t sizet;
+ readLE (fix, &sizet);
+
+ reads_m.clear();
+ reads_m . resize (sizet);
+}
+
+
+//----------------------------------------------------- readUMD ----------------
+bool Contig_t::readUMD (istream & in)
+{
+ gapsvalid_m = false;
+ string eid;
+ Tile_t tile;
+ istringstream ss;
+ string line;
+
+ while ( line . empty( ) || line [0] != 'C' )
+ {
+ if ( !in . good( ) )
+ return false;
+ getline (in, line);
+ }
+
+ clear( );
+
+ try {
+
+ ss . str (line);
+ ss . ignore( );
+ ss >> eid;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid contig ID");
+ ss . clear( );
+ setEID (eid);
+
+ while ( true )
+ {
+ getline (in, line);
+ if ( line . empty( ) )
+ break;
+
+ ss . str (line);
+ ss >> tile . source;
+ ss >> tile . range . begin;
+ ss >> tile . range . end;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid read layout");
+ ss . clear( );
+ tile . offset = tile . range . begin < tile . range . end ?
+ tile . range . begin : tile . range . end;
+ tile . range . begin -= tile . offset;
+ tile . range . end -= tile . offset;
+ getReadTiling( ) . push_back (tile);
+ }
+
+ }
+ catch (IOException_t) {
+
+ //-- Clean up and rethrow
+ clear( );
+ throw;
+ }
+
+ return true;
+}
+
+void Contig_t::reverseComplement()
+{
+ // Reverse the consensus
+ string qual(getQualString());
+ string seq(getSeqString());
+ int conslen = seq.length();
+
+ AMOS::ReverseComplement(seq);
+ reverse(qual.begin(), qual.end());
+ setSequence(seq, qual);
+
+ // Flip the orientation of the reads
+ vector<Tile_t>::iterator i;
+ for (i = reads_m.begin();
+ i != reads_m.end();
+ i++)
+ {
+ i->range.swap();
+ i->offset = conslen - (i->offset + i->getGappedLength());
+
+ Pos_t len = i->range.getLength();
+
+ vector<Pos_t>::iterator g;
+ for (g = i->gaps.begin();
+ g != i->gaps.end();
+ g++)
+ {
+ *g = len - *g;
+ }
+
+ reverse(i->gaps.begin(), i->gaps.end());
+ }
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Contig_t::writeMessage (Message_t & msg) const
+{
+ Sequence_t::writeMessage (msg);
+ try {
+ ostringstream ss;
+ if ( scf_m != NULL_ID )
+ {
+ ss << scf_m;
+ msg . setField (F_SCAFFOLD, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ Pos_t begin = msg . getSubMessages( ) . size( );
+ msg . getSubMessages( ) . resize (begin + reads_m . size( ));
+
+ msg . setMessageCode (Contig_t::NCODE);
+
+ if ( !reads_m . empty( ) )
+ {
+ vector<Tile_t>::const_iterator tvi;
+ for ( tvi = reads_m . begin( ); tvi != reads_m . end( ); ++ tvi )
+ tvi -> writeMessage (msg . getSubMessages( ) [begin ++]);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Contig_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Sequence_t::writeRecord (fix, var);
+ writeLE (fix, &scf_m);
+
+ Size_t sizet = reads_m . size( );
+ writeLE (fix, &sizet);
+
+ for ( Pos_t i = 0; i < sizet; i ++ )
+ reads_m [i] . writeRecord (var);
+}
+
+
+//----------------------------------------------------- writeUMD ---------------
+void Contig_t::writeUMD (ostream & out) const
+{
+ vector<Tile_t>::const_iterator ti;
+
+ out << "C " << getEID( ) << endl;
+
+ for ( ti = reads_m . begin( ); ti != reads_m . end( ); ti ++ )
+ out << ti -> source << ' '
+ << ti -> range . begin + ti -> offset << ' '
+ << ti -> range . end + ti -> offset << endl;
+
+ out << endl;
+
+ if ( !out . good( ) )
+ AMOS_THROW_IO ("UMD message write failure");
+}
diff --git a/src/AMOS/Contig_AMOS.hh b/src/AMOS/Contig_AMOS.hh
new file mode 100644
index 0000000..5593bc4
--- /dev/null
+++ b/src/AMOS/Contig_AMOS.hh
@@ -0,0 +1,449 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/18/2003
+//!
+//! \brief Header for Contig_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Contig_AMOS_HH
+#define __Contig_AMOS_HH 1
+
+#include "Sequence_AMOS.hh"
+#include "Layout_AMOS.hh"
+#include <vector>
+
+
+
+
+namespace AMOS {
+
+//================================================ Contig_t ====================
+//! \brief A tiling of assembled sequence reads
+//!
+//! A Contig_t consists of a consensus sequence with quality scores and a
+//! tiling of underlying reads that produce the consensus. The consensus
+//! sequence is stored as a 'gapped consensus'. That is the gaps are stored as
+//! gap characters in the consensus sequence instead of as a position list.
+//! The ungapped version of the consensus can be generated with the
+//! getUngapped... methods. Gap characters should be '-' but '*' is also
+//! accepted. The compress and uncompress methods inherited from Sequence_t
+//! are made private because they would corrupt the gap characters.
+//!
+//==============================================================================
+class Contig_t : public Sequence_t
+{
+
+private:
+ bool gapsvalid_m; //<! indicates if gaps_m is up to date
+ std::vector<Pos_t> gaps_m; //!< consensus gaps
+ std::vector<Tile_t> reads_m; //!< read tiling
+ ID_t scf_m; //!< the IID of the parent scaffold
+
+ //--------------------------------------------------- compress ---------------
+ //! \brief Reimplemented from Sequence_t as private to prohibit use
+ //!
+ void compress ( );
+
+
+ //--------------------------------------------------- uncompress -------------
+ //! \brief Reimplemented from Sequence_t as private to prohibit use
+ //!
+ void uncompress ( );
+
+
+ //--------------------------------------------------- indexGaps --------------
+ //! \brief Records the positions of the consensus gaps for fast coordinate translation
+ //!
+ void indexGaps();
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //--------------------------------------------------- Contig_t ---------------
+ //! \brief Constructs an empty Contig_t object
+ //!
+ Contig_t ( )
+ : gapsvalid_m(false), scf_m(NULL_ID)
+ {
+
+ }
+
+
+ //--------------------------------------------------- Contig_t ---------------
+ //! \brief Copy constructor
+ //!
+ Contig_t (const Contig_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~Contig_t --------------
+ //! \brief Destroys a Contig_t object
+ //!
+ ~Contig_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ Sequence_t::clear( );
+ gaps_m . clear( );
+ reads_m . clear( );
+ gapsvalid_m = false;
+ scf_m = NULL_ID;
+ }
+
+ void setScf(ID_t &id) {
+ scf_m = id;
+ }
+
+ ID_t getScf() {
+ return scf_m;
+ }
+
+ //--------------------------------------------------- gap2ungap --------------
+ //! \brief Translates a 0-based gapped position (offset) to a 1-based ungapped position (sequence coordinate)
+ //!
+ //! This method requires O(num gaps). If the gapped position points to a gap
+ //! the returned ungapped position will point to the base immediately
+ //! preceeding the gap.
+ //!
+ //! \param The gapped position
+ //! \pre gap < getLength( )
+ //! \return The ungapped position
+ //!
+ Pos_t gap2ungap (Pos_t gap);
+
+
+ //--------------------------------------------------- ungap2gap --------------
+ //! \brief Translates an 1-based ungapped position to a 0-based gapped position
+ //!
+ //! This method requires O(number gaps) time.
+ //!
+ //! \param The ungapped position
+ //! \pre ungap < getUngappedLength( )
+ //! \return The gapped position
+ //!
+ Pos_t ungap2gap (Pos_t ungap);
+
+ //--------------------------------------------------- getGCContent --------------
+ //! \brief Get the gc content of the sequence
+ //!
+ //! \return The gc content for the specified range of the sequence
+ //!
+ virtual double getGCContent (const Range_t & rng) const
+ {
+ int gc = 0;
+ int all = 0;
+
+ int start = rng.getLo();
+ int stop = rng.getHi();
+
+ if (stop > length_m)
+ AMOS_THROW_ARGUMENT("Can't compute GC Content beyond sequence length");
+
+ // skip ambiguities, gaps
+
+ for (int i = start; i < stop; i++)
+ {
+ switch(seq_m[i])
+ {
+ case 'A':
+ case 'a':
+ case 'T':
+ case 't': all++; break;
+
+ case 'C':
+ case 'c':
+ case 'G':
+ case 'g': all++; gc++; break;
+ };
+ }
+
+ return (all) ? ((double)gc)/all : 0.0;
+ }
+
+ //--------------------------------------------------- getGCContent --------------
+ //! \brief Get the gc content of the sequence
+ //!
+ //! \return The gc content of the full range of the sequence
+ //!
+ virtual double getGCContent ( ) const
+ {
+ return getGCContent(Range_t(0, length_m));
+ }
+
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Contig_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getReadTiling ----------
+ //! \brief Get the tiling of underlying reads
+ //!
+ //! \return The vector of underlying reads
+ //!
+ const std::vector<Tile_t> & getReadTiling ( ) const
+ {
+ return reads_m;
+ }
+
+
+ //--------------------------------------------------- getReadTiling ----------
+ std::vector<Tile_t> & getReadTiling ( )
+ {
+ return reads_m;
+ }
+
+
+ //--------------------------------------------------- getSpan ----------------
+ //! \brief Get the span of the read layout
+ //!
+ //! Returns the difference between min(offset) and max(offset+len). Since the
+ //! layout is not necessarily sorted, this method requires linear time.
+ //!
+ //! \return The span of the layout
+ //!
+ Size_t getSpan ( ) const;
+
+
+ //--------------------------------------------------- getUngappedLength ------
+ //! \brief Get the ungapped consensus length
+ //!
+ //! Unlike getLength( ) which is constant time, this method requires linear
+ //! time.
+ //!
+ //! \return The ungapped length of the consensus sequence
+ //!
+ Size_t getUngappedLength ( ) const;
+
+
+ //--------------------------------------------------- getUngappedQualString --
+ //! \brief Get the ungapped quality score string
+ //!
+ //! Returns the quality string with all the gap scores removed.
+ //!
+ //! \return The full string of ungapped quality scores
+ //!
+ std::string getUngappedQualString ( ) const
+ {
+ return getUngappedQualString (Range_t (0, getLength( )));
+ }
+
+
+ //--------------------------------------------------- getUngappedQualString --
+ //! \brief Get an ungapped quality score substring
+ //!
+ //! Returns a subrange of quality scores [begin, end) or (end, begin] with
+ //! all the gap scores removed. The range bounds are relative to the gapped
+ //! consensus sequence, and a reversed range will pull the reverse string of
+ //! quality scores.
+ //!
+ //! \param range The range of quality scores to get
+ //! \pre range lo >= 0 && hi <= length
+ //! \throws ArgumentException
+ //! \return A subrange of ungapped quality scores
+ //!
+ std::string getUngappedQualString (Range_t range) const;
+
+
+ //--------------------------------------------------- getUngappedSeqString ---
+ //! \brief Get the ungapped sequence base string
+ //!
+ //! \return The full string of ungapped sequence bases
+ //!
+ std::string getUngappedSeqString ( ) const
+ {
+ return getUngappedSeqString (Range_t (0, getLength( )));
+ }
+
+
+ //--------------------------------------------------- getUngappedSeqString ---
+ //! \brief Get an ungapped sequence base substring
+ //!
+ //! Returns a subrange of ungapped sequence bases [begin, end) or (end, begin]
+ //! with all the gaps (non-alphas) removed. The range bounds are relative to
+ //! the gapped consensus sequence, and reversed range will pull the reverse
+ //! complement string of sequence bases.
+ //!
+ //! \param range The range of sequence bases to get
+ //! \pre range lo >= 0 && hi <= length
+ //! \throws ArgumentException
+ //! \return A subrange of ungapped sequence bases
+ //!
+ std::string getUngappedSeqString (Range_t range) const;
+
+
+
+ //--------------------------------------------------- insertGapColumn -------
+ //! \brief Insert a gap column at the specified position in the contig
+ //!
+ //! Inserts a gap into the consensus and tiling reads at the specified position.
+ //! The downstream reads are shifted appropriately, and the consensus grows by
+ //! 1bp.
+ //!
+ //! \param gindex The gapped consensus position to insert the gap column
+ //! \pre 0 <= gindex <= |consensus|
+ //! \throws ArgumentException
+ //! \return void
+ //!
+ void insertGapColumn (Pos_t gindex);
+
+
+
+ //--------------------------------------------------- getFoldCov -------------
+ //! \brief Get the fold coverage of the contig sequence
+ //!
+ //! Example: A 1,000 bp long contig with 100x 100bp reads has a 10x coverage.
+ //!
+ //! \return Fold coverage value
+ //!
+ double getFoldCov ( ) const;
+
+
+
+ //--------------------------------------------------- getCovStat -------------
+ //! \brief Get the cov stat of the sequence
+ //!
+ //! \return The coverage stat for the sequence
+ //!
+ double getCovStat(const double globalArrivalRate) const;
+
+
+
+ //--------------------------------------------------- getAvgRho --------------
+ //! \brief Get the length of the sequence with more than 1X coverage
+ //!
+ //! \return The length for the sequence
+ //!
+ double getAvgRho( ) const;
+
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- readUMD ----------------
+ //! \brief Read a UMD contig message from an input stream
+ //!
+ //! Reads a University of Maryland style contig message and populates the
+ //! appropriate fields with the values read from the stream. Will throw an
+ //! exception if a message is found, but is not properly formatted. All
+ //! fields not included in the message will be reinitialized. Contig EID will
+ //! be set, and each tile will be stored with Read IID, read offset, and read
+ //! range. Read range will be flipped to represent reverse complement.
+ //!
+ //! \param in The input stream to read from
+ //! \pre The incoming message is properly formatted
+ //! \throws IOException_t
+ //! \return true if a message was read, false if no message read (EOF)
+ //!
+ bool readUMD (std::istream & in);
+
+ //--------------------------------------------------- reverseComplement ------
+ //! \brief Reverse Complement the contig and layout of reads
+ //!
+ //! Reverse complements the consensus, reverses the consensus quality values
+ //! and flips the orientations of the tiling reads. Note: The scaffold and contig
+ //! edges are NOT updated.
+ //! \return void
+ //!
+ void reverseComplement();
+
+
+ //--------------------------------------------------- setReadTiling ----------
+ //! \brief Set the tiling of underlying reads
+ //!
+ //! \param reads The new vector of underlying reads
+ //! \return void
+ //!
+ void setReadTiling (const std::vector<Tile_t> & reads)
+ {
+ reads_m = reads;
+ }
+
+
+ //--------------------------------------------------- setReadTiling ----------
+ //! \brief Set the tiling of underlying reads
+ //!
+ //! \param layout The new read layout
+ //! \return void
+ //!
+ void setReadTiling (const Layout_t & layout)
+ {
+ reads_m = layout . getTiling( );
+ }
+
+ //--------------------------------------------------- setSequence -----------
+ //! \brief Set the consensus sequence of the contig
+ //!
+ //! See Sequence_t::setSequence()
+ //!
+ void setSequence (const char * seq, const char * qual)
+ {
+ gapsvalid_m = false;
+ Sequence_t::setSequence(seq, qual);
+ }
+
+ //--------------------------------------------------- setSequence -----------
+ //! \brief Set the consensus sequence of the contig
+ //!
+ //! See Sequence_t::setSequence()
+ //!
+ void setSequence (const std::string & seq, const std::string & qual)
+ {
+ gapsvalid_m = false;
+ Sequence_t::setSequence(seq, qual);
+ }
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+
+ //--------------------------------------------------- writeUMD ---------------
+ //! \brief Write a UMD contig message to an output stream
+ //!
+ //! Writes a University of Maryland style contig message to the output stream.
+ //! Will throw an exception if there was an error trying to write to the
+ //! output stream.
+ //!
+ //! \param out The output stream to write to
+ //! \pre The ostream is open and writable
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void writeUMD (std::ostream & out) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Contig_AMOS_HH
diff --git a/src/AMOS/Edge_AMOS.cc b/src/AMOS/Edge_AMOS.cc
new file mode 100644
index 0000000..483da63
--- /dev/null
+++ b/src/AMOS/Edge_AMOS.cc
@@ -0,0 +1,167 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 04/12/2005
+//!
+//! \brief Source for Edge_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Edge_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//====================================================== IEdge_t ===============
+//----------------------------------------------------- readMessage ------------
+void IEdge_t::readMessage (const Message_t & msg)
+{
+ clear( );
+
+ try {
+
+ if ( msg . exists (F_LINK) )
+ {
+ istringstream ss;
+ ID_t iid;
+
+ ss . str (msg . getField (F_LINK));
+
+ while ( ss )
+ {
+ ss >> iid;
+ if ( ! ss . fail( ) )
+ links_m . push_back (iid);
+ }
+
+ if ( ! ss . eof( ) )
+ AMOS_THROW_ARGUMENT ("Invalid link list format");
+ ss . clear( );
+ }
+ }
+ catch (ArgumentException_t) {
+
+ IEdge_t::clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void IEdge_t::readRecord (istream & fix, istream & var)
+{
+ Size_t size;
+ readLE (fix, &size);
+
+ links_m . resize (size, NULL_ID);
+ for ( Pos_t i = 0; i < size; i ++ )
+ readLE (var, &(links_m [i]));
+}
+
+
+
+//----------------------------------------------------- readRecordFix ----------
+void IEdge_t::readRecordFix (istream & fix)
+{
+ Size_t size;
+ readLE (fix, &size);
+
+ links_m . clear();
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void IEdge_t::writeMessage (Message_t & msg) const
+{
+ try {
+
+ if ( !links_m . empty( ) )
+ {
+ string s;
+ ostringstream ss;
+ vector<ID_t>::const_iterator vi;
+
+ for ( vi = links_m . begin( ); vi != links_m . end( ); vi ++ )
+ {
+ ss << *vi << endl;
+ s . append (ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ msg . setField (F_LINK, s);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void IEdge_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Size_t size = links_m . size( );
+ writeLE (fix, &size);
+
+ for ( Pos_t i = 0; i < size; i ++ )
+ writeLE (var, &(links_m [i]));
+}
+
+
+//====================================================== Edge_t ================
+const NCode_t Edge_t::NCODE = M_EDGE;
+
+
+//----------------------------------------------------- readMessage ------------
+void Edge_t::readMessage (const Message_t & msg)
+{
+ Link_t::readMessage (msg);
+ IEdge_t::readMessage (msg);
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Edge_t::readRecord (istream & fix, istream & var)
+{
+ Link_t::readRecord (fix, var);
+ IEdge_t::readRecord (fix, var);
+}
+
+
+//----------------------------------------------------- readRecordFix ----------
+void Edge_t::readRecordFix (istream & fix)
+{
+ Link_t::readRecordFix (fix);
+ IEdge_t::readRecordFix (fix);
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Edge_t::writeMessage (Message_t & msg) const
+{
+ Link_t::writeMessage (msg);
+ IEdge_t::writeMessage (msg);
+
+ try {
+
+ msg . setMessageCode (Edge_t::NCODE);
+
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Edge_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Link_t::writeRecord (fix, var);
+ IEdge_t::writeRecord (fix, var);
+}
diff --git a/src/AMOS/Edge_AMOS.hh b/src/AMOS/Edge_AMOS.hh
new file mode 100644
index 0000000..a4580b8
--- /dev/null
+++ b/src/AMOS/Edge_AMOS.hh
@@ -0,0 +1,219 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 04/12/2005
+//!
+//! \brief Header for Edge_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Edge_AMOS_HH
+#define __Edge_AMOS_HH 1
+
+#include "Link_AMOS.hh"
+#include <vector>
+
+
+
+
+namespace AMOS {
+
+//====================================================== IEdge_t ===============
+//! \brief Interface for Edge_t
+//!
+//==============================================================================
+class IEdge_t
+{
+
+private:
+
+ std::vector<ID_t> links_m; //!< bundle of Links
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ //--------------------------------------------------------- IEdge_t ----------
+ //! \brief Constructs an empty IEdge_t object
+ //!
+ IEdge_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------------- IEdge_t ----------
+ //! \brief Copy constructor
+ //!
+ IEdge_t (const IEdge_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------------- ~IEdge_t ---------
+ //! \brief Destroys a IEdge_t object
+ //!
+ virtual ~IEdge_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ void clear ( )
+ {
+ links_m . clear( );
+ }
+
+
+ //--------------------------------------------------------- getLinks ---------
+ //! \brief Get the bundle of link IIDs that make up this contig edge
+ //!
+ //! \return A vector of link IIDs
+ //!
+ const std::vector<ID_t> & getLinks ( ) const
+ {
+ return links_m;
+ }
+
+
+ //--------------------------------------------------------- getLinks ---------
+ //! \brief Get the bundle of link IIDs that make up this contig edge
+ //!
+ //! \return A vector of link IIDs
+ //!
+ std::vector<ID_t> & getLinks ( )
+ {
+ return links_m;
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const = 0;
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------------- setLinks ---------
+ //! \brief Set the bundle of link IIDs that make up this contig edge
+ //!
+ //! \param links The new vector of link IIDs
+ //! \return void
+ //!
+ void setLinks (const std::vector<ID_t> & links)
+ {
+ links_m = links;
+ }
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+
+
+
+//====================================================== Edge_t ================
+//! \brief Reliable linking information between two nodes
+//!
+//! Derived from a Link_t, this class represents a reliable link between
+//! two nodes that is usually composed of multiple links.
+//!
+//==============================================================================
+ class Edge_t : public Link_t, public IEdge_t
+{
+
+private:
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //--------------------------------------------------------- Edge_t -----------
+ //! \brief Constructs an empty Edge_t object
+ //!
+ Edge_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------------- Edge_t -----------
+ //! \brief Copy constructor
+ //!
+ Edge_t (const Edge_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------------- ~Edge_t ----------
+ //! \brief Destroys a Edge_t object
+ //!
+ ~Edge_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ Link_t::clear( );
+ IEdge_t::clear( );
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Edge_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Edge_AMOS_HH
diff --git a/src/AMOS/Feature_AMOS.cc b/src/AMOS/Feature_AMOS.cc
new file mode 100644
index 0000000..3209109
--- /dev/null
+++ b/src/AMOS/Feature_AMOS.cc
@@ -0,0 +1,143 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 04/19/2005
+//!
+//! \brief Source for Feature_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Feature_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//====================================================== Feature_t =============
+const NCode_t Feature_t::NCODE = M_FEATURE;
+
+//----------------------------------------------------- readMessage ------------
+void Feature_t::readMessage (const Message_t & msg)
+{
+ Universal_t::readMessage (msg);
+
+ try {
+ istringstream ss;
+
+ if ( msg . exists (F_CLEAR) )
+ {
+ ss . str (msg . getField (F_CLEAR));
+ ss >> range_m . begin;
+ ss . ignore( );
+ ss >> range_m . end;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid clear range format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_TYPE) )
+ {
+ ss . str (msg . getField (F_TYPE));
+ ss . get (type_m);
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_SOURCE) )
+ {
+ string str;
+
+ ss . str (msg . getField (F_SOURCE));
+ ss >> source_m . first;
+ ss . ignore( );
+ ss >> str;
+ if ( !ss || str . length( ) != NCODE_SIZE )
+ AMOS_THROW_ARGUMENT ("Invalid source format");
+ ss . clear( );
+ source_m . second = Encode (str);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Feature_t::readRecord (istream & fix, istream & var)
+{
+ Universal_t::readRecord (fix, var);
+
+ readLE (fix, &(range_m . begin));
+ readLE (fix, &(range_m . end));
+ readLE (fix, &(source_m . first));
+ readLE (fix, &(source_m . second));
+ fix . get (type_m);
+}
+
+
+//----------------------------------------------------- readRecordFix ----------
+void Feature_t::readRecordFix (istream & fix)
+{
+ Universal_t::readRecordFix (fix);
+
+ readLE (fix, &(range_m . begin));
+ readLE (fix, &(range_m . end));
+ readLE (fix, &(source_m . first));
+ readLE (fix, &(source_m . second));
+ fix . get (type_m);
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Feature_t::writeMessage (Message_t & msg) const
+{
+ Universal_t::writeMessage (msg);
+
+ try {
+ ostringstream ss;
+
+ msg . setMessageCode (Feature_t::NCODE);
+
+ if ( range_m . getLength( ) != 0 )
+ {
+ ss << range_m . begin << ',' << range_m . end;
+ msg . setField (F_CLEAR, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( type_m != NULL_FEATURE )
+ {
+ ss << type_m;
+ msg . setField (F_TYPE, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( source_m . first != NULL_ID || source_m . second != NULL_NCODE )
+ {
+ ss << source_m . first << ',' << Decode (source_m . second);
+ msg . setField (F_SOURCE, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Feature_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Universal_t::writeRecord (fix, var);
+
+ writeLE (fix, &(range_m . begin));
+ writeLE (fix, &(range_m . end));
+ writeLE (fix, &(source_m . first));
+ writeLE (fix, &(source_m . second));
+ fix . put (type_m);
+}
diff --git a/src/AMOS/Feature_AMOS.hh b/src/AMOS/Feature_AMOS.hh
new file mode 100644
index 0000000..5832eff
--- /dev/null
+++ b/src/AMOS/Feature_AMOS.hh
@@ -0,0 +1,208 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 04/19/2005
+//!
+//! \brief Header for Feature_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Feature_AMOS_HH
+#define __Feature_AMOS_HH 1
+
+#include "Universal_AMOS.hh"
+
+
+
+
+namespace AMOS {
+
+typedef char FeatureType_t;
+
+//====================================================== Feature_t =============
+//! \brief Notes remarkable features of other objects
+//!
+//! Allows a range from some other Universal object to be flagged as a feature.
+//! One example would be a location on a contig where a repeat is known to
+//! exist. Multiple repeat features with the same consensus could then be
+//! grouped together with the Group object to represent a repeat class,
+//!
+//==============================================================================
+class Feature_t : public Universal_t
+{
+
+private:
+
+ std::pair<ID_t, NCode_t> source_m; //!< source of the feature
+ Range_t range_m; //!< feature extent
+ FeatureType_t type_m; //!< feature type
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+ static const FeatureType_t NULL_FEATURE = 0;
+ static const FeatureType_t REPEAT = 'R';
+ static const FeatureType_t UNITIG = 'U';
+ static const FeatureType_t JOIN = 'J';
+ static const FeatureType_t ORF = 'O';
+ static const FeatureType_t FIX = 'F';
+
+ // forensics features
+ static const FeatureType_t COVERAGE = 'C';
+ static const FeatureType_t POLYMORPHISM = 'P';
+ static const FeatureType_t BREAKPOINT = 'B';
+ static const FeatureType_t KMER = 'K';
+ static const FeatureType_t MATEPAIR = 'M';
+ static const FeatureType_t MISASSEMBLY = 'A';
+
+
+ //--------------------------------------------------------- Feature_t --------
+ //! \brief Constructs an empty Feature_t object
+ //!
+ //! Sets all members to zero or NULL
+ //!
+ Feature_t ( )
+ {
+ source_m . first = NULL_ID;
+ source_m . second = NULL_NCODE;
+ type_m = NULL_FEATURE;
+ }
+
+
+ //--------------------------------------------------------- Feature_t --------
+ //! \brief Copy constructor
+ //!
+ Feature_t (const Feature_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------------- ~Feature_t -------
+ //! \brief Destroys a Feature_t object
+ //!
+ ~Feature_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ source_m . first = NULL_ID;
+ source_m . second = NULL_NCODE;
+ range_m . clear( );
+ type_m = NULL_FEATURE;
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Feature_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getRange ---------------
+ //! \brief Get the feature range
+ //!
+ //! \return The feature range
+ //!
+ Range_t getRange ( ) const
+ {
+ return range_m;
+ }
+
+
+ //--------------------------------------------------- getSource --------------
+ //! \brief Get the feature source IID and type
+ //!
+ //! This method only returns the IID of the object which this feature refers
+ //! to. The entire source object can be obtained by fetching the returned IID
+ //! from the specified bank type.
+ //!
+ //! \return The IID of the feature source and the NCode type indentifier
+ //!
+ std::pair<ID_t, NCode_t> getSource ( ) const
+ {
+ return source_m;
+ }
+
+
+ //--------------------------------------------------- getType ----------------
+ //! \brief Get the feature type
+ //!
+ //! \return The feature type
+ //!
+ FeatureType_t getType ( ) const
+ {
+ return type_m;
+ }
+
+
+ //--------------------------------------------------- setRange ---------------
+ //! \brief Set the feature range
+ //!
+ //! \param range The new feature range
+ //! \return void
+ //!
+ void setRange (Range_t range)
+ {
+ range_m = range;
+ }
+
+
+ //--------------------------------------------------- setSource --------------
+ //! \brief Set the feature source IID and type
+ //!
+ //! \param source The new IID and NCode type identifier of the feature source
+ //! \return void
+ //!
+ void setSource (std::pair<ID_t, NCode_t> source)
+ {
+ source_m = source;
+ }
+
+
+ //--------------------------------------------------- setType ----------------
+ //! \brief Set the feature type
+ //!
+ //! \param type The new feature type
+ //! \return void
+ //!
+ void setType (FeatureType_t type)
+ {
+ type_m = type;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Feature_AMOS_HH
diff --git a/src/AMOS/Fragment_AMOS.cc b/src/AMOS/Fragment_AMOS.cc
new file mode 100644
index 0000000..48e4f40
--- /dev/null
+++ b/src/AMOS/Fragment_AMOS.cc
@@ -0,0 +1,212 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 10/23/2003
+//!
+//! \brief Source for Fragment_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Fragment_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ Fragment_t ==================
+const NCode_t Fragment_t::NCODE = M_FRAGMENT;
+
+
+//----------------------------------------------------- clear ------------------
+void Fragment_t::clear ( )
+{
+ Universal_t::clear( );
+ size_m = 0;
+ library_m = source_m . first = reads_m . first = reads_m . second = NULL_ID;
+ source_m . second = NULL_NCODE;
+ type_m = NULL_FRAGMENT;
+}
+
+
+//----------------------------------------------------- readMessage-------------
+void Fragment_t::readMessage (const Message_t & msg)
+{
+ Universal_t::readMessage (msg);
+
+ try {
+ istringstream ss;
+
+ if ( msg . exists (F_LIBRARY) )
+ {
+ ss . str (msg . getField (F_LIBRARY));
+ ss >> library_m;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid library link format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_SIZE) )
+ {
+ ss . str (msg . getField (F_SIZE));
+ ss >> size_m;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid size format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_SOURCE) )
+ {
+ string str;
+
+ ss . str (msg . getField (F_SOURCE));
+ ss >> source_m . first;
+ ss . ignore ( );
+ ss >> str;
+ if ( !ss || str . length( ) != NCODE_SIZE )
+ AMOS_THROW_ARGUMENT ("Invalid source format");
+ ss . clear( );
+ source_m . second = Encode (str);
+ }
+
+ if ( msg . exists (F_READS) )
+ {
+ ss . str (msg . getField (F_READS));
+ ss >> reads_m . first;
+ ss . ignore( );
+ ss >> reads_m . second;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid nodes format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_TYPE) )
+ {
+ ss . str (msg . getField (F_TYPE));
+ setType (ss . get( ));
+ ss . clear( );
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Fragment_t::readRecord (istream & fix, istream & var)
+{
+ Universal_t::readRecord (fix, var);
+
+ readLE (fix, &library_m);
+ readLE (fix, &size_m);
+ readLE (fix, &(source_m . first));
+ readLE (fix, &(source_m . second));
+ readLE (fix, &(reads_m . first));
+ readLE (fix, &(reads_m . second));
+ type_m = fix . get( );
+}
+
+
+//----------------------------------------------------- readRecordFix ----------
+void Fragment_t::readRecordFix (istream & fix)
+{
+ Universal_t::readRecordFix (fix);
+
+ readLE (fix, &library_m);
+ readLE (fix, &size_m);
+ readLE (fix, &(source_m . first));
+ readLE (fix, &(source_m . second));
+ readLE (fix, &(reads_m . first));
+ readLE (fix, &(reads_m . second));
+ type_m = fix . get( );
+}
+
+
+//----------------------------------------------------- setType ----------------
+void Fragment_t::setType (FragmentType_t type)
+{
+ switch (type)
+ {
+ case NULL_FRAGMENT:
+ case OTHER:
+ case BAC:
+ case INSERT:
+ case TRANSPOSON:
+ case WALK:
+ type_m = type;
+ break;
+ default:
+ AMOS_THROW_ARGUMENT ((string)"Invalid fragment type " + type);
+ }
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Fragment_t::writeMessage (Message_t & msg) const
+{
+ Universal_t::writeMessage (msg);
+
+ try {
+ ostringstream ss;
+
+ msg . setMessageCode (Fragment_t::NCODE);
+
+ if ( library_m != NULL_ID )
+ {
+ ss << library_m;
+ msg . setField (F_LIBRARY, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( size_m != 0 )
+ {
+ ss << size_m;
+ msg . setField (F_SIZE, ss . str( ));
+ ss .str (NULL_STRING);
+ }
+
+ if ( source_m . first != NULL_ID || source_m . second != NULL_NCODE )
+ {
+ ss << source_m . first << ',' << Decode (source_m . second);
+ msg . setField (F_SOURCE, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( reads_m . first != NULL_ID || reads_m . second != NULL_ID )
+ {
+ ss << reads_m . first << ',' << reads_m . second;
+ msg . setField (F_READS, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( type_m != NULL_FRAGMENT )
+ {
+ ss << type_m;
+ msg . setField (F_TYPE, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Fragment_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Universal_t::writeRecord (fix, var);
+
+ writeLE (fix, &library_m);
+ writeLE (fix, &size_m);
+ writeLE (fix, &(source_m . first));
+ writeLE (fix, &(source_m . second));
+ writeLE (fix, &(reads_m . first));
+ writeLE (fix, &(reads_m . second));
+ fix . put (type_m);
+}
diff --git a/src/AMOS/Fragment_AMOS.hh b/src/AMOS/Fragment_AMOS.hh
new file mode 100644
index 0000000..12c7d7c
--- /dev/null
+++ b/src/AMOS/Fragment_AMOS.hh
@@ -0,0 +1,255 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/18/2003
+//!
+//! \brief Header for Fragment_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Fragment_AMOS_HH
+#define __Fragment_AMOS_HH 1
+
+#include "Universal_AMOS.hh"
+
+
+
+
+namespace AMOS {
+
+typedef char FragmentType_t;
+
+//================================================ Fragment_t ==================
+//! \brief Single piece of DNA
+//!
+//! A single piece of DNA from which a group of reads were sequenced. This
+//! allows for the hierarchical clustering of reads that come from the same
+//! fragment. Mate-pair information is also stored in this type.
+//!
+//==============================================================================
+class Fragment_t : public Universal_t
+{
+
+private:
+
+ ID_t library_m; //!< IID of the parent library
+ Size_t size_m; //!< size of the fragment, 0 if not known
+ std::pair<ID_t, NCode_t> source_m; //!< source of the fragment
+ std::pair<ID_t, ID_t> reads_m; //!< the pair of mated read IIDs
+ FragmentType_t type_m; //!< type of fragment
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+ static const FragmentType_t NULL_FRAGMENT = 0;
+ static const FragmentType_t OTHER = 'X';
+ static const FragmentType_t BAC = 'B';
+ static const FragmentType_t INSERT = 'I';
+ static const FragmentType_t TRANSPOSON = 'T';
+ static const FragmentType_t WALK = 'W';
+
+
+ //--------------------------------------------------- Fragment_t -------------
+ //! \brief Contstructs an empty Fragment_t object
+ //!
+ //! Sets all members to NULL
+ //!
+ Fragment_t ( )
+ {
+ size_m = 0;
+ library_m = source_m . first = reads_m . first = reads_m . second = NULL_ID;
+ source_m . second = NULL_NCODE;
+ type_m = NULL_FRAGMENT;
+ }
+
+
+ //--------------------------------------------------- Fragment_t -------------
+ //! \brief Copy constructor
+ //!
+ Fragment_t (const Fragment_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~Fragment_t ------------
+ //! \brief Destroys a Fragment_t object
+ //!
+ ~Fragment_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( );
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Fragment_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getLibrary -------------
+ //! \brief Get the parent library IID
+ //!
+ //! \return The IID of the parent library
+ //!
+ ID_t getLibrary ( ) const
+ {
+ return library_m;
+ }
+
+
+ //--------------------------------------------------- getMatePair ------------
+ //! \brief Get the paired sequencing reads for this fragment
+ //!
+ //! Orientation of the pair can be deduced from the fragment type. An INSERT
+ //! fragment will have innie mates and a TRANSPOSON fragment will have outie
+ //! mates.
+ //!
+ //! \return The mated reads
+ //!
+ std::pair<ID_t, ID_t> getMatePair ( ) const
+ {
+ return reads_m;
+ }
+
+
+ //--------------------------------------------------- getSize ----------------
+ //! \brief Get the size of the fragment, if known
+ //!
+ //! Size will be 0 if unknown. If exact size is unknown, the parent library
+ //! of this fragment should contain an estimated size distribution.
+ //!
+ //! \return The size of the fragment
+ //!
+ Size_t getSize ( ) const
+ {
+ return size_m;
+ }
+
+
+ //--------------------------------------------------- getSource --------------
+ //! \brief Get the fragment source IID and type
+ //!
+ //! Returns the source this fragment was generated from, e.g. the insert
+ //! fragment used for a PCR walk.
+ //!
+ //! \return The IID of the fragment source and the NCode type identifier
+ //!
+ std::pair<ID_t, NCode_t> getSource ( ) const
+ {
+ return source_m;
+ }
+
+
+ //--------------------------------------------------- getType ----------------
+ //! \brief Get the fragment type
+ //!
+ //! \return The type of fragment
+ //!
+ FragmentType_t getType ( ) const
+ {
+ return type_m;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- setLibrary -------------
+ //! \brief Set the parent library IID
+ //!
+ //! \param library The new IID of parent library
+ //! \return void
+ //!
+ void setLibrary (ID_t library)
+ {
+ library_m = library;
+ }
+
+
+ //--------------------------------------------------- setMatePair ------------
+ //! \brief Set the paired sequencing reads for this fragment
+ //!
+ //! Orientation of the pair can be stored in the fragment type. An INSERT
+ //! fragment will have innie mates and a TRANSPOSON fragment will have outie
+ //! mates.
+ //!
+ //! \param reads The new pair of read IIDs
+ //! \return void
+ //!
+ void setReads (std::pair<ID_t, ID_t> reads)
+ {
+ reads_m = reads;
+ }
+
+
+ //--------------------------------------------------- setSize ----------------
+ //! \brief Set the size of the fragment, if known
+ //!
+ //! \param size The size of the fragment
+ //! \return void
+ //!
+ void setSize (Size_t size)
+ {
+ size_m = size;
+ }
+
+
+ //--------------------------------------------------- setSource --------------
+ //! \brief Set the link source IID and type
+ //!
+ //! Sets the source this fragment was generated from, e.g. the insert
+ //! fragment used for a PCR walk.
+ //!
+ //! \param source The IID and NCode type of the fragment source
+ //! \return void
+ //!
+ void setSource (std::pair<ID_t, NCode_t> source)
+ {
+ source_m = source;
+ }
+
+
+ //--------------------------------------------------- setType ----------------
+ //! \brief Set the fragment type
+ //!
+ //! \param type The new fragment type
+ //! \pre type is one of [OITB] or NULL
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void setType (FragmentType_t type);
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Fragment_AMOS_HH
diff --git a/src/AMOS/Group_AMOS.cc b/src/AMOS/Group_AMOS.cc
new file mode 100644
index 0000000..52ab3b7
--- /dev/null
+++ b/src/AMOS/Group_AMOS.cc
@@ -0,0 +1,147 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 04/11/2005
+//!
+//! \brief Source for Group_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Group_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ Group_t =====================
+const NCode_t Group_t::NCODE = M_GROUP;
+
+
+//----------------------------------------------------- readMessage ------------
+void Group_t::readMessage (const Message_t & msg)
+{
+ Universal_t::readMessage (msg);
+
+ try {
+
+ istringstream ss;
+
+ if ( msg . exists (F_MEMBER) )
+ {
+ ID_t iid;
+
+ ss . str (msg . getField (F_MEMBER));
+
+ while ( ss )
+ {
+ ss >> iid;
+ if ( ! ss . fail( ) )
+ mems_m . push_back (iid);
+ }
+
+ if ( ! ss . eof( ) )
+ AMOS_THROW_ARGUMENT ("Invalid member list format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_OBJECT) )
+ {
+ string str;
+
+ ss . str (msg . getField (F_OBJECT));
+ ss >> str;
+ if ( !ss || str . length( ) != NCODE_SIZE )
+ AMOS_THROW_ARGUMENT ("Invalid object type format");
+ ss . clear( );
+ memtype_m = Encode (str);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Group_t::readRecord (istream & fix, istream & var)
+{
+ Universal_t::readRecord (fix, var);
+
+ Size_t size;
+ readLE (fix, &size);
+ readLE (fix, &memtype_m);
+
+ mems_m . resize (size, NULL_ID);
+ for ( Pos_t i = 0; i < size; i ++ )
+ readLE (var, &(mems_m [i]));
+}
+
+
+
+//----------------------------------------------------- readRecordFix ----------
+void Group_t::readRecordFix (istream & fix)
+{
+ Universal_t::readRecordFix (fix);
+
+ Size_t size;
+ readLE (fix, &size);
+ readLE (fix, &memtype_m);
+
+ mems_m . clear();
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Group_t::writeMessage (Message_t & msg) const
+{
+ Universal_t::writeMessage (msg);
+
+ try {
+ ostringstream ss;
+
+ msg . setMessageCode (Group_t::NCODE);
+
+ if ( !mems_m . empty( ) )
+ {
+ string s;
+ vector<ID_t>::const_iterator vi;
+
+ for ( vi = mems_m . begin( ); vi != mems_m . end( ); vi ++ )
+ {
+ ss << *vi << endl;
+ s . append (ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ msg . setField (F_MEMBER, s);
+ }
+
+ if ( memtype_m != NULL_NCODE )
+ {
+ msg . setField (F_OBJECT, Decode (memtype_m));
+ ss . str (NULL_STRING);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Group_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Universal_t::writeRecord (fix, var);
+
+ Size_t size = mems_m . size( );
+ writeLE (fix, &size);
+ writeLE (fix, &memtype_m);
+
+ for ( Pos_t i = 0; i < size; i ++ )
+ writeLE (var, &(mems_m [i]));
+}
diff --git a/src/AMOS/Group_AMOS.hh b/src/AMOS/Group_AMOS.hh
new file mode 100644
index 0000000..30473eb
--- /dev/null
+++ b/src/AMOS/Group_AMOS.hh
@@ -0,0 +1,169 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 04/11/2005
+//!
+//! \brief Header for Group_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Group_AMOS_HH
+#define __Group_AMOS_HH 1
+
+#include "Universal_AMOS.hh"
+#include <vector>
+
+
+
+
+namespace AMOS {
+
+//================================================ Group_t =====================
+//! \brief A homogenous grouping of AMOS objects
+//!
+//! A group of AMOS objects which are all of the same type.
+//!
+//==============================================================================
+class Group_t : public Universal_t
+{
+
+private:
+
+ std::vector<ID_t> mems_m; //!< IIDs of the grouped objects
+ NCode_t memtype_m; //!< object type stored in the group
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //-------------------------------------------------------- Group_t -----------
+ //! \brief Constructs an empty Group_t object
+ //!
+ //! Sets all members to zero or NULL
+ //!
+ Group_t ( )
+ {
+ memtype_m = NULL_NCODE;
+ }
+
+
+ //-------------------------------------------------------- Group_t -----------
+ //! \brief Copy constructor
+ //!
+ Group_t (const Group_t & source)
+ {
+ *this = source;
+ }
+
+
+ //-------------------------------------------------------- ~Group_t ----------
+ //! \brief Destroys a Group_t object
+ //!
+ ~Group_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ Universal_t::clear( );
+ mems_m . clear( );
+ memtype_m = NULL_NCODE;
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Group_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getMembers -------------
+ //! \brief Get the vector of group members
+ //!
+ //! \return The vector of grouped object IIDs
+ //!
+ const std::vector<ID_t> & getMembers ( ) const
+ {
+ return mems_m;
+ }
+
+
+ //--------------------------------------------------- getMembers -------------
+ std::vector<ID_t> & getMembers ( )
+ {
+ return mems_m;
+ }
+
+
+ //--------------------------------------------------- getMemberType ----------
+ //! \brief Get the type of grouped object
+ //!
+ //! Describes the type of IIDs stored in the group vector.
+ //!
+ //! \return The type of grouped objects
+ //!
+ NCode_t getMemberType( ) const
+ {
+ return memtype_m;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- setMembers -------------
+ //! \brief Set the vector of group members
+ //!
+ //! \param mems The new vector of group members
+ //! \return void
+ //!
+ void setMembers (const std::vector<ID_t> & mems)
+ {
+ mems_m = mems;
+ }
+
+
+ //--------------------------------------------------- setMemberType ----------
+ //! \brief Set the type of grouped objects
+ //!
+ //! Describes the type of IIDs stored in the group vector.
+ //!
+ //! \param memtype The new object type
+ //! \return void
+ //!
+ void setMemberType (NCode_t memtype)
+ {
+ memtype_m = memtype;
+ }
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Group_AMOS_HH
diff --git a/src/AMOS/IDMap_AMOS.cc b/src/AMOS/IDMap_AMOS.cc
new file mode 100644
index 0000000..0e3df92
--- /dev/null
+++ b/src/AMOS/IDMap_AMOS.cc
@@ -0,0 +1,669 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 10/23/2003
+//!
+//! \brief Source for IDMap_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "IDMap_AMOS.hh"
+#include <cstdio>
+#include <string>
+#include <sstream>
+#include <cstring>
+using namespace AMOS;
+using namespace std;
+
+const int MAX_EID_LENGTH = 2048; //! Maximum length for an EID
+
+
+
+//================================================ HashTriple_t ================
+//----------------------------------------------------- operator= --------------
+IDMap_t::HashTriple_t & IDMap_t::HashTriple_t::operator=
+(const HashTriple_t & s)
+{
+ if ( this != &s )
+ {
+ c = s.c;
+ iid = s.iid;
+ bid = s.bid;
+ eid = s.eid;
+ }
+ return *this;
+}
+
+
+
+
+//================================================ HashNode_t ==================
+//----------------------------------------------------- clear ------------------
+void IDMap_t::HashNode_t::clear ( )
+{
+ if ( triple != NULL )
+ if ( -- (triple -> c) == 0 )
+ delete triple;
+ delete next;
+
+ triple = NULL;
+ next = NULL;
+}
+
+
+
+
+//================================================ IDMap_t =====================
+const NCode_t IDMap_t::NCODE = M_IDMAP;
+const Size_t IDMap_t::DEFAULT_NUM_BUCKETS = 1000;
+
+
+//----------------------------------------------------- clear ------------------
+void IDMap_t::clear ( )
+{
+ if ( size_m > 0 )
+ {
+ vector<HashNode_t>::iterator hni;
+ for ( hni = iid_bucs_m . begin( ); hni != iid_bucs_m . end( ); hni ++ )
+ hni -> clearchain( );
+ for ( hni = eid_bucs_m . begin( ); hni != eid_bucs_m . end( ); hni ++ )
+ hni -> clearchain( );
+ size_m = 0;
+ }
+ type_m = NULL_NCODE;
+}
+
+
+//----------------------------------------------------- minbuckets -------------
+Size_t IDMap_t::minbuckets (Size_t min)
+{
+ //-- Bucket size constants
+ const uint8_t NUM_BUCKET_SIZES = 27;
+ const Size_t BUCKET_SIZES [NUM_BUCKET_SIZES] =
+ {
+ 53l, 97l, 193l, 389l, 769l,
+ 1543l, 3079l, 6151l, 12289l, 24593l,
+ 49157l, 98317l, 196613l, 393241l, 786433l,
+ 1572869l, 3145739l, 6291469l, 12582917l, 25165843l,
+ 50331653l, 100663319l, 201326611l, 402653189l, 805306457l,
+ 1610612741l, 2147354947l
+ };
+
+ uint8_t first = 0;
+ uint8_t len = NUM_BUCKET_SIZES;
+ uint8_t half, middle;
+
+ //-- Binary search for a bucket size greater than hint
+ while ( len > 0 )
+ {
+ half = len >> 1;
+ middle = first + half;
+ if ( BUCKET_SIZES [middle] < min )
+ {
+ first = middle + 1;
+ len = len - half - 1;
+ }
+ else
+ len = half;
+ }
+ if ( first == NUM_BUCKET_SIZES )
+ first --;
+
+ return BUCKET_SIZES [first];
+}
+
+
+//----------------------------------------------------- lookupnode -------------
+bool IDMap_t::lookupnode (ID_t key, HashNode_t * & node) const
+{
+ if ( key == NULL_ID )
+ {
+ node = NULL;
+ return false;
+ }
+ for ( node = hashfunc (key); node -> next != NULL; node = node -> next )
+ if ( node -> triple -> iid == key )
+ return true;
+ if ( node -> triple == NULL || node -> triple -> iid != key )
+ return false;
+ else
+ return true;
+}
+
+
+//----------------------------------------------------- lookupnode -------------
+bool IDMap_t::lookupnode (const string & key, HashNode_t * & node) const
+{
+ if ( key . empty( ) )
+ {
+ node = NULL;
+ return false;
+ }
+ for ( node = hashfunc (key); node -> next != NULL; node = node -> next )
+ if ( node -> triple -> eid == key )
+ return true;
+ if ( node -> triple == NULL || node -> triple -> eid != key )
+ return false;
+ else
+ return true;
+}
+
+
+//----------------------------------------------------- removenode -------------
+void IDMap_t::removenode (HashNode_t * curr, HashNode_t * prev)
+{
+ if ( prev == NULL )
+ //-- If a root node
+ {
+ if ( curr -> next == NULL )
+ curr -> clear( ); // free curr's triple
+ else
+ {
+ prev = curr -> next; // this will be the new root
+ curr -> next = NULL; // as to not delete next on clear
+ curr -> clear( ); // free curr's triple
+ *curr = *prev; // overwrite root node
+ delete prev; // free duplicate node
+ }
+ }
+ else
+ //-- If not a root node
+ {
+ prev -> next = curr -> next; // bypass curr
+ curr -> next = NULL; // as to not delete next on clear
+ curr -> clear( ); // free curr's triple
+ delete curr; // free removed node
+ }
+}
+
+
+//----------------------------------------------------- concat -----------------
+void IDMap_t::concat (const IDMap_t & s)
+{
+ if ( this != &s )
+ {
+ resize (getSize( ) + s . getSize( ));
+
+ //-- Copy all the triples
+ for ( const_iterator itr = s . begin( ); itr != s . end( ); ++ itr )
+ insert (itr -> iid, itr -> eid, itr -> bid);
+ }
+}
+
+
+//----------------------------------------------------- insert -----------------
+const IDMap_t::HashTriple_t * IDMap_t::insert (ID_t iid,
+ const string & eid,
+ ID_t bid)
+{
+ if ( iid == NULL_ID && eid . empty( ) ) return NULL;
+
+ HashNode_t * curri, * curre;
+
+ //cerr << "insert bid: " << bid << "\tiid:" << iid << "\teid: \"" << eid << "\"" << endl;
+
+ if ( lookupnode (iid, curri) )
+ {
+ ostringstream ss;
+ ss << "Cannot insert int key '" << iid << "' multiple times";
+ AMOS_THROW_ARGUMENT (ss . str( ));
+ }
+ if ( lookupnode (eid, curre) )
+ {
+ ostringstream ss;
+ ss << "Cannot insert string key '" << eid << "' multiple times";
+ AMOS_THROW_ARGUMENT (ss . str( ));
+ }
+
+ HashTriple_t * currt = new HashTriple_t (iid, eid, bid);
+
+ if ( curri != NULL )
+ {
+ if ( curri -> triple != NULL )
+ curri = curri -> next = new HashNode_t( );
+ curri -> triple = currt;
+ currt -> c ++;
+ }
+ if ( curre != NULL )
+ {
+ if ( curre -> triple != NULL )
+ curre = curre -> next = new HashNode_t( );
+ curre -> triple = currt;
+ currt -> c ++;
+ }
+
+ if ( ++ size_m >= getBuckets( ) )
+ resize (size_m + 1);
+
+ return currt;
+}
+
+
+//----------------------------------------------------- readMessage ------------
+void IDMap_t::readMessage (const Message_t & msg)
+{
+ clear( );
+
+ try {
+ Size_t size = -1;
+ istringstream ss;
+
+ if ( msg . exists (F_OBJECT) )
+ {
+ string str = msg . getField (F_OBJECT);
+
+ if ( str . length( ) != NCODE_SIZE )
+ AMOS_THROW_ARGUMENT ("Invalid object type format");
+ type_m = Encode (str);
+ }
+
+ if ( msg . exists (F_SIZE) )
+ {
+ ss . str (msg . getField (F_SIZE));
+ ss >> size;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid size format");
+ ss . clear( );
+
+ resize (size);
+ }
+
+ if ( msg . exists (F_MAP) )
+ {
+ string eid;
+ ID_t bid, iid;
+ ss . str (msg . getField (F_MAP));
+
+ while ( ss )
+ {
+ ss >> bid >> iid;
+ ss . ignore( );
+ getline (ss, eid);
+ if ( ! ss . fail( ) )
+ insert (iid, eid, bid);
+ }
+
+ if ( ! ss . eof( ) )
+ AMOS_THROW_ARGUMENT ("Invalid map format");
+ ss . clear( );
+
+ if ( size >= 0 && size != size_m )
+ AMOS_THROW_ARGUMENT ("map and size fields do not agree");
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- remove -----------------
+void IDMap_t::remove (ID_t key)
+{
+ if ( key == NULL_ID ) return;
+ string eid;
+
+ HashNode_t * prev = NULL;
+ HashNode_t * curr = hashfunc (key);
+ if ( curr -> triple != NULL )
+ for ( ; curr != NULL; curr = curr -> next )
+ {
+ if ( curr -> triple -> iid == key )
+ {
+ size_m --;
+ if ( curr -> triple -> c > 1 )
+ eid = curr -> triple -> eid;
+ removenode (curr, prev);
+ break;
+ }
+ prev = curr;
+ }
+
+ if ( eid . empty( ) )
+ return;
+
+ prev = NULL;
+ curr = hashfunc (eid);
+ if ( curr -> triple != NULL )
+ for ( ; curr != NULL; curr = curr -> next )
+ {
+ if ( curr -> triple -> eid == eid )
+ {
+ removenode (curr, prev);
+ break;
+ }
+ prev = curr;
+ }
+}
+
+
+//----------------------------------------------------- remove -----------------
+void IDMap_t::remove (const string & key)
+{
+ if ( key . empty( ) ) return;
+ ID_t iid = NULL_ID;
+
+ HashNode_t * prev = NULL;
+ HashNode_t * curr = hashfunc (key);
+ if ( curr -> triple != NULL )
+ for ( ; curr != NULL; curr = curr -> next )
+ {
+ if ( curr -> triple -> eid == key )
+ {
+ size_m --;
+ if ( curr -> triple -> c > 1 )
+ iid = curr -> triple -> iid;
+ removenode (curr, prev);
+ break;
+ }
+ prev = curr;
+ }
+
+ if ( iid == NULL_ID )
+ return;
+
+ prev = NULL;
+ curr = hashfunc (iid);
+ if ( curr -> triple != NULL )
+ for ( ; curr != NULL; curr = curr -> next )
+ {
+ if ( curr -> triple -> iid == iid )
+ {
+ removenode (curr, prev);
+ break;
+ }
+ prev = curr;
+ }
+}
+
+
+//----------------------------------------------------- resize -----------------
+void IDMap_t::resize (Size_t min)
+{
+ if ( (min = minbuckets (min)) == getBuckets( ) )
+ return;
+
+ vector<HashTriple_t *> triples (size_m);
+ long int pos = 0;
+
+ if ( size_m > 0 )
+ {
+ //-- Collect all the triples
+ for ( iterator itr = begin( ); itr != end ( ); ++ itr )
+ {
+ itr -> c ++;
+ triples [pos ++] = itr;
+ }
+
+ Size_t size = size_m;
+ NCode_t type = type_m;
+ clear( );
+ size_m = size;
+ type_m = type;
+ }
+
+ //-- Resize the bucket vectors
+ if ( size_m != pos )
+ AMOS_THROW ("Unknown fatal error during hash resize");
+ iid_bucs_m . resize (min);
+ eid_bucs_m . resize (min);
+
+ //-- Put the triples back in the map via modified insert
+ HashNode_t * curri, * curre;
+ vector<HashTriple_t *>::iterator tpi;
+ for ( tpi = triples . begin( ); tpi != triples . end( ); tpi ++ )
+ {
+ lookupnode ((*tpi) -> iid, curri);
+ lookupnode ((*tpi) -> eid, curre);
+
+ if ( curri != NULL )
+ {
+ if ( curri -> triple != NULL )
+ curri = curri -> next = new HashNode_t( );
+ curri -> triple = (*tpi);
+ curri -> triple -> c ++;
+ }
+ if ( curre != NULL )
+ {
+ if ( curre -> triple != NULL )
+ curre = curre -> next = new HashNode_t( );
+ curre -> triple = (*tpi);
+ curre -> triple -> c ++;
+ }
+
+ (*tpi) -> c --;
+ }
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void IDMap_t::writeMessage (Message_t & msg) const
+{
+ msg . clear( );
+
+ try {
+ ostringstream ss;
+
+ msg . setMessageCode (IDMap_t::NCODE);
+
+ if ( type_m != NULL_NCODE )
+ msg . setField (F_OBJECT, Decode (type_m));
+
+ ss << size_m;
+ msg . setField (F_SIZE, ss . str( ));
+ ss . str (NULL_STRING);
+
+ if (size_m != 0 )
+ {
+ //-- Output all the triples
+ string str;
+ for ( const_iterator itr = begin( ); itr != end( ); ++ itr )
+ {
+ ss << itr -> bid << '\t' << itr -> iid << '\t';
+ str . append (ss . str( ));
+ ss . str (NULL_STRING);
+ str . append (itr -> eid);
+ str . push_back (NL_CHAR);
+ }
+
+ msg . setField (F_MAP, str);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- operator= --------------
+IDMap_t & IDMap_t::operator= (const IDMap_t & s)
+{
+ if ( this != &s )
+ {
+ clear( );
+ type_m = s . type_m;
+ concat (s);
+ }
+
+ return *this;
+}
+
+
+//----------------------------------------------------- read -------------------
+void IDMap_t::read(const std::string & path)
+{
+ Size_t size;
+ ID_t bid, iid;
+ char buffer [MAX_EID_LENGTH+1];
+
+ clear( );
+
+ FILE * fp = fopen(path.c_str(), "r");
+
+ if (!fp)
+ { AMOS_THROW_IO("Could not open bank partition, " + path); }
+
+ if (fscanf(fp, "%s %d", buffer, &size) != 2)
+ { AMOS_THROW_IO("Invalid Header, Map file is corrupted for " + path); }
+
+ type_m = Encode (buffer);
+ resize (size);
+
+ while (fscanf(fp, "%d\t%d", &bid, &iid) == 2)
+ {
+ int c = getc(fp);
+ if (c != '\t')
+ { AMOS_THROW_IO("Map file is corrupted for " + path); }
+
+ // Go to <= MAX_EID_LENGTH so that we know when at least 1 char is chopped
+ int i;
+ bool done = false;
+ for (i = 0; i <= MAX_EID_LENGTH; i++)
+ {
+ c = getc(fp);
+ buffer[i] = c;
+
+ if (c == '\n' || c == EOF)
+ {
+ buffer[i] = '\0';
+ done = true; break;
+ }
+ }
+
+ if (!done)
+ {
+ buffer[MAX_EID_LENGTH] = '\0';
+ int chop = 0; // This immediately goes to 1
+ while (!(c == '\n' || c == EOF))
+ {
+ chop++;
+ c = getc(fp);
+ }
+
+ cerr << "WARNING: Truncated EID for IID " << iid << " to " << MAX_EID_LENGTH << " characters (chopped last " << chop <<")" << endl;
+ }
+
+ insert (iid, buffer, bid);
+ }
+
+ if (size_m != size)
+ {
+ AMOS_THROW_IO ("Bank Corrupted: Number of named elements doesn't match map header in " + path);
+ }
+
+ fclose(fp);
+}
+
+
+//----------------------------------------------------- write ------------------
+void IDMap_t::write (ostream & out) const
+{
+ out << Decode(type_m) << ' ' << size_m << NL_CHAR;
+
+ for ( const_iterator itr = begin( ); itr != end( ); ++ itr )
+ out << itr -> bid << '\t' << itr -> iid << '\t' << itr -> eid << NL_CHAR;
+}
+
+
+
+
+
+//================================================ iterator ====================
+//------------------------------------------------ iterator --------------------
+IDMap_t::iterator::iterator (vector<HashNode_t> * iid_bucs_p,
+ vector<HashNode_t> * eid_bucs_p)
+ : iid_bucs (iid_bucs_p), eid_bucs (eid_bucs_p)
+{
+ if ( iid_bucs -> empty( ) )
+ curr = NULL;
+ else
+ {
+ iids = true;
+ buc = iid_bucs -> begin( );
+ curr = &(*buc);
+ if ( curr -> triple == NULL )
+ this->operator++();
+ }
+}
+
+
+//------------------------------------------------ operator++ ------------------
+IDMap_t::iterator & IDMap_t::iterator::operator++ ( )
+{
+ while ( curr != NULL )
+ {
+ curr = curr -> next;
+ while ( curr == NULL )
+ {
+ ++ buc;
+
+ if ( iids && buc >= iid_bucs -> end( ) )
+ {
+ iids = false;
+ buc = eid_bucs -> begin( );
+ }
+
+ if ( !iids && buc >= eid_bucs -> end( ) )
+ return *this;
+
+ if ( buc -> triple != NULL )
+ curr = &(*buc);
+ }
+
+ if ( iids || curr -> triple -> c == 1 )
+ break;
+ }
+ return *this;
+}
+
+
+//------------------------------------------------ const_iterator --------------
+IDMap_t::const_iterator::const_iterator (const vector<HashNode_t> * iid_bucs_p,
+ const vector<HashNode_t> * eid_bucs_p)
+ : iid_bucs (iid_bucs_p), eid_bucs (eid_bucs_p)
+{
+ if ( iid_bucs -> empty( ) )
+ curr = NULL;
+ else
+ {
+ iids = true;
+ buc = iid_bucs -> begin( );
+ curr = &(*buc);
+ if ( curr -> triple == NULL )
+ this->operator++();
+ }
+}
+
+
+//------------------------------------------------ operator++ ------------------
+IDMap_t::const_iterator & IDMap_t::const_iterator::operator++ ( )
+{
+ while ( curr != NULL )
+ {
+ curr = curr -> next;
+ while ( curr == NULL )
+ {
+ ++ buc;
+
+ if ( iids && buc >= iid_bucs -> end( ) )
+ {
+ iids = false;
+ buc = eid_bucs -> begin( );
+ }
+
+ if ( !iids && buc >= eid_bucs -> end( ) )
+ return *this;
+
+ if ( buc -> triple != NULL )
+ curr = &(*buc);
+ }
+
+ if ( iids || curr -> triple -> c == 1 )
+ break;
+ }
+ return *this;
+}
diff --git a/src/AMOS/IDMap_AMOS.hh b/src/AMOS/IDMap_AMOS.hh
new file mode 100644
index 0000000..f4aa04f
--- /dev/null
+++ b/src/AMOS/IDMap_AMOS.hh
@@ -0,0 +1,717 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/18/2003
+//!
+//! \brief Header for IDMap_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __IDMap_AMOS_HH
+#define __IDMap_AMOS_HH 1
+
+#include "Message_AMOS.hh"
+#include <string>
+#include <vector>
+
+
+
+
+namespace AMOS {
+
+//================================================ IDMap_t =====================
+//! \brief An IID/EID double hash for mapping IIDs and EIDs to BIDs
+//!
+//! A double hash of IIDs and EIDs to each other and BIDs. Users may lookup an
+//! EID or BID via an IID, or may lookup an IID or BID via an EID.
+//!
+//! A quick review of the identifier nomenclature: BID is a bank index, EID is
+//! an external ID, and IID is an internal AMOS ID. BIDs are physical bank
+//! indices; useful only for debugging purposes. IIDs are interger IDs used by
+//! AMOS for object links and identification, e.g. retrieving an object from a
+//! bank. EIDs are string indentifiers of unlimited length, e.g. sequence names.
+//! The empty string is used as an equivalent for NULL EID.
+//!
+//==============================================================================
+class IDMap_t : public IMessagable_t
+{
+
+public:
+
+ //============================================== HashTriple_t ================
+ //! \brief HashTriple for IDMap
+ //!
+ //! Contains the BID/EID/IID value triple. Also contains a reference counter
+ //! which displays the number of hash keys that point to this value triple.
+ //!
+ //============================================================================
+ struct HashTriple_t
+ {
+ uint8_t c; //!< reference counter
+ ID_t iid; //!< internal AMOS ID
+ ID_t bid; //!< bank index
+ std::string eid; //!< external ID
+
+ //------------------------------------------------- HashTriple_t -----------
+ //! \brief Constructs a HashTriple
+ //!
+ HashTriple_t (ID_t iid_p, const std::string & eid_p, ID_t bid_p)
+ : c (0), iid (iid_p), eid (eid_p), bid (bid_p)
+ { }
+
+ //------------------------------------------------- ~HashTriple_t ----------
+ //! \brief Destroys a HashTriple
+ //!
+ ~HashTriple_t ( )
+ { }
+
+ //------------------------------------------------- operator= --------------
+ //! \brief Deep copy of the HashTriple
+ //!
+ HashTriple_t & operator= (const HashTriple_t & s);
+
+ };
+
+
+private:
+
+ static const Size_t DEFAULT_NUM_BUCKETS; //!< default min buckets
+
+ //============================================== HashNode_t ==================
+ //! \brief HashNode for IDMap
+ //!
+ //! Contains a HashNode pointer and a HashTriple pointer. If next is not NULL
+ //! then a collision has occured and next is the pointer to the collision
+ //! chain.
+ //!
+ //============================================================================
+ struct HashNode_t
+ {
+ HashNode_t * next; //!< collision chain
+ HashTriple_t * triple; //!< hash triple
+
+ //------------------------------------------------- HashNode_t -------------
+ //! \brief Constructs an empty HashNode
+ //!
+ HashNode_t ( )
+ : next (NULL), triple (NULL)
+ { }
+
+
+ //------------------------------------------------- ~HashNode_t ------------
+ //! \brief Destroys a HashNode
+ //!
+ ~HashNode_t ( )
+ { }
+
+
+ //------------------------------------------------- clear ------------------
+ //! \brief Clears the node
+ //!
+ //! Deletes its triple if reference count falls to zero and deletes the
+ //! next pointer. Resets both pointers to NULL.
+ //!
+ void clear ( );
+
+
+ //------------------------------------------------- clearchain -------------
+ //! \brief Clears the node and recursively deletes its chain
+ //!
+ //! Will also delete the triples the chain nodes refer to if a triple's
+ //! reference counter falls to zero.
+ //!
+ void clearchain ( )
+ {
+ if ( next != NULL )
+ next -> clearchain( );
+ clear( );
+ }
+ };
+
+
+ //============================================== iterator ====================
+ //! \brief iterator for moving through the map
+ //!
+ //============================================================================
+ class iterator
+ {
+ private:
+ std::vector<HashNode_t> * iid_bucs;
+ std::vector<HashNode_t> * eid_bucs;
+ std::vector<HashNode_t>::iterator buc;
+ HashNode_t * curr;
+ bool iids;
+
+ public:
+ iterator ( )
+ { curr = NULL; }
+ iterator (std::vector<HashNode_t> * iid_bucs_p,
+ std::vector<HashNode_t> * eid_bucs_p);
+ HashTriple_t & operator*() const
+ { return *(curr -> triple); }
+ operator HashTriple_t * () const
+ { return (curr == NULL ? NULL : curr -> triple); }
+ HashTriple_t * operator->() const
+ { return (curr == NULL ? NULL : curr -> triple); }
+ iterator & operator++();
+ iterator operator++(int)
+ {
+ iterator tmp = *this;
+ this->operator++();
+ return tmp;
+ }
+ };
+
+
+ //--------------------------------------------------- begin ------------------
+ iterator begin ( )
+ {
+ return iterator (&iid_bucs_m, &eid_bucs_m);
+ }
+
+
+ //--------------------------------------------------- end --------------------
+ iterator end ( )
+ {
+ return iterator ( );
+ }
+
+
+ //--------------------------------------------------- minbuckets -------------
+ //! \brief Get the minimum number of buckets to satisfy need
+ //!
+ Size_t minbuckets (Size_t min);
+
+
+ //--------------------------------------------------- hashfunc ---------------
+ //! \brief Hash function for IIDs
+ //!
+ //! \param key The IID key
+ //! \return The appropriate bucket
+ //!
+ HashNode_t * hashfunc (ID_t key) const
+ {
+ return &((HashNode_t &)(iid_bucs_m [key % getBuckets( )]));
+ }
+
+
+ //--------------------------------------------------- hashfunc ---------------
+ //! \brief Hash function for EIDs
+ //!
+ //! \param key The EID key
+ //! \return The appropriate bucket
+ //!
+ HashNode_t * hashfunc (const std::string & key) const
+ {
+ int c;
+ unsigned long h = 5381;
+ std::string::const_iterator i;
+ std::string::const_iterator end = key . end( );
+
+ for ( i = key . begin( ); i != end; i ++ )
+ h = ((h << 5) + h) ^ (*i);
+
+ return &((HashNode_t &)(eid_bucs_m [h % getBuckets( )]));
+ }
+
+
+ //--------------------------------------------------- lookupnode -------------
+ //! \brief Lookup a hashnode in the hash table
+ //!
+ //! If key is NULL_ID, false will be returned and node will be set to NULL.
+ //!
+ //! \param key The key to look for in the hash table
+ //! \param node Pointer to adjust
+ //! \post Will adjust node to point to the end or right pos of the chain
+ //! \return true if found, else false
+ //!
+ bool lookupnode (ID_t key, HashNode_t * & node) const;
+
+
+ //--------------------------------------------------- lookupnode -------------
+ //! \brief Lookup a hashnode in the hash table
+ //!
+ //! If key is NULL, false will be returned and node will be set to NULL.
+ //!
+ //! \param key The key to look for in the hash table
+ //! \param node Pointer to adjust
+ //! \post Will adjust node to point to the end or right pos of the chain
+ //! \return true if found, else false
+ //!
+ bool lookupnode (const std::string & key, HashNode_t * & node) const;
+
+
+ //--------------------------------------------------- removenode -------------
+ //! \brief Removes a hash node from the collision chain
+ //!
+ //! Will delete the node's triple if the reference count falls to zero.
+ //!
+ //! \param curr The node to remove
+ //! \param prev The previous node, or NULL if curr is root node
+ //! \return void
+ //!
+ void removenode (HashNode_t * curr, HashNode_t * prev);
+
+
+ std::vector<HashNode_t> iid_bucs_m; //!< the iid hash buckets
+ std::vector<HashNode_t> eid_bucs_m; //!< the eid hash buckets
+ Size_t size_m; //!< number of value triples
+ NCode_t type_m; //!< type of the IDs
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //============================================== const_iterator ==============
+ //! \brief const_iterator for moving through the map
+ //!
+ //============================================================================
+ class const_iterator
+ {
+ private:
+ const std::vector<HashNode_t> * iid_bucs;
+ const std::vector<HashNode_t> * eid_bucs;
+ std::vector<HashNode_t>::const_iterator buc;
+ const HashNode_t * curr;
+ bool iids;
+
+ public:
+ const_iterator ( )
+ { curr = NULL; }
+ const_iterator (const std::vector<HashNode_t> * iid_bucs_p,
+ const std::vector<HashNode_t> * eid_bucs_p);
+ const HashTriple_t & operator*() const
+ { return *(curr -> triple); }
+ operator const HashTriple_t * () const
+ { return (curr == NULL ? NULL : curr -> triple); }
+ const HashTriple_t * operator->() const
+ { return (curr == NULL ? NULL : curr -> triple); }
+ const_iterator & operator++();
+ const_iterator operator++(int)
+ {
+ const_iterator tmp = *this;
+ this->operator++();
+ return tmp;
+ }
+ };
+
+
+ //--------------------------------------------------- IDMap_t ----------------
+ //! \brief Contstructs an empty IDMap_t object
+ //!
+ IDMap_t ( )
+ : size_m (0), type_m (NULL_NCODE)
+ {
+ resize (DEFAULT_NUM_BUCKETS);
+ }
+
+
+ //--------------------------------------------------- IDMap_t ----------------
+ //! \brief Contstructs an empty IDMap_t object
+ //!
+ //! \param buckets Minimum number of hash table buckets to start with
+ //!
+ IDMap_t (Size_t buckets)
+ : size_m (0), type_m (NULL_NCODE)
+ {
+ resize (buckets);
+ }
+
+
+ //--------------------------------------------------- IDMap_t ----------------
+ //! \brief Copy constructor
+ //!
+ IDMap_t (const IDMap_t & source)
+ : size_m (0), type_m (NULL_NCODE)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~IDMap_t ---------------
+ //! \brief Destroys a IDMap_t object
+ //!
+ ~IDMap_t ( )
+ {
+ clear( );
+ }
+
+
+ //--------------------------------------------------- begin ------------------
+ //! \brief Returns an IDMap_t::const_iterator to the beginning of the map
+ //!
+ //! Constant iterator on all the HashTriple_t values in the map. Will go
+ //! NULL when at end of list. Test for validity just as you would test a
+ //! pointer: for ( myitr = mymap.begin( ); mitr; ++ mitr )
+ //!
+ const_iterator begin ( ) const
+ {
+ return const_iterator (&iid_bucs_m, &eid_bucs_m);
+ }
+
+
+ //--------------------------------------------------- end --------------------
+ //! \brief Returns an IDMap_t::const_iterator to the end of the map
+ //!
+ //! Constant iterator on all the HashTriple_t values in the map. Usage similar
+ //! to STL iterators, i.e.
+ //! for ( itr = map.begin( ); itr != map.end( ); ++ itr )
+ //!
+ const_iterator end ( ) const
+ {
+ return const_iterator ( );
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ //! \brief Clears all object data
+ //!
+ //! Clears data, but does not resize the hash table.
+ //!
+ //! \return void
+ //!
+ void clear ( );
+
+
+ //--------------------------------------------------- concat -----------------
+ //! \brief Concatenate another IDMap onto this one
+ //!
+ //! Has no effect if source is the same IDMap as this one.
+ //!
+ //! \pre The two IDMaps are entirely disjoint
+ //! \return void
+ //!
+ void concat (const IDMap_t & source);
+
+
+ //--------------------------------------------------- empty ------------------
+ //! \brief Returns true if the map is empty
+ //!
+ //! \return true if empty, else false
+ //!
+ bool empty ( ) const
+ {
+ return (size_m == 0);
+ }
+
+
+ //--------------------------------------------------- exists -----------------
+ //! \brief Check if a certain EID exists in the map
+ //!
+ //! Returns true if the EID exists, otherwise false. Will always return
+ //! false if key is NULL.
+ //!
+ //! \param key The EID key to check
+ //! \return true if key exists, otherwise false
+ //!
+ bool exists (const std::string & key) const
+ {
+ HashNode_t * curr;
+ return lookupnode (key, curr);
+ }
+
+
+ //--------------------------------------------------- exists -----------------
+ //! \brief Check if a certain IID exists in the map
+ //!
+ //! Returns true if the IID exists, otherwise false. Will always return
+ //! false if key is NULL_ID.
+ //!
+ //! \param key The IID key to check
+ //! \return true if key exists, otherwise false
+ //!
+ bool exists (ID_t key) const
+ {
+ HashNode_t * curr;
+ return lookupnode (key, curr);
+ }
+
+
+ //--------------------------------------------------- getBuckets -------------
+ //! \brief Returns the current number of buckets being used
+ //!
+ //! \return The current number of buckets being used
+ //!
+ Size_t getBuckets ( ) const
+ {
+ return iid_bucs_m . size( );
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return IDMap_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getSize ----------------
+ //! \brief Get the number of value triples in the map
+ //!
+ //! \return The number of value triples in the map
+ //!
+ Size_t getSize ( ) const
+ {
+ return size_m;
+ }
+
+
+ //--------------------------------------------------- getType ----------------
+ //! \brief The type of IDs stored in the map
+ //!
+ //! \return The NCode of the IDs or NULL_NCODE if unset
+ //!
+ NCode_t getType ( ) const
+ {
+ return type_m;
+ }
+
+
+ //--------------------------------------------------- insert -----------------
+ //! \brief Insert a new EID/IID keyed value into the map
+ //!
+ //! Inserts a new BID into the map via both an EID and IID key. Has no effect
+ //! if *both* EID and IID are NULL, but *one* of them and BID are permitted
+ //! to be NULL. If EID is NULL but IID is not, then a triple will be inserted
+ //! into the map, keyed only by the IID. If IID is NULL but EID is not, then
+ //! a triple will be inserted, keyed only by EID. If neither is NULL, then
+ //! the triple will be keyed by both. If both are NULL, there is no effect.
+ //!
+ //! \param iid The IID key
+ //! \param eid The EID key
+ //! \param bid The bank index value
+ //! \pre The IID does not already exist in the map
+ //! \pre The EID does not already exist in the map
+ //! \throws ArgumentException_t
+ //! \return Pointer to the inserted triple
+ //!
+ const HashTriple_t * insert (ID_t iid,
+ const std::string & eid,
+ ID_t bid = NULL_ID);
+
+
+ //--------------------------------------------------- insertEID --------------
+ //! \brief Insert a new EID keyed value into the map
+ //!
+ //! Inserts a new BID into the map via an EID key. Has no effect if EID is
+ //! NULL, but BID is permitted to be NULL_ID.
+ //!
+ //! \param eid The EID key
+ //! \param bid The bank index value
+ //! \pre EID contains no newlines
+ //! \pre The EID does not already exist in the map
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ const HashTriple_t * insert (const std::string & eid, ID_t bid = NULL_ID)
+ {
+ return insert (NULL_ID, eid, bid);
+ }
+
+
+ //--------------------------------------------------- insertIID --------------
+ //! \brief Insert a new IID keyed value into the map
+ //!
+ //! Inserts a new BID into the map via an IID key. Has no effect if IID is
+ //! NULL_ID, but BID is permitted to be NULL_ID.
+ //!
+ //! \param iid The IID key
+ //! \param bid The bank index value
+ //! \pre The IID does not already exist in the map
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ const HashTriple_t * insert (ID_t iid, ID_t bid = NULL_ID)
+ {
+ return insert (iid, NULL_STRING, bid);
+ }
+
+
+ //--------------------------------------------------- lookupBID --------------
+ //! \brief Lookup the BID associated with an EID key
+ //!
+ //! \note BID value is permitted to be NULL_ID, so returning NULL_ID does not
+ //! guarantee that the EID key does not exist. NULL_ID will always be
+ //! returned for a NULL key.
+ //!
+ //! \param key The EID key of the BID to lookup
+ //! \return The BID of the lookup key or NULL_ID if key does not exist
+ //!
+ ID_t lookupBID (const std::string & key) const
+ {
+ HashNode_t * curr;
+ if ( !lookupnode (key, curr) )
+ return NULL_ID;
+ return curr -> triple -> bid;
+ }
+
+
+ //--------------------------------------------------- lookupBID --------------
+ //! \brief Lookup the BID associated with an IID key
+ //!
+ //! \note BID value is permitted to be NULL_ID, so returning NULL_ID does not
+ //! guarantee that the IID key does not exist. NULL_ID will always be
+ //! returned for a NULL_ID key.
+ //!
+ //! \param key The IID key of the BID to lookup
+ //! \return The BID of the lookup key or NULL_ID if key does not exist
+ //!
+ ID_t lookupBID (ID_t key) const
+ {
+ HashNode_t * curr;
+ if ( !lookupnode (key, curr) )
+ return NULL_ID;
+ return curr -> triple -> bid;
+ }
+
+
+ //--------------------------------------------------- lookupEID --------------
+ //! \brief Lookup the EID associated with an IID key
+ //!
+ //! \note EID value is permitted to be NULL, so returning the empty string
+ //! does not guarantee that the IID key does not exist. The empty string will
+ //! always be returned for a NULL_ID key.
+ //!
+ //! \param key The IID key of the EID to lookup
+ //! \return The EID of the lookup key or empty ('\\0') if key does not exist
+ //!
+ const std::string & lookupEID (ID_t key) const
+ {
+ HashNode_t * curr;
+ if ( !lookupnode (key, curr) )
+ return NULL_STRING;
+ return curr -> triple -> eid;
+ }
+
+
+ //--------------------------------------------------- lookupIID --------------
+ //! \brief Lookup the IID associated with an EID key
+ //!
+ //! \note IID value is permitted to be NULL_ID, so returning NULL_ID does not
+ //! guarantee that the EID key does not exist. NULL_ID will always be
+ //! returned for a NULL key.
+ //!
+ //! \param key The EID key of the IID to lookup
+ //! \return The IID of the lookup key or NULL_ID if key does not exist
+ //!
+ ID_t lookupIID (const std::string & key) const
+ {
+ HashNode_t * curr;
+ if ( !lookupnode (key, curr) )
+ return NULL_ID;
+ return curr -> triple -> iid;
+ }
+
+
+ //--------------------------------------------------- operator= --------------
+ //! \brief Assignment (copy) operator
+ //!
+ //! Simply clears the current map and calls insert on everything in source.
+ //! Does not guarantee that getBuckets( ) will equal source.getBuckets( )
+ //! after the assignment. Throws an exception if copy failed due to corrupt
+ //! source map.
+ //!
+ //! \param source The map to copy
+ //! \throws ArgumentException_t
+ //! \return The resulting map object
+ //!
+ IDMap_t & operator= (const IDMap_t & source);
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- remove -----------------
+ //! \brief Remove an existing value triple from the map by IID key
+ //!
+ //! Removes an existsing value triple from the map. Has no effect if the key
+ //! does not exist or is NULL_ID. If IID is associated with an EID, the EID
+ //! key will also be removed.
+ //!
+ //! \param key The IID key of the triple to remove
+ //! \return void
+ //!
+ void remove (ID_t key);
+
+
+ //--------------------------------------------------- remove -----------------
+ //! \brief Remove an existing value triple from the map by EID key
+ //!
+ //! Removes an existsing value triple from the map. Has no effect if the key
+ //! does not exist or is NULL. If EID is associated with an IID, the IID key
+ //! will also be removed.
+ //!
+ //! \param key The EID key of the triple to remove
+ //! \return void
+ //!
+ void remove (const std::string & key);
+
+
+ //--------------------------------------------------- resize -----------------
+ //! \brief Resize the hash table
+ //!
+ //! This will cause the hash to reorganize itself and is not recommended
+ //! as a frequent operation. If request is larger than max number of buckets
+ //! the max number of buckets will be used. Otherwise, the resulting
+ //! number of buckets is only guaranteed to be greater than request.
+ //!
+ //! Number of buckets will automatically increase whenever an insert operation
+ //! causes the number of elements to be >= than number of buckets.
+ //!
+ //! \param min Minimum number of buckets to use
+ //! \return void
+ //!
+ void resize (Size_t min);
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+
+ //--------------------------------------------------- read -------------------
+ //! \brief Read a tab-delimited IDMap record
+ //!
+ //! IDMap NCode and size listed on the first line separated by a single space,
+ //! followed by one tab-delimited triple per line in the order: bid, iid, eid.
+ //! One of the stream's error bits will be set on failure.
+ //! The EID strings cannot contain any whitespace
+ //!
+ //! \param in The stream to read the IDMap from
+ //! \return void
+ //!
+ void read(const std::string & path);
+
+
+ //--------------------------------------------------- setType ----------------
+ //! \brief Set the type of the mapped IDs
+ //!
+ //! \param type The NCode type of the mapped IDs
+ //! \return void
+ //!
+ void setType (NCode_t type)
+ {
+ type_m = type;
+ }
+
+
+ //--------------------------------------------------- write ------------------
+ //! \brief Write a tab-delimited IDMap record
+ //!
+ //! IDMap NCode and size listed on the first line separated by a single space,
+ //! followed by one tab-delimited triple per line in the order: bid, iid, eid.
+ //! One of the stream's error bits will be set on failure.
+ //!
+ //! \param out The stream to write the IDMap to
+ //! \return void
+ //!
+ void write (std::ostream & out) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __IDMap_AMOS_HH
diff --git a/src/AMOS/Index_AMOS.cc b/src/AMOS/Index_AMOS.cc
new file mode 100644
index 0000000..a89b633
--- /dev/null
+++ b/src/AMOS/Index_AMOS.cc
@@ -0,0 +1,327 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 04/21/2005
+//!
+//! \brief Source for Index_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Index_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ Index_t =====================
+const NCode_t Index_t::NCODE = M_INDEX;
+
+
+//----------------------------------------------------- buildContigFeature -----
+void Index_t::buildContigFeature (const std::string bankname)
+{
+ clear( );
+ setType (Contig_t::NCODE, Feature_t::NCODE);
+
+ Feature_t fea;
+ pair<NCode_t, ID_t> src;
+ BankStream_t fea_bank (Feature_t::NCODE);
+
+ fea_bank . open (bankname, B_READ);
+
+ while ( fea_bank >> fea )
+ {
+ src = fea . getSource( );
+ if ( src . first != NULL_ID && src . second == Contig_t::NCODE )
+ insert (src . first, fea . getIID( ));
+ }
+
+ fea_bank . close( );
+}
+
+
+//----------------------------------------------------- buildContigScaffold ----
+void Index_t::buildContigScaffold (const std::string bankname)
+{
+ clear( );
+ setType (Contig_t::NCODE, Scaffold_t::NCODE);
+
+ Scaffold_t scf;
+ vector<Tile_t>::const_iterator cur;
+ vector<Tile_t>::const_iterator end;
+ BankStream_t scf_bank (Scaffold_t::NCODE);
+
+ scf_bank . open (bankname, B_READ);
+
+ while ( scf_bank >> scf )
+ {
+ end = scf . getContigTiling( ) . end( );
+ if ( scf . getIID( ) != NULL_ID )
+ for ( cur = scf . getContigTiling( ) . begin( ); cur != end; ++ cur )
+ if ( cur -> source != NULL_ID )
+ insert (cur -> source, scf . getIID( ));
+ }
+
+ scf_bank . close( );
+}
+
+
+//----------------------------------------------------- buildReadContig --------
+void Index_t::buildReadContig (const std::string bankname)
+{
+ clear( );
+ setType (Read_t::NCODE, Contig_t::NCODE);
+
+ Contig_t ctg;
+ vector<Tile_t>::const_iterator cur;
+ vector<Tile_t>::const_iterator end;
+ BankStream_t ctg_bank (Contig_t::NCODE);
+
+ ctg_bank . open (bankname, B_READ);
+
+ while ( ctg_bank >> ctg )
+ {
+ end = ctg . getReadTiling( ) . end( );
+ if ( ctg . getIID( ) != NULL_ID )
+ for ( cur = ctg . getReadTiling( ) . begin( ); cur != end; ++ cur )
+ if ( cur -> source != NULL_ID )
+ insert (cur -> source, ctg . getIID( ));
+ }
+
+ ctg_bank . close( );
+}
+
+
+//----------------------------------------------------- buildReadLibrary -------
+void Index_t::buildReadLibrary (const std::string bankname)
+{
+ clear( );
+ setType (Read_t::NCODE, Library_t::NCODE);
+
+ Read_t red;
+ Fragment_t frg;
+ Bank_t frg_bank (Fragment_t::NCODE);
+ BankStream_t red_bank (Read_t::NCODE);
+
+ frg_bank . open (bankname, B_READ);
+ red_bank . open (bankname, B_READ);
+
+ while ( red_bank >> red )
+ {
+ frg_bank . fetch (red . getFragment( ), frg);
+ if ( red . getIID( ) != NULL_ID && frg . getLibrary( ) != NULL_ID )
+ insert (red . getIID( ), frg . getLibrary( ));
+ }
+
+ frg_bank . close( );
+ red_bank . close( );
+}
+
+
+//----------------------------------------------------- buildReadMate ----------
+void Index_t::buildReadMate (const std::string bankname)
+{
+ clear( );
+ setType (Read_t::NCODE, Read_t::NCODE);
+
+ Fragment_t frg;
+ pair<ID_t, ID_t> mtp;
+ BankStream_t frg_bank (Fragment_t::NCODE);
+
+ frg_bank . open (bankname, B_READ);
+
+ while ( frg_bank >> frg )
+ {
+ mtp = frg . getMatePair( );
+ if ( mtp . first != NULL_ID && mtp . second != NULL_ID )
+ {
+ insert (mtp . first, mtp . second);
+ insert (mtp . second, mtp . first);
+ }
+ }
+
+ frg_bank . close( );
+}
+
+
+//----------------------------------------------------- buildScaffoldFeature ---
+void Index_t::buildScaffoldFeature (const std::string bankname)
+{
+ clear( );
+ setType (Scaffold_t::NCODE, Feature_t::NCODE);
+
+ Feature_t fea;
+ pair<NCode_t, ID_t> src;
+ BankStream_t fea_bank (Feature_t::NCODE);
+
+ fea_bank . open (bankname, B_READ);
+
+ while ( fea_bank >> fea )
+ {
+ src = fea . getSource( );
+ if ( src . first != NULL_ID && src . second == Scaffold_t::NCODE )
+ insert (src . first, fea . getIID( ));
+ }
+
+ fea_bank . close( );
+}
+
+
+//----------------------------------------------------- readMessage ------------
+void Index_t::readMessage (const Message_t & msg)
+{
+ Universal_t::readMessage (msg);
+
+ try {
+ Size_t size = -1;
+ istringstream ss;
+
+ if ( msg . exists (F_OBJECT) )
+ {
+ string str = msg . getField (F_OBJECT);
+
+ if ( str . length( ) != NCODE_SIZE + NCODE_SIZE + 1 )
+ AMOS_THROW_ARGUMENT ("Invalid object type format");
+
+ type_m . first = Encode (str.substr (0, NCODE_SIZE));
+ type_m . second = Encode (str.substr (NCODE_SIZE + 1));
+ }
+
+ if ( msg . exists (F_SIZE) )
+ {
+ ss . str (msg . getField (F_SIZE));
+ ss >> size;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid size format");
+ index_m . resize (size);
+
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_MAP) )
+ {
+ pair<ID_t, ID_t> iids;
+ ss . str (msg . getField (F_MAP));
+
+ while ( ss )
+ {
+ ss >> iids . first >> iids . second;
+ if ( ! ss . fail( ) )
+ insert (iids);
+ }
+
+ if ( ! ss . eof( ) )
+ AMOS_THROW_ARGUMENT ("Invalid map format");
+
+ if ( size >= 0 && size != getSize( ) )
+ AMOS_THROW_ARGUMENT ("map and size fields do not agree");
+
+ ss . clear( );
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Index_t::readRecord (istream & fix, istream & var)
+{
+ Universal_t::readRecord (fix, var);
+
+ Size_t size;
+ readLE (fix, &size);
+ readLE (fix, &(type_m . first));
+ readLE (fix, &(type_m . second));
+
+ pair<ID_t, ID_t> iids;
+ index_m . clear( );
+ index_m . resize (size);
+ for ( Pos_t i = 0; i < size; ++ i )
+ {
+ readLE (var, &(iids . first));
+ readLE (var, &(iids . second));
+ insert (iids);
+ }
+}
+
+
+
+//----------------------------------------------------- readRecordFix ----------
+void Index_t::readRecordFix (istream & fix)
+{
+ Universal_t::readRecordFix (fix);
+
+ Size_t size;
+ readLE (fix, &size);
+ readLE (fix, &(type_m . first));
+ readLE (fix, &(type_m . second));
+
+ index_m . clear( );
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Index_t::writeMessage (Message_t & msg) const
+{
+ Universal_t::writeMessage (msg);
+
+ try {
+ Size_t size = getSize( );
+ ostringstream ss;
+
+ msg . setMessageCode (Index_t::NCODE);
+
+ if ( type_m . first != NULL_NCODE || type_m . second != NULL_NCODE )
+ {
+ ss << Decode (type_m . first) << ',' << Decode (type_m . second);
+ msg . setField (F_OBJECT, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( size != 0 )
+ {
+ ss << size;
+ msg . setField (F_SIZE, ss . str( ));
+ ss . str (NULL_STRING);
+
+ string str;
+ for ( const_iterator itr = begin( ); itr != end( ); ++ itr )
+ {
+ ss << itr -> first << '\t' << itr -> second;
+ str . append (ss . str( ));
+ str . push_back (NL_CHAR);
+ ss . str (NULL_STRING);
+ }
+
+ msg . setField (F_MAP, str);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Index_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Universal_t::writeRecord (fix, var);
+
+ Size_t size = getSize( );
+ writeLE (fix, &size);
+ writeLE (fix, &(type_m . first));
+ writeLE (fix, &(type_m . second));
+
+ for ( const_iterator itr = begin( ); itr != end( ); ++ itr )
+ {
+ writeLE (var, &(itr -> first));
+ writeLE (var, &(itr -> second));
+ }
+}
diff --git a/src/AMOS/Index_AMOS.hh b/src/AMOS/Index_AMOS.hh
new file mode 100644
index 0000000..841f155
--- /dev/null
+++ b/src/AMOS/Index_AMOS.hh
@@ -0,0 +1,437 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 04/21/2005
+//!
+//! \brief Header for Index_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Index_AMOS_HH
+#define __Index_AMOS_HH 1
+
+#include "universals_AMOS.hh"
+#include <utility>
+
+
+
+
+namespace AMOS {
+
+//================================================ Index_t =====================
+//! \brief An association index between two types of AMOS objects
+//!
+//! Provides an efficient means for storing/retrieving inter-object
+//! relationships, e.g. read to mated read. Since most objects only store a
+//! minimal set of references, it can be akward and costly to identify related
+//! objects not directly linked with an IID reference. The Index_t provides a
+//! way to amortize this cost by storing the association information directly
+//! for future, repeated use. When in memory, it is essentially a watered-down
+//! version of an STL multimap.
+//!
+//==============================================================================
+class Index_t : public Universal_t
+{
+
+private:
+
+ std::pair<NCode_t, NCode_t> type_m; //!< the index type
+ HASHMAP::hash_multimap<ID_t, ID_t> index_m; //!< ID_t -> ID_t index
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ typedef HASHMAP::hash_multimap<ID_t, ID_t>::iterator iterator;
+ //!< Un-mutable index iterator, only itr -> second can be modified
+
+ typedef HASHMAP::hash_multimap<ID_t, ID_t>::const_iterator const_iterator;
+ //!< constant index iterator
+
+
+ //--------------------------------------------------- Index_t ----------------
+ //! \brief Constructs an empty Index_t object
+ //!
+ //! Sets all members to zero or NULL
+ //!
+ Index_t ( )
+ {
+ type_m . first = type_m . second = NULL_NCODE;
+ }
+
+
+ //--------------------------------------------------- Index_t ----------------
+ //! \brief Constructs an Index_t of a certain type
+ //!
+ Index_t (NCode_t a, NCode_t b)
+ {
+ type_m . first = a;
+ type_m . second = b;
+ }
+
+
+ //--------------------------------------------------- Index_t ----------------
+ //! \brief Copy constructor
+ //!
+ Index_t (const Index_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~Index_t ---------------
+ //! \brief Destroys a Index_t object
+ //!
+ ~Index_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- begin ------------------
+ //! \brief Returns a iterator to the beginning of the index
+ //!
+ //! Iterator is of the type hash_multimap<ID_t, ID_t>::iterator. Access
+ //! TO and FROM IIDs with 'itr -> first' and 'itr -> second' respectively.
+ //!
+ //! \return An iterator to the beginning of the index
+ //!
+ iterator begin ( )
+ {
+ return index_m . begin( );
+ }
+
+
+ //--------------------------------------------------- begin ------------------
+ const_iterator begin ( ) const
+ {
+ return index_m . begin( );
+ }
+
+
+ //--------------------------------------------------- buildContigFeature -----
+ //! \brief Builds the index with Contig_t Feature_t's
+ //!
+ //! Builds the index with contig features, i.e. the index will contain a
+ //! set of all associated features for each contig IID. Will throw an
+ //! exception if there was any trouble opening and reading from the banks.
+ //!
+ //! \param bankname Name of the bank directory to index
+ //! \throws ArgumentException_t
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void buildContigFeature (const std::string bankname);
+
+
+ //--------------------------------------------------- buildContigScaffold ----
+ //! \brief Builds the index with Contig_t to Scaffold_t mappings
+ //!
+ //! Builds the index with contig to scaffold links, i.e. the index will
+ //! reference the containing scaffold(s) for each contig IID. Will throw an
+ //! exception if there was any trouble opening and reading from the banks.
+ //!
+ //! \param bankname Name of the bank directory to index
+ //! \throws ArgumentException_t
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void buildContigScaffold (const std::string bankname);
+
+
+ //--------------------------------------------------- buildReadContig --------
+ //! \brief Builds the index with Read_t to Contig_t mappings
+ //!
+ //! Builds the index with read to contig links, i.e. the index will
+ //! reference the containing contig(s) for each read IID. Will throw an
+ //! exception if there was any trouble opening and reading from the banks.
+ //!
+ //! \param bankname Name of the bank directory to index
+ //! \throws ArgumentException_t
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void buildReadContig (const std::string bankname);
+
+
+ //--------------------------------------------------- buildReadLibrary -------
+ //! \brief Builds the index with Read_t to Library_t mappings
+ //!
+ //! Builds the index with read to library links, i.e. the index will
+ //! reference the parent library for each read IID. Will throw an exception
+ //! if there was any trouble opening and reading from the banks.
+ //!
+ //! \param bankname Name of the bank directory to index
+ //! \throws ArgumentException_t
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void buildReadLibrary (const std::string bankname);
+
+
+ //--------------------------------------------------- buildReadMate ----------
+ //! \brief Builds the index with mated Read_t's
+ //!
+ //! Builds the index with read mates, i.e. the index will reference the
+ //! the mate of each read IID. Will throw an exception if there was any
+ //! trouble opening and reading from the banks.
+ //! \throws ArgumentException_t
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void buildReadMate (const std::string bankname);
+
+
+ //--------------------------------------------------- buildScaffoldFeature ---
+ //! \brief Builds the index with Scaffold_t Feature_t's
+ //!
+ //! Builds the index with scaffold features, i.e. the index will contain a
+ //! set of all associated features for each scaffold IID. Will throw an
+ //! exception if there was any trouble opening and reading from the banks.
+ //!
+ //! \param bankname Name of the bank directory to index
+ //! \throws ArgumentException_t
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void buildScaffoldFeature (const std::string bankname);
+
+
+ //--------------------------------------------------- end --------------------
+ //! \brief Returns a iterator to the end of the index
+ //!
+ //! Iterator is of the type hash_multimap<ID_t, ID_t>::iterator. Access
+ //! TO and FROM IIDs with 'itr -> first' and 'itr -> second' respectively.
+ //!
+ //! \return A iterator to the end of the index
+ //!
+ iterator end ( )
+ {
+ return index_m . end( );
+ }
+
+
+ //--------------------------------------------------- end --------------------
+ const_iterator end ( ) const
+ {
+ return index_m . end( );
+ }
+
+
+ //--------------------------------------------------- empty ------------------
+ //! \brief Returns true if the index is empty
+ //!
+ //! \return True if the index is empty, else false
+ //!
+ bool empty ( ) const
+ {
+ return index_m . empty( );
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ Universal_t::clear( );
+
+ type_m . first = type_m . second = NULL_NCODE;
+ index_m . clear( );
+ }
+
+
+ //--------------------------------------------------- count ------------------
+ //! \brief Returns the number of IDs associated with a particular key
+ //!
+ //! \return The number of IDs associated with a particular key
+ //!
+ Size_t count (ID_t key) const
+ {
+ return index_m . count (key);
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Index_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getSize ----------------
+ //! \brief Returns the number of ID pairs in the index
+ //!
+ //! \return The number of ID pairs in the index
+ //!
+ Size_t getSize ( ) const
+ {
+ return index_m . size( );
+ }
+
+
+ //--------------------------------------------------- getType ----------------
+ //! \brief Get the index type as a pair of NCodes
+ //!
+ //! Get the index type as a pair of NCodes for the FROM and TO type
+ //! respectively.
+ //!
+ //! \return The index type
+ //!
+ std::pair<NCode_t, NCode_t> getType( ) const
+ {
+ return type_m;
+ }
+
+
+ //--------------------------------------------------- insert -----------------
+ //! \brief Inserts a new IID pair into the index
+ //!
+ //! Inserts a new IID pair into the index. Index keys are allowed to have
+ //! multiple, not necessarily unique, values.
+ //!
+ //! \param key The index key
+ //! \param value The new index value
+ //! \return void
+ //!
+ void insert (ID_t key, ID_t value)
+ {
+ insert (std::make_pair(key, value));
+ }
+
+
+ //--------------------------------------------------- insert -----------------
+ void insert (std::pair<ID_t, ID_t> iids)
+ {
+ index_m . insert (iids);
+ }
+
+
+ //--------------------------------------------------- isMulti ----------------
+ //! \brief Returns true if count is > 1 for a particular key
+ //!
+ //! \return True if count is > 1 for a particular key
+ //!
+ bool isMulti (ID_t key) const
+ {
+ return (count (key) > 1);
+ }
+
+
+ //--------------------------------------------------- lookup -----------------
+ //! \brief Look up a single IID by its index key
+ //!
+ //! Look up a single IID by its index key, even though multiple IDs make be
+ //! associated with the same key. If multiple IDs exist for the same key, a
+ //! single value will be picked (in no guaranteed fasion) and returned
+ //!
+ //! \param key The key to lookup
+ //! \return An IID value associated with the given key or NULL_ID if none
+ //!
+ ID_t lookup (ID_t key) const
+ {
+ const_iterator i = index_m . find (key);
+ return ( i == end( ) ? NULL_ID : i -> second );
+ }
+
+
+ //--------------------------------------------------- lookupAll --------------
+ //! \brief Look up a list of IIDs by their index key
+ //!
+ //! Look up all IIDs associated with the same index key. A begin and end
+ //! iterator will be returned, representing the bounds of the value list.
+ //! Like standard STL begin/end iterators, the begin iterator will point to
+ //! the first object and the end iterator will point one past the end object.
+ //!
+ //! \param key The key to lookup
+ //! \return A pair of iterators bounding the values with the given key
+ //!
+ std::pair<iterator, iterator> lookupAll (ID_t key)
+ {
+ return index_m . equal_range (key);
+ }
+
+
+ //--------------------------------------------------- lookupAll --------------
+ std::pair<const_iterator, const_iterator> lookupAll (ID_t key) const
+ {
+ return index_m . equal_range (key);
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- remove -----------------
+ //! \brief Remove all IIDs associated with a particular key
+ //!
+ //! Will remove the index key and all values associated with that key. Returns
+ //! the number of ID pairs removed.
+ //!
+ //! \param key The key to remove
+ //! \return The number of ID pairs removed
+ //!
+ Size_t remove (ID_t key)
+ {
+ return index_m . erase (key);
+ }
+
+
+ //--------------------------------------------------- remove -----------------
+ //! \brief Remove a single ID pair
+ //!
+ //! \param itr An iterator pointing to the pair to remove
+ //! \return void
+ //!
+ void remove (iterator itr)
+ {
+ index_m . erase (itr);
+ }
+
+
+ //--------------------------------------------------- setType ----------------
+ //! \brief Set the index type as a pair of NCodes
+ //!
+ //! Set the index type as a pair of NCodes for the FROM and TO type
+ //! respectively.
+ //!
+ //! \param type The new index type
+ //! \return void
+ //!
+ void setType (std::pair<NCode_t, NCode_t> type)
+ {
+ type_m = type;
+ }
+
+
+ //--------------------------------------------------- setType ----------------
+ void setType (NCode_t a, NCode_t b)
+ {
+ setType (std::make_pair (a, b));
+ }
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Index_AMOS_HH
diff --git a/src/AMOS/Kmer_AMOS.cc b/src/AMOS/Kmer_AMOS.cc
new file mode 100644
index 0000000..198db2f
--- /dev/null
+++ b/src/AMOS/Kmer_AMOS.cc
@@ -0,0 +1,247 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 10/29/2003
+//!
+//! \brief Source for Kmer_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Kmer_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ Kmer_t ======================
+const NCode_t Kmer_t::NCODE = M_KMER;
+const uint8_t Kmer_t::MAX_LENGTH = 255;
+
+
+//----------------------------------------------------- clear ------------------
+void Kmer_t::clear ( )
+{
+ Universal_t::clear( );
+ free (seq_m);
+ seq_m = NULL;
+ count_m = length_m = 0;
+ reads_m . clear( );
+}
+
+
+//----------------------------------------------------- getSeqString -----------
+string Kmer_t::getSeqString ( ) const
+{
+ string retval (length_m, NULL_CHAR);
+
+ //-- See developer comments for getBase
+ Pos_t ci = -1;
+ uint8_t byte = 0;
+ for ( Pos_t ui = 0; ui < length_m; ui ++ )
+ {
+ if ( ui % 4 == 0 )
+ byte = seq_m [++ ci];
+
+ retval [ui] = uncompress (byte);
+ byte <<= 2;
+ }
+
+ return retval;
+}
+
+
+//----------------------------------------------------- readMessage-------------
+void Kmer_t::readMessage (const Message_t & msg)
+{
+ Universal_t::readMessage (msg);
+
+ try {
+
+ istringstream ss;
+
+ if ( msg . exists (F_COUNT) )
+ {
+ ss . str (msg . getField (F_COUNT));
+ ss >> count_m;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid count format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_SEQUENCE) )
+ setSeqString (msg . getField (F_SEQUENCE));
+
+ if ( msg . exists (F_READS) )
+ {
+ ID_t iid;
+
+ ss . str (msg . getField (F_READS));
+
+ while ( ss )
+ {
+ ss >> iid;
+ if ( ! ss . fail( ) )
+ reads_m . push_back (iid);
+ }
+
+ if ( !ss . eof( ) )
+ AMOS_THROW_ARGUMENT ("Invalid read link list format");
+ ss . clear( );
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Kmer_t::readRecord (istream & fix, istream & var)
+{
+ Universal_t::readRecord (fix, var);
+
+ Size_t size;
+ readLE (fix, &count_m);
+ readLE (fix, &length_m);
+ readLE (fix, &size);
+
+ reads_m . resize (size, NULL_ID);
+ for ( Pos_t i = 0; i < size; i ++ )
+ readLE (var, &(reads_m [i]));
+
+ size = length_m / 4 + (length_m % 4 ? 1 : 0);
+ seq_m = (uint8_t *) SafeRealloc (seq_m, size);
+ var . read ((char *)seq_m, size);
+}
+
+
+//----------------------------------------------------- readRecordFix ----------
+void Kmer_t::readRecordFix (istream & fix)
+{
+ Universal_t::readRecordFix (fix);
+
+ Size_t size;
+ readLE (fix, &count_m);
+ readLE (fix, &length_m);
+ readLE (fix, &size);
+
+ reads_m.clear();
+
+ free(seq_m);
+ seq_m = NULL;
+}
+
+
+//----------------------------------------------------- setSeqString -----------
+void Kmer_t::setSeqString (const string & seq)
+{
+ Size_t osize = seq . size( );
+ Size_t size = osize;
+ if ( size > Kmer_t::MAX_LENGTH )
+ AMOS_THROW_ARGUMENT ("Invalid kmer sequence is too long");
+
+ size = size / 4 + (size % 4 ? 1 : 0);
+ seq_m = (uint8_t *) SafeRealloc (seq_m, size);
+
+ //-- See developer comments for setBase
+ Pos_t ci = -1;
+ int offset = 8;
+ length_m = 0;
+ for ( Size_t ui = 0; ui < osize; ui ++ )
+ {
+ if ( seq [ui] == NL_CHAR )
+ continue;
+
+ length_m ++;
+ if ( offset >= 8 )
+ {
+ offset = 0;
+ seq_m [++ ci] = 0;
+ }
+ seq_m [ci] |= compress (seq [ui]) >> offset;
+ offset += 2;
+ }
+
+ if ( length_m != osize )
+ {
+ size = length_m / 4 + (length_m % 4 ? 1 : 0);
+ seq_m = (uint8_t *) SafeRealloc (seq_m, size);
+ }
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Kmer_t::writeMessage (Message_t & msg) const
+{
+ Universal_t::writeMessage (msg);
+
+ try {
+
+ ostringstream ss;
+
+ msg . setMessageCode (Kmer_t::NCODE);
+
+ ss << count_m;
+ msg . setField (F_COUNT, ss . str( ));
+ ss . str (NULL_STRING);
+
+ if ( length_m != 0 )
+ msg . setField (F_SEQUENCE, getSeqString( ));
+
+ if ( !reads_m . empty( ) )
+ {
+ vector<ID_t>::const_iterator vi;
+
+ for ( vi = reads_m . begin( ); vi != reads_m . end( ); vi ++ )
+ ss << *vi << endl;
+ msg . setField (F_READS, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Kmer_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Universal_t::writeRecord (fix, var);
+
+ Size_t size = reads_m . size( );
+ writeLE (fix, &count_m);
+ writeLE (fix, &length_m);
+ writeLE (fix, &size);
+
+ for ( Pos_t i = 0; i < size; i ++ )
+ writeLE (var, &(reads_m [i]));
+
+ size = length_m / 4 + (length_m % 4 ? 1 : 0);
+ var . write ((char *)seq_m, size);
+}
+
+
+//----------------------------------------------------- operator= --------------
+Kmer_t & Kmer_t::operator= (const Kmer_t & source)
+{
+ if ( this != &source )
+ {
+ Universal_t::operator= (source);
+
+ Size_t size = source . length_m / 4 + (source . length_m % 4 ? 1 : 0);
+ seq_m = (uint8_t *) SafeRealloc (seq_m, size);
+ memcpy (seq_m, source . seq_m, size);
+
+ count_m = source . count_m;
+ length_m = source . length_m;
+ reads_m = source . reads_m;
+ }
+
+ return *this;
+}
diff --git a/src/AMOS/Kmer_AMOS.hh b/src/AMOS/Kmer_AMOS.hh
new file mode 100644
index 0000000..a1e69c2
--- /dev/null
+++ b/src/AMOS/Kmer_AMOS.hh
@@ -0,0 +1,358 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/18/2003
+//!
+//! \brief Header for Kmer_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Kmer_AMOS_HH
+#define __Kmer_AMOS_HH 1
+
+#include "Universal_AMOS.hh"
+#include <vector>
+#include <string>
+
+
+
+
+namespace AMOS {
+
+//================================================ Kmer_t ======================
+//! \brief String of K bases present in the assembly
+//!
+//! A string of K bases that is present in one or more occurrences throught a
+//! set of sequencing reads.
+//!
+//==============================================================================
+class Kmer_t : public Universal_t
+{
+
+private:
+
+ uint8_t * seq_m; //!< the compressed string of A, C, G and T's
+ uint32_t count_m; //!< the number of occurrences of this Kmer
+ uint8_t length_m; //!< the length of the Kmer (value of K)
+ std::vector<ID_t> reads_m; //!< list of Read_t types that contain this Kmer
+
+
+protected:
+
+ static const uint8_t ADENINE_BITS = 0x0; //!< 'A' bit
+ static const uint8_t CYTOSINE_BITS = 0x40; //!< 'C' bit
+ static const uint8_t GUANINE_BITS = 0x80; //!< 'G' bit
+ static const uint8_t THYMINE_BITS = 0xC0; //!< 'T' bit
+ static const uint8_t SEQ_BITS = 0xC0; //!< sequence bit mask
+
+
+ //--------------------------------------------------- compress ---------------
+ //! \brief Compresses a sequence char into two bits
+ //!
+ //! \note Must work with uncompress(uint8_t) method
+ //!
+ //! \param seqchar The sequence base character
+ //! \pre seqchar is A,C,G,T (case insensitive)
+ //! \throws ArgumentException_t
+ //! \return The compressed 2 bits (in the highest two bit positions)
+ //!
+ static uint8_t compress (char seqchar)
+ {
+ switch ( toupper(seqchar) )
+ {
+ case 'A': return ADENINE_BITS;
+ case 'C': return CYTOSINE_BITS;
+ case 'G': return GUANINE_BITS;
+ case 'T': return THYMINE_BITS;
+ default:
+ AMOS_THROW_ARGUMENT ((std::string)"Invalid Kmer character " + seqchar);
+ }
+ }
+
+
+ //--------------------------------------------------- uncompress -------------
+ //! \brief Uncompresses two bits into a sequence char
+ //!
+ //! \note Must work with compress(char)
+ //!
+ //! \param byte The compressed sequence bits (in highest two bit positions)
+ //! \throws Exception_t
+ //! \return The sequence char
+ //!
+ static char uncompress (uint8_t byte)
+ {
+ switch ( byte & SEQ_BITS )
+ {
+ case ADENINE_BITS: return 'A';
+ case CYTOSINE_BITS: return 'C';
+ case GUANINE_BITS: return 'G';
+ case THYMINE_BITS: return 'T';
+ default:
+ AMOS_THROW_ARGUMENT ("Unknown logic error");
+ }
+ }
+
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+ static const uint8_t MAX_LENGTH;
+ //!< Maximum Kmer length
+
+
+ //--------------------------------------------------- Kmer_t -----------------
+ //! \brief Constructs an empty Kmer_t object
+ //!
+ //! Sets all members to 0 or NULL
+ //!
+ Kmer_t ( )
+ {
+ seq_m = NULL;
+ count_m = length_m = 0;
+ }
+
+
+ //--------------------------------------------------- Kmer_t -----------------
+ //! \brief Copy constructor
+ //!
+ Kmer_t (const Kmer_t & source)
+ {
+ seq_m = NULL;
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~Kmer_t ----------------
+ //! \brief Destroys a Kmer_t object
+ //!
+ //! Frees the memory used for the compressed sequence
+ //!
+ ~Kmer_t ( )
+ {
+ free (seq_m);
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( );
+
+
+ //--------------------------------------------------- getBase ----------------
+ //! \brief Get a single sequence base from the kmer
+ //!
+ //! Retrieves and uncompresses the sequence base for the requested index.
+ //!
+ //! \param index The index of the requested base
+ //! \pre index >= 0 && index < length
+ //! \throws ArgumentException_t
+ //! \return The requested (uppercase) base character
+ //!
+ // -- developers note --
+ // If we imagine consecutive bytes stored left-to-right, then we can index
+ // the seqchars left-to-right as follows:
+ // [0] [1] [2] [3] [4] [5] [6] [7] ... seqchars
+ // [7 6 5 4 3 2 1 0] [7 6 5 4 3 2 1 0] ... bits
+ // [byte 0 ] [byte 1 ] ... bytes
+ // Thus, to retrieve seqchar 5 we need to index byte 1. Since uncompress
+ // expects the sequence bits in the high-order end of the byte, we left
+ // shift 2-bits. The uncompress method will take care of the necessary
+ // masking.
+ //
+ char getBase (Pos_t index) const
+ {
+ if ( index < 0 || index >= length_m )
+ AMOS_THROW_ARGUMENT ("Requested kmer index is out of range");
+ return uncompress ((seq_m [index / 4]) << (index % 4 * 2));
+ }
+
+
+ //--------------------------------------------------- getCount ---------------
+ //! \brief Get the number of this Kmer's occurrences
+ //!
+ //! \return The number of occurrrences
+ //!
+ uint32_t getCount ( ) const
+ {
+ return count_m;
+ }
+
+
+ //--------------------------------------------------- getLength --------------
+ //! \brief Gets the length of the Kmer
+ //!
+ //! \return The Kmer length
+ //!
+ uint8_t getLength ( ) const
+ {
+ return length_m;
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Kmer_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getReads ---------------
+ //! \brief Get the containing read IIDs
+ //!
+ //! \return The vector of read IIDs that contain this Kmer
+ //!
+ const std::vector<ID_t> & getReads ( ) const
+ {
+ return reads_m;
+ }
+
+
+ //--------------------------------------------------- getReads ---------------
+ //! \brief Get the containing read IIDs
+ //!
+ //! \return The vector of read IIDs that contain this Kmer
+ //!
+ std::vector<ID_t> & getReads ( )
+ {
+ return reads_m;
+ }
+
+
+ //--------------------------------------------------- getSeqString -----------
+ //! \brief Get the Kmer sequence string
+ //!
+ //! Uncompresses the Kmer sequence and returns a string representation.
+ //!
+ //! \return The Kmer sequence string
+ //!
+ std::string getSeqString ( ) const;
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- setBase ----------------
+ //! \brief Set a single sequence base for the kmer
+ //!
+ //! Only the characters A,C,G,T are allowed, all other characters will throw
+ //! an exception.
+ //!
+ //! \param seqchar The sequence base character
+ //! \param index The index to assign this character
+ //! \pre index >= 0 && index < length
+ //! \pre seqchar is A,C,G,T (case insensitive)
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ // -- developers note --
+ // If we imagine consecutive bytes stored left-to-right, then we can index
+ // the seqchars left-to-right as follows:
+ // [0] [1] [2] [3] [4] [5] [6] [7] ... seqchars
+ // [7 6 5 4 3 2 1 0] [7 6 5 4 3 2 1 0] ... bits
+ // [byte 0 ] [byte 1 ] ... bytes
+ // Thus, to set seqchar 2, we need overwrite the bits at the 2^3 and 2^2
+ // positions of byte 0. Since compress returns the sequence bits in the
+ // high-order end of the byte, we right-shift the return value 4-bits and
+ // "OR" it with the stored byte (making sure to clear those two bits first).
+ //
+ void setBase (char seqchar, Pos_t index)
+ {
+ if ( index < 0 || index >= length_m )
+ AMOS_THROW_ARGUMENT ("Requested kmer index is out of range");
+
+ int offset = index % 4 * 2; // the bitmask offset
+ uint8_t * seqp = seq_m + index / 4; // the required byte
+
+ //-- Delete the previous two bits, then set the two new bits
+ *seqp &= ~(SEQ_BITS >> offset);
+ *seqp |= compress (seqchar) >> offset;
+ }
+
+
+ //--------------------------------------------------- setCount ---------------
+ //! \brief Set the number of this Kmer's occurrences
+ //!
+ //! \param count The new number of occurrences
+ //! \return void
+ //!
+ void setCount (uint32_t count)
+ {
+ count_m = count;
+ }
+
+
+ //--------------------------------------------------- setReads ---------------
+ //! \brief Set the list of containing read IIDs
+ //!
+ //! \param reads The new vector of read IIDs that contain this Kmer
+ //! \return void
+ //!
+ void setReads (const std::vector<ID_t> & reads)
+ {
+ reads_m = reads;
+ }
+
+
+ //--------------------------------------------------- setSeqString -----------
+ //! \brief Set the Kmer sequence string
+ //!
+ //! Compresses the string and updates the Kmer sequence. Does not alter
+ //! Kmer count or read list, these must be reset manually. Only the
+ //! characters A,C,G,T are allowed, all other characters will throw an
+ //! exception (except for newlines, which will be discarded).
+ //!
+ //! \param seq The new Kmer sequence string
+ //! \pre seq can be longer than MAX_LENGTH (255) bases
+ //! \pre seqchar is A,C,G,T (case insensitive)
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void setSeqString (const std::string & seq);
+
+
+ //--------------------------------------------------- operator++ -------------
+ //! \brief Increments kmer count by 1 (postfix)
+ //!
+ //! Increment the kmer count by 1 using postfix notation, i.e. mykmer ++;
+ //!
+ //! \return This kmer, after incrementation
+ //!
+ Kmer_t & operator++ (int)
+ {
+ count_m ++;
+ return *this;
+ }
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+
+ //--------------------------------------------------- operator= --------------
+ //! \brief Assignment (copy) operator
+ //!
+ //! Efficiently copies the compressed data from the another Kmer_t.
+ //!
+ //! \param source The Kmer_t object to copy
+ //! \return The resulting Kmer_t object
+ //!
+ Kmer_t & operator= (const Kmer_t & source);
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Kmer_AMOS_HH
diff --git a/src/AMOS/Layout_AMOS.cc b/src/AMOS/Layout_AMOS.cc
new file mode 100644
index 0000000..925cfc6
--- /dev/null
+++ b/src/AMOS/Layout_AMOS.cc
@@ -0,0 +1,142 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 07/08/2004
+//!
+//! \brief Source for Layout_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Layout_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ Layout_t ====================
+const NCode_t Layout_t::NCODE = M_LAYOUT;
+
+
+//----------------------------------------------------- getSpan ----------------
+Size_t Layout_t::getSpan ( ) const
+{
+ Pos_t hi,lo;
+
+ if ( tiles_m . empty( ) )
+ {
+ hi = 0;
+ lo = 0;
+ }
+ else
+ {
+ hi = -(MAX_POS);
+ lo = MAX_POS;
+ }
+
+ vector<Tile_t>::const_iterator ti;
+ for ( ti = tiles_m . begin( ); ti != tiles_m . end( ); ++ ti )
+ {
+ if ( ti -> offset < lo )
+ lo = ti -> offset;
+ if ( ti -> offset + ti -> range . getLength( ) > hi )
+ hi = ti -> offset + ti -> range . getLength( );
+ }
+
+ return hi - lo;
+}
+
+
+//----------------------------------------------------- readMessage ------------
+void Layout_t::readMessage (const Message_t & msg)
+{
+ Universal_t::readMessage (msg);
+
+ try {
+ Tile_t tile;
+ vector<Message_t>::const_iterator vi;
+
+ for ( vi = msg . getSubMessages( ) . begin( );
+ vi != msg . getSubMessages( ) . end( ); vi ++ )
+ {
+ if ( vi -> getMessageCode( ) == M_TILE )
+ {
+ tile . readMessage (*vi);
+ tiles_m . push_back (tile);
+ }
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Layout_t::readRecord (istream & fix, istream & var)
+{
+ Universal_t::readRecord (fix, var);
+
+ Size_t size;
+ readLE (fix, &size);
+
+ tiles_m . resize (size);
+ for ( Pos_t i = 0; i < size; i ++ )
+ tiles_m [i] . readRecord (var);
+}
+
+
+
+//----------------------------------------------------- readRecordFix ----------
+void Layout_t::readRecordFix (istream & fix)
+{
+ Universal_t::readRecordFix (fix);
+
+ Size_t size;
+ readLE (fix, &size);
+
+ tiles_m . clear();
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Layout_t::writeMessage (Message_t & msg) const
+{
+ Universal_t::writeMessage (msg);
+
+ try {
+
+ msg . setMessageCode (Layout_t::NCODE);
+
+ if ( !tiles_m . empty( ) )
+ {
+ vector<Tile_t>::const_iterator tvi;
+ Pos_t begin = msg . getSubMessages( ) . size( );
+ Pos_t end = begin + tiles_m . size( );
+ msg . getSubMessages( ) . resize (end);
+
+ for ( tvi = tiles_m . begin( ); tvi != tiles_m . end( ); tvi ++ )
+ tvi -> writeMessage (msg . getSubMessages( ) [begin ++]);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Layout_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Universal_t::writeRecord (fix, var);
+
+ Size_t size = tiles_m . size( );
+ writeLE (fix, &size);
+
+ for ( Pos_t i = 0; i < size; i ++ )
+ tiles_m [i] . writeRecord (var);
+}
diff --git a/src/AMOS/Layout_AMOS.hh b/src/AMOS/Layout_AMOS.hh
new file mode 100644
index 0000000..52b13fe
--- /dev/null
+++ b/src/AMOS/Layout_AMOS.hh
@@ -0,0 +1,155 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 07/08/2004
+//!
+//! \brief Header for Layout_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Layout_AMOS_HH
+#define __Layout_AMOS_HH 1
+
+#include "Universal_AMOS.hh"
+#include <vector>
+
+
+
+
+
+namespace AMOS {
+
+//================================================ Layout_t ====================
+//! \brief A layout of sequences
+//!
+//! A Layout_t is simply a collection of sequences and offsets describing how
+//! each sequence is positioned in relation to all other sequences. If the
+//! layout is in relation to some reference sequence, a vector of alignment
+//! gaps is provided for storing the alignment information.
+//!
+//==============================================================================
+class Layout_t : public Universal_t
+{
+
+protected:
+
+ std::vector<Tile_t> tiles_m; //!< sequence tiling
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //--------------------------------------------------- Layout_t ---------------
+ //! \brief Constructs an empty Layout_t object
+ //!
+ Layout_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- Layout_t ---------------
+ //! \brief Copy constructor
+ //!
+ Layout_t (const Layout_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~Layout_t --------------
+ //! \brief Destroys a Layout_t object
+ //!
+ ~Layout_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ Universal_t::clear( );
+ tiles_m . clear( );
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Layout_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getSpan ----------------
+ //! \brief Get the span of the layout
+ //!
+ //! Returns the difference between min(offset) and max(offset+len). Since the
+ //! layout is not necessarily sorted, this method requires linear time.
+ //!
+ //! \return The span of the layout
+ //!
+ Size_t getSpan ( ) const;
+
+
+ //--------------------------------------------------- getTiling --------------
+ //! \brief Get the sequence tiling
+ //!
+ //! \return The vector of underlying sequences
+ //!
+ const std::vector<Tile_t> & getTiling ( ) const
+ {
+ return tiles_m;
+ }
+
+
+ //--------------------------------------------------- getTiling --------------
+ //! \brief Get the sequence tiling
+ //!
+ //! \return The vector of underlying sequences
+ //!
+ std::vector<Tile_t> & getTiling ( )
+ {
+ return tiles_m;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- setTiling --------------
+ //! \brief Set the sequence tiling
+ //!
+ //! \param tiles The new vector of underlying sequences
+ //! \return void
+ //!
+ void setTiling (const std::vector<Tile_t> & tiles)
+ {
+ tiles_m = tiles;
+ }
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Layout_AMOS_HH
diff --git a/src/AMOS/Library_AMOS.cc b/src/AMOS/Library_AMOS.cc
new file mode 100644
index 0000000..eb81ada
--- /dev/null
+++ b/src/AMOS/Library_AMOS.cc
@@ -0,0 +1,89 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 10/23/2003
+//!
+//! \brief Source for Library_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Library_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ Library_t ===================
+const NCode_t Library_t::NCODE = M_LIBRARY;
+
+
+//----------------------------------------------------- readMessage ------------
+void Library_t::readMessage (const Message_t & msg)
+{
+ Oriented_t::readMessage (msg);
+
+ try {
+ vector<Message_t>::const_iterator i;
+
+ for ( i = msg . getSubMessages( ) . begin( );
+ i != msg . getSubMessages( ) . end( ); i ++ )
+ {
+ if ( i -> getMessageCode( ) == M_DISTRIBUTION )
+ {
+ dist_m . readMessage (*i);
+ }
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Library_t::readRecord (istream & fix, istream & var)
+{
+ Oriented_t::readRecord (fix, var);
+
+ dist_m . readRecord (var);
+}
+
+//----------------------------------------------------- readRecordFix ----------
+void Library_t::readRecordFix (istream & fix)
+{
+ Oriented_t::readRecordFix (fix);
+
+ dist_m . clear();
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Library_t::writeMessage (Message_t & msg) const
+{
+ Oriented_t::writeMessage (msg);
+
+ try {
+
+ msg . setMessageCode (Library_t::NCODE);
+
+ msg . getSubMessages( ) . resize (1);
+ dist_m . writeMessage (msg . getSubMessages( ) [0]);
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Library_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Oriented_t::writeRecord (fix, var);
+
+ dist_m . writeRecord (var);
+}
diff --git a/src/AMOS/Library_AMOS.hh b/src/AMOS/Library_AMOS.hh
new file mode 100644
index 0000000..4b79841
--- /dev/null
+++ b/src/AMOS/Library_AMOS.hh
@@ -0,0 +1,127 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/18/2003
+//!
+//! \brief Header for Library_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Library_AMOS_HH
+#define __Library_AMOS_HH 1
+
+#include "Universal_AMOS.hh"
+
+
+
+namespace AMOS {
+
+typedef Adjacency_t LibraryAdjacency_t;
+
+//================================================ Library_t ===================
+//! \brief A collection of cloned, size-controlled DNA molecules
+//!
+//! A DNA sequence library contains a group of child fragments that follow a
+//! certain sizing distribution. This object stores that size distribution.
+//! Child fragments will point back to this object as their parent library.
+//!
+//==============================================================================
+class Library_t : public Oriented_t
+{
+
+private:
+
+ Distribution_t dist_m; //!< the insert fragment size distribution
+
+protected:
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+ //--------------------------------------------------- Library_t --------------
+ //! \brief Constructs an empty Library_t object
+ //!
+ Library_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- Library_t --------------
+ //! \brief Copy constructor
+ //!
+ Library_t (const Library_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~Library_t -------------
+ //! \brief Destroys a Library_t object
+ //!
+ ~Library_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ Oriented_t::clear( );
+ dist_m . clear( );
+ }
+
+
+ //--------------------------------------------------- getDistribution --------
+ //! \brief Get the insert fragment size distribution
+ //!
+ //! \return The insert fragment size distribution
+ //!
+ Distribution_t getDistribution ( ) const
+ {
+ return dist_m;
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Library_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- setDistribution --------
+ //! \brief Set the insert fragment size distribution
+ //!
+ //! \param dist The new insert fragment size distribution
+ //! \return void
+ //!
+ void setDistribution (Distribution_t dist)
+ {
+ dist_m = dist;
+ }
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Library_AMOS_HH
diff --git a/src/AMOS/Link_AMOS.cc b/src/AMOS/Link_AMOS.cc
new file mode 100644
index 0000000..cd73c2e
--- /dev/null
+++ b/src/AMOS/Link_AMOS.cc
@@ -0,0 +1,241 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 04/12/2005
+//!
+//! \brief Source for Link_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Link_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//====================================================== Link_t ================
+const NCode_t Link_t::NCODE = M_LINK;
+
+
+//----------------------------------------------------- clear ------------------
+void Link_t::clear ( )
+{
+ Oriented_t::clear( );
+ nods_m . first = nods_m . second = source_m . first = NULL_ID;
+ source_m . second = NULL_NCODE;
+ nodtype_m = NULL_NCODE;
+ sd_m = size_m = 0;
+ type_m = NULL_LINK;
+}
+
+
+//----------------------------------------------------- flip -------------------
+void Link_t::flip ( )
+{
+ LinkAdjacency_t la = getAdjacency( );
+ if ( la == NORMAL )
+ setAdjacency (ANTINORMAL);
+ else if ( la == ANTINORMAL )
+ setAdjacency (NORMAL);
+
+ nods_m = std::make_pair (nods_m . second, nods_m . first);
+}
+
+
+//----------------------------------------------------- readMessage ------------
+void Link_t::readMessage (const Message_t & msg)
+{
+ Oriented_t::readMessage (msg);
+
+ try {
+
+ istringstream ss;
+
+ if ( msg . exists (F_NODES) )
+ {
+ ss . str (msg . getField (F_NODES));
+ ss >> nods_m . first;
+ ss . ignore( );
+ ss >> nods_m . second;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid nodes format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_OBJECT) )
+ {
+ string str;
+
+ ss . str (msg . getField (F_OBJECT));
+ ss >> str;
+ if ( !ss || str . length( ) != NCODE_SIZE )
+ AMOS_THROW_ARGUMENT ("Invalid object type format");
+ ss . clear( );
+ nodtype_m = Encode (str);
+ }
+
+ if ( msg . exists (F_SD) )
+ {
+ ss . str (msg . getField (F_SD));
+ ss >> sd_m;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid standard deviation format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_SIZE) )
+ {
+ ss . str (msg . getField (F_SIZE));
+ ss >> size_m;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid size format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_TYPE) )
+ {
+ ss . str (msg . getField (F_TYPE));
+ setType (ss . get( ));
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_SOURCE) )
+ {
+ string str;
+
+ ss . str (msg . getField (F_SOURCE));
+ ss >> source_m . first;
+ ss . ignore( );
+ ss >> str;
+ if ( !ss || str . length( ) != NCODE_SIZE )
+ AMOS_THROW_ARGUMENT ("Invalid source format");
+ ss . clear( );
+ source_m . second = Encode (str);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Link_t::readRecord (istream & fix, istream & var)
+{
+ Oriented_t::readRecord (fix, var);
+
+ readLE (fix, &(nods_m . first));
+ readLE (fix, &(nods_m . second));
+ readLE (fix, &nodtype_m);
+ readLE (fix, &sd_m);
+ readLE (fix, &size_m);
+ readLE (fix, &(source_m . first));
+ readLE (fix, &(source_m . second));
+}
+
+
+//----------------------------------------------------- readRecordFix ----------
+void Link_t::readRecordFix (istream & fix)
+{
+ Oriented_t::readRecordFix (fix);
+
+ readLE (fix, &(nods_m . first));
+ readLE (fix, &(nods_m . second));
+ readLE (fix, &nodtype_m);
+ readLE (fix, &sd_m);
+ readLE (fix, &size_m);
+ readLE (fix, &(source_m . first));
+ readLE (fix, &(source_m . second));
+}
+
+
+//----------------------------------------------------- setType ----------------
+void Link_t::setType (LinkType_t type)
+{
+ switch (type)
+ {
+ case NULL_LINK:
+ case OTHER:
+ case MATEPAIR:
+ case OVERLAP:
+ case PHYSICAL:
+ case ALIGNMENT:
+ case SYNTENY:
+ type_m = type;
+ break;
+ default:
+ AMOS_THROW_ARGUMENT ((string)"Invalid contig link type " + type);
+ }
+ type_m = type;
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Link_t::writeMessage (Message_t & msg) const
+{
+ Oriented_t::writeMessage (msg);
+
+ try {
+ ostringstream ss;
+
+ msg . setMessageCode (Link_t::NCODE);
+
+ if ( nods_m . first != NULL_ID || nods_m . second != NULL_ID )
+ {
+ ss << nods_m . first << ',' << nods_m . second;
+ msg . setField (F_NODES, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( nodtype_m != NULL_NCODE )
+ {
+ msg . setField (F_OBJECT, Decode (nodtype_m));
+ ss . str (NULL_STRING);
+ }
+
+ ss << sd_m;
+ msg . setField (F_SD, ss . str( ));
+ ss . str (NULL_STRING);
+
+ ss << size_m;
+ msg . setField (F_SIZE, ss . str( ));
+ ss . str (NULL_STRING);
+
+ if ( type_m != NULL_LINK )
+ {
+ ss << type_m;
+ msg . setField (F_TYPE, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( source_m . first != NULL_ID || source_m . second != NULL_NCODE )
+ {
+ ss << source_m . first << ',' << Decode (source_m . second);
+ msg . setField (F_SOURCE, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Link_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Oriented_t::writeRecord (fix, var);
+
+ writeLE (fix, &(nods_m . first));
+ writeLE (fix, &(nods_m . second));
+ writeLE (fix, &nodtype_m);
+ writeLE (fix, &sd_m);
+ writeLE (fix, &size_m);
+ writeLE (fix, &(source_m . first));
+ writeLE (fix, &(source_m . second));
+}
diff --git a/src/AMOS/Link_AMOS.hh b/src/AMOS/Link_AMOS.hh
new file mode 100644
index 0000000..20f8997
--- /dev/null
+++ b/src/AMOS/Link_AMOS.hh
@@ -0,0 +1,291 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 04/12/2005
+//!
+//! \brief Header for Link_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Link_AMOS_HH
+#define __Link_AMOS_HH 1
+
+#include "Universal_AMOS.hh"
+#include <utility>
+
+
+
+
+namespace AMOS {
+
+typedef char LinkType_t;
+typedef Adjacency_t LinkAdjacency_t;
+
+//====================================================== Link_t ================
+//! \brief Linking information between two nodes, such as between contigs
+//!
+//! A single piece of linking information between two nodes. For example, a
+//! probable extension of this class would be a ContigLink_t to represent an
+//! inferred relationship between two contigs. These atomic links can be
+//! bundled together to form an Edge_t.
+//!
+//==============================================================================
+class Link_t : public Oriented_t
+{
+
+private:
+
+ std::pair<ID_t, ID_t> nods_m; //!< the pair of nodes
+ std::pair<ID_t, NCode_t> source_m; //!< source of the link
+ NCode_t nodtype_m; //!< the type node object
+ SD_t sd_m; //!< standard deviation of the link
+ Size_t size_m; //!< size of the link
+ LinkType_t type_m; //!< type of link
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+ static const LinkType_t NULL_LINK = 0;
+ static const LinkType_t OTHER = 'X';
+ static const LinkType_t MATEPAIR = 'M';
+ static const LinkType_t OVERLAP = 'O';
+ static const LinkType_t PHYSICAL = 'P';
+ static const LinkType_t ALIGNMENT = 'A';
+ static const LinkType_t SYNTENY = 'S';
+
+ //--------------------------------------------------------- Link_t -----------
+ //! \brief Constructs an empty Link_t object
+ //!
+ //! Sets all members to zero or NULL
+ //!
+ Link_t ( )
+ {
+ nods_m . first = nods_m . second = source_m . first = NULL_ID;
+ source_m . second = NULL_NCODE;
+ nodtype_m = NULL_NCODE;
+ sd_m = size_m = 0;
+ type_m = NULL_LINK;
+ }
+
+
+ //--------------------------------------------------------- Link_t -----------
+ //! \brief Copy constructor
+ //!
+ Link_t (const Link_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------------- ~Link_t ----------
+ //! \brief Destroys a Link_t object
+ //!
+ ~Link_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( );
+
+
+ //--------------------------------------------------- flip -------------------
+ //! \brief Flip the orientation of the link
+ //!
+ //! Reverses the order of the IIDs and changes the adjacency as altered by
+ //! the new orientation of the nodes. Does not alter adjacency if it is
+ //! currently a NULL_ADJACENCY. After flip, NORMAL become ANTINORMAL,
+ //! ANTINORMAL becomes NORMAL, and INNIE and OUTIE remain the same.
+ //!
+ //! \return void
+ //!
+ void flip ( );
+
+
+ //----------------------------------------------------- getNodes -------------
+ //! \brief Get the pair of node IIDs joined by this link
+ //!
+ //! \return The first and second node IIDs joined by this link
+ //!
+ std::pair<ID_t, ID_t> getNodes ( ) const
+ {
+ return nods_m;
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Link_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getSD ------------------
+ //! \brief Get the standard deviation of the link size
+ //!
+ //! \return The standard deviation of the link
+ //!
+ SD_t getSD ( ) const
+ {
+ return sd_m;
+ }
+
+
+ //--------------------------------------------------- getSize ----------------
+ //! \brief Get the weight/size of the link
+ //!
+ //! \return The weight/size of the link
+ //!
+ Size_t getSize ( ) const
+ {
+ return size_m;
+ }
+
+
+ //--------------------------------------------------- getSource --------------
+ //! \brief Get the link source IID and type
+ //!
+ //! This method only returns the IID of the link source and the object type.
+ //! The entire source object can be obtained by fetching the specified IID
+ //! from the corresponding bank.
+ //!
+ //! \return The IID of the link source and the NCode type indentifier
+ //!
+ std::pair<ID_t, NCode_t> getSource ( ) const
+ {
+ return source_m;
+ }
+
+
+ //----------------------------------------------------- getNodeType ----------
+ //! \brief Get the node type
+ //!
+ //! Describes the type of IID the nodes represent.
+ //!
+ //! \return The node type
+ //!
+ NCode_t getNodeType( ) const
+ {
+ return nodtype_m;
+ }
+
+
+ //--------------------------------------------------- getType ----------------
+ //! \brief Get the link type
+ //!
+ //! Describes the type of link this object represents.
+ //!
+ //! \return The type of link
+ //!
+ LinkType_t getType ( ) const
+ {
+ return type_m;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //----------------------------------------------------- setNodes -------------
+ //! \brief Set the node IID pair for this link
+ //!
+ //! Only returns the IIDs of the nodes. It is up to the user to keep track
+ //! of where the actual node objects are stored.
+ //!
+ //! \param nods The new pair of node IIDs
+ //! \return void
+ //!
+ void setNodes (std::pair<ID_t, ID_t> nods)
+ {
+ nods_m = nods;
+ }
+
+
+ //----------------------------------------------------- setNodeType ----------
+ //! \brief Set the type of node
+ //!
+ //! Describes the type of IID the nodes represent.
+ //!
+ //! \param nodtype The new node type
+ //! \return void
+ //!
+ void setNodeType (NCode_t nodtype)
+ {
+ nodtype_m = nodtype;
+ }
+
+
+ //--------------------------------------------------- setSD ------------------
+ //! \brief Set the standard deviation of the link size
+ //!
+ //! \param sd The new standard deviation for the link size
+ //! \return void
+ //!
+ void setSD (SD_t sd)
+ {
+ sd_m = sd;
+ }
+
+
+ //--------------------------------------------------- setSize ----------------
+ //! \brief Set the weight/size of the link
+ //!
+ //! \param size The new link weight/size
+ //! \return void
+ //!
+ void setSize (Size_t size)
+ {
+ size_m = size;
+ }
+
+
+ //--------------------------------------------------- setSource --------------
+ //! \brief Set the link source IID
+ //!
+ //! \param source The new IID and NCode type identifier of the link source
+ //! \return void
+ //!
+ void setSource (std::pair<ID_t, NCode_t> source)
+ {
+ source_m = source;
+ }
+
+
+ //--------------------------------------------------- setType ----------------
+ //! \brief Set the linking type
+ //!
+ //! \param type The new link type
+ //! \pre type is one of [XMOPAS] or NULL
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void setType (LinkType_t type);
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Link_AMOS_HH
diff --git a/src/AMOS/Makefile.am b/src/AMOS/Makefile.am
new file mode 100644
index 0000000..b521dbd
--- /dev/null
+++ b/src/AMOS/Makefile.am
@@ -0,0 +1,127 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+##-- TO BE INSTALLED
+amoslib_LIBRARIES = \
+ libAMOS.a
+
+amosinclude_HEADERS = \
+ BankStream_AMOS.hh \
+ Bank_AMOS.hh \
+ ContigEdge_AMOS.hh \
+ ContigIterator_AMOS.hh \
+ ContigLink_AMOS.hh \
+ Motif_AMOS.hh \
+ Contig_AMOS.hh \
+ Edge_AMOS.hh \
+ Feature_AMOS.hh \
+ Fragment_AMOS.hh \
+ Group_AMOS.hh \
+ IDMap_AMOS.hh \
+ Index_AMOS.hh \
+ Kmer_AMOS.hh \
+ Layout_AMOS.hh \
+ Library_AMOS.hh \
+ Link_AMOS.hh \
+ Message_AMOS.hh \
+ Overlap_AMOS.hh \
+ Read_AMOS.hh \
+ ScaffoldEdge_AMOS.hh \
+ ScaffoldLink_AMOS.hh \
+ Scaffold_AMOS.hh \
+ Sequence_AMOS.hh \
+ Universal_AMOS.hh \
+ databanks_AMOS.hh \
+ datatypes_AMOS.hh \
+ exceptions_AMOS.hh \
+ foundation_AMOS.hh \
+ inttypes_AMOS.hh \
+ messages_AMOS.hh \
+ universals_AMOS.hh \
+ utility_AMOS.hh
+
+
+##-- TO BE TESTED
+check_PROGRAMS = \
+ banktest \
+ maptest \
+ msgtest \
+ streamtest \
+ umdtest
+
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common
+
+
+##-- banktest
+banktest_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+banktest_SOURCES = \
+ banktest.cc
+
+##-- maptest
+maptest_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+maptest_SOURCES = \
+ maptest.cc
+
+##-- msgtest
+msgtest_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+msgtest_SOURCES = \
+ msgtest.cc
+
+##-- streamtest
+streamtest_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+streamtest_SOURCES = \
+ streamtest.cc
+
+##-- umdtest
+umdtest_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+umdtest_SOURCES = \
+ umdtest.cc
+
+##-- libAMOS.a
+libAMOS_a_CPPFLAGS =
+ -I$(top_builddir)/src/GNU
+ ## because some system headers will be built if necessary
+libAMOS_a_LIBADD = \
+ $(LIBOBJS:%=$(top_builddir)/src/GNU/%)
+libAMOS_a_SOURCES = \
+ BankStream_AMOS.cc \
+ Bank_AMOS.cc \
+ ContigEdge_AMOS.cc \
+ ContigIterator_AMOS.cc \
+ ContigLink_AMOS.cc \
+ Motif_AMOS.cc \
+ Contig_AMOS.cc \
+ Edge_AMOS.cc \
+ Feature_AMOS.cc \
+ Fragment_AMOS.cc \
+ Group_AMOS.cc \
+ IDMap_AMOS.cc \
+ Index_AMOS.cc \
+ Kmer_AMOS.cc \
+ Layout_AMOS.cc \
+ Library_AMOS.cc \
+ Link_AMOS.cc \
+ Message_AMOS.cc \
+ Overlap_AMOS.cc \
+ Read_AMOS.cc \
+ ScaffoldEdge_AMOS.cc \
+ ScaffoldLink_AMOS.cc \
+ Scaffold_AMOS.cc \
+ Sequence_AMOS.cc \
+ Universal_AMOS.cc \
+ datatypes_AMOS.cc \
+ universals_AMOS.cc \
+ utility_AMOS.cc
+
+
+##-- END OF MAKEFILE --##
diff --git a/src/AMOS/Makefile.in b/src/AMOS/Makefile.in
new file mode 100644
index 0000000..321d7c2
--- /dev/null
+++ b/src/AMOS/Makefile.in
@@ -0,0 +1,1191 @@
+# 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 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@
+DIST_COMMON = $(amosinclude_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+check_PROGRAMS = banktest$(EXEEXT) maptest$(EXEEXT) msgtest$(EXEEXT) \
+ streamtest$(EXEEXT) umdtest$(EXEEXT)
+subdir = src/AMOS
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(amoslibdir)" \
+ "$(DESTDIR)$(amosincludedir)"
+LIBRARIES = $(amoslib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libAMOS_a_AR = $(AR) $(ARFLAGS)
+libAMOS_a_DEPENDENCIES = $(LIBOBJS:%=$(top_builddir)/src/GNU/%)
+am_libAMOS_a_OBJECTS = libAMOS_a-BankStream_AMOS.$(OBJEXT) \
+ libAMOS_a-Bank_AMOS.$(OBJEXT) \
+ libAMOS_a-ContigEdge_AMOS.$(OBJEXT) \
+ libAMOS_a-ContigIterator_AMOS.$(OBJEXT) \
+ libAMOS_a-ContigLink_AMOS.$(OBJEXT) \
+ libAMOS_a-Motif_AMOS.$(OBJEXT) libAMOS_a-Contig_AMOS.$(OBJEXT) \
+ libAMOS_a-Edge_AMOS.$(OBJEXT) libAMOS_a-Feature_AMOS.$(OBJEXT) \
+ libAMOS_a-Fragment_AMOS.$(OBJEXT) \
+ libAMOS_a-Group_AMOS.$(OBJEXT) libAMOS_a-IDMap_AMOS.$(OBJEXT) \
+ libAMOS_a-Index_AMOS.$(OBJEXT) libAMOS_a-Kmer_AMOS.$(OBJEXT) \
+ libAMOS_a-Layout_AMOS.$(OBJEXT) \
+ libAMOS_a-Library_AMOS.$(OBJEXT) libAMOS_a-Link_AMOS.$(OBJEXT) \
+ libAMOS_a-Message_AMOS.$(OBJEXT) \
+ libAMOS_a-Overlap_AMOS.$(OBJEXT) libAMOS_a-Read_AMOS.$(OBJEXT) \
+ libAMOS_a-ScaffoldEdge_AMOS.$(OBJEXT) \
+ libAMOS_a-ScaffoldLink_AMOS.$(OBJEXT) \
+ libAMOS_a-Scaffold_AMOS.$(OBJEXT) \
+ libAMOS_a-Sequence_AMOS.$(OBJEXT) \
+ libAMOS_a-Universal_AMOS.$(OBJEXT) \
+ libAMOS_a-datatypes_AMOS.$(OBJEXT) \
+ libAMOS_a-universals_AMOS.$(OBJEXT) \
+ libAMOS_a-utility_AMOS.$(OBJEXT)
+libAMOS_a_OBJECTS = $(am_libAMOS_a_OBJECTS)
+am_banktest_OBJECTS = banktest.$(OBJEXT)
+banktest_OBJECTS = $(am_banktest_OBJECTS)
+banktest_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_maptest_OBJECTS = maptest.$(OBJEXT)
+maptest_OBJECTS = $(am_maptest_OBJECTS)
+maptest_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a
+am_msgtest_OBJECTS = msgtest.$(OBJEXT)
+msgtest_OBJECTS = $(am_msgtest_OBJECTS)
+msgtest_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a
+am_streamtest_OBJECTS = streamtest.$(OBJEXT)
+streamtest_OBJECTS = $(am_streamtest_OBJECTS)
+streamtest_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a
+am_umdtest_OBJECTS = umdtest.$(OBJEXT)
+umdtest_OBJECTS = $(am_umdtest_OBJECTS)
+umdtest_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(libAMOS_a_SOURCES) $(banktest_SOURCES) $(maptest_SOURCES) \
+ $(msgtest_SOURCES) $(streamtest_SOURCES) $(umdtest_SOURCES)
+DIST_SOURCES = $(libAMOS_a_SOURCES) $(banktest_SOURCES) \
+ $(maptest_SOURCES) $(msgtest_SOURCES) $(streamtest_SOURCES) \
+ $(umdtest_SOURCES)
+HEADERS = $(amosinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+amoslib_LIBRARIES = \
+ libAMOS.a
+
+amosinclude_HEADERS = \
+ BankStream_AMOS.hh \
+ Bank_AMOS.hh \
+ ContigEdge_AMOS.hh \
+ ContigIterator_AMOS.hh \
+ ContigLink_AMOS.hh \
+ Motif_AMOS.hh \
+ Contig_AMOS.hh \
+ Edge_AMOS.hh \
+ Feature_AMOS.hh \
+ Fragment_AMOS.hh \
+ Group_AMOS.hh \
+ IDMap_AMOS.hh \
+ Index_AMOS.hh \
+ Kmer_AMOS.hh \
+ Layout_AMOS.hh \
+ Library_AMOS.hh \
+ Link_AMOS.hh \
+ Message_AMOS.hh \
+ Overlap_AMOS.hh \
+ Read_AMOS.hh \
+ ScaffoldEdge_AMOS.hh \
+ ScaffoldLink_AMOS.hh \
+ Scaffold_AMOS.hh \
+ Sequence_AMOS.hh \
+ Universal_AMOS.hh \
+ databanks_AMOS.hh \
+ datatypes_AMOS.hh \
+ exceptions_AMOS.hh \
+ foundation_AMOS.hh \
+ inttypes_AMOS.hh \
+ messages_AMOS.hh \
+ universals_AMOS.hh \
+ utility_AMOS.hh
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common
+
+banktest_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+banktest_SOURCES = \
+ banktest.cc
+
+maptest_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+maptest_SOURCES = \
+ maptest.cc
+
+msgtest_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+msgtest_SOURCES = \
+ msgtest.cc
+
+streamtest_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+streamtest_SOURCES = \
+ streamtest.cc
+
+umdtest_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+umdtest_SOURCES = \
+ umdtest.cc
+
+libAMOS_a_CPPFLAGS =
+libAMOS_a_LIBADD = \
+ $(LIBOBJS:%=$(top_builddir)/src/GNU/%)
+
+libAMOS_a_SOURCES = \
+ BankStream_AMOS.cc \
+ Bank_AMOS.cc \
+ ContigEdge_AMOS.cc \
+ ContigIterator_AMOS.cc \
+ ContigLink_AMOS.cc \
+ Motif_AMOS.cc \
+ Contig_AMOS.cc \
+ Edge_AMOS.cc \
+ Feature_AMOS.cc \
+ Fragment_AMOS.cc \
+ Group_AMOS.cc \
+ IDMap_AMOS.cc \
+ Index_AMOS.cc \
+ Kmer_AMOS.cc \
+ Layout_AMOS.cc \
+ Library_AMOS.cc \
+ Link_AMOS.cc \
+ Message_AMOS.cc \
+ Overlap_AMOS.cc \
+ Read_AMOS.cc \
+ ScaffoldEdge_AMOS.cc \
+ ScaffoldLink_AMOS.cc \
+ Scaffold_AMOS.cc \
+ Sequence_AMOS.cc \
+ Universal_AMOS.cc \
+ datatypes_AMOS.cc \
+ universals_AMOS.cc \
+ utility_AMOS.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/AMOS/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/AMOS/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):
+install-amoslibLIBRARIES: $(amoslib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(amoslibdir)" || $(MKDIR_P) "$(DESTDIR)$(amoslibdir)"
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(amoslibdir)'"; \
+ $(INSTALL_DATA) $$list2 "$(DESTDIR)$(amoslibdir)" || exit $$?; }
+ @$(POST_INSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ for p in $$list; do \
+ if test -f $$p; then \
+ $(am__strip_dir) \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && $(RANLIB) $$f )"; \
+ ( cd "$(DESTDIR)$(amoslibdir)" && $(RANLIB) $$f ) || exit $$?; \
+ else :; fi; \
+ done
+
+uninstall-amoslibLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && rm -f "$$files" )"; \
+ cd "$(DESTDIR)$(amoslibdir)" && rm -f $$files
+
+clean-amoslibLIBRARIES:
+ -test -z "$(amoslib_LIBRARIES)" || rm -f $(amoslib_LIBRARIES)
+libAMOS.a: $(libAMOS_a_OBJECTS) $(libAMOS_a_DEPENDENCIES)
+ -rm -f libAMOS.a
+ $(libAMOS_a_AR) libAMOS.a $(libAMOS_a_OBJECTS) $(libAMOS_a_LIBADD)
+ $(RANLIB) libAMOS.a
+
+clean-checkPROGRAMS:
+ -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+banktest$(EXEEXT): $(banktest_OBJECTS) $(banktest_DEPENDENCIES)
+ @rm -f banktest$(EXEEXT)
+ $(CXXLINK) $(banktest_OBJECTS) $(banktest_LDADD) $(LIBS)
+maptest$(EXEEXT): $(maptest_OBJECTS) $(maptest_DEPENDENCIES)
+ @rm -f maptest$(EXEEXT)
+ $(CXXLINK) $(maptest_OBJECTS) $(maptest_LDADD) $(LIBS)
+msgtest$(EXEEXT): $(msgtest_OBJECTS) $(msgtest_DEPENDENCIES)
+ @rm -f msgtest$(EXEEXT)
+ $(CXXLINK) $(msgtest_OBJECTS) $(msgtest_LDADD) $(LIBS)
+streamtest$(EXEEXT): $(streamtest_OBJECTS) $(streamtest_DEPENDENCIES)
+ @rm -f streamtest$(EXEEXT)
+ $(CXXLINK) $(streamtest_OBJECTS) $(streamtest_LDADD) $(LIBS)
+umdtest$(EXEEXT): $(umdtest_OBJECTS) $(umdtest_DEPENDENCIES)
+ @rm -f umdtest$(EXEEXT)
+ $(CXXLINK) $(umdtest_OBJECTS) $(umdtest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/banktest.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-BankStream_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Bank_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-ContigEdge_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-ContigIterator_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-ContigLink_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Contig_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Edge_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Feature_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Fragment_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Group_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-IDMap_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Index_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Kmer_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Layout_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Library_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Link_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Message_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Motif_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Overlap_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Read_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-ScaffoldEdge_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-ScaffoldLink_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Scaffold_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Sequence_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-Universal_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-datatypes_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-universals_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libAMOS_a-utility_AMOS.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/maptest.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/msgtest.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/streamtest.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/umdtest.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+
+libAMOS_a-BankStream_AMOS.o: BankStream_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-BankStream_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-BankStream_AMOS.Tpo -c -o libAMOS_a-BankStream_AMOS.o `test -f 'BankStream_AMOS.cc' || echo '$(srcdir)/'`BankStream_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-BankStream_AMOS.Tpo $(DEPDIR)/libAMOS_a-BankStream_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='BankStream_AMOS.cc' object='libAMOS_a-BankStream_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-BankStream_AMOS.o `test -f 'BankStream_AMOS.cc' || echo '$(srcdir)/'`BankStream_AMOS.cc
+
+libAMOS_a-BankStream_AMOS.obj: BankStream_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-BankStream_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-BankStream_AMOS.Tpo -c -o libAMOS_a-BankStream_AMOS.obj `if test -f 'BankStream_AMOS.cc'; then $(CYGPATH_W) 'BankStream_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/BankStream_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-BankStream_AMOS.Tpo $(DEPDIR)/libAMOS_a-BankStream_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='BankStream_AMOS.cc' object='libAMOS_a-BankStream_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-BankStream_AMOS.obj `if test -f 'BankStream_AMOS.cc'; then $(CYGPATH_W) 'BankStream_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/BankStream_AMOS.cc'; fi`
+
+libAMOS_a-Bank_AMOS.o: Bank_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Bank_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Bank_AMOS.Tpo -c -o libAMOS_a-Bank_AMOS.o `test -f 'Bank_AMOS.cc' || echo '$(srcdir)/'`Bank_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Bank_AMOS.Tpo $(DEPDIR)/libAMOS_a-Bank_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Bank_AMOS.cc' object='libAMOS_a-Bank_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Bank_AMOS.o `test -f 'Bank_AMOS.cc' || echo '$(srcdir)/'`Bank_AMOS.cc
+
+libAMOS_a-Bank_AMOS.obj: Bank_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Bank_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Bank_AMOS.Tpo -c -o libAMOS_a-Bank_AMOS.obj `if test -f 'Bank_AMOS.cc'; then $(CYGPATH_W) 'Bank_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Bank_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Bank_AMOS.Tpo $(DEPDIR)/libAMOS_a-Bank_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Bank_AMOS.cc' object='libAMOS_a-Bank_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Bank_AMOS.obj `if test -f 'Bank_AMOS.cc'; then $(CYGPATH_W) 'Bank_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Bank_AMOS.cc'; fi`
+
+libAMOS_a-ContigEdge_AMOS.o: ContigEdge_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-ContigEdge_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-ContigEdge_AMOS.Tpo -c -o libAMOS_a-ContigEdge_AMOS.o `test -f 'ContigEdge_AMOS.cc' || echo '$(srcdir)/'`ContigEdge_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-ContigEdge_AMOS.Tpo $(DEPDIR)/libAMOS_a-ContigEdge_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ContigEdge_AMOS.cc' object='libAMOS_a-ContigEdge_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-ContigEdge_AMOS.o `test -f 'ContigEdge_AMOS.cc' || echo '$(srcdir)/'`ContigEdge_AMOS.cc
+
+libAMOS_a-ContigEdge_AMOS.obj: ContigEdge_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-ContigEdge_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-ContigEdge_AMOS.Tpo -c -o libAMOS_a-ContigEdge_AMOS.obj `if test -f 'ContigEdge_AMOS.cc'; then $(CYGPATH_W) 'ContigEdge_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/ContigEdge_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-ContigEdge_AMOS.Tpo $(DEPDIR)/libAMOS_a-ContigEdge_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ContigEdge_AMOS.cc' object='libAMOS_a-ContigEdge_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-ContigEdge_AMOS.obj `if test -f 'ContigEdge_AMOS.cc'; then $(CYGPATH_W) 'ContigEdge_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/ContigEdge_AMOS.cc'; fi`
+
+libAMOS_a-ContigIterator_AMOS.o: ContigIterator_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-ContigIterator_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-ContigIterator_AMOS.Tpo -c -o libAMOS_a-ContigIterator_AMOS.o `test -f 'ContigIterator_AMOS.cc' || echo '$(srcdir)/'`ContigIterator_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-ContigIterator_AMOS.Tpo $(DEPDIR)/libAMOS_a-ContigIterator_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ContigIterator_AMOS.cc' object='libAMOS_a-ContigIterator_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-ContigIterator_AMOS.o `test -f 'ContigIterator_AMOS.cc' || echo '$(srcdir)/'`ContigIterator_AMOS.cc
+
+libAMOS_a-ContigIterator_AMOS.obj: ContigIterator_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-ContigIterator_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-ContigIterator_AMOS.Tpo -c -o libAMOS_a-ContigIterator_AMOS.obj `if test -f 'ContigIterator_AMOS.cc'; then $(CYGPATH_W) 'ContigIterator_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/ContigIterator_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-ContigIterator_AMOS.Tpo $(DEPDIR)/libAMOS_a-ContigIterator_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ContigIterator_AMOS.cc' object='libAMOS_a-ContigIterator_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-ContigIterator_AMOS.obj `if test -f 'ContigIterator_AMOS.cc'; then $(CYGPATH_W) 'ContigIterator_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/ContigIterator_AMOS.cc'; fi`
+
+libAMOS_a-ContigLink_AMOS.o: ContigLink_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-ContigLink_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-ContigLink_AMOS.Tpo -c -o libAMOS_a-ContigLink_AMOS.o `test -f 'ContigLink_AMOS.cc' || echo '$(srcdir)/'`ContigLink_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-ContigLink_AMOS.Tpo $(DEPDIR)/libAMOS_a-ContigLink_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ContigLink_AMOS.cc' object='libAMOS_a-ContigLink_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-ContigLink_AMOS.o `test -f 'ContigLink_AMOS.cc' || echo '$(srcdir)/'`ContigLink_AMOS.cc
+
+libAMOS_a-ContigLink_AMOS.obj: ContigLink_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-ContigLink_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-ContigLink_AMOS.Tpo -c -o libAMOS_a-ContigLink_AMOS.obj `if test -f 'ContigLink_AMOS.cc'; then $(CYGPATH_W) 'ContigLink_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/ContigLink_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-ContigLink_AMOS.Tpo $(DEPDIR)/libAMOS_a-ContigLink_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ContigLink_AMOS.cc' object='libAMOS_a-ContigLink_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-ContigLink_AMOS.obj `if test -f 'ContigLink_AMOS.cc'; then $(CYGPATH_W) 'ContigLink_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/ContigLink_AMOS.cc'; fi`
+
+libAMOS_a-Motif_AMOS.o: Motif_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Motif_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Motif_AMOS.Tpo -c -o libAMOS_a-Motif_AMOS.o `test -f 'Motif_AMOS.cc' || echo '$(srcdir)/'`Motif_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Motif_AMOS.Tpo $(DEPDIR)/libAMOS_a-Motif_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Motif_AMOS.cc' object='libAMOS_a-Motif_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Motif_AMOS.o `test -f 'Motif_AMOS.cc' || echo '$(srcdir)/'`Motif_AMOS.cc
+
+libAMOS_a-Motif_AMOS.obj: Motif_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Motif_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Motif_AMOS.Tpo -c -o libAMOS_a-Motif_AMOS.obj `if test -f 'Motif_AMOS.cc'; then $(CYGPATH_W) 'Motif_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Motif_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Motif_AMOS.Tpo $(DEPDIR)/libAMOS_a-Motif_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Motif_AMOS.cc' object='libAMOS_a-Motif_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Motif_AMOS.obj `if test -f 'Motif_AMOS.cc'; then $(CYGPATH_W) 'Motif_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Motif_AMOS.cc'; fi`
+
+libAMOS_a-Contig_AMOS.o: Contig_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Contig_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Contig_AMOS.Tpo -c -o libAMOS_a-Contig_AMOS.o `test -f 'Contig_AMOS.cc' || echo '$(srcdir)/'`Contig_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Contig_AMOS.Tpo $(DEPDIR)/libAMOS_a-Contig_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Contig_AMOS.cc' object='libAMOS_a-Contig_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Contig_AMOS.o `test -f 'Contig_AMOS.cc' || echo '$(srcdir)/'`Contig_AMOS.cc
+
+libAMOS_a-Contig_AMOS.obj: Contig_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Contig_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Contig_AMOS.Tpo -c -o libAMOS_a-Contig_AMOS.obj `if test -f 'Contig_AMOS.cc'; then $(CYGPATH_W) 'Contig_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Contig_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Contig_AMOS.Tpo $(DEPDIR)/libAMOS_a-Contig_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Contig_AMOS.cc' object='libAMOS_a-Contig_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Contig_AMOS.obj `if test -f 'Contig_AMOS.cc'; then $(CYGPATH_W) 'Contig_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Contig_AMOS.cc'; fi`
+
+libAMOS_a-Edge_AMOS.o: Edge_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Edge_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Edge_AMOS.Tpo -c -o libAMOS_a-Edge_AMOS.o `test -f 'Edge_AMOS.cc' || echo '$(srcdir)/'`Edge_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Edge_AMOS.Tpo $(DEPDIR)/libAMOS_a-Edge_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Edge_AMOS.cc' object='libAMOS_a-Edge_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Edge_AMOS.o `test -f 'Edge_AMOS.cc' || echo '$(srcdir)/'`Edge_AMOS.cc
+
+libAMOS_a-Edge_AMOS.obj: Edge_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Edge_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Edge_AMOS.Tpo -c -o libAMOS_a-Edge_AMOS.obj `if test -f 'Edge_AMOS.cc'; then $(CYGPATH_W) 'Edge_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Edge_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Edge_AMOS.Tpo $(DEPDIR)/libAMOS_a-Edge_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Edge_AMOS.cc' object='libAMOS_a-Edge_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Edge_AMOS.obj `if test -f 'Edge_AMOS.cc'; then $(CYGPATH_W) 'Edge_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Edge_AMOS.cc'; fi`
+
+libAMOS_a-Feature_AMOS.o: Feature_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Feature_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Feature_AMOS.Tpo -c -o libAMOS_a-Feature_AMOS.o `test -f 'Feature_AMOS.cc' || echo '$(srcdir)/'`Feature_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Feature_AMOS.Tpo $(DEPDIR)/libAMOS_a-Feature_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Feature_AMOS.cc' object='libAMOS_a-Feature_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Feature_AMOS.o `test -f 'Feature_AMOS.cc' || echo '$(srcdir)/'`Feature_AMOS.cc
+
+libAMOS_a-Feature_AMOS.obj: Feature_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Feature_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Feature_AMOS.Tpo -c -o libAMOS_a-Feature_AMOS.obj `if test -f 'Feature_AMOS.cc'; then $(CYGPATH_W) 'Feature_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Feature_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Feature_AMOS.Tpo $(DEPDIR)/libAMOS_a-Feature_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Feature_AMOS.cc' object='libAMOS_a-Feature_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Feature_AMOS.obj `if test -f 'Feature_AMOS.cc'; then $(CYGPATH_W) 'Feature_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Feature_AMOS.cc'; fi`
+
+libAMOS_a-Fragment_AMOS.o: Fragment_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Fragment_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Fragment_AMOS.Tpo -c -o libAMOS_a-Fragment_AMOS.o `test -f 'Fragment_AMOS.cc' || echo '$(srcdir)/'`Fragment_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Fragment_AMOS.Tpo $(DEPDIR)/libAMOS_a-Fragment_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Fragment_AMOS.cc' object='libAMOS_a-Fragment_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Fragment_AMOS.o `test -f 'Fragment_AMOS.cc' || echo '$(srcdir)/'`Fragment_AMOS.cc
+
+libAMOS_a-Fragment_AMOS.obj: Fragment_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Fragment_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Fragment_AMOS.Tpo -c -o libAMOS_a-Fragment_AMOS.obj `if test -f 'Fragment_AMOS.cc'; then $(CYGPATH_W) 'Fragment_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Fragment_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Fragment_AMOS.Tpo $(DEPDIR)/libAMOS_a-Fragment_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Fragment_AMOS.cc' object='libAMOS_a-Fragment_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Fragment_AMOS.obj `if test -f 'Fragment_AMOS.cc'; then $(CYGPATH_W) 'Fragment_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Fragment_AMOS.cc'; fi`
+
+libAMOS_a-Group_AMOS.o: Group_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Group_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Group_AMOS.Tpo -c -o libAMOS_a-Group_AMOS.o `test -f 'Group_AMOS.cc' || echo '$(srcdir)/'`Group_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Group_AMOS.Tpo $(DEPDIR)/libAMOS_a-Group_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Group_AMOS.cc' object='libAMOS_a-Group_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Group_AMOS.o `test -f 'Group_AMOS.cc' || echo '$(srcdir)/'`Group_AMOS.cc
+
+libAMOS_a-Group_AMOS.obj: Group_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Group_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Group_AMOS.Tpo -c -o libAMOS_a-Group_AMOS.obj `if test -f 'Group_AMOS.cc'; then $(CYGPATH_W) 'Group_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Group_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Group_AMOS.Tpo $(DEPDIR)/libAMOS_a-Group_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Group_AMOS.cc' object='libAMOS_a-Group_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Group_AMOS.obj `if test -f 'Group_AMOS.cc'; then $(CYGPATH_W) 'Group_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Group_AMOS.cc'; fi`
+
+libAMOS_a-IDMap_AMOS.o: IDMap_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-IDMap_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-IDMap_AMOS.Tpo -c -o libAMOS_a-IDMap_AMOS.o `test -f 'IDMap_AMOS.cc' || echo '$(srcdir)/'`IDMap_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-IDMap_AMOS.Tpo $(DEPDIR)/libAMOS_a-IDMap_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='IDMap_AMOS.cc' object='libAMOS_a-IDMap_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-IDMap_AMOS.o `test -f 'IDMap_AMOS.cc' || echo '$(srcdir)/'`IDMap_AMOS.cc
+
+libAMOS_a-IDMap_AMOS.obj: IDMap_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-IDMap_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-IDMap_AMOS.Tpo -c -o libAMOS_a-IDMap_AMOS.obj `if test -f 'IDMap_AMOS.cc'; then $(CYGPATH_W) 'IDMap_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/IDMap_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-IDMap_AMOS.Tpo $(DEPDIR)/libAMOS_a-IDMap_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='IDMap_AMOS.cc' object='libAMOS_a-IDMap_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-IDMap_AMOS.obj `if test -f 'IDMap_AMOS.cc'; then $(CYGPATH_W) 'IDMap_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/IDMap_AMOS.cc'; fi`
+
+libAMOS_a-Index_AMOS.o: Index_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Index_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Index_AMOS.Tpo -c -o libAMOS_a-Index_AMOS.o `test -f 'Index_AMOS.cc' || echo '$(srcdir)/'`Index_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Index_AMOS.Tpo $(DEPDIR)/libAMOS_a-Index_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Index_AMOS.cc' object='libAMOS_a-Index_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Index_AMOS.o `test -f 'Index_AMOS.cc' || echo '$(srcdir)/'`Index_AMOS.cc
+
+libAMOS_a-Index_AMOS.obj: Index_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Index_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Index_AMOS.Tpo -c -o libAMOS_a-Index_AMOS.obj `if test -f 'Index_AMOS.cc'; then $(CYGPATH_W) 'Index_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Index_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Index_AMOS.Tpo $(DEPDIR)/libAMOS_a-Index_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Index_AMOS.cc' object='libAMOS_a-Index_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Index_AMOS.obj `if test -f 'Index_AMOS.cc'; then $(CYGPATH_W) 'Index_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Index_AMOS.cc'; fi`
+
+libAMOS_a-Kmer_AMOS.o: Kmer_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Kmer_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Kmer_AMOS.Tpo -c -o libAMOS_a-Kmer_AMOS.o `test -f 'Kmer_AMOS.cc' || echo '$(srcdir)/'`Kmer_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Kmer_AMOS.Tpo $(DEPDIR)/libAMOS_a-Kmer_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Kmer_AMOS.cc' object='libAMOS_a-Kmer_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Kmer_AMOS.o `test -f 'Kmer_AMOS.cc' || echo '$(srcdir)/'`Kmer_AMOS.cc
+
+libAMOS_a-Kmer_AMOS.obj: Kmer_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Kmer_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Kmer_AMOS.Tpo -c -o libAMOS_a-Kmer_AMOS.obj `if test -f 'Kmer_AMOS.cc'; then $(CYGPATH_W) 'Kmer_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Kmer_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Kmer_AMOS.Tpo $(DEPDIR)/libAMOS_a-Kmer_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Kmer_AMOS.cc' object='libAMOS_a-Kmer_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Kmer_AMOS.obj `if test -f 'Kmer_AMOS.cc'; then $(CYGPATH_W) 'Kmer_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Kmer_AMOS.cc'; fi`
+
+libAMOS_a-Layout_AMOS.o: Layout_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Layout_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Layout_AMOS.Tpo -c -o libAMOS_a-Layout_AMOS.o `test -f 'Layout_AMOS.cc' || echo '$(srcdir)/'`Layout_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Layout_AMOS.Tpo $(DEPDIR)/libAMOS_a-Layout_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Layout_AMOS.cc' object='libAMOS_a-Layout_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Layout_AMOS.o `test -f 'Layout_AMOS.cc' || echo '$(srcdir)/'`Layout_AMOS.cc
+
+libAMOS_a-Layout_AMOS.obj: Layout_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Layout_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Layout_AMOS.Tpo -c -o libAMOS_a-Layout_AMOS.obj `if test -f 'Layout_AMOS.cc'; then $(CYGPATH_W) 'Layout_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Layout_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Layout_AMOS.Tpo $(DEPDIR)/libAMOS_a-Layout_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Layout_AMOS.cc' object='libAMOS_a-Layout_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Layout_AMOS.obj `if test -f 'Layout_AMOS.cc'; then $(CYGPATH_W) 'Layout_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Layout_AMOS.cc'; fi`
+
+libAMOS_a-Library_AMOS.o: Library_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Library_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Library_AMOS.Tpo -c -o libAMOS_a-Library_AMOS.o `test -f 'Library_AMOS.cc' || echo '$(srcdir)/'`Library_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Library_AMOS.Tpo $(DEPDIR)/libAMOS_a-Library_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Library_AMOS.cc' object='libAMOS_a-Library_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Library_AMOS.o `test -f 'Library_AMOS.cc' || echo '$(srcdir)/'`Library_AMOS.cc
+
+libAMOS_a-Library_AMOS.obj: Library_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Library_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Library_AMOS.Tpo -c -o libAMOS_a-Library_AMOS.obj `if test -f 'Library_AMOS.cc'; then $(CYGPATH_W) 'Library_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Library_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Library_AMOS.Tpo $(DEPDIR)/libAMOS_a-Library_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Library_AMOS.cc' object='libAMOS_a-Library_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Library_AMOS.obj `if test -f 'Library_AMOS.cc'; then $(CYGPATH_W) 'Library_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Library_AMOS.cc'; fi`
+
+libAMOS_a-Link_AMOS.o: Link_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Link_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Link_AMOS.Tpo -c -o libAMOS_a-Link_AMOS.o `test -f 'Link_AMOS.cc' || echo '$(srcdir)/'`Link_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Link_AMOS.Tpo $(DEPDIR)/libAMOS_a-Link_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Link_AMOS.cc' object='libAMOS_a-Link_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Link_AMOS.o `test -f 'Link_AMOS.cc' || echo '$(srcdir)/'`Link_AMOS.cc
+
+libAMOS_a-Link_AMOS.obj: Link_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Link_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Link_AMOS.Tpo -c -o libAMOS_a-Link_AMOS.obj `if test -f 'Link_AMOS.cc'; then $(CYGPATH_W) 'Link_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Link_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Link_AMOS.Tpo $(DEPDIR)/libAMOS_a-Link_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Link_AMOS.cc' object='libAMOS_a-Link_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Link_AMOS.obj `if test -f 'Link_AMOS.cc'; then $(CYGPATH_W) 'Link_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Link_AMOS.cc'; fi`
+
+libAMOS_a-Message_AMOS.o: Message_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Message_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Message_AMOS.Tpo -c -o libAMOS_a-Message_AMOS.o `test -f 'Message_AMOS.cc' || echo '$(srcdir)/'`Message_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Message_AMOS.Tpo $(DEPDIR)/libAMOS_a-Message_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Message_AMOS.cc' object='libAMOS_a-Message_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Message_AMOS.o `test -f 'Message_AMOS.cc' || echo '$(srcdir)/'`Message_AMOS.cc
+
+libAMOS_a-Message_AMOS.obj: Message_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Message_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Message_AMOS.Tpo -c -o libAMOS_a-Message_AMOS.obj `if test -f 'Message_AMOS.cc'; then $(CYGPATH_W) 'Message_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Message_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Message_AMOS.Tpo $(DEPDIR)/libAMOS_a-Message_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Message_AMOS.cc' object='libAMOS_a-Message_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Message_AMOS.obj `if test -f 'Message_AMOS.cc'; then $(CYGPATH_W) 'Message_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Message_AMOS.cc'; fi`
+
+libAMOS_a-Overlap_AMOS.o: Overlap_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Overlap_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Overlap_AMOS.Tpo -c -o libAMOS_a-Overlap_AMOS.o `test -f 'Overlap_AMOS.cc' || echo '$(srcdir)/'`Overlap_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Overlap_AMOS.Tpo $(DEPDIR)/libAMOS_a-Overlap_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Overlap_AMOS.cc' object='libAMOS_a-Overlap_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Overlap_AMOS.o `test -f 'Overlap_AMOS.cc' || echo '$(srcdir)/'`Overlap_AMOS.cc
+
+libAMOS_a-Overlap_AMOS.obj: Overlap_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Overlap_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Overlap_AMOS.Tpo -c -o libAMOS_a-Overlap_AMOS.obj `if test -f 'Overlap_AMOS.cc'; then $(CYGPATH_W) 'Overlap_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Overlap_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Overlap_AMOS.Tpo $(DEPDIR)/libAMOS_a-Overlap_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Overlap_AMOS.cc' object='libAMOS_a-Overlap_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Overlap_AMOS.obj `if test -f 'Overlap_AMOS.cc'; then $(CYGPATH_W) 'Overlap_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Overlap_AMOS.cc'; fi`
+
+libAMOS_a-Read_AMOS.o: Read_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Read_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Read_AMOS.Tpo -c -o libAMOS_a-Read_AMOS.o `test -f 'Read_AMOS.cc' || echo '$(srcdir)/'`Read_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Read_AMOS.Tpo $(DEPDIR)/libAMOS_a-Read_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Read_AMOS.cc' object='libAMOS_a-Read_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Read_AMOS.o `test -f 'Read_AMOS.cc' || echo '$(srcdir)/'`Read_AMOS.cc
+
+libAMOS_a-Read_AMOS.obj: Read_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Read_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Read_AMOS.Tpo -c -o libAMOS_a-Read_AMOS.obj `if test -f 'Read_AMOS.cc'; then $(CYGPATH_W) 'Read_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Read_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Read_AMOS.Tpo $(DEPDIR)/libAMOS_a-Read_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Read_AMOS.cc' object='libAMOS_a-Read_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Read_AMOS.obj `if test -f 'Read_AMOS.cc'; then $(CYGPATH_W) 'Read_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Read_AMOS.cc'; fi`
+
+libAMOS_a-ScaffoldEdge_AMOS.o: ScaffoldEdge_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-ScaffoldEdge_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-ScaffoldEdge_AMOS.Tpo -c -o libAMOS_a-ScaffoldEdge_AMOS.o `test -f 'ScaffoldEdge_AMOS.cc' || echo '$(srcdir)/'`ScaffoldEdge_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-ScaffoldEdge_AMOS.Tpo $(DEPDIR)/libAMOS_a-ScaffoldEdge_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ScaffoldEdge_AMOS.cc' object='libAMOS_a-ScaffoldEdge_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-ScaffoldEdge_AMOS.o `test -f 'ScaffoldEdge_AMOS.cc' || echo '$(srcdir)/'`ScaffoldEdge_AMOS.cc
+
+libAMOS_a-ScaffoldEdge_AMOS.obj: ScaffoldEdge_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-ScaffoldEdge_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-ScaffoldEdge_AMOS.Tpo -c -o libAMOS_a-ScaffoldEdge_AMOS.obj `if test -f 'ScaffoldEdge_AMOS.cc'; then $(CYGPATH_W) 'ScaffoldEdge_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/ScaffoldEdge_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-ScaffoldEdge_AMOS.Tpo $(DEPDIR)/libAMOS_a-ScaffoldEdge_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ScaffoldEdge_AMOS.cc' object='libAMOS_a-ScaffoldEdge_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-ScaffoldEdge_AMOS.obj `if test -f 'ScaffoldEdge_AMOS.cc'; then $(CYGPATH_W) 'ScaffoldEdge_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/ScaffoldEdge_AMOS.cc'; fi`
+
+libAMOS_a-ScaffoldLink_AMOS.o: ScaffoldLink_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-ScaffoldLink_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-ScaffoldLink_AMOS.Tpo -c -o libAMOS_a-ScaffoldLink_AMOS.o `test -f 'ScaffoldLink_AMOS.cc' || echo '$(srcdir)/'`ScaffoldLink_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-ScaffoldLink_AMOS.Tpo $(DEPDIR)/libAMOS_a-ScaffoldLink_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ScaffoldLink_AMOS.cc' object='libAMOS_a-ScaffoldLink_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-ScaffoldLink_AMOS.o `test -f 'ScaffoldLink_AMOS.cc' || echo '$(srcdir)/'`ScaffoldLink_AMOS.cc
+
+libAMOS_a-ScaffoldLink_AMOS.obj: ScaffoldLink_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-ScaffoldLink_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-ScaffoldLink_AMOS.Tpo -c -o libAMOS_a-ScaffoldLink_AMOS.obj `if test -f 'ScaffoldLink_AMOS.cc'; then $(CYGPATH_W) 'ScaffoldLink_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/ScaffoldLink_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-ScaffoldLink_AMOS.Tpo $(DEPDIR)/libAMOS_a-ScaffoldLink_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ScaffoldLink_AMOS.cc' object='libAMOS_a-ScaffoldLink_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-ScaffoldLink_AMOS.obj `if test -f 'ScaffoldLink_AMOS.cc'; then $(CYGPATH_W) 'ScaffoldLink_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/ScaffoldLink_AMOS.cc'; fi`
+
+libAMOS_a-Scaffold_AMOS.o: Scaffold_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Scaffold_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Scaffold_AMOS.Tpo -c -o libAMOS_a-Scaffold_AMOS.o `test -f 'Scaffold_AMOS.cc' || echo '$(srcdir)/'`Scaffold_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Scaffold_AMOS.Tpo $(DEPDIR)/libAMOS_a-Scaffold_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Scaffold_AMOS.cc' object='libAMOS_a-Scaffold_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Scaffold_AMOS.o `test -f 'Scaffold_AMOS.cc' || echo '$(srcdir)/'`Scaffold_AMOS.cc
+
+libAMOS_a-Scaffold_AMOS.obj: Scaffold_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Scaffold_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Scaffold_AMOS.Tpo -c -o libAMOS_a-Scaffold_AMOS.obj `if test -f 'Scaffold_AMOS.cc'; then $(CYGPATH_W) 'Scaffold_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Scaffold_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Scaffold_AMOS.Tpo $(DEPDIR)/libAMOS_a-Scaffold_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Scaffold_AMOS.cc' object='libAMOS_a-Scaffold_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Scaffold_AMOS.obj `if test -f 'Scaffold_AMOS.cc'; then $(CYGPATH_W) 'Scaffold_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Scaffold_AMOS.cc'; fi`
+
+libAMOS_a-Sequence_AMOS.o: Sequence_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Sequence_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Sequence_AMOS.Tpo -c -o libAMOS_a-Sequence_AMOS.o `test -f 'Sequence_AMOS.cc' || echo '$(srcdir)/'`Sequence_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Sequence_AMOS.Tpo $(DEPDIR)/libAMOS_a-Sequence_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Sequence_AMOS.cc' object='libAMOS_a-Sequence_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Sequence_AMOS.o `test -f 'Sequence_AMOS.cc' || echo '$(srcdir)/'`Sequence_AMOS.cc
+
+libAMOS_a-Sequence_AMOS.obj: Sequence_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Sequence_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Sequence_AMOS.Tpo -c -o libAMOS_a-Sequence_AMOS.obj `if test -f 'Sequence_AMOS.cc'; then $(CYGPATH_W) 'Sequence_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Sequence_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Sequence_AMOS.Tpo $(DEPDIR)/libAMOS_a-Sequence_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Sequence_AMOS.cc' object='libAMOS_a-Sequence_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Sequence_AMOS.obj `if test -f 'Sequence_AMOS.cc'; then $(CYGPATH_W) 'Sequence_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Sequence_AMOS.cc'; fi`
+
+libAMOS_a-Universal_AMOS.o: Universal_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Universal_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-Universal_AMOS.Tpo -c -o libAMOS_a-Universal_AMOS.o `test -f 'Universal_AMOS.cc' || echo '$(srcdir)/'`Universal_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Universal_AMOS.Tpo $(DEPDIR)/libAMOS_a-Universal_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Universal_AMOS.cc' object='libAMOS_a-Universal_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Universal_AMOS.o `test -f 'Universal_AMOS.cc' || echo '$(srcdir)/'`Universal_AMOS.cc
+
+libAMOS_a-Universal_AMOS.obj: Universal_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-Universal_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-Universal_AMOS.Tpo -c -o libAMOS_a-Universal_AMOS.obj `if test -f 'Universal_AMOS.cc'; then $(CYGPATH_W) 'Universal_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Universal_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-Universal_AMOS.Tpo $(DEPDIR)/libAMOS_a-Universal_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Universal_AMOS.cc' object='libAMOS_a-Universal_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-Universal_AMOS.obj `if test -f 'Universal_AMOS.cc'; then $(CYGPATH_W) 'Universal_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/Universal_AMOS.cc'; fi`
+
+libAMOS_a-datatypes_AMOS.o: datatypes_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-datatypes_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-datatypes_AMOS.Tpo -c -o libAMOS_a-datatypes_AMOS.o `test -f 'datatypes_AMOS.cc' || echo '$(srcdir)/'`datatypes_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-datatypes_AMOS.Tpo $(DEPDIR)/libAMOS_a-datatypes_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='datatypes_AMOS.cc' object='libAMOS_a-datatypes_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-datatypes_AMOS.o `test -f 'datatypes_AMOS.cc' || echo '$(srcdir)/'`datatypes_AMOS.cc
+
+libAMOS_a-datatypes_AMOS.obj: datatypes_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-datatypes_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-datatypes_AMOS.Tpo -c -o libAMOS_a-datatypes_AMOS.obj `if test -f 'datatypes_AMOS.cc'; then $(CYGPATH_W) 'datatypes_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/datatypes_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-datatypes_AMOS.Tpo $(DEPDIR)/libAMOS_a-datatypes_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='datatypes_AMOS.cc' object='libAMOS_a-datatypes_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-datatypes_AMOS.obj `if test -f 'datatypes_AMOS.cc'; then $(CYGPATH_W) 'datatypes_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/datatypes_AMOS.cc'; fi`
+
+libAMOS_a-universals_AMOS.o: universals_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-universals_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-universals_AMOS.Tpo -c -o libAMOS_a-universals_AMOS.o `test -f 'universals_AMOS.cc' || echo '$(srcdir)/'`universals_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-universals_AMOS.Tpo $(DEPDIR)/libAMOS_a-universals_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='universals_AMOS.cc' object='libAMOS_a-universals_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-universals_AMOS.o `test -f 'universals_AMOS.cc' || echo '$(srcdir)/'`universals_AMOS.cc
+
+libAMOS_a-universals_AMOS.obj: universals_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-universals_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-universals_AMOS.Tpo -c -o libAMOS_a-universals_AMOS.obj `if test -f 'universals_AMOS.cc'; then $(CYGPATH_W) 'universals_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/universals_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-universals_AMOS.Tpo $(DEPDIR)/libAMOS_a-universals_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='universals_AMOS.cc' object='libAMOS_a-universals_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-universals_AMOS.obj `if test -f 'universals_AMOS.cc'; then $(CYGPATH_W) 'universals_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/universals_AMOS.cc'; fi`
+
+libAMOS_a-utility_AMOS.o: utility_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-utility_AMOS.o -MD -MP -MF $(DEPDIR)/libAMOS_a-utility_AMOS.Tpo -c -o libAMOS_a-utility_AMOS.o `test -f 'utility_AMOS.cc' || echo '$(srcdir)/'`utility_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-utility_AMOS.Tpo $(DEPDIR)/libAMOS_a-utility_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='utility_AMOS.cc' object='libAMOS_a-utility_AMOS.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-utility_AMOS.o `test -f 'utility_AMOS.cc' || echo '$(srcdir)/'`utility_AMOS.cc
+
+libAMOS_a-utility_AMOS.obj: utility_AMOS.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libAMOS_a-utility_AMOS.obj -MD -MP -MF $(DEPDIR)/libAMOS_a-utility_AMOS.Tpo -c -o libAMOS_a-utility_AMOS.obj `if test -f 'utility_AMOS.cc'; then $(CYGPATH_W) 'utility_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/utility_AMOS.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libAMOS_a-utility_AMOS.Tpo $(DEPDIR)/libAMOS_a-utility_AMOS.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='utility_AMOS.cc' object='libAMOS_a-utility_AMOS.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libAMOS_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libAMOS_a-utility_AMOS.obj `if test -f 'utility_AMOS.cc'; then $(CYGPATH_W) 'utility_AMOS.cc'; else $(CYGPATH_W) '$(srcdir)/utility_AMOS.cc'; fi`
+install-amosincludeHEADERS: $(amosinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(amosincludedir)" || $(MKDIR_P) "$(DESTDIR)$(amosincludedir)"
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(amosincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(amosincludedir)" || exit $$?; \
+ done
+
+uninstall-amosincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amosincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(amosincludedir)" && rm -f $$files
+
+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
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+check: check-am
+all-am: Makefile $(LIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(amosincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-amoslibLIBRARIES clean-checkPROGRAMS clean-generic \
+ 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-amosincludeHEADERS install-amoslibLIBRARIES
+
+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:
+
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-amosincludeHEADERS uninstall-amoslibLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: check-am install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-amoslibLIBRARIES clean-checkPROGRAMS clean-generic ctags \
+ distclean distclean-compile distclean-generic distclean-tags \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-amosincludeHEADERS install-amoslibLIBRARIES \
+ 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-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-amosincludeHEADERS \
+ uninstall-amoslibLIBRARIES uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+ -I$(top_builddir)/src/GNU
+
+# 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/AMOS/Message_AMOS.cc b/src/AMOS/Message_AMOS.cc
new file mode 100644
index 0000000..47efcb9
--- /dev/null
+++ b/src/AMOS/Message_AMOS.cc
@@ -0,0 +1,240 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 11/12/2003
+//!
+//! \brief Source for Message_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Message_AMOS.hh"
+#include <cstdio>
+using namespace AMOS;
+using namespace std;
+using namespace HASHMAP;
+
+#define FIELD_SEPARATOR ':'
+#define FIELD_TERMINATOR '.'
+
+
+
+
+//================================================ Message_t ===================
+//----------------------------------------------------- skipto -----------------
+inline bool skipto (istream & in, char ch)
+{
+ static const int chunk = 1024;
+
+ while ( true )
+ {
+ in . ignore (chunk, ch);
+
+ if ( !in . good( ) )
+ return false;
+ if ( in . gcount( ) != chunk )
+ return true;
+
+ in . unget( );
+ }
+}
+
+
+//----------------------------------------------------- read -------------------
+bool Message_t::read (istream & in)
+{
+ int i;
+ char ch;
+ string data;
+ string chunk;
+ string name (NCODE_SIZE, NULL_CHAR);
+
+ //-- Search for the beginning of the message
+ if ( !skipto (in, '{') )
+ return NULL_NCODE;
+
+ //-- Empty the object
+ clear( );
+
+ try {
+
+ //-- Get the type name
+ for ( i = 0; i < NCODE_SIZE; i ++ )
+ name [i] = in . get( );
+ if ( in . get( ) != NL_CHAR )
+ AMOS_THROW_IO ("Could not parse message NCode: " + name);
+ setMessageCode (name);
+
+ //-- Until end of message
+ while ( true )
+ {
+ //-- Check next char
+ ch = in . peek( );
+
+ //-- If unexpected EOF
+ if ( ch == EOF )
+ AMOS_THROW_IO ("Unbalanced message nesting");
+ //-- If a nested message, read it in
+ else if ( ch == '{' )
+ {
+ subs_m . push_back (Message_t ( ));
+ subs_m . back( ) . read (in);
+ continue;
+ }
+ //-- If end of message
+ else if ( ch == '}' )
+ {
+ skipto (in, NL_CHAR);
+ break;
+ }
+ //-- If spacing
+ else if ( ch == NL_CHAR )
+ {
+ in . get( );
+ continue;
+ }
+
+ //-- Get the field name
+ for ( i = 0; i < NCODE_SIZE; i ++ )
+ name [i] = in . get( );
+ if ( in . get( ) != FIELD_SEPARATOR )
+ AMOS_THROW_IO ("Could not parse field code in '" +
+ Decode (mcode_m) + "' message");
+
+ //-- Read in first line of field
+ getline (in, data);
+ if ( !in . good( ) )
+ AMOS_THROW_IO ("Could not parse single-line field data in '" +
+ Decode (mcode_m) + "' message");
+
+ //-- If multi-line field
+ if ( data . empty( ) )
+ {
+ getline (in, data, FIELD_TERMINATOR);
+
+ //-- Slurp up '.'s while not the '\n.\n' pattern
+ while ( in . peek( ) != NL_CHAR ||
+ (!data . empty( ) && *(data . rbegin( )) != NL_CHAR) )
+ {
+ if ( !in . good( ) )
+ AMOS_THROW_IO ("Unterminated multi-line field in '" +
+ Decode (mcode_m) + "' message");
+
+ data . push_back (FIELD_TERMINATOR);
+ getline (in, chunk, FIELD_TERMINATOR);
+ data . append (chunk);
+ }
+ in . get( );
+
+ if ( !in . good( ) )
+ AMOS_THROW_IO ("Could not parse multi-line field data in '" +
+ Decode (mcode_m) + "' message");
+ }
+
+ //-- Set field data
+ setField (name, data);
+ }
+ }
+ catch (Exception_t) {
+
+ //-- Clean up and rethrow
+ clear( );
+ throw;
+ }
+
+ return true;
+}
+
+
+//----------------------------------------------------- setField ---------------
+void Message_t::setField (NCode_t fcode, const string & data)
+{
+ if ( data . empty( ) )
+ return;
+
+ //-- Check pre-conditions
+ string::size_type nlpos = data . rfind (NL_CHAR);
+ if ( nlpos != string::npos && nlpos != data . size( ) - 1 )
+ AMOS_THROW_ARGUMENT ("Invalid multi-line message field format");
+
+ //-- Insert new field, overwrite if already exists
+ fields_m [fcode] = data;
+}
+
+
+//----------------------------------------------------- skip -------------------
+NCode_t Message_t::skip (istream & in) // static const
+{
+ int i;
+ char ch;
+ string name (NCODE_SIZE, NULL_CHAR);
+
+ //-- Search for the beginning of the message
+ if ( !skipto (in, '{') )
+ return NULL_NCODE;
+
+ //-- Get the type name
+ for ( i = 0; i < NCODE_SIZE; i ++ )
+ name [i] = in . get( );
+ if ( in . get( ) != NL_CHAR )
+ AMOS_THROW_IO ("Could not parse message header: " + name);
+
+ //-- Until end of message
+ i = 1;
+ while ( i != 0 )
+ {
+ //-- Get next char
+ ch = in . get( );
+ if ( !in . good( ) )
+ AMOS_THROW_IO ("Unbalanced message nesting");
+
+ //-- Increment/decrement level counter
+ if ( ch == '{' )
+ i ++;
+ else if ( ch == '}' )
+ i --;
+
+ //-- Suck in rest of line
+ if ( ch != NL_CHAR )
+ skipto (in, NL_CHAR);
+ }
+
+ return Encode (name);
+}
+
+
+//----------------------------------------------------- write ------------------
+void Message_t::write (ostream & out) const
+{
+ bool mline = false;
+
+ //-- Write opening of message
+ out << '{' << Decode (mcode_m) << endl;
+
+ //-- Write all fields
+ hash_map<NCode_t,string>::const_iterator mi;
+ for ( mi = fields_m . begin( ); mi != fields_m . end( ); mi ++ )
+ {
+ //-- Set multi-line message flag
+ mline = *(mi -> second . rbegin( )) == NL_CHAR ? true : false;
+
+ out << Decode (mi -> first) << FIELD_SEPARATOR;
+ if ( mline )
+ out . put (NL_CHAR);
+ out << mi -> second;
+ if ( mline )
+ out . put (FIELD_TERMINATOR);
+ out . put (NL_CHAR);
+ }
+
+ //-- Write all sub-messages
+ vector<Message_t>::const_iterator vi;
+ for ( vi = subs_m . begin( ); vi != subs_m . end( ); vi ++ )
+ vi -> write (out);
+
+ //-- Close out message
+ out << '}' << endl;
+
+ //-- Check stream 'goodness'
+ if ( !out . good( ) )
+ AMOS_THROW_IO ("Message write failure");
+}
diff --git a/src/AMOS/Message_AMOS.hh b/src/AMOS/Message_AMOS.hh
new file mode 100644
index 0000000..a949f53
--- /dev/null
+++ b/src/AMOS/Message_AMOS.hh
@@ -0,0 +1,554 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 11/12/2003
+//!
+//! \brief Header for Message_t and IMessagable_t
+//! \todo Validity checking for Message and Field codes
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Message_AMOS_HH
+#define __Message_AMOS_HH 1
+
+#include "utility_AMOS.hh"
+#include <string>
+#include <vector>
+#include <iostream>
+
+// Use a macro because OS X doesn't like/allow static members initialized
+// with actual code.
+#define AMOS_ENCODE(a,b,c) ((((c << CHAR_BIT) | b) << CHAR_BIT) | a)
+
+namespace AMOS {
+
+const char E_ADD = 'A';
+const char E_DELETE = 'D';
+const char E_REPLACE = 'R';
+const NCode_t F_NULL = AMOS_ENCODE ('n','u','l');
+const NCode_t F_AHANG = AMOS_ENCODE ('a','h','g');
+const NCode_t F_ACTION = AMOS_ENCODE ('a','c','t');
+const NCode_t F_ADJACENCY = AMOS_ENCODE ('a','d','j');
+const NCode_t F_BASEPOSITION = AMOS_ENCODE ('b','c','p');
+const NCode_t F_BHANG = AMOS_ENCODE ('b','h','g');
+const NCode_t F_BID = AMOS_ENCODE ('b','i','d');
+const NCode_t F_CLEAR = AMOS_ENCODE ('c','l','r');
+const NCode_t F_COMMENT = AMOS_ENCODE ('c','o','m');
+const NCode_t F_COUNT = AMOS_ENCODE ('c','n','t');
+const NCode_t F_EID = AMOS_ENCODE ('e','i','d');
+const NCode_t F_EDGE = AMOS_ENCODE ('e','d','g');
+const NCode_t F_FLAG = AMOS_ENCODE ('f','l','g');
+const NCode_t F_FRAGMENT = AMOS_ENCODE ('f','r','g');
+const NCode_t F_GAPS = AMOS_ENCODE ('g','a','p');
+const NCode_t F_IID = AMOS_ENCODE ('i','i','d');
+const NCode_t F_LIBRARY = AMOS_ENCODE ('l','i','b');
+const NCode_t F_LINK = AMOS_ENCODE ('l','n','k');
+const NCode_t F_MAP = AMOS_ENCODE ('m','a','p');
+const NCode_t F_MEAN = AMOS_ENCODE ('m','e','a');
+const NCode_t F_MEMBER = AMOS_ENCODE ('m','b','r');
+const NCode_t F_NODES = AMOS_ENCODE ('n','d','s');
+const NCode_t F_OBJECT = AMOS_ENCODE ('o','b','j');
+const NCode_t F_OFFSET = AMOS_ENCODE ('o','f','f');
+const NCode_t F_POSITION = AMOS_ENCODE ('p','o','s');
+const NCode_t F_QUALITY = AMOS_ENCODE ('q','l','t');
+const NCode_t F_QUALITYCLEAR = AMOS_ENCODE ('q','c','r');
+const NCode_t F_READS = AMOS_ENCODE ('r','d','s');
+const NCode_t F_SCORE = AMOS_ENCODE ('s','c','r');
+const NCode_t F_SEQUENCE = AMOS_ENCODE ('s','e','q');
+const NCode_t F_SD = AMOS_ENCODE ('s','t','d');
+const NCode_t F_SIZE = AMOS_ENCODE ('s','z','e');
+const NCode_t F_SOURCE = AMOS_ENCODE ('s','r','c');
+const NCode_t F_STATUS = AMOS_ENCODE ('s','t','s');
+const NCode_t F_TYPE = AMOS_ENCODE ('t','y','p');
+const NCode_t F_VECTORCLEAR = AMOS_ENCODE ('v','c','r');
+const NCode_t F_SCAFFOLD = AMOS_ENCODE ('s','c','f');
+const NCode_t M_NULL = AMOS_ENCODE ('N','U','L');
+const NCode_t M_UNIVERSAL = AMOS_ENCODE ('U','N','V');
+const NCode_t M_ORIENTED = AMOS_ENCODE ('O','R','I');
+const NCode_t M_CONTIG = AMOS_ENCODE ('C','T','G');
+const NCode_t M_CONTIGEDGE = AMOS_ENCODE ('C','T','E');
+const NCode_t M_CONTIGLINK = AMOS_ENCODE ('C','T','L');
+const NCode_t M_DISTRIBUTION = AMOS_ENCODE ('D','S','T');
+const NCode_t M_EDGE = AMOS_ENCODE ('E','D','G');
+const NCode_t M_FEATURE = AMOS_ENCODE ('F','E','A');
+const NCode_t M_FRAGMENT = AMOS_ENCODE ('F','R','G');
+const NCode_t M_GROUP = AMOS_ENCODE ('G','R','P');
+const NCode_t M_KMER = AMOS_ENCODE ('K','M','R');
+const NCode_t M_LAYOUT = AMOS_ENCODE ('L','A','Y');
+const NCode_t M_LIBRARY = AMOS_ENCODE ('L','I','B');
+const NCode_t M_LINK = AMOS_ENCODE ('L','N','K');
+const NCode_t M_IDMAP = AMOS_ENCODE ('M','A','P');
+const NCode_t M_INDEX = AMOS_ENCODE ('I','D','X');
+const NCode_t M_OVERLAP = AMOS_ENCODE ('O','V','L');
+const NCode_t M_READ = AMOS_ENCODE ('R','E','D');
+const NCode_t M_MOTIF = AMOS_ENCODE ('M','T','F');
+const NCode_t M_SCAFFOLD = AMOS_ENCODE ('S','C','F');
+const NCode_t M_SCAFFOLDEDGE = AMOS_ENCODE ('S','C','E');
+const NCode_t M_SCAFFOLDLINK = AMOS_ENCODE ('S','C','L');
+const NCode_t M_SEQUENCE = AMOS_ENCODE ('S','E','Q');
+const NCode_t M_TILE = AMOS_ENCODE ('T','L','E');
+
+
+//================================================ Message_t ===================
+//! \brief A generic AMOS message object for reading and writing data
+//!
+//! Based on the Celera 3-code format, the AMOS 'NCode' messages are designed
+//! for easy parsing and compatibility with the other AMOS modules. This
+//! generic message class makes no assumptions about the type of data to be
+//! stored within, so it can be used for reading and writing ANY type of ASCII
+//! record in NCode format. The main duty of this class is to understand and
+//! validate incoming or outgoing NCode format.
+//!
+//==============================================================================
+class Message_t
+{
+
+private:
+
+ NCode_t mcode_m; //!< message NCode type
+ std::vector<Message_t> subs_m; //!< vector of submessages
+ HASHMAP::hash_map<NCode_t,std::string> fields_m; //!< message fields
+
+
+public:
+
+ typedef HASHMAP::hash_map<NCode_t,std::string>::const_iterator const_iterator;
+
+
+ //--------------------------------------------------- Message_t --------------
+ //! \brief Constructs an empty Message_t
+ //!
+ Message_t ( )
+ {
+ mcode_m = M_NULL;
+ }
+
+
+ //--------------------------------------------------- ~Message_t -------------
+ //! \brief Destroys a Message_t object
+ //!
+ ~Message_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- begin ------------------
+ //! \brief Returns a const_iterator to the beginning of the field map
+ //!
+ //! Iterator is of the type hash_map<NCode_t,std::string>::const_iterator.
+ //! Access NCode with `itr -> first` and data with `itr -> second`.
+ //!
+ //! \return A const_iterator to the beginning of the field map
+ //!
+ const_iterator begin ( ) const
+ {
+ return fields_m . begin( );
+ }
+
+
+ //--------------------------------------------------- end --------------------
+ //! \brief Returns a const_iterator to the end of the field map
+ //!
+ //! Iterator is of the type hash_map<NCode_t,std::string>::const_iterator.
+ //! Access NCode with `itr -> first` and data with `itr -> second`.
+ //!
+ //! \return A const_iterator to the end of the field map
+ //!
+ const_iterator end ( ) const
+ {
+ return fields_m . end( );
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ //! \brief Clears the message
+ //!
+ //! \return void
+ //!
+ void clear ( )
+ {
+ mcode_m = M_NULL;
+ fields_m . clear( );
+ subs_m . clear( );
+ }
+
+
+ //--------------------------------------------------- countFields ------------
+ //! \brief Returns the number of top-level fields in the message
+ //!
+ //! \return The number of top-level fields in the message
+ //!
+ Size_t countFields ( ) const
+ {
+ return fields_m . size( );
+ }
+
+
+ //--------------------------------------------------- countSubMessages -------
+ //! \brief Returns the number of top-level sub-messages in the message
+ //!
+ //! \return The number of top-level sub-messages in the message
+ //!
+ Size_t countSubMessages ( ) const
+ {
+ return subs_m . size( );
+ }
+
+
+ //--------------------------------------------------- empty ------------------
+ //! \brief Returns true if the message has no fields or sub messages
+ //!
+ //! \return True if the message is empty, else false
+ //!
+ bool empty ( ) const
+ {
+ return (fields_m . empty( ) && subs_m . empty( ));
+ }
+
+
+ //--------------------------------------------------- exists -----------------
+ //! \brief Checks for the existence of a field by NCode
+ //!
+ //! \param fcode Check for a field with this NCode
+ //! \return true if exists, false if otherwise
+ //!
+ bool exists (NCode_t fcode) const
+ {
+ return fields_m . find (fcode) == fields_m . end( ) ? false : true;
+ }
+
+
+ //--------------------------------------------------- exists -----------------
+ //! \brief Checks for the existence of a field by name
+ //!
+ //! \param fname Check for a field with this name
+ //! \return true if exists, false if otherwise
+ //!
+ bool exists (const std::string & fname) const
+ {
+ return exists (Encode (fname));
+ }
+
+
+ //--------------------------------------------------- getField ---------------
+ //! \brief Gets field data by field NCode
+ //!
+ //! Will return the field data, or throws an exception if the field does not
+ //! exist. You can check if the field exists first with the exists method.
+ //!
+ //! \param fcode Get field data with this field NCode
+ //! \pre The field code exists in the current message
+ //! \throws ArgumentException_t
+ //! \return The field data for fcode
+ //!
+ const std::string & getField (NCode_t fcode) const
+ {
+ HASHMAP::hash_map<NCode_t,std::string>::const_iterator
+ mi = fields_m . find (fcode);
+ if ( mi == fields_m . end( ) )
+ AMOS_THROW_ARGUMENT
+ ("Cannot retrieve absent field '" + Decode (fcode) + "'");
+ return mi -> second;
+ }
+
+
+ //--------------------------------------------------- getField ---------------
+ //! \brief Gets field data by field name
+ //!
+ //! Will return the field data, or throws an exception if the field does not
+ //! exist. You can check if the field exists first with the exists method.
+ //!
+ //! \param fname Get field data with this field name
+ //! \pre The field name exists in the current message
+ //! \throws ArgumentException_t
+ //! \return The field data for fname
+ //!
+ const std::string & getField (const std::string & fname) const
+ {
+ return getField (Encode (fname));
+ }
+
+
+ //--------------------------------------------------- getSubMessages ---------
+ //! \brief Get the vector of submessages for this message
+ //!
+ //! \return The vector of submessages for this message
+ //!
+ const std::vector<Message_t> & getSubMessages ( ) const
+ {
+ return subs_m;
+ }
+
+
+ //--------------------------------------------------- getSubMessages ---------
+ //! \brief Get the vector of submessages for this message
+ //!
+ //! \return The vector of submessages for this message
+ //!
+ std::vector<Message_t> & getSubMessages ( )
+ {
+ return subs_m;
+ }
+
+
+ //--------------------------------------------------- getMessageCode ---------
+ //! \brief Get the NCode type of this message
+ //!
+ //! Will return M_NULL if the message has not been assigned a type name
+ //! yet. NCode can be decoded to a string with the 'AMOS::Decode' function.
+ //!
+ //! \return The NCode type of this message
+ //!
+ NCode_t getMessageCode ( ) const
+ {
+ return mcode_m;
+ }
+
+
+ //--------------------------------------------------- operator[] -------------
+ //! \brief operator for getField method
+ //!
+ const std::string & operator[] (NCode_t fcode) const
+ {
+ return getField (fcode);
+ }
+
+ const std::string & operator[] (const std::string & fname) const
+ {
+ return getField (fname);
+ }
+
+
+ //--------------------------------------------------- read -------------------
+ //! \brief Read a message from an input stream
+ //!
+ //! Reads a message from an input stream and populates the message fields
+ //! with the values read from the stream. Will throw an exception if a
+ //! message is found, but is not properly formatted.
+ //!
+ //! \param in The input stream to read from
+ //! \pre The incoming message is properly formatted
+ //! \throws IOException_t
+ //! \return true if a message was read, false if no message read (EOF)
+ //!
+ bool read (std::istream & in);
+
+
+ //--------------------------------------------------- removeField ------------
+ //! \brief Removes a field from the message object by NCode
+ //!
+ //! Removes a field from the message by its NCode. Has no effect if the field
+ //! code does not exist.
+ //!
+ //! \param fcode The field NCode to remove
+ //! \return void
+ //!
+ void removeField (NCode_t fcode)
+ {
+ fields_m . erase (fcode);
+ }
+
+
+ //--------------------------------------------------- removeField ------------
+ //! \brief Removes a field from the message object
+ //!
+ //! Removes a field from the message. Has no effect if the field name does
+ //! not exist or is improperly formatted.
+ //!
+ //! \param fname The field name to remove
+ //! \return void
+ //!
+ void removeField (const std::string & fname)
+ {
+ removeField (Encode (fname));
+ }
+
+
+ //--------------------------------------------------- setSubMessages ---------
+ //! \brief Set the vector of submessages for this message
+ //!
+ //! \param subs The new vector of submessages
+ //! \return void
+ //!
+ void setSubMessages (const std::vector<Message_t> & subs)
+ {
+ subs_m = subs;
+ }
+
+
+ //--------------------------------------------------- setField ---------------
+ //! \brief Set field data by field NCode
+ //!
+ //! Will set a new, or overwrite and existing field with the supplied data.
+ //! Throws an exception for an improperly formatted data record (i.e. a
+ //! multi-line record that does not end in a newline). If the data string is
+ //! empty, the field will be ignored and will remain uninitialized.
+ //!
+ //! \param fcode The field NCode
+ //! \param data The new field data
+ //! \pre The data field ends in '\n' if it is multiple lines
+ //! \throws ArugmentException_t
+ //! \return void
+ //!
+ void setField (NCode_t fcode, const std::string & data);
+
+
+ //--------------------------------------------------- setField ---------------
+ //! \brief Set field data by field name
+ //!
+ //! Will set a new, or overwrite and existing field with the supplied data.
+ //! Throws an exception for an improperly formatted 3-code field name or
+ //! an improperly formated data record (i.e. a multi-line record that does
+ //! not end in a newline).
+ //!
+ //! \param fname The field name
+ //! \param data The new field data
+ //! \pre The field name is 3 chars
+ //! \pre The data field ends in '\n' if it is multiple lines
+ //! \throws ArugmentException_t
+ //! \return void
+ //!
+ void setField (const std::string & fname, const std::string & data)
+ {
+ setField (Encode (fname), data);
+ }
+
+
+ //--------------------------------------------------- setMessageCode ---------
+ //! \brief Set the NCode type code of this message
+ //!
+ //! \param mcode The new NCode type of this message
+ //! \return void
+ //!
+ void setMessageCode (NCode_t mcode)
+ {
+ mcode_m = mcode;
+ }
+
+
+ //--------------------------------------------------- setMessageCode ---------
+ //! \brief Set the NCode type name of this message
+ //!
+ //! Will throw an exception if the name is improperly formatted.
+ //!
+ //! \param mname The new NCode type name of this message
+ //! \pre The type name is 3 chars
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void setMessageCode (const std::string & mname)
+ {
+ setMessageCode (Encode (mname));
+ }
+
+
+ //--------------------------------------------------- skip -------------------
+ //! \brief Skips a message in an input stream, returning its NCode
+ //!
+ //! Skips a message in an input stream, returning its NCode. Will throw an
+ //! exception if a message is found, but its nesting is not properly
+ //! formatted. However, complete validation is not performed. Use read method
+ //! to assure proper formatting.
+ //!
+ //! \param in The input stream to read from
+ //! \pre The incoming message code and nesting are properly formatted
+ //! \post Information already stored in the message object will not be changed
+ //! \post The istream is repositioned at the beginning of the next message
+ //! \throws IOException_t
+ //! \return NCode of the skipped message, or NULL_NCODE if no message found
+ //!
+ static NCode_t skip (std::istream & in); // const
+
+
+ //--------------------------------------------------- write ------------------
+ //! \brief Write the message object to an output stream
+ //!
+ //! Writes the NCode ASCII representation of this object to the supplied
+ //! output stream. Will throw an exception if there was an error trying to
+ //! write to the stream.
+ //!
+ //! \param out The output stream to write to
+ //! \pre The ostream is open and writable
+ //! \throws IOException_t
+ //! \return void
+ //!
+ void write (std::ostream & out) const;
+
+};
+
+
+
+
+
+//================================================ IMessagable_t ===============
+//! \brief Interface for classes that can interpret messages
+//!
+//! Provides an interface for classes that can input and output messages. This
+//! allows in-memory classes to read and write messages to a stream via the
+//! Message_t class.
+//!
+//==============================================================================
+class IMessagable_t
+{
+
+public:
+
+ //--------------------------------------------------- IMessagable_t ----------
+ //! \brief Constructs a Messagable object with null message type
+ //!
+ IMessagable_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- ~IMessagable_t ---------
+ //! \brief Virtual destructor for Messagable objects
+ //!
+ virtual ~IMessagable_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ //! \brief Get the AMOS NCode type identifier
+ //!
+ //! \return The AMOS NCode type identifier
+ //!
+ virtual NCode_t getNCode ( ) const = 0;
+
+
+ //--------------------------------------------------- readMessage ------------
+ //! \brief Reads in data from a Message object
+ //!
+ //! Reads the data contained in a Message object and stores it in the
+ //! Messagable object. Will not complain if incoming message is of the wrong
+ //! type, will only try and suck out the fields it recognizes. All previous
+ //! data in the Messagable object will be cleared or overwritten.
+ //!
+ //! \param msg The Message to read from
+ //! \pre The expected fields are formatted properly
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ virtual void readMessage (const Message_t & msg) = 0;
+
+
+ //--------------------------------------------------- writeMessage -----------
+ //! \brief Writes data to a Message object
+ //!
+ //! Writes the data contained in a Messagable object to a Message object.
+ //! All previous data in the Message will be cleared or overwritten.
+ //!
+ //! \param msg The Message to write to
+ //! \return void
+ //!
+ virtual void writeMessage (Message_t & msg) const = 0;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Message_AMOS_HH
diff --git a/src/AMOS/Motif_AMOS.cc b/src/AMOS/Motif_AMOS.cc
new file mode 100644
index 0000000..edf4cee
--- /dev/null
+++ b/src/AMOS/Motif_AMOS.cc
@@ -0,0 +1,87 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 10/23/2003
+//!
+//! \brief Source for Motif_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Motif_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ Motif_t ==================
+const NCode_t Motif_t::NCODE = M_MOTIF;
+
+//----------------------------------------------------- readMessage ------------
+void Motif_t::readMessage (const Message_t & msg)
+{
+ try {
+ istringstream ss;
+
+ if ( msg . exists (F_SCAFFOLD) )
+ {
+ ss . str (msg . getField (F_SCAFFOLD));
+ ss >> scf_m;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid scaffold format");
+ ss . clear( );
+ }
+
+ Scaffold_t::readMessage (msg);
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Motif_t::readRecord (istream & fix, istream & var)
+{
+ readLE (fix, &scf_m);
+ Scaffold_t::readRecord (fix, var);
+}
+
+//----------------------------------------------------- readRecordFix ----------
+void Motif_t::readRecordFix (istream & fix)
+{
+ readLE (fix, &scf_m);
+ Scaffold_t::readRecordFix (fix);
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Motif_t::writeMessage (Message_t & msg) const
+{
+ try {
+ ostringstream ss;
+ if ( scf_m != NULL_ID )
+ {
+ ss << scf_m;
+ msg . setField (F_SCAFFOLD, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ Scaffold_t::writeMessage (msg);
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Motif_t::writeRecord (ostream & fix, ostream & var) const
+{
+ writeLE (fix, &scf_m);
+ Scaffold_t::writeRecord(fix, var);
+}
diff --git a/src/AMOS/Motif_AMOS.hh b/src/AMOS/Motif_AMOS.hh
new file mode 100644
index 0000000..69811fb
--- /dev/null
+++ b/src/AMOS/Motif_AMOS.hh
@@ -0,0 +1,115 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Sergey Koren
+//! \date 04/11/11
+//!
+//! \brief Header for Motif_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Motif_AMOS_HH
+#define __Motif_AMOS_HH 1
+
+#include "Universal_AMOS.hh"
+#include "Scaffold_AMOS.hh"
+#include <vector>
+
+
+
+
+namespace AMOS {
+
+//================================================ Motif_t ==================
+//! \brief A ordered, oriented and positioned list of contigs
+//!
+//! A list of contigs that are ordered, oriented and positioned in
+//! relation to one another.
+//!
+//==============================================================================
+class Motif_t : public Scaffold_t
+{
+
+private:
+ ID_t scf_m;
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //--------------------------------------------------- Motif_t -------------
+ //! \brief Constructs an empty Motif_t object
+ //!
+ Motif_t ( )
+ {
+ scf_m = NULL_ID;
+ }
+
+
+ //--------------------------------------------------- Motif_t -------------
+ //! \brief Copy constructor
+ //!
+ Motif_t (const Motif_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~Motif_t ------------
+ //! \brief Destroys a Motif_t object
+ //!
+ ~Motif_t ( )
+ {
+
+ }
+
+ void setScf(ID_t &id) {
+ scf_m = id;
+ }
+
+ ID_t getScf() {
+ return scf_m;
+ }
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ Scaffold_t::clear( );
+ scf_m = NULL_ID;
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Motif_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Motif_AMOS_HH
diff --git a/src/AMOS/Overlap_AMOS.cc b/src/AMOS/Overlap_AMOS.cc
new file mode 100644
index 0000000..3bfc34d
--- /dev/null
+++ b/src/AMOS/Overlap_AMOS.cc
@@ -0,0 +1,199 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 10/23/2003
+//!
+//! \brief Source for Overlap_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Overlap_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ Overlap_t ===================
+const NCode_t Overlap_t::NCODE = M_OVERLAP;
+
+
+//----------------------------------------------------- flip -------------------
+void Overlap_t::flip ( )
+{
+ OverlapAdjacency_t oa = getAdjacency( );
+ if ( oa == NORMAL )
+ setAdjacency (ANTINORMAL);
+ else if ( oa == ANTINORMAL )
+ setAdjacency (NORMAL);
+
+ Size_t tHang = aHang_m;
+ aHang_m = bHang_m;
+ bHang_m = tHang;
+
+ reads_m = std::make_pair (reads_m . second, reads_m . first);
+}
+
+
+//----------------------------------------------------- readMessage ------------
+void Overlap_t::readMessage (const Message_t & msg)
+{
+ Oriented_t::readMessage (msg);
+
+ try {
+ istringstream ss;
+
+ if ( msg . exists (F_READS) )
+ {
+ ss . str (msg . getField (F_READS));
+ ss >> reads_m . first;
+ ss . ignore( );
+ ss >> reads_m . second;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid nodes format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_ADJACENCY) )
+ {
+ ss . str (msg . getField (F_ADJACENCY));
+ setAdjacency (ss . get( ));
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_AHANG) )
+ {
+ ss . str (msg . getField (F_AHANG));
+ ss >> aHang_m;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid aHang format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_BHANG) )
+ {
+ ss . str (msg . getField (F_BHANG));
+ ss >> bHang_m;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid bHang format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_SCORE) )
+ {
+ ss . str (msg . getField (F_SCORE));
+ ss >> score_m;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid score format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_FLAG) )
+ {
+ char fA, fB, fC;
+ ss . str (msg . getField (F_FLAG));
+ ss >> fA >> fB >> fC;
+ setFlagA ( fA == '1' );
+ setFlagB ( fB == '1' );
+ setFlagC ( fC == '1' );
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid flag format");
+ ss . clear( );
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Overlap_t::readRecord (istream & fix, istream & var)
+{
+ Oriented_t::readRecord (fix, var);
+
+ readLE (fix, &aHang_m);
+ readLE (fix, &bHang_m);
+ readLE (fix, &(reads_m . first));
+ readLE (fix, &(reads_m . second));
+ readLE (fix, &score_m);
+}
+
+
+//----------------------------------------------------- readRecordFix ----------
+void Overlap_t::readRecordFix (istream & fix)
+{
+ Oriented_t::readRecordFix (fix);
+
+ readLE (fix, &aHang_m);
+ readLE (fix, &bHang_m);
+ readLE (fix, &(reads_m . first));
+ readLE (fix, &(reads_m . second));
+ readLE (fix, &score_m);
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Overlap_t::writeMessage (Message_t & msg) const
+{
+ Oriented_t::writeMessage (msg);
+
+ try {
+ ostringstream ss;
+
+ msg . setMessageCode (Overlap_t::NCODE);
+
+ if ( reads_m . first != NULL_ID || reads_m . second != NULL_ID )
+ {
+ ss << reads_m . first << ',' << reads_m . second;
+ msg . setField (F_READS, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( getAdjacency( ) != NULL_ADJACENCY )
+ {
+ ss << getAdjacency( );
+ msg . setField (F_ADJACENCY, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ ss << aHang_m;
+ msg . setField (F_AHANG, ss . str( ));
+ ss . str (NULL_STRING);
+
+ ss << bHang_m;
+ msg . setField (F_BHANG, ss . str( ));
+ ss . str (NULL_STRING);
+
+ ss << score_m;
+ msg . setField (F_SCORE, ss . str( ));
+ ss . str (NULL_STRING);
+
+ if ( isFlagA( ) || isFlagB( ) || isFlagC( ) )
+ {
+ ss << isFlagA( ) << isFlagB( ) << isFlagC( );
+ msg . setField (F_FLAG, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Overlap_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Oriented_t::writeRecord (fix, var);
+
+ writeLE (fix, &aHang_m);
+ writeLE (fix, &bHang_m);
+ writeLE (fix, &(reads_m . first));
+ writeLE (fix, &(reads_m . second));
+ writeLE (fix, &score_m);
+}
diff --git a/src/AMOS/Overlap_AMOS.hh b/src/AMOS/Overlap_AMOS.hh
new file mode 100644
index 0000000..e2b62b4
--- /dev/null
+++ b/src/AMOS/Overlap_AMOS.hh
@@ -0,0 +1,270 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/18/2003
+//!
+//! \brief Header for Overlap_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Overlap_AMOS_HH
+#define __Overlap_AMOS_HH 1
+
+#include "Universal_AMOS.hh"
+
+
+
+
+namespace AMOS {
+
+typedef Adjacency_t OverlapAdjacency_t;
+
+//================================================ Overlap_t ===================
+//! \brief An overlap relation between to sequencing reads
+//!
+//! A similarity based overlap between two Read_t that suggests their relative
+//! location (to one another) in the original sequence. If storing a large
+//! number of overlaps in an AMOS bank, it is wise to omit the IID and EID
+//! fields from the objects as these values will only be written to the bank
+//! if they are non-NULL. Also, an extra bit flag (FlagC) is provided in
+//! addition to FlagA and FlagB which are inherited.
+//!
+//==============================================================================
+class Overlap_t : public Oriented_t
+{
+
+private:
+
+ Size_t aHang_m; //!< length of non-overlapping portion of A
+ Size_t bHang_m; //!< length of non-overlapping portion of B
+ std::pair<ID_t, ID_t> reads_m; //!< the pair of read IIDs
+ uint32_t score_m; //!< overlap score
+
+
+protected:
+
+ static const uint8_t FLAGC_BIT = 0x8; //!< C flag
+
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+ static const OverlapAdjacency_t NULL_ADJACENCY = 0;
+ static const OverlapAdjacency_t NORMAL = 'N'; //!< E,B
+ static const OverlapAdjacency_t ANTINORMAL = 'A'; //!< B,E
+ static const OverlapAdjacency_t INNIE = 'I'; //!< E,E
+ static const OverlapAdjacency_t OUTIE = 'O'; //!< B,B
+
+
+ //--------------------------------------------------- Overlap_t --------------
+ //! \brief Constructs an empty Overlap_t object
+ //!
+ //! Sets all members to 0
+ //!
+ Overlap_t ( )
+ {
+ score_m = 0;
+ aHang_m = bHang_m = 0;
+ reads_m . first = reads_m . second = NULL_ID;
+ }
+
+
+ //--------------------------------------------------- Overlap_t --------------
+ //! \brief Copy constructor
+ //!
+ Overlap_t (const Overlap_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~Overlap_t -------------
+ //! \brief Destroys a Overlap_t object
+ //!
+ ~Overlap_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ Oriented_t::clear( );
+ score_m = 0;
+ aHang_m = bHang_m = 0;
+ reads_m . first = reads_m . second = NULL_ID;
+ }
+
+
+ //--------------------------------------------------- flip -------------------
+ //! \brief Flip the orientation of the overlap
+ //!
+ //! Reverses the order of the read IIDs and changes the overlap adjacency as
+ //! altered by the new orientation of the reads. Does not alter adjacency
+ //! if it is currently a NULL_ADJACENCY. Also, swaps the a/bHang values.
+ //! After flip, NORMAL becomes ANTINORMAL, ANTINORMAL becomes NORMAL, and
+ //! INNIE and OUTIE remain the same.
+ //!
+ //! \return void
+ //!
+ void flip ( );
+
+
+ //--------------------------------------------------- getAhang ---------------
+ //! \brief Get the A-hang overlap value
+ //!
+ //! Get the length of the non-overlapping portion of the first read.
+ //!
+ //! \return The A-hang overlap value
+ //!
+ Size_t getAhang ( ) const
+ {
+ return aHang_m;
+ }
+
+
+ //--------------------------------------------------- getBhang ---------------
+ //! \brief Get the B-hang overlap value
+ //!
+ //! Get the length of the non-overlapping portion of the second read.
+ //!
+ //! \return The B-hang overlap value
+ //!
+ Size_t getBhang ( ) const
+ {
+ return bHang_m;
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Overlap_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getReads ---------------
+ //! \brief Get the pair of contig IIDs joined by this overlap
+ //!
+ //! \return The first and second read IIDs joined by this overlap
+ //!
+ std::pair<ID_t, ID_t> getReads ( ) const
+ {
+ return reads_m;
+ }
+
+
+ //--------------------------------------------------- getScore ---------------
+ //! \brief Get the overlap score
+ //!
+ //! \return A 32-bit unsigned integer representing the overlap score
+ //!
+ uint32_t getScore ( ) const
+ {
+ return score_m;
+ }
+
+
+ //--------------------------------------------------- isFlagC ----------------
+ //! \brief Check the value of flag C
+ //!
+ //! \return The value of flag C
+ //!
+ bool isFlagC ( ) const
+ {
+ return flags_m . nibble & FLAGC_BIT;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- setAhang ---------------
+ //! \brief Set the A-hang overlap value
+ //!
+ //! Set the length of the non-overlapping portion of the first read.
+ //!
+ //! \param aHang The new A-hang overlap value
+ //! \return The new A-hang overlap value
+ //!
+ void setAhang (Size_t aHang)
+ {
+ aHang_m = aHang;
+ }
+
+
+ //--------------------------------------------------- setBhang ---------------
+ //! \brief Set the B-hang overlap value
+ //!
+ //! Set the length of the non-overlapping portion of the second read.
+ //!
+ //! \param bHang The new B-hang overlap value
+ //! \return The new B-hang overlap value
+ //!
+ void setBhang (Size_t bHang)
+ {
+ bHang_m = bHang;
+ }
+
+
+ //--------------------------------------------------- setFlagC ---------------
+ //! \brief Set the value of flag C
+ //!
+ //! \param flag The new flag C value
+ //! \return void
+ //!
+ void setFlagC (bool flag)
+ {
+ if ( flag )
+ flags_m . nibble |= FLAGC_BIT;
+ else
+ flags_m . nibble &= ~FLAGC_BIT;
+ }
+
+
+ //--------------------------------------------------- setReads ---------------
+ //! \brief Set the read IID pair for this overlap
+ //!
+ //! \param reads The new pair of read IIDs
+ //!
+ void setReads (std::pair<ID_t, ID_t> reads)
+ {
+ reads_m = reads;
+ }
+
+
+ //--------------------------------------------------- setScore ---------------
+ //! \brief Set the overlap score
+ //!
+ //! \param score A 32-bit unsigned integer representing the overlap score
+ //! \return void
+ //!
+ void setScore (uint32_t score)
+ {
+ score_m = score;
+ }
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Overlap_AMOS_HH
diff --git a/src/AMOS/Read_AMOS.cc b/src/AMOS/Read_AMOS.cc
new file mode 100644
index 0000000..c0ddbc0
--- /dev/null
+++ b/src/AMOS/Read_AMOS.cc
@@ -0,0 +1,297 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 09/24/2003
+//!
+//! \brief Source for Read_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Read_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ Read_t ======================
+const NCode_t Read_t::NCODE = M_READ;
+
+
+//----------------------------------------------------- clear ------------------
+void Read_t::clear ( )
+{
+ Sequence_t::clear( );
+ clear_m . clear( );
+ frag_m = NULL_ID;
+ qclear_m . clear( );
+ type_m = NULL_READ;
+ vclear_m . clear( );
+ bcp_m . clear( );
+ pos_m = 0;
+}
+
+
+//----------------------------------------------------- readMessage-------------
+void Read_t::readMessage (const Message_t & msg)
+{
+ Sequence_t::readMessage (msg);
+
+ try {
+ int16_t bcp;
+ istringstream ss;
+
+ if ( msg . exists (F_FRAGMENT) )
+ {
+ ss . str (msg . getField (F_FRAGMENT));
+ ss >> frag_m;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ((string) "Invalid fragment link format: " + msg.getField(F_FRAGMENT));
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_TYPE) )
+ {
+ ss . str (msg . getField (F_TYPE));
+ setType (ss . get( ));
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_CLEAR) )
+ {
+ ss . str (msg . getField (F_CLEAR));
+ ss >> clear_m . begin;
+ ss . ignore( );
+ ss >> clear_m . end;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ((string) "Invalid clear range format: " + msg.getField(F_CLEAR));
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_VECTORCLEAR) )
+ {
+ ss . str (msg . getField (F_VECTORCLEAR));
+ ss >> vclear_m . begin;
+ ss . ignore( );
+ ss >> vclear_m . end;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ((string) "Invalid vector clear range format: " + msg.getField(F_VECTORCLEAR));
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_QUALITYCLEAR) )
+ {
+ ss . str (msg . getField (F_QUALITYCLEAR));
+ ss >> qclear_m . begin;
+ ss . ignore( );
+ ss >> qclear_m . end;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ((string) "Invalid quality clear range format: " + msg.getField(F_QUALITYCLEAR));
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_BASEPOSITION) )
+ {
+ ss . str (msg . getField (F_BASEPOSITION));
+
+ while ( ss )
+ {
+ ss >> bcp;
+ if ( ! ss . fail( ) )
+ bcp_m . push_back (bcp);
+ }
+
+ if ( !ss . eof( ) )
+ AMOS_THROW_ARGUMENT ((string) "Invalid base call position format: " + msg.getField(F_BASEPOSITION));
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_POSITION) )
+ {
+ ss . str (msg . getField (F_POSITION));
+ ss >> pos_m;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ((string) "Invalid fragment position format: " + msg.getField(F_POSITION));
+ ss . clear( );
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Read_t::readRecord (istream & fix, istream & var)
+{
+ Size_t size;
+ Sequence_t::readRecord (fix, var);
+
+ readLE (fix, &(clear_m . begin));
+ readLE (fix, &(clear_m . end));
+ readLE (fix, &frag_m);
+ readLE (fix, &(qclear_m . begin));
+ readLE (fix, &(qclear_m . end));
+ type_m = fix . get( );
+ readLE (fix, &(vclear_m . begin));
+ readLE (fix, &(vclear_m . end));
+ readLE (fix, &pos_m);
+ readLE (fix, &size);
+
+ bcp_m . resize (size);
+ for ( Pos_t i = 0; i < size; i ++ )
+ readLE (var, &(bcp_m [i]));
+}
+
+//----------------------------------------------------- readRecordFix ----------
+void Read_t::readRecordFix (istream & fix)
+{
+ Size_t size;
+ Sequence_t::readRecordFix (fix);
+
+ readLE (fix, &(clear_m . begin));
+ readLE (fix, &(clear_m . end));
+ readLE (fix, &frag_m);
+ readLE (fix, &(qclear_m . begin));
+ readLE (fix, &(qclear_m . end));
+ type_m = fix . get( );
+ readLE (fix, &(vclear_m . begin));
+ readLE (fix, &(vclear_m . end));
+ readLE (fix, &pos_m);
+ readLE (fix, &size);
+
+ bcp_m.clear();
+}
+
+
+//----------------------------------------------------- setType ----------------
+void Read_t::setType (ReadType_t type)
+{
+ switch (type)
+ {
+ case NULL_READ:
+ case OTHER:
+ case END:
+ case CONTIG:
+ case BAC:
+ case WALK:
+ case TRANSPOSON:
+ type_m = type;
+ break;
+ default:
+ AMOS_THROW_ARGUMENT ((string)"Invalid read type " + type);
+ }
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Read_t::writeMessage (Message_t & msg) const
+{
+ Sequence_t::writeMessage (msg);
+
+ try {
+ vector<int16_t>::const_iterator vi;
+ ostringstream ss;
+
+ msg . setMessageCode (Read_t::NCODE);
+
+ if ( frag_m != NULL_ID )
+ {
+ ss << frag_m;
+ msg . setField (F_FRAGMENT, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( type_m != NULL_READ )
+ {
+ ss << type_m;
+ msg . setField (F_TYPE, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( clear_m . getLength( ) != 0 )
+ {
+ ss << clear_m . begin << ',' << clear_m . end;
+ msg . setField (F_CLEAR, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( vclear_m . getLength( ) != 0 )
+ {
+ ss << vclear_m . begin << ',' << vclear_m . end;
+ msg . setField (F_VECTORCLEAR, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( qclear_m . getLength( ) != 0 )
+ {
+ ss << qclear_m . begin << ',' << qclear_m . end;
+ msg . setField (F_QUALITYCLEAR, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( !bcp_m . empty( ) )
+ {
+ for ( vi = bcp_m . begin( ); vi != bcp_m . end( ); vi ++ )
+ ss << *vi << '\n';
+ msg . setField (F_BASEPOSITION, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( pos_m != 0 )
+ {
+ ss << pos_m;
+ msg . setField (F_POSITION, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Read_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Size_t size = bcp_m . size( );
+ Sequence_t::writeRecord (fix, var);
+
+ writeLE (fix, &(clear_m . begin));
+ writeLE (fix, &(clear_m . end));
+ writeLE (fix, &frag_m);
+ writeLE (fix, &(qclear_m . begin));
+ writeLE (fix, &(qclear_m . end));
+ fix . put (type_m);
+ writeLE (fix, &(vclear_m . begin));
+ writeLE (fix, &(vclear_m . end));
+ writeLE (fix, &pos_m);
+ writeLE (fix, &size);
+
+ for ( Pos_t i = 0; i < size; i ++ )
+ writeLE (var, &(bcp_m [i]));
+}
+
+
+//================================================ Helper Functions ============
+//----------------------------------------------------- operator<< -------------
+ostream & AMOS::operator<< (ostream & out, Read_t & read)
+{
+ string s;
+
+ out << "#iid:" << read.getIID( ) << endl;
+ out << "#comment:" << endl;
+ out << read.getComment( ) << endl;
+ out << "#clear:" << read.getClearRange( ).begin << ","
+ << read.getClearRange( ).end << endl;
+ out << "#sequence:" << endl;
+ WrapString (out, read.getSeqString( ), 70);
+ out << "#quality:" << endl;
+ WrapString (out, read.getQualString( ), 70);
+
+ return out;
+}
diff --git a/src/AMOS/Read_AMOS.hh b/src/AMOS/Read_AMOS.hh
new file mode 100644
index 0000000..8aaa33e
--- /dev/null
+++ b/src/AMOS/Read_AMOS.hh
@@ -0,0 +1,318 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/18/2003
+//!
+//! \brief Header for Read_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Read_AMOS_HH
+#define __Read_AMOS_HH 1
+
+#include "Sequence_AMOS.hh"
+#include <vector>
+
+
+
+
+namespace AMOS {
+
+typedef char ReadType_t;
+
+//================================================ Read_t ======================
+//! \brief A DNA sequencing read
+//!
+//! Derived from a Sequence_t type, this class is for the efficient storage of
+//! DNA sequencing reads. Retains all the functionality of a Sequence with
+//! added fields for clear ranges, mate pairs, etc.
+//!
+//==============================================================================
+class Read_t : public Sequence_t
+{
+
+private:
+
+ Range_t clear_m; //!< generic clear range
+ ID_t frag_m; //!< the IID of the parent fragment
+ Range_t qclear_m; //!< the quality score clear range
+ ReadType_t type_m; //!< the read type
+ Range_t vclear_m; //!< the vector clear range
+ std::vector<int16_t> bcp_m; //!< base call positions
+ Pos_t pos_m; //!< position on parent fragment
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+ static const ReadType_t NULL_READ = 0;
+ static const ReadType_t OTHER = 'X';
+ static const ReadType_t END = 'E';
+ static const ReadType_t CONTIG = 'C';
+ static const ReadType_t BAC = 'B';
+ static const ReadType_t WALK = 'W';
+ static const ReadType_t TRANSPOSON = 'T';
+
+
+ //--------------------------------------------------- Read_t -----------------
+ //! \brief Constructs an empty Read_t object
+ //!
+ //! Sets all members to NULL
+ //!
+ Read_t ( )
+ {
+ frag_m = NULL_ID;
+ type_m = NULL_READ;
+ pos_m = 0;
+ }
+
+
+ //--------------------------------------------------- Read_t -----------------
+ //! \brief Copy constructor
+ //!
+ Read_t (const Read_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~Read_t ----------------
+ //! \brief Destroys a Read_t object
+ //!
+ ~Read_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( );
+
+
+ //--------------------------------------------------- getBasePositions -------
+ //! \brief Get the base call positions
+ //!
+ //! If the vector is empty, then no base call positions are provided.
+ //! Otherwise, the vector should have a size equal to the sequence length
+ //! representing the base call positions as specified by the base-caller.
+ //!
+ //! \return The vector of base call positions
+ //!
+ const std::vector<int16_t> & getBasePositions ( ) const
+ {
+ return bcp_m;
+ }
+
+
+ //--------------------------------------------------- getBasePositions -------
+ //! \brief Get the base call positions
+ //!
+ //! If the vector is empty, then no base call positions are provided.
+ //! Otherwise, the vector should have a size equal to the sequence length
+ //! representing the base call positions as specified by the base-caller.
+ //!
+ //! \return The vector of base call positions
+ //!
+ std::vector<int16_t> & getBasePositions ( )
+ {
+ return bcp_m;
+ }
+
+
+ //--------------------------------------------------- getClearRange ----------
+ //! \brief Get the generic clear range
+ //!
+ //! \return The generic clear range
+ //!
+ Range_t getClearRange ( )
+ {
+ return clear_m;
+ }
+
+
+ //--------------------------------------------------- getFragment ------------
+ //! \brief Get the parent fragment IID
+ //!
+ //! \return The parent fragment IID
+ //!
+ ID_t getFragment ( ) const
+ {
+ return frag_m;
+ }
+
+
+ //--------------------------------------------------- getFragmentPosition ----
+ //! \brief Get the approximate position on the parent fragment
+ //!
+ //! Get this read's 1-based position on the parent fragment, positive if
+ //! counting from left and oriented forward, negative if counting from right
+ //! and reverse oriented, 0 if unknown.
+ //!
+ //! \return The position of this read on the parent fragment
+ //!
+ Pos_t getFragmentPosition ( )
+ {
+ return pos_m;
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Read_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getQualityClearRange ---
+ //! \brief Get the quality score clear range
+ //!
+ //! \return The quality score clear range
+ //!
+ Range_t getQualityClearRange ( )
+ {
+ return qclear_m;
+ }
+
+
+ //--------------------------------------------------- getType ----------------
+ //! \brief Get the type of read
+ //!
+ //! \return The type of read
+ //!
+ ReadType_t getType ( ) const
+ {
+ return type_m;
+ }
+
+
+ //--------------------------------------------------- getVectorClearRange ----
+ //! \brief Get the vector sequence clear range
+ //!
+ //! \return The vector sequence clear range
+ //!
+ Range_t getVectorClearRange ( )
+ {
+ return vclear_m;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- setBasePositions -------
+ //! \brief Set the base call positions
+ //!
+ //! \param bcp The new vector of base call positions
+ //! \return void
+ //!
+ void setBasePositions (const std::vector<int16_t> & bcp)
+ {
+ bcp_m = bcp;
+ }
+
+
+ //--------------------------------------------------- setClearRange ----------
+ //! \brief Set the generic clear range
+ //!
+ //! \param clear The new generic clear range
+ //! \return void
+ //!
+ void setClearRange (Range_t clear)
+ {
+ clear_m = clear;
+ }
+
+
+ //--------------------------------------------------- setFragment ------------
+ //! \brief Set the parent fragment IID
+ //!
+ //! \param frag The new parent fragment IID
+ //! \return void
+ //!
+ void setFragment (ID_t frag)
+ {
+ frag_m = frag;
+ }
+
+
+ //--------------------------------------------------- setFragmentPosition ----
+ //! \brief Set the approximate position on the parent fragment
+ //!
+ //! Set this read's 1-based position on the parent fragment, positive if
+ //! counting from left and oriented forward, negative if counting from right
+ //! and reverse oriented, 0 if unknown.
+ //!
+ //! \param pos The approximate position of this read on the parent fragment
+ //! \return void
+ //!
+ void setFragmentPosition (Pos_t pos)
+ {
+ pos_m = pos;
+ }
+
+
+ //--------------------------------------------------- setQualityClearRange ---
+ //! \brief Set the quality score clear range
+ //!
+ //! \param qclear The new quality score clear range
+ //! \return void
+ //!
+ void setQualityClearRange (Range_t qclear)
+ {
+ qclear_m = qclear;
+ }
+
+
+ //--------------------------------------------------- setType ----------------
+ //! \brief Set the type of read
+ //!
+ //! \param type The new type of read
+ //! \pre type is one of [XECBW]
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void setType (ReadType_t type);
+
+
+ //--------------------------------------------------- setVectorClearRange ----
+ //! \brief Set the vector sequence clear range
+ //!
+ //! \param vclear The new vector sequence clear range
+ //! \return void
+ //!
+ void setVectorClearRange (Range_t vclear)
+ {
+ vclear_m = vclear;
+ }
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+
+//================================================ Helper Functions ============
+//----------------------------------------------------- operator<< -------------
+//! \brief Dump read object to ostream
+//!
+std::ostream & operator<< (std::ostream & o, Read_t & read);
+
+} // namespace AMOS
+
+#endif // #ifndef __Read_AMOS_HH
diff --git a/src/AMOS/ScaffoldEdge_AMOS.cc b/src/AMOS/ScaffoldEdge_AMOS.cc
new file mode 100644
index 0000000..5878f83
--- /dev/null
+++ b/src/AMOS/ScaffoldEdge_AMOS.cc
@@ -0,0 +1,85 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 10/19/2003
+//!
+//! \brief Source for ScaffoldEdge_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "ScaffoldEdge_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ ScaffoldEdge_t ==============
+const NCode_t ScaffoldEdge_t::NCODE = M_SCAFFOLDEDGE;
+
+
+//----------------------------------------------------- readMessage ------------
+void ScaffoldEdge_t::readMessage (const Message_t & msg)
+{
+ ScaffoldLink_t::readMessage (msg);
+ IEdge_t::readMessage (msg);
+
+ try {
+ // put ScaffoldEdge_t specifics here
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void ScaffoldEdge_t::readRecord (istream & fix, istream & var)
+{
+ ScaffoldLink_t::readRecord (fix, var);
+ IEdge_t::readRecord (fix, var);
+
+ // put ScaffoldEdge_t specifics here
+}
+
+
+//----------------------------------------------------- readRecordFix ----------
+void ScaffoldEdge_t::readRecordFix (istream & fix)
+{
+ ScaffoldLink_t::readRecordFix (fix);
+ IEdge_t::readRecordFix (fix);
+
+ // put ScaffoldEdge_t specifics here
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void ScaffoldEdge_t::writeMessage (Message_t & msg) const
+{
+ ScaffoldLink_t::writeMessage (msg);
+ IEdge_t::writeMessage (msg);
+
+ try {
+
+ msg . setMessageCode (ScaffoldEdge_t::NCODE);
+
+ // put ScaffoldEdge_t specifics here
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void ScaffoldEdge_t::writeRecord (ostream & fix, ostream & var) const
+{
+ ScaffoldLink_t::writeRecord (fix, var);
+ IEdge_t::writeRecord (fix, var);
+
+ // put ScaffoldEdge_t specifics here
+}
diff --git a/src/AMOS/ScaffoldEdge_AMOS.hh b/src/AMOS/ScaffoldEdge_AMOS.hh
new file mode 100644
index 0000000..3f0e24e
--- /dev/null
+++ b/src/AMOS/ScaffoldEdge_AMOS.hh
@@ -0,0 +1,145 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 10/19/2003
+//!
+//! \brief Header for ScaffoldEdge_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __ScaffoldEdge_AMOS_HH
+#define __ScaffoldEdge_AMOS_HH 1
+
+#include "Edge_AMOS.hh"
+#include "ScaffoldLink_AMOS.hh"
+#include <vector>
+
+
+
+
+namespace AMOS {
+
+//================================================ ScaffoldEdge_t ==============
+//! \brief Reliable linking information between two scaffolds
+//!
+//! Derived from a ScaffoldLink_t, this class represents a reliable link between
+//! two scaffolds that is usually composed of multiple scaffold links.
+//!
+//==============================================================================
+ class ScaffoldEdge_t : public ScaffoldLink_t, public IEdge_t
+{
+
+private:
+
+ void setNodeType (NCode_t nodtype);
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //--------------------------------------------------- ScaffoldEdge_t ---------
+ //! \brief Constructs an empty ScaffoldEdge_t object
+ //!
+ ScaffoldEdge_t ( )
+ {
+ // ScaffoldLink_t sets NodeType
+ }
+
+
+ //--------------------------------------------------- ScaffoldEdge_t ---------
+ //! \brief Copy constructor
+ //!
+ ScaffoldEdge_t (const ScaffoldEdge_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~ScaffoldEdge_t --------
+ //! \brief Destroys a ScaffoldEdge_t object
+ //!
+ ~ScaffoldEdge_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ // ScaffoldLink_t preserves NodeType
+ ScaffoldLink_t::clear( );
+ IEdge_t::clear( );
+ }
+
+
+ //--------------------------------------------------- getScaffoldLinks -------
+ //! \brief Get the bundle of scaffold link IIDs that make up this edge
+ //!
+ //! \return A vector of scaffold link IIDs
+ //!
+ const std::vector<ID_t> & getScaffoldLinks ( ) const
+ {
+ return IEdge_t::getLinks( );
+ }
+
+
+ //--------------------------------------------------- getScaffoldLinks -------
+ //! \brief Get the bundle of scaffold link IIDs that make up this edge
+ //!
+ //! \return A vector of scaffold link IIDs
+ //!
+ std::vector<ID_t> & getScaffoldLinks ( )
+ {
+ return IEdge_t::getLinks( );
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return ScaffoldEdge_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- setScaffoldLinks -------
+ //! \brief Set the bundle of scaffold link IIDs that make up this edge
+ //!
+ //! \param links The new vector of scaffold link IIDs
+ //! \return void
+ //!
+ void setScaffoldLinks (const std::vector<ID_t> & links)
+ {
+ IEdge_t::setLinks (links);
+ }
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __ScaffoldEdge_AMOS_HH
diff --git a/src/AMOS/ScaffoldLink_AMOS.cc b/src/AMOS/ScaffoldLink_AMOS.cc
new file mode 100644
index 0000000..cd6d50d
--- /dev/null
+++ b/src/AMOS/ScaffoldLink_AMOS.cc
@@ -0,0 +1,80 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 10/19/2003
+//!
+//! \brief Source for ScaffoldLink_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "ScaffoldLink_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ ScaffoldLink_t ==============
+const NCode_t ScaffoldLink_t::NCODE = M_SCAFFOLDLINK;
+
+
+//----------------------------------------------------- readMessage ------------
+void ScaffoldLink_t::readMessage (const Message_t & msg)
+{
+ Link_t::readMessage (msg);
+
+ try {
+ Link_t::setNodeType (NULL_NCODE);
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void ScaffoldLink_t::readRecord (istream & fix, istream & var)
+{
+ Link_t::readRecord (fix, var);
+
+ Link_t::setNodeType (NULL_NCODE);
+}
+
+
+//----------------------------------------------------- readRecordFix ----------
+void ScaffoldLink_t::readRecordFix (istream & fix)
+{
+ Link_t::readRecordFix (fix);
+
+ Link_t::setNodeType (NULL_NCODE);
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void ScaffoldLink_t::writeMessage (Message_t & msg) const
+{
+ Link_t::writeMessage (msg);
+
+ try {
+
+ msg . setMessageCode (ScaffoldLink_t::NCODE);
+
+ // put ScaffoldLink_t specifics here
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void ScaffoldLink_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Link_t::writeRecord (fix, var);
+
+ // put ScaffoldLink_t specifics here
+}
diff --git a/src/AMOS/ScaffoldLink_AMOS.hh b/src/AMOS/ScaffoldLink_AMOS.hh
new file mode 100644
index 0000000..d5c27e4
--- /dev/null
+++ b/src/AMOS/ScaffoldLink_AMOS.hh
@@ -0,0 +1,144 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 10/19/2003
+//!
+//! \brief Header for ScaffoldLink_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __ScaffoldLink_AMOS_HH
+#define __ScaffoldLink_AMOS_HH 1
+
+#include "Link_AMOS.hh"
+#include "Scaffold_AMOS.hh"
+#include <utility>
+
+
+
+
+namespace AMOS {
+
+//================================================ ScaffoldLink_t ==============
+//! \brief Linking information between two scaffolds
+//!
+//! A single piece of linking information between two scaffolds. These
+//! individual links can be bundled together to form reliable scaffold edges.
+//!
+//==============================================================================
+class ScaffoldLink_t : public Link_t
+{
+
+private:
+
+ void setNodeType (NCode_t nodtype);
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //--------------------------------------------------- ScaffoldLink_t ---------
+ //! \brief Constructs an empty ScaffoldLink_t object
+ //!
+ //! Sets all members to zero or NULL
+ //!
+ ScaffoldLink_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- ScaffoldLink_t ---------
+ //! \brief Copy constructor
+ //!
+ ScaffoldLink_t (const ScaffoldLink_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~ScaffoldLink_t --------
+ //! \brief Destroys a ScaffoldLink_t object
+ //!
+ ~ScaffoldLink_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ Link_t::clear( );
+ }
+
+
+ //--------------------------------------------------- getScaffolds -----------
+ //! \brief Get the pair of scaffold IIDs joined by this link
+ //!
+ //! \return The first and second scaffold IIDs joined by this link
+ //!
+ std::pair<ID_t, ID_t> getScaffolds ( ) const
+ {
+ return Link_t::getNodes( );
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return ScaffoldLink_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getNodeType ------------
+ NCode_t getNodeType ( ) const
+ {
+ return Scaffold_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- setScaffolds -----------
+ //! \brief Set the scaffold IID pair for this link
+ //!
+ //! Only returns the IIDs of the scaffolds. It is up to the user to keep track
+ //! of where the actual scaffold objects are stored.
+ //!
+ //! \param scaffolds The new pair of scaffold IIDs
+ //! \return void
+ //!
+ void setScaffolds (std::pair<ID_t, ID_t> scaffolds)
+ {
+ Link_t::setNodes (scaffolds);
+ }
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __ScaffoldLink_AMOS_HH
diff --git a/src/AMOS/Scaffold_AMOS.cc b/src/AMOS/Scaffold_AMOS.cc
new file mode 100644
index 0000000..53e5991
--- /dev/null
+++ b/src/AMOS/Scaffold_AMOS.cc
@@ -0,0 +1,187 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 10/23/2003
+//!
+//! \brief Source for Scaffold_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Scaffold_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ Scaffold_t ==================
+const NCode_t Scaffold_t::NCODE = M_SCAFFOLD;
+
+
+//----------------------------------------------------- getSpan ----------------
+Size_t Scaffold_t::getSpan ( ) const
+{
+ Pos_t hi,lo;
+
+ if ( contigs_m . empty( ) )
+ {
+ hi = 0;
+ lo = 0;
+ }
+ else
+ {
+ hi = -(MAX_POS);
+ lo = MAX_POS;
+ }
+
+ vector<Tile_t>::const_iterator ti;
+ for ( ti = contigs_m . begin( ); ti != contigs_m . end( ); ++ ti )
+ {
+ if ( ti -> offset < lo )
+ lo = ti -> offset;
+ if ( ti -> offset + ti -> range . getLength( ) > hi )
+ hi = ti -> offset + ti -> range . getLength( );
+ }
+
+ return hi - lo;
+}
+
+
+//----------------------------------------------------- readMessage ------------
+void Scaffold_t::readMessage (const Message_t & msg)
+{
+ Universal_t::readMessage (msg);
+
+ try {
+ vector<Message_t>::const_iterator i;
+
+ if ( msg . exists (F_EDGE) )
+ {
+ ID_t iid;
+ istringstream ss;
+
+ ss . str (msg . getField (F_EDGE));
+
+ while ( ss )
+ {
+ ss >> iid;
+ if ( ! ss . fail( ) )
+ edges_m . push_back (iid);
+ }
+
+ if ( !ss . eof( ) )
+ AMOS_THROW_ARGUMENT ("Invalid contig edge link list format");
+ ss . clear( );
+ }
+
+ for ( i = msg . getSubMessages( ) . begin( );
+ i != msg . getSubMessages( ) . end( ); i ++ )
+ {
+ if ( i -> getMessageCode( ) == M_TILE )
+ {
+ contigs_m . push_back (Tile_t( ));
+ contigs_m . back( ) . readMessage (*i);
+ }
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Scaffold_t::readRecord (istream & fix, istream & var)
+{
+ Universal_t::readRecord (fix, var);
+
+ Size_t csize, esize;
+ readLE (fix, &csize);
+ readLE (fix, &esize);
+
+ contigs_m . resize (csize);
+ for ( Pos_t i = 0; i < csize; i ++ )
+ contigs_m [i] . readRecord (var);
+
+ edges_m . resize (esize);
+ for ( Pos_t i = 0; i < esize; i ++ )
+ readLE (var, &(edges_m [i]));
+}
+
+
+//----------------------------------------------------- readRecordFix ----------
+void Scaffold_t::readRecordFix (istream & fix)
+{
+ Universal_t::readRecordFix (fix);
+
+ Size_t csize, esize;
+ readLE (fix, &csize);
+ readLE (fix, &esize);
+
+ contigs_m . clear();
+ edges_m . clear();
+
+ contigs_m . resize (csize);
+ edges_m . resize (esize);
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Scaffold_t::writeMessage (Message_t & msg) const
+{
+ Universal_t::writeMessage (msg);
+
+ try {
+ ostringstream ss;
+ Pos_t begin = msg . getSubMessages( ) . size( );
+ msg . getSubMessages( ) . resize (begin + contigs_m . size( ));
+
+ msg . setMessageCode (Scaffold_t::NCODE);
+
+ if ( !edges_m . empty( ) )
+ {
+ string s;
+ vector<ID_t>::const_iterator evi;
+
+ for ( evi = edges_m . begin( ); evi != edges_m . end( ); evi ++ )
+ {
+ ss << *evi << endl;
+ s . append (ss . str( ));
+ ss . str (NULL_STRING);
+ }
+ msg . setField (F_EDGE, s);
+ }
+
+ if ( !contigs_m . empty( ) )
+ {
+ vector<Tile_t>::const_iterator tvi;
+ for ( tvi = contigs_m . begin( ); tvi != contigs_m . end( ); ++ tvi )
+ tvi -> writeMessage (msg . getSubMessages( ) [begin ++]);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Scaffold_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Universal_t::writeRecord (fix, var);
+
+ Size_t csize = contigs_m . size( );
+ Size_t esize = edges_m . size( );
+ writeLE (fix, &csize);
+ writeLE (fix, &esize);
+
+ for ( Pos_t i = 0; i < csize; i ++ )
+ contigs_m [i] . writeRecord (var);
+
+ for ( Pos_t i = 0; i < esize; i ++ )
+ writeLE (var, &(edges_m [i]));
+}
diff --git a/src/AMOS/Scaffold_AMOS.hh b/src/AMOS/Scaffold_AMOS.hh
new file mode 100644
index 0000000..63757ea
--- /dev/null
+++ b/src/AMOS/Scaffold_AMOS.hh
@@ -0,0 +1,203 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/18/2003
+//!
+//! \brief Header for Scaffold_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Scaffold_AMOS_HH
+#define __Scaffold_AMOS_HH 1
+
+#include "Universal_AMOS.hh"
+#include "Layout_AMOS.hh"
+#include <vector>
+
+
+
+
+namespace AMOS {
+
+//================================================ Scaffold_t ==================
+//! \brief A ordered, oriented and positioned list of contigs
+//!
+//! A list of contigs that are ordered, oriented and positioned in
+//! relation to one another.
+//!
+//==============================================================================
+class Scaffold_t : public Universal_t
+{
+
+private:
+
+ std::vector<Tile_t> contigs_m; //!< contig tiling
+ std::vector<ID_t> edges_m; //!< list of contig edges
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //--------------------------------------------------- Scaffold_t -------------
+ //! \brief Constructs an empty Scaffold_t object
+ //!
+ Scaffold_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- Scaffold_t -------------
+ //! \brief Copy constructor
+ //!
+ Scaffold_t (const Scaffold_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~Scaffold_t ------------
+ //! \brief Destroys a Scaffold_t object
+ //!
+ ~Scaffold_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ Universal_t::clear( );
+ contigs_m . clear( );
+ edges_m . clear( );
+ }
+
+
+ //--------------------------------------------------- getContigTiling --------
+ //! \brief Get the tiling of underlying contigs
+ //!
+ //! \return The vector of underlying contigs
+ //!
+ const std::vector<Tile_t> & getContigTiling ( ) const
+ {
+ return contigs_m;
+ }
+
+
+ //--------------------------------------------------- getContigTiling --------
+ //! \brief Get the tiling of underlying contigs
+ //!
+ //! \return The vector of underlying contigs
+ //!
+ std::vector<Tile_t> & getContigTiling ( )
+ {
+ return contigs_m;
+ }
+
+
+ //--------------------------------------------------- getContigEdges ---------
+ //! \brief Get the contig edge IIDs
+ //!
+ //! \return The vector of contig edge IIDs
+ //!
+ const std::vector<ID_t> & getContigEdges ( ) const
+ {
+ return edges_m;
+ }
+
+
+ //--------------------------------------------------- getContigEdges ---------
+ //! \brief Get the contig edge IIDs
+ //!
+ //! \return The vector of contig edge IIDs
+ //!
+ std::vector<ID_t> & getContigEdges ( )
+ {
+ return edges_m;
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Scaffold_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getSpan ----------------
+ //! \brief Get the span of the contig layout
+ //!
+ //! Returns the difference between min(offset) and max(offset+len). Since the
+ //! layout is not necessarily sorted, this method requires linear time.
+ //!
+ //! \return The span of the layout
+ //!
+ Size_t getSpan ( ) const;
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- setContigTiling --------
+ //! \brief Set the tiling of underlying contigs
+ //!
+ //! \param contigs The new vector of underlying contigs
+ //! \return void
+ //!
+ void setContigTiling (const std::vector<Tile_t> & contigs)
+ {
+ contigs_m = contigs;
+ }
+
+
+ //--------------------------------------------------- setContigTiling --------
+ //! \brief Set the tiling of underlying contigs
+ //!
+ //! \param layout The new contig layout
+ //! \return void
+ //!
+ void setContigTiling (const Layout_t & layout)
+ {
+ contigs_m = layout . getTiling( );
+ }
+
+
+ //--------------------------------------------------- setContigEdges ---------
+ //! \brief Set the contig edge IIDs
+ //!
+ //! \param edges The new vector of contig edge IIDs
+ //! \return void
+ //!
+ void setContigEdges (const std::vector<ID_t> & edges)
+ {
+ edges_m = edges;
+ }
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Scaffold_AMOS_HH
diff --git a/src/AMOS/Sequence_AMOS.cc b/src/AMOS/Sequence_AMOS.cc
new file mode 100644
index 0000000..b138131
--- /dev/null
+++ b/src/AMOS/Sequence_AMOS.cc
@@ -0,0 +1,335 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 09/24/2003
+//!
+//! \brief Source for Sequence_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Sequence_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+#define CHARS_PER_LINE 70
+
+
+
+
+//================================================ Sequence_t ==================
+const NCode_t Sequence_t::NCODE = M_SEQUENCE;
+
+
+//----------------------------------------------------- clear ------------------
+void Sequence_t::clear ( )
+{
+ bool compress = flags_m . nibble & COMPRESS_BIT;
+ Universal_t::clear( );
+ free (seq_m);
+ free (qual_m);
+ seq_m = qual_m = NULL;
+ length_m = 0;
+ if ( compress )
+ flags_m . nibble |= COMPRESS_BIT;
+}
+
+
+//----------------------------------------------------- compress ---------------
+void Sequence_t::compress ( )
+{
+ if ( isCompressed( ) )
+ return;
+
+ //-- store compression flag in bit COMPRESS_BIT
+ flags_m . nibble |= COMPRESS_BIT;
+
+ if (seq_m == NULL)
+ return;
+
+ //-- Store compressed data in seq_m
+ for ( Pos_t i = 0; i < length_m; i ++ )
+ seq_m [i] = compress (seq_m [i], qual_m [i]);
+
+ //-- Free qual_m, it is no longer used
+ free (qual_m);
+ qual_m = NULL;
+}
+
+
+//----------------------------------------------------- getQualString ----------
+string Sequence_t::getQualString (Range_t range) const
+{
+ Pos_t lo = range . getLo( );
+ Pos_t hi = range . getHi( );
+
+ //-- Check preconditions
+ if ( lo < 0 || hi > length_m )
+ AMOS_THROW_ARGUMENT ("Invalid quality subrange");
+
+ //-- Allocate space for retval
+ string retval (hi - lo, NULL_CHAR);
+
+ //-- Fill retval
+ for ( Pos_t i = 0; lo < hi; i ++, lo ++ )
+ retval [i] = getBase (lo) . second;
+
+ if ( range . isReverse( ) )
+ AMOS::Reverse (retval);
+
+ return retval;
+}
+
+
+//----------------------------------------------------- getSeqString -----------
+string Sequence_t::getSeqString (Range_t range) const
+{
+ Pos_t lo = range . getLo( );
+ Pos_t hi = range . getHi( );
+
+ //-- Check preconditions
+ if ( lo < 0 || hi > length_m )
+ AMOS_THROW_ARGUMENT ("Invalid sequence subrange");
+
+ //-- Allocate space for retval
+ string retval (hi - lo, NULL_CHAR);
+
+ //-- Fill retval
+ for ( Pos_t i = 0; lo < hi; i ++, lo ++ )
+ retval [i] = getBase (lo) . first;
+
+ if ( range . isReverse( ) )
+ AMOS::ReverseComplement (retval);
+
+ return retval;
+}
+
+
+//--------------------------------------------------- readMessage ------------
+void Sequence_t::readMessage (const Message_t & msg)
+{
+ Universal_t::readMessage (msg);
+
+ try {
+
+ if ( msg . exists (F_SEQUENCE) &&
+ msg . exists (F_QUALITY) )
+ setSequence (msg . getField (F_SEQUENCE),
+ msg . getField (F_QUALITY));
+ else if ( msg . exists (F_SEQUENCE) ||
+ msg . exists (F_QUALITY) )
+ AMOS_THROW_ARGUMENT ("Missing sequence or quality field");
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Sequence_t::readRecord (istream & fix, istream & var)
+{
+ Universal_t::readRecord (fix, var);
+
+ readLE (fix, &length_m);
+
+ seq_m = (uint8_t *) SafeRealloc (seq_m, length_m);
+ var . read ((char *)seq_m, length_m);
+
+ if ( !isCompressed( ) )
+ {
+ qual_m = (uint8_t *) SafeRealloc (qual_m, length_m);
+ var . read ((char *)qual_m, length_m);
+ }
+}
+
+//----------------------------------------------------- readRecordFix ----------
+void Sequence_t::readRecordFix (istream & fix)
+{
+ Universal_t::readRecordFix (fix);
+
+ readLE (fix, &length_m);
+
+ free(seq_m);
+ free(qual_m);
+
+ seq_m = qual_m = NULL;
+}
+
+
+
+
+//----------------------------------------------------- setSequence ------------
+void Sequence_t::setSequence (const char * seq, const char * qual)
+{
+ //-- Check preconditions
+ Size_t length = strlen (seq);
+ if ( length != (Size_t)strlen (qual) )
+ AMOS_THROW_ARGUMENT ("Sequence and quality lengths disagree");
+
+ //-- Set the sequence
+ seq_m = (uint8_t *) SafeRealloc (seq_m, length);
+ if ( !isCompressed( ) )
+ qual_m = (uint8_t *) SafeRealloc (qual_m, length);
+
+ length_m = 0;
+ for ( Pos_t i = 0; i < length; i ++ )
+ {
+ if ( seq [i] == NL_CHAR && qual [i] == NL_CHAR )
+ continue;
+ else if ( seq [i] == NL_CHAR || qual [i] == NL_CHAR )
+ AMOS_THROW_ARGUMENT ("Invalid newline found in seq and qlt data");
+
+ length_m ++;
+ setBase (seq [i], qual [i], length_m - 1);
+ }
+
+ if ( length_m != length )
+ {
+ seq_m = (uint8_t *) SafeRealloc (seq_m, length_m);
+ if ( !isCompressed( ) )
+ qual_m = (uint8_t *) SafeRealloc (qual_m, length_m);
+ }
+}
+
+
+//----------------------------------------------------- setSequence ------------
+void Sequence_t::setSequence (const string & seq, const string & qual)
+{
+ //-- Check preconditions
+ Size_t length = seq . size( );
+ if ( length != (Size_t)qual . size( ) )
+ AMOS_THROW_ARGUMENT ("Sequence and quality lengths disagree");
+
+ //-- Set the sequence
+ seq_m = (uint8_t *) SafeRealloc (seq_m, length);
+ if ( !isCompressed( ) )
+ qual_m = (uint8_t *) SafeRealloc (qual_m, length);
+
+ length_m = 0;
+ for ( Pos_t i = 0; i < length; i ++ )
+ {
+ if ( seq [i] == NL_CHAR && qual [i] == NL_CHAR )
+ continue;
+ else if ( seq [i] == NL_CHAR || qual [i] == NL_CHAR )
+ AMOS_THROW_ARGUMENT ("Invalid newline found in seq and qlt data");
+
+ length_m ++;
+ setBase (seq [i], qual [i], length_m - 1);
+ }
+
+ if ( length_m != length )
+ {
+ seq_m = (uint8_t *) SafeRealloc (seq_m, length_m);
+ if ( !isCompressed( ) )
+ qual_m = (uint8_t *) SafeRealloc (qual_m, length_m);
+ }
+}
+
+
+//----------------------------------------------------- uncompress -------------
+void Sequence_t::uncompress ( )
+{
+ if ( !isCompressed( ) )
+ return;
+
+ //-- store compression flag in bit COMPRESS_BIT
+ flags_m . nibble &= ~COMPRESS_BIT;
+
+ if (seq_m == NULL)
+ return;
+
+ //-- Uncompress, move quality scores back to qual_m
+ pair<char, char> retval;
+ qual_m = (uint8_t *) SafeRealloc (qual_m, length_m);
+ for ( Pos_t i = 0; i < length_m; i ++ )
+ {
+ retval = uncompress (seq_m [i]);
+ seq_m [i] = retval . first;
+ qual_m [i] = retval . second;
+ }
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Sequence_t::writeMessage (Message_t & msg) const
+{
+ Universal_t::writeMessage (msg);
+
+ try {
+
+ msg . setMessageCode (Sequence_t::NCODE);
+
+ if ( length_m != 0 && seq_m )
+ {
+ pair<char, char> cp;
+ Pos_t i, j, last;
+ Size_t pos = length_m + ((length_m - 1) / CHARS_PER_LINE) + 1;
+ string seq (pos, NL_CHAR);
+ string qlt (pos, NL_CHAR);
+
+ pos = 0;
+ for ( i = 0; i < length_m; i += CHARS_PER_LINE )
+ {
+ last = i + CHARS_PER_LINE;
+ if ( length_m < last )
+ last = length_m;
+ for ( j = i; j < last; ++ j )
+ {
+ cp = getBase (j);
+ seq [pos] = cp . first;
+ qlt [pos] = cp . second;
+ ++ pos;
+ }
+ ++ pos;
+ }
+
+ msg . setField (F_SEQUENCE, seq);
+ msg . setField (F_QUALITY, qlt);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Sequence_t::writeRecord (ostream & fix, ostream & var) const
+{
+ Universal_t::writeRecord (fix, var);
+
+ writeLE (fix, &length_m);
+
+ var . write ((char *)seq_m, length_m);
+
+ if ( !isCompressed( ) )
+ var . write ((char *)qual_m, length_m);
+}
+
+
+//----------------------------------------------------- operator= --------------
+Sequence_t & Sequence_t::operator= (const Sequence_t & source)
+{
+ if ( this != &source )
+ {
+ Universal_t::operator= (source);
+
+ seq_m = (uint8_t *) SafeRealloc (seq_m, source . length_m);
+ memcpy (seq_m, source . seq_m, source . length_m);
+
+ if ( !source . isCompressed( ) )
+ {
+ qual_m = (uint8_t *) SafeRealloc (qual_m, source . length_m);
+ memcpy (qual_m, source . qual_m, source . length_m);
+ }
+ else
+ qual_m = NULL;
+
+ length_m = source . length_m;
+ }
+
+ return *this;
+}
diff --git a/src/AMOS/Sequence_AMOS.hh b/src/AMOS/Sequence_AMOS.hh
new file mode 100644
index 0000000..9ed769d
--- /dev/null
+++ b/src/AMOS/Sequence_AMOS.hh
@@ -0,0 +1,458 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/18/2003
+//!
+//! \brief Header for Sequence_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Sequence_AMOS_HH
+#define __Sequence_AMOS_HH 1
+
+#include "Universal_AMOS.hh"
+#include <string>
+
+
+
+
+namespace AMOS {
+
+//================================================ Sequence_t ==================
+//! \brief Sequence bases with quality scores
+//!
+//! Stores both sequence and quality score data in a space efficient manner
+//! (when compressed). Can represent any type of sequence data, but must always
+//! be used with both sequence AND quality data. If just one of these two data
+//! types is required use a simple character array instead. Can be used in
+//! uncompressed mode where a base and its quality occupy 2 bytes, or a
+//! compressed mode where a base and its quality are packed into a single byte.
+//! In uncompressed mode, any characters are valid for bases and quality
+//! scores, however in compressed mode, acceptable sequence bases are A,C,G,T
+//! and N (case insensitive) and acceptable quality scores are between
+//! MIN_QUALITY and MAX_QUALITY.
+//!
+//==============================================================================
+class Sequence_t : public Universal_t
+{
+
+protected:
+
+ uint8_t * seq_m; //!< compressed seq and qual data or uncompressed seq
+ uint8_t * qual_m; //!< uncompressed qual data
+ Size_t length_m; //!< length of the sequence and quality data
+
+
+ static const uint8_t COMPRESS_BIT = 0x1; //!< compressed sequence flag
+ static const uint8_t ADENINE_BITS = 0x0; //!< 'A' bit
+ static const uint8_t CYTOSINE_BITS = 0x40; //!< 'C' bit
+ static const uint8_t GUANINE_BITS = 0x80; //!< 'G' bit
+ static const uint8_t THYMINE_BITS = 0xC0; //!< 'T' bit
+ static const uint8_t SEQ_BITS = 0xC0; //!< sequence bit mask
+ static const uint8_t QUAL_BITS = 0x3F; //!< quality bit mask
+
+
+ //--------------------------------------------------- compress ---------------
+ //! \brief Compresses a sequence char and quality char into a single byte
+ //!
+ //! \note Must work with uncompress(uint8_t) method
+ //!
+ //! \param seqchar The sequence base character (case insensitive)
+ //! \param qualchar The quality score character
+ //! \return The compressed byte
+ //!
+ static inline uint8_t compress (char seqchar, char qualchar)
+ {
+ //-- Force quality score into its bits
+ qualchar = Char2Qual (qualchar);
+
+ if ( qualchar & SEQ_BITS )
+ return 0;
+
+ switch ( toupper (seqchar) )
+ {
+ case 'A': return (uint8_t)qualchar | ADENINE_BITS;
+ case 'C': return (uint8_t)qualchar | CYTOSINE_BITS;
+ case 'G': return (uint8_t)qualchar | GUANINE_BITS;
+ case 'T': return (uint8_t)qualchar | THYMINE_BITS;
+ case 'N': return 0;
+ default:
+ return 0;
+ }
+ }
+
+
+ //--------------------------------------------------- uncompress -------------
+ //! \brief Uncompresses a byte into a sequence and quality char
+ //!
+ //! \note Must work with compress(char,char)
+ //!
+ //! \param byte The compressed sequence and quality byte
+ //! \return The sequence and quality char respectively
+ //!
+ static inline std::pair<char, char> uncompress (uint8_t byte)
+ {
+ std::pair<char, char> retval;
+
+ switch ( byte & SEQ_BITS )
+ {
+ case ADENINE_BITS: retval . first = 'A'; break;
+ case CYTOSINE_BITS: retval . first = 'C'; break;
+ case GUANINE_BITS: retval . first = 'G'; break;
+ case THYMINE_BITS: retval . first = 'T'; break;
+ }
+
+ byte &= QUAL_BITS;
+ if ( byte == 0 )
+ retval . first = 'N';
+
+ retval . second = Qual2Char (byte);
+
+ return retval;
+ }
+
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //--------------------------------------------------- Sequence_t -------------
+ //! \brief Constructs an empty Sequence_t object
+ //!
+ //! Sets all members to 0 or NULL
+ //!
+ Sequence_t ( )
+ {
+ seq_m = qual_m = NULL;
+ length_m = 0;
+ }
+
+
+ //--------------------------------------------------- Sequence_t -------------
+ //! \brief Copy constructor
+ //!
+ Sequence_t (const Sequence_t & source)
+ {
+ seq_m = qual_m = NULL;
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~Sequence_t ------------
+ //! \brief Destroys a Sequence_t object
+ //!
+ //! Frees the memory used for storing the sequence and quality data.
+ //!
+ virtual ~Sequence_t ( )
+ {
+ free (seq_m);
+ free (qual_m);
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ //! \brief Clears all object data, reinitializes the object
+ //!
+ //! All data will be cleared, but object compression status will remain
+ //! unchanged. Use the compress/uncompress members to change this info.
+ //!
+ virtual void clear ( );
+
+
+ //--------------------------------------------------- compress ---------------
+ //! \brief Compress the internal representation of this sequence
+ //!
+ //! After compression, this object will continue to compress incoming data
+ //! until the uncompress method is called. Compression packs both a base
+ //! and a quality score into a single byte, effectively halving the memory
+ //! requirements for each object.
+ //!
+ //! The sequence should only contain A,C,G,T and Ns and quality scores in the
+ //! range [MIN_QUALITY,MAX_QUALITY], if either of these conditions are not
+ //! met the information will be lost when the data is compressed (see
+ //! postconditions below).
+ //!
+ //! \post All invalid quality scores will be cast to MIN_QUALITY
+ //! \post All N's will be assigned a MIN_QUALITY quality score
+ //! \post All MIN_QUALITY scores will be assigned a N seqchar
+ //! \return void
+ //!
+ void compress ( );
+
+
+ //--------------------------------------------------- getBase ----------------
+ //! \brief Get a single base and its quality score
+ //!
+ //! Retrieves and uncompresses the sequence base for the requested index.
+ //!
+ //! \param index The index of the requested base
+ //! \pre index >= 0 && index < length
+ //! \throws ArgumentException_t
+ //! \return The requested (uppercase) base character and its quality score
+ //!
+ std::pair<char, char> getBase (Pos_t index) const
+ {
+ if (seq_m == NULL)
+ AMOS_THROW_ARGUMENT("No sequence data");
+
+ if ( index < 0 || index >= length_m )
+ AMOS_THROW_ARGUMENT ("Requested sequence index is out of range");
+
+ if ( isCompressed( ) )
+ return uncompress (seq_m [index]);
+ else
+ return std::make_pair ((char)(seq_m [index]), (char)(qual_m [index]));
+ }
+
+
+
+ //--------------------------------------------------- getGCContent --------------
+ //! \brief Get the gc content of the sequence
+ //!
+ //! \return The gc content for the specified range of the sequence
+ //!
+ virtual double getGCContent (const Range_t & rng) const
+ {
+ int gc = 0;
+ int all = 0;
+
+ int start = rng.getLo();
+ int stop = rng.getHi();
+
+ // skip ambiguities, gaps
+
+ for (int i = start; i < stop; i++)
+ {
+ switch(getBase(i).first)
+ {
+ case 'A':
+ case 'a':
+ case 'T':
+ case 't': all++; break;
+
+ case 'C':
+ case 'c':
+ case 'G':
+ case 'g': all++; gc++; break;
+ };
+ }
+
+ return (all) ? ((double)gc)/all : 0.0;
+ }
+
+ //--------------------------------------------------- getGCContent --------------
+ //! \brief Get the gc content of the sequence
+ //!
+ //! \return The gc content of the full range of the sequence
+ //!
+ virtual double getGCContent ( ) const
+ {
+ return getGCContent(Range_t(0, length_m));
+ }
+
+
+
+ //--------------------------------------------------- getLength --------------
+ //! \brief Get the length of the sequence
+ //!
+ //! \return The length of the sequence
+ //!
+ Size_t getLength ( ) const
+ {
+ return length_m;
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Sequence_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getQualString ----------
+ //! \brief Get the quality score string
+ //!
+ //! \return The full string of quality scores
+ //!
+ std::string getQualString ( ) const
+ {
+ return getQualString (Range_t (0, length_m));
+ }
+
+
+ //--------------------------------------------------- getQualString ----------
+ //! \brief Get a quality score substring
+ //!
+ //! Returns a subrange of quality scores [begin, end) or (end, begin]. The
+ //! reversed range will pull the reverse string of quality scores.
+ //!
+ //! \param range The range of quality scores to get
+ //! \pre range lo >= 0 && hi <= length
+ //! \throws ArgumentException_t
+ //! \return A subrange quality scores
+ //!
+ std::string getQualString (Range_t range) const;
+
+
+ //--------------------------------------------------- getSeqString -----------
+ //! \brief Get the sequence base string
+ //!
+ //! \return The full string of sequence bases
+ //!
+ std::string getSeqString ( ) const
+ {
+ return getSeqString (Range_t (0, length_m));
+ }
+
+
+ //--------------------------------------------------- getSeqString -----------
+ //! \brief Get a sequence base substring
+ //!
+ //! Returns a subrange of sequence bases [begin, end) or (end, being]. The
+ //! reversed range will pull the reverse complement string of sequences bases.
+ //!
+ //! \param range The range of sequence bases to get
+ //! \pre range lo >= 0 && hi <= length
+ //! \throws ArgumentException_t
+ //! \return A subrange of sequence bases
+ //!
+ std::string getSeqString (Range_t range) const;
+
+
+ //--------------------------------------------------- isCompressed -----------
+ //! \brief Checks if the sequence data is compressed
+ //!
+ //! Returns true if the Sequence is currently operating in compressed mode,
+ //! or false if under normal operation.
+ //!
+ //! \return True if compressed, false if not
+ //!
+ bool isCompressed ( ) const
+ {
+ return flags_m . nibble & COMPRESS_BIT;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- setBase ----------------
+ //! \brief Set a sequence base and its quality score
+ //!
+ //! Any characters may be used for seq and qualchar unless dealing with a
+ //! compressed sequence. If compressed, the sequence should only contain
+ //! A,C,G,T and Ns and quality scores in the range [MIN_QUALITY,MAX_QUALITY],
+ //! if either of these conditions are not met the information will be lost
+ //! when the data is compressed (see postconditions below).
+ //!
+ //! \param seqchar The sequence base character
+ //! \param qualchar The quality score character
+ //! \param index The index to assign these values
+ //! \pre index >= 0 && index < length
+ //! \post If compressed:
+ //! - All invalid quality scores will be cast to MIN_QUALITY
+ //! - All N's will be assigned a MIN_QUALITY quality score
+ //! - All MIN_QUALITY scores will be assigned a N seqchar
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void setBase (char seqchar, char qualchar, Pos_t index)
+ {
+ if (seq_m == NULL)
+ AMOS_THROW_ARGUMENT("No sequence data");
+
+ if ( index < 0 || index >= length_m )
+ AMOS_THROW_ARGUMENT ("Requested sequence index is out of range");
+
+ if ( isCompressed( ) )
+ seq_m [index] = compress (seqchar, qualchar);
+ else
+ {
+ seq_m [index] = seqchar;
+ qual_m [index] = qualchar;
+ }
+ }
+
+
+ //--------------------------------------------------- setSequence ------------
+ //! \brief Set the entire sequence
+ //!
+ //! Combines and compresses the sequence and quality data contained in the
+ //! two C strings. If current Sequence object is compressed, please refer
+ //! to the postconditions for the setBase(char,char,Pos_t) operation. All
+ //! newline characters will be discarded, but the newlines must be in the
+ //! same location in both the sequence and quality files.
+ //!
+ //! \param seq The sequence base string
+ //! \param qual The quality score string
+ //! \pre strlen(seq) == strlen(qual)
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void setSequence (const char * seq, const char * qual);
+
+
+ //--------------------------------------------------- setSequence ------------
+ //! \brief Set the entire sequence
+ //!
+ //! Combines and compresses the sequence and quality data contained in the
+ //! two STL strings. If current Sequence object is compressed, please refer
+ //! to the postconditions for the setBase(char,char,Pos_t) operation. All
+ //! newline characters will be discarded. but the newlines must be in the
+ //! same location in both the sequence and quality files.
+ //!
+ //! \param seq The sequence base string
+ //! \param qual The quality score string
+ //! \pre seq . size( ) == qual . size( )
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ void setSequence (const std::string & seq, const std::string & qual);
+
+
+ //--------------------------------------------------- uncompress -------------
+ //! \brief Uncompress the internal representation of this sequence
+ //!
+ //! After uncompression, this object will not compress incoming data until
+ //! the compress method is called once again. The uncompressed version uses
+ //! two bytes to store a base and quality score, thus doubling the memory
+ //! requirements over a compressed version.
+ //!
+ //! \return void
+ //!
+ void uncompress ( );
+
+
+ //--------------------------------------------------- operator= --------------
+ //! \brief Assignment (copy) operator
+ //!
+ //! Efficiently copies the compressed data from the other Sequence_t.
+ //!
+ //! \param source The sequence to copy
+ //! \return The resulting Sequence_t object
+ //!
+ Sequence_t & operator= (const Sequence_t & source);
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Sequence_AMOS_HH
diff --git a/src/AMOS/Universal_AMOS.cc b/src/AMOS/Universal_AMOS.cc
new file mode 100644
index 0000000..7f09d59
--- /dev/null
+++ b/src/AMOS/Universal_AMOS.cc
@@ -0,0 +1,216 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 09/24/2003
+//!
+//! \brief Source for Universal_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Universal_AMOS.hh"
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//================================================ Universal_t =================
+const NCode_t Universal_t::NCODE = M_UNIVERSAL;
+
+
+//----------------------------------------------------- readMessage ------------
+void Universal_t::readMessage (const Message_t & msg)
+{
+ clear( ); // virtual func, will call child clear( )
+
+ try {
+ istringstream ss;
+
+ if ( msg . exists (F_IID) )
+ {
+ ss . str (msg . getField (F_IID));
+ ss >> iid_m;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid iid format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_EID) )
+ eid_m = msg . getField (F_EID);
+
+ if ( msg . exists (F_STATUS) )
+ {
+ ss . str (msg . getField (F_STATUS));
+ setStatus (ss . get( ));
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_COMMENT) )
+ comment_m = msg . getField (F_COMMENT);
+
+ if ( msg . exists (F_FLAG) )
+ {
+ char fA, fB;
+ ss . str (msg . getField (F_FLAG));
+ ss >> fA >> fB;
+ setFlagA ( fA == '1' );
+ setFlagB ( fB == '1' );
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid flag format");
+ ss . clear( );
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Universal_t::writeMessage (Message_t & msg) const
+{
+ msg . clear( );
+
+ try {
+ ostringstream ss;
+
+ msg . setMessageCode (Universal_t::NCODE);
+
+ if ( iid_m != NULL_ID )
+ {
+ ss << iid_m;
+ msg . setField (F_IID, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( !eid_m . empty( ) )
+ msg . setField (F_EID, eid_m);
+
+ if ( status_m != NULL_STATUS )
+ {
+ ss << status_m;
+ msg . setField (F_STATUS, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ if ( !comment_m . empty( ) )
+ msg . setField (F_COMMENT, comment_m);
+
+ if ( isFlagA( ) || isFlagB( ) )
+ {
+ ss << isFlagA( ) << isFlagB( );
+ msg . setField (F_FLAG, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//================================================== Oriented_t =================
+const NCode_t Oriented_t::NCODE = M_ORIENTED;
+
+//--------------------------------------------------- readMessage -------------
+void Oriented_t::readMessage (const Message_t & msg)
+{
+ Universal_t::readMessage(msg);
+
+ try {
+
+ istringstream ss;
+
+ if ( msg . exists (F_ADJACENCY) )
+ {
+ ss . str (msg . getField (F_ADJACENCY));
+ setAdjacency (ss . get( ));
+ ss . clear( );
+ }
+ } catch (ArgumentException_t) {
+ clear( );
+ throw;
+ }
+}
+
+//--------------------------------------------------- writeMessage ----------
+void Oriented_t::writeMessage ( Message_t & msg) const
+{
+ Universal_t::writeMessage ( msg );
+ try {
+ ostringstream ss;
+
+ msg . setMessageCode (Oriented_t::NCODE);
+
+ if ( getAdjacency( ) != NULL_ADJACENCY )
+ {
+ ss << getAdjacency( );
+ msg . setField (F_ADJACENCY, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ } catch (ArgumentException_t) {
+ msg.clear();
+ throw;
+ }
+}
+
+//--------------------------------------------------- readRecord -------------
+void Oriented_t::readRecord (std::istream & fix, std::istream & var)
+{
+ Universal_t::readRecord(fix, var);
+}
+
+//--------------------------------------------------- readRecordFix ----------
+void Oriented_t::readRecordFix (std::istream & fix)
+{
+ Universal_t::readRecordFix(fix);
+}
+
+//--------------------------------------------------- writeRecord ------------
+void Oriented_t::writeRecord (std::ostream & fix, std::ostream & var) const
+{
+ Universal_t::writeRecord(fix, var);
+}
+
+//----------------------------------------------------- getAdjacency -----------
+Adjacency_t Oriented_t::getAdjacency ( ) const
+{
+ if ( flags_m . nibble & ADJACENCY_BIT )
+ {
+ switch (flags_m . nibble & ADJACENCY_BITS)
+ {
+ case NORMAL_BITS : return NORMAL;
+ case ANTINORMAL_BITS : return ANTINORMAL;
+ case INNIE_BITS : return INNIE;
+ case OUTIE_BITS : return OUTIE;
+ }
+ }
+ return NULL_ADJACENCY;
+}
+
+//----------------------------------------------------- setAdjacency -----------
+void Oriented_t::setAdjacency (Adjacency_t adj)
+{
+ uint8_t bits = flags_m . nibble;
+ flags_m . nibble &= ~ADJACENCY_BITS;
+ flags_m . nibble |= ADJACENCY_BIT;
+
+ switch (adj)
+ {
+ case NORMAL : flags_m . nibble |= NORMAL_BITS; break;
+ case ANTINORMAL : flags_m . nibble |= ANTINORMAL_BITS; break;
+ case INNIE : flags_m . nibble |= INNIE_BITS; break;
+ case OUTIE : flags_m . nibble |= OUTIE_BITS; break;
+ case NULL_ADJACENCY:
+ flags_m . nibble &= ~ADJACENCY_BIT;
+ break;
+ default:
+ flags_m . nibble = bits;
+ AMOS_THROW_ARGUMENT ((string)"Invalid adjacency " + adj);
+ }
+}
diff --git a/src/AMOS/Universal_AMOS.hh b/src/AMOS/Universal_AMOS.hh
new file mode 100644
index 0000000..5926100
--- /dev/null
+++ b/src/AMOS/Universal_AMOS.hh
@@ -0,0 +1,267 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/18/2003
+//!
+//! \brief Header for Universal_t
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __Universal_AMOS_HH
+#define __Universal_AMOS_HH 1
+
+#include "Message_AMOS.hh"
+#include "datatypes_AMOS.hh"
+#include "databanks_AMOS.hh"
+#include <string>
+#include <sstream>
+#include <utility>
+
+
+
+
+namespace AMOS {
+
+//================================================ Universal_t =================
+//! \brief A universal base class that can be used by Banks or Messages
+//!
+//! All AMOS objects that can be read as Messages and stored in a Bank should
+//! be derived from this class. In addition, the single comment field in this
+//! class can be used for storage of any data that a type does not yet exist
+//! for, perhaps in XML format or similar.
+//!
+//==============================================================================
+class Universal_t : public IBankable_t, public IMessagable_t
+{
+
+private:
+
+ Status_t status_m; //!< status char
+ std::string comment_m; //!< comment string
+
+
+protected:
+
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var)
+ {
+ fix . get (status_m);
+ std::getline (var, comment_m, '\0');
+ }
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix)
+ {
+ fix . get (status_m);
+ comment_m.clear();
+ }
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const
+ {
+ fix . put (status_m);
+ var . write (comment_m . c_str( ), comment_m . size( ) + 1);
+ }
+
+
+public:
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //--------------------------------------------------- Universal_t ------------
+ //! \brief Constructs an empty Universal_t object
+ //!
+ //! Set IID to NULL_ID, comment to empty string and all flags to false.
+ //!
+ Universal_t ( )
+ {
+ status_m = NULL_STATUS;
+ }
+
+
+ //--------------------------------------------------- Universal_t ------------
+ //! \brief Copy constructor
+ //!
+ Universal_t (const Universal_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- ~Universal_t -----------
+ //! \brief Virtual destructor
+ //!
+ virtual ~Universal_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ IBankable_t::clear( );
+ status_m = NULL_STATUS;
+ comment_m . erase( );
+ }
+
+
+ //--------------------------------------------------- getComment -------------
+ //! \brief Get the comment string
+ //!
+ //! \return The comment string
+ //!
+ const std::string & getComment ( ) const
+ {
+ return comment_m;
+ }
+
+
+ //--------------------------------------------------- getStatus --------------
+ //! \brief Get the status value
+ //!
+ //! \return The status value
+ //!
+ const Status_t getStatus ( ) const
+ {
+ return status_m;
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Universal_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- setComment -------------
+ //! \brief Set the comment string
+ //!
+ //! \param comment The new comment string
+ //! \return void
+ //!
+ void setComment (const std::string & comment)
+ {
+ comment_m = comment;
+ }
+
+
+ //--------------------------------------------------- setStatus --------------
+ //! \brief Set the status value
+ //!
+ //! \param status The new status value
+ //! \return void
+ //!
+ void setStatus (Status_t status)
+ {
+ status_m = status;
+ }
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+};
+
+typedef char Adjacency_t;
+
+//================================================ Oriented_t =================
+//! \brief Defines methods and types related to orientation
+//==============================================================================
+class Oriented_t : public Universal_t
+{
+protected:
+ //--------------------------------------------------- readRecord -------------
+ virtual void readRecord (std::istream & fix, std::istream & var);
+
+
+ //--------------------------------------------------- readRecordFix ----------
+ virtual void readRecordFix (std::istream & fix);
+
+
+ //--------------------------------------------------- writeRecord ------------
+ virtual void writeRecord (std::ostream & fix, std::ostream & var) const;
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+ static const uint8_t ADJACENCY_BIT = 0x4; //!< adjacency exists flag
+ static const uint8_t ADJACENCY_BITS = 0x3; //!< adjacency info mask
+ static const uint8_t NORMAL_BITS = 0x1;
+ static const uint8_t ANTINORMAL_BITS = 0x2;
+ static const uint8_t INNIE_BITS = 0x3;
+ static const uint8_t OUTIE_BITS = 0x0;
+
+public:
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+ static const Adjacency_t NULL_ADJACENCY = 0;
+ static const Adjacency_t NORMAL = 'N'; //!< E,B
+ static const Adjacency_t ANTINORMAL = 'A'; //!< B,E
+ static const Adjacency_t INNIE = 'I'; //!< E,E
+ static const Adjacency_t OUTIE = 'O'; //!< B,B
+
+ Oriented_t() {
+ setAdjacency ( NULL_ADJACENCY );
+ }
+
+ virtual ~Oriented_t() {
+ }
+
+ //--------------------------------------------------- clear ------------------
+ virtual void clear ( )
+ {
+ Universal_t::clear( );
+ setAdjacency ( NULL_ADJACENCY );
+ }
+
+ //--------------------------------------------------- getAdjacency -----------
+ //! \brief Get the adjacency relation of the two nodes
+ //!
+ //! Get the adjacency information for the nodes, i.e. [N]ORMAL (EB),
+ //! [A]NTINORMAL (BE), [I]NNIE (EE) or [O]UTIE (BB). Where, if we picture
+ //! each node as an arrow, B is the tail and E is the head. Thus EB means the
+ //! head of node1 is adjacent to the tail of node2. This may seem awkward in
+ //! a theoretical sense, but comes in handy when the nodes are directed
+ //! sequences.
+ //!
+ //! \return The pair of adjacent ends
+ //!
+ virtual Adjacency_t getAdjacency ( ) const;
+
+ //--------------------------------------------------- setAdjacency -----------
+ //! \brief Set the adjacent ends of the two nodes
+ //!
+ //! Set the adjacency information for the nodes, i.e. [N]ORMAL (EB),
+ //! [A]NTINORMAL (BE), [I]NNIE (EE) or [O]UTIE (BB). Where, if we picture
+ //! each node as an arrow, B is the tail and E is the head. Thus EB means the
+ //! head of node1 is adjacent to the tail of node2. This may seem awkward in
+ //! a theoretical sense, but comes in handy when the nodes are directed
+ //! sequences.
+ //!
+ //! \note Will store info in nibble portion of BankFlags
+ //!
+ //! \param adj The new adjacency of the nodes
+ //! \pre adj must be one of [NAIO]
+ //! \throws ArgumentException_t
+ //! \return void
+ //!
+ virtual void setAdjacency (Adjacency_t adj);
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __Universal_AMOS_HH
diff --git a/src/AMOS/banktest.cc b/src/AMOS/banktest.cc
new file mode 100644
index 0000000..7248ffe
--- /dev/null
+++ b/src/AMOS/banktest.cc
@@ -0,0 +1,231 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include <cstdlib>
+#include <ctime>
+#include <sstream>
+#include <iostream>
+using namespace std;
+using namespace AMOS;
+
+const string BANK_STORE_DIR = "_bank_";
+const string STREAM_STORE_DIR = "_stream_";
+
+int main (int argc, char ** argv)
+{
+ srand (time(NULL));
+
+ try {
+
+ ID_t N, i , j, step;
+ Bank_t readbank (Read_t::NCODE);
+ BankStream_t readstream (Read_t::NCODE);
+ Read_t read;
+ ostringstream ss;
+
+ if ( argc != 2 )
+ {
+ cerr << "USAGE: " << argv[0] << " #reads\n";
+ return -1;
+ }
+
+ N = atol (argv[1]);
+ if ( N < 50 )
+ step = 1;
+ else
+ step = N / 50;
+
+ read . setClearRange (Range_t(0,1080));
+ read . setQualityClearRange (Range_t(1,1301));
+ read . setVectorClearRange (Range_t(2,1032));
+ read . setFragment (29373);
+ read . setType (Read_t::END);
+ read . compress( );
+ read . setFlagA (false);
+ read . setFlagB (true);
+ read . setSequence (
+ "acgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgtacgt [...]
+ "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678443573456345523453444442345678901234567890123456789012345678901234567890123456789012345678901234567 [...]
+
+
+
+ readbank . create (BANK_STORE_DIR);
+ readstream . create (STREAM_STORE_DIR);
+
+
+ cerr << "APPEND " << N << " reads\n" << Date( ) << endl << "begin";
+ for ( i = 1; i <= N; i ++ )
+ {
+ ss . str (NULL_STRING);
+ ss << 'a' << i;
+ read . setIID (i);
+ read . setEID (ss . str( ));
+ read . setComment (ss . str( ) + 'c');
+ readbank . append (read);
+
+ if ( i % step == 0 )
+ cerr << '.';
+ }
+ cerr << "done.\n" << Date( ) << endl << endl;
+
+
+ cerr << "SAPPEND " << N << " reads\n" << Date( ) << endl << "begin";
+ for ( i = 1; i <= N; i ++ )
+ {
+ ss . str (NULL_STRING);
+ ss << 'a' << i;
+ read . setIID (i);
+ read . setEID (ss . str( ));
+ read . setComment (ss . str( ) + 'c');
+ readstream << read;
+
+ if ( i % step == 0 )
+ cerr << '.';
+ }
+ cerr << "done.\n" << Date( ) << endl << endl;
+
+
+ cerr << "FETCH " << N
+ << " random reads\n" << Date( ) << endl << "begin";
+ for ( i = 1; i <= N; i ++ )
+ {
+ j = 1 + rand( ) % N;
+ readbank . fetch (j, read);
+
+ if ( i % step == 0 )
+ cerr << '.';
+ }
+ cerr << "done.\n" << Date( ) << endl << endl;
+
+
+ cerr << "SFETCH " << N
+ << " consecutive reads\n" << Date( ) << endl << "begin";
+ for ( i = 1; readstream >> read; i ++ )
+ {
+ if ( i % step == 0 )
+ cerr << '.';
+ }
+ cerr << "done.\n" << Date( ) << endl << endl;
+
+
+ cerr << "REPLACE " << N
+ << " random reads\n" << Date( ) << endl << "begin";
+ for ( i = 1; i <= N; i ++ )
+ {
+ j = 1 + rand( ) % N;
+
+ ss . str (NULL_STRING);
+ ss << 'r' << j;
+ read . setIID (j);
+ read . setEID (ss . str( ));
+ read . setComment (ss . str( ) + 'c');
+ readbank . replace (j, read);
+
+ if ( i % step == 0 )
+ cerr << '.';
+ }
+ cerr << "done.\n" << Date( ) << endl << endl;
+
+
+ cerr << "REMOVE " << N
+ << " random reads\n" << Date( ) << endl << "begin";
+ for ( i = 1; i <= N; i ++ )
+ {
+ j = 1 + rand( ) % N;
+
+ if ( readbank . getIDMap( ) . exists (j) )
+ readbank . remove (j);
+
+ if ( i % step == 0 )
+ cerr << '.';
+ }
+ cerr << "done.\n" << Date( ) << endl << endl;
+
+
+ j = rand( ) % N;
+ readstream . seekg (j, BankStream_t::BEGIN);
+ if ( readstream >> read )
+ {
+ cerr << "SFETCH OFFSET " << j
+ << " yeilds IID:" << read . getIID( )
+ << " EID:" << read . getEID( )
+ << " COMMENT:" << read . getComment( ) << endl << endl;
+ }
+
+
+ do {
+ j = 1 + rand( ) % N;
+ } while ( ! readbank . getIDMap( ) . exists (j) );
+ readbank . fetch (j, read);
+ cerr << "FETCH IID " << j
+ << " bid:" << readbank . getIDMap() . lookupBID (j)
+ << " yields IID:" << read . getIID( )
+ << " EID:" << read . getEID( )
+ << " COMMENT:" << read . getComment( ) << endl << endl;
+
+
+ readbank . close( );
+ readstream . close( );
+
+
+ readstream . open (BANK_STORE_DIR);
+ cerr << "SFETCH " << readstream . getSize( )
+ << " consecutive reads\n" << Date( ) << endl << "begin";
+ for ( i = 1; readstream >> read; i ++ )
+ {
+// cout << readstream . getIDMap() . lookupBID (read . getIID( ))
+// << ": " << read . getIID( )
+// << ' ' << read . getEID( )
+// << ' ' << read . getComment( ) << endl;
+
+ if ( i % step == 0 )
+ cerr << '.';
+ }
+ cerr << "done.\n" << Date( ) << endl;
+ cerr << i - 1 << " fetched" << endl << endl;
+ readstream . close( );
+
+
+ readbank . open (BANK_STORE_DIR);
+ cerr << "CLEAN bank\n" << Date( ) << endl << "begin...";
+ readbank . clean( );
+ cerr << "done.\n" << Date( ) << endl << endl;
+
+
+ readbank . fetch (j, read);
+ cerr << "FETCH IID " << j
+ << " bid:" << readbank . getIDMap() . lookupBID (j)
+ << " yields IID:" << read . getIID( )
+ << " EID:" << read . getEID( )
+ << " COMMENT:" << read . getComment( ) << endl << endl;
+ readbank . close( );
+
+
+ readstream . open (BANK_STORE_DIR);
+ cerr << "SFETCH " << readstream . getSize( )
+ << " consecutive reads\n" << Date( ) << endl << "begin";
+ for ( i = 1; readstream >> read; i ++ )
+ {
+// cout << readstream . getIDMap() . lookupBID (read . getIID( ))
+// << ": " << read . getIID( )
+// << ' ' << read . getEID( )
+// << ' ' << read . getComment( ) << endl;
+
+ if ( i % step == 0 )
+ cerr << '.';
+ }
+ cerr << "done.\n" << Date( ) << endl;
+ cerr << i - 1 << " fetched" << endl << endl;
+ readstream . close( );
+
+
+ // readbank . destroy( );
+ // readstream . destroy( );
+ }
+ catch (const Exception_t & e) {
+
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/src/AMOS/databanks_AMOS.hh b/src/AMOS/databanks_AMOS.hh
new file mode 100644
index 0000000..7838c84
--- /dev/null
+++ b/src/AMOS/databanks_AMOS.hh
@@ -0,0 +1,16 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 11/13/2003
+//!
+//! \brief Include file for all of the AMOS data banks
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __databanks_AMOS_HH
+#define __databanks_AMOS_HH 1
+
+#include "Bank_AMOS.hh"
+#include "BankStream_AMOS.hh"
+
+#endif // #ifndef __databanks_AMOS_HH
diff --git a/src/AMOS/datatypes_AMOS.cc b/src/AMOS/datatypes_AMOS.cc
new file mode 100644
index 0000000..356e81f
--- /dev/null
+++ b/src/AMOS/datatypes_AMOS.cc
@@ -0,0 +1,360 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 10/30/2003
+//!
+//! \brief Source for datatypes_AMOS.hh
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "datatypes_AMOS.hh"
+#include <sstream>
+using namespace AMOS;
+using namespace std;
+
+
+//================================================ Distribution_t ==============
+const NCode_t Distribution_t::NCODE = M_DISTRIBUTION;
+
+
+//----------------------------------------------------- readMessage ------------
+void Distribution_t::readMessage (const Message_t & msg)
+{
+ clear( );
+
+ try {
+ istringstream ss;
+
+ ss . str (msg . getField (F_MEAN));
+ ss >> mean;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid mean format");
+ ss . clear( );
+
+ ss . str (msg . getField (F_SD));
+ ss >> sd;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid standard deviation format");
+ ss . clear( );
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//--------------------------------------------------- readRecord -------------
+void Distribution_t::readRecord (std::istream & in)
+{
+ readLE (in, &mean);
+ readLE (in, &sd);
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Distribution_t::writeMessage (Message_t & msg) const
+{
+ msg . clear( );
+
+ try {
+ ostringstream ss;
+
+ msg . setMessageCode (Distribution_t::getNCode( ));
+
+ ss << mean;
+ msg . setField (F_MEAN, ss . str( ));
+ ss . str (NULL_STRING);
+
+ ss << sd;
+ msg . setField (F_SD, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//--------------------------------------------------- writeRecord ------------
+void Distribution_t::writeRecord (std::ostream & out) const
+{
+ writeLE (out, &mean);
+ writeLE (out, &sd);
+}
+
+
+
+
+//================================================ Tile_t ======================
+const NCode_t Tile_t::NCODE = M_TILE;
+
+
+//----------------------------------------------------- clear ------------------
+void Tile_t::clear ( )
+{
+ source = NULL_ID;
+ source_type = NULL_NCODE;
+ gaps . clear( );
+ offset = 0;
+ range . clear( );
+}
+
+
+//----------------------------------------------------- readMessage ------------
+void Tile_t::readMessage (const Message_t & msg)
+{
+ clear( );
+
+ try {
+ Pos_t gap;
+ istringstream ss;
+
+ if ( msg . exists (F_SOURCE) )
+ {
+ string str;
+
+ ss . str (msg . getField (F_SOURCE));
+ ss >> source;
+ ss . ignore( );
+ ss >> str;
+ if ( !ss || str . length( ) != NCODE_SIZE )
+ source_type = NULL_NCODE;
+ else
+ source_type = Encode(str);
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_OFFSET) )
+ {
+ ss . str (msg . getField (F_OFFSET));
+ ss >> offset;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid offset format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_CLEAR) )
+ {
+ ss . str (msg . getField (F_CLEAR));
+ ss >> range . begin;
+ ss . ignore( );
+ ss >> range . end;
+ if ( !ss )
+ AMOS_THROW_ARGUMENT ("Invalid clear range format");
+ ss . clear( );
+ }
+
+ if ( msg . exists (F_GAPS) )
+ {
+ ss . str (msg . getField (F_GAPS));
+
+ while ( ss )
+ {
+ ss >> gap;
+ if ( ! ss . fail( ) )
+ gaps . push_back (gap);
+ }
+
+ if ( !ss . eof( ) )
+ AMOS_THROW_ARGUMENT ("Invalid gaps format");
+ ss . clear( );
+ }
+ }
+ catch (ArgumentException_t) {
+
+ clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- readRecord -------------
+void Tile_t::readRecord (istream & in)
+{
+ Size_t size;
+
+ readLE (in, &size);
+ gaps . resize (size);
+ for ( Pos_t i = 0; i < size; i ++ )
+ readLE (in, &(gaps [i]));
+ readLE (in, &source);
+ readLE (in, &source_type);
+ readLE (in, &offset);
+ readLE (in, &(range . begin));
+ readLE (in, &(range . end));
+}
+
+
+//----------------------------------------------------- writeMessage -----------
+void Tile_t::writeMessage (Message_t & msg) const
+{
+ msg . clear( );
+
+ try {
+ vector<Pos_t>::const_iterator vi;
+ ostringstream ss;
+
+ msg . setMessageCode (Tile_t::getNCode( ));
+
+ if ( source != NULL_ID)
+ {
+ ss << source;
+ if (source_type != NULL_NCODE)
+ ss << ',' << Decode (source_type);
+ msg . setField (F_SOURCE, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+
+ ss << offset;
+ msg . setField (F_OFFSET, ss . str( ));
+ ss . str (NULL_STRING);
+
+ ss << range . begin << ',' << range . end;
+ msg . setField (F_CLEAR, ss . str( ));
+ ss . str (NULL_STRING);
+
+ if ( !gaps . empty( ) )
+ {
+ for ( vi = gaps . begin( ); vi != gaps . end( ); vi ++ )
+ ss << *vi << '\n';
+ msg . setField (F_GAPS, ss . str( ));
+ ss . str (NULL_STRING);
+ }
+ }
+ catch (ArgumentException_t) {
+
+ msg . clear( );
+ throw;
+ }
+}
+
+
+//----------------------------------------------------- writeRecord ------------
+void Tile_t::writeRecord (ostream & out) const
+{
+ Size_t size = gaps . size( );
+
+ writeLE (out, &size);
+ for ( Pos_t i = 0; i < size; i ++ )
+ writeLE (out, &(gaps [i]));
+ writeLE (out, &source);
+ writeLE (out, &source_type);
+ writeLE (out, &offset);
+ writeLE (out, &(range . begin));
+ writeLE (out, &(range . end));
+}
+
+
+
+
+//================================================ Helper Functions ============
+//----------------------------------------------------- operator& --------------
+Range_t AMOS::operator& (Range_t a, Range_t b)
+{
+ if ( a . begin > a . end )
+ {
+ Pos_t tmp = a . begin;
+ a . begin = a . end;
+ a . end = tmp;
+ }
+
+ if ( b . begin > b . end )
+ {
+ Pos_t tmp = b . begin;
+ b . begin = b . end;
+ b . end = tmp;
+ }
+
+ if ( a . begin >= b . end || a . end <= b . begin )
+ return Range_t (0,0);
+ else if ( a . begin < b . begin )
+ return Range_t (b . begin, a . end < b . end ? a . end : b . end);
+ else
+ return Range_t (a . begin, a . end < b . end ? a . end : b . end);
+}
+
+
+//----------------------------------------------------- operator| --------------
+Range_t AMOS::operator| (Range_t a, Range_t b)
+{
+ if ( a . begin > a . end )
+ {
+ Pos_t tmp = a . begin;
+ a . begin = a . end;
+ a . end = tmp;
+ }
+
+ if ( b . begin > b . end )
+ {
+ Pos_t tmp = b . begin;
+ b . begin = b . end;
+ b . end = tmp;
+ }
+
+ if ( a . begin >= b . end || a . end <= b . begin )
+ return Range_t (0,0);
+ else
+ return Range_t (a . begin < b . begin ? a . begin : b . begin,
+ a . end > b . end ? a . end : b . end);
+}
+
+
+//----------------------------------------------------- operator== -------------
+bool AMOS::operator== (const Range_t & a, const Range_t & b)
+{
+ return ( a . begin == b . begin && a . end == b . end );
+}
+bool AMOS::operator!= (const Range_t & a, const Range_t & b)
+{
+ return !(a == b);
+}
+
+
+//----------------------------------------------------- operator== -------------
+bool AMOS::operator== (const Distribution_t & a, const Distribution_t & b)
+{
+ return ( a . mean == b . mean &&
+ a . sd == b . sd );
+}
+bool AMOS::operator!= (const Distribution_t & a, const Distribution_t & b)
+{
+ return !(a == b);
+}
+
+
+//----------------------------------------------------- operator== -------------
+bool AMOS::operator== (const Tile_t & a, const Tile_t & b)
+{
+ return ( a . source == b . source &&
+ a . gaps == b . gaps &&
+ a . offset == b . offset &&
+ a . range == b . range );
+}
+bool AMOS::operator!= (const Tile_t & a, const Tile_t & b)
+{
+ return !(a == b);
+}
+
+
+//----------------------------------------------------- WrapStirng -------------
+void AMOS::WrapString (ostream & out, const string & s, int per)
+{
+ int i, n;
+
+ n = s . size ( );
+ for (i = 0; i < n; i += per)
+ {
+ int j, last;
+
+ last = i + per;
+ if (n < last)
+ last = n;
+ for (j = i; j < last; j ++)
+ out << s [j];
+ out << endl;
+ }
+}
diff --git a/src/AMOS/datatypes_AMOS.hh b/src/AMOS/datatypes_AMOS.hh
new file mode 100644
index 0000000..b678687
--- /dev/null
+++ b/src/AMOS/datatypes_AMOS.hh
@@ -0,0 +1,473 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/16/2003
+//!
+//! \brief Include file for some simple AMOS type definitions and structs
+//!
+//! These are objects that cannot be stored by themselves in a Bank, however
+//! are capable of writing messages and records. Mostly used as ID-less
+//! submessages.
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __datatypes_AMOS_HH
+#define __datatypes_AMOS_HH 1
+
+#include "Message_AMOS.hh"
+#include <vector>
+#include <string>
+
+
+
+
+
+//-- Miscellaneous types and definitions
+namespace AMOS {
+
+//================================================ Distribution_t ==============
+//! \brief A set of statistics that define a distribution
+//!
+//! Additional parameters may be added to this class if more complex
+//! distributions need to be represented. The contained parameters should
+//! suffice to represent normal distributions.
+//!
+//! \todo make more general for more complex distributions
+//==============================================================================
+struct Distribution_t : public IMessagable_t
+{
+
+ Pos_t mean; //!< the mean
+ SD_t sd; //!< the standard deviation
+
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //--------------------------------------------------- Distribution_t ---------
+ //! \brief Constructs an empty Distribution_t object
+ //!
+ //! Sets all members to 0
+ //!
+ Distribution_t ( )
+ {
+ clear( );
+ }
+
+
+ //--------------------------------------------------- ~Distribution_t --------
+ //! \brief Destroys a Distribution_t object
+ //!
+ ~Distribution_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ //! \brief Clears all object data, reinitializes the object
+ //!
+ void clear ( )
+ {
+ mean = 0; sd = 0;
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Distribution_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- readRecord -------------
+ //! \brief Read a binary record
+ //!
+ void readRecord (std::istream & in);
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+
+ //--------------------------------------------------- writeRecord ------------
+ //! \brief Write a binary record
+ //!
+ void writeRecord (std::ostream & out) const;
+
+};
+
+
+
+
+//================================================ Range_t =====================
+//! \brief A gapped coordinate range
+//!
+//! A range of values defined by the start and end gap numbers that bracket the
+//! requested values with gap counting starting at 0 (the gap before the first
+//! value). The minimum value points to the leftmost value in the list, while
+//! the maximum value points to one after the rightmost value in the list.
+//! For example, the range [2,5) for the list 0,1,2,3,4,5,6 would define the
+//! sublist 2,3,4. Reversed ranges are also allowed, for example (5,2] would
+//! define the subset 4,3,2.
+//!
+//==============================================================================
+struct Range_t
+{
+
+ Pos_t begin; //!< The begin of the range
+ Pos_t end; //!< The end of the range
+
+
+ //--------------------------------------------------- Range_t ----------------
+ //! \brief Constructs an empty Range_t object
+ //!
+ //! Sets begin and end to zero, thus creating a zero length range
+ //!
+ Range_t ( )
+ {
+ clear( );
+ }
+
+
+ //--------------------------------------------------- Range_t ----------------
+ //! \brief Copy constructor
+ //!
+ //! \param source The range to be copied
+ //!
+ Range_t (const Range_t & source)
+ {
+ *this = source;
+ }
+
+
+ //--------------------------------------------------- Range_t ----------------
+ //! \brief Constructs a Range_t object
+ //!
+ //! Sets begin and end to the parameter values
+ //!
+ //! \param b Construct value of begin
+ //! \param e Construct value of end
+ //!
+ Range_t (Pos_t b, Pos_t e)
+ {
+ begin = b;
+ end = e;
+ }
+
+
+ //--------------------------------------------------- ~Range_t ---------------
+ //! \brief Destroys a Range_t object
+ //!
+ ~Range_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ //! \brief Clears the range to an empty range [0,0)
+ //!
+ void clear ( )
+ {
+ begin = end = 0;
+ }
+
+
+ //--------------------------------------------------- getBegin ---------------
+ //! \brief Get the beginning of the range
+ //!
+ Pos_t getBegin ( ) const
+ {
+ return begin;
+ }
+
+
+ //--------------------------------------------------- getLo ------------------
+ //! \brief Get the lo range position, (begin < end ? begin : end)
+ //!
+ Pos_t getLo ( ) const
+ {
+ return (begin < end ? begin : end);
+ }
+
+
+ //--------------------------------------------------- getHi ------------------
+ //! \brief Get the hi range position, (begin > end ? begin : end)
+ //!
+ Pos_t getHi ( ) const
+ {
+ return (begin > end ? begin : end);
+ }
+
+
+ //--------------------------------------------------- getEnd -----------------
+ //! \brief Get the end of the range
+ //!
+ Pos_t getEnd ( ) const
+ {
+ return end;
+ }
+
+
+ //--------------------------------------------------- getLength --------------
+ //! \brief Get the length of the range
+ //!
+ //! \return abs (end - begin)
+ //!
+ Size_t getLength ( ) const
+ {
+ return labs (end - begin);
+ }
+
+
+ //--------------------------------------------------- isReverse --------------
+ //! \brief Returns true if begin > end, otherwise false
+ //!
+ //! \return true if begin > end, otherwise false
+ //!
+ bool isReverse ( ) const
+ {
+ return begin > end;
+ }
+
+
+ //--------------------------------------------------- setBegin ---------------
+ //! \brief Set the beginning of the range
+ //!
+ void setBegin (Pos_t b)
+ {
+ begin = b;
+ }
+
+
+ //--------------------------------------------------- setEnd -----------------
+ //! \brief Set the end of the range
+ //!
+ void setEnd (Pos_t e)
+ {
+ end = e;
+ }
+
+
+ //--------------------------------------------------- setRange ---------------
+ //! \brief Set the whole range
+ //!
+ void setRange (Pos_t b, Pos_t e)
+ {
+ begin = b;
+ end = e;
+ }
+
+
+ //--------------------------------------------------- swap -------------------
+ //! \brief Exchange the beginning and end of the range
+ //!
+ void swap ( )
+ {
+ Pos_t save = begin;
+ begin = end;
+ end = save;
+ }
+
+};
+
+
+
+
+//================================================ Tile_t ======================
+//! \brief A singe sequence's location and orientation in a larger sequence
+//!
+//! A tiled sequence, like a read in a contig, or a contig in a scaffold. For
+//! explanation purposes, let us assume we are dealing with an underlying read
+//! in a contig. The id is the IID of the read. The gaps are the alignment gaps
+//! in the read, stored as a list of gap positions. How these positions are
+//! stored relative to the parent contig is left to the user. Commonly, each
+//! gap integer is simply the gap location in the read. Thus, two adjacent gaps
+//! would share the same value. The offset is the offset of the beginning on
+//! the read in the contig, thus an offset of 0 would signify a read beginning
+//! at the very start of the contig. Finally, the range is the portion of the
+//! read that has been aligned to the contig, with the range order also
+//! specifying the orientation of the read relative to the contig, i.e. if the
+//! beginning of the range is greater than the end of the range the read is
+//! reversed relative to the forward strand of the contig.
+//!
+//==============================================================================
+struct Tile_t : public IMessagable_t
+{
+ ID_t source; //!< source of the tile
+ NCode_t source_type; //!< the type of tile source (read, contig, or motif
+ std::vector<Pos_t> gaps; //!< the absolute gap positions
+ Pos_t offset; //!< the offset of the tile
+ Range_t range; //!< the usable range of the tile
+
+
+ static const NCode_t NCODE;
+ //!< The NCode type identifier for this object
+
+
+ //--------------------------------------------------- Tile_t -----------------
+ //! \brief Constructs an empty Tile_t object
+ //!
+ //! Sets id to NULL_ID, offset to 0
+ //!
+ Tile_t ( )
+ {
+ source = NULL_ID;
+ source_type = NULL_NCODE;
+ offset = 0;
+ }
+
+
+ //--------------------------------------------------- ~Tile_t ----------------
+ //! \brief Destroys a Tile_t object
+ //!
+ ~Tile_t ( )
+ {
+
+ }
+
+
+ //--------------------------------------------------- clear ------------------
+ //! \brief Clears all object data, reinitializes the object
+ //!
+ void clear ( );
+
+
+ //--------------------------------------------------- getGappedLength --------
+ //! \brief Gets the gapped length of the tile
+ //!
+ //! (range . getLength( ) + gaps . size( ))
+ //!
+ //! \return The gapped length of the tile
+ //!
+ Size_t getGappedLength ( ) const
+ {
+ return (range . getLength( ) + gaps . size( ));
+ }
+
+
+ //--------------------------------------------------- getNCode ---------------
+ virtual NCode_t getNCode ( ) const
+ {
+ return Tile_t::NCODE;
+ }
+
+
+ //--------------------------------------------------- getRightOffset --------
+ //! \brief Gets the exact right offset of the tile
+ //!
+ //! offset + (range . getLength( ) + gaps . size( )) - 1
+ //!
+ //! \return The right offset of the tile
+ //!
+
+ Pos_t getRightOffset() const
+ {
+ return offset + range.getLength() + gaps.size() - 1;
+ }
+
+
+ //--------------------------------------------------- readMessage ------------
+ virtual void readMessage (const Message_t & msg);
+
+
+ //--------------------------------------------------- readRecord -------------
+ //! \brief Read a binary record
+ //!
+ void readRecord (std::istream & in);
+
+
+ //--------------------------------------------------- writeMessage -----------
+ virtual void writeMessage (Message_t & msg) const;
+
+
+ //--------------------------------------------------- writeRecord ------------
+ //! \brief Write a binary record
+ //!
+ void writeRecord (std::ostream & out) const;
+
+};
+
+
+//================================================ Helper Functions ============
+//----------------------------------------------------- operator& --------------
+//! \brief An intersection operator for Ranges
+//!
+//! Returns the (foward) intersection of two overlapping ranges.
+//!
+//! \param a Range A
+//! \param b Range B
+//! \return The intersection of Range A and B or [0,0) if no overlap
+//!
+Range_t operator& (Range_t a, Range_t b);
+
+
+//----------------------------------------------------- operator| --------------
+//! \brief A union operator for Ranges
+//!
+//! Returns the union of two overlapping ranges
+//!
+//! \param a Range A
+//! \param b Range B
+//! \return The union of Range A and B or [0,0) if no overlap
+//!
+Range_t operator| (Range_t a, Range_t b);
+
+
+//----------------------------------------------------- operator== -------------
+//! \brief An equality operator for Ranges
+//!
+//! Returns true if the two ranges have equal begin and end values.
+//!
+//! \param a Range A
+//! \param b Range B
+//! \return true if a.begin == b.begin && a.end == b.end, else false
+//!
+bool operator== (const Range_t & a, const Range_t & b);
+bool operator!= (const Range_t & a, const Range_t & b);
+
+
+//----------------------------------------------------- operator== -------------
+//! \brief An equality operator for Distributions
+//!
+//! Returns true if distributions have identical values
+//!
+//! \param a Distribution A
+//! \param b Distribution B
+//! \return true if distributions have identical values
+//!
+bool operator== (const Distribution_t & a, const Distribution_t & b);
+bool operator!= (const Distribution_t & a, const Distribution_t & b);
+
+
+//----------------------------------------------------- operator== -------------
+//! \brief An equality operator for Tiles
+//!
+//! Returns true if distributions have identical values
+//!
+//! \param a Tile A
+//! \param b Tile B
+//! \return true if distributions have identical values
+//!
+bool operator== (const Tile_t & a, const Tile_t & b);
+bool operator!= (const Tile_t & a, const Tile_t & b);
+
+
+//----------------------------------------------------- WrapStirng -------------
+//! \brief Inserts a newline every 'per' characters when writing to stream
+//!
+void WrapString (std::ostream & out, const std::string & s, int per);
+
+
+//--TEMPORARY
+typedef Range_t Ordered_Range_t;
+
+} // namespace AMOS
+
+#endif // #ifndef __datatypes_AMOS_HH
diff --git a/src/AMOS/exceptions_AMOS.hh b/src/AMOS/exceptions_AMOS.hh
new file mode 100644
index 0000000..7138034
--- /dev/null
+++ b/src/AMOS/exceptions_AMOS.hh
@@ -0,0 +1,279 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 10/17/2003
+//!
+//! \brief Include file for all of the AMOS exception types
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __exceptions_AMOS_HH
+#define __exceptions_AMOS_HH 1
+
+#include "inttypes_AMOS.hh"
+#include <string>
+#include <exception>
+#include <iostream>
+
+
+
+
+namespace AMOS {
+
+//================================================ Exception_t =================
+//! \brief The base AMOS excpetion class
+//!
+//! All other AMOS exceptions will be derived from this class, so catching for
+//! this class should effectively catch all AMOS exceptions.
+//!
+//==============================================================================
+class Exception_t : public std::exception
+{
+
+private:
+
+ std::string what_m; //!< description of exception
+ int line_m; //!< line number of exception
+ std::string file_m; //!< file name of exception
+
+
+
+public:
+
+ //---------------------------------------------- Exception_t -----------------
+ //! \brief Informative constructor
+ //!
+ //! \param what Brief description of the exception
+ //! \param line Line number of the exception
+ //! \param file File name of the exception
+ //!
+ Exception_t (const std::string & what,
+ int line = 0,
+ const std::string & file = NULL_STRING)
+ : what_m (what), line_m (line), file_m (file)
+ { }
+
+
+ //---------------------------------------------- ~Exception_t ----------------
+ //! \brief Default destructor
+ //!
+ ~Exception_t ( ) throw()
+ { }
+
+
+ //---------------------------------------------- file ------------------------
+ //! \brief Returns the file (if available) of the exception
+ //!
+ virtual const char * file ( ) const
+ {
+ return file_m . c_str( );
+ }
+
+
+ //---------------------------------------------- line ------------------------
+ //! \brief Returns the line number (if available) of the exception
+ //!
+ virtual int line ( ) const
+ {
+ return line_m;
+ }
+
+
+ //---------------------------------------------- what ------------------------
+ //! \brief Returns a short description (if available) of the exception
+ //!
+ virtual const char * what ( ) const throw( )
+ {
+ return what_m . c_str( );
+ }
+
+};
+
+
+
+
+//================================================ AlignmentException_t ========
+//! \brief An exception for alignment failures
+//!
+//! Thrown when an alignment cannot be found between two strings
+//! that are supposed to align
+//!
+//==============================================================================
+class AlignmentException_t : public Exception_t
+{
+
+private:
+
+ int a_id_m; //!< id or subscript of first string
+ int b_id_m; //!< id or subscript of second string
+
+
+public:
+
+ //---------------------------------------------- AlignmentException_t --------
+ //! \brief Constructor
+ //!
+ //! \param what Brief description of the exception
+ //! \param line Line number of the exception
+ //! \param file File name of the exception
+ //! \param a_id ID or subscript of first string involved
+ //! \param b_id ID or subscript of second string involved
+ //!
+ AlignmentException_t (const std::string & what,
+ int line = 0,
+ const std::string & file = NULL_STRING,
+ int a_id = -1,
+ int b_id = -1)
+ : Exception_t (what, line, file), a_id_m (a_id), b_id_m (b_id)
+ { }
+
+
+ //---------------------------------------------- a_id ------------------------
+ //! \brief Returns the id or subscript of the first string
+ //!
+ virtual const int a_id ( ) const
+ {
+ return a_id_m;
+ }
+
+
+ //---------------------------------------------- b_id ------------------------
+ //! \brief Returns the id or subscript of the first string
+ //!
+ virtual const int b_id ( ) const
+ {
+ return b_id_m;
+ }
+
+
+};
+
+
+
+
+//================================================ AllocException_t ============
+//! \brief An exception for alloc failures, better than std::bad_alloc
+//!
+//! Can be thrown in place of std::bad_alloc when a modified description, line
+//! number or file name would be helpful for debugging.
+//!
+//==============================================================================
+class AllocException_t : public Exception_t
+{
+
+public:
+
+ //---------------------------------------------- AllocException_t ------------
+ //! \brief Informative constructor
+ //!
+ //! \param what Brief description of the exception
+ //! \param line Line number of the exception
+ //! \param file File name of the exception
+ //!
+ AllocException_t (const std::string & what,
+ int line = 0,
+ const std::string & file = NULL_STRING)
+ : Exception_t (what, line, file)
+ { }
+
+};
+
+
+
+
+//================================================ ArgumentException_t =========
+//! \brief An exception for invalid arguments
+//!
+//! Usually thrown when a function argument does not satisfy the preconditions.
+//! The reason for the exception can be retrieved with the what( ) function
+//! inherited from the Exception_t class. This is primarily a logic error and
+//! can usually be avoided entirely, so the user probably does not need to
+//! catch for this exception except for debugging purposes.
+//!
+//==============================================================================
+class ArgumentException_t : public Exception_t
+{
+
+public:
+
+ //---------------------------------------------- ArgumentException_t ---------
+ //! \brief Informative constructor
+ //!
+ //! \param what Brief description of the exception
+ //! \param line Line number of the exception
+ //! \param file File name of the exception
+ //!
+ ArgumentException_t (const std::string & what,
+ int line = 0,
+ const std::string & file = NULL_STRING)
+ : Exception_t (what, line, file)
+ { }
+
+};
+
+
+
+
+//================================================ IOException_t ===============
+//! \brief An exception for IO errors
+//!
+//! Usually thrown when an IO attempt fails or has severe warnings. The reason
+//! for the exception can be retrieved with the what( ) function inherited from
+//! the Exception_t class.
+//!
+//==============================================================================
+class IOException_t : public Exception_t
+{
+
+public:
+
+ //---------------------------------------------- IOException_t ---------------
+ //! \brief Informative constructor
+ //!
+ //! \param what Brief description of the exception
+ //! \param line Line number of the exception
+ //! \param file File name of the exception
+ //!
+ IOException_t (const std::string & what,
+ int line = 0,
+ const std::string & file = NULL_STRING)
+ : Exception_t (what, line, file)
+ { }
+
+};
+
+
+
+
+//----------------------------------------------------- operator<< -------------
+//! \brief Dump Exception_t info to an ostream
+//!
+inline std::ostream & operator<< (std::ostream & out, const Exception_t & e)
+{
+ out << "WHAT: " << e . what( ) << std::endl;
+ out << "LINE: " << e . line( ) << std::endl;
+ out << "FILE: " << e . file( ) << std::endl;
+ return out;
+}
+
+
+//----------------------------------------------------- operator<< -------------
+//! \brief Dump exception info to an ostream
+//!
+inline std::ostream & operator<< (std::ostream & out, const std::exception & e)
+{
+ out << "WHAT: " << e . what( ) << std::endl;
+ return out;
+}
+
+} // namespace AMOS
+
+
+//-- Helpful exception throw macros
+#define AMOS_THROW(A) throw Exception_t(A,__LINE__,__FILE__)
+#define AMOS_THROW_ALLOC(A) throw AllocException_t(A,__LINE__,__FILE__)
+#define AMOS_THROW_ARGUMENT(A) throw ArgumentException_t(A,__LINE__,__FILE__)
+#define AMOS_THROW_IO(A) throw IOException_t(A,__LINE__,__FILE__)
+
+
+#endif // #ifndef __exceptions_AMOS_HH
diff --git a/src/AMOS/foundation_AMOS.hh b/src/AMOS/foundation_AMOS.hh
new file mode 100644
index 0000000..f385cf2
--- /dev/null
+++ b/src/AMOS/foundation_AMOS.hh
@@ -0,0 +1,25 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 12/05/2003
+//!
+//! \brief Include file for all of the AMOS foundation classes
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __foundation_AMOS_HH
+#define __foundation_AMOS_HH 1
+
+#include "utility_AMOS.hh"
+#include "inttypes_AMOS.hh"
+#include "exceptions_AMOS.hh"
+#include "datatypes_AMOS.hh"
+#include "databanks_AMOS.hh"
+#include "messages_AMOS.hh"
+#include "universals_AMOS.hh"
+#include "IDMap_AMOS.hh"
+#include "ContigIterator_AMOS.hh"
+
+#define Bank BankStream
+
+#endif // #ifndef __foundation_AMOS_HH
diff --git a/src/AMOS/inttypes_AMOS.hh b/src/AMOS/inttypes_AMOS.hh
new file mode 100644
index 0000000..6571e11
--- /dev/null
+++ b/src/AMOS/inttypes_AMOS.hh
@@ -0,0 +1,209 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 11/12/2003
+//!
+//! \brief Include file for all the AMOS integer types
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __inttypes_AMOS_HH
+#define __inttypes_AMOS_HH 1
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <inttypes.h> //!< ints of the form [u]int(size)_t, i.e. int32_t
+#include <limits.h>
+#include <string>
+
+
+namespace AMOS {
+
+typedef uint32_t ID_t; //!< ID type for iid's
+typedef uint32_t NCode_t; //!< unique integer code for dynamic typing
+typedef uint32_t SD_t; //!< standard deviation type
+typedef int32_t Size_t; //!< size type (for links,etc)
+typedef Size_t Pos_t; //!< position type (in a sequence,etc)
+typedef char Status_t; //!< status type
+
+const uint8_t NCODE_SIZE = 3; //!< length of the NCode strings
+const NCode_t NULL_NCODE = 0; //!< NULL NCode definition
+const ID_t NULL_ID = 0; //!< NULL ID definition
+const Status_t NULL_STATUS = 0; //!< NULL status definition
+const char MIN_QUALITY = '0'; //!< min quality score definition
+const char MAX_QUALITY = '0' + 63; //!< max quality score definition
+const char NULL_CHAR = '\0'; //!< null char
+const char NL_CHAR = '\n'; //!< newline char
+const std::string NULL_STRING = &NULL_CHAR; //!< null string
+
+const ID_t MAX_ID = ~((uint32_t)0); //!< (unsigned 32bit int)
+const Size_t MAX_SIZE = ~((uint32_t)0) >> 1; //!< ( signed 32bit int)
+const Pos_t MAX_POS = ~((uint32_t)0) >> 1; //!< ( signed 32bit int)
+
+
+//----------------------------------------------------- Qual2Char --------------
+//! \brief Converts a quality int into a printable character
+//!
+//! \param qual Integer quality representation
+//! \return Printable quality character
+//!
+inline char Qual2Char (uint8_t qual)
+{
+ return qual + MIN_QUALITY;
+}
+
+
+//----------------------------------------------------- Char2Qual --------------
+//! \brief Converts a printable quality character to an int
+//!
+//! \param qual Character quality representation
+//! \return Integer quality representation
+//!
+inline uint8_t Char2Qual (char qual)
+{
+ return qual - MIN_QUALITY;
+}
+
+
+//----------------------------------------------------- Decode -----------------
+//! \brief Converts an NCode integer to an AMOS message/field type
+//!
+//! \param ncode The NCode to translate to a string
+//! \return String representation of the NCode
+//!
+inline std::string Decode (NCode_t ncode)
+{
+ char buff[4] = {ncode & CHAR_MAX, ncode >> CHAR_BIT & CHAR_MAX,
+ ncode >> CHAR_BIT >> CHAR_BIT & CHAR_MAX, '\0'};
+ return buff;
+}
+
+
+//----------------------------------------------------- Encode -----------------
+//! \brief Converts an AMOS message/field type to an NCode integer
+//!
+//! \param str The NCode string equivalent
+//! \pre str is of proper NCode length, i.e. str . size( ) == NCODE_SIZE
+//! \return NCode of the string
+//!
+inline NCode_t Encode (const std::string & str)
+{
+ return (((str[2] << CHAR_BIT) | str[1]) << CHAR_BIT) | str[0];
+}
+
+
+//================================================ BankFlags_t =================
+//! \brief 8 bit flag set for IBankable types
+//!
+//! The flag set object provides 4 flags in a bit field, and can be directly
+//! accessed. In addition, 4 bits are left available for misc use.
+//!
+//==============================================================================
+struct BankFlags_t
+{
+//-- check which way we pack our bits, reverse order if machine is hi-to-lo
+// we should also limit this to 1byte in size to avoid endian issues
+#ifdef BITFIELDS_HTOL
+ uint8_t nibble : 4; //!< extra class-specific bits
+ uint8_t is_flagB : 1; //!< generic user flag B
+ uint8_t is_flagA : 1; //!< generic user flag A
+ uint8_t is_modified : 1; //!< modified flag
+ uint8_t is_removed : 1; //!< removed flag
+#else
+ uint8_t is_removed : 1; //!< removed flag
+ uint8_t is_modified : 1; //!< modified flag
+ uint8_t is_flagA : 1; //!< generic user flag A
+ uint8_t is_flagB : 1; //!< generic user flag B
+ uint8_t nibble : 4; //!< extra class-specific bits
+#endif
+
+ //------------------------------------------------- BankFlags_t --------------
+ //! \brief Constructs an empty Flags_t object
+ //!
+ //! Initializes all flag bits to zero (false)
+ //!
+ BankFlags_t ( )
+ {
+ clear( );
+ }
+
+
+ //------------------------------------------------- ~BankFlags_t -------------
+ //! \brief Destroys a Flags_t object
+ //!
+ ~BankFlags_t ( )
+ {
+
+ }
+
+
+ //------------------------------------------------- clear --------------------
+ //! \brief Sets everything to zero
+ //!
+ void clear ( )
+ {
+ is_removed = is_modified = is_flagA = is_flagB = 0; nibble = 0;
+ }
+};
+
+
+#define swap16(x) \
+ ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
+//!< swaps the bytes in a 16-bit value
+
+#define swap32(x) \
+ ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) \
+ | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
+//!< swaps the bytes in a 32-bit value
+
+#define swap64(x) \
+ ((((x) & 0xff00000000000000ull) >> 56) \
+ | (((x) & 0x00ff000000000000ull) >> 40) \
+ | (((x) & 0x0000ff0000000000ull) >> 24) \
+ | (((x) & 0x000000ff00000000ull) >> 8) \
+ | (((x) & 0x00000000ff000000ull) << 8) \
+ | (((x) & 0x0000000000ff0000ull) << 24) \
+ | (((x) & 0x000000000000ff00ull) << 40) \
+ | (((x) & 0x00000000000000ffull) << 56))
+//!< swaps the bytes in a 64-bit value
+
+
+//-- check machine endian-ness, if host is big-endian we need to swap
+#ifdef WORDS_BIGENDIAN
+# define htol16(x) swap16(x) //!< host to little-endian 16-bits
+# define htol32(x) swap32(x) //!< host to little-endian 32-bits
+# define htol64(x) swap64(x) //!< host to little-endian 64-bits
+# define ltoh16(x) swap16(x) //!< little-endian to host 16-bits
+# define ltoh32(x) swap32(x) //!< little-endian to host 32-bits
+# define ltoh64(x) swap64(x) //!< little-endian to host 64-bits
+#else
+# define htol16(x) (x) //!< host to little-endian 16-bits
+# define htol32(x) (x) //!< host to little-endian 32-bits
+# define htol64(x) (x) //!< host to little-endian 64-bits
+# define ltoh16(x) (x) //!< little-endian to host 16-bits
+# define ltoh32(x) (x) //!< little-endian to host 32-bits
+# define ltoh64(x) (x) //!< little-endian to host 64-bits
+#endif
+
+//-- check machine endian-ness, if host is little-endian we need to swap
+#ifdef WORDS_BIGENDIAN
+# define htob16(x) (x) //!< host to big-endian 16-bits
+# define htob32(x) (x) //!< host to big-endian 32-bits
+# define htob64(x) (x) //!< host to big-endian 64-bits
+# define btoh16(x) (x) //!< big-endian to host 16-bits
+# define btoh32(x) (x) //!< big-endian to host 32-bits
+# define btoh64(x) (x) //!< big-endian to host 64-bits
+#else
+# define htob16(x) swap16(x) //!< host to big-endian 16-bits
+# define htob32(x) swap32(x) //!< host to big-endian 32-bits
+# define htob64(x) swap64(x) //!< host to big-endian 64-bits
+# define btoh16(x) swap16(x) //!< big-endian to host 16-bits
+# define btoh32(x) swap32(x) //!< big-endian to host 32-bits
+# define btoh64(x) swap64(x) //!< big-endian to host 64-bits
+#endif
+
+} // namespace AMOS
+
+#endif // #ifndef __inttypes_AMOS_HH
diff --git a/src/AMOS/maptest.cc b/src/AMOS/maptest.cc
new file mode 100644
index 0000000..3bc56d5
--- /dev/null
+++ b/src/AMOS/maptest.cc
@@ -0,0 +1,28 @@
+#include <IDMap_AMOS.hh>
+#include <Message_AMOS.hh>
+#include <iostream>
+#include <cstdlib>
+using namespace std;
+using namespace AMOS;
+
+int main ( )
+{
+ try {
+
+ IDMap_t idmap1, idmap2;
+ Message_t msg;
+
+ msg . read (cin);
+ idmap1 . readMessage (msg);
+
+ idmap2 = idmap1;
+
+ idmap2 . writeMessage (msg);
+ msg . write (cout);
+ }
+ catch (Exception_t & e) {
+ cerr << e;
+ }
+
+ return 0;
+}
diff --git a/src/AMOS/messages_AMOS.hh b/src/AMOS/messages_AMOS.hh
new file mode 100644
index 0000000..dace1d9
--- /dev/null
+++ b/src/AMOS/messages_AMOS.hh
@@ -0,0 +1,15 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 11/13/2003
+//!
+//! \brief Include file for all of the AMOS messages
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __messages_AMOS_HH
+#define __messages_AMOS_HH 1
+
+#include "Message_AMOS.hh"
+
+#endif // #ifndef __messages_AMOS_HH
diff --git a/src/AMOS/msgtest.cc b/src/AMOS/msgtest.cc
new file mode 100644
index 0000000..e9c44d7
--- /dev/null
+++ b/src/AMOS/msgtest.cc
@@ -0,0 +1,88 @@
+#include "foundation_AMOS.hh"
+#include <fstream>
+#include <ctime>
+using namespace std;
+using namespace AMOS;
+
+#define ITERS 500000
+
+int main (int argc, char ** argv)
+{
+ Message_t msg;
+ Read_t red;
+ Contig_t ctg;
+
+ double loopa = 0;
+ double loopb = 0;
+ clock_t clocka, clockb;
+
+ vector<Tile_t> tlevec;
+ Tile_t tle;
+
+ tle . source = 33396;
+ tle . offset = 512;
+ tle . range = Range_t (12,832);
+ tle . gaps . push_back (12);
+ tle . gaps . push_back (30);
+ tle . gaps . push_back (337);
+ tle . gaps . push_back (508);
+ tle . gaps . push_back (514);
+ tle . gaps . push_back (789);
+
+ for ( int j = 0; j < 200; j ++ )
+ tlevec . push_back (tle);
+
+ try {
+
+ red . setIID (1);
+ red . setEID ("str2");
+ red . setComment ("GBRAA01TF");
+ red . setSequence
+ ("CCTTTGTGCTGGAAGGTGAATGCGGTGCGGCTGGTAACGGGCCGCGCGGGCGCAATCGGCGTCGTGATGGGCCGCAACAGCGAGTTTCACTTTGCCGAATTCATGCGCGGCATGGCCGAACGGCTGGGGCAGGACGAAGTGGACATTCTCGTCAGCCCCACCTCGCCGACCGGCAATGACGACGAGGTGCAGCTTTGTCACCGGCTGGCAACGAGCGGACGGGTGGATGCCGTTATCGTCACTTCCCCCAGGCCGAATGATGAACGCATCCGCATGTTGCACAAGCTCGGCATGCCGTTTCTGGTCCACGGGCGTTCGCAGATCGACATTCCCCATGCATGGCTTGATATCGACAATGAGAGCGCGGTCTATCATTCCACCGCACATCTGCTCGATCTTGGCCACAAGCGGATTGCGATGATCAACGGGCGCCATGGCTTCACCTTCTCGCTGCACCGCGACGCTGGCTATCGTAAGGCGCTTG [...]
+ "9878<?JQONBB77:=EGMPDOHRNSTSTSTRSSSREMRSSRSSRSQSSLQLLLLMPPPRRSSSRRRRSSSRSSSRRSRRRRSRIJJJONLTTTTRRROLLLLLLTTTTTTTRRRRPPPSRRSTTTRSRRRSPOLOOLOSSSSRSSRSRPRPPPSPSTSTSQSQTRURSSSSSTTTTRRRSRRSRSSSURRRRSWSSRRRSSTSRRTTTTTTTTTPPSRPPSTTTTRSRUSSSSUSPPPPRSQRTTTTSSSRRRRRTRRSTRTTTRTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTPSPPPPPRRRTTTTTRSSSSRRSRRSTSTTTTTTTTRTTRSSSTRSRSRRSSSTTTRSSRSSSUSSQSSRSSSSRRRRRSRRTRTSRTSURTTTTTRSSSSSSTRTRRRSSRSSRTSPSPPPRTRRSSRRSTRRRSSRRRRTTTRRRUSRSSSTRSSSSRRLLLLOLNOTTTSRRRRSSST [...]
+ red . setFragment (1);
+ red . setClearRange (Range_t(16,823));
+ red . setVectorClearRange (Range_t(16,823));
+ red . setQualityClearRange (Range_t(16,823));
+
+ ctg . setIID (1);
+ ctg . setEID ("str2");
+ ctg . setComment ("big contig");
+
+ ctg . setSequence
+ ("CCTTTGTGCTGGAAGGTGAATGCGGTGCGGCTGGTAACGGGCCGCGCGGGCGCAATCGGCGTCGTGATGGGCCGCAACAGCGAGTTTCACTTTGCCGAATTCATGCGCGGCATGGCCGAACGGCTGGGGCAGGACGAAGTGGACATTCTCGTCAGCCCCACCTCGCCGACCGGCAATGACGACGAGGTGCAGCTTTGTCACCGGCTGGCAACGAGCGGACGGGTGGATGCCGTTATCGTCACTTCCCCCAGGCCGAATGATGAACGCATCCGCATGTTGCACAAGCTCGGCATGCCGTTTCTGGTCCACGGGCGTTCGCAGATCGACATTCCCCATGCATGGCTTGATATCGACAATGAGAGCGCGGTCTATCATTCCACCGCACATCTGCTCGATCTTGGCCACAAGCGGATTGCGATGATCAACGGGCGCCATGGCTTCACCTTCTCGCTGCACCGCGACGCTGGCTATCGTAAGGCGCTTG [...]
+ "9878<?JQONBB77:=EGMPDOHRNSTSTSTRSSSREMRSSRSSRSQSSLQLLLLMPPPRRSSSRRRRSSSRSSSRRSRRRRSRIJJJONLTTTTRRROLLLLLLTTTTTTTRRRRPPPSRRSTTTRSRRRSPOLOOLOSSSSRSSRSRPRPPPSPSTSTSQSQTRURSSSSSTTTTRRRSRRSRSSSURRRRSWSSRRRSSTSRRTTTTTTTTTPPSRPPSTTTTRSRUSSSSUSPPPPRSQRTTTTSSSRRRRRTRRSTRTTTRTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTPSPPPPPRRRTTTTTRSSSSRRSRRSTSTTTTTTTTRTTRSSSTRSRSRRSSSTTTRSSRSSSUSSQSSRSSSSRRRRRSRRTRTSRTSURTTTTTRSSSSSSTRTRRRSSRSSRTSPSPPPRTRRSSRRSTRRRSSRRRRTTTRRRUSRSSSTRSSSSRRLLLLOLNOTTTSRRRRSSST [...]
+ ctg . setReadTiling (tlevec);
+
+ clocka = clock( );
+ for ( int i = 0; i < ITERS; i ++ )
+ red . writeMessage (msg);
+ clockb = clock( );
+ loopa = (double)(clockb - clocka);
+
+ clocka = clock( );
+ for ( int i = 0; i < ITERS; i ++ )
+ red . readMessage (msg);
+ clockb = clock( );
+ loopb = (double)(clockb - clocka);
+
+ msg . setField ("eid", "hello");
+ msg . setField ("bla", "foo");
+ msg . write (cerr);
+
+ Message_t::const_iterator mi;
+ cerr << "\nField List\n";
+ for ( mi = msg . begin( ); mi != msg . end( ); ++ mi )
+ cerr << Decode (mi -> first) << endl;
+
+ cerr << endl
+ << "loopa: " << (double)loopa / CLOCKS_PER_SEC << " sec.\n"
+ << "loopb: " << (double)loopb / CLOCKS_PER_SEC << " sec.\n"
+ << "granu: " << CLOCKS_PER_SEC << " of a sec.\n";
+ }
+ catch (Exception_t & e) {
+ cerr << "ERROR: exception\n" << e;
+ }
+
+ return 0;
+}
diff --git a/src/AMOS/streamtest.cc b/src/AMOS/streamtest.cc
new file mode 100644
index 0000000..99c36e8
--- /dev/null
+++ b/src/AMOS/streamtest.cc
@@ -0,0 +1,88 @@
+#include "foundation_AMOS.hh"
+#include <iostream>
+using namespace AMOS;
+using namespace std;
+
+int main (int argc, char ** argv)
+{
+ if ( argc != 2 )
+ {
+ cerr << "USAGE: " << argv[0] << " <outfile>" << endl;
+ exit (-1);
+ }
+
+ const uint8_t u8c = 0x01;
+ const uint16_t u16c = 0x0123;
+ const uint32_t u32c = 0x01234567;
+ const uint64_t u64c = 0x0123456789ABCDEFull;
+
+ const int8_t s8c = -u8c;
+ const int16_t s16c = -u16c;
+ const int32_t s32c = -u32c;
+ const int64_t s64c = -u64c;
+
+ cout << "BEFORE." << endl
+ << (unsigned long long)u8c << endl
+ << (unsigned long long)u16c << endl
+ << (unsigned long long)u32c << endl
+ << (unsigned long long)u64c << endl
+ << (long long)s8c << endl
+ << (long long)s16c << endl
+ << (long long)s32c << endl
+ << (long long)s64c << endl << endl;
+
+ uint8_t u8;
+ uint16_t u16;
+ uint32_t u32;
+ uint64_t u64;
+
+ int8_t s8;
+ int16_t s16;
+ int32_t s32;
+ int64_t s64;
+
+ fstream as;
+ as . open (argv[1], ios::out | ios::binary | ios::trunc);
+ writeLE (as, &u8c);
+ writeLE (as, &u16c);
+ writeLE (as, &u32c);
+ writeLE (as, &u64c);
+ writeLE (as, &s8c);
+ writeLE (as, &s16c);
+ writeLE (as, &s32c);
+ writeLE (as, &s64c);
+ as . close( );
+
+ as . open (argv[1], ios::in | ios::binary);
+ readLE (as, &u8);
+ readLE (as, &u16);
+ readLE (as, &u32);
+ readLE (as, &u64);
+ readLE (as, &s8);
+ readLE (as, &s16);
+ readLE (as, &s32);
+ readLE (as, &s64);
+ as . close( );
+
+ cout << "AFTER." << endl
+ << (unsigned long long)u8 << endl
+ << (unsigned long long)u16 << endl
+ << (unsigned long long)u32 << endl
+ << (unsigned long long)u64 << endl
+ << (long long)s8 << endl
+ << (long long)s16 << endl
+ << (long long)s32 << endl
+ << (long long)s64 << endl << endl;
+
+ if ( u8c == u8 && u16c == u16 && u32c == u32 && u64c == u64 &&
+ s8c == s8 && s16c == s16 && s32c == s32 && s64c == s64 )
+ {
+ cout << "SUCCESS!" << endl;
+ return 0;
+ }
+ else
+ {
+ cout << "FAILURE!" << endl;
+ return -1;
+ }
+}
diff --git a/src/AMOS/umdtest.cc b/src/AMOS/umdtest.cc
new file mode 100644
index 0000000..e3bd9a3
--- /dev/null
+++ b/src/AMOS/umdtest.cc
@@ -0,0 +1,21 @@
+#include "foundation_AMOS.hh"
+#include <iostream>
+using namespace std;
+using namespace AMOS;
+
+int main ( )
+{
+ Contig_t ctg;
+
+ try {
+
+ while ( ctg . readUMD (cin) )
+ ctg . writeUMD (cout);
+
+ }
+ catch (Exception_t & e) {
+ cerr << e;
+ }
+
+ return 0;
+}
diff --git a/src/AMOS/universals_AMOS.cc b/src/AMOS/universals_AMOS.cc
new file mode 100644
index 0000000..995ca38
--- /dev/null
+++ b/src/AMOS/universals_AMOS.cc
@@ -0,0 +1,165 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 11/11/2004
+//!
+//! \brief Source for universals_AMOS.hh
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "universals_AMOS.hh"
+#include <cassert>
+using namespace AMOS;
+using namespace std;
+using namespace HASHMAP;
+
+
+
+
+//================================================ UniversalSet_t ==============
+//----------------------------------------------------- UniversalSet_t ---------
+UniversalSet_t::UniversalSet_t ( )
+{
+ //-- Order must maintain definition-before-reference rule!
+ objs_m . push_back (new Universal_t( ));
+ objs_m . push_back (new Sequence_t( ));
+ objs_m . push_back (new Library_t( ));
+ objs_m . push_back (new Fragment_t( ));
+ objs_m . push_back (new Read_t( ));
+ objs_m . push_back (new Overlap_t( ));
+ objs_m . push_back (new Kmer_t( ));
+ objs_m . push_back (new Layout_t( ));
+ objs_m . push_back (new Contig_t( ));
+ objs_m . push_back (new Scaffold_t( ));
+ objs_m . push_back (new Link_t( ));
+ objs_m . push_back (new ContigLink_t( ));
+ objs_m . push_back (new ScaffoldLink_t( ));
+ objs_m . push_back (new Edge_t( ));
+ objs_m . push_back (new ContigEdge_t( ));
+ objs_m . push_back (new ScaffoldEdge_t( ));
+ objs_m . push_back (new Feature_t( ));
+ objs_m . push_back (new Group_t( ));
+ objs_m . push_back (new Index_t( ));
+
+ //-- Set up the hash
+ for ( iterator i = begin( ); i != end( ); ++ i )
+ hash_m [i -> getNCode( )] = &(*i);
+
+ //-- Make sure everything went OK, e.g. all the NCodes were unique
+ assert ( objs_m . size( ) == hash_m . size( ) );
+}
+
+
+
+//----------------------------------------------------- ~UniversalSet_t --------
+UniversalSet_t::~UniversalSet_t ( )
+{
+ for ( iterator i = begin( ); i != end( ); ++ i )
+ delete &(*i);
+}
+
+
+//----------------------------------------------------- clearAll ---------------
+void UniversalSet_t::clearAll ( )
+{
+ for ( iterator i = begin( ); i != end( ); ++ i )
+ i -> clear( );
+}
+
+
+
+//================================================ BankSet_t ===================
+//----------------------------------------------------- BankSet_t --------------
+BankSet_t::BankSet_t ( )
+{
+ UniversalSet_t objs;
+ UniversalSet_t::iterator ui;
+ iterator bi;
+
+ //-- Set up the banks
+ for ( ui = objs . begin( ); ui != objs . end( ); ++ ui )
+ bnks_m . push_back (new Bank_t (ui -> getNCode( )));
+
+ //-- Set up the hash
+ for ( bi = begin( ); bi != end( ); ++ bi )
+ hash_m [bi -> getType( )] = &(*bi);
+
+ //-- Make sure everything went OK, e.g. all the NCodes were unique
+ assert ( bnks_m . size( ) == hash_m . size( ) );
+}
+
+
+//----------------------------------------------------- ~BankSet_t -------------
+BankSet_t::~BankSet_t ( )
+{
+ for ( iterator i = begin( ); i != end( ); ++ i )
+ {
+ i -> close( );
+ delete &(*i);
+ }
+}
+
+
+//----------------------------------------------------- clearAll ---------------
+void BankSet_t::clearAll ( )
+{
+ for ( iterator i = begin( ); i != end( ); ++ i )
+ i -> clear( );
+}
+
+
+//----------------------------------------------------- closeAll ---------------
+void BankSet_t::closeAll ( )
+{
+ for ( iterator i = begin( ); i != end( ); ++ i )
+ i -> close( );
+}
+
+
+
+//================================================ BankStreamSet_t =============
+//----------------------------------------------------- BankStreamSet_t --------
+BankStreamSet_t::BankStreamSet_t ( )
+{
+ UniversalSet_t objs;
+ UniversalSet_t::iterator ui;
+ iterator bi;
+
+ //-- Set up the banks
+ for ( ui = objs . begin( ); ui != objs . end( ); ++ ui )
+ bnks_m . push_back (new BankStream_t (ui -> getNCode( )));
+
+ //-- Set up the hash
+ for ( bi = begin( ); bi != end( ); ++ bi )
+ hash_m [bi -> getType( )] = &(*bi);
+
+ //-- Make sure everything went OK, e.g. all the NCodes were unique
+ assert ( bnks_m . size( ) == hash_m . size( ) );
+}
+
+
+//----------------------------------------------------- ~BankStreamSet_t -------
+BankStreamSet_t::~BankStreamSet_t ( )
+{
+ for ( iterator i = begin( ); i != end( ); ++ i )
+ {
+ i -> close( );
+ delete &(*i);
+ }
+}
+
+
+//----------------------------------------------------- clearAll ---------------
+void BankStreamSet_t::clearAll ( )
+{
+ for ( iterator i = begin( ); i != end( ); ++ i )
+ i -> clear( );
+}
+
+
+//----------------------------------------------------- closeAll ---------------
+void BankStreamSet_t::closeAll ( )
+{
+ for ( iterator i = begin( ); i != end( ); ++ i )
+ i -> close( );
+}
diff --git a/src/AMOS/universals_AMOS.hh b/src/AMOS/universals_AMOS.hh
new file mode 100644
index 0000000..28157f0
--- /dev/null
+++ b/src/AMOS/universals_AMOS.hh
@@ -0,0 +1,610 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 12/05/2003
+//!
+//! \brief Include file for all of the AMOS universal types
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __universals_AMOS_HH
+#define __universals_AMOS_HH 1
+
+#include "ContigEdge_AMOS.hh"
+#include "ContigLink_AMOS.hh"
+#include "Contig_AMOS.hh"
+#include "Edge_AMOS.hh"
+#include "Feature_AMOS.hh"
+#include "Fragment_AMOS.hh"
+#include "Group_AMOS.hh"
+#include "Index_AMOS.hh"
+#include "Kmer_AMOS.hh"
+#include "Layout_AMOS.hh"
+#include "Library_AMOS.hh"
+#include "Link_AMOS.hh"
+#include "Overlap_AMOS.hh"
+#include "Read_AMOS.hh"
+#include "ScaffoldEdge_AMOS.hh"
+#include "ScaffoldLink_AMOS.hh"
+#include "Scaffold_AMOS.hh"
+#include "Sequence_AMOS.hh"
+#include "Universal_AMOS.hh"
+
+#include "utility_AMOS.hh"
+#include <vector>
+#include <string>
+
+
+
+namespace AMOS {
+
+//================================================ UniversalSet_t ==============
+//! \brief A non-redundant, complete collection of Universal objects
+//!
+//! Provides a non-redundant, complete collection of static Universal objects
+//! accessible by their NCode and iteration. Useful when all possible AMOS
+//! universal objects are required, but the exact makeup of objects is unknown.
+//! Objects stored in this set are static, and only destruced when the class
+//! is destructed. Objects are stored in order that will preserve the
+//! def-before-ref rule - meaning two objects A,B where B has a link to A will
+//! always appear in the order A,B when iterating through the set.
+//!
+//==============================================================================
+class UniversalSet_t
+{
+
+private:
+
+ std::vector<Universal_t *> objs_m; //!< objects in correct order
+ HASHMAP::hash_map<NCode_t, Universal_t *> hash_m; //!< object hash
+
+
+public:
+
+ class iterator
+ {
+ private:
+ std::vector<Universal_t *>::iterator i_m;
+
+ public:
+ iterator ()
+ { }
+ iterator (std::vector<Universal_t *>::iterator i)
+ { i_m = i; }
+ Universal_t & operator*() const
+ { return **i_m; }
+ Universal_t * operator->() const
+ { return *i_m; }
+ iterator & operator++()
+ { ++ i_m; return *this; }
+ iterator operator++(int)
+ { iterator tmp = *this; this->operator++(); return tmp; }
+ bool operator== (iterator x)
+ { return i_m == x . i_m; }
+ bool operator!= (iterator x)
+ { return i_m != x . i_m; }
+ };
+
+ class const_iterator
+ {
+ private:
+ std::vector<Universal_t *>::const_iterator i_m;
+
+ public:
+ const_iterator ()
+ { }
+ const_iterator (std::vector<Universal_t *>::const_iterator i)
+ { i_m = i; }
+ const Universal_t & operator*() const
+ { return **i_m; }
+ const Universal_t * operator->() const
+ { return *i_m; }
+ const_iterator & operator++()
+ { ++ i_m; return *this; }
+ const_iterator operator++(int)
+ { const_iterator tmp = *this; this->operator++(); return tmp; }
+ bool operator== (const_iterator x)
+ { return i_m == x . i_m; }
+ bool operator!= (const_iterator x)
+ { return i_m != x . i_m; }
+ };
+
+
+ //--------------------------------------------------- UniversalSet_t ---------
+ //! \brief Constructs a UniversalSet_t w/ default objects
+ //!
+ UniversalSet_t ( );
+
+
+ //--------------------------------------------------- ~UniversalSet_t --------
+ //! \brief Destroys a UniveralSet_t and its contained objects
+ //!
+ ~UniversalSet_t ( );
+
+
+ //--------------------------------------------------- begin ------------------
+ //! \brief Returns an iterator to the beginning of the set
+ //!
+ //! Iterator on all the objects in the set. Operates just like a std::vector
+ //! iterator, however it does not support iterator addition/subtraction or
+ //! reverse iteration. Objects will always be ordered
+ //! definition-before-reference, meaning if B refers to A, A will always
+ //! appear before B when iterating forward.
+ //!
+ //! \return An iterator to the beginning of the set
+ //!
+ iterator begin ( ) { return iterator (objs_m . begin( )); }
+ const_iterator begin ( ) const { return const_iterator (objs_m . begin( )); }
+
+
+ //--------------------------------------------------- clearAll ---------------
+ //! \brief Issues a clear command to each object in the set
+ //!
+ //! \return void
+ //!
+ void clearAll ( );
+
+
+ //--------------------------------------------------- end --------------------
+ //! \brief Returns an iterator to the end of the set
+ //!
+ //! \return An iterator to the end of the set
+ //!
+ iterator end ( ) { return iterator (objs_m . end( )); }
+ const_iterator end ( ) const { return const_iterator (objs_m . end( )); }
+
+
+ //--------------------------------------------------- exists -----------------
+ //! \brief Checks if an object with a given NCode exists in the set
+ //!
+ //! \return true if it exists, false otherwise
+ //!
+ bool exists (NCode_t ncode)
+ {
+ return ( hash_m . find (ncode) != hash_m . end( ) );
+ }
+
+
+ //--------------------------------------------------- getSize ----------------
+ //! \brief Returns the number of known universal objects
+ //!
+ //! \return The number of objects in the set
+ //!
+ Size_t getSize ( )
+ {
+ return objs_m . size( );
+ }
+
+
+ //--------------------------------------------------- operator[] -------------
+ //! \brief Returns a reference to the object with the given NCode
+ //!
+ //! To call object-specific methods, it will be necessary to cast the return
+ //! reference to the type of object you are expecting to be returned. e.g.
+ //! `((Read_t &)set["RED"]).setType(Read_t::END)'. However, for virtual
+ //! methods inherited from Universal_t, this casting is unnecessary.
+ //!
+ //! \pre The NCode exists in the set
+ //! \throws ArgumentException_t
+ //! \return Pointer to the object with the given NCode
+ //!
+ Universal_t & operator[] (NCode_t ncode)
+ {
+ HASHMAP::hash_map<NCode_t, Universal_t *>::iterator i;
+ if ( (i = hash_m . find (ncode)) == hash_m . end( ) )
+ AMOS_THROW_ARGUMENT
+ ("Unknown UniversalSet_t object NCode " + Decode(ncode));
+ return *(i -> second);
+ }
+
+
+ //--------------------------------------------------- operator[] -------------
+ const Universal_t & operator[] (NCode_t ncode) const
+ {
+ HASHMAP::hash_map<NCode_t, Universal_t *>::const_iterator i;
+ if ( (i = hash_m . find (ncode)) == hash_m . end( ) )
+ AMOS_THROW_ARGUMENT
+ ("Unknown UniversalSet_t object NCode " + Decode(ncode));
+ return *(i -> second);
+ }
+
+
+ //--------------------------------------------------- operator[] -------------
+ Universal_t & operator[] (const std::string & ncode)
+ {
+ return operator[] (Encode (ncode));
+ }
+
+
+ //--------------------------------------------------- operator[] -------------
+ const Universal_t & operator[] (const std::string & ncode) const
+ {
+ return operator[] (Encode (ncode));
+ }
+};
+
+
+
+
+//================================================ BankSet_t ===================
+//! \brief A non-redundant, complete collection of AMOS banks
+//!
+//! Provides a non-redundant, complete collection of static AMOS banks
+//! accessible by their NCode and iteration. Useful when all possible AMOS
+//! banks are required, but the exact makeup of banks is unknown. Banks stored
+//! in this set are static, and only destruced when the class is destructed.
+//! Banks are stored in order that will preserve the def-before-ref rule -
+//! meaning two banks A,B where B has a link to A will always appear in the
+//! order A,B when iterating through the set.
+//!
+//==============================================================================
+class BankSet_t
+{
+
+private:
+
+ std::vector<Bank_t *> bnks_m; //!< banks in correct order
+ HASHMAP::hash_map<NCode_t, Bank_t *> hash_m; //!< bank hash
+
+
+public:
+
+ class iterator
+ {
+ private:
+ std::vector<Bank_t *>::iterator i_m;
+
+ public:
+ iterator ()
+ { }
+ iterator (std::vector<Bank_t *>::iterator i)
+ { i_m = i; }
+ Bank_t & operator*() const
+ { return **i_m; }
+ Bank_t * operator->() const
+ { return *i_m; }
+ iterator & operator++()
+ { ++ i_m; return *this; }
+ iterator operator++(int)
+ { iterator tmp = *this; this->operator++(); return tmp; }
+ bool operator== (iterator x)
+ { return i_m == x . i_m; }
+ bool operator!= (iterator x)
+ { return i_m != x . i_m; }
+ };
+
+ class const_iterator
+ {
+ private:
+ std::vector<Bank_t *>::const_iterator i_m;
+
+ public:
+ const_iterator ()
+ { }
+ const_iterator (std::vector<Bank_t *>::const_iterator i)
+ { i_m = i; }
+ const Bank_t & operator*() const
+ { return **i_m; }
+ const Bank_t * operator->() const
+ { return *i_m; }
+ const_iterator & operator++()
+ { ++ i_m; return *this; }
+ const_iterator operator++(int)
+ { const_iterator tmp = *this; this->operator++(); return tmp; }
+ bool operator== (const_iterator x)
+ { return i_m == x . i_m; }
+ bool operator!= (const_iterator x)
+ { return i_m != x . i_m; }
+ };
+
+
+ //--------------------------------------------------- BankSet_t --------------
+ //! \brief Constructs a BankSet_t w/ default banks
+ //!
+ BankSet_t ( );
+
+
+ //--------------------------------------------------- ~BankSet_t -------------
+ //! \brief Destroys a UniveralSet_t and closes its contained banks
+ //!
+ ~BankSet_t ( );
+
+
+ //--------------------------------------------------- begin ------------------
+ //! \brief Returns an iterator to the beginning of the set
+ //!
+ //! Iterator on all the banks in the set. Operates just like a std::vector
+ //! iterator, however it does not support iterator addition/subtraction or
+ //! reverse iteration. Banks will always be ordered
+ //! definition-before-reference, meaning if B refers to A, A will always
+ //! appear before B when iterating forward.
+ //!
+ //! \return An iterator to the beginning of the set
+ //!
+ iterator begin ( ) { return iterator (bnks_m . begin( )); }
+ const_iterator begin ( ) const { return const_iterator (bnks_m . begin( )); }
+
+
+ //--------------------------------------------------- clearAll ---------------
+ //! \brief Issues a clear command to each bank in the set
+ //!
+ //! \return void
+ //!
+ void clearAll ( );
+
+
+ //--------------------------------------------------- closeAll ---------------
+ //! \brief Issues a close command to each bank in the set
+ //!
+ //! \return void
+ //!
+ void closeAll ( );
+
+
+ //--------------------------------------------------- end --------------------
+ //! \brief Returns an iterator to the end of the set
+ //!
+ //! \return An iterator to the end of the set
+ //!
+ iterator end ( ) { return iterator (bnks_m . end ( )); }
+ const_iterator end ( ) const { return const_iterator (bnks_m . end( )); }
+
+
+ //--------------------------------------------------- exists -----------------
+ //! \brief Checks if a bank with a given NCode exists in the set
+ //!
+ //! \return true if it exists, false otherwise
+ //!
+ bool exists (NCode_t ncode)
+ {
+ return ( hash_m . find (ncode) != hash_m . end( ) );
+ }
+
+
+ //--------------------------------------------------- getSize ----------------
+ //! \brief Returns the number of known AMOS banks
+ //!
+ //! \return The number of banks in the set
+ //!
+ Size_t getSize ( )
+ {
+ return bnks_m . size( );
+ }
+
+
+ //--------------------------------------------------- operator[] -------------
+ //! \brief Returns a reference to the bank with the given NCode
+ //!
+ //! \pre The NCode exists in the set
+ //! \throws ArgumentException_t
+ //! \return Pointer to the bank with the given NCode
+ //!
+ Bank_t & operator[] (NCode_t ncode)
+ {
+ HASHMAP::hash_map<NCode_t, Bank_t *>::iterator i;
+ if ( (i = hash_m . find (ncode)) == hash_m . end( ) )
+ AMOS_THROW_ARGUMENT
+ ("Unknown BankSet_t object NCode " + Decode(ncode));
+ return *(i -> second);
+ }
+
+
+ //--------------------------------------------------- operator[] -------------
+ const Bank_t & operator[] (NCode_t ncode) const
+ {
+ HASHMAP::hash_map<NCode_t, Bank_t *>::const_iterator i;
+ if ( (i = hash_m . find (ncode)) == hash_m . end( ) )
+ AMOS_THROW_ARGUMENT
+ ("Unknown BankSet_t object NCode " + Decode(ncode));
+ return *(i -> second);
+ }
+
+
+ //--------------------------------------------------- operator[] -------------
+ Bank_t & operator[] (const std::string & ncode)
+ {
+ return operator[] (Encode (ncode));
+ }
+
+
+ //--------------------------------------------------- operator[] -------------
+ const Bank_t & operator[] (const std::string & ncode) const
+ {
+ return operator[] (Encode (ncode));
+ }
+};
+
+
+
+
+//================================================ BankStreamSet_t =============
+//! \brief A non-redundant, complete collection of AMOS banks
+//!
+//! Provides a non-redundant, complete collection of static AMOS banks
+//! accessible by their NCode and iteration. Useful when all possible AMOS
+//! banks are required, but the exact makeup of banks is unknown. Banks stored
+//! in this set are static, and only destruced when the class is destructed.
+//! Banks are stored in order that will preserve the def-before-ref rule -
+//! meaning two banks A,B where B has a link to A will always appear in the
+//! order A,B when iterating through the set.
+//!
+//==============================================================================
+class BankStreamSet_t
+{
+
+private:
+
+ std::vector<BankStream_t *> bnks_m; //!< banks in correct order
+ HASHMAP::hash_map<NCode_t, BankStream_t *> hash_m; //!< bank hash
+
+
+public:
+
+ class iterator
+ {
+ private:
+ std::vector<BankStream_t *>::iterator i_m;
+
+ public:
+ iterator ()
+ { }
+ iterator (std::vector<BankStream_t *>::iterator i)
+ { i_m = i; }
+ BankStream_t & operator*() const
+ { return **i_m; }
+ BankStream_t * operator->() const
+ { return *i_m; }
+ iterator & operator++()
+ { ++ i_m; return *this; }
+ iterator operator++(int)
+ { iterator tmp = *this; this->operator++(); return tmp; }
+ bool operator== (iterator x)
+ { return i_m == x . i_m; }
+ bool operator!= (iterator x)
+ { return i_m != x . i_m; }
+ };
+
+ class const_iterator
+ {
+ private:
+ std::vector<BankStream_t *>::const_iterator i_m;
+
+ public:
+ const_iterator ()
+ { }
+ const_iterator (std::vector<BankStream_t *>::const_iterator i)
+ { i_m = i; }
+ const BankStream_t & operator*() const
+ { return **i_m; }
+ const BankStream_t * operator->() const
+ { return *i_m; }
+ const_iterator & operator++()
+ { ++ i_m; return *this; }
+ const_iterator operator++(int)
+ { const_iterator tmp = *this; this->operator++(); return tmp; }
+ bool operator== (const_iterator x)
+ { return i_m == x . i_m; }
+ bool operator!= (const_iterator x)
+ { return i_m != x . i_m; }
+ };
+
+
+ //--------------------------------------------------- BankStreamSet_t --------
+ //! \brief Constructs a BankStreamSet_t w/ default banks
+ //!
+ BankStreamSet_t ( );
+
+
+ //--------------------------------------------------- ~BankStreamSet_t -------
+ //! \brief Destroys a UniveralSet_t and closes its contained banks
+ //!
+ ~BankStreamSet_t ( );
+
+
+ //--------------------------------------------------- begin ------------------
+ //! \brief Returns an iterator to the beginning of the set
+ //!
+ //! Iterator on all the banks in the set. Operates just like a std::vector
+ //! iterator, however it does not support iterator addition/subtraction or
+ //! reverse iteration. Banks will always be ordered
+ //! definition-before-reference, meaning if B refers to A, A will always
+ //! appear before B when iterating forward.
+ //!
+ //! \return An iterator to the beginning of the set
+ //!
+ iterator begin ( ) { return iterator (bnks_m . begin( )); }
+ const_iterator begin ( ) const { return const_iterator (bnks_m . begin( )); }
+
+
+ //--------------------------------------------------- clearAll ---------------
+ //! \brief Issues a clear command to each bank in the set
+ //!
+ //! \return void
+ //!
+ void clearAll ( );
+
+
+ //--------------------------------------------------- closeAll ---------------
+ //! \brief Issues a close command to each bank in the set
+ //!
+ //! \return void
+ //!
+ void closeAll ( );
+
+
+ //--------------------------------------------------- end --------------------
+ //! \brief Returns an iterator to the end of the set
+ //!
+ //! \return An iterator to the end of the set
+ //!
+ iterator end ( ) { return iterator (bnks_m . end ( )); }
+ const_iterator end ( ) const { return const_iterator (bnks_m . end( )); }
+
+
+ //--------------------------------------------------- exists -----------------
+ //! \brief Checks if a bank with a given NCode exists in the set
+ //!
+ //! \return true if it exists, false otherwise
+ //!
+ bool exists (NCode_t ncode)
+ {
+ return ( hash_m . find (ncode) != hash_m . end( ) );
+ }
+
+
+ //--------------------------------------------------- getSize ----------------
+ //! \brief Returns the number of known AMOS banks
+ //!
+ //! \return The number of banks in the set
+ //!
+ Size_t getSize ( )
+ {
+ return bnks_m . size( );
+ }
+
+
+ //--------------------------------------------------- operator[] -------------
+ //! \brief Returns a reference to the bank with the given NCode
+ //!
+ //! \pre The NCode exists in the set
+ //! \throws ArgumentException_t
+ //! \return Pointer to the bank with the given NCode
+ //!
+ BankStream_t & operator[] (NCode_t ncode)
+ {
+ HASHMAP::hash_map<NCode_t, BankStream_t *>::iterator i;
+ if ( (i = hash_m . find (ncode)) == hash_m . end( ) )
+ AMOS_THROW_ARGUMENT
+ ("Unknown BankStreamSet_t object NCode " + Decode(ncode));
+ return *(i -> second);
+ }
+
+
+ //--------------------------------------------------- operator[] -------------
+ const BankStream_t & operator[] (NCode_t ncode) const
+ {
+ HASHMAP::hash_map<NCode_t, BankStream_t *>::const_iterator i;
+ if ( (i = hash_m . find (ncode)) == hash_m . end( ) )
+ AMOS_THROW_ARGUMENT
+ ("Unknown BankStreamSet_t object NCode " + Decode(ncode));
+ return *(i -> second);
+ }
+
+
+ //--------------------------------------------------- operator[] -------------
+ BankStream_t & operator[] (const std::string & ncode)
+ {
+ return operator[] (Encode (ncode));
+ }
+
+
+ //--------------------------------------------------- operator[] -------------
+ const BankStream_t & operator[] (const std::string & ncode) const
+ {
+ return operator[] (Encode (ncode));
+ }
+};
+
+} // namespace AMOS
+
+#endif // #ifndef __universals_AMOS_HH
diff --git a/src/AMOS/utility_AMOS.cc b/src/AMOS/utility_AMOS.cc
new file mode 100644
index 0000000..b0271af
--- /dev/null
+++ b/src/AMOS/utility_AMOS.cc
@@ -0,0 +1,88 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 04/18/2005
+//!
+//! \brief Source for utility_AMOS.hh
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "utility_AMOS.hh"
+#include <algorithm>
+#include <cstring>
+using namespace AMOS;
+using namespace std;
+
+
+const char COMPLEMENT_DNA[256] =
+ {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64,'T','V','G','H', 69, 70,'C','D', 73, 74,'M', 76,'K','N', 79,
+ 80, 81,'Y','S','A', 85,'B','W','X','R', 90, 91, 92, 93, 94, 95,
+ 96,'t','v','g','h',101,102,'c','d',105,106,'m',108,'k','n',111,
+ 112,113,'y','s','a',117,'b','w','x','r',122,123,124,125,126,127,
+ 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
+ 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
+ 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
+ 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
+ 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
+ 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
+ 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
+ 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
+ };
+
+
+//--------------------------------------------------- Complement ---------------
+char AMOS::Complement (char ch)
+{
+ return COMPLEMENT_DNA[ int(ch) ];
+}
+
+
+//--------------------------------------------------- ReverseComplement --------
+void AMOS::ReverseComplement(string & str)
+{
+ char ch;
+ string::iterator lo = str.begin();
+ string::iterator hi = str.end() - 1;
+ while ( lo <= hi )
+ {
+ ch = *hi;
+ *hi = COMPLEMENT_DNA[ int(*lo) ];
+ *lo = COMPLEMENT_DNA[ int(ch) ];
+ lo++; hi--;
+ }
+}
+
+
+//--------------------------------------------------- ReverseComplement --------
+void AMOS::ReverseComplement(char * str)
+{
+ char ch;
+ char *lo = str;
+ char *hi = str + strlen(str) - 1;
+ while ( lo <= hi )
+ {
+ ch = *hi;
+ *hi = COMPLEMENT_DNA[ int(*lo) ];
+ *lo = COMPLEMENT_DNA[ int(ch) ];
+ lo++; hi--;
+ }
+}
+
+
+//--------------------------------------------------- Reverse ------------------
+void AMOS::Reverse (string & str)
+{
+ reverse (str . begin( ), str . end( ));
+}
+
+
+//--------------------------------------------------- Reverse ------------------
+void AMOS::Reverse (char * str)
+{
+ reverse (str, str + strlen (str));
+}
diff --git a/src/AMOS/utility_AMOS.hh b/src/AMOS/utility_AMOS.hh
new file mode 100644
index 0000000..c7cc64f
--- /dev/null
+++ b/src/AMOS/utility_AMOS.hh
@@ -0,0 +1,380 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 07/27/2004
+//!
+//! \brief Include file for AMOS utilities, #defines, inttypes and exceptions
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __utility_AMOS_HH
+#define __utility_AMOS_HH 1
+
+#include "inttypes_AMOS.hh"
+#include "exceptions_AMOS.hh"
+#include <new>
+#include <cstdlib>
+#include <cstring>
+#include <iostream>
+#include <cassert>
+#include <errno.h>
+
+//-- Include hash_map
+#ifdef __GNUC__
+
+#if __GNUC__ < 3
+
+ #include <hash_map.h>
+ namespace Sgi { using ::hash_map; }; // inherit globals
+ #define HASHMAP std
+
+#elif __GNUC__ == 3
+
+ #include <ext/hash_map>
+
+ #if __GNUC_MINOR__ == 0
+
+ namespace Sgi = std; // GCC 3.0
+ #define HASHMAP std
+
+ #else
+ namespace Sgi = ::__gnu_cxx; // GCC 3.1 and later
+ #define HASHMAP __gnu_cxx
+
+ #endif
+
+#elif __GNUC__ > 3
+
+ #include <ext/hash_map>
+ namespace Sgi = ::__gnu_cxx; // GCC 4.0 and later
+ #define HASHMAP __gnu_cxx
+
+#endif
+
+#else // ... there are other compilers, right?
+ namespace Sgi = std;
+ #define HASHMAP std
+#endif
+
+
+
+
+namespace AMOS {
+
+//--------------------------------------------------- SafeCalloc ---------------
+//! \brief Safe calloc wrapper
+//!
+//! Detects calloc failure and throws AMOS::AllocException_t exception instead
+//! of returning a NULL pointer.
+//!
+//! \param num Number of elements to allocate
+//! \param size Number of bytes per element
+//! \post The memory is allocated
+//! \throws AllocException_t on memory exhaustion
+//! \return Pointer to the new memory block
+//!
+inline void * SafeCalloc (size_t num, size_t size)
+{
+ void * Q = calloc (num, size);
+ if ( Q == NULL )
+ AMOS_THROW_ALLOC ("calloc failed");
+
+ return Q;
+}
+
+
+//--------------------------------------------------- SafeMalloc ---------------
+//! \brief Safe malloc wrapper
+//!
+//! Detects malloc failure and throws AMOS::AllocException_t exception instead
+//! of returning a NULL pointer.
+//!
+//! \param size Number of bytes to allocate
+//! \post The memory is allocated
+//! \throws AllocException_t on memory exhaustion
+//! \return Pointer to the new memory block
+//!
+inline void * SafeMalloc (size_t size)
+{
+ void * Q = malloc (size);
+ if ( Q == NULL )
+ AMOS_THROW_ALLOC ("malloc failed");
+
+ return Q;
+}
+
+
+//--------------------------------------------------- SafeRealloc --------------
+//! \brief Safe realloc wrapper
+//!
+//! Detects realloc failure and throws AMOS::AllocException_t exception instead
+//! of returning a NULL pointer. This helps prevent memory leaks by preventing
+//! the original memory block from being lost when the realloc function returns
+//! NULL.
+//!
+//! \param P The memory block to re-allocate
+//! \param size Number of bytes to allocate
+//! \post The memory is allocated
+//! \throws AllocException_t on memory exhaustion
+//! \return Pointer to the new memory block
+//!
+inline void * SafeRealloc (void * P, size_t size)
+{
+ void * Q = realloc (P, size);
+ if ( Q == NULL && size != 0 )
+ AMOS_THROW_ALLOC ("realloc failed");
+
+ return Q;
+}
+
+
+//--------------------------------------------------- SafeStrdup ---------------
+//! \brief Safe strdup wrapper
+//!
+//! Detects malloc failure and throws AMOS::AllocException_t exception instead
+//! of returning a NULL pointer.
+//!
+//! \param str The string to copy
+//! \post The memory is allocated and the string is copied
+//! \throws AllocException_t on memory exhaustion
+//! \return Pointer to the new string copy
+//!
+inline char * SafeStrdup (const char * str)
+{
+ char * Q = strdup (str);
+ if ( Q == NULL )
+ AMOS_THROW_ALLOC ("strdup failed");
+ return Q;
+}
+
+
+//--------------------------------------------------- Complement ---------------
+//! \brief Returns the DNA complement of an IUPAC character
+//!
+//! Complement-able IUPAC characters are ACGTUMRWSYKVHDB, while NX*- are also
+//! acceptable but are self-complementary. Characters other than these will
+//! throw an exception.
+//!
+//! \param ch The character to take the complement of
+//! \throws ArgumentException_t if ch is an invalid character
+//! \return void
+//!
+char Complement (char ch);
+
+
+//--------------------------------------------------- ReverseComplement --------
+//! \brief Takes the DNA reverse complement of an IUPAC string
+//!
+//! Complement-able IUPAC characters are ACGTUMRWSYKVHDB, while NX*- are also
+//! acceptable but are self-complementary. Characters other than these will
+//! throw an exception.
+//!
+//! \param str The string to reverse complement
+//! \throws ArgumentException_t if invalid characters are found
+//! \return void
+//!
+void ReverseComplement (std::string & str);
+
+
+//--------------------------------------------------- ReverseComplement --------
+//! \brief Takes the DNA reverse complement of an IUPAC string
+//!
+//! Complement-able IUPAC characters are ACGTUMRWSYKVHDB, while NX*- are also
+//! acceptable but are self-complementary. Characters other than these will
+//! throw an exception.
+//!
+//! \param str The string to reverse complement
+//! \throws ArgumentException_t if invalid characters are found
+//! \return void
+//!
+void ReverseComplement (char * str);
+
+
+//--------------------------------------------------- Reverse ------------------
+//! \brief Reverses the contents of a string
+//!
+//! Simply calls the STL reverse "algorithm" but in an AMOS way
+//!
+//! \param str The string to reverse
+//! \return void
+//!
+void Reverse (std::string & str);
+
+
+//--------------------------------------------------- Reverse ------------------
+//! \brief Reverses the contents of a string
+//!
+//! \param str The string to reverse
+//! \return void
+//!
+void Reverse (char * str);
+
+
+//------------------------------------------------- writeLE ------------------
+//! \brief Writes an 8-bit int in little-endian byte order
+//!
+//! \param out The ostream to write to
+//! \param i A pointer to the int to write
+//! \pre Same preconditions as ostream::write
+//! \return void
+//!
+inline void writeLE (std::ostream & out, const uint8_t * i)
+{
+ out . put ((char)(*i));
+}
+inline void writeLE (std::ostream & out, const int8_t * i)
+{
+ writeLE (out, (const uint8_t *)(i));
+}
+inline void writeLE (std::ostream & out, const BankFlags_t * i)
+{
+ assert ( sizeof (BankFlags_t) == 1 );
+ writeLE (out, (const uint8_t *)(i));
+}
+
+
+//------------------------------------------------- writeLE ------------------
+//! \brief Writes a 16-bit int in little-endian byte order
+//!
+//! \param out The ostream to write to
+//! \param i A pointer to the int to write
+//! \pre Same preconditions as ostream::write
+//! \return void
+//!
+inline void writeLE (std::ostream & out, const uint16_t * i)
+{
+ union {uint16_t i; char c[sizeof (uint16_t)];} u16;
+ u16.i = htol16 (*i);
+ out . write (u16.c, sizeof (uint16_t));
+}
+inline void writeLE (std::ostream & out, const int16_t * i)
+{
+ writeLE (out, (const uint16_t *)(i));
+}
+
+
+//------------------------------------------------- writeLE ------------------
+//! \brief Writes a 32-bit int in little-endian byte order
+//!
+//! \param out The ostream to write to
+//! \param i A pointer to the int to write
+//! \pre Same preconditions as ostream::write
+//! \return void
+//!
+inline void writeLE (std::ostream & out, const uint32_t * i)
+{
+ union {uint32_t i; char c[sizeof (uint32_t)];} u32;
+ u32.i = htol32 (*i);
+ out . write (u32.c, sizeof (uint32_t));
+}
+inline void writeLE (std::ostream & out, const int32_t * i)
+{
+ writeLE (out, (const uint32_t *)(i));
+}
+
+
+//------------------------------------------------- writeLE ------------------
+//! \brief Writes a 64-bit int in little-endian byte order
+//!
+//! \param out The ostream to write to
+//! \param i A pointer to the int to write
+//! \pre Same preconditions as ostream::write
+//! \return void
+//!
+inline void writeLE (std::ostream & out, const uint64_t * i)
+{
+ union {uint64_t i; char c[sizeof (uint64_t)];} u64;
+ u64.i = htol64 (*i);
+ out . write (u64.c, sizeof (uint64_t));
+}
+inline void writeLE (std::ostream & out, const int64_t * i)
+{
+ writeLE (out, (const uint64_t *)(i));
+}
+
+
+//------------------------------------------------- readLE -------------------
+//! \brief Reads a little-endian 8-bit int
+//!
+//! \param in The istream to read from
+//! \param i A pointer to the int storage
+//! \pre Same preconditions as istream::read
+//! \return void
+//!
+inline void readLE (std::istream & in, uint8_t * i)
+{
+ *i = in . get( );
+}
+inline void readLE (std::istream & in, int8_t * i)
+{
+ readLE (in, (uint8_t *)(i));
+}
+inline void readLE (std::istream & in, BankFlags_t * i)
+{
+ assert ( sizeof (BankFlags_t) == 1 );
+ readLE (in, (uint8_t *)(i));
+}
+
+
+//------------------------------------------------- readLE -------------------
+//! \brief Reads a little-endian 16-bit int
+//!
+//! \param in The istream to read from
+//! \param i A pointer to the int storage
+//! \pre Same preconditions as istream::read
+//! \return void
+//!
+inline void readLE (std::istream & in, uint16_t * i)
+{
+ union {uint16_t i; char c[sizeof (uint16_t)];} u16;
+ in . read (u16.c, sizeof (uint16_t));
+ *i = ltoh16 (u16.i);
+}
+inline void readLE (std::istream & in, int16_t * i)
+{
+ readLE (in, (uint16_t *)(i));
+}
+
+
+//------------------------------------------------- readLE -------------------
+//! \brief Reads a little-endian 32-bit int
+//!
+//! \param in The istream to read from
+//! \param i A pointer to the int storage
+//! \pre Same preconditions as istream::read
+//! \return void
+//!
+inline void readLE (std::istream & in, uint32_t * i)
+{
+ union {uint32_t i; char c[sizeof (uint32_t)];} u32;
+ in . read (u32.c, sizeof (uint32_t));
+ *i = ltoh32 (u32.i);
+}
+inline void readLE (std::istream & in, int32_t * i)
+{
+ readLE (in, (uint32_t *)(i));
+}
+
+
+//------------------------------------------------- readLE -------------------
+//! \brief Reads a little-endian 64-bit int
+//!
+//! \param in The istream to read from
+//! \param i A pointer to the int storage
+//! \pre Same preconditions as istream::read
+//! \return void
+//!
+inline void readLE (std::istream & in, uint64_t * i)
+{
+ union {uint64_t i; char c[sizeof (uint64_t)];} u64;
+ in . read (u64.c, sizeof (uint64_t));
+ *i = ltoh64 (u64.i);
+}
+inline void readLE (std::istream & in, int64_t * i)
+{
+ readLE (in, (uint64_t *)(i));
+}
+
+} // namespace AMOS
+
+#endif // #ifndef __utility_AMOS_HH
diff --git a/src/Align/Makefile.am b/src/Align/Makefile.am
new file mode 100644
index 0000000..4d5b8f9
--- /dev/null
+++ b/src/Align/Makefile.am
@@ -0,0 +1,300 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+##-- TO BE INSTALLED
+bin_PROGRAMS = \
+ arrive \
+ arrive2 \
+ genome-complexity \
+ genome-complexity-fast \
+ count-kmers \
+ find-tandem \
+ count-qmers \
+ qmer-filter \
+ frg-umd-merge \
+ gap-links \
+ hash-overlap \
+ kmer-count \
+ kmer-cov \
+ kmer-cov-plot \
+ make-consensus \
+ make-consensus_poly \
+ merge-contigs \
+ missing-reads \
+ ovl-degr-dist \
+ overlap-align \
+ readinfo2cam \
+ running-cmp \
+ show-ma-asm \
+ sim-cover-depth \
+ sim-cover2 \
+ sim-shotgun \
+ simple-overlap \
+ verify-layout
+
+amoslib_LIBRARIES = \
+ libAlign.a \
+ libAlign_poly.a
+
+amosinclude_HEADERS = \
+ align.hh \
+ align_poly.hh \
+ matrix.hh
+
+
+##-- TO BE TESTED
+check_PROGRAMS = \
+ maligntest \
+ test-align
+
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/CelMsg \
+ -I$(top_srcdir)/src/Slice \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/Foundation
+
+
+
+##-- arrive
+arrive_SOURCES = \
+ arrive.cc
+
+##-- arrive2
+arrive2_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+arrive2_SOURCES = \
+ arrive2.cc
+
+##-- count-kmers
+count_kmers_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+count_kmers_SOURCES = \
+ count-kmers.cc
+
+##-- find-tandem
+find_tandem_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+find_tandem_SOURCES = \
+ find-tandem.cc
+
+##-- count-qmers
+count_qmers_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+count_qmers_SOURCES = \
+ count-qmers.cc
+
+##-- qmer-filter
+qmer_filter_SOURCES = \
+ qmer-filter.cc
+
+##-- frg-umd-merge
+frg_umd_merge_LDADD = \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+frg_umd_merge_SOURCES = \
+ frg-umd-merge.cc
+
+##-- gap-links
+gap_links_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+gap_links_SOURCES = \
+ gap-links.cc
+
+##-- genome-complexity
+genome_complexity_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+genome_complexity_SOURCES = \
+ genome-complexity-fast.cc
+
+##-- genome-complexity-fast
+genome_complexity_fast_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+genome_complexity_fast_SOURCES = \
+ genome-complexity-fast.cc
+
+##-- hash-overlap
+hash_overlap_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+hash_overlap_SOURCES = \
+ hash-overlap.cc \
+ hash-overlap.hh
+
+##-- kmer-count
+kmer_count_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+kmer_count_SOURCES = \
+ kmer-count.cc
+
+##-- kmer-cov
+kmer_cov_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+kmer_cov_SOURCES = \
+ kmer-cov.cc
+
+##-- kmer-cov-plot
+kmer_cov_plot_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+kmer_cov_plot_SOURCES = \
+ kmer-cov-plot.cc
+
+##-- overlap-align
+overlap_align_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+overlap_align_SOURCES = \
+ overlap-align.cc
+
+##-- make-consensus
+make_consensus_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+make_consensus_SOURCES = \
+ make-consensus.cc
+
+##-- make-consensus_poly
+make_consensus_poly_LDADD = \
+ $(top_builddir)/src/Align/libAlign_poly.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+make_consensus_poly_SOURCES = \
+ make-consensus_poly.cc
+
+##-- maligntest
+maligntest_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+maligntest_SOURCES = \
+ maligntest.cc
+
+##-- merge-contigs
+merge_contigs_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+merge_contigs_SOURCES = \
+ merge-contigs.cc
+
+##-- missing-reads
+missing_reads_SOURCES = \
+ missing-reads.cc
+
+##-- ovl-degr-dist
+ovl_degr_dist_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+ovl_degr_dist_SOURCES = \
+ ovl-degr-dist.cc
+
+##-- readinfo2cam
+readinfo2cam_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+readinfo2cam_SOURCES = \
+ readinfo2cam.cc
+
+##-- running-cmp
+running_cmp_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+running_cmp_SOURCES = \
+ running-cmp.cc
+
+##-- show-ma-asm
+show_ma_asm_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+show_ma_asm_SOURCES = \
+ show-ma-asm.cc
+
+##-- sim-cover-depth
+sim_cover_depth_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+sim_cover_depth_SOURCES = \
+ sim-cover-depth.cc
+
+##-- sim-cover2
+sim_cover2_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+sim_cover2_SOURCES = \
+ sim-cover2.cc
+
+##-- sim-shotgun
+sim_shotgun_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+sim_shotgun_SOURCES = \
+ sim-shotgun.cc
+
+##-- simple-overlap
+simple_overlap_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+simple_overlap_SOURCES = \
+ simple-overlap.cc \
+ simple-overlap.hh
+
+##-- test-align
+test_align_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+test_align_SOURCES = \
+ test-align.cc
+
+##-- verify-layout
+verify_layout_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+verify_layout_SOURCES = \
+ verify-layout.cc
+
+##-- libAlign.a
+libAlign_a_SOURCES = \
+ align.cc
+
+##-- libAlign_poly.a
+libAlign_poly_a_SOURCES = \
+ align_poly.cc
+
+##-- END OF MAKEFILE --##
diff --git a/src/Align/Makefile.in b/src/Align/Makefile.in
new file mode 100644
index 0000000..cc85c2a
--- /dev/null
+++ b/src/Align/Makefile.in
@@ -0,0 +1,1216 @@
+# 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 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@
+DIST_COMMON = $(amosinclude_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = arrive$(EXEEXT) arrive2$(EXEEXT) \
+ genome-complexity$(EXEEXT) genome-complexity-fast$(EXEEXT) \
+ count-kmers$(EXEEXT) find-tandem$(EXEEXT) count-qmers$(EXEEXT) \
+ qmer-filter$(EXEEXT) frg-umd-merge$(EXEEXT) gap-links$(EXEEXT) \
+ hash-overlap$(EXEEXT) kmer-count$(EXEEXT) kmer-cov$(EXEEXT) \
+ kmer-cov-plot$(EXEEXT) make-consensus$(EXEEXT) \
+ make-consensus_poly$(EXEEXT) merge-contigs$(EXEEXT) \
+ missing-reads$(EXEEXT) ovl-degr-dist$(EXEEXT) \
+ overlap-align$(EXEEXT) readinfo2cam$(EXEEXT) \
+ running-cmp$(EXEEXT) show-ma-asm$(EXEEXT) \
+ sim-cover-depth$(EXEEXT) sim-cover2$(EXEEXT) \
+ sim-shotgun$(EXEEXT) simple-overlap$(EXEEXT) \
+ verify-layout$(EXEEXT)
+check_PROGRAMS = maligntest$(EXEEXT) test-align$(EXEEXT)
+subdir = src/Align
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(amosincludedir)"
+LIBRARIES = $(amoslib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libAlign_a_AR = $(AR) $(ARFLAGS)
+libAlign_a_LIBADD =
+am_libAlign_a_OBJECTS = align.$(OBJEXT)
+libAlign_a_OBJECTS = $(am_libAlign_a_OBJECTS)
+libAlign_poly_a_AR = $(AR) $(ARFLAGS)
+libAlign_poly_a_LIBADD =
+am_libAlign_poly_a_OBJECTS = align_poly.$(OBJEXT)
+libAlign_poly_a_OBJECTS = $(am_libAlign_poly_a_OBJECTS)
+PROGRAMS = $(bin_PROGRAMS)
+am_arrive_OBJECTS = arrive.$(OBJEXT)
+arrive_OBJECTS = $(am_arrive_OBJECTS)
+arrive_LDADD = $(LDADD)
+am_arrive2_OBJECTS = arrive2.$(OBJEXT)
+arrive2_OBJECTS = $(am_arrive2_OBJECTS)
+arrive2_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a
+am_count_kmers_OBJECTS = count-kmers.$(OBJEXT)
+count_kmers_OBJECTS = $(am_count_kmers_OBJECTS)
+count_kmers_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+am_count_qmers_OBJECTS = count-qmers.$(OBJEXT)
+count_qmers_OBJECTS = $(am_count_qmers_OBJECTS)
+count_qmers_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+am_find_tandem_OBJECTS = find-tandem.$(OBJEXT)
+find_tandem_OBJECTS = $(am_find_tandem_OBJECTS)
+find_tandem_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+am_frg_umd_merge_OBJECTS = frg-umd-merge.$(OBJEXT)
+frg_umd_merge_OBJECTS = $(am_frg_umd_merge_OBJECTS)
+frg_umd_merge_DEPENDENCIES = $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_gap_links_OBJECTS = gap-links.$(OBJEXT)
+gap_links_OBJECTS = $(am_gap_links_OBJECTS)
+gap_links_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a
+am_genome_complexity_OBJECTS = genome-complexity-fast.$(OBJEXT)
+genome_complexity_OBJECTS = $(am_genome_complexity_OBJECTS)
+genome_complexity_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_genome_complexity_fast_OBJECTS = genome-complexity-fast.$(OBJEXT)
+genome_complexity_fast_OBJECTS = $(am_genome_complexity_fast_OBJECTS)
+genome_complexity_fast_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_hash_overlap_OBJECTS = hash-overlap.$(OBJEXT)
+hash_overlap_OBJECTS = $(am_hash_overlap_OBJECTS)
+hash_overlap_DEPENDENCIES = $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_kmer_count_OBJECTS = kmer-count.$(OBJEXT)
+kmer_count_OBJECTS = $(am_kmer_count_OBJECTS)
+kmer_count_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_kmer_cov_OBJECTS = kmer-cov.$(OBJEXT)
+kmer_cov_OBJECTS = $(am_kmer_cov_OBJECTS)
+kmer_cov_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_kmer_cov_plot_OBJECTS = kmer-cov-plot.$(OBJEXT)
+kmer_cov_plot_OBJECTS = $(am_kmer_cov_plot_OBJECTS)
+kmer_cov_plot_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_make_consensus_OBJECTS = make-consensus.$(OBJEXT)
+make_consensus_OBJECTS = $(am_make_consensus_OBJECTS)
+make_consensus_DEPENDENCIES = $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_make_consensus_poly_OBJECTS = make-consensus_poly.$(OBJEXT)
+make_consensus_poly_OBJECTS = $(am_make_consensus_poly_OBJECTS)
+make_consensus_poly_DEPENDENCIES = \
+ $(top_builddir)/src/Align/libAlign_poly.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_maligntest_OBJECTS = maligntest.$(OBJEXT)
+maligntest_OBJECTS = $(am_maligntest_OBJECTS)
+maligntest_DEPENDENCIES = $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_merge_contigs_OBJECTS = merge-contigs.$(OBJEXT)
+merge_contigs_OBJECTS = $(am_merge_contigs_OBJECTS)
+merge_contigs_DEPENDENCIES = $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_missing_reads_OBJECTS = missing-reads.$(OBJEXT)
+missing_reads_OBJECTS = $(am_missing_reads_OBJECTS)
+missing_reads_LDADD = $(LDADD)
+am_overlap_align_OBJECTS = overlap-align.$(OBJEXT)
+overlap_align_OBJECTS = $(am_overlap_align_OBJECTS)
+overlap_align_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_ovl_degr_dist_OBJECTS = ovl-degr-dist.$(OBJEXT)
+ovl_degr_dist_OBJECTS = $(am_ovl_degr_dist_OBJECTS)
+ovl_degr_dist_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a
+am_qmer_filter_OBJECTS = qmer-filter.$(OBJEXT)
+qmer_filter_OBJECTS = $(am_qmer_filter_OBJECTS)
+qmer_filter_LDADD = $(LDADD)
+am_readinfo2cam_OBJECTS = readinfo2cam.$(OBJEXT)
+readinfo2cam_OBJECTS = $(am_readinfo2cam_OBJECTS)
+readinfo2cam_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_running_cmp_OBJECTS = running-cmp.$(OBJEXT)
+running_cmp_OBJECTS = $(am_running_cmp_OBJECTS)
+running_cmp_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a
+am_show_ma_asm_OBJECTS = show-ma-asm.$(OBJEXT)
+show_ma_asm_OBJECTS = $(am_show_ma_asm_OBJECTS)
+show_ma_asm_DEPENDENCIES = $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_sim_cover_depth_OBJECTS = sim-cover-depth.$(OBJEXT)
+sim_cover_depth_OBJECTS = $(am_sim_cover_depth_OBJECTS)
+sim_cover_depth_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a
+am_sim_cover2_OBJECTS = sim-cover2.$(OBJEXT)
+sim_cover2_OBJECTS = $(am_sim_cover2_OBJECTS)
+sim_cover2_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a
+am_sim_shotgun_OBJECTS = sim-shotgun.$(OBJEXT)
+sim_shotgun_OBJECTS = $(am_sim_shotgun_OBJECTS)
+sim_shotgun_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a
+am_simple_overlap_OBJECTS = simple-overlap.$(OBJEXT)
+simple_overlap_OBJECTS = $(am_simple_overlap_OBJECTS)
+simple_overlap_DEPENDENCIES = $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_test_align_OBJECTS = test-align.$(OBJEXT)
+test_align_OBJECTS = $(am_test_align_OBJECTS)
+test_align_DEPENDENCIES = $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_verify_layout_OBJECTS = verify-layout.$(OBJEXT)
+verify_layout_OBJECTS = $(am_verify_layout_OBJECTS)
+verify_layout_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libAlign_a_SOURCES) $(libAlign_poly_a_SOURCES) \
+ $(arrive_SOURCES) $(arrive2_SOURCES) $(count_kmers_SOURCES) \
+ $(count_qmers_SOURCES) $(find_tandem_SOURCES) \
+ $(frg_umd_merge_SOURCES) $(gap_links_SOURCES) \
+ $(genome_complexity_SOURCES) $(genome_complexity_fast_SOURCES) \
+ $(hash_overlap_SOURCES) $(kmer_count_SOURCES) \
+ $(kmer_cov_SOURCES) $(kmer_cov_plot_SOURCES) \
+ $(make_consensus_SOURCES) $(make_consensus_poly_SOURCES) \
+ $(maligntest_SOURCES) $(merge_contigs_SOURCES) \
+ $(missing_reads_SOURCES) $(overlap_align_SOURCES) \
+ $(ovl_degr_dist_SOURCES) $(qmer_filter_SOURCES) \
+ $(readinfo2cam_SOURCES) $(running_cmp_SOURCES) \
+ $(show_ma_asm_SOURCES) $(sim_cover_depth_SOURCES) \
+ $(sim_cover2_SOURCES) $(sim_shotgun_SOURCES) \
+ $(simple_overlap_SOURCES) $(test_align_SOURCES) \
+ $(verify_layout_SOURCES)
+DIST_SOURCES = $(libAlign_a_SOURCES) $(libAlign_poly_a_SOURCES) \
+ $(arrive_SOURCES) $(arrive2_SOURCES) $(count_kmers_SOURCES) \
+ $(count_qmers_SOURCES) $(find_tandem_SOURCES) \
+ $(frg_umd_merge_SOURCES) $(gap_links_SOURCES) \
+ $(genome_complexity_SOURCES) $(genome_complexity_fast_SOURCES) \
+ $(hash_overlap_SOURCES) $(kmer_count_SOURCES) \
+ $(kmer_cov_SOURCES) $(kmer_cov_plot_SOURCES) \
+ $(make_consensus_SOURCES) $(make_consensus_poly_SOURCES) \
+ $(maligntest_SOURCES) $(merge_contigs_SOURCES) \
+ $(missing_reads_SOURCES) $(overlap_align_SOURCES) \
+ $(ovl_degr_dist_SOURCES) $(qmer_filter_SOURCES) \
+ $(readinfo2cam_SOURCES) $(running_cmp_SOURCES) \
+ $(show_ma_asm_SOURCES) $(sim_cover_depth_SOURCES) \
+ $(sim_cover2_SOURCES) $(sim_shotgun_SOURCES) \
+ $(simple_overlap_SOURCES) $(test_align_SOURCES) \
+ $(verify_layout_SOURCES)
+HEADERS = $(amosinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+amoslib_LIBRARIES = \
+ libAlign.a \
+ libAlign_poly.a
+
+amosinclude_HEADERS = \
+ align.hh \
+ align_poly.hh \
+ matrix.hh
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/CelMsg \
+ -I$(top_srcdir)/src/Slice \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/Foundation
+
+arrive_SOURCES = \
+ arrive.cc
+
+arrive2_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+
+arrive2_SOURCES = \
+ arrive2.cc
+
+count_kmers_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+
+count_kmers_SOURCES = \
+ count-kmers.cc
+
+find_tandem_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+
+find_tandem_SOURCES = \
+ find-tandem.cc
+
+count_qmers_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+
+count_qmers_SOURCES = \
+ count-qmers.cc
+
+qmer_filter_SOURCES = \
+ qmer-filter.cc
+
+frg_umd_merge_LDADD = \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+frg_umd_merge_SOURCES = \
+ frg-umd-merge.cc
+
+gap_links_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+
+gap_links_SOURCES = \
+ gap-links.cc
+
+genome_complexity_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+genome_complexity_SOURCES = \
+ genome-complexity-fast.cc
+
+genome_complexity_fast_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+genome_complexity_fast_SOURCES = \
+ genome-complexity-fast.cc
+
+hash_overlap_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+hash_overlap_SOURCES = \
+ hash-overlap.cc \
+ hash-overlap.hh
+
+kmer_count_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+kmer_count_SOURCES = \
+ kmer-count.cc
+
+kmer_cov_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+kmer_cov_SOURCES = \
+ kmer-cov.cc
+
+kmer_cov_plot_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+kmer_cov_plot_SOURCES = \
+ kmer-cov-plot.cc
+
+overlap_align_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+overlap_align_SOURCES = \
+ overlap-align.cc
+
+make_consensus_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+make_consensus_SOURCES = \
+ make-consensus.cc
+
+make_consensus_poly_LDADD = \
+ $(top_builddir)/src/Align/libAlign_poly.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+make_consensus_poly_SOURCES = \
+ make-consensus_poly.cc
+
+maligntest_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+maligntest_SOURCES = \
+ maligntest.cc
+
+merge_contigs_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+merge_contigs_SOURCES = \
+ merge-contigs.cc
+
+missing_reads_SOURCES = \
+ missing-reads.cc
+
+ovl_degr_dist_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+
+ovl_degr_dist_SOURCES = \
+ ovl-degr-dist.cc
+
+readinfo2cam_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+readinfo2cam_SOURCES = \
+ readinfo2cam.cc
+
+running_cmp_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+
+running_cmp_SOURCES = \
+ running-cmp.cc
+
+show_ma_asm_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+show_ma_asm_SOURCES = \
+ show-ma-asm.cc
+
+sim_cover_depth_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+
+sim_cover_depth_SOURCES = \
+ sim-cover-depth.cc
+
+sim_cover2_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+
+sim_cover2_SOURCES = \
+ sim-cover2.cc
+
+sim_shotgun_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+
+sim_shotgun_SOURCES = \
+ sim-shotgun.cc
+
+simple_overlap_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+simple_overlap_SOURCES = \
+ simple-overlap.cc \
+ simple-overlap.hh
+
+test_align_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+test_align_SOURCES = \
+ test-align.cc
+
+verify_layout_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+verify_layout_SOURCES = \
+ verify-layout.cc
+
+libAlign_a_SOURCES = \
+ align.cc
+
+libAlign_poly_a_SOURCES = \
+ align_poly.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Align/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Align/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):
+install-amoslibLIBRARIES: $(amoslib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(amoslibdir)" || $(MKDIR_P) "$(DESTDIR)$(amoslibdir)"
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(amoslibdir)'"; \
+ $(INSTALL_DATA) $$list2 "$(DESTDIR)$(amoslibdir)" || exit $$?; }
+ @$(POST_INSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ for p in $$list; do \
+ if test -f $$p; then \
+ $(am__strip_dir) \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && $(RANLIB) $$f )"; \
+ ( cd "$(DESTDIR)$(amoslibdir)" && $(RANLIB) $$f ) || exit $$?; \
+ else :; fi; \
+ done
+
+uninstall-amoslibLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && rm -f "$$files" )"; \
+ cd "$(DESTDIR)$(amoslibdir)" && rm -f $$files
+
+clean-amoslibLIBRARIES:
+ -test -z "$(amoslib_LIBRARIES)" || rm -f $(amoslib_LIBRARIES)
+libAlign.a: $(libAlign_a_OBJECTS) $(libAlign_a_DEPENDENCIES)
+ -rm -f libAlign.a
+ $(libAlign_a_AR) libAlign.a $(libAlign_a_OBJECTS) $(libAlign_a_LIBADD)
+ $(RANLIB) libAlign.a
+libAlign_poly.a: $(libAlign_poly_a_OBJECTS) $(libAlign_poly_a_DEPENDENCIES)
+ -rm -f libAlign_poly.a
+ $(libAlign_poly_a_AR) libAlign_poly.a $(libAlign_poly_a_OBJECTS) $(libAlign_poly_a_LIBADD)
+ $(RANLIB) libAlign_poly.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+clean-checkPROGRAMS:
+ -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+arrive$(EXEEXT): $(arrive_OBJECTS) $(arrive_DEPENDENCIES)
+ @rm -f arrive$(EXEEXT)
+ $(CXXLINK) $(arrive_OBJECTS) $(arrive_LDADD) $(LIBS)
+arrive2$(EXEEXT): $(arrive2_OBJECTS) $(arrive2_DEPENDENCIES)
+ @rm -f arrive2$(EXEEXT)
+ $(CXXLINK) $(arrive2_OBJECTS) $(arrive2_LDADD) $(LIBS)
+count-kmers$(EXEEXT): $(count_kmers_OBJECTS) $(count_kmers_DEPENDENCIES)
+ @rm -f count-kmers$(EXEEXT)
+ $(CXXLINK) $(count_kmers_OBJECTS) $(count_kmers_LDADD) $(LIBS)
+count-qmers$(EXEEXT): $(count_qmers_OBJECTS) $(count_qmers_DEPENDENCIES)
+ @rm -f count-qmers$(EXEEXT)
+ $(CXXLINK) $(count_qmers_OBJECTS) $(count_qmers_LDADD) $(LIBS)
+find-tandem$(EXEEXT): $(find_tandem_OBJECTS) $(find_tandem_DEPENDENCIES)
+ @rm -f find-tandem$(EXEEXT)
+ $(CXXLINK) $(find_tandem_OBJECTS) $(find_tandem_LDADD) $(LIBS)
+frg-umd-merge$(EXEEXT): $(frg_umd_merge_OBJECTS) $(frg_umd_merge_DEPENDENCIES)
+ @rm -f frg-umd-merge$(EXEEXT)
+ $(CXXLINK) $(frg_umd_merge_OBJECTS) $(frg_umd_merge_LDADD) $(LIBS)
+gap-links$(EXEEXT): $(gap_links_OBJECTS) $(gap_links_DEPENDENCIES)
+ @rm -f gap-links$(EXEEXT)
+ $(CXXLINK) $(gap_links_OBJECTS) $(gap_links_LDADD) $(LIBS)
+genome-complexity$(EXEEXT): $(genome_complexity_OBJECTS) $(genome_complexity_DEPENDENCIES)
+ @rm -f genome-complexity$(EXEEXT)
+ $(CXXLINK) $(genome_complexity_OBJECTS) $(genome_complexity_LDADD) $(LIBS)
+genome-complexity-fast$(EXEEXT): $(genome_complexity_fast_OBJECTS) $(genome_complexity_fast_DEPENDENCIES)
+ @rm -f genome-complexity-fast$(EXEEXT)
+ $(CXXLINK) $(genome_complexity_fast_OBJECTS) $(genome_complexity_fast_LDADD) $(LIBS)
+hash-overlap$(EXEEXT): $(hash_overlap_OBJECTS) $(hash_overlap_DEPENDENCIES)
+ @rm -f hash-overlap$(EXEEXT)
+ $(CXXLINK) $(hash_overlap_OBJECTS) $(hash_overlap_LDADD) $(LIBS)
+kmer-count$(EXEEXT): $(kmer_count_OBJECTS) $(kmer_count_DEPENDENCIES)
+ @rm -f kmer-count$(EXEEXT)
+ $(CXXLINK) $(kmer_count_OBJECTS) $(kmer_count_LDADD) $(LIBS)
+kmer-cov$(EXEEXT): $(kmer_cov_OBJECTS) $(kmer_cov_DEPENDENCIES)
+ @rm -f kmer-cov$(EXEEXT)
+ $(CXXLINK) $(kmer_cov_OBJECTS) $(kmer_cov_LDADD) $(LIBS)
+kmer-cov-plot$(EXEEXT): $(kmer_cov_plot_OBJECTS) $(kmer_cov_plot_DEPENDENCIES)
+ @rm -f kmer-cov-plot$(EXEEXT)
+ $(CXXLINK) $(kmer_cov_plot_OBJECTS) $(kmer_cov_plot_LDADD) $(LIBS)
+make-consensus$(EXEEXT): $(make_consensus_OBJECTS) $(make_consensus_DEPENDENCIES)
+ @rm -f make-consensus$(EXEEXT)
+ $(CXXLINK) $(make_consensus_OBJECTS) $(make_consensus_LDADD) $(LIBS)
+make-consensus_poly$(EXEEXT): $(make_consensus_poly_OBJECTS) $(make_consensus_poly_DEPENDENCIES)
+ @rm -f make-consensus_poly$(EXEEXT)
+ $(CXXLINK) $(make_consensus_poly_OBJECTS) $(make_consensus_poly_LDADD) $(LIBS)
+maligntest$(EXEEXT): $(maligntest_OBJECTS) $(maligntest_DEPENDENCIES)
+ @rm -f maligntest$(EXEEXT)
+ $(CXXLINK) $(maligntest_OBJECTS) $(maligntest_LDADD) $(LIBS)
+merge-contigs$(EXEEXT): $(merge_contigs_OBJECTS) $(merge_contigs_DEPENDENCIES)
+ @rm -f merge-contigs$(EXEEXT)
+ $(CXXLINK) $(merge_contigs_OBJECTS) $(merge_contigs_LDADD) $(LIBS)
+missing-reads$(EXEEXT): $(missing_reads_OBJECTS) $(missing_reads_DEPENDENCIES)
+ @rm -f missing-reads$(EXEEXT)
+ $(CXXLINK) $(missing_reads_OBJECTS) $(missing_reads_LDADD) $(LIBS)
+overlap-align$(EXEEXT): $(overlap_align_OBJECTS) $(overlap_align_DEPENDENCIES)
+ @rm -f overlap-align$(EXEEXT)
+ $(CXXLINK) $(overlap_align_OBJECTS) $(overlap_align_LDADD) $(LIBS)
+ovl-degr-dist$(EXEEXT): $(ovl_degr_dist_OBJECTS) $(ovl_degr_dist_DEPENDENCIES)
+ @rm -f ovl-degr-dist$(EXEEXT)
+ $(CXXLINK) $(ovl_degr_dist_OBJECTS) $(ovl_degr_dist_LDADD) $(LIBS)
+qmer-filter$(EXEEXT): $(qmer_filter_OBJECTS) $(qmer_filter_DEPENDENCIES)
+ @rm -f qmer-filter$(EXEEXT)
+ $(CXXLINK) $(qmer_filter_OBJECTS) $(qmer_filter_LDADD) $(LIBS)
+readinfo2cam$(EXEEXT): $(readinfo2cam_OBJECTS) $(readinfo2cam_DEPENDENCIES)
+ @rm -f readinfo2cam$(EXEEXT)
+ $(CXXLINK) $(readinfo2cam_OBJECTS) $(readinfo2cam_LDADD) $(LIBS)
+running-cmp$(EXEEXT): $(running_cmp_OBJECTS) $(running_cmp_DEPENDENCIES)
+ @rm -f running-cmp$(EXEEXT)
+ $(CXXLINK) $(running_cmp_OBJECTS) $(running_cmp_LDADD) $(LIBS)
+show-ma-asm$(EXEEXT): $(show_ma_asm_OBJECTS) $(show_ma_asm_DEPENDENCIES)
+ @rm -f show-ma-asm$(EXEEXT)
+ $(CXXLINK) $(show_ma_asm_OBJECTS) $(show_ma_asm_LDADD) $(LIBS)
+sim-cover-depth$(EXEEXT): $(sim_cover_depth_OBJECTS) $(sim_cover_depth_DEPENDENCIES)
+ @rm -f sim-cover-depth$(EXEEXT)
+ $(CXXLINK) $(sim_cover_depth_OBJECTS) $(sim_cover_depth_LDADD) $(LIBS)
+sim-cover2$(EXEEXT): $(sim_cover2_OBJECTS) $(sim_cover2_DEPENDENCIES)
+ @rm -f sim-cover2$(EXEEXT)
+ $(CXXLINK) $(sim_cover2_OBJECTS) $(sim_cover2_LDADD) $(LIBS)
+sim-shotgun$(EXEEXT): $(sim_shotgun_OBJECTS) $(sim_shotgun_DEPENDENCIES)
+ @rm -f sim-shotgun$(EXEEXT)
+ $(CXXLINK) $(sim_shotgun_OBJECTS) $(sim_shotgun_LDADD) $(LIBS)
+simple-overlap$(EXEEXT): $(simple_overlap_OBJECTS) $(simple_overlap_DEPENDENCIES)
+ @rm -f simple-overlap$(EXEEXT)
+ $(CXXLINK) $(simple_overlap_OBJECTS) $(simple_overlap_LDADD) $(LIBS)
+test-align$(EXEEXT): $(test_align_OBJECTS) $(test_align_DEPENDENCIES)
+ @rm -f test-align$(EXEEXT)
+ $(CXXLINK) $(test_align_OBJECTS) $(test_align_LDADD) $(LIBS)
+verify-layout$(EXEEXT): $(verify_layout_OBJECTS) $(verify_layout_DEPENDENCIES)
+ @rm -f verify-layout$(EXEEXT)
+ $(CXXLINK) $(verify_layout_OBJECTS) $(verify_layout_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/align.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/align_poly.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/arrive.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/arrive2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/count-kmers.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/count-qmers.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/find-tandem.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/frg-umd-merge.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gap-links.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genome-complexity-fast.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hash-overlap.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmer-count.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmer-cov-plot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmer-cov.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/make-consensus.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/make-consensus_poly.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/maligntest.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/merge-contigs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/missing-reads.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/overlap-align.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ovl-degr-dist.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qmer-filter.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/readinfo2cam.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/running-cmp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/show-ma-asm.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sim-cover-depth.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sim-cover2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sim-shotgun.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simple-overlap.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test-align.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/verify-layout.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+install-amosincludeHEADERS: $(amosinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(amosincludedir)" || $(MKDIR_P) "$(DESTDIR)$(amosincludedir)"
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(amosincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(amosincludedir)" || exit $$?; \
+ done
+
+uninstall-amosincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amosincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(amosincludedir)" && rm -f $$files
+
+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
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(amosincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-amoslibLIBRARIES clean-binPROGRAMS clean-checkPROGRAMS \
+ clean-generic 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-amosincludeHEADERS install-amoslibLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-amosincludeHEADERS uninstall-amoslibLIBRARIES \
+ uninstall-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: check-am install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-amoslibLIBRARIES clean-binPROGRAMS clean-checkPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am \
+ install-amosincludeHEADERS install-amoslibLIBRARIES \
+ install-binPROGRAMS 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-compile mostlyclean-generic pdf pdf-am \
+ ps ps-am tags uninstall uninstall-am \
+ uninstall-amosincludeHEADERS uninstall-amoslibLIBRARIES \
+ uninstall-binPROGRAMS uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Align/align.cc b/src/Align/align.cc
new file mode 100644
index 0000000..2cd18db
--- /dev/null
+++ b/src/Align/align.cc
@@ -0,0 +1,7169 @@
+//
+// File: align.cc
+//
+// Last Modified: 25 November 2002
+//
+// Routines to do string alignments
+
+
+#include "align.hh"
+#include <stack>
+#include <cassert>
+using namespace AMOS;
+using namespace std;
+
+
+// ### Align_Score_Entry_t methods ###
+
+
+void Align_Score_Entry_t :: Dump
+ (FILE * fp) const
+
+// Print to fp the contents of this score entry.
+
+ {
+ fprintf (fp, "L = %d:%u D = %d:%u T = %d:%u\n",
+ left_score, left_from, diag_score, diag_from,
+ top_score, top_from);
+
+ return;
+ }
+
+
+
+void Align_Score_Entry_t :: Get_Max
+ (int & max_score, unsigned int & max_from) const
+
+// Set max_score to the highest score in this entry
+// and max_from to the sub_entry it came from.
+
+ {
+ if (left_score <= diag_score)
+ {
+ max_score = diag_score;
+ max_from = FROM_DIAG;
+ }
+ else
+ {
+ max_score = left_score;
+ max_from = FROM_LEFT;
+ }
+
+ if (max_score < top_score)
+ {
+ max_score = top_score;
+ max_from = FROM_TOP;
+ }
+
+ return;
+ }
+
+
+
+void Align_Score_Entry_t :: Get_Max_Left
+ (int & max_score, unsigned int & max_from, int penalty) const
+
+// Set max_score to the highest score in this entry
+// and max_from to the sub_entry it came from, where penalty
+// is added to max_score if max_from is not FROM_LEFT .
+
+ {
+ if (top_score <= diag_score)
+ {
+ max_score = diag_score;
+ max_from = FROM_DIAG;
+ }
+ else
+ {
+ max_score = top_score;
+ max_from = FROM_TOP;
+ }
+ max_score += penalty;
+
+ if (max_score <= left_score)
+ {
+ max_score = left_score;
+ max_from = FROM_LEFT;
+ }
+
+ return;
+ }
+
+
+
+void Align_Score_Entry_t :: Get_Max_Top
+ (int & max_score, unsigned int & max_from, int penalty) const
+
+// Set max_score to the highest score in this entry
+// and max_from to the sub_entry it came from, where penalty
+// is added to max_score if max_from is not FROM_TOP .
+
+ {
+ if (left_score <= diag_score)
+ {
+ max_score = diag_score;
+ max_from = FROM_DIAG;
+ }
+ else
+ {
+ max_score = left_score;
+ max_from = FROM_LEFT;
+ }
+ max_score += penalty;
+
+ if (max_score < top_score)
+ {
+ max_score = top_score;
+ max_from = FROM_TOP;
+ }
+
+ return;
+ }
+
+
+
+void Augmented_Score_Entry_t :: Dump
+ (FILE * fp) const
+
+// Print to fp the contents of this score entry.
+
+ {
+ Align_Score_Entry_t :: Dump (fp);
+ fprintf (fp, "Refs: %d %d %d\n", left_ref, diag_ref, top_ref);
+
+ return;
+ }
+
+
+
+int Augmented_Score_Entry_t :: Get_Ref
+ (unsigned int & from) const
+
+// Return the ref entry corresponding to from .
+
+ {
+ switch (from)
+ {
+ case FROM_TOP :
+ return top_ref;
+ case FROM_DIAG :
+ return diag_ref;
+ case FROM_LEFT :
+ return left_ref;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad from value = %d in Get_Ref\n",
+ from);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ return -1;
+ }
+
+
+
+void Errors_Score_Entry_t :: Dump
+ (FILE * fp) const
+
+// Print to fp the contents of this score entry.
+
+ {
+ Augmented_Score_Entry_t :: Dump (fp);
+ fprintf (fp, "Errors: %d %d %d\n", left_errors, diag_errors, top_errors);
+
+ return;
+ }
+
+
+
+int Errors_Score_Entry_t :: Get_Errors
+ (unsigned int & from) const
+
+// Return the ref entry corresponding to from .
+
+ {
+ switch (from)
+ {
+ case FROM_TOP :
+ return top_errors;
+ case FROM_DIAG :
+ return diag_errors;
+ case FROM_LEFT :
+ return left_errors;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad from value = %d in Get_Errors\n",
+ from);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ return -1;
+ }
+
+
+
+
+// ### Distinguishing_Column_t methods ###
+
+
+bool Distinguishing_Column_t :: Intersects
+ (const Distinguishing_Column_t & d, Phase_Entry_t & p,
+ int & min)
+
+// See if any of the subscripts in this column match
+// those in d . If not, return false . Otherwise, return
+// true and set the counts in p for how many match a/a and b/b,
+// and how many match a/b and b/a. Set min to the smaller
+// number of component matches in the larger of same_ct and
+// opposite_ct .
+
+ {
+ int aa, ab, ba, bb;
+
+ aa = Match_Count (hapa_sub, d . hapa_sub);
+ bb = Match_Count (hapb_sub, d . hapb_sub);
+
+ ab = Match_Count (hapa_sub, d . hapb_sub);
+ ba = Match_Count (hapb_sub, d . hapa_sub);
+
+ p . same_ct = aa + bb;
+ p . opposite_ct = ab + ba;
+
+ if (p . same_ct >= p . opposite_ct)
+ min = Min (aa, bb);
+ else
+ min = Min (ab, ba);
+
+ return (p . same_ct > 0 || p . opposite_ct > 0);
+ }
+
+
+
+
+// ### Vote_t methods ###
+
+
+void Vote_t :: Incr_After
+ (char ch, int incr_val)
+
+// Add incr_val to the after count in this Vote_t for ch .
+
+ {
+ const char * p;
+
+ p = strchr (ALPHABET, tolower (ch));
+ if (p == NULL)
+ {
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad character %c (ASCII %d)\n",
+ ch, ch);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ after [p - ALPHABET] += incr_val;
+
+ return;
+ }
+
+
+
+void Vote_t :: Incr_Blank
+ (int incr_val)
+
+// Add incr_val to the blank entry in the here counts of this Vote_t .
+
+ {
+ here [ALPHABET_SIZE] += incr_val;
+
+ return;
+ }
+
+
+
+void Vote_t :: Incr_By
+ (char ch, bool with_blank, int incr_val)
+
+// Add incr_val to the here count in this Vote_t for ch .
+// If with_blank is true then also add incr_val to the after
+// count for a blank.
+
+ {
+ const char * p;
+
+ p = strchr (ALPHABET, tolower (ch));
+ if (p == NULL)
+ {
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad character %c (ASCII %d)\n",
+ ch, ch);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ here [p - ALPHABET] += incr_val;
+ if (with_blank)
+ after [ALPHABET_SIZE] += incr_val;
+
+ return;
+ }
+
+
+
+char Vote_t :: Max_After_Char
+ (void)
+
+// Return the character corresponding to the maximum count
+// in here . If all zeroes, return a blank.
+
+ {
+ int i, max;
+
+ max = 0;
+ for (i = 1; i <= ALPHABET_SIZE; i ++)
+ if (after [max] < after [i])
+ max = i;
+
+ if (after [max] == 0 || max == ALPHABET_SIZE)
+ return ' ';
+ else
+ return ALPHABET [max];
+ }
+
+
+
+char Vote_t :: Max_Here_Char
+ (void)
+
+// Return the character corresponding to the maximum count
+// in after . If all zeroes, return a blank.
+
+ {
+ int i, max;
+
+ max = 0;
+ for (i = 1; i <= ALPHABET_SIZE; i ++)
+ if (here [max] < here [i])
+ max = i;
+
+ if (here [max] == 0 || max == ALPHABET_SIZE)
+ return ' ';
+ else
+ return ALPHABET [max];
+ }
+
+
+
+void Vote_t :: Set_To
+ (char ch, bool with_blank)
+
+// Make the counts in this Vote_t all zero except set the
+// here count for ch to 1 . If with_blank is true then
+// also set the after count for a blank to 1 .
+
+ {
+ int i;
+ const char * p;
+
+ for (i = 0; i <= ALPHABET_SIZE; i ++)
+ here [i] = after [i] = 0;
+
+ p = strchr (ALPHABET, tolower (ch));
+ if (p == NULL)
+ {
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad character %c (ASCII %d)\n",
+ ch, ch);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ here [p - ALPHABET] = 1;
+ if (with_blank)
+ after [ALPHABET_SIZE] = 1;
+
+ return;
+ }
+
+
+
+void Vote_t :: Set_Zero
+ (void)
+
+// Make the counts in this Vote_t all zero.
+
+ {
+ int i;
+
+ for (i = 0; i <= ALPHABET_SIZE; i ++)
+ here [i] = after [i] = 0;
+
+ return;
+ }
+
+
+
+
+// ### Base_Alignment_t methods ###
+
+
+void Base_Alignment_t :: Dump
+ (FILE * fp) const
+
+// Print to fp the contents of this base alignent.
+
+ {
+ fprintf (fp, "### a_lo/hi = %d/%d b_lo/hi = %d/%d errors = %d string_sub = %d\n",
+ a_lo, a_hi, b_lo, b_hi, errors, string_sub);
+
+ return;
+ }
+
+
+
+double Base_Alignment_t :: Error_Rate
+ (void) const
+
+// Return the number of errors divided by the average
+// length of this alignment.
+
+ {
+ double len;
+
+ len = (a_hi - a_lo + b_hi - b_lo) / 2.0;
+ if (len == 0)
+ return 0.0;
+ else
+ return errors / len;
+ }
+
+
+
+void Base_Alignment_t :: Flip_AB
+ (void)
+
+// Switch the roles of a and b . No change to errors , string_sub,
+// flipped or a_len .
+
+ {
+ Swap (a_lo, b_lo);
+ Swap (a_hi, b_hi);
+ }
+
+
+
+bool Base_Alignment_t :: Is_Empty
+ (void) const
+
+ // Return true iff a_lo/hi and b_lo/hi are all 0
+
+{
+ return (a_lo == 0 && a_hi == 0 && b_lo == 0 && b_hi == 0);
+}
+
+
+
+
+// ### Alignment_t methods ###
+
+
+int Alignment_t :: B_Position
+ (int a) const
+
+// Return the postion in the b string that corresponds to
+// position a in the a string. Must have a_lo <= a < a_hi .
+// In case of insertions in the a string, return the lowest
+// position in the b string that corresponds.
+
+ {
+ int d, i, j, n;
+
+ i = a_lo;
+ j = b_lo;
+ n = delta . size ();
+
+ for (d = 0; d < n; d ++)
+ {
+ int extent;
+
+ extent = abs (delta [d]) - 1;
+ if (a - i <= extent)
+ return j + a - i;
+ i += extent;
+ j += extent;
+ if (delta [d] < 0)
+ i ++;
+ else
+ j ++;
+ }
+
+ return j + a - i;
+ }
+
+
+
+void Alignment_t :: Clear
+ (void)
+
+// Make this alignment empty.
+
+ {
+ a_lo = a_hi = b_lo = b_hi = errors = 0;
+ delta . clear ();
+
+ return;
+ }
+
+
+
+void Alignment_t :: Combine
+ (const Alignment_t & a1, const Alignment_t & a2)
+
+// Concatenate alignments a1 and a2 into this single alignment.
+
+ {
+ int a_used, b_used, extent;
+ int a_left, b_left;
+ int i, n;
+
+ if (Verbose > 3)
+ {
+ cerr << "Combine:" << endl;
+ a1 . Dump (stderr);
+ a2 . Dump (stderr);
+ }
+
+ assert (a1 . a_hi == a2 . a_lo);
+ assert (a1 . b_hi == a2 . b_lo);
+
+ delta = a1 . delta;
+ a_lo = a1 . a_lo;
+ a_hi = a2 . a_hi;
+ b_lo = a1 . b_lo;
+ b_hi = a2 . b_hi;
+ errors = a1 . errors + a2 . errors;
+ string_sub = a1 . string_sub;
+ flipped = a1 . flipped;
+ a_len = a1 . a_len;
+
+ if (a2 . delta . size () == 0)
+ return;
+
+ // Compute the number of characters in the a and b strings
+ // accounted for by the delta values in a1 .
+ n = a1 . delta . size ();
+ a_used = b_used = 0;
+ for (i = 0; i < n; i ++)
+ {
+ extent = abs (a1 . delta [i]) - 1;
+ a_used += extent;
+ b_used += extent;
+ if (delta [i] < 0)
+ a_used ++;
+ else
+ b_used ++;
+ }
+
+ a_left = a1 . a_hi - a1 . a_lo - a_used;
+ b_left = a1 . b_hi - a1 . b_lo - b_used;
+ assert (a_left == b_left);
+
+ if (a2 . delta [0] < 0)
+ delta . push_back (a2 . delta [0] - a_left);
+ else
+ delta . push_back (a2 . delta [0] + a_left);
+
+ n = a2 . delta . size ();
+ for (i = 1; i < n; i ++)
+ delta . push_back (a2 . delta [i]);
+
+ return;
+ }
+
+
+
+void Alignment_t :: Dump
+ (FILE * fp) const
+
+// Print to fp the entries of this alignment.
+
+ {
+ Base_Alignment_t :: Dump (fp);
+ fprintf (fp, "Delta:\n");
+ Dump_Delta (fp);
+
+ return;
+ }
+
+
+
+void Alignment_t :: Dump_Delta
+ (FILE * fp) const
+
+// Print to fp the delta entries of this alignment.
+
+ {
+ int i, n;
+
+ n = delta . size ();
+ for (i = 0; i < n; i ++)
+ fprintf (fp, " %3d: %5d\n", i, delta [i]);
+
+ return;
+ }
+
+
+
+void Alignment_t :: Check_Fix_Start
+ (const char * s , int s_len, const char * t, int t_len,
+ Fix_Status_t & status)
+
+// Check for errors/indels at the start of this alignment.
+// If there aren't any, set status to NO_FIX_NEEDED and return.
+// If there are gaps in s then shift the alignment to the
+// right and set status to SHIFTED_RIGHT . If there are
+// gaps in t or suspiciously many errors, then set status to
+// NEEDS_LEFT_SHIFT .
+// The alignment aligns s as the a-string to t as the b-string.
+
+ {
+ int i, j, n, shift, indels, matches;
+
+ n = delta . size ();
+
+ // if there are no indels or there isn't one at the beginning
+ // of the alignment, there's nothing to do
+ // This is oversimplified. There may be a match for the first
+ // character or two, but then too many indels, which would
+ // indicate a shift is needed
+
+ if (n == 0 || abs (delta [0]) > 1)
+ {
+ status = NO_FIX_NEEDED;
+ return;
+ }
+
+ if (delta [0] == 1)
+ { // shift the alignment to the right;
+
+ for (j = 1; j < n && delta [j] == 1; j ++)
+ ;
+ // There are j consecutive 1 's at the start.
+ // Just remove them and shift the alignment j positions
+ // to the right
+
+ shift = j;
+ for (i = 0; j < n; i++, j++)
+ delta [i] = delta [j];
+ delta . resize (n - shift);
+ b_lo += shift;
+ if (shift <= errors)
+ errors -= shift; // errors is generally not used and set to zero
+
+ status = SHIFTED_RIGHT;
+ return;
+ }
+
+ if (delta [0] == -1)
+ { // first count how many -1's are at the start
+ for (j = 1; j < n && delta [j] == -1; j ++)
+ ;
+ if (j <= b_lo)
+ { // count the number of matches
+ indels = j;
+ i = b_lo - indels;
+ matches = 0;
+ for (j = 0; j < indels; j ++)
+ if (s [a_lo + j] == t [i + j])
+ matches ++;
+
+ if (indels - 1 <= matches)
+ { // all but one character matches so can just shift the start
+ shift = j = indels;
+ for (i = 0; j < n; i ++, j ++)
+ delta [i] = delta [j];
+ delta . resize (n - shift);
+ b_lo -= shift;
+ if (indels - matches <= errors)
+ errors -= indels - matches;
+ // errors is generally not used and set to zero
+
+ status = SHIFTED_LEFT;
+ return;
+ }
+ }
+ status = NEEDS_LEFT_SHIFT;
+ // needs a more complicated shift
+ return;
+ }
+
+ return;
+ }
+
+
+
+void Alignment_t :: Flip_AB
+ (void)
+
+// Switch the roles of a and b in this alignment.
+
+ {
+ int i, n;
+
+ Base_Alignment_t :: Flip_AB ();
+
+ n = delta . size ();
+ for (i = 0; i < n; i ++)
+ delta [i] *= -1;
+
+ return;
+ }
+
+
+
+void Alignment_t :: Incr_Votes
+ (vector <Vote_t> & vote, char * a, int incr_val)
+
+// Use the entries in the alignment to increment the entries in vote
+// that correspond to the b string in the alignment.
+// Vote values are from the string a . Value to increment by
+// is incr_val .
+
+ {
+ int d, i, j, k, n;
+
+
+ i = a_lo;
+ j = b_lo;
+ n = delta . size ();
+
+ // First do the entries in the delta encoding
+ for (d = 0; d < n; d ++)
+ {
+ int extent;
+
+ if (Verbose > 3)
+ fprintf (stderr, "d = %d delta = %d\n", d, delta [d]);
+
+ extent = abs (delta [d]) - 1;
+
+ for (k = 0; k < extent; k ++)
+ {
+ vote [j] . Incr_By (a [i], (k < extent - 1), incr_val);
+ i ++;
+ j ++;
+ }
+
+ if (delta [d] < 0)
+ {
+ if (extent > 0)
+ vote [j - 1] . Incr_After (a [i], incr_val);
+ i ++;
+ }
+ else
+ {
+ vote [j] . Incr_Blank (incr_val);
+ j ++;
+ }
+ }
+
+ if (Verbose > 3)
+ {
+ fprintf (stderr, "i = %d a_hi = %d j = %d b_hi = %d\n",
+ i, a_hi, j, b_hi);
+ }
+
+ // Now finish off what's left
+ while (i < a_hi && j < b_hi)
+ {
+ vote [j] . Incr_By (a [i], (j < b_hi - 1), incr_val);
+ i ++;
+ j ++;
+ }
+
+ if (i != a_hi)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Bad alignment end i = %d a_hi = %d", i, a_hi);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ if (j != b_hi)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Bad alignment end j = %d b_hi = %d", j, b_hi);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ return;
+ }
+
+
+
+void Alignment_t :: Offset_A
+ (int n)
+
+// Add n to the a_lo and a_hi positions of this alignment.
+
+ {
+ a_lo += n;
+ a_hi += n;
+
+ return;
+ }
+
+
+
+void Alignment_t :: Print
+ (FILE * fp, const char * a, const char * b, int width)
+
+// Show this alignment between strings a and b
+// showing just the alignment portion of the two strings,
+// with index positions in the right-hand margin.
+// Use width characters per line for alignment.
+// Output goes to fp .
+
+ {
+ string s (width, ' '), t (width, ' ');
+ int a_begin, b_begin;
+ int d, i, j, k, n, q;
+
+
+ i = a_lo;
+ j = b_lo;
+ a_begin = a_lo;
+ b_begin = b_lo;
+ q = 0;
+ n = delta . size ();
+
+ // First do the entries in the delta encoding
+ for (d = 0; d < n; d ++)
+ {
+ int extent;
+
+ if (Verbose > 3)
+ fprintf (stderr, "d = %d delta = %d\n", d, delta [d]);
+
+ extent = abs (delta [d]) - 1;
+
+ for (k = 0; k < extent; k ++)
+ {
+ s [q] = a [i ++];
+ t [q ++] = b [j ++];
+ if (q == width)
+ {
+ Print_Align_Lines_Pair
+ (fp, s, t, q, "a:", "b:", a_begin, i, b_begin, j);
+ a_begin = i;
+ b_begin = j;
+ q = 0;
+ }
+ }
+
+ if (delta [d] < 0)
+ {
+ s [q] = a [i ++];
+ t [q ++] = '-';
+ if (q == width)
+ {
+ Print_Align_Lines_Pair
+ (fp, s, t, q, "a:", "b:", a_begin, i, b_begin, j);
+ a_begin = i;
+ b_begin = j;
+ q = 0;
+ }
+ }
+ else
+ {
+ s [q] = '-';
+ t [q ++] = b [j ++];
+ if (q == width)
+ {
+ Print_Align_Lines_Pair
+ (fp, s, t, q, "a:", "b:", a_begin, i, b_begin, j);
+ a_begin = i;
+ b_begin = j;
+ q = 0;
+ }
+ }
+ }
+
+ if (Verbose > 1)
+ {
+ fprintf (stderr, "i = %d a_hi = %d j = %d b_hi = %d\n",
+ i, a_hi, j, b_hi);
+ }
+
+ // Now finish off what's left
+ while (i < a_hi && j < b_hi)
+ {
+ s [q] = a [i ++];
+ t [q ++] = b [j ++];
+ if (q == width)
+ {
+ Print_Align_Lines_Pair
+ (fp, s, t, q, "a:", "b:", a_begin, i, b_begin, j);
+ a_begin = i;
+ b_begin = j;
+ q = 0;
+ }
+ }
+
+ if (q > 0)
+ Print_Align_Lines_Pair
+ (fp, s, t, q, "a:", "b:", a_begin, i, b_begin, j);
+
+ if (i != a_hi)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Bad alignment end i = %d a_hi = %d", i, a_hi);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ if (j != b_hi)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Bad alignment end j = %d b_hi = %d", j, b_hi);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ return;
+ }
+
+
+
+void Alignment_t :: Set_Empty_A
+ (int a_start, int b_start, int b_end)
+
+// Make this an alignment with an empty a string at position
+// a_start against the portion of b string between b_start
+// and b_end .
+
+ {
+ int i;
+
+ a_lo = a_hi = a_start;
+ b_lo = b_start;
+ b_hi = b_end;
+ errors = b_hi - b_lo;
+ delta . clear ();
+ for (i = b_lo; i < b_hi; i ++)
+ delta . push_back (1);
+
+ return;
+ }
+
+
+
+void Alignment_t :: Set_Exact
+ (int a_start, int b_start, int len)
+
+// Make this alignment represent an exact match starting
+// at a_start in string a and b_start in string b and
+// extending for length len .
+
+ {
+ a_lo = a_start;
+ a_hi = a_start + len;
+ b_lo = b_start;
+ b_hi = b_start + len;
+ errors = 0;
+ delta . clear ();
+
+ return;
+ }
+
+
+
+void Alignment_t :: Set_From_VS_Matrix
+ (Match_Extent_Entry_t * * t, int e, int j)
+
+// Make this alignment represent the match in t starting
+// at entry t [e] [j] and working back to t [0] [0] .
+// t is the matrix of the Vishkin-Schieber algorithm in which
+// t [e] [j] is the most positions of string a
+// that can be matched with e errors and ending aligned at
+// offset j in string b .
+
+ {
+ stack <int> s;
+ int end_match;
+
+ a_lo = 0;
+ a_hi = t [e] [j] . len;
+ b_hi = a_hi + j;
+ errors = e;
+
+ delta . clear ();
+
+ // First get the reverse encoding (i.e., reading strings a and b
+ // from right to left) and push it onto a stack
+
+ end_match = t [e] [j] . len;
+ for ( ; e > 0; e --)
+ switch (t [e] [j] . from)
+ {
+ case MATCH_FROM_TOP : // no delta entry needed because
+ // no shift in diagonal
+ break;
+
+ case MATCH_FROM_NW :
+ j --; // extra character in string b
+ s . push (1 + (end_match - t [e - 1] [j] . len));
+ end_match = t [e - 1] [j] . len;
+ break;
+
+ case MATCH_FROM_NE :
+ j ++; // extra character in string a
+ s . push (- (end_match - t [e - 1] [j] . len));
+ end_match = t [e - 1] [j] . len;
+ break;
+
+ default :
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad switch value from = %d\n",
+ t [e] [j] . from);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ b_lo = a_lo + j;
+
+ // Now convert reverse encoding to forward encoding by popping
+ // values off the stack
+
+ end_match ++;
+ while (! s . empty ())
+ {
+ int k;
+
+ k = s . top ();
+ if (Verbose > 1)
+ fprintf (stderr, "stack top = %d end_match = %d\n", k, end_match);
+ s . pop ();
+ if (k < 0)
+ delta . push_back (- end_match);
+ else
+ delta . push_back (+ end_match);
+
+ end_match = abs (k);
+ }
+
+ return;
+ }
+
+
+
+void Alignment_t :: Set_Inserts
+ (vector <short> & v) const
+
+// Make sure the values in v are large enough to hold the number
+// of inserts specified in this alignment.
+
+ {
+ int ct;
+ int d, j, n;
+
+ j = b_lo;
+ n = delta . size ();
+ ct = 0;
+
+ for (d = 0; d < n; d ++)
+ {
+ j += abs (delta [d]) - 1;
+
+ if (delta [d] != -1)
+ ct = 0;
+ if (delta [d] < 0)
+ {
+ ct ++;
+ if (ct > v [j])
+ v [j] = ct;
+ }
+ else
+ j ++;
+ }
+
+ return;
+ }
+
+
+
+void Alignment_t :: Set_To_Identity
+ (int len)
+
+// Set this alignment to represent an identity between
+// two strings of length len .
+
+ {
+ a_lo = b_lo = 0;
+ a_hi = b_hi = len;
+ errors = 0;
+ a_len = len;
+
+ delta . clear ();
+
+ return;
+ }
+
+
+
+void Alignment_t :: Shift_First_Delta
+ (int offset)
+
+// Adjust the first delta value (if any) in this alignment
+// by offset .
+
+ {
+ if (delta . size () > 0)
+ {
+ if (delta [0] > 0)
+ delta [0] += offset;
+ else
+ delta [0] -= offset;
+ }
+
+ return;
+ }
+
+
+
+
+// ### Gapped_Alignment_t methods ###
+
+
+void Gapped_Alignment_t :: Clear
+ (void)
+
+// Make this alignment empty.
+
+ {
+ a_lo = a_hi = b_lo = b_hi = errors = 0;
+ skip . clear ();
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Convert_From
+ (const Alignment_t & ali, vector <int> & tr)
+
+// Convert the alignment in ali (which represents
+// indels w.r.t. an ungapped sequence) to one
+// representing positions w.r.t. a consensus
+// with gaps inserted. Thus the delta will be
+// a sequence of positive numbers indicating
+// the positions in the b string that have no
+// match to the a string.
+// tr is a translation vector that maps the ungapped
+// positions in the b string to the positions after
+// gaps are inserted.
+
+ {
+ int ct;
+ int d, i, j, k, n, p, q, r;
+
+ i = a_lo = ali . a_lo;
+ j = ali . b_lo;
+ a_hi = ali . a_hi;
+ p = b_lo = tr [ali . b_lo];
+ errors = ali . errors;
+ flipped = ali . flipped;
+ a_len = ali . a_len;
+
+ skip . clear ();
+
+ n = ali . delta . size ();
+ ct = 0;
+
+ if (Verbose > 2)
+ {
+ int i;
+
+ fprintf (stderr, "Convert_From: a_lo = %d a_hi = %d\n", a_lo, a_hi);
+ fprintf (stderr, " Delta:\n");
+ for (i = 0; i < n; i ++)
+ fprintf (stderr, " %3d: %5d\n", i, ali . delta [i]);
+ for (i = ali . b_lo; i < ali . b_hi; i ++)
+ fprintf (stderr, " tr [%3d] = %5hd\n", i, tr [i]);
+ }
+
+ // adjust b_lo if alignment begins with insertions
+ for (d = 0; d < n && ali . delta [d] == -1; d ++)
+ {
+ i ++;
+ b_lo --;
+ }
+ if (b_lo < 0)
+//##ALD if (d > 0 && (j == 0 || tr [j] - d <= tr [j - 1]))
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Convert_From had too many initial inserts\n"
+ " d = %d j = %d tr [j] = %d tr [j - 1] = %d\n",
+ d, j, tr [j], j > 0 ? tr [j - 1] : 0);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ for ( ; d < n; d ++)
+ {
+ k = abs (ali . delta [d]) - 1;
+ for (q = 0; q < k; q ++)
+ {
+ if (j > ali . b_lo)
+ for (r = tr [j - 1] + 1 + ct; r < tr [j]; r ++)
+ {
+ skip . push_back (p);
+ p ++;
+ }
+ i ++;
+ j ++;
+ p ++;
+ ct = 0;
+ }
+
+ if (ali . delta [d] != -1)
+ ct = 0;
+ if (ali . delta [d] < 0)
+ {
+ ct ++;
+ i ++;
+ p ++;
+ }
+ else
+ {
+ for (q = tr [j - 1]; q < tr [j]; q ++)
+ {
+ skip . push_back (p);
+ p ++;
+ }
+ j ++;
+ }
+ }
+
+ // Now finish off the remaining indel-free tail
+ while (i < a_hi && j < ali . b_hi)
+ {
+ if (j > ali . b_lo)
+ for (q = tr [j - 1] + 1 + ct; q < tr [j]; q ++)
+ {
+ skip . push_back (p);
+ p ++;
+ }
+ i ++;
+ j ++;
+ p ++;
+ ct = 0;
+ }
+
+ b_hi = p;
+
+ if (Verbose > 2)
+ {
+ fprintf (stderr, "Convert_From: a_lo = %d a_hi = %d\n", a_lo, a_hi);
+ fprintf (stderr, " b_lo = %d b_hi = %d\n", b_lo, b_hi);
+ fprintf (stderr, " Skip:\n");
+ Dump_Skip (stderr);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Convert_Skip_to_Del
+ (vector <int> & del)
+
+// Set del to the entries in an IMP submessage that correspond
+// to the skip values in this alignment.
+
+ {
+ int i, n;
+
+ del . clear ();
+
+ n = skip . size ();
+ for (i = 0; i < n; i ++)
+ del . push_back (a_lo + skip [i] - b_lo - i);
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Dump
+ (FILE * fp) const
+
+// Print to fp the entries of this alignment.
+
+ {
+ Base_Alignment_t :: Dump (fp);
+ fprintf (fp, "Skip:\n");
+ Dump_Skip (fp);
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Dump_Skip
+ (FILE * fp) const
+
+// Print to fp the skip entries of this alignment.
+
+ {
+ int i, n;
+
+ n = skip . size ();
+ for (i = 0; i < n; i ++)
+ fprintf (fp, " %3d: %5d\n", i, skip [i]);
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Flip
+ (int a_length, int b_length)
+
+// Change this alignment to reflect that both strings
+// have been reversed. a_length is the length of the
+// a string (i.e., that a coordinates refer to) and
+// b_length is the length of the b string.
+
+ {
+ int i, n, tmp;
+
+ flipped = 1 - flipped;
+
+ tmp = a_length - a_lo;
+ a_lo = a_length - a_hi;
+ a_hi = tmp;
+
+ tmp = b_length - b_lo;
+ b_lo = b_length - b_hi;
+ b_hi = tmp;
+
+ reverse (skip . begin (), skip . end ());
+ n = skip . size ();
+ for (i = 0; i < n; i ++)
+ skip [i] = b_length - 1 - skip [i];
+
+ return;
+ }
+
+
+
+char Gapped_Alignment_t :: Get_Aligning_Char
+ (int b, char * s)
+
+// Return the character in string s that aligns to
+// consensus position b .
+
+ {
+ int d, i, n;
+
+ assert (b_lo <= b && b < b_hi);
+
+ n = skip . size ();
+ for (d = 0; d < n && skip [d] < b; d ++)
+ ;
+
+ i = a_lo + b - b_lo - d;
+ if (d < n && b == skip [d])
+ return '-';
+ else
+ return s [i];
+ }
+
+
+
+int Gapped_Alignment_t :: Get_Skip
+ (int i) const
+
+// Return the skip value associated with subscript i , if there
+// is one; otherwise, return INT_MAX .
+
+ {
+ int n;
+
+ n = skip . size ();
+ if (i < n)
+ return skip [i];
+ else
+ return INT_MAX;
+ }
+
+
+
+void Gapped_Alignment_t :: Incr_Column_Chars
+ (Matrix <unsigned char> & count, const char * s)
+
+// Increment entries in count corresponding to this alignment
+// of s to the consensus string.
+
+ {
+ int skip_ct = skip . size ();
+ int a, b, d, j;
+
+ a = a_lo;
+ d = 0;
+ for (b = b_lo; b < b_hi; b ++)
+ {
+ if (d < skip_ct && b == skip [d])
+ {
+ Incr_Limited (count . get (b, 4), (unsigned char) UCHAR_MAX); // '-'
+ d ++;
+ }
+ else
+ {
+ j = DNA_Char_To_Sub (s [a]);
+ if (j >= 0)
+ Incr_Limited (count . get (b, j), (unsigned char) UCHAR_MAX);
+ a ++;
+ }
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Make_Sub_Alignment
+ (Gapped_Alignment_t & sub_ali, int b1, int b2) const
+
+// Set sub_ali to the portion of this alignment that intersects
+// b1 .. b2 of the b sequence.
+
+ {
+ int d, n;
+
+ sub_ali . Clear ();
+
+ n = skip . size ();
+ d = 0;
+ if (b1 <= b_lo)
+ {
+ sub_ali . b_lo = b_lo;
+ sub_ali . a_lo = a_lo;
+ }
+ else
+ {
+ while (d < n && skip [d] < b1)
+ d ++;
+ sub_ali . b_lo = b1;
+ sub_ali . a_lo = a_lo + b1 - b_lo - d;
+ }
+
+ sub_ali . b_hi = Min (b2, b_hi);
+
+ for ( ; d < n && skip [d] <= sub_ali . b_hi; d ++)
+ sub_ali . skip . push_back (skip [d]);
+
+ sub_ali . a_hi = a_lo + sub_ali . b_hi - b_lo - d;
+
+ sub_ali . string_sub = string_sub;
+ sub_ali . flipped = flipped;
+ sub_ali . a_len = a_len;
+
+ assert (sub_ali . a_lo < sub_ali . a_hi);
+ assert (sub_ali . b_lo <= sub_ali . b_hi);
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Modify_For_B_Inserts
+ (const vector <int> & insert_sub)
+
+// Change this alignment to reflect additional '-'s in the
+// consensus sequence at positions in insert_sub .
+
+ {
+ vector <int> :: iterator p;
+ vector <int> new_skip;
+ int i, n;
+
+ if (Verbose > 2)
+ {
+ n = insert_sub . size ();
+ printf ("insert_sub n = %d\n", n);
+ for (i = 0; i < n; i ++)
+ printf ("%3d: %5d\n", i, insert_sub [i]);
+
+ printf ("Before Modify_For_B_Inserts:\n");
+ Dump (stdout);
+ }
+
+ n = insert_sub . size ();
+ for (i = 0; i < n && insert_sub [i] < b_lo; i ++)
+ b_lo ++;
+ // Note: can't wait till end of loop to increment b_lo by
+ // i because loop may end prematurely
+
+ p = skip . begin ();
+ while (p != skip . end () && i < n)
+ {
+ if (insert_sub [i] <= (* p) + i)
+ {
+ new_skip . push_back (insert_sub [i]);
+ i ++;
+ }
+ else
+ {
+ new_skip . push_back ((* p) + i);
+ p ++;
+ }
+ }
+
+ for ( ; p != skip . end (); p ++)
+ new_skip . push_back ((* p) + i);
+
+ b_hi += i;
+
+ while (i < n && insert_sub [i] < b_hi)
+ {
+ new_skip . push_back (insert_sub [i]);
+ i ++;
+ b_hi ++;
+ }
+
+ skip = new_skip;
+
+ if (Verbose > 2)
+ {
+ printf ("After Modify_For_B_Inserts:\n");
+ Dump (stdout);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Pass_Through
+ (const Alignment_t & ali)
+
+// Convert this alignment to refer to the b sequence in ali ,
+// which maps this alignment's consensus (as its a sequence)
+// to another sequence. Assume that the other sequence has
+// had gaps inserted where needed.
+
+ {
+ vector <int> new_skip;
+ bool done_b_lo = false;
+ int orig_b_lo;
+ int prev_new_skip = -1, skip_len;
+ int d, i, j, k, n;
+
+ if (Verbose > 2)
+ {
+ printf ("ali . a_lo/hi = %d/%d ali . b_lo/hi = %d/%d\n",
+ ali . a_lo, ali . a_hi, ali . b_lo, ali . b_hi);
+ printf ("a_lo/hi = %d/%d b_lo/hi = %d/%d\n",
+ a_lo, a_hi, b_lo, b_hi);
+ }
+ assert (ali . a_lo <= b_lo);
+ assert (b_hi <= ali . a_hi);
+
+ orig_b_lo = b_lo;
+ i = ali . a_lo;
+ j = ali . b_lo;
+ n = ali . delta . size ();
+ skip_len = skip . size ();
+ for (d = k = 0; d < int (ali . delta . size ()) && i < b_hi; d ++)
+ {
+ i += abs (ali . delta [d]) - 1;
+ j += abs (ali . delta [d]) - 1;
+ if (! done_b_lo && b_lo <= i)
+ {
+ b_lo += j - i;
+ done_b_lo = true;
+ }
+ while (k < skip_len && skip [k] <= i)
+ {
+ if (Verbose > 2)
+ printf ("k = %d i = %d j = %d old_skip = %d new_skip = %d\n",
+ k, i, j, skip [k], skip [k] + j - i);
+ new_skip . push_back (skip [k] + j - i);
+ prev_new_skip = skip [k] + j - i;
+ k ++;
+ }
+ if (ali . delta [d] < 0)
+ {
+ i ++;
+ j ++;
+ // Advance both because we assume the "j" sequence has
+ // had gaps inserted
+ }
+ else if (i >= b_hi)
+ break;
+ else
+ {
+ if (orig_b_lo <= i)
+ {
+ if (Verbose > 2)
+ printf ("k = %d i = %d j = %d b_lo = %d b_hi = %d"
+
+ " adding new_skip = %d\n", k, i, j, b_lo, b_hi, j);
+ if (j == prev_new_skip)
+ new_skip . push_back (j + 1);
+ else
+ new_skip . push_back (j);
+ }
+ j ++;
+ }
+ }
+
+ while (k < skip_len)
+ {
+ if (Verbose > 2)
+ printf ("k = %d i = %d j = %d old_skip = %d new_skip = %d\n",
+ k, i, j, skip [k], skip [k] + j - i);
+ new_skip . push_back (skip [k] + j - i);
+ k ++;
+ }
+
+ if (! done_b_lo)
+ b_lo += j - i;
+ b_hi += j - i;
+ skip = new_skip;
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Print_Subalignment_Line
+ (char * buff, int b1, int b2, char * s, int & a1, int & a2)
+
+// Write into buff the portion of this alignment of string s
+// that lies over subrange b1 .. b2 of a gapped consensus string.
+// Set a1 and a2 to the range of this sequence that corresponds
+// to what is printed.
+
+ {
+ int ct, limit;
+ int d, i, n;
+
+ ct = 0; // keep track of what's been written into buff
+ a1 = a2 = -1; // indicate no match unless changed
+
+ // fill buff with blanks to get to the start of characters
+ limit = Min (b_lo, b2);
+ while (b1 < limit)
+ {
+ buff [ct ++] = ' ';
+ b1 ++;
+ }
+
+ if (b1 == b2)
+ return;
+
+ n = skip . size ();
+
+ for (d = 0; d < n && skip [d] < b1; d ++)
+ ;
+
+ i = a1 = a_lo + b1 - b_lo - d;
+
+ limit = Min (b_hi, b2);
+ while (b1 < limit)
+ {
+ if (d < n && b1 == skip [d])
+ {
+ buff [ct ++] = '-';
+ d ++;
+ }
+ else
+ buff [ct ++] = s [i ++];
+ b1 ++;
+ }
+
+ a2 = i;
+
+ // pad with spaces if alignment ends before b2
+ while (b1 < b2)
+ {
+ buff [ct ++] = ' ';
+ b1 ++;
+ }
+
+ buff [ct] = '\0';
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Shift_Skip
+ (int offset)
+
+// Add offset to all the values in this alignment's skip vector.
+
+ {
+ int i, n;
+
+ n = skip . size ();
+ for (i = 0; i < n; i ++)
+ skip [i] += offset;
+
+ return;
+ }
+
+
+
+
+// ### Gapped_MA_Bead_t methods ###
+
+
+void Gapped_MA_Bead_t :: Advance
+ (void)
+
+// Set seq_ch and qual_ch to the next character in the
+// alignment referred to by this bead. Also update the other
+// members to track the change.
+
+ {
+ b_pos ++;
+
+ if (b_pos == skip_pos)
+ {
+ seq_ch = '-';
+ qual_ch = Min (qual [a_pos], qual [a_pos + 1]);
+ skip_i ++;
+ skip_pos = ga -> Get_Skip (skip_i);
+ }
+ else
+ {
+ a_pos ++;
+ seq_ch = seq [a_pos];
+ qual_ch = qual [a_pos];
+ }
+
+ if (a_pos >= ga -> a_hi || b_pos >= ga -> b_hi)
+ active = false;
+
+ return;
+ }
+
+
+
+
+// ### Multi_Alignment_t methods ###
+
+
+bool Multi_Alignment_t :: Check_Subsequent_Overlaps
+ (const char * cons, int cons_len, const vector <char *> & s, int i,
+ const vector <int> & offset, int n, int curr_offset, int wiggle, int min_overlap,
+ double erate, int offset_sum, int virtual_cons_len)
+
+ // Check if one of the strings s [i .. (n-1)] might overlap
+ // string cons (whose length is cons_len ) based on their
+ // relative offsets in offset w.r.t the current offset of string i - 1
+ // in cons of curr_offset and actual alignments. Offset positions
+ // are allowed wiggle characters in each direction and the minimum
+ // overlap is min_overlap characters. erate is the allowed
+ // error fraction in overlaps. Overlap must extend at
+ // least as far as string i - 1 would have. offset_sum is the
+ // sum of entries in offset [0 .. (i - 1)] and virtual_cons_len is
+ // the length of a perfect consensus using just the (non-expelled)
+ // values in offset and the lengths of the strings to be multi-aligned.
+
+{
+ Alignment_t ali;
+ int add_offset, min_olap, needed_extension;
+ int j, mid;
+
+ needed_extension = curr_offset + strlen (s [i - 1]);
+ // this may include an extension past the end of the consensus string
+ // subsequent overlap must get at least this far in order to
+ // safely expel string i - 1
+
+ min_olap = Min (cons_len, min_overlap);
+ // Adjust in case the consensus is too short. Don't adjust if a
+ // subsequent string is too short, though. It will be used if it
+ // overlaps well enough in the main routine, but it shouldn't justify
+ // getting rid of this string.
+
+ mid = cons_len - min_olap;
+ add_offset = curr_offset;
+
+ for (j = i; j < n; j ++)
+ {
+ bool matched;
+ int lo, hi, exp_olap_len, error_limit, len;
+
+ len = strlen (s [j]);
+ offset_sum += offset [i];
+
+ add_offset += offset [j];
+ if (cons_len - add_offset + wiggle < min_olap
+ || virtual_cons_len <= offset_sum)
+ // The first test is that string i might overlap the actual consensus.
+ // The second is that the implied position of string i could be found in
+ // the consensus in Estimate_Offset or Estimate_Offset_With_Expels .
+ // The second test is necessary when the actual offsets vary significantly
+ // from the ones provided in offset .
+ return false; // It's hopeless from here on since offsets only increase
+
+ lo = Max (0, Min (add_offset - wiggle, mid));
+ hi = Min (Max (lo + 1, mid), add_offset + wiggle);
+ exp_olap_len = Min (cons_len - lo, len);
+
+ error_limit = Binomial_Cutoff (exp_olap_len, erate, BIN_CUTOFF_PROB);
+ matched = Overlap_Match_VS (s [j], len, cons, cons_len, lo, hi,
+ 0, error_limit, ali);
+
+ if (matched && ali . Error_Rate () <= erate
+ && needed_extension <= ali . b_hi + len - ali . a_hi)
+ return true;
+ }
+
+ return false;
+}
+
+
+
+void Multi_Alignment_t :: Clear
+ (void)
+
+// Make this multi-alignment empty.
+
+ {
+ consensus . assign ("");
+ align . clear ();
+
+ return;
+ }
+
+
+
+int Multi_Alignment_t :: Estimate_Offset_Position
+ (int i, const vector <int> & offset)
+
+// Estimate the position at which offset [i] would be in the
+// consensus of this multialignment using the previous alignments
+// in align [0 .. (i-1)] . The values in offset represent the
+// leftmost position of each string relative to the preceding string.
+
+ {
+ int j, off, len;
+
+ off = offset [i];
+ for (j = i - 1; j >= 0; j --)
+ {
+ len = align [j] . a_hi - align [j] . a_lo;
+ if (off < len)
+ return align [j] . B_Position (off);
+
+ off += offset [j];
+ }
+
+ if (Verbose > 0)
+ {
+ off = offset [i];
+ fprintf (stderr, "%5s %5s %5s %5s %5s\n", "j", "off", "len", "a_lo", "a_hi");
+ for (j = i; j >= 0; j --)
+ {
+ len = align [j] . a_hi - align [j] . a_lo;
+ fprintf (stderr, "%5d %5d %5d %5d %5d\n", j, off, len, align [j] . a_lo,
+ align [j] . a_hi);
+ off += offset [j];
+ }
+ }
+
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Impossible offset = %d i = %d in Estimate_Offset_Position\n",
+ offset [i], i);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+
+ return -1;
+ }
+
+
+
+int Multi_Alignment_t :: Estimate_Offset_With_Expels
+ (int i, const vector <int> & offset, const vector <bool> & expel)
+
+// Estimate the position at which offset [i] would be in the
+// consensus of this multialignment using the previous alignments
+// in align [0 .. (i-1)] , but not any whose corresponding expel entry
+// is true. The values in offset represent the
+// leftmost position of each string relative to the preceding string.
+
+{
+ int j, off, len;
+
+ off = offset [i];
+ for (j = i - 1; j >= 0; j --)
+ {
+ if (! expel [j])
+ {
+ len = align [j] . a_hi - align [j] . a_lo;
+
+ if (off < len)
+ return align [j] . B_Position (off);
+ }
+
+ off += offset [j];
+ }
+
+ if (Verbose > 0)
+ {
+ off = offset [i];
+ fprintf (stderr, "%5s %5s %5s %5s %5s %5s\n", "j", "expel", "off",
+ "len", "a_lo", "a_hi");
+ for (j = i; j >= 0; j --)
+ {
+ len = align [j] . a_hi - align [j] . a_lo;
+ fprintf (stderr, "%5d %5s %5d %5d %5d %5d\n", j,
+ (expel [j] ? "yes" : "no"),
+ off, len, align [j] . a_lo, align [j] . a_hi);
+ off += offset [j];
+ }
+ }
+
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Impossible offset = %d i = %d in Estimate_Offset_With_Expels\n",
+ offset [i], i);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+
+ return -1;
+}
+
+
+
+void Multi_Alignment_t :: Print_Alignments_To_Consensus
+ (FILE * fp, vector <char *> s)
+
+// Show the individual alignments of the strings in s to
+// the consensus sequence of this alignment
+
+ {
+ const char * con;
+ int i, n;
+
+ n = align . size ();
+ con = consensus . c_str ();
+
+ fprintf (fp, "\nConsensus len = %d\n", consensus . length ());
+
+ for (i = 0; i < n; i ++)
+ {
+ fprintf (fp, "\nString #%d:\n", i);
+
+ align [i] . Print (fp, s [i], con);
+ }
+
+
+ return;
+ }
+
+
+
+void Multi_Alignment_t :: Reset_From_Votes
+ (const vector <char *> & s,
+ int offset_delta, double error_rate,
+ vector <Vote_t> & vote, bool & changed)
+
+// Reset the consensus string in this multialignment from the
+// votes in vote . Redo the individual alignments of the
+// strings, which are in s . Allow offset_delta play either
+// direction at the start when re-doing the alignments and
+// assume an error-rate of error_rate . Save the votes of
+// the new alignments in vote . Set changed true iff the new
+// consensus string differs from the previous one.
+
+ {
+ string new_cons;
+ char * cons;
+ int adj, attempts, cons_len, wiggle;
+ int min_b_lo, max_b_hi;
+ int i, n;
+
+ n = vote . size ();
+
+ vector <short> adjust (n + 1, 0);
+ adj = 0;
+ // Keep track of adjustments in positions caused by indels so
+ // that when alignments are recalculated, we can start at
+ // the correct place
+
+ for (i = 0; i < n; i ++)
+ {
+ char ch;
+
+ adjust [i] = adj;
+
+ ch = vote [i] . Max_Here_Char ();
+ if (ch != ' ')
+ new_cons . push_back (ch);
+ else
+ adj --;
+
+ ch = vote [i] . Max_After_Char ();
+ if (ch != ' ')
+ {
+ new_cons . push_back (ch);
+ adj ++;
+ }
+ }
+
+ changed = (consensus != new_cons);
+ if (! changed)
+ return;
+
+ consensus = new_cons;
+ cons = strdup (new_cons . c_str ());
+ cons_len = new_cons . length ();
+
+ vote . resize (cons_len);
+ for (i = 0; i < cons_len; i ++)
+ vote [i] . Set_Zero ();
+
+ n = s . size ();
+ min_b_lo = INT_MAX;
+ max_b_hi = 0;
+ for (i = 0; i < n; i ++)
+ {
+ bool ok, needs_shift;
+ int error_limit, len, off;
+ int lo, hi;
+
+ if (align [i] . Is_Empty ())
+ {
+ if (Verbose > 1)
+ cerr << "In Reset_From_Votes skipping empty alignment " << i << endl;
+ continue;
+ }
+
+ len = strlen (s [i]);
+ error_limit = Binomial_Cutoff (len, error_rate, BIN_CUTOFF_PROB);
+
+ // need to adjust b_lo here because of indels ****
+
+ if (Verbose > 3)
+ {
+ char tag [1000];
+
+ sprintf (tag, "cons");
+ Fasta_Print (stderr, cons, tag);
+
+ sprintf (tag, "s[%d] offset = %d", i, align [i] . b_lo);
+ Fasta_Print (stderr, s [i], tag);
+
+ fprintf (stderr, "error_limit = %d b_lo = %d\n",
+ error_limit, align [i] . b_lo);
+ }
+
+ attempts = 0;
+ wiggle = offset_delta;
+ needs_shift = false;
+ do
+ {
+ Fix_Status_t status;
+
+ off = align [i] . b_lo + adjust [align [i] . b_lo];
+ lo = Max (off - wiggle, 0);
+ hi = Min (off + wiggle, cons_len);
+ ok = Substring_Match_VS
+ (s [i], len, cons, cons_len, lo, hi,
+ error_limit, align [i]);
+
+ if (! ok)
+ {
+ wiggle *= 2;
+ error_limit += Min (1, int (error_limit * 0.10));
+ }
+ else
+ {
+ align [i] . Check_Fix_Start (s [i] , len, cons, cons_len, status);
+ if (status == NEEDS_LEFT_SHIFT)
+ needs_shift = true;
+ }
+
+ } while (! ok && ++ attempts < MAX_ALIGN_ATTEMPTS);
+
+ if (! ok || needs_shift)
+ {
+ Fix_Status_t fix_status;
+
+//##ALD Replace this with a Substring_Align
+ Overlap_Align (s [i], len, cons, lo, hi, cons_len,
+ 1, -3, -2, -2, align [i]);
+ align [i] . a_len = len;
+ align [i] . Check_Fix_Start (s [i] , len, cons, cons_len,
+ fix_status);
+ }
+
+ if (! ok)
+ {
+ iostream::fmtflags ios_status;
+
+ cerr << "In Reset_From_Votes in contig " << id << endl
+ << " Forced alignment of string subscript " << i
+ << " to consensus\n";
+ ios_status = cerr . setf (ios :: fixed);
+ cerr << " with " << align [i] . errors << " errors ("
+ << setprecision (2) << 100.0 * align [i] . Error_Rate ()
+ << "% error)" << endl;
+ cerr . setf (ios_status);
+
+#if 0
+ sprintf (Clean_Exit_Msg_Line,
+ "Failed on string %d in Reset_From_Votes", i);
+ throw AlignmentException_t (Clean_Exit_Msg_Line, __LINE__, __FILE__,
+ -1, i);
+#endif
+ }
+
+ align [i] . Incr_Votes (vote, s [i]);
+ if (align [i] . b_lo < min_b_lo)
+ min_b_lo = align [i] . b_lo;
+ if (align [i] . b_hi > max_b_hi)
+ max_b_hi = align [i] . b_hi;
+ }
+
+ if (max_b_hi < cons_len)
+ consensus . resize (max_b_hi);
+
+ if (min_b_lo > 0)
+ {
+ consensus . erase (0, min_b_lo);
+ for (i = 0; i < n; i ++)
+ {
+ align [i] . b_lo -= min_b_lo;
+ align [i] . b_hi -= min_b_lo;
+ }
+ }
+
+ free (cons);
+
+ return;
+ }
+
+
+
+void Multi_Alignment_t :: Set_Consensus
+ (char * s)
+
+// Make this multialignment's consensus string be s .
+
+ {
+ consensus . assign (s);
+ }
+
+
+
+void Multi_Alignment_t :: Set_Initial_Consensus
+ (const vector <char *> & s, const vector <int> & offset,
+ int offset_delta, double error_rate, int min_overlap,
+ vector <Vote_t> & vote, vector <char *> * tag_list, bool allow_expels)
+
+// Create an initial consensus string in this multialignment from the
+// strings in s with nominal relative offsets in offset . Offsets
+// are allowed to vary by +/- offset_delta and the allowed error rate
+// in alignments is error_rate . Strings must overlap by
+// at least min_overlap bases. Set vote to the votes of the strings
+// at each position of the consensus. Create the consensus by greedily
+// tiling the strings in order, appending the extension of any
+// string that aligns past the end of the consensus. Store the
+// initial alignments in this consensus, too. If tag_list isn't
+// NULL , then use its values to identify strings. If allow_expels is
+// true, then reads can be omitted from the multialignment if they would
+// have to be forced and they do not disconnect the alignment.
+
+ {
+ Vote_t v;
+ Alignment_t ali;
+ vector <bool> expel;
+ char * cons;
+ bool wrote_contig_id = false;
+ int cons_len, prev_cons_len = 0;
+ int virtual_cons_len, prev_virtual_cons_len = 0;
+ int offset_sum = 0;
+ int num_strings, prev_sub;
+ int i, j;
+
+ Clear ();
+ vote . clear ();
+
+ cons = strdup (s [0]);
+ virtual_cons_len = cons_len = strlen (cons);
+ // virtual_cons_len is how long the consensus would be if all the
+ // offset values were correct and everything aligned perfectly
+ for (j = 0; j < cons_len - 1; j ++)
+ {
+ v . Set_To (s [0] [j], true);
+ vote . push_back (v);
+ }
+ v . Set_To (s [0] [cons_len - 1], false);
+ vote . push_back (v);
+
+ ali . Set_To_Identity (cons_len);
+ align . push_back (ali);
+ prev_sub = 0;
+
+ num_strings = s . size ();
+ // where the last string started in the consensus
+ for (i = 0; i < num_strings; i ++)
+ expel . push_back (false);
+
+ for (i = 1; i < num_strings; i ++)
+ {
+ Fix_Status_t fix_status;
+ bool wrote_string_tag = false, can_skip = false, retry_worked = false;
+ bool matched;
+ double erate;
+ int error_limit, len, exp_olap_len, min_olap;
+ int attempts, curr_offset, wiggle;
+ int lo, mid, hi;
+
+ len = strlen (s [i]);
+ attempts = 0;
+ wiggle = offset_delta;
+ erate = error_rate;
+ offset_sum += offset [i];
+
+ if (allow_expels)
+ curr_offset = Min (cons_len, Estimate_Offset_With_Expels (i, offset, expel));
+ else
+ curr_offset = Min (cons_len, Estimate_Offset_Position (i, offset));
+ // where offset position hits the consensus, based on prior
+ // string alignment(s)
+
+ min_olap = Min (min_overlap, Min (cons_len, len));
+ // reduce the minimum overlap length if the strings are too short
+ // to achieve it
+ mid = cons_len - min_olap;
+
+ do
+ {
+ lo = Max (0, Min (curr_offset - wiggle, mid));
+ hi = Min (Max (lo + 1, mid), curr_offset + wiggle);
+ exp_olap_len = Min (cons_len - lo, len);
+ error_limit = Binomial_Cutoff (exp_olap_len, erate, BIN_CUTOFF_PROB);
+ // Add the current read to the consensus if there is an overlap
+ matched = Overlap_Match_VS (s [i], len, cons, cons_len, lo, hi,
+ 0, error_limit, ali);
+ matched = matched && ali . Error_Rate () <= erate;
+
+ if (Verbose > 0 && matched && attempts > 0)
+ fprintf (stderr,
+ "Matched with wiggle = %d error_rate = %.1f%%\n",
+ wiggle, 100.0 * ali . Error_Rate ());
+
+ // Increase the wiggle and error rate if alignment is not good enough
+ if (! matched)
+ {
+ if (Verbose > 0)
+ {
+ if (! wrote_contig_id)
+ {
+ cerr << endl
+ << "In Set_Initial_Consensus for contig " << id
+ << ":" << endl;
+ wrote_contig_id = true;
+ }
+ if (tag_list != NULL && ! wrote_string_tag)
+ {
+ cerr << "For string " << (* tag_list) [i] << endl;
+ wrote_string_tag = true;
+ }
+ cerr << "Alignment failed with wiggle = " << wiggle
+ << " error_limit = " << error_limit << endl;
+ }
+ wiggle *= 2;
+ if (erate <= 0.99)
+ erate += 0.01;
+
+ }
+
+ } while (! matched && ++ attempts < MAX_ALIGN_ATTEMPTS);
+
+ if (matched)
+ ali . Check_Fix_Start (s [i], len, cons, cons_len, fix_status);
+ else
+ {
+ if (allow_expels)
+ {
+ can_skip = Check_Subsequent_Overlaps
+ (cons, cons_len, s, i + 1, offset, num_strings, curr_offset,
+ offset_delta, min_overlap, error_rate, offset_sum,
+ virtual_cons_len);
+ // Use the original min-overlap value since this string
+ // might be a short contained string.
+ // Also use the original wiggle (offset_delta) and erate values.
+ // Maybe this is too conservative??
+ if (! can_skip && 0 < prev_sub && prev_cons_len < cons_len)
+ {
+ // try overlapping without most recent prior consensus
+ min_olap = Min (min_overlap, Min (prev_cons_len, len));
+ mid = prev_cons_len - min_olap;
+ lo = Max (0, Min (curr_offset - offset_delta, mid));
+ hi = Min (Max (lo + 1, mid), curr_offset + wiggle);
+ exp_olap_len = Min (prev_cons_len - lo, len);
+
+ error_limit = Binomial_Cutoff (exp_olap_len, error_rate, BIN_CUTOFF_PROB);
+ retry_worked = Overlap_Match_VS
+ (s [i], len, cons, prev_cons_len, lo, hi, 0, error_limit, ali);
+ retry_worked = retry_worked && ali . Error_Rate () <= error_rate;
+ if (retry_worked)
+ { // Remove prev_sub and its votes
+ align [prev_sub] . Incr_Votes (vote, s [prev_sub], -1);
+ align [prev_sub] . Clear ();
+ vote . resize (prev_cons_len);
+ cons_len = prev_cons_len;
+ virtual_cons_len = prev_virtual_cons_len;
+ expel [prev_sub] = true;
+ }
+ }
+ }
+
+ if (can_skip)
+ expel [i] = true;
+ else if (! retry_worked)
+ {
+ iostream::fmtflags status;
+ int a_width, b_width, max_width;
+
+ if (Verbose > 0)
+ cerr << "No more Mr. Nice Guy--forcing alignment" << endl;
+
+ Overlap_Align (s [i], len, cons, lo, hi, cons_len,
+ 1, -3, -2, -2, ali);
+ ali . a_len = len;
+
+ a_width = ali . a_hi - ali . a_lo;
+ b_width = ali . b_hi - ali . b_lo;
+ max_width = Max (a_width, b_width);
+
+ cerr << "In contig " << id << " forced alignment of "
+ << a_width << " bases of string ";
+ if (tag_list != NULL)
+ cerr << (* tag_list) [i] << " ";
+ cerr << "subscript " << i;
+ cerr << " to " << b_width << " bases of consensus\n";
+ status = cerr . setf (ios :: fixed);
+ cerr << " with " << ali . errors << " errors ("
+ << setprecision (2) << Percent (ali . errors, max_width)
+ << "% error)" << endl;
+ cerr . setf (status);
+
+#if 0
+ fprintf (stderr,
+ "\nERROR: Failed to find overlap between this string:\n");
+ Fasta_Print (stderr, s [i]);
+ fprintf (stderr, "\nand this portion of prior consensus:\n");
+ Fasta_Print (stderr, cons + lo);
+ fprintf (stderr,
+ "\nstarting in the first %d bases with at most %d errors\n\n",
+ hi - lo, error_limit);
+ sprintf (Clean_Exit_Msg_Line,
+ "Failed on string %d in Set_Initial_Consensus", i);
+ throw AlignmentException_t (Clean_Exit_Msg_Line, __LINE__, __FILE__,
+ -1, i);
+#endif
+ }
+ }
+
+ if (expel [i])
+ ali . Clear ();
+ else
+ {
+ ali . Incr_Votes (vote, s [i]);
+
+ prev_sub = i;
+ prev_cons_len = cons_len;
+ prev_virtual_cons_len = virtual_cons_len;
+
+ if (virtual_cons_len < offset_sum + len)
+ virtual_cons_len = offset_sum + len;
+
+ if (ali . a_hi < len)
+ { // s [i] extends past the end of the current consensus
+ int extra;
+
+ extra = len - ali . a_hi;
+ cons = (char *) Safe_realloc (cons, cons_len + extra + 1,
+ __FILE__, __LINE__);
+ strcpy (cons + cons_len, s [i] + ali . a_hi);
+ cons_len += extra;
+
+ for (j = ali . a_hi; j < len - 1; j ++)
+ {
+ v . Set_To (s [i] [j], true);
+ vote . push_back (v);
+ }
+ v . Set_To (s [i] [len - 1], false);
+ vote . push_back (v);
+
+ ali . a_hi = len;
+ ali . b_hi = cons_len;
+ }
+
+ ali . a_len = len;
+ }
+ align . push_back (ali);
+ }
+
+ if (Verbose > 1)
+ {
+ fprintf (stderr, "*** Votes ***\n");
+ fprintf (stderr, "%5s: %2s ------ Here ------- ------ After ------\n",
+ "Pos", "Ch");
+ for (j = 0; j < cons_len; j ++)
+ fprintf (stderr, "%5d: %c %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d\n",
+ j, cons [j],
+ vote [j] . here [0], vote [j] . here [1],
+ vote [j] . here [2], vote [j] . here [3],
+ vote [j] . here [4],
+ vote [j] . after [0], vote [j] . after [1],
+ vote [j] . after [2], vote [j] . after [3],
+ vote [j] . after [4]);
+ }
+
+ consensus . assign (cons);
+ free (cons);
+
+ return;
+ }
+
+
+
+
+// ### Gapped_Multi_Alignment_t methods ###
+
+
+void Gapped_Multi_Alignment_t :: Add_Aligned_Seqs
+ (const Gapped_Multi_Alignment_t & m, const Alignment_t & ali,
+ int cons_lo, int cons_hi, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1, vector <char *> * tg2)
+
+// Add sequences in m that align to positions cons_lo .. cons_hi
+// in m . consensus to this multialignment. Use alignment ali
+// to map m . consensus to this -> consensus . Check sl2_place
+// to see if the actual sequence is already in sl1 . If not, add it
+// onto the end of sl1 and set the corresponding sl2_place entry
+// to indicate where it is. If
+// tg1 and tg2 are not both NULL, also add the tags from
+// tg2 onto the end of tg1 (unless sl2_place indicates they're
+// already there).
+
+ {
+ Gapped_Alignment_t sub_ali;
+ bool use_tgs = (tg1 != NULL && tg2 != NULL);
+ int i, j, n;
+
+ if (Verbose > 2)
+ {
+ printf ("ali:\n");
+ ali . Dump (stdout);
+ }
+ n = m . align . size ();
+ for (i = 0; i < n; i ++)
+ if (Range_Intersect (cons_lo, cons_hi, m . align [i] . b_lo,
+ m . align [i] . b_hi))
+ {
+ if (Verbose > 2)
+ {
+ printf ("m . align [%d]:\n", i);
+ m . align [i] . Dump (stdout);
+ }
+
+ m . align [i] . Make_Sub_Alignment (sub_ali, cons_lo, cons_hi);
+
+ if (Verbose > 2)
+ {
+ printf ("First sub_ali:\n");
+ sub_ali . Dump (stdout);
+ }
+
+ sub_ali . Pass_Through (ali);
+
+ if (Verbose > 2)
+ {
+ printf ("sub_ali after Pass_Through:\n");
+ sub_ali . Dump (stdout);
+ }
+
+ if (sl2_place [i] >= 0)
+ j = sl2_place [i];
+ else
+ {
+ sl1 . push_back (strdup (sl2 [i]));
+ if (use_tgs)
+ (* tg1) . push_back (strdup ((* tg2) [i]));
+ j = sl1 . size () - 1;
+ sl2_place [i] = j;
+ }
+
+ sub_ali . string_sub = j;
+ align . push_back (sub_ali);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Clear
+ (void)
+
+// Clear this gapped multi-alignment.
+
+ {
+ consensus . erase ();
+ con_qual . erase ();
+ align . clear ();
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Consensus_To_Lower
+ (void)
+
+// Convert the consensus sequence in this multialignment
+// to lowercase.
+
+ {
+ int i, n;
+
+ n = consensus . length ();
+ for (i = 0; i < n; i ++)
+ consensus [i] = tolower (consensus [i]);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Convert_Consensus
+ (const Multi_Alignment_t & ma, const vector <short> & v)
+
+// Convert the (ungapped) consensus string in ma to a gapped
+// one in this gapped multialignment by inserting extra '-'s.
+// The number of hyphens to insert at each position is specified
+// in v .
+
+ {
+ int len;
+ int i, j, n;
+
+ len = ma . consensus . length ();
+ n = v . size ();
+
+ if (n <= len)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Gapped_Multi_Alignment_t :: Convert_Consensus\n"
+ " insert vector shorter than consensus string\n"
+ " len = %d insert size = %d",
+ len, int (v . size ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ consensus . assign ("");
+ for (i = 0; i < len; i ++)
+ {
+ for (j = 0; j < v [i]; j ++)
+ consensus . push_back ('-');
+ consensus . push_back (ma . consensus [i]);
+ }
+
+ for (j = 0; j < v [len]; j ++)
+ consensus . push_back ('-');
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Convert_From
+ (const Multi_Alignment_t & ma)
+
+// Convert the mulitalignment ma (where the consensus has no gaps)
+// to a gapped multialignment where the consensus has gaps (enough
+// to hold all insertions of all strings in the multialignment).
+
+ {
+ Gapped_Alignment_t ga;
+ int len;
+ int i, n;
+
+ id = ma . id;
+
+ len = 1 + ma . consensus . length ();
+
+ vector <short> insert (len, 0);
+ vector <int> tr (len, 0);
+
+ n = ma . align . size ();
+ for (i = 0; i < n; i ++)
+ ma . align [i] . Set_Inserts (insert);
+
+ Convert_Consensus (ma, insert);
+
+ // build translation table for each position in ungapped consensus
+ // to its corresponding position in the gapped consensus
+ tr [0] = insert [0];
+ for (i = 1; i < len; i ++)
+ tr [i] = tr [i - 1] + insert [i] + 1;
+
+ align . clear ();
+ for (i = 0; i < n; i ++)
+ {
+ ga . Convert_From (ma . align [i], tr);
+ align . push_back (ga);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Count_Column_Chars
+ (Matrix <unsigned char> & count,
+ const vector <char *> & sl)
+
+// Set entries in count to number of each character in
+// corresponding alignment columns. sl has the actual
+// sequences. Assume entries in count are all already zero.
+
+ {
+ int len;
+ int i, n;
+
+ if (sl . size () != align . size ())
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Count_Column_Chars called with %d strings and %d alignments",
+ int (sl . size ()), int (align . size ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ n = align . size ();
+ len = getConsensusLen ();
+ if (count . NumRows () < len)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Count_Column_Chars called with count vector = %d\n"
+ " and consensus len = %d",
+ count . NumRows (), len);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ for (i = 0; i < n; i ++)
+ align [i] . Incr_Column_Chars (count, sl [i]);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Dump_Aligns
+ (FILE * fp)
+
+// Print to fp the alignments in this multialignment.
+
+ {
+ int i, n;
+
+ n = align . size ();
+ fprintf (fp, "### num aligns = %d\n", n);
+ for (i = 0; i < n; i ++)
+ align [i] . Dump (fp);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Expand_Consensus
+ (const Alignment_t & ali)
+
+// Adjust the consensus sequence of this multialignment to add
+// gaps where needed to accommodate the alignment in ali ,
+// which represents the alignment of another consensus to this one.
+// Also adjust the individual read alignments for the new gaps added.
+
+ {
+ Delta_Encoding_t delta = ali . getDelta ();
+ vector <int> insert_sub;
+ int prev;
+ int i, n;
+
+ n = delta . size ();
+ prev = ali . b_lo;
+ for (i = 0; i < n; i ++)
+ if (delta [i] > 0)
+ prev += delta [i];
+ else
+ {
+ prev -= delta [i];
+ insert_sub . push_back (prev - 1);
+ consensus . insert (prev - 1, 1, '-');
+ }
+
+ n = insert_sub . size ();
+
+ if (n == 0)
+ return; // nothing to do
+
+ if (Verbose > 2)
+ for (i = 0; i < n; i ++)
+ printf ("insert_sub [%d] = %d\n", i, insert_sub [i]);
+
+ n = align . size ();
+ for (i = 0; i < n; i ++)
+ if (insert_sub [0] < align [i] . b_hi)
+ align [i] . Modify_For_B_Inserts (insert_sub);
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Extract_Gapped_Region
+ (int lo, int hi, string & s, int & gapped_lo, int & gapped_hi) const
+
+// Set s to the substring of the gapped consensus
+// between lo and hi , where lo and hi are
+// *UN*gapped positions. Set gapped_lo and gapped_hi
+// to indicate the region in the gapped consensus that
+// was extracted.
+
+ {
+ bool is_first = true;
+ int i, j, n;
+
+ s . erase ();
+
+ n = consensus . length ();
+ for (i = j = 0; i < n && j < hi; i ++)
+ {
+ if (consensus [i] != '-')
+ j ++;
+ if (j > lo && j <= hi)
+ {
+ s . push_back (consensus [i]);
+ if (is_first)
+ {
+ gapped_lo = i;
+ is_first = false;
+ }
+ gapped_hi = i + 1;
+ }
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Extract_IMP_Dels
+ (vector < vector <int> > & del_list)
+
+// Set del_list to be the del entries in IMP submessages
+// corresponding to the skip values in this alignment.
+
+ {
+ vector <int> del;
+ int i, n;
+
+ del_list . clear ();
+
+ n = align . size ();
+ for (i = 0; i < n; i ++)
+ {
+ align [i] . Convert_Skip_to_Del (del);
+ del_list . push_back (del);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Full_Merge_Left
+ (const Gapped_Multi_Alignment_t & m, int adj_a_lo, int a_lo, int a_hi,
+ int b_lo, int b_hi, int & prefix_len_added, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1, vector <char *> * tg2)
+
+// Merge the prefix of the alignment in m onto the front
+// of this alignment. The region a_lo .. a_hi
+// in the m consensus matches the prefix of this
+// alignment b_lo .. b_hi . Note that b_lo may be
+// slightly bigger than 0, so some "play" is allowed
+// for finding where the beginning of this multialignment
+// consensus actually hits m 's consensus. The search for the
+// start of the alignment begins between adj_a_lo and a_lo + 1 .
+// sl1 and sl2 are the sequences of the reads for this
+// multialignment and multialignment m , respectively.
+// Set prefix_len_added to the number of *ungapped* positions
+// in the prefix prepended to this consensus sequence.
+// Must have a_lo <= a_hi and b_lo <= b_hi .
+// sl2_place indicates whether and where sl2 strings are already
+// in sl1 . Any new strings are added
+// from sl2 to end of sl1 and sl2_place is updated.
+// If neither tg1 nor tg2 is NULL , then also add relevant
+// sequences from tg2 to the end of tg1 , mirroring sl1
+// and sl2 .
+
+ {
+ Alignment_t ali;
+ Align_Score_Entry_t last_entry;
+ string x, y;
+ int a_gapped_lo, a_gapped_hi, b_gapped_lo, b_gapped_hi;
+ int x_len, y_len, x_slip, extra;
+
+ // First align the consensus sequences (also aligning the gap
+ // positions based on the characters that are there) in the
+ // overlap region
+
+ // Pull out the respective consensus regions to the end of each
+ // sequence.
+ // Need to add some indication of what characters aligned with the
+ // gap position
+ m . Extract_Gapped_Region (adj_a_lo, a_hi, x, a_gapped_lo, a_gapped_hi);
+ x_len = x . length ();
+
+ Extract_Gapped_Region (0, b_hi, y, b_gapped_lo, b_gapped_hi);
+ y_len = y . length ();
+
+ // Align them
+ // Need to add something to take into account characters associated
+ // with gap positions
+ // The alignments must end exactly where indicated
+
+ x_slip = 1 + Gapped_Equivalent (a_lo - adj_a_lo, x);
+ Complete_Align (y . c_str (), 0, y_len, x . c_str (), 0,
+ x_slip, x_len, 2, -3, -2, -1, NULL, last_entry, ali);
+
+ if (Verbose > 2)
+ {
+ printf ("Full_Merge_Left: Alignment before flip:\n");
+ ali . Print (stdout, y . c_str (), x . c_str ());
+ }
+
+ ali . Flip_AB ();
+
+ if (Verbose > 2)
+ {
+ printf ("Full_Merge_Left: Alignment after flip:\n");
+ ali . Print (stdout, x . c_str (), y . c_str ());
+ }
+
+ extra = a_gapped_lo + ali . a_lo;
+
+ // Prepend the leftover part of a to the front of this consensus sequence
+ // Because the added leftover part is identical, only need to adjust
+ // the first delta value.
+
+ assert (extra >= 0);
+ if (extra > 0)
+ {
+ consensus . insert (0, m . consensus, 0, extra);
+ ali . Shift_First_Delta (extra);
+ Shift_B_Right (extra);
+ }
+
+ ali . a_lo = 0;
+ ali . a_hi = a_gapped_hi;
+ assert (ali . b_lo == 0);
+ ali . b_hi += extra;
+
+ Expand_Consensus (ali);
+
+ if (Verbose > 2)
+ {
+ cout << endl << endl << "Contig in Full_Merge_Left after Expand_Consensus"
+ << endl;
+ cout << "sl1 . size () = " << sl1 . size () << endl;
+ cout << "sl2 . size () = " << sl2 . size () << endl;
+ Print (stdout, sl1, 60);
+ }
+
+ Add_Aligned_Seqs (m, ali, 0, a_gapped_hi, sl1, sl2, sl2_place,
+ tg1, tg2);
+
+ if (Verbose > 2)
+ {
+ int i, n;
+
+ n = align . size ();
+ cout << endl << "Align after Full_Merge_Right n = " << n << endl;
+ cout << "sl1 . size () = " << sl1 . size () << endl;
+ cout << "sl2 . size () = " << sl2 . size () << endl;
+ for (i = 0; i < n; i ++)
+ {
+ printf ("align [%d]:\n", i);
+ align [i] . Dump (stdout);
+ }
+
+ n = sl2_place . size ();
+ cout << endl << "sl2_place n = " << n << endl;
+ for (i = 0; i < n; i ++)
+ cout << sl2_place [i] << endl;
+ }
+
+ // Eventually re-call the consensus here
+
+ prefix_len_added = Ungapped_Positions (consensus, 0, extra);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Full_Merge_Right
+ (const Gapped_Multi_Alignment_t & m, int a_lo,
+ int b_lo, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1, vector <char *> * tg2)
+
+// Merge the entire alignment in m starting at a_lo
+// into this alignment starting at b_lo . The presumption
+// is that the alignment will go to the right end of this
+// multialignment and beyond to extend it.
+// sl1 and sl2 are the sequences of the reads for this
+// multialignment and multialignment m , respectively.
+// Must have a_lo <= a_hi and b_lo <= b_hi .
+// sl2_place indicates whether and where sl2 strings are already
+// in sl1 . Any new strings are added
+// from sl2 to end of sl1 and sl2_place is updated.
+// If neither tg1 nor tg2 is NULL , then also add relevant
+// sequences from tg2 to the end of tg1 , mirroring sl1
+// and sl2 .
+
+ {
+ Alignment_t ali;
+ string x, y;
+ int a_gapped_lo, a_gapped_hi, b_gapped_lo, b_gapped_hi;
+ int a_hi, b_hi, x_len, y_len, extra;
+
+ // First align the consensus sequences (also aligning the gap
+ // positions based on the characters that are there) in the
+ // overlap region
+
+ // Pull out the respective consensus regions to the end of each
+ // sequence.
+ // Need to add some indication of what characters aligned with the
+ // gap position
+ a_hi = m . Ungapped_Consensus_Len ();
+ m . Extract_Gapped_Region (a_lo, a_hi, x, a_gapped_lo, a_gapped_hi);
+ x_len = x . length ();
+
+ b_hi = Ungapped_Consensus_Len ();
+ Extract_Gapped_Region (b_lo, b_hi, y, b_gapped_lo, b_gapped_hi);
+ y_len = y . length ();
+
+ // Align them
+ // Need to add something to take into account characters associated
+ // with gap positions
+ // This version has no flexibility--the alignments must start exactly
+ // where indicated
+ Overlap_Align (x . c_str (), x_len, y . c_str (), 0, 1, y_len,
+ 2, -3, -2, -1, ali);
+
+ if (Verbose > 2)
+ ali . Print (stdout, x . c_str (), y . c_str ());
+
+ extra = x_len - ali . a_hi;
+
+ // Append the leftover part of a to the end of this sequence
+ if (extra > 0)
+ {
+ assert (ali . b_hi == y_len);
+ consensus . append (x, ali . a_hi, extra);
+ }
+ else
+ extra = 0;
+
+ // Because the added leftover part is identical, the alignment is
+ // correct for the entire region, too.
+
+ ali . a_lo += a_gapped_lo;
+ ali . a_hi += a_gapped_lo + extra;
+ ali . b_lo += b_gapped_lo;
+ ali . b_hi += b_gapped_lo + extra;
+
+ Expand_Consensus (ali);
+
+ if (Verbose > 2)
+ {
+ cout << endl << endl << "Contig in Full_Merge_Right after Expand_Consensus"
+ << endl;
+ cout << "sl1 . size () = " << sl1 . size () << endl;
+ cout << "sl2 . size () = " << sl2 . size () << endl;
+ Print (stdout, sl1, 60);
+ }
+
+ Add_Aligned_Seqs (m, ali, a_gapped_lo, a_gapped_hi, sl1, sl2, sl2_place,
+ tg1, tg2);
+
+ if (Verbose > 2)
+ {
+ int i, n;
+
+ n = align . size ();
+ cout << endl << "Align after Full_Merge_Right n = " << n << endl;
+ cout << "sl1 . size () = " << sl1 . size () << endl;
+ cout << "sl2 . size () = " << sl2 . size () << endl;
+ for (i = 0; i < n; i ++)
+ {
+ printf ("align [%d]:\n", i);
+ align [i] . Dump (stdout);
+ }
+
+ n = sl2_place . size ();
+ cout << endl << "sl2_place n = " << n << endl;
+ for (i = 0; i < n; i ++)
+ cout << sl2_place [i] << endl;
+ }
+
+ // Eventually re-call the consensus here
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Get_Distinguishing_Columns
+ (vector <Distinguishing_Column_t> & dc,
+ const vector <char *> & sl)
+
+// Fill dc with the distinguishing columns in this multialignment.
+// A distinguishing column has a confirmed SNP.
+// It may actually be a range of adjacent columns.
+// sl holds the component sequences in the multialignment and
+
+ {
+ Distinguishing_Column_t d;
+ int i, len;
+
+ dc . clear ();
+
+ len = getConsensusLen ();
+
+ Matrix <unsigned char> count (len, 5);
+ // counts of a, c, g, t and - at each position of consensus
+ // automatically set to zero
+
+ Count_Column_Chars (count, sl);
+
+ for (i = 0; i < len; i ++)
+ {
+ char ch1, ch2;
+ int ch1_ct, ch2_ct;
+
+ if (Is_Distinguishing (count . getRow (i), ch1, ch1_ct, ch2, ch2_ct))
+ {
+ d . lo = i;
+ d . hi = i + 1; // restrict to single characters for now
+ d . hapa_ch = ch1;
+ d . hapb_ch = ch2;
+ d . phase_ch = ' ';
+ Get_Element_Subs (d, sl);
+
+ dc . push_back (d);
+ }
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Get_Element_Subs
+ (Distinguishing_Column_t & d, const vector <char *> & sl)
+
+// Fill hapa_sub and hapb_sub in d with the subscripts
+// of the strings in sl that have d . hapa_ch and d . hapb_ch ,
+// respectively, at the position indicated in d .
+
+ {
+ int i, n;
+
+ d . hapa_sub . clear ();
+ d . hapb_sub . clear ();
+
+ n = align . size ();
+ for (i = 0; i < n; i ++)
+ if (Range_Intersect (align [i] . b_lo, align [i] . b_hi, d . lo, d . hi))
+ {
+ char ch;
+
+ ch = align [i] . Get_Aligning_Char (d . lo, sl [i]);
+ if (ch == d . hapa_ch)
+ d . hapa_sub . push_back (i);
+ else if (ch == d . hapb_ch)
+ d . hapb_sub . push_back (i);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Get_Partial_Ungapped_Consensus
+ (string & s, int lo, int hi) const
+
+// Set s to the ungapped portion of the consensus of this
+// multialignment between positions lo and hi (in gap
+// coordinates).
+
+ {
+ int i, j, n;
+
+ s . erase ();
+ n = consensus . length ();
+ for (i = j = 0; i < n && j < hi; i ++)
+ if (consensus [i] != '-')
+ {
+ if (lo <= j)
+ s . push_back (consensus [i]);
+ j ++;
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Get_Positions
+ (vector <AMOS :: Range_t> & pos) const
+
+// Set pos to the list of b_lo and b_hi values in
+// the align vector of this alignment
+
+ {
+ int i, n;
+
+ n = align . size ();
+ pos . resize (n);
+
+ for (i = 0; i < n; i ++)
+ pos [i] . setRange (align [i] . b_lo, align [i] . b_hi);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Get_Ungapped_Consensus
+ (string & s)
+
+// Set s to the ungapped consensus sequence of this
+// multialignment.
+
+ {
+ int i, n;
+
+ s . erase ();
+ n = consensus . length ();
+ for (i = 0; i < n; i ++)
+ if (consensus [i] != '-')
+ s . push_back (consensus [i]);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Haplo_Sep
+ (const vector <char *> & sl, vector <Distinguishing_Column_t> & dc,
+ vector <char *> * tg)
+
+// Identify distinguishing columns in this multialignment
+// and use them to partition the elements into separate
+// haplotypes as much as possible. sl holds the sequences
+// of the elements and tg holds the id tags of the elements.
+// Set dc to hold the SNPs between the haplotypes.
+
+ {
+ vector <char> side;
+ vector <int> segment;
+ int i, m, n;
+
+ Get_Distinguishing_Columns (dc, sl);
+
+ Set_Phase (dc);
+
+ n = sl . size ();
+ vector <int> pos (n, 0), neg (n, 0);
+
+ Classify_Reads (dc, n, side, segment);
+
+ m = dc . size ();
+ for (i = 0; i < m; i ++)
+ {
+ int j, k;
+
+ if (dc [i] . phase_ch == '+')
+ {
+ k = dc [i] . hapa_sub . size ();
+ for (j = 0; j < k; j ++)
+ pos [dc [i] . hapa_sub [j]] ++;
+
+ k = dc [i] . hapb_sub . size ();
+ for (j = 0; j < k; j ++)
+ neg [dc [i] . hapb_sub [j]] ++;
+ }
+ else if (dc [i] . phase_ch == '-')
+ {
+ k = dc [i] . hapa_sub . size ();
+ for (j = 0; j < k; j ++)
+ neg [dc [i] . hapa_sub [j]] ++;
+
+ k = dc [i] . hapb_sub . size ();
+ for (j = 0; j < k; j ++)
+ pos [dc [i] . hapb_sub [j]] ++;
+ }
+ }
+
+ int p_ct = 0, n_ct = 0, u_ct = 0;
+
+ printf ("String Assignments:\n");
+ for (i = 0; i < n; i ++)
+ {
+ if (tg != NULL)
+ printf ("%3d %8s: %7d %7d %c %4d\n", i, (* tg) [i], pos [i], neg [i],
+ side [i], segment [i]);
+ else
+ printf ("%3d: %7d %7d %c %4d\n", i, pos [i], neg [i], side [i],
+ segment [i]);
+ if (pos [i] > neg [i])
+ p_ct ++;
+ else if (pos [i] < neg [i])
+ n_ct ++;
+ else
+ u_ct ++;
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Make_From_CCO_Msg
+ (const Celera_Message_t & msg, const vector <int> & slen)
+
+// Set this multi-alignment to the one in the Celera CCO
+// message msg . slen is the lengths of the reads in msg .
+
+ {
+ vector <Celera_MPS_Sub_Msg_t> mps_list;
+ vector <Celera_UPS_Sub_Msg_t> ups_list;
+ Ordered_Range_t position;
+ Gapped_Alignment_t ga;
+ vector <int> del;
+ int i, n, slen_sub;
+
+ consensus = msg . getConsensus ();
+ n = consensus . length ();
+ for (i = 0; i < n; i ++)
+ consensus [i] = tolower (consensus [i]);
+ con_qual = msg . getQuality ();
+
+ align . clear ();
+
+ mps_list = msg . getMPSList ();
+ ups_list = msg . getUPSList ();
+
+ n = mps_list . size ();
+ for (i = 0; i < n; i ++)
+ {
+ int j, k, x, y;
+
+ ga . a_lo = 0;
+ ga . a_hi = slen [i];
+ ga . a_len = slen [i];
+ position = mps_list [i] . getPosition ();
+ x = position . getBegin ();
+ y = position . getEnd ();
+ if (x < y)
+ {
+ ga . b_lo = x;
+ ga . b_hi = y;
+ ga . flipped = 0;
+ }
+ else
+ {
+ ga . b_lo = y;
+ ga . b_hi = x;
+ ga . flipped = 1;
+ }
+ ga . errors = 0; // Temporary--needs to be set correctly later
+ del = mps_list [i] . getDel ();
+ k = del . size ();
+ for (j = 0; j < k; j ++)
+ del [j] += ga . b_lo + j;
+ ga . setSkip (del);
+ align . push_back (ga);
+ }
+
+ slen_sub = n;
+
+ // Only extract alignment for surrogate (i.e., stone) unitigs
+ n = ups_list . size ();
+ for (i = 0; i < n; i ++)
+ {
+ int j, k, x, y;
+
+ if (ups_list [i] . getUnitigType () == STONE_UNI_T)
+ {
+ ga . a_lo = 0;
+ ga . a_hi = slen [slen_sub];
+ ga . a_len = slen [slen_sub];
+ slen_sub ++;
+ position = ups_list [i] . getPosition ();
+ x = position . getBegin ();
+ y = position . getEnd ();
+ if (x < y)
+ {
+ ga . b_lo = x;
+ ga . b_hi = y;
+ ga . flipped = 0;
+ }
+ else
+ {
+ ga . b_lo = y;
+ ga . b_hi = x;
+ ga . flipped = 1;
+ }
+ ga . errors = 0; // Temporary--needs to be set correctly later
+ del = ups_list [i] . getDel ();
+ k = del . size ();
+ for (j = 0; j < k; j ++)
+ del [j] += ga . b_lo + j;
+ ga . setSkip (del);
+ align . push_back (ga);
+ }
+ }
+
+ if (slen_sub != int (slen . size ()))
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: In Make_From_CCO_Msg used %d of %d lengths\n"
+ " Should have been equal", slen_sub, int (slen.size ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Make_Gapped_Ungapped_Lookup
+ (vector <int> & lookup)
+
+// Set lookup to hold the corresponding ungapped position
+// for every position in this multialignment's consensus.
+
+ {
+ int i, n;
+
+ n = consensus . length ();
+ lookup . resize (n + 1);
+
+ lookup [0] = 0;
+ for (i = 0; i < n; i ++)
+ if (consensus [i] == '-')
+ lookup [i + 1] = lookup [i];
+ else
+ lookup [i + 1] = 1 + lookup [i];
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Merge
+ (const Gapped_Multi_Alignment_t & m)
+
+// Merge the multialignment m into this one
+
+ {
+ // Not done yet. Need to add extra parameters specifying
+ // where the merge happens (including orientation)
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Output_Read_Positions
+ (FILE * fp, int id, const vector <char *> & tag, int orig_tag_ct,
+ int len, int offset)
+
+// Output to fp a header line for this multialignment
+// containing id and the (ungapped) length of the consensus
+// followed by a list of reads and their implied positions
+// in this multialignment. Include an indication of whether
+// the read is an original read (if it's subscript is < orig_tag_ct )
+// or an added one (otherwise). len is the length of the
+// ungapped consensus. offset is added to the b positions
+// of all the reads
+
+ {
+ vector <int> lookup;
+ vector <Base_Alignment_t> extreme;
+ // holds extreme positions of all component reads
+ Base_Alignment_t * ep;
+ int bad_ct;
+ int i, j, num_aligns, num_tags;
+
+ num_tags = tag . size ();
+ // should be the same as number of distinct strings in alignment
+
+ Make_Gapped_Ungapped_Lookup (lookup);
+
+ extreme . resize (num_tags);
+ for (i = 0; i < num_tags; i ++)
+ extreme [i] . string_sub = -1; // mark to indicate not modified
+
+ num_aligns = align . size ();
+ for (i = 0; i < num_aligns; i ++)
+ {
+ j = align [i] . string_sub;
+ ep = & (extreme [j]);
+ if (ep -> string_sub == -1)
+ {
+ extreme [j] = align [i];
+ ep -> b_lo = lookup [ep -> b_lo];
+ ep -> b_hi = lookup [ep -> b_hi];
+ }
+ else if (ep -> flipped != align [i] . flipped)
+ ; // skip it; something's wrong; same read is in with
+ // different orientations
+ else
+ {
+ ep -> a_lo = Min (ep -> a_lo, align [i] . a_lo);
+ ep -> a_hi = Max (ep -> a_hi, align [i] . a_hi);
+ ep -> b_lo = Min (ep -> b_lo, lookup [align [i] . b_lo]);
+ ep -> b_hi = Max (ep -> b_hi, lookup [align [i] . b_hi]);
+ }
+ }
+
+ bad_ct = 0;
+ for (i = 0; i < num_tags; i ++)
+ if (extreme [i] . string_sub < 0)
+ bad_ct ++;
+ if (bad_ct > 0)
+ {
+ fprintf (stderr, "YIKES: %d unused alignments for contig %d\n",
+ bad_ct, id);
+ }
+
+ fprintf (fp, ">%d %d %d\n", id, len, num_tags - bad_ct);
+
+ for (i = 0; i < num_tags; i ++)
+ {
+ int actual_start, actual_stop;
+ int implied_start, implied_stop;
+
+ ep = & (extreme [i]);
+
+ if (ep -> string_sub < 0)
+ continue;
+
+ if (ep -> flipped)
+ {
+ actual_start = ep -> b_hi;
+ actual_stop = ep -> b_lo;
+ implied_start = actual_start + (ep -> a_len - ep -> a_hi);
+ implied_stop = actual_stop - ep -> a_lo;
+ }
+ else
+ {
+ actual_start = ep -> b_lo;
+ actual_stop = ep -> b_hi;
+ implied_start = actual_start - ep -> a_lo;
+ implied_stop = actual_stop + (ep -> a_len - ep -> a_hi);
+ }
+ actual_start += offset;
+ actual_stop += offset;
+ implied_start += offset;
+ implied_stop += offset;
+
+ fprintf (fp, " %c %c %10s %7d %7d %7d %7d\n",
+ tag [i] [0], (i < orig_tag_ct ? 'a' : 'b'),
+ tag [i] + 1, actual_start, actual_stop,
+ implied_start, implied_stop);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Partial_Merge
+ (const Gapped_Multi_Alignment_t & m, int a_lo, int a_hi,
+ int b_lo, int b_hi, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1, vector <char *> * tg2)
+
+// Merge the portion of the alignment in m between a_lo and
+// a_hi into this alignment between b_lo and b_hi .
+// sl1 and sl2 are the sequences of the reads for this
+// multialignment and multialignment m , respectively.
+// Must have a_lo <= a_hi and b_lo <= b_hi .
+// sl2_place indicates whether and where sl2 strings are already
+// in sl1 . Any new strings are added
+// from sl2 to end of sl1 and sl2_place is updated.
+// If neither tg1 nor tg2 is NULL , then also add relevant
+// sequences from tg2 to the end of tg1 , mirroring sl1
+// and sl2 .
+
+ {
+ Alignment_t ali;
+ Align_Score_Entry_t last_entry;
+ string x, y;
+ int a_gapped_lo, a_gapped_hi, b_gapped_lo, b_gapped_hi;
+ int x_len, y_len;
+
+ // First align the consensus sequences (also aligning the gap
+ // positions based on the characters that are there)
+
+ // Pull out the respective consensus regions
+ // Need to add some indication of what characters aligned with the
+ // gap position
+ m . Extract_Gapped_Region (a_lo, a_hi, x, a_gapped_lo, a_gapped_hi);
+ x_len = x . length ();
+
+ Extract_Gapped_Region (b_lo, b_hi, y, b_gapped_lo, b_gapped_hi);
+ y_len = y . length ();
+
+#if 0
+ printf (">a%d..%d\n", a_lo, a_hi);
+ Fasta_Print (stdout, x . c_str (), NULL);
+
+ printf (">b%d..%d\n", b_lo, b_hi);
+ Fasta_Print (stdout, y . c_str (), NULL);
+#endif
+
+ // Align them
+ // Need to add something to take into account characters associated
+ // with gap positions
+#if 0
+ Global_Align (x . c_str (), x_len, y . c_str (), 0, y_len, 2, -3, -2, -1, ali);
+#else
+ Complete_Align (x . c_str (), 0, x_len, y . c_str (), 0, 1, y_len,
+ 2, -3, -2, -1, NULL, last_entry, ali);
+#endif
+
+ if (Verbose > 2)
+ ali . Print (stdout, x . c_str (), y . c_str ());
+
+ // Then align the individual reads to the result.
+
+ if (Verbose > 2)
+ {
+ printf ("ali:\n");
+ ali . Dump (stdout);
+ printf ("a_gapped_lo/hi = %d/%d b_gapped_lo/hi = %d/%d\n",
+ a_gapped_lo, a_gapped_hi, b_gapped_lo, b_gapped_hi);
+ }
+
+ ali . a_lo += a_gapped_lo;
+ ali . a_hi += a_gapped_lo;
+ ali . b_lo += b_gapped_lo;
+ ali . b_hi += b_gapped_lo;
+ Expand_Consensus (ali);
+
+ if (Verbose > 2)
+ {
+ cout << endl << endl << "Contig #1 after Expand_Consensus" << endl;
+ cout << "sl1 . size () = " << sl1 . size () << endl;
+ cout << "sl2 . size () = " << sl2 . size () << endl;
+ Print (stdout, sl1, 60);
+ }
+
+ Add_Aligned_Seqs (m, ali, a_gapped_lo, a_gapped_hi, sl1, sl2, sl2_place,
+ tg1, tg2);
+
+ if (Verbose > 2)
+ {
+ int i, n;
+
+ n = align . size ();
+ cout << endl << "align after partial merge n = " << n << endl;
+ cout << "sl1 . size () = " << sl1 . size () << endl;
+ cout << "sl2 . size () = " << sl2 . size () << endl;
+ for (i = 0; i < n; i ++)
+ {
+ printf ("align [%d]:\n", i);
+ align [i] . Dump (stdout);
+ }
+
+ n = sl2_place . size ();
+ cout << endl << "sl2_place n = " << n << endl;
+ for (i = 0; i < n; i ++)
+ cout << sl2_place [i] << endl;
+ }
+
+ // Eventually re-call the consensus here
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Print
+ (FILE * fp, const vector <char *> & s, int width,
+ vector <char *> * tag)
+
+// Display this multialignment to file fp using
+// width characters per line. s holds the strings
+// the alignment references. If tag is not NULL, it
+// holds tag strings corresponding to the sequences s
+// to be used to label the sub-alignment lines. If use_string_sub
+// is true, then use the string_sub field in each alignment to
+// determine which string in s to use. If
+// with_diffs is true also print a line under the consensus showing
+// where there are any differences with the aligned sequences.
+
+ {
+ char * buff, * diff;
+ bool use_string_sub, with_diffs, use_gapped_coords;
+ int lo, hi, len, print_lo, print_hi, ungapped_lo, ungapped_hi;
+ int i, j, n;
+
+ use_string_sub = (print_flags & PRINT_USING_STRING_SUB);
+ with_diffs = (print_flags & PRINT_WITH_DIFFS);
+ use_gapped_coords = (print_flags & PRINT_CONSENSUS_GAP_COORDS);
+
+ if (! use_string_sub && s . size () != align . size ())
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Multi_Align . Print called with %d strings and %d alignments",
+ int (s . size ()), int (align . size ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ n = align . size ();
+ len = consensus . length ();
+ buff = (char *) Safe_malloc (5 + len, __FILE__, __LINE__);
+ if (with_diffs)
+ diff = (char *) Safe_malloc (5 + width, __FILE__, __LINE__);
+
+ // assume for now the alignments are sorted in ascending order by
+ // b_lo value
+
+ ungapped_lo = 0;
+ for (lo = 0; lo < len; lo += width)
+ {
+ int a_lo, a_hi;
+
+ hi = Min (lo + width, len);
+ if (with_diffs)
+ {
+ memset (diff, ' ', hi - lo);
+ diff [hi - lo] = '\0';
+ }
+
+ for (i = 0; i < n; i ++)
+ if (! align [i] . Is_Empty ()
+ && Range_Intersect (align [i] . b_lo, align [i] . b_hi, lo, hi))
+ {
+ char tag_buff [100];
+ int sub;
+
+ if (use_string_sub)
+ sub = align [i] . string_sub;
+ else
+ sub = i;
+ align [i] . Print_Subalignment_Line
+ (buff, lo, hi, s [sub], a_lo, a_hi);
+
+ if (tag == NULL)
+ sprintf (tag_buff, "%4d:", sub);
+ else
+ sprintf (tag_buff, "%10.10s:", (* tag) [sub]);
+ if (align [i] . flipped)
+ {
+ print_lo = align [i] . a_len - a_lo;
+ print_hi = align [i] . a_len - a_hi;
+ }
+ else
+ {
+ print_lo = a_lo;
+ print_hi = a_hi;
+ }
+ fprintf (fp, "%s %s (%d-%d)\n", tag_buff, buff, print_lo,
+ print_hi);
+
+ if (with_diffs)
+ {
+ int j, k;
+
+ k = 0;
+ for (j = lo; j < hi; j ++, k ++)
+ if (buff [k] != ' ' && buff [k] != consensus [j])
+ diff [k] = '^';
+ }
+ }
+
+ Print_Consensus (buff, lo, hi);
+
+ ungapped_hi = ungapped_lo;
+ for (j = 0; buff [j] != '\0'; j ++)
+ if (buff [j] != '-')
+ ungapped_hi ++;
+
+ if (use_gapped_coords)
+ {
+ print_lo = lo;
+ print_hi = hi;
+ }
+ else
+ {
+ print_lo = ungapped_lo;
+ print_hi = ungapped_hi;
+ }
+
+ if (tag == NULL)
+ {
+ fprintf (fp, "%4s: %s (%d-%d)\n", "cons", buff, print_lo, print_hi);
+ if (with_diffs)
+ fprintf (fp, "%5s %s\n", "", diff);
+ }
+ else
+ {
+ fprintf (fp, "%10.10s: %s (%d-%d)\n", "consensus", buff, print_lo,
+ print_hi);
+ if (with_diffs)
+ fprintf (fp, "%11s %s\n", "", diff);
+ }
+
+ ungapped_lo = ungapped_hi;
+
+ if (hi < len)
+ fprintf (fp, "\n");
+ }
+
+ free (buff);
+ if (with_diffs)
+ free (diff);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Print_Consensus
+ (char * buff, int b1, int b2)
+
+// Write into buff the portion of this consensus string
+// that lies within the subrange b1 .. b2 .
+
+ {
+ int i, ct;
+
+ ct = 0;
+ for (i = b1; i < b2; i ++)
+ buff [ct ++] = consensus [i];
+
+ buff [ct] = '\0';
+
+ return;
+ }
+
+
+
+int Gapped_Multi_Alignment_t :: Print_Empty_Aligns
+ (FILE * fp, const vector <char *> & tag, const char * contig_id)
+
+// Print to fp strings in tag corresponding to alignments in this
+// multialignment that are empty. For each, also print contig_id
+
+ {
+ int i, n, ct = 0;
+
+ n = align . size ();
+ for (i = 0; i < n; i ++)
+ if (align [i] . Is_Empty ())
+ {
+ fprintf (fp, "%-10s %s\n", tag [i], contig_id);
+ ct ++;
+ }
+
+ return ct;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Print_Ungapped_Consensus
+ (FILE * fp, char * hdr, int width)
+
+// Print to fp the non-gap entries in this multialignment's
+// consensus sequence in fasta-style. Print hdr on the
+// fasta-header line. Print width characters per line.
+
+ {
+ int i, j, n;
+
+ fprintf (fp, ">%s\n", hdr);
+
+ n = consensus . length ();
+ for (i = j = 0; i < n; i ++)
+ if (consensus [i] != '-')
+ {
+ fputc (consensus [i], fp);
+ j ++;
+ if (j == width)
+ {
+ fputc ('\n', fp);
+ j = 0;
+ }
+ }
+
+ if (j > 0)
+ fputc ('\n', fp);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Reverse_Complement
+ (vector <char *> & s)
+
+// Reverse-complement the consensus of this multialignment
+// and all the entries in s , and adjust the alignments
+// of all the component strings (which are in s ).
+
+ {
+ int cons_len;
+ int i, n;
+
+ :: Reverse_Complement (consensus);
+ Reverse_String (con_qual);
+
+ cons_len = consensus . length ();
+
+ if (align . size () != s . size ())
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: GMA reverse_complement called with %d strings and %d alignments",
+ int (s . size ()), int (align . size ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+
+ }
+ n = align . size ();
+ for (i = 0; i < n; i ++)
+ {
+ int read_len = strlen (s [i]);
+
+ :: Reverse_Complement (s [i]);
+ align [i] . Flip (read_len, cons_len);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Set_Consensus_And_Qual
+ (const vector <char *> & s, const vector <char *> & q)
+
+// Reset the consensus base values using the libSlice package
+// and assign the corresponding quality for each one in the
+// con_qual string. All ambiguous read bases or consensus base
+// are handled as an N. Strings in alignment are in s and
+// their quality values are in q .
+
+ {
+
+ unsigned int qvsum [5];
+ unsigned int cns_qv;
+ char cns_ch;
+ vector <Gapped_MA_Bead_t> active_bead;
+ string seq_column, qual_column;
+ int col_len;
+ int len, next;
+ int i, j, n;
+
+ len = consensus . length ();
+ con_qual . resize (len);
+ n = align . size ();
+
+ if (Verbose > 3)
+ {
+ printf ("consensus . length () = %d n = %d\n", len, n);
+ for (i = 0; i < n; i ++)
+ {
+ printf ("> Sequence %d\n", i);
+ Fasta_Print (stdout, s [i], NULL);
+ Fasta_Print (stdout, q [i], NULL);
+ }
+ }
+
+ // Take a slice at each sequence position and find its consensus
+ next = 0;
+ for (i = 0; i < len; i ++)
+ {
+
+ Gapped_MA_Bead_t b;
+ vector <Gapped_MA_Bead_t> :: iterator bp;
+
+ seq_column . erase ();
+ qual_column . erase ();
+
+ for (bp = active_bead . begin (); bp != active_bead . end (); )
+ {
+ bp -> Advance ();
+ if (! bp -> active)
+ bp = active_bead . erase (bp);
+ else
+ {
+ seq_column . push_back (bp -> seq_ch);
+ qual_column . push_back (bp -> qual_ch - MIN_QUALITY);
+ bp ++;
+ }
+ }
+
+ while (next < n && align [next] . b_lo == i)
+ {
+ b . seq = s [next];
+ b . qual = q [next];
+ b . ga = & (align [next]);
+ b . a_pos = b . ga -> a_lo;
+ b . b_pos = i;
+ b . skip_i = 0;
+ b . skip_pos = b . ga -> Get_Skip (b . skip_i);
+ b . seq_ch = s [next] [b . a_pos];
+ b . qual_ch = q [next] [b . a_pos];
+ b . active = true;
+ active_bead . push_back (b);
+ seq_column . push_back (b . seq_ch);
+ qual_column . push_back (b . qual_ch - MIN_QUALITY);
+ next ++;
+ }
+
+ // Array of sum of quality scores in the slice for A,C,G,T,- resp.
+ for (j = 0; j < 6; j ++)
+ qvsum [j] = 0;
+
+ int nof_ambiguities = 0;
+ col_len = seq_column . length ();
+ for (j = 0; j < col_len; j ++)
+ switch (tolower (seq_column [j]))
+ {
+ case 'a' :
+ qvsum [0] += qual_column [j];
+ break;
+ case 'c' :
+ qvsum [1] += qual_column [j];
+ break;
+ case 'g' :
+ qvsum [2] += qual_column [j];
+ break;
+ case 't' :
+ qvsum [3] += qual_column [j];
+ break;
+ case '-' :
+ qvsum [4] += qual_column [j];
+ break;
+ default:
+ // All other bases are considered an 'N'
+ nof_ambiguities += 1;
+ break;
+ }
+
+ libSlice_ConsensusLight (qvsum, nof_ambiguities, & cns_ch, & cns_qv);
+
+ consensus [i] = cns_ch;
+ con_qual [i] = MIN_QUALITY + Min (cns_qv, unsigned (MAX_QUALITY_CHAR));
+
+ if (Verbose > 3)
+ {
+ printf ("%6d: ", i);
+ cout << seq_column << " col_len = " << col_len << endl;
+ printf (" ");
+ for (j = 0; j < col_len; j ++)
+ putchar (qual_column [j] + MIN_QUALITY);
+ putchar ('\n');
+ printf (" ");
+ for (j = 0; j < col_len; j ++)
+ printf (" %02d", (signed) qual_column [j]);
+ putchar ('\n');
+
+ cout << " cons = " << consensus [i] << " qv = "
+ << con_qual [i] << endl;
+ }
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Set_Flipped
+ (const vector <AMOS :: Range_t> & clr)
+
+// Set the flipped bit true for each alignment in this
+// alignment iff the corresponding clr begin value
+// is greater than the end value.
+
+ {
+ int i, n;
+
+ n = align . size ();
+ if (int (clr . size ()) < n)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Number of clear ranges %d < number of aligns %d\n",
+ int (clr . size ()), n);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ for (i = 0; i < n; i ++)
+ if (clr [i] . end < clr [i] . begin)
+ align [i] . flipped = 1;
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Set_Phase
+ (vector <Distinguishing_Column_t> & dc)
+
+// Determine the phase of each column based on common reads with
+// consistent haplotype patterns
+
+ {
+ vector <Phase_Entry_t> edge_list;
+ vector <int> tree_edge;
+ Phase_Entry_t phase;
+ vector <Distinguishing_Column_t> :: iterator p;
+ int min;
+ int i, j, e, n, t;
+
+ n = dc . size ();
+ for (i = 0; i < n; i ++)
+ dc [i] . phase_ch = ' ';
+
+ // Eliminate dubious dc entries by marking the ones that
+ // are bounded by much better ones
+ for (i = 0; i < n - 1; i ++)
+ {
+ int k, hi_j = i;
+
+ if (dc [i] . phase_ch == 'D')
+ continue;
+
+ for (j = i + 1; j < n && dc [i] . Intersects (dc [j], phase, min); j ++)
+ {
+ if (abs (phase . same_ct - phase . opposite_ct) >= 4
+ && min >= 4)
+ hi_j = j;
+ }
+
+ for (k = i + 1; k < hi_j; k ++)
+ if (dc [k] . hapb_sub . size () <= 2)
+ dc [k] . phase_ch = 'D';
+ }
+
+ if (Verbose > 2)
+ {
+ printf ("Dubious Columns:\n");
+ for (i = 0; i < n; i ++)
+ if (dc [i] . phase_ch == 'D')
+ dc [i] . Print (stdout);
+ }
+
+ // Eliminate dubious columns
+ p = dc . begin ();
+ while (p != dc . end ())
+ if (p -> phase_ch == 'D')
+ dc . erase (p);
+ else
+ p ++;
+
+ // Create edges between remaining columns
+ n = dc . size ();
+
+ for (i = 0; i < n - 1; i ++)
+ {
+ for (j = i + 1; j < n && dc [i] . Intersects (dc [j], phase, min); j ++)
+ {
+ phase . from = i;
+ phase . to = j;
+ phase . weight = abs (phase . same_ct - phase . opposite_ct);
+ if (phase . weight > 0)
+ edge_list . push_back (phase);
+ }
+ }
+
+ sort (edge_list . begin (), edge_list . end (), greater<Phase_Entry_t>());
+
+ e = edge_list . size ();
+
+ if (Verbose > 2)
+ {
+ printf ("Edges:\n");
+ for (i = 0; i < e; i ++)
+ printf ("%4d %4d %3d %3d %3d\n", edge_list [i] . from,
+ edge_list [i] . to, edge_list [i] . same_ct,
+ edge_list [i] . opposite_ct, edge_list [i] . weight);
+ }
+
+
+ vector < vector <Phase_Entry_t> > tree (n);
+ // allocate n empty adjacency lists
+
+ Best_Spanning_Tree (n, edge_list, tree_edge);
+
+ printf ("Vertices = %d\n", n);
+ t = tree_edge . size ();
+ printf ("Tree edges = %d\n", t);
+ for (i = 0; i < t; i ++)
+ {
+ tree [edge_list [tree_edge [i]] . from]
+ . push_back (edge_list [tree_edge [i]]);
+ Swap (edge_list [tree_edge [i]] . from,
+ edge_list [tree_edge [i]] . to);
+ tree [edge_list [tree_edge [i]] . from]
+ . push_back (edge_list [tree_edge [i]]);
+ }
+
+ if (Verbose > 2)
+ {
+ printf ("Tree:\n");
+ for (i = 0; i < n; i ++)
+ {
+ int j, m;
+
+ printf ("%3d:\n", i);
+ m = tree [i] . size ();
+ for (j = 0; j < m; j ++)
+ tree [i] [j] . Print (stdout);
+ }
+ }
+
+ for (i = 0; i < n; i ++)
+ if (dc [i] . phase_ch == ' ')
+ {
+ int sum = 0;
+
+ Traverse (i, -1, tree, dc, '+', sum);
+ if (sum < 0)
+ Traverse (i, -1, tree, dc, '-', sum);
+ }
+
+ printf ("DC after Set_Phase\n");
+ for (i = 0; i < n; i ++)
+ {
+ printf ("i = %d:\n", i);
+ dc [i] . Print (stdout);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Set_String_Subs
+ (void)
+
+// Set the string_sub field in each component alignment
+// to the same subscript as the component alignemnt.
+
+ {
+ int i, n;
+
+ n = align . size ();
+ for (i = 0; i < n; i ++)
+ align [i] . string_sub = i;
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Shift_B_Right
+ (int offset)
+
+// Shift all the b values in this alignment to the right
+// by offset .
+
+ {
+ int i, n;
+
+ n = align . size ();
+ for (i = 0; i < n; i ++)
+ {
+ align [i] . b_lo += offset;
+ align [i] . b_hi += offset;
+ align [i] . Shift_Skip (offset);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Show_Skips
+ (FILE * fp)
+
+// Print the skip values in the alignment to file fp .
+
+ {
+ vector <Gapped_Alignment_t> :: iterator p;
+
+ for (p = align . begin (); p != align . end (); p ++)
+ p -> Dump_Skip (fp);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Sort
+ (vector <char *> & s, vector <int> * ref, vector <char *> * tag_list)
+
+// Sort the align entries in this multialignment according to their
+// b_lo values. Also sort the strings s along with them.
+// If ref isn't NULL , then move its entries in parallel
+// with those of s and align . Likewise, for tag_list .
+
+ {
+ int i, j, n;
+
+ n = align . size ();
+ if (n != int (s . size ()))
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Sorting %d strings with %d alignments\n",
+ int (s . size ()), n);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ for (i = 1; i < n; i ++)
+ {
+ char * s_save, * t_save;
+ Gapped_Alignment_t a_save;
+ int r_save;
+
+ if (align [i - 1] . b_lo <= align [i] . b_lo)
+ continue;
+
+ s_save = s [i];
+ a_save = align [i];
+ if (ref != NULL)
+ r_save = (* ref) [i];
+ if (tag_list != NULL)
+ t_save = (* tag_list) [i];
+
+ for (j = i; j > 0 && align [j - 1] . b_lo > a_save . b_lo; j --)
+ {
+ align [j] = align [j - 1];
+ s [j] = s [j - 1];
+ if (ref != NULL)
+ (* ref) [j] = (* ref) [j - 1];
+ if (tag_list != NULL)
+ (* tag_list) [j] = (* tag_list) [j - 1];
+ }
+
+ s [j] = s_save;
+ align [j] = a_save;
+ if (ref != NULL)
+ (* ref) [j] = r_save;
+ if (tag_list != NULL)
+ (* tag_list) [j] = t_save;
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: TA_Print
+ (FILE * fp, const vector <char *> & s, const vector <AMOS :: Range_t> & clr_list,
+ int width, const vector <char *> * tag, const string & id)
+
+// Display this multialignment to file fp in TIGR Assembler
+// .contig format. Use width characters per line of sequences.
+// s holds the strings the alignment references and clr_list holds
+// the clear ranges of the original reads (in reverse order if the
+// original read has been reversed complemented). If tag is
+// not NULL, it holds IID tags corresponding to the sequences s
+// to be used to label the sub-alignment lines. id is the
+// id number of this contig.
+
+ {
+ vector <int> lookup;
+ char * buff;
+ bool use_string_sub;
+ int clr_begin = 0, clr_end = 0;
+ int len;
+ int i, n, sub;
+
+ use_string_sub = (print_flags & PRINT_USING_STRING_SUB);
+
+ if (! use_string_sub && s . size () != align . size ())
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Multi_Align . Print called with %d strings and %d alignments",
+ int (s . size ()), int (align . size ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ n = align . size ();
+ len = consensus . length ();
+ buff = (char *) Safe_malloc (5 + len, __FILE__, __LINE__);
+
+ Make_Gapped_Ungapped_Lookup (lookup);
+
+ // first print the header information and gapped consensus.
+ fprintf (fp, "##%s %d %d bases, 00000000 checksum.\n",
+ id . c_str (), n, len);
+ Fasta_Print (stdout, getConsensusString (), NULL);
+
+ // Then the gapped reads
+ for (i = 0; i < n; i ++)
+ {
+ bool flipped;
+ int a_lo, a_hi;
+
+ if (use_string_sub)
+ sub = align [i] . string_sub;
+ else
+ sub = i;
+
+ if (tag == NULL)
+ sprintf (buff, "%d", i);
+ else
+ sprintf (buff, "%s", (* tag) [sub]);
+
+ clr_begin = clr_list [sub] . begin;
+ clr_end = clr_list [sub] . end;
+ if (clr_begin < clr_end)
+ {
+ flipped = false;
+ clr_begin ++;
+ }
+ else
+ {
+ flipped = true;
+ clr_end ++;
+ }
+
+ fprintf (fp, "#%s(%d) [%s] %d bases, 00000000 checksum. {%d %d} <%d %d>\n",
+ buff, align [i] . b_lo,
+ flipped ? "RC" : "", align [i] . b_hi - align [i] . b_lo,
+ clr_begin, clr_end, 1 + lookup [align [i] . b_lo],
+ lookup [align [i] . b_hi]);
+
+ align [i] . Print_Subalignment_Line
+ (buff, align [i] . b_lo, align [i] . b_hi, s [sub],
+ a_lo, a_hi);
+
+ Uppercase (buff);
+ Fasta_Print (stdout, buff, NULL);
+ }
+
+ return;
+ }
+
+
+void Gapped_Multi_Alignment_t :: Make_AMOS_Contig
+ (const vector <AMOS :: Range_t> & clr_list, const vector <char *> & tag,
+ AMOS :: Contig_t & out) const
+ // returns a Contig_t representation of the multi-alignment
+{
+ out . setSequence (consensus, con_qual);
+ out . setIID (strtol (id . c_str (), NULL, 10));
+
+ int n = align . size ();
+
+ vector <Tile_t> tiles;
+ for (int i = 0; i < n; i ++)
+ {
+ AMOS :: Tile_t tile;
+
+ if (align [i] . Is_Empty ())
+ continue;
+ // skip empty alignments which indicate expelled strings
+
+ tile . source = strtol(tag [i], NULL, 10);
+ if (tile.source == 0){
+ cerr << "Source of tag " << tag[i] << " is null\n";
+ }
+ tile . range = clr_list [i];
+ tile . offset = align [i] . b_lo;
+
+ int skip = align [i] . Get_Skip (0);
+ int s = 0;
+ while (skip != INT_MAX) {
+ tile . gaps . push_back (skip - tile . offset - s); // convert to CA standard
+ skip = align [i] . Get_Skip(++ s);
+ }
+
+ tiles . push_back(tile);
+ }
+ out . setReadTiling(tiles);
+}
+
+
+
+int Gapped_Multi_Alignment_t :: Ungapped_Consensus_Len
+ (void) const
+
+// Return the number of non-'-' characters in this
+// multialignment's consensus sequence.
+
+ {
+ int i, n, ct;
+
+ n = consensus . length ();
+ ct = 0;
+ for (i = 0; i < n; i ++)
+ if (consensus [i] != '-')
+ ct ++;
+
+ return ct;
+ }
+
+
+
+
+// ### Independent Functions ###
+
+
+void Align_Row_Update
+ (vector <Augmented_Score_Entry_t> & align_row, char ch, const char * s,
+ int s_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, int first_score)
+
+// Update align_row to be the values in the next row of an alignment
+// matrix where the preceding row is in align_row now. ch is
+// the character for the next row and s (whose length is s_len )
+// is the characters across the top of the alignment matrix.
+// match_score , mismatch_score , indel_score and gap_score
+// are the scores for matching characters, mismatching characters,
+// insertion/deletion and initiating a gap, respectively.
+// first_score is the value to add to the first entry's top_score field.
+
+ {
+ Augmented_Score_Entry_t prev, curr;
+ int mxs;
+ unsigned int mxf;
+ int i;
+
+ if (s_len == 0)
+ return;
+
+ assert (int (align_row . size ()) == s_len + 1);
+
+ prev = align_row [0];
+ align_row [0] . top_score += first_score;
+ align_row [0] . diag_score = align_row [0] . left_score = NEG_INFTY_SCORE;
+
+ for (i = 1; i <= s_len; i ++)
+ {
+ Augmented_Score_Entry_t * p = & (align_row [i]);
+
+ curr = align_row [i];
+ curr . Get_Max_Top (mxs, mxf, gap_score);
+
+ p -> top_score = mxs + indel_score;
+ p -> top_from = mxf;
+ p -> top_ref = curr . Get_Ref (mxf);
+
+ prev . Get_Max (mxs, mxf);
+ p -> diag_score = mxs
+ + ((ch == s [i - 1]) ? match_score : mismatch_score);
+ p -> diag_from = mxf;
+ p -> diag_ref = prev . Get_Ref (mxf);
+
+ align_row [i - 1] . Get_Max_Left (mxs, mxf, gap_score);
+ p -> left_score = mxs + indel_score;
+ p -> left_from = mxf;
+ p -> left_ref = align_row [i - 1] . Get_Ref (mxf);
+
+ prev = curr;
+ }
+
+ return;
+ }
+
+
+
+void Align_Row_Update_With_Errors
+ (vector <Errors_Score_Entry_t> & align_row, char ch, const char * s,
+ int s_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, int first_score, int first_error)
+
+// Update align_row to be the values in the next row of an alignment
+// matrix where the preceding row is in align_row now. ch is
+// the character for the next row and s (whose length is s_len )
+// is the characters across the top of the alignment matrix.
+// match_score , mismatch_score , indel_score and gap_score
+// are the scores for matching characters, mismatching characters,
+// insertion/deletion and initiating a gap, respectively.
+// first_score is the value to add to the first entry's top_score field.
+// first_error is the value to add to the first entry's top_errors field.
+
+ {
+ Errors_Score_Entry_t prev, curr;
+ int mxs;
+ unsigned int mxf;
+ int i;
+
+ if (s_len == 0)
+ return;
+
+ assert (int (align_row . size ()) == s_len + 1);
+
+ prev = align_row [0];
+ align_row [0] . top_score += first_score;
+ align_row [0] . diag_score = align_row [0] . left_score = NEG_INFTY_SCORE;
+ align_row [0] . top_errors += first_error;
+ align_row [0] . diag_errors = align_row [0] . left_errors = 0;
+
+ for (i = 1; i <= s_len; i ++)
+ {
+ Errors_Score_Entry_t * p = & (align_row [i]);
+
+ curr = align_row [i];
+ curr . Get_Max_Top (mxs, mxf, gap_score);
+
+ p -> top_score = mxs + indel_score;
+ p -> top_from = mxf;
+ p -> top_ref = curr . Get_Ref (mxf);
+ p -> top_errors = curr . Get_Errors (mxf) + 1;
+
+ prev . Get_Max (mxs, mxf);
+ p -> diag_score = mxs
+ + ((ch == s [i - 1]) ? match_score : mismatch_score);
+ p -> diag_from = mxf;
+ p -> diag_ref = prev . Get_Ref (mxf);
+ p -> diag_errors = prev . Get_Errors (mxf);
+ if (ch != s [i - 1])
+ p -> diag_errors ++;
+
+ align_row [i - 1] . Get_Max_Left (mxs, mxf, gap_score);
+ p -> left_score = mxs + indel_score;
+ p -> left_from = mxf;
+ p -> left_ref = align_row [i - 1] . Get_Ref (mxf);
+ p -> left_errors = align_row [i - 1] . Get_Errors (mxf) + 1;
+
+ prev = curr;
+ }
+
+ return;
+ }
+
+
+
+void Banded_Overlap
+ (const char * s, int s_len, const char * t, int t_len,
+ int lo_offset, int hi_offset, Simple_Overlap_t & olap,
+ int match_score,
+ int mismatch_score,
+ int indel_score,
+ int gap_score)
+
+// Find the highest-scoring overlap alignment between string s and
+// string t , restricted to a band between lo_offset and
+// hi_offset , inclusive. Offsets are measured by the position in
+// t minus the position in s of a corresponding base.
+// The length of s is s_len and the length of t is t_len .
+// The resulting overlap is stored in olap .
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+
+ {
+ vector <Errors_Score_Entry_t> band;
+ // row of alignment array
+ Errors_Score_Entry_t entry;
+ int max_row, max_col, max_score, mxs, max_ref, max_errors;
+ unsigned int max_from, mxf;
+ int bandwidth;
+ int left_col, right_col;
+ // bound region represented by band
+ int r, c;
+
+ if (s_len + lo_offset < 0)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "lo_offset=%d longer than s_len=%d in Banded_Overlap",
+ lo_offset, s_len);
+ throw AlignmentException_t (Clean_Exit_Msg_Line, __LINE__, __FILE__,
+ -1, -1);
+ }
+ if (t_len < hi_offset)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "hi_offset=%d longer than t_len=%d in Banded_Overlap",
+ hi_offset, t_len);
+ throw AlignmentException_t (Clean_Exit_Msg_Line, __LINE__, __FILE__,
+ -1, -1);
+ }
+
+ bandwidth = 1 + hi_offset - lo_offset;
+ max_score = NEG_INFTY_SCORE;
+
+ // Create the first row of the alignment matrix
+ entry . diag_score = entry . top_score = entry . left_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ entry . diag_errors = entry . top_errors = entry . left_errors = 0;
+
+ if (lo_offset <= 0)
+ {
+ r = 0;
+ right_col = - lo_offset;
+ }
+ else
+ {
+ r = lo_offset;
+ right_col = 0;
+ }
+ left_col = 1 + right_col - bandwidth;
+
+ // Create band
+ for (c = left_col; c <= right_col; c ++)
+ {
+ entry . top_ref = entry . diag_ref = entry . left_ref = c;
+ band . push_back (entry);
+ }
+
+ if (right_col == s_len || r == t_len)
+ {
+ entry . Get_Max (max_score, max_from);
+ max_row = 0;
+ max_col = s_len;
+ max_ref = s_len;
+ max_errors = entry . Get_Errors (max_from);
+ }
+
+ // Do remaining rows
+ while (left_col < s_len && r < t_len)
+ {
+ if (left_col <= 0)
+ band [- left_col] . top_ref = band [- left_col] . diag_ref
+ = band [- left_col] . left_ref = - r;
+ // is value of current row, not one being built
+
+ Update_Banded_Row (band, t [r], s, s_len, left_col, right_col,
+ match_score, mismatch_score, indel_score, gap_score, 0, 0);
+ r ++;
+ left_col ++;
+ right_col ++;
+
+ // Check last column entry for max
+ if (left_col <= s_len && s_len <= right_col)
+ {
+ band [s_len - left_col] . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = r;
+ max_col = s_len;
+ max_ref = band [s_len - left_col] . Get_Ref (mxf);
+ max_errors = band [s_len - left_col] . Get_Errors (mxf);
+ }
+ }
+ }
+
+ // Check entries in last row for max
+ if (r == t_len)
+ {
+ int lo, hi;
+
+ lo = Max (0, - left_col);
+ hi = Min (bandwidth - 1, s_len - left_col);
+ for (c = lo; c <= hi; c ++)
+ {
+ band [c] . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = t_len;
+ max_col = left_col + c;
+ max_ref = band [c] . Get_Ref (mxf);
+ max_errors = band [c] . Get_Errors (mxf);
+ }
+ }
+ }
+
+ olap . score = max_score;
+ olap . errors = max_errors;
+ olap . a_hang = max_ref;
+ if (max_col < s_len)
+ olap . b_hang = max_col - s_len;
+ else
+ olap . b_hang = t_len - max_row;
+ if (max_ref >= 0)
+ {
+ olap . b_olap_len = max_row;
+ olap . a_olap_len = max_col - max_ref;
+ }
+ else
+ {
+ olap . b_olap_len = max_row + max_ref;
+ olap . a_olap_len = max_col;
+ }
+
+ return;
+ }
+
+
+
+void Best_Spanning_Tree
+ (int n, const vector <Phase_Entry_t> & edge_list,
+ vector <int> & tree_edge)
+
+// Find the best spanning tree of graph of n vertices, 0 .. (n-1)
+// using edges in edge_list in order. Put subscripts of edges
+// used in tree_edge . Use Union-Find algorithm.
+
+ {
+ vector <int> uf (n, -1);
+ int i, e;
+
+ tree_edge . clear ();
+
+ e = edge_list . size ();
+ for (i = 0; i < e; i ++)
+ {
+ int j, k;
+
+edge_list [i] . Print (stdout);
+ j = UF_Find (edge_list [i] . from, uf);
+ k = UF_Find (edge_list [i] . to, uf);
+printf (" j = %d k = %d\n", j, k);
+ if (j != k)
+ {
+ tree_edge . push_back (i);
+ UF_Union (j, k, uf);
+ }
+ }
+
+ return;
+ }
+
+
+void Classify_Reads
+ (const vector <Distinguishing_Column_t> & dc, int n,
+ vector <char> & side, vector <int> & segment)
+
+// Assign haplotypes to reads 0 .. (n-1) based on the
+// entries in dc .
+
+ {
+ vector < vector <Phase_Entry_t> > A (n);
+ vector <Phase_Entry_t> edge_list;
+ Phase_Entry_t phase;
+ vector <int> uf (n, -1);
+ int len;
+ int e, i, j, k, m;
+
+ m = dc . size ();
+ for (i = 0; i < m; i ++)
+ {
+ int a_len, b_len;
+ int from, to;
+
+ a_len = dc [i] . hapa_sub . size ();
+ b_len = dc [i] . hapb_sub . size ();
+
+ for (j = 0; j < a_len; j ++)
+ for (k = 0; k < b_len; k ++)
+ {
+ from = dc [i] . hapa_sub [j];
+ to = dc [i] . hapb_sub [k];
+ if (from < to)
+ Incr_Opposite (A [from], from, to);
+ else
+ Incr_Opposite (A [to], to, from);
+ }
+ }
+
+ printf ("Opposite Counts n = %d:\n", n);
+ for (i = 0; i < n; i ++)
+ {
+ len = A [i] . size ();
+ printf ("%3d (%2d): ", i, len);
+ for (j = 0; j < len; j ++)
+ if (A [i] [j] . opposite_ct > 0)
+ printf (" %3d/%-3d", A [i] [j] . to, A [i] [j] . opposite_ct);
+ putchar ('\n');
+ }
+
+ // Make a list of edges
+ for (i = 0; i < n; i ++)
+ {
+ len = A [i] . size ();
+ for (j = 0; j < len; j ++)
+ {
+ phase . from = i;
+ phase . to = A [i] [j] . to;
+ phase . weight = A [i] [j] . opposite_ct;
+
+ edge_list . push_back (phase);
+ }
+ }
+
+ // Sort into descending order by weight
+ sort (edge_list . begin (), edge_list . end (), greater<Phase_Entry_t>());
+
+ // Greedily find approximate best bipartite subgraph
+ e = edge_list . size ();
+ for (i = 0; i < e; i ++)
+ {
+ int j_par, k_par;
+ int from, to;
+
+ from = edge_list [i] . from;
+ to = edge_list [i] . to;
+
+ j = UF_Find_With_Parity (from, uf, j_par);
+ k = UF_Find_With_Parity (to, uf, k_par);
+
+ if (j != k)
+ {
+ if (j_par == k_par)
+ UF_Union (j, k, uf);
+ else
+ { // break usual UF rules to ensure that from and
+ // to get opposite sides of the bipartite graph
+ if (j == from)
+ {
+ uf [k] += uf [j];
+ uf [j] = to;
+ }
+ else if (k == to)
+ {
+ uf [j] += uf [k];
+ uf [k] = from;
+ }
+ else if (uf [j] <= uf [k])
+ { // k is smaller since values are negative sizes
+ uf [j] += uf [k];
+ uf [k] = from;
+ }
+ }
+ }
+ }
+
+ side . resize (n);
+ segment . resize (n);
+
+ printf ("Bipartite Segments:\n");
+ for (i = 0; i < n; i ++)
+ {
+ char ch;
+ int par;
+
+ j = UF_Find_With_Parity (i, uf, par);
+ if (par == 0)
+ ch = 'a';
+ else
+ ch = 'b';
+ side [i] = ch;
+ segment [i] = j;
+
+ printf ("%4d %4d %c\n", i, j, ch);
+ }
+
+ return;
+ }
+
+
+
+void Complete_Align
+ (const char * s, int s_lo, int s_hi, const char * t, int t_lo, int t_slip,
+ int t_hi, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Align_Score_Entry_t * first_entry,
+ Align_Score_Entry_t & last_entry, Alignment_t & align)
+
+// Find the best alignment of the entire string s [s_lo .. (s_hi - 1)]
+// to the entire string t [t_lo .. (t_hi - 1)] but the alignment in
+// t may start between t_lo and t_slip .
+// If first_entry is not NULL , use it for the first entry in
+// the alignment matrix; otherwise, use a zero value.
+// Set last_entry to the last entry in the alignment matrix.
+// The resulting alignment is stored in align ,
+// where s is the a string and t is the b string.
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+
+ {
+ int matrix_size;
+
+ if (Verbose > 3)
+ fprintf (stderr,
+ "Complete_Align: s_lo/hi = %d/%d t_lo/slip/hi = %d/%d/%d\n",
+ s_lo, s_hi, t_lo, t_slip, t_hi);
+
+ assert (t_lo < t_slip);
+ assert (t_slip <= t_hi);
+ assert (s_lo <= s_hi );
+
+ matrix_size = (s_hi - s_lo) * (t_hi - t_lo);
+ if (t_hi - t_lo <= 10 || matrix_size <= MATRIX_SIZE_LIMIT)
+ Complete_Align_Full_Matrix (s, s_lo, s_hi, t, t_lo, t_slip, t_hi,
+ match_score, mismatch_score, indel_score, gap_score,
+ first_entry, last_entry, align);
+ else
+ Complete_Align_Save_Space (s, s_lo, s_hi, t, t_lo, t_slip, t_hi,
+ match_score, mismatch_score, indel_score, gap_score,
+ first_entry, last_entry, align);
+
+ return;
+ }
+
+
+
+void Complete_Align_Full_Matrix
+ (const char * s, int s_lo, int s_hi, const char * t, int t_lo, int t_slip,
+ int t_hi, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Align_Score_Entry_t * first_entry,
+ Align_Score_Entry_t & last_entry, Alignment_t & align)
+
+// Find the best alignment of the entire string s [s_lo .. (s_hi - 1)]
+// to the entire string t [t_lo .. (t_hi - 1)] but the alignment in
+// t may start between t_lo and t_slip .
+// If first_entry is not NULL , use it for the first entry in
+// the alignment matrix; otherwise, use a zero value.
+// Set last_entry to the last entry in the alignment matrix.
+// The resulting alignment is stored in align ,
+// where s is the a string and t is the b string.
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+// Use a full matrix for the computation.
+
+ {
+ vector < vector <Align_Score_Entry_t> > a; // the alignment array
+ vector <Align_Score_Entry_t> empty_vector;
+ vector <int> delta;
+ Align_Score_Entry_t entry;
+ unsigned int mxf;
+ int mxs, s_len, t_len, error_ct, row_limit;
+ int r, c; // row and column
+ int i, j, n; // position in string t
+
+ if (Verbose > 3)
+ {
+ fprintf (stderr, "Start Complete_Align_Full_Matrix\n");
+ fprintf (stderr, "s_lo = %d s_hi = %d t_lo = %d t_slip = %d t_hi = %d\n",
+ s_lo, s_hi, t_lo, t_slip, t_hi);
+ fprintf (stderr, "Scores: match/mismatch/indel/gap = %d/%d/%d/%d\n",
+ match_score, mismatch_score, indel_score, gap_score);
+ }
+
+ s_len = s_hi - s_lo;
+ t_len = t_hi - t_lo;
+
+ // Do first row
+ a . push_back (empty_vector);
+ if (first_entry != NULL)
+ entry = * first_entry;
+ else
+ {
+ entry . diag_score = entry . top_score = entry . left_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ }
+ r = c = 0;
+ a [r] . push_back (entry);
+
+ entry . top_score = NEG_INFTY_SCORE;
+ entry . top_from = FROM_NOWHERE;
+ entry . diag_score = NEG_INFTY_SCORE;
+ entry . diag_from = FROM_NOWHERE;
+ for (c = 1; c <= s_len; c ++)
+ {
+ entry . left_score = a [r] [c - 1] . left_score + indel_score;
+ if (c == 1)
+ entry . left_score += gap_score;
+ entry . left_from = FROM_LEFT;
+ a [r] . push_back (entry);
+ }
+
+ // Do remaining rows
+ for (i = t_lo; i < t_hi; i ++)
+ {
+ r ++;
+
+ // First column in row
+ a . push_back (empty_vector);
+ entry . diag_score = entry . left_score = NEG_INFTY_SCORE;
+ if (i < t_slip - 1)
+ {
+ entry . top_score = 0;
+ entry . top_from = FROM_NOWHERE;
+ }
+ else
+ {
+ entry . top_score = a [r - 1] [0] . top_score + indel_score;
+ if (i == t_slip - 1)
+ entry . top_score += gap_score;
+ entry . top_from = FROM_TOP;
+ }
+ entry . diag_from = entry . left_from = FROM_NOWHERE;
+ a [r] . push_back (entry);
+
+ // Remaining columns in row
+ j = s_lo;
+ for (c = 1; c <= s_len; c ++, j ++)
+ {
+ Align_Score_Entry_t * p;
+
+ p = & (a [r - 1] [c]);
+ p -> Get_Max_Top (mxs, mxf, gap_score);
+ entry . top_score = mxs + indel_score;
+ entry . top_from = mxf;
+
+ p = & (a [r - 1] [c - 1]);
+ p -> Get_Max (mxs, mxf);
+ entry . diag_score = mxs;
+ entry . diag_from = mxf;
+ entry . diag_score += ((t [i] == s [j]) ? match_score : mismatch_score);
+
+ p = & (a [r] [c - 1]);
+ p -> Get_Max_Left (mxs, mxf, gap_score);
+ entry . left_score = mxs + indel_score;
+ entry . left_from = mxf;
+ a [r] . push_back (entry);
+ }
+ }
+
+ last_entry = a [t_len] [s_len];
+ last_entry . Get_Max (mxs, mxf);
+ if (Verbose > 1)
+ printf ("Complete_Align_Full_Matrix: final score = %d\n", mxs);
+
+ // Trace back
+ row_limit = t_slip - t_lo - 1;
+ Trace_Back_Align_Path (a, r, s_len, row_limit, 0, delta,
+ error_ct, s + s_lo, t + t_lo);
+
+ align . a_lo = s_lo;
+ align . a_hi = s_hi;
+ align . b_hi = t_hi;
+ align . b_lo = r + t_lo;
+ align . errors = error_ct;
+
+ if (Verbose > 2)
+ {
+ n = delta . size ();
+ for (i = 0; i < n; i ++)
+ printf ("delta [%d] = %d\n", i, delta [i]);
+ }
+
+ align . setDelta (delta);
+
+ return;
+ }
+
+
+
+void Complete_Align_Save_Space
+ (const char * s, int s_lo, int s_hi, const char * t, int t_lo, int t_slip,
+ int t_hi, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Align_Score_Entry_t * first_entry,
+ Align_Score_Entry_t & last_entry, Alignment_t & align)
+
+// Find the best alignment of the entire string s [s_lo .. (s_hi - 1)]
+// to the entire string t [t_lo .. (t_hi - 1)] but the alignment in
+// t may start between t_lo and t_slip .
+// If first_entry is not NULL , use it for the first entry in
+// the alignment matrix; otherwise, use a zero value.
+// Set last_entry to the last entry in the alignment matrix.
+// The resulting alignment is stored in align ,
+// where s is the a string and t is the b string.
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+// Do recursively keeping just a single row.
+
+ {
+ Alignment_t sub_ali_1, sub_ali_2;
+ vector <Augmented_Score_Entry_t> align_row;
+ // row of alignment array
+ Augmented_Score_Entry_t entry;
+ int s_len, t_len, t_half, tmp_slip;
+ int mxs, max_ref;
+ unsigned int mxf;
+ int r, c;
+
+ s_len = s_hi - s_lo;
+ t_len = t_hi - t_lo;
+ assert (t_len > 1);
+
+ // Build first row
+ if (first_entry == NULL)
+ {
+ entry . diag_score = entry . top_score = entry . left_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ }
+ else
+ {
+ entry . diag_score = first_entry -> diag_score;
+ entry . top_score = first_entry -> top_score;
+ entry . left_score = first_entry -> left_score;
+ entry . diag_from = first_entry -> diag_from;
+ entry . top_from = first_entry -> top_from;
+ entry . left_from = first_entry -> left_from;
+ }
+ entry . top_ref = entry . diag_ref = entry . left_ref = 0;
+ align_row . push_back (entry);
+
+ entry . top_score = NEG_INFTY_SCORE;
+ entry . top_from = FROM_NOWHERE;
+ entry . diag_score = NEG_INFTY_SCORE;
+ entry . diag_from = FROM_NOWHERE;
+ entry . left_from = FROM_LEFT;
+ entry . left_ref = 0;
+ entry . top_ref = entry . diag_ref = -1;
+
+ for (c = 1; c <= s_len; c ++)
+ {
+ entry . left_score = align_row [c - 1] . left_score + indel_score;
+ if (c == 1)
+ entry . left_score += gap_score;
+ align_row . push_back (entry);
+ }
+
+ // Do remaining rows
+ t_half = (t_lo + t_hi) / 2;
+ for (r = t_lo + 1; r <= t_hi; r ++)
+ {
+ int first_score;
+
+ if (r < t_slip)
+ first_score = 0;
+ else if (r == t_slip)
+ first_score = indel_score + gap_score;
+ else
+ first_score = indel_score;
+
+ Align_Row_Update (align_row, t [r - 1], s + s_lo, s_len, match_score,
+ mismatch_score, indel_score, gap_score, first_score);
+
+ if (r == t_half)
+ { // set the ref entries to reference this row
+ align_row [0] . top_ref = 0;
+ for (c = 1; c <= s_len; c ++)
+ {
+ align_row [c] . top_ref = align_row [c] . diag_ref = c;
+ align_row [c - 1] . Get_Max_Left (mxs, mxf, gap_score);
+ align_row [c] . left_ref = align_row [c - 1] . Get_Ref (mxf);
+ }
+ }
+ }
+
+ // Get max from last entry
+ align_row [s_len] . Get_Max (mxs, mxf);
+ max_ref = align_row [s_len] . Get_Ref (mxf);
+
+ tmp_slip = Min (t_slip, t_half);
+ if (Verbose > 3)
+ fprintf (stderr, "max_ref = %d t_lo = %d t_slip = %d t_half = %d t_hi = %d\n",
+ max_ref, t_lo, t_slip, t_half, t_hi);
+ Complete_Align_Full_Matrix (s, s_lo, s_lo + max_ref, t, t_lo, tmp_slip, t_half,
+ match_score, mismatch_score, indel_score, gap_score, first_entry,
+ entry, sub_ali_1);
+
+ if (max_ref == 0)
+ tmp_slip = Max (t_slip, t_half + 1);
+ else
+ tmp_slip = t_half + 1;
+ Complete_Align_Full_Matrix (s, s_lo + max_ref, s_hi, t, t_half, tmp_slip,
+ t_hi, match_score, mismatch_score, indel_score, gap_score,
+ & entry, last_entry, sub_ali_2);
+
+ align . Combine (sub_ali_1, sub_ali_2);
+
+ return;
+ }
+
+
+
+int DNA_Char_To_Sub
+ (char ch)
+
+// Return the subscript 0 .. 4 corresponding to ch
+// acgt-, respectively. Return -1 if ch is not
+// one of these characters
+
+ {
+ switch (tolower (ch))
+ {
+ case 'a' :
+ return 0;
+ case 'c' :
+ return 1;
+ case 'g' :
+ return 2;
+ case 't' :
+ return 3;
+ case '-' :
+ return 4;
+ default :
+ return -1;
+ }
+ }
+
+
+
+int Exact_Prefix_Match
+ (const char * s, const char * t, int max_len)
+
+// Return the length of the longest exact prefix match of
+// strings s and t , not to exceed max_len .
+
+ {
+ int i;
+
+ if (Verbose > 5)
+ {
+ fprintf (stderr, "In Exact_Prefix_Match max_len = %d\n", max_len);
+ fprintf (stderr, "s :\n");
+ Fasta_Print (stderr, s, NULL);
+ fprintf (stderr, "t :\n");
+ Fasta_Print (stderr, t, NULL);
+ }
+
+ for (i = 0; i < max_len && s [i] == t [i]; i ++)
+//**ALD Allow N's to match anything
+// for (i = 0; i < max_len
+// && (s [i] == t [i] || tolower (s [i]) == 'n'
+// || tolower (t [i]) == 'n'); i ++)
+ ;
+
+ if (Verbose > 3)
+ {
+ fprintf (stderr, "Exact_Prefix_Match return value = %d\n", i);
+ }
+
+ return i;
+ }
+
+
+
+int Gapped_Equivalent
+ (int pos, const string & s)
+
+// Return the gapped position in s that is equivalent to
+// pos in an ungapped sequence. The return position is
+// the largest possible value, i.e., we slide over as many
+// '-'s as possible.
+
+ {
+ int i, j, n;
+
+ n = s . length ();
+ for (i = j = 0; i < n && j <= pos; i ++)
+ if (s [i] != '-')
+ {
+ if (j == pos)
+ return i;
+ j ++;
+ }
+
+ return i;
+ }
+
+
+
+void Global_Align
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align)
+
+// Find the best global alignment of the entire string s to a
+// substring of t between positions t_lo and t_hi .
+// The length of s is s_len and the length of t is at least
+// t_hi . The resulting alignment is stored in align ,
+// where s is the a string and t is the b string.
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+
+ {
+ vector < vector <Align_Score_Entry_t> > a; // the alignment array
+ vector <Align_Score_Entry_t> empty_vector;
+ vector <int> delta;
+ Align_Score_Entry_t entry;
+ int r, c; // row and column
+ int max_row, max_score;
+ unsigned int max_from;
+ int mxs;
+ unsigned int mxf;
+ int ct, sign;
+ int i, n; // position in string t
+
+ assert (t_lo <= t_hi);
+ assert (0 <= s_len );
+
+ // Do first row
+ a . push_back (empty_vector);
+ entry . diag_score = entry . top_score = entry . left_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ r = 0;
+ a [r] . push_back (entry);
+ for (c = 1; c <= s_len; c ++)
+ {
+ entry . top_score = NEG_INFTY_SCORE;
+ entry . top_from = FROM_NOWHERE;
+ entry . diag_score = NEG_INFTY_SCORE;
+ entry . diag_from = FROM_NOWHERE;
+ entry . left_score = a [r] [c - 1] . left_score + indel_score;
+ if (c == 1)
+ entry . left_score += gap_score;
+ entry . left_from = FROM_LEFT;
+ a [r] . push_back (entry);
+ }
+ entry . Get_Max (max_score, max_from);
+ max_row = 0;
+
+ // Do remaining rows
+ for (i = t_lo; i < t_hi; i ++)
+ {
+ r ++;
+
+ // First column in row
+ a . push_back (empty_vector);
+ entry . diag_score = entry . left_score = NEG_INFTY_SCORE;
+ entry . top_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ a [r] . push_back (entry);
+
+ // Remaining columns in row
+ for (c = 1; c <= s_len; c ++)
+ {
+ Align_Score_Entry_t * p;
+
+ p = & (a [r - 1] [c]);
+ p -> Get_Max (mxs, mxf);
+ if (mxf != FROM_TOP)
+ mxs += gap_score;
+ mxs += indel_score;
+ entry . top_score = mxs;
+ entry . top_from = mxf;
+
+ p = & (a [r - 1] [c - 1]);
+ if (p -> left_score < p -> diag_score)
+ {
+ entry . diag_score = p -> diag_score;
+ entry . diag_from = FROM_DIAG;
+ }
+ else
+ {
+ entry . diag_score = p -> left_score;
+ entry . diag_from = FROM_LEFT;
+ }
+ if (entry . diag_score < p -> top_score)
+ {
+ entry . diag_score = p -> top_score;
+ entry . diag_from = FROM_TOP;
+ }
+ entry . diag_score += ((t [i] == s [c - 1]) ? match_score : mismatch_score);
+
+ p = & (a [r] [c - 1]);
+ if (p -> left_score < p -> diag_score)
+ {
+ entry . left_score = p -> diag_score + gap_score;
+ entry . left_from = FROM_DIAG;
+ }
+ else
+ {
+ entry . left_score = p -> left_score; // Don't add gap_score here
+ entry . left_from = FROM_LEFT;
+ }
+ if (entry . left_score < p -> top_score)
+ {
+ entry . left_score = p -> top_score + gap_score;
+ entry . left_from = FROM_TOP;
+ }
+ entry . left_score += indel_score;
+ a [r] . push_back (entry);
+#if 0
+entry . Get_Max (mxs, mxf);
+printf ("r = %d c = %d mxs = %d mxf = %u max_score = %d max_row = %d\n",
+ r, c, mxs, mxf, max_score, max_row);
+printf ("L = %d:%u D = %d:%u T = %d:%u\n", entry . left_score, entry . left_from,
+ entry . diag_score, entry . diag_from, entry . top_score, entry . top_from);
+#endif
+ }
+
+ entry . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = r;
+ }
+ }
+
+ r = max_row;
+ c = s_len;
+ ct = 0;
+ sign = 0;
+ while (c > 0)
+ {
+#if 0
+{
+ int mxs;
+ unsigned int mxf;
+
+ a [r] [c] . Get_Max (mxs, mxf);
+
+ printf ("r = %d c = %d mxs = %d mxf = %u\n", r, c, mxs, mxf);
+ printf ("sign = %d ct = %d\n", sign, ct);
+}
+#endif
+ switch (max_from)
+ {
+ case FROM_LEFT :
+ if (sign != 0)
+ {
+ if (Verbose > 2)
+ printf ("del = %d\n", sign * ct);
+ delta . push_back (sign * ct);
+ }
+ ct = 1;
+ sign = -1;
+ max_from = a [r] [c] . left_from;
+ c --;
+ break;
+ case FROM_DIAG :
+ ct ++;
+ max_from = a [r] [c] . diag_from;
+ r --;
+ c --;
+ break;
+ case FROM_TOP :
+ if (sign != 0)
+ {
+ if (Verbose > 2)
+ printf ("del = %d\n", sign * ct);
+ delta . push_back (sign * ct);
+ }
+ ct = 1;
+ sign = 1;
+ max_from = a [r] [c] . top_from;
+ r --;
+ break;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad from = %u in Global_Align",
+ max_from);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ }
+
+ if (sign != 0)
+ {
+ if (Verbose > 2)
+ printf ("del = %d\n", sign * ct);
+ delta . push_back (sign * ct);
+ }
+
+ align . a_lo = 0;
+ align . a_hi = s_len;
+ align . b_hi = max_row + t_lo;
+ align . b_lo = r + t_lo;
+
+ reverse (delta . begin (), delta . end ());
+ n = delta . size ();
+ if (Verbose > 2)
+ for (i = 0; i < n; i ++)
+ printf ("delta [%d] = %d\n", i, delta [i]);
+
+ align . setDelta (delta);
+
+ return;
+ }
+
+
+
+void Incr_Opposite
+ (vector <Phase_Entry_t> & v, int from, int to)
+
+// Increment opposite_ct in v [i] that matches from and
+// to . If none is found, then add a new one and set its
+// oppostie_ct to 1 and its same_ct to 0 .
+
+ {
+ Phase_Entry_t p;
+ int i, n;
+
+ n = v . size ();
+ for (i = 0; i < n; i ++)
+ if (v [i] . to == to)
+ {
+ assert (v [i] . from = from);
+ v [i] . opposite_ct ++;
+ return;
+ }
+
+ p . from = from;
+ p . to = to;
+ p . opposite_ct = 1;
+ p . same_ct = 0;
+ p . weight = 0;
+
+ v . push_back (p);
+
+ return;
+ }
+
+
+
+void Incr_Same
+ (vector <Phase_Entry_t> & v, int from, int to)
+
+// Increment same_ct in v [i] that matches from and
+// to . If none is found, then add a new one and set its
+// same_ct to 1 and its opposite_ct to 0 .
+
+ {
+ Phase_Entry_t p;
+ int i, n;
+
+ n = v . size ();
+ for (i = 0; i < n; i ++)
+ if (v [i] . to == to)
+ {
+ assert (v [i] . from = from);
+ v [i] . same_ct ++;
+ return;
+ }
+
+ p . from = from;
+ p . to = to;
+ p . same_ct = 1;
+ p . opposite_ct = 0;
+ p . weight = 0;
+
+ v . push_back (p);
+
+ return;
+ }
+
+
+
+bool Is_Distinguishing
+ (unsigned char ct [5], char & ch1, int & ch1_ct,
+ char & ch2, int & ch2_ct)
+
+// Check if values in ct indicate a polymorphism. If so set
+// ch1 and ch2 to the most frequenct characters and
+// ch1_ct and ch2_ct to the number of occurrences of each.
+
+ {
+ int sub1, sub2;
+ int i;
+
+ ch1_ct = ct [0];
+ sub1 = 0;
+ ch2_ct = 0;
+
+ for (i = 1; i < 5; i ++)
+ if (ch2_ct < ct [i])
+ {
+ if (ch1_ct < ct [i])
+ {
+ ch2_ct = ch1_ct;
+ sub2 = sub1;
+ ch1_ct = ct [i];
+ sub1 = i;
+ }
+ else
+ {
+ ch2_ct = ct [i];
+ sub2 = i;
+ }
+ }
+
+ // Simple version that makes a column distinguishing if it has
+ // >= 3 occurrences of 3 or more characters
+ // Should probably make alternative version that uses quality values
+ if (ch1_ct >= 3 && ch2_ct >= 3)
+ {
+ ch1 = Sub_To_DNA_Char (sub1);
+ ch2 = Sub_To_DNA_Char (sub2);
+ return true;
+ }
+
+ return false;
+ }
+
+
+
+int Match_Count
+ (const vector <int> & a, const vector <int> & b)
+
+// Return the number of entries in a that are also in b
+// Assume each list is in ascending sorted order without
+// duplicates.
+
+ {
+ int i, j, m, n, ct;
+
+ m = a . size ();
+ n = b . size ();
+
+ i = j = ct = 0;
+ while (i < m && j < n)
+ {
+ if (a [i] < b [j])
+ i ++;
+ else if (b [j] < a [i])
+ j ++;
+ else
+ {
+ ct ++;
+ i ++;
+ j ++;
+ }
+ }
+
+ return ct;
+ }
+
+
+
+void Multi_Align
+ (const string & id, vector <char *> & s, vector <int> & offset,
+ int offset_delta, double error_rate, int min_overlap,
+ Gapped_Multi_Alignment_t & gma, vector <int> * ref,
+ vector <char *> * tag_list, bool allow_expels)
+
+// id is the id of the contig being multi-aligned.
+// Create multialignment in gma of strings s each of which has
+// a nominal offset from its predecessor of offset . offset_delta is
+// the number of positions by which the offset is allowed to vary in
+// either direction. error_rate is the maximum expected error rate
+// in alignments between strings. It should be twice the expected error
+// rate to the real reference string to allow for independent errors
+// in separate strings. Strings must overlap by at least min_overlap
+// bases (unless forced). The value of offset [0] must be zero.
+// If ref isn't NULL then make its values be the subscripts of
+// the original locations of the entries in s in case they are
+// shifted. If tag_list isn't NULL , then use its values to identify
+// the strings in s and shift them along with the entries in s .
+// If allow_expels is true, then reads can be left out of the multialignment
+// if doing so does not separate the multialignment into disjoint segments
+
+ {
+ Multi_Alignment_t ma;
+ vector <Vote_t> vote;
+ vector <int> s_len;
+ bool changed;
+ int i, n, ct;
+
+ n = s . size ();
+ if (n == 0)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Multi_Align for contig %s called with no strings",
+ id . c_str ());
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ if (n != int (offset . size ()))
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Multi_Align for contig %s called with %d strings and %d offsets",
+ id . c_str (), n, int (offset . size ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ if (offset [0] != 0)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Multi_Align for contig %s called with non-zero offset [0] = %d",
+ id . c_str (), offset [0]);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ for (i = 0; i < n; i ++)
+ s_len . push_back (strlen (s [i]));
+
+ // Sort the sequence strings in s and sequence length in s_len by increasing
+ // sequence offset
+ Sort_Strings_And_Offsets (s, s_len, offset, ref, tag_list);
+
+ ma . setID (id);
+ ma . Set_Initial_Consensus (s, offset, offset_delta, error_rate, min_overlap,
+ vote, tag_list, allow_expels);
+
+ ct = 0;
+ do
+ {
+ ma . Reset_From_Votes (s, offset_delta, error_rate, vote, changed);
+ ct ++;
+ } while (ct < MAX_REFINEMENTS && changed);
+
+ if (Verbose > 3)
+ ma . Print_Alignments_To_Consensus (stderr, s);
+
+ gma . Convert_From (ma);
+
+ gma . Sort (s, ref, tag_list);
+
+ return;
+ }
+
+
+
+void Overlap_Align
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int t_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align)
+
+// Find the best alignment of a prefix of string s to a
+// substring of t starting between positions t_lo and t_hi ,
+// where the alignment must extend to the end of one of the strings.
+// The length of s is s_len and the length of t is t_len .
+// The resulting alignment is stored in align ,
+// where s is the a string and t is the b string.
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+
+ {
+ double matrix_size;
+
+ if (Verbose > 3)
+ fprintf (stderr, "Overlap_Align: s_len = %d t_lo/hi/len = %d/%d/%d\n",
+ s_len, t_lo, t_hi, t_len);
+
+ assert (t_lo <= t_hi);
+ assert (t_hi <= t_len);
+ assert (0 <= s_len );
+
+ matrix_size = double (s_len) * (t_len - t_lo);
+
+ if (t_len - t_lo <= 10 || matrix_size <= MATRIX_SIZE_LIMIT)
+ Overlap_Align_Full_Matrix (s, s_len, t, t_lo, t_hi, t_len,
+ match_score, mismatch_score, indel_score, gap_score, align);
+ else
+ Overlap_Align_Save_Space (s, s_len, t, t_lo, t_hi, t_len,
+ match_score, mismatch_score, indel_score, gap_score, align);
+
+ return;
+ }
+
+
+
+void Overlap_Align_Full_Matrix
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int t_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align)
+
+// Find the best alignment of a prefix of string s to a
+// substring of t starting between postions t_lo and t_hi ,
+// where the alignment must extend to the end of one of the strings.
+// The length of s is s_len and the length of t is t_len .
+// The resulting alignment is stored in align ,
+// where s is the a string and t is the b string.
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+// Use a full matrix for the computation.
+
+ {
+ vector < vector <Align_Score_Entry_t> > a; // the alignment array
+ vector <Align_Score_Entry_t> empty_vector;
+ vector <int> delta;
+ Align_Score_Entry_t entry;
+ int r, c; // row and column
+ unsigned int max_from, mxf;
+ int max_row, max_col, max_score, mxs;
+ int error_ct, row_limit;
+ int i, n; // position in string t
+
+ // Do first row
+
+ if (Verbose > 0)
+ fprintf (stderr, "Overlap_Align_Full_Matrix:\n");
+
+ a . push_back (empty_vector);
+ entry . diag_score = entry . top_score = entry . left_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ r = 0;
+ a [r] . push_back (entry);
+ for (c = 1; c <= s_len; c ++)
+ {
+ entry . top_score = NEG_INFTY_SCORE;
+ entry . top_from = FROM_NOWHERE;
+ entry . diag_score = NEG_INFTY_SCORE;
+ entry . diag_from = FROM_NOWHERE;
+ entry . left_score = a [r] [c - 1] . left_score + indel_score;
+ if (c == 1)
+ entry . left_score += gap_score;
+ entry . left_from = FROM_LEFT;
+ a [r] . push_back (entry);
+ }
+ entry . Get_Max (max_score, max_from);
+ max_row = 0;
+
+ // Do remaining rows
+ for (i = t_lo; i < t_len; i ++)
+ {
+ r ++;
+
+ // First column in row
+ a . push_back (empty_vector);
+ entry . diag_score = entry . left_score = NEG_INFTY_SCORE;
+ if (i < t_hi - 1)
+ {
+ entry . top_score = 0;
+ entry . top_from = FROM_NOWHERE;
+ }
+ else
+ {
+ entry . top_score = a [r - 1] [0] . top_score + indel_score;
+ if (i == t_hi - 1)
+ entry . top_score += gap_score;
+ entry . top_from = FROM_TOP;
+ }
+ entry . diag_from = entry . left_from = FROM_NOWHERE;
+ a [r] . push_back (entry);
+
+ // Remaining columns in row
+ for (c = 1; c <= s_len; c ++)
+ {
+ Align_Score_Entry_t * p;
+
+ p = & (a [r - 1] [c]);
+ p -> Get_Max_Top (mxs, mxf, gap_score);
+ entry . top_score = mxs + indel_score;
+ entry . top_from = mxf;
+
+ p = & (a [r - 1] [c - 1]);
+ p -> Get_Max (mxs, mxf);
+ entry . diag_score = mxs;
+ entry . diag_from = mxf;
+ entry . diag_score += ((t [i] == s [c - 1]) ? match_score : mismatch_score);
+
+ p = & (a [r] [c - 1]);
+ p -> Get_Max_Left (mxs, mxf, gap_score);
+ entry . left_score = mxs + indel_score;
+ entry . left_from = mxf;
+ a [r] . push_back (entry);
+ }
+
+ // check last entry in row to find max
+ entry . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = r;
+ max_col = s_len;
+ }
+ }
+
+ // See if get better max in the last row
+ for (c = 0; c <= s_len; c ++)
+ {
+ a [r] [c] . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = r;
+ max_col = c;
+ }
+ }
+
+ // Trace back
+ r = max_row;
+ c = max_col;
+ row_limit = t_hi - t_lo - 1;
+ Trace_Back_Align_Path (a, r, c, row_limit, 0, delta,
+ error_ct, s, t + t_lo);
+
+ align . a_lo = 0;
+ align . a_hi = max_col;
+ align . b_hi = max_row + t_lo;
+ align . b_lo = r + t_lo;
+ align . errors = error_ct;
+
+ if (Verbose > 2)
+ {
+ n = delta . size ();
+ for (i = 0; i < n; i ++)
+ printf ("delta [%d] = %d\n", i, delta [i]);
+ }
+
+ align . setDelta (delta);
+
+ return;
+ }
+
+
+
+void Overlap_Align_Save_Space
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int t_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align)
+
+// Find the best alignment of a prefix of string s to a
+// substring of t starting between postions t_lo and t_hi ,
+// where the alignment must extend to the end of one of the strings.
+// The length of s is s_len and the length of t is t_len .
+// The resulting alignment is stored in align ,
+// where s is the a string and t is the b string.
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+// Do recursively keeping just a finite number of rows
+
+ {
+ Alignment_t sub_ali_1, sub_ali_2;
+ vector <Augmented_Score_Entry_t> align_row;
+ // row of alignment array
+ Augmented_Score_Entry_t entry, last_entry;
+ int t_half, t_slip;
+ int max_row, max_col, max_score, mxs, max_ref;
+ unsigned int max_from, mxf;
+ int r, c;
+
+ if (Verbose > 3)
+ fprintf (stderr, "Overlap_Align_Save_Space:\n");
+
+ // Build first row
+
+ entry . diag_score = entry . top_score = entry . left_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ entry . top_ref = entry . diag_ref = entry . left_ref = 0;
+ align_row . push_back (entry);
+ for (c = 1; c <= s_len; c ++)
+ {
+ entry . top_score = NEG_INFTY_SCORE;
+ entry . top_from = FROM_NOWHERE;
+ entry . diag_score = NEG_INFTY_SCORE;
+ entry . diag_from = FROM_NOWHERE;
+ entry . left_score = align_row [c - 1] . left_score + indel_score;
+ if (c == 1)
+ entry . left_score += gap_score;
+ entry . left_from = FROM_LEFT;
+ entry . left_ref = 0;
+ entry . top_ref = entry . diag_ref = -1;
+ align_row . push_back (entry);
+ }
+ entry . Get_Max (max_score, max_from);
+ max_row = t_lo;
+ max_col = s_len;
+ max_ref = 0;
+
+ // Do remaining rows
+
+ t_half = (t_lo + t_len) / 2;
+ for (r = t_lo + 1; r <= t_len; r ++)
+ {
+ int first_score;
+
+ if (r < t_hi)
+ first_score = 0;
+ else if (r == t_hi)
+ first_score = indel_score + gap_score;
+ else
+ first_score = indel_score;
+
+ Align_Row_Update (align_row, t [r - 1], s, s_len, match_score,
+ mismatch_score, indel_score, gap_score, first_score);
+
+ if (r == t_half)
+ { // set the ref entries to reference this row
+ align_row [0] . top_ref = 0;
+ for (c = 1; c <= s_len; c ++)
+ {
+ align_row [c] . top_ref = align_row [c] . diag_ref = c;
+ align_row [c - 1] . Get_Max_Left (mxs, mxf, gap_score);
+ align_row [c] . left_ref = align_row [c - 1] . Get_Ref (mxf);
+ }
+ }
+
+ // Check last column entry for max
+ align_row [s_len] . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = r;
+ max_col = s_len;
+ max_ref = align_row [s_len] . Get_Ref (mxf);
+ }
+ }
+
+ // Check entries in last row for max
+ for (c = 0; c <= s_len; c ++)
+ {
+ align_row [c] . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = t_len;
+ max_col = c;
+ max_ref = align_row [c] . Get_Ref (mxf);
+ }
+ }
+
+ t_slip = Min (t_hi, max_row);
+ if (Verbose > 3)
+ fprintf (stderr,
+ "max_row/col = %d/%d t_lo = %d t_slip = %d t_half = %d t_hi = %d\n",
+ max_row, max_col, t_lo, t_slip, t_half, t_hi);
+ if (max_row <= t_half)
+ {
+ // only need one recursive call on the first half of the alignment
+ Complete_Align (s, 0, s_len, t, t_lo, t_slip, max_row,
+ match_score, mismatch_score, indel_score, gap_score, NULL,
+ entry, align);
+
+ return;
+ }
+
+ if (max_col == 0 && t_half < t_hi)
+ {
+ // only need one recursive call on the second half of the alignment
+ // because the best start for the alignment is after t_half
+ Complete_Align (s, 0, s_len, t, t_half, t_hi, max_row,
+ match_score, mismatch_score, indel_score, gap_score, NULL,
+ entry, align);
+
+ return;
+ }
+
+ t_slip = Min (t_hi, t_half);
+ if (Verbose > 3)
+ fprintf (stderr,
+ "max_ref = %d t_lo = %d t_slip = %d t_half = %d t_hi = %d\n",
+ max_ref, t_lo, t_slip, t_half, t_hi);
+ Complete_Align (s, 0, max_ref, t, t_lo, t_slip, t_half,
+ match_score, mismatch_score, indel_score, gap_score,
+ NULL, entry, sub_ali_1);
+
+ if (max_ref == 0)
+ t_slip = Max (t_hi, t_half + 1);
+ else
+ t_slip = t_half + 1;
+ Complete_Align (s, max_ref, max_col, t, t_half, t_slip,
+ max_row, match_score, mismatch_score, indel_score, gap_score,
+ & entry, last_entry, sub_ali_2);
+
+ align . Combine (sub_ali_1, sub_ali_2);
+
+ return;
+ }
+
+
+
+bool Overlap_Match_VS
+ (const char * s, int s_len, const char * t, int t_len,
+ int lo_off, int hi_off, int min_len, int max_errors,
+ Alignment_t & align)
+
+// Return whether there is an overlap between string s and string
+// t starting at a position in the range lo_off .. hi_off wrt
+// string t . These values must be non-negative. The overlap region
+// can have at most max_errors errors and must be at least min_len
+// long in both s and t (length can differ because of indels).
+// The length of s is s_len and the length of t is t_len .
+// If successful, the alignment is stored in align .
+// Uses Vishkin_Schieber (e * n) algorithm. Errors are inserts,
+// deletes or substitutions. Returns the best match found, i.e.,
+// the match with the lowest errors/overlap_len ratio, where
+// overlap_len is the average of the lengths of the two strings'
+// overlap regions.
+
+ {
+ static Match_Extent_Entry_t * space = NULL;
+ static int space_size = 0;
+ static Match_Extent_Entry_t * * tab = NULL;
+ static int tab_size = 0;
+ int space_needed;
+ bool found;
+ int complete_match, possible_len;
+ int e, i, best_i;
+
+ if (Verbose > 3)
+ {
+ fprintf (stderr, "In Overlap_Match_VS lo_off = %d hi_off = %d\n",
+ lo_off, hi_off);
+ }
+
+ lo_off = Max (0, lo_off);
+ hi_off = Min (hi_off, t_len - min_len);
+
+ if (hi_off < lo_off || s_len < min_len)
+ return false; // No match possible
+
+ if (max_errors < 0)
+ {
+ sprintf (Clean_Exit_Msg_Line, "ERROR: max_errors = %d < 0", max_errors);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ // allocate more memory if necessary
+ space_needed = (1 + max_errors) * (max_errors + 1 + hi_off - lo_off);
+ if (space_needed > space_size)
+ {
+ space_size = space_needed;
+ space = (Match_Extent_Entry_t *) Safe_realloc
+ (space, space_size * sizeof (Match_Extent_Entry_t),
+ __FILE__, __LINE__);
+ }
+ if (1 + max_errors > tab_size)
+ {
+ tab_size = 1 + max_errors;
+ tab = (Match_Extent_Entry_t * *) Safe_realloc
+ (tab, tab_size * sizeof (Match_Extent_Entry_t *),
+ __FILE__, __LINE__);
+ }
+
+ // tab points to the logical start of each row of
+ // (truncated) pyramidal array with entries for (lo_off .. hi_off)
+ // in the zeroth row and extending one to the left and one to the
+ // right every row after that
+
+ tab [0] = space - lo_off;
+
+ // find how far can match at each spot with zero errors
+ // Could do better maybe using KMP here
+ for (i = lo_off; i <= hi_off; i ++)
+ {
+ possible_len = Min (s_len, t_len - i);
+ tab [0] [i] . len = Exact_Prefix_Match (s, t + i, possible_len);
+ tab [0] [i] . from = MATCH_FROM_TOP;
+ if (tab [0] [i] . len == possible_len)
+ { // match found
+ align . Set_Exact (0, i, possible_len);
+ return true;
+ }
+ }
+
+ // now progressively try more errors
+ found = false;
+ best_i = lo_off - max_errors - 2;
+
+ for (e = 1; e <= max_errors && ! found; e ++)
+ {
+ int prev_match;
+
+ tab [e] = tab [e - 1] + hi_off - lo_off + 2 * e;
+
+ i = lo_off - e;
+ complete_match = Min (s_len, t_len - i);
+ prev_match = tab [e - 1] [i + 1] . len;
+ possible_len = Min (s_len - prev_match - 1,
+ t_len - i - prev_match - 1);
+ tab [e] [i] . len = prev_match + 1
+ + Exact_Prefix_Match (s + prev_match + 1, t + i + prev_match + 1,
+ possible_len);
+ tab [e] [i] . from = MATCH_FROM_NE;
+ if (tab [e] [i] . len == complete_match)
+ {
+ found = true;
+ best_i = i;
+ }
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d NE len = %d poss_len = %d\n",
+ e, i, tab [e] [i] . len, possible_len);
+
+ for (i = lo_off - e + 1; i <= hi_off + e - 1; i ++)
+ {
+ int next;
+
+ complete_match = Min (s_len, t_len - i);
+
+ prev_match = tab [e - 1] [i] . len;
+ possible_len = Min (s_len - prev_match - 1,
+ t_len - i - prev_match - 1);
+ tab [e] [i] . len = prev_match + 1
+ + Exact_Prefix_Match (s + prev_match + 1, t + i + prev_match + 1,
+ possible_len);
+ tab [e] [i] . from = MATCH_FROM_TOP;
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d TOP len = %d poss_len = %d\n",
+ e, i, tab [e] [i] . len, possible_len);
+
+ if (i > lo_off - e + 1)
+ {
+ prev_match = tab [e - 1] [i - 1] . len;
+ possible_len = Min (s_len - prev_match,
+ t_len - i - prev_match);
+ next = prev_match
+ + Exact_Prefix_Match
+ (s + prev_match, t + i + prev_match,
+ possible_len);
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d NW len = %d poss_len = %d\n",
+ e, i, next, possible_len);
+ if (next > tab [e] [i] . len)
+ {
+ tab [e] [i] . len = next;
+ tab [e] [i] . from = MATCH_FROM_NW;
+ }
+ }
+
+ if (i < hi_off + e - 1)
+ {
+ prev_match = tab [e - 1] [i + 1] . len;
+ possible_len = Min (s_len - prev_match - 1,
+ t_len - i - prev_match - 1);
+ next = prev_match + 1
+ + Exact_Prefix_Match
+ (s + prev_match + 1, t + i + prev_match + 1,
+ possible_len);
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d NE len = %d poss_len = %d\n",
+ e, i, next, possible_len);
+ if (next > tab [e] [i] . len)
+ {
+ tab [e] [i] . len = next;
+ tab [e] [i] . from = MATCH_FROM_NE;
+ }
+ }
+
+ // Prefer MATCH_FROM_TOP if there are consecutive matches
+ if (tab [e] [i] . len == complete_match)
+ {
+ if (tab [e] [i] . from == MATCH_FROM_TOP)
+ {
+ best_i = i;
+ found = true;
+ break;
+ }
+ else if (! found)
+ {
+ found = true;
+ best_i = i;
+ }
+ }
+ else if (found)
+ break;
+ }
+
+ if (! found)
+ {
+ i = hi_off + e;
+ complete_match = Min (s_len, t_len - i);
+ prev_match = tab [e - 1] [i - 1] . len;
+ possible_len = Min (s_len - prev_match,
+ t_len - i - prev_match);
+ tab [e] [i] . len = prev_match
+ + Exact_Prefix_Match (s + prev_match, t + i + prev_match,
+ possible_len);
+ tab [e] [i] . from = MATCH_FROM_NW;
+ if (tab [e] [i] . len == complete_match)
+ {
+ best_i = i;
+ found = true;
+ }
+ }
+ }
+
+ if (Verbose > 1)
+ Print_VS_Table (stderr, tab, lo_off, hi_off + 1, e, best_i, found);
+
+ if (found)
+ {
+ align . Set_From_VS_Matrix (tab, e - 1, best_i);
+ return true;
+ }
+
+ return false;
+ }
+
+
+
+void Print_Align_Lines_Pair
+ (FILE * fp, const string & s, const string & t, int len,
+ const char * s_label, const char * t_label,
+ int s_lo, int s_hi, int t_lo, int t_hi)
+
+// Print to fp alignment lines s and t , each of length len .
+// Print s_label at the beginning of the s line and t_label
+// at the beginning of the t line, and print the ranges
+// s_lo .. s_hi and t_lo .. t_hi at the right of the lines.
+// Also print a line of carets underneath the s and t lines
+// with a caret beneath every position where the s and t
+// entries differ.
+
+ {
+ int s_label_len, t_label_len;
+ int i;
+
+ // In case s_label and t_label aren't the same length
+ // we'll use the longer of the two and right align them
+
+ s_label_len = strlen (s_label);
+ t_label_len = strlen (t_label);
+ if (s_label_len < t_label_len)
+ s_label_len = t_label_len;
+
+ fprintf (fp, "%*s ", s_label_len, s_label);
+ for (i = 0; i < len; i ++)
+ fputc (s [i], fp);
+ fprintf (fp, " (%d-%d)\n", s_lo, s_hi);
+
+ fprintf (fp, "%*s ", s_label_len, t_label);
+ for (i = 0; i < len; i ++)
+ fputc (t [i], fp);
+ fprintf (fp, " (%d-%d)\n", t_lo, t_hi);
+
+ fprintf (fp, "%*s ", s_label_len, "");
+ for (i = 0; i < len; i ++)
+ fputc (s [i] == t [i] ? ' ' : '^', fp);
+ fputc ('\n', fp);
+
+ return;
+ }
+
+
+
+void Print_VS_Table
+ (FILE * fp, Match_Extent_Entry_t * * tab, int t_lo, int t_hi, int e,
+ int best_i, bool found)
+
+// Print to fp the entries in tab for columns t_lo - e .. t_hi + e
+// and rows 0 .. e - 1 . End the last row at column best_i .
+// Also print the value of found .
+
+ {
+ int i, j;
+
+ fprintf (stderr, "e = %d best_i = %d found = %c\n",
+ e, best_i, found ? 'T' : 'F');
+ fprintf (stderr, "%3s ", "e");
+ for (j = t_lo - e + 1; j < t_hi + e - 1; j ++)
+ fprintf (stderr, " %3d ", j);
+ fputc ('\n', stderr);
+
+ if (! found)
+ best_i = t_hi + e - 1;
+
+ for (i = 0; i < e; i ++)
+ {
+ fprintf (stderr, "%2d: ", i);
+
+ for (j = t_lo - e + 1; (i < e - 1 && j < t_hi + e - 1)
+ || (i == e - 1 && j <= best_i); j ++)
+ if (j < t_lo - i || j >= t_hi + i)
+ fprintf (stderr, " %3s ", "-");
+ else
+ {
+ char ch;
+ switch (tab [i] [j] . from)
+ {
+ case -1 :
+ ch = 'r';
+ break;
+ case 0 :
+ ch = 't';
+ break;
+ case 1 :
+ ch = 'l';
+ break;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "ERROR: from = %d\n",
+ tab [i] [j] . from);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ fprintf (stderr, " %3d%c", tab [i] [j] . len, ch);
+ }
+ fputc ('\n', stderr);
+ }
+ }
+
+
+
+bool Range_Intersect
+ (int a_lo, int a_hi, int b_lo, int b_hi)
+
+// Return true iff the substring range a_lo .. a_hi overlaps the
+// substring range b_lo .. b_hi .
+
+ {
+ if (a_lo == a_hi)
+ return false; // a is empty
+
+ if (a_hi <= b_lo || a_lo >= b_hi)
+ return false;
+
+ return true;
+ }
+
+
+
+void Simple_Overlap
+ (const char * s, int s_len, const char * t, int t_len,
+ Simple_Overlap_t & olap, int match_score,
+ int mismatch_score,
+ int indel_score,
+ int gap_score)
+
+// Find the highest-scoring overlap alignment between string s and
+// string t , i.e., an alignment the extends to the end of either
+// of the two strings on each end.
+// The length of s is s_len and the length of t is t_len .
+// The resulting overlap is stored in olap .
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+
+ {
+ vector <Errors_Score_Entry_t> align_row;
+ // row of alignment array
+ Errors_Score_Entry_t entry;
+ int max_row, max_col, max_score, mxs, max_ref, max_errors;
+ unsigned int max_from, mxf;
+ int r, c;
+
+ // Create the first row of the alignment matrix
+ entry . diag_score = entry . top_score = entry . left_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ entry . diag_errors = entry . top_errors = entry . left_errors = 0;
+
+ for (c = 0; c <= s_len; c ++)
+ {
+ entry . top_ref = entry . diag_ref = entry . left_ref = c;
+ align_row . push_back (entry);
+ }
+
+ entry . Get_Max (max_score, max_from);
+ max_row = 0;
+ max_col = s_len;
+ max_ref = s_len;
+
+ // Do remaining rows
+ for (r = 1; r <= t_len; r ++)
+ {
+ align_row [0] . top_ref = align_row [0] . diag_ref
+ = align_row [0] . left_ref = 1 - r;
+ // is value of current row, not one being built
+ Align_Row_Update_With_Errors (align_row, t [r - 1], s, s_len, match_score,
+ mismatch_score, indel_score, gap_score, 0, 0);
+
+ // Check last column entry for max
+ align_row [s_len] . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = r;
+ max_col = s_len;
+ max_ref = align_row [s_len] . Get_Ref (mxf);
+ max_errors = align_row [s_len] . Get_Errors (mxf);
+ }
+ }
+
+ // Check entries in last row for max
+ for (c = 0; c <= s_len; c ++)
+ {
+ align_row [c] . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = t_len;
+ max_col = c;
+ max_ref = align_row [c] . Get_Ref (mxf);
+ max_errors = align_row [c] . Get_Errors (mxf);
+ }
+ }
+
+ if (Verbose > 2)
+ printf ("row = %d col = %d ref = %d score = %d s_len = %d t_len = %d\n",
+ max_row, max_col, max_ref, max_score, s_len, t_len);
+
+ olap . score = max_score;
+ olap . errors = max_errors;
+ olap . a_hang = max_ref;
+ if (max_col < s_len)
+ olap . b_hang = max_col - s_len;
+ else
+ olap . b_hang = t_len - max_row;
+ if (max_ref >= 0)
+ {
+ olap . b_olap_len = max_row;
+ olap . a_olap_len = max_col - max_ref;
+ }
+ else
+ {
+ olap . b_olap_len = max_row + max_ref;
+ olap . a_olap_len = max_col;
+ }
+
+ return;
+ }
+
+
+
+void Sort_Strings_And_Offsets
+ (vector <char *> & s, vector <int> & s_len, vector <int> & offset,
+ vector <int> * ref, vector <char *> * tag_list)
+
+// Sort the strings in s (together with their lengths in s_len )
+// into order so that all their offsets
+// are non-negative. Adjust the values in offset accordingly.
+// Use lengths to resolve tied offsets preferring to put
+// longer strings first.
+// Use insertion sort since most offsets should be positive.
+// If ref isn't NULL, then set it to the subscripts of the
+// positions of the entries in s and offset before they were
+// changed. If tag_list isn't NULL , then also sort its entries.
+// Note: These offsets are relative to the preceding string, so
+// only non-positive values need to be moved.
+
+ {
+ int i, j, n;
+
+ n = offset . size ();
+ if (n != int (s . size ()))
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Sorting %d strings with %d offsets\n",
+ int (s . size ()), n);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ if (ref != NULL)
+ {
+ ref -> resize (n);
+ for (i = 0; i < n; i ++)
+ (* ref) [i] = i;
+ }
+
+ for (i = 1; i < n; i ++)
+ {
+ char * s_save, * t_save;
+ int o_save, r_save, l_save;
+
+ if (0 < offset [i])
+ continue;
+
+ s_save = s [i];
+ l_save = s_len [i];
+ o_save = offset [i];
+ if (tag_list != NULL)
+ t_save = (* tag_list) [i];
+ if (ref != NULL)
+ r_save = (* ref) [i];
+ if (i < n - 1)
+ offset [i + 1] += o_save;
+
+ for (j = i; j > 0 && (o_save < 0 || (o_save == 0 && s_len [j - 1] < l_save));
+ j --)
+ {
+ o_save += offset [j - 1];
+ offset [j] = offset [j - 1];
+ s [j] = s [j - 1];
+ s_len [j] = s_len [j - 1];
+ if (tag_list != NULL)
+ (* tag_list) [j] = (* tag_list) [j - 1];
+ if (ref != NULL)
+ (* ref) [j] = (* ref) [j - 1];
+ }
+
+ s [j] = s_save;
+ s_len [j] = l_save;
+ offset [j] = o_save;
+ offset [j + 1] -= o_save;
+ if (tag_list != NULL)
+ (* tag_list) [j] = t_save;
+ if (ref != NULL)
+ (* ref) [j] = r_save;
+ }
+
+ return;
+ }
+
+
+
+bool Substring_Match_VS
+ (const char * s, int s_len, const char * t, int t_len,
+ int t_lo, int t_hi, int max_errors, Alignment_t & align)
+
+// Return whether string s is contained as a substring within
+// string t with at most max_errors errors. The length of
+// s is s_len and the length of t is t_len . The match
+// must start within t between positions t_lo and t_hi (gap
+// coordinates). If successful, the alignment is stored in align .
+// Uses Vishkin_Schieber (e * n) algorithm. Errors are inserts,
+// deletes or substitutions. Returns first match found, i.e., the
+// one beginning closest to t_lo (in case there is more than one).
+
+ {
+ static Match_Extent_Entry_t * space = NULL;
+ static int space_size = 0;
+ static Match_Extent_Entry_t * * tab = NULL;
+ static int tab_size = 0;
+ int space_needed;
+ bool found;
+ int e, i, best_i;
+
+ if (Verbose > 3)
+ {
+ fprintf (stderr, "In Substring_Match_VS t_lo = %d t_hi = %d\n",
+ t_lo, t_hi);
+ }
+
+ if (t_hi <= t_lo)
+ return false; // No place for match to start
+
+ if (max_errors < 0)
+ {
+ sprintf (Clean_Exit_Msg_Line, "ERROR: max_errors = %d < 0", max_errors);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ // allocate more memory if necessary
+ space_needed = (1 + max_errors) * (max_errors + t_hi - t_lo);
+ if (space_needed > space_size)
+ {
+ space_size = space_needed;
+ space = (Match_Extent_Entry_t *) Safe_realloc
+ (space, space_size * sizeof (Match_Extent_Entry_t),
+ __FILE__, __LINE__);
+ }
+ if (1 + max_errors > tab_size)
+ {
+ tab_size = 1 + max_errors;
+ tab = (Match_Extent_Entry_t * *) Safe_realloc
+ (tab, tab_size * sizeof (Match_Extent_Entry_t *),
+ __FILE__, __LINE__);
+ }
+
+ // tab points to the logical start of each row of
+ // (truncated) pyramidal array with entries for (t_lo .. t_hi - 1)
+ // in the zeroth row and extending one to the left and one to the
+ // right every row after that
+
+ tab [0] = space - t_lo;
+
+ // find how far can match at each spot with zero errors
+ // Could do better maybe using KMP here
+ for (i = t_lo; i < t_hi; i ++)
+ {
+ tab [0] [i] . len = Exact_Prefix_Match (s, t + i, Min (s_len, t_len - i));
+ tab [0] [i] . from = MATCH_FROM_TOP;
+ if (tab [0] [i] . len == s_len)
+ { // match found
+ align . Set_Exact (0, i, s_len);
+ return true;
+ }
+ }
+
+ // now progressively try more errors
+ found = false;
+ best_i = t_lo - max_errors - 2;
+
+ for (e = 1; e <= max_errors && ! found; e ++)
+ {
+ int prev_match;
+
+ tab [e] = tab [e - 1] + t_hi - t_lo + 2 * e - 1;
+
+ i = t_lo - e;
+ prev_match = tab [e - 1] [i + 1] . len;
+ tab [e] [i] . len = prev_match + 1
+ + Exact_Prefix_Match (s + prev_match + 1, t + i + prev_match + 1,
+ Min (s_len - prev_match - 1,
+ t_len - i - prev_match - 1));
+ tab [e] [i] . from = MATCH_FROM_NE;
+ if (tab [e] [i] . len == s_len)
+ {
+ found = true;
+ best_i = i;
+ }
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d NE len = %d\n",
+ e, i, tab [e] [i] . len);
+
+ for (i = t_lo - e + 1; i < t_hi + e - 1; i ++)
+ {
+ int next;
+
+ prev_match = tab [e - 1] [i] . len;
+ tab [e] [i] . len = prev_match + 1
+ + Exact_Prefix_Match (s + prev_match + 1, t + i + prev_match + 1,
+ Min (s_len - prev_match - 1,
+ t_len - i - prev_match - 1));
+ tab [e] [i] . from = MATCH_FROM_TOP;
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d TOP len = %d\n",
+ e, i, tab [e] [i] . len);
+
+ if (i > t_lo - e + 1)
+ {
+ prev_match = tab [e - 1] [i - 1] . len;
+ next = prev_match
+ + Exact_Prefix_Match
+ (s + prev_match, t + i + prev_match,
+ Min (s_len - prev_match,
+ t_len - i - prev_match));
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d NW len = %d\n",
+ e, i, next);
+ if (next > tab [e] [i] . len)
+ {
+ tab [e] [i] . len = next;
+ tab [e] [i] . from = MATCH_FROM_NW;
+ }
+ }
+
+ if (i < t_hi + e - 2)
+ {
+ prev_match = tab [e - 1] [i + 1] . len;
+ next = prev_match + 1
+ + Exact_Prefix_Match
+ (s + prev_match + 1, t + i + prev_match + 1,
+ Min (s_len - prev_match - 1,
+ t_len - i - prev_match - 1));
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d NE len = %d\n",
+ e, i, next);
+ if (next > tab [e] [i] . len)
+ {
+ tab [e] [i] . len = next;
+ tab [e] [i] . from = MATCH_FROM_NE;
+ }
+ }
+
+ // Prefer MATCH_FROM_TOP if there are consecutive matches
+ if (tab [e] [i] . len == s_len)
+ {
+ if (tab [e] [i] . from == MATCH_FROM_TOP)
+ {
+ best_i = i;
+ found = true;
+ break;
+ }
+ else if (! found)
+ {
+ found = true;
+ best_i = i;
+ }
+ }
+ else if (found)
+ break;
+ }
+
+ if (! found)
+ {
+ i = t_hi + e - 1;
+ prev_match = tab [e - 1] [i - 1] . len;
+ tab [e] [i] . len = prev_match
+ + Exact_Prefix_Match (s + prev_match, t + i + prev_match,
+ Min (s_len - prev_match,
+ t_len - i - prev_match));
+ tab [e] [i] . from = MATCH_FROM_NW;
+ if (tab [e] [i] . len == s_len)
+ {
+ best_i = i;
+ found = true;
+ }
+ }
+ }
+
+ if (Verbose > 1)
+ Print_VS_Table (stderr, tab, t_lo, t_hi, e, best_i, found);
+
+ if (found)
+ {
+ align . Set_From_VS_Matrix (tab, e - 1, best_i);
+ return true;
+ }
+
+ return false;
+ }
+
+
+
+char Sub_To_DNA_Char
+ (int i)
+
+// Return the DNA character equivalent of subscript i .
+
+ {
+ static char convert [] = "acgt-";
+
+ if (i >= 5)
+ {
+ sprintf (Clean_Exit_Msg_Line, "ERROR: subscript %d >= 5",
+ i);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ return convert [i];
+ }
+
+
+
+void Trace_Back_Align_Path
+ (const vector < vector <Align_Score_Entry_t> > & a, int & r, int & c,
+ int r_start, int c_start, vector <int> & delta, int & errors,
+ const char * s, const char * t)
+
+// Trace back the alignment in a from row/column r / c back
+// to an entry with r <= r_start and c <= c_start .
+// Set delta to the delta-encoding for the alignment and set
+// errors to the number of errors in the alignment. Strings
+// s and t are the strings referred to by the matrix, s
+// for columns and t for rows.
+
+ {
+ int ct, sign, mxs;
+ unsigned int mxf;
+
+ a [r] [c] . Get_Max (mxs, mxf);
+ ct = sign = errors = 0;
+ delta . clear ();
+
+ while (r > r_start || c > c_start)
+ {
+ switch (mxf)
+ {
+ case FROM_LEFT :
+ if (sign != 0)
+ {
+ if (Verbose > 2)
+ printf ("del = %d\n", sign * ct);
+ delta . push_back (sign * ct);
+ }
+ ct = 1;
+ sign = -1;
+ mxf = a [r] [c] . left_from;
+ c --;
+ errors ++;
+ break;
+ case FROM_DIAG :
+ ct ++;
+ mxf = a [r] [c] . diag_from;
+ r --;
+ c --;
+ if (s [c] != t [r])
+ errors ++;
+ break;
+ case FROM_TOP :
+ if (sign != 0)
+ {
+ if (Verbose > 2)
+ printf ("del = %d\n", sign * ct);
+ delta . push_back (sign * ct);
+ }
+ ct = 1;
+ sign = 1;
+ mxf = a [r] [c] . top_from;
+ r --;
+ errors ++;
+ break;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad from = %u in Global_Align",
+ mxf);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ }
+
+ if (sign != 0)
+ {
+ if (Verbose > 2)
+ printf ("del = %d\n", sign * ct);
+ delta . push_back (sign * ct);
+ }
+
+ reverse (delta . begin (), delta . end ());
+
+ return;
+ }
+
+
+
+void Traverse
+ (int v, int par, vector < vector <Phase_Entry_t> > & tree,
+ vector <Distinguishing_Column_t> & dc, char ch, int & sum)
+
+// Set dc [v] . phase_char to ch and continue a depth-first
+// traversal of the tree in tree using the phase of the tree
+// edges to determine the next phase character. Increment
+// sum by ch * (dc [v] . (hapa_ct - hapb_ct)) .
+// par is the subscript of the parent of v in the tree.
+// Note: there must be *NO* cycles in tree except between
+// parent and child.
+
+ {
+ int i, n;
+
+ dc [v] . phase_ch = ch;
+ if (ch == '+')
+ sum += int (dc [v] . hapa_sub . size ())
+ - int (dc [v] . hapb_sub . size ());
+ else
+ sum += int (dc [v] . hapb_sub . size ())
+ - int (dc [v] . hapa_sub . size ());
+
+ n = tree [v] . size ();
+ for (i = 0; i < n; i ++)
+ if (tree [v] [i] . to != par)
+ {
+ if (tree [v] [i] . same_ct >= tree [v] [i] . opposite_ct)
+ Traverse (tree [v] [i] . to, v, tree, dc, ch, sum);
+ else
+ {
+ char flip_ch;
+
+ if (ch == '+')
+ flip_ch = '-';
+ else
+ flip_ch = '+';
+ Traverse (tree [v] [i] . to, v, tree, dc, flip_ch, sum);
+ }
+ }
+
+ return;
+ }
+
+
+
+int UF_Find
+ (int i, vector <int> & uf)
+
+// Return the subscript of the set leader of i in Union-Find
+// array uf .
+
+ {
+ int j;
+
+ for (j = i; uf [j] >= 0; j = uf [j])
+ ;
+
+ if (j == i)
+ return j;
+
+ while (uf [i] != j)
+ {
+ int k = uf [i];
+
+ uf [i] = j;
+ i = k;
+ }
+
+ return j;
+ }
+
+
+
+int UF_Find_With_Parity
+ (int i, vector <int> & uf, int & parity)
+
+// Return the subscript of the set leader of i in Union-Find
+// array uf and set parity to 0 if it's an even number of
+// edges from the leader in the UF tree or 1 if it's odd.
+// Maintain the parity of any other nodes when compressing the path.
+
+ {
+ int j, par, save;
+
+ parity = 0;
+ for (j = i; uf [j] >= 0; j = uf [j])
+ {
+ save = j;
+ parity = 1 - parity;
+ }
+
+ // save should now be the child of j (which is the root of
+ // the tree), on the path from i to the root.
+
+ if (j == i)
+ return j;
+
+ par = parity;
+ while (uf [i] != j)
+ {
+ int k = uf [i];
+
+ if (par == 0)
+ uf [i] = save;
+ else
+ uf [i] = j;
+ i = k;
+ par = 1 - par;
+ }
+
+ return j;
+ }
+
+
+
+void UF_Union
+ (int i, int j, vector <int> & uf)
+
+// Union the sets represented by i and j in Union-Find
+// array uf .
+
+ {
+ assert (uf [i] < 0 && uf [j] < 0);
+
+ if (uf [i] <= uf [j])
+ { // i is more negative, hence bigger
+ uf [i] += uf [j];
+ uf [j] = i;
+ }
+ else
+ { // j is more negative, hence bigger
+ uf [j] += uf [i];
+ uf [i] = j;
+ }
+
+ return;
+ }
+
+
+
+int Ungapped_Positions
+ (const string & s, int lo, int hi)
+
+// Return the number of non-'-' positions in string s
+// in the range lo .. hi , which are in gapped coordinates.
+
+ {
+ int i, n, ct;
+
+ n = s . length ();
+ if (hi > n)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: hi = %d > s . length () = %d in Ungapped_Positions\n",
+ hi, n);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ ct = 0;
+ for (i = lo; i < hi; i ++)
+ if (s [i] != '-')
+ ct ++;
+
+ return ct;
+ }
+
+
+
+void Update_Banded_Row
+ (vector <Errors_Score_Entry_t> & band, char ch, const char * s,
+ int s_len, int left_col, int right_col, int match_score,
+ int mismatch_score, int indel_score, int gap_score, int first_score,
+ int first_error)
+
+// Update band to be the values in the next row of an alignment
+// matrix where the preceding row is in band now.
+// The new band is shifted one to the right of the current band.
+// ch is the character for the next row and s (whose length is s_len )
+// is the characters across the top of the alignment matrix.
+// The current band represents columns left_col .. right_col in
+// the alignment matrix.
+// match_score , mismatch_score , indel_score and gap_score
+// are the scores for matching characters, mismatching characters,
+// insertion/deletion and initiating a gap, respectively.
+// first_score is the value to add to the first entry's top_score field.
+// first_error is the value to add to the first entry's top_errors field.
+
+ {
+ Errors_Score_Entry_t save, * p, * q;
+ int mxs;
+ unsigned int mxf;
+ int c, i, first, last;
+
+ assert (int (band . size ()) == 1 + right_col - left_col);
+
+ // Fill in the first cell
+ if (left_col < 0)
+ {
+ first = -1 - left_col;
+ c = 0;
+ p = & (band [first]);
+ q = & (band [first + 1]);
+
+ p -> top_score = q -> top_score + first_score;
+ p -> diag_score = p -> left_score = NEG_INFTY_SCORE;
+ p -> top_errors = q -> top_errors + first_error;
+ p -> diag_errors = p -> left_errors = 0;
+ }
+ else
+ {
+ first = 0;
+ c = left_col + 1;
+ save = band [first];
+ p = & (band [first]);
+ q = & (band [first + 1]);
+
+ q -> Get_Max_Top (mxs, mxf, gap_score);
+ p -> top_score = mxs + indel_score;
+ p -> top_from = mxf;
+ p -> top_ref = q -> Get_Ref (mxf);
+ p -> top_errors = q -> Get_Errors (mxf) + 1;
+
+ save . Get_Max (mxs, mxf);
+ p -> diag_score = mxs
+ + ((ch == s [left_col]) ? match_score : mismatch_score);
+ p -> diag_from = mxf;
+ p -> diag_ref = save . Get_Ref (mxf);
+ p -> diag_errors = save . Get_Errors (mxf);
+ if (ch != s [left_col])
+ p -> diag_errors ++;
+
+ p -> left_score = NEG_INFTY_SCORE;
+ p -> left_errors = 0;
+ p -> left_ref = 0;
+ }
+
+ // Do the remaining cells
+ if (right_col >= s_len)
+ last = s_len - left_col - 1;
+ else
+ last = right_col - left_col;
+ for (i = first + 1; i <= last; i ++, c++)
+ {
+ save = band [i];
+ p = & (band [i]);
+
+ if (i == last)
+ {
+ p -> top_score = NEG_INFTY_SCORE;
+ p -> top_ref = p -> top_errors = 0;
+ }
+ else
+ {
+ q = & (band [i + 1]);
+ q -> Get_Max_Top (mxs, mxf, gap_score);
+ p -> top_score = mxs + indel_score;
+ p -> top_from = mxf;
+ p -> top_ref = q -> Get_Ref (mxf);
+ p -> top_errors = q -> Get_Errors (mxf) + 1;
+ }
+
+ save . Get_Max (mxs, mxf);
+ p -> diag_score = mxs
+ + ((ch == s [c]) ? match_score : mismatch_score);
+ p -> diag_from = mxf;
+ p -> diag_ref = save . Get_Ref (mxf);
+ p -> diag_errors = save . Get_Errors (mxf);
+ if (ch != s [c])
+ p -> diag_errors ++;
+
+ band [i - 1] . Get_Max_Left (mxs, mxf, gap_score);
+ p -> left_score = mxs + indel_score;
+ p -> left_from = mxf;
+ p -> left_ref = band [i - 1] . Get_Ref (mxf);
+ p -> left_errors = band [i - 1] . Get_Errors (mxf) + 1;
+ }
+
+ return;
+ }
diff --git a/src/Align/align.hh b/src/Align/align.hh
new file mode 100644
index 0000000..3268f3d
--- /dev/null
+++ b/src/Align/align.hh
@@ -0,0 +1,771 @@
+//
+// File: align.h
+//
+// Last Modified: 25 November 2002
+//
+// Routines to do string alignments
+
+
+#ifndef __ALIGN_H_INCLUDED
+#define __ALIGN_H_INCLUDED
+
+
+#include "datatypes_AMOS.hh"
+#include "utility_AMOS.hh"
+#include "Contig_AMOS.hh"
+#include "delcher.hh"
+#include "fasta.hh"
+#include "prob.hh"
+#include "matrix.hh"
+#include "CelMsg.hh"
+#include "Slice.h"
+#include <iostream>
+#include <string>
+#include <vector>
+#include <functional>
+#include <algorithm>
+
+
+
+// Delta encoding shows the positions of the insertions and deletions
+// in the strings. If the encoding is from string A to string B
+// then minus values indicate an extra character in A and plus values
+// indicate an extra character in B . The absolute value is the
+// position of that extra character relative to the current positions.
+// E.g., for the alignment:
+// A: abcxxdefghi-jklmn
+// B: abc--dexghixjklmn
+// ^^ ^ ^
+// The delta encoding would be: -4, -1, +7
+
+typedef vector <int> Delta_Encoding_t;
+
+
+const char ALPHABET [] = "acgtn";
+const int ALPHABET_SIZE = 5;
+const int MATCH_FROM_TOP = 0;
+const int MATCH_FROM_NW = 1;
+const int MATCH_FROM_NE = -1;
+const int MATRIX_SIZE_LIMIT = 100000;
+ // Largest matrix that will be used for full alignment computations
+const int MAX_ALIGN_ATTEMPTS = 3;
+ // Number of times to try alignments, loosening constraints each time
+const int MAX_REFINEMENTS = 3;
+ // Number of times to refine an alignment
+const double BIN_CUTOFF_PROB = 1e-6;
+ // Probability cutoff for the binonial distribution
+const char MAX_QUALITY_CHAR = 60;
+
+
+const int NEG_INFTY_SCORE = ((1 << 29) - 1) * -1;
+const unsigned int FROM_LEFT = 0;
+const unsigned int FROM_DIAG = 1;
+const unsigned int FROM_TOP = 2;
+const unsigned int FROM_NOWHERE = 3;
+
+
+// Flags for printing multialignments
+const unsigned int PRINT_WITH_DIFFS = 1;
+ // if set true then print ^'s under consensus where not unanimous
+const unsigned int PRINT_USING_STRING_SUB = 1 << 1;
+ // if set true then use string_sub value to get component string
+const unsigned int PRINT_CONSENSUS_GAP_COORDS = 1 << 2;
+ // if set true then print consensus range values counting gap positions
+
+
+// Results for checking/fixing starts of alignments
+enum Fix_Status_t
+ {NO_FIX_NEEDED, NEEDS_LEFT_SHIFT, SHIFTED_RIGHT, SHIFTED_LEFT};
+
+
+// Defaults values for alignment score parameters
+const int DEFAULT_MATCH_SCORE = 1;
+ // Score for matching characters
+const int DEFAULT_MISMATCH_SCORE = -3;
+ // Score for substitution error
+const int DEFAULT_INDEL_SCORE = -3;
+ // Score for insertion or deletion
+const int DEFAULT_GAP_SCORE = -1;
+ // Extra penalty for first insertion/deletion in a run
+
+
+class Align_Score_Entry_t
+ {
+ public:
+ int diag_score : 30; // score where last move is match/mismatch
+ unsigned int diag_from : 2;
+ int top_score : 30; // score where last move is from preceding row
+ unsigned int top_from : 2;
+ int left_score : 30; // score where last move is from preceding column
+ unsigned int left_from : 2;
+
+ void Dump
+ (FILE * fp) const;
+ void Get_Max
+ (int & max_score, unsigned int & max_from) const;
+ void Get_Max_Left
+ (int & max_score, unsigned int & max_from, int penalty) const;
+ void Get_Max_Top
+ (int & max_score, unsigned int & max_from, int penalty) const;
+ };
+
+
+class Augmented_Score_Entry_t : public Align_Score_Entry_t
+ {
+ public:
+ int top_ref;
+ int diag_ref;
+ int left_ref;
+ // subscript where best alignment to here began in a designated prior row
+
+ void Dump
+ (FILE * fp) const;
+ int Get_Ref
+ (unsigned int & from) const;
+ };
+
+
+class Errors_Score_Entry_t : public Augmented_Score_Entry_t
+ {
+ public:
+ int top_errors;
+ int diag_errors;
+ int left_errors;
+ // number of errors to get to this entry in the respective direction
+
+ void Dump
+ (FILE * fp) const;
+ int Get_Errors
+ (unsigned int & from) const;
+ };
+
+
+class Phase_Entry_t
+ {
+ public:
+ int from, to; // entries connected
+ int same_ct, opposite_ct, weight;
+
+ void Print
+ (FILE * fp) const
+ {
+ fprintf (fp, "from = %d to = %d same = %d opp = %d wt = %d\n",
+ from, to, same_ct, opposite_ct, weight);
+ }
+
+ bool operator >
+ (const Phase_Entry_t & p) const
+ {
+ if (weight > p . weight)
+ return true;
+ if (weight == p . weight && same_ct > p . same_ct)
+ return true;
+ if (weight == p . weight && same_ct == p . same_ct
+ && abs (to - from) > abs (p . to - p . from))
+ return true;
+
+ return false;
+ }
+ };
+
+
+class Distinguishing_Column_t
+ {
+ public:
+ int lo, hi;
+ // indicate range of gapped consensus columns where there's a
+ // consistent significant difference
+ char hapa_ch, hapb_ch, phase_ch;
+ vector <int> hapa_sub, hapb_sub;
+
+ bool Intersects
+ (const Distinguishing_Column_t & d, Phase_Entry_t & p,
+ int & min);
+ void Print
+ (FILE * fp)
+ {
+ int i, na, nb;
+
+ na = hapa_sub . size ();
+ nb = hapb_sub . size ();
+ fprintf (fp, "lo/hi = %d/%d %c %2d %c %2d %c\n",
+ lo, hi, hapa_ch, na, hapb_ch, nb, phase_ch);
+ for (i = 0; i < na; i ++)
+ fprintf (fp, " %3d", hapa_sub [i]);
+ fputc ('\n', fp);
+ for (i = 0; i < nb; i ++)
+ fprintf (fp, " %3d", hapb_sub [i]);
+ fputc ('\n', fp);
+ }
+ };
+
+
+class Match_Extent_Entry_t
+ {
+ public:
+ int len : 30;
+ int from : 2;
+ };
+
+
+class Simple_Overlap_t
+ {
+ public:
+ int a_id, b_id;
+ int a_hang, b_hang;
+ int a_olap_len, b_olap_len;
+ int errors, score;
+ bool flipped;
+ // a is always forward. If b is forward flipped is false; otherwise,
+ // it's true
+ };
+
+
+class Vote_t
+ {
+ public:
+ int here [ALPHABET_SIZE + 1];
+ // votes at this position; letters followed by blank
+ int after [ALPHABET_SIZE + 1];
+ // votes for insertion after this position; letters followed by blank
+
+ void Incr_After
+ (char ch, int incr_val = 1);
+ void Incr_Blank
+ (int incr_val = 1);
+ void Incr_By
+ (char ch, bool with_blank, int incr_val = 1);
+ char Max_After_Char
+ (void);
+ char Max_Here_Char
+ (void);
+ void Set_To
+ (char ch, bool with_blank);
+ void Set_Zero
+ (void);
+ };
+
+
+class Base_Alignment_t
+ {
+ public:
+ int a_lo, a_hi;
+ // matching region in string a in space-based coords
+ int b_lo, b_hi;
+ // matching region in string b in space-based coords
+ int errors;
+ // number of errors in the matching region
+ // currently this is ignored
+ int string_sub;
+ // subscript of string in accompanying array
+ unsigned flipped : 1;
+ // 0 if original a was same orientation as b; 1 otherwise
+ int a_len : 31;
+ // length of entire a string
+
+ Base_Alignment_t
+ () // default constructor
+ {
+ errors = string_sub = a_len = flipped = 0;
+ }
+ void Dump
+ (FILE * fp) const;
+ double Error_Rate
+ (void) const;
+ void Flip_AB
+ (void);
+ bool Is_Empty
+ (void) const;
+ };
+
+
+class Gapped_Alignment_t;
+
+class Alignment_t : public Base_Alignment_t
+ {
+ friend class Gapped_Alignment_t;
+ private:
+ Delta_Encoding_t delta;
+ // indicates positions of inserts/deletes
+
+ public:
+ const Delta_Encoding_t & getDelta
+ (void) const
+ { return delta; }
+
+ void setDelta
+ (const Delta_Encoding_t & d)
+ { delta = d; }
+
+ int B_Position
+ (int a) const;
+ void Clear
+ (void);
+ void Combine
+ (const Alignment_t & a1, const Alignment_t & a2);
+ void Dump
+ (FILE * fp) const;
+ void Dump_Delta
+ (FILE * fp) const;
+ void Check_Fix_Start
+ (const char * s , int s_len, const char * t, int t_len,
+ Fix_Status_t & status);
+ void Flip_AB
+ (void);
+ void Incr_Votes
+ (vector <Vote_t> & vote, char * a, int incr_val = 1);
+ void Offset_A
+ (int n);
+ void Print
+ (FILE * fp, const char * a, const char * b,
+ int width = DEFAULT_FASTA_WIDTH);
+ void Set_Empty_A
+ (int a_start, int b_start, int b_end);
+ void Set_Exact
+ (int a_start, int b_start, int len);
+ void Set_From_VS_Matrix
+ (Match_Extent_Entry_t * * t, int e, int col);
+ void Set_Inserts
+ (vector <short> & v) const;
+ void Set_To_Identity
+ (int len);
+ void Shift_First_Delta
+ (int offset);
+ };
+
+
+class Gapped_Alignment_t : public Base_Alignment_t
+ {
+ friend class Alignment_t;
+ protected:
+ vector <int> skip;
+ // indicates positions of inserts/deletes
+
+ public:
+ void setSkip
+ (const vector <int> & s)
+ { skip = s; }
+
+ void Clear
+ (void);
+ void Convert_From
+ (const Alignment_t & ali, vector <int> & tr);
+ void Convert_Skip_to_Del
+ (vector <int> & del);
+ void Dump
+ (FILE * fp) const;
+ void Dump_Skip
+ (FILE * fp) const;
+ void Flip
+ (int a_len, int b_len);
+ void Incr_Column_Chars
+ (Matrix <unsigned char> & count, const char * s);
+ char Get_Aligning_Char
+ (int b, char * s);
+ int Get_Skip
+ (int i) const;
+ void Make_Sub_Alignment
+ (Gapped_Alignment_t & sub_ali, int b1, int b2) const;
+ void Modify_For_B_Inserts
+ (const vector <int> & insert_sub);
+ void Pass_Through
+ (const Alignment_t & ali);
+ void Print_Subalignment_Line
+ (char * buff, int b1, int b2, char * s, int & a1, int & a2);
+ void Shift_Skip
+ (int offset);
+ };
+
+
+class Gapped_MA_Bead_t
+ {
+ public:
+ int a_pos, b_pos, skip_pos;
+ int skip_i;
+ char seq_ch, qual_ch;
+ const char * seq, * qual;
+ const Gapped_Alignment_t * ga;
+ bool active;
+
+ void Advance
+ (void);
+ };
+
+
+class Gapped_Multi_Alignment_t;
+
+class Multi_Alignment_t
+ {
+ friend class Gapped_Multi_Alignment_t;
+ private:
+ string id;
+ string consensus;
+ // consensus of each column of the multialignment
+ vector <Alignment_t> align;
+ // alignment of each string to the consensus
+
+ public:
+ const char * getConsensus (void)
+ { return consensus . c_str (); }
+ const char * getID
+ (void)
+ // return the id string as a C string
+ { return id . c_str (); }
+
+ void setID
+ (const string & s)
+ { id = s; }
+
+ bool Check_Subsequent_Overlaps
+ (const char * cons, int cons_len, const vector <char *> & s, int i,
+ const vector <int> & offset, int n, int curr_offset, int wiggle, int min_olap,
+ double error_rate, int offset_sum, int virtual_cons_len);
+ void Clear
+ (void);
+ int Estimate_Offset_Position
+ (int i, const vector <int> & offset);
+ int Estimate_Offset_With_Expels
+ (int i, const vector <int> & offset, const vector <bool> & expel);
+ void Print_Alignments_To_Consensus
+ (FILE * fp, vector <char *> s);
+ void Reset_From_Votes
+ (const vector <char *> & s,
+ int offset_delta, double error_rate,
+ vector <Vote_t> & vote, bool & changed);
+ void Set_Consensus
+ (char * s);
+ void Set_Initial_Consensus
+ (const vector <char *> & s, const vector <int> & offset,
+ int offset_delta, double error_rate, int min_overlap,
+ vector <Vote_t> & vote, vector <char *> * tag_list = NULL,
+ bool allow_expels = FALSE);
+ };
+
+
+
+class Gapped_Multi_Alignment_t
+ {
+ friend class Multi_Alignment_t;
+ private:
+ unsigned int print_flags;
+ string id;
+ string consensus;
+ // consensus of each column of the multialignment
+ string con_qual;
+ // quality value of each character of consensus
+ vector <Gapped_Alignment_t> align;
+ // alignment of each string to the consensus
+
+ public:
+ Gapped_Multi_Alignment_t
+ () // default constructor
+ { print_flags = 0; }
+
+ int getConsensusLen
+ (void) const
+ // return the length of the consensus string
+ { return consensus . length (); }
+ const char * getConsensusString
+ (void)
+ // return the consensus string as a C string
+ { return consensus . c_str (); }
+ const char * getQualityString
+ (void)
+ // return the quality string as a C string
+ { return con_qual . c_str (); }
+ const char * getID
+ (void)
+ // return the id string as a C string
+ { return id . c_str (); }
+
+ void setConsensusString
+ (const string & s)
+ { consensus = s; }
+ void setID
+ (const string & s)
+ { id = s; }
+ void setPrintFlag
+ (unsigned int f)
+ { print_flags |= f; }
+ void setQualityString
+ (const string & q)
+ { con_qual = q; }
+ void unsetPrintFlag
+ (unsigned int f)
+ { print_flags &= (~ f); }
+
+ void TA_Print
+ (FILE * fp, const vector <char *> & s,
+ const vector <AMOS :: Range_t> & clr_list,
+ int width, const vector <char *> * tag, const string & id);
+
+
+ void Add_Aligned_Seqs
+ (const Gapped_Multi_Alignment_t & m, const Alignment_t & ali,
+ int cons_lo, int cons_hi, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1 = NULL, vector <char *> * tg2 = NULL);
+ void Clear
+ (void);
+ void Clear_All_Print_Flags
+ (void)
+ { print_flags = 0; }
+ void Consensus_To_Lower
+ (void);
+ void Convert_Consensus
+ (const Multi_Alignment_t & ma, const vector <short> & v);
+ void Convert_From
+ (const Multi_Alignment_t & ma);
+ void Count_Column_Chars
+ (Matrix <unsigned char> & count,
+ const vector <char *> & sl);
+ void Dump_Aligns
+ (FILE * fp);
+ void Expand_Consensus
+ (const Alignment_t & ali);
+ void Extract_Gapped_Region
+ (int lo, int hi, string & s, int & gapped_lo, int & gapped_hi) const;
+ void Extract_IMP_Dels
+ (vector < vector <int> > & del_list);
+ void Full_Merge_Left
+ (const Gapped_Multi_Alignment_t & m, int adj_a_lo, int a_lo, int a_hi,
+ int b_lo, int b_hi, int & prefix_len_added, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1, vector <char *> * tg2);
+ void Full_Merge_Right
+ (const Gapped_Multi_Alignment_t & m, int a_lo,
+ int b_lo, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1 = NULL, vector <char *> * tg2 = NULL);
+ void Get_Distinguishing_Columns
+ (vector <Distinguishing_Column_t> & dc,
+ const vector <char *> & sl);
+ void Get_Element_Subs
+ (Distinguishing_Column_t & d, const vector <char *> & sl);
+ void Get_Partial_Ungapped_Consensus
+ (string & s, int lo, int hi) const;
+ void Get_Positions
+ (vector <AMOS::Range_t> & pos) const;
+ void Get_Ungapped_Consensus
+ (string & s);
+ void Haplo_Sep
+ (const vector <char *> & sl, vector <Distinguishing_Column_t> & dc,
+ vector <char *> * tg = NULL);
+ void Make_From_CCO_Msg
+ (const Celera_Message_t & msg, const vector <int> & slen);
+ void Make_Gapped_Ungapped_Lookup
+ (vector <int> & lookup);
+ void Merge
+ (const Gapped_Multi_Alignment_t & m);
+ void Output_Read_Positions
+ (FILE * fp, int id, const vector <char *> & tag, int orig_tag_ct,
+ int len, int offset = 0);
+ void Partial_Merge
+ (const Gapped_Multi_Alignment_t & m, int a_lo, int a_hi,
+ int b_lo, int b_hi, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1 = NULL, vector <char *> * tg2 = NULL);
+ void Print
+ (FILE * fp, const vector <char *> & s, int width = DEFAULT_FASTA_WIDTH,
+ vector <char *> * tag = NULL);
+ void Print_Consensus
+ (char * buff, int b1, int b2);
+ int Print_Empty_Aligns
+ (FILE * fp, const vector <char *> & tag, const char * contig_id);
+ void Print_Ungapped_Consensus
+ (FILE * fp, char * hdr, int width = DEFAULT_FASTA_WIDTH);
+ void Reverse_Complement
+ (vector <char *> & s);
+ void Set_Consensus_And_Qual
+ (const vector <char *> & s, const vector <char *> & q);
+ void Set_Flipped
+ (const vector <AMOS :: Range_t> & clr);
+ void Set_Phase
+ (vector <Distinguishing_Column_t> & dc);
+ void Set_String_Subs
+ (void);
+ void Shift_B_Right
+ (int offset);
+ void Show_Skips
+ (FILE * fp);
+ void Sort
+ (vector <char *> & s, vector <int> * ref = NULL,
+ vector <char *> * tag_list = NULL);
+
+ int Ungapped_Consensus_Len
+ (void) const;
+ void Make_AMOS_Contig(const vector <AMOS :: Range_t> & clr_list,
+ const vector <char *> & tag,
+ AMOS::Contig_t & out) const;
+ };
+
+
+
+void Align_Row_Update
+ (vector <Augmented_Score_Entry_t> & align_row, char ch, const char * s,
+ int s_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, int first_score);
+void Align_Row_Update_With_Errors
+ (vector <Errors_Score_Entry_t> & align_row, char ch, const char * s,
+ int s_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, int first_score, int first_error);
+void Banded_Overlap
+ (const char * s, int s_len, const char * t, int t_len,
+ int lo_offset, int hi_offset, Simple_Overlap_t & olap,
+ int match_score = DEFAULT_MATCH_SCORE,
+ int mismatch_score = DEFAULT_MISMATCH_SCORE,
+ int indel_score = DEFAULT_INDEL_SCORE,
+ int gap_score = DEFAULT_GAP_SCORE);
+void Best_Spanning_Tree
+ (int n, const vector <Phase_Entry_t> & edge_list,
+ vector <int> & tree_edge);
+void Classify_Reads
+ (const vector <Distinguishing_Column_t> & dc, int n,
+ vector <char> & side, vector <int> & segment);
+void Complete_Align
+ (const char * s, int s_lo, int s_hi, const char * t, int t_lo, int t_slip,
+ int t_hi, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Align_Score_Entry_t * first_entry,
+ Align_Score_Entry_t & last_entry, Alignment_t & align);
+void Complete_Align_Full_Matrix
+ (const char * s, int s_lo, int s_hi, const char * t, int t_lo, int t_slip,
+ int t_hi, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Align_Score_Entry_t * first_entry,
+ Align_Score_Entry_t & last_entry, Alignment_t & align);
+void Complete_Align_Save_Space
+ (const char * s, int s_lo, int s_hi, const char * t, int t_lo, int t_slip,
+ int t_hi, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Align_Score_Entry_t * first_entry,
+ Align_Score_Entry_t & last_entry, Alignment_t & align);
+int DNA_Char_To_Sub
+ (char ch);
+int Exact_Prefix_Match
+ (const char * s, const char * t, int max_len);
+int Gapped_Equivalent
+ (int pos, const string & s);
+void Global_Align
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align);
+void Incr_Opposite
+ (vector <Phase_Entry_t> & v, int from, int to);
+void Incr_Same
+ (vector <Phase_Entry_t> & v, int from, int to);
+bool Is_Distinguishing
+ (unsigned char ct [5], char & ch1, int & ch1_ct,
+ char & ch2, int & ch2_ct);
+int Match_Count
+ (const vector <int> & a, const vector <int> & b);
+void Multi_Align
+ (const string & id, vector <char *> & s, vector <int> & offset,
+ int offset_delta, double error_rate, int min_overlap,
+ Gapped_Multi_Alignment_t & ma, vector <int> * ref = NULL,
+ vector <char *> * tag_list = NULL, bool allow_expels = FALSE);
+void Overlap_Align
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int t_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align);
+void Overlap_Align_Full_Matrix
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int t_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align);
+void Overlap_Align_Save_Space
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int t_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align);
+bool Overlap_Match_VS
+ (const char * s, int s_len, const char * t, int t_len,
+ int lo, int hi, int min_len, int max_errors,
+ Alignment_t & align);
+void Print_Align_Lines_Pair
+ (FILE * fp, const string & s, const string & t, int len,
+ const char * s_label, const char * t_label,
+ int s_lo, int s_hi, int t_lo, int t_hi);
+void Print_VS_Table
+ (FILE * fp, Match_Extent_Entry_t * * tab, int t_lo, int t_hi, int e,
+ int best_i, bool found);
+bool Range_Intersect
+ (int a_lo, int a_hi, int b_lo, int b_hi);
+void Simple_Overlap
+ (const char * s, int s_len, const char * t, int t_len,
+ Simple_Overlap_t & olap, int match_score = DEFAULT_MATCH_SCORE,
+ int mismatch_score = DEFAULT_MISMATCH_SCORE,
+ int indel_score = DEFAULT_INDEL_SCORE,
+ int gap_score = DEFAULT_GAP_SCORE);
+void Sort_Strings_And_Offsets
+ (vector <char *> & s, vector <int> & s_len, vector <int> & offset,
+ vector <int> * ref, vector <char *> * tag_list);
+bool Substring_Match_VS
+ (const char * s, int s_len, const char * t, int t_len,
+ int lo, int hi, int max_errors, Alignment_t & align);
+char Sub_To_DNA_Char
+ (int i);
+void Trace_Back_Align_Path
+ (const vector < vector <Align_Score_Entry_t> > & a, int & r, int & c,
+ int r_start, int c_start, vector <int> & delta, int & errors,
+ const char * s, const char * t);
+void Traverse
+ (int v, int par, vector < vector <Phase_Entry_t> > & tree,
+ vector <Distinguishing_Column_t> & dc, char ch, int & sum);
+int UF_Find
+ (int i, vector <int> & uf);
+int UF_Find_With_Parity
+ (int i, vector <int> & uf, int & parity);
+void UF_Union
+ (int i, int j, vector <int> & uf);
+int Ungapped_Positions
+ (const string & s, int lo, int hi);
+void Update_Banded_Row
+ (vector <Errors_Score_Entry_t> & band, char ch, const char * s,
+ int s_len, int left_col, int right_col, int match_score,
+ int mismatch_score, int indel_score, int gap_score, int first_score,
+ int first_error);
+
+
+
+template <class DT>
+void Permute
+ (vector <DT> & v, const vector <int> & p)
+
+// Permute the entries in v according to the values in p .
+
+ {
+ int i, m, n;
+ DT save;
+
+ m = v . size ();
+ n = p . size ();
+ if (m != n)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Permute size mismatch. v.size = %d p.size = %d\n",
+ m, n);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ vector <bool> done (n, false);
+
+ for (i = 0; i < n; i ++)
+ if (p [i] != i && ! done [i])
+ {
+ int j, k;
+
+ save = v [i];
+
+ for (j = i; p [j] != i; j = k)
+ {
+ k = p [j];
+ v [j] = v [k];
+ done [j] = true;
+ }
+
+ v [j] = save;
+ done [j] = true;
+ }
+
+ return;
+ }
+
+
+
+#endif
diff --git a/src/Align/align_poly.cc b/src/Align/align_poly.cc
new file mode 100644
index 0000000..4c989f1
--- /dev/null
+++ b/src/Align/align_poly.cc
@@ -0,0 +1,6929 @@
+//
+// File: align_poly.cc
+//
+// Last Modified: 25 November 2002
+//
+// Routines to do string alignments.
+// The alphabet supported (acgtmrwsykvhdbn) includes all ambiguities.
+
+
+#include "align_poly.hh"
+#include <stack>
+#include <cassert>
+using namespace AMOS;
+using namespace std;
+
+
+// ### Align_Score_Entry_t methods ###
+
+
+void Align_Score_Entry_t :: Dump
+ (FILE * fp) const
+
+// Print to fp the contents of this score entry.
+
+ {
+ fprintf (fp, "L = %d:%u D = %d:%u T = %d:%u\n",
+ left_score, left_from, diag_score, diag_from,
+ top_score, top_from);
+
+ return;
+ }
+
+
+
+void Align_Score_Entry_t :: Get_Max
+ (int & max_score, unsigned int & max_from) const
+
+// Set max_score to the highest score in this entry
+// and max_from to the sub_entry it came from.
+
+ {
+ if (left_score <= diag_score)
+ {
+ max_score = diag_score;
+ max_from = FROM_DIAG;
+ }
+ else
+ {
+ max_score = left_score;
+ max_from = FROM_LEFT;
+ }
+
+ if (max_score < top_score)
+ {
+ max_score = top_score;
+ max_from = FROM_TOP;
+ }
+
+ return;
+ }
+
+
+
+void Align_Score_Entry_t :: Get_Max_Left
+ (int & max_score, unsigned int & max_from, int penalty) const
+
+// Set max_score to the highest score in this entry
+// and max_from to the sub_entry it came from, where penalty
+// is added to max_score if max_from is not FROM_LEFT .
+
+ {
+ if (top_score <= diag_score)
+ {
+ max_score = diag_score;
+ max_from = FROM_DIAG;
+ }
+ else
+ {
+ max_score = top_score;
+ max_from = FROM_TOP;
+ }
+ max_score += penalty;
+
+ if (max_score <= left_score)
+ {
+ max_score = left_score;
+ max_from = FROM_LEFT;
+ }
+
+ return;
+ }
+
+
+
+void Align_Score_Entry_t :: Get_Max_Top
+ (int & max_score, unsigned int & max_from, int penalty) const
+
+// Set max_score to the highest score in this entry
+// and max_from to the sub_entry it came from, where penalty
+// is added to max_score if max_from is not FROM_TOP .
+
+ {
+ if (left_score <= diag_score)
+ {
+ max_score = diag_score;
+ max_from = FROM_DIAG;
+ }
+ else
+ {
+ max_score = left_score;
+ max_from = FROM_LEFT;
+ }
+ max_score += penalty;
+
+ if (max_score < top_score)
+ {
+ max_score = top_score;
+ max_from = FROM_TOP;
+ }
+
+ return;
+ }
+
+
+
+void Augmented_Score_Entry_t :: Dump
+ (FILE * fp) const
+
+// Print to fp the contents of this score entry.
+
+ {
+ Align_Score_Entry_t :: Dump (fp);
+ fprintf (fp, "Refs: %d %d %d\n", left_ref, diag_ref, top_ref);
+
+ return;
+ }
+
+
+
+int Augmented_Score_Entry_t :: Get_Ref
+ (unsigned int & from) const
+
+// Return the ref entry corresponding to from .
+
+ {
+ switch (from)
+ {
+ case FROM_TOP :
+ return top_ref;
+ case FROM_DIAG :
+ return diag_ref;
+ case FROM_LEFT :
+ return left_ref;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad from value = %d in Get_Ref\n",
+ from);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ return -1;
+ }
+
+
+
+void Errors_Score_Entry_t :: Dump
+ (FILE * fp) const
+
+// Print to fp the contents of this score entry.
+
+ {
+ Augmented_Score_Entry_t :: Dump (fp);
+ fprintf (fp, "Errors: %d %d %d\n", left_errors, diag_errors, top_errors);
+
+ return;
+ }
+
+
+
+int Errors_Score_Entry_t :: Get_Errors
+ (unsigned int & from) const
+
+// Return the ref entry corresponding to from .
+
+ {
+ switch (from)
+ {
+ case FROM_TOP :
+ return top_errors;
+ case FROM_DIAG :
+ return diag_errors;
+ case FROM_LEFT :
+ return left_errors;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad from value = %d in Get_Errors\n",
+ from);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ return -1;
+ }
+
+
+
+
+// ### Distinguishing_Column_t methods ###
+
+
+bool Distinguishing_Column_t :: Intersects
+ (const Distinguishing_Column_t & d, Phase_Entry_t & p,
+ int & min)
+
+// See if any of the subscripts in this column match
+// those in d . If not, return false . Otherwise, return
+// true and set the counts in p for how many match a/a and b/b,
+// and how many match a/b and b/a. Set min to the smaller
+// number of component matches in the larger of same_ct and
+// opposite_ct .
+
+ {
+ int aa, ab, ba, bb;
+
+ aa = Match_Count (hapa_sub, d . hapa_sub);
+ bb = Match_Count (hapb_sub, d . hapb_sub);
+
+ ab = Match_Count (hapa_sub, d . hapb_sub);
+ ba = Match_Count (hapb_sub, d . hapa_sub);
+
+ p . same_ct = aa + bb;
+ p . opposite_ct = ab + ba;
+
+ if (p . same_ct >= p . opposite_ct)
+ min = Min (aa, bb);
+ else
+ min = Min (ab, ba);
+
+ return (p . same_ct > 0 || p . opposite_ct > 0);
+ }
+
+
+
+
+// ### Vote_t methods ###
+
+
+void Vote_t :: Incr_After
+ (char ch)
+
+// Add 1 to the after count in this Vote_t for ch .
+
+ {
+ const char * p;
+
+ p = strchr (ALPHABET, tolower (ch));
+ if (p == NULL)
+ {
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad character %c (ASCII %d)\n",
+ ch, ch);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ after [p - ALPHABET] ++;
+
+ return;
+ }
+
+
+
+void Vote_t :: Incr_Blank
+ (void)
+// Add 1 to the blank entry in the here counts of this Vote_t .
+
+ {
+ here [ALPHABET_SIZE] ++;
+
+ return;
+ }
+
+
+
+void Vote_t :: Incr_By
+ (char ch, bool with_blank)
+
+// Add 1 to the here count in this Vote_t for ch .
+// If with_blank is true then also add 1 to the after
+// count for a blank.
+
+ {
+ const char * p;
+
+ p = strchr (ALPHABET, tolower (ch));
+ if (p == NULL)
+ {
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad character %c (ASCII %d)\n",
+ ch, ch);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ here [p - ALPHABET] ++;
+ if (with_blank)
+ after [ALPHABET_SIZE] ++;
+
+ return;
+ }
+
+
+
+char Vote_t :: Max_After_Char
+ (void)
+
+// Return the character corresponding to the maximum count
+// in here . If all zeroes, return a blank.
+
+ {
+ int i, max;
+
+ max = 0;
+ for (i = 1; i <= ALPHABET_SIZE; i ++)
+ if (after [max] < after [i])
+ max = i;
+
+ if (after [max] == 0 || max == ALPHABET_SIZE)
+ return ' ';
+ else
+ return ALPHABET [max];
+ }
+
+
+
+char Vote_t :: Max_Here_Char
+ (void)
+
+// Return the character corresponding to the maximum count
+// in after . If all zeroes, return a blank.
+
+ {
+ int i, max;
+
+ max = 0;
+ for (i = 1; i <= ALPHABET_SIZE; i ++)
+ if (here [max] < here [i])
+ max = i;
+
+ if (here [max] == 0 || max == ALPHABET_SIZE)
+ return ' ';
+ else
+ return ALPHABET [max];
+ }
+
+
+
+void Vote_t :: Set_To
+ (char ch, bool with_blank)
+
+// Make the counts in this Vote_t all zero except set the
+// here count for ch to 1 . If with_blank is true then
+// also set the after count for a blank to 1 .
+
+ {
+ int i;
+ const char * p;
+
+ for (i = 0; i <= ALPHABET_SIZE; i ++)
+ here [i] = after [i] = 0;
+
+ p = strchr (ALPHABET, tolower (ch));
+ if (p == NULL)
+ {
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad character %c (ASCII %d)\n",
+ ch, ch);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ here [p - ALPHABET] = 1;
+ if (with_blank)
+ after [ALPHABET_SIZE] = 1;
+
+ return;
+ }
+
+
+
+void Vote_t :: Set_Zero
+ (void)
+
+// Make the counts in this Vote_t all zero.
+
+ {
+ int i;
+
+ for (i = 0; i <= ALPHABET_SIZE; i ++)
+ here [i] = after [i] = 0;
+
+ return;
+ }
+
+
+
+
+// ### Base_Alignment_t methods ###
+
+
+void Base_Alignment_t :: Dump
+ (FILE * fp) const
+
+// Print to fp the contents of this base alignent.
+
+ {
+ fprintf (fp, "### a_lo/hi = %d/%d b_lo/hi = %d/%d errors = %d string_sub = %d\n",
+ a_lo, a_hi, b_lo, b_hi, errors, string_sub);
+
+ return;
+ }
+
+
+
+double Base_Alignment_t :: Error_Rate
+ (void) const
+
+// Return the number of errors divided by the average
+// length of this alignment.
+
+ {
+ double len;
+
+ len = (a_hi - a_lo + b_hi - b_lo) / 2.0;
+ if (len == 0)
+ return 0.0;
+ else
+ return errors / len;
+ }
+
+
+
+void Base_Alignment_t :: Flip_AB
+ (void)
+
+// Switch the roles of a and b . No change to errors , string_sub,
+// flipped or a_len .
+
+ {
+ Swap (a_lo, b_lo);
+ Swap (a_hi, b_hi);
+ }
+
+
+
+
+// ### Alignment_t methods ###
+
+
+int Alignment_t :: B_Position
+ (int a) const
+
+// Return the postion in the b string that corresponds to
+// position a in the a string. Must have a_lo <= a < a_hi .
+// In case of insertions in the a string, return the lowest
+// position in the b string that corresponds.
+
+ {
+ int d, i, j, n;
+
+ i = a_lo;
+ j = b_lo;
+ n = delta . size ();
+
+ for (d = 0; d < n; d ++)
+ {
+ int extent;
+
+ extent = abs (delta [d]) - 1;
+ if (a - i <= extent)
+ return j + a - i;
+ i += extent;
+ j += extent;
+ if (delta [d] < 0)
+ i ++;
+ else
+ j ++;
+ }
+
+ return j + a - i;
+ }
+
+
+
+void Alignment_t :: Clear
+ (void)
+
+// Make this alignment empty.
+
+ {
+ a_lo = a_hi = b_lo = b_hi = errors = 0;
+ delta . clear ();
+
+ return;
+ }
+
+
+
+void Alignment_t :: Combine
+ (const Alignment_t & a1, const Alignment_t & a2)
+
+// Concatenate alignments a1 and a2 into this single alignment.
+
+ {
+ int a_used, b_used, extent;
+ int a_left, b_left;
+ int i, n;
+
+ if (Verbose > 3)
+ {
+ cerr << "Combine:" << endl;
+ a1 . Dump (stderr);
+ a2 . Dump (stderr);
+ }
+
+ assert (a1 . a_hi == a2 . a_lo);
+ assert (a1 . b_hi == a2 . b_lo);
+
+ delta = a1 . delta;
+ a_lo = a1 . a_lo;
+ a_hi = a2 . a_hi;
+ b_lo = a1 . b_lo;
+ b_hi = a2 . b_hi;
+ errors = a1 . errors + a2 . errors;
+ string_sub = a1 . string_sub;
+ flipped = a1 . flipped;
+ a_len = a1 . a_len;
+
+ if (a2 . delta . size () == 0)
+ return;
+
+ // Compute the number of characters in the a and b strings
+ // accounted for by the delta values in a1 .
+ n = a1 . delta . size ();
+ a_used = b_used = 0;
+ for (i = 0; i < n; i ++)
+ {
+ extent = abs (a1 . delta [i]) - 1;
+ a_used += extent;
+ b_used += extent;
+ if (delta [i] < 0)
+ a_used ++;
+ else
+ b_used ++;
+ }
+
+ a_left = a1 . a_hi - a1 . a_lo - a_used;
+ b_left = a1 . b_hi - a1 . b_lo - b_used;
+ assert (a_left == b_left);
+
+ if (a2 . delta [0] < 0)
+ delta . push_back (a2 . delta [0] - a_left);
+ else
+ delta . push_back (a2 . delta [0] + a_left);
+
+ n = a2 . delta . size ();
+ for (i = 1; i < n; i ++)
+ delta . push_back (a2 . delta [i]);
+
+ return;
+ }
+
+
+
+void Alignment_t :: Dump
+ (FILE * fp) const
+
+// Print to fp the entries of this alignment.
+
+ {
+ Base_Alignment_t :: Dump (fp);
+ fprintf (fp, "Delta:\n");
+ Dump_Delta (fp);
+
+ return;
+ }
+
+
+
+void Alignment_t :: Dump_Delta
+ (FILE * fp) const
+
+// Print to fp the delta entries of this alignment.
+
+ {
+ int i, n;
+
+ n = delta . size ();
+ for (i = 0; i < n; i ++)
+ fprintf (fp, " %3d: %5d\n", i, delta [i]);
+
+ return;
+ }
+
+
+
+void Alignment_t :: Check_Fix_Start
+ (const char * s , int s_len, const char * t, int t_len,
+ Fix_Status_t & status)
+
+// Check for errors/indels at the start of this alignment.
+// If there aren't any, set status to NO_FIX_NEEDED and return.
+// If there are gaps in s then shift the alignment to the
+// right and set status to SHIFTED_RIGHT . If there are
+// gaps in t or suspiciously many errors, then set status to
+// NEEDS_LEFT_SHIFT .
+// The alignment aligns s as the a-string to t as the b-string.
+
+ {
+ int i, j, n, shift;
+
+ n = delta . size ();
+
+ // if there are no indels or there isn't one at the beginning
+ // of the alignment, there's nothing to do
+ // This is oversimplified. There may be a match for the first
+ // character or two, but then too many indels, which would
+ // indicate a shift is needed
+
+ if (n == 0 || abs (delta [0]) > 1)
+ {
+ status = NO_FIX_NEEDED;
+ return;
+ }
+
+ if (delta [0] == 1)
+ { // shift the alignment to the right;
+
+ for (j = 1; j < n && delta [j] == 1; j ++)
+ ;
+ // There are j consecutive 1 's at the start.
+ // Just remove them and shift the alignment j positions
+ // to the right
+
+ shift = j;
+ for (i = 0; j < n; i++, j++)
+ delta [i] = delta [j];
+ delta . resize (n - shift);
+ b_lo += shift;
+
+ status = SHIFTED_RIGHT;
+ return;
+ }
+
+ if (delta [0] == -1)
+ {
+ status = NEEDS_LEFT_SHIFT;
+ return;
+ }
+
+ return;
+ }
+
+
+
+void Alignment_t :: Flip_AB
+ (void)
+
+// Switch the roles of a and b in this alignment.
+
+ {
+ int i, n;
+
+ Base_Alignment_t :: Flip_AB ();
+
+ n = delta . size ();
+ for (i = 0; i < n; i ++)
+ delta [i] *= -1;
+
+ return;
+ }
+
+
+
+void Alignment_t :: Incr_Votes
+ (vector <Vote_t> & vote, char * a)
+
+// Use the entries in the alignment to increment the entries in vote
+// that correspond to the b string in the alignment.
+// Vote values are from the string a .
+
+ {
+ int d, i, j, k, n;
+
+
+ i = a_lo;
+ j = b_lo;
+ n = delta . size ();
+
+ // First do the entries in the delta encoding
+ for (d = 0; d < n; d ++)
+ {
+ int extent;
+
+ if (Verbose > 3)
+ fprintf (stderr, "d = %d delta = %d\n", d, delta [d]);
+
+ extent = abs (delta [d]) - 1;
+
+ for (k = 0; k < extent; k ++)
+ {
+ vote [j] . Incr_By (a [i], (k < extent - 1));
+ i ++;
+ j ++;
+ }
+
+ if (delta [d] < 0)
+ {
+ if (extent > 0)
+ vote [j - 1] . Incr_After (a [i]);
+ i ++;
+ }
+ else
+ {
+ vote [j] . Incr_Blank ();
+ j ++;
+ }
+ }
+
+ if (Verbose > 3)
+ {
+ fprintf (stderr, "i = %d a_hi = %d j = %d b_hi = %d\n",
+ i, a_hi, j, b_hi);
+ }
+
+ // Now finish off what's left
+ while (i < a_hi && j < b_hi)
+ {
+ vote [j] . Incr_By (a [i], (j < b_hi - 1));
+ i ++;
+ j ++;
+ }
+
+ if (i != a_hi)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Bad alignment end i = %d a_hi = %d", i, a_hi);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ if (j != b_hi)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Bad alignment end j = %d b_hi = %d", j, b_hi);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ return;
+ }
+
+
+
+void Alignment_t :: Offset_A
+ (int n)
+
+// Add n to the a_lo and a_hi positions of this alignment.
+
+ {
+ a_lo += n;
+ a_hi += n;
+
+ return;
+ }
+
+
+
+void Alignment_t :: Print
+ (FILE * fp, const char * a, const char * b, int width)
+
+// Show this alignment between strings a and b
+// showing just the alignment portion of the two strings,
+// with index positions in the right-hand margin.
+// Use width characters per line for alignment.
+// Output goes to fp .
+
+ {
+ string s (width, ' '), t (width, ' ');
+ int a_begin, b_begin;
+ int d, i, j, k, n, q;
+
+
+ i = a_lo;
+ j = b_lo;
+ a_begin = a_lo;
+ b_begin = b_lo;
+ q = 0;
+ n = delta . size ();
+
+ // First do the entries in the delta encoding
+ for (d = 0; d < n; d ++)
+ {
+ int extent;
+
+ if (Verbose > 3)
+ fprintf (stderr, "d = %d delta = %d\n", d, delta [d]);
+
+ extent = abs (delta [d]) - 1;
+
+ for (k = 0; k < extent; k ++)
+ {
+ s [q] = a [i ++];
+ t [q ++] = b [j ++];
+ if (q == width)
+ {
+ Print_Align_Lines_Pair
+ (fp, s, t, q, "a:", "b:", a_begin, i, b_begin, j);
+ a_begin = i;
+ b_begin = j;
+ q = 0;
+ }
+ }
+
+ if (delta [d] < 0)
+ {
+ s [q] = a [i ++];
+ t [q ++] = '-';
+ if (q == width)
+ {
+ Print_Align_Lines_Pair
+ (fp, s, t, q, "a:", "b:", a_begin, i, b_begin, j);
+ a_begin = i;
+ b_begin = j;
+ q = 0;
+ }
+ }
+ else
+ {
+ s [q] = '-';
+ t [q ++] = b [j ++];
+ if (q == width)
+ {
+ Print_Align_Lines_Pair
+ (fp, s, t, q, "a:", "b:", a_begin, i, b_begin, j);
+ a_begin = i;
+ b_begin = j;
+ q = 0;
+ }
+ }
+ }
+
+ if (Verbose > 1)
+ {
+ fprintf (stderr, "i = %d a_hi = %d j = %d b_hi = %d\n",
+ i, a_hi, j, b_hi);
+ }
+
+ // Now finish off what's left
+ while (i < a_hi && j < b_hi)
+ {
+ s [q] = a [i ++];
+ t [q ++] = b [j ++];
+ if (q == width)
+ {
+ Print_Align_Lines_Pair
+ (fp, s, t, q, "a:", "b:", a_begin, i, b_begin, j);
+ a_begin = i;
+ b_begin = j;
+ q = 0;
+ }
+ }
+
+ if (q > 0)
+ Print_Align_Lines_Pair
+ (fp, s, t, q, "a:", "b:", a_begin, i, b_begin, j);
+
+ if (i != a_hi)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Bad alignment end i = %d a_hi = %d", i, a_hi);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ if (j != b_hi)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Bad alignment end j = %d b_hi = %d", j, b_hi);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ return;
+ }
+
+
+
+void Alignment_t :: Set_Empty_A
+ (int a_start, int b_start, int b_end)
+
+// Make this an alignment with an empty a string at position
+// a_start against the portion of b string between b_start
+// and b_end .
+
+ {
+ int i;
+
+ a_lo = a_hi = a_start;
+ b_lo = b_start;
+ b_hi = b_end;
+ errors = b_hi - b_lo;
+ delta . clear ();
+ for (i = b_lo; i < b_hi; i ++)
+ delta . push_back (1);
+
+ return;
+ }
+
+
+
+void Alignment_t :: Set_Exact
+ (int a_start, int b_start, int len)
+
+// Make this alignment represent an exact match starting
+// at a_start in string a and b_start in string b and
+// extending for length len .
+
+ {
+ a_lo = a_start;
+ a_hi = a_start + len;
+ b_lo = b_start;
+ b_hi = b_start + len;
+ errors = 0;
+ delta . clear ();
+
+ return;
+ }
+
+
+
+void Alignment_t :: Set_From_VS_Matrix
+ (Match_Extent_Entry_t * * t, int e, int j)
+
+// Make this alignment represent the match in t starting
+// at entry t [e] [j] and working back to t [0] [0] .
+// t is the matrix of the Vishkin-Schieber algorithm in which
+// t [e] [j] is the most positions of string a
+// that can be matched with e errors and ending aligned at
+// offset j in string b .
+
+ {
+ stack <int> s;
+ int end_match;
+
+ a_lo = 0;
+ a_hi = t [e] [j] . len;
+ b_hi = a_hi + j;
+ errors = e;
+
+ delta . clear ();
+
+ // First get the reverse encoding (i.e., reading strings a and b
+ // from right to left) and push it onto a stack
+
+ end_match = t [e] [j] . len;
+ for ( ; e > 0; e --)
+ switch (t [e] [j] . from)
+ {
+ case MATCH_FROM_TOP : // no delta entry needed because
+ // no shift in diagonal
+ break;
+
+ case MATCH_FROM_NW :
+ j --; // extra character in string b
+ s . push (1 + (end_match - t [e - 1] [j] . len));
+ end_match = t [e - 1] [j] . len;
+ break;
+
+ case MATCH_FROM_NE :
+ j ++; // extra character in string a
+ s . push (- (end_match - t [e - 1] [j] . len));
+ end_match = t [e - 1] [j] . len;
+ break;
+
+ default :
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad switch value from = %d\n",
+ t [e] [j] . from);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ b_lo = a_lo + j;
+
+ // Now convert reverse encoding to forward encoding by popping
+ // values off the stack
+
+ end_match ++;
+ while (! s . empty ())
+ {
+ int k;
+
+ k = s . top ();
+ if (Verbose > 1)
+ fprintf (stderr, "stack top = %d end_match = %d\n", k, end_match);
+ s . pop ();
+ if (k < 0)
+ delta . push_back (- end_match);
+ else
+ delta . push_back (+ end_match);
+
+ end_match = abs (k);
+ }
+
+ return;
+ }
+
+
+
+void Alignment_t :: Set_Inserts
+ (vector <short> & v) const
+
+// Make sure the values in v are large enough to hold the number
+// of inserts specified in this alignment.
+
+ {
+ int ct;
+ int d, j, n;
+
+ j = b_lo;
+ n = delta . size ();
+ ct = 0;
+
+ for (d = 0; d < n; d ++)
+ {
+ j += abs (delta [d]) - 1;
+
+ if (delta [d] != -1)
+ ct = 0;
+ if (delta [d] < 0)
+ {
+ ct ++;
+ if (ct > v [j])
+ v [j] = ct;
+ }
+ else
+ j ++;
+ }
+
+ return;
+ }
+
+
+
+void Alignment_t :: Set_To_Identity
+ (int len)
+
+// Set this alignment to represent an identity between
+// two strings of length len .
+
+ {
+ a_lo = b_lo = 0;
+ a_hi = b_hi = len;
+ errors = 0;
+ a_len = len;
+
+ delta . clear ();
+
+ return;
+ }
+
+
+
+void Alignment_t :: Shift_First_Delta
+ (int offset)
+
+// Adjust the first delta value (if any) in this alignment
+// by offset .
+
+ {
+ if (delta . size () > 0)
+ {
+ if (delta [0] > 0)
+ delta [0] += offset;
+ else
+ delta [0] -= offset;
+ }
+
+ return;
+ }
+
+
+
+
+// ### Gapped_Alignment_t methods ###
+
+
+void Gapped_Alignment_t :: Clear
+ (void)
+
+// Make this alignment empty.
+
+ {
+ a_lo = a_hi = b_lo = b_hi = errors = 0;
+ skip . clear ();
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Convert_From
+ (const Alignment_t & ali, vector <int> & tr)
+
+// Convert the alignment in ali (which represents
+// indels w.r.t. an ungapped sequence) to one
+// representing positions w.r.t. a consensus
+// with gaps inserted. Thus the delta will be
+// a sequence of positive numbers indicating
+// the positions in the b string that have no
+// match to the a string.
+// tr is a translation vector that maps the ungapped
+// positions in the b string to the positions after
+// gaps are inserted.
+
+ {
+ int ct;
+ int d, i, j, k, n, p, q, r;
+
+ i = a_lo = ali . a_lo;
+ j = ali . b_lo;
+ a_hi = ali . a_hi;
+ p = b_lo = tr [ali . b_lo];
+ errors = ali . errors;
+ flipped = ali . flipped;
+ a_len = ali . a_len;
+
+ skip . clear ();
+
+ n = ali . delta . size ();
+ ct = 0;
+
+ if (Verbose > 2)
+ {
+ int i;
+
+ fprintf (stderr, "Convert_From: a_lo = %d a_hi = %d\n", a_lo, a_hi);
+ fprintf (stderr, " Delta:\n");
+ for (i = 0; i < n; i ++)
+ fprintf (stderr, " %3d: %5d\n", i, ali . delta [i]);
+ for (i = ali . b_lo; i < ali . b_hi; i ++)
+ fprintf (stderr, " tr [%3d] = %5hd\n", i, tr [i]);
+ }
+
+ // adjust b_lo if alignment begins with insertions
+ for (d = 0; d < n && ali . delta [d] == -1; d ++)
+ {
+ i ++;
+ b_lo --;
+ }
+ if (b_lo < 0)
+//##ALD if (d > 0 && (j == 0 || tr [j] - d <= tr [j - 1]))
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Convert_From had too many initial inserts\n"
+ " d = %d j = %d tr [j] = %d tr [j - 1] = %d\n",
+ d, j, tr [j], j > 0 ? tr [j - 1] : 0);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ for ( ; d < n; d ++)
+ {
+ k = abs (ali . delta [d]) - 1;
+ for (q = 0; q < k; q ++)
+ {
+ if (j > ali . b_lo)
+ for (r = tr [j - 1] + 1 + ct; r < tr [j]; r ++)
+ {
+ skip . push_back (p);
+ p ++;
+ }
+ i ++;
+ j ++;
+ p ++;
+ ct = 0;
+ }
+
+ if (ali . delta [d] != -1)
+ ct = 0;
+ if (ali . delta [d] < 0)
+ {
+ ct ++;
+ i ++;
+ p ++;
+ }
+ else
+ {
+ for (q = tr [j - 1]; q < tr [j]; q ++)
+ {
+ skip . push_back (p);
+ p ++;
+ }
+ j ++;
+ }
+ }
+
+ // Now finish off the remaining indel-free tail
+ while (i < a_hi && j < ali . b_hi)
+ {
+ if (j > ali . b_lo)
+ for (q = tr [j - 1] + 1 + ct; q < tr [j]; q ++)
+ {
+ skip . push_back (p);
+ p ++;
+ }
+ i ++;
+ j ++;
+ p ++;
+ ct = 0;
+ }
+
+ b_hi = p;
+
+ if (Verbose > 2)
+ {
+ fprintf (stderr, "Convert_From: a_lo = %d a_hi = %d\n", a_lo, a_hi);
+ fprintf (stderr, " b_lo = %d b_hi = %d\n", b_lo, b_hi);
+ fprintf (stderr, " Skip:\n");
+ Dump_Skip (stderr);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Convert_Skip_to_Del
+ (vector <int> & del)
+
+// Set del to the entries in an IMP submessage that correspond
+// to the skip values in this alignment.
+
+ {
+ int i, n;
+
+ del . clear ();
+
+ n = skip . size ();
+ for (i = 0; i < n; i ++)
+ del . push_back (a_lo + skip [i] - b_lo - i);
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Dump
+ (FILE * fp) const
+
+// Print to fp the entries of this alignment.
+
+ {
+ Base_Alignment_t :: Dump (fp);
+ fprintf (fp, "Skip:\n");
+ Dump_Skip (fp);
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Dump_Skip
+ (FILE * fp) const
+
+// Print to fp the skip entries of this alignment.
+
+ {
+ int i, n;
+
+ n = skip . size ();
+ for (i = 0; i < n; i ++)
+ fprintf (fp, " %3d: %5d\n", i, skip [i]);
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Flip
+ (int a_length, int b_length)
+
+// Change this alignment to reflect that both strings
+// have been reversed. a_length is the length of the
+// a string (i.e., that a coordinates refer to) and
+// b_length is the length of the b string.
+
+ {
+ int i, n, tmp;
+
+ flipped = 1 - flipped;
+
+ tmp = a_length - a_lo;
+ a_lo = a_length - a_hi;
+ a_hi = tmp;
+
+ tmp = b_length - b_lo;
+ b_lo = b_length - b_hi;
+ b_hi = tmp;
+
+ reverse (skip . begin (), skip . end ());
+ n = skip . size ();
+ for (i = 0; i < n; i ++)
+ skip [i] = b_length - 1 - skip [i];
+
+ return;
+ }
+
+
+
+char Gapped_Alignment_t :: Get_Aligning_Char
+ (int b, char * s)
+
+// Return the character in string s that aligns to
+// consensus position b .
+
+ {
+ int d, i, n;
+
+ assert (b_lo <= b && b < b_hi);
+
+ n = skip . size ();
+ for (d = 0; d < n && skip [d] < b; d ++)
+ ;
+
+ i = a_lo + b - b_lo - d;
+ if (d < n && b == skip [d])
+ return '-';
+ else
+ return s [i];
+ }
+
+
+
+int Gapped_Alignment_t :: Get_Skip
+ (int i) const
+
+// Return the skip value associated with subscript i , if there
+// is one; otherwise, return INT_MAX .
+
+ {
+ int n;
+
+ n = skip . size ();
+ if (i < n)
+ return skip [i];
+ else
+ return INT_MAX;
+ }
+
+
+
+void Gapped_Alignment_t :: Incr_Column_Chars
+ (Matrix <unsigned char> & count, const char * s)
+
+// Increment entries in count corresponding to this alignment
+// of s to the consensus string.
+
+ {
+ int skip_ct = skip . size ();
+ int a, b, d, j;
+
+ a = a_lo;
+ d = 0;
+ for (b = b_lo; b < b_hi; b ++)
+ {
+ if (d < skip_ct && b == skip [d])
+ {
+ Incr_Limited (count . get (b, 4), (unsigned char) UCHAR_MAX); // '-'
+ d ++;
+ }
+ else
+ {
+ j = DNA_Char_To_Sub (s [a]);
+ if (j >= 0)
+ Incr_Limited (count . get (b, j), (unsigned char) UCHAR_MAX);
+ a ++;
+ }
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Make_Sub_Alignment
+ (Gapped_Alignment_t & sub_ali, int b1, int b2) const
+
+// Set sub_ali to the portion of this alignment that intersects
+// b1 .. b2 of the b sequence.
+
+ {
+ int d, n;
+
+ sub_ali . Clear ();
+
+ n = skip . size ();
+ d = 0;
+ if (b1 <= b_lo)
+ {
+ sub_ali . b_lo = b_lo;
+ sub_ali . a_lo = a_lo;
+ }
+ else
+ {
+ while (d < n && skip [d] < b1)
+ d ++;
+ sub_ali . b_lo = b1;
+ sub_ali . a_lo = a_lo + b1 - b_lo - d;
+ }
+
+ sub_ali . b_hi = Min (b2, b_hi);
+
+ for ( ; d < n && skip [d] <= sub_ali . b_hi; d ++)
+ sub_ali . skip . push_back (skip [d]);
+
+ sub_ali . a_hi = a_lo + sub_ali . b_hi - b_lo - d;
+
+ sub_ali . string_sub = string_sub;
+ sub_ali . flipped = flipped;
+ sub_ali . a_len = a_len;
+
+ assert (sub_ali . a_lo < sub_ali . a_hi);
+ assert (sub_ali . b_lo <= sub_ali . b_hi);
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Modify_For_B_Inserts
+ (const vector <int> & insert_sub)
+
+// Change this alignment to reflect additional '-'s in the
+// consensus sequence at positions in insert_sub .
+
+ {
+ vector <int> :: iterator p;
+ vector <int> new_skip;
+ int i, n;
+
+ if (Verbose > 2)
+ {
+ n = insert_sub . size ();
+ printf ("insert_sub n = %d\n", n);
+ for (i = 0; i < n; i ++)
+ printf ("%3d: %5d\n", i, insert_sub [i]);
+
+ printf ("Before Modify_For_B_Inserts:\n");
+ Dump (stdout);
+ }
+
+ n = insert_sub . size ();
+ for (i = 0; i < n && insert_sub [i] < b_lo; i ++)
+ b_lo ++;
+ // Note: can't wait till end of loop to increment b_lo by
+ // i because loop may end prematurely
+
+ p = skip . begin ();
+ while (p != skip . end () && i < n)
+ {
+ if (insert_sub [i] <= (* p) + i)
+ {
+ new_skip . push_back (insert_sub [i]);
+ i ++;
+ }
+ else
+ {
+ new_skip . push_back ((* p) + i);
+ p ++;
+ }
+ }
+
+ for ( ; p != skip . end (); p ++)
+ new_skip . push_back ((* p) + i);
+
+ b_hi += i;
+
+ while (i < n && insert_sub [i] < b_hi)
+ {
+ new_skip . push_back (insert_sub [i]);
+ i ++;
+ b_hi ++;
+ }
+
+ skip = new_skip;
+
+ if (Verbose > 2)
+ {
+ printf ("After Modify_For_B_Inserts:\n");
+ Dump (stdout);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Pass_Through
+ (const Alignment_t & ali)
+
+// Convert this alignment to refer to the b sequence in ali ,
+// which maps this alignment's consensus (as its a sequence)
+// to another sequence. Assume that the other sequence has
+// had gaps inserted where needed.
+
+ {
+ vector <int> new_skip;
+ bool done_b_lo = false;
+ int orig_b_lo;
+ int prev_new_skip = -1, skip_len;
+ int d, i, j, k, n;
+
+ if (Verbose > 2)
+ {
+ printf ("ali . a_lo/hi = %d/%d ali . b_lo/hi = %d/%d\n",
+ ali . a_lo, ali . a_hi, ali . b_lo, ali . b_hi);
+ printf ("a_lo/hi = %d/%d b_lo/hi = %d/%d\n",
+ a_lo, a_hi, b_lo, b_hi);
+ }
+ assert (ali . a_lo <= b_lo);
+ assert (b_hi <= ali . a_hi);
+
+ orig_b_lo = b_lo;
+ i = ali . a_lo;
+ j = ali . b_lo;
+ n = ali . delta . size ();
+ skip_len = skip . size ();
+ for (d = k = 0; d < int (ali . delta . size ()) && i < b_hi; d ++)
+ {
+ i += abs (ali . delta [d]) - 1;
+ j += abs (ali . delta [d]) - 1;
+ if (! done_b_lo && b_lo <= i)
+ {
+ b_lo += j - i;
+ done_b_lo = true;
+ }
+ while (k < skip_len && skip [k] <= i)
+ {
+ if (Verbose > 2)
+ printf ("k = %d i = %d j = %d old_skip = %d new_skip = %d\n",
+ k, i, j, skip [k], skip [k] + j - i);
+ new_skip . push_back (skip [k] + j - i);
+ prev_new_skip = skip [k] + j - i;
+ k ++;
+ }
+ if (ali . delta [d] < 0)
+ {
+ i ++;
+ j ++;
+ // Advance both because we assume the "j" sequence has
+ // had gaps inserted
+ }
+ else if (i >= b_hi)
+ break;
+ else
+ {
+ if (orig_b_lo <= i)
+ {
+ if (Verbose > 2)
+ printf ("k = %d i = %d j = %d b_lo = %d b_hi = %d"
+
+ " adding new_skip = %d\n", k, i, j, b_lo, b_hi, j);
+ if (j == prev_new_skip)
+ new_skip . push_back (j + 1);
+ else
+ new_skip . push_back (j);
+ }
+ j ++;
+ }
+ }
+
+ while (k < skip_len)
+ {
+ if (Verbose > 2)
+ printf ("k = %d i = %d j = %d old_skip = %d new_skip = %d\n",
+ k, i, j, skip [k], skip [k] + j - i);
+ new_skip . push_back (skip [k] + j - i);
+ k ++;
+ }
+
+ if (! done_b_lo)
+ b_lo += j - i;
+ b_hi += j - i;
+ skip = new_skip;
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Print_Subalignment_Line
+ (char * buff, int b1, int b2, char * s, int & a1, int & a2)
+
+// Write into buff the portion of this alignment of string s
+// that lies over subrange b1 .. b2 of a gapped consensus string.
+// Set a1 and a2 to the range of this sequence that corresponds
+// to what is printed.
+
+ {
+ int ct, limit;
+ int d, i, n;
+
+ ct = 0; // keep track of what's been written into buff
+ a1 = a2 = -1; // indicate no match unless changed
+
+ // fill buff with blanks to get to the start of characters
+ limit = Min (b_lo, b2);
+ while (b1 < limit)
+ {
+ buff [ct ++] = ' ';
+ b1 ++;
+ }
+
+ if (b1 == b2)
+ return;
+
+ n = skip . size ();
+
+ for (d = 0; d < n && skip [d] < b1; d ++)
+ ;
+
+ i = a1 = a_lo + b1 - b_lo - d;
+
+ limit = Min (b_hi, b2);
+ while (b1 < limit)
+ {
+ if (d < n && b1 == skip [d])
+ {
+ buff [ct ++] = '-';
+ d ++;
+ }
+ else
+ buff [ct ++] = s [i ++];
+ b1 ++;
+ }
+
+ a2 = i;
+
+ // pad with spaces if alignment ends before b2
+ while (b1 < b2)
+ {
+ buff [ct ++] = ' ';
+ b1 ++;
+ }
+
+ buff [ct] = '\0';
+
+ return;
+ }
+
+
+
+void Gapped_Alignment_t :: Shift_Skip
+ (int offset)
+
+// Add offset to all the values in this alignment's skip vector.
+
+ {
+ int i, n;
+
+ n = skip . size ();
+ for (i = 0; i < n; i ++)
+ skip [i] += offset;
+
+ return;
+ }
+
+
+
+
+// ### Gapped_MA_Bead_t methods ###
+
+
+void Gapped_MA_Bead_t :: Advance
+ (void)
+
+// Set seq_ch and qual_ch to the next character in the
+// alignment referred to by this bead. Also update the other
+// members to track the change.
+
+ {
+ b_pos ++;
+
+ if (b_pos == skip_pos)
+ {
+ seq_ch = '-';
+ qual_ch = Min (qual [a_pos], qual [a_pos + 1]);
+ skip_i ++;
+ skip_pos = ga -> Get_Skip (skip_i);
+ }
+ else
+ {
+ a_pos ++;
+ seq_ch = seq [a_pos];
+ qual_ch = qual [a_pos];
+ }
+
+ if (a_pos >= ga -> a_hi || b_pos >= ga -> b_hi)
+ active = false;
+
+ return;
+ }
+
+
+
+
+// ### Multi_Alignment_t methods ###
+
+
+void Multi_Alignment_t :: Clear
+ (void)
+
+// Make this multi-alignment empty.
+
+ {
+ consensus . assign ("");
+ align . clear ();
+
+ return;
+ }
+
+
+
+int Multi_Alignment_t :: Estimate_Offset_Position
+ (int i, const vector <int> & offset)
+
+// Estimate the position at which offset [i] would be in the
+// consensus of this multialignment using the previous alignments
+// in align [0 .. (i-1)] . The values in offset represent the
+// leftmost positino of each string relative to the preceding string.
+
+ {
+ int j, off;
+
+ off = offset [i];
+ for (j = i - 1; j >= 0; j --)
+ {
+ int len;
+
+ len = align [j] . a_hi - align [j] . a_lo;
+ if (off < len)
+ return align [j] . B_Position (off);
+
+ off += offset [j];
+ }
+
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Impossible offset = %d i = %d in Estimate_Offset_Position\n",
+ offset [i], i);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+
+ return -1;
+ }
+
+
+
+void Multi_Alignment_t :: Print_Alignments_To_Consensus
+ (FILE * fp, vector <char *> s)
+
+// Show the individual alignments of the strings in s to
+// the consensus sequence of this alignment
+
+ {
+ const char * con;
+ int i, n;
+
+ n = align . size ();
+ con = consensus . c_str ();
+
+ fprintf (fp, "\nConsensus len = %d\n", consensus . length ());
+ for (i = 0; i < n; i ++)
+ {
+ fprintf (fp, "\nString #%d:\n", i);
+
+ align [i] . Print (fp, s [i], con);
+ }
+
+ return;
+ }
+
+
+
+void Multi_Alignment_t :: Reset_From_Votes
+ (const vector <char *> & s,
+ int offset_delta, double error_rate,
+ vector <Vote_t> & vote, bool & changed)
+
+// Reset the consensus string in this multialignment from the
+// votes in vote . Redo the individual alignments of the
+// strings, which are in s . Allow offset_delta play either
+// direction at the start when re-doing the alignments and
+// assume an error-rate of error_rate . Save the votes of
+// the new alignments in vote . Set changed true iff the new
+// consensus string differs from the previous one.
+
+ {
+ string new_cons;
+ char * cons;
+ int adj, attempts, cons_len, wiggle;
+ int min_b_lo, max_b_hi;
+ int i, n;
+
+ n = vote . size ();
+
+ vector <short> adjust (n + 1, 0);
+ adj = 0;
+ // Keep track of adjustments in positions caused by indels so
+ // that when alignments are recalculated, we can start at
+ // the correct place
+
+ for (i = 0; i < n; i ++)
+ {
+ char ch;
+
+ adjust [i] = adj;
+
+ ch = vote [i] . Max_Here_Char ();
+ if (ch != ' ')
+ new_cons . push_back (ch);
+ else
+ adj --;
+
+ ch = vote [i] . Max_After_Char ();
+ if (ch != ' ')
+ {
+ new_cons . push_back (ch);
+ adj ++;
+ }
+ }
+
+ changed = (consensus != new_cons);
+ if (! changed)
+ return;
+
+ consensus = new_cons;
+ cons = strdup (new_cons . c_str ());
+ cons_len = new_cons . length ();
+
+ vote . resize (cons_len);
+ for (i = 0; i < cons_len; i ++)
+ vote [i] . Set_Zero ();
+
+ n = s . size ();
+ min_b_lo = INT_MAX;
+ max_b_hi = 0;
+ for (i = 0; i < n; i ++)
+ {
+ bool ok;
+ int error_limit, len, off;
+ int lo, hi;
+
+ len = strlen (s [i]);
+ error_limit = Binomial_Cutoff (len, error_rate, BIN_CUTOFF_PROB);
+
+ // need to adjust b_lo here because of indels ****
+
+ if (Verbose > 3)
+ {
+ char tag [1000];
+
+ sprintf (tag, "cons");
+ Fasta_Print (stderr, cons, tag);
+
+ sprintf (tag, "s[%d] offset = %d", i, align [i] . b_lo);
+ Fasta_Print (stderr, s [i], tag);
+
+ fprintf (stderr, "error_limit = %d b_lo = %d\n",
+ error_limit, align [i] . b_lo);
+ }
+
+ attempts = 0;
+ wiggle = offset_delta;
+ do
+ {
+ Fix_Status_t status;
+
+ off = align [i] . b_lo + adjust [align [i] . b_lo];
+ lo = Max (off - wiggle, 0);
+ hi = Min (off + wiggle, cons_len);
+ ok = Substring_Match_VS
+ (s [i], len, cons, cons_len, lo, hi,
+ error_limit, align [i]);
+ if (! ok)
+ {
+ wiggle *= 2;
+ error_limit += Min (1, int (error_limit * 0.10));
+ }
+ else
+ {
+ align [i] . Check_Fix_Start (s [i] , len, cons, cons_len, status);
+ if (status == NEEDS_LEFT_SHIFT)
+ ok = false;
+ }
+
+ } while (! ok && ++ attempts < MAX_ALIGN_ATTEMPTS);
+
+ if (! ok)
+ {
+ Fix_Status_t fix_status;
+ iostream::fmtflags ios_status;
+
+//##ALD Replace this with a Substring_Align
+ Overlap_Align (s [i], len, cons, lo, hi, cons_len,
+ 1, -3, -2, -2, align [i]);
+ align [i] . a_len = len;
+ align [i] . Check_Fix_Start (s [i] , len, cons, cons_len,
+ fix_status);
+
+ cerr << "In Reset_From_Votes in contig " << id << endl
+ << " Forced alignment of string subscript " << i
+ << " to consensus\n";
+ ios_status = cerr . setf (ios :: fixed);
+ cerr << " with " << align [i] . errors << " errors ("
+ << setprecision (2) << 100.0 * align [i] . Error_Rate ()
+ << "% error)" << endl;
+ cerr . setf (ios_status);
+
+#if 0
+ sprintf (Clean_Exit_Msg_Line,
+ "Failed on string %d in Reset_From_Votes", i);
+ throw AlignmentException_t (Clean_Exit_Msg_Line, __LINE__, __FILE__,
+ -1, i);
+#endif
+ }
+
+ align [i] . Incr_Votes (vote, s [i]);
+ if (align [i] . b_lo < min_b_lo)
+ min_b_lo = align [i] . b_lo;
+ if (align [i] . b_hi > max_b_hi)
+ max_b_hi = align [i] . b_hi;
+ }
+
+ if (max_b_hi < cons_len)
+ consensus . resize (max_b_hi);
+
+ if (min_b_lo > 0)
+ {
+ consensus . erase (0, min_b_lo);
+ for (i = 0; i < n; i ++)
+ {
+ align [i] . b_lo -= min_b_lo;
+ align [i] . b_hi -= min_b_lo;
+ }
+ }
+
+ free (cons);
+
+ return;
+ }
+
+
+
+void Multi_Alignment_t :: Set_Consensus
+ (char * s)
+
+// Make this multialignment's consensus string be s .
+
+ {
+ consensus . assign (s);
+ }
+
+
+
+void Multi_Alignment_t :: Set_Initial_Consensus
+ (const vector <char *> & s, const vector <int> & offset,
+ int offset_delta, double error_rate, int min_overlap,
+ vector <Vote_t> & vote, vector <char *> * tag_list)
+
+// Create an initial consensus string in this multialignment from the
+// strings in s with nominal relative offsets in offset . Offsets
+// are allowed to vary by +/- offset_delta and the allowed error rate
+// in alignments is error_rate . Strings must overlap by
+// at least min_overlap bases. Set vote to the votes of the strings
+// at each position of the consensus. Create the consensus by greedily
+// tiling the strings in order, appending the extension of any
+// string that aligns past the end of the consensus. Store the
+// initial alignments in this consensus, too. If tag_list isn't
+// NULL , then use its values to identify strings.
+
+ {
+ Vote_t v;
+ Alignment_t ali;
+ char * cons;
+ bool wrote_contig_id = false;
+ int cons_len;
+ int num_strings;
+ int i, j;
+
+ Clear ();
+ vote . clear ();
+
+ cons = strdup (s [0]);
+ cons_len = strlen (cons);
+ for (j = 0; j < cons_len - 1; j ++)
+ {
+ v . Set_To (s [0] [j], true);
+ vote . push_back (v);
+ }
+ v . Set_To (s [0] [cons_len - 1], false);
+ vote . push_back (v);
+
+ ali . Set_To_Identity (cons_len);
+ align . push_back (ali);
+
+ num_strings = s . size ();
+ // where the last string started in the consensus
+
+
+ for (i = 1; i < num_strings; i ++)
+ {
+ bool wrote_string_tag = false;
+ bool matched;
+ double erate;
+ int error_limit, len, exp_olap_len;
+ int attempts, curr_offset, wiggle;
+ int lo, hi;
+
+ len = strlen (s [i]);
+ attempts = 0;
+ wiggle = offset_delta;
+ erate = error_rate;
+
+ curr_offset = Min (cons_len, Estimate_Offset_Position (i, offset));
+ // where offset position hits the consensus, based on prior
+ // string alignment(s)
+
+ do
+ {
+ lo = Max (0, curr_offset - wiggle);
+ hi = Min (cons_len - min_overlap, curr_offset + wiggle);
+ exp_olap_len = Min (cons_len - lo, len);
+
+ error_limit = Binomial_Cutoff (exp_olap_len, erate, BIN_CUTOFF_PROB);
+ // Add the current read to the consensus if there is an overlap
+ matched = Overlap_Match_VS (s [i], len, cons, cons_len, lo, hi,
+ 0, error_limit, ali);
+ matched = matched && ali . Error_Rate () <= erate;
+
+ if (Verbose > 0 && matched && attempts > 0)
+ fprintf (stderr,
+ "Matched with wiggle = %d error_rate = %.1f%%\n",
+ wiggle, 100.0 * ali . Error_Rate ());
+
+ if (! matched)
+ {
+ if (Verbose > 0)
+ {
+ if (! wrote_contig_id)
+ {
+ cerr << endl
+ << "In Set_Initial_Consensus for contig " << id
+ << ":" << endl;
+ wrote_contig_id = true;
+ }
+ if (tag_list != NULL && ! wrote_string_tag)
+ {
+ cerr << "For string " << (* tag_list) [i] << endl;
+ wrote_string_tag = true;
+ }
+ cerr << "Alignment failed with wiggle = " << wiggle
+ << " error_limit = " << error_limit << endl;
+ }
+ wiggle *= 2;
+ erate += 0.01;
+ }
+ } while (! matched && ++ attempts < MAX_ALIGN_ATTEMPTS);
+
+ if (! matched)
+ {
+ iostream::fmtflags status;
+ int a_width, b_width, max_width;
+
+ if (Verbose > 0)
+ cerr << "No more Mr. Nice Guy--forcing alignment" << endl;
+
+ Overlap_Align (s [i], len, cons, lo, hi, cons_len,
+ 1, -3, -2, -2, ali);
+ ali . a_len = len;
+
+ a_width = ali . a_hi - ali . a_lo;
+ b_width = ali . b_hi - ali . b_lo;
+ max_width = Max (a_width, b_width);
+
+ cerr << "In contig " << id << " forced alignment of "
+ << a_width << " bases of string ";
+ if (tag_list != NULL)
+ cerr << (* tag_list) [i] << " ";
+ cerr << "subscript " << i;
+ cerr << " to " << b_width << " bases of consensus\n";
+ status = cerr . setf (ios :: fixed);
+ cerr << " with " << ali . errors << " errors ("
+ << setprecision (2) << Percent (ali . errors, max_width)
+ << "% error)" << endl;
+ cerr . setf (status);
+
+#if 0
+ fprintf (stderr,
+ "\nERROR: Failed to find overlap between this string:\n");
+ Fasta_Print (stderr, s [i]);
+ fprintf (stderr, "\nand this portion of prior consensus:\n");
+ Fasta_Print (stderr, cons + lo);
+ fprintf (stderr,
+ "\nstarting in the first %d bases with at most %d errors\n\n",
+ hi - lo, error_limit);
+ sprintf (Clean_Exit_Msg_Line,
+ "Failed on string %d in Set_Initial_Consensus", i);
+ throw AlignmentException_t (Clean_Exit_Msg_Line, __LINE__, __FILE__,
+ -1, i);
+#endif
+ }
+
+ ali . Incr_Votes (vote, s [i]);
+
+ if (ali . a_hi < len)
+ { // s [i] extends past the end of the current consensus
+ int extra;
+
+ extra = len - ali . a_hi;
+ cons = (char *) Safe_realloc (cons, cons_len + extra + 1,
+ __FILE__, __LINE__);
+ strcpy (cons + cons_len, s [i] + ali . a_hi);
+ cons_len += extra;
+
+ for (j = ali . a_hi; j < len - 1; j ++)
+ {
+ v . Set_To (s [i] [j], true);
+ vote . push_back (v);
+ }
+ v . Set_To (s [i] [len - 1], false);
+ vote . push_back (v);
+
+ ali . a_hi = len;
+ ali . b_hi = cons_len;
+ }
+
+ ali . a_len = len;
+ align . push_back (ali);
+ }
+
+ if (Verbose > 1)
+ {
+ fprintf (stderr, "*** Votes ***\n");
+ fprintf (stderr, "%5s: %2s ------ Here ------- ------ After ------\n",
+ "Pos", "Ch");
+ for (j = 0; j < cons_len; j ++)
+ fprintf (stderr, "%5d: %c %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d\n",
+ j, cons [j],
+ vote [j] . here [0], vote [j] . here [1],
+ vote [j] . here [2], vote [j] . here [3],
+ vote [j] . here [4],
+ vote [j] . after [0], vote [j] . after [1],
+ vote [j] . after [2], vote [j] . after [3],
+ vote [j] . after [4]);
+ }
+
+ consensus . assign (cons);
+ free (cons);
+
+ return;
+ }
+
+
+
+
+// ### Gapped_Multi_Alignment_t methods ###
+
+
+void Gapped_Multi_Alignment_t :: Add_Aligned_Seqs
+ (const Gapped_Multi_Alignment_t & m, const Alignment_t & ali,
+ int cons_lo, int cons_hi, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1, vector <char *> * tg2)
+
+// Add sequences in m that align to positions cons_lo .. cons_hi
+// in m . consensus to this multialignment. Use alignment ali
+// to map m . consensus to this -> consensus . Check sl2_place
+// to see if the actual sequence is already in sl1 . If not, add it
+// onto the end of sl1 and set the corresponding sl2_place entry
+// to indicate where it is. If
+// tg1 and tg2 are not both NULL, also add the tags from
+// tg2 onto the end of tg1 (unless sl2_place indicates they're
+// already there).
+
+ {
+ Gapped_Alignment_t sub_ali;
+ bool use_tgs = (tg1 != NULL && tg2 != NULL);
+ int i, j, n;
+
+ if (Verbose > 2)
+ {
+ printf ("ali:\n");
+ ali . Dump (stdout);
+ }
+ n = m . align . size ();
+ for (i = 0; i < n; i ++)
+ if (Range_Intersect (cons_lo, cons_hi, m . align [i] . b_lo,
+ m . align [i] . b_hi))
+ {
+ if (Verbose > 2)
+ {
+ printf ("m . align [%d]:\n", i);
+ m . align [i] . Dump (stdout);
+ }
+
+ m . align [i] . Make_Sub_Alignment (sub_ali, cons_lo, cons_hi);
+
+ if (Verbose > 2)
+ {
+ printf ("First sub_ali:\n");
+ sub_ali . Dump (stdout);
+ }
+
+ sub_ali . Pass_Through (ali);
+
+ if (Verbose > 2)
+ {
+ printf ("sub_ali after Pass_Through:\n");
+ sub_ali . Dump (stdout);
+ }
+
+ if (sl2_place [i] >= 0)
+ j = sl2_place [i];
+ else
+ {
+ sl1 . push_back (strdup (sl2 [i]));
+ if (use_tgs)
+ (* tg1) . push_back (strdup ((* tg2) [i]));
+ j = sl1 . size () - 1;
+ sl2_place [i] = j;
+ }
+
+ sub_ali . string_sub = j;
+ align . push_back (sub_ali);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Clear
+ (void)
+
+// Clear this gapped multi-alignment.
+
+ {
+ consensus . erase ();
+ con_qual . erase ();
+ align . clear ();
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Consensus_To_Lower
+ (void)
+
+// Convert the consensus sequence in this multialignment
+// to lowercase.
+
+ {
+ int i, n;
+
+ n = consensus . length ();
+ for (i = 0; i < n; i ++)
+ consensus [i] = tolower (consensus [i]);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Convert_Consensus
+ (const Multi_Alignment_t & ma, const vector <short> & v)
+
+// Convert the (ungapped) consensus string in ma to a gapped
+// one in this gapped multialignment by inserting extra '-'s.
+// The number of hyphens to insert at each position is specified
+// in v .
+
+ {
+ int len;
+ int i, j, n;
+
+ len = ma . consensus . length ();
+ n = v . size ();
+
+ if (n <= len)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Gapped_Multi_Alignment_t :: Convert_Consensus\n"
+ " insert vector shorter than consensus string\n"
+ " len = %d insert size = %d",
+ len, int (v . size ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ consensus . assign ("");
+ for (i = 0; i < len; i ++)
+ {
+ for (j = 0; j < v [i]; j ++)
+ consensus . push_back ('-');
+ consensus . push_back (ma . consensus [i]);
+ }
+
+ for (j = 0; j < v [len]; j ++)
+ consensus . push_back ('-');
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Convert_From
+ (const Multi_Alignment_t & ma)
+
+// Convert the mulitalignment ma (where the consensus has no gaps)
+// to a gapped multialignment where the consensus has gaps (enough
+// to hold all insertions of all strings in the multialignment).
+
+ {
+ Gapped_Alignment_t ga;
+ int len;
+ int i, n;
+
+ id = ma . id;
+
+ len = 1 + ma . consensus . length ();
+
+ vector <short> insert (len, 0);
+ vector <int> tr (len, 0);
+
+ n = ma . align . size ();
+ for (i = 0; i < n; i ++)
+ ma . align [i] . Set_Inserts (insert);
+
+ Convert_Consensus (ma, insert);
+
+ // build translation table for each position in ungapped consensus
+ // to its corresponding position in the gapped consensus
+ tr [0] = insert [0];
+ for (i = 1; i < len; i ++)
+ tr [i] = tr [i - 1] + insert [i] + 1;
+
+ align . clear ();
+ for (i = 0; i < n; i ++)
+ {
+ ga . Convert_From (ma . align [i], tr);
+ align . push_back (ga);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Count_Column_Chars
+ (Matrix <unsigned char> & count,
+ const vector <char *> & sl)
+
+// Set entries in count to number of each character in
+// corresponding alignment columns. sl has the actual
+// sequences. Assume entries in count are all already zero.
+
+ {
+ int len;
+ int i, n;
+
+ if (sl . size () != align . size ())
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Count_Column_Chars called with %d strings and %d alignments",
+ int (sl . size ()), int (align . size ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ n = align . size ();
+ len = getConsensusLen ();
+ if (count . NumRows () < len)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Count_Column_Chars called with count vector = %d\n"
+ " and consensus len = %d",
+ count . NumRows (), len);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ for (i = 0; i < n; i ++)
+ align [i] . Incr_Column_Chars (count, sl [i]);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Dump_Aligns
+ (FILE * fp)
+
+// Print to fp the alignments in this multialignment.
+
+ {
+ int i, n;
+
+ n = align . size ();
+ fprintf (fp, "### num aligns = %d\n", n);
+ for (i = 0; i < n; i ++)
+ align [i] . Dump (fp);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Expand_Consensus
+ (const Alignment_t & ali)
+
+// Adjust the consensus sequence of this multialignment to add
+// gaps where needed to accommodate the alignment in ali ,
+// which represents the alignment of another consensus to this one.
+// Also adjust the individual read alignments for the new gaps added.
+
+ {
+ Delta_Encoding_t delta = ali . getDelta ();
+ vector <int> insert_sub;
+ int prev;
+ int i, n;
+
+ n = delta . size ();
+ prev = ali . b_lo;
+ for (i = 0; i < n; i ++)
+ if (delta [i] > 0)
+ prev += delta [i];
+ else
+ {
+ prev -= delta [i];
+ insert_sub . push_back (prev - 1);
+ consensus . insert (prev - 1, 1, '-');
+ }
+
+ n = insert_sub . size ();
+
+ if (n == 0)
+ return; // nothing to do
+
+ if (Verbose > 2)
+ for (i = 0; i < n; i ++)
+ printf ("insert_sub [%d] = %d\n", i, insert_sub [i]);
+
+ n = align . size ();
+ for (i = 0; i < n; i ++)
+ if (insert_sub [0] < align [i] . b_hi)
+ align [i] . Modify_For_B_Inserts (insert_sub);
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Extract_Gapped_Region
+ (int lo, int hi, string & s, int & gapped_lo, int & gapped_hi) const
+
+// Set s to the substring of the gapped consensus
+// between lo and hi , where lo and hi are
+// *UN*gapped positions. Set gapped_lo and gapped_hi
+// to indicate the region in the gapped consensus that
+// was extracted.
+
+ {
+ bool is_first = true;
+ int i, j, n;
+
+ s . erase ();
+
+ n = consensus . length ();
+ for (i = j = 0; i < n && j < hi; i ++)
+ {
+ if (consensus [i] != '-')
+ j ++;
+ if (j > lo && j <= hi)
+ {
+ s . push_back (consensus [i]);
+ if (is_first)
+ {
+ gapped_lo = i;
+ is_first = false;
+ }
+ gapped_hi = i + 1;
+ }
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Extract_IMP_Dels
+ (vector < vector <int> > & del_list)
+
+// Set del_list to be the del entries in IMP submessages
+// corresponding to the skip values in this alignment.
+
+ {
+ vector <int> del;
+ int i, n;
+
+ del_list . clear ();
+
+ n = align . size ();
+ for (i = 0; i < n; i ++)
+ {
+ align [i] . Convert_Skip_to_Del (del);
+ del_list . push_back (del);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Full_Merge_Left
+ (const Gapped_Multi_Alignment_t & m, int adj_a_lo, int a_lo, int a_hi,
+ int b_lo, int b_hi, int & prefix_len_added, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1, vector <char *> * tg2)
+
+// Merge the prefix of the alignment in m onto the front
+// of this alignment. The region a_lo .. a_hi
+// in the m consensus matches the prefix of this
+// alignment b_lo .. b_hi . Note that b_lo may be
+// slightly bigger than 0, so some "play" is allowed
+// for finding where the beginning of this multialignment
+// consensus actually hits m 's consensus. The search for the
+// start of the alignment begins between adj_a_lo and a_lo + 1 .
+// sl1 and sl2 are the sequences of the reads for this
+// multialignment and multialignment m , respectively.
+// Set prefix_len_added to the number of *ungapped* positions
+// in the prefix prepended to this consensus sequence.
+// Must have a_lo <= a_hi and b_lo <= b_hi .
+// sl2_place indicates whether and where sl2 strings are already
+// in sl1 . Any new strings are added
+// from sl2 to end of sl1 and sl2_place is updated.
+// If neither tg1 nor tg2 is NULL , then also add relevant
+// sequences from tg2 to the end of tg1 , mirroring sl1
+// and sl2 .
+
+ {
+ Alignment_t ali;
+ Align_Score_Entry_t last_entry;
+ string x, y;
+ int a_gapped_lo, a_gapped_hi, b_gapped_lo, b_gapped_hi;
+ int x_len, y_len, x_slip, extra;
+
+ // First align the consensus sequences (also aligning the gap
+ // positions based on the characters that are there) in the
+ // overlap region
+
+ // Pull out the respective consensus regions to the end of each
+ // sequence.
+ // Need to add some indication of what characters aligned with the
+ // gap position
+ m . Extract_Gapped_Region (adj_a_lo, a_hi, x, a_gapped_lo, a_gapped_hi);
+ x_len = x . length ();
+
+ Extract_Gapped_Region (0, b_hi, y, b_gapped_lo, b_gapped_hi);
+ y_len = y . length ();
+
+ // Align them
+ // Need to add something to take into account characters associated
+ // with gap positions
+ // The alignments must end exactly where indicated
+
+ x_slip = 1 + Gapped_Equivalent (a_lo - adj_a_lo, x);
+ Complete_Align (y . c_str (), 0, y_len, x . c_str (), 0,
+ x_slip, x_len, 2, -3, -2, -1, NULL, last_entry, ali);
+
+ if (Verbose > 2)
+ {
+ printf ("Full_Merge_Left: Alignment before flip:\n");
+ ali . Print (stdout, y . c_str (), x . c_str ());
+ }
+
+ ali . Flip_AB ();
+
+ if (Verbose > 2)
+ {
+ printf ("Full_Merge_Left: Alignment after flip:\n");
+ ali . Print (stdout, x . c_str (), y . c_str ());
+ }
+
+ extra = a_gapped_lo + ali . a_lo;
+
+ // Prepend the leftover part of a to the front of this consensus sequence
+ // Because the added leftover part is identical, only need to adjust
+ // the first delta value.
+
+ assert (extra >= 0);
+ if (extra > 0)
+ {
+ consensus . insert (0, m . consensus, 0, extra);
+ ali . Shift_First_Delta (extra);
+ Shift_B_Right (extra);
+ }
+
+ ali . a_lo = 0;
+ ali . a_hi = a_gapped_hi;
+ assert (ali . b_lo == 0);
+ ali . b_hi += extra;
+
+ Expand_Consensus (ali);
+
+ if (Verbose > 2)
+ {
+ cout << endl << endl << "Contig in Full_Merge_Left after Expand_Consensus"
+ << endl;
+ cout << "sl1 . size () = " << sl1 . size () << endl;
+ cout << "sl2 . size () = " << sl2 . size () << endl;
+ Print (stdout, sl1, 60);
+ }
+
+ Add_Aligned_Seqs (m, ali, 0, a_gapped_hi, sl1, sl2, sl2_place,
+ tg1, tg2);
+
+ if (Verbose > 2)
+ {
+ int i, n;
+
+ n = align . size ();
+ cout << endl << "Align after Full_Merge_Right n = " << n << endl;
+ cout << "sl1 . size () = " << sl1 . size () << endl;
+ cout << "sl2 . size () = " << sl2 . size () << endl;
+ for (i = 0; i < n; i ++)
+ {
+ printf ("align [%d]:\n", i);
+ align [i] . Dump (stdout);
+ }
+
+ n = sl2_place . size ();
+ cout << endl << "sl2_place n = " << n << endl;
+ for (i = 0; i < n; i ++)
+ cout << sl2_place [i] << endl;
+ }
+
+ // Eventually re-call the consensus here
+
+ prefix_len_added = Ungapped_Positions (consensus, 0, extra);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Full_Merge_Right
+ (const Gapped_Multi_Alignment_t & m, int a_lo,
+ int b_lo, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1, vector <char *> * tg2)
+
+// Merge the entire alignment in m starting at a_lo
+// into this alignment starting at b_lo . The presumption
+// is that the alignment will go to the right end of this
+// multialignment and beyond to extend it.
+// sl1 and sl2 are the sequences of the reads for this
+// multialignment and multialignment m , respectively.
+// Must have a_lo <= a_hi and b_lo <= b_hi .
+// sl2_place indicates whether and where sl2 strings are already
+// in sl1 . Any new strings are added
+// from sl2 to end of sl1 and sl2_place is updated.
+// If neither tg1 nor tg2 is NULL , then also add relevant
+// sequences from tg2 to the end of tg1 , mirroring sl1
+// and sl2 .
+
+ {
+ Alignment_t ali;
+ string x, y;
+ int a_gapped_lo, a_gapped_hi, b_gapped_lo, b_gapped_hi;
+ int a_hi, b_hi, x_len, y_len, extra;
+
+ // First align the consensus sequences (also aligning the gap
+ // positions based on the characters that are there) in the
+ // overlap region
+
+ // Pull out the respective consensus regions to the end of each
+ // sequence.
+ // Need to add some indication of what characters aligned with the
+ // gap position
+ a_hi = m . Ungapped_Consensus_Len ();
+ m . Extract_Gapped_Region (a_lo, a_hi, x, a_gapped_lo, a_gapped_hi);
+ x_len = x . length ();
+
+ b_hi = Ungapped_Consensus_Len ();
+ Extract_Gapped_Region (b_lo, b_hi, y, b_gapped_lo, b_gapped_hi);
+ y_len = y . length ();
+
+ // Align them
+ // Need to add something to take into account characters associated
+ // with gap positions
+ // This version has no flexibility--the alignments must start exactly
+ // where indicated
+ Overlap_Align (x . c_str (), x_len, y . c_str (), 0, 1, y_len,
+ 2, -3, -2, -1, ali);
+
+ if (Verbose > 2)
+ ali . Print (stdout, x . c_str (), y . c_str ());
+
+ extra = x_len - ali . a_hi;
+
+ // Append the leftover part of a to the end of this sequence
+ if (extra > 0)
+ {
+ assert (ali . b_hi == y_len);
+ consensus . append (x, ali . a_hi, extra);
+ }
+ else
+ extra = 0;
+
+ // Because the added leftover part is identical, the alignment is
+ // correct for the entire region, too.
+
+ ali . a_lo += a_gapped_lo;
+ ali . a_hi += a_gapped_lo + extra;
+ ali . b_lo += b_gapped_lo;
+ ali . b_hi += b_gapped_lo + extra;
+
+ Expand_Consensus (ali);
+
+ if (Verbose > 2)
+ {
+ cout << endl << endl << "Contig in Full_Merge_Right after Expand_Consensus"
+ << endl;
+ cout << "sl1 . size () = " << sl1 . size () << endl;
+ cout << "sl2 . size () = " << sl2 . size () << endl;
+ Print (stdout, sl1, 60);
+ }
+
+ Add_Aligned_Seqs (m, ali, a_gapped_lo, a_gapped_hi, sl1, sl2, sl2_place,
+ tg1, tg2);
+
+ if (Verbose > 2)
+ {
+ int i, n;
+
+ n = align . size ();
+ cout << endl << "Align after Full_Merge_Right n = " << n << endl;
+ cout << "sl1 . size () = " << sl1 . size () << endl;
+ cout << "sl2 . size () = " << sl2 . size () << endl;
+ for (i = 0; i < n; i ++)
+ {
+ printf ("align [%d]:\n", i);
+ align [i] . Dump (stdout);
+ }
+
+ n = sl2_place . size ();
+ cout << endl << "sl2_place n = " << n << endl;
+ for (i = 0; i < n; i ++)
+ cout << sl2_place [i] << endl;
+ }
+
+ // Eventually re-call the consensus here
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Get_Distinguishing_Columns
+ (vector <Distinguishing_Column_t> & dc,
+ const vector <char *> & sl)
+
+// Fill dc with the distinguishing columns in this multialignment.
+// A distinguishing column has a confirmed SNP.
+// It may actually be a range of adjacent columns.
+// sl holds the component sequences in the multialignment and
+
+ {
+ Distinguishing_Column_t d;
+ int i, len;
+
+ dc . clear ();
+
+ len = getConsensusLen ();
+
+ Matrix <unsigned char> count (len, 5);
+ // counts of a, c, g, t and - at each position of consensus
+ // automatically set to zero
+
+ Count_Column_Chars (count, sl);
+
+ for (i = 0; i < len; i ++)
+ {
+ char ch1, ch2;
+ int ch1_ct, ch2_ct;
+
+ if (Is_Distinguishing (count . getRow (i), ch1, ch1_ct, ch2, ch2_ct))
+ {
+ d . lo = i;
+ d . hi = i + 1; // restrict to single characters for now
+ d . hapa_ch = ch1;
+ d . hapb_ch = ch2;
+ d . phase_ch = ' ';
+ Get_Element_Subs (d, sl);
+
+ dc . push_back (d);
+ }
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Get_Element_Subs
+ (Distinguishing_Column_t & d, const vector <char *> & sl)
+
+// Fill hapa_sub and hapb_sub in d with the subscripts
+// of the strings in sl that have d . hapa_ch and d . hapb_ch ,
+// respectively, at the position indicated in d .
+
+ {
+ int i, n;
+
+ d . hapa_sub . clear ();
+ d . hapb_sub . clear ();
+
+ n = align . size ();
+ for (i = 0; i < n; i ++)
+ if (Range_Intersect (align [i] . b_lo, align [i] . b_hi, d . lo, d . hi))
+ {
+ char ch;
+
+ ch = align [i] . Get_Aligning_Char (d . lo, sl [i]);
+ if (ch == d . hapa_ch)
+ d . hapa_sub . push_back (i);
+ else if (ch == d . hapb_ch)
+ d . hapb_sub . push_back (i);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Get_Partial_Ungapped_Consensus
+ (string & s, int lo, int hi) const
+
+// Set s to the ungapped portion of the consensus of this
+// multialignment between positions lo and hi (in gap
+// coordinates).
+
+ {
+ int i, j, n;
+
+ s . erase ();
+ n = consensus . length ();
+ for (i = j = 0; i < n && j < hi; i ++)
+ if (consensus [i] != '-')
+ {
+ if (lo <= j)
+ s . push_back (consensus [i]);
+ j ++;
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Get_Positions
+ (vector <AMOS :: Range_t> & pos) const
+
+// Set pos to the list of b_lo and b_hi values in
+// the align vector of this alignment
+
+ {
+ int i, n;
+
+ n = align . size ();
+ pos . resize (n);
+
+ for (i = 0; i < n; i ++)
+ pos [i] . setRange (align [i] . b_lo, align [i] . b_hi);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Get_Ungapped_Consensus
+ (string & s)
+
+// Set s to the ungapped consensus sequence of this
+// multialignment.
+
+ {
+ int i, n;
+
+ s . erase ();
+ n = consensus . length ();
+ for (i = 0; i < n; i ++)
+ if (consensus [i] != '-')
+ s . push_back (consensus [i]);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Haplo_Sep
+ (const vector <char *> & sl, vector <Distinguishing_Column_t> & dc,
+ vector <char *> * tg)
+
+// Identify distinguishing columns in this multialignment
+// and use them to partition the elements into separate
+// haplotypes as much as possible. sl holds the sequences
+// of the elements and tg holds the id tags of the elements.
+// Set dc to hold the SNPs between the haplotypes.
+
+ {
+ vector <char> side;
+ vector <int> segment;
+ int i, m, n;
+
+ Get_Distinguishing_Columns (dc, sl);
+
+ Set_Phase (dc);
+
+ n = sl . size ();
+ vector <int> pos (n, 0), neg (n, 0);
+
+ Classify_Reads (dc, n, side, segment);
+
+ m = dc . size ();
+ for (i = 0; i < m; i ++)
+ {
+ int j, k;
+
+ if (dc [i] . phase_ch == '+')
+ {
+ k = dc [i] . hapa_sub . size ();
+ for (j = 0; j < k; j ++)
+ pos [dc [i] . hapa_sub [j]] ++;
+
+ k = dc [i] . hapb_sub . size ();
+ for (j = 0; j < k; j ++)
+ neg [dc [i] . hapb_sub [j]] ++;
+ }
+ else if (dc [i] . phase_ch == '-')
+ {
+ k = dc [i] . hapa_sub . size ();
+ for (j = 0; j < k; j ++)
+ neg [dc [i] . hapa_sub [j]] ++;
+
+ k = dc [i] . hapb_sub . size ();
+ for (j = 0; j < k; j ++)
+ pos [dc [i] . hapb_sub [j]] ++;
+ }
+ }
+
+ int p_ct = 0, n_ct = 0, u_ct = 0;
+
+ printf ("String Assignments:\n");
+ for (i = 0; i < n; i ++)
+ {
+ if (tg != NULL)
+ printf ("%3d %8s: %7d %7d %c %4d\n", i, (* tg) [i], pos [i], neg [i],
+ side [i], segment [i]);
+ else
+ printf ("%3d: %7d %7d %c %4d\n", i, pos [i], neg [i], side [i],
+ segment [i]);
+ if (pos [i] > neg [i])
+ p_ct ++;
+ else if (pos [i] < neg [i])
+ n_ct ++;
+ else
+ u_ct ++;
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Make_From_CCO_Msg
+ (const Celera_Message_t & msg, const vector <int> & slen)
+
+// Set this multi-alignment to the one in the Celera CCO
+// message msg . slen is the lengths of the reads in msg .
+
+ {
+ vector <Celera_MPS_Sub_Msg_t> mps_list;
+ vector <Celera_UPS_Sub_Msg_t> ups_list;
+ Ordered_Range_t position;
+ Gapped_Alignment_t ga;
+ vector <int> del;
+ int i, n, slen_sub;
+
+ consensus = msg . getConsensus ();
+ n = consensus . length ();
+ for (i = 0; i < n; i ++)
+ consensus [i] = tolower (consensus [i]);
+ con_qual = msg . getQuality ();
+
+ align . clear ();
+
+ mps_list = msg . getMPSList ();
+ ups_list = msg . getUPSList ();
+
+ n = mps_list . size ();
+ for (i = 0; i < n; i ++)
+ {
+ int j, k, x, y;
+
+ ga . a_lo = 0;
+ ga . a_hi = slen [i];
+ ga . a_len = slen [i];
+ position = mps_list [i] . getPosition ();
+ x = position . getBegin ();
+ y = position . getEnd ();
+ if (x < y)
+ {
+ ga . b_lo = x;
+ ga . b_hi = y;
+ ga . flipped = 0;
+ }
+ else
+ {
+ ga . b_lo = y;
+ ga . b_hi = x;
+ ga . flipped = 1;
+ }
+ ga . errors = 0; // Temporary--needs to be set correctly later
+ del = mps_list [i] . getDel ();
+ k = del . size ();
+ for (j = 0; j < k; j ++)
+ del [j] += ga . b_lo + j;
+ ga . setSkip (del);
+ align . push_back (ga);
+ }
+
+ slen_sub = n;
+
+ // Only extract alignment for surrogate (i.e., stone) unitigs
+ n = ups_list . size ();
+ for (i = 0; i < n; i ++)
+ {
+ int j, k, x, y;
+
+ if (ups_list [i] . getUnitigType () == STONE_UNI_T)
+ {
+ ga . a_lo = 0;
+ ga . a_hi = slen [slen_sub];
+ ga . a_len = slen [slen_sub];
+ slen_sub ++;
+ position = ups_list [i] . getPosition ();
+ x = position . getBegin ();
+ y = position . getEnd ();
+ if (x < y)
+ {
+ ga . b_lo = x;
+ ga . b_hi = y;
+ ga . flipped = 0;
+ }
+ else
+ {
+ ga . b_lo = y;
+ ga . b_hi = x;
+ ga . flipped = 1;
+ }
+ ga . errors = 0; // Temporary--needs to be set correctly later
+ del = ups_list [i] . getDel ();
+ k = del . size ();
+ for (j = 0; j < k; j ++)
+ del [j] += ga . b_lo + j;
+ ga . setSkip (del);
+ align . push_back (ga);
+ }
+ }
+
+ if (slen_sub != int (slen . size ()))
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: In Make_From_CCO_Msg used %d of %d lengths\n"
+ " Should have been equal", slen_sub, int (slen.size ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Make_Gapped_Ungapped_Lookup
+ (vector <int> & lookup)
+
+// Set lookup to hold the corresponding ungapped position
+// for every position in this multialignment's consensus.
+
+ {
+ int i, n;
+
+ n = consensus . length ();
+ lookup . resize (n + 1);
+
+ lookup [0] = 0;
+ for (i = 0; i < n; i ++)
+ if (consensus [i] == '-')
+ lookup [i + 1] = lookup [i];
+ else
+ lookup [i + 1] = 1 + lookup [i];
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Merge
+ (const Gapped_Multi_Alignment_t & m)
+
+// Merge the multialignment m into this one
+
+ {
+ // Not done yet. Need to add extra parameters specifying
+ // where the merge happens (including orientation)
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Output_Read_Positions
+ (FILE * fp, int id, const vector <char *> & tag, int orig_tag_ct,
+ int len, int offset)
+
+// Output to fp a header line for this multialignment
+// containing id and the (ungapped) length of the consensus
+// followed by a list of reads and their implied positions
+// in this multialignment. Include an indication of whether
+// the read is an original read (if it's subscript is < orig_tag_ct )
+// or an added one (otherwise). len is the length of the
+// ungapped consensus. offset is added to the b positions
+// of all the reads
+
+ {
+ vector <int> lookup;
+ vector <Base_Alignment_t> extreme;
+ // holds extreme positions of all component reads
+ Base_Alignment_t * ep;
+ int bad_ct;
+ int i, j, num_aligns, num_tags;
+
+ num_tags = tag . size ();
+ // should be the same as number of distinct strings in alignment
+
+ Make_Gapped_Ungapped_Lookup (lookup);
+
+ extreme . resize (num_tags);
+ for (i = 0; i < num_tags; i ++)
+ extreme [i] . string_sub = -1; // mark to indicate not modified
+
+ num_aligns = align . size ();
+ for (i = 0; i < num_aligns; i ++)
+ {
+ j = align [i] . string_sub;
+ ep = & (extreme [j]);
+ if (ep -> string_sub == -1)
+ {
+ extreme [j] = align [i];
+ ep -> b_lo = lookup [ep -> b_lo];
+ ep -> b_hi = lookup [ep -> b_hi];
+ }
+ else if (ep -> flipped != align [i] . flipped)
+ ; // skip it; something's wrong; same read is in with
+ // different orientations
+ else
+ {
+ ep -> a_lo = Min (ep -> a_lo, align [i] . a_lo);
+ ep -> a_hi = Max (ep -> a_hi, align [i] . a_hi);
+ ep -> b_lo = Min (ep -> b_lo, lookup [align [i] . b_lo]);
+ ep -> b_hi = Max (ep -> b_hi, lookup [align [i] . b_hi]);
+ }
+ }
+
+ bad_ct = 0;
+ for (i = 0; i < num_tags; i ++)
+ if (extreme [i] . string_sub < 0)
+ bad_ct ++;
+ if (bad_ct > 0)
+ {
+ fprintf (stderr, "YIKES: %d unused alignments for contig %d\n",
+ bad_ct, id);
+ }
+
+ fprintf (fp, ">%d %d %d\n", id, len, num_tags - bad_ct);
+
+ for (i = 0; i < num_tags; i ++)
+ {
+ int actual_start, actual_stop;
+ int implied_start, implied_stop;
+
+ ep = & (extreme [i]);
+
+ if (ep -> string_sub < 0)
+ continue;
+
+ if (ep -> flipped)
+ {
+ actual_start = ep -> b_hi;
+ actual_stop = ep -> b_lo;
+ implied_start = actual_start + (ep -> a_len - ep -> a_hi);
+ implied_stop = actual_stop - ep -> a_lo;
+ }
+ else
+ {
+ actual_start = ep -> b_lo;
+ actual_stop = ep -> b_hi;
+ implied_start = actual_start - ep -> a_lo;
+ implied_stop = actual_stop + (ep -> a_len - ep -> a_hi);
+ }
+ actual_start += offset;
+ actual_stop += offset;
+ implied_start += offset;
+ implied_stop += offset;
+
+ fprintf (fp, " %c %c %10s %7d %7d %7d %7d\n",
+ tag [i] [0], (i < orig_tag_ct ? 'a' : 'b'),
+ tag [i] + 1, actual_start, actual_stop,
+ implied_start, implied_stop);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Partial_Merge
+ (const Gapped_Multi_Alignment_t & m, int a_lo, int a_hi,
+ int b_lo, int b_hi, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1, vector <char *> * tg2)
+
+// Merge the portion of the alignment in m between a_lo and
+// a_hi into this alignment between b_lo and b_hi .
+// sl1 and sl2 are the sequences of the reads for this
+// multialignment and multialignment m , respectively.
+// Must have a_lo <= a_hi and b_lo <= b_hi .
+// sl2_place indicates whether and where sl2 strings are already
+// in sl1 . Any new strings are added
+// from sl2 to end of sl1 and sl2_place is updated.
+// If neither tg1 nor tg2 is NULL , then also add relevant
+// sequences from tg2 to the end of tg1 , mirroring sl1
+// and sl2 .
+
+ {
+ Alignment_t ali;
+ Align_Score_Entry_t last_entry;
+ string x, y;
+ int a_gapped_lo, a_gapped_hi, b_gapped_lo, b_gapped_hi;
+ int x_len, y_len;
+
+ // First align the consensus sequences (also aligning the gap
+ // positions based on the characters that are there)
+
+ // Pull out the respective consensus regions
+ // Need to add some indication of what characters aligned with the
+ // gap position
+ m . Extract_Gapped_Region (a_lo, a_hi, x, a_gapped_lo, a_gapped_hi);
+ x_len = x . length ();
+
+ Extract_Gapped_Region (b_lo, b_hi, y, b_gapped_lo, b_gapped_hi);
+ y_len = y . length ();
+
+#if 0
+ printf (">a%d..%d\n", a_lo, a_hi);
+ Fasta_Print (stdout, x . c_str (), NULL);
+
+ printf (">b%d..%d\n", b_lo, b_hi);
+ Fasta_Print (stdout, y . c_str (), NULL);
+#endif
+
+ // Align them
+ // Need to add something to take into account characters associated
+ // with gap positions
+#if 0
+ Global_Align (x . c_str (), x_len, y . c_str (), 0, y_len, 2, -3, -2, -1, ali);
+#else
+ Complete_Align (x . c_str (), 0, x_len, y . c_str (), 0, 1, y_len,
+ 2, -3, -2, -1, NULL, last_entry, ali);
+#endif
+
+ if (Verbose > 2)
+ ali . Print (stdout, x . c_str (), y . c_str ());
+
+ // Then align the individual reads to the result.
+
+ if (Verbose > 2)
+ {
+ printf ("ali:\n");
+ ali . Dump (stdout);
+ printf ("a_gapped_lo/hi = %d/%d b_gapped_lo/hi = %d/%d\n",
+ a_gapped_lo, a_gapped_hi, b_gapped_lo, b_gapped_hi);
+ }
+
+ ali . a_lo += a_gapped_lo;
+ ali . a_hi += a_gapped_lo;
+ ali . b_lo += b_gapped_lo;
+ ali . b_hi += b_gapped_lo;
+ Expand_Consensus (ali);
+
+ if (Verbose > 2)
+ {
+ cout << endl << endl << "Contig #1 after Expand_Consensus" << endl;
+ cout << "sl1 . size () = " << sl1 . size () << endl;
+ cout << "sl2 . size () = " << sl2 . size () << endl;
+ Print (stdout, sl1, 60);
+ }
+
+ Add_Aligned_Seqs (m, ali, a_gapped_lo, a_gapped_hi, sl1, sl2, sl2_place,
+ tg1, tg2);
+
+ if (Verbose > 2)
+ {
+ int i, n;
+
+ n = align . size ();
+ cout << endl << "align after partial merge n = " << n << endl;
+ cout << "sl1 . size () = " << sl1 . size () << endl;
+ cout << "sl2 . size () = " << sl2 . size () << endl;
+ for (i = 0; i < n; i ++)
+ {
+ printf ("align [%d]:\n", i);
+ align [i] . Dump (stdout);
+ }
+
+ n = sl2_place . size ();
+ cout << endl << "sl2_place n = " << n << endl;
+ for (i = 0; i < n; i ++)
+ cout << sl2_place [i] << endl;
+ }
+
+ // Eventually re-call the consensus here
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Print
+ (FILE * fp, const vector <char *> & s, int width,
+ vector <char *> * tag)
+
+// Display this multialignment to file fp using
+// width characters per line. s holds the strings
+// the alignment references. If tag is not NULL, it
+// holds tag strings corresponding to the sequences s
+// to be used to label the sub-alignment lines. If use_string_sub
+// is true, then use the string_sub field in each alignment to
+// determine which string in s to use. If
+// with_diffs is true also print a line under the consensus showing
+// where there are any differences with the aligned sequences.
+
+ {
+ char * buff, * diff;
+ bool use_string_sub, with_diffs, use_gapped_coords;
+ int lo, hi, len, print_lo, print_hi, ungapped_lo, ungapped_hi;
+ int i, j, n;
+
+ use_string_sub = (print_flags & PRINT_USING_STRING_SUB);
+ with_diffs = (print_flags & PRINT_WITH_DIFFS);
+ use_gapped_coords = (print_flags & PRINT_CONSENSUS_GAP_COORDS);
+
+ if (! use_string_sub && s . size () != align . size ())
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Multi_Align . Print called with %d strings and %d alignments",
+ int (s . size ()), int (align . size ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ n = align . size ();
+ len = consensus . length ();
+ buff = (char *) Safe_malloc (5 + len, __FILE__, __LINE__);
+ if (with_diffs)
+ diff = (char *) Safe_malloc (5 + width, __FILE__, __LINE__);
+
+ // assume for now the alignments are sorted in ascending order by
+ // b_lo value
+
+ ungapped_lo = 0;
+ for (lo = 0; lo < len; lo += width)
+ {
+ int a_lo, a_hi;
+
+ hi = Min (lo + width, len);
+ if (with_diffs)
+ {
+ memset (diff, ' ', hi - lo);
+ diff [hi - lo] = '\0';
+ }
+
+ for (i = 0; i < n; i ++)
+ if (Range_Intersect (align [i] . b_lo, align [i] . b_hi, lo, hi))
+ {
+ char tag_buff [100];
+ int sub;
+
+ if (use_string_sub)
+ sub = align [i] . string_sub;
+ else
+ sub = i;
+ align [i] . Print_Subalignment_Line
+ (buff, lo, hi, s [sub], a_lo, a_hi);
+
+ if (tag == NULL)
+ sprintf (tag_buff, "%4d:", sub);
+ else
+ sprintf (tag_buff, "%10.10s:", (* tag) [sub]);
+ if (align [i] . flipped)
+ {
+ print_lo = align [i] . a_len - a_lo;
+ print_hi = align [i] . a_len - a_hi;
+ }
+ else
+ {
+ print_lo = a_lo;
+ print_hi = a_hi;
+ }
+ fprintf (fp, "%s %s (%d-%d)\n", tag_buff, buff, print_lo,
+ print_hi);
+
+ if (with_diffs)
+ {
+ int j, k;
+
+ k = 0;
+ for (j = lo; j < hi; j ++, k ++)
+ if (buff [k] != ' ' && buff [k] != consensus [j])
+ diff [k] = '^';
+ }
+ }
+
+ Print_Consensus (buff, lo, hi);
+
+ ungapped_hi = ungapped_lo;
+ for (j = 0; buff [j] != '\0'; j ++)
+ if (buff [j] != '-')
+ ungapped_hi ++;
+
+ if (use_gapped_coords)
+ {
+ print_lo = lo;
+ print_hi = hi;
+ }
+ else
+ {
+ print_lo = ungapped_lo;
+ print_hi = ungapped_hi;
+ }
+
+ if (tag == NULL)
+ {
+ fprintf (fp, "%4s: %s (%d-%d)\n", "cons", buff, print_lo, print_hi);
+ if (with_diffs)
+ fprintf (fp, "%5s %s\n", "", diff);
+ }
+ else
+ {
+ fprintf (fp, "%10.10s: %s (%d-%d)\n", "consensus", buff, print_lo,
+ print_hi);
+ if (with_diffs)
+ fprintf (fp, "%11s %s\n", "", diff);
+ }
+
+ ungapped_lo = ungapped_hi;
+
+ if (hi < len)
+ fprintf (fp, "\n");
+ }
+
+ free (buff);
+ if (with_diffs)
+ free (diff);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Print_Consensus
+ (char * buff, int b1, int b2)
+
+// Write into buff the portion of this consensus string
+// that lies within the subrange b1 .. b2 .
+
+ {
+ int i, ct;
+
+ ct = 0;
+ for (i = b1; i < b2; i ++)
+ buff [ct ++] = consensus [i];
+
+ buff [ct] = '\0';
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Print_Ungapped_Consensus
+ (FILE * fp, char * hdr, int width)
+
+// Print to fp the non-gap entries in this multialignment's
+// consensus sequence in fasta-style. Print hdr on the
+// fasta-header line. Print width characters per line.
+
+ {
+ int i, j, n;
+
+ fprintf (fp, ">%s\n", hdr);
+
+ n = consensus . length ();
+ for (i = j = 0; i < n; i ++)
+ if (consensus [i] != '-')
+ {
+ fputc (consensus [i], fp);
+ j ++;
+ if (j == width)
+ {
+ fputc ('\n', fp);
+ j = 0;
+ }
+ }
+
+ if (j > 0)
+ fputc ('\n', fp);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Reverse_Complement
+ (vector <char *> & s)
+
+// Reverse-complement the consensus of this multialignment
+// and all the entries in s , and adjust the alignments
+// of all the component strings (which are in s ).
+
+ {
+ int cons_len;
+ int i, n;
+
+ :: Reverse_Complement (consensus);
+ Reverse_String (con_qual);
+
+ cons_len = consensus . length ();
+
+ if (align . size () != s . size ())
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: GMA reverse_complement called with %d strings and %d alignments",
+ int (s . size ()), int (align . size ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+
+ }
+ n = align . size ();
+ for (i = 0; i < n; i ++)
+ {
+ int read_len = strlen (s [i]);
+
+ :: Reverse_Complement (s [i]);
+ align [i] . Flip (read_len, cons_len);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Set_Consensus_And_Qual
+ (const vector <char *> & s, const vector <char *> & q)
+
+// Reset the consensus base values using the libSlice package
+// and assign the corresponding quality for each one in the
+// con_qual string. Strings in alignment are in s and their
+// quality values are in q .
+
+ {
+ vector <Gapped_MA_Bead_t> active_bead;
+ string seq_column, qual_column;
+ libSlice_Consensus cns;
+ static libSlice_Slice sl;
+ int col_len;
+ static int max_len = 0;
+ int len, next;
+ int i, j, n;
+
+
+ len = consensus . length ();
+ con_qual . resize (len);
+ n = align . size ();
+
+ if (Verbose > 3)
+ {
+ printf ("consensus . length () = %d n = %d\n", len, n);
+ for (i = 0; i < n; i ++)
+ {
+ printf ("> Sequence %d\n", i);
+ Fasta_Print (stdout, s [i], NULL);
+ Fasta_Print (stdout, q [i], NULL);
+ }
+ }
+
+ if (max_len == 0)
+ {
+ max_len = 200;
+ sl . rc = (char *) Safe_malloc (max_len, __FILE__, __LINE__);
+ memset (sl . rc, 0, max_len);
+ }
+
+ next = 0;
+ for (i = 0; i < len; i ++)
+ {
+ Gapped_MA_Bead_t b;
+ vector <Gapped_MA_Bead_t> :: iterator bp;
+
+ seq_column . erase ();
+ qual_column . erase ();
+
+ for (bp = active_bead . begin (); bp != active_bead . end (); )
+ {
+ bp -> Advance ();
+ if (! bp -> active)
+ bp = active_bead . erase (bp);
+ else
+ {
+ seq_column . push_back (bp -> seq_ch);
+ qual_column . push_back (bp -> qual_ch - MIN_QUALITY);
+ bp ++;
+ }
+ }
+
+ while (next < n && align [next] . b_lo == i)
+ {
+ b . seq = s [next];
+ b . qual = q [next];
+ b . ga = & (align [next]);
+ b . a_pos = b . ga -> a_lo;
+ b . b_pos = i;
+ b . skip_i = 0;
+ b . skip_pos = b . ga -> Get_Skip (b . skip_i);
+ b . seq_ch = s [next] [b . a_pos];
+ b . qual_ch = q [next] [b . a_pos];
+ b . active = true;
+ active_bead . push_back (b);
+
+ seq_column . push_back (b . seq_ch);
+ qual_column . push_back (b . qual_ch - MIN_QUALITY);
+
+ next ++;
+ }
+
+ sl . bc = (char *) seq_column . c_str ();
+ sl . qv = (char *) qual_column . c_str ();
+ col_len = seq_column . length ();
+ if (col_len >= max_len)
+ {
+ max_len = Max (2 * max_len, col_len + 1);
+ sl . rc = (char *) Safe_realloc (sl . rc, max_len);
+ memset (sl . rc, 0, max_len);
+ }
+ sl . dcov = col_len;
+
+ // libSlice_getConsensusWithAmbiguity (& sl, & cns, NULL, 0);
+ libSlice_getConsensusParam(& sl, & cns, NULL, 0, 1);
+ libSlice_updateAmbiguityConic(& sl, & cns, 0, 0);
+
+ // consensus [i] = cns . consensus;
+ consensus [i] = libSlice_convertAmbiguityFlags(cns.ambiguityFlags);
+ con_qual [i] = MIN_QUALITY
+ + Min (cns . qvConsensus, unsigned (MAX_QUALITY_CHAR));
+
+ if (Verbose > 3)
+ {
+ printf ("%6d: ", i);
+ cout << seq_column << " col_len = " << col_len << endl;
+ printf (" ");
+ for (j = 0; j < col_len; j ++)
+ putchar (qual_column [j] + MIN_QUALITY);
+ putchar ('\n');
+ printf (" ");
+ for (j = 0; j < col_len; j ++)
+ printf (" %02d", (signed) qual_column [j]);
+ putchar ('\n');
+
+ cout << " cons = " << cns . consensus << " qv = "
+ << Min (cns . qvConsensus, unsigned (MAX_QUALITY_CHAR)) << endl;
+ }
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Set_Flipped
+ (const vector <AMOS :: Range_t> & clr)
+
+// Set the flipped bit true for each alignment in this
+// alignment iff the corresponding clr begin value
+// is greater than the end value.
+
+ {
+ int i, n;
+
+ n = align . size ();
+ if (int (clr . size ()) < n)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Number of clear ranges %d < number of aligns %d\n",
+ int (clr . size ()), n);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ for (i = 0; i < n; i ++)
+ if (clr [i] . end < clr [i] . begin)
+ align [i] . flipped = 1;
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Set_Phase
+ (vector <Distinguishing_Column_t> & dc)
+
+// Determine the phase of each column based on common reads with
+// consistent haplotype patterns
+
+ {
+ vector <Phase_Entry_t> edge_list;
+ vector <int> tree_edge;
+ Phase_Entry_t phase;
+ vector <Distinguishing_Column_t> :: iterator p;
+ int min;
+ int i, j, e, n, t;
+
+ n = dc . size ();
+ for (i = 0; i < n; i ++)
+ dc [i] . phase_ch = ' ';
+
+ // Eliminate dubious dc entries by marking the ones that
+ // are bounded by much better ones
+ for (i = 0; i < n - 1; i ++)
+ {
+ int k, hi_j = i;
+
+ if (dc [i] . phase_ch == 'D')
+ continue;
+
+ for (j = i + 1; j < n && dc [i] . Intersects (dc [j], phase, min); j ++)
+ {
+ if (abs (phase . same_ct - phase . opposite_ct) >= 4
+ && min >= 4)
+ hi_j = j;
+ }
+
+ for (k = i + 1; k < hi_j; k ++)
+ if (dc [k] . hapb_sub . size () <= 2)
+ dc [k] . phase_ch = 'D';
+ }
+
+ if (Verbose > 2)
+ {
+ printf ("Dubious Columns:\n");
+ for (i = 0; i < n; i ++)
+ if (dc [i] . phase_ch == 'D')
+ dc [i] . Print (stdout);
+ }
+
+ // Eliminate dubious columns
+ p = dc . begin ();
+ while (p != dc . end ())
+ if (p -> phase_ch == 'D')
+ dc . erase (p);
+ else
+ p ++;
+
+ // Create edges between remaining columns
+ n = dc . size ();
+
+ for (i = 0; i < n - 1; i ++)
+ {
+ for (j = i + 1; j < n && dc [i] . Intersects (dc [j], phase, min); j ++)
+ {
+ phase . from = i;
+ phase . to = j;
+ phase . weight = abs (phase . same_ct - phase . opposite_ct);
+ if (phase . weight > 0)
+ edge_list . push_back (phase);
+ }
+ }
+
+ sort (edge_list . begin (), edge_list . end (), greater<Phase_Entry_t>());
+
+ e = edge_list . size ();
+
+ if (Verbose > 2)
+ {
+ printf ("Edges:\n");
+ for (i = 0; i < e; i ++)
+ printf ("%4d %4d %3d %3d %3d\n", edge_list [i] . from,
+ edge_list [i] . to, edge_list [i] . same_ct,
+ edge_list [i] . opposite_ct, edge_list [i] . weight);
+ }
+
+
+ vector < vector <Phase_Entry_t> > tree (n);
+ // allocate n empty adjacency lists
+
+ Best_Spanning_Tree (n, edge_list, tree_edge);
+
+ printf ("Vertices = %d\n", n);
+ t = tree_edge . size ();
+ printf ("Tree edges = %d\n", t);
+ for (i = 0; i < t; i ++)
+ {
+ tree [edge_list [tree_edge [i]] . from]
+ . push_back (edge_list [tree_edge [i]]);
+ Swap (edge_list [tree_edge [i]] . from,
+ edge_list [tree_edge [i]] . to);
+ tree [edge_list [tree_edge [i]] . from]
+ . push_back (edge_list [tree_edge [i]]);
+ }
+
+ if (Verbose > 2)
+ {
+ printf ("Tree:\n");
+ for (i = 0; i < n; i ++)
+ {
+ int j, m;
+
+ printf ("%3d:\n", i);
+ m = tree [i] . size ();
+ for (j = 0; j < m; j ++)
+ tree [i] [j] . Print (stdout);
+ }
+ }
+
+ for (i = 0; i < n; i ++)
+ if (dc [i] . phase_ch == ' ')
+ {
+ int sum = 0;
+
+ Traverse (i, -1, tree, dc, '+', sum);
+ if (sum < 0)
+ Traverse (i, -1, tree, dc, '-', sum);
+ }
+
+ printf ("DC after Set_Phase\n");
+ for (i = 0; i < n; i ++)
+ {
+ printf ("i = %d:\n", i);
+ dc [i] . Print (stdout);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Set_String_Subs
+ (void)
+
+// Set the string_sub field in each component alignment
+// to the same subscript as the component alignemnt.
+
+ {
+ int i, n;
+
+ n = align . size ();
+ for (i = 0; i < n; i ++)
+ align [i] . string_sub = i;
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Shift_B_Right
+ (int offset)
+
+// Shift all the b values in this alignment to the right
+// by offset .
+
+ {
+ int i, n;
+
+ n = align . size ();
+ for (i = 0; i < n; i ++)
+ {
+ align [i] . b_lo += offset;
+ align [i] . b_hi += offset;
+ align [i] . Shift_Skip (offset);
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Show_Skips
+ (FILE * fp)
+
+// Print the skip values in the alignment to file fp .
+
+ {
+ vector <Gapped_Alignment_t> :: iterator p;
+
+ for (p = align . begin (); p != align . end (); p ++)
+ p -> Dump_Skip (fp);
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: Sort
+ (vector <char *> & s, vector <int> * ref, vector <char *> * tag_list)
+
+// Sort the align entries in this multialignment according to their
+// b_lo values. Also sort the strings s along with them.
+// If ref isn't NULL , then move its entries in parallel
+// with those of s and align . Likewise, for tag_list .
+
+ {
+ int i, j, n;
+
+ n = align . size ();
+ if (n != int (s . size ()))
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Sorting %d strings with %d alignments\n",
+ int (s . size ()), n);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ for (i = 1; i < n; i ++)
+ {
+ char * s_save, * t_save;
+ Gapped_Alignment_t a_save;
+ int r_save;
+
+ if (align [i - 1] . b_lo <= align [i] . b_lo)
+ continue;
+
+ s_save = s [i];
+ a_save = align [i];
+ if (ref != NULL)
+ r_save = (* ref) [i];
+ if (tag_list != NULL)
+ t_save = (* tag_list) [i];
+
+ for (j = i; j > 0 && align [j - 1] . b_lo > a_save . b_lo; j --)
+ {
+ align [j] = align [j - 1];
+ s [j] = s [j - 1];
+ if (ref != NULL)
+ (* ref) [j] = (* ref) [j - 1];
+ if (tag_list != NULL)
+ (* tag_list) [j] = (* tag_list) [j - 1];
+ }
+
+ s [j] = s_save;
+ align [j] = a_save;
+ if (ref != NULL)
+ (* ref) [j] = r_save;
+ if (tag_list != NULL)
+ (* tag_list) [j] = t_save;
+ }
+
+ return;
+ }
+
+
+
+void Gapped_Multi_Alignment_t :: TA_Print
+ (FILE * fp, const vector <char *> & s, const vector <AMOS :: Range_t> & clr_list,
+ int width, const vector <char *> * tag, const string & id)
+
+// Display this multialignment to file fp in TIGR Assembler
+// .contig format. Use width characters per line of sequences.
+// s holds the strings the alignment references and clr_list holds
+// the clear ranges of the original reads (in reverse order if the
+// original read has been reversed complemented). If tag is
+// not NULL, it holds IID tags corresponding to the sequences s
+// to be used to label the sub-alignment lines. id is the
+// id number of this contig.
+
+ {
+ vector <int> lookup;
+ char * buff;
+ bool use_string_sub;
+ int clr_begin = 0, clr_end = 0;
+ int len;
+ int i, n, sub;
+
+ use_string_sub = (print_flags & PRINT_USING_STRING_SUB);
+
+ if (! use_string_sub && s . size () != align . size ())
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Multi_Align . Print called with %d strings and %d alignments",
+ int (s . size ()), int (align . size ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ n = align . size ();
+ len = consensus . length ();
+ buff = (char *) Safe_malloc (5 + len, __FILE__, __LINE__);
+
+ Make_Gapped_Ungapped_Lookup (lookup);
+
+ // first print the header information and gapped consensus.
+ fprintf (fp, "##%s %d %d bases, 00000000 checksum.\n",
+ id . c_str (), n, len);
+ Fasta_Print (stdout, getConsensusString (), NULL);
+
+ // Then the gapped reads
+ for (i = 0; i < n; i ++)
+ {
+ bool flipped;
+ int a_lo, a_hi;
+
+ if (use_string_sub)
+ sub = align [i] . string_sub;
+ else
+ sub = i;
+
+ if (tag == NULL)
+ sprintf (buff, "%d", i);
+ else
+ sprintf (buff, "%s", (* tag) [sub]);
+
+ clr_begin = clr_list [sub] . begin;
+ clr_end = clr_list [sub] . end;
+ if (clr_begin < clr_end)
+ {
+ flipped = false;
+ clr_begin ++;
+ }
+ else
+ {
+ flipped = true;
+ clr_end ++;
+ }
+
+ fprintf (fp, "#%s(%d) [%s] %d bases, 00000000 checksum. {%d %d} <%d %d>\n",
+ buff, align [i] . b_lo,
+ flipped ? "RC" : "", align [i] . b_hi - align [i] . b_lo,
+ clr_begin, clr_end, 1 + lookup [align [i] . b_lo],
+ lookup [align [i] . b_hi]);
+
+ align [i] . Print_Subalignment_Line
+ (buff, align [i] . b_lo, align [i] . b_hi, s [sub],
+ a_lo, a_hi);
+
+ Uppercase (buff);
+ Fasta_Print (stdout, buff, NULL);
+ }
+
+ return;
+ }
+
+
+void Gapped_Multi_Alignment_t :: Make_AMOS_Contig
+ (const vector <AMOS :: Range_t> & clr_list, const vector <char *> & tag,
+ AMOS :: Contig_t & out) const
+ // returns a Contig_t representation of the multi-alignment
+{
+ out . setSequence (consensus, con_qual);
+ out . setIID (strtol (id . c_str (), NULL, 10));
+
+ int n = align . size ();
+
+ vector <Tile_t> tiles;
+ for (int i = 0; i < n; i ++)
+ {
+ AMOS :: Tile_t tile;
+ tile . source = strtol(tag [i], NULL, 10);
+ if (tile.source == 0){
+ cerr << "Source of tag " << tag[i] << " is null\n";
+ }
+ tile . range = clr_list [i];
+ tile . offset = align [i] . b_lo;
+
+ int skip = align [i] . Get_Skip (0);
+ int s = 0;
+ while (skip != INT_MAX) {
+ tile . gaps . push_back (skip - tile . offset - s); // convert to CA standard
+ skip = align [i] . Get_Skip(++ s);
+ }
+
+ tiles . push_back(tile);
+ }
+ out . setReadTiling(tiles);
+}
+
+
+
+int Gapped_Multi_Alignment_t :: Ungapped_Consensus_Len
+ (void) const
+
+// Return the number of non-'-' characters in this
+// multialignment's consensus sequence.
+
+ {
+ int i, n, ct;
+
+ n = consensus . length ();
+ ct = 0;
+ for (i = 0; i < n; i ++)
+ if (consensus [i] != '-')
+ ct ++;
+
+ return ct;
+ }
+
+
+
+
+// ### Independent Functions ###
+
+
+void Align_Row_Update
+ (vector <Augmented_Score_Entry_t> & align_row, char ch, const char * s,
+ int s_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, int first_score)
+
+// Update align_row to be the values in the next row of an alignment
+// matrix where the preceding row is in align_row now. ch is
+// the character for the next row and s (whose length is s_len )
+// is the characters across the top of the alignment matrix.
+// match_score , mismatch_score , indel_score and gap_score
+// are the scores for matching characters, mismatching characters,
+// insertion/deletion and initiating a gap, respectively.
+// first_score is the value to add to the first entry's top_score field.
+
+ {
+ Augmented_Score_Entry_t prev, curr;
+ int mxs;
+ unsigned int mxf;
+ int i;
+
+ if (s_len == 0)
+ return;
+
+ assert (int (align_row . size ()) == s_len + 1);
+
+ prev = align_row [0];
+ align_row [0] . top_score += first_score;
+ align_row [0] . diag_score = align_row [0] . left_score = NEG_INFTY_SCORE;
+
+ for (i = 1; i <= s_len; i ++)
+ {
+ Augmented_Score_Entry_t * p = & (align_row [i]);
+
+ curr = align_row [i];
+ curr . Get_Max_Top (mxs, mxf, gap_score);
+
+ p -> top_score = mxs + indel_score;
+ p -> top_from = mxf;
+ p -> top_ref = curr . Get_Ref (mxf);
+
+ prev . Get_Max (mxs, mxf);
+ p -> diag_score = mxs
+ + ((ismatch(ch , s [i - 1])) ? match_score : mismatch_score);
+ p -> diag_from = mxf;
+ p -> diag_ref = prev . Get_Ref (mxf);
+
+ align_row [i - 1] . Get_Max_Left (mxs, mxf, gap_score);
+ p -> left_score = mxs + indel_score;
+ p -> left_from = mxf;
+ p -> left_ref = align_row [i - 1] . Get_Ref (mxf);
+
+ prev = curr;
+ }
+
+ return;
+ }
+
+
+
+void Align_Row_Update_With_Errors
+ (vector <Errors_Score_Entry_t> & align_row, char ch, const char * s,
+ int s_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, int first_score, int first_error)
+
+// Update align_row to be the values in the next row of an alignment
+// matrix where the preceding row is in align_row now. ch is
+// the character for the next row and s (whose length is s_len )
+// is the characters across the top of the alignment matrix.
+// match_score , mismatch_score , indel_score and gap_score
+// are the scores for matching characters, mismatching characters,
+// insertion/deletion and initiating a gap, respectively.
+// first_score is the value to add to the first entry's top_score field.
+// first_error is the value to add to the first entry's top_errors field.
+
+ {
+ Errors_Score_Entry_t prev, curr;
+ int mxs;
+ unsigned int mxf;
+ int i;
+
+ if (s_len == 0)
+ return;
+
+ assert (int (align_row . size ()) == s_len + 1);
+
+ prev = align_row [0];
+ align_row [0] . top_score += first_score;
+ align_row [0] . diag_score = align_row [0] . left_score = NEG_INFTY_SCORE;
+ align_row [0] . top_errors += first_error;
+ align_row [0] . diag_errors = align_row [0] . left_errors = 0;
+
+ for (i = 1; i <= s_len; i ++)
+ {
+ Errors_Score_Entry_t * p = & (align_row [i]);
+
+ curr = align_row [i];
+ curr . Get_Max_Top (mxs, mxf, gap_score);
+
+ p -> top_score = mxs + indel_score;
+ p -> top_from = mxf;
+ p -> top_ref = curr . Get_Ref (mxf);
+ p -> top_errors = curr . Get_Errors (mxf) + 1;
+
+ prev . Get_Max (mxs, mxf);
+ p -> diag_score = mxs
+ + ((ismatch(ch , s [i - 1])) ? match_score : mismatch_score);
+ p -> diag_from = mxf;
+ p -> diag_ref = prev . Get_Ref (mxf);
+ p -> diag_errors = prev . Get_Errors (mxf);
+ if (ch != s [i - 1])
+ p -> diag_errors ++;
+
+ align_row [i - 1] . Get_Max_Left (mxs, mxf, gap_score);
+ p -> left_score = mxs + indel_score;
+ p -> left_from = mxf;
+ p -> left_ref = align_row [i - 1] . Get_Ref (mxf);
+ p -> left_errors = align_row [i - 1] . Get_Errors (mxf) + 1;
+
+ prev = curr;
+ }
+
+ return;
+ }
+
+
+
+void Banded_Overlap
+ (const char * s, int s_len, const char * t, int t_len,
+ int lo_offset, int hi_offset, Simple_Overlap_t & olap,
+ int match_score,
+ int mismatch_score,
+ int indel_score,
+ int gap_score)
+
+// Find the highest-scoring overlap alignment between string s and
+// string t , restricted to a band between lo_offset and
+// hi_offset , inclusive. Offsets are measured by the position in
+// t minus the position in s of a corresponding base.
+// The length of s is s_len and the length of t is t_len .
+// The resulting overlap is stored in olap .
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+
+ {
+ vector <Errors_Score_Entry_t> band;
+ // row of alignment array
+ Errors_Score_Entry_t entry;
+ int max_row, max_col, max_score, mxs, max_ref, max_errors;
+ unsigned int max_from, mxf;
+ int bandwidth;
+ int left_col, right_col;
+ // bound region represented by band
+ int r, c;
+
+ if (s_len + lo_offset < 0)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "lo_offset=%d longer than s_len=%d in Banded_Overlap",
+ lo_offset, s_len);
+ throw AlignmentException_t (Clean_Exit_Msg_Line, __LINE__, __FILE__,
+ -1, -1);
+ }
+ if (t_len < hi_offset)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "hi_offset=%d longer than t_len=%d in Banded_Overlap",
+ hi_offset, t_len);
+ throw AlignmentException_t (Clean_Exit_Msg_Line, __LINE__, __FILE__,
+ -1, -1);
+ }
+
+ bandwidth = 1 + hi_offset - lo_offset;
+ max_score = NEG_INFTY_SCORE;
+
+ // Create the first row of the alignment matrix
+ entry . diag_score = entry . top_score = entry . left_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ entry . diag_errors = entry . top_errors = entry . left_errors = 0;
+
+ if (lo_offset <= 0)
+ {
+ r = 0;
+ right_col = - lo_offset;
+ }
+ else
+ {
+ r = lo_offset;
+ right_col = 0;
+ }
+ left_col = 1 + right_col - bandwidth;
+
+ // Create band
+ for (c = left_col; c <= right_col; c ++)
+ {
+ entry . top_ref = entry . diag_ref = entry . left_ref = c;
+ band . push_back (entry);
+ }
+
+ if (right_col == s_len || r == t_len)
+ {
+ entry . Get_Max (max_score, max_from);
+ max_row = 0;
+ max_col = s_len;
+ max_ref = s_len;
+ max_errors = entry . Get_Errors (max_from);
+ }
+
+ // Do remaining rows
+ while (left_col < s_len && r < t_len)
+ {
+ if (left_col <= 0)
+ band [- left_col] . top_ref = band [- left_col] . diag_ref
+ = band [- left_col] . left_ref = - r;
+ // is value of current row, not one being built
+
+ Update_Banded_Row (band, t [r], s, s_len, left_col, right_col,
+ match_score, mismatch_score, indel_score, gap_score, 0, 0);
+ r ++;
+ left_col ++;
+ right_col ++;
+
+ // Check last column entry for max
+ if (left_col <= s_len && s_len <= right_col)
+ {
+ band [s_len - left_col] . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = r;
+ max_col = s_len;
+ max_ref = band [s_len - left_col] . Get_Ref (mxf);
+ max_errors = band [s_len - left_col] . Get_Errors (mxf);
+ }
+ }
+ }
+
+ // Check entries in last row for max
+ if (r == t_len)
+ {
+ int lo, hi;
+
+ lo = Max (0, - left_col);
+ hi = Min (bandwidth - 1, s_len - left_col);
+ for (c = lo; c <= hi; c ++)
+ {
+ band [c] . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = t_len;
+ max_col = left_col + c;
+ max_ref = band [c] . Get_Ref (mxf);
+ max_errors = band [c] . Get_Errors (mxf);
+ }
+ }
+ }
+
+ olap . score = max_score;
+ olap . errors = max_errors;
+ olap . a_hang = max_ref;
+ if (max_col < s_len)
+ olap . b_hang = max_col - s_len;
+ else
+ olap . b_hang = t_len - max_row;
+ if (max_ref >= 0)
+ {
+ olap . b_olap_len = max_row;
+ olap . a_olap_len = max_col - max_ref;
+ }
+ else
+ {
+ olap . b_olap_len = max_row + max_ref;
+ olap . a_olap_len = max_col;
+ }
+
+ return;
+ }
+
+
+
+void Best_Spanning_Tree
+ (int n, const vector <Phase_Entry_t> & edge_list,
+ vector <int> & tree_edge)
+
+// Find the best spanning tree of graph of n vertices, 0 .. (n-1)
+// using edges in edge_list in order. Put subscripts of edges
+// used in tree_edge . Use Union-Find algorithm.
+
+ {
+ vector <int> uf (n, -1);
+ int i, e;
+
+ tree_edge . clear ();
+
+ e = edge_list . size ();
+ for (i = 0; i < e; i ++)
+ {
+ int j, k;
+
+edge_list [i] . Print (stdout);
+ j = UF_Find (edge_list [i] . from, uf);
+ k = UF_Find (edge_list [i] . to, uf);
+printf (" j = %d k = %d\n", j, k);
+ if (j != k)
+ {
+ tree_edge . push_back (i);
+ UF_Union (j, k, uf);
+ }
+ }
+
+ return;
+ }
+
+
+
+const int MAX_ITERATIONS = 200;
+
+void Classify_Reads
+ (const vector <Distinguishing_Column_t> & dc, int n,
+ vector <char> & side, vector <int> & segment)
+
+// Assign haplotypes to reads 0 .. (n-1) based on the
+// entries in dc .
+
+ {
+ vector < vector <Phase_Entry_t> > A (n);
+ vector <Phase_Entry_t> edge_list;
+ Phase_Entry_t phase;
+ vector <int> uf (n, -1);
+ int len;
+ int e, i, j, k, m;
+
+ m = dc . size ();
+ for (i = 0; i < m; i ++)
+ {
+ int a_len, b_len;
+ int from, to;
+
+ a_len = dc [i] . hapa_sub . size ();
+ b_len = dc [i] . hapb_sub . size ();
+
+ for (j = 0; j < a_len; j ++)
+ for (k = 0; k < b_len; k ++)
+ {
+ from = dc [i] . hapa_sub [j];
+ to = dc [i] . hapb_sub [k];
+ if (from < to)
+ Incr_Opposite (A [from], from, to);
+ else
+ Incr_Opposite (A [to], to, from);
+ }
+ }
+
+ printf ("Opposite Counts n = %d:\n", n);
+ for (i = 0; i < n; i ++)
+ {
+ len = A [i] . size ();
+ printf ("%3d (%2d): ", i, len);
+ for (j = 0; j < len; j ++)
+ if (A [i] [j] . opposite_ct > 0)
+ printf (" %3d/%-3d", A [i] [j] . to, A [i] [j] . opposite_ct);
+ putchar ('\n');
+ }
+
+ // Make a list of edges
+ for (i = 0; i < n; i ++)
+ {
+ len = A [i] . size ();
+ for (j = 0; j < len; j ++)
+ {
+ phase . from = i;
+ phase . to = A [i] [j] . to;
+ phase . weight = A [i] [j] . opposite_ct;
+
+ edge_list . push_back (phase);
+ }
+ }
+
+ // Sort into descending order by weight
+ sort (edge_list . begin (), edge_list . end (), greater<Phase_Entry_t>());
+
+ // Greedily find approximate best bipartite subgraph
+ e = edge_list . size ();
+ for (i = 0; i < e; i ++)
+ {
+ int j_par, k_par;
+ int from, to;
+
+ from = edge_list [i] . from;
+ to = edge_list [i] . to;
+
+ j = UF_Find_With_Parity (from, uf, j_par);
+ k = UF_Find_With_Parity (to, uf, k_par);
+
+ if (j != k)
+ {
+ if (j_par == k_par)
+ UF_Union (j, k, uf);
+ else
+ { // break usual UF rules to ensure that from and
+ // to get opposite sides of the bipartite graph
+ if (j == from)
+ {
+ uf [k] += uf [j];
+ uf [j] = to;
+ }
+ else if (k == to)
+ {
+ uf [j] += uf [k];
+ uf [k] = from;
+ }
+ else if (uf [j] <= uf [k])
+ { // k is smaller since values are negative sizes
+ uf [j] += uf [k];
+ uf [k] = from;
+ }
+ }
+ }
+ }
+
+ side . resize (n);
+ segment . resize (n);
+
+ printf ("Bipartite Segments:\n");
+ for (i = 0; i < n; i ++)
+ {
+ char ch;
+ int par;
+
+ j = UF_Find_With_Parity (i, uf, par);
+ if (par == 0)
+ ch = 'a';
+ else
+ ch = 'b';
+ side [i] = ch;
+ segment [i] = j;
+
+ printf ("%4d %4d %c\n", i, j, ch);
+ }
+
+ return;
+ }
+
+
+
+void Complete_Align
+ (const char * s, int s_lo, int s_hi, const char * t, int t_lo, int t_slip,
+ int t_hi, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Align_Score_Entry_t * first_entry,
+ Align_Score_Entry_t & last_entry, Alignment_t & align)
+
+// Find the best alignment of the entire string s [s_lo .. (s_hi - 1)]
+// to the entire string t [t_lo .. (t_hi - 1)] but the alignment in
+// t may start between t_lo and t_slip .
+// If first_entry is not NULL , use it for the first entry in
+// the alignment matrix; otherwise, use a zero value.
+// Set last_entry to the last entry in the alignment matrix.
+// The resulting alignment is stored in align ,
+// where s is the a string and t is the b string.
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+
+ {
+ int matrix_size;
+
+ if (Verbose > 3)
+ fprintf (stderr,
+ "Complete_Align: s_lo/hi = %d/%d t_lo/slip/hi = %d/%d/%d\n",
+ s_lo, s_hi, t_lo, t_slip, t_hi);
+
+ assert (t_lo < t_slip);
+ assert (t_slip <= t_hi);
+ assert (s_lo <= s_hi );
+
+ matrix_size = (s_hi - s_lo) * (t_hi - t_lo);
+ if (t_hi - t_lo <= 10 || matrix_size <= MATRIX_SIZE_LIMIT)
+ Complete_Align_Full_Matrix (s, s_lo, s_hi, t, t_lo, t_slip, t_hi,
+ match_score, mismatch_score, indel_score, gap_score,
+ first_entry, last_entry, align);
+ else
+ Complete_Align_Save_Space (s, s_lo, s_hi, t, t_lo, t_slip, t_hi,
+ match_score, mismatch_score, indel_score, gap_score,
+ first_entry, last_entry, align);
+
+ return;
+ }
+
+
+
+void Complete_Align_Full_Matrix
+ (const char * s, int s_lo, int s_hi, const char * t, int t_lo, int t_slip,
+ int t_hi, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Align_Score_Entry_t * first_entry,
+ Align_Score_Entry_t & last_entry, Alignment_t & align)
+
+// Find the best alignment of the entire string s [s_lo .. (s_hi - 1)]
+// to the entire string t [t_lo .. (t_hi - 1)] but the alignment in
+// t may start between t_lo and t_slip .
+// If first_entry is not NULL , use it for the first entry in
+// the alignment matrix; otherwise, use a zero value.
+// Set last_entry to the last entry in the alignment matrix.
+// The resulting alignment is stored in align ,
+// where s is the a string and t is the b string.
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+// Use a full matrix for the computation.
+
+ {
+ vector < vector <Align_Score_Entry_t> > a; // the alignment array
+ vector <Align_Score_Entry_t> empty_vector;
+ vector <int> delta;
+ Align_Score_Entry_t entry;
+ unsigned int mxf;
+ int mxs, s_len, t_len, error_ct, row_limit;
+ int r, c; // row and column
+ int i, j, n; // position in string t
+
+ if (Verbose > 3)
+ {
+ fprintf (stderr, "Start Complete_Align_Full_Matrix\n");
+ fprintf (stderr, "s_lo = %d s_hi = %d t_lo = %d t_slip = %d t_hi = %d\n",
+ s_lo, s_hi, t_lo, t_slip, t_hi);
+ fprintf (stderr, "Scores: match/mismatch/indel/gap = %d/%d/%d/%d\n",
+ match_score, mismatch_score, indel_score, gap_score);
+ }
+
+ s_len = s_hi - s_lo;
+ t_len = t_hi - t_lo;
+
+ // Do first row
+ a . push_back (empty_vector);
+ if (first_entry != NULL)
+ entry = * first_entry;
+ else
+ {
+ entry . diag_score = entry . top_score = entry . left_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ }
+ r = c = 0;
+ a [r] . push_back (entry);
+
+ entry . top_score = NEG_INFTY_SCORE;
+ entry . top_from = FROM_NOWHERE;
+ entry . diag_score = NEG_INFTY_SCORE;
+ entry . diag_from = FROM_NOWHERE;
+ for (c = 1; c <= s_len; c ++)
+ {
+ entry . left_score = a [r] [c - 1] . left_score + indel_score;
+ if (c == 1)
+ entry . left_score += gap_score;
+ entry . left_from = FROM_LEFT;
+ a [r] . push_back (entry);
+ }
+
+ // Do remaining rows
+ for (i = t_lo; i < t_hi; i ++)
+ {
+ r ++;
+
+ // First column in row
+ a . push_back (empty_vector);
+ entry . diag_score = entry . left_score = NEG_INFTY_SCORE;
+ if (i < t_slip - 1)
+ {
+ entry . top_score = 0;
+ entry . top_from = FROM_NOWHERE;
+ }
+ else
+ {
+ entry . top_score = a [r - 1] [0] . top_score + indel_score;
+ if (i == t_slip - 1)
+ entry . top_score += gap_score;
+ entry . top_from = FROM_TOP;
+ }
+ entry . diag_from = entry . left_from = FROM_NOWHERE;
+ a [r] . push_back (entry);
+
+ // Remaining columns in row
+ j = s_lo;
+ for (c = 1; c <= s_len; c ++, j ++)
+ {
+ Align_Score_Entry_t * p;
+
+ p = & (a [r - 1] [c]);
+ p -> Get_Max_Top (mxs, mxf, gap_score);
+ entry . top_score = mxs + indel_score;
+ entry . top_from = mxf;
+
+ p = & (a [r - 1] [c - 1]);
+ p -> Get_Max (mxs, mxf);
+ entry . diag_score = mxs;
+ entry . diag_from = mxf;
+ entry . diag_score += ((ismatch(t [i] , s [j])) ? match_score : mismatch_score);
+
+ p = & (a [r] [c - 1]);
+ p -> Get_Max_Left (mxs, mxf, gap_score);
+ entry . left_score = mxs + indel_score;
+ entry . left_from = mxf;
+ a [r] . push_back (entry);
+ }
+ }
+
+ last_entry = a [t_len] [s_len];
+ last_entry . Get_Max (mxs, mxf);
+ if (Verbose > 1)
+ printf ("Complete_Align_Full_Matrix: final score = %d\n", mxs);
+
+ // Trace back
+ row_limit = t_slip - t_lo - 1;
+ Trace_Back_Align_Path (a, r, s_len, row_limit, 0, delta,
+ error_ct, s + s_lo, t + t_lo);
+
+ align . a_lo = s_lo;
+ align . a_hi = s_hi;
+ align . b_hi = t_hi;
+ align . b_lo = r + t_lo;
+ align . errors = error_ct;
+
+ if (Verbose > 2)
+ {
+ n = delta . size ();
+ for (i = 0; i < n; i ++)
+ printf ("delta [%d] = %d\n", i, delta [i]);
+ }
+
+ align . setDelta (delta);
+
+ return;
+ }
+
+
+
+void Complete_Align_Save_Space
+ (const char * s, int s_lo, int s_hi, const char * t, int t_lo, int t_slip,
+ int t_hi, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Align_Score_Entry_t * first_entry,
+ Align_Score_Entry_t & last_entry, Alignment_t & align)
+
+// Find the best alignment of the entire string s [s_lo .. (s_hi - 1)]
+// to the entire string t [t_lo .. (t_hi - 1)] but the alignment in
+// t may start between t_lo and t_slip .
+// If first_entry is not NULL , use it for the first entry in
+// the alignment matrix; otherwise, use a zero value.
+// Set last_entry to the last entry in the alignment matrix.
+// The resulting alignment is stored in align ,
+// where s is the a string and t is the b string.
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+// Do recursively keeping just a single row.
+
+ {
+ Alignment_t sub_ali_1, sub_ali_2;
+ vector <Augmented_Score_Entry_t> align_row;
+ // row of alignment array
+ Augmented_Score_Entry_t entry;
+ int s_len, t_len, t_half, tmp_slip;
+ int mxs, max_ref;
+ unsigned int mxf;
+ int r, c;
+
+ s_len = s_hi - s_lo;
+ t_len = t_hi - t_lo;
+ assert (t_len > 1);
+
+ // Build first row
+ if (first_entry == NULL)
+ {
+ entry . diag_score = entry . top_score = entry . left_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ }
+ else
+ {
+ entry . diag_score = first_entry -> diag_score;
+ entry . top_score = first_entry -> top_score;
+ entry . left_score = first_entry -> left_score;
+ entry . diag_from = first_entry -> diag_from;
+ entry . top_from = first_entry -> top_from;
+ entry . left_from = first_entry -> left_from;
+ }
+ entry . top_ref = entry . diag_ref = entry . left_ref = 0;
+ align_row . push_back (entry);
+
+ entry . top_score = NEG_INFTY_SCORE;
+ entry . top_from = FROM_NOWHERE;
+ entry . diag_score = NEG_INFTY_SCORE;
+ entry . diag_from = FROM_NOWHERE;
+ entry . left_from = FROM_LEFT;
+ entry . left_ref = 0;
+ entry . top_ref = entry . diag_ref = -1;
+
+ for (c = 1; c <= s_len; c ++)
+ {
+ entry . left_score = align_row [c - 1] . left_score + indel_score;
+ if (c == 1)
+ entry . left_score += gap_score;
+ align_row . push_back (entry);
+ }
+
+ // Do remaining rows
+ t_half = (t_lo + t_hi) / 2;
+ for (r = t_lo + 1; r <= t_hi; r ++)
+ {
+ int first_score;
+
+ if (r < t_slip)
+ first_score = 0;
+ else if (r == t_slip)
+ first_score = indel_score + gap_score;
+ else
+ first_score = indel_score;
+
+ Align_Row_Update (align_row, t [r - 1], s + s_lo, s_len, match_score,
+ mismatch_score, indel_score, gap_score, first_score);
+
+ if (r == t_half)
+ { // set the ref entries to reference this row
+ align_row [0] . top_ref = 0;
+ for (c = 1; c <= s_len; c ++)
+ {
+ align_row [c] . top_ref = align_row [c] . diag_ref = c;
+ align_row [c - 1] . Get_Max_Left (mxs, mxf, gap_score);
+ align_row [c] . left_ref = align_row [c - 1] . Get_Ref (mxf);
+ }
+ }
+ }
+
+ // Get max from last entry
+ align_row [s_len] . Get_Max (mxs, mxf);
+ max_ref = align_row [s_len] . Get_Ref (mxf);
+
+ tmp_slip = Min (t_slip, t_half);
+ if (Verbose > 3)
+ fprintf (stderr, "max_ref = %d t_lo = %d t_slip = %d t_half = %d t_hi = %d\n",
+ max_ref, t_lo, t_slip, t_half, t_hi);
+ Complete_Align_Full_Matrix (s, s_lo, s_lo + max_ref, t, t_lo, tmp_slip, t_half,
+ match_score, mismatch_score, indel_score, gap_score, first_entry,
+ entry, sub_ali_1);
+
+ if (max_ref == 0)
+ tmp_slip = Max (t_slip, t_half + 1);
+ else
+ tmp_slip = t_half + 1;
+ Complete_Align_Full_Matrix (s, s_lo + max_ref, s_hi, t, t_half, tmp_slip,
+ t_hi, match_score, mismatch_score, indel_score, gap_score,
+ & entry, last_entry, sub_ali_2);
+
+ align . Combine (sub_ali_1, sub_ali_2);
+
+ return;
+ }
+
+
+
+int DNA_Char_To_Sub
+ (char ch)
+
+// Return the subscript 0 .. 4 corresponding to ch
+// acgt-, respectively. Return -1 if ch is not
+// one of these characters
+
+ {
+ switch (tolower (ch))
+ {
+ case 'a' :
+ return 0;
+ case 'c' :
+ return 1;
+ case 'g' :
+ return 2;
+ case 't' :
+ return 3;
+ case '-' :
+ return 4;
+ default :
+ return -1;
+ }
+ }
+
+
+
+int Exact_Prefix_Match
+ (const char * s, const char * t, int max_len)
+
+// Return the length of the longest exact prefix match of
+// strings s and t , not to exceed max_len .
+
+ {
+ int i;
+
+ if (Verbose > 5)
+ {
+ fprintf (stderr, "In Exact_Prefix_Match max_len = %d\n", max_len);
+ fprintf (stderr, "s :\n");
+ Fasta_Print (stderr, s, NULL);
+ fprintf (stderr, "t :\n");
+ Fasta_Print (stderr, t, NULL);
+ }
+
+ for (i = 0; i < max_len && s [i] == t [i]; i ++)
+//**ALD Allow N's to match anything
+// for (i = 0; i < max_len
+// && (s [i] == t [i] || tolower (s [i]) == 'n'
+// || tolower (t [i]) == 'n'); i ++)
+ ;
+
+ if (Verbose > 3)
+ {
+ fprintf (stderr, "Exact_Prefix_Match return value = %d\n", i);
+ }
+
+ return i;
+ }
+
+
+
+int Gapped_Equivalent
+ (int pos, const string & s)
+
+// Return the gapped position in s that is equivalent to
+// pos in an ungapped sequence. The return position is
+// the largest possible value, i.e., we slide over as many
+// '-'s as possible.
+
+ {
+ int i, j, n;
+
+ n = s . length ();
+ for (i = j = 0; i < n && j <= pos; i ++)
+ if (s [i] != '-')
+ {
+ if (j == pos)
+ return i;
+ j ++;
+ }
+
+ return i;
+ }
+
+
+
+void Global_Align
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align)
+
+// Find the best global alignment of the entire string s to a
+// substring of t between positions t_lo and t_hi .
+// The length of s is s_len and the length of t is at least
+// t_hi . The resulting alignment is stored in align ,
+// where s is the a string and t is the b string.
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+
+ {
+ vector < vector <Align_Score_Entry_t> > a; // the alignment array
+ vector <Align_Score_Entry_t> empty_vector;
+ vector <int> delta;
+ Align_Score_Entry_t entry;
+ int r, c; // row and column
+ int max_row, max_score;
+ unsigned int max_from;
+ int mxs;
+ unsigned int mxf;
+ int ct, sign;
+ int i, n; // position in string t
+
+ assert (t_lo <= t_hi);
+ assert (0 <= s_len );
+
+ // Do first row
+ a . push_back (empty_vector);
+ entry . diag_score = entry . top_score = entry . left_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ r = 0;
+ a [r] . push_back (entry);
+ for (c = 1; c <= s_len; c ++)
+ {
+ entry . top_score = NEG_INFTY_SCORE;
+ entry . top_from = FROM_NOWHERE;
+ entry . diag_score = NEG_INFTY_SCORE;
+ entry . diag_from = FROM_NOWHERE;
+ entry . left_score = a [r] [c - 1] . left_score + indel_score;
+ if (c == 1)
+ entry . left_score += gap_score;
+ entry . left_from = FROM_LEFT;
+ a [r] . push_back (entry);
+ }
+ entry . Get_Max (max_score, max_from);
+ max_row = 0;
+
+ // Do remaining rows
+ for (i = t_lo; i < t_hi; i ++)
+ {
+ r ++;
+
+ // First column in row
+ a . push_back (empty_vector);
+ entry . diag_score = entry . left_score = NEG_INFTY_SCORE;
+ entry . top_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ a [r] . push_back (entry);
+
+ // Remaining columns in row
+ for (c = 1; c <= s_len; c ++)
+ {
+ Align_Score_Entry_t * p;
+
+ p = & (a [r - 1] [c]);
+ p -> Get_Max (mxs, mxf);
+ if (mxf != FROM_TOP)
+ mxs += gap_score;
+ mxs += indel_score;
+ entry . top_score = mxs;
+ entry . top_from = mxf;
+
+ p = & (a [r - 1] [c - 1]);
+ if (p -> left_score < p -> diag_score)
+ {
+ entry . diag_score = p -> diag_score;
+ entry . diag_from = FROM_DIAG;
+ }
+ else
+ {
+ entry . diag_score = p -> left_score;
+ entry . diag_from = FROM_LEFT;
+ }
+ if (entry . diag_score < p -> top_score)
+ {
+ entry . diag_score = p -> top_score;
+ entry . diag_from = FROM_TOP;
+ }
+ entry . diag_score += ((ismatch(t [i] , s [c - 1])) ? match_score : mismatch_score);
+
+ p = & (a [r] [c - 1]);
+ if (p -> left_score < p -> diag_score)
+ {
+ entry . left_score = p -> diag_score + gap_score;
+ entry . left_from = FROM_DIAG;
+ }
+ else
+ {
+ entry . left_score = p -> left_score; // Don't add gap_score here
+ entry . left_from = FROM_LEFT;
+ }
+ if (entry . left_score < p -> top_score)
+ {
+ entry . left_score = p -> top_score + gap_score;
+ entry . left_from = FROM_TOP;
+ }
+ entry . left_score += indel_score;
+ a [r] . push_back (entry);
+#if 0
+entry . Get_Max (mxs, mxf);
+printf ("r = %d c = %d mxs = %d mxf = %u max_score = %d max_row = %d\n",
+ r, c, mxs, mxf, max_score, max_row);
+printf ("L = %d:%u D = %d:%u T = %d:%u\n", entry . left_score, entry . left_from,
+ entry . diag_score, entry . diag_from, entry . top_score, entry . top_from);
+#endif
+ }
+
+ entry . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = r;
+ }
+ }
+
+ r = max_row;
+ c = s_len;
+ ct = 0;
+ sign = 0;
+ while (c > 0)
+ {
+#if 0
+{
+ int mxs;
+ unsigned int mxf;
+
+ a [r] [c] . Get_Max (mxs, mxf);
+
+ printf ("r = %d c = %d mxs = %d mxf = %u\n", r, c, mxs, mxf);
+ printf ("sign = %d ct = %d\n", sign, ct);
+}
+#endif
+ switch (max_from)
+ {
+ case FROM_LEFT :
+ if (sign != 0)
+ {
+ if (Verbose > 2)
+ printf ("del = %d\n", sign * ct);
+ delta . push_back (sign * ct);
+ }
+ ct = 1;
+ sign = -1;
+ max_from = a [r] [c] . left_from;
+ c --;
+ break;
+ case FROM_DIAG :
+ ct ++;
+ max_from = a [r] [c] . diag_from;
+ r --;
+ c --;
+ break;
+ case FROM_TOP :
+ if (sign != 0)
+ {
+ if (Verbose > 2)
+ printf ("del = %d\n", sign * ct);
+ delta . push_back (sign * ct);
+ }
+ ct = 1;
+ sign = 1;
+ max_from = a [r] [c] . top_from;
+ r --;
+ break;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad from = %u in Global_Align",
+ max_from);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ }
+
+ if (sign != 0)
+ {
+ if (Verbose > 2)
+ printf ("del = %d\n", sign * ct);
+ delta . push_back (sign * ct);
+ }
+
+ align . a_lo = 0;
+ align . a_hi = s_len;
+ align . b_hi = max_row + t_lo;
+ align . b_lo = r + t_lo;
+
+ reverse (delta . begin (), delta . end ());
+ n = delta . size ();
+ if (Verbose > 2)
+ for (i = 0; i < n; i ++)
+ printf ("delta [%d] = %d\n", i, delta [i]);
+
+ align . setDelta (delta);
+
+ return;
+ }
+
+
+
+void Incr_Opposite
+ (vector <Phase_Entry_t> & v, int from, int to)
+
+// Increment opposite_ct in v [i] that matches from and
+// to . If none is found, then add a new one and set its
+// oppostie_ct to 1 and its same_ct to 0 .
+
+ {
+ Phase_Entry_t p;
+ int i, n;
+
+ n = v . size ();
+ for (i = 0; i < n; i ++)
+ if (v [i] . to == to)
+ {
+ assert (v [i] . from = from);
+ v [i] . opposite_ct ++;
+ return;
+ }
+
+ p . from = from;
+ p . to = to;
+ p . opposite_ct = 1;
+ p . same_ct = 0;
+ p . weight = 0;
+
+ v . push_back (p);
+
+ return;
+ }
+
+
+
+void Incr_Same
+ (vector <Phase_Entry_t> & v, int from, int to)
+
+// Increment same_ct in v [i] that matches from and
+// to . If none is found, then add a new one and set its
+// same_ct to 1 and its opposite_ct to 0 .
+
+ {
+ Phase_Entry_t p;
+ int i, n;
+
+ n = v . size ();
+ for (i = 0; i < n; i ++)
+ if (v [i] . to == to)
+ {
+ assert (v [i] . from = from);
+ v [i] . same_ct ++;
+ return;
+ }
+
+ p . from = from;
+ p . to = to;
+ p . same_ct = 1;
+ p . opposite_ct = 0;
+ p . weight = 0;
+
+ v . push_back (p);
+
+ return;
+ }
+
+
+
+bool Is_Distinguishing
+ (unsigned char ct [5], char & ch1, int & ch1_ct,
+ char & ch2, int & ch2_ct)
+
+// Check if values in ct indicate a polymorphism. If so set
+// ch1 and ch2 to the most frequenct characters and
+// ch1_ct and ch2_ct to the number of occurrences of each.
+
+ {
+ int sub1, sub2;
+ int i;
+
+ ch1_ct = ct [0];
+ sub1 = 0;
+ ch2_ct = 0;
+
+ for (i = 1; i < 5; i ++)
+ if (ch2_ct < ct [i])
+ {
+ if (ch1_ct < ct [i])
+ {
+ ch2_ct = ch1_ct;
+ sub2 = sub1;
+ ch1_ct = ct [i];
+ sub1 = i;
+ }
+ else
+ {
+ ch2_ct = ct [i];
+ sub2 = i;
+ }
+ }
+
+ // Simple version that makes a column distinguishing if it has
+ // >= 3 occurrences of 3 or more characters
+ // Should probably make alternative version that uses quality values
+ if (ch1_ct >= 3 && ch2_ct >= 3)
+ {
+ ch1 = Sub_To_DNA_Char (sub1);
+ ch2 = Sub_To_DNA_Char (sub2);
+ return true;
+ }
+
+ return false;
+ }
+
+
+
+int Match_Count
+ (const vector <int> & a, const vector <int> & b)
+
+// Return the number of entries in a that are also in b
+// Assume each list is in ascending sorted order without
+// duplicates.
+
+ {
+ int i, j, m, n, ct;
+
+ m = a . size ();
+ n = b . size ();
+
+ i = j = ct = 0;
+ while (i < m && j < n)
+ {
+ if (a [i] < b [j])
+ i ++;
+ else if (b [j] < a [i])
+ j ++;
+ else
+ {
+ ct ++;
+ i ++;
+ j ++;
+ }
+ }
+
+ return ct;
+ }
+
+
+
+void Multi_Align
+ (const string & id, vector <char *> & s, vector <int> & offset,
+ int offset_delta, double error_rate, int min_overlap,
+ Gapped_Multi_Alignment_t & gma, vector <int> * ref,
+ vector <char *> * tag_list)
+
+// id is the id of the contig being multi-aligned.
+// Create multialignment in gma of strings s each of which has
+// a nominal offset from its predecessor of offset . offset_delta is
+// the number of positions by which the offset is allowed to vary in
+// either direction. error_rate is the maximum expected error rate
+// in alignments between strings. It should be twice the expected error
+// rate to the real reference string to allow for independent errors
+// in separate strings. Strings must overlap by at least min_overlap
+// bases (unless forced). The value of offset [0] must be zero.
+// If ref isn't NULL then make its values be the subscripts of
+// the original locations of the entries in s in case they are
+// shifted. If tag_list isn't NULL , then use its values to identify
+// the strings in s and shift them along with the entries in s .
+
+ {
+ Multi_Alignment_t ma;
+ vector <Vote_t> vote;
+ bool changed;
+ int ct, n;
+
+ n = s . size ();
+ if (n == 0)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Multi_Align for contig %s called with no strings",
+ id . c_str ());
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ if (n != int (offset . size ()))
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Multi_Align for contig %s called with %d strings and %d offsets",
+ id . c_str (), n, int (offset . size ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ if (offset [0] != 0)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Multi_Align for contig %s called with non-zero offset [0] = %d",
+ id . c_str (), offset [0]);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ Sort_Strings_And_Offsets (s, offset, ref, tag_list);
+
+ ma . setID (id);
+ ma . Set_Initial_Consensus (s, offset, offset_delta, error_rate, min_overlap,
+ vote, tag_list);
+
+ ct = 0;
+ do
+ {
+ ma . Reset_From_Votes (s, offset_delta, error_rate, vote, changed);
+ ct ++;
+ } while (ct < MAX_REFINEMENTS && changed);
+
+ if (Verbose > 3)
+ ma . Print_Alignments_To_Consensus (stderr, s);
+
+ gma . Convert_From (ma);
+
+ gma . Sort (s, ref, tag_list);
+
+ return;
+ }
+
+
+
+void Overlap_Align
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int t_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align)
+
+// Find the best alignment of a prefix of string s to a
+// substring of t starting between positions t_lo and t_hi ,
+// where the alignment must extend to the end of one of the strings.
+// The length of s is s_len and the length of t is t_len .
+// The resulting alignment is stored in align ,
+// where s is the a string and t is the b string.
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+
+ {
+ int matrix_size;
+
+ if (Verbose > 3)
+ fprintf (stderr, "Overlap_Align: s_len = %d t_lo/hi/len = %d/%d/%d\n",
+ s_len, t_lo, t_hi, t_len);
+
+ assert (t_lo <= t_hi);
+ assert (t_hi <= t_len);
+ assert (0 <= s_len );
+
+ matrix_size = s_len * (t_len - t_lo);
+ if (t_len - t_lo <= 10 || matrix_size <= MATRIX_SIZE_LIMIT)
+ Overlap_Align_Full_Matrix (s, s_len, t, t_lo, t_hi, t_len,
+ match_score, mismatch_score, indel_score, gap_score, align);
+ else
+ Overlap_Align_Save_Space (s, s_len, t, t_lo, t_hi, t_len,
+ match_score, mismatch_score, indel_score, gap_score, align);
+
+ return;
+ }
+
+
+
+void Overlap_Align_Full_Matrix
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int t_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align)
+
+// Find the best alignment of a prefix of string s to a
+// substring of t starting between postions t_lo and t_hi ,
+// where the alignment must extend to the end of one of the strings.
+// The length of s is s_len and the length of t is t_len .
+// The resulting alignment is stored in align ,
+// where s is the a string and t is the b string.
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+// Use a full matrix for the computation.
+
+ {
+ vector < vector <Align_Score_Entry_t> > a; // the alignment array
+ vector <Align_Score_Entry_t> empty_vector;
+ vector <int> delta;
+ Align_Score_Entry_t entry;
+ int r, c; // row and column
+ unsigned int max_from, mxf;
+ int max_row, max_col, max_score, mxs;
+ int error_ct, row_limit;
+ int i, n; // position in string t
+
+ // Do first row
+
+ if (Verbose > 0)
+ fprintf (stderr, "Overlap_Align_Full_Matrix:\n");
+
+ a . push_back (empty_vector);
+ entry . diag_score = entry . top_score = entry . left_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ r = 0;
+ a [r] . push_back (entry);
+ for (c = 1; c <= s_len; c ++)
+ {
+ entry . top_score = NEG_INFTY_SCORE;
+ entry . top_from = FROM_NOWHERE;
+ entry . diag_score = NEG_INFTY_SCORE;
+ entry . diag_from = FROM_NOWHERE;
+ entry . left_score = a [r] [c - 1] . left_score + indel_score;
+ if (c == 1)
+ entry . left_score += gap_score;
+ entry . left_from = FROM_LEFT;
+ a [r] . push_back (entry);
+ }
+ entry . Get_Max (max_score, max_from);
+ max_row = 0;
+
+ // Do remaining rows
+ for (i = t_lo; i < t_len; i ++)
+ {
+ r ++;
+
+ // First column in row
+ a . push_back (empty_vector);
+ entry . diag_score = entry . left_score = NEG_INFTY_SCORE;
+ if (i < t_hi - 1)
+ {
+ entry . top_score = 0;
+ entry . top_from = FROM_NOWHERE;
+ }
+ else
+ {
+ entry . top_score = a [r - 1] [0] . top_score + indel_score;
+ if (i == t_hi - 1)
+ entry . top_score += gap_score;
+ entry . top_from = FROM_TOP;
+ }
+ entry . diag_from = entry . left_from = FROM_NOWHERE;
+ a [r] . push_back (entry);
+
+ // Remaining columns in row
+ for (c = 1; c <= s_len; c ++)
+ {
+ Align_Score_Entry_t * p;
+
+ p = & (a [r - 1] [c]);
+ p -> Get_Max_Top (mxs, mxf, gap_score);
+ entry . top_score = mxs + indel_score;
+ entry . top_from = mxf;
+
+ p = & (a [r - 1] [c - 1]);
+ p -> Get_Max (mxs, mxf);
+ entry . diag_score = mxs;
+ entry . diag_from = mxf;
+ entry . diag_score += ((ismatch(t [i] , s [c - 1])) ? match_score : mismatch_score);
+
+ p = & (a [r] [c - 1]);
+ p -> Get_Max_Left (mxs, mxf, gap_score);
+ entry . left_score = mxs + indel_score;
+ entry . left_from = mxf;
+ a [r] . push_back (entry);
+ }
+
+ // check last entry in row to find max
+ entry . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = r;
+ max_col = s_len;
+ }
+ }
+
+ // See if get better max in the last row
+ for (c = 0; c <= s_len; c ++)
+ {
+ a [r] [c] . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = r;
+ max_col = c;
+ }
+ }
+
+ // Trace back
+ r = max_row;
+ c = max_col;
+ row_limit = t_hi - t_lo - 1;
+ Trace_Back_Align_Path (a, r, c, row_limit, 0, delta,
+ error_ct, s, t + t_lo);
+
+ align . a_lo = 0;
+ align . a_hi = max_col;
+ align . b_hi = max_row + t_lo;
+ align . b_lo = r + t_lo;
+ align . errors = error_ct;
+
+ if (Verbose > 2)
+ {
+ n = delta . size ();
+ for (i = 0; i < n; i ++)
+ printf ("delta [%d] = %d\n", i, delta [i]);
+ }
+
+ align . setDelta (delta);
+
+ return;
+ }
+
+
+
+void Overlap_Align_Save_Space
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int t_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align)
+
+// Find the best alignment of a prefix of string s to a
+// substring of t starting between postions t_lo and t_hi ,
+// where the alignment must extend to the end of one of the strings.
+// The length of s is s_len and the length of t is t_len .
+// The resulting alignment is stored in align ,
+// where s is the a string and t is the b string.
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+// Do recursively keeping just a finite number of rows
+
+ {
+ Alignment_t sub_ali_1, sub_ali_2;
+ vector <Augmented_Score_Entry_t> align_row;
+ // row of alignment array
+ Augmented_Score_Entry_t entry, last_entry;
+ int t_half, t_slip;
+ int max_row, max_col, max_score, mxs, max_ref;
+ unsigned int max_from, mxf;
+ int r, c;
+
+ if (Verbose > 3)
+ fprintf (stderr, "Overlap_Align_Save_Space:\n");
+
+ // Build first row
+
+ entry . diag_score = entry . top_score = entry . left_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ entry . top_ref = entry . diag_ref = entry . left_ref = 0;
+ align_row . push_back (entry);
+ for (c = 1; c <= s_len; c ++)
+ {
+ entry . top_score = NEG_INFTY_SCORE;
+ entry . top_from = FROM_NOWHERE;
+ entry . diag_score = NEG_INFTY_SCORE;
+ entry . diag_from = FROM_NOWHERE;
+ entry . left_score = align_row [c - 1] . left_score + indel_score;
+ if (c == 1)
+ entry . left_score += gap_score;
+ entry . left_from = FROM_LEFT;
+ entry . left_ref = 0;
+ entry . top_ref = entry . diag_ref = -1;
+ align_row . push_back (entry);
+ }
+ entry . Get_Max (max_score, max_from);
+ max_row = t_lo;
+ max_col = s_len;
+ max_ref = 0;
+
+ // Do remaining rows
+
+ t_half = (t_lo + t_len) / 2;
+ for (r = t_lo + 1; r <= t_len; r ++)
+ {
+ int first_score;
+
+ if (r < t_hi)
+ first_score = 0;
+ else if (r == t_hi)
+ first_score = indel_score + gap_score;
+ else
+ first_score = indel_score;
+
+ Align_Row_Update (align_row, t [r - 1], s, s_len, match_score,
+ mismatch_score, indel_score, gap_score, first_score);
+
+ if (r == t_half)
+ { // set the ref entries to reference this row
+ align_row [0] . top_ref = 0;
+ for (c = 1; c <= s_len; c ++)
+ {
+ align_row [c] . top_ref = align_row [c] . diag_ref = c;
+ align_row [c - 1] . Get_Max_Left (mxs, mxf, gap_score);
+ align_row [c] . left_ref = align_row [c - 1] . Get_Ref (mxf);
+ }
+ }
+
+ // Check last column entry for max
+ align_row [s_len] . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = r;
+ max_col = s_len;
+ max_ref = align_row [s_len] . Get_Ref (mxf);
+ }
+ }
+
+ // Check entries in last row for max
+ for (c = 0; c <= s_len; c ++)
+ {
+ align_row [c] . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = t_len;
+ max_col = c;
+ max_ref = align_row [c] . Get_Ref (mxf);
+ }
+ }
+
+ t_slip = Min (t_hi, max_row);
+ if (Verbose > 3)
+ fprintf (stderr,
+ "max_row/col = %d/%d t_lo = %d t_slip = %d t_half = %d t_hi = %d\n",
+ max_row, max_col, t_lo, t_slip, t_half, t_hi);
+ if (max_row <= t_half)
+ {
+ // only need one recursive call on the first half of the alignment
+ Complete_Align (s, 0, s_len, t, t_lo, t_slip, max_row,
+ match_score, mismatch_score, indel_score, gap_score, NULL,
+ entry, align);
+
+ return;
+ }
+
+ if (max_col == 0 && t_half < t_hi)
+ {
+ // only need one recursive call on the second half of the alignment
+ // because the best start for the alignment is after t_half
+ Complete_Align (s, 0, s_len, t, t_half, t_hi, max_row,
+ match_score, mismatch_score, indel_score, gap_score, NULL,
+ entry, align);
+
+ return;
+ }
+
+ t_slip = Min (t_hi, t_half);
+ if (Verbose > 3)
+ fprintf (stderr,
+ "max_ref = %d t_lo = %d t_slip = %d t_half = %d t_hi = %d\n",
+ max_ref, t_lo, t_slip, t_half, t_hi);
+ Complete_Align (s, 0, max_ref, t, t_lo, t_slip, t_half,
+ match_score, mismatch_score, indel_score, gap_score,
+ NULL, entry, sub_ali_1);
+
+ if (max_ref == 0)
+ t_slip = Max (t_hi, t_half + 1);
+ else
+ t_slip = t_half + 1;
+ Complete_Align (s, max_ref, max_col, t, t_half, t_slip,
+ max_row, match_score, mismatch_score, indel_score, gap_score,
+ & entry, last_entry, sub_ali_2);
+
+ align . Combine (sub_ali_1, sub_ali_2);
+
+ return;
+ }
+
+
+
+bool Overlap_Match_VS
+ (const char * s, int s_len, const char * t, int t_len,
+ int lo_off, int hi_off, int min_len, int max_errors,
+ Alignment_t & align)
+
+// Return whether there is an overlap between string s and string
+// t starting at a position in the range lo_off .. hi_off wrt
+// string t . These values must be non-negative. The overlap region
+// can have at most max_errors errors and must be at least min_len
+// long in both s and t (length can differ because of indels).
+// The length of s is s_len and the length of t is t_len .
+// If successful, the alignment is stored in align .
+// Uses Vishkin_Schieber (e * n) algorithm. Errors are inserts,
+// deletes or substitutions. Returns the best match found, i.e.,
+// the match with the lowest errors/overlap_len ratio, where
+// overlap_len is the average of the lengths of the two strings'
+// overlap regions.
+
+ {
+ static Match_Extent_Entry_t * space = NULL;
+ static int space_size = 0;
+ static Match_Extent_Entry_t * * tab = NULL;
+ static int tab_size = 0;
+ int space_needed;
+ bool found;
+ int complete_match, possible_len;
+ int e, i, best_i;
+
+ if (Verbose > 3)
+ {
+ fprintf (stderr, "In Overlap_Match_VS lo_off = %d hi_off = %d\n",
+ lo_off, hi_off);
+ }
+
+ lo_off = Max (0, lo_off);
+ hi_off = Min (hi_off, t_len - min_len);
+
+ if (hi_off < lo_off || s_len < min_len)
+ return false; // No match possible
+
+ if (max_errors < 0)
+ {
+ sprintf (Clean_Exit_Msg_Line, "ERROR: max_errors = %d < 0", max_errors);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ // allocate more memory if necessary
+ space_needed = (1 + max_errors) * (max_errors + 1 + hi_off - lo_off);
+ if (space_needed > space_size)
+ {
+ space_size = space_needed;
+ space = (Match_Extent_Entry_t *) Safe_realloc
+ (space, space_size * sizeof (Match_Extent_Entry_t),
+ __FILE__, __LINE__);
+ }
+ if (1 + max_errors > tab_size)
+ {
+ tab_size = 1 + max_errors;
+ tab = (Match_Extent_Entry_t * *) Safe_realloc
+ (tab, tab_size * sizeof (Match_Extent_Entry_t *),
+ __FILE__, __LINE__);
+ }
+
+ // tab points to the logical start of each row of
+ // (truncated) pyramidal array with entries for (lo_off .. hi_off)
+ // in the zeroth row and extending one to the left and one to the
+ // right every row after that
+
+ tab [0] = space - lo_off;
+
+ // find how far can match at each spot with zero errors
+ // Could do better maybe using KMP here
+ for (i = lo_off; i <= hi_off; i ++)
+ {
+ possible_len = Min (s_len, t_len - i);
+ tab [0] [i] . len = Exact_Prefix_Match (s, t + i, possible_len);
+ tab [0] [i] . from = MATCH_FROM_TOP;
+ if (tab [0] [i] . len == possible_len)
+ { // match found
+ align . Set_Exact (0, i, possible_len);
+ return true;
+ }
+ }
+
+ // now progressively try more errors
+ found = false;
+ best_i = lo_off - max_errors - 2;
+
+ for (e = 1; e <= max_errors && ! found; e ++)
+ {
+ int prev_match;
+
+ tab [e] = tab [e - 1] + hi_off - lo_off + 2 * e;
+
+ i = lo_off - e;
+ complete_match = Min (s_len, t_len - i);
+ prev_match = tab [e - 1] [i + 1] . len;
+ possible_len = Min (s_len - prev_match - 1,
+ t_len - i - prev_match - 1);
+ tab [e] [i] . len = prev_match + 1
+ + Exact_Prefix_Match (s + prev_match + 1, t + i + prev_match + 1,
+ possible_len);
+ tab [e] [i] . from = MATCH_FROM_NE;
+ if (tab [e] [i] . len == complete_match)
+ {
+ found = true;
+ best_i = i;
+ }
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d NE len = %d poss_len = %d\n",
+ e, i, tab [e] [i] . len, possible_len);
+
+ for (i = lo_off - e + 1; i <= hi_off + e - 1; i ++)
+ {
+ int next;
+
+ complete_match = Min (s_len, t_len - i);
+
+ prev_match = tab [e - 1] [i] . len;
+ possible_len = Min (s_len - prev_match - 1,
+ t_len - i - prev_match - 1);
+ tab [e] [i] . len = prev_match + 1
+ + Exact_Prefix_Match (s + prev_match + 1, t + i + prev_match + 1,
+ possible_len);
+ tab [e] [i] . from = MATCH_FROM_TOP;
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d TOP len = %d poss_len = %d\n",
+ e, i, tab [e] [i] . len, possible_len);
+
+ if (i > lo_off - e + 1)
+ {
+ prev_match = tab [e - 1] [i - 1] . len;
+ possible_len = Min (s_len - prev_match,
+ t_len - i - prev_match);
+ next = prev_match
+ + Exact_Prefix_Match
+ (s + prev_match, t + i + prev_match,
+ possible_len);
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d NW len = %d poss_len = %d\n",
+ e, i, next, possible_len);
+ if (next > tab [e] [i] . len)
+ {
+ tab [e] [i] . len = next;
+ tab [e] [i] . from = MATCH_FROM_NW;
+ }
+ }
+
+ if (i < hi_off + e - 1)
+ {
+ prev_match = tab [e - 1] [i + 1] . len;
+ possible_len = Min (s_len - prev_match - 1,
+ t_len - i - prev_match - 1);
+ next = prev_match + 1
+ + Exact_Prefix_Match
+ (s + prev_match + 1, t + i + prev_match + 1,
+ possible_len);
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d NE len = %d poss_len = %d\n",
+ e, i, next, possible_len);
+ if (next > tab [e] [i] . len)
+ {
+ tab [e] [i] . len = next;
+ tab [e] [i] . from = MATCH_FROM_NE;
+ }
+ }
+
+ // Prefer MATCH_FROM_TOP if there are consecutive matches
+ if (tab [e] [i] . len == complete_match)
+ {
+ if (tab [e] [i] . from == MATCH_FROM_TOP)
+ {
+ best_i = i;
+ found = true;
+ break;
+ }
+ else if (! found)
+ {
+ found = true;
+ best_i = i;
+ }
+ }
+ else if (found)
+ break;
+ }
+
+ if (! found)
+ {
+ i = hi_off + e;
+ complete_match = Min (s_len, t_len - i);
+ prev_match = tab [e - 1] [i - 1] . len;
+ possible_len = Min (s_len - prev_match,
+ t_len - i - prev_match);
+ tab [e] [i] . len = prev_match
+ + Exact_Prefix_Match (s + prev_match, t + i + prev_match,
+ possible_len);
+ tab [e] [i] . from = MATCH_FROM_NW;
+ if (tab [e] [i] . len == complete_match)
+ {
+ best_i = i;
+ found = true;
+ }
+ }
+ }
+
+ if (Verbose > 1)
+ Print_VS_Table (stderr, tab, lo_off, hi_off + 1, e, best_i, found);
+
+ if (found)
+ {
+ align . Set_From_VS_Matrix (tab, e - 1, best_i);
+ return true;
+ }
+
+ return false;
+ }
+
+
+
+void Print_Align_Lines_Pair
+ (FILE * fp, const string & s, const string & t, int len,
+ const char * s_label, const char * t_label,
+ int s_lo, int s_hi, int t_lo, int t_hi)
+
+// Print to fp alignment lines s and t , each of length len .
+// Print s_label at the beginning of the s line and t_label
+// at the beginning of the t line, and print the ranges
+// s_lo .. s_hi and t_lo .. t_hi at the right of the lines.
+// Also print a line of carets underneath the s and t lines
+// with a caret beneath every position where the s and t
+// entries differ.
+
+ {
+ int s_label_len, t_label_len;
+ int i;
+
+ // In case s_label and t_label aren't the same length
+ // we'll use the longer of the two and right align them
+
+ s_label_len = strlen (s_label);
+ t_label_len = strlen (t_label);
+ if (s_label_len < t_label_len)
+ s_label_len = t_label_len;
+
+ fprintf (fp, "%*s ", s_label_len, s_label);
+ for (i = 0; i < len; i ++)
+ fputc (s [i], fp);
+ fprintf (fp, " (%d-%d)\n", s_lo, s_hi);
+
+ fprintf (fp, "%*s ", s_label_len, t_label);
+ for (i = 0; i < len; i ++)
+ fputc (t [i], fp);
+ fprintf (fp, " (%d-%d)\n", t_lo, t_hi);
+
+ fprintf (fp, "%*s ", s_label_len, "");
+ for (i = 0; i < len; i ++)
+ fputc (s [i] == t [i] ? ' ' : '^', fp);
+ fputc ('\n', fp);
+
+ return;
+ }
+
+
+
+void Print_VS_Table
+ (FILE * fp, Match_Extent_Entry_t * * tab, int t_lo, int t_hi, int e,
+ int best_i, bool found)
+
+// Print to fp the entries in tab for columns t_lo - e .. t_hi + e
+// and rows 0 .. e - 1 . End the last row at column best_i .
+// Also print the value of found .
+
+ {
+ int i, j;
+
+ fprintf (stderr, "e = %d best_i = %d found = %c\n",
+ e, best_i, found ? 'T' : 'F');
+ fprintf (stderr, "%3s ", "e");
+ for (j = t_lo - e + 1; j < t_hi + e - 1; j ++)
+ fprintf (stderr, " %3d ", j);
+ fputc ('\n', stderr);
+
+ if (! found)
+ best_i = t_hi + e - 1;
+
+ for (i = 0; i < e; i ++)
+ {
+ fprintf (stderr, "%2d: ", i);
+
+ for (j = t_lo - e + 1; (i < e - 1 && j < t_hi + e - 1)
+ || (i == e - 1 && j <= best_i); j ++)
+ if (j < t_lo - i || j >= t_hi + i)
+ fprintf (stderr, " %3s ", "-");
+ else
+ {
+ char ch;
+ switch (tab [i] [j] . from)
+ {
+ case -1 :
+ ch = 'r';
+ break;
+ case 0 :
+ ch = 't';
+ break;
+ case 1 :
+ ch = 'l';
+ break;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "ERROR: from = %d\n",
+ tab [i] [j] . from);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ fprintf (stderr, " %3d%c", tab [i] [j] . len, ch);
+ }
+ fputc ('\n', stderr);
+ }
+ }
+
+
+
+bool Range_Intersect
+ (int a_lo, int a_hi, int b_lo, int b_hi)
+
+// Return true iff the substring range a_lo .. a_hi overlaps the
+// substring range b_lo .. b_hi .
+
+ {
+ if (a_lo == a_hi)
+ return false; // a is empty
+
+ if (a_hi <= b_lo || a_lo >= b_hi)
+ return false;
+
+ return true;
+ }
+
+
+
+void Simple_Overlap
+ (const char * s, int s_len, const char * t, int t_len,
+ Simple_Overlap_t & olap, int match_score,
+ int mismatch_score,
+ int indel_score,
+ int gap_score)
+
+// Find the highest-scoring overlap alignment between string s and
+// string t , i.e., an alignment the extends to the end of either
+// of the two strings on each end.
+// The length of s is s_len and the length of t is t_len .
+// The resulting overlap is stored in olap .
+// match_score is the score for matching characters (positive);
+// mismatch_score the score for aligning different characters (negative);
+// indel_score the score for insertions/deletions (negative);
+// and gap_score the extra penalty for starting a gap (negative).
+
+ {
+ vector <Errors_Score_Entry_t> align_row;
+ // row of alignment array
+ Errors_Score_Entry_t entry;
+ int max_row, max_col, max_score, mxs, max_ref, max_errors;
+ unsigned int max_from, mxf;
+ int r, c;
+
+ // Create the first row of the alignment matrix
+ entry . diag_score = entry . top_score = entry . left_score = 0;
+ entry . diag_from = entry . top_from = entry . left_from = FROM_NOWHERE;
+ entry . diag_errors = entry . top_errors = entry . left_errors = 0;
+
+ for (c = 0; c <= s_len; c ++)
+ {
+ entry . top_ref = entry . diag_ref = entry . left_ref = c;
+ align_row . push_back (entry);
+ }
+
+ entry . Get_Max (max_score, max_from);
+ max_row = 0;
+ max_col = s_len;
+ max_ref = s_len;
+
+ // Do remaining rows
+ for (r = 1; r <= t_len; r ++)
+ {
+ align_row [0] . top_ref = align_row [0] . diag_ref
+ = align_row [0] . left_ref = 1 - r;
+ // is value of current row, not one being built
+ Align_Row_Update_With_Errors (align_row, t [r - 1], s, s_len, match_score,
+ mismatch_score, indel_score, gap_score, 0, 0);
+
+ // Check last column entry for max
+ align_row [s_len] . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = r;
+ max_col = s_len;
+ max_ref = align_row [s_len] . Get_Ref (mxf);
+ max_errors = align_row [s_len] . Get_Errors (mxf);
+ }
+ }
+
+ // Check entries in last row for max
+ for (c = 0; c <= s_len; c ++)
+ {
+ align_row [c] . Get_Max (mxs, mxf);
+ if (mxs > max_score)
+ {
+ max_score = mxs;
+ max_from = mxf;
+ max_row = t_len;
+ max_col = c;
+ max_ref = align_row [c] . Get_Ref (mxf);
+ max_errors = align_row [c] . Get_Errors (mxf);
+ }
+ }
+
+ if (Verbose > 2)
+ printf ("row = %d col = %d ref = %d score = %d s_len = %d t_len = %d\n",
+ max_row, max_col, max_ref, max_score, s_len, t_len);
+
+ olap . score = max_score;
+ olap . errors = max_errors;
+ olap . a_hang = max_ref;
+ if (max_col < s_len)
+ olap . b_hang = max_col - s_len;
+ else
+ olap . b_hang = t_len - max_row;
+ if (max_ref >= 0)
+ {
+ olap . b_olap_len = max_row;
+ olap . a_olap_len = max_col - max_ref;
+ }
+ else
+ {
+ olap . b_olap_len = max_row + max_ref;
+ olap . a_olap_len = max_col;
+ }
+
+ return;
+ }
+
+
+
+void Sort_Strings_And_Offsets
+ (vector <char *> & s, vector <int> & offset, vector <int> * ref,
+ vector <char *> * tag_list)
+
+// Sort the strings in s into order so that all their offsets
+// are non-negative. Adjust the values in offset accordingly.
+// Use insertion sort since most offsets should be positive.
+// If ref isn't NULL, then set it to the subscripts of the
+// positions of the entries in s and offset before they were
+// changed. If tag_list isn't NULL , then also sort its entries.
+
+ {
+ int i, j, n;
+
+ n = offset . size ();
+ if (n != int (s . size ()))
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Sorting %d strings with %d offsets\n",
+ int (s . size ()), n);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ if (ref != NULL)
+ {
+ ref -> resize (n);
+ for (i = 0; i < n; i ++)
+ (* ref) [i] = i;
+ }
+
+ for (i = 1; i < n; i ++)
+ {
+ char * s_save, * t_save;
+ int o_save, r_save;
+
+ if (0 <= offset [i])
+ continue;
+
+ s_save = s [i];
+ o_save = offset [i];
+ if (tag_list != NULL)
+ t_save = (* tag_list) [i];
+ if (ref != NULL)
+ r_save = (* ref) [i];
+ if (i < n - 1)
+ offset [i + 1] += o_save;
+
+ for (j = i; j > 0 && o_save < 0; j --)
+ {
+ o_save += offset [j - 1];
+ offset [j] = offset [j - 1];
+ s [j] = s [j - 1];
+ if (tag_list != NULL)
+ (* tag_list) [j] = (* tag_list) [j - 1];
+ if (ref != NULL)
+ (* ref) [j] = (* ref) [j - 1];
+ }
+
+ s [j] = s_save;
+ offset [j] = o_save;
+ offset [j + 1] -= o_save;
+ if (tag_list != NULL)
+ (* tag_list) [j] = t_save;
+ if (ref != NULL)
+ (* ref) [j] = r_save;
+ }
+
+ return;
+ }
+
+
+
+bool Substring_Match_VS
+ (const char * s, int s_len, const char * t, int t_len,
+ int t_lo, int t_hi, int max_errors, Alignment_t & align)
+
+// Return whether string s is contained as a substring within
+// string t with at most max_errors errors. The length of
+// s is s_len and the length of t is t_len . The match
+// must start within t between positions t_lo and t_hi (gap
+// coordinates). If successful, the alignment is stored in align .
+// Uses Vishkin_Schieber (e * n) algorithm. Errors are inserts,
+// deletes or substitutions. Returns first match found, i.e., the
+// one beginning closest to t_lo (in case there is more than one).
+
+ {
+ static Match_Extent_Entry_t * space = NULL;
+ static int space_size = 0;
+ static Match_Extent_Entry_t * * tab = NULL;
+ static int tab_size = 0;
+ int space_needed;
+ bool found;
+ int e, i, best_i;
+
+ if (Verbose > 3)
+ {
+ fprintf (stderr, "In Substring_Match_VS t_lo = %d t_hi = %d\n",
+ t_lo, t_hi);
+ }
+
+ if (t_hi <= t_lo)
+ return false; // No place for match to start
+
+ if (max_errors < 0)
+ {
+ sprintf (Clean_Exit_Msg_Line, "ERROR: max_errors = %d < 0", max_errors);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ // allocate more memory if necessary
+ space_needed = (1 + max_errors) * (max_errors + t_hi - t_lo);
+ if (space_needed > space_size)
+ {
+ space_size = space_needed;
+ space = (Match_Extent_Entry_t *) Safe_realloc
+ (space, space_size * sizeof (Match_Extent_Entry_t),
+ __FILE__, __LINE__);
+ }
+ if (1 + max_errors > tab_size)
+ {
+ tab_size = 1 + max_errors;
+ tab = (Match_Extent_Entry_t * *) Safe_realloc
+ (tab, tab_size * sizeof (Match_Extent_Entry_t *),
+ __FILE__, __LINE__);
+ }
+
+ // tab points to the logical start of each row of
+ // (truncated) pyramidal array with entries for (t_lo .. t_hi - 1)
+ // in the zeroth row and extending one to the left and one to the
+ // right every row after that
+
+ tab [0] = space - t_lo;
+
+ // find how far can match at each spot with zero errors
+ // Could do better maybe using KMP here
+ for (i = t_lo; i < t_hi; i ++)
+ {
+ tab [0] [i] . len = Exact_Prefix_Match (s, t + i, Min (s_len, t_len - i));
+ tab [0] [i] . from = MATCH_FROM_TOP;
+ if (tab [0] [i] . len == s_len)
+ { // match found
+ align . Set_Exact (0, i, s_len);
+ return true;
+ }
+ }
+
+ // now progressively try more errors
+ found = false;
+ best_i = t_lo - max_errors - 2;
+
+ for (e = 1; e <= max_errors && ! found; e ++)
+ {
+ int prev_match;
+
+ tab [e] = tab [e - 1] + t_hi - t_lo + 2 * e - 1;
+
+ i = t_lo - e;
+ prev_match = tab [e - 1] [i + 1] . len;
+ tab [e] [i] . len = prev_match + 1
+ + Exact_Prefix_Match (s + prev_match + 1, t + i + prev_match + 1,
+ Min (s_len - prev_match - 1,
+ t_len - i - prev_match - 1));
+ tab [e] [i] . from = MATCH_FROM_NE;
+ if (tab [e] [i] . len == s_len)
+ {
+ found = true;
+ best_i = i;
+ }
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d NE len = %d\n",
+ e, i, tab [e] [i] . len);
+
+ for (i = t_lo - e + 1; i < t_hi + e - 1; i ++)
+ {
+ int next;
+
+ prev_match = tab [e - 1] [i] . len;
+ tab [e] [i] . len = prev_match + 1
+ + Exact_Prefix_Match (s + prev_match + 1, t + i + prev_match + 1,
+ Min (s_len - prev_match - 1,
+ t_len - i - prev_match - 1));
+ tab [e] [i] . from = MATCH_FROM_TOP;
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d TOP len = %d\n",
+ e, i, tab [e] [i] . len);
+
+ if (i > t_lo - e + 1)
+ {
+ prev_match = tab [e - 1] [i - 1] . len;
+ next = prev_match
+ + Exact_Prefix_Match
+ (s + prev_match, t + i + prev_match,
+ Min (s_len - prev_match,
+ t_len - i - prev_match));
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d NW len = %d\n",
+ e, i, next);
+ if (next > tab [e] [i] . len)
+ {
+ tab [e] [i] . len = next;
+ tab [e] [i] . from = MATCH_FROM_NW;
+ }
+ }
+
+ if (i < t_hi + e - 2)
+ {
+ prev_match = tab [e - 1] [i + 1] . len;
+ next = prev_match + 1
+ + Exact_Prefix_Match
+ (s + prev_match + 1, t + i + prev_match + 1,
+ Min (s_len - prev_match - 1,
+ t_len - i - prev_match - 1));
+ if (Verbose > 3)
+ fprintf (stderr, "e = %d i = %d NE len = %d\n",
+ e, i, next);
+ if (next > tab [e] [i] . len)
+ {
+ tab [e] [i] . len = next;
+ tab [e] [i] . from = MATCH_FROM_NE;
+ }
+ }
+
+ // Prefer MATCH_FROM_TOP if there are consecutive matches
+ if (tab [e] [i] . len == s_len)
+ {
+ if (tab [e] [i] . from == MATCH_FROM_TOP)
+ {
+ best_i = i;
+ found = true;
+ break;
+ }
+ else if (! found)
+ {
+ found = true;
+ best_i = i;
+ }
+ }
+ else if (found)
+ break;
+ }
+
+ if (! found)
+ {
+ i = t_hi + e - 1;
+ prev_match = tab [e - 1] [i - 1] . len;
+ tab [e] [i] . len = prev_match
+ + Exact_Prefix_Match (s + prev_match, t + i + prev_match,
+ Min (s_len - prev_match,
+ t_len - i - prev_match));
+ tab [e] [i] . from = MATCH_FROM_NW;
+ if (tab [e] [i] . len == s_len)
+ {
+ best_i = i;
+ found = true;
+ }
+ }
+ }
+
+ if (Verbose > 1)
+ Print_VS_Table (stderr, tab, t_lo, t_hi, e, best_i, found);
+
+ if (found)
+ {
+ align . Set_From_VS_Matrix (tab, e - 1, best_i);
+ return true;
+ }
+
+ return false;
+ }
+
+
+
+char Sub_To_DNA_Char
+ (int i)
+
+// Return the DNA character equivalent of subscript i .
+
+ {
+ static char convert [] = "acgt-";
+
+ if (i >= 5)
+ {
+ sprintf (Clean_Exit_Msg_Line, "ERROR: subscript %d >= 5",
+ i);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ return convert [i];
+ }
+
+
+
+void Trace_Back_Align_Path
+ (const vector < vector <Align_Score_Entry_t> > & a, int & r, int & c,
+ int r_start, int c_start, vector <int> & delta, int & errors,
+ const char * s, const char * t)
+
+// Trace back the alignment in a from row/column r / c back
+// to an entry with r <= r_start and c <= c_start .
+// Set delta to the delta-encoding for the alignment and set
+// errors to the number of errors in the alignment. Strings
+// s and t are the strings referred to by the matrix, s
+// for columns and t for rows.
+
+ {
+ int ct, sign, mxs;
+ unsigned int mxf;
+
+ a [r] [c] . Get_Max (mxs, mxf);
+ ct = sign = errors = 0;
+ delta . clear ();
+
+ while (r > r_start || c > c_start)
+ {
+ switch (mxf)
+ {
+ case FROM_LEFT :
+ if (sign != 0)
+ {
+ if (Verbose > 2)
+ printf ("del = %d\n", sign * ct);
+ delta . push_back (sign * ct);
+ }
+ ct = 1;
+ sign = -1;
+ mxf = a [r] [c] . left_from;
+ c --;
+ errors ++;
+ break;
+ case FROM_DIAG :
+ ct ++;
+ mxf = a [r] [c] . diag_from;
+ r --;
+ c --;
+ if (s [c] != t [r])
+ errors ++;
+ break;
+ case FROM_TOP :
+ if (sign != 0)
+ {
+ if (Verbose > 2)
+ printf ("del = %d\n", sign * ct);
+ delta . push_back (sign * ct);
+ }
+ ct = 1;
+ sign = 1;
+ mxf = a [r] [c] . top_from;
+ r --;
+ errors ++;
+ break;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "ERROR: Bad from = %u in Global_Align",
+ mxf);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ }
+
+ if (sign != 0)
+ {
+ if (Verbose > 2)
+ printf ("del = %d\n", sign * ct);
+ delta . push_back (sign * ct);
+ }
+
+ reverse (delta . begin (), delta . end ());
+
+ return;
+ }
+
+
+
+void Traverse
+ (int v, int par, vector < vector <Phase_Entry_t> > & tree,
+ vector <Distinguishing_Column_t> & dc, char ch, int & sum)
+
+// Set dc [v] . phase_char to ch and continue a depth-first
+// traversal of the tree in tree using the phase of the tree
+// edges to determine the next phase character. Increment
+// sum by ch * (dc [v] . (hapa_ct - hapb_ct)) .
+// par is the subscript of the parent of v in the tree.
+// Note: there must be *NO* cycles in tree except between
+// parent and child.
+
+ {
+ int i, n;
+
+ dc [v] . phase_ch = ch;
+ if (ch == '+')
+ sum += int (dc [v] . hapa_sub . size ())
+ - int (dc [v] . hapb_sub . size ());
+ else
+ sum += int (dc [v] . hapb_sub . size ())
+ - int (dc [v] . hapa_sub . size ());
+
+ n = tree [v] . size ();
+ for (i = 0; i < n; i ++)
+ if (tree [v] [i] . to != par)
+ {
+ if (tree [v] [i] . same_ct >= tree [v] [i] . opposite_ct)
+ Traverse (tree [v] [i] . to, v, tree, dc, ch, sum);
+ else
+ {
+ char flip_ch;
+
+ if (ch == '+')
+ flip_ch = '-';
+ else
+ flip_ch = '+';
+ Traverse (tree [v] [i] . to, v, tree, dc, flip_ch, sum);
+ }
+ }
+
+ return;
+ }
+
+
+
+int UF_Find
+ (int i, vector <int> & uf)
+
+// Return the subscript of the set leader of i in Union-Find
+// array uf .
+
+ {
+ int j;
+
+ for (j = i; uf [j] >= 0; j = uf [j])
+ ;
+
+ if (j == i)
+ return j;
+
+ while (uf [i] != j)
+ {
+ int k = uf [i];
+
+ uf [i] = j;
+ i = k;
+ }
+
+ return j;
+ }
+
+
+
+int UF_Find_With_Parity
+ (int i, vector <int> & uf, int & parity)
+
+// Return the subscript of the set leader of i in Union-Find
+// array uf and set parity to 0 if it's an even number of
+// edges from the leader in the UF tree or 1 if it's odd.
+// Maintain the parity of any other nodes when compressing the path.
+
+ {
+ int j, par, save;
+
+ parity = 0;
+ for (j = i; uf [j] >= 0; j = uf [j])
+ {
+ save = j;
+ parity = 1 - parity;
+ }
+
+ // save should now be the child of j (which is the root of
+ // the tree), on the path from i to the root.
+
+ if (j == i)
+ return j;
+
+ par = parity;
+ while (uf [i] != j)
+ {
+ int k = uf [i];
+
+ if (par == 0)
+ uf [i] = save;
+ else
+ uf [i] = j;
+ i = k;
+ par = 1 - par;
+ }
+
+ return j;
+ }
+
+
+
+void UF_Union
+ (int i, int j, vector <int> & uf)
+
+// Union the sets represented by i and j in Union-Find
+// array uf .
+
+ {
+ assert (uf [i] < 0 && uf [j] < 0);
+
+ if (uf [i] <= uf [j])
+ { // i is more negative, hence bigger
+ uf [i] += uf [j];
+ uf [j] = i;
+ }
+ else
+ { // j is more negative, hence bigger
+ uf [j] += uf [i];
+ uf [i] = j;
+ }
+
+ return;
+ }
+
+
+
+int Ungapped_Positions
+ (const string & s, int lo, int hi)
+
+// Return the number of non-'-' positions in string s
+// in the range lo .. hi , which are in gapped coordinates.
+
+ {
+ int i, n, ct;
+
+ n = s . length ();
+ if (hi > n)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: hi = %d > s . length () = %d in Ungapped_Positions\n",
+ hi, n);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ ct = 0;
+ for (i = lo; i < hi; i ++)
+ if (s [i] != '-')
+ ct ++;
+
+ return ct;
+ }
+
+
+
+void Update_Banded_Row
+ (vector <Errors_Score_Entry_t> & band, char ch, const char * s,
+ int s_len, int left_col, int right_col, int match_score,
+ int mismatch_score, int indel_score, int gap_score, int first_score,
+ int first_error)
+
+// Update band to be the values in the next row of an alignment
+// matrix where the preceding row is in band now.
+// The new band is shifted one to the right of the current band.
+// ch is the character for the next row and s (whose length is s_len )
+// is the characters across the top of the alignment matrix.
+// The current band represents columns left_col .. right_col in
+// the alignment matrix.
+// match_score , mismatch_score , indel_score and gap_score
+// are the scores for matching characters, mismatching characters,
+// insertion/deletion and initiating a gap, respectively.
+// first_score is the value to add to the first entry's top_score field.
+// first_error is the value to add to the first entry's top_errors field.
+
+ {
+ Errors_Score_Entry_t save, * p, * q;
+ int mxs;
+ unsigned int mxf;
+ int c, i, first, last;
+
+ assert (int (band . size ()) == 1 + right_col - left_col);
+
+ // Fill in the first cell
+ if (left_col < 0)
+ {
+ first = -1 - left_col;
+ c = 0;
+ p = & (band [first]);
+ q = & (band [first + 1]);
+
+ p -> top_score = q -> top_score + first_score;
+ p -> diag_score = p -> left_score = NEG_INFTY_SCORE;
+ p -> top_errors = q -> top_errors + first_error;
+ p -> diag_errors = p -> left_errors = 0;
+ }
+ else
+ {
+ first = 0;
+ c = left_col + 1;
+ save = band [first];
+ p = & (band [first]);
+ q = & (band [first + 1]);
+
+ q -> Get_Max_Top (mxs, mxf, gap_score);
+ p -> top_score = mxs + indel_score;
+ p -> top_from = mxf;
+ p -> top_ref = q -> Get_Ref (mxf);
+ p -> top_errors = q -> Get_Errors (mxf) + 1;
+
+ save . Get_Max (mxs, mxf);
+ p -> diag_score = mxs
+ + ((ismatch(ch , s [left_col])) ? match_score : mismatch_score);
+ p -> diag_from = mxf;
+ p -> diag_ref = save . Get_Ref (mxf);
+ p -> diag_errors = save . Get_Errors (mxf);
+ if (ch != s [left_col])
+ p -> diag_errors ++;
+
+ p -> left_score = NEG_INFTY_SCORE;
+ p -> left_errors = 0;
+ p -> left_ref = 0;
+ }
+
+ // Do the remaining cells
+ if (right_col >= s_len)
+ last = s_len - left_col - 1;
+ else
+ last = right_col - left_col;
+ for (i = first + 1; i <= last; i ++, c++)
+ {
+ save = band [i];
+ p = & (band [i]);
+
+ if (i == last)
+ {
+ p -> top_score = NEG_INFTY_SCORE;
+ p -> top_ref = p -> top_errors = 0;
+ }
+ else
+ {
+ q = & (band [i + 1]);
+ q -> Get_Max_Top (mxs, mxf, gap_score);
+ p -> top_score = mxs + indel_score;
+ p -> top_from = mxf;
+ p -> top_ref = q -> Get_Ref (mxf);
+ p -> top_errors = q -> Get_Errors (mxf) + 1;
+ }
+
+ save . Get_Max (mxs, mxf);
+ p -> diag_score = mxs
+ + ((ismatch(ch , s [c])) ? match_score : mismatch_score);
+ p -> diag_from = mxf;
+ p -> diag_ref = save . Get_Ref (mxf);
+ p -> diag_errors = save . Get_Errors (mxf);
+ if (ch != s [c])
+ p -> diag_errors ++;
+
+ band [i - 1] . Get_Max_Left (mxs, mxf, gap_score);
+ p -> left_score = mxs + indel_score;
+ p -> left_from = mxf;
+ p -> left_ref = band [i - 1] . Get_Ref (mxf);
+ p -> left_errors = band [i - 1] . Get_Errors (mxf) + 1;
+ }
+
+ return;
+ }
+
+void setof(char a, char* set)
+ // assigns to set "set" the set of nucleotides represented by the ambiguity
+ // code of IUPAC character a
+{
+ switch (a) {
+ case 'a':
+ strcpy(set, "a");
+ break;
+ case 'c':
+ strcpy(set, "c");
+ break;
+ case 'g':
+ strcpy(set, "g");
+ break;
+ case 't':
+ strcpy(set, "t");
+ break;
+ case 'm':
+ strcpy(set, "ac");
+ break;
+ case 'r':
+ strcpy(set, "ag");
+ break;
+ case 'w':
+ strcpy(set, "at");
+ break;
+ case 's':
+ strcpy(set, "cg");
+ break;
+ case 'y':
+ strcpy(set, "ct");
+ break;
+ case 'k':
+ strcpy(set, "gt");
+ break;
+ case 'v':
+ strcpy(set, "acg");
+ break;
+ case 'h':
+ strcpy(set, "act");
+ break;
+ case 'd':
+ strcpy(set, "agt");
+ break;
+ case 'b':
+ strcpy(set, "cgt");
+ break;
+ } // switch(a)
+} // setof
+
+bool ismatch(char a, char b)
+ // returns true if IUPAC characters a and b are compatible: either the same
+ // or one represents a super-set of the other.
+ // returns false otherwise
+{
+ char polya[5], polyb[5]; // string representing the ambiguity of character
+ int nfound = 0;
+
+ if (a == 'n' || b == 'n')
+ return true; // n matches anything
+
+ if (a == b)
+ return true; // base always matches itself
+
+ setof(a, polya);
+ setof(b, polyb);
+
+ for (int i = 0; i < strlen(polya); i++)
+ for (int j = 0; j < strlen(polyb); j++)
+ if (polya[i] == polyb[j])
+ nfound++;
+
+ if (nfound == strlen(polya) || nfound == strlen(polyb))
+ return true; // all bases in shortest string also occur in the longer one
+
+ return false;
+} // ismatch
diff --git a/src/Align/align_poly.hh b/src/Align/align_poly.hh
new file mode 100644
index 0000000..8268d0a
--- /dev/null
+++ b/src/Align/align_poly.hh
@@ -0,0 +1,760 @@
+//
+// File: align_poly.hh
+//
+// Last Modified: 25 November 2002
+//
+// Routines to do string alignments.
+// The alphabet supported (acgtmrwsykvhdbn) includes all ambiguities.
+
+
+#ifndef __ALIGN_H_INCLUDED
+#define __ALIGN_H_INCLUDED
+
+
+#include "datatypes_AMOS.hh"
+#include "utility_AMOS.hh"
+#include "Contig_AMOS.hh"
+#include "delcher.hh"
+#include "fasta.hh"
+#include "prob.hh"
+#include "matrix.hh"
+#include "CelMsg.hh"
+#include "Slice.h"
+#include <iostream>
+#include <string>
+#include <vector>
+#include <functional>
+#include <algorithm>
+
+
+
+// Delta encoding shows the positions of the insertions and deletions
+// in the strings. If the encoding is from string A to string B
+// then minus values indicate an extra character in A and plus values
+// indicate an extra character in B . The absolute value is the
+// position of that extra character relative to the current positions.
+// E.g., for the alignment:
+// A: abcxxdefghi-jklmn
+// B: abc--dexghixjklmn
+// ^^ ^ ^
+// The delta encoding would be: -4, -1, +7
+
+typedef vector <int> Delta_Encoding_t;
+
+
+const char ALPHABET [] = "acgtmrwsykvhdbn";
+const int ALPHABET_SIZE = 15;
+const int MATCH_FROM_TOP = 0;
+const int MATCH_FROM_NW = 1;
+const int MATCH_FROM_NE = -1;
+const int MATRIX_SIZE_LIMIT = 100000;
+ // Largest matrix that will be used for full alignment computations
+const int MAX_ALIGN_ATTEMPTS = 3;
+ // Number of times to try alignments, loosening constraints each time
+const int MAX_REFINEMENTS = 3;
+ // Number of times to refine an alignment
+const double BIN_CUTOFF_PROB = 1e-6;
+ // Probability cutoff for the binonial distribution
+const char MAX_QUALITY_CHAR = 60;
+
+
+const int NEG_INFTY_SCORE = ((1 << 29) - 1) * -1;
+const unsigned int FROM_LEFT = 0;
+const unsigned int FROM_DIAG = 1;
+const unsigned int FROM_TOP = 2;
+const unsigned int FROM_NOWHERE = 3;
+
+
+// Flags for printing multialignments
+const unsigned int PRINT_WITH_DIFFS = 1;
+ // if set true then print ^'s under consensus where not unanimous
+const unsigned int PRINT_USING_STRING_SUB = 1 << 1;
+ // if set true then use string_sub value to get component string
+const unsigned int PRINT_CONSENSUS_GAP_COORDS = 1 << 2;
+ // if set true then print consensus range values counting gap positions
+
+
+// Results for checking/fixing starts of alignments
+enum Fix_Status_t
+ {NO_FIX_NEEDED, NEEDS_LEFT_SHIFT, SHIFTED_RIGHT};
+
+
+// Defaults values for alignment score parameters
+const int DEFAULT_MATCH_SCORE = 1;
+ // Score for matching characters
+const int DEFAULT_MISMATCH_SCORE = -3;
+ // Score for substitution error
+const int DEFAULT_INDEL_SCORE = -3;
+ // Score for insertion or deletion
+const int DEFAULT_GAP_SCORE = -1;
+ // Extra penalty for first insertion/deletion in a run
+
+
+class Align_Score_Entry_t
+ {
+ public:
+ int diag_score : 30; // score where last move is match/mismatch
+ unsigned int diag_from : 2;
+ int top_score : 30; // score where last move is from preceding row
+ unsigned int top_from : 2;
+ int left_score : 30; // score where last move is from preceding column
+ unsigned int left_from : 2;
+
+ void Dump
+ (FILE * fp) const;
+ void Get_Max
+ (int & max_score, unsigned int & max_from) const;
+ void Get_Max_Left
+ (int & max_score, unsigned int & max_from, int penalty) const;
+ void Get_Max_Top
+ (int & max_score, unsigned int & max_from, int penalty) const;
+ };
+
+
+class Augmented_Score_Entry_t : public Align_Score_Entry_t
+ {
+ public:
+ int top_ref;
+ int diag_ref;
+ int left_ref;
+ // subscript where best alignment to here began in a designated prior row
+
+ void Dump
+ (FILE * fp) const;
+ int Get_Ref
+ (unsigned int & from) const;
+ };
+
+
+class Errors_Score_Entry_t : public Augmented_Score_Entry_t
+ {
+ public:
+ int top_errors;
+ int diag_errors;
+ int left_errors;
+ // number of errors to get to this entry in the respective direction
+
+ void Dump
+ (FILE * fp) const;
+ int Get_Errors
+ (unsigned int & from) const;
+ };
+
+
+class Phase_Entry_t
+ {
+ public:
+ int from, to; // entries connected
+ int same_ct, opposite_ct, weight;
+
+ void Print
+ (FILE * fp) const
+ {
+ fprintf (fp, "from = %d to = %d same = %d opp = %d wt = %d\n",
+ from, to, same_ct, opposite_ct, weight);
+ }
+
+ bool operator >
+ (const Phase_Entry_t & p) const
+ {
+ if (weight > p . weight)
+ return true;
+ if (weight == p . weight && same_ct > p . same_ct)
+ return true;
+ if (weight == p . weight && same_ct == p . same_ct
+ && abs (to - from) > abs (p . to - p . from))
+ return true;
+
+ return false;
+ }
+ };
+
+
+class Distinguishing_Column_t
+ {
+ public:
+ int lo, hi;
+ // indicate range of gapped consensus columns where there's a
+ // consistent significant difference
+ char hapa_ch, hapb_ch, phase_ch;
+ vector <int> hapa_sub, hapb_sub;
+
+ bool Intersects
+ (const Distinguishing_Column_t & d, Phase_Entry_t & p,
+ int & min);
+ void Print
+ (FILE * fp)
+ {
+ int i, na, nb;
+
+ na = hapa_sub . size ();
+ nb = hapb_sub . size ();
+ fprintf (fp, "lo/hi = %d/%d %c %2d %c %2d %c\n",
+ lo, hi, hapa_ch, na, hapb_ch, nb, phase_ch);
+ for (i = 0; i < na; i ++)
+ fprintf (fp, " %3d", hapa_sub [i]);
+ fputc ('\n', fp);
+ for (i = 0; i < nb; i ++)
+ fprintf (fp, " %3d", hapb_sub [i]);
+ fputc ('\n', fp);
+ }
+ };
+
+
+class Match_Extent_Entry_t
+ {
+ public:
+ int len : 30;
+ int from : 2;
+ };
+
+
+class Simple_Overlap_t
+ {
+ public:
+ int a_id, b_id;
+ int a_hang, b_hang;
+ int a_olap_len, b_olap_len;
+ int errors, score;
+ bool flipped;
+ // a is always forward. If b is forward flipped is false; otherwise,
+ // it's true
+ };
+
+
+class Vote_t
+ {
+ public:
+ int here [ALPHABET_SIZE + 1];
+ // votes at this position; letters followed by blank
+ int after [ALPHABET_SIZE + 1];
+ // votes for insertion after this position; letters followed by blank
+
+ void Incr_After
+ (char ch);
+ void Incr_Blank
+ (void);
+ void Incr_By
+ (char ch, bool with_blank);
+ char Max_After_Char
+ (void);
+ char Max_Here_Char
+ (void);
+ void Set_To
+ (char ch, bool with_blank);
+ void Set_Zero
+ (void);
+ };
+
+
+class Base_Alignment_t
+ {
+ public:
+ int a_lo, a_hi;
+ // matching region in string a in space-based coords
+ int b_lo, b_hi;
+ // matching region in string b in space-based coords
+ int errors;
+ // number of errors in the matching region
+ // currently this is ignored
+ int string_sub;
+ // subscript of string in accompanying array
+ unsigned flipped : 1;
+ // 0 if original a was same orientation as b; 1 otherwise
+ int a_len : 31;
+ // length of entire a string
+
+ Base_Alignment_t
+ () // default constructor
+ {
+ errors = string_sub = a_len = flipped = 0;
+ }
+ void Dump
+ (FILE * fp) const;
+ double Error_Rate
+ (void) const;
+ void Flip_AB
+ (void);
+ };
+
+
+class Gapped_Alignment_t;
+
+class Alignment_t : public Base_Alignment_t
+ {
+ friend class Gapped_Alignment_t;
+ private:
+ Delta_Encoding_t delta;
+ // indicates positions of inserts/deletes
+
+ public:
+ const Delta_Encoding_t & getDelta
+ (void) const
+ { return delta; }
+
+ void setDelta
+ (const Delta_Encoding_t & d)
+ { delta = d; }
+
+ int B_Position
+ (int a) const;
+ void Clear
+ (void);
+ void Combine
+ (const Alignment_t & a1, const Alignment_t & a2);
+ void Dump
+ (FILE * fp) const;
+ void Dump_Delta
+ (FILE * fp) const;
+ void Check_Fix_Start
+ (const char * s , int s_len, const char * t, int t_len,
+ Fix_Status_t & status);
+ void Fix_Start
+ (const char * s , int s_len, const char * t, int t_len,
+ Fix_Status_t & status);
+ void Flip_AB
+ (void);
+ void Incr_Votes
+ (vector <Vote_t> & vote, char * a);
+ void Offset_A
+ (int n);
+ void Print
+ (FILE * fp, const char * a, const char * b,
+ int width = DEFAULT_FASTA_WIDTH);
+ void Set_Empty_A
+ (int a_start, int b_start, int b_end);
+ void Set_Exact
+ (int a_start, int b_start, int len);
+ void Set_From_VS_Matrix
+ (Match_Extent_Entry_t * * t, int e, int col);
+ void Set_Inserts
+ (vector <short> & v) const;
+ void Set_To_Identity
+ (int len);
+ void Shift_First_Delta
+ (int offset);
+ };
+
+
+class Gapped_Alignment_t : public Base_Alignment_t
+ {
+ friend class Alignment_t;
+ protected:
+ vector <int> skip;
+ // indicates positions of inserts/deletes
+
+ public:
+ void setSkip
+ (const vector <int> & s)
+ { skip = s; }
+
+ void Clear
+ (void);
+ void Convert_From
+ (const Alignment_t & ali, vector <int> & tr);
+ void Convert_Skip_to_Del
+ (vector <int> & del);
+ void Dump
+ (FILE * fp) const;
+ void Dump_Skip
+ (FILE * fp) const;
+ void Flip
+ (int a_len, int b_len);
+ void Incr_Column_Chars
+ (Matrix <unsigned char> & count, const char * s);
+ char Get_Aligning_Char
+ (int b, char * s);
+ int Get_Skip
+ (int i) const;
+ void Make_Sub_Alignment
+ (Gapped_Alignment_t & sub_ali, int b1, int b2) const;
+ void Modify_For_B_Inserts
+ (const vector <int> & insert_sub);
+ void Pass_Through
+ (const Alignment_t & ali);
+ void Print_Subalignment_Line
+ (char * buff, int b1, int b2, char * s, int & a1, int & a2);
+ void Shift_Skip
+ (int offset);
+ };
+
+
+class Gapped_MA_Bead_t
+ {
+ public:
+ int a_pos, b_pos, skip_pos;
+ int skip_i;
+ char seq_ch, qual_ch;
+ const char * seq, * qual;
+ const Gapped_Alignment_t * ga;
+ bool active;
+
+ void Advance
+ (void);
+ };
+
+
+class Gapped_Multi_Alignment_t;
+
+class Multi_Alignment_t
+ {
+ friend class Gapped_Multi_Alignment_t;
+ private:
+ string id;
+ string consensus;
+ // consensus of each column of the multialignment
+ vector <Alignment_t> align;
+ // alignment of each string to the consensus
+
+ public:
+ const char * getID
+ (void)
+ // return the id string as a C string
+ { return id . c_str (); }
+
+ void setID
+ (const string & s)
+ { id = s; }
+
+ void Clear
+ (void);
+ int Estimate_Offset_Position
+ (int i, const vector <int> & offset);
+ void Print_Alignments_To_Consensus
+ (FILE * fp, vector <char *> s);
+ void Reset_From_Votes
+ (const vector <char *> & s,
+ int offset_delta, double error_rate,
+ vector <Vote_t> & vote, bool & changed);
+ void Set_Consensus
+ (char * s);
+ void Set_Initial_Consensus
+ (const vector <char *> & s, const vector <int> & offset,
+ int offset_delta, double error_rate, int min_overlap,
+ vector <Vote_t> & vote, vector <char *> * tag_list = NULL);
+ };
+
+
+
+class Gapped_Multi_Alignment_t
+ {
+ friend class Multi_Alignment_t;
+ private:
+ unsigned int print_flags;
+ string id;
+ string consensus;
+ // consensus of each column of the multialignment
+ string con_qual;
+ // quality value of each character of consensus
+ vector <Gapped_Alignment_t> align;
+ // alignment of each string to the consensus
+
+ public:
+ Gapped_Multi_Alignment_t
+ () // default constructor
+ { print_flags = 0; }
+
+ int getConsensusLen
+ (void) const
+ // return the length of the consensus string
+ { return consensus . length (); }
+ const char * getConsensusString
+ (void)
+ // return the consensus string as a C string
+ { return consensus . c_str (); }
+ const char * getQualityString
+ (void)
+ // return the quality string as a C string
+ { return con_qual . c_str (); }
+ const char * getID
+ (void)
+ // return the id string as a C string
+ { return id . c_str (); }
+
+ void setConsensusString
+ (const string & s)
+ { consensus = s; }
+ void setID
+ (const string & s)
+ { id = s; }
+ void setPrintFlag
+ (unsigned int f)
+ { print_flags |= f; }
+ void setQualityString
+ (const string & q)
+ { con_qual = q; }
+ void unsetPrintFlag
+ (unsigned int f)
+ { print_flags &= (~ f); }
+
+
+ void Add_Aligned_Seqs
+ (const Gapped_Multi_Alignment_t & m, const Alignment_t & ali,
+ int cons_lo, int cons_hi, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1 = NULL, vector <char *> * tg2 = NULL);
+ void Clear
+ (void);
+ void Clear_All_Print_Flags
+ (void)
+ { print_flags = 0; }
+ void Consensus_To_Lower
+ (void);
+ void Convert_Consensus
+ (const Multi_Alignment_t & ma, const vector <short> & v);
+ void Convert_From
+ (const Multi_Alignment_t & ma);
+ void Count_Column_Chars
+ (Matrix <unsigned char> & count,
+ const vector <char *> & sl);
+ void Dump_Aligns
+ (FILE * fp);
+ void Expand_Consensus
+ (const Alignment_t & ali);
+ void Extract_Gapped_Region
+ (int lo, int hi, string & s, int & gapped_lo, int & gapped_hi) const;
+ void Extract_IMP_Dels
+ (vector < vector <int> > & del_list);
+ void Full_Merge_Left
+ (const Gapped_Multi_Alignment_t & m, int adj_a_lo, int a_lo, int a_hi,
+ int b_lo, int b_hi, int & prefix_len_added, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1, vector <char *> * tg2);
+ void Full_Merge_Right
+ (const Gapped_Multi_Alignment_t & m, int a_lo,
+ int b_lo, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1 = NULL, vector <char *> * tg2 = NULL);
+ void Get_Distinguishing_Columns
+ (vector <Distinguishing_Column_t> & dc,
+ const vector <char *> & sl);
+ void Get_Element_Subs
+ (Distinguishing_Column_t & d, const vector <char *> & sl);
+ void Get_Partial_Ungapped_Consensus
+ (string & s, int lo, int hi) const;
+ void Get_Positions
+ (vector <AMOS::Range_t> & pos) const;
+ void Get_Ungapped_Consensus
+ (string & s);
+ void Haplo_Sep
+ (const vector <char *> & sl, vector <Distinguishing_Column_t> & dc,
+ vector <char *> * tg = NULL);
+ void Make_From_CCO_Msg
+ (const Celera_Message_t & msg, const vector <int> & slen);
+ void Make_Gapped_Ungapped_Lookup
+ (vector <int> & lookup);
+ void Merge
+ (const Gapped_Multi_Alignment_t & m);
+ void Output_Read_Positions
+ (FILE * fp, int id, const vector <char *> & tag, int orig_tag_ct,
+ int len, int offset = 0);
+ void Partial_Merge
+ (const Gapped_Multi_Alignment_t & m, int a_lo, int a_hi,
+ int b_lo, int b_hi, vector <char *> & sl1,
+ const vector <char *> & sl2, vector <int> & sl2_place,
+ vector <char *> * tg1 = NULL, vector <char *> * tg2 = NULL);
+ void Print
+ (FILE * fp, const vector <char *> & s, int width = DEFAULT_FASTA_WIDTH,
+ vector <char *> * tag = NULL);
+ void Print_Consensus
+ (char * buff, int b1, int b2);
+ void Print_Ungapped_Consensus
+ (FILE * fp, char * hdr, int width = DEFAULT_FASTA_WIDTH);
+ void Reverse_Complement
+ (vector <char *> & s);
+ void Set_Consensus_And_Qual
+ (const vector <char *> & s, const vector <char *> & q);
+ void Set_Flipped
+ (const vector <AMOS :: Range_t> & clr);
+ void Set_Phase
+ (vector <Distinguishing_Column_t> & dc);
+ void Set_String_Subs
+ (void);
+ void Shift_B_Right
+ (int offset);
+ void Show_Skips
+ (FILE * fp);
+ void Sort
+ (vector <char *> & s, vector <int> * ref = NULL,
+ vector <char *> * tag_list = NULL);
+ int Ungapped_Consensus_Len
+ (void) const;
+ void Make_AMOS_Contig(const vector <AMOS :: Range_t> & clr_list,
+ const vector <char *> & tag,
+ AMOS::Contig_t & out) const;
+ void TA_Print
+ (FILE * fp, const vector <char *> & s,
+ const vector <AMOS :: Range_t> & clr_list,
+ int width, const vector <char *> * tag, const string & id);
+ };
+
+
+
+void Align_Row_Update
+ (vector <Augmented_Score_Entry_t> & align_row, char ch, const char * s,
+ int s_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, int first_score);
+void Align_Row_Update_With_Errors
+ (vector <Errors_Score_Entry_t> & align_row, char ch, const char * s,
+ int s_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, int first_score, int first_error);
+void Banded_Overlap
+ (const char * s, int s_len, const char * t, int t_len,
+ int lo_offset, int hi_offset, Simple_Overlap_t & olap,
+ int match_score = DEFAULT_MATCH_SCORE,
+ int mismatch_score = DEFAULT_MISMATCH_SCORE,
+ int indel_score = DEFAULT_INDEL_SCORE,
+ int gap_score = DEFAULT_GAP_SCORE);
+void Best_Spanning_Tree
+ (int n, const vector <Phase_Entry_t> & edge_list,
+ vector <int> & tree_edge);
+void Classify_Reads
+ (const vector <Distinguishing_Column_t> & dc, int n,
+ vector <char> & side, vector <int> & segment);
+void Complete_Align
+ (const char * s, int s_lo, int s_hi, const char * t, int t_lo, int t_slip,
+ int t_hi, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Align_Score_Entry_t * first_entry,
+ Align_Score_Entry_t & last_entry, Alignment_t & align);
+void Complete_Align_Full_Matrix
+ (const char * s, int s_lo, int s_hi, const char * t, int t_lo, int t_slip,
+ int t_hi, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Align_Score_Entry_t * first_entry,
+ Align_Score_Entry_t & last_entry, Alignment_t & align);
+void Complete_Align_Save_Space
+ (const char * s, int s_lo, int s_hi, const char * t, int t_lo, int t_slip,
+ int t_hi, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Align_Score_Entry_t * first_entry,
+ Align_Score_Entry_t & last_entry, Alignment_t & align);
+int DNA_Char_To_Sub
+ (char ch);
+int Exact_Prefix_Match
+ (const char * s, const char * t, int max_len);
+int Gapped_Equivalent
+ (int pos, const string & s);
+void Global_Align
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align);
+void Incr_Opposite
+ (vector <Phase_Entry_t> & v, int from, int to);
+void Incr_Same
+ (vector <Phase_Entry_t> & v, int from, int to);
+bool Is_Distinguishing
+ (unsigned char ct [5], char & ch1, int & ch1_ct,
+ char & ch2, int & ch2_ct);
+int Match_Count
+ (const vector <int> & a, const vector <int> & b);
+void Multi_Align
+ (const string & id, vector <char *> & s, vector <int> & offset,
+ int offset_delta, double error_rate, int min_overlap,
+ Gapped_Multi_Alignment_t & ma, vector <int> * ref = NULL,
+ vector <char *> * tag_list = NULL);
+void Overlap_Align
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int t_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align);
+void Overlap_Align_Full_Matrix
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int t_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align);
+void Overlap_Align_Save_Space
+ (const char * s, int s_len, const char * t, int t_lo, int t_hi,
+ int t_len, int match_score, int mismatch_score, int indel_score,
+ int gap_score, Alignment_t & align);
+bool Overlap_Match_VS
+ (const char * s, int s_len, const char * t, int t_len,
+ int lo, int hi, int min_len, int max_errors,
+ Alignment_t & align);
+void Print_Align_Lines_Pair
+ (FILE * fp, const string & s, const string & t, int len,
+ const char * s_label, const char * t_label,
+ int s_lo, int s_hi, int t_lo, int t_hi);
+void Print_VS_Table
+ (FILE * fp, Match_Extent_Entry_t * * tab, int t_lo, int t_hi, int e,
+ int best_i, bool found);
+bool Range_Intersect
+ (int a_lo, int a_hi, int b_lo, int b_hi);
+void Simple_Overlap
+ (const char * s, int s_len, const char * t, int t_len,
+ Simple_Overlap_t & olap, int match_score = DEFAULT_MATCH_SCORE,
+ int mismatch_score = DEFAULT_MISMATCH_SCORE,
+ int indel_score = DEFAULT_INDEL_SCORE,
+ int gap_score = DEFAULT_GAP_SCORE);
+void Sort_Strings_And_Offsets
+ (vector <char *> & s, vector <int> & offset, vector <int> * ref = NULL,
+ vector <char *> * tag_list = NULL);
+bool Substring_Match_VS
+ (const char * s, int s_len, const char * t, int t_len,
+ int lo, int hi, int max_errors, Alignment_t & align);
+char Sub_To_DNA_Char
+ (int i);
+void Trace_Back_Align_Path
+ (const vector < vector <Align_Score_Entry_t> > & a, int & r, int & c,
+ int r_start, int c_start, vector <int> & delta, int & errors,
+ const char * s, const char * t);
+void Traverse
+ (int v, int par, vector < vector <Phase_Entry_t> > & tree,
+ vector <Distinguishing_Column_t> & dc, char ch, int & sum);
+int UF_Find
+ (int i, vector <int> & uf);
+int UF_Find_With_Parity
+ (int i, vector <int> & uf, int & parity);
+void UF_Union
+ (int i, int j, vector <int> & uf);
+int Ungapped_Positions
+ (const string & s, int lo, int hi);
+void Update_Banded_Row
+ (vector <Errors_Score_Entry_t> & band, char ch, const char * s,
+ int s_len, int left_col, int right_col, int match_score,
+ int mismatch_score, int indel_score, int gap_score, int first_score,
+ int first_error);
+bool ismatch(char a, char b);
+
+
+template <class DT>
+void Permute
+ (vector <DT> & v, const vector <int> & p)
+
+// Permute the entries in v according to the values in p .
+
+ {
+ int i, m, n;
+ DT save;
+
+ m = v . size ();
+ n = p . size ();
+ if (m != n)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Permute size mismatch. v.size = %d p.size = %d\n",
+ m, n);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ vector <bool> done (n, false);
+
+ for (i = 0; i < n; i ++)
+ if (p [i] != i && ! done [i])
+ {
+ int j, k;
+
+ save = v [i];
+
+ for (j = i; p [j] != i; j = k)
+ {
+ k = p [j];
+ v [j] = v [k];
+ done [j] = true;
+ }
+
+ v [j] = save;
+ done [j] = true;
+ }
+
+ return;
+ }
+
+
+
+#endif
diff --git a/src/Align/arrive.cc b/src/Align/arrive.cc
new file mode 100644
index 0000000..f61eb84
--- /dev/null
+++ b/src/Align/arrive.cc
@@ -0,0 +1,87 @@
+#include <cstdio>
+#include <cstdlib>
+#include <cmath>
+#include <vector>
+using namespace std;
+
+int Lo = 0;
+int Hi = 100;
+ // Range of entries to match with distribution;
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ vector <double> a, expect;
+ double sum = 0.0;
+ double x;
+ double genome, num_reads, error;
+ double best_error, best_genome, best_num_reads;
+ int i, ct;
+
+ if (argc == 3)
+ {
+ Lo = strtol (argv [1], NULL, 10);
+ Hi = strtol (argv [2], NULL, 10);
+ }
+ fprintf (stderr, "Using Lo = %d and Hi = %d\n", Lo, Hi);
+
+ while (scanf ("%d %d %lf", & i, & ct, & x) == 3)
+ {
+ a . push_back (double (ct));
+ sum += ct;
+ }
+
+ for (i = Lo; i <= Hi; i ++)
+ a [i] /= sum;
+
+ best_error = 1e9;
+ for (num_reads = 2.0 * sum; num_reads >= sum / 2.0; num_reads -= 500.0)
+ {
+// printf ("# reads = %.0f\n", num_reads);
+ for (genome = 10.0e6; genome <= 100.0e6; genome += 1.0e6)
+ {
+ double p, q, prev;
+
+ q = exp ((num_reads - 1.0) * log ((genome - 1.0) / genome));
+ p = 1 - q;
+
+ prev = p * pow (q, Lo);
+ error = 0.0;
+ for (i = Lo; i <= Hi; i ++)
+ {
+ error += fabs (prev - a [i]);
+ prev *= q;
+ }
+
+// printf ("G = %10.3e error = %9.4f\n", genome, error);
+ if (error < best_error)
+ {
+ best_error = error;
+ best_genome = genome;
+ best_num_reads = num_reads;
+ }
+ }
+ }
+
+ printf ("Bests: G = %10.3e N = %.0f error = %9.4f\n",
+ best_genome, best_num_reads, best_error);
+
+ {
+ double p, q, prev;
+
+ q = exp ((best_num_reads - 1.0) * log ((best_genome - 1.0) / best_genome));
+ p = 1 - q;
+
+ prev = p * pow (q, Lo);
+ for (i = Lo; i <= Hi; i ++)
+ {
+ printf ("%5d: %8.6f %8.6f %8.6f\n", i, a [i], prev, a [i] - prev);
+ prev *= q;
+ }
+ }
+
+
+ return 0;
+ }
diff --git a/src/Align/arrive2.cc b/src/Align/arrive2.cc
new file mode 100644
index 0000000..b6ff1c2
--- /dev/null
+++ b/src/Align/arrive2.cc
@@ -0,0 +1,697 @@
+#include <cstdio>
+#include <cstdlib>
+#include <cmath>
+#include <vector>
+#include <delcher.hh>
+using namespace std;
+
+const int DIST_MAX = 11;
+ // Number of counts to keep in a distribution. Values >= the
+ // max are lumped together in the last count
+const int WINDOW_SIZE = 50;
+
+
+static int Degree_Cutoff = 6;
+ // Only do counts of reads with <= this many right (3' end) overlaps
+static bool Ignore_Zeroes = false;
+ // If set true by the -z option, ignore reads with no overlaps at all
+static int Lo = 5;
+static int Hi = 104;
+ // Range of arrival positions to consider
+static FILE * Len_fp = NULL;
+ // File from which read lengths are read
+static bool Minimize_Max_Error = FALSE;
+ // If set true (by the -x option) then the max
+ // error between observed and estimated proportions
+ // will be used to fit distributions
+static bool Minimize_Squared_Error = FALSE;
+ // If set true (by the -s option) then the square
+ // of the error between observed and estimated proportions
+ // will be used to fit distributions
+static int Min_Read_Len = INT_MAX;
+ // Ignore reads shorter than this
+static int Max_Read_Len = 900;
+ // Ignore reads longer than this
+
+static double Lo_Genome_Len;
+static double Hi_Genome_Len;
+static double Genome_Len_Delta;
+ // Determine range of genome sizes to use for best-fit analysis
+ // Values come from command line
+
+
+static void Analyze
+ (int dist [], int lo, int hi, int n);
+static void Double_Fit
+ (int dist [], int lo, int hi, int n);
+static void Parse_Command_Line
+ (int argc, char * argv []);
+static void Usage
+ (const char * command);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ int num_buckets, num_dists;
+ int a, b, a_hang, b_hang;
+ int prev;
+ int num_reads, r_degr;
+ int total_olaps;
+ vector <int> read_len;
+ char ori;
+ double e1, e2;
+ int d, i, j, k;
+
+ Parse_Command_Line (argc, argv);
+
+ fprintf (stderr, "Using Lo = %d and Hi = %d\n", Lo, Hi);
+ fprintf (stderr, "Degree cutoff = %d\n", Degree_Cutoff);
+ if (Min_Read_Len < INT_MAX)
+ {
+ fprintf (stderr, "Ignoring lengths < %d\n", Min_Read_Len);
+ fprintf (stderr, "Degree cutoff applied to region %d .. %d\n",
+ Lo, Min_Read_Len);
+ }
+ fprintf (stderr, "Ignoring lengths > %d\n", Max_Read_Len);
+ if (Minimize_Squared_Error)
+ fprintf (stderr, "Minimizing sum of error^2 instead of sum of |error|\n");
+ else if (Minimize_Max_Error)
+ fprintf (stderr, "Minimizing max error instead of sum of |error|\n");
+ else
+ fprintf (stderr, "Minimizing sum of |error| instead of sum of error^2\n");
+ fprintf (stderr, "Using only reads with 3' overlaps degrees <= %d\n",
+ Degree_Cutoff);
+
+ if (Len_fp != NULL)
+ {
+ int expect = 1;
+ int iid, uid, c1, c2, len;
+
+ read_len . push_back (0);
+ // There is no read iid zero
+
+ while (fscanf (Len_fp, "%d %d %d %d %d",
+ & iid, & uid, & c1, & c2, & len) == 5)
+ {
+ if (iid != expect)
+ {
+ read_len . resize (iid);
+ for (i = expect; i < iid; i ++)
+ read_len [i] = 0;
+ }
+ read_len . push_back (len);
+ expect = iid + 1;
+ }
+ }
+
+ num_buckets = int (ceil ((1.0 + Hi - Lo) / WINDOW_SIZE));
+ num_dists = (num_buckets * (num_buckets + 1)) / 2;
+ fprintf (stderr, "num_buckets = %d num_dists = %d\n",
+ num_buckets, num_dists);
+
+ vector <int> bucket (num_buckets, 0);
+ vector <int *> dist (num_dists);
+ for (d = 0; d < num_dists; d ++)
+ dist [d] = (int *) Safe_calloc (1 + DIST_MAX, sizeof (int), __FILE__, __LINE__);
+
+ prev = 0;
+ num_reads = r_degr = total_olaps = 0;
+ while (scanf ("%d %d %c %d %d %lf %lf",
+ & a, & b, & ori, & a_hang, & b_hang, & e1, & e2) == 7)
+ {
+ if (a != prev)
+ {
+// if (prev != 0 && total_olaps <= Degree_Cutoff
+ if (prev != 0 && r_degr <= Degree_Cutoff
+ && (Len_fp == NULL
+ || (read_len [prev] >= Min_Read_Len
+ && read_len [prev] <= Max_Read_Len)))
+ {
+ d = 0;
+ for (k = 1; k <= num_buckets; k ++)
+ {
+ for (i = 0; i <= num_buckets - k; i ++)
+ {
+ int sum = 0;
+
+ for (j = i; j < i + k; j ++)
+ sum += bucket [j];
+
+ if (sum >= DIST_MAX)
+ sum = DIST_MAX;
+ dist [d ++] [sum] ++;
+ }
+ }
+ }
+ if (prev != 0)
+ num_reads ++;
+
+ // Increment the zero count of each distribution for the
+ // reads that had no overlaps at all;
+ if (! Ignore_Zeroes)
+ for (i = prev + 1; i < a; i ++)
+ {
+ for (d = 0; d < num_dists; d ++)
+ dist [d] [0] ++;
+ num_reads ++;
+ }
+
+ for (i = 0; i < num_buckets; i ++)
+ bucket [i] = 0;
+ prev = a;
+ r_degr = total_olaps = 0;
+ }
+
+ if (a_hang >= Lo)
+ {
+ i = (a_hang - Lo) / WINDOW_SIZE;
+ if (i < num_buckets)
+ bucket [i] ++;
+ if (a_hang < Min_Read_Len)
+ r_degr ++;
+ }
+ total_olaps ++;
+ }
+
+ // Handle the last one
+// if (total_olaps <= Degree_Cutoff
+ if (r_degr <= Degree_Cutoff
+ && (Len_fp == NULL
+ || (read_len [prev] > Min_Read_Len
+ && read_len [prev] <= Max_Read_Len)))
+ {
+ d = 0;
+ for (k = 1; k <= num_buckets; k ++)
+ {
+ for (i = 0; i <= num_buckets - k; i ++)
+ {
+ int sum = 0;
+
+ for (j = i; j < i + k; j ++)
+ sum += bucket [j];
+
+ if (sum >= DIST_MAX)
+ sum = DIST_MAX;
+ dist [d ++] [sum] ++;
+ }
+ }
+ }
+ num_reads ++;
+
+ // Print the distributions
+ printf ("num_reads = %d\n", num_reads);
+ d = 0;
+ for (k = 1; k <= num_buckets; k ++)
+ {
+ for (i = 0; i <= num_buckets - k; i ++)
+ {
+ a = Lo + i * WINDOW_SIZE;
+ b = Lo + (i + k) * WINDOW_SIZE - 1;
+
+ Analyze (dist [d], a, b, num_reads);
+ Double_Fit (dist [d], a, b, num_reads);
+
+ d ++;
+ }
+ }
+
+
+#if 0
+ best_error = 1e9;
+ for (num_reads = 2.0 * sum; num_reads >= sum / 2.0; num_reads -= 500.0)
+ {
+// printf ("# reads = %.0f\n", num_reads);
+ for (genome = 10.0e6; genome <= 100.0e6; genome += 1.0e6)
+ {
+ double p, q, prev;
+
+ q = exp ((num_reads - 1.0) * log ((genome - 1.0) / genome));
+ p = 1 - q;
+
+ prev = p * pow (q, Lo);
+ error = 0.0;
+ for (i = Lo; i <= Hi; i ++)
+ {
+ error += fabs (prev - a [i]);
+ prev *= q;
+ }
+
+// printf ("G = %10.3e error = %9.4f\n", genome, error);
+ if (error < best_error)
+ {
+ best_error = error;
+ best_genome = genome;
+ best_num_reads = num_reads;
+ }
+ }
+ }
+
+ printf ("Bests: G = %10.3e N = %.0f error = %9.6e\n",
+ best_genome, best_num_reads, best_error);
+
+ {
+ double p, q, prev;
+
+ q = exp ((best_num_reads - 1.0) * log ((best_genome - 1.0) / best_genome));
+ p = 1 - q;
+
+ prev = p * pow (q, Lo);
+ for (i = Lo; i <= Hi; i ++)
+ {
+ printf ("%5d: %8.6f %8.6f %8.6f\n", i, a [i], prev, a [i] - prev);
+ prev *= q;
+ }
+ }
+#endif
+
+ return 0;
+ }
+
+
+
+void Analyze
+ (int dist [], int lo, int hi, int n)
+
+// Analyze the distribution of counts in dist [0 .. DIST_MAX]
+// representing hits to the range of positions lo .. hi
+// n is the total number of reads that could have contributed
+// to the entries in dist [] .
+
+ {
+ double lambda, term;
+ double error, square_error, mx_error;
+ double genome_len;
+ double best_error, best_square_error, best_mx_error, best_genome_len;
+ double diff;
+ int num_contams, max_contams, best_contams;
+ int sum, new_sum;
+ int j;
+
+ printf ("\nRange %d .. %d:\n", lo, hi);
+
+ lambda = 0.0;
+ sum = 0;
+ for (j = 0; j <= DIST_MAX; j ++)
+ sum += dist [j];
+
+ for (j = 0; j < DIST_MAX; j ++)
+ lambda += j * double (dist [j]) / sum;
+
+ printf (" Hits --- Observed --- --- Expected ---\n");
+ term = exp (-1.0 * lambda);
+ error = square_error = mx_error = 0.0;
+ for (j = 0; j < DIST_MAX; j ++)
+ {
+ printf (" %3d: %8d %6.4f %8d %6.4f\n", j, dist [j],
+ (1.0 * dist [j]) / sum, int (term * sum + 0.5), term);
+ diff = fabs ((1.0 * dist [j]) / sum - term);
+ error += diff;
+ square_error += diff * diff;
+ mx_error = Max (mx_error, diff);
+ term *= lambda / (j + 1.0);
+ }
+
+ printf (">=%3d: %8d %6.4f %8d %6.4f\n", DIST_MAX, dist [DIST_MAX],
+ (1.0 * dist [DIST_MAX]) / sum, int (term * sum + 0.5), term);
+ diff = fabs ((1.0 * dist [DIST_MAX]) / sum - term);
+ error += diff;
+ square_error += diff * diff;
+ mx_error = Max (mx_error, diff);
+ printf ("Total: %8d\n", sum);
+ printf ("Lambda = %.4f\n", lambda);
+ printf ("Estimated genome length = %.0f\n", ((1 + hi - lo) * n) / lambda);
+ printf ("Error = %.6e Squared error = %.6e Max error = %.6e\n",
+ error, square_error, mx_error);
+
+ best_error = best_square_error = best_mx_error = DBL_MAX;
+ for (genome_len = Lo_Genome_Len; genome_len <= Hi_Genome_Len;
+ genome_len += Genome_Len_Delta)
+ {
+ bool update;
+
+ lambda = (n * (1 + hi - lo)) / genome_len;
+ term = exp (-1.0 * lambda);
+ error = square_error = mx_error = 0.0;
+ for (j = 0; j < DIST_MAX; j ++)
+ {
+ diff = fabs ((1.0 * dist [j]) / sum - term);
+ error += diff;
+ square_error += diff * diff;
+ mx_error = Max (mx_error, diff);
+ term *= lambda / (j + 1.0);
+ }
+
+ update = false;
+ if (Minimize_Squared_Error && square_error < best_square_error)
+ update = true;
+ else if (Minimize_Max_Error && mx_error < best_mx_error)
+ update = true;
+ else if (! Minimize_Squared_Error && ! Minimize_Max_Error
+ && error < best_error)
+ update = true;
+
+ if (update)
+ {
+ best_error = error;
+ best_square_error = square_error;
+ best_mx_error = mx_error;
+ best_genome_len = genome_len;
+ }
+ }
+
+ printf ("\n");
+ printf (" Hits --- Observed --- --- Best Fit ---\n");
+ lambda = (n * (1 + hi - lo)) / best_genome_len;
+ term = exp (-1.0 * lambda);
+ error = square_error = 0.0;
+ for (j = 0; j < DIST_MAX; j ++)
+ {
+ printf (" %3d: %8d %6.4f %8d %6.4f\n", j, dist [j],
+ (1.0 * dist [j]) / sum, int (term * sum + 0.5), term);
+ error += fabs ((1.0 * dist [j]) / sum - term);
+ square_error += pow ((1.0 * dist [j]) / sum - term, 2);
+ term *= lambda / (j + 1.0);
+ }
+ printf ("Total: %8d\n", sum);
+ printf ("Lambda = %.4f\n", lambda);
+ printf ("Best-fit genome length = %.0f\n", best_genome_len);
+ printf ("Error = %.6e Squared error = %.6e Max error = %.6e\n",
+ best_error, best_square_error, best_mx_error);
+
+
+ // Re-do calculation allowing various numbers of reads to be "contaminant",
+ // which reduces the number of zero-degree hits
+
+ max_contams = Min (80000, dist [0]);
+
+ best_error = best_square_error = DBL_MAX;
+ for (genome_len = Lo_Genome_Len; genome_len <= Hi_Genome_Len;
+ genome_len += Genome_Len_Delta)
+ for (num_contams = 0; num_contams <= max_contams; num_contams += 1000)
+ {
+ lambda = ((n - num_contams) * (1 + hi - lo)) / genome_len;
+ term = exp (-1.0 * lambda);
+ new_sum = sum - num_contams;
+ error = fabs ((1.0 * (dist [0] - num_contams)) / new_sum - term);
+ square_error = pow ((1.0 * (dist [0] - num_contams)) / new_sum - term, 2);
+
+ for (j = 1; j < DIST_MAX; j ++)
+ {
+ term *= lambda / j;
+ error += fabs ((1.0 * dist [j]) / new_sum - term);
+ square_error += pow ((1.0 * dist [j]) / new_sum - term, 2);
+ }
+
+ if (Minimize_Squared_Error && square_error < best_square_error
+ || ! Minimize_Squared_Error && error < best_error)
+ {
+ best_error = error;
+ best_square_error = square_error;
+ best_genome_len = genome_len;
+ best_contams = num_contams;
+ }
+ }
+
+ printf ("\n");
+ printf (" Assuming %d contaminant reads\n", best_contams);
+ printf (" Hits --- Observed --- --- Best Fit ---\n");
+ lambda = ((n - best_contams) * (1 + hi - lo)) / best_genome_len;
+ term = exp (-1.0 * lambda);
+ new_sum = sum - best_contams;
+
+ printf (" %3d: %8d %6.4f %8d %6.4f\n", 0, (dist [0] - best_contams),
+ (1.0 * (dist [0] - best_contams)) / new_sum,
+ int (term * new_sum + 0.5), term);
+ error = fabs ((1.0 * (dist [0] - num_contams)) / new_sum - term);
+ square_error = pow ((1.0 * (dist [0] - num_contams)) / new_sum - term, 2);
+
+ for (j = 1; j < DIST_MAX; j ++)
+ {
+ term *= lambda / j;
+ printf (" %3d: %8d %6.4f %8d %6.4f\n", j, dist [j],
+ (1.0 * dist [j]) / new_sum, int (term * new_sum + 0.5), term);
+
+ error += fabs ((1.0 * dist [j]) / new_sum - term);
+ square_error += pow ((1.0 * dist [j]) / new_sum - term, 2);
+ }
+ printf ("Total: %8d\n", new_sum);
+ printf ("Lambda = %.4f\n", lambda);
+ printf ("Best-fit genome length = %.0f\n", best_genome_len);
+ printf ("Error = %.6e Squared error = %.6e\n", best_error, best_square_error);
+
+ return;
+ }
+
+
+
+void Double_Fit
+ (int dist [], int lo, int hi, int n)
+
+// Fit the distribution of counts in dist [0 .. DIST_MAX]
+// representing hits to the range of positions lo .. hi
+// n is the total number of reads that could have contributed
+// to the entries in dist [] . Assume hits could come from
+// a combination of single and two-copy elements in the genome
+
+ {
+ double lambda1, lambda2, term1, term2;
+ double error, square_error;
+ double genome_len;
+ double best_error, best_square_error, best_genome_len;
+ double dbl_copy_p, best_dcp;
+ vector <double> observe (DIST_MAX);
+ int sum;
+ int j;
+
+ printf ("*** Double Fit Analysis ***\n");
+ printf ("\nRange %d .. %d:\n", lo, hi);
+
+ sum = 0;
+ for (j = 0; j <= DIST_MAX; j ++)
+ sum += dist [j];
+
+ // Save observed distribution as proportions
+ for (j = 0; j < DIST_MAX; j ++)
+ observe [j] = (1.0 * dist [j]) / sum;
+
+ best_error = best_square_error = DBL_MAX;
+ for (genome_len = Lo_Genome_Len; genome_len <= Hi_Genome_Len;
+ genome_len += Genome_Len_Delta)
+ for (dbl_copy_p = 0.00; dbl_copy_p <= 0.80; dbl_copy_p += 0.01)
+ {
+ lambda1 = (n * (1 + hi - lo)) / genome_len;
+ lambda2 = 2.0 * lambda1;
+ term1 = exp (-1.0 * lambda1);
+ term2 = exp (-1.0 * lambda2);
+
+ error = square_error = 0.0;
+
+ for (j = 0; j < DIST_MAX; j ++)
+ {
+ double expect;
+
+ expect = (1.0 - dbl_copy_p) * term1 + dbl_copy_p * term2;
+ error += fabs (observe [j] - expect);
+ square_error += pow (observe [j] - expect, 2);
+ term1 *= lambda1 / (j + 1.0);
+ term2 *= lambda2 / (j + 1.0);
+ }
+
+ if (Minimize_Squared_Error ? (square_error < best_square_error)
+ : (error < best_error))
+ {
+ best_error = error;
+ best_square_error = square_error;
+ best_genome_len = genome_len;
+ best_dcp = dbl_copy_p;
+ }
+ }
+
+ printf ("\n");
+ printf (" Assuming %.0f%% 1-copy and %.0f%% 2-copy\n",
+ 100.0 * (1.0 - best_dcp), 100.0 * best_dcp);
+ printf (" Hits --- Observed --- --- One Copy --- --- Two Copy --- --- Combined ---\n");
+ lambda1 = (n * (1 + hi - lo)) / best_genome_len;
+ lambda2 = 2.0 * lambda1;
+ term1 = exp (-1.0 * lambda1);
+ term2 = exp (-1.0 * lambda2);
+
+ error = square_error = 0.0;
+
+ for (j = 0; j < DIST_MAX; j ++)
+ {
+ double e;
+
+ printf (" %3d: %8d %6.4f %8d %6.4f %8d %6.4f %8d %6.4f\n",
+ j, dist [j], observe [j],
+ int (term1 * sum * (1.0 - best_dcp) + 0.5), term1,
+ int (term2 * sum * best_dcp + 0.5), term2,
+ int (term1 * sum * (1.0 - best_dcp)
+ + term2 * sum * best_dcp + 0.5),
+ (1.0 - best_dcp) * term1 + best_dcp * term2);
+
+ e = fabs (observe [j] - ((1.0 - best_dcp) * term1 + best_dcp * term2));
+ error += e;
+ square_error += pow (e, 2);
+ term1 *= lambda1 / (j + 1.0);
+ term2 *= lambda2 / (j + 1.0);
+ }
+ printf ("Total: %8d\n", sum);
+ printf ("Lambda1 = %.4f Lambda2 = %.4f\n", lambda1, lambda2);
+ printf ("Best-fit genome length = %.0f\n", best_genome_len);
+ printf ("Error = %.6e Squared error = %.6e\n", best_error, best_square_error);
+
+ return;
+ }
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = false;
+ char * p;
+ int ch;
+
+ optarg = NULL;
+
+ while (! errflg && ((ch = getopt (argc, argv, "d:hL:m:r:sxz")) != EOF))
+ switch (ch)
+ {
+ case 'd' :
+ Degree_Cutoff = strtol (optarg, NULL, 10);
+ if (Degree_Cutoff < 0)
+ {
+ fprintf (stderr, "\nERROR: Bad degree cutoff value \"%s\"\n",
+ optarg);
+ errflg = true;
+ }
+ break;
+
+ case 'h' :
+ errflg = true;
+ break;
+
+ case 'L' :
+ Len_fp = File_Open (optarg, "r");
+ break;
+
+ case 'm' :
+ Min_Read_Len = strtol (optarg, NULL, 10);
+ if (Min_Read_Len < 0)
+ {
+ fprintf (stderr, "\nERROR: Bad minimum read len \"%s\"\n",
+ optarg);
+ errflg = true;
+ }
+ break;
+
+ case 'r' :
+ if (sscanf (optarg, "%d-%d", & Lo, & Hi) != 2
+ || Lo < 0 || Hi < Lo)
+ {
+ fprintf (stderr, "\nERROR: Bad window range \"%s\"\n",
+ optarg);
+ errflg = true;
+ }
+ break;
+
+ case 's' :
+ Minimize_Squared_Error = true;
+ break;
+
+ case 'x' :
+ Minimize_Max_Error = true;
+ break;
+
+ case 'z' :
+ Ignore_Zeroes = true;
+ break;
+
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+
+ default :
+ errflg = true;
+ }
+
+ if (errflg || optind != argc - 3)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ Lo_Genome_Len = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad low genome length value \"%s\"\n",
+ argv [optind]);
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ optind ++;
+ Hi_Genome_Len = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad high genome length value \"%s\"\n",
+ argv [optind]);
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ optind ++;
+ Genome_Len_Delta = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad genome length delta value \"%s\"\n",
+ argv [optind]);
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "USAGE: %s <lo> <hi> <del>\n"
+ "\n"
+ "Read overlap information (from stdin in format produced\n"
+ "by dump-olaps program) and estimate genome length from it\n"
+ "based on arrivals in windows on reads. Do best-fit trying\n"
+ "genomes with lengths from <lo> to <hi> in increments of <del>\n"
+ "\n"
+ "Options:\n"
+ " -d <n> Ignore 3' overlap degrees > <n>\n"
+ " -h Print this usage message\n"
+ " -L <fn> Get read length info from file <fn>\n"
+ " -m <n> Ignore reads shorter than <n> bp\n"
+ " -r <m>-<n> Use windows in the range <m> .. <n> of reads\n"
+ " -s Fit by minimizing sum of squared errors instead of |error|\n"
+ " -x Fit by minimizing max |error| instead of sum of |error|\n"
+ " -z Ignore reads with no overlaps at all\n"
+ "\n",
+ command);
+
+ return;
+ }
+
+
+
diff --git a/src/Align/count-kmers.cc b/src/Align/count-kmers.cc
new file mode 100644
index 0000000..430ab8c
--- /dev/null
+++ b/src/Align/count-kmers.cc
@@ -0,0 +1,499 @@
+#include "foundation_AMOS.hh"
+#include "delcher.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+
+#include <string>
+#include <vector>
+using namespace std;
+using namespace HASHMAP;
+using namespace AMOS;
+
+int COUNT = 0;
+int LEN = 0;
+int BAD_CHAR = 0;
+
+int PRINT_SIMPLE = 0;
+int PRINT_STATS = 0;
+
+
+#undef BIGMER
+//#define BIGMER 1
+
+#ifdef BIGMER
+typedef vector<bool> Mer_t;
+typedef map<Mer_t, unsigned int> MerTable_t;
+#else
+typedef long long unsigned Mer_t;
+typedef hash_map<Mer_t, unsigned int, hash<unsigned long> > MerTable_t;
+#endif
+
+static Mer_t Forward_Mask;
+static int Kmer_Len = 22;
+
+static unsigned Char_To_Binary (char ch);
+static void Forward_Add_Ch (Mer_t & mer, char ch);
+static void Reverse_Add_Ch (Mer_t & mer, char ch);
+static void MerToAscii(Mer_t mer, string & s);
+static void CountMers (const string & s, MerTable_t & mer_table);
+static void PrintMers(const MerTable_t & mer_table, int min_count);
+
+
+
+
+int main (int argc, char * argv [])
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ try
+ {
+ string version = "Version 1.0";
+ string helptext =
+"\n"
+".USAGE.\n"
+" count-kmers [-f fasta] [-r bnk] [-c bnk] [-n bnk]\n"
+"\n"
+".DESCRIPTION.\n"
+" Count kmers in a multifasta file or in read or contig banks.\n"
+" Output is to stdout in \"meryl-style\": >count\\nmer\\n\n"
+"\n.OPTIONS.\n"
+" -f <fasta> multifasta file to count\n"
+" -r <bnk> Bank of reads to count\n"
+" -c <bnk> Bank of contigs to count\n"
+" -n <bnk> Report normalized counts (readmercount/contigmercount)\n"
+" -k <len> Length of kmer \n"
+" -m <min> Minimum count to report (default: 1)\n"
+" -S Print using simple nmer count format: mer count\n"
+" -s Just print statistics on unique mers\n";
+"\n.KEYWORDS.\n"
+" kmers, fasta\n";
+
+ string fastafile;
+ string readbank;
+ string contigbank;
+ string normalizedbank;
+
+ int min_count = 1;
+
+ tf = new AMOS_Foundation(version, helptext, "", argc, argv);
+ tf->disableOptionHelp();
+ tf->getOptions()->addOptionResult("f=s", &fastafile);
+ tf->getOptions()->addOptionResult("r=s", &readbank);
+ tf->getOptions()->addOptionResult("c=s", &contigbank);
+ tf->getOptions()->addOptionResult("n=s", &normalizedbank);
+ tf->getOptions()->addOptionResult("k=i", &Kmer_Len);
+ tf->getOptions()->addOptionResult("m=i", &min_count);
+ tf->getOptions()->addOptionResult("S", &PRINT_SIMPLE);
+ tf->getOptions()->addOptionResult("s", &PRINT_STATS);
+
+ tf->handleStandardOptions();
+
+
+ if ((fastafile.empty() +
+ readbank.empty() +
+ contigbank.empty() +
+ normalizedbank.empty()) != 3)
+ {
+ cerr << "You must specify one input source" << endl;
+ exit(1);
+ }
+
+
+ #ifndef BIGMER
+ if (Kmer_Len > 31 || Kmer_Len < 1)
+ {
+ cerr << "Kmer length must be <= 31" << endl;
+ exit(1);
+ }
+ Forward_Mask = ((long long unsigned) 1 << (2 * Kmer_Len - 2)) - 1;
+ #endif
+
+ MerTable_t mer_table;
+
+ if (!fastafile.empty())
+ {
+ cerr << "Processing sequences in " << fastafile << "..." << endl;
+
+ FILE * fp = fopen(fastafile.c_str(), "r");
+
+ if (!fp)
+ {
+ cerr << "Couldn't open " << fastafile << endl;
+ exit(1);
+ }
+
+ string s, tag;
+
+ while (Fasta_Read (fp, s, tag))
+ {
+ CountMers(s, mer_table);
+ cerr << ".";
+ }
+ cerr << endl;
+ }
+ else if (!readbank.empty())
+ {
+ cerr << "Processing reads in " << readbank << "..." << endl;
+ BankStream_t bank(Read_t::NCODE);
+ bank.open(readbank, B_READ);
+
+ Read_t red;
+ while (bank >> red)
+ {
+ CountMers(red.getSeqString(red.getClearRange()), mer_table);
+ }
+ }
+ else if (!contigbank.empty())
+ {
+ cerr << "Processing contigs in " << contigbank << "..." << endl;
+ BankStream_t bank(Contig_t::NCODE);
+ bank.open(contigbank, B_READ);
+
+ Contig_t contig;
+ while (bank >> contig)
+ {
+ CountMers(contig.getUngappedSeqString(), mer_table);
+ }
+ }
+ else if (!normalizedbank.empty())
+ {
+ BankStream_t rbank(Read_t::NCODE);
+ rbank.open(normalizedbank, B_READ);
+
+ BankStream_t cbank(Contig_t::NCODE);
+ cbank.open(normalizedbank, B_READ);
+
+ cerr << "Processing reads in " << normalizedbank << "..." << endl;
+ Read_t red;
+ while (rbank >> red)
+ {
+ CountMers(red.getSeqString(red.getClearRange()), mer_table);
+ }
+
+
+ cerr << "Processing contigs in " << normalizedbank << "..." << endl;
+ MerTable_t consmers;
+ Contig_t contig;
+ while (cbank >> contig)
+ {
+ CountMers(contig.getUngappedSeqString(), consmers);
+ }
+
+
+ cerr << "Normalizing counts" << endl;
+ MerTable_t::iterator ri;
+ MerTable_t::iterator ci;
+
+ for (ri = mer_table.begin(); ri != mer_table.end(); ri++)
+ {
+ ci = consmers.find(ri->first);
+
+ if (ci != consmers.end())
+ {
+ ri->second /= ci->second;
+ }
+ else
+ {
+ ri->second = 0;
+ }
+ }
+ }
+
+ cerr << COUNT << " sequences processed, " << LEN << " bp scanned" << endl;
+
+ if (BAD_CHAR)
+ {
+ cerr << "WARNING: Input had " << BAD_CHAR << " non-DNA (ACGT) characters" << endl;
+ }
+
+ PrintMers(mer_table, min_count);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+ catch (...)
+ {
+ cerr << "uncaught exception\n";
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ return retval;
+}
+
+const char * bintoascii = "ACGT";
+
+
+
+
+// Return the binary equivalent of ch .
+static unsigned Char_To_Binary (char ch)
+{
+ switch (tolower (ch))
+ {
+ case 'a' : return 0;
+ case 'c' : return 1;
+ case 'g' : return 2;
+ case 't' : return 3;
+ default: BAD_CHAR++; return 0;
+ };
+
+ return 0;
+}
+
+
+char RC(char ch)
+{
+ switch(toupper(ch))
+ {
+ case 'A': return 'T';
+ case 'T': return 'A';
+ case 'C': return 'G';
+ case 'G': return 'C';
+
+ default: return 'T';
+ };
+
+ return 0;
+}
+
+char NORM(char ch)
+{
+ switch(toupper(ch))
+ {
+ case 'A': return 'A';
+ case 'C': return 'C';
+ case 'G': return 'G';
+ case 'T': return 'T';
+ default: return 'A';
+ };
+
+ return 0;
+}
+
+
+#ifdef BIGMER
+
+void InitMer(Mer_t & mer)
+{
+ mer.clear();
+ mer.resize(Kmer_Len*2);
+}
+
+static void MerToAscii(Mer_t mer, string & s)
+{
+ s.erase();
+ s.resize(Kmer_Len);
+
+ for (int i = 0; i < Kmer_Len; i++)
+ {
+ char m = 0;
+ m |= mer[i*2+1] << 1;
+ m |= mer[i*2];
+
+ s[Kmer_Len-i-1] = bintoascii[m];
+ }
+}
+
+// Add ch to mer on the right, sliding one character
+// off the left end of mer .
+static void Forward_Add_Ch(Mer_t & mer, char ch)
+{
+ // shift left
+ for (int i = Kmer_Len * 2-1; i > 1; i--)
+ {
+ mer[i] = mer[i-2];
+ }
+
+ // append to end
+ ch = Char_To_Binary(ch);
+ mer[1] = ch & 2;
+ mer[0] = ch & 1;
+}
+
+
+// Add the Watson-Crick complement of ch to mer on the left,
+// sliding one character off the right end of mer .
+static void Reverse_Add_Ch(Mer_t & mer, char ch)
+{
+ // shift right
+ for (int i = 0; i < Kmer_Len*2-2; i++)
+ {
+ mer[i] = mer[i+2];
+ }
+
+ // append to front
+ ch = 3^Char_To_Binary(ch);
+ mer[Kmer_Len*2-1] = ch&2;
+ mer[Kmer_Len*2-2] = ch&1;
+}
+
+
+#else
+
+void InitMer(Mer_t & mer)
+{
+ mer = 0;
+}
+
+static void MerToAscii(Mer_t mer, string & s)
+{
+ s.erase();
+ s.resize(Kmer_Len);
+
+ for (int i = 0; i < Kmer_Len; i++)
+ {
+ s[Kmer_Len-i-1] = bintoascii[mer & 0x3];
+ mer >>= 2;
+ }
+}
+
+// Add ch to mer on the right, sliding one character
+// off the left end of mer .
+static void Forward_Add_Ch(Mer_t & mer, char ch)
+{
+ mer &= Forward_Mask;
+ mer <<= 2;
+ mer |= Char_To_Binary (ch);
+}
+
+// Add the Watson-Crick complement of ch to mer on the left,
+// sliding one character off the right end of mer .
+static void Reverse_Add_Ch(Mer_t & mer, char ch)
+{
+ mer >>= 2;
+ mer |= ((long long unsigned) (3 ^ Char_To_Binary (ch)) << (2 * Kmer_Len - 2));
+}
+
+#endif
+
+
+static void CountMers (const string & s, MerTable_t & mer_table)
+{
+ Mer_t fwd_mer, rev_mer;
+ int i, j, n;
+
+ InitMer(fwd_mer);
+ InitMer(rev_mer);
+
+ n = s . length ();
+
+ COUNT++;
+ LEN+=n;
+
+ if (n < Kmer_Len) { return; }
+
+ for (i = 0; i < Kmer_Len - 1; i ++)
+ {
+ Forward_Add_Ch (fwd_mer, s [i]);
+ Reverse_Add_Ch (rev_mer, s [i]);
+ }
+
+ MerTable_t::iterator fi;
+
+ while (i < n)
+ {
+ Forward_Add_Ch (fwd_mer, s [i]);
+ Reverse_Add_Ch (rev_mer, s [i]);
+
+ string f,r;
+
+ MerToAscii(fwd_mer, f);
+ MerToAscii(rev_mer, r);
+
+ if (f < r)
+ {
+ fi = mer_table.find(fwd_mer);
+ if (fi == mer_table.end()) { fi=mer_table.insert(make_pair(fwd_mer,0)).first; }
+ }
+ else
+ {
+ fi = mer_table.find(rev_mer);
+ if (fi == mer_table.end()) { fi=mer_table.insert(make_pair(rev_mer,0)).first; }
+ }
+
+ fi->second++;
+
+ i++;
+ }
+
+ return;
+}
+
+
+void PrintMers(const MerTable_t & mer_table, int min_count)
+{
+ if (PRINT_STATS)
+ {
+ long long unique = 0;
+
+ MerTable_t::const_iterator fi;
+ for (fi = mer_table.begin(); fi != mer_table.end(); fi++)
+ {
+ if (fi->second == 1)
+ {
+ unique++;
+ }
+ }
+
+ cout << "n=" << COUNT
+ << " l=" << LEN
+ << " k=" << Kmer_Len
+ << " d=" << mer_table.size()
+ << " u=" << unique
+ << endl;
+ }
+ else
+ {
+ cerr << mer_table.size() << " total distinct mers" << endl;
+ string mer;
+ int printed = 0;
+ int skip = 0;
+
+ MerTable_t::const_iterator fi;
+ for (fi = mer_table.begin(); fi != mer_table.end(); fi++)
+ {
+ if (fi->second >= min_count)
+ {
+ MerToAscii(fi->first, mer);
+ if (PRINT_SIMPLE)
+ {
+ printf("%s\t%d\n", mer.c_str(), fi->second);
+ }
+ else
+ {
+ printf(">%d\n%s\n", fi->second, mer.c_str());
+ }
+ printed++;
+ }
+ else
+ {
+ skip++;
+ }
+ }
+
+ cerr << printed << " mers occur at least " << min_count << " times" << endl;
+ cerr << "Skipped " << skip << endl;
+ }
+}
+
diff --git a/src/Align/count-qmers.cc b/src/Align/count-qmers.cc
new file mode 100644
index 0000000..624f1cc
--- /dev/null
+++ b/src/Align/count-qmers.cc
@@ -0,0 +1,544 @@
+#include "foundation_AMOS.hh"
+#include "delcher.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+
+#include <string>
+#include <vector>
+using namespace std;
+using namespace HASHMAP;
+using namespace AMOS;
+
+extern char **environ;
+
+long long COUNT = 0;
+long long LEN = 0;
+int BAD_CHAR = 0;
+
+// always print as "mer count" rather than meryl format
+int PRINT_SIMPLE = 1;
+
+
+#undef BIGMER
+
+#ifdef BIGMER
+typedef vector<bool> Mer_t;
+typedef map<Mer_t, double> MerTable_t;
+#else
+typedef long long unsigned Mer_t;
+typedef hash_map<Mer_t, double, hash<unsigned long> > MerTable_t;
+#endif
+
+static Mer_t Forward_Mask;
+static int Kmer_Len = 22;
+
+// limit size
+static int bytes_per_kmer = 42;
+static float gb_limit = 0;
+
+static unsigned Char_To_Binary (char ch);
+static void Forward_Add_Ch (Mer_t & mer, char ch);
+static void Reverse_Add_Ch (Mer_t & mer, char ch);
+static void MerToAscii(Mer_t mer, string & s);
+static void CountMers (const string & s, const string & q, MerTable_t & mer_table);
+static void PrintMers(const MerTable_t & mer_table, int min_count);
+
+// mine
+static bool Fastq_Read(FILE * fp, string & s, string & hdr, string & q);
+
+
+int main (int argc, char * argv [])
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ try
+ {
+ string version = "Version 1.0";
+ string helptext =
+"\n"
+".USAGE.\n"
+" count-kmers-q [-f fasta] [-r bnk] [-c bnk] [-n bnk]\n"
+"\n"
+".DESCRIPTION.\n"
+" Count kmers in a fastq file or in read or contig banks.\n"
+" Output is to stdout in simple nmer count format: mer count\n"
+"\n.OPTIONS.\n"
+" -f <fastq> multifasta file to count\n"
+" -r <bnk> Bank of reads to count\n"
+" -c <bnk> Bank of contigs to count\n"
+" -n <bnk> Report normalized counts (readmercount/contigmercount)\n"
+" -k <len> Length of kmer \n"
+" -m <min> Minimum count to report (default: 1)\n"
+" -S Print using simple nmer count format: mer count\n"
+" -l <limit> Gigabyte limit on RAM. If limited, the output will contain redundancies\n"
+"\n.KEYWORDS.\n"
+" kmers, fasta\n";
+
+ string fastqfile = "-";
+ string readbank;
+ string contigbank;
+ string normalizedbank;
+
+ int min_count = 0;
+ int show_env = 0;
+
+ tf = new AMOS_Foundation(version, helptext, "", argc, argv);
+ tf->disableOptionHelp();
+ tf->getOptions()->addOptionResult("f=s", &fastqfile);
+ tf->getOptions()->addOptionResult("r=s", &readbank);
+ tf->getOptions()->addOptionResult("c=s", &contigbank);
+ tf->getOptions()->addOptionResult("n=s", &normalizedbank);
+ tf->getOptions()->addOptionResult("k=i", &Kmer_Len);
+ tf->getOptions()->addOptionResult("m=i", &min_count);
+ tf->getOptions()->addOptionResult("S", &PRINT_SIMPLE);
+ tf->getOptions()->addOptionResult("l=f", &gb_limit);
+ tf->getOptions()->addOptionResult("e", &show_env);
+
+ tf->handleStandardOptions();
+
+ /*
+ if ((fastafile.empty() +
+ readbank.empty() +
+ contigbank.empty() +
+ normalizedbank.empty()) != 3)
+ {
+ cerr << "You must specify one input source" << endl;
+ //exit(1);
+ }
+ */
+
+ if (show_env)
+ {
+ char **env;
+ for (env = environ; *env != NULL; ++env)
+ fprintf(stderr, "%s\n", *env);
+ }
+
+ #ifndef BIGMER
+ if (Kmer_Len > 31 || Kmer_Len < 1)
+ {
+ cerr << "Kmer length must be <= 31" << endl;
+ exit(1);
+ }
+ Forward_Mask = ((long long unsigned) 1 << (2 * Kmer_Len - 2)) - 1;
+ #endif
+
+ MerTable_t mer_table;
+
+ /*
+ if (!fastafile.empty())
+ {
+ cerr << "Processing sequences in " << fastafile << "..." << endl;
+
+ FILE * fp = fopen(fastafile.c_str(), "r");
+
+ if (!fp)
+ {
+ cerr << "Couldn't open " << fastafile << endl;
+ exit(1);
+ }
+
+ string s, tag;
+
+ while (Fasta_Read (fp, s, tag))
+ {
+ CountMers(s, mer_table);
+ //cerr << ".";
+ }
+ cerr << endl;
+ }
+ */
+
+ FILE * fp;
+ if(fastqfile == "-")
+ fp = stdin;
+ else {
+ fp = fopen(fastqfile.c_str(), "r");
+ if (!fp)
+ {
+ cerr << "Couldn't open " << fastqfile << endl;
+ exit(1);
+ }
+ }
+
+ cerr << "Processing sequences..." << endl;
+
+ string s, q, tag;
+ unsigned long mb_limit = (unsigned long)(1024.0*gb_limit);
+ unsigned long kmer_limit = mb_limit * 1048576UL / (unsigned long)bytes_per_kmer;
+
+ //while(Fasta_Read(stdin, s, tag))
+ while(Fastq_Read(fp, s, tag, q)) {
+ CountMers(s, q, mer_table);
+ if(gb_limit > 0 && mer_table.size() > kmer_limit) {
+ // print table
+ cerr << COUNT << " sequences processed, " << LEN << " bp scanned" << endl;
+ fprintf(stderr, "reporter:counter:asm,flush,1\n");
+ PrintMers(mer_table, min_count);
+ // clear table
+ mer_table.clear();
+ }
+ }
+
+ cerr << COUNT << " sequences processed, " << LEN << " bp scanned" << endl;
+ fprintf(stderr, "reporter:counter:asm,flush,1\n");
+
+ if (BAD_CHAR)
+ {
+ cerr << "WARNING: Input had " << BAD_CHAR << " non-DNA (ACGT) characters" << endl;
+ }
+
+ PrintMers(mer_table, min_count);
+
+ fprintf(stderr, "reporter:counter:asm,reads_total,%ld\n", COUNT);
+ fprintf(stderr, "reporter:counter:asm,reads_bp,%ld\n", LEN);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+ catch (...)
+ {
+ cerr << "uncaught exception\n";
+ fprintf(stderr, "reporter:counter:asm,error,1\n");
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ return retval;
+}
+
+const char * bintoascii = "ACGT";
+
+
+
+
+// Return the binary equivalent of ch .
+static unsigned Char_To_Binary (char ch)
+{
+ switch (tolower (ch))
+ {
+ case 'a' : return 0;
+ case 'c' : return 1;
+ case 'g' : return 2;
+ case 't' : return 3;
+ default: BAD_CHAR++; return 0;
+ };
+
+ return 0;
+}
+
+
+char RC(char ch)
+{
+ switch(toupper(ch))
+ {
+ case 'A': return 'T';
+ case 'T': return 'A';
+ case 'C': return 'G';
+ case 'G': return 'C';
+
+ default: return 'T';
+ };
+
+ return 0;
+}
+
+char NORM(char ch)
+{
+ switch(toupper(ch))
+ {
+ case 'A': return 'A';
+ case 'C': return 'C';
+ case 'G': return 'G';
+ case 'T': return 'T';
+ default: return 'A';
+ };
+
+ return 0;
+}
+
+
+#ifdef BIGMER
+
+void InitMer(Mer_t & mer)
+{
+ mer.clear();
+ mer.resize(Kmer_Len*2);
+}
+
+static void MerToAscii(Mer_t mer, string & s)
+{
+ s.erase();
+ s.resize(Kmer_Len);
+
+ for (int i = 0; i < Kmer_Len; i++)
+ {
+ char m = 0;
+ m |= mer[i*2+1] << 1;
+ m |= mer[i*2];
+
+ s[Kmer_Len-i-1] = bintoascii[m];
+ }
+}
+
+// Add ch to mer on the right, sliding one character
+// off the left end of mer .
+static void Forward_Add_Ch(Mer_t & mer, char ch)
+{
+ // shift left
+ for (int i = Kmer_Len * 2-1; i > 1; i--)
+ {
+ mer[i] = mer[i-2];
+ }
+
+ // append to end
+ ch = Char_To_Binary(ch);
+ mer[1] = ch & 2;
+ mer[0] = ch & 1;
+}
+
+
+// Add the Watson-Crick complement of ch to mer on the left,
+// sliding one character off the right end of mer .
+static void Reverse_Add_Ch(Mer_t & mer, char ch)
+{
+ // shift right
+ for (int i = 0; i < Kmer_Len*2-2; i++)
+ {
+ mer[i] = mer[i+2];
+ }
+
+ // append to front
+ ch = 3^Char_To_Binary(ch);
+ mer[Kmer_Len*2-1] = ch&2;
+ mer[Kmer_Len*2-2] = ch&1;
+}
+
+
+#else
+
+void InitMer(Mer_t & mer)
+{
+ mer = 0;
+}
+
+static void MerToAscii(Mer_t mer, string & s)
+{
+ s.erase();
+ s.resize(Kmer_Len);
+
+ for (int i = 0; i < Kmer_Len; i++)
+ {
+ s[Kmer_Len-i-1] = bintoascii[mer & 0x3];
+ mer >>= 2;
+ }
+}
+
+// Add ch to mer on the right, sliding one character
+// off the left end of mer .
+static void Forward_Add_Ch(Mer_t & mer, char ch)
+{
+ mer &= Forward_Mask;
+ mer <<= 2;
+ mer |= Char_To_Binary (ch);
+}
+
+// Add the Watson-Crick complement of ch to mer on the left,
+// sliding one character off the right end of mer .
+static void Reverse_Add_Ch(Mer_t & mer, char ch)
+{
+ mer >>= 2;
+ mer |= ((long long unsigned) (3 ^ Char_To_Binary (ch)) << (2 * Kmer_Len - 2));
+}
+
+#endif
+
+
+////////////////////////////////////////////////////////////
+// CountMers
+//
+// I edited this function to detect non ACGT's and ignore
+// the Kmer_Len affected kmers.
+////////////////////////////////////////////////////////////
+static void CountMers (const string & s, const string & q, MerTable_t & mer_table)
+{
+ Mer_t fwd_mer, rev_mer;
+ int i, j, n;
+ int non_acgt_buffer = 0;
+
+ // convert quality values
+ vector<double> quals;
+ double quality = 1.0;
+ for(i = 0; i < q.size(); i++)
+ quals.push_back(max(.25, 1.0-pow(10.0,-(q[i]-33)/10.0)));
+ //quals.push_back(max(.25, 1.0-pow(10.0,-(q[i]-64)/10.0)));
+
+ InitMer(fwd_mer);
+ InitMer(rev_mer);
+
+ n = s . length ();
+
+ COUNT++;
+ LEN+=n;
+
+ if (n < Kmer_Len) { return; }
+
+ for (i = 0; i < Kmer_Len - 1; i ++)
+ {
+ Forward_Add_Ch (fwd_mer, s [i]);
+ Reverse_Add_Ch (rev_mer, s [i]);
+
+ quality *= quals[i];
+
+ if(strchr(bintoascii, s[i]) == NULL)
+ non_acgt_buffer = Kmer_Len;
+ else if(non_acgt_buffer > 0)
+ non_acgt_buffer--;
+ }
+
+ MerTable_t::iterator fi;
+
+ while (i < n)
+ {
+ Forward_Add_Ch (fwd_mer, s [i]);
+ Reverse_Add_Ch (rev_mer, s [i]);
+
+ if(i == Kmer_Len-1)
+ quality *= quals[i];
+ else
+ quality *= (quals[i] / quals[i - Kmer_Len]);
+
+ if(strchr(bintoascii, s[i]) == NULL)
+ non_acgt_buffer = Kmer_Len;
+ else if(non_acgt_buffer > 0)
+ non_acgt_buffer--;
+
+ if(non_acgt_buffer == 0) {
+ string f,r;
+
+ MerToAscii(fwd_mer, f);
+ MerToAscii(rev_mer, r);
+
+ if (f < r)
+ {
+ fi = mer_table.find(fwd_mer);
+ if (fi == mer_table.end()) { fi=mer_table.insert(make_pair(fwd_mer,0)).first; }
+ }
+ else
+ {
+ fi = mer_table.find(rev_mer);
+ if (fi == mer_table.end()) { fi=mer_table.insert(make_pair(rev_mer,0)).first; }
+ }
+
+ fi->second += quality;
+ }
+
+ i++;
+ }
+
+ return;
+}
+
+
+void PrintMers(const MerTable_t & mer_table, int min_count)
+{
+ cerr << mer_table.size() << " total distinct mers" << endl;
+ string mer;
+ int printed = 0;
+ int skip = 0;
+
+ MerTable_t::const_iterator fi;
+ for (fi = mer_table.begin(); fi != mer_table.end(); fi++)
+ {
+ if (fi->second > min_count)
+ {
+ MerToAscii(fi->first, mer);
+ if (PRINT_SIMPLE)
+ {
+ printf("%s\t%f\n", mer.c_str(), fi->second);
+ }
+ else
+ {
+ printf(">%f\n%s\n", fi->second, mer.c_str());
+ }
+ printed++;
+ }
+ else
+ {
+ skip++;
+ }
+ }
+
+ cerr << printed << " mers occur at least " << min_count << " times" << endl;
+ cerr << "Skipped " << skip << endl;
+}
+
+bool Fastq_Read(FILE * fp, string & s, string & hdr, string & q)
+{
+ int ch;
+
+ s.erase();
+ hdr.erase();
+ q.erase();
+
+ // skip till next '@' if necessary
+ while ((ch = fgetc (fp)) != EOF && ch != '@')
+ ;
+
+ if(ch == EOF)
+ return false;
+
+ // skip spaces if any
+ while ((ch = fgetc (fp)) != EOF && ch == ' ')
+ ;
+ if (ch == EOF)
+ return false;
+ ungetc (ch, fp);
+
+ // put rest of line into hdr
+ while ((ch = fgetc (fp)) != EOF && ch != '\n')
+ hdr . push_back (char (ch));
+
+ // put everything up till next '\n' into s
+ while ((ch = fgetc (fp)) != EOF && ch != '\n')
+ {
+ if (! isspace (ch))
+ s . push_back (char (ch));
+ }
+
+ // skep next line
+ while ((ch = fgetc (fp)) != EOF && ch != '\n')
+ ;
+
+ // put everything up till next '\n' into q
+ while ((ch = fgetc (fp)) != EOF && ch != '\n')
+ {
+ if (! isspace (ch))
+ q . push_back (char (ch));
+ }
+
+ if (ch == '@')
+ ungetc (ch, fp);
+
+ return true;
+}
diff --git a/src/Align/find-tandem.cc b/src/Align/find-tandem.cc
new file mode 100644
index 0000000..ddf1cab
--- /dev/null
+++ b/src/Align/find-tandem.cc
@@ -0,0 +1,310 @@
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <vector>
+#include <ctime>
+#include <sys/time.h>
+using namespace std;
+
+const int OFFSET_TABLE_SIZE = 100;
+
+string FASTA_FILE;
+
+int MIN_REPORT_LEN = 8;
+int MIN_REPORT_UNITS = 3;
+int MIN_UNIT_LEN = 1;
+int MAX_UNIT_LEN = 4;
+int FLANK = 10;
+
+// Record length of event in seconds
+class EventTime_t
+{
+public:
+
+ EventTime_t()
+ {
+ start();
+ memset(&m_end, 0, sizeof(struct timeval));
+ }
+
+ void start()
+ {
+ gettimeofday(&m_start, NULL);
+ }
+
+ void end()
+ {
+ gettimeofday(&m_end, NULL);
+ }
+
+ double length()
+ {
+ if ((m_end.tv_sec == 0) && (m_end.tv_usec == 0)) { end(); }
+ return ((m_end.tv_sec - m_start.tv_sec)*1000000.0 + (m_end.tv_usec - m_start.tv_usec)) / 1e6;
+ }
+
+ string str(bool format, int precision)
+ {
+ double r = length();
+
+ char buffer[1024];
+ sprintf(buffer, "%0.*f", precision, r);
+
+ if (format)
+ {
+ string s("[");
+ s += buffer;
+ s += "s]";
+ return s;
+ }
+
+ return buffer;
+ }
+
+
+private:
+ struct timeval m_start;
+ struct timeval m_end;
+};
+
+
+
+bool Fasta_Read (FILE * fp, string & s, string & hdr)
+
+// Read next fasta-format string from file fp (which must
+// already be open) into string s . Put the faster
+// header line (without the '>' and trailing spaces) into
+// string hdr . Return true if a string is successfully,
+// read; false, otherwise.
+
+ {
+ int ch;
+
+ s . erase ();
+ hdr . erase ();
+
+ // skip till next '>' if necessary
+ while ((ch = fgetc (fp)) != EOF && ch != '>')
+ ;
+
+ if (ch == EOF)
+ return false;
+
+ // skip spaces if any
+ while ((ch = fgetc (fp)) != EOF && ch == ' ')
+ ;
+ if (ch == EOF)
+ return false;
+ ungetc (ch, fp);
+
+ // put rest of line into hdr
+ while ((ch = fgetc (fp)) != EOF && ch != '\n')
+ hdr . push_back (char (ch));
+
+ // put everything up till next '>' into s
+ while ((ch = fgetc (fp)) != EOF && ch != '>')
+ {
+ if (! isspace (ch))
+ s . push_back (char (ch));
+ }
+
+ if (ch == '>')
+ ungetc (ch, fp);
+
+ return true;
+ }
+
+
+void findTandems(const string & seq, const string & tag)
+{
+ cout << ">" << tag << " len=" << seq.length() << endl;
+
+ int offsets[OFFSET_TABLE_SIZE][OFFSET_TABLE_SIZE];
+
+ // initialize the offsets
+ for (int merlen = 1; merlen <= MAX_UNIT_LEN; merlen++)
+ {
+ for (int phase = 0; phase < merlen; phase++)
+ {
+ offsets[merlen][phase] = phase;
+ }
+ }
+
+ // now scan the sequence, considering mers starting at position i
+ for (int i = 0; i < seq.length(); i++)
+ {
+
+ // consider all possible merlens from 1 to max
+ for (int merlen = 1; merlen <= MAX_UNIT_LEN; merlen++)
+ {
+ int phase = i % merlen;
+ int offset = offsets[merlen][phase];
+
+ // compare [i..i+merlen) to [offset..offset+merlen)
+ int j = 0;
+ while ((j < merlen) &&
+ (i+j < seq.length()) &&
+ (seq[i+j] == seq[offset+j]))
+ { j++; }
+
+ // is the end of the tandem?
+ if (j != merlen || (i+j+1 == seq.length()))
+ {
+ // am i the leftmost version of this tandem?
+ if (seq[offset-1] != seq[offset+merlen-1])
+ {
+ // is it long enough to report?
+ if (((i-offset)/merlen >= MIN_REPORT_UNITS) && (i - offset >= MIN_REPORT_LEN))
+ {
+ // is it primitive?
+ int ml = 1;
+
+ while (ml < merlen)
+ {
+ int units = (i-offset+j) / ml;
+
+ int allmatch = 1;
+ for (int index = 1; allmatch && (index < units); index++)
+ {
+ // compare the bases of the current unit to those of unit0
+ for (int m = 0; m < ml; m++)
+ {
+ if (seq[offset+m] != seq[offset+index*ml+m])
+ {
+ allmatch = 0;
+ break;
+ }
+ }
+ }
+
+ if (!allmatch) { ml++; }
+ else { break; }
+ }
+
+ // everything checks, now report it
+
+ if (ml == merlen)
+ {
+ // start end length
+ cout << offset+1 << "\t" << i+j << "\t" << i+j-offset << "\t";
+
+ // tandem seq
+ for (int z = 0; z < merlen; z++) { cout << seq[offset+z]; }
+
+ // complete units + remainder
+ cout << "\t" << (i - offset) / merlen << "+" << j << "\t";
+
+ // left flank - tandem - right flank
+ for (int z = offset-FLANK; z < offset; z++) { if (z >= 0) { cout << (char) tolower(seq[z]); } }
+ for (int z = offset; z < i+j; z++) { cout << seq[z]; }
+ for (int z = i+j; z < i+j+FLANK; z++) { if (z < seq.length()) { cout << (char) tolower(seq[z]); } }
+
+ cout << "\t" << phase;
+
+ cout << endl;
+ }
+ }
+ }
+
+ offsets[merlen][phase] = i;
+ }
+ }
+ }
+}
+
+
+int main (int argc, char * argv [])
+{
+
+stringstream helptext;
+helptext <<
+"Find tandem repeats\n"
+"\n"
+" Usage: find-tandems -f fasta\n"
+"\n"
+" -f <fasta> multifasta file to scan\n"
+" -u <units> minimum number of units to report (default: " << MIN_REPORT_UNITS << ")\n"
+" -l <bp> minimum length of tandem in bp (default: " << MIN_REPORT_LEN << ")\n"
+" -x <len> max unit length (default: " << MAX_UNIT_LEN << ")\n"
+" -m <len> min unit length (default: " << MIN_UNIT_LEN << ")\n"
+" -k <bp> flanking bp to report (default: " << FLANK << ")\n"
+"\n"
+" Output format:\n"
+">fasta header\n"
+"start end total_len tandem_unit complete_units+partial left_flank+repeat+right_flank\n"
+"\n";
+
+ bool errflg = false;
+ int ch;
+
+ optarg = NULL;
+
+ while (!errflg && ((ch = getopt (argc, argv, "f:u:l:x:m:k:h")) != EOF))
+ {
+ switch (ch)
+ {
+
+ case 'f': FASTA_FILE = optarg; break;
+ case 'u': MIN_REPORT_UNITS = atoi(optarg); break;
+ case 'l': MIN_REPORT_LEN = atoi(optarg); break;
+ case 'x': MAX_UNIT_LEN = atoi(optarg); break;
+ case 'm': MIN_UNIT_LEN = atoi(optarg); break;
+ case 'k': FLANK = atoi(optarg); break;
+
+ case '?':
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+
+ case 'h':
+
+ default:
+ errflg = true;
+ }
+
+ if (errflg)
+ {
+ cout << helptext.str();
+ exit (EXIT_FAILURE);
+ }
+ }
+
+ if (FASTA_FILE.empty())
+ {
+ cerr << "You must specify a fasta file" << endl;
+ return 1;
+ }
+
+ if (MAX_UNIT_LEN >= OFFSET_TABLE_SIZE)
+ {
+ cerr << "Max unit size must be less than " << OFFSET_TABLE_SIZE << endl;
+ return 1;
+ }
+
+ cerr << "Processing sequences in " << FASTA_FILE << "..." << endl;
+
+ FILE * fp = fopen(FASTA_FILE.c_str(), "r");
+
+ if (!fp)
+ {
+ cerr << "Couldn't open " << FASTA_FILE << endl;
+ exit(1);
+ }
+
+ EventTime_t timer;
+
+ string s, tag;
+
+ while (Fasta_Read (fp, s, tag))
+ {
+ findTandems(s, tag);
+ }
+
+ cerr << "finished in " << timer.length() << "s" << endl;
+
+ return 0;
+}
+
+
+
diff --git a/src/Align/frg-umd-merge.cc b/src/Align/frg-umd-merge.cc
new file mode 100644
index 0000000..e4bc0f9
--- /dev/null
+++ b/src/Align/frg-umd-merge.cc
@@ -0,0 +1,256 @@
+// A. L. Delcher
+//
+// File: frg-umd-merge.cc
+//
+// Last Modified: 17 July 2003
+//
+// Read a Celera-format .frg file and corresponding sequence and
+// quality files from the UMd overlap and output a Celera-format
+// .frg file with the sequence and quality set to the UMd values.
+
+
+#include "CelMsg.hh"
+#include "delcher.hh"
+#include "fasta.hh"
+#include <vector>
+#include <string>
+#include <algorithm>
+
+
+using namespace std;
+using namespace AMOS;
+
+
+const int MAX_LINE = 1000;
+const int NEW_SIZE = 1000;
+
+
+static char * Frg_File_Name;
+ // Name of input .frg file
+static char * Qual_File_Name;
+ // Name of input UMd quality file
+static char * Seq_File_Name;
+ // Name of input UMd sequence file
+static int Seqname_Match = 0;
+ // Determines which field on fasta header line must
+ // match seqname in src field of frg message
+
+
+static void Parse_Command_Line
+ (int argc, char * argv []);
+static void Usage
+ (const char * command);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ Celera_Message_t msg;
+ FILE * frg_fp, * seq_fp, * qual_fp;
+ string new_seq, new_qual;
+ string seq_hdr, qual_hdr;
+ string frg_comment;
+ char seq_id [MAX_LINE], qual_id [MAX_LINE];
+ char * p, * p1, * q1, * p2, * q2;
+ time_t now;
+
+ try
+ {
+ now = time (NULL);
+ cerr << "Starting on " << ctime (& now) << endl;
+
+ Verbose = 1;
+
+ Parse_Command_Line (argc, argv);
+
+ frg_fp = File_Open (Frg_File_Name, "r");
+ seq_fp = File_Open (Seq_File_Name, "r");
+ qual_fp = File_Open (Qual_File_Name, "r");
+
+ while (msg . read (frg_fp))
+ {
+ if (msg . getMsgType () != FRG_MSG)
+ msg . print (stdout);
+ else
+ {
+ int s_len, q_len;
+ int i;
+ bool success;
+
+ frg_comment = msg . getSource ();
+
+ success = Fasta_Read (seq_fp, new_seq, seq_hdr);
+ if (! success)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "Could not read UMd sequence for frg %s",
+ msg . getAccession () . c_str ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+ Fasta_Qual_Read (qual_fp, new_qual, qual_hdr);
+ if (! success)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "Could not read UMd quality for frg %s",
+ msg . getAccession () . c_str ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+ strcpy (seq_id, seq_hdr . c_str ());
+ strcpy (qual_id, qual_hdr . c_str ());
+ p1 = strtok (seq_id, " \t\n");
+ p2 = strtok (NULL, " \t\n");
+ q1 = strtok (qual_id, " \t\n");
+ q2 = strtok (NULL, " \t\n");
+ switch (Seqname_Match)
+ {
+ case 1 :
+ p = p1;
+ break;
+ case 2 :
+ p = p2;
+ break;
+ default :
+ p = "XXX";
+ }
+ if (strcmp (p1, q1) != 0
+ || (Seqname_Match > 0 && int (frg_comment . find (p)) < 0))
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "Tag mismatch: UMseq = %s UMqual = %s p = %s frg = %s",
+ p1, q1, p, frg_comment . c_str ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+ s_len = new_seq . length ();
+ q_len = new_qual . length ();
+ if (s_len != q_len)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "Seq len = %d != Qual len = %d for %s",
+ s_len, q_len, p);
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+ for (i = 0; i < q_len; i ++)
+ new_qual [i] = Min (new_qual [i], MAX_CELERA_QUALITY_CHAR);
+ msg . setSequence (new_seq);
+ msg . setQuality (new_qual);
+ msg . setClearRange (0, s_len);
+
+ msg . print (stdout);
+ }
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "** AMOS Exception **" << endl;
+ cerr << e << endl;
+ exit (EXIT_FAILURE);
+ }
+ catch (std :: exception & e)
+ {
+ cerr << "** Standard Exception **" << endl;
+ cerr << e << endl;
+ exit (EXIT_FAILURE);
+ }
+
+ return 0;
+ }
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = false, helpflg = false;
+ int ch;
+
+ optarg = NULL;
+
+ while (! errflg && ((ch = getopt (argc, argv, "012h")) != EOF))
+ switch (ch)
+ {
+ case '0' :
+ Seqname_Match = 0;
+ break;
+ case '1' :
+ Seqname_Match = 1;
+ break;
+ case '2' :
+ Seqname_Match = 2;
+ break;
+ case 'h' :
+ helpflg = true;
+ break;
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+ default :
+ errflg = true;
+ }
+
+ if (errflg)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (optind > argc - 3)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (helpflg)
+ {
+ Usage (argv [0]);
+ exit (EXIT_SUCCESS);
+ }
+
+ Frg_File_Name = argv [optind ++];
+ Seq_File_Name = argv [optind ++];
+ Qual_File_Name = argv [optind ++];
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "USAGE: %s [options] <frg-file> <umd-seq-file> <umd-qual-file>\n"
+ "\n"
+ "Read <frg-file> and replace sequences and qualities with\n"
+ "corresponding entries in <umd-seq-file> and <umd-qual-file>\n"
+ "Output revised .frg-file to stdout \n"
+ "\n"
+ "Options:\n"
+ " -0\n"
+ " -1\n"
+ " -2\n"
+ " Determines which field on fasta header line must\n"
+ " match the seqname in the src field of the frg file\n"
+ " -0 no match required (default)\n"
+ " -1 first field must match\n"
+ " -2 second field must match\n"
+ " -h\n"
+ " Print this usage message\n"
+ "\n",
+ command);
+
+ return;
+ }
+
+
+
diff --git a/src/Align/gap-links.cc b/src/Align/gap-links.cc
new file mode 100644
index 0000000..83a8afa
--- /dev/null
+++ b/src/Align/gap-links.cc
@@ -0,0 +1,114 @@
+// Read two files (named on command line): first is list of
+// contig pairs (presumably bounding a gap in a scaffold); second
+// is a sorted list of all contig links (in same order as .asm file).
+// For each pair in the first file, print the corresponding entries from
+// the second file. Output goes to stdout
+
+#include "delcher.hh"
+#include <vector>
+#include <algorithm>
+using namespace std;
+
+
+const int MAX_LINE = 1000;
+
+
+
+struct Link_t
+ {
+ int id1, id2;
+ char * line;
+ };
+
+
+static void Print_Matches
+ (int id1, int id2, const vector <Link_t> & link);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ FILE * fp;
+ vector <Link_t> link;
+ Link_t new_link;
+ char line [MAX_LINE];
+ int id1, id2;
+
+ fp = File_Open (argv [2], "r");
+
+ while (fgets (line, MAX_LINE, fp) != NULL)
+ {
+ sscanf (line, "%d %d", & new_link . id1, & new_link . id2);
+ new_link . line = strdup (line);
+ link . push_back (new_link);
+ }
+
+ fclose (fp);
+
+cerr << "num links = " << link . size () << endl;
+
+ fp = File_Open (argv [1], "r");
+ while (fgets (line, MAX_LINE, fp) != NULL)
+ {
+ fputs (line, stdout);
+ sscanf (line, "%d %d", & id1, & id2);
+ if (id1 < id2)
+ Print_Matches (id1, id2, link);
+ else
+ Print_Matches (id2, id1, link);
+ }
+
+
+ return 0;
+ }
+
+
+
+static void Print_Matches
+ (int id1, int id2, const vector <Link_t> & link)
+
+// Find entries in link that match id1 and id2 and
+// print their line strings to stdout
+
+ {
+ bool found = false;
+ int lo, hi, mid, n;
+
+ n = link . size ();
+
+ lo = 0; hi = n - 1;
+ while (lo <= hi && ! found)
+ {
+ mid = (lo + hi) / 2;
+ if (link [mid] . id1 == id1)
+ {
+ if (link [mid] . id2 == id2)
+ found = true;
+ else if (id2 < link [mid] . id2)
+ hi = mid - 1;
+ else
+ lo = mid + 1;
+ }
+ else if (id1 < link [mid] . id1)
+ hi = mid - 1;
+ else
+ lo = mid + 1;
+ }
+
+ if (found)
+ {
+ while (mid > 0 && link [mid - 1] . id1 == id1
+ && link [mid - 1] . id2 == id2)
+ mid --;
+ while (mid < n && link [mid] . id1 == id1
+ && link [mid] . id2 == id2)
+ fputs (link [mid ++] . line, stdout);
+ }
+
+ return;
+ }
+
+
+
diff --git a/src/Align/genome-complexity-fast.cc b/src/Align/genome-complexity-fast.cc
new file mode 100644
index 0000000..0bd7138
--- /dev/null
+++ b/src/Align/genome-complexity-fast.cc
@@ -0,0 +1,1144 @@
+#include "foundation_AMOS.hh"
+#include "delcher.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+
+#include <iostream>
+#include <string>
+#include <vector>
+using namespace std;
+using namespace HASHMAP;
+using namespace AMOS;
+
+using namespace std;
+
+// Store the (variable length) mer as a compressed bit vector
+typedef long long unsigned Mer_t;
+static Mer_t Forward_Mask;
+
+class MerVertex_t;
+typedef HASHMAP::hash_multimap<Mer_t, MerVertex_t *, hash<unsigned long> > MerTable_t;
+typedef list<MerVertex_t *> NodeTable_t;
+
+
+
+// Default length, can override at runtime
+int Kmer_Len = 30;
+int Seed_Len = 30;
+
+// Convert from bits to ascii via an array lookup
+const char * bintoascii = "ACGT";
+
+int OPT_DisplaySeq = 0;
+int OPT_DisplayStarts = 0;
+int OPT_SeqToDisplay = 8;
+int OPT_DisplayStats = 0;
+int OPT_JustCompress = 0;
+
+bool SortLens(const int & a, const int & b)
+{
+ return b < a;
+}
+
+// Return the binary equivalent of ch .
+static unsigned Char_To_Binary (char ch)
+{
+ switch (tolower (ch))
+ {
+ case 'a' : return 0;
+ case 'c' : return 1;
+ case 'g' : return 2;
+ case 't' : return 3;
+ default: return 0;
+ };
+
+ return 0;
+}
+
+// Initialize an empty mer
+void InitMer(Mer_t & mer)
+{
+ mer = 0;
+}
+
+// Add ch to mer on the right, sliding one character
+// off the left end of mer .
+static void Forward_Add_Ch(Mer_t & mer, char ch)
+{
+ mer &= Forward_Mask;
+ mer <<= 2;
+ mer |= Char_To_Binary (ch);
+}
+
+
+// Class for storing a mer and its neighbors
+class MerVertex_t
+{
+ static int NODECOUNT; // give all the nodes a unique id
+public:
+ MerVertex_t(int startpos, int endpos)
+ : startpos_m(startpos), endpos_m(endpos), node_m(NODECOUNT++), dead(false) {
+ starts_m.push_back(startpos);}
+ int startpos_m;
+ int endpos_m;
+ int node_m;
+ bool dead;
+
+ vector<MerVertex_t *> successor_m;
+ vector<MerVertex_t *> predecessor_m;
+ vector<int> starts_m;
+
+ void addStartPos(int pos)
+ {
+ starts_m.push_back(pos);
+ }
+
+ int len() const
+ {
+ return endpos_m-startpos_m+1;
+ }
+
+ // Can this node be compressed with its immediate neighbor
+ bool isCompressable()
+ {
+ if (successor_m.empty() || (successor_m[0] == this))
+ {
+ return false;
+ }
+
+ // Make sure all of the out-links point to the same node v
+ int ol = successor_m.size();
+ for (int i = 1; i < ol; i++)
+ {
+ if (successor_m[i] != successor_m[0])
+ {
+ return false;
+ }
+ }
+
+ // Make sure all of v's in-links are from me
+ int il = successor_m[0]->predecessor_m.size();
+
+ if (ol != il)
+ {
+ return false;
+ }
+
+ for (int i = 0; i < il; i++)
+ {
+ if (successor_m[0]->predecessor_m[i] != this)
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ // Actually collapse this node with its immediate neighbor
+ void collapse()
+ {
+ MerVertex_t * buddy = successor_m[0];
+ //cerr << "Collapse " << node_m << " and " << buddy->node_m << endl;
+ successor_m = buddy->successor_m;
+ buddy->dead = true;
+ endpos_m += buddy->len() - (Kmer_Len-2);
+
+ // Update the links so that the buddy's neighbors now point at me
+ for (int i = 0; i < successor_m.size(); i++)
+ {
+ MerVertex_t * bo = successor_m[i];
+
+ for (int j = 0; j < bo->predecessor_m.size(); j++)
+ {
+ if (bo->predecessor_m[j] == buddy)
+ {
+ bo->predecessor_m[j] = this;
+ break;
+ }
+ }
+ }
+
+ }
+
+ bool isTreeLeaf()
+ {
+ int il = predecessor_m.size();
+ int ol = successor_m.size();
+
+ if ((il != ol) || (il == 0)) { return false; }
+
+ // see if all of my in links are from the same node
+ for (int i = 1; i < il; i++)
+ {
+ if (predecessor_m[i] != predecessor_m[0]) { return false; }
+ }
+
+ // see if all of my out links are to the same node
+ for (int i = 0; i < ol; i++)
+ {
+ if (successor_m[i] != predecessor_m[0]) { return false; }
+ }
+
+ // now see if parent has just 1 extra in- and out- link
+ MerVertex_t * parent = successor_m[0];
+
+ if (parent->predecessor_m.size() != ol+1) { return false; }
+ if (parent->successor_m.size() != il+1) { return false; }
+
+ return true;
+ }
+
+ bool isSelfLeaf()
+ {
+ int ol = successor_m.size();
+ int il = predecessor_m.size();
+
+ if (ol != il) { return false; }
+
+ int self = 0;
+ for (int i = 0; i < il; i++)
+ {
+ if (successor_m[i] == this) { self++; }
+ }
+
+ if ((self > 0) && (self == il-1))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ void foldSelf()
+ {
+ int numcycles = successor_m.size()-1;
+
+ int mylen = len();
+ endpos_m += numcycles * (mylen - (Kmer_Len-2));
+
+ MerVertex_t * other = NULL;
+ int ol = successor_m.size();
+ int il = predecessor_m.size();
+
+ // keep just the non-self successor
+ for (int i = 0; i < ol; i++)
+ {
+ if (successor_m[i] != this)
+ { other = successor_m[i]; break; }
+ }
+
+ assert(other != NULL);
+
+ successor_m.clear();
+ successor_m.push_back(other);
+
+ // keep just the non-self predecessor
+ for (int i = 0; i < il; i++)
+ {
+ if (predecessor_m[i] != this)
+ { other = predecessor_m[i]; break; }
+ }
+
+ assert(other != NULL);
+
+ predecessor_m.clear();
+ predecessor_m.push_back(other);
+ }
+
+ // backward: multiple predecessors (predecessor_m), one successor(successor_m)
+ bool isBackwardDecisionNode()
+ {
+ int il = predecessor_m.size();
+ int ol = successor_m.size();
+ if ((ol != il) || (il < 2)) { return false; }
+
+ // check that all of the outlinks go to the same node (successor_m[0])
+ for (int i = 1; i < ol; i++)
+ {
+ if (successor_m[i] != successor_m[0]) { return false; }
+ }
+
+ // now check that there are > 1 predecessors
+ for (int i = 1; i < il; i++)
+ {
+ if (predecessor_m[i] != predecessor_m[0])
+ {
+ return true;
+ }
+ }
+
+ // nope, all of the in links are from same node
+ return false;
+ }
+
+ // forward: one predecessor (predecessor_m), multiple successors (successor_m)
+ bool isForwardDecisionNode()
+ {
+ int il = predecessor_m.size();
+ int ol = successor_m.size();
+ if ((ol != il) || (il < 2)) { return false; }
+
+ // check that all of the inlinks are from the same node (predecessor_m[0])
+ for (int i = 1; i < il; i++)
+ {
+ if (predecessor_m[i] != predecessor_m[0]) { return false; }
+ }
+
+ // now check that there are > 1 successors
+ for (int i = 1; i < ol; i++)
+ {
+ if (successor_m[i] != successor_m[0])
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ // There are multiple predecessors (predecessor_m), split this node for each
+ NodeTable_t splitBackwards()
+ {
+ NodeTable_t retval;
+
+ // count how many different predecessors I have
+ int il = predecessor_m.size();
+ int numpre = 1; //predecessor_m[0];
+ int pre[il];
+ pre[0] = 0;
+
+ for (int i = 1; i < il; i++)
+ {
+ bool seen = false;
+ for (int j = 0; j < i; j++)
+ {
+ if (predecessor_m[i] == predecessor_m[j])
+ {
+ seen = true;
+ pre[i] = pre[j];
+ break;
+ }
+ }
+
+ if (!seen)
+ {
+ pre[i] = numpre;
+ numpre++;
+ }
+ }
+
+ if (numpre > 1)
+ {
+ // mark me dead, I'm replaced by the other nodes
+ dead = true;
+
+ // the sole successor node
+ MerVertex_t * successor = successor_m[0];
+ int successorlinksfixed = 0;
+
+ for (int p = 0; p < numpre; p++)
+ {
+ MerVertex_t * nn = NULL;
+
+ for (int i = 0; i < il; i++)
+ {
+ if (pre[i] == p)
+ {
+ if (nn == NULL)
+ {
+ nn = new MerVertex_t(startpos_m, endpos_m);
+ retval.push_back(nn);
+
+ // update the links inside predecessor_m[i]
+ MerVertex_t * pred = predecessor_m[i];
+ int bol = pred->successor_m.size();
+ for (int b = 0; b < bol; b++)
+ {
+ if (pred->successor_m[b] == this)
+ {
+ pred->successor_m[b] = nn;
+ }
+ }
+ }
+
+ nn->predecessor_m.push_back(predecessor_m[i]);
+ nn->successor_m.push_back(successor);
+ }
+ }
+
+ // update successors's out-links
+ int nl = nn->successor_m.size();
+ int succpred = successor->predecessor_m.size();
+ for (int k = 0; k < nl; k++)
+ {
+ for (int j = 0; j < succpred; j++)
+ {
+ if (successor->predecessor_m[j] == this)
+ {
+ successor->predecessor_m[j] = nn;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return retval;
+ }
+
+ // There are multiple successors, split this node for each
+ NodeTable_t splitForwards()
+ {
+ NodeTable_t retval;
+
+ // count how many different successors I have
+ int ol = successor_m.size();
+ int numsuc = 1; //successor_m[0];
+ int suc[ol];
+ suc[0] = 0;
+
+ for (int i = 1; i < ol; i++)
+ {
+ bool seen = false;
+ for (int j = 0; j < i; j++)
+ {
+ if (successor_m[i] == successor_m[j])
+ {
+ seen = true;
+ suc[i] = suc[j];
+ break;
+ }
+ }
+
+ if (!seen)
+ {
+ suc[i] = numsuc;
+ numsuc++;
+ }
+ }
+
+ if (numsuc > 1)
+ {
+ // mark me dead, I'm replaced by the other nodes
+ dead = true;
+
+ // the sole predecessor node
+ MerVertex_t * pred = predecessor_m[0];
+ int predsucc = pred->successor_m.size();
+
+ for (int s = 0; s < numsuc; s++)
+ {
+ MerVertex_t * nn = NULL;
+
+ for (int i = 0; i < ol; i++)
+ {
+ if (suc[i] == s)
+ {
+ if (nn == NULL)
+ {
+ nn = new MerVertex_t(startpos_m, endpos_m);
+ retval.push_back(nn);
+
+ // update the links inside successor_m[i]
+ MerVertex_t * succ = successor_m[i];
+ int bil = succ->predecessor_m.size();
+ for (int b = 0; b < bil; b++)
+ {
+ if (succ->predecessor_m[b] == this)
+ {
+ succ->predecessor_m[b] = nn;
+ }
+ }
+ }
+
+ nn->predecessor_m.push_back(pred);
+ nn->successor_m.push_back(successor_m[i]);
+ }
+ }
+
+ // update pred's out-links
+ int nl = nn->predecessor_m.size();
+ for (int k = 0; k < nl; k++)
+ {
+ for (int j = 0; j < predsucc; j++)
+ {
+ if (pred->successor_m[j] == this)
+ {
+ pred->successor_m[j] = nn;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return retval;
+ }
+
+
+ void foldIntoParent()
+ {
+ MerVertex_t * parent = predecessor_m[0];
+
+ int numcycles = predecessor_m.size();
+
+ int mylen = len();
+ int plen = parent->len();
+
+ parent->endpos_m += numcycles * (mylen - (Kmer_Len-2) + plen - (Kmer_Len -2));
+
+ dead = true;
+
+ // Clear all of the parents out- and in- links to me (all but 1 each)
+
+ int pol = parent->successor_m.size();
+ int pil = parent->predecessor_m.size();
+
+ MerVertex_t * pout = NULL;
+
+ for (int i = 0; i < pol; i++)
+ {
+ if (parent->successor_m[i] != this)
+ { pout = parent->successor_m[i]; break; }
+ }
+
+ assert(pout != NULL);
+
+ parent->successor_m.clear();
+ parent->successor_m.push_back(pout);
+
+ MerVertex_t * pin = NULL;
+
+ for (int i = 0; i < pil; i++)
+ {
+ if (parent->predecessor_m[i] != this)
+ { pin = parent->predecessor_m[i]; break; }
+ }
+
+ assert(pin != NULL);
+
+ parent->predecessor_m.clear();
+ parent->predecessor_m.push_back(pin);
+ }
+
+ // Return the sequence stored in the node
+ string str(const string & seq)
+ {
+ string r = seq.substr(startpos_m, endpos_m-startpos_m+1);
+ return r;
+ }
+
+ bool isNonDecisionNode()
+ {
+ int il = predecessor_m.size();
+ int ol = successor_m.size();
+
+ if (il != ol) { return false; }
+
+ // check all in links are same
+ for (int i = 1; i < il; i++)
+ {
+ if (predecessor_m[i] != predecessor_m[0]) { return false; }
+ }
+
+ for (int i = 1; i < ol; i++)
+ {
+ if (successor_m[i] != successor_m[0]) { return false; }
+ }
+
+ return true;
+ }
+};
+
+int MerVertex_t::NODECOUNT=0;
+
+
+// Class for storing the entire graph: Nodes are stored in a giant MerTable_T
+class deBrujinGraph_t
+{
+public:
+
+ deBrujinGraph_t(const string & tag,
+ const string & seq)
+ : tag_m(tag), seq_m(seq) {}
+
+ const string & tag_m;
+ const string & seq_m;
+
+ MerTable_t mers_m;
+ NodeTable_t nodes_m;
+
+ bool substrEqual(int s1, int e1, int s2, int e2)
+ {
+ if (e1-s1 != e2-s2) { return false; }
+
+ int l = e1-s1+1;
+ for (int i = Seed_Len; i < l; i++)
+ {
+ if (seq_m[s1+i] != seq_m[s2+i])
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ // Get (or create) a vertex
+ MerVertex_t * getVertex(const Mer_t & mer, int startpos, int endpos)
+ {
+ MerTable_t::iterator m = mers_m.find(mer);
+
+ while ((m != mers_m.end()) &&
+ (m->first == mer))
+ {
+ if (substrEqual(startpos, endpos,
+ m->second->startpos_m, m->second->endpos_m))
+ {
+ m->second->addStartPos(startpos);
+ return m->second;
+ }
+
+ m++;
+ }
+
+ m = mers_m.insert(make_pair(mer, new MerVertex_t(startpos, endpos)));
+
+ return m->second;
+ }
+
+ void construct()
+ {
+ Mer_t seed;
+ InitMer(seed);
+
+ // Initialize the first s characters
+ for (int i = 0; i < Seed_Len; i ++)
+ {
+ Forward_Add_Ch(seed, seq_m[i]);
+ }
+
+ // prefix is the first (k-1) bp
+ MerVertex_t * p = getVertex(seed, 0, Kmer_Len-2);
+ int n = seq_m.length();
+
+ for (int i = 1; i+Kmer_Len-2 < n; i++)
+ {
+ Forward_Add_Ch(seed, seq_m[i+Seed_Len-1]);
+
+ // suffix is the next (k-1) bp
+ MerVertex_t * s = getVertex(seed, i, i+Kmer_Len-2);
+
+ p->successor_m.push_back(s);
+ s->predecessor_m.push_back(p);
+
+ p = s;
+ }
+ }
+
+ // Return number of nodes in the graph
+ int nodeCount()
+ {
+ if (nodes_m.size())
+ {
+ return nodes_m.size();
+ }
+
+ return mers_m.size();
+ }
+
+
+ void printStats()
+ {
+ int numNodes = nodes_m.size();
+ int numEdges = 0;
+
+ long totalspan = 0;
+
+ vector<int> lengths;
+
+ long max = 0;
+
+ for (NodeTable_t::iterator ni = nodes_m.begin();
+ ni != nodes_m.end();
+ ni++)
+ {
+ numEdges += (*ni)->successor_m.size();
+
+ long l = (*ni)->len();
+
+ totalspan += l;
+ lengths.push_back(l);
+
+ if (l > max) { max = l; }
+ }
+
+ sort(lengths.begin(), lengths.end(), SortLens);
+
+ long target = totalspan/2;
+ long sum = 0;
+ int n50cnt = 0;
+
+ for (int i = 0; i < lengths.size(); i++)
+ {
+ sum += lengths[i];
+
+ if (sum >= target)
+ {
+ n50cnt = i;
+ break;
+ }
+ }
+
+ cerr << "n=" << numNodes
+ << " m=" << numEdges
+ << " totalspan=" << totalspan
+ << " max=" << max
+ << " mean=" << ((double) totalspan)/ ((double) numNodes)
+ << " n50=" << lengths[n50cnt]
+ << " n50cnt=" << n50cnt
+ << endl;
+ }
+
+ // Print graph in DOT format
+ void print()
+ {
+ cout << "digraph G {" << endl;
+
+ // Renumber nodes and print
+ int count = 1;
+
+ for (NodeTable_t::iterator ni = nodes_m.begin();
+ ni != nodes_m.end();
+ ni++)
+ {
+ assert(!(*ni)->dead);
+ (*ni)->node_m = count;
+ count++;
+
+ if (OPT_DisplayStarts)
+ {
+ cout << " " << (*ni)->node_m
+ << " [label=\"";
+
+ sort((*ni)->starts_m.begin(), (*ni)->starts_m.end());
+
+ for (int j = 0; j < (*ni)->starts_m.size(); j++)
+ {
+ if (j > 0) { cout << ","; }
+ cout << (*ni)->starts_m[j]+1; // use 1-based coordinates
+ }
+
+ cout << ":" << (*ni)->len() << "\"]" << endl;
+ }
+ else if (OPT_DisplaySeq)
+ {
+ string s((*ni)->str(seq_m));
+ int slen = s.length();
+ if (slen > OPT_SeqToDisplay)
+ {
+ string q = s.substr(0,4);
+ q += "...";
+ q += s.substr(s.length()-4, 4);
+ s = q;
+ }
+
+ cout << " " << (*ni)->node_m << " [label=\"" << s << "\\n" << slen << "\"]" << endl;
+ }
+ else
+ {
+ cout << " " << (*ni)->node_m << " [label=\"" << (*ni)->len() << "\"]" << endl;
+ }
+ }
+
+ // Print Edges
+ for (NodeTable_t::iterator ni = nodes_m.begin(); ni != nodes_m.end(); ni++)
+ {
+ for (int j = 0; j < (*ni)->successor_m.size(); j++)
+ {
+ cout << " " << (*ni)->node_m << " -> " << (*ni)->successor_m[j]->node_m << endl;
+ }
+ }
+
+ cout << "}" << endl;
+ }
+
+ // convert the hash table to a list of mers
+ void convertToNodes()
+ {
+ for (MerTable_t::iterator mi = mers_m.begin();
+ mi != mers_m.end();
+ mi++)
+ {
+ if (!mi->second->dead)
+ {
+ nodes_m.push_back(mi->second);
+ }
+ else
+ {
+ delete mi->second;
+ }
+ }
+
+ mers_m.clear();
+ }
+
+ // Compress the graph
+ void compressPaths()
+ {
+ vector<MerVertex_t*> changed;
+
+ // Foreach mer in graph
+ NodeTable_t::iterator mi = nodes_m.begin();
+ while (mi != nodes_m.end())
+ {
+ if ((*mi)->dead)
+ {
+ // Prune nodes that were collapsed away
+ NodeTable_t::iterator t = mi;
+ mi++;
+
+ delete *t;
+ nodes_m.erase(t);
+ }
+ else
+ {
+ // Try to merge this node with its neighbors
+ MerVertex_t * v = *mi;
+
+ while(v->isCompressable())
+ {
+ v->collapse();
+ }
+
+ mi++;
+ }
+ }
+
+ cleanNodeArray();
+ }
+
+ void cleanNodeArray()
+ {
+ NodeTable_t::iterator ni = nodes_m.begin();
+ while (ni != nodes_m.end())
+ {
+ if ((*ni)->dead)
+ {
+ NodeTable_t::iterator t = ni;
+ ni++;
+
+ delete *t;
+ nodes_m.erase(t);
+ }
+ else
+ {
+ ni++;
+ }
+ }
+ }
+
+ void compressTrees()
+ {
+ int nodecount = nodes_m.size();
+ int totalfolds = 0;
+ int selffolds = 0;
+
+ bool madefold = true;
+
+ while (madefold)
+ {
+ cerr << ".";
+ madefold = false;
+ for (NodeTable_t::iterator ni = nodes_m.begin();
+ ni != nodes_m.end();
+ ni++)
+ {
+ if ((*ni)->dead) { continue; }
+
+ if ((*ni)->isSelfLeaf())
+ {
+ (*ni)->foldSelf();
+ madefold = true;
+ totalfolds++;
+ selffolds++;
+ }
+
+ if ((*ni)->isTreeLeaf())
+ {
+ (*ni)->foldIntoParent();
+ madefold=true;
+ totalfolds++;
+ }
+ }
+
+ compressPaths();
+ }
+
+ cerr << "Made " << totalfolds << " total folds, " << selffolds << " selffolds" << endl;
+ }
+
+ void splitBackwardDecisionNodes()
+ {
+ int numsplit = 0;
+ bool split = true;
+ while (split)
+ {
+ split = false;
+ for (NodeTable_t::iterator ni = nodes_m.begin();
+ ni != nodes_m.end();
+ ni++)
+ {
+ if ((*ni)->dead) { continue; }
+ if ((*ni)->isBackwardDecisionNode())
+ {
+ split = true;
+ numsplit++;
+ NodeTable_t extranodes = (*ni)->splitBackwards();
+ for (NodeTable_t::iterator mi = extranodes.begin();
+ mi != extranodes.end();
+ mi++)
+ {
+ nodes_m.push_back(*mi);
+ }
+ }
+ }
+ }
+
+ cleanNodeArray();
+
+ cerr << "splitBackwardDecisionNodes: " << numsplit << endl;
+ }
+
+ void splitForwardDecisionNodes()
+ {
+ int numsplit = 0;
+ bool split = true;
+ while (split)
+ {
+ split = false;
+ for (NodeTable_t::iterator ni = nodes_m.begin();
+ ni != nodes_m.end();
+ ni++)
+ {
+ if ((*ni)->dead) { continue; }
+ if ((*ni)->isForwardDecisionNode())
+ {
+ split = true;
+ numsplit++;
+ NodeTable_t extranodes = (*ni)->splitForwards();
+ for (NodeTable_t::iterator mi = extranodes.begin();
+ mi != extranodes.end();
+ mi++)
+ {
+ nodes_m.push_back(*mi);
+ }
+ }
+ }
+ }
+
+ cleanNodeArray();
+ cerr << "splitForwardDecisionNodes: " << numsplit << endl;
+ }
+
+ void convertNonDecisionToEdges()
+ {
+ int numnondecisionnodes = 0;
+
+ for (NodeTable_t::iterator ni = nodes_m.begin();
+ ni != nodes_m.end();
+ ni++)
+ {
+ if ((*ni)->isNonDecisionNode())
+ {
+ numnondecisionnodes++;
+ }
+ }
+
+ int final = nodes_m.size() - numnondecisionnodes;
+ cerr << "--Final: n=" << final << endl;
+ }
+};
+
+// For now, just create the deBrujin Graph, and print it out
+void ComputeComplexity(const string & tag, const string & seq)
+{
+ int i, j, n;
+
+ n = seq . length ();
+ if (n < Kmer_Len) { return; }
+
+ deBrujinGraph_t graph(tag, seq);
+ EventTime_t timeall;
+ EventTime_t timegraph;
+
+ graph.construct();
+ cerr << graph.nodeCount() << " nodes. " << timegraph.str(true, 8) << endl;
+ graph.convertToNodes();
+ graph.printStats();
+
+ EventTime_t timecompress;
+ graph.compressPaths();
+ cerr << graph.nodeCount() << " nodes compressed. " << timecompress.str(true, 8) << endl;
+ graph.printStats();
+
+ // Just do the compression
+ if (OPT_JustCompress)
+ {
+ if (!OPT_DisplayStats)
+ {
+ graph.print();
+ }
+
+ return;
+ }
+
+
+ EventTime_t timetree;
+ graph.compressTrees();
+ cerr << graph.nodeCount() << " nodes treecompressed. " << timetree.str(true, 8) << endl;
+ graph.printStats();
+
+ EventTime_t timebackwards;
+ graph.splitBackwardDecisionNodes();
+ cerr << graph.nodeCount() << " nodes splitBackwardDecisionNodes. " << timebackwards.str(true, 8) << endl;
+
+ EventTime_t timeforward;
+ graph.splitForwardDecisionNodes();
+ cerr << graph.nodeCount() << " nodes splitForwardDecisionNodes. " << timeforward.str(true, 8) << endl;
+
+ EventTime_t timecompress3;
+ graph.compressPaths();
+ cerr << graph.nodeCount() << " nodes compressed3. " << timecompress3.str(true, 8) << endl;
+
+
+ cerr << "--PostSplit:";
+ graph.printStats();
+
+ EventTime_t timeconverttoedges;
+ graph.convertNonDecisionToEdges();
+
+ cerr << "Total time: " << timeall.str(true, 8) << endl;
+
+ if (!OPT_DisplayStats)
+ {
+ graph.print();
+ }
+
+ return;
+}
+
+
+
+
+int main(int argc, char ** argv)
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+ int isCircular = false;
+
+ try
+ {
+ // Get standard options to work (--help, --version)
+ string version = "Version 1.1";
+ string helptext =
+"Compute the complexity of a genome\n"
+"\n"
+" Usage: genome-complexity -f fasta\n"
+"\n"
+" -f <fasta> fasta file to evaluate\n"
+" -k <len> Length of mers to consider (default:30)\n"
+" -C Interpret genome as circular\n"
+" -p Display the start positions and length of each sequence\n"
+" -d Display the sequences for edge node\n"
+" -D <len> Only show first and last 4 bp for sequences longer than <len>\n"
+" -S Just Compute graph statistics\n";
+"\n";
+
+ string fastafile;
+
+ tf = new AMOS_Foundation(version, helptext, "", argc, argv);
+ tf->disableOptionHelp();
+ tf->getOptions()->addOptionResult("f=s", &fastafile);
+ tf->getOptions()->addOptionResult("k=i", &Kmer_Len);
+ tf->getOptions()->addOptionResult("C", &isCircular);
+ tf->getOptions()->addOptionResult("d", &OPT_DisplaySeq);
+ tf->getOptions()->addOptionResult("p", &OPT_DisplayStarts);
+ tf->getOptions()->addOptionResult("D=i", &OPT_SeqToDisplay);
+ tf->getOptions()->addOptionResult("c", &OPT_JustCompress);
+ tf->getOptions()->addOptionResult("S", &OPT_DisplayStats);
+ tf->handleStandardOptions();
+
+ if (fastafile.empty())
+ {
+ cerr << "You must specify a fasta file" << endl;
+ exit(1);
+ }
+
+ if (Seed_Len > Kmer_Len-1)
+ {
+ Seed_Len = Kmer_Len-1;
+ }
+
+ Forward_Mask = ((long long unsigned) 1 << (2 * Seed_Len - 2)) - 1;
+
+
+ cerr << "Processing sequences in " << fastafile << "..." << endl;
+
+ FILE * fp = fopen(fastafile.c_str(), "r");
+
+ if (!fp)
+ {
+ cerr << "Couldn't open " << fastafile << endl;
+ exit(1);
+ }
+
+ string s, tag;
+
+ // Use Art's fasta reader
+ while (Fasta_Read (fp, s, tag))
+ {
+ cout << tag << endl;
+
+ if (isCircular)
+ {
+ // Add the first kmer_len-1 characters to end to create circularity
+ s += s.substr(0, Kmer_Len-1);
+ }
+
+ // Compute the complexity for each sequence in the fasta file
+ ComputeComplexity(tag, s);
+
+ cout << endl << endl;
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ // Standard stuff to try to exit gracefully
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ return retval;
+}
diff --git a/src/Align/hash-overlap.cc b/src/Align/hash-overlap.cc
new file mode 100644
index 0000000..ba155e3
--- /dev/null
+++ b/src/Align/hash-overlap.cc
@@ -0,0 +1,1374 @@
+// A. L. Delcher
+//
+// File: hash-overlap.cc
+//
+// Last Modified: Tue May 25 09:42:14 EDT 2004
+// Thu Jul 1 17:29:28 EDT 2004 (amp)
+// Tue Aug 24 15:30:52 EDT 2004 (amp)
+//
+// Compute overlaps among an input set of sequences by
+// creating a hash table of minimizers to use as seed
+// matches and then do a full alignment for pairs with
+// common seeds.
+
+
+#include "hash-overlap.hh"
+#include <cassert>
+
+
+#define USE_SIMPLE_OVERLAP 0
+
+static bool AMOS_Message_Output = false;
+static bool AMOS_Bank_Output = false;
+ // Determines whether output is AMOS messages, banks
+static string Input_Name;
+ // Name of file or read bank from which reads are obtained
+static double Error_Rate = DEFAULT_ERROR_RATE;
+ // Fraction of errors allowed in overlap alignment
+static bool FASTA_Input = false;
+ // If set true by the -F option, then input is a multi-fasta
+ // file instead of a read-bank
+static int Lo_ID = 0, Hi_ID = INT_MAX;
+ // Range of indices for which to compute overlaps
+static int Minimizer_Window_Len = 20;
+ // Length of window from which a minimizer is extracted
+static int Min_Overlap_Len = DEFAULT_MIN_OVERLAP_LEN;
+ // Minimum number of bases by which two sequences must overlap
+static string IIDFile = "";
+ // List of IID to be overlapped
+bool selectIIDs = false;
+ // Whether IIDs should be read from a file
+bool selectEIDs = false;
+ // Whether EIDs should be read from a file
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ BankStream_t read_bank (Read_t::NCODE);
+ BankStream_t overlap_bank (Overlap_t::NCODE);
+ Simple_Overlap_t olap;
+ vector <char *> string_list, qual_list;
+ vector <char *> tag_list;
+ vector <ID_t> id_list;
+ vector <Range_t> clr_list;
+ hash_map <unsigned int, Hash_Entry_t> hash_table;
+ time_t now;
+ iostream :: fmtflags status;
+ int i, j, n;
+
+ try
+ {
+ now = time (NULL);
+ cerr << "Starting on " << ctime (& now) << endl;
+
+ Verbose = 0;
+
+ Parse_Command_Line (argc, argv);
+
+
+ if (FASTA_Input)
+ cerr << "FASTA input file is " << Input_Name << endl;
+ else
+ cerr << "Read bank is " << Input_Name << endl;
+ status = cerr . setf (ios :: fixed);
+ cerr << "Alignment error rate is " << setprecision (2)
+ << Error_Rate << endl;
+ cerr . setf (status);
+ cerr << "Minimum overlap bases is " << Min_Overlap_Len << endl;
+
+ if (FASTA_Input)
+ {
+ Read_Fasta_Strings (string_list, id_list, tag_list, Input_Name);
+ }
+ else
+ {
+ if (selectIIDs){
+ vector<ID_t> sel_list;
+ ID_t iid;
+ ifstream selfile(IIDFile.c_str());
+ if (! selfile.is_open()) {
+ cerr << "Could not open IID file " << IIDFile << endl;
+ exit(1);
+ }
+
+ while (selfile >> iid)
+ sel_list.push_back(iid);
+
+ Bank_t read_bank (Read_t::NCODE);
+ read_bank . open(Input_Name, B_READ);
+ Get_Strings_From_Bank_ByID(string_list, qual_list, clr_list,
+ id_list, tag_list, read_bank, sel_list);
+ read_bank . close ();
+ } else if (selectEIDs) {
+ vector<string> sel_list;
+ string eid;
+ ifstream selfile(IIDFile.c_str());
+ if (! selfile.is_open()) {
+ cerr << "Could not open IID file " << IIDFile << endl;
+ exit(1);
+ }
+
+ while (selfile >> eid)
+ sel_list.push_back(eid);
+
+ Bank_t read_bank (Read_t::NCODE);
+ read_bank . open(Input_Name, B_READ);
+ Get_Strings_From_Bank_ByEID(string_list, qual_list, clr_list,
+ id_list, tag_list, read_bank, sel_list);
+ read_bank . close ();
+ } else {
+ read_bank . open (Input_Name, B_READ);
+ Get_Strings_From_Bank (string_list, qual_list, clr_list,
+ id_list, tag_list, read_bank);
+ read_bank . close ();
+ }
+
+ if ( AMOS_Bank_Output )
+ {
+ if ( overlap_bank . exists (Input_Name) )
+ overlap_bank . open (Input_Name);
+ else
+ overlap_bank . create (Input_Name);
+ }
+ }
+
+ Map_Minimizers (string_list, hash_table);
+
+ Find_Fwd_Overlaps (string_list, hash_table, id_list, overlap_bank);
+
+ Find_Rev_Overlaps (string_list, hash_table, id_list, overlap_bank);
+
+ overlap_bank . close( );
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "** AMOS Exception **" << endl;
+ cerr << e << endl;
+ exit (EXIT_FAILURE);
+ }
+ catch (std :: exception & e)
+ {
+ cerr << "** Standard Exception **" << endl;
+ cerr << e << endl;
+ exit (EXIT_FAILURE);
+ }
+
+ return 0;
+ }
+
+
+
+static unsigned int Bit_Pattern
+ (char ch)
+
+// Return the bit pattern equivalent of character ch .
+
+ {
+ switch (tolower (ch))
+ {
+ case 'a' :
+ return 0x0;
+ case 'c' :
+ return 0x1;
+ case 'g' :
+ return 0x2;
+ case 't' :
+ return 0x3;
+ default : // Anything else is converted to an A
+ return 0x0;
+ }
+ }
+
+
+
+static int By_String_Num_Then_Pos
+ (const void * a, const void * b)
+
+// Return the order relationship between a and b regarded
+// as Reference_t 's based first on the string_num field,
+// and second on the pos field. Used by qsort function.
+
+ {
+ Reference_t * x, * y;
+
+ x = (Reference_t *) a;
+ y = (Reference_t *) b;
+
+ if (x -> string_num < y -> string_num)
+ return -1;
+ else if (x -> string_num > y -> string_num)
+ return 1;
+ else if (x -> pos < y -> pos)
+ return -1;
+ else if (x -> pos > y -> pos)
+ return 1;
+ else return 0;
+ }
+
+
+
+static int By_String_Then_Lo_Offset
+ (const void * a, const void * b)
+
+// Return the order relationship between a and b regarded
+// as Offset_Range_t 's based first on the string_num field,
+// and second on the lo_offset field. Used by qsort function.
+
+ {
+ Offset_Range_t * x, * y;
+
+ x = (Offset_Range_t *) a;
+ y = (Offset_Range_t *) b;
+
+ if (x -> string_num < y -> string_num)
+ return -1;
+ else if (x -> string_num > y -> string_num)
+ return 1;
+ else if (x -> lo_offset < y -> lo_offset)
+ return -1;
+ else if (x -> lo_offset > y -> lo_offset)
+ return 1;
+ else return 0;
+ }
+
+
+
+static void Check_IDs
+ (void)
+
+// Check that global ID range bounds Lo_ID and Hi_ID
+// are valid. Throw an exception if they're not.
+
+ {
+ if (Lo_ID < 0)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "Low ID = %d is negative", Lo_ID);
+ AMOS_THROW (Clean_Exit_Msg_Line);
+ }
+ if (Hi_ID < Lo_ID)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "Low ID = %d and High ID = %d are out of order", Lo_ID, Hi_ID);
+ AMOS_THROW (Clean_Exit_Msg_Line);
+ }
+ if (Lo_ID == Hi_ID)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "Low ID = %d = High ID No overlaps are possible", Lo_ID);
+ AMOS_THROW (Clean_Exit_Msg_Line);
+ }
+
+ return;
+ }
+
+
+
+static void Find_Fwd_Overlaps
+ (const vector <char *> & string_list,
+ hash_map <unsigned int, Hash_Entry_t> & ht,
+ const vector <ID_t> & id_list, BankStream_t & overlap_bank)
+
+// Find all overlaps between pairs of strings in string_list
+// where both are in the forward orientation and share
+// a minimizer in ht .
+
+ {
+ vector <Offset_Entry_t> offset_list;
+ hash_map <unsigned int, Hash_Entry_t> :: iterator iter;
+ Simple_Overlap_t prev_olap, olap;
+ bool have_prev_olap;
+ double erate;
+ int i, j, n;
+
+ n = string_list . size ();
+ offset_list . resize (n);
+
+ for (i = 0; i < n; i ++)
+ offset_list [i] . ct = 0;
+
+ // Store the offsets
+ for (iter = ht . begin (); iter != ht . end (); iter ++)
+ {
+ if (iter -> second . ct < 2)
+ continue;
+
+ for (i = 0; i < iter -> second . ct - 1; i ++)
+ {
+ int a = iter -> second . ref [i] . string_num;
+ int a_pos = iter -> second . ref [i] . pos;
+
+ for (j = i + 1; j < iter -> second . ct; j ++)
+ {
+ int b = iter -> second . ref [j] . string_num;
+ int b_pos = iter -> second . ref [j] . pos;
+
+ if (a == b)
+ continue;
+
+ offset_list [a] . Add_Offset (b, b_pos - a_pos);
+ }
+ }
+ }
+
+ for (i = 0; i < n; i ++)
+ {
+ // Since the same pair of strings may have multiple offset
+ // entries, sort them so that all entries are together and
+ // merge entries that are close enough to have overlapping
+ // bands for the alignment
+
+ if (1 < offset_list [i] . ct)
+ {
+ qsort (offset_list [i] . off, offset_list [i] . ct,
+ sizeof (Offset_Range_t), By_String_Then_Lo_Offset);
+ Merge_Overlapping_Bands (offset_list [i], 5 * ALIGNMENT_BAND_RADIUS);
+ }
+
+ have_prev_olap = false;
+ for (j = 0; j < offset_list [i] . ct; j ++)
+ {
+ int b = offset_list [i] . off [j] . string_num;
+ int lo, hi;
+
+#if USE_SIMPLE_OVERLAP
+ Simple_Overlap (string_list [i], strlen (string_list [i]),
+ string_list [b], strlen (string_list [b]), olap);
+#else
+ lo = Max (offset_list [i] . off [j] . lo_offset - ALIGNMENT_BAND_RADIUS,
+ - int (strlen (string_list [i])));
+ hi = Min (offset_list [i] . off [j] . hi_offset + ALIGNMENT_BAND_RADIUS,
+ int (strlen (string_list [b])));
+ Banded_Overlap (string_list [i], strlen (string_list [i]),
+ string_list [b], strlen (string_list [b]), lo, hi, olap);
+#endif
+ if (olap . a_olap_len < Min_Overlap_Len
+ || olap . b_olap_len < Min_Overlap_Len)
+ continue;
+ erate = (2.0 * olap . errors)
+ / (olap . a_olap_len + olap . b_olap_len);
+ if (erate <= Error_Rate)
+ {
+ olap . a_id = id_list [i];
+ olap . b_id = id_list [b];
+ olap . flipped = false;
+ if (have_prev_olap)
+ {
+ assert (prev_olap . a_id == olap . a_id);
+ if (prev_olap . b_id == olap . b_id)
+ {
+ if (prev_olap . score < olap . score)
+ prev_olap = olap;
+ }
+ else
+ {
+ Output (cout, overlap_bank, prev_olap);
+ prev_olap = olap;
+ }
+ }
+ else
+ {
+ prev_olap = olap;
+ have_prev_olap = true;
+ }
+ }
+ }
+ if (have_prev_olap)
+ Output (cout, overlap_bank, prev_olap);
+ }
+
+ for (i = 0; i < n; i ++)
+ if (offset_list [i] . ct > 0)
+ free (offset_list [i] . off);
+
+ return;
+ }
+
+
+
+static void Find_Rev_Overlaps
+ (vector <char *> & string_list,
+ hash_map <unsigned int, Hash_Entry_t> & ht,
+ const vector <ID_t> & id_list, BankStream_t & overlap_bank)
+
+// Find all overlaps between pairs of strings in string_list
+// where the lower-numbered string is in the reverse orientation
+// the higher-numbered string is in the forward orientation.
+// Overlaps are found only if the sequences share
+// a minimizer in ht .
+
+ {
+ Minimizer_t mini (Minimizer_Window_Len);
+ Offset_Entry_t offset;
+ Simple_Overlap_t prev_olap, olap;
+ bool have_prev_olap;
+ double erate;
+ int i, j, n, p;
+
+ n = string_list . size ();
+ offset . ct = 0;
+
+ for (i = 0; i < n; i ++)
+ {
+ char * s;
+ unsigned int sig;
+ int pos, new_pos;
+ int k, m, p;
+
+ Reverse_Complement (string_list [i]);
+ s = string_list [i];
+ m = strlen (s);
+ if (m < Minimizer_Window_Len)
+ continue;
+
+ mini . Init (s);
+ sig = mini . Get_Signature ();
+ pos = mini . Get_Window_Offset ();
+ if (ht . find (sig) != ht . end ())
+ for (j = 0; j < ht [sig] . ct; j ++)
+ {
+ int b = ht [sig] . ref [j] . string_num;
+
+ if (i < b)
+ offset . Add_Offset (ht [sig] . ref [j] . string_num,
+ ht [sig] . ref [j] . pos - pos);
+ }
+
+ k = Minimizer_Window_Len;
+ for (p = 1; p <= m - Minimizer_Window_Len; p ++, k++)
+ {
+ mini . Advance (s [k]);
+ new_pos = p + mini . Get_Window_Offset ();
+ if (new_pos > pos)
+ {
+ sig = mini . Get_Signature ();
+ if (ht . find (sig) != ht . end ())
+ for (j = 0; j < ht [sig] . ct; j ++)
+ {
+ int b = ht [sig] . ref [j] . string_num;
+
+ if (i < b)
+ offset . Add_Offset (b,
+ ht [sig] . ref [j] . pos - pos);
+ }
+ pos = new_pos;
+ }
+ }
+
+ // Since the same pair of strings may have multiple offset
+ // entries, sort them so that all entries are together and
+ // merge entries that are close enough to have overlapping
+ // bands for the alignment
+
+ if (1 < offset . ct)
+ {
+ qsort (offset . off, offset . ct,
+ sizeof (Offset_Range_t), By_String_Then_Lo_Offset);
+ Merge_Overlapping_Bands (offset, 5 * ALIGNMENT_BAND_RADIUS);
+ }
+
+ have_prev_olap = false;
+ for (j = 0; j < offset . ct; j ++)
+ {
+ int b = offset . off [j] . string_num;
+ int lo, hi;
+
+#if USE_SIMPLE_OVERLAP
+ Simple_Overlap (string_list [i], strlen (string_list [i]),
+ string_list [b], strlen (string_list [b]), olap);
+#else
+ lo = Max (offset . off [j] . lo_offset - ALIGNMENT_BAND_RADIUS,
+ - int (strlen (string_list [i])));
+ hi = Min (offset . off [j] . hi_offset + ALIGNMENT_BAND_RADIUS,
+ int (strlen (string_list [b])));
+ Banded_Overlap (string_list [i], strlen (string_list [i]),
+ string_list [b], strlen (string_list [b]), lo, hi, olap);
+#endif
+ if (olap . a_olap_len < Min_Overlap_Len
+ || olap . b_olap_len < Min_Overlap_Len)
+ continue;
+ erate = (2.0 * olap . errors)
+ / (olap . a_olap_len + olap . b_olap_len);
+ if (erate <= Error_Rate)
+ {
+ int save;
+
+ // Re-orient with a forward and b reversed
+ save = olap . a_hang;
+ olap . a_hang = - olap . b_hang;
+ olap . b_hang = - save;
+ olap . a_id = id_list [i];
+ olap . b_id = id_list [b];
+ olap . flipped = true;
+ if (have_prev_olap)
+ {
+ assert (prev_olap . a_id == olap . a_id);
+ if (prev_olap . b_id == olap . b_id)
+ {
+ if (prev_olap . score < olap . score)
+ prev_olap = olap;
+ }
+ else
+ {
+ Output (cout, overlap_bank, prev_olap);
+ prev_olap = olap;
+ }
+ }
+ else
+ {
+ prev_olap = olap;
+ have_prev_olap = true;
+ }
+ }
+ }
+ if (have_prev_olap)
+ Output (cout, overlap_bank, prev_olap);
+
+ if (offset . ct > 0)
+ {
+ free (offset . off);
+ offset . ct = 0;
+ }
+ }
+
+ return;
+ }
+
+
+
+static void Get_Strings_From_Bank
+ (vector <char *> & s, vector <char *> & q,
+ vector <Range_t> & clr_list, vector <ID_t> & id_list,
+ vector <char * > & tag_list, BankStream_t & read_bank)
+
+// Populate s and q with sequences and quality values, resp.,
+// from read_bank . Put the clear-ranges for the sequences in clr_list .
+// read_bank must already be opened. Put the identifying tags for the
+// sequences in tag_list . Only get sequences with index in the range
+// lo_id .. hi_id .
+
+ {
+ int i, n;
+
+ n = s . size ();
+ for (i = 0; i < n; i ++)
+ free (s [i]);
+ s . clear ();
+
+ n = q . size ();
+ for (i = 0; i < n; i ++)
+ free (q [i]);
+ q . clear ();
+
+ n = tag_list . size ();
+ for (i = 0; i < n; i ++)
+ free (tag_list [i]);
+ tag_list . clear ();
+ id_list . clear ();
+ clr_list . clear ();
+
+ Read_t read;
+ char * tmp, tag_buff [100];
+ string seq;
+ string qual;
+ Range_t clear;
+ int this_offset;
+ int a, b, j, len, qlen;
+
+ i = Lo_ID;
+ read_bank . seekg (i, BankStream_t::BEGIN);
+ while ( read_bank >> read && i ++ < Hi_ID )
+ {
+ id_list . push_back (read . getIID());
+ tag_list . push_back (strdup (read . getEID() . c_str()));
+
+ clear = read . getClearRange ();
+ if (Verbose > 2)
+ cerr << read;
+ seq = read . getSeqString (clear);
+ qual = read . getQualString (clear);
+ clr_list . push_back (clear);
+
+ len = seq . length ();
+ tmp = strdup (seq . c_str ());
+ for (j = 0; j < len; j ++)
+ tmp [j] = tolower (tmp [j]);
+ s . push_back (tmp);
+
+ qlen = qual . length ();
+ if (len != qlen)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Sequence length (%d) != quality length (%d) for read %d\n",
+ len, qlen, read . getIID( ));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ tmp = strdup (qual . c_str ());
+ q . push_back (tmp);
+ }
+
+ return;
+ }
+
+
+
+static void Get_Strings_From_Bank_ByID
+ (vector <char *> & s, vector <char *> & q,
+ vector <Range_t> & clr_list, vector <ID_t> & id_list,
+ vector <char * > & tag_list, Bank_t & read_bank,
+ vector <ID_t> & sel_list)
+
+// Populate s and q with sequences and quality values, resp.,
+// from read_bank . Put the clear-ranges for the sequences in clr_list .
+// read_bank must already be opened. Put the identifying tags for the
+// sequences in tag_list . Only get sequences whose IIDs are in sel_list
+
+ {
+ int i, n;
+
+ n = s . size ();
+ for (i = 0; i < n; i ++)
+ free (s [i]);
+ s . clear ();
+
+ n = q . size ();
+ for (i = 0; i < n; i ++)
+ free (q [i]);
+ q . clear ();
+
+ n = tag_list . size ();
+ for (i = 0; i < n; i ++)
+ free (tag_list [i]);
+ tag_list . clear ();
+ id_list . clear ();
+ clr_list . clear ();
+
+ Read_t read;
+ char * tmp, tag_buff [100];
+ string seq;
+ string qual;
+ Range_t clear;
+ int this_offset;
+ int a, b, j, len, qlen;
+
+ // i = Lo_ID;
+ // read_bank . seekg (i, BankStream_t::BEGIN);
+ for (int idx = 0; idx < sel_list.size(); idx++)
+ {
+ if (! read_bank.existsIID(sel_list[idx])){
+ cerr << "IID " << sel_list[idx] << " does not exist in bank!\n";
+ exit(1);
+ }
+ read_bank.fetch(sel_list[idx], read);
+ id_list . push_back (read . getIID());
+ tag_list . push_back (strdup (read . getEID() . c_str()));
+
+ clear = read . getClearRange ();
+ if (Verbose > 2)
+ cerr << read;
+ seq = read . getSeqString (clear);
+ qual = read . getQualString (clear);
+ clr_list . push_back (clear);
+
+ len = seq . length ();
+ tmp = strdup (seq . c_str ());
+ for (j = 0; j < len; j ++)
+ tmp [j] = tolower (tmp [j]);
+ s . push_back (tmp);
+
+ qlen = qual . length ();
+ if (len != qlen)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Sequence length (%d) != quality length (%d) for read %d\n",
+ len, qlen, read . getIID( ));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ tmp = strdup (qual . c_str ());
+ q . push_back (tmp);
+ }
+
+ return;
+ }
+
+
+static void Get_Strings_From_Bank_ByEID
+ (vector <char *> & s, vector <char *> & q,
+ vector <Range_t> & clr_list, vector <ID_t> & id_list,
+ vector <char * > & tag_list, Bank_t & read_bank,
+ vector <string> & sel_list)
+
+// Populate s and q with sequences and quality values, resp.,
+// from read_bank . Put the clear-ranges for the sequences in clr_list .
+// read_bank must already be opened. Put the identifying tags for the
+// sequences in tag_list . Only get sequences whose IIDs are in sel_list
+
+ {
+ int i, n;
+
+ n = s . size ();
+ for (i = 0; i < n; i ++)
+ free (s [i]);
+ s . clear ();
+
+ n = q . size ();
+ for (i = 0; i < n; i ++)
+ free (q [i]);
+ q . clear ();
+
+ n = tag_list . size ();
+ for (i = 0; i < n; i ++)
+ free (tag_list [i]);
+ tag_list . clear ();
+ id_list . clear ();
+ clr_list . clear ();
+
+ Read_t read;
+ char * tmp, tag_buff [100];
+ string seq;
+ string qual;
+ Range_t clear;
+ int this_offset;
+ int a, b, j, len, qlen;
+
+ // i = Lo_ID;
+ // read_bank . seekg (i, BankStream_t::BEGIN);
+ for (int idx = 0; idx < sel_list.size(); idx++)
+ {
+ if (! read_bank.existsEID(sel_list[idx].c_str())){
+ cerr << "EID " << sel_list[idx] << " does not exist in bank!\n";
+ exit(1);
+ }
+ read_bank.fetch(sel_list[idx].c_str(), read);
+ id_list . push_back (read . getIID());
+ tag_list . push_back (strdup (read . getEID() . c_str()));
+
+ clear = read . getClearRange ();
+ if (Verbose > 2)
+ cerr << read;
+ seq = read . getSeqString (clear);
+ qual = read . getQualString (clear);
+ clr_list . push_back (clear);
+
+ len = seq . length ();
+ tmp = strdup (seq . c_str ());
+ for (j = 0; j < len; j ++)
+ tmp [j] = tolower (tmp [j]);
+ s . push_back (tmp);
+
+ qlen = qual . length ();
+ if (len != qlen)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Sequence length (%d) != quality length (%d) for read %d\n",
+ len, qlen, read . getIID( ));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ tmp = strdup (qual . c_str ());
+ q . push_back (tmp);
+ }
+
+ return;
+ }
+
+
+static void Map_Minimizers
+ (const vector <char *> & string_list,
+ hash_map <unsigned int, Hash_Entry_t> & ht)
+
+// Find minimizers for all strings in string_list
+// and store them in ht .
+
+ {
+ Minimizer_t mini (Minimizer_Window_Len);
+ hash_map <unsigned int, Hash_Entry_t> :: iterator iter;
+ int c, i, n;
+
+ // First count the number of occurrences of each minimizer
+ n = string_list . size ();
+ for (i = 0; i < n; i ++)
+ {
+ char * s;
+ unsigned int sig;
+ int pos, new_pos;
+ int j, k, m;
+
+ s = string_list [i];
+ m = strlen (s);
+ if (m < Minimizer_Window_Len)
+ continue;
+
+ mini . Init (s);
+ sig = mini . Get_Signature ();
+ pos = mini . Get_Window_Offset ();
+ if (ht . find (sig) != ht . end ())
+ ht [sig] . ct ++;
+ else
+ ht [sig] . ct = 1;
+
+ k = Minimizer_Window_Len;
+ for (j = 1; j <= m - Minimizer_Window_Len; j ++, k++)
+ {
+ mini . Advance (s [k]);
+ new_pos = j + mini . Get_Window_Offset ();
+ if (new_pos > pos)
+ {
+ sig = mini . Get_Signature ();
+ if (ht . find (sig) != ht . end ())
+ ht [sig] . ct ++;
+ else
+ ht [sig] . ct = 1;
+ pos = new_pos;
+ }
+ }
+ }
+
+ // Allocate memory based on the counts
+ for (iter = ht . begin (); iter != ht . end (); iter ++)
+ {
+ iter -> second . ref = new Reference_t [iter -> second . ct];
+ iter -> second . ct = 0;
+ }
+
+ // Go back and actually store the minimizers this time
+ for (i = 0; i < n; i ++)
+ {
+ char * s;
+ unsigned int sig;
+ int pos, new_pos;
+ int j, k, m;
+
+ s = string_list [i];
+ m = strlen (s);
+ if (m < Minimizer_Window_Len)
+ continue;
+
+ mini . Init (s);
+ sig = mini . Get_Signature ();
+ pos = mini . Get_Window_Offset ();
+ c = ht [sig] . ct;
+ ht [sig] . ref [c] . string_num = i;
+ ht [sig] . ref [c] . pos = pos;
+ ht [sig] . ct ++;
+
+ k = Minimizer_Window_Len;
+ for (j = 1; j <= m - Minimizer_Window_Len; j ++, k++)
+ {
+ mini . Advance (s [k]);
+ new_pos = j + mini . Get_Window_Offset ();
+ if (new_pos > pos)
+ {
+ pos = new_pos;
+ sig = mini . Get_Signature ();
+ c = ht [sig] . ct;
+ ht [sig] . ref [c] . string_num = i;
+ ht [sig] . ref [c] . pos = pos;
+ ht [sig] . ct ++;
+ }
+ }
+ }
+
+ // Sort the ref entries by string number
+ for (iter = ht . begin (); iter != ht . end (); iter ++)
+ if (iter -> second . ct > 1)
+ qsort (iter -> second . ref, iter -> second . ct,
+ sizeof (Reference_t), By_String_Num_Then_Pos);
+
+ if (Verbose > 2)
+ for (iter = ht . begin (); iter != ht . end (); iter ++)
+ {
+ printf ("%08x ", iter -> first);
+ for (i = 0; i < iter -> second . ct; i ++)
+ printf (" %5d/%-4d", iter -> second . ref [i] . string_num,
+ iter -> second . ref [i] . pos);
+ putchar ('\n');
+ }
+
+ return;
+ }
+
+
+
+static void Merge_Overlapping_Bands
+ (Offset_Entry_t & oe, int rad)
+
+// Merge ranges in oe that overlap after being expanded by rad
+// in both directions.
+
+ {
+ int i, p;
+
+ p = 0;
+ for (i = 1; i < oe . ct; i ++)
+ if (oe . off [p] . string_num == oe . off [i] . string_num
+ && oe . off [i] . lo_offset - rad <= oe . off [p] . hi_offset + rad)
+ {
+ // merge
+ oe . off [p] . hi_offset
+ = Max (oe . off [p] . hi_offset, oe . off [i] . hi_offset);
+ }
+ else
+ {
+ p ++;
+ if (p < i)
+ oe . off [p] = oe . off [i];
+ }
+ oe . ct = p + 1;
+
+ return;
+ }
+
+
+
+static void Output
+ (ostream & os, BankStream_t & overlap_bank, const Simple_Overlap_t & olap)
+
+// Print the contents of olap to fp .
+
+ {
+ if ( AMOS_Message_Output || AMOS_Bank_Output )
+ {
+ AMOS :: Overlap_t ovl;
+ std :: pair <ID_t, ID_t> read_pair;
+
+ if (olap . flipped)
+ ovl . setAdjacency (Overlap_t :: INNIE);
+ else
+ ovl . setAdjacency (Overlap_t :: NORMAL);
+ read_pair . first = olap . a_id;
+ read_pair . second = olap . b_id;
+ ovl . setReads (read_pair);
+ ovl . setAhang (olap . a_hang);
+ ovl . setBhang (olap . b_hang);
+
+ if ( AMOS_Bank_Output )
+ {
+ overlap_bank << ovl;
+ }
+ else // AMOS_Message_Output
+ {
+ Message_t msg;
+ ovl . writeMessage (msg);
+ msg . write (cout);
+ }
+ }
+ else
+ {
+ char line [MAX_LINE];
+
+ sprintf (line, "%5d %5d %c %5d %5d %5d %5d %5d %3d %4.2f\n",
+ olap . a_id, olap . b_id, olap . flipped ? 'I' : 'N',
+ olap . a_hang, olap . b_hang,
+ olap . a_olap_len, olap . b_olap_len, olap . score,
+ olap . errors,
+ 200.0 * olap . errors
+ / (olap . a_olap_len + olap . b_olap_len));
+ os << line;
+ }
+
+ return;
+ }
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = false;
+ int ch;
+
+ optarg = NULL;
+
+ while (!errflg && ((ch = getopt (argc, argv, "ABb:e:Fho:v:x:I:E:")) != EOF))
+ switch (ch)
+ {
+ case 'A' :
+ AMOS_Message_Output = true;
+ break;
+
+ case 'B' :
+ AMOS_Bank_Output = true;
+ break;
+
+ case 'b' :
+ Lo_ID = strtol (optarg, NULL, 10);
+ break;
+
+ case 'e' :
+ Hi_ID = strtol (optarg, NULL, 10);
+ break;
+
+ case 'F' :
+ FASTA_Input = true;
+ break;
+
+ case 'h' :
+ errflg = true;
+ break;
+
+ case 'o' :
+ Min_Overlap_Len = strtol (optarg, NULL, 10);
+ break;
+
+ case 'v' :
+ Verbose = strtol (optarg, NULL, 10);
+ break;
+
+ case 'x' :
+ Error_Rate = strtod (optarg, NULL);
+ break;
+
+ case 'I' :
+ IIDFile = string(optarg);
+ selectIIDs = true;
+ break;
+
+ case 'E' :
+ IIDFile = string(optarg);
+ selectEIDs = true;
+ break;
+
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+
+ default :
+ errflg = true;
+ }
+
+ if ( AMOS_Message_Output && AMOS_Bank_Output )
+ {
+ fprintf (stderr, "The -A and -B options are mutually exclusive\n");
+ errflg = true;
+ }
+
+ if ( AMOS_Bank_Output && FASTA_Input )
+ {
+ fprintf (stderr, "The -B and -F options are mutually exclusive\n");
+ errflg = true;
+ }
+
+ if (errflg)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (optind > argc - 1)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ Input_Name = argv [optind ++];
+ Check_IDs( );
+ return;
+ }
+
+
+
+static void Read_Fasta_Strings
+ (vector <char *> & s, vector <ID_t> & id_list,
+ vector <char *> & tag_list, const std :: string & fn)
+
+// Open file named fn and read FASTA-format sequences from it
+// into s and their tags into tag_list .
+
+ {
+ FILE * fp;
+ std :: string seq, hdr;
+
+ fp = File_Open (fn . c_str (), "r", __FILE__, __LINE__);
+ s . clear ();
+ id_list . clear();
+ tag_list . clear ();
+
+ char tag [MAX_LINE];
+ char * tmp;
+ int j, len;
+ int cnt = 0;
+
+ while (Fasta_Read (fp, seq, hdr))
+ {
+ if ( cnt >= Lo_ID && cnt < Hi_ID )
+ {
+ tmp = strdup (seq . c_str ());
+ len = seq . length ();
+ for (j = 0; j < len; j ++)
+ tmp [j] = tolower (tmp [j]);
+ s . push_back (tmp);
+
+ sscanf (hdr . c_str (), "%s", tag);
+ tag_list . push_back (strdup (tag));
+ id_list . push_back (cnt);
+ }
+ ++ cnt;
+ }
+
+ return;
+ }
+
+
+
+static void Shift_In
+ (unsigned int & u, char ch, unsigned int mask)
+
+// Shift into u (on the right side) the bit equivalent of ch
+// and then AND the result with mask .
+
+ {
+ u <<= 2;
+ u |= Bit_Pattern (ch);
+ u &= mask;
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ ".USAGE.\n"
+ " %s <input-name>\n"
+ "\n"
+ ".DESCRIPTION.\n"
+ " Compute pairwise overlaps among a set of sequences by\n"
+ " brute-force all-pairs alignment. Sequences are obtained\n"
+ " from <input-name>, which by default is an AMOS read bank.\n"
+ " Each line of the output file describes the overlap\n"
+ " between two sequences. The lines are space-delimited and\n"
+ " contain 10 fields:\n"
+ " * ID of first read (IIDs in the case of a read bank \n"
+ " input and sequence index for a fasta file input)\n"
+ " * ID of second read\n"
+ " * overlap type: [N]ormal (EB), [A]ntinormal (BE),\n"
+ " [I]nnie (EE) or [O]utie (BB), where B is the \n"
+ " beginning of the read and E its end\n"
+ " * length of non-overlapping portion for first read\n"
+ " * length of non-overlapping portion for second read\n"
+ " * overlap length for first read\n"
+ " * overlap length for second read\n"
+ " * overlap score\n"
+ " * number of errors in the overlap\n"
+ " * overlap error percentage\n"
+ "\n"
+ ".OPTIONS.\n"
+ " -A Output AMOS-format messages instead of default\n"
+ " -B Output to AMOS bank instead of default\n"
+ " -b <n> Use <n> as lowest read index (0 based inclusive)\n"
+ " -e <n> Use <n> as highest read index (0 based exclusive)\n"
+ " -F Input is from multi-fasta file <input-name>\n"
+ " -h Print this usage message\n"
+ " -o <n> Set minimum overlap length to <n>\n"
+ " -v <n> Set verbose level to <n>. Higher produces more output.\n"
+ " -x <d> Set maximum error rate to <d>. E.g., 0.06 is 6%% error\n"
+ " -I <file> Build overlaps only for reads whose IIDs are in <file>\n"
+ " -E <file> Build overlaps only for reads whose EIDs are in <file>\n"
+ "\n"
+ ".KEYWORDS.\n"
+ " overlaps, reads\n",
+ command);
+
+ return;
+ }
+
+
+
+void Offset_Entry_t :: Add_Offset
+ (int s, int offset)
+
+// Add match to string number s with offset offset to this
+// entry if its not already present.
+
+ {
+ int i;
+
+ if (ct == 0)
+ {
+ ct = 1;
+ off = (Offset_Range_t *) Safe_calloc (1, sizeof (Offset_Range_t),
+ __FILE__, __LINE__);
+ off [0] . string_num = s;
+ off [0] . lo_offset = off [0] . hi_offset = offset;
+ return;
+ }
+
+ for (i = 0; i < ct; i ++)
+ if (off [i] . string_num == s
+ && off [i] . lo_offset - OFFSET_WIGGLE <= offset
+ && offset <= off [i] . hi_offset + OFFSET_WIGGLE)
+ {
+ if (offset < off [i] . lo_offset)
+ off [i] . lo_offset = offset;
+ if (offset > off [i] . hi_offset)
+ off [i] . hi_offset = offset;
+ return;
+ }
+
+ ct ++;
+ off = (Offset_Range_t *) Safe_realloc (off, ct * sizeof (Offset_Range_t),
+ __FILE__, __LINE__);
+ off [ct - 1] . string_num = s;
+ off [ct - 1] . lo_offset = off [ct - 1] . hi_offset = offset;
+
+ return;
+ }
+
+
+
+Minimizer_t :: Minimizer_t
+ (int wl)
+
+// Construct an empty minimizer that uses a window of wl characters
+
+ {
+ int i, two_bit_ct;
+
+ two_bit_ct = 4 * sizeof (unsigned int);
+ // number of 2-bit units in an unsigned int
+ assert (signature_len <= two_bit_ct);
+
+ window_len = wl;
+ signature = new unsigned int [1 + window_len - signature_len];
+ delay = new int [1 + window_len - signature_len];
+
+ signature_mask = order_mask = 0;
+ for (i = 0; i < signature_len; i ++)
+ {
+ signature_mask = (signature_mask << 2) | 0x3;
+ order_mask <<= 2;
+ if (i % 2 == 1)
+ order_mask |= 0x3;
+ }
+
+ signature_ct = 0;
+ // indicates an empty (i.e., uninitialized) minimizer
+ }
+
+
+
+Minimizer_t :: ~ Minimizer_t
+ ()
+
+// Destroy this minimizer
+
+ {
+ delete [] signature;
+ delete [] delay;
+ }
+
+
+
+void Minimizer_t :: Advance
+ (char ch)
+
+// Shift character ch into this minimizer window on the right
+// and shift out the leftmost window character. Update signature
+// and offset values as needed.
+
+ {
+ unsigned int new_sig;
+ int i;
+
+ Shift_In (buff, ch, signature_mask);
+
+ new_sig = buff ^ order_mask;
+ window_offset --;
+ if (window_offset < 0)
+ {
+ for (i = 1; i < signature_ct && signature [i] <= new_sig; i ++)
+ {
+ signature [i - 1] = signature [i];
+ delay [i - 1] = delay [i];
+ }
+ signature [i - 1] = new_sig;
+ signature_ct = i;
+ if (i == 1)
+ window_offset = window_len - signature_len;
+ else
+ {
+ window_offset += delay [0];
+ for (i = 1; i < signature_ct - 1; i ++)
+ delay [i] -= delay [0];
+ delay [signature_ct - 1] =
+ window_len - signature_len - window_offset;
+ }
+ delay [0] = 0;
+ }
+ else
+ {
+ for (i = signature_ct - 1; i >= 0 && new_sig < signature [i]; i --)
+ ;
+ signature [i + 1] = new_sig;
+ signature_ct = i + 2;
+ if (signature_ct == 1)
+ window_offset = window_len - signature_len;
+ else
+ delay [signature_ct - 1] =
+ window_len - signature_len - window_offset;
+ }
+
+ return;
+ }
+
+
+
+void Minimizer_t :: Dump
+ (FILE * fp)
+
+// Display the contents of this minimizer to fp .
+
+ {
+ int i;
+
+ fprintf (fp,
+ "window_len/offset = %d/%d signature/order_mask = %08x/%08x\n",
+ window_len, window_offset, signature_mask, order_mask);
+ fprintf (fp, "buff = %08x\n", buff);
+ fprintf (fp, "signatures & delays:\n");
+ for (i = 0; i < signature_ct; i ++)
+ fprintf (fp, "%2d: %08x %2d\n", i, signature [i], delay [i]);
+
+ return;
+ }
+
+
+
+void Minimizer_t :: Init
+ (const char * s)
+
+// Fill this minimizer window with the first window_len characters
+// of s and find the minimizer in it.
+
+ {
+ int i;
+
+ buff = 0u;
+ for (i = 0; i < signature_len; i ++)
+ Shift_In (buff, s [i], signature_mask);
+
+ window_offset = window_len - signature_len;
+ signature [0] = buff ^ order_mask;
+ delay [0] = 0;
+ signature_ct = 1;
+
+ for (i = signature_len; i < window_len; i ++)
+ Advance (s [i]);
+
+ return;
+ }
+
+
+
diff --git a/src/Align/hash-overlap.hh b/src/Align/hash-overlap.hh
new file mode 100644
index 0000000..aa61c96
--- /dev/null
+++ b/src/Align/hash-overlap.hh
@@ -0,0 +1,161 @@
+// A. L. Delcher
+//
+// File: hash-overlap.hh
+//
+// Last Modified: Tue May 25 09:45:25 EDT 2004
+// Thu Jul 1 17:29:28 EDT 2004 (amp)
+// Tue Aug 24 15:30:52 EDT 2004 (amp)
+//
+// Declarations for simple-overlap.cc
+
+
+#ifndef __HASH_OVERLAP_HH_INCLUDED
+#define __HASH_OVERLAP_HH_INCLUDED
+
+#include "foundation_AMOS.hh"
+#include "delcher.hh"
+#include "align.hh"
+#include "fasta.hh"
+#include <iostream>
+#include <vector>
+#include <string>
+#include <algorithm>
+
+using namespace std;
+using namespace AMOS;
+using namespace HASHMAP;
+
+const double DEFAULT_ERROR_RATE = 0.06;
+ // Default fraction of errors allowed in overlap alignment
+const int DEFAULT_MIN_OVERLAP_LEN = 40;
+ // Default minimum number of bases by which two sequences must overlap
+const int ALIGNMENT_BAND_RADIUS = 5;
+ // Half the width of the alignment band
+const int OFFSET_WIGGLE = 3;
+ // Number of bases difference in offsets to be considered the same
+const int MAX_LINE = 1000;
+const int NEW_SIZE = 1000;
+
+
+struct Reference_t
+ {
+ int string_num, pos;
+ };
+
+
+struct Hash_Entry_t
+ {
+ int ct;
+ Reference_t * ref;
+ };
+
+
+struct Offset_Range_t
+ {
+ int string_num, lo_offset, hi_offset;
+ };
+
+
+struct Offset_Entry_t
+ {
+ int ct;
+ Offset_Range_t * off;
+
+ void Add_Offset
+ (int s, int offset);
+ };
+
+
+class Minimizer_t
+ {
+ private:
+ static const int signature_len = 16;
+
+ unsigned int buff;
+ unsigned int * signature;
+ // a priority queue of the lexicographic minimum bit patterns
+ // in the window
+ int * delay;
+ // how much additional offset each signature is from the best
+ int signature_ct;
+ // the number of entries on the signature priority queue
+ int window_len;
+ // the number of characters in window
+ int window_offset;
+ // the offset into window where the min signature pattern occurs
+ // measured in characters
+ unsigned int signature_mask;
+ // bit pattern that matches used part of signature
+ // in case it's shorter than a full unsigned int
+ unsigned int order_mask;
+ // bit pattern to XOR with text bit pattern to create pattern
+ // for lexicographic comparison
+
+ public:
+ Minimizer_t
+ (int wl); // Constructor
+ ~ Minimizer_t
+ (); // Destructor
+
+ unsigned int Get_Signature
+ (void) const
+ { return signature [0] ^ order_mask; }
+ int Get_Window_Offset
+ (void) const
+ { return window_offset; }
+
+ void Advance
+ (char ch);
+ void Dump
+ (FILE * fp);
+ void Init
+ (const char * s);
+ };
+
+
+static unsigned int Bit_Pattern
+ (char ch);
+static int By_String_Num_Then_Pos
+ (const void * a, const void * b);
+static void Check_IDs
+ (void);
+static void Find_Fwd_Overlaps
+ (const vector <char *> & string_list,
+ hash_map <unsigned int, Hash_Entry_t> & ht,
+ const vector <ID_t> & id_list, BankStream_t & overlap_bank);
+static void Find_Rev_Overlaps
+ (vector <char *> & string_list,
+ hash_map <unsigned int, Hash_Entry_t> & ht,
+ const vector <ID_t> & id_list, BankStream_t & overlap_bank);
+static void Get_Strings_From_Bank
+ (vector <char *> & s, vector <char *> & q,
+ vector <Range_t> & clr_list, vector <ID_t> & id_list,
+ vector <char *> & tag_list, BankStream_t & read_bank);
+static void Get_Strings_From_Bank_ByID
+ (vector <char *> & s, vector <char *> & q,
+ vector <Range_t> & clr_list, vector <ID_t> & id_list,
+ vector <char *> & tag_list, Bank_t & read_bank, vector <ID_t> & sel_list);
+static void Get_Strings_From_Bank_ByEID
+ (vector <char *> & s, vector <char *> & q,
+ vector <Range_t> & clr_list, vector <ID_t> & id_list,
+ vector <char *> & tag_list, Bank_t & read_bank, vector <string> & sel_list);
+static void Map_Minimizers
+ (const vector <char *> & string_list,
+ hash_map <unsigned int, Hash_Entry_t> & ht);
+static void Merge_Overlapping_Bands
+ (Offset_Entry_t & oe, int rad);
+static void Output
+ (ostream & os, BankStream_t & overlap_bank, const Simple_Overlap_t & olap);
+static void Parse_Command_Line
+ (int argc, char * argv []);
+static void Read_Fasta_Strings
+ (vector <char *> & s, vector <ID_t> & id_list,
+ vector <char *> & tag_list, const string & fn);
+static void Shift_In
+ (unsigned int & u, char ch, unsigned int mask = UINT_MAX);
+static void Usage
+ (const char * command);
+
+#endif
+
+
diff --git a/src/Align/kmer-count.cc b/src/Align/kmer-count.cc
new file mode 100644
index 0000000..da3a634
--- /dev/null
+++ b/src/Align/kmer-count.cc
@@ -0,0 +1,162 @@
+// A. L. Delcher
+//
+// File: kmer-count.cc
+//
+// Last Modified: 22 March 2004
+//
+// For the kmer specified on the command line, count
+// how many times it occurs in the multifasta file
+// read from stdin .
+
+
+#include "delcher.hh"
+#include "fasta.hh"
+#include <string>
+#include <vector>
+using namespace std;
+
+
+#define DEBUG 0
+
+
+const int MAX_LINE = 1000;
+
+
+static char * Kmer;
+ // The kmer on the command line
+
+
+static void Parse_Command_Line
+ (int argc, char * argv []);
+static void Usage
+ (const char * command);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ char * rev_kmer;
+ string s, tag;
+ bool is_palindrome;
+ int match_ct = 0, total_mers = 0;
+ int i, kmer_len;
+
+ Parse_Command_Line (argc, argv);
+
+ kmer_len = strlen (Kmer);
+ for (i = 0; i < kmer_len; i ++)
+ Kmer [i] = tolower (Kmer [i]);
+ rev_kmer = strdup (Kmer);
+ Reverse_Complement (rev_kmer);
+
+ is_palindrome = (strcmp (Kmer, rev_kmer) == 0);
+
+ while (Fasta_Read (stdin, s, tag))
+ {
+ const char * p, * sp;
+ int n = s . length ();
+
+ for (i = 0; i < n; i ++)
+ s [i] = tolower (s [i]);
+
+ sp = s . c_str ();
+
+ for (p = strstr (sp, Kmer); p != NULL; p = strstr (p + 1, Kmer))
+ match_ct ++;
+
+ if (! is_palindrome)
+ {
+ for (p = strstr (sp, rev_kmer); p != NULL; p = strstr (p + 1, rev_kmer))
+ match_ct ++;
+ }
+
+ if (n >= kmer_len)
+ total_mers += 1 + n - kmer_len;
+ }
+
+ printf ("Kmer = %s\n", Kmer);
+ if (is_palindrome)
+ printf (" is palindrome\n");
+ else
+ printf ("Rev_Comp Kmer = %s", rev_kmer);
+ printf ("Matches = %d\n", match_ct);
+ printf ("Total mers = %d\n", total_mers);
+ if (match_ct > 0)
+ printf ("One match every %.1f mers\n", double (total_mers) / match_ct);
+
+ return 0;
+ }
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = false;
+ int ch;
+
+ optarg = NULL;
+
+ while (! errflg && ((ch = getopt (argc, argv, "h")) != EOF))
+ switch (ch)
+ {
+ case 'h' :
+ errflg = true;
+ break;
+
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+
+ default :
+ errflg = true;
+ }
+
+ if (errflg)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (optind > argc - 1)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ Kmer = argv [optind ++];
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "USAGE: kmer-cov <kmer>\n"
+ "\n"
+ "For the kmer specified on the command line, count\n"
+ "how many times it occurs in the multifasta file\n"
+ "read from stdin .\n"
+ "\n"
+ "Options:\n"
+ " -h Print this usage message\n"
+ "\n");
+
+ return;
+ }
+
+
+
diff --git a/src/Align/kmer-cov-plot.cc b/src/Align/kmer-cov-plot.cc
new file mode 100644
index 0000000..746c2c6
--- /dev/null
+++ b/src/Align/kmer-cov-plot.cc
@@ -0,0 +1,377 @@
+// A. L. Delcher
+//
+// File: kmer-cov.cc
+//
+// Last Modified: 22 March 2004
+//
+
+#include "foundation_AMOS.hh"
+#include "delcher.hh"
+#include "fasta.hh"
+
+#include <string>
+#include <vector>
+using namespace std;
+using namespace HASHMAP;
+
+
+#define DEBUG 0
+
+bool OPT_DisplayKmers = false;
+
+
+const int MAX_LINE = 1000;
+typedef long long unsigned Mer_t;
+
+typedef hash_map<Mer_t, unsigned int, hash<unsigned long> > MerTable_t;
+
+
+static Mer_t Filled_Mask = Mer_t (1) << (8 * sizeof (Mer_t) - 1);
+static Mer_t Extract_Mask = 0;
+static Mer_t Forward_Mask;
+static int Kmer_Len = 0;
+static string Kmer_File_Name;
+ // Name of file kmers
+
+static unsigned Char_To_Binary (char ch);
+static void Fasta_To_Binary (const string & s, Mer_t & mer);
+static void Forward_Add_Ch (Mer_t & mer, char ch);
+static void Reverse_Add_Ch (Mer_t & mer, char ch);
+static void Parse_Command_Line (int argc, char * argv []);
+static void Print_Mer_Coverage (const string & s, double & percent_covered);
+static void Read_Mers (const char * fname, MerTable_t & mer_table);
+static void Usage (const char * command);
+static void Compute_Mer_Coverage (const string & s, const MerTable_t & mer_table);
+static char BinaryToAscii(char b);
+static void MerToAscii(Mer_t mer, string & s);
+
+
+
+
+int main (int argc, char * argv [])
+{
+ FILE * unique_fp, * repeat_fp, * unsure_fp;
+ MerTable_t mer_table;
+
+ string s, tag;
+
+ Parse_Command_Line (argc, argv);
+
+ cerr << "Loading mer counts... ";
+ Read_Mers (Kmer_File_Name . c_str (), mer_table);
+ cerr << mer_table.size() << " mers loaded" << endl;
+
+ cerr << "Processing sequence... ";
+
+ int count = 0;
+
+ while (Fasta_Read (stdin, s, tag))
+ {
+ printf (">%s\n", tag . c_str ());
+ Compute_Mer_Coverage(s, mer_table);
+ count++;
+ }
+
+ cerr << count << " sequences processed" << endl;
+
+ return 0;
+}
+
+static char BinaryToAscii(char b)
+{
+ switch(b)
+ {
+ case 0: return 'A';
+ case 1: return 'C';
+ case 2: return 'G';
+ case 3: return 'T';
+ }
+
+ return '*';
+}
+
+static void MerToAscii(Mer_t mer, string & s)
+{
+ s.erase();
+
+ for (int i = 0; i < Kmer_Len; i++)
+ {
+ char a = BinaryToAscii(mer & 0x3);
+ mer >>= 2;
+
+ s.append(1, a);
+ }
+
+ reverse(s.begin(), s.end());
+}
+
+
+
+static unsigned Char_To_Binary
+ (char ch)
+
+// Return the binary equivalent of ch .
+
+ {
+ switch (tolower (ch))
+ {
+ case 'a' :
+ case 'n' :
+ default:
+ return 0;
+ case 'c' :
+ return 1;
+ case 'g' :
+ return 2;
+ case 't' :
+ return 3;
+ /*
+ default :
+ sprintf (Clean_Exit_Msg_Line, "Bad char = %c (ASCII %u) in Char_To_Binary",
+ ch, unsigned (ch));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ */
+ }
+ return 0;
+ }
+
+
+
+static void Fasta_To_Binary
+ (const string & s, Mer_t & mer)
+
+// Convert string s to its binary equivalent in mer .
+
+ {
+ int i, n;
+
+ n = s . length ();
+ mer = 0;
+ for (i = 0; i < n; i ++)
+ {
+ mer <<= 2;
+ mer |= Char_To_Binary (s [i]);
+ }
+
+ return;
+ }
+
+
+
+static void Forward_Add_Ch
+ (Mer_t & mer, char ch)
+
+// Add ch to mer on the right, sliding one character
+// off the left end of mer .
+
+ {
+ mer &= Forward_Mask;
+ mer <<= 2;
+ mer |= Char_To_Binary (ch);
+
+ return;
+ }
+
+
+
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = false;
+ int ch;
+
+ optarg = NULL;
+
+ while (! errflg && ((ch = getopt (argc, argv, "hK")) != EOF))
+ switch (ch)
+ {
+
+ case 'K' : OPT_DisplayKmers = true; break;
+
+ case 'h' :
+ errflg = true;
+ break;
+
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+
+ default :
+ errflg = true;
+ }
+
+ if (errflg)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (optind > argc - 1)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ Kmer_File_Name = argv [optind ++];
+
+ return;
+ }
+
+
+
+static void Compute_Mer_Coverage (const string & s, const MerTable_t & mer_table)
+{
+ Mer_t fwd_mer = 0, rev_mer = 0;
+ int i, j, n;
+
+ n = s . length ();
+
+ if (n < Kmer_Len)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ printf("%d 0 0\n", i);
+ }
+
+ return;
+ }
+
+ for (i = 0; i < Kmer_Len - 1; i ++)
+ {
+ Forward_Add_Ch (fwd_mer, s [i]);
+ Reverse_Add_Ch (rev_mer, s [i]);
+ }
+
+ string fmer, rmer;
+ MerTable_t::const_iterator fi, ri;
+ unsigned int fcount = 0;
+ unsigned int rcount = 0;
+
+ for (j = 0; i < n; i ++, j ++)
+ {
+ Forward_Add_Ch (fwd_mer, s [i]);
+ Reverse_Add_Ch (rev_mer, s [i]);
+
+ fcount = 0;
+ rcount = 0;
+
+ fi = mer_table.find(fwd_mer);
+ ri = mer_table.find(rev_mer);
+
+ if (fi != mer_table.end()) { fcount = fi->second; }
+ if (ri != mer_table.end()) { rcount = ri->second; }
+
+ unsigned int mcount = (fcount > rcount) ? fcount : rcount;
+
+ if (OPT_DisplayKmers)
+ {
+ MerToAscii(fwd_mer, fmer);
+ MerToAscii(rev_mer, rmer);
+
+ printf("%d\t%d\t%d\t%d\t%s\t%s\n",
+ i-Kmer_Len+1, mcount, fcount, rcount,
+ fmer.c_str(), rmer.c_str());
+ }
+ else
+ {
+ printf("%d\t%d\t%d\t%d\n",
+ i-Kmer_Len+1, mcount, fcount, rcount);
+ }
+ }
+
+ return;
+}
+
+
+
+static void Read_Mers (const char * fname, MerTable_t & mer_table)
+
+// Read kmers from file name fname and save them
+// in binary form in mer_list . Input format is
+// a multi-fasta file. Mers are assumed to contain only
+// ACGT's
+
+{
+ FILE * fp;
+ string s, tag;
+ Mer_t mer;
+
+ fp = File_Open (fname, "r", __FILE__, __LINE__);
+
+ mer_table . clear ();
+
+ while (Fasta_Read (fp, s, tag))
+ {
+ unsigned int mercount = atol(tag.c_str());
+
+ if (Kmer_Len == 0)
+ {
+ Kmer_Len = s . length ();
+ }
+ else if (Kmer_Len != int (s . length ()))
+ {
+ sprintf (Clean_Exit_Msg_Line, "New kmer \"%s\" length is %d instead of %d",
+ s . c_str (), s . length (), Kmer_Len);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ Fasta_To_Binary (s, mer);
+
+ // MerToAscii(mer, tag);
+ // fprintf(stderr, "orig: %s mer: %032llx asc: %s\n", s.c_str(), mer, tag.c_str());
+
+ mer_table.insert(make_pair(mer, mercount));
+ }
+
+ Forward_Mask = ((long long unsigned) 1 << (2 * Kmer_Len - 2)) - 1;
+
+ return;
+}
+
+
+
+static void Reverse_Add_Ch
+ (Mer_t & mer, char ch)
+
+// Add the Watson-Crick complement of ch to mer on the left,
+// sliding one character off the right end of mer .
+
+ {
+ mer >>= 2;
+ mer |= ((long long unsigned) (3 ^ Char_To_Binary (ch)) << (2 * Kmer_Len - 2));
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "USAGE: kmer-cov-plot <kmer-file>\n"
+ "\n"
+ "Read a list of short kmers (31 bases or less) from <kmer-file>\n"
+ "and a fasta file on stdin and print the kmer coverage at each \n"
+ "position (prints max (forkmercov, revkmercov))\n"
+ "\n"
+ "Options:\n"
+ " -h Print this usage message\n"
+ " -K Display the actual kmer in addtion to the counts\n"
+ "\n");
+
+ return;
+ }
+
+
+
diff --git a/src/Align/kmer-cov.cc b/src/Align/kmer-cov.cc
new file mode 100644
index 0000000..a705195
--- /dev/null
+++ b/src/Align/kmer-cov.cc
@@ -0,0 +1,546 @@
+// A. L. Delcher
+//
+// File: kmer-cov.cc
+//
+// Last Modified: 22 March 2004
+//
+// Read a list of short kmers (31 bases or less) and then
+// compute what regions of the fasta sequences read from
+// stdin are covered by them (or their reverse complement).
+
+
+#include "delcher.hh"
+#include "fasta.hh"
+#include <string>
+#include <vector>
+using namespace std;
+
+
+#define DEBUG 0
+
+
+const int MAX_LINE = 1000;
+const double DEFAULT_UNIQUE_CUTOFF = 50.0;
+ // Default value for global Unique_Cutoff
+const double DEFAULT_REPEAT_CUTOFF = 90.0;
+ // Default value for global Repeat_Cutoff
+
+typedef long long unsigned Mer_t;
+
+bool OPT_Features = false;
+bool OPT_AllowAmbiguity = false;
+int MIN_LEN = 0;
+
+
+static Mer_t Filled_Mask = Mer_t (1) << (8 * sizeof (Mer_t) - 1);
+static Mer_t Extract_Mask = 0;
+static Mer_t Forward_Mask;
+static Mer_t Hash_Mask;
+static int Hash_Shift = 0;
+static Mer_t * Hash_Table = NULL;
+static int Hash_Table_Size = 0;
+static int Kmer_Len = 0;
+static string Kmer_File_Name;
+ // Name of file kmers
+static bool Make_Fasta = false;
+ // If set true by the -f option, also generate fasta files
+ // of sequences that are unique, repeat and unsure.
+static double Repeat_Cutoff = DEFAULT_REPEAT_CUTOFF;
+ // Strings covered >= this percent are classified repeat
+ // Inbetween is unsure.
+static double Unique_Cutoff = DEFAULT_UNIQUE_CUTOFF;
+ // Strings covered < this percent are classified unique
+
+
+static void Build_Hash_Table
+ (const vector <Mer_t> & mer_list);
+static unsigned Char_To_Binary
+ (char ch);
+static void Fasta_To_Binary
+ (const string & s, Mer_t & mer);
+static void Forward_Add_Ch
+ (Mer_t & mer, char ch);
+static void Reverse_Add_Ch
+ (Mer_t & mer, char ch);
+static int Hash
+ (Mer_t mer);
+static bool Hash_Find
+ (Mer_t mer);
+static void Hash_Insert
+ (Mer_t mer);
+static void Parse_Command_Line
+ (int argc, char * argv []);
+static void Print_Mer_Coverage
+ (const string & tag, const string & s, double & percent_covered);
+static void Read_Mers
+ (const char * fname, vector <Mer_t> & mer_list);
+static void Usage
+ (const char * command);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ FILE * unique_fp, * repeat_fp, * unsure_fp;
+ vector <Mer_t> mer_list;
+ string s, tag;
+ int n;
+
+ Parse_Command_Line (argc, argv);
+
+ fprintf (stderr, "Repeat_Cutoff set to %.2f%%\n", Repeat_Cutoff);
+ fprintf (stderr, "Unique_Cutoff set to %.2f%%\n", Unique_Cutoff);
+
+ Read_Mers (Kmer_File_Name . c_str (), mer_list);
+
+ n = mer_list . size ();
+
+ Build_Hash_Table (mer_list);
+
+#if DEBUG
+{
+ int i;
+
+ printf ("Kmer_Len = %d Hash_Table_Size = %d Hash_Shift = %d\n",
+ Kmer_Len, Hash_Table_Size, Hash_Shift);
+ for (i = 0; i < n; i ++)
+ printf ("%15llo %8d\n", mer_list [i], Hash (mer_list [i]));
+}
+#endif
+
+ Forward_Mask = ((long long unsigned) 1 << (2 * Kmer_Len - 2)) - 1;
+ Extract_Mask = ((long long unsigned) 1 << (2 * Kmer_Len)) - 1;
+
+#if DEBUG
+{
+ printf ("Forward_Mask = %15llo\n", Forward_Mask);
+ printf ("Extract_Mask = %15llo\n", Extract_Mask);
+}
+#endif
+
+ if (Make_Fasta)
+ {
+ unique_fp = File_Open ("unique.cov.fasta", "w", __FILE__, __LINE__);
+ repeat_fp = File_Open ("repeat.cov.fasta", "w", __FILE__, __LINE__);
+ unsure_fp = File_Open ("unsure.cov.fasta", "w", __FILE__, __LINE__);
+ }
+
+ while (Fasta_Read (stdin, s, tag))
+ {
+ FILE * fp;
+ double percent_covered;
+
+ if (!OPT_Features) { printf (">%s\n", tag . c_str ()); }
+ Print_Mer_Coverage (tag, s, percent_covered);
+
+ if (Make_Fasta)
+ {
+ if (percent_covered < Unique_Cutoff)
+ fp = unique_fp;
+ else if (percent_covered >= Repeat_Cutoff)
+ fp = repeat_fp;
+ else
+ fp = unsure_fp;
+ fprintf (fp, ">%s\n", tag . c_str ());
+ Fasta_Print (fp, s . c_str ());
+ }
+ }
+
+ if (Make_Fasta)
+ {
+ fclose (unique_fp);
+ fclose (repeat_fp);
+ fclose (unsure_fp);
+ }
+
+ return 0;
+ }
+
+
+
+static void Build_Hash_Table
+ (const vector <Mer_t> & mer_list)
+
+// Add entries in mer_list to the global
+// Hash_Table .
+
+ {
+ int i, n;
+
+ n = mer_list . size ();
+ Hash_Shift = 1;
+ for (i = 2; i < 3 * n; i *= 2)
+ Hash_Shift ++;
+ Hash_Table_Size = i;
+ Hash_Mask = Hash_Table_Size - 1;
+
+ Hash_Table = (Mer_t *) Safe_calloc (Hash_Table_Size, sizeof (Mer_t),
+ __FILE__, __LINE__);
+ for (i = 0; i < n; i ++)
+ Hash_Insert (mer_list [i]);
+
+ return;
+ }
+
+
+
+static unsigned Char_To_Binary
+ (char ch)
+
+// Return the binary equivalent of ch .
+
+ {
+ switch (tolower (ch))
+ {
+ case 'a' :
+ case 'n' : return 0;
+ case 'c' : return 1;
+ case 'g' : return 2;
+ case 't' : return 3;
+
+ default :
+ if (OPT_AllowAmbiguity) { return 0; }
+ sprintf (Clean_Exit_Msg_Line, "Bad char = %c (ASCII %u) in Char_To_Binary",
+ ch, unsigned (ch));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ return 0;
+ }
+
+
+
+static void Fasta_To_Binary
+ (const string & s, Mer_t & mer)
+
+// Convert string s to its binary equivalent in mer .
+
+ {
+ int i, n;
+
+ n = s . length ();
+ mer = 0;
+ for (i = 0; i < n; i ++)
+ {
+ mer <<= 2;
+ mer |= Char_To_Binary (s [i]);
+ }
+
+ return;
+ }
+
+
+
+static void Forward_Add_Ch
+ (Mer_t & mer, char ch)
+
+// Add ch to mer on the right, sliding one character
+// off the left end of mer .
+
+ {
+ mer &= Forward_Mask;
+ mer <<= 2;
+ mer |= Char_To_Binary (ch);
+
+ return;
+ }
+
+
+
+static int Hash
+ (Mer_t mer)
+
+// Convert mer to a subscript in the global Hash_Table .
+
+ {
+ unsigned result = 0;
+
+ while (mer > 0)
+ {
+ result ^= mer & Hash_Mask;
+ mer >>= Hash_Shift;
+ }
+
+ return int (result);
+ }
+
+
+
+static bool Hash_Find
+ (Mer_t mer)
+
+// Return true iff mer occurs in the global Hash_Table .
+
+ {
+ int i;
+
+ i = Hash (mer);
+
+ while (Hash_Table [i] & Filled_Mask)
+ {
+ if ((Hash_Table [i] & Extract_Mask) == mer)
+ return true;
+ i ++;
+ if (i == Hash_Table_Size)
+ i = 0;
+ }
+
+ return false;
+ }
+
+
+
+static void Hash_Insert
+ (Mer_t mer)
+
+// Insert mer into the global Hash_Table .
+
+ {
+ int i;
+
+ i = Hash (mer);
+
+ while (Hash_Table [i] & Filled_Mask)
+ {
+ i ++;
+ if (i == Hash_Table_Size)
+ i = 0;
+ }
+
+ Hash_Table [i] = (mer | Filled_Mask);
+
+ return;
+ }
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = false;
+ int ch;
+
+ optarg = NULL;
+
+ while (! errflg && ((ch = getopt (argc, argv, "Afhr:u:FL:")) != EOF))
+ switch (ch)
+ {
+ case 'A' : OPT_AllowAmbiguity = true; break;
+ case 'f' : Make_Fasta = true; break;
+ case 'F' : OPT_Features = true; break;
+ case 'h' : errflg = true; break;
+ case 'r' : Repeat_Cutoff = strtod (optarg, NULL); break;
+ case 'u' : Unique_Cutoff = strtod (optarg, NULL); break;
+ case 'L' : MIN_LEN = atoi(optarg); break;
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+
+ default :
+ errflg = true;
+ }
+
+ if (errflg)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (optind > argc - 1)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ Kmer_File_Name = argv [optind ++];
+
+ return;
+ }
+
+
+
+static void Print_Mer_Coverage
+ (const string & tag, const string & s, double & percent_covered)
+
+// Print regions in string s that are covered
+// by mers (or their reverse-complements) in
+// the global hash table. Set percent_covered to
+// the percentage of the entire read covered by the mers
+
+ {
+ Mer_t fwd_mer = 0, rev_mer = 0;
+ int lo, hi, total = 0;
+ int i, j, n;
+
+ n = s . length ();
+
+ if (n < Kmer_Len)
+ {
+ percent_covered = 0.0;
+ if (!OPT_Features)
+ {
+ printf ("Total %d of %d (%.1f%%)\n", 0, n, Percent (0, n));
+ }
+ return;
+ }
+
+ for (i = 0; i < Kmer_Len - 1; i ++)
+ {
+ Forward_Add_Ch (fwd_mer, s [i]);
+ Reverse_Add_Ch (rev_mer, s [i]);
+ }
+
+ lo = 0;
+ hi = -1;
+ for (j = 0; i < n; i ++, j ++)
+ {
+ Forward_Add_Ch (fwd_mer, s [i]);
+ Reverse_Add_Ch (rev_mer, s [i]);
+
+#if DEBUG
+{
+ printf ("%4d %c %15llo %15llo %c %c\n",
+ i, s [i], fwd_mer, rev_mer,
+ Hash_Find (fwd_mer) ? 'T' : 'F',
+ Hash_Find (rev_mer) ? 'T' : 'F');
+}
+#endif
+
+ if (Hash_Find (fwd_mer) || Hash_Find (rev_mer))
+ {
+ if (hi < j)
+ {
+ if (hi > 0)
+ {
+ if (OPT_Features)
+ {
+ if (hi-lo > MIN_LEN)
+ {
+ printf("%s K %d %d KMER_COV %d\n", tag.c_str(), lo, hi, hi-lo);
+ }
+ }
+ else
+ {
+ printf ("%8d %8d %8d\n", lo, hi, hi - lo);
+ }
+ total += hi - lo;
+ }
+ lo = j;
+ }
+ hi = i + 1;
+ }
+ }
+
+ if (hi > 0)
+ {
+ total += hi - lo;
+ if (OPT_Features)
+ {
+ if (hi-lo > MIN_LEN)
+ {
+ printf("%s K %d %d KMER_COV %d\n", tag.c_str(), lo, hi, hi-lo);
+ }
+ }
+ else
+ {
+ printf ("%8d %8d %8d\n", lo, hi, hi - lo);
+ }
+ }
+
+ percent_covered = Percent (total, n);
+ if (!OPT_Features)
+ {
+ printf ("Total %d of %d (%.1f%%)\n", total, n, percent_covered);
+ }
+
+ return;
+ }
+
+
+
+static void Read_Mers
+ (const char * fname, vector <Mer_t> & mer_list)
+
+// Read kmers from file name fname and save them
+// in binary form in mer_list . Input format is
+// a multi-fasta file. Mers are assumed to contain only
+// ACGT's
+
+ {
+ FILE * fp;
+ string s, tag;
+ Mer_t mer;
+
+ fp = File_Open (fname, "r", __FILE__, __LINE__);
+
+ mer_list . clear ();
+
+ while (Fasta_Read (fp, s, tag))
+ {
+ if (Kmer_Len == 0)
+ Kmer_Len = s . length ();
+ else if (Kmer_Len != int (s . length ()))
+ {
+ sprintf (Clean_Exit_Msg_Line, "New kmer \"%s\" length is %d instead of %d",
+ s . c_str (), s . length (), Kmer_Len);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ Fasta_To_Binary (s, mer);
+ mer_list . push_back (mer);
+ }
+
+ return;
+ }
+
+
+
+static void Reverse_Add_Ch
+ (Mer_t & mer, char ch)
+
+// Add the Watson-Crick complement of ch to mer on the left,
+// sliding one character off the right end of mer .
+
+ {
+ mer >>= 2;
+ mer |= ((long long unsigned) (3 ^ Char_To_Binary (ch)) << (2 * Kmer_Len - 2));
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "USAGE: kmer-cov <kmer-file>\n"
+ "\n"
+ "Read a list of short kmers (31 bases or less) from <kmer-file>\n"
+ "and then compute what regions of the fasta sequences read from\n"
+ "stdin are covered by them (or their reverse complement).\n"
+ "\n"
+ "Options:\n"
+ " -F Output regions as Features\n"
+ " -L <len> Min Length to report as a feature\n"
+ " -A Allow Ambiguity Codes (treated as A's)\n"
+ "\n"
+ " -f Output unique/repeat/unsure fasta sequences\n"
+ " -h Print this usage message\n"
+ " -r <x> Repeats are > <x>%% covered by kmers\n"
+ " -u <x> Uniques are <= <x>%% covered by kmers\n"
+ "\n");
+
+ return;
+ }
+
+
+
diff --git a/src/Align/make-consensus.cc b/src/Align/make-consensus.cc
new file mode 100644
index 0000000..cf6fe13
--- /dev/null
+++ b/src/Align/make-consensus.cc
@@ -0,0 +1,1321 @@
+// A. L. Delcher
+//
+// File: make-consensus.cc
+//
+// Last Modified: 19 February 2008
+//
+// Read layout information for reads in unitigs/contigs and create
+// multialignments and/or consensus sequences for them.
+
+
+#include "foundation_AMOS.hh"
+#include "delcher.hh"
+#include "CelMsg.hh"
+#include "align.hh"
+#include "prob.hh"
+#include "fasta.hh"
+#include <iostream>
+#include <vector>
+#include <string>
+#include <algorithm>
+#include <fstream>
+
+
+using namespace std;
+using namespace AMOS;
+
+const int DEFAULT_ALIGN_WIGGLE = 15;
+ // Number of positions left and right of specified location
+ // to look for alignments.
+const double DEFAULT_ERROR_RATE = 0.06;
+const int DEFAULT_MIN_OVERLAP = 5;
+const int MAX_LINE = 1000;
+const int NEW_SIZE = 1000;
+
+
+enum Input_Format_t
+{ PARTIAL_READ_INPUT, SIMPLE_CONTIG_INPUT, CELERA_MSG_INPUT, BANK_INPUT };
+enum Output_Format_t
+{ MULTI_ALIGN_OUTPUT, ONLY_FASTA_OUTPUT, CELERA_MSG_OUTPUT,
+ TIGR_CONTIG_OUTPUT, AMOS_OUTPUT, BANK_OUTPUT
+};
+
+
+static int Align_Wiggle = DEFAULT_ALIGN_WIGGLE;
+ // Change made by Daniela Puiu 01/03/2008
+ // new input parameter -w to specify the alignment wiggle
+ // default value 15; use a smaller value for Solexa data
+static bool Allow_Expels = false;
+ // If set true (by -x option) then allow reads with poor alignments to
+ // be expelled from multialignments
+static string Bank_Name;
+ // Name of read bank from which reads are obtained
+static bool Use_SeqNames = false;
+ //AMP// If set true, will use comment filed in the readbank for seq tags
+static bool Do_Contig_Messages = false;
+ // If set true (by -c option) then contig messages in the
+ // input will be processed
+static bool Do_Unitig_Messages = false;
+ // If set true (by -u option) then unitig messages in the
+ // input will be processed
+static double Error_Rate = DEFAULT_ERROR_RATE;
+ // Fraction of errors allowed in alignments
+static FILE * Expel_fp = NULL;
+ // Pointer to file where expelled reads are output
+static FILE *Extra_fp = NULL;
+ // Pointer to file of extra fasta sequences to align
+static Input_Format_t Input_Format = SIMPLE_CONTIG_INPUT;
+ // Type of input
+static int Min_Overlap = DEFAULT_MIN_OVERLAP;
+ // Minimum number of bases strings in multialignment must overlap
+static Output_Format_t Output_Format = CELERA_MSG_OUTPUT;
+ // Type of output to produce
+static string Tig_File_Name;
+ // Name of file containing input contig/unitig messages
+static bool byIID = false;
+ // Layouts to be processed listed by IID
+static ifstream IID_fp;
+ // Pointer to file of IIDs
+static bool byEID = false;
+ // Layouts to be processed listed by EID
+static ifstream EID_fp;
+ // Pointer to file of EIDs
+
+
+static bool USE_LayoutClear = false; // TODO: Fix AMOScmp, then this will be true
+
+
+static bool By_Lo_Position
+ (const Celera_IMP_Sub_Msg_t & a, const Celera_IMP_Sub_Msg_t & b);
+static void Get_Strings_And_Offsets
+ (vector < char *>&s, vector < char *>&q, vector < Range_t > &clr_list,
+ vector < char *>&tag_list, vector < int >&offset,
+ const Celera_Message_t & msg, Bank_t & read_bank);
+static void Get_Strings_And_Offsets
+ (vector < char *>&s, vector < char *>&q, vector < Range_t > &clr_list,
+ vector < char *>&tag_list, vector < int >&offset, vector < int >&fid,
+ vector < Ordered_Range_t > &pos, vector < Ordered_Range_t > &seg,
+ Bank_t & read_bank);
+static void Get_Strings_And_Offsets
+ (vector < char *>&s, vector < char *>&q, vector < Range_t > &clr_list,
+ vector < char *>&tag_list, vector < int >&offset, Layout_t & layout,
+ vector < int >&fid, vector < Ordered_Range_t > &pos, Bank_t & read_bank);
+static void Output_Unit
+ (const string & label, const string & id, int num_reads,
+ Gapped_Multi_Alignment_t & gma, Celera_Message_t & msg,
+ const vector < char *>&string_list,
+ const vector < char *>&qual_list, const vector < Range_t > &clr_list,
+ const vector < char *>tag_list, BankStream_t & bank);
+static void Parse_Command_Line (int argc, char *argv[]);
+static void Sort_By_Low_Pos
+ (vector < int >&fid, vector < Ordered_Range_t > &pos,
+ vector < Ordered_Range_t > &seg);
+static void Usage (const char *command);
+static void readIIDFile (ifstream & f, list < ID_t > &l);
+static void readEIDFile (ifstream & f, list < string > &l);
+
+
+
+int main (int argc, char *argv[])
+{
+ Bank_t read_bank (Read_t::NCODE);
+ BankStream_t contig_bank (Contig_t::NCODE);
+ BankStream_t layout_bank (Layout_t::NCODE);
+ Celera_Message_t msg;
+ Read_t read;
+ FILE *input_fp;
+ string label = "Contig";
+ string cid;
+ vector < char *>string_list, qual_list;
+ vector < char *>tag_list;
+ vector < int >offset;
+ vector < int >ref;
+ vector < Range_t > pos, clr_list;
+ vector < vector < int > >del_list;
+ Gapped_Multi_Alignment_t gma;
+ time_t now;
+ iostream::fmtflags status;
+ int contig_ct, unitig_ct;
+ list < string > eid_list; // if layouts selected by eid
+ list < ID_t > iid_list; // if layouts selected by iid
+
+ try
+ {
+ now = time (NULL);
+ cerr << "Starting on " << ctime (&now) << endl;
+
+ Verbose = 0;
+
+ Parse_Command_Line (argc, argv);
+
+ cerr << "Read bank is " << Bank_Name << endl;
+ status = cerr.setf (ios::fixed);
+ cerr << "Alignment error rate is " << setprecision (2)
+ << Error_Rate << endl;
+ cerr.setf (status);
+ cerr << "Minimum overlap bases is " << Min_Overlap << endl;
+
+ if (Output_Format == BANK_OUTPUT)
+ {
+ cerr << "Output will be written to the bank" << endl;
+ if (!contig_bank.exists (Bank_Name))
+ contig_bank.create (Bank_Name);
+ else
+ contig_bank.open (Bank_Name);
+ }
+
+ if (byIID)
+ {
+ cerr << "Will only process IIDs in file specified by option -i\n";
+
+ readIIDFile (IID_fp, iid_list);
+ cerr << "List size: " << iid_list.size() << endl;
+
+ IID_fp.close ();
+ }
+
+ if (byEID)
+ {
+ cerr << "Will only process EIDs in file specified by option -n\n";
+ readEIDFile (EID_fp, eid_list);
+ EID_fp.close ();
+ }
+
+ gma.setPrintFlag (PRINT_WITH_DIFFS);
+
+ if (Input_Format == CELERA_MSG_INPUT)
+ {
+ cerr << "Processing ";
+ if (Do_Contig_Messages)
+ cerr << "contig";
+ else
+ {
+ cerr << "unitig";
+ label = "Unitig";
+ }
+ cerr << " messages from file " << Tig_File_Name << endl;
+
+ input_fp = File_Open (Tig_File_Name.c_str (), "r");
+ read_bank.open (Bank_Name, B_READ);
+
+ unitig_ct = contig_ct = 0;
+ while (msg.read (input_fp))
+ {
+ if (msg.getMsgType () == IUM_MSG && Do_Unitig_Messages)
+ {
+ cerr << "Process unitig " << msg.getAccession () << endl;
+ Get_Strings_And_Offsets
+ (string_list, qual_list, clr_list, tag_list, offset,
+ msg, read_bank);
+
+ try
+ {
+ cid = msg.getAccession ();
+ Multi_Align
+ (cid, string_list, offset, Align_Wiggle, Error_Rate,
+ Min_Overlap, gma, &ref, &tag_list, Allow_Expels);
+ }
+ catch (AlignmentException_t)
+ {
+ cerr << "Failed on unitig " << msg.getAccession () << endl;
+ throw;
+ }
+
+ Permute (qual_list, ref);
+ Permute (clr_list, ref);
+
+ gma.Set_Flipped (clr_list);
+ gma.Get_Positions (pos);
+ gma.Extract_IMP_Dels (del_list);
+ msg.Update_IMPs (pos, ref, del_list);
+ if (Allow_Expels)
+ msg . Remove_Empty_IMPs ();
+
+ Output_Unit (label, msg.getAccession (),
+ msg.getNumFrags (), gma, msg, string_list,
+ qual_list, clr_list, tag_list, contig_bank);
+
+ unitig_ct++;
+ }
+ if (msg.getMsgType () == ICM_MSG && Do_Contig_Messages)
+ {
+ contig_ct++;
+ }
+ }
+ if (Do_Unitig_Messages)
+ cerr << unitig_ct << " IUM messages processed" << endl;
+ if (Do_Contig_Messages)
+ cerr << contig_ct << " ICM messages processed" << endl;
+ } // end of celera input
+ else if (Input_Format == BANK_INPUT)
+ {
+ ID_t layout_id = 0; // we'll have to number the contigs ourselves
+ Layout_t layout;
+ vector < Ordered_Range_t > pos_list;
+ vector < int >frg_id_list;
+ list < string >::iterator eidi = eid_list.begin ();
+ list < ID_t >::iterator iidi = iid_list.begin ();
+
+ cerr << "Input is being read from the bank " << endl;
+
+ read_bank.open (Bank_Name, B_READ);
+
+ layout_bank.open (Bank_Name);
+
+ msg.setType (IUM_MSG);
+ msg.setStatus (UNASSIGNED_UNITIG);
+
+ while (true)
+ {
+ char sid[256];
+
+ if (byIID)
+ {
+ if (iidi == iid_list.end ())
+ {
+ break;
+ }
+
+ if (!layout_bank.existsIID (*iidi))
+ {
+ cerr << "IID " << *iidi << " does not exist *** !\n";
+ exit (1);
+ }
+ layout_bank.fetch (*iidi, layout);
+ iidi++;
+ }
+ else if (byEID)
+ {
+ if (eidi == eid_list.end ())
+ break;
+ if (!layout_bank.existsEID (*eidi))
+ {
+ cerr << "EID " << *eidi << " does not exist!\n";
+ exit (1);
+ }
+ layout_bank.fetch (*eidi, layout);
+ eidi++;
+ }
+ else
+ {
+ layout_bank >> layout;
+ if (layout_bank.eof ())
+ break;
+ }
+
+ sprintf (sid, "%ld", ++layout_id);
+ cid = string (sid);
+ ID_t lid = layout.getIID ();
+ if (lid == 0)
+ {
+ lid = layout_id;
+ }
+
+ if (Verbose >= 2)
+ cerr << "Processing layout: " << cid << endl;
+
+ Get_Strings_And_Offsets
+ (string_list, qual_list, clr_list, tag_list, offset,
+ layout, frg_id_list, pos_list, read_bank);
+
+ msg.setAccession (cid);
+ msg.setIMPs (frg_id_list, pos_list);
+
+ try
+ {
+ Multi_Align
+ (cid, string_list, offset, Align_Wiggle, Error_Rate,
+ Min_Overlap, gma, &ref, &tag_list, Allow_Expels);
+ }
+ catch (...)
+ {
+ cerr << "Failed on " << lid << "\'th layout/contig" << endl;
+ throw;
+ }
+
+ Permute (qual_list, ref);
+ Permute (clr_list, ref);
+ Permute (frg_id_list, ref);
+
+ gma.Set_Flipped (clr_list);
+ gma.Get_Positions (pos);
+ gma.Extract_IMP_Dels (del_list);
+ msg.Update_IMPs (pos, ref, del_list);
+ if (Allow_Expels)
+ msg . Remove_Empty_IMPs ();
+
+ gma.Set_Consensus_And_Qual (string_list, qual_list);
+ msg.setSequence (gma.getConsensusString ());
+ msg.setQuality (gma.getQualityString ());
+ msg.setUniLen (strlen (gma.getConsensusString ()));
+
+ Output_Unit (label, layout.getEID (),
+ msg.getNumFrags (), gma, msg, string_list,
+ qual_list, clr_list, tag_list, contig_bank);
+
+ // Cleanup before next layout to make valgrind happy on last layout
+ // Otherwise happens in Get_Strings_And_Offsets
+ {
+ int i, n;
+ n = string_list.size ();
+ for (i = 0; i < n; i++)
+ free (string_list[i]);
+ string_list.clear ();
+
+ n = qual_list.size ();
+ for (i = 0; i < n; i++)
+ free (qual_list[i]);
+ qual_list.clear ();
+
+ n = tag_list.size ();
+ for (i = 0; i < n; i++)
+ free (tag_list[i]);
+ tag_list.clear ();
+ }
+
+ contig_ct++;
+ } // while layout
+ cerr << "Processed " << layout_id << " layouts" << endl;
+ } // end of amos bank processing
+ else if (Input_Format == SIMPLE_CONTIG_INPUT
+ || Input_Format == PARTIAL_READ_INPUT)
+ {
+ char line[MAX_LINE];
+ vector < Ordered_Range_t > pos_list, seg_list;
+ vector < int >frg_id_list;
+ int fid;
+
+ input_fp = File_Open (Tig_File_Name.c_str (), "r");
+ read_bank.open (Bank_Name, B_READ);
+
+ msg.setType (IUM_MSG);
+ msg.setStatus (UNASSIGNED_UNITIG);
+
+ contig_ct = 0;
+
+ while (fgets (line, MAX_LINE, input_fp) != NULL)
+ {
+ char *p;
+
+ p = strtok (line, " \t\n");
+ if (p == NULL)
+ continue;
+
+ if (strcmp (p, "C") == 0) // line starts with 'C'
+ {
+ if (frg_id_list.size () > 0)
+ {
+ Get_Strings_And_Offsets (string_list, qual_list, clr_list,
+ tag_list, offset, frg_id_list,
+ pos_list, seg_list, read_bank);
+
+ msg.setAccession (cid);
+ msg.setIMPs (frg_id_list, pos_list);
+ try
+ {
+ Multi_Align
+ (cid, string_list, offset, Align_Wiggle, Error_Rate,
+ Min_Overlap, gma, &ref, &tag_list, Allow_Expels);
+ }
+ catch (AlignmentException_t & e)
+ {
+ int b = e.b_id ();
+
+ cerr << "Failed on contig " << cid << endl;
+ cerr << "Could not align string "
+ << tag_list[b] << " subscript " << b << endl;
+ throw;
+ }
+ Permute (qual_list, ref);
+ Permute (clr_list, ref);
+ Permute (frg_id_list, ref);
+
+ gma.Set_Flipped (clr_list);
+ gma.Get_Positions (pos);
+ gma.Extract_IMP_Dels (del_list);
+ msg.Update_IMPs (pos, ref, del_list);
+ if (Allow_Expels)
+ msg . Remove_Empty_IMPs ();
+
+ gma.Set_Consensus_And_Qual (string_list, qual_list);
+ msg.setSequence (gma.getConsensusString ());
+ msg.setQuality (gma.getQualityString ());
+ msg.setUniLen (strlen (gma.getConsensusString ()));
+
+ Output_Unit (label, msg.getAccession (),
+ msg.getNumFrags (), gma, msg, string_list,
+ qual_list, clr_list, tag_list, contig_bank);
+
+ contig_ct++;
+ }
+
+ frg_id_list.clear ();
+ pos_list.clear ();
+ seg_list.clear ();
+
+ p = strtok (NULL, " \t\n");
+ cid = p;
+ } // end of if line starts with 'C'
+ else
+ {
+ Ordered_Range_t ps;
+ int a, b;
+
+ fid = strtol (p, NULL, 10);
+ p = strtok (NULL, " \t\n");
+ a = strtol (p, NULL, 10);
+ p = strtok (NULL, " \t\n");
+ b = strtol (p, NULL, 10);
+ ps.setRange (a, b);
+ frg_id_list.push_back (fid);
+ pos_list.push_back (ps);
+ if (Input_Format == PARTIAL_READ_INPUT)
+ {
+ p = strtok (NULL, " \t\n");
+ a = strtol (p, NULL, 10);
+ p = strtok (NULL, " \t\n");
+ b = strtol (p, NULL, 10);
+ ps.setRange (a, b);
+ seg_list.push_back (ps);
+ }
+ }
+ } // end of while fgets
+
+ // Process the last contig here
+ if (frg_id_list.size () > 0)
+ {
+ Get_Strings_And_Offsets (string_list, qual_list, clr_list,
+ tag_list, offset, frg_id_list, pos_list,
+ seg_list, read_bank);
+
+ if (Extra_fp != NULL)
+ {
+ fprintf (stderr,
+ "Fasta sequence option not yet available--Ignored\n");
+ fclose (Extra_fp);
+ }
+
+ msg.setAccession (cid);
+ msg.setIMPs (frg_id_list, pos_list);
+ try
+ {
+ Multi_Align
+ (cid, string_list, offset, Align_Wiggle, Error_Rate, Min_Overlap,
+ gma, &ref, &tag_list, Allow_Expels);
+ }
+ catch (AlignmentException_t & e)
+ {
+ int b = e.b_id ();
+
+ cerr << "Failed on contig " << cid << endl;
+ cerr << "Could not align string "
+ << tag_list[b] << " subscript " << b << endl;
+ throw;
+ }
+
+ Permute (qual_list, ref);
+ Permute (clr_list, ref);
+ Permute (frg_id_list, ref);
+
+ gma.Set_Flipped (clr_list);
+ gma.Get_Positions (pos);
+ gma.Extract_IMP_Dels (del_list);
+ msg.Update_IMPs (pos, ref, del_list);
+ if (Allow_Expels)
+ msg . Remove_Empty_IMPs ();
+
+ gma.Set_Consensus_And_Qual (string_list, qual_list);
+ msg.setSequence (gma.getConsensusString ());
+ msg.setQuality (gma.getQualityString ());
+ msg.setUniLen (strlen (gma.getConsensusString ()));
+
+ Output_Unit (label, msg.getAccession (),
+ msg.getNumFrags (), gma, msg, string_list,
+ qual_list, clr_list, tag_list, contig_bank);
+
+ contig_ct++;
+ } // end of if frg_id_list.size > 0
+
+ cerr << "Processed " << contig_ct << " contigs" << endl;
+ } // end of if Input_Format == PARTIAL_READ_INPUT || SIMPLE_CONTIG_INPUT
+
+ if (Input_Format != BANK_INPUT)
+ fclose (input_fp);
+ if (Expel_fp != NULL)
+ fclose (Expel_fp);
+
+ read_bank.close ();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "** AMOS Exception **" << endl;
+ cerr << e << endl;
+ exit (EXIT_FAILURE);
+ }
+ catch (std::exception & e)
+ {
+ cerr << "** Standard Exception **" << endl;
+ cerr << e << endl;
+ exit (EXIT_FAILURE);
+ }
+
+ return 0;
+}
+
+
+
+bool By_Lo_Position
+ (const Celera_IMP_Sub_Msg_t & a, const Celera_IMP_Sub_Msg_t & b)
+// Return true iff the region in a comes before the region in b
+// in the uni/contig that contains them. Used for sorting.
+{
+ Ordered_Range_t position;
+ int start, stop;
+ int a_lo, a_hi, b_lo, b_hi;
+
+ position = a.getPosition ();
+ start = position.getBegin ();
+ stop = position.getEnd ();
+ a_lo = Min (start, stop);
+ a_hi = Max (start, stop);
+
+ position = b.getPosition ();
+ start = position.getBegin ();
+ stop = position.getEnd ();
+ b_lo = Min (start, stop);
+ b_hi = Max (start, stop);
+
+ if (a_lo < b_lo)
+ return true;
+ else if (a_lo == b_lo && a_hi < b_hi)
+ return true;
+
+ return false;
+}
+
+
+
+static void Get_Strings_And_Offsets
+ (vector < char *>&s, vector < char *>&q, vector < Range_t > &clr_list,
+ vector < char *>&tag_list, vector < int >&offset,
+ const Celera_Message_t & msg, Bank_t & read_bank)
+// Populate s and offset with reads and their unitig positions
+// for the unitig in msg with reads coming from read_bank.
+// Put the clear-ranges for the strings in clr_list with
+// coordinates swapped if the string is reverse-complemented.
+// read_bank must already be opened. Put the corresponding quality-value
+// strings for the reads into q . Put the identifying tags for the reads
+// in tag_list .
+{
+ vector < Celera_IMP_Sub_Msg_t > frgs = msg.getIMPList ();
+ Read_t read;
+ Ordered_Range_t position;
+ int prev_offset;
+ int i, n;
+
+ n = s.size ();
+ for (i = 0; i < n; i++)
+ free (s[i]);
+ s.clear ();
+
+ n = q.size ();
+ for (i = 0; i < n; i++)
+ free (q[i]);
+ q.clear ();
+
+ n = tag_list.size ();
+ for (i = 0; i < n; i++)
+ free (tag_list[i]);
+ tag_list.clear ();
+
+ clr_list.clear ();
+ offset.clear ();
+
+ sort (frgs.begin (), frgs.end (), By_Lo_Position);
+
+ prev_offset = 0;
+ n = msg.getNumFrags ();
+ for (i = 0; i < n; i++)
+ {
+ char *tmp, tag_buff[100];
+ string seq;
+ string qual;
+ Range_t clear;
+ int this_offset;
+ int a, b, j, len, qlen;
+
+ position = frgs[i].getPosition ();
+ a = position.getBegin ();
+ b = position.getEnd ();
+
+ read_bank.fetch (frgs[i].getId (), read);
+
+ if (Use_SeqNames)
+ tag_list.push_back (strdup (read.getEID ().c_str ()));
+ else
+ {
+ sprintf (tag_buff, "%u", read.getIID ());
+ tag_list.push_back (strdup (tag_buff));
+ }
+
+ clear = read.getClearRange ();
+ if (Verbose > 2)
+ cerr << read;
+ seq = read.getSeqString (clear);
+ qual = read.getQualString (clear);
+ if (b < a)
+ {
+ Reverse_Complement (seq);
+ reverse (qual.begin (), qual.end ());
+ clear.swap ();
+ }
+ clr_list.push_back (clear);
+
+ len = seq.length ();
+ tmp = strdup (seq.c_str ());
+ for (j = 0; j < len; j++)
+ tmp[j] = tolower (tmp[j]);
+ s.push_back (tmp);
+
+ qlen = qual.length ();
+ if (len != qlen)
+ {
+ sprintf
+ (Clean_Exit_Msg_Line,
+ "ERROR: Sequence length (%d) != quality length (%d) for read %d\n",
+ len, qlen, read.getIID ());
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ tmp = strdup (qual.c_str ());
+ q.push_back (tmp);
+
+ this_offset = Min (a, b);
+ offset.push_back (this_offset - prev_offset);
+ prev_offset = this_offset;
+ }
+
+ return;
+}
+
+
+
+static void Get_Strings_And_Offsets
+ (vector < char *>&s, vector < char *>&q, vector < Range_t > &clr_list,
+ vector < char *>&tag_list, vector < int >&offset, vector < int >&fid,
+ vector < Ordered_Range_t > &pos, vector < Ordered_Range_t > &seg,
+ Bank_t & read_bank)
+// Populate s and offset with reads and their contig positions
+// for the contig with read-ids in fid and consensus positions
+// in pos . Put the corresponding quality-value strings for the reads
+// into q . Put the clear-ranges for the strings in clr_list with
+// coordinates swapped if the string is reverse-complemented.
+// Put the identifying tags for the reads
+// in tag_list . Get reads and qualities from read_bank.
+// read_bank must already be opened. If seg is not empty, used
+// the values in it to determine what segment of each read to use.
+{
+ Read_t read;
+ int prev_offset;
+ bool partial_reads;
+ int i, n;
+
+ n = s.size ();
+ for (i = 0; i < n; i++)
+ free (s[i]);
+ s.clear ();
+
+ n = q.size ();
+ for (i = 0; i < n; i++)
+ free (q[i]);
+ q.clear ();
+
+ n = tag_list.size ();
+ for (i = 0; i < n; i++)
+ free (tag_list[i]);
+ tag_list.clear ();
+
+ clr_list.clear ();
+ offset.clear ();
+ partial_reads = (seg.size () > 0);
+
+ Sort_By_Low_Pos (fid, pos, seg);
+ if (Verbose > 2)
+ {
+ int i, n;
+
+ fprintf (stderr, "After Sort_By_Low_Pos:\n");
+ n = fid.size ();
+ for (i = 0; i < n; i++)
+ fprintf (stderr, "%8d %6d %6d\n", fid[i],
+ pos[i].getBegin (), pos[i].getEnd ());
+ }
+
+ prev_offset = 0;
+ n = fid.size ();
+ for (i = 0; i < n; i++)
+ {
+ char *tmp, tag_buff[100];
+ string seq;
+ string qual;
+ Range_t clear;
+ int this_offset;
+ int a, b, j, len, qlen;
+
+ a = pos[i].getBegin ();
+ b = pos[i].getEnd ();
+
+ read_bank.fetch (fid[i], read);
+
+ if (Use_SeqNames)
+ tag_list.push_back (strdup (read.getEID ().c_str ()));
+ else
+ {
+ sprintf (tag_buff, "%u", read.getIID ());
+ tag_list.push_back (strdup (tag_buff));
+ }
+
+ clear = read.getClearRange ();
+ if (Verbose > 2)
+ cerr << read;
+ seq = read.getSeqString (clear);
+ qual = read.getQualString (clear);
+ if (partial_reads)
+ {
+ int lo, hi;
+
+ lo = seg[i].getBegin ();
+ hi = seg[i].getEnd ();
+ seq = seq.substr (lo, hi - lo);
+ qual = qual.substr (lo, hi - lo);
+ }
+ if (b < a)
+ {
+ Reverse_Complement (seq);
+ reverse (qual.begin (), qual.end ());
+ clear.swap ();
+ }
+
+ clr_list.push_back (clear);
+
+ len = seq.length ();
+ tmp = strdup (seq.c_str ());
+ for (j = 0; j < len; j++)
+ tmp[j] = tolower (tmp[j]);
+ s.push_back (tmp);
+
+ qlen = qual.length ();
+ if (len != qlen)
+ {
+ sprintf
+ (Clean_Exit_Msg_Line,
+ "ERROR: Sequence length (%d) != quality length (%d) for read %d\n",
+ len, qlen, fid[i]);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ tmp = strdup (qual.c_str ());
+ q.push_back (tmp);
+
+ this_offset = Min (a, b);
+ offset.push_back (this_offset - prev_offset);
+ prev_offset = this_offset;
+ }
+
+ return;
+}
+
+struct cmpTile:public binary_function < Tile_t, Tile_t, bool >
+{
+ bool operator () (Tile_t x, Tile_t y)
+ {
+ if (x.offset < y.offset)
+ return true;
+ if (x.offset == y.offset && x.range.getLength () < y.range.getLength ())
+ return true;
+ return false;
+ }
+};
+
+
+// MP - using layout info to populate fid & pos in addition to the other work
+// done in this function
+static void Get_Strings_And_Offsets
+ (vector < char *>&s, vector < char *>&q, vector < Range_t > &clr_list,
+ vector < char *>&tag_list, vector < int >&offset, Layout_t & layout,
+ vector < int >&fid, vector < Ordered_Range_t > &pos, Bank_t & read_bank)
+// Populate s and offset with reads and their contig positions
+// for the contig with read-ids in fid and consensus positions
+// in pos . Put the corresponding quality-value strings for the reads
+// into q . Put the clear-ranges for the strings in clr_list with
+// coordinates swapped if the string is reverse-complemented.
+// Put the identifying tags for the reads
+// in tag_list . Get reads and qualities from read_bank.
+// read_bank must already be opened. If seg is not empty, used
+// the values in it to determine what segment of each read to use.
+{
+ Read_t read;
+ int prev_offset;
+ bool partial_reads;
+ int i, n;
+
+ n = s.size ();
+ for (i = 0; i < n; i++)
+ free (s[i]);
+ s.clear ();
+
+ n = q.size ();
+ for (i = 0; i < n; i++)
+ free (q[i]);
+ q.clear ();
+
+ n = tag_list.size ();
+ for (i = 0; i < n; i++)
+ free (tag_list[i]);
+ tag_list.clear ();
+
+ clr_list.clear ();
+ offset.clear ();
+ fid.clear ();
+
+ sort (layout.getTiling ().begin (), layout.getTiling ().end (), cmpTile ());
+
+ prev_offset = 0;
+
+ for (vector < Tile_t >::iterator ti = layout.getTiling ().begin ();
+ ti != layout.getTiling ().end (); ti++)
+ {
+ char *tmp, tag_buff[100];
+ string seq;
+ string qual;
+ Range_t clear;
+ int this_offset;
+ int a, b, j, len, qlen;
+
+ if (ti->range.getBegin () < ti->range.getEnd ())
+ { // forward match
+ a = ti->offset;
+ b = ti->offset + ti->range.getLength ();
+ }
+ else
+ {
+ a = ti->offset + ti->range.getLength ();
+ b = ti->offset;
+ }
+
+ pos.push_back (Ordered_Range_t (a, b));
+ fid.push_back (ti->source);
+
+
+ read_bank.fetch (ti->source, read);
+
+ if (Verbose > 3)
+ {
+ cerr << "Loading e" << read.getEID () << " i" << read.
+ getIID () << "... ";
+ }
+
+ if (Use_SeqNames)
+ tag_list.push_back (strdup (read.getEID ().c_str ()));
+ else
+ {
+ sprintf (tag_buff, "%u", read.getIID ());
+ tag_list.push_back (strdup (tag_buff));
+ }
+
+ if (USE_LayoutClear)
+ {
+ clear = ti->range;
+ if (clear.isReverse ())
+ {
+ clear.swap ();
+ }
+ }
+ else
+ {
+ // Grab clear range from read bank
+ clear = read.getClearRange ();
+ }
+
+ seq = read.getSeqString (clear);
+ qual = read.getQualString (clear);
+
+ if (b < a)
+ {
+ Reverse_Complement (seq);
+ reverse (qual.begin (), qual.end ());
+ clear.swap ();
+ }
+
+ clr_list.push_back (clear);
+
+ len = seq.length ();
+ tmp = strdup (seq.c_str ());
+ for (j = 0; j < len; j++)
+ tmp[j] = tolower (tmp[j]);
+ s.push_back (tmp);
+
+ qlen = qual.length ();
+ if (len != qlen)
+ {
+ sprintf
+ (Clean_Exit_Msg_Line,
+ "ERROR: Sequence length (%d) != quality length (%d) for read %d\n",
+ len, qlen, ti->source);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ tmp = strdup (qual.c_str ());
+ q.push_back (tmp);
+
+ this_offset = Min (a, b);
+ offset.push_back (this_offset - prev_offset);
+
+ prev_offset = this_offset;
+
+ if (Verbose > 3)
+ {
+ cerr << "ok." << endl;
+ }
+ }
+
+ return;
+} // end of Get_Strings_And_Offsets
+
+
+
+static void Output_Unit
+ (const string & label, const string & id, int num_reads,
+ Gapped_Multi_Alignment_t & gma, Celera_Message_t & msg,
+ const vector < char *>&string_list,
+ const vector < char *>&qual_list, const vector < Range_t > &clr_list,
+ vector < char *>tag_list, BankStream_t & bank)
+// Output the consensus/multialignment unit in msg and gma with
+// id and num_reads in the format specified in global Output_Format .
+// label is the separator in MULTI_ALIGN_OUTPUT . string_list and
+// qual_list hold the sequence and quality values of the component
+// reads. clr_list holds the clear ranges of the fragments from
+// which the reads came (in reverse order if the read has been
+// reverse-complemented). tag_list holds the IIDs of the reads.
+{
+ Contig_t act;
+ Message_t amg;
+ int expel_ct = 0;
+
+ if (Allow_Expels)
+ expel_ct = gma . Print_Empty_Aligns
+ (Expel_fp, tag_list, msg . getAccession () . c_str ());
+
+ act.setEID (id);
+ switch (Output_Format)
+ {
+ case MULTI_ALIGN_OUTPUT:
+ cout << endl << endl << label << " #" << msg.getAccession ()
+ << " " << num_reads << " reads" << endl;
+ gma.Consensus_To_Lower ();
+ gma.Print (stdout, string_list, 60, &tag_list);
+ break;
+ case ONLY_FASTA_OUTPUT:
+ cout << ">" << msg.getAccession () << endl;
+ Fasta_Print_Skip (stdout, gma.getConsensusString (), "-", NULL);
+ break;
+ case CELERA_MSG_OUTPUT:
+ gma.Set_Consensus_And_Qual (string_list, qual_list);
+ msg.setSequence (gma.getConsensusString ());
+ msg.setQuality (gma.getQualityString ());
+ msg.setUniLen (strlen (gma.getConsensusString ()));
+ msg.print (stdout);
+ break;
+ case TIGR_CONTIG_OUTPUT:
+ gma.TA_Print (stdout, string_list, clr_list, 60, &tag_list,
+ msg.getAccession ());
+ break;
+ case AMOS_OUTPUT:
+ gma.Make_AMOS_Contig (clr_list, tag_list, act);
+ act.writeMessage (amg);
+ amg.write (cout);
+ break;
+ case BANK_OUTPUT:
+ gma.Make_AMOS_Contig (clr_list, tag_list, act);
+ bank << act;
+ break;
+ default:
+ sprintf
+ (Clean_Exit_Msg_Line,
+ "ERROR: Bad output type = %d\n", int (Output_Format));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ return;
+}
+
+
+
+static void Parse_Command_Line (int argc, char *argv[])
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+{
+ bool errflg = false;
+ int ch;
+
+ optarg = NULL;
+
+ while (!errflg
+ && ((ch = getopt (argc, argv, "aAbBcCe:E:fhi:Ln:o:PsSTuv:w:x:")) != EOF))
+ switch (ch)
+ {
+ case 'a':
+ Output_Format = MULTI_ALIGN_OUTPUT;
+ break;
+
+ case 'A':
+ Output_Format = AMOS_OUTPUT;
+ break;
+
+ case 'b':
+ Input_Format = BANK_INPUT;
+ break;
+
+ case 'B':
+ Output_Format = BANK_OUTPUT;
+ break;
+
+ case 'c':
+ Do_Contig_Messages = true;
+ Do_Unitig_Messages = false;
+ break;
+
+ case 'C':
+ Input_Format = CELERA_MSG_INPUT;
+ break;
+
+ case 'e':
+ Error_Rate = strtod (optarg, NULL);
+ break;
+
+ case 'E':
+ Extra_fp = File_Open (optarg, "r", __FILE__, __LINE__);
+ break;
+
+ case 'f':
+ Output_Format = ONLY_FASTA_OUTPUT;
+ break;
+
+ case 'h':
+ errflg = true;
+ break;
+
+ case 'i':
+ byIID = true;
+ IID_fp.open (optarg, ifstream::in);
+ if (!IID_fp.is_open ())
+ {
+ cerr << "Couldn't open " << optarg << endl;
+ exit (1);
+ }
+ break;
+
+ case 'L':
+ USE_LayoutClear = true;
+ break;
+
+ case 'n':
+ byEID = true;
+ EID_fp.open (optarg, ifstream::in);
+ if (!EID_fp.is_open ())
+ {
+ cerr << "Couldn't open " << optarg << endl;
+ exit (1);
+ }
+ break;
+
+ case 'o':
+ Min_Overlap = strtol (optarg, NULL, 10);
+ break;
+
+ case 'P':
+ Input_Format = PARTIAL_READ_INPUT;
+ break;
+
+ case 's':
+ Use_SeqNames = true;
+ break;
+
+ case 'S':
+ Input_Format = SIMPLE_CONTIG_INPUT;
+ break;
+
+ case 'T':
+ Output_Format = TIGR_CONTIG_OUTPUT;
+ break;
+
+ case 'u':
+ Do_Unitig_Messages = true;
+ Do_Contig_Messages = false;
+ break;
+
+ case 'v':
+ Verbose = strtol (optarg, NULL, 10);
+ break;
+
+ case 'w':
+ Align_Wiggle = strtol (optarg, NULL, 10);
+ break;
+
+ case 'x':
+ Allow_Expels = true;
+ Expel_fp = File_Open (optarg, "w", __FILE__, __LINE__);
+ fprintf (Expel_fp, "# expelled reads: read-id contig-id\n");
+ cerr << "Expelled reads listed in file " << optarg << endl;
+ break;
+
+ case '?':
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+
+ default:
+ errflg = true;
+ }
+
+ if (Input_Format == CELERA_MSG_INPUT
+ && !Do_Unitig_Messages && !Do_Contig_Messages)
+ {
+ fprintf (stderr, "\nERROR: Must specify either -u or -c\n\n");
+ errflg = true;
+ }
+
+ if (errflg)
+ {
+ Usage (argv[0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if ((Input_Format == BANK_INPUT && optind > argc - 1) ||
+ (Input_Format != BANK_INPUT && optind > argc - 2))
+ {
+ Usage (argv[0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (Input_Format != BANK_INPUT)
+ Tig_File_Name = argv[optind++];
+ Bank_Name = argv[optind++];
+
+ return;
+}
+
+
+
+static void Sort_By_Low_Pos
+ (vector < int >&fid, vector < Ordered_Range_t > &pos,
+ vector < Ordered_Range_t > &seg)
+// Sort the entries in fid and pos (and seg if it's not empty)
+// into ascending order based on the lower of two values in each
+// pos entry. Use an insertion sort since we expect the values are
+// likely to be nearly sorted already.
+{
+ vector < int >low;
+ bool use_seg;
+ Ordered_Range_t save_pos, save_seg;
+ int save_fid, save_low;
+ int n, i;
+
+ n = pos.size ();
+ if (n == 0)
+ return;
+
+ use_seg = (seg.size () > 0);
+
+ for (i = 0; i < n; i++)
+ low.push_back (Min (pos[i].getBegin (), pos[i].getEnd ()));
+
+ for (i = 1; i < n; i++)
+ {
+ int j;
+
+ if (low[i - 1] <= low[i])
+ continue; // already in order
+
+ save_low = low[i];
+ save_pos = pos[i];
+ save_fid = fid[i];
+ if (use_seg)
+ save_seg = seg[i];
+
+ for (j = i; j > 0 && low[j - 1] > save_low; j--)
+ {
+ low[j] = low[j - 1];
+ pos[j] = pos[j - 1];
+ fid[j] = fid[j - 1];
+ if (use_seg)
+ seg[j] = seg[j - 1];
+ }
+
+ low[j] = save_low;
+ pos[j] = save_pos;
+ fid[j] = save_fid;
+ if (use_seg)
+ seg[j] = save_seg;
+ }
+
+ return;
+}
+
+
+
+static void Usage (const char *command)
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+{
+ fprintf (stderr,
+ "USAGE: %s <tig-file> <bank-name>\n"
+ "\n"
+ "Read layout information from <tig-file> describing positions\n"
+ "of reads, and create multialignments and/or consensus sequences\n"
+ "for them. Read sequences are obtained from <bank-name>\n"
+ "\n"
+ "Options:\n"
+ " -a Output alignments instead of consensus messages\n"
+ " -A Output an AMOS message file\n"
+ " -b Input from AMOS bank\n"
+ " -B Output to an AMOS bank\n"
+ " -c Process contig messages\n"
+ " -C Input is Celera msg format, i.e., a .cgb or .cgw file\n"
+ " -e <x> Set alignment error rate to <x>, e.g., -e 0.05 for 5%% error\n"
+ " -E <fn> Get extra sequences to align from fasta file <fn>\n"
+ " -f Output consensus only in FASTA format\n"
+ " -h Print this usage message\n"
+ " -i <fn> File containing list of IIDs to be processed\n"
+ " -L Use clear range in layout rather than readbank (-b only)\n"
+ " -n <fn> File containing list of EIDs (names) to be processed\n"
+ " -o <n> Set minimum overlap bases to <n>\n"
+ " -P Input is simple contig format, i.e., UMD format\n"
+ " using partial reads\n"
+ " -s Output EID seqnames for reads instead of IID ints\n"
+ " -S Input is simple contig format, i.e., UMD format\n"
+ " -T Output in TIGR Assembler contig format\n"
+ " -u Process unitig messages\n"
+ " -v <n> Set verbose level to <n>. Higher produces more output\n"
+ " -w <n> Set alignment wiggle to <n>. Default is 15. Use a smaller value for Solexa reads (Example: -w 2)\n"
+ " -x <fn> Expel poor aligning reads from contigs and list them in file <fn>\n"
+ "\n", command);
+
+ return;
+}
+
+static void
+readIIDFile (ifstream & f, list < ID_t > &l)
+ // Reads IIDs from a file
+{
+ ID_t iid;
+
+ while (f >> iid)
+ l.push_back (iid);
+}
+
+static void
+readEIDFile (ifstream & f, list < string > &l)
+ // Reads EIDs from a file
+{
+ string eid;
+
+ while (f >> eid)
+ l.push_back (eid);
+}
diff --git a/src/Align/make-consensus_poly.cc b/src/Align/make-consensus_poly.cc
new file mode 100644
index 0000000..dd1ea0a
--- /dev/null
+++ b/src/Align/make-consensus_poly.cc
@@ -0,0 +1,1262 @@
+// A. L. Delcher
+//
+// File: make-consensus_poly.cc
+//
+// Last Modified: 12 April 2004
+//
+// Read layout information for reads in unitigs/contigs and create
+// multialignments and/or consensus sequences for them. The alphabet
+// supported (acgtmrwsykvhdbn) includes all ambiguities
+
+
+#include "foundation_AMOS.hh"
+#include "delcher.hh"
+#include "CelMsg.hh"
+#include "align_poly.hh"
+#include "prob.hh"
+#include "fasta.hh"
+#include <iostream>
+#include <vector>
+#include <string>
+#include <algorithm>
+#include <fstream>
+
+
+using namespace std;
+using namespace AMOS;
+
+const int ALIGN_WIGGLE = 15;
+ // Number of positions left and right of specified location
+ // to look for alignments.
+const double DEFAULT_ERROR_RATE = 0.06;
+const int DEFAULT_MIN_OVERLAP = 5;
+const int MAX_LINE = 1000;
+const int NEW_SIZE = 1000;
+
+
+enum Input_Format_t
+ {PARTIAL_READ_INPUT, SIMPLE_CONTIG_INPUT, CELERA_MSG_INPUT, BANK_INPUT};
+enum Output_Format_t
+ {MULTI_ALIGN_OUTPUT, ONLY_FASTA_OUTPUT, CELERA_MSG_OUTPUT,
+ TIGR_CONTIG_OUTPUT, AMOS_OUTPUT, BANK_OUTPUT};
+
+
+static string Bank_Name;
+ // Name of read bank from which reads are obtained
+static bool Use_SeqNames = false;
+ //AMP// If set true, will use comment filed in the readbank for seq tags
+static bool Do_Contig_Messages = false;
+ // If set true (by -c option) then contig messages in the
+ // input will be processed
+static bool Do_Unitig_Messages = false;
+ // If set true (by -u option) then unitig messages in the
+ // input will be processed
+static double Error_Rate = DEFAULT_ERROR_RATE;
+ // Fraction of errors allowed in alignments
+static FILE * Extra_fp = NULL;
+ // Pointer to file of extra fasta sequences to align
+static Input_Format_t Input_Format = SIMPLE_CONTIG_INPUT;
+ // Type of input
+static int Min_Overlap = DEFAULT_MIN_OVERLAP;
+ // Minimum number of bases strings in multialignment must overlap
+static Output_Format_t Output_Format = CELERA_MSG_OUTPUT;
+ // Type of output to produce
+static string Tig_File_Name;
+ // Name of file containing input contig/unitig messages
+static bool byIID = false;
+ // Layouts to be processed listed by IID
+static ifstream IID_fp;
+ // Pointer to file of IIDs
+static bool byEID = false;
+ // Layouts to be processed listed by EID
+static ifstream EID_fp;
+ // Pointer to file of EIDs
+
+
+static bool By_Lo_Position
+ (const Celera_IMP_Sub_Msg_t & a, const Celera_IMP_Sub_Msg_t & b);
+static void Get_Strings_And_Offsets
+ (vector <char *> & s, vector <char *> & q, vector <Range_t> & clr_list,
+ vector <char *> & tag_list, vector <int> & offset,
+ const Celera_Message_t & msg, Bank_t & read_bank);
+static void Get_Strings_And_Offsets
+ (vector <char *> & s, vector <char *> & q, vector <Range_t> & clr_list,
+ vector <char * > & tag_list, vector <int> & offset, vector <int> & fid,
+ vector <Ordered_Range_t> & pos, vector <Ordered_Range_t> & seg,
+ Bank_t & read_bank);
+static void Get_Strings_And_Offsets
+ (vector <char *> & s, vector <char *> & q, vector <Range_t> & clr_list,
+ vector <char * > & tag_list, vector <int> & offset, Layout_t & layout,
+ vector <int> & fid, vector <Ordered_Range_t> & pos, Bank_t & read_bank);
+static void Output_Unit
+ (const string & label, const string & id, int num_reads,
+ Gapped_Multi_Alignment_t & gma, Celera_Message_t & msg,
+ const vector <char *> & string_list,
+ const vector <char *> & qual_list, const vector <Range_t> & clr_list,
+ const vector <char *> tag_list, BankStream_t & bank);
+static void Parse_Command_Line
+ (int argc, char * argv []);
+static void Sort_By_Low_Pos
+ (vector <int> & fid, vector <Ordered_Range_t> & pos,
+ vector <Ordered_Range_t> & seg);
+static void Usage
+ (const char * command);
+static void readIIDFile(ifstream & f, list <ID_t> & l);
+static void readEIDFile(ifstream & f, list <string> &l);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ Bank_t read_bank (Read_t::NCODE);
+ BankStream_t contig_bank (Contig_t::NCODE);
+ BankStream_t layout_bank_stream (Layout_t::NCODE);
+ Bank_t layout_bank (Layout_t::NCODE);
+ Celera_Message_t msg;
+ Read_t read;
+ FILE * input_fp;
+ string label = "Contig";
+ string cid;
+ vector <char *> string_list, qual_list;
+ vector <char *> tag_list;
+ vector <int> offset;
+ vector <int> ref;
+ vector <Range_t> pos, clr_list;
+ vector < vector <int> > del_list;
+ Gapped_Multi_Alignment_t gma;
+ time_t now;
+ iostream::fmtflags status;
+ int contig_ct, unitig_ct;
+ list <string> eid_list; // if layouts selected by eid
+ list <ID_t> iid_list; // if layouts selected by iid
+
+ try
+ {
+ now = time (NULL);
+ cerr << "Starting on " << ctime (& now) << endl;
+
+ Verbose = 0;
+
+ Parse_Command_Line (argc, argv);
+
+ cerr << "Read bank is " << Bank_Name << endl;
+ status = cerr . setf (ios :: fixed);
+ cerr << "Alignment error rate is " << setprecision (2)
+ << Error_Rate << endl;
+ cerr . setf (status);
+ cerr << "Minimum overlap bases is " << Min_Overlap << endl;
+
+ if (Output_Format == BANK_OUTPUT){
+ cerr << "Output will be written to the bank" << endl;
+ if (! contig_bank . exists (Bank_Name))
+ contig_bank . create (Bank_Name);
+ else
+ contig_bank . open (Bank_Name);
+ }
+
+ if (byIID) {
+ cerr << "Will only process IIDs in file specified by option -i\n";
+
+ readIIDFile (IID_fp, iid_list);
+ IID_fp.close();
+ }
+
+ if (byEID) {
+ cerr << "Will only process EIDs in file specified by option -n\n";
+ readEIDFile (EID_fp, eid_list);
+ EID_fp.close();
+ }
+
+ gma . setPrintFlag (PRINT_WITH_DIFFS);
+
+ if (Input_Format == CELERA_MSG_INPUT)
+ {
+ cerr << "Processing ";
+ if (Do_Contig_Messages)
+ cerr << "contig";
+ else
+ {
+ cerr << "unitig";
+ label = "Unitig";
+ }
+ cerr << " messages from file " << Tig_File_Name << endl;
+
+ input_fp = File_Open (Tig_File_Name . c_str (), "r");
+ read_bank . open (Bank_Name, B_READ);
+
+ unitig_ct = contig_ct = 0;
+ while (msg . read (input_fp))
+ {
+ if (msg . getMsgType () == IUM_MSG && Do_Unitig_Messages)
+ {
+ cerr << "Process unitig " << msg . getAccession () << endl;
+ Get_Strings_And_Offsets
+ (string_list, qual_list, clr_list, tag_list, offset,
+ msg, read_bank);
+
+ try
+ {
+ cid = msg . getAccession ();
+ Multi_Align (cid, string_list, offset, ALIGN_WIGGLE,
+ Error_Rate, Min_Overlap, gma, & ref, & tag_list);
+ }
+ catch (AlignmentException_t)
+ {
+ cerr << "Failed on unitig " << msg . getAccession () << endl;
+ throw;
+ }
+
+ Permute (qual_list, ref);
+ Permute (clr_list, ref);
+
+ gma . Set_Flipped (clr_list);
+ gma . Get_Positions (pos);
+ gma . Extract_IMP_Dels (del_list);
+ msg . Update_IMPs (pos, ref, del_list);
+
+ Output_Unit (label, msg . getAccession (),
+ msg . getNumFrags (), gma, msg, string_list,
+ qual_list, clr_list, tag_list, contig_bank);
+
+ unitig_ct ++;
+ }
+ if (msg . getMsgType () == ICM_MSG && Do_Contig_Messages)
+ {
+ contig_ct ++;
+ }
+ }
+ if (Do_Unitig_Messages)
+ cerr << unitig_ct << " IUM messages processed" << endl;
+ if (Do_Contig_Messages)
+ cerr << contig_ct << " ICM messages processed" << endl;
+ } // celera input
+ else if (Input_Format == BANK_INPUT)
+ {
+ ID_t layout_id = 0; // we'll have to number the contigs ourselves
+ Layout_t layout;
+ vector <Ordered_Range_t> pos_list;
+ vector <int> frg_id_list;
+ list <string>::iterator eidi = eid_list.begin();
+ list <ID_t>::iterator iidi = iid_list.begin();
+
+ cerr << "Input is being read from the bank " << endl;
+
+ read_bank . open (Bank_Name, B_READ);
+
+ if (byIID || byEID)
+ layout_bank . open (Bank_Name);
+ else
+ layout_bank_stream . open (Bank_Name);
+
+ msg . setType (IUM_MSG);
+ msg . setStatus (UNASSIGNED_UNITIG);
+
+ while (true)
+ {
+ char sid[256];
+
+ if (byIID) {
+ if (iidi == iid_list.end()) break;
+ if (! layout_bank . existsIID(*iidi)){
+ cerr << "IID " << *iidi << " does not exist!\n";
+ exit(1);
+ }
+ layout_bank . fetch(*iidi, layout);
+ iidi++;
+ } else if (byEID) {
+ if (eidi == eid_list.end()) break;
+ if (! layout_bank . existsEID(*eidi)){
+ cerr << "EID " << *eidi << " does not exist!\n";
+ exit(1);
+ }
+ layout_bank . fetch(*eidi, layout);
+ eidi++;
+ } else {
+ layout_bank_stream >> layout;
+ if (layout_bank_stream.eof())
+ break;
+ }
+
+ sprintf(sid, "%ld", ++layout_id);
+ cid = string(sid);
+ ID_t lid = layout.getIID();
+ if (lid == 0) {
+ lid = layout_id;
+ }
+
+ Get_Strings_And_Offsets
+ (string_list, qual_list, clr_list, tag_list, offset,
+ layout, frg_id_list, pos_list, read_bank);
+
+ msg . setAccession(cid);
+ msg . setIMPs(frg_id_list, pos_list);
+
+ try
+ {
+ Multi_Align (cid, string_list, offset, ALIGN_WIGGLE,
+ Error_Rate, Min_Overlap, gma, & ref, & tag_list);
+ }
+ catch (...)
+ {
+ cerr << "Failed on " << lid << "\'th layout/contig" << endl;
+ throw;
+ }
+
+ Permute (qual_list, ref);
+ Permute (clr_list, ref);
+ Permute (frg_id_list, ref);
+
+ gma . Set_Flipped (clr_list);
+ gma . Get_Positions (pos);
+ gma . Extract_IMP_Dels (del_list);
+ msg . Update_IMPs (pos, ref, del_list);
+
+ gma . Set_Consensus_And_Qual (string_list, qual_list);
+ msg . setSequence (gma . getConsensusString ());
+ msg . setQuality (gma . getQualityString ());
+ msg . setUniLen (strlen (gma . getConsensusString ()));
+
+ Output_Unit (label, layout.getEID(),
+ msg . getNumFrags (), gma, msg, string_list,
+ qual_list, clr_list, tag_list, contig_bank);
+
+ // Cleanup before next layout to make valgrind happy on last layout
+ // Otherwise happens in Get_Strings_And_Offsets
+ {
+ int i, n;
+ n = string_list . size ();
+ for (i = 0; i < n; i ++)
+ free (string_list [i]);
+ string_list . clear ();
+
+ n = qual_list . size ();
+ for (i = 0; i < n; i ++)
+ free (qual_list [i]);
+ qual_list . clear ();
+
+ n = tag_list . size ();
+ for (i = 0; i < n; i ++)
+ free (tag_list [i]);
+ tag_list . clear ();
+ }
+
+ contig_ct ++;
+ } // while layout
+ cerr << "Processed " << layout_id << " layouts" << endl;
+ if (byIID || byEID)
+ layout_bank.close();
+ else
+ layout_bank_stream.close();
+ } // amos bank input
+ else if (Input_Format == SIMPLE_CONTIG_INPUT
+ || Input_Format == PARTIAL_READ_INPUT)
+ {
+ char line [MAX_LINE];
+ vector <Ordered_Range_t> pos_list, seg_list;
+ vector <int> frg_id_list;
+ int fid;
+
+ input_fp = File_Open (Tig_File_Name . c_str (), "r");
+ read_bank . open (Bank_Name, B_READ);
+
+ msg . setType (IUM_MSG);
+ msg . setStatus (UNASSIGNED_UNITIG);
+
+ contig_ct = 0;
+
+ while (fgets (line, MAX_LINE, input_fp) != NULL)
+ {
+ char * p;
+
+ p = strtok (line, " \t\n");
+ if (p == NULL)
+ continue;
+
+ if (strcmp (p, "C") == 0)
+ {
+ if (frg_id_list . size () > 0)
+ {
+ Get_Strings_And_Offsets (string_list, qual_list, clr_list,
+ tag_list, offset, frg_id_list, pos_list, seg_list,
+ read_bank);
+
+ msg . setAccession (cid);
+ msg . setIMPs (frg_id_list, pos_list);
+ try
+ {
+ Multi_Align (cid, string_list, offset, ALIGN_WIGGLE,
+ Error_Rate, Min_Overlap, gma, & ref, & tag_list);
+ }
+ catch (AlignmentException_t & e)
+ {
+ int b = e . b_id ();
+
+ cerr << "Failed on contig " << cid << endl;
+ cerr << "Could not align string "
+ << tag_list [b] << " subscript " << b << endl;
+ throw;
+ }
+ Permute (qual_list, ref);
+ Permute (clr_list, ref);
+ Permute (frg_id_list, ref);
+
+ gma . Set_Flipped (clr_list);
+ gma . Get_Positions (pos);
+ gma . Extract_IMP_Dels (del_list);
+ msg . Update_IMPs (pos, ref, del_list);
+
+ gma . Set_Consensus_And_Qual (string_list, qual_list);
+ msg . setSequence (gma . getConsensusString ());
+ msg . setQuality (gma . getQualityString ());
+ msg . setUniLen (strlen (gma . getConsensusString ()));
+
+ Output_Unit (label, msg . getAccession (),
+ msg . getNumFrags (), gma, msg, string_list,
+ qual_list, clr_list, tag_list, contig_bank);
+
+ contig_ct ++;
+ }
+
+ frg_id_list . clear ();
+ pos_list . clear ();
+ seg_list . clear ();
+
+ p = strtok (NULL, " \t\n");
+ cid = p;
+ } // if line starts with 'C'
+ else
+ {
+ Ordered_Range_t ps;
+ int a, b;
+
+ fid = strtol (p, NULL, 10);
+ p = strtok (NULL, " \t\n");
+ a = strtol (p, NULL, 10);
+ p = strtok (NULL, " \t\n");
+ b = strtol (p, NULL, 10);
+ ps . setRange (a, b);
+ frg_id_list . push_back (fid);
+ pos_list . push_back (ps);
+ if (Input_Format == PARTIAL_READ_INPUT)
+ {
+ p = strtok (NULL, " \t\n");
+ a = strtol (p, NULL, 10);
+ p = strtok (NULL, " \t\n");
+ b = strtol (p, NULL, 10);
+ ps . setRange (a, b);
+ seg_list . push_back (ps);
+ }
+ }
+ } // while fgets
+
+ // Process the last contig here
+ if (frg_id_list . size () > 0)
+ {
+ Get_Strings_And_Offsets (string_list, qual_list, clr_list,
+ tag_list, offset, frg_id_list, pos_list, seg_list, read_bank);
+
+ if (Extra_fp != NULL)
+ {
+ fprintf (stderr,
+ "Fasta sequence option not yet available--Ignored\n");
+ fclose (Extra_fp);
+ }
+
+ msg . setAccession (cid);
+ msg . setIMPs (frg_id_list, pos_list);
+ try
+ {
+ Multi_Align (cid, string_list, offset, ALIGN_WIGGLE,
+ Error_Rate, Min_Overlap, gma, & ref, & tag_list);
+ }
+ catch (AlignmentException_t & e)
+ {
+ int b = e . b_id ();
+
+ cerr << "Failed on contig " << cid << endl;
+ cerr << "Could not align string "
+ << tag_list [b] << " subscript " << b << endl;
+ throw;
+ }
+
+ Permute (qual_list, ref);
+ Permute (clr_list, ref);
+ Permute (frg_id_list, ref);
+
+ gma . Set_Flipped (clr_list);
+ gma . Get_Positions (pos);
+ gma . Extract_IMP_Dels (del_list);
+ msg . Update_IMPs (pos, ref, del_list);
+
+ gma . Set_Consensus_And_Qual (string_list, qual_list);
+ msg . setSequence (gma . getConsensusString ());
+ msg . setQuality (gma . getQualityString ());
+ msg . setUniLen (strlen (gma . getConsensusString ()));
+
+ Output_Unit (label, msg . getAccession (),
+ msg . getNumFrags (), gma, msg, string_list,
+ qual_list, clr_list, tag_list, contig_bank);
+
+ contig_ct ++;
+ } // if frg_id_list.size > 0
+
+ cerr << "Processed " << contig_ct << " contigs" << endl;
+ } // if PARTIAL_READ_INPUT || SIMPLE_CONTIG_INPUT
+
+ if (Input_Format != BANK_INPUT)
+ fclose (input_fp);
+
+ read_bank . close ();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "** AMOS Exception **" << endl;
+ cerr << e << endl;
+ exit (EXIT_FAILURE);
+ }
+ catch (std :: exception & e)
+ {
+ cerr << "** Standard Exception **" << endl;
+ cerr << e << endl;
+ exit (EXIT_FAILURE);
+ }
+
+ return 0;
+ }
+
+
+
+bool By_Lo_Position
+ (const Celera_IMP_Sub_Msg_t & a, const Celera_IMP_Sub_Msg_t & b)
+
+// Return true iff the region in a comes before the region in b
+// in the uni/contig that contains them. Used for sorting.
+
+ {
+ Ordered_Range_t position;
+ int start, stop;
+ int a_lo, a_hi, b_lo, b_hi;
+
+ position = a . getPosition ();
+ start = position . getBegin ();
+ stop = position . getEnd ();
+ a_lo = Min (start, stop);
+ a_hi = Max (start, stop);
+
+ position = b . getPosition ();
+ start = position . getBegin ();
+ stop = position . getEnd ();
+ b_lo = Min (start, stop);
+ b_hi = Max (start, stop);
+
+ if (a_lo < b_lo)
+ return true;
+ else if (a_lo == b_lo && a_hi < b_hi)
+ return true;
+
+ return false;
+ }
+
+
+
+static void Get_Strings_And_Offsets
+ (vector <char *> & s, vector <char *> & q, vector <Range_t> & clr_list,
+ vector <char * > & tag_list, vector <int> & offset,
+ const Celera_Message_t & msg, Bank_t & read_bank)
+
+// Populate s and offset with reads and their unitig positions
+// for the unitig in msg with reads coming from read_bank.
+// Put the clear-ranges for the strings in clr_list with
+// coordinates swapped if the string is reverse-complemented.
+// read_bank must already be opened. Put the corresponding quality-value
+// strings for the reads into q . Put the identifying tags for the reads
+// in tag_list .
+
+ {
+ vector <Celera_IMP_Sub_Msg_t> frgs = msg . getIMPList ();
+ Read_t read;
+ Ordered_Range_t position;
+ int prev_offset;
+ int i, n;
+
+ n = s . size ();
+ for (i = 0; i < n; i ++)
+ free (s [i]);
+ s . clear ();
+
+ n = q . size ();
+ for (i = 0; i < n; i ++)
+ free (q [i]);
+ q . clear ();
+
+ n = tag_list . size ();
+ for (i = 0; i < n; i ++)
+ free (tag_list [i]);
+ tag_list . clear ();
+
+ clr_list . clear ();
+ offset . clear ();
+
+ sort (frgs . begin (), frgs . end (), By_Lo_Position);
+
+ prev_offset = 0;
+ n = msg . getNumFrags ();
+ for (i = 0; i < n; i ++)
+ {
+ char * tmp, tag_buff [100];
+ string seq;
+ string qual;
+ Range_t clear;
+ int this_offset;
+ int a, b, j, len, qlen;
+
+ position = frgs [i] . getPosition ();
+ a = position . getBegin ();
+ b = position . getEnd ();
+
+ read_bank . fetch (frgs [i] . getId(), read);
+
+ if ( Use_SeqNames )
+ tag_list . push_back (strdup (read . getEID() . c_str()));
+ else
+ {
+ sprintf (tag_buff, "%u", read . getIID ());
+ tag_list . push_back (strdup (tag_buff));
+ }
+
+ clear = read . getClearRange ();
+ if (Verbose > 2)
+ cerr << read;
+ seq = read . getSeqString (clear);
+ qual = read . getQualString (clear);
+ if (b < a)
+ {
+ Reverse_Complement (seq);
+ reverse (qual . begin (), qual . end ());
+ clear . swap ();
+ }
+ clr_list . push_back (clear);
+
+ len = seq . length ();
+ tmp = strdup (seq . c_str ());
+ for (j = 0; j < len; j ++)
+ tmp [j] = tolower (tmp [j]);
+ s . push_back (tmp);
+
+ qlen = qual . length ();
+ if (len != qlen)
+ {
+ sprintf
+ (Clean_Exit_Msg_Line,
+ "ERROR: Sequence length (%d) != quality length (%d) for read %d\n",
+ len, qlen, read . getIID( ));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ tmp = strdup (qual . c_str ());
+ q . push_back (tmp);
+
+ this_offset = Min (a, b);
+ offset . push_back (this_offset - prev_offset);
+ prev_offset = this_offset;
+ }
+
+
+ return;
+ }
+
+
+
+static void Get_Strings_And_Offsets
+ (vector <char *> & s, vector <char *> & q, vector <Range_t> & clr_list,
+ vector <char *> & tag_list, vector <int> & offset, vector <int> & fid,
+ vector <Ordered_Range_t> & pos, vector <Ordered_Range_t> & seg,
+ Bank_t & read_bank)
+
+// Populate s and offset with reads and their contig positions
+// for the contig with read-ids in fid and consensus positions
+// in pos . Put the corresponding quality-value strings for the reads
+// into q . Put the clear-ranges for the strings in clr_list with
+// coordinates swapped if the string is reverse-complemented.
+// Put the identifying tags for the reads
+// in tag_list . Get reads and qualities from read_bank.
+// read_bank must already be opened. If seg is not empty, used
+// the values in it to determine what segment of each read to use.
+
+ {
+ Read_t read;
+ int prev_offset;
+ bool partial_reads;
+ int i, n;
+
+ n = s . size ();
+ for (i = 0; i < n; i ++)
+ free (s [i]);
+ s . clear ();
+
+ n = q . size ();
+ for (i = 0; i < n; i ++)
+ free (q [i]);
+ q . clear ();
+
+ n = tag_list . size ();
+ for (i = 0; i < n; i ++)
+ free (tag_list [i]);
+ tag_list . clear ();
+
+ clr_list . clear ();
+ offset . clear ();
+ partial_reads = (seg . size () > 0);
+
+ Sort_By_Low_Pos (fid, pos, seg);
+ if (Verbose > 2)
+ {
+ int i, n;
+
+ fprintf (stderr, "After Sort_By_Low_Pos:\n");
+ n = fid . size ();
+ for (i = 0; i < n; i ++)
+ fprintf (stderr, "%8d %6d %6d\n", fid [i],
+ pos [i] . getBegin (), pos [i] . getEnd ());
+ }
+
+ prev_offset = 0;
+ n = fid . size ();
+ for (i = 0; i < n; i ++)
+ {
+ char * tmp, tag_buff [100];
+ string seq;
+ string qual;
+ Range_t clear;
+ int this_offset;
+ int a, b, j, len, qlen;
+
+ a = pos [i] . getBegin ();
+ b = pos [i] . getEnd ();
+
+ read_bank . fetch (fid [i], read);
+
+ if ( Use_SeqNames )
+ tag_list . push_back (strdup (read . getEID() . c_str()));
+ else
+ {
+ sprintf (tag_buff, "%u", read . getIID ());
+ tag_list . push_back (strdup (tag_buff));
+ }
+
+ clear = read . getClearRange ();
+ if (Verbose > 2)
+ cerr << read;
+ seq = read . getSeqString (clear);
+ qual = read . getQualString (clear);
+ if (partial_reads)
+ {
+ int lo, hi;
+
+ lo = seg [i] . getBegin ();
+ hi = seg [i] . getEnd ();
+ seq = seq . substr (lo, hi - lo);
+ qual = qual . substr (lo, hi - lo);
+ }
+ if (b < a)
+ {
+ Reverse_Complement (seq);
+ reverse (qual . begin (), qual . end ());
+ clear . swap ();
+ }
+
+ clr_list . push_back (clear);
+
+ len = seq . length ();
+ tmp = strdup (seq . c_str ());
+ for (j = 0; j < len; j ++)
+ tmp [j] = tolower (tmp [j]);
+ s . push_back (tmp);
+
+ qlen = qual . length ();
+ if (len != qlen)
+ {
+ sprintf
+ (Clean_Exit_Msg_Line,
+ "ERROR: Sequence length (%d) != quality length (%d) for read %d\n",
+ len, qlen, fid [i]);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ tmp = strdup (qual . c_str ());
+ q . push_back (tmp);
+
+ this_offset = Min (a, b);
+ offset . push_back (this_offset - prev_offset);
+ prev_offset = this_offset;
+ }
+
+ return;
+ }
+
+struct cmpTile : public binary_function<Tile_t, Tile_t, bool> {
+ bool operator () (Tile_t x, Tile_t y)
+ {
+ if (x . offset < y . offset)
+ return true;
+ if (x . offset == y . offset && x . range . getLength () < y . range . getLength ())
+ return true;
+ return false;
+ }
+};
+
+
+// MP - using layout info to populate fid & pos in addition to the other work
+// done in this function
+static void Get_Strings_And_Offsets
+ (vector <char *> & s, vector <char *> & q, vector <Range_t> & clr_list,
+ vector <char *> & tag_list, vector <int> & offset, Layout_t & layout,
+ vector <int> & fid, vector <Ordered_Range_t> & pos,
+ Bank_t & read_bank)
+
+// Populate s and offset with reads and their contig positions
+// for the contig with read-ids in fid and consensus positions
+// in pos . Put the corresponding quality-value strings for the reads
+// into q . Put the clear-ranges for the strings in clr_list with
+// coordinates swapped if the string is reverse-complemented.
+// Put the identifying tags for the reads
+// in tag_list . Get reads and qualities from read_bank.
+// read_bank must already be opened. If seg is not empty, used
+// the values in it to determine what segment of each read to use.
+
+ {
+ Read_t read;
+ int prev_offset;
+ bool partial_reads;
+ int i, n;
+
+ n = s . size ();
+ for (i = 0; i < n; i ++)
+ free (s [i]);
+ s . clear ();
+
+ n = q . size ();
+ for (i = 0; i < n; i ++)
+ free (q [i]);
+ q . clear ();
+
+ n = tag_list . size ();
+ for (i = 0; i < n; i ++)
+ free (tag_list [i]);
+ tag_list . clear ();
+
+ clr_list . clear ();
+ offset . clear ();
+ fid . clear ();
+
+ sort(layout . getTiling () . begin (), layout . getTiling () .end (), cmpTile ());
+
+
+
+ prev_offset = 0;
+
+ for (vector<Tile_t>::iterator ti = layout . getTiling () . begin ();
+ ti != layout . getTiling () . end() ; ti++)
+ {
+ char * tmp, tag_buff [100];
+ string seq;
+ string qual;
+ Range_t clear;
+ int this_offset;
+ int a, b, j, len, qlen;
+
+ if ( ti -> range . getBegin () < ti -> range . getEnd () ){ // forward match
+ a = ti -> offset;
+ b = ti -> offset + ti -> range . getLength ();
+ } else {
+ a = ti -> offset + ti -> range . getLength ();
+ b = ti -> offset;
+ }
+
+ pos . push_back ( Ordered_Range_t ( a, b ) );
+ fid . push_back ( ti -> source );
+
+
+ read_bank . fetch (ti -> source, read);
+
+ if (Verbose > 3) { cerr << "Loading e" << read.getEID() << " i" << read.getIID() << "... "; }
+
+ if ( Use_SeqNames )
+ tag_list . push_back (strdup (read . getEID() . c_str()));
+ else
+ {
+ sprintf (tag_buff, "%u", read . getIID ());
+ tag_list . push_back (strdup (tag_buff));
+ }
+
+ clear = read . getClearRange ();
+ seq = read . getSeqString (clear);
+ qual = read . getQualString (clear);
+
+ if (b < a)
+ {
+ Reverse_Complement (seq);
+ reverse (qual . begin (), qual . end ());
+ clear . swap ();
+ }
+
+ clr_list . push_back (clear);
+
+ len = seq . length ();
+ tmp = strdup (seq . c_str ());
+ for (j = 0; j < len; j ++)
+ tmp [j] = tolower (tmp [j]);
+ s . push_back (tmp);
+
+ qlen = qual . length ();
+ if (len != qlen)
+ {
+ sprintf
+ (Clean_Exit_Msg_Line,
+ "ERROR: Sequence length (%d) != quality length (%d) for read %d\n",
+ len, qlen, ti->source);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ tmp = strdup (qual . c_str ());
+ q . push_back (tmp);
+
+ this_offset = Min (a, b);
+ offset . push_back (this_offset - prev_offset);
+ prev_offset = this_offset;
+
+ if (Verbose > 3) { cerr << "ok." << endl; }
+ }
+
+ return;
+ } // Get_Strings_And_Offsets
+
+
+
+static void Output_Unit
+ (const string & label, const string & id, int num_reads,
+ Gapped_Multi_Alignment_t & gma, Celera_Message_t & msg,
+ const vector <char *> & string_list,
+ const vector <char *> & qual_list, const vector <Range_t> & clr_list,
+ vector <char *> tag_list, BankStream_t & bank)
+
+// Output the consensus/multialignment unit in msg and gma with
+// id and num_reads in the format specified in global Output_Format .
+// label is the separator in MULTI_ALIGN_OUTPUT . string_list and
+// qual_list hold the sequence and quality values of the component
+// reads. clr_list holds the clear ranges of the fragments from
+// which the reads came (in reverse order if the read has been
+// reverse-complemented). tag_list holds the IIDs of the reads.
+
+ {
+ Contig_t act;
+ Message_t amg;
+ act.setEID(id);
+ switch (Output_Format)
+ {
+ case MULTI_ALIGN_OUTPUT :
+ cout << endl << endl << label << " #" << msg . getAccession ()
+ << " " << num_reads << " reads" << endl;
+ gma . Consensus_To_Lower ();
+ gma . Print (stdout, string_list, 60, & tag_list);
+ break;
+ case ONLY_FASTA_OUTPUT :
+ cout << ">" << msg . getAccession () << endl;
+ Fasta_Print_Skip (stdout, gma . getConsensusString (),
+ "-", NULL);
+ break;
+ case CELERA_MSG_OUTPUT :
+ gma . Set_Consensus_And_Qual (string_list, qual_list);
+ msg . setSequence (gma . getConsensusString ());
+ msg . setQuality (gma . getQualityString ());
+ msg . setUniLen (strlen (gma . getConsensusString ()));
+ msg . print (stdout);
+ break;
+ case TIGR_CONTIG_OUTPUT :
+ gma . TA_Print (stdout, string_list, clr_list, 60, & tag_list,
+ msg . getAccession ());
+ break;
+ case AMOS_OUTPUT :
+ gma . Make_AMOS_Contig (clr_list, tag_list, act);
+ act . writeMessage (amg);
+ amg . write (cout);
+ break;
+ case BANK_OUTPUT :
+ gma . Make_AMOS_Contig (clr_list, tag_list, act);
+ bank << act;
+ break;
+ default :
+ sprintf
+ (Clean_Exit_Msg_Line,
+ "ERROR: Bad output type = %d\n",
+ int (Output_Format));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ return;
+ }
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = false;
+ int ch;
+
+ optarg = NULL;
+
+ while (!errflg && ((ch = getopt (argc, argv, "aAbBcCe:E:fhi:n:o:PsSTuv:")) != EOF))
+ switch (ch)
+ {
+ case 'a' :
+ Output_Format = MULTI_ALIGN_OUTPUT;
+ break;
+
+ case 'A' :
+ Output_Format = AMOS_OUTPUT;
+ break;
+
+ case 'b' :
+ Input_Format = BANK_INPUT;
+ break;
+
+ case 'B' :
+ Output_Format = BANK_OUTPUT;
+ break;
+
+ case 'c' :
+ Do_Contig_Messages = true;
+ Do_Unitig_Messages = false;
+ break;
+
+ case 'C' :
+ Input_Format = CELERA_MSG_INPUT;
+ break;
+
+ case 'e' :
+ Error_Rate = strtod (optarg, NULL);
+ break;
+
+ case 'E' :
+ Extra_fp = File_Open (optarg, "r", __FILE__, __LINE__);
+ break;
+
+ case 'f' :
+ Output_Format = ONLY_FASTA_OUTPUT;
+ break;
+
+ case 'h' :
+ errflg = true;
+ break;
+
+ case 'i':
+ byIID = true;
+ IID_fp.open(optarg, ifstream::in);
+ if (! IID_fp.is_open()){
+ cerr << "Couldn't open " << optarg << endl;
+ exit(1);
+ }
+ break;
+
+ case 'n':
+ byEID = true;
+ EID_fp.open(optarg, ifstream::in);
+ if (! EID_fp.is_open()){
+ cerr << "Couldn't open " << optarg << endl;
+ exit(1);
+ }
+ break;
+
+ case 'o' :
+ Min_Overlap = strtol (optarg, NULL, 10);
+ break;
+
+ case 'P' :
+ Input_Format = PARTIAL_READ_INPUT;
+ break;
+
+ case 's' :
+ Use_SeqNames = true;
+ break;
+
+ case 'S' :
+ Input_Format = SIMPLE_CONTIG_INPUT;
+ break;
+
+ case 'T' :
+ Output_Format = TIGR_CONTIG_OUTPUT;
+ break;
+
+ case 'u' :
+ Do_Unitig_Messages = true;
+ Do_Contig_Messages = false;
+ break;
+
+ case 'v' :
+ Verbose = strtol (optarg, NULL, 10);
+ break;
+
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+
+ default :
+ errflg = true;
+ }
+
+ if (Input_Format == CELERA_MSG_INPUT
+ &&! Do_Unitig_Messages && ! Do_Contig_Messages)
+ {
+ fprintf (stderr, "\nERROR: Must specify either -u or -c\n\n");
+ errflg = true;
+ }
+
+ if (errflg)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if ((Input_Format == BANK_INPUT && optind > argc - 1) ||
+ (Input_Format != BANK_INPUT && optind > argc - 2))
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (Input_Format != BANK_INPUT)
+ Tig_File_Name = argv [optind ++];
+ Bank_Name = argv [optind ++];
+
+ return;
+ }
+
+
+
+static void Sort_By_Low_Pos
+ (vector <int> & fid, vector <Ordered_Range_t> & pos,
+ vector <Ordered_Range_t> & seg)
+
+// Sort the entries in fid and pos (and seg if it's not empty)
+// into ascending order based on the lower of two values in each
+// pos entry. Use an insertion sort since we expect the values are
+// likely to be nearly sorted already.
+
+ {
+ vector <int> low;
+ bool use_seg;
+ Ordered_Range_t save_pos, save_seg;
+ int save_fid, save_low;
+ int n, i;
+
+ n = pos . size ();
+ if (n == 0)
+ return;
+
+ use_seg = (seg . size () > 0);
+
+ for (i = 0; i < n; i ++)
+ low . push_back (Min (pos [i] . getBegin (), pos [i] . getEnd ()));
+
+ for (i = 1; i < n; i ++)
+ {
+ int j;
+
+ if (low [i - 1] <= low [i])
+ continue; // already in order
+
+ save_low = low [i];
+ save_pos = pos [i];
+ save_fid = fid [i];
+ if (use_seg)
+ save_seg = seg [i];
+
+ for (j = i; j > 0 && low [j - 1] > save_low; j --)
+ {
+ low [j] = low [j - 1];
+ pos [j] = pos [j - 1];
+ fid [j] = fid [j - 1];
+ if (use_seg)
+ seg [j] = seg [j - 1];
+ }
+
+ low [j] = save_low;
+ pos [j] = save_pos;
+ fid [j] = save_fid;
+ if (use_seg)
+ seg [j] = save_seg;
+ }
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "\n.USAGE.\n"
+ " %s <tig-file> <bank-name>\n"
+ "\n"
+ ".DESCRIPTION.\n"
+ " Read layout information from <tig-file> describing positions\n"
+ " of reads, and create multialignments and/or consensus sequences\n"
+ " for them. Read sequences are obtained from <bank-name>. The\n"
+ " alphabet supported (acgtmrwsykvhdbn) includes all ambiguities\n"
+ "\n"
+ ".OPTIONS.\n"
+ " -a Output alignments instead of consensus messages\n"
+ " -A Output an AMOS message file\n"
+ " -b Input from AMOS bank\n"
+ " -B Output to an AMOS bank\n"
+ " -c Process contig messages\n"
+ " -C Input is Celera msg format, i.e., a .cgb or .cgw file\n"
+ " -e <x> Set alignment error rate to <x>, e.g., -e 0.05 for 5%% error\n"
+ " -E <fn> Get extra sequences to align from fasta file <fn>\n"
+ " -f Output consensus only in FASTA format\n"
+ " -h Print this usage message\n"
+ " -i <fn> File containing list of IIDs to be processed\n"
+ " -n <fn> File containing list of EIDs (names) to be processed\n"
+ " -o <n> Set minimum overlap bases to <n>\n"
+ " -P Input is simple contig format, i.e., UMD format\n"
+ " using partial reads\n"
+ " -s Output EID seqnames for reads instead of IID ints\n"
+ " -S Input is simple contig format, i.e., UMD format\n"
+ " -T Output in TIGR Assembler contig format\n"
+ " -u Process unitig messages\n"
+ " -v <n> Set verbose level to <n>. Higher produces more output.\n"
+ "\n.KEYWORDS.\n"
+ " reads, consensus\n\n",
+ command);
+
+ return;
+ }
+
+
+
+static void readIIDFile(ifstream & f, list <ID_t> & l)
+ // Reads IIDs from a file
+{
+ ID_t iid;
+
+ while (f >> iid)
+ l.push_back(iid);
+}
+
+static void readEIDFile(ifstream & f, list <string> &l)
+ // Reads EIDs from a file
+{
+ string eid;
+
+ while (f >> eid)
+ l.push_back(eid);
+}
diff --git a/src/Align/maligntest.cc b/src/Align/maligntest.cc
new file mode 100644
index 0000000..ab2f1ea
--- /dev/null
+++ b/src/Align/maligntest.cc
@@ -0,0 +1,202 @@
+// A. L. Delcher
+//
+// File: test.cc
+//
+// Last Modified: 25 November 2002
+//
+// Test program to generate a random sequence. Then generate
+// multiple sequences from it (with errors) and find a multialignment
+// of those sequences.
+
+
+#include "delcher.hh"
+#include "fasta.hh"
+#include "align.hh"
+#include "prob.hh"
+#include "utility_AMOS.hh"
+#include <vector>
+
+
+const int NEW_SIZE = 1000;
+
+
+static char Alphabet [] = "acgt";
+ // Characters from which strings are generated
+
+
+
+static void Make_Copy_With_Errors
+ (const char * ref, char * a, int len, double error);
+static void Usage
+ (const char * command);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ Gapped_Multi_Alignment_t gma;
+ Alignment_t ali;
+ vector <char *> s;
+ vector <int> offset;
+ double error;
+ char * ref, * a;
+ int ref_len;
+ int base_len, delta, num_strings, slop;
+ int i;
+
+ fprintf (stderr, "Starting on %s at %s\n", __DATE__, __TIME__);
+
+ Verbose = 1;
+
+ if (argc < 5)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ num_strings = atoi (argv [1]);
+ base_len = atoi (argv [2]);
+ delta = atoi (argv [3]);
+ error = strtod (argv [4], NULL);
+
+ fprintf (stderr, "error = %.5f\n", error);
+
+ // generate num_strings of approximate length base_len
+ // (may vary because of indels) each chosen starting delta
+ // letters after the preceding from a single reference string
+ // with error rate of error
+
+ slop = int (10 + base_len * 2.0 * error);
+ // extra length to allow for indels
+ ref_len = base_len + (num_strings - 1) * delta + slop;
+ a = (char *) AMOS::SafeMalloc (1 + base_len + slop);
+ ref = (char *) AMOS::SafeMalloc (1 + ref_len);
+
+ for (i = 0; i < ref_len; i ++)
+ ref [i] = Alphabet [lrand48 () % 4];
+ ref [i] = '\0';
+
+ for (i = 0; i < num_strings; i ++)
+ {
+ char * p;
+ int off;
+
+ Make_Copy_With_Errors (ref + i * delta, a, base_len, error);
+ p = strdup (a);
+ s . push_back (p);
+ if (i == 0)
+ off = 0;
+ else
+ off = delta;
+ offset . push_back (off);
+ }
+
+ if (Verbose > 1)
+ {
+ char tag [1000];
+
+ sprintf (tag, "Reference");
+ Fasta_Print (stdout, ref, tag);
+
+ for (i = 0; i < num_strings; i ++)
+ {
+ sprintf (tag, "%d offset = %d", i + 1, offset [i]);
+ Fasta_Print (stdout, s [i], tag);
+ }
+ }
+
+ Multi_Align ("Test", s, offset, 5, 0.04, 10, gma);
+
+ gma . Print (stderr, s, 60);
+
+ for (i = 0; i < num_strings - 1; i ++)
+ {
+ bool ans;
+
+ ans = Overlap_Match_VS
+ (s [i + 1], strlen (s [i + 1]), s [i], strlen (s [i]),
+ offset [i + 1] - 4, offset [i + 1] + 4, base_len / 2, slop, ali);
+
+ if (! ans)
+ printf ("Not found\n");
+ else
+ {
+ printf ("\nFound at %d\n", ali . b_lo);
+ ali . Print (stdout, s [i + 1], s [i]);
+ }
+ }
+
+ return 0;
+ }
+
+
+
+static void Make_Copy_With_Errors
+ (const char * ref, char * a, int len, double error)
+
+// Copy the first len characters of ref into a but insert errors
+// with probability error .
+
+ {
+ int i, j;
+
+ i = 0;
+ for (j = 0; j < len && ref [j] != '\0'; )
+ {
+ if (drand48 () >= error)
+ a [i ++] = ref [j ++];
+ else
+ {
+ double p;
+
+ p = drand48 ();
+ if (p < 0.333)
+ {
+ int q;
+
+ q = lrand48 () % 4;
+ if (Alphabet [q] == ref [j])
+ a [i] = Alphabet [(q + 1 + lrand48 () % 3) % 4];
+ else
+ a [i] = Alphabet [q];
+ i ++;
+ j ++;
+ }
+ else if (p < 0.667)
+ j ++;
+ else
+ a [i ++] = Alphabet [lrand48 () % 4];
+ }
+ }
+ a [i] = '\0';
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "USAGE: %s <num_strings> <base_len> <delta> <error>\n"
+ "\n"
+ "Generate <num_strings> of approximate length <base_len>\n"
+ "(may vary because of indels) each chosen starting <delta>\n"
+ "letters after the preceding from a single reference string\n"
+ "with error rate of <error> \n"
+ "\n"
+ "Options:\n"
+ " none\n"
+ "\n",
+ command);
+
+ return;
+ }
diff --git a/src/Align/matrix.hh b/src/Align/matrix.hh
new file mode 100644
index 0000000..432ea10
--- /dev/null
+++ b/src/Align/matrix.hh
@@ -0,0 +1,53 @@
+// A. L. Delcher
+//
+// File: matrix.hh
+//
+// Last Modified: 12 September 2003
+//
+// Define a simple 2D array class
+
+
+#ifndef __MATRIX_HH_INCLUDED
+#define __MATRIX_HH_INCLUDED
+
+
+#include <delcher.hh>
+
+
+
+template <class DT>
+class Matrix
+ {
+ private:
+ int rows, cols;
+ DT * data;
+
+ public:
+ Matrix
+ (int r, int c)
+ {
+ data = (DT *) Safe_calloc (r * c, sizeof (DT));
+ rows = r;
+ cols = c;
+ }
+ ~ Matrix
+ ()
+ {
+ free (data);
+ }
+ DT & get
+ (int i, int j)
+ {
+ return * (data + i * cols + j);
+ }
+ DT * getRow
+ (int i)
+ { return data + i * cols; }
+ int NumRows
+ (void) const
+ { return rows; }
+ };
+
+
+
+#endif
diff --git a/src/Align/merge-contigs.cc b/src/Align/merge-contigs.cc
new file mode 100644
index 0000000..8153467
--- /dev/null
+++ b/src/Align/merge-contigs.cc
@@ -0,0 +1,920 @@
+// A. L. Delcher
+//
+// File: merge-contigs.cc
+//
+// Last Modified: 15 August 2003
+//
+// Read Celera-format contigs and merge their multialignments
+
+
+#include "foundation_AMOS.hh"
+#include "delcher.hh"
+#include "CelMsg.hh"
+#include "align.hh"
+#include "prob.hh"
+#include "fasta.hh"
+#include <vector>
+#include <string>
+#include <algorithm>
+
+
+using namespace std;
+using namespace AMOS;
+
+
+const int END_FUDGE_BASES = 5;
+ // If match is within this many bases of the end, regard it as
+ // matching to the end
+const int MAX_LINE = 1000;
+const int NEW_SIZE = 1000;
+
+
+enum Input_Format_t
+ {SIMPLE_CONTIG_FORMAT, CELERA_MSG_FORMAT};
+
+struct ID_Pair_t
+ {
+ int uid, iid;
+ };
+
+struct Coord_Line_t
+ {
+ int r_lo, r_hi;
+ int q_start, q_end;
+ int r_match_len, q_match_len;
+ double percent_id;
+ int r_len, q_len;
+ double r_percent_matched, q_percent_matched;
+ int r_id, q_id;
+ };
+
+// The following describes how a contig (or part of it) maps to the
+// consensus of the merged contig begin built
+
+struct Contig_Map_Entry_t
+ {
+ int id;
+ int len;
+ int start, end;
+ // in ungapped consensus of merged contig
+ };
+
+struct Unitig_Ref_t
+ {
+ int uid;
+ char * seq;
+ };
+
+
+
+static string Bank_Name;
+ // Name of read bank from which reads are obtained
+static string CCO_File_Name;
+ // Name of file containing input contig/unitig messages
+static string Coords_File_Name;
+ // Name of file containing NUCmer coords info
+static string Map_File_Name;
+ // Name of file containing uid-iid map
+static bool Output_Multialignment = false;
+ // If set true by -a option then output the .mali file
+static string Output_Prefix;
+ // Prefix used for output file names
+static string Unitig_File_Name;
+ // Name of fasta file surrogate unitig sequences
+
+
+static bool Range_Precedes
+ (const Ordered_Range_t & a, const Ordered_Range_t & b)
+ {
+ int a_start, a_end, b_start, b_end;
+
+ a_start = a . getBegin ();
+ a_end = a . getEnd ();
+ b_start = b . getBegin ();
+ b_end = b . getEnd ();
+
+ if (a_end < a_start)
+ Swap (a_start, a_end);
+ if (b_end < b_start)
+ Swap (b_start, b_end);
+
+ if (a_start < b_start)
+ return true;
+ if (a_start == b_start && a_end < b_end)
+ return true;
+
+ return false;
+ }
+
+
+static void Copy
+ (vector <char *> & S, const vector <char *> & T);
+static int Find_Map_Entry
+ (int id, const vector <Contig_Map_Entry_t> & map);
+static int Find_Unitig
+ (int uid, const vector <Unitig_Ref_t> & uni_list);
+static void Get_Strings_And_Lengths
+ (vector <char *> & s, vector <char *> & q, vector <int> & str_len,
+ vector <char *> & tag, const Celera_Message_t & msg,
+ Bank_t & read_bank, const vector <ID_Pair_t> & map,
+ const vector <Unitig_Ref_t> & uni_list);
+static void Load_ID_Map
+ (vector <ID_Pair_t> & map, const char * fn);
+static void Load_Unitigs
+ (vector <Unitig_Ref_t> & uni_list, const char * fn);
+static int Lookup
+ (int uid, const vector <ID_Pair_t> & map);
+static void Output_Variant
+ (FILE * fp, int ref_id, int q_id, bool q_flipped,
+ int r_lo, int r_hi, int q_lo, int q_hi,
+ const Gapped_Multi_Alignment_t & gma);
+static void Parse_Command_Line
+ (int argc, char * argv []);
+static void Usage
+ (const char * command);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ Bank_t read_bank (Read_t::NCODE);
+ Celera_Message_t msg;
+ Read_t read;
+ FILE * cco_fp, * coords_fp;
+ FILE * rpos_fp, * mali_fp, * ref_fp, * vary_fp;
+ vector <char *> string_list, qual_list, tag;
+ vector <char *> ref_sl, sl2;
+ vector <char *> ref_tag, tg2;
+ vector <int> sl2_place;
+ vector <int> offset;
+ vector <int> ref, str_len;
+ vector <Range_t> pos;
+ vector < vector <int> > del_list;
+ Gapped_Multi_Alignment_t ref_gma, gma2;
+ vector <ID_Pair_t> map;
+ vector <Unitig_Ref_t> uni_list;
+ vector <Distinguishing_Column_t> dc;
+ vector <Contig_Map_Entry_t> contig_map;
+ Contig_Map_Entry_t map_entry;
+ Coord_Line_t c;
+ string ref_string;
+ int acc, len, prefix_len_added, right_tail;
+ bool result, same_ref, same_query, q_flipped;
+ bool full_merge_left = false, full_merge_right = false;
+ bool first = true, skip_left_variant;
+ time_t now;
+ char buff [MAX_LINE];
+ int orig_ref_tag_ct;
+ int prev_ref_id = -1, prev_q_id = -1, right_string_id = -1;
+ int prev_ref_end = -1, prev_q_hi = 0, prev_q_len;
+ int q_lo, q_hi;
+ int match_ct = 0;
+
+ now = time (NULL);
+ cerr << "Starting at " << ctime (& now) << endl;
+
+ Verbose = 0;
+
+ Parse_Command_Line (argc, argv);
+
+ cerr << "Read bank is " << Bank_Name << endl;
+ cerr << "Processing NUCmer coords from file " << Coords_File_Name << endl;
+ cerr << "Processing CCO messages from file " << CCO_File_Name << endl;
+ cerr << "Map file is " << Map_File_Name << endl;
+
+ Load_ID_Map (map, Map_File_Name . c_str ());
+ Load_Unitigs (uni_list, Unitig_File_Name . c_str ());
+
+ coords_fp = File_Open (Coords_File_Name . c_str (), "r");
+ cco_fp = File_Open (CCO_File_Name . c_str (), "r");
+ read_bank . open (Bank_Name, B_READ);
+
+ sprintf (buff, "%s.rpos", Output_Prefix . c_str ());
+ rpos_fp = File_Open (buff, "w");
+ if (Output_Multialignment)
+ {
+ sprintf (buff, "%s.mali", Output_Prefix . c_str ());
+ mali_fp = File_Open (buff, "w");
+ }
+ sprintf (buff, "%s.ref", Output_Prefix . c_str ());
+ ref_fp = File_Open (buff, "w");
+ sprintf (buff, "%s.vary", Output_Prefix . c_str ());
+ vary_fp = File_Open (buff, "w");
+
+ ref_gma . setPrintFlag (PRINT_WITH_DIFFS);
+ ref_gma . setPrintFlag (PRINT_USING_STRING_SUB);
+ gma2 . setPrintFlag (PRINT_WITH_DIFFS);
+ gma2 . setPrintFlag (PRINT_USING_STRING_SUB);
+
+ while (fscanf (coords_fp, "%d %d %d %d %d %d %lf %d %d %lf %lf %d %d",
+ & c . r_lo, & c . r_hi, & c . q_start, & c . q_end,
+ & c . r_match_len, & c . q_match_len, & c . percent_id,
+ & c . r_len, & c . q_len, & c . r_percent_matched,
+ & c . q_percent_matched, & c . r_id, & c . q_id) == 13)
+ {
+ match_ct ++;
+
+ same_ref = (c . r_id == prev_ref_id);
+ same_query = (same_ref && c . q_id == prev_q_id);
+
+ if (! first && ! same_query && ! full_merge_right
+ && right_string_id != prev_q_id && q_hi < prev_q_len)
+ { // need to output variant to end of query string
+ Output_Variant (vary_fp, prev_ref_id, prev_q_id, q_flipped,
+ prev_ref_end, -1, prev_q_hi, prev_q_len, gma2);
+ }
+
+ if (! same_ref)
+ {
+ if (! first)
+ {
+ // output info for this merged contig
+// ref_gma . Haplo_Sep (sl1, dc, & tg1);
+ if (Output_Multialignment)
+ {
+ fprintf (mali_fp, "\nContig %d:\n\n", prev_ref_id);
+ ref_gma . Print (mali_fp, ref_sl, 60, & ref_tag);
+// ref_gma . Print (mali_fp, ref_sl, 60);
+ }
+ ref_gma . Get_Ungapped_Consensus (ref_string);
+ len = ref_string . length ();
+ ref_gma . Output_Read_Positions (rpos_fp,
+ prev_ref_id, ref_tag, orig_ref_tag_ct, len, 0);
+ sprintf (buff, "%d merged len=%d reads=%d",
+ prev_ref_id, len, int (ref_sl . size ()));
+ Fasta_Print (ref_fp, ref_string . c_str (), buff);
+ printf ("\nFinished merge for ref %d\n", prev_ref_id);
+ }
+ contig_map . clear ();
+ ref_gma . Clear ();
+ gma2 . Clear ();
+ prefix_len_added = 0;
+ full_merge_left = full_merge_right = false;
+
+ // Read next cco message and convert to gma
+ result = msg . read (cco_fp);
+ if (! result || msg . getMsgType () != CCO_MSG)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Failed to read expected CCO message for id = %d",
+ c . r_id);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ acc = strtol (msg . getAccession () . c_str () + 1, NULL, 10);
+ if (acc != c . r_id)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Expecting ref CCO %d read %d instead",
+ c . r_id, acc);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ Get_Strings_And_Lengths
+ (string_list, qual_list, str_len, tag, msg, read_bank, map,
+ uni_list);
+ ref_gma . Make_From_CCO_Msg (msg, str_len);
+ Copy (ref_sl, string_list);
+ Copy (ref_tag, tag);
+ orig_ref_tag_ct = tag . size ();
+ ref_gma . Set_String_Subs ();
+ len = ref_gma . Ungapped_Consensus_Len ();
+ map_entry . id = c . r_id;
+ map_entry . len = len;
+ map_entry . start = 0;
+ map_entry . end = len;
+ contig_map . push_back (map_entry);
+
+ ref_string . erase ();
+ right_string_id = -1;
+
+ if (Verbose > 2)
+ {
+ printf ("\nRef Contig %d\n", c . r_id);
+ ref_gma . Print (stdout, ref_sl, 60, & ref_tag);
+ }
+ printf ("\nStart merge for ref %d\n", c . r_id);
+ }
+
+ if (! same_query)
+ {
+ if (same_ref)
+ printf ("\nFinished query %d\n", prev_q_id);
+ result = msg . read (cco_fp);
+ if (! result || msg . getMsgType () != CCO_MSG)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Failed to read expected CCO message for id = %d",
+ c . q_id);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ acc = strtol (msg . getAccession () . c_str () + 1, NULL, 10);
+ if (acc != c . q_id)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Expecting query CCO %d read %d instead",
+ c . q_id, acc);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ Get_Strings_And_Lengths
+ (string_list, qual_list, str_len, tag, msg, read_bank, map,
+ uni_list);
+ gma2 . Make_From_CCO_Msg (msg, str_len);
+ Copy (sl2, string_list);
+ Copy (tg2, tag);
+ sl2_place . clear ();
+ sl2_place . resize (string_list . size (), -1);
+ prev_ref_end = -1;
+ prev_q_hi = 0;
+
+ if (Verbose > 2)
+ {
+ printf ("\nQuery Contig %d\n", c . q_id);
+ gma2 . Print (stdout, sl2, 60, & tg2);
+ }
+ printf ("\nStart merge for query %d\n", c . q_id);
+ }
+
+ prev_ref_id = c . r_id;
+ prev_q_id = c . q_id;
+
+ // adjust if previously added a prefix to this reference string
+ right_tail = c . r_len - c . r_hi;
+ c . r_lo += prefix_len_added;
+ c . r_hi += prefix_len_added;
+
+ // do overlaps
+ if (c . q_start < c . q_end)
+ {
+ q_lo = c . q_start - 1;
+ q_hi = c . q_end;
+ q_flipped = false;
+ }
+ else
+ {
+ if (! same_query)
+ gma2 . Reverse_Complement (sl2);
+ q_lo = c . q_len - c . q_start;
+ q_hi = 1 + c . q_len - c . q_end;
+ q_flipped = true;
+ }
+
+ skip_left_variant = false;
+ if (! full_merge_left && c . r_lo <= 1 + END_FUDGE_BASES
+ && 0 <= q_lo - c . r_lo)
+ {
+ int adjusted_q_lo;
+ // low bound on where match is allowed to start
+
+ adjusted_q_lo = Max (0, 1 + q_lo - c . r_lo - END_FUDGE_BASES);
+
+ ref_gma . Full_Merge_Left (gma2, adjusted_q_lo, q_lo, q_hi,
+ c . r_lo - 1, c . r_hi, prefix_len_added, ref_sl, sl2, sl2_place,
+ & ref_tag, & tg2);
+
+ c . r_lo += prefix_len_added;
+ c . r_hi += prefix_len_added;
+ full_merge_left = skip_left_variant = true;
+ }
+ else if (! full_merge_right && right_tail <= END_FUDGE_BASES
+ && right_tail < c . q_len - q_hi)
+ {
+ ref_gma . Full_Merge_Right (gma2, q_lo, c . r_lo - 1,
+ ref_sl, sl2, sl2_place, & ref_tag, & tg2);
+
+ right_string_id = c . q_id;
+ full_merge_right = true;
+ }
+ else
+ {
+ ref_gma . Partial_Merge (gma2, q_lo, q_hi, c . r_lo - 1,
+ c . r_hi, ref_sl, sl2, sl2_place, & ref_tag, & tg2);
+ }
+
+ if (! skip_left_variant && 0 < q_lo
+ && (prev_ref_end < c . r_lo || prev_q_hi < q_lo))
+ Output_Variant (vary_fp, prev_ref_id, prev_q_id, q_flipped,
+ prev_ref_end, c . r_lo - 1, prev_q_hi, q_lo, gma2);
+
+ prev_ref_end = c . r_hi;
+ prev_q_hi = q_hi;
+ prev_q_len = c . q_len;
+ first = false;
+
+ if (Verbose > 2)
+ {
+ printf ("\nRef after first merge\n");
+ ref_gma . Print (stdout, ref_sl, 60, & ref_tag);
+ }
+
+ // push appropriate entries onto contig_map;
+ }
+
+ // handle any leftover matches at end of file
+ if (! first)
+ {
+ if (right_string_id != prev_q_id && ! full_merge_right
+ && q_hi < prev_q_len)
+ { // need to output variant to end of query string
+ Output_Variant (vary_fp, prev_ref_id, prev_q_id, q_flipped,
+ prev_ref_end, -1, prev_q_hi, prev_q_len, gma2);
+ }
+ // output info for this merged contig
+// ref_gma . Haplo_Sep (sl1, dc, & tg1);
+ if (Output_Multialignment)
+ {
+ fprintf (mali_fp, "\nContig %d:\n\n", prev_ref_id);
+ ref_gma . Print (mali_fp, ref_sl, 60, & ref_tag);
+// ref_gma . Print (mali_fp, true, false, true, 60);
+ }
+ ref_gma . Get_Ungapped_Consensus (ref_string);
+ len = ref_string . length ();
+ ref_gma . Output_Read_Positions (rpos_fp,
+ prev_ref_id, ref_tag, orig_ref_tag_ct, len, 0);
+ sprintf (buff, "%d merged len=%d reads=%d",
+ prev_ref_id, len, int (ref_sl . size ()));
+ Fasta_Print (ref_fp, ref_string . c_str (), buff);
+ printf ("\nFinished merge for ref %d\n", prev_ref_id);
+ }
+
+
+ fclose (coords_fp);
+ fclose (cco_fp);
+ fclose (rpos_fp);
+ if (Output_Multialignment)
+ fclose (mali_fp);
+ fclose (ref_fp);
+ fclose (vary_fp);
+ read_bank . close ();
+
+
+if (0)
+{
+ int i, n;
+
+ n = ref_tag . size ();
+ for (i = 0; i < n; i ++)
+ ref_tag [i] [0] = 'a';
+
+ n = tg2 . size ();
+ for (i = 0; i < n; i ++)
+ tg2 [i] [0] = 'b';
+}
+
+#if 0
+ {
+ int cons_len = gma2 . Ungapped_Consensus_Len ();
+
+// gma1 . Partial_Merge (gma2, cons_len - 3731, cons_len - 2452, 1322, 2638,
+// sl1, sl2, sl2_place, & tg1, & tg2);
+
+ gma2 . Reverse_Complement (sl2);
+ cout << endl << endl << "Contig #2 after reverse" << endl;
+ gma2 . Print (stdout, sl2, true, true, 60);
+
+ gma1 . Partial_Merge (gma2, cons_len - 3731, cons_len - 2566, 1322, 2487,
+ sl1, sl2, sl2_place, & tg1, & tg2);
+ gma1 . Partial_Merge (gma2, cons_len - 2474, cons_len - 236, 3080, 5324,
+ sl1, sl2, sl2_place, & tg1, & tg2);
+
+ cout << endl << endl << "Contig #1 after merge" << endl;
+ gma1 . Print (stdout, sl1, true, true, 60, & tg1);
+ }
+#endif
+
+
+ return 0;
+ }
+
+
+
+static void Copy
+ (vector <char *> & S, const vector <char *> & T)
+
+// Copy contents of T into S allocating new memory
+// for each string
+
+ {
+ int i, n;
+
+ n = S . size ();
+ for (i = 0; i < n; i ++)
+ free (S [i]);
+ S . clear ();
+
+ n = T . size ();
+ for (i = 0; i < n; i ++)
+ S . push_back (strdup (T [i]));
+
+ return;
+ }
+
+
+
+static int Find_Map_Entry
+ (int id, const vector <Contig_Map_Entry_t> & map)
+
+// Search for id in map and return the subscript of
+// where it was found, or else -1 if it wasn't found.
+
+ {
+ int i, n;
+
+ n = map . size ();
+ for (i = 0; i < n; i ++)
+ if (map [i] . id == id)
+ return i;
+
+ return -1;
+ }
+
+
+
+static int Find_Unitig
+ (int uid, const vector <Unitig_Ref_t> & uni_list)
+
+// Search for the entry in uni_list whose uid field matches
+// uid and return the subscript of that entry. Return -1
+// if none is found. uni_list is assumed to be in sorted order by
+// uid so a binary search is done.
+
+ {
+ int lo, hi, mid;
+
+ lo = 0;
+ hi = uni_list . size () - 1;
+ while (lo <= hi)
+ {
+ mid = (lo + hi) / 2;
+ if (uid == uni_list [mid] . uid)
+ return mid;
+ else if (uid < uni_list [mid] . uid)
+ hi = mid - 1;
+ else
+ lo = mid + 1;
+ }
+
+ return -1;
+ }
+
+
+
+static void Get_Strings_And_Lengths
+ (vector <char *> & s, vector <char *> & q, vector <int> & str_len,
+ vector <char *> & tag, const Celera_Message_t & msg,
+ Bank_t & read_bank, const vector <ID_Pair_t> & map,
+ const vector <Unitig_Ref_t> & uni_list)
+
+// Populate s with reads for the contig in msg with reads coming
+// from read_bank , which must already be opened. Put the corresponding
+// quality-value strings for the reads into q , put the lengths of
+// the reads into str_len , and put an identifying tag for
+// each string in tag . Use map to convert uids
+// (which is what's in the CCO messages) to iids (which is what's in
+// the read bank). Get surrogate unitig sequences from uni_list .
+
+ {
+ const vector <Celera_MPS_Sub_Msg_t> & frgs = msg . getMPSList ();
+ const vector <Celera_UPS_Sub_Msg_t> & unis = msg . getUPSList ();
+ vector <int> id_list;
+ Read_t read;
+ Ordered_Range_t position;
+ char tag_buff [MAX_LINE];
+ char * tmp;
+ int len;
+ int a, b, i, j, n;
+
+ n = s . size ();
+ for (i = 0; i < n; i ++)
+ free (s [i]);
+ s . clear ();
+
+ n = q . size ();
+ for (i = 0; i < n; i ++)
+ free (q [i]);
+ q . clear ();
+
+ n = tag . size ();
+ for (i = 0; i < n; i ++)
+ free (tag [i]);
+ tag . clear ();
+
+ str_len . clear ();
+
+ n = msg . getNumFrags ();
+ for (i = 0; i < n; i ++)
+ {
+ string seq;
+ string qual;
+ Range_t clear;
+ int uid;
+ int qlen;
+
+ position = frgs [i] . getPosition ();
+ a = position . getBegin ();
+ b = position . getEnd ();
+
+ uid = frgs [i] . getId ();
+ read_bank . fetch (Lookup (uid,map), read);
+ clear = read . getClearRange ();
+ if (Verbose > 2)
+ cerr << read;
+ seq = read . getSeqString (clear);
+ qual = read . getQualString (clear);
+ if (b < a)
+ {
+ Reverse_Complement (seq);
+ reverse (qual . begin (), qual . end ());
+ }
+
+ len = seq . length ();
+ tmp = strdup (seq . c_str ());
+ for (j = 0; j < len; j ++)
+ tmp [j] = tolower (tmp [j]);
+ s . push_back (tmp);
+
+ qlen = qual . length ();
+ if (len != qlen)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Sequence length (%d) != quality length (%d) for read %d",
+ len, qlen, uid);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ tmp = strdup (qual . c_str ());
+ q . push_back (tmp);
+
+ str_len . push_back (len);
+
+ sprintf (tag_buff, "r%d", uid);
+ tag . push_back (strdup (tag_buff));
+ }
+
+ n = msg . getNumUnitigs ();
+ if (Verbose > 2)
+ printf ("Num unitigs = %d\n", n);
+ for (i = 0; i < n; i ++)
+ {
+ Celera_Unitig_Type_t u_type;
+ int uid;
+
+ position = unis [i] . getPosition ();
+ a = position . getBegin ();
+ b = position . getEnd ();
+
+ uid = unis [i] . getId ();
+ u_type = unis [i] . getUnitigType ();
+ if (Verbose > 2)
+ printf ("Unitig %8d %c\n", uid, Convert_Char (u_type));
+ if (u_type == STONE_UNI_T)
+ {
+ j = Find_Unitig (uid, uni_list);
+ if (j < 0)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Could not find unitig %d in unitig list",
+ uid);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ len = strlen (uni_list [j] . seq);
+ tmp = strdup (uni_list [j] . seq);
+ for (j = 0; j < len; j ++)
+ tmp [j] = tolower (tmp [j]);
+ if (b < a)
+ Reverse_Complement (tmp);
+ s . push_back (tmp);
+
+ // Make artificial quality string of all 10's
+ tmp = (char *) SafeMalloc (len + 1);
+ memset (tmp, MIN_QUALITY + 10, len);
+ tmp [len] = '\0';
+ q . push_back (tmp);
+
+ str_len . push_back (len);
+
+ sprintf (tag_buff, "u%d", uid);
+ tag . push_back (strdup (tag_buff));
+ }
+ }
+
+ return;
+ }
+
+
+
+static void Load_ID_Map
+ (vector <ID_Pair_t> & map, const char * fn)
+
+// Load the iid-uid map from the file name fn into
+// map .
+
+ {
+ FILE * fp;
+ char tag [MAX_LINE];
+ ID_Pair_t pair;
+
+ map . clear ();
+ fp = File_Open (fn, "r");
+ while (fscanf (fp, "%d %d %s", & pair . uid, & pair . iid, tag) == 3)
+ if (strcmp (tag, "AFG") == 0)
+ map . push_back (pair);
+
+ fclose (fp);
+
+ return;
+ }
+
+
+
+static void Load_Unitigs
+ (vector <Unitig_Ref_t> & uni_list, const char * fn)
+
+// Load unitigs from the file named fn and store them in uni .
+
+ {
+ FILE * fp;
+ string s, tag;
+ Unitig_Ref_t u;
+
+ uni_list . clear ();
+ fp = File_Open (fn, "r");
+ while (Fasta_Read (fp, s, tag))
+ {
+ u . uid = int (strtol (tag . c_str (), NULL, 10));
+ if (u . uid == 0)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Bad unitig uid \"%s\"",
+ tag . c_str ());
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ u . seq = strdup (s . c_str ());
+ uni_list . push_back (u);
+ }
+
+ fclose (fp);
+
+ return;
+ }
+
+
+
+static int Lookup
+ (int uid, const vector <ID_Pair_t> & map)
+
+// Find uid in sorted list map and return the corresponding
+// iid . Fail if not found.
+
+ {
+ int lo, hi, mid;
+
+ lo = 0; hi = map . size () - 1;
+ while (lo <= hi)
+ {
+ mid = (lo + hi) / 2;
+ if (map [mid] . uid == uid)
+ return map [mid] . iid;
+ else if (uid < map [mid] . uid)
+ hi = mid - 1;
+ else
+ lo = mid + 1;
+ }
+
+ cerr << "Lookup of uid " << uid << " failed" << endl;
+ exit (EXIT_FAILURE);
+ }
+
+
+
+static void Output_Variant
+ (FILE * fp, int ref_id, int q_id, bool q_flipped,
+ int r_lo, int r_hi, int q_lo, int q_hi,
+ const Gapped_Multi_Alignment_t & gma)
+
+// Output to fp an indication of the variant sequence between
+// the reference region r_lo .. r_hi and the query sequence
+// in the consensus of gma for region q_lo .. q_hi .
+// ref_id and q_id are the ids of the reference and query
+// sequences, respectively. q_flipped indicates whether the
+// query sequence is reverse complemented wrt the reference.
+// All coordinates are gapped.
+
+ {
+ string seq;
+ char buff [MAX_LINE];
+ int q_start, q_end, q_len;
+
+ q_len = gma . Ungapped_Consensus_Len ();
+ if (q_flipped)
+ {
+ q_start = q_len - q_lo;
+ q_end = q_len - q_hi;
+ }
+ else
+ {
+ q_start = q_lo;
+ q_end = q_hi;
+ }
+
+ sprintf (buff, "%d %d %d %d %d %d",
+ ref_id, q_id, r_lo, r_hi, q_start, q_end);
+
+ gma . Get_Partial_Ungapped_Consensus (seq, q_lo, q_hi);
+
+ Fasta_Print (fp, seq . c_str (), buff);
+
+ return;
+ }
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = false;
+ int ch;
+
+ optarg = NULL;
+
+ while (! errflg && ((ch = getopt (argc, argv, "ah")) != EOF))
+ switch (ch)
+ {
+ case 'a' :
+ Output_Multialignment = true;
+ break;
+
+ case 'h' :
+ errflg = true;
+ break;
+
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+
+ default :
+ errflg = true;
+ }
+
+ if (errflg)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (optind > argc - 6)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ Coords_File_Name = argv [optind ++];
+ CCO_File_Name = argv [optind ++];
+ Bank_Name = argv [optind ++];
+ Map_File_Name = argv [optind ++];
+ Unitig_File_Name = argv [optind ++];
+ Output_Prefix = argv [optind ++];
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "USAGE: merge-contigs <coords-file> <cco-file> <bank-name>\n"
+ " <map-file> <unitig-file> <out-prefix>\n"
+ "\n"
+ "Read NUCmer coords output from <coords-file> and use it to\n"
+ "output merged contigs. Contigs come from CCO messages in\n"
+ "<cco-file> and must be in the order of appearance in <coords-file>.\n"
+ "Reads are obtained from <bank-name>. <map-file> gives the uid-iid\n"
+ "mapping for reads. <unitig-file> is the fasta sequence of\n"
+ "surrogate unitigs\n"
+ "Output files produced are:\n"
+ " <out-prefix>.rpos contig lengths and positions of reads in them\n"
+ " <out-prefix>.mali multialignment of reads to contigs\n"
+ " <out-prefix>.ref reference sequence for contigs\n"
+ " <out-prefix>.vary indications of SNPs are larger variations\n"
+ " relative to the reference\n"
+ "\n"
+ "Options:\n"
+ " -a Output the <out-prefix>.mali file\n"
+ " -h Print this usage message\n"
+ "\n");
+
+ return;
+ }
+
+
+
diff --git a/src/Align/missing-reads.cc b/src/Align/missing-reads.cc
new file mode 100644
index 0000000..306c99e
--- /dev/null
+++ b/src/Align/missing-reads.cc
@@ -0,0 +1,280 @@
+// Read assembly read-info information from stdin and output a list of
+// reads *not* in the assembly whose mates *are* in the assembly.
+// Also output which gap in which scaffold each should go in.
+// Output goes to stdout
+
+#include <cstdio>
+#include <cstdlib>
+#include <cmath>
+#include <vector>
+#include <algorithm>
+#include <cassert>
+#include <cstring>
+
+using namespace std;
+
+const int MAX_LINE = 1000;
+
+
+
+struct Read_Info_t
+ {
+ int id;
+ int mate_id;
+ int dst;
+ int unitig_id, contig_id;
+ int c_a_pos, c_b_pos;
+
+ Read_Info_t ()
+ {
+ mate_id = -1;
+ contig_id = -1;
+ unitig_id = -1;
+ }
+ };
+
+
+struct Contig_Info_t
+ {
+ int id;
+ int scaff_id;
+ int scaff_place; // ordinal position in scaffold, starting at 1
+ char ori; // orientation in scaffold, forward or reverse
+ double gap_mean; // immediately preceding gap
+ double gap_stddev;
+
+ Contig_Info_t ()
+ {
+ scaff_id = -1;
+ }
+ };
+
+
+struct Dst_Info_t
+ {
+ double mean;
+ double stddev;
+ };
+
+
+
+bool Contig_Cmp
+ (const Contig_Info_t & a, const Contig_Info_t & b)
+ { return a . id < b . id; }
+
+bool Read_Cmp
+ (const Read_Info_t & a, const Read_Info_t & b)
+ { return a . id < b . id; }
+
+
+static int Find_ID
+ (vector <Read_Info_t> & read, int id);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ vector <Read_Info_t> read;
+ vector <Contig_Info_t> contig;
+ vector <Dst_Info_t> dst;
+ Read_Info_t new_read;
+ char line [MAX_LINE];
+ bool found, reads_sorted = false;
+ int id1, id2;
+ int a, b;
+ int i, n;
+
+ while (fgets (line, MAX_LINE, stdin) != NULL)
+ {
+ char tag [10], ori [10], typ [10];
+ double mean, stddev;
+
+ sscanf (line, "%s", tag);
+ if (strcmp (tag, "LKG") == 0)
+ {
+ sscanf (line + 4, "%d %d %lf %lf %s",
+ & id1, & id2, & mean, & stddev, ori);
+
+ if (ori [0] != 'I')
+ {
+ fprintf (stderr, "ERROR: Unexpected orientation \"%s\"\n",
+ ori);
+ fputs (line, stderr);
+ exit (EXIT_FAILURE);
+ }
+
+ n = dst . size ();
+ found = false;
+ for (i = 0; i < n && ! found; i ++)
+ if (dst [i] . mean == mean && dst [i] . stddev == stddev)
+ {
+ found = true;
+ break;
+ }
+ if (! found)
+ {
+ Dst_Info_t new_dst;
+
+ new_dst . mean = mean;
+ new_dst . stddev = stddev;
+ dst . push_back (new_dst);
+ }
+
+ new_read . id = id1;
+ new_read . mate_id = id2;
+ new_read . dst = i;
+ read . push_back (new_read);
+
+ new_read . id = id2;
+ new_read . mate_id = id1;
+ read . push_back (new_read);
+ }
+ else if (strcmp (tag, "CCO") == 0)
+ {
+ if (! reads_sorted)
+ {
+ sort (read . begin (), read . end (), Read_Cmp);
+ reads_sorted = true;
+ }
+ sscanf (line + 4, "%d %d %d %d %s",
+ & id1, & id2, & a, & b, typ);
+
+ if (typ [0] != 'R')
+ {
+ fprintf (stderr, "ERROR: Unexpected type \"%s\"\n",
+ ori);
+ fputs (line, stderr);
+ exit (EXIT_FAILURE);
+ }
+
+ i = Find_ID (read, id1);
+ if (i < 0)
+ {
+ ; // has no mate, do nothing
+ }
+ else
+ {
+ assert (read [i] . id == id1);
+ read [i] . contig_id = id2;
+ read [i] . c_a_pos = a;
+ read [i] . c_b_pos = b;
+ }
+ }
+ else if (strcmp (tag, "UTG") == 0)
+ {
+ if (! reads_sorted)
+ {
+ sort (read . begin (), read . end (), Read_Cmp);
+ reads_sorted = true;
+ }
+ sscanf (line + 4, "%d %d %d %d %s",
+ & id1, & id2, & a, & b, typ);
+
+ if (typ [0] != 'R')
+ {
+ fprintf (stderr, "ERROR: Unexpected type \"%s\"\n",
+ ori);
+ fputs (line, stderr);
+ exit (EXIT_FAILURE);
+ }
+
+ i = Find_ID (read, id1);
+ if (i < 0)
+ {
+ ; // has no mate, do nothing
+ }
+ else
+ {
+ assert (read [i] . id == id1);
+ read [i] . unitig_id = id2;
+ }
+ }
+ else if (strcmp (tag, "SCF") == 0)
+ {
+ Contig_Info_t c;
+
+ sscanf (line + 4, "%d %d %d %s %lf %lf",
+ & id1, & id2, & a, ori, & mean, & stddev);
+
+ assert (ori [0] == 'F' || ori [0] == 'R');
+ c . id = id1;
+ c . scaff_id = id2;
+ c . scaff_place = a;
+ c . ori = ori [0];
+ c . gap_mean = mean;
+ c . gap_stddev = stddev;
+ contig . push_back (c);
+ }
+ else if (strcmp (tag, "CON") == 0
+ || strcmp (tag, "UPS") == 0
+ || strcmp (tag, "UNI") == 0
+ )
+ {
+ ; // ignore
+ }
+ else
+ {
+ fprintf (stderr, "ERROR: Unexpected tag\n");
+ fputs (line, stderr);
+ exit (EXIT_FAILURE);
+ }
+ }
+
+ sort (contig . begin (), contig . end (), Contig_Cmp);
+
+
+ // Find reads that are not in any contig and see where
+ // their mates place them
+ n = read . size ();
+ fprintf (stderr, "### %d reads\n", n);
+ for (i = 0; i < n; i ++)
+ {
+ if (read [i] . contig_id >= 0)
+ {
+ int j;
+
+ j = Find_ID (read, read [i] . mate_id);
+ assert (j >= 0);
+ if (read [j] . unitig_id == -1)
+ printf ("%9d %9d %8d %8d %9d\n", read [i] . id,
+ read [i] . contig_id, read [i] . c_a_pos,
+ read [i] . c_b_pos, read [i] . mate_id);
+ }
+ }
+
+ return 0;
+ }
+
+
+
+static int Find_ID
+ (vector <Read_Info_t> & read, int id)
+
+// Do a binary search of read and return the subscript
+// of the read whose id is id . Return -1 if not found.
+// read must already be sorted into ascending order by id .
+
+ {
+ int lo, hi, mid;
+
+ lo = 0;
+ hi = int (read . size () - 1);
+
+ while (lo <= hi)
+ {
+ mid = (lo + hi) / 2;
+ if (read [mid] . id == id)
+ return mid;
+ else if (id < read [mid] . id)
+ hi = mid - 1;
+ else
+ lo = mid + 1;
+ }
+
+ return -1;
+ }
+
+
+
diff --git a/src/Align/overlap-align.cc b/src/Align/overlap-align.cc
new file mode 100644
index 0000000..f7287c6
--- /dev/null
+++ b/src/Align/overlap-align.cc
@@ -0,0 +1,364 @@
+#include <iostream>
+#include "fasta.hh"
+#include <iomanip>
+using namespace std;
+
+inline int max2(int a, int b)
+{
+ return (a > b) ? a : b;
+}
+
+inline int max3(int a, int b, int c)
+{
+ int maxl = (a > b) ? a : b;
+ return (maxl > c) ? maxl : c;
+}
+
+inline int max4(int a, int b, int c, int d)
+{
+ int maxl = (a > b) ? a : b;
+ int maxr = (c > d) ? c : d;
+
+ return (maxl > maxr) ? maxl : maxr;
+}
+
+int s(char a, char b, int match_score, int mismatch_score)
+{
+ if (a == b)
+ {
+ return match_score;
+ }
+
+ return mismatch_score;
+}
+
+struct aligned_t
+{
+ char s;
+ char t;
+ int score;
+};
+typedef struct aligned_t aligned_t;
+
+
+
+void align(const string & S,
+ const string & T,
+ int match_score,
+ int mismatch_score,
+ int gap_open,
+ int gap_extension)
+{
+ int m = S.length()-1;
+ int n = T.length()-1;
+
+ int * E = new int[(m+2) * (n+2)];
+ int * F = new int[(m+2) * (n+2)];
+ int * G = new int[(m+2) * (n+2)];
+ int * V = new int[(m+2) * (n+2)];
+
+ if (!E || !F || !G || !V)
+ {
+ fprintf(stderr, "strings too long!\n");
+ exit(1);
+ }
+
+ fprintf(stderr, "Initializing arrays...");
+
+ // initialize matrices
+ for (int i = 0; i <= m; i++)
+ {
+ //E[i][0] = -gap_open + -gap_extension*i;
+ E[i*(n+2) + 0] = 0;
+ F[i*(n+2) + 0] = 0;
+ G[i*(n+2) + 0] = 0;
+ V[i*(n+2) + 0] = E[i*(n+2)+0];
+ }
+
+ fprintf(stderr, " ...");
+
+ for (int j = 0; j <= n; j++)
+ {
+ //F[0][j] = 0;
+ F[0+j] = -gap_open + -gap_extension*j;
+ E[0+j] = 0;
+ G[0+j] = 0;
+ V[0+j] = F[0+j];
+ }
+
+ fprintf(stderr, " done.\n");
+
+ G[0] = 0;
+ V[0] = 0;
+
+ int maxi = 0;
+ int maxj = 0;
+ int maxv = 0;
+
+ // compute the matrix
+ for (int i = 1; i <= m; i++)
+ {
+ for (int j = 1; j <= n; j++)
+ {
+ E[i*(n+2)+j] = max2(E[(i-1)*(n+2) + j] - gap_extension,
+ V[(i-1)*(n+2) + j] - gap_open - gap_extension);
+
+ F[i*(n+2)+j] = max2(F[(i-1)*(n+2) + j] - gap_extension,
+ V[(i-1)*(n+2) + j] - gap_open - gap_extension);
+
+ G[i*(n+2)+j] = V[(i-1) * (n+2) + j-1] + s(S[i], T[j], match_score, mismatch_score);
+
+ V[i*(n+2)+j] = max3(E[i*(n+2) + j],
+ F[i*(n+2) + j],
+ G[i*(n+2) + j]);
+
+ if (V[i*(n+2)+j] > maxv)
+ {
+ maxv = V[i*(n+2)+j];
+ maxi = i;
+ maxj = j;
+ }
+ }
+ }
+
+ maxv = -1;
+ // find the max along the last row (m)
+ for (int j = 0; j <= n; j++)
+ {
+ if (V[m*(n+2)+j] > maxv)
+ {
+ maxv = V[m*(n+2)+j];
+ maxi = m;
+ maxj = j;
+ }
+ }
+
+
+ // // print the scores
+ // cout << "V" << endl;
+ // cout << "=======================================" << endl;
+ // for (int i = 0; i <= m; i++)
+ // {
+ // if (i == 0)
+ // {
+ // cout << " \t";
+ // for (int j = 0; j <= n; j++) { cout << T[j] << "\t"; }
+ // cout << endl;
+ // }
+ //
+ // cout << S[i] << "\t";
+ // for (int j = 0; j <= n; j++)
+ // {
+ // cout << V[i][j];
+ // //if (V[i][j] == maxv) { cout << "*"; }
+ // if (i == maxi && j == maxj) { cout << "*"; }
+ // cout << "\t";
+ // }
+ //
+ //
+ // cout << endl;
+ // }
+
+ // cout << endl << endl;
+ // cout << "E" << endl;
+ // cout << "=======================================" << endl;
+ // for (int i = 0; i <= m; i++)
+ // {
+ // if (i == 0)
+ // {
+ // cout << " \t";
+ // for (int j = 0; j <= n; j++) { cout << T[j] << "\t"; }
+ // cout << endl;
+ // }
+ //
+ // cout << S[i] << "\t";
+ // for (int j = 0; j <= n; j++)
+ // {
+ // cout << E[i][j];
+ // cout << "\t";
+ // }
+ //
+ // cout << endl;
+ // }
+ //
+ // cout << endl << endl;
+ // cout << "F" << endl;
+ // cout << "=======================================" << endl;
+ // for (int i = 0; i <= m; i++)
+ // {
+ // if (i == 0)
+ // {
+ // cout << " \t";
+ // for (int j = 0; j <= n; j++) { cout << T[j] << "\t"; }
+ // cout << endl;
+ // }
+ //
+ // cout << S[i] << "\t";
+ // for (int j = 0; j <= n; j++)
+ // {
+ // cout << F[i][j];
+ // cout << "\t";
+ // }
+ //
+ // cout << endl;
+ // }
+ //
+ // cout << endl << endl;
+ // cout << "G" << endl;
+ // cout << "=======================================" << endl;
+ // for (int i = 0; i <= m; i++)
+ // {
+ // if (i == 0)
+ // {
+ // cout << " \t";
+ // for (int j = 0; j <= n; j++) { cout << T[j] << "\t"; }
+ // cout << endl;
+ // }
+ //
+ // cout << S[i] << "\t";
+ // for (int j = 0; j <= n; j++)
+ // {
+ // cout << G[i][j];
+ // cout << "\t";
+ // }
+ //
+ // cout << endl;
+ // }
+
+
+ cout << "max score[" << maxi << "," << maxj << "]:" << maxv << endl;
+
+
+ // print the alignment
+ aligned_t trace[m+n];
+ //int i = m; int j = n;
+ int i = maxi, j = maxj;
+ int tlen = 0;
+
+ int numbasesaligned = 0;
+ int numbasessame = 0;
+
+ while (i > 0 && j > 0)
+ {
+ int v = V[i*(n+2)+j];
+ trace[tlen].score = v;
+
+ numbasesaligned++;
+
+ if (v == G[i*(n+2)+j])
+ {
+ if (S[i] == T[j])
+ {
+ numbasessame++;
+ }
+
+ trace[tlen].s = S[i];
+ trace[tlen].t = T[j];
+ i--;
+ j--;
+ }
+ else if (v == E[i*(n+2)+j])
+ {
+ trace[tlen].s = S[i];
+ trace[tlen].t = '-';
+ i--;
+ }
+ else if (v == F[i*(n+2)+j])
+ {
+ trace[tlen].s = '-';
+ trace[tlen].t = T[j];
+ j--;
+ }
+ else // v == 0;
+ {
+ break;
+ }
+
+ tlen++;
+ }
+
+ for (int k = tlen - 1; k >= 0; k--)
+ {
+ cout << " " << trace[k].s;
+ }
+ cout << endl;
+
+ for (int k = tlen - 1; k >= 0; k--)
+ {
+ cout << " " << trace[k].t;
+ }
+ cout << endl;
+
+ for (int k = tlen - 1; k >= 0; k--)
+ {
+ //printf(" %3d", trace[k].score);
+ cout << setw(3) << trace[k].score << endl;
+ }
+ cout << endl;
+
+ int s_s, s_e;
+ int t_s, t_e;
+
+ s_s = i+1;
+ s_e = maxi;
+
+ t_s = 1;
+ t_e = maxj;
+
+ float perc_id = (float)(numbasessame * 100) / numbasesaligned;
+
+ cout << "S: 1 [" << s_s << " " << s_e << "]" << endl;
+ cout << "T: [" << t_s << " " << t_e << "] " << n << endl;
+ cout << numbasessame << "/" << numbasesaligned << " bases aligned : " << perc_id << " percent id" << endl;
+
+ for (int i = 1; i < s_s; i++) { cout << S[i]; }
+ for (int k = tlen-1; k >= 0; k--) { cout << trace[k].s; }
+ cout << endl;
+
+ for (int j = 1; j < s_s; j++) { cout << " "; }
+ for (int k = tlen-1; k >= 0; k--) { cout << trace[k].t; }
+ for (int j = t_e; j <=n; j++) { cout << T[j]; }
+ cout << endl;
+}
+
+
+int main(int argc, char ** argv)
+{
+ //string S = "sACAAAAATTTGGTC";
+ //string T = "sATGGTTCCATGA";
+
+ if (argc < 3)
+ {
+ fprintf(stderr, "USAGE: overlap-align fasta1 fasta2\n");
+ exit(1);
+ }
+
+ FILE * f1 = fopen(argv[1], "r");
+ FILE * f2 = fopen(argv[2], "r");
+
+ if (!f1) { fprintf(stderr, "ERROR: Couldn't open %s\n", argv[1]); exit(1); }
+ if (!f2) { fprintf(stderr, "ERROR: Couldn't open %s\n", argv[2]); exit(1); }
+
+ string S, S_header;
+ string T, T_header;
+
+ Fasta_Read(f1, S, S_header);
+ Fasta_Read(f2, T, T_header);
+
+ S.insert(0, 1, 's');
+ T.insert(0, 1, 's');
+
+ int match_score = 10;
+ int mismatch_score = -2;
+ int gap_open = 4;
+ int gap_extension = 1;
+
+ cout << "S: " << S << " " << S.length()-1 << endl;
+ cout << "T: " << T << " " << T.length()-1 << endl;
+
+ align(S,T, match_score, mismatch_score, gap_open, gap_extension);
+
+ return 0;
+}
+
+
diff --git a/src/Align/ovl-degr-dist.cc b/src/Align/ovl-degr-dist.cc
new file mode 100644
index 0000000..d7bff71
--- /dev/null
+++ b/src/Align/ovl-degr-dist.cc
@@ -0,0 +1,329 @@
+// A. L. Delcher
+//
+// File: ovl-degr-dist.cc
+//
+// Last Modified: 22 January 2003
+//
+// List probabilities for numbers of overlaps off one end of a read
+// based on binomial trials model
+
+
+#include "delcher.hh"
+#include <vector>
+using namespace std;
+
+const int DEFAULT_MIN_OLAP_LEN = 40;
+const int DEFAULT_HI_DEGREE = 20;
+
+
+struct Dist_Entry_t
+ {
+ int degree;
+ double prob, cum_prob;
+ double num_reads, cum_num_reads;
+ };
+
+
+static double Genome_Len;
+ // Length of the genome in bases
+static int Hi_Degree = DEFAULT_HI_DEGREE;
+ // The highest value to print a probability for. Above this
+ // just prints above
+static bool Match_Input_Distrib = false;
+ // If set true by the -m option, then read a distribution
+ // of values from the input and adjust the genome length
+ // to the value that best matches it.
+static int Min_Olap_Len = DEFAULT_MIN_OLAP_LEN;
+ // Smallest detected overlap between two reads
+static double Num_Reads;
+ // Number of reads randomly distributed in the genome
+static double Read_Len;
+ // Number of bases in each read
+
+
+static void Make_Dist
+ (vector <Dist_Entry_t> & dist, double N, double p, int hi);
+static void Parse_Command_Line
+ (int argc, char * argv []);
+static double Score_Diff
+ (const vector <Dist_Entry_t> & actual,
+ const vector <Dist_Entry_t> & goal, int hi);
+static void Usage
+ (const char * command);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ double N, p;
+ double lambda;
+ vector <Dist_Entry_t> dist;
+ int i;
+
+ Parse_Command_Line (argc, argv);
+
+ fprintf (stderr, "Starting on %s at %s\n", __DATE__, __TIME__);
+
+ Verbose = 0;
+
+ if (Match_Input_Distrib)
+ {
+ vector <Dist_Entry_t> goal;
+ Dist_Entry_t entry;
+ double best_score, score;
+ int ct;
+
+ while (scanf ("%d %lf", & entry . degree, & entry . num_reads) == 2)
+ goal . push_back (entry);
+
+ Hi_Degree = goal [goal . size () - 1] . degree;
+ N = Num_Reads - 1;
+ best_score = DBL_MAX;
+ ct = 0;
+ do
+ {
+ p = (Read_Len - Min_Olap_Len) / (Genome_Len - Read_Len);
+ lambda = N * p;
+
+ Make_Dist (dist, N, p, Hi_Degree);
+ score = Score_Diff (dist, goal, Hi_Degree);
+
+ printf ("%10.0f %10.0f\n", Genome_Len, score);
+
+ Genome_Len += 1e5;
+ if (score < best_score)
+ {
+ best_score = score;
+ ct = 0;
+ }
+ else
+ ct ++;
+ } while (ct <= 3);
+
+ }
+
+ N = Num_Reads - 1;
+ p = (Read_Len - Min_Olap_Len) / (Genome_Len - Read_Len);
+ lambda = N * p;
+
+ Make_Dist (dist, N, p, Hi_Degree);
+
+ fprintf (stderr, "Num Reads = %.0f Read Len = %.0f Genome Len = %.0f\n",
+ Num_Reads, Read_Len, Genome_Len);
+ fprintf (stderr, "N = %e p = %e lambda = %e\n", N, p, lambda);
+ printf ("%6s %8s %8s %8s %8s\n",
+ "Degree", "Prob", "CumProb", "Reads", "CumReads");
+
+ for (i = 0; i <= Hi_Degree; i ++)
+ printf ("%5d: %8.6f %8.6f %8.0f %8.0f\n", dist [i] . degree,
+ dist [i] . prob, dist [i] . cum_prob, dist [i] . num_reads,
+ dist [i] . cum_num_reads);
+
+ printf ("above: %8.6f %8.6f %8.0f %8.0f\n",
+ dist [Hi_Degree + 1] . prob, dist [Hi_Degree + 1] . cum_prob,
+ dist [Hi_Degree + 1] . num_reads,
+ dist [Hi_Degree + 1] . cum_num_reads);
+
+ return 0;
+ }
+
+
+
+static void Make_Dist
+ (vector <Dist_Entry_t> & dist, double N, double p, int hi)
+
+// Fill dist with the values of the binomial distribution
+// of the number of successes in N trials, with probability of
+// success per trial equal to p , numbers 0 .. hi .
+// Set dist [hi + 1] to the sum of the remaining values, i.e.,
+// the values above hi .
+
+ {
+ Dist_Entry_t entry;
+ double lambda;
+ double sum, term;
+ int i;
+
+ dist . clear ();
+ lambda = N * p;
+
+ sum = 0.0;
+ term = 1.0 * exp (-1.0 * lambda);
+
+ for (i = 0; i <= hi; i ++)
+ {
+ sum += term;
+
+ entry . degree = i;
+ entry . prob = term;
+ entry . cum_prob = sum;
+ entry . num_reads = term * N;
+ entry . cum_num_reads = sum * N;
+ dist . push_back (entry);
+
+ term *= lambda / double (i + 1);
+ }
+
+ entry . degree = hi + 1;
+ entry . prob = 1.0 - sum;
+ entry . cum_prob = 1.0;
+ entry . num_reads = (1.0 - sum) * N;
+ entry . cum_num_reads = N;
+ dist . push_back (entry);
+
+ return;
+ }
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = FALSE;
+ int ch;
+ char * p;
+
+ optarg = NULL;
+
+ while (! errflg
+ && ((ch = getopt (argc, argv, "hmo:")) != EOF))
+ switch (ch)
+ {
+ case 'h' :
+ errflg = TRUE;
+ break;
+
+ case 'm' :
+ Match_Input_Distrib = true;
+ if (p == optarg)
+ {
+ fprintf (stderr, "ERROR: Bad min olap length \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ break;
+
+ case 'o' :
+ Min_Olap_Len = (int) strtol (optarg, & p, 10);
+ if (p == optarg)
+ {
+ fprintf (stderr, "ERROR: Bad min olap length \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ break;
+
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+ // fall through
+
+ default :
+ errflg = TRUE;
+ }
+
+ if (errflg || optind != argc - 3)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ Num_Reads = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad num reads \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ optind ++;
+
+ Read_Len = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad read len \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ optind ++;
+
+ Genome_Len = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad genome len \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ optind ++;
+
+ return;
+ }
+
+
+
+static double Score_Diff
+ (const vector <Dist_Entry_t> & actual,
+ const vector <Dist_Entry_t> & goal, int hi)
+
+// Return the sum of the absolute values of the differences
+// in the num_reads fields in entries of actual and goal
+// that have the same degree field . Both are assumed to be
+// in ascending sorted order by degree. Stop after degree value
+// of hi .
+
+ {
+ double score;
+ int i, j, m, n;
+
+ i = j = 0;
+ m = int (actual . size ());
+ n = int (goal . size ());
+ score = 0.0;
+
+ while (i < m && j < n && actual [i] . degree <= hi
+ && goal [j] . degree <= hi)
+ {
+ if (actual [i] . degree < goal [j] . degree)
+ i ++;
+ else if (actual [i] . degree > goal [j] . degree)
+ j ++;
+ else
+ {
+ score += fabs (actual [i] . num_reads - goal [j] . num_reads);
+ i ++;
+ j ++;
+ }
+ }
+
+ return score;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "USAGE: %s <#reads> <read-len> <genome-len>\n"
+ "\n"
+ "List probabilities for numbers of overlaps off one end of a read\n"
+ "based on binomial trials model\n"
+ "\n"
+ "Options:\n"
+ " -m Adjust genome length to get best match to distrib\n"
+ " input from stdin\n"
+ " -o <n> Set minimum overlap length to <n> (default = %d)\n"
+ "\n",
+ command, DEFAULT_MIN_OLAP_LEN);
+
+ return;
+ }
diff --git a/src/Align/qmer-filter.cc b/src/Align/qmer-filter.cc
new file mode 100644
index 0000000..21cbaaf
--- /dev/null
+++ b/src/Align/qmer-filter.cc
@@ -0,0 +1,32 @@
+#include <string>
+#include <iostream>
+#include <cstdlib>
+
+using namespace std;
+
+int main (int argc, char * argv [])
+{
+ if (argc != 2)
+ {
+ cerr << "Usage: qmer-filter threshold < in > out\n";
+ return 0;
+ }
+
+ double threshold = atof(argv[1]);
+ cerr << "Qmer threshold: " << threshold << endl;
+
+ string kmer;
+ double count;
+
+ while(cin >> kmer)
+ {
+ cin >> count;
+
+ if (count >= threshold)
+ {
+ cout << kmer << "\t" << count << "\n";
+ }
+ }
+
+ return 0;
+}
diff --git a/src/Align/readinfo2cam.cc b/src/Align/readinfo2cam.cc
new file mode 100644
index 0000000..e143025
--- /dev/null
+++ b/src/Align/readinfo2cam.cc
@@ -0,0 +1,1294 @@
+// Read read-info information from stdin and a file of
+// contig position information (from file named on the command line).
+// Generate a celamy cam file for the reads that are in the contig file.
+// Output goes to stdout
+
+#include "foundation_AMOS.hh"
+#include "delcher.hh"
+#include <cstdio>
+#include <cstdlib>
+#include <cmath>
+#include <vector>
+#include <queue>
+#include <algorithm>
+#include <cassert>
+using namespace std;
+using namespace AMOS;
+using namespace HASHMAP;
+
+
+const int MAX_LINE = 1000;
+const int SINGLE_READ_LEN = 2500;
+
+const char Unique_Col_Id [] = "1UniUtgCol";
+const char Unique_Col_Def [] = "CFF00FF"; // pink
+const char Rock_Col_Id [] = "1RockUtgCol";
+const char Rock_Col_Def [] = "CFF0000"; // red
+const char Surr_Col_Id [] = "1SurrUtgCol";
+const char Surr_Col_Def [] = "CB19B56"; // tan
+const char Degen_Col_Id [] = "1DegenUtgCol";
+const char Degen_Col_Def [] = "C00FFFF"; // blue/green
+const char Degen_Link_Col_Id [] = "1DegenScaff";
+const char Degen_Link_Col_Def [] = "C00FFFF"; // blue/green
+const char Scaff_Link_Col_Id [] = "2RegScaff";
+const char Scaff_Link_Col_Def [] = "C00FF00"; // blue
+const char Single_Read_Col_Id [] = "1SingRead";
+const char Single_Read_Col_Def [] = "C0000FF"; // blue
+const char Single_Mate_Col_Id [] = "1SingMate";
+const char Single_Mate_Col_Def [] = "C0000BF"; // blue
+const char Bad_Read_Col_Id [] = "2BadRead";
+const char Bad_Read_Col_Def [] = "CFF0000"; // red
+const char Bad_Mate_Col_Id [] = "2BadMate";
+const char Bad_Mate_Col_Def [] = "CBF0000"; // red
+const char Stretch_Read_Col_Id [] = "3StretchRead";
+const char Stretch_Read_Col_Def [] = "CFF00FF"; // pink
+const char Stretch_Mate_Col_Id [] = "3StretchMate";
+const char Stretch_Mate_Col_Def [] = "CBF00BF"; // pink
+const char Good_Read_Col_Id [] = "4GoodRead";
+const char Good_Read_Col_Def [] = "C00FF00"; // green
+const char Good_Mate_Col_Id [] = "4GoodMate";
+const char Good_Mate_Col_Def [] = "C00BF00"; // green
+const char Infer_Read_Col_Id [] = "5InferRead";
+const char Infer_Read_Col_Def [] = "CFF7F00"; // orange
+const char Infer_Mate_Col_Id [] = "5InferMate";
+const char Infer_Mate_Col_Def [] = "CBF7500"; // orange
+const char Repeat_Col_Id [] = "6RepeatCol";
+const char Repeat_Col_Def [] = "CFFAF00"; // yellow-orange
+const char Repeat_Ext_Id [] = "6RepeatExt";
+const char Repeat_Ext_Def [] = "CFFAF00"; // yellow-orange
+
+
+
+struct Extent_t
+ {
+ int lo, hi, category;
+ };
+
+
+struct Read_Info_t
+ {
+ long long int uid;
+ int mate;
+ int dst;
+ long long int unitig_id;
+ int u_a_pos, u_b_pos;
+ long long int contig_id;
+ int c_a_pos, c_b_pos;
+ int cam_a, cam_b;
+ bool mark;
+
+ Read_Info_t ()
+ {
+ mate = -1;
+ unitig_id = -1;
+ contig_id = -1;
+ cam_a = cam_b = -1;
+ }
+ };
+
+
+struct Unitig_Info_t
+ {
+ long long int unitig_id;
+ long long int contig_id;
+ int c_a_pos, c_b_pos;
+ char typ;
+ int cam_lo, cam_hi;
+ int match;
+ short copy_num, copy_total;
+ bool cam_fwd;
+
+ Unitig_Info_t ()
+ {
+ match = -1;
+ }
+ };
+
+
+struct Contig_Info_t
+ {
+ long long int contig_id;
+ long long int scaff_id;
+ int scaff_place;
+ char ori;
+ double gap_mean;
+ double gap_stddev;
+ int match;
+
+ Contig_Info_t ()
+ {
+ match = -1;
+ }
+ };
+
+
+struct Contig_Pos_t
+ {
+ long long int contig_id;
+ long long int scaff_id;
+ int a, b;
+ int len;
+ char * tag;
+ bool mark;
+
+ Contig_Pos_t ()
+ {
+ scaff_id = -1;
+ len = 0;
+ }
+ };
+
+
+struct Dst_Info_t
+ {
+ double mean;
+ double stddev;
+ };
+
+
+struct Uni_Data_t
+ {
+ long long int unitig_id;
+ float coverage;
+ char typ;
+ int num_reads;
+ int len;
+ };
+
+
+struct Con_Data_t
+ {
+ long long int contig_id;
+ char typ;
+ int num_reads;
+ int num_unis;
+ int len;
+ };
+
+
+
+static int Bad_Start_Row;
+static int Good_Start_Row = 10;
+// static long long int ID_Offset = 0;
+// static long long int ID_Offset = 1047274077950;
+ // Value to subtract from read IDs to get reasonable values
+ // no longer used
+static int Missing_Start_Row;
+
+static vector <Dst_Info_t> Dst;
+static vector <Read_Info_t> Read;
+
+
+static long long int Hash_Mask = 1;
+HASHMAP :: hash_map <long unsigned, int> ID_Map;
+
+
+bool Contig_Cmp
+ (const Contig_Info_t & a, const Contig_Info_t & b)
+ { return a . contig_id < b . contig_id; }
+
+bool Contig_Pos_Cmp
+ (const Contig_Pos_t & a, const Contig_Pos_t & b)
+ { return a . contig_id < b . contig_id; }
+
+bool Extent_Cmp
+ (const Extent_t & a, const Extent_t & b)
+ {
+ return (a . category < b . category
+ || (a . category == b . category && a . lo < b . lo));
+ }
+
+bool PQ_Cmp
+ (int a, int b)
+ { return b < a; }
+
+bool Unitig_Cmp
+ (const Unitig_Info_t & a, const Unitig_Info_t & b)
+ { return a . unitig_id < b . unitig_id; }
+
+bool Uni_Data_Cmp
+ (const Uni_Data_t & a, const Uni_Data_t & b)
+ { return a . unitig_id < b . unitig_id; }
+
+
+static void Add_Pair_Extent
+ (int i, int j, vector <Extent_t> & extent);
+static void Add_Single_Extent
+ (int i, int len, int cat, vector <Extent_t> & extent);
+static void Output_Mates
+ (int i, int j);
+static void Output_Pair
+ (int i, int j, const char * read_colour, const char * mate_colour,
+ int start_row, const char * tag);
+static void Output_Repeats
+ (const char * filename, const vector <Contig_Pos_t> & contig_pos);
+static void Output_Single_Read
+ (int i, const char * read_colour, const char * mate_colour,
+ int len, int start_row, const char * tag);
+static void Print_Colour_Headers
+ (void);
+static int Read_Subscript
+ (long long int id);
+static int Search
+ (const vector <Contig_Pos_t> & pos, long long int id);
+static void Set_Position
+ (int & x, int & y, int a, int b, int c, int d, int len);
+static void Set_Starting_Rows
+ (void);
+static int Uni_Data_Search
+ (const vector <Uni_Data_t> & u, long long int id);
+static int Unitig_Search
+ (const vector <Unitig_Info_t> & u, long long int id);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ FILE * fp;
+ vector <Unitig_Info_t> unitig;
+ vector <Contig_Info_t> contig;
+ vector <Contig_Pos_t> contig_pos;
+ vector <Uni_Data_t> uni_data;
+ vector <Con_Data_t> con_data;
+ char line [MAX_LINE];
+ bool found;
+ float cov;
+ short copy_ct;
+ int unitig_ct;
+ int short_id1, short_id2;
+ long long int id1, id2, hi_id;
+ int a, b, c;
+ int hi_read = 0;
+ int i, j, n;
+
+ if (argc < 2)
+ {
+ fprintf (stderr, "USAGE: %s <contig-info-file> [<repeat-coord-file>]\n",
+ argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ Hash_Mask <<= 32;
+ Hash_Mask --;
+ // Used to mask just the right 32 bits of uids. Presume these
+ // are unique for reads.
+
+ fp = fopen (argv [1], "r");
+ assert (fp != NULL);
+ while (fscanf (fp, "%lld %d %d %s", & id1, & a, & b, line) == 4)
+ {
+ Contig_Pos_t c;
+
+ c . contig_id = id1;
+ c . a = a;
+ c . b = b;
+ c . tag = strdup (line);
+ contig_pos . push_back (c);
+ }
+ fclose (fp);
+
+ if (argc > 2)
+ Output_Repeats (argv [2], contig_pos);
+
+ while (fgets (line, MAX_LINE, stdin) != NULL)
+ {
+ char tag [10], ori [10], typ [10];
+ double mean, stddev;
+
+ sscanf (line, "%s", tag);
+ if (strcmp (tag, "LKG") == 0)
+ {
+ sscanf (line + 4, "%lld %lld %lf %lf %s",
+ & id1, & id2, & mean, & stddev, ori);
+
+ short_id1 = Read_Subscript (id1);
+ short_id2 = Read_Subscript (id2);
+
+ if (ori [0] != 'I')
+ {
+ fprintf (stderr, "ERROR: Unexpected orientation \"%s\"\n",
+ ori);
+ fputs (line, stderr);
+ exit (EXIT_FAILURE);
+ }
+
+ if (Read [short_id1] . mate != -1)
+ {
+ fprintf (stderr, "ERROR: Duplicate mate\n");
+ fprintf (stderr, "id1 = %lld mate = %lld\n", id1,
+ Read [Read [short_id1] . mate] . uid);
+ exit (EXIT_FAILURE);
+ }
+ if (Read [short_id2] . mate != -1)
+ {
+ fprintf (stderr, "ERROR: Duplicate mate\n");
+ fprintf (stderr, "id2 = %lld mate = %lld\n", id2,
+ Read [Read [short_id2] . mate] . uid);
+ exit (EXIT_FAILURE);
+ }
+
+ Read [short_id1] . mate = short_id2;
+ Read [short_id2] . mate = short_id1;
+
+ n = Dst . size ();
+ found = false;
+ for (i = 0; i < n && ! found; i ++)
+ if (Dst [i] . mean == mean && Dst [i] . stddev == stddev)
+ {
+ found = true;
+ break;
+ }
+ if (! found)
+ {
+ Dst_Info_t new_dst;
+
+ new_dst . mean = mean;
+ new_dst . stddev = stddev;
+ Dst . push_back (new_dst);
+ }
+ Read [short_id1] . dst = i;
+ Read [short_id2] . dst = i;
+
+ }
+ else if (strcmp (tag, "UTG") == 0)
+ {
+ sscanf (line + 4, "%lld %lld %d %d %s",
+ & id1, & id2, & a, & b, typ);
+
+ short_id1 = Read_Subscript (id1);
+
+ if (typ [0] != 'R')
+ {
+ fprintf (stderr, "ERROR: Unexpected type \"%s\"\n",
+ ori);
+ fputs (line, stderr);
+ exit (EXIT_FAILURE);
+ }
+
+ assert (Read [short_id1] . unitig_id == -1);
+ Read [short_id1] . unitig_id = id2;
+ Read [short_id1] . u_a_pos = a;
+ Read [short_id1] . u_b_pos = b;
+ }
+ else if (strcmp (tag, "CCO") == 0)
+ {
+ sscanf (line + 4, "%lld %lld %d %d %s",
+ & id1, & id2, & a, & b, typ);
+
+ short_id1 = Read_Subscript (id1);
+
+ if (typ [0] != 'R')
+ {
+ fprintf (stderr, "ERROR: Unexpected type \"%s\"\n",
+ ori);
+ fputs (line, stderr);
+ exit (EXIT_FAILURE);
+ }
+
+ assert (Read [short_id1] . contig_id == -1);
+ Read [short_id1] . contig_id = id2;
+ Read [short_id1] . c_a_pos = a;
+ Read [short_id1] . c_b_pos = b;
+ }
+ else if (strcmp (tag, "UNI") == 0)
+ {
+ Uni_Data_t uni;
+
+ sscanf (line + 4, "%lld %f %s %d %d",
+ & id1, & cov, typ, & a, & b);
+ uni . unitig_id = id1;
+ uni . coverage = cov;
+ uni . typ = typ [0];
+ uni . num_reads = a;
+ uni . len = b;
+ uni_data . push_back (uni);
+ }
+ else if (strcmp (tag, "CON") == 0)
+ {
+ Con_Data_t con;
+
+ sscanf (line + 4, "%lld %s %d %d %d",
+ & id1, typ, & a, & b, & c);
+ con . contig_id = id1;
+ con . typ = typ [0];
+ con . num_reads = a;
+ con . num_unis = b;
+ con . len = c;
+ con_data . push_back (con);
+ }
+ else if (strcmp (tag, "UPS") == 0)
+ {
+ Unitig_Info_t u;
+
+ sscanf (line + 4, "%lld %lld %d %d %s",
+ & id1, & id2, & a, & b, typ);
+
+ u . unitig_id = id1;
+ u . contig_id = id2;
+ u . c_a_pos = a;
+ u . c_b_pos = b;
+ u . typ = typ [0];
+ unitig . push_back (u);
+ }
+ else if (strcmp (tag, "SCF") == 0)
+ {
+ Contig_Info_t c;
+
+ sscanf (line + 4, "%lld %lld %d %s %lf %lf",
+ & id1, & id2, & a, ori, & mean, & stddev);
+
+ assert (ori [0] == 'F' || ori [0] == 'R');
+ c . contig_id = id1;
+ c . scaff_id = id2;
+ c . scaff_place = a;
+ c . ori = ori [0];
+ c . gap_mean = mean;
+ c . gap_stddev = stddev;
+ contig . push_back (c);
+ }
+ else if (strcmp (tag, "ULK") == 0)
+ ; // Skip
+ else
+ {
+ fprintf (stderr, "ERROR: Unexpected tag\n");
+ fputs (line, stderr);
+ exit (EXIT_FAILURE);
+ }
+ }
+
+ sort (unitig . begin (), unitig . end (), Unitig_Cmp);
+ sort (contig . begin (), contig . end (), Contig_Cmp);
+ sort (contig_pos . begin (), contig_pos . end (), Contig_Pos_Cmp);
+ sort (uni_data . begin (), uni_data . end (), Uni_Data_Cmp);
+
+ Print_Colour_Headers ();
+
+
+ // Still Need to Do:
+ // Add to contig_pos contigs that are not there already but
+ // are in the same scaffold as contigs that are in it.
+
+
+ // Set size of contigs in contig_pos to max unitig pos
+ // in them
+ // Also set copy_num and copy_total fields in unitig array
+ n = unitig . size ();
+fprintf (stderr, "### %d unitigs\n", n);
+
+ copy_ct = 0;
+ for (i = 0; i < n; i ++)
+ {
+ j = Search (contig_pos, unitig [i] . contig_id);
+
+ unitig [i] . match = j;
+
+ if (j >= 0)
+ {
+ if (unitig [i] . c_a_pos > contig_pos [j] . len)
+ contig_pos [j] . len = unitig [i] . c_a_pos;
+ if (unitig [i] . c_b_pos > contig_pos [j] . len)
+ contig_pos [j] . len = unitig [i] . c_b_pos;
+ }
+
+ if (i == 0 || unitig [i] . unitig_id == unitig [i - 1] . unitig_id)
+ copy_ct ++;
+ else
+ {
+ for (j = 1; j <= copy_ct; j ++)
+ unitig [i - j] . copy_total = copy_ct;
+ copy_ct = 1;
+ }
+ unitig [i] . copy_num = copy_ct;
+ }
+ for (j = 1; j <= copy_ct; j ++)
+ unitig [n - j] . copy_total = copy_ct;
+
+
+ // Output celamy lines for matching unitigs
+ unitig_ct = 0;
+ for (i = 0; i < n; i ++)
+ {
+ j = unitig [i] . match;
+
+ if (j >= 0)
+ {
+ const char * colour;
+ int k, x, y;
+
+ Set_Position (x, y, unitig [i] . c_a_pos, unitig [i] . c_b_pos,
+ contig_pos [j] . a, contig_pos [j] . b, contig_pos [j] . len);
+
+ switch (unitig [i] . typ)
+ {
+ case 'U' :
+ colour = Unique_Col_Id;
+ break;
+ case 'R' :
+ colour = Rock_Col_Id;
+ break;
+ case 'S' :
+ colour = Surr_Col_Id;
+ break;
+ case 's' :
+ colour = Degen_Col_Id;
+ break;
+ default :
+ fprintf (stderr, "ERROR: Bad unitig type = \"%c\"\n",
+ unitig [i] . typ);
+ exit (EXIT_FAILURE);
+ }
+
+ k = Uni_Data_Search (uni_data, unitig [i] . unitig_id);
+ if (k < 0)
+ {
+ fprintf (stderr, "ERROR: Missing unitig %lld in uni_data\n",
+ unitig [i] . unitig_id);
+ exit (EXIT_FAILURE);
+ }
+
+ unitig_ct ++;
+ if (x < y)
+ printf ("%dUnitig: %d A%s %d R6 # Utg%lld Ctg%lld"
+ " cov=%.1f typ=%c nfr=%d len=%d",
+ unitig_ct, x, colour, y, unitig [i] . unitig_id,
+ unitig [i] . contig_id, uni_data [k] . coverage,
+ uni_data [k] . typ, uni_data [k] . num_reads,
+ uni_data [k] . len);
+ else
+ printf ("%dUnitig: %d A%s %d R6 # Utg%lld Ctg%lld"
+ " cov=%.1f typ=%c nfr=%d len=%d",
+ unitig_ct, y, colour, x, unitig [i] . unitig_id,
+ unitig [i] . contig_id, uni_data [k] . coverage,
+ uni_data [k] . typ, uni_data [k] . num_reads,
+ uni_data [k] . len);
+ if (unitig [i] . copy_total > 1)
+ printf (" copy=%d of %d", unitig [i] . copy_num,
+ unitig [i] . copy_total);
+ putchar ('\n');
+ }
+ }
+
+ // Mark scaffolds in contig_pos
+ n = contig . size ();
+fprintf (stderr, "### %d contigs\n", n);
+
+ for (i = 0; i < n; i ++)
+ {
+ j = Search (contig_pos, contig [i] . contig_id);
+
+ contig [i] . match = j;
+ if (j >= 0)
+ contig_pos [j] . scaff_id = contig [i] . scaff_id;
+ }
+
+ // Output scaffold links
+ n = contig_pos . size ();
+
+ for (i = 0; i < n; i ++)
+ contig_pos [i] . mark = false;
+
+ for (i = 0; i < n; i ++)
+ if (! contig_pos [i] . mark)
+ {
+ contig_pos [i] . mark = true;
+ printf ("LNK: %s", contig_pos [i] . tag);
+ if (contig_pos [i] . scaff_id == -1)
+ printf (" A%s # Degenerate scaff\n", Degen_Link_Col_Id);
+ else
+ {
+ for (j = i + 1; j < n; j ++)
+ if (contig_pos [j] . scaff_id == contig_pos [i] . scaff_id)
+ {
+ contig_pos [j] . mark = true;
+ printf (" %s", contig_pos [j] . tag);
+ }
+ printf (" A%s # Scaff %lld\n", Scaff_Link_Col_Id,
+ contig_pos [i] . scaff_id);
+ }
+ }
+
+ // Find reads that are in the picture
+ n = Read . size ();
+fprintf (stderr, "### %d reads\n", n);
+ for (i = 0; i < n; i ++)
+ {
+ Read [i] . mark = false;
+ if (Read [i] . contig_id >= 0)
+ {
+ j = Search (contig_pos, Read [i] . contig_id);
+ if (j >= 0)
+ {
+ Set_Position (Read [i] . cam_a, Read [i] . cam_b,
+ Read [i] . c_a_pos, Read [i] . c_b_pos,
+ contig_pos [j] . a, contig_pos [j] . b,
+ contig_pos [j] . len);
+ }
+ }
+ else if (Read [i] . unitig_id >= 0)
+ {
+ bool done;
+ int k;
+
+ j = Unitig_Search (unitig, Read [i] . unitig_id);
+ if (j < 0)
+ fprintf (stderr, "** Unitig %lld not found\n",
+ Read [i] . unitig_id);
+ else
+ {
+ done = false;
+
+ for (k = j; k < j + unitig [j] . copy_total && ! done; k ++)
+ {
+ int p;
+
+ p = Search (contig_pos, unitig [k] . contig_id);
+ if (p >= 0)
+ {
+ int x, y;
+
+ Set_Position (x, y, unitig [k] . c_a_pos,
+ unitig [k] . c_b_pos, contig_pos [p] . a,
+ contig_pos [p] . b, contig_pos [p] . len);
+ Set_Position (Read [i] . cam_a, Read [i] . cam_b,
+ Read [i] . u_a_pos, Read [i] . u_b_pos,
+ x, y, abs (x - y));
+ done = true;
+ }
+ }
+ }
+ }
+ }
+
+ Set_Starting_Rows ();
+
+ for (i = 0; i < n; i ++)
+ {
+ if (Read [i] . cam_a > 0 && ! Read [i] . mark)
+ {
+ char tag [200];
+
+ j = Read [i] . mate;
+ if (j < 0)
+ {
+ sprintf (tag, "Single read %lld (Utg%lld)", Read [i] . uid, Read [i] . unitig_id);
+ Output_Single_Read (i, Single_Read_Col_Id, Single_Mate_Col_Id,
+ SINGLE_READ_LEN, Good_Start_Row, tag);
+ }
+ else
+ {
+// fprintf (stderr, "%8d has mate %8d cam_a [j] = %d\n", i, j, Read [j] . cam_a);
+ if (Read [j] . cam_a > 0)
+ Output_Mates (i, j);
+ else
+ {
+ int mean;
+
+ sprintf (tag, "Read %lld (Utg%lld) mate %lld (Utg%lld) not in picture",
+ Read [i] . uid, Read [i] . unitig_id, Read [j] . uid,
+ Read [j] . unitig_id);
+ mean = int (Dst [Read [i] . dst] . mean);
+ Output_Single_Read (i, Infer_Read_Col_Id, Infer_Mate_Col_Id,
+ mean, Missing_Start_Row, tag);
+ }
+ Read [j] . mark = true;
+ }
+ }
+ Read [i] . mark = true;
+ }
+
+ return 0;
+ }
+
+
+
+static void Add_Pair_Extent
+ (int i, int j, vector <Extent_t> & extent)
+
+// Add one or two entries to extent reprenting the position(s)
+// of the mate pair Read [i] and Read [j] .
+
+ {
+ Extent_t ext;
+ int mean, sd, diff;
+
+ mean = int (Dst [Read [i] . dst] . mean);
+ sd = int (Dst [Read [i] . dst] . stddev);
+
+ if (Read [i] . cam_a <= Read [i] . cam_b)
+ {
+ if (Read [j] . cam_a <= Read [j] . cam_b
+ || Read [j] . cam_a < Read [i] . cam_a + 200
+ || Read [j] . cam_a > Read [i] . cam_a + mean + 10 * sd)
+ {
+ Add_Single_Extent (i, mean, 1, extent);
+ Add_Single_Extent (j, mean, 1, extent);
+ }
+ else
+ {
+ ext . lo = Read [i] . cam_a;
+ ext . hi = Read [j] . cam_a;
+ diff = Read [j] . cam_a - Read [i] . cam_a;
+ if (mean - 3 * sd <= diff && diff <= mean + 3 * sd)
+ ext . category = 0; // good
+ else
+ ext . category = 1; // stretched
+ extent . push_back (ext);
+ }
+ }
+ else
+ {
+ if (Read [j] . cam_a > Read [j] . cam_b
+ || Read [i] . cam_a < Read [j] . cam_a + 200
+ || Read [i] . cam_a > Read [j] . cam_a + mean + 10 * sd)
+ {
+ Add_Single_Extent (i, mean, 1, extent);
+ Add_Single_Extent (j, mean, 1, extent);
+ }
+ else
+ {
+ ext . lo = Read [j] . cam_a;
+ ext . hi = Read [i] . cam_a;
+ diff = Read [i] . cam_a - Read [j] . cam_a;
+ if (mean - 3 * sd <= diff && diff <= mean + 3 * sd)
+ ext . category = 0; // good
+ else
+ ext . category = 1; // stretched
+ extent . push_back (ext);
+ }
+ }
+
+ return;
+ }
+
+
+
+static void Add_Single_Extent
+ (int i, int len, int cat, vector <Extent_t> & extent)
+
+// Add an entry to extent representing the position of Read [i]
+// with a mate of length len and category cat .
+
+ {
+ Extent_t ext;
+
+ ext . category = cat;
+ if (Read [i] . cam_a < Read [i] . cam_b)
+ {
+ ext . lo = Read [i] . cam_a;
+ ext . hi = Read [i] . cam_a + len;
+ }
+ else
+ {
+ ext . lo = Read [i] . cam_a - len;
+ ext . hi = Read [i] . cam_a;
+ }
+
+ extent . push_back (ext);
+
+ return;
+ }
+
+
+
+static void Output_Mates
+ (int i, int j)
+
+// Output a celamy line for mated reads Read [i] and Read [j]
+
+ {
+ int mean, sd, diff;
+ char tag [200];
+
+ mean = int (Dst [Read [i] . dst] . mean);
+ sd = int (Dst [Read [i] . dst] . stddev);
+ if (Read [i] . cam_a <= Read [i] . cam_b)
+ {
+ if (Read [j] . cam_a <= Read [j] . cam_b
+ || Read [j] . cam_a < Read [i] . cam_a + 200
+ || Read [j] . cam_a > Read [i] . cam_a + mean + 10 * sd)
+ {
+ sprintf (tag, "Read %lld (Utg%lld) has bad mate %lld (Utg%lld) at coord %d",
+ Read [i] . uid, Read [i] . unitig_id, Read [j]. uid,
+ Read [j] . unitig_id, (Read [j] . cam_a + Read [j] . cam_b) / 2);
+ Output_Single_Read (i, Bad_Read_Col_Id, Bad_Mate_Col_Id, mean,
+ Bad_Start_Row, tag);
+
+ sprintf (tag, "Read %lld (Utg%lld) has bad mate %lld (Utg%lld) at coord %d",
+ Read [j]. uid, Read [j] . unitig_id, Read [i] . uid,
+ Read [i] . unitig_id, (Read [i] . cam_a + Read [i] . cam_b) / 2);
+ Output_Single_Read (j, Bad_Read_Col_Id, Bad_Mate_Col_Id, mean,
+ Bad_Start_Row, tag);
+ }
+ else if (Read [j] . cam_a > Read [j] . cam_b)
+ {
+ diff = Read [j] . cam_a - Read [i] . cam_a;
+ sprintf (tag, "Mated reads %lld (Utg%lld) and %lld (Utg%lld)"
+ " diff=%d mn=%d sd=%d distort=%+.1fsd",
+ Read [i] . uid, Read [i] . unitig_id, Read [j] . uid,
+ Read [j] . unitig_id,
+ diff, mean, sd, double (diff - mean) / sd);
+ if (mean - 3 * sd <= diff && diff <= mean + 3 * sd)
+ Output_Pair (i, j, Good_Read_Col_Id, Good_Mate_Col_Id,
+ Good_Start_Row, tag);
+ else
+ Output_Pair (i, j, Stretch_Read_Col_Id, Stretch_Mate_Col_Id,
+ Bad_Start_Row, tag);
+ }
+ }
+ else
+ {
+ if (Read [j] . cam_a > Read [j] . cam_b
+ || Read [i] . cam_a < Read [j] . cam_a + 200
+ || Read [i] . cam_a > Read [j] . cam_a + mean + 10 * sd)
+ {
+ sprintf (tag, "Read %lld (Utg%lld) has bad mate %lld (Utg%lld) at coord %d",
+ Read [i] . uid, Read [i] . unitig_id, Read [j] . uid,
+ Read [j] . unitig_id,
+ (Read [j] . cam_a + Read [j] . cam_b) / 2);
+ Output_Single_Read (i, Bad_Read_Col_Id, Bad_Mate_Col_Id, mean,
+ Bad_Start_Row, tag);
+
+ sprintf (tag, "Read %lld (Utg%lld) has bad mate %lld (Utg%lld) at coord %d",
+ Read [j] . uid, Read [j] . unitig_id, Read [i] . uid,
+ Read [i] . unitig_id,
+ (Read [i] . cam_a + Read [i] . cam_b) / 2);
+ Output_Single_Read (j, Bad_Read_Col_Id, Bad_Mate_Col_Id, mean,
+ Bad_Start_Row, tag);
+ }
+ else if (Read [j] . cam_a <= Read [j] . cam_b)
+ {
+ diff = Read [i] . cam_a - Read [j] . cam_a;
+ sprintf (tag, "Mated reads %lld (Utg%lld) and %lld (Utg%lld)"
+ " diff=%d mn=%d sd=%d distort=%+.1fsd",
+ Read [j] . uid, Read [j] . unitig_id, Read [i] . uid,
+ Read [i] . unitig_id,
+ diff, mean, sd, double (diff - mean) / sd);
+ if (mean - 3 * sd <= diff && diff <= mean + 3 * sd)
+ Output_Pair (j, i, Good_Read_Col_Id, Good_Mate_Col_Id,
+ Good_Start_Row, tag);
+ else
+ Output_Pair (j, i, Stretch_Read_Col_Id, Stretch_Mate_Col_Id,
+ Bad_Start_Row, tag);
+ }
+ }
+ return;
+ }
+
+
+
+static void Output_Pair
+ (int i, int j, const char * read_colour, const char * mate_colour,
+ int start_row, const char * tag)
+
+// Output a celamy line for mated reads Read [i] and Read [j] ,
+// where i is on the left. Use read_colour for the read parts and
+// mate_colour for the gap. Position the line at celamy row start_row
+// (or below, i.e., higher row number). Use tag as the celamy comment.
+
+ {
+ static int pair_ct = 0;
+
+ assert (Read [i] . cam_a <= Read [i] . cam_b);
+ assert (Read [j] . cam_a > Read [j] . cam_b);
+ assert (Read [i] . cam_a < Read [j] . cam_a);
+
+ pair_ct ++;
+
+ if (Read [j] . cam_b <= Read [i] . cam_b)
+ // no gap
+ printf ("%dReadPair: %d A%s %d R%d # %s\n", pair_ct, Read [i] . cam_a,
+ read_colour, Read [j] . cam_a, start_row, tag);
+ else
+ printf ("%dReadPair: %d A%s %d A%s %d A%s %d R%d # %s\n", pair_ct,
+ Read [i] . cam_a, read_colour, Read [i] . cam_b,
+ mate_colour, Read [j] . cam_b, read_colour, Read [j] . cam_a,
+ start_row, tag);
+
+ return;
+ }
+
+
+
+static void Output_Repeats
+ (const char * filename, const vector <Contig_Pos_t> & contig_pos)
+
+// Read nucmer matches from filename (format is from show-coords -cHlT )
+// and output celamy lines for the ones that match entries in
+// contig_pos .
+
+ {
+ FILE * fp;
+ char rpt_tag [100];
+ double percent_id, x_junk;
+ long long int ctg_id;
+ bool fwd_rpt;
+ int ctg_a, ctg_b, rpt_a, rpt_b, ctg_len, rpt_len, junk;
+ int left, right, ext_left, ext_right;
+ static int repeat_ct = 0;
+ int x, y;
+ int i, n;
+
+ fp = fopen (filename, "r");
+ assert (fp != NULL);
+
+ // output repeat header line
+ printf ("%s: %s T5 S # %s\n",
+ Repeat_Col_Id, Repeat_Col_Def, "RepeatMatch");
+ printf ("%s: %s T2 S # %s\n",
+ Repeat_Ext_Id, Repeat_Ext_Def, "RepeatExt");
+
+ n = contig_pos . size ();
+
+ while (fscanf (fp, "%d %d %d %d %d %d %lf %d %d %lf %lf %lld %s",
+ & ctg_a, & ctg_b, & rpt_a, & rpt_b, & junk, & junk, & percent_id,
+ & ctg_len, & rpt_len, & x_junk, & x_junk, & ctg_id, rpt_tag) == 13)
+ {
+ for (i = 0; i < n; i ++)
+ if (contig_pos [i] . contig_id == ctg_id)
+ { // output repeat line
+ if (contig_pos [i] . a < contig_pos [i] . b)
+ {
+ left = contig_pos [i] . a + ctg_a - 1;
+ right = left + 1 + ctg_b - ctg_a;
+ if (rpt_a < rpt_b)
+ {
+ ext_left = left - (rpt_a - 1);
+ ext_right = right + rpt_len - rpt_b;
+ fwd_rpt = true;
+ }
+ else
+ {
+ ext_left = left - (rpt_len - rpt_a);
+ ext_right = right + rpt_b - 1;
+ fwd_rpt = false;
+ }
+ }
+ else
+ {
+ right = contig_pos [i] . a + 1 - ctg_a;
+ left = right - (1 + ctg_b - ctg_a);
+ if (rpt_a < rpt_b)
+ {
+ ext_left = left - (rpt_len - rpt_b);
+ ext_right = right + rpt_a - 1;
+ fwd_rpt = false;
+ }
+ else
+ {
+ ext_left = left - (rpt_b - 1);
+ ext_right = right + rpt_len - rpt_a;
+ fwd_rpt = true;
+ }
+ }
+
+ printf ("%dRepeat:", ++ repeat_ct);
+ if (ext_left < left)
+ printf (" %d A%s", ext_left, Repeat_Ext_Id);
+ printf (" %d A%s %d", left, Repeat_Col_Id, right);
+ if (right < ext_right)
+ printf (" A%s %d", Repeat_Ext_Id, ext_right);
+ printf (" R4 # %s %s\n", rpt_tag, fwd_rpt ? "fwd" : "rev");
+
+ break;
+ }
+ }
+
+ fclose (fp);
+
+ return;
+ }
+
+
+
+static void Output_Single_Read
+ (int i, const char * read_colour, const char * mate_colour, int len,
+ int start_row, const char * tag)
+
+// Output a celamy line for just read Read [i] without a mate
+// using read_colour for the read part and mate_colour
+// for where the mate should be, len away from the beginning of the
+// read. Line is positioned at start_row (or below, i.e., higher row
+// number) on the screen. Use tag as the celamy comment
+
+ {
+ static int single_ct = 0;
+
+ single_ct ++;
+ if (Read [i] . cam_a < Read [i] . cam_b)
+ printf ("%dSingRead: %d A%s %d A%s %d R%d # %s\n",
+ single_ct, Read [i] . cam_a, read_colour,
+ Read [i] . cam_b, mate_colour,
+ Read [i] . cam_a + len, start_row, tag);
+ else
+ printf ("%dSingRead: %d A%s %d A%s %d R%d # %s\n",
+ single_ct, Read [i] . cam_a - len, mate_colour,
+ Read [i] . cam_b, read_colour,
+ Read [i] . cam_a, start_row, tag);
+
+ return;
+ }
+
+
+
+static void Print_Colour_Headers
+ (void)
+
+// Print the celamy descriptions of the colours referred to later
+
+ {
+ printf ("%s: %s T3 S # %s\n",
+ Unique_Col_Id, Unique_Col_Def, "UniqueUtg");
+ printf ("%s: %s T3 S # %s\n",
+ Rock_Col_Id, Rock_Col_Def, "RockUtg");
+ printf ("%s: %s T3 S # %s\n",
+ Surr_Col_Id, Surr_Col_Def, "SurrUtg");
+ printf ("%s: %s T3 S # %s\n",
+ Degen_Col_Id, Degen_Col_Def, "DegenUtg");
+ printf ("%s: %s T2 S # %s\n",
+ Degen_Link_Col_Id, Degen_Link_Col_Def, "DegenScaff");
+ printf ("%s: %s T2 S # %s\n",
+ Scaff_Link_Col_Id, Scaff_Link_Col_Def, "QueryScaff");
+ printf ("%s: %s T2 S # %s\n",
+ Single_Read_Col_Id, Single_Read_Col_Def, "SingleRead");
+ printf ("%s: %s T1 S # %s\n",
+ Single_Mate_Col_Id, Single_Mate_Col_Def, "SingleMate");
+ printf ("%s: %s T2 S # %s\n",
+ Bad_Read_Col_Id, Bad_Read_Col_Def, "BadRead");
+ printf ("%s: %s T1 S # %s\n",
+ Bad_Mate_Col_Id, Bad_Mate_Col_Def, "BadMate");
+ printf ("%s: %s T2 S # %s\n",
+ Stretch_Read_Col_Id, Stretch_Read_Col_Def, "StretchRead");
+ printf ("%s: %s T1 S # %s\n",
+ Stretch_Mate_Col_Id, Stretch_Mate_Col_Def, "StretchMate");
+ printf ("%s: %s T2 S # %s\n",
+ Good_Read_Col_Id, Good_Read_Col_Def, "GoodRead");
+ printf ("%s: %s T1 S # %s\n",
+ Good_Mate_Col_Id, Good_Mate_Col_Def, "GoodMate");
+ printf ("%s: %s T2 S # %s\n",
+ Infer_Read_Col_Id, Infer_Read_Col_Def, "InferRead");
+ printf ("%s: %s T1 S # %s\n",
+ Infer_Mate_Col_Id, Infer_Mate_Col_Def, "InferMate");
+
+ return;
+ }
+
+
+
+static int Read_Subscript
+ (long long int id)
+
+// Return the subscript in global vector Read of the read with uid id .
+// Use global ID_Map for the lookup. Only use the rightmost 32 bits
+// of id , assuming they're unique.
+// If it's not already there, add a new entry to the back of Read
+// and return it's subscript.
+
+ {
+ static Read_Info_t empty_read;
+ static int read_size = 0;
+ long unsigned buff;
+
+ buff = id & Hash_Mask;
+ if (ID_Map . find (buff) == ID_Map . end ())
+ {
+ ID_Map [buff] = read_size ++;
+ empty_read . uid = id;
+ Read . push_back (empty_read);
+ }
+
+ return ID_Map [buff];
+ }
+
+
+
+static int Search
+ (const vector <Contig_Pos_t> & pos, long long int id)
+
+// Do a binary search of pos for entry with contig_id == id
+// Return subscript of entry if found; -1 , if not found
+// Assumes pos has been sorted into ascending order by contig_id .
+
+ {
+ int lo, hi, mid;
+
+ lo = 0;
+ hi = pos . size () - 1;
+ while (lo <= hi)
+ {
+ mid = (lo + hi) / 2;
+ if (id == pos [mid] . contig_id)
+ return mid;
+ else if (id < pos [mid] . contig_id)
+ hi = mid - 1;
+ else
+ lo = mid + 1;
+ }
+
+ return -1;
+ }
+
+
+
+static void Set_Position
+ (int & x, int & y, int a, int b, int c, int d, int len)
+
+// Set x and y to the start and end positions, resp., of
+// an object that starts/ends at a/b within an object
+// whose start/end postions are c/d . c/d may have been
+// stretched/shrunk by partial matches to another object, and
+// len is the natural length that a/b refer to.
+
+ {
+ double factor;
+
+ if (c <= d)
+ {
+ factor = double (d - c) / len;
+ x = int (floor (0.5 + c + a * factor));
+ y = int (floor (0.5 + c + b * factor));
+ }
+ else
+ {
+ factor = double (c - d) / len;
+ x = int (floor (0.5 + c - a * factor));
+ y = int (floor (0.5 + c - b * factor));
+ }
+
+ return;
+ }
+
+
+
+static void Set_Starting_Rows
+ (void)
+
+// Determine the starting celamy row of bad and stretched mates
+// and missing mates. Use placement information in global Read .
+// Save results in globals Bad_Start_Row and Missing_Start_Row .
+
+ {
+ priority_queue <int, vector <int>, greater <int> > pq;
+ vector <Extent_t> extent;
+ int i, j, k, n;
+
+ n = Read . size ();
+ for (i = 0; i < n; i ++)
+ {
+ if (Read [i] . cam_a > 0 && ! Read [i] . mark)
+ {
+ j = Read [i] . mate;
+ if (j < 0)
+ Add_Single_Extent (i, SINGLE_READ_LEN, 0, extent);
+ else
+ {
+ if (Read [j] . cam_a > 0)
+ Add_Pair_Extent (i, j, extent);
+ else
+ Add_Single_Extent (i, int (Dst [Read [i] . dst] . mean),
+ 2, extent);
+ Read [j] . mark = true;
+ }
+ }
+ Read [i] . mark = true;
+ }
+
+ // restore marks
+ for (i = 0; i < n; i ++)
+ Read [i] . mark = false;
+
+ sort (extent . begin (), extent . end (), Extent_Cmp);
+
+ n = extent . size ();
+
+ // Get number of rows used by good and single mates
+ pq . push (-1);
+ for (i = 0; i < n && extent [i] . category == 0; i ++)
+ {
+ if (pq . top () < extent [i] . lo)
+ pq . pop ();
+ pq . push (extent [i] . hi);
+ }
+ k = pq . size ();
+ Bad_Start_Row = Good_Start_Row + k;
+ for (j = 0; j < k; j ++)
+ pq . pop ();
+
+ // Get number of rows used by bad and stretched mates
+ pq . push (-1);
+ for ( ; i < n && extent [i] . category == 1; i ++)
+ {
+ if (pq . top () < extent [i] . lo)
+ pq . pop ();
+ pq . push (extent [i] . hi);
+ }
+ k = pq . size ();
+ Missing_Start_Row = Bad_Start_Row + k;
+
+ return;
+ }
+
+
+
+
+static int Uni_Data_Search
+ (const vector <Uni_Data_t> & u, long long int id)
+
+// Do a binary search of u for entries with unitig_id == id
+// Return subscript of entry if found; -1 , if not found.
+// Assumes u has been sorted into ascending order by unitig_id .
+
+ {
+ int lo, hi, mid;
+
+ lo = 0;
+ hi = u . size () - 1;
+ while (lo <= hi)
+ {
+ mid = (lo + hi) / 2;
+ if (id == u [mid] . unitig_id)
+ return mid;
+ else if (id < u [mid] . unitig_id)
+ hi = mid - 1;
+ else
+ lo = mid + 1;
+ }
+
+ return -1;
+ }
+
+
+
+static int Unitig_Search
+ (const vector <Unitig_Info_t> & u, long long int id)
+
+// Do a binary search of u for entries with unitig_id == id
+// Return subscript of first entry if found; -1 , if not found.
+// Assumes u has been sorted into ascending order by unitig_id .
+
+ {
+ int lo, hi, mid, n;
+
+ lo = 0;
+ n = hi = u . size () - 1;
+ while (lo <= hi)
+ {
+ mid = (lo + hi) / 2;
+ if (id == u [mid] . unitig_id)
+ {
+ while (mid > 0 && u [mid] . unitig_id == u [mid - 1] . unitig_id)
+ mid --;
+
+ return mid;
+ }
+ else if (id < u [mid] . unitig_id)
+ hi = mid - 1;
+ else
+ lo = mid + 1;
+ }
+
+ return -1;
+ }
+
+
diff --git a/src/Align/running-cmp.cc b/src/Align/running-cmp.cc
new file mode 100644
index 0000000..80f8fc2
--- /dev/null
+++ b/src/Align/running-cmp.cc
@@ -0,0 +1,91 @@
+// A. L. Delcher
+//
+// File: running-cmp.cc
+//
+// Last Modified: 9 July 2003
+//
+// Read 2 files of numbers, sort them into descending order
+// and print out the running difference between their prefix sums.
+
+
+#include "delcher.hh"
+#include <vector>
+#include <algorithm>
+using namespace std;
+
+const int MAX_LINE = 10000;
+
+
+static bool Reverse_Order
+ (const double & a, const double & b)
+ {
+ return (b < a);
+ }
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ FILE * fp;
+ vector <double> a, b;
+ double x, sum, s2;
+ char line [MAX_LINE];
+ int a_len, b_len, min_len;
+ int i;
+
+ Verbose = 0;
+
+ if (argc < 3)
+ {
+ fprintf (stderr, "USAGE: running-cmp <file1> <file2>\n");
+ exit (EXIT_FAILURE);
+ }
+
+ fp = File_Open (argv [1], "r");
+ // skip the first line which is a comment
+ fgets (line, MAX_LINE, fp);
+ while (fscanf (fp, "%lf", & x) == 1)
+ a . push_back (x);
+ fclose (fp);
+
+ fp = File_Open (argv [2], "r");
+ // skip the first line which is a comment
+ fgets (line, MAX_LINE, fp);
+ while (fscanf (fp, "%lf", & x) == 1)
+ b . push_back (x);
+ fclose (fp);
+
+ sort (a . begin (), a . end (), Reverse_Order);
+ sort (b . begin (), b . end (), Reverse_Order);
+
+ a_len = a . size ();
+ b_len = b . size ();
+ min_len = Min (a_len, b_len);
+
+ sum = 0.0;
+
+ for (i = 0; i < min_len; i ++)
+ {
+ sum += a [i] - b [i];
+ printf ("%6d %10.0f %10.0f %10.0f\n", i, a [i], b [i], sum);
+ }
+
+ s2 = 0.0;
+ if (min_len < a_len)
+ {
+ for ( ; i < a_len; i ++)
+ s2 += a [i];
+ printf ("File 1 has %d additional entries: sum = %.0f average = %.0f\n",
+ a_len - min_len, s2, s2 / (a_len - min_len));
+ }
+ else if (min_len < b_len)
+ {
+ for ( ; i < b_len; i ++)
+ s2 += b [i];
+ printf ("File 2 has %d additional entries: sum = %.0f average = %.0f\n",
+ b_len - min_len, s2, s2 / (b_len - min_len));
+ }
+
+ return 0;
+ }
diff --git a/src/Align/show-ma-asm.cc b/src/Align/show-ma-asm.cc
new file mode 100644
index 0000000..5d9ceea
--- /dev/null
+++ b/src/Align/show-ma-asm.cc
@@ -0,0 +1,1332 @@
+// A. L. Delcher
+//
+// File: show-ma-asm.cc
+//
+// Last Modified: 20 May 2003
+//
+// Read Celera-format .asm and .frg files and display the
+// multialignment for a specified contig
+
+
+#include "utility_AMOS.hh"
+#include "delcher.hh"
+#include "fasta.hh"
+#include "align.hh"
+#include <vector>
+#include <set>
+#include <string>
+#include <algorithm>
+#include <cassert>
+
+using namespace std;
+
+
+#define RESTRICTED_COUNTS 0
+
+
+static const char * VERSION_ID = "1.2";
+
+
+static const int ALIGN_WIDTH = 60;
+ // number of characters to show on each line of multialignment
+static const int INITIAL_READ_BUFF_LEN = 2048;
+ // initial length of buffer to hold reads
+static const int MAX_LINE = 1000;
+ // maximum length input line
+static const unsigned SIGNIFICANT_QUAL_THRESHOLD = 30;
+ // Minimum value for a quality difference to be significant
+static const int TAG_WIDTH = 10;
+ // number of characters for id tags at beginning of multialignment
+ // lines--should be at least 9
+
+
+#if RESTRICTED_COUNTS
+ #define COUNT_WIDTH 3
+ #define QUAL_WIDTH 16
+ static const unsigned QUAL_LIMIT = (1 << QUAL_WIDTH) - 100;
+ // don't add to quality sum if its already this large
+#else
+ #define COUNT_WIDTH 8
+ #define QUAL_WIDTH 32
+ static const unsigned QUAL_LIMIT = UINT_MAX - 128;
+ // don't add to quality sum if its already this large
+#endif
+
+static const unsigned COUNT_LIMIT = (1 << COUNT_WIDTH) - 1;
+ // dont add to quality sum if its already this large
+
+
+struct Count_t
+ {
+ char majority_ch, alternate_ch;
+ // In case of SNP, set majority_ch to the consensus
+ // character and alternate_ch to the other character
+ unsigned a_ct : COUNT_WIDTH;
+ unsigned c_ct : COUNT_WIDTH;
+ unsigned g_ct : COUNT_WIDTH;
+ unsigned t_ct : COUNT_WIDTH;
+ unsigned other_ct : COUNT_WIDTH;
+ unsigned a_qual : QUAL_WIDTH;
+ unsigned c_qual : QUAL_WIDTH;
+ unsigned g_qual : QUAL_WIDTH;
+ unsigned t_qual : QUAL_WIDTH;
+ unsigned other_qual : QUAL_WIDTH;
+ int position, plus_gaps;
+ // position is where this count is in the consensus
+ // plus_gaps is how many gaps after that postion if
+ // the position is in terms of ungapped characters
+
+ Count_t
+ () // Default constructor
+ { Zero (); }
+
+ bool Check_SNP (char cons_ch)
+ // Check if these counts indicate a SNP, where
+ // cons_ch is the consensus character. If not,
+ // return false ; otherwise, set majority_ch and
+ // alternate_ch and return true .
+
+ {
+ unsigned cons_ct, cons_qual, max_ch, max_ct, max_qual;
+ unsigned total_ct;
+
+ cons_ch = tolower (cons_ch);
+ max_ct = 0;
+ if (cons_ch == 'a')
+ {
+ cons_ct = a_ct;
+ cons_qual = a_qual;
+ }
+ else if (a_ct > max_ct)
+ {
+ max_ch = 'a';
+ max_ct = a_ct;
+ max_qual = a_qual;
+ }
+ if (cons_ch == 'c')
+ {
+ cons_ct = c_ct;
+ cons_qual = c_qual;
+ }
+ else if (c_ct > max_ct)
+ {
+ max_ch = 'c';
+ max_ct = c_ct;
+ max_qual = c_qual;
+ }
+ if (cons_ch == 'g')
+ {
+ cons_ct = g_ct;
+ cons_qual = g_qual;
+ }
+ else if (g_ct > max_ct)
+ {
+ max_ch = 'g';
+ max_ct = g_ct;
+ max_qual = g_qual;
+ }
+ if (cons_ch == 't')
+ {
+ cons_ct = t_ct;
+ cons_qual = t_qual;
+ }
+ else if (t_ct > max_ct)
+ {
+ max_ch = 't';
+ max_ct = t_ct;
+ max_qual = t_qual;
+ }
+ if (cons_ch == '-')
+ {
+ cons_ct = other_ct;
+ cons_qual = other_qual;
+ }
+ else if (other_ct > max_ct)
+ {
+ max_ch = '-';
+ max_ct = other_ct;
+ max_qual = other_qual;
+ }
+ total_ct = a_ct + c_ct + g_ct + t_ct + other_ct;
+ // This is the rule for determining SNPs
+ // Can be changed as desired
+ if (cons_ct >= 3 && max_ct >= 3
+ || total_ct <= 8 && cons_ct >= 2 && max_ct >= 2)
+ {
+ majority_ch = cons_ch;
+ alternate_ch = max_ch;
+ return true;
+ }
+
+ return false;
+ }
+
+ void Incr
+ (char ch, unsigned q)
+ {
+ switch (tolower (ch))
+ {
+ case 'a' :
+ if (a_ct < COUNT_LIMIT)
+ a_ct ++;
+ if (a_qual < QUAL_LIMIT)
+ a_qual += q;
+ break;
+ case 'c' :
+ if (c_ct < COUNT_LIMIT)
+ c_ct ++;
+ if (c_qual < QUAL_LIMIT)
+ c_qual += q;
+ break;
+ case 'g' :
+ if (g_ct < COUNT_LIMIT)
+ g_ct ++;
+ if (g_qual < QUAL_LIMIT)
+ g_qual += q;
+ break;
+ case 't' :
+ if (t_ct < COUNT_LIMIT)
+ t_ct ++;
+ if (t_qual < QUAL_LIMIT)
+ t_qual += q;
+ break;
+ default :
+ if (other_ct < COUNT_LIMIT)
+ other_ct ++;
+ if (other_qual < QUAL_LIMIT)
+ other_qual += q;
+ break;
+ }
+ }
+ void Majority
+ (char & ch, unsigned & qual) const
+ {
+ unsigned max, sum;
+
+ max = sum = a_qual;
+ ch = 'a';
+ if (c_qual > max)
+ {
+ max = c_qual;
+ ch = 'c';
+ }
+ sum += c_qual;
+ if (g_qual > max)
+ {
+ max = g_qual;
+ ch = 'g';
+ }
+ sum += g_qual;
+ if (t_qual > max)
+ {
+ max = t_qual;
+ ch = 't';
+ }
+ sum += t_qual;
+ if (other_qual > max)
+ {
+ max = other_qual;
+ ch = '-';
+ }
+ sum += other_qual;
+
+ if (sum - max <= 20 && 2 * max - sum >= 20)
+ qual = 2 * max - sum;
+ else
+ {
+ ch = ' ';
+ qual = 0;
+ }
+
+ return;
+ }
+ int Num_Greater
+ (unsigned n)
+ {
+ int ct = 0;
+
+ if (a_ct > n)
+ ct ++;
+ if (c_ct > n)
+ ct ++;
+ if (g_ct > n)
+ ct ++;
+ if (t_ct > n)
+ ct ++;
+ if (other_ct > n)
+ ct ++;
+ return ct;
+ }
+ void Print
+ (FILE * fp) const
+ {
+ fprintf (fp, " %2u/%-4u %2u/%-4u %2u/%-4u %2u/%-4u %2u/%-4u ",
+ a_ct, a_qual, c_ct, c_qual, g_ct, g_qual, t_ct, t_qual,
+ other_ct, other_qual);
+ }
+ void SNP_Print
+ (FILE * fp) const
+ // Print the SNP information in this count
+ {
+ fprintf (fp, "%8d %+3d %c/%c ", position, plus_gaps,
+ majority_ch, alternate_ch);
+ Print (fp);
+ fputc ('\n', fp);
+ return;
+ }
+
+ const char * SNP_String
+ (void)
+ {
+ static char buff [10];
+ bool first = true;
+
+ buff [0] = '\0';
+ if (a_ct > 1)
+ {
+ if (! first)
+ strcat (buff, "/");
+ strcat (buff, "a");
+ first = false;
+ }
+ if (c_ct > 1)
+ {
+ if (! first)
+ strcat (buff, "/");
+ strcat (buff, "c");
+ first = false;
+ }
+ if (g_ct > 1)
+ {
+ if (! first)
+ strcat (buff, "/");
+ strcat (buff, "g");
+ first = false;
+ }
+ if (t_ct > 1)
+ {
+ if (! first)
+ strcat (buff, "/");
+ strcat (buff, "t");
+ first = false;
+ }
+ if (other_ct > 1)
+ {
+ if (! first)
+ strcat (buff, "/");
+ strcat (buff, "-");
+ first = false;
+ }
+ return buff;
+ }
+ int Sum
+ (void) const
+ {
+ return a_ct + c_ct + g_ct + t_ct + other_ct;
+ }
+ void Zero
+ (void)
+ {
+ a_ct = c_ct = g_ct = t_ct = other_ct
+ = a_qual = c_qual = g_qual = t_qual = other_qual = 0;
+ }
+ };
+
+struct Read_Info_t
+ {
+ int id;
+ int start, end;
+ int len : 31;
+ unsigned flipped : 1;
+ vector <int> del;
+ char * seq, * qual;
+
+ bool operator <
+ (const Read_Info_t & r) const
+ {
+ return (start < r . start);
+ }
+ };
+
+
+static string Desired_ID;
+static char * ASM_File_Name;
+static char * FRG_File_Name;
+static FILE * SNP_fp = NULL;
+ // File to which SNP information should be written if
+ // Show_SNPs is true.
+static bool Consensus_With_Gapped_Coords = false;
+ // Determines whether coordinates after consensus line count
+ // all characters (if true ), or just non-gap characters (if false )
+static bool Only_One = true;
+ // If true then do only one contig, otherwise do them all
+static bool Show_SNPs = false;
+ // If set true by the -s option, the after each multialignment
+ // list the SNP values in it
+static bool Show_Unitig = false;
+ // If set true by the -u option, then do alignment for unitig(s)
+ // with the specified uid
+
+
+static void Clean_Consensus
+ (char * consensus, int & gapped_len, int & ungapped_len);
+static int Count_SNPs
+ (char * consensus, int con_lo, int con_hi,
+ const vector <Read_Info_t> & read_list, int & possible);
+static void Get_Reads
+ (const char * file_name, vector <Read_Info_t> & read_list,
+ const set <int> & frg_ids);
+static void Incr_Align_Counts
+ (Count_t * count, const Read_Info_t & read, int offset);
+static void List_SNPs
+ (FILE * fp, char * consensus, int con_lo, int con_hi,
+ const vector <Read_Info_t> & read_list);
+static void Parse_Command_Line
+ (int argc, char * argv []);
+static void Print_Alignment_Line
+ (FILE * fp, const Read_Info_t & read, int lo, int hi,
+ const char * consensus, string & diff_line, vector <Count_t> & count);
+static void Print_Multialignment
+ (FILE * fp, char * consensus, int con_lo, int con_hi,
+ const vector <Read_Info_t> & read_list, int & gaps,
+ vector <Count_t> & snp_list, bool with_diffs = true);
+static void Print_Multialignment_Segment
+ (FILE * fp, char * consensus, int con_lo, int con_hi,
+ const vector <Read_Info_t> & read_list, int & gaps,
+ vector <Count_t> & snp_list, bool with_diffs = true);
+static void Print_SNP_List
+ (FILE * fp, const vector <Count_t> & snp_list);
+bool Significant_Diff
+ (const Count_t & x, const Count_t & y, char & x_ch, char & y_ch,
+ unsigned & qual_diff);
+static void Usage
+ (const char * command);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ FILE * fp;
+ char line [MAX_LINE], hdr_line [MAX_LINE];
+ set <int> frg_ids;
+ vector <Read_Info_t> read_list, surro_list;
+ Read_Info_t read;
+ Gapped_Multi_Alignment_t gma;
+ vector <Count_t> snp_list;
+ char * consensus = NULL;
+ int consensus_len, consensus_ungapped_len;
+ int tig_iid;
+ bool in_cco = false, in_consensus = false, in_mps = false, in_del = false;
+ bool in_utg = false;
+ bool found_it = false;
+ string cid;
+ char * p;
+ time_t now;
+ int ct, dln, gaps, level;
+ int i, n;
+
+ now = time (NULL);
+ cerr << "Starting on " << ctime (& now) << endl;
+
+ Verbose = 0;
+
+ Parse_Command_Line (argc, argv);
+
+ if (Only_One)
+ fprintf (stderr, "Multialignment for %stig %s\n",
+ Show_Unitig ? "uni" : "con", Desired_ID . c_str ());
+ else
+ fprintf (stderr, "Multialignment for all %stigs\n",
+ Show_Unitig ? "uni" : "con");
+ fprintf (stderr, "Using .asm file %s and .frg file %s\n",
+ ASM_File_Name, FRG_File_Name);
+
+ // Find and extract the CCO message for the specified contig
+ fp = File_Open (ASM_File_Name, "r", __FILE__, __LINE__);
+ level = 0;
+ while (fgets (line, MAX_LINE, fp) != NULL)
+ {
+ if (line [0] == '{')
+ level ++;
+ else if (line [0] == '}')
+ level --;
+ if (strncmp (line, "{CCO", 4) == 0)
+ in_cco = true;
+ else if (strncmp (line, "{UTG", 4) == 0)
+ in_utg = true;
+ if (in_cco && level == 0)
+ in_cco = false;
+ else if (in_utg && level == 0)
+ in_utg = false;
+ if (in_cco && strncmp (line, "acc:", 4) == 0 && ! Show_Unitig)
+ {
+ p = strchr (line + 5, ',');
+ assert (p != NULL);
+ cid . assign (line + 5, p - line - 5);
+ if (cid == Desired_ID || ! Only_One)
+ {
+ found_it = true;
+ tig_iid = strtol (p + 1, NULL, 10);
+ }
+ }
+ else if (in_utg && strncmp (line, "acc:", 4) == 0 && Show_Unitig)
+ {
+ p = strchr (line + 5, ',');
+ assert (p != NULL);
+ cid . assign (line + 5, p - line - 5);
+ if (cid == Desired_ID || ! Only_One)
+ {
+ found_it = true;
+ tig_iid = strtol (p + 1, NULL, 10);
+ }
+ }
+ if (found_it && level == 0)
+ {
+ int possible, snps;
+
+ if (Only_One)
+ break;
+
+ Clean_Consensus (consensus, consensus_len, consensus_ungapped_len);
+ assert (ct == consensus_len);
+
+ Get_Reads (FRG_File_Name, read_list, frg_ids);
+ n = read_list . size ();
+
+#if 0
+ snps = Count_SNPs (consensus, 0, consensus_len, read_list, possible);
+ printf ("%10s %10d %8d %8d %8d %8d %8d\n",
+ cid . c_str (), tig_iid, n, consensus_len, consensus_ungapped_len,
+ snps, possible);
+#else
+ sprintf (hdr_line,
+ "%stig %s (iid %d) reads = %d len = %d (%d without gaps)",
+ Show_Unitig ? "Uni" : "Con", cid . c_str (), tig_iid, n,
+ consensus_len, consensus_ungapped_len);
+ printf ("\n\n%s\n\n", hdr_line);
+ gaps = 0;
+
+ sort (read_list . begin (), read_list . end ());
+
+ snp_list . clear ();
+ Print_Multialignment (stdout, consensus, 0, consensus_len,
+ read_list, gaps, snp_list);
+ if (Show_SNPs)
+ {
+ Print_SNP_List (stdout, snp_list);
+
+ fprintf (SNP_fp, "\n%s\n", hdr_line);
+ Print_SNP_List (SNP_fp, snp_list);
+
+// List_SNPs (stdout, consensus, 0, consensus_len, read_list);
+ }
+#endif
+
+ found_it = false;
+ n = read_list . size ();
+ for (i = 0; i < n; i ++)
+ {
+ free (read_list [i] . seq);
+ free (read_list [i] . qual);
+ }
+ read_list . clear ();
+ frg_ids . clear ();
+ ct = 0;
+ }
+ if (found_it && strncmp (line, "len:", 4) == 0)
+ {
+ int len;
+
+ len = strtol (line + 4, NULL, 10);
+ consensus = (char *) AMOS::SafeRealloc (consensus, len + 1);
+ consensus [0] = '\n';
+ ct = 0; // length of consensus
+ }
+ if (found_it && strncmp (line, "cns:", 4) == 0)
+ in_consensus = true;
+ else if (in_consensus)
+ {
+ char * s;
+
+ s = strtok (line, " \t\n");
+ if (strcmp (s, ".") == 0)
+ in_consensus = false;
+ else
+ {
+ strcpy (consensus + ct, s);
+ ct += strlen (s);
+ }
+ }
+ if (found_it && strncmp (line, "{MPS", 4) == 0)
+ in_mps = true;
+ else if (in_mps && line [0] == '}')
+ {
+ in_mps = in_del = false;
+ read . flipped = FALSE;
+ read_list . push_back (read);
+ if (Verbose > 1)
+ {
+ cerr << "push read list len = " << read_list . size ()
+ << " level = " << level << endl;
+ cerr << "start = " << read . start << " end = " << read . end
+ << endl;
+ cerr << "inserting id " << read . id << endl;
+ }
+ frg_ids . insert (read . id);
+ read . del . clear ();
+ }
+ if (in_mps && strncmp (line, "mid:", 4) == 0)
+ read . id = strtol (line + 4, NULL, 10);
+ if (in_mps && strncmp (line, "pos:", 4) == 0)
+ sscanf (line + 4, "%d,%d", & read . start, & read . end);
+ if (in_mps && strncmp (line, "dln:", 4) == 0)
+ dln = strtol (line + 4, NULL, 10);
+ if (in_mps && strncmp (line, "del:", 4) == 0)
+ in_del = true;
+ else if (in_del)
+ {
+ char * p;
+
+ for (p = strtok (line, " \t\n"); p != NULL; p = strtok (NULL, " \t\n"))
+ read . del . push_back (strtol (p, NULL, 10));
+ }
+ }
+
+ fclose (fp);
+
+ if (Only_One)
+ {
+ if (! found_it)
+ {
+ fprintf (stderr, "ERROR: Didn't find %stig %s\n",
+ Show_Unitig ? "Uni" : "Con", Desired_ID . c_str ());
+ exit (EXIT_FAILURE);
+ }
+ Clean_Consensus (consensus, consensus_len, consensus_ungapped_len);
+ assert (ct == consensus_len);
+
+ Get_Reads (FRG_File_Name, read_list, frg_ids);
+
+ n = read_list . size ();
+ if (Verbose > 0)
+ {
+ fprintf (stderr, "Num reads = %d\n", n);
+ fprintf (stderr, "Consensus:\n");
+ Fasta_Print (stderr, consensus, NULL);
+ for (i = 0; i < n; i ++)
+ {
+ int j, m;
+
+ fprintf (stderr, "Read=%d id=%d start=%d end=%d :\n",
+ i, read_list [i] . id, read_list [i] . start,
+ read_list [i] . end);
+ fprintf (stderr, "dln: ");
+ m = read_list [i] . del . size ();
+ for (j = 0; j < m; j ++)
+ fprintf (stderr, " %3d", read_list [i] . del [j]);
+ fputc ('\n', stderr);
+ Fasta_Print (stderr, read_list [i] . seq, NULL);
+ }
+ }
+
+ printf ("%stig %s (iid %d) reads = %d len = %d (%d without gaps)\n\n",
+ Show_Unitig ? "Uni" : "Con", Desired_ID . c_str (), tig_iid, n,
+ consensus_len, consensus_ungapped_len);
+ gaps = 0;
+
+ sort (read_list . begin (), read_list . end ());
+
+ Print_Multialignment (stdout, consensus, 0, consensus_len,
+ read_list, gaps, snp_list);
+ if (Show_SNPs)
+ {
+ Print_SNP_List (stdout, snp_list);
+
+ fprintf (SNP_fp, "\n%s\n", hdr_line);
+ Print_SNP_List (SNP_fp, snp_list);
+
+// List_SNPs (stdout, consensus, 0, consensus_len, read_list);
+ }
+ }
+
+ if (Show_SNPs)
+ fclose (SNP_fp);
+
+ return 0;
+ }
+
+
+
+static void Clean_Consensus
+ (char * consensus, int & gapped_len, int & ungapped_len)
+
+// Set gapped_len to length of string consensus . Set
+// ungapped_len to the number of non-hyphens in consensus .
+// Convert consensus to lowercase.
+
+ {
+ int i, ct;
+
+ gapped_len = strlen (consensus);
+ ct = 0;
+ for (i = 0; i < gapped_len; i ++)
+ if (isalpha (consensus [i]))
+ {
+ consensus [i] = tolower (consensus [i]);
+ ct ++;
+ }
+ ungapped_len = ct;
+
+ return;
+ }
+
+
+
+static int Count_SNPs
+ (char * consensus, int con_lo, int con_hi,
+ const vector <Read_Info_t> & read_list, int & possible)
+
+// Return the number of potential SNPs in consensus
+// in region con_lo .. con_hi . Use the reads in
+// read_list . Set possible to the number of positions
+// that had enough coverage to possibly meet the conditions
+// for a SNP.
+
+ {
+ static Count_t * count = NULL;
+ static int count_len;
+ int cons_len, ct;
+ int i, n;
+
+ cons_len = con_hi - con_lo;
+ if (count == NULL)
+ {
+ count = (Count_t *) AMOS::SafeCalloc (cons_len, sizeof (Count_t));
+ count_len = cons_len;
+ }
+ else
+ {
+ if (cons_len > count_len)
+ {
+ count = (Count_t *) AMOS::SafeRealloc (count, cons_len * sizeof (Count_t));
+ count_len = cons_len;
+ }
+ for (i = 0; i < cons_len; i ++)
+ count [i] . Zero ();
+ }
+
+ n = read_list . size ();
+ for (i = 0; i < n; i ++)
+ Incr_Align_Counts (count, read_list [i], con_lo);
+
+ possible = 0;
+ for (i = con_lo; i < con_hi; i ++)
+ if (count [i] . Sum () >= 4)
+ possible ++;
+
+ ct = 0;
+ for (i = con_lo; i < con_hi; i ++)
+ if (count [i] . Num_Greater (2) >= 2)
+ ct ++;
+
+ return ct;
+ }
+
+
+
+static void Get_Reads
+ (const char * file_name, vector <Read_Info_t> & read_list,
+ const set <int> & frg_ids)
+
+// Open and read sequence information from .frg file file_name
+// and put the relevant information into read_list .
+// frg_ids contains the ids of the reads to get.
+
+ {
+ static char * read_buff = NULL;
+ static int read_buff_len = INITIAL_READ_BUFF_LEN;
+ static char * qual_buff = NULL;
+ static int qual_buff_len = INITIAL_READ_BUFF_LEN;
+ FILE * fp;
+ char line [MAX_LINE];
+ int level;
+ int frg_sub;
+ bool found_it, in_frg, in_frgseq, in_qualseq;
+ int i, n, ct, q_ct;
+
+ if (read_buff == NULL)
+ read_buff = (char *) AMOS::SafeMalloc (read_buff_len);
+ if (qual_buff == NULL)
+ qual_buff = (char *) AMOS::SafeMalloc (qual_buff_len);
+
+ // Find the read sequence information from the .frg file
+ // for all the reads in read_list
+ fp = File_Open (FRG_File_Name, "r", __FILE__, __LINE__);
+ level = 0;
+ found_it = in_frg = in_frgseq = in_qualseq = false;
+ while (fgets (line, MAX_LINE, fp) != NULL)
+ {
+ if (line [0] == '{')
+ level ++;
+ else if (line [0] == '}')
+ level --;
+ if (level == 1 && strncmp (line, "{FRG", 4) == 0)
+ in_frg = true;
+ if (in_frg && level == 0)
+ in_frg = found_it = false;
+ if (found_it && strncmp (line, "clr:", 4) == 0)
+ {
+ int clr_start, clr_end, len;
+
+ sscanf (line + 4, "%d,%d", & clr_start, & clr_end);
+ read_list [frg_sub] . len = len = clr_end - clr_start;
+ if (clr_start > 0)
+ {
+ memmove (read_buff, read_buff + clr_start, len);
+ memmove (qual_buff, qual_buff + clr_start, len);
+ }
+ read_buff [len] = '\0';
+ qual_buff [len] = '\0';
+ if (read_list [frg_sub] . start > read_list [frg_sub] . end)
+ {
+ int save;
+
+ Reverse_Complement (read_buff);
+ Reverse_String (qual_buff);
+ save = read_list [frg_sub] . start;
+ read_list [frg_sub] . start = read_list [frg_sub] . end;
+ read_list [frg_sub] . end = save;
+ read_list [frg_sub] . flipped = TRUE;
+ }
+ read_list [frg_sub] . seq = strdup (read_buff);
+ read_list [frg_sub] . qual = strdup (qual_buff);
+ for (i = 0; i < len; i ++)
+ read_list [frg_sub] . qual [i] -= '0';
+ }
+ if (found_it && strncmp (line, "seq:", 4) == 0)
+ {
+ in_frgseq = true;
+ ct = 0;
+ }
+ else if (found_it && strncmp (line, "qlt:", 4) == 0)
+ {
+ in_qualseq = true;
+ q_ct = 0;
+ }
+ else if (in_frgseq)
+ {
+ char * s;
+
+ s = strtok (line, " \t\n");
+ if (strcmp (s, ".") == 0)
+ in_frgseq = false;
+ else
+ {
+ int add;
+
+ add = strlen (s);
+ if (ct + add >= read_buff_len)
+ {
+ read_buff_len *= 2;
+ read_buff
+ = (char *) AMOS::SafeRealloc (read_buff, read_buff_len);
+ }
+ strcpy (read_buff + ct, s);
+ ct += strlen (s);
+ }
+ }
+ else if (in_qualseq)
+ {
+ char * s;
+
+ s = strtok (line, " \t\n");
+ if (strcmp (s, ".") == 0)
+ in_qualseq = false;
+ else
+ {
+ int add;
+
+ add = strlen (s);
+ if (q_ct + add >= qual_buff_len)
+ {
+ qual_buff_len *= 2;
+ qual_buff
+ = (char *) AMOS::SafeRealloc (qual_buff, qual_buff_len);
+ }
+ strcpy (qual_buff + q_ct, s);
+ q_ct += strlen (s);
+ }
+ }
+ if (in_frg && strncmp (line, "acc:", 4) == 0)
+ {
+ int fid;
+
+ fid = strtol (line + 4, NULL, 10);
+ if (frg_ids . find (fid) != frg_ids . end ())
+ {
+ if (Verbose > 1)
+ cerr << "*** Found " << fid << endl;
+ found_it = true;
+ n = read_list . size ();
+ for (i = 0; i < n; i ++)
+ if (read_list [i] . id == fid)
+ {
+ frg_sub = i;
+ break;
+ }
+ if (i == n)
+ {
+ cerr << "ERROR: Didn't find read id " << fid << endl;
+ exit (EXIT_FAILURE);
+ }
+ }
+ }
+ }
+
+ fclose (fp);
+
+ return;
+ }
+
+
+
+static void Incr_Align_Counts
+ (Count_t * count, const Read_Info_t & read, int offset)
+
+// Increment positions in count for each position in read that
+// aligns to them. offset is the consensus position corresponding
+// to the first entry in count .
+
+ {
+ int i, j, k, m;
+
+ assert (offset <= read . start);
+
+ m = read . del . size ();
+ j = 0; // position in the read
+ k = 0; // del entry subscript
+
+ for (i = read . start; i < read . end; i ++)
+ if (k < m && j == read . del [k])
+ {
+ count [i - offset] . Incr ('-',
+ Min (read . qual [j - 1], read . qual [j]));
+ k ++;
+ }
+ else
+ {
+ count [i - offset] . Incr (read . seq [j], read . qual [j]);
+ j ++;
+ }
+
+ return;
+ }
+
+
+
+static void List_SNPs
+ (FILE * fp, char * consensus, int con_lo, int con_hi,
+ const vector <Read_Info_t> & read_list)
+
+// Print to fp positions in consensus [con_lo .. con_hi]
+// that have >=2 reads for each of 2 or more different values
+// at a column. Use reads in read_list.
+
+ {
+ static Count_t * count_a = NULL, * count_b = NULL;
+ static int count_len;
+ int cons_len, ct, possible;
+ int i, n;
+
+ cons_len = con_hi - con_lo;
+ if (count_a == NULL)
+ {
+ count_a = (Count_t *) AMOS::SafeCalloc (cons_len, sizeof (Count_t));
+ count_b = (Count_t *) AMOS::SafeCalloc (cons_len, sizeof (Count_t));
+ count_len = cons_len;
+ }
+ else
+ {
+ if (cons_len > count_len)
+ {
+ count_a = (Count_t *) AMOS::SafeRealloc (count_a, cons_len * sizeof (Count_t));
+ count_b = (Count_t *) AMOS::SafeRealloc (count_b, cons_len * sizeof (Count_t));
+ count_len = cons_len;
+ }
+ for (i = 0; i < cons_len; i ++)
+ {
+ count_a [i] . Zero ();
+ count_b [i] . Zero ();
+ }
+ }
+
+ n = read_list . size ();
+ for (i = 0; i < n; i ++)
+ {
+ if (read_list [i] . id < 100000)
+ Incr_Align_Counts (count_a, read_list [i], con_lo);
+ else
+ Incr_Align_Counts (count_b, read_list [i], con_lo);
+ }
+
+ possible = 0;
+ for (i = con_lo; i < con_hi; i ++)
+ if (count_a [i] . Sum () > 0 && count_b [i] . Sum () > 0)
+ possible ++;
+
+ ct = 0;
+ for (i = con_lo; i < con_hi; i ++)
+ {
+ char a_ch, b_ch;
+ unsigned qual_diff;
+
+// if (count_a [i] . Num_Greater (2) >= 2)
+ if (Significant_Diff (count_a [i], count_b [i], a_ch, b_ch, qual_diff))
+ {
+// char buff [10];
+
+ fprintf (fp, "%7d %c/%c %3d ", i + 1, a_ch, b_ch, qual_diff);
+ count_a [i] . Print (fp);
+ fprintf (fp, " ");
+ count_b [i] . Print (fp);
+// strcpy (buff, count_a [i] . SNP_String ());
+// fprintf (fp, " %s\n", buff);
+ fputc ('\n', fp);
+ ct ++;
+ }
+ }
+
+ fprintf (fp, "%d SNPs out of %d possible positions\n", ct, possible);
+
+ return;
+ }
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = false;
+ int ch;
+
+ optarg = NULL;
+
+ while (! errflg && ((ch = getopt (argc, argv, "ghs:uV")) != EOF))
+ switch (ch)
+ {
+ case 'g' :
+ Consensus_With_Gapped_Coords = true;
+ break;
+
+ case 'h' :
+ Usage (argv [0]);
+ exit (EXIT_SUCCESS);
+
+ case 's' :
+ Show_SNPs = true;
+ SNP_fp = File_Open (optarg, "w", __FILE__, __LINE__);
+ break;
+
+ case 'u' :
+ Show_Unitig = true;
+ break;
+
+ case 'V' :
+ fprintf (stderr, "Version = %s\n", VERSION_ID);
+ exit (EXIT_SUCCESS);
+
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+
+ default :
+ errflg = true;
+ }
+
+ if (errflg)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (optind > argc - 3)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (strcmp (argv [optind], "ALL") == 0)
+ {
+ Only_One = false;
+ Desired_ID = "BAD";
+ optind ++;
+ }
+ else
+ Desired_ID = argv [optind ++];
+ ASM_File_Name = argv [optind ++];
+ FRG_File_Name = argv [optind ++];
+
+ return;
+ }
+
+
+
+static void Print_Alignment_Line
+ (FILE * fp, const Read_Info_t & read, int lo, int hi,
+ const char * consensus, string & diff_line, vector <Count_t> & count)
+
+// Print to fp the single-line portion of the alignment in
+// read to the portion of the consensus string between
+// lo and hi (in gapped coordinates).
+// consensus is the consensus string. Put a '^' in each
+// position of diff_line that the alignment line disagrees with
+// the consensus. Set counts and quality sums in count
+// for the corresponding entries.
+
+ {
+ int read_lo, read_hi;
+ int i, j, k, m;
+
+ if (read . end <= lo || hi <= read . start)
+ return; // there's nothing here
+
+
+ read_lo = read_hi = 0;
+
+ // Print the id tag of this read at the beginning of the line
+ fprintf (fp, "%*d: ", TAG_WIDTH, read . id);
+
+ m = read . del . size ();
+ j = 0; // position in the read
+ k = 0; // del entry subscript
+
+ if (lo < read . start)
+ { // put blanks to get to the start of this read
+ for (i = lo; i < read . start; i ++)
+ fputc (' ', fp);
+ }
+ else
+ { // skip the start of this read before where this line begins
+ for (i = read . start; i < lo; i ++)
+ if (k < m && j == read . del [k])
+ k ++;
+ else
+ j ++;
+ }
+ read_lo = j;
+
+ // print actual alignment
+ for ( ; i < read . end && i < hi; i ++)
+ if (k < m && j == read . del [k])
+ {
+ unsigned nbr_qual;
+
+ fputc ('-', fp);
+ nbr_qual = read . qual [j];
+ if (j > 0 && unsigned (read . qual [j - 1]) < nbr_qual)
+ nbr_qual = read . qual [j - 1];
+ // Use smaller of the two bounding qualities as the quality
+ // for the gap
+ count [i - lo] . Incr ('-', nbr_qual);
+ diff_line [i - lo] = '^';
+ k ++;
+ }
+ else
+ {
+ fputc (read . seq [j], fp);
+ count [i - lo] . Incr (read . seq [j], read . qual [j]);
+ if (tolower (read . seq [j]) != tolower (consensus [i]))
+ diff_line [i - lo] = '^';
+ j ++;
+ }
+ read_hi = j;
+
+ // print blanks at end if necessary
+ for ( ; i < hi; i ++)
+ fputc (' ', fp);
+
+ if (read . flipped)
+ {
+ read_lo = read . len - read_lo;
+ read_hi = read . len - read_hi;
+ }
+ fprintf (fp, " %d..%d\n", read_lo, read_hi);
+
+ return;
+ }
+
+
+
+static void Print_Multialignment
+ (FILE * fp, char * consensus, int con_lo, int con_hi,
+ const vector <Read_Info_t> & read_list, int & gaps,
+ vector <Count_t> & snp_list, bool with_diffs)
+
+// Print to fp the multialignment of the reads in read_list to
+// the portion of the string consensus between positions
+// con_lo and con_hi (in gapped coordinates).
+// If with_diffs is true, then show under the consensus where
+// there is not complete agreement in the alignment. gaps is
+// the number of gaps that have been in consensus before con_lo
+// so that consensus coordinates without gaps can be printed.
+// gaps is updated at the end.
+
+ {
+ int i;
+
+ for (i = con_lo; i < con_hi; i += ALIGN_WIDTH)
+ {
+ int hi;
+
+ if (i > con_lo)
+ fputc ('\n', fp);
+ hi = i + ALIGN_WIDTH;
+ if (hi > con_hi)
+ hi = con_hi;
+ Print_Multialignment_Segment (fp, consensus, i, hi, read_list, gaps,
+ snp_list, with_diffs);
+ }
+
+ return;
+ }
+
+
+
+static void Print_Multialignment_Segment
+ (FILE * fp, char * consensus, int con_lo, int con_hi,
+ const vector <Read_Info_t> & read_list, int & gaps,
+ vector <Count_t> & snp_list, bool with_diffs)
+
+// Print to fp the single segment of the multialignment of
+// the reads in read_list to the portion of the string consensus
+// between positions con_lo and con_hi (in gapped coordinates).
+// If with_diffs is true, then show under the consensus where
+// there is not complete agreement in the alignment. gaps is
+// the number of gaps that have been in consensus before con_lo
+// so that consensus coordinates without gaps can be printed.
+// gaps is updated at the end. snp_list is where the
+// SNP locations are saved if Show_SNPs is true.
+
+ {
+ string diff_line (con_hi - con_lo, ' ');
+ vector <Count_t> count (con_hi - con_lo);
+ int new_gaps, consecutive_gaps;
+ int i, j, n;
+
+ n = read_list . size ();
+ for (i = 0; i < n; i ++)
+ if (read_list [i] . start < con_hi && con_lo < read_list [i] . end)
+ Print_Alignment_Line (fp, read_list [i], con_lo, con_hi,
+ consensus, diff_line, count);
+ fprintf (fp, "%*s: ", TAG_WIDTH, "consensus");
+ j = new_gaps = consecutive_gaps = 0;
+ for (i = con_lo; i < con_hi; i ++, j ++)
+ {
+ fputc (consensus [i], fp);
+ if (consensus [i] == '-')
+ {
+ new_gaps ++;
+ consecutive_gaps ++;
+ }
+ else
+ consecutive_gaps = 0;
+
+ if (Show_SNPs && count [j] . Check_SNP (consensus [i]))
+ {
+ diff_line [j] = '#';
+ count [j] . position = i - gaps - new_gaps;
+ count [j] . plus_gaps = consecutive_gaps;
+ snp_list . push_back (count [j]);
+ }
+ }
+
+ if (Consensus_With_Gapped_Coords)
+ fprintf (fp, " %d..%d\n", con_lo, con_hi);
+ else
+ fprintf (fp, " %d..%d\n", con_lo - gaps, con_hi - gaps - new_gaps);
+ gaps += new_gaps;
+ if (with_diffs)
+ {
+ fprintf (fp, "%*s %s\n", TAG_WIDTH, "", diff_line . c_str ());
+ }
+
+ return;
+ }
+
+
+
+static void Print_SNP_List
+ (FILE * fp, const vector <Count_t> & snp_list)
+
+// Print the SNPs in snp_list to fp .
+
+ {
+ int i, n;
+
+ n = snp_list . size ();
+
+ fprintf (fp, "SNPs:\n");
+ for (i = 0; i < n; i ++)
+ snp_list [i] . SNP_Print (fp);
+ fprintf (fp, "Total SNPs = %d\n", n);
+
+ return;
+ }
+
+
+
+bool Significant_Diff
+ (const Count_t & x, const Count_t & y, char & x_ch, char & y_ch,
+ unsigned & qual_diff)
+
+// Return true iff counts x and y are different enough to
+// indicate a SNP
+
+ {
+ unsigned x_qual, y_qual;
+
+ x . Majority (x_ch, x_qual);
+ y . Majority (y_ch, y_qual);
+
+ qual_diff = Min (x_qual, y_qual);
+
+ return (x_ch != y_ch && x_ch != ' ' && y_ch != ' '
+ && qual_diff > SIGNIFICANT_QUAL_THRESHOLD);
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "USAGE: %s [options] <uid> <asm-file> <frg-file>\n"
+ "\n"
+ "Read Celera-format .asm file and .frg file and\n"
+ "print the multialignment for the specified contig/unitig\n"
+ "If <uid> is ALL, then print alignments of all contigs/unitigs\n"
+ "\n"
+ "Options:\n"
+ " -g Count gaps in printed consensus positions\n"
+ " -h Print this usage message\n"
+ " -s Print SNPs in addition to multialignments\n"
+ " -u Print alignments for unitig(s) with specfied uid(s)\n"
+ " -V Display code version\n"
+ "\n",
+ command);
+
+ return;
+ }
+
+
+
diff --git a/src/Align/sim-cover-depth.cc b/src/Align/sim-cover-depth.cc
new file mode 100644
index 0000000..2cdc06e
--- /dev/null
+++ b/src/Align/sim-cover-depth.cc
@@ -0,0 +1,251 @@
+// A. L. Delcher
+//
+// File: sim-cover-depth.cc
+//
+// Last Modified: 11 March 2003
+//
+// Simulate coverage depth for random reads from genome.
+
+
+#include "delcher.hh"
+#include <deque>
+#include <vector>
+using namespace std;
+
+const int DEFAULT_MIN_OLAP_LEN = 40;
+const int DEFAULT_HI_DEGREE = 20;
+
+
+struct Dist_Entry_t
+ {
+ int degree;
+ double prob, cum_prob;
+ double num_reads, cum_num_reads;
+ };
+
+
+static double Genome_Len;
+ // Length of the genome in bases
+static int Hi_Degree = DEFAULT_HI_DEGREE;
+ // The highest value to print a probability for. Above this
+ // just prints above
+static int Min_Olap_Len = DEFAULT_MIN_OLAP_LEN;
+ // Smallest detected overlap between two reads
+static double Num_Reads;
+ // Number of reads randomly distributed in the genome
+static double Read_Len;
+ // Number of bases in each read
+
+
+static void Parse_Command_Line
+ (int argc, char * argv []);
+static void Usage
+ (const char * command);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ double start_prob;
+ double pos, prev_event;
+ double total_coverage = 0.0;
+ deque <double> event_list;
+ // This is a list of positions of pending end-of-read events
+ vector <int> cover_ct (1 + Hi_Degree, 0);
+ int total_ct = 0;
+ vector <double> cover_len (1 + Hi_Degree, 0.0);
+ int coverage = 0, prev_coverage = 0;
+ int i;
+
+ Parse_Command_Line (argc, argv);
+
+ fprintf (stderr, "Starting on %s at %s\n", __DATE__, __TIME__);
+
+ Verbose = 0;
+
+ srand48 (time (NULL));
+
+ printf ("Num Reads = %.0f Read Len = %.0f Genome Len = %.0f\n",
+ Num_Reads, Read_Len, Genome_Len);
+
+ start_prob = Num_Reads / (1.0 + Genome_Len - Read_Len);
+
+ prev_event = 0.0;
+ for (pos = 0.0; pos <= Genome_Len; pos += 1.0)
+ {
+ bool have_event = false;
+
+ if (event_list . size () > 0 && event_list . front () == pos)
+ {
+ coverage --;
+ have_event = true;
+ event_list . pop_front ();
+ }
+ if (pos <= Genome_Len - Read_Len // read could start here
+ && drand48 () < start_prob) // and does
+ {
+ if (event_list . size () > 0
+ && event_list . back () - pos < Min_Olap_Len)
+ {
+ // When the last overlap is less than Min_Olap_Len
+ // then the region is arbitrarily ascribed to
+ // the read that starts here by prematurely
+ // truncating the pending events.
+ coverage -= event_list . size ();
+ event_list . clear ();
+ }
+ event_list . push_back (pos + Read_Len);
+ coverage ++;
+ have_event = true;
+ }
+ if (have_event)
+ {
+ if (pos > prev_event)
+ {
+ if (prev_coverage > Hi_Degree)
+ prev_coverage = Hi_Degree;
+ cover_ct [prev_coverage] ++;
+ total_ct ++;
+ cover_len [prev_coverage] += pos - prev_event;
+ }
+ prev_event = pos;
+ prev_coverage = coverage;
+ }
+ }
+
+ if (prev_event < Genome_Len)
+ {
+ if (prev_coverage > Hi_Degree)
+ prev_coverage = Hi_Degree;
+ cover_ct [prev_coverage] ++;
+ total_ct ++;
+ cover_len [prev_coverage] += Genome_Len - prev_event;
+ }
+
+
+ printf ("%8s %14s %19s %10s\n",
+ "Coverage", "# Regions", "Total Length", "Avg Len");
+ for (i = 0; i < Hi_Degree; i ++)
+ {
+ printf (" %3d: %8d (%5.1f%%) %10.0f (%5.1f%%) %8.1f\n",
+ i, cover_ct [i], Percent (cover_ct [i], total_ct),
+ cover_len [i], Percent (cover_len [i], Genome_Len),
+ Ratio (cover_len [i], cover_ct [i]));
+ total_coverage += i * cover_len [i];
+ }
+ printf (">=%3d: %8d (%5.1f%%) %10.0f (%5.1f%%) %8.1f\n",
+ Hi_Degree, cover_ct [Hi_Degree],
+ Percent (cover_ct [Hi_Degree], total_ct),
+ cover_len [Hi_Degree],
+ Percent (cover_len [Hi_Degree], Genome_Len),
+ Ratio (cover_len [Hi_Degree], cover_ct [Hi_Degree]));
+ total_coverage += i * cover_len [Hi_Degree];
+ printf ("\nEffective coverage = %.1fx\n", total_coverage / Genome_Len);
+
+ return 0;
+ }
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = FALSE;
+ int ch;
+ char * p;
+
+ optarg = NULL;
+
+ while (! errflg
+ && ((ch = getopt (argc, argv, "hmo:")) != EOF))
+ switch (ch)
+ {
+ case 'h' :
+ errflg = TRUE;
+ break;
+
+ case 'o' :
+ Min_Olap_Len = (int) strtol (optarg, & p, 10);
+ if (p == optarg)
+ {
+ fprintf (stderr, "ERROR: Bad min olap length \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ break;
+
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+ // fall through
+
+ default :
+ errflg = TRUE;
+ }
+
+ if (errflg || optind != argc - 3)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ Num_Reads = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad num reads \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ optind ++;
+
+ Read_Len = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad read len \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ optind ++;
+
+ Genome_Len = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad genome len \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ optind ++;
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "USAGE: %s <#reads> <read-len> <genome-len>\n"
+ "\n"
+ "List probabilities for numbers of overlaps off one end of a read\n"
+ "based on binomial trials model\n"
+ "\n"
+ "Options:\n"
+ " -m Adjust genome length to get best match to distrib\n"
+ " input from stdin\n"
+ " -o <n> Set minimum overlap length to <n> (default = %d)\n"
+ "\n",
+ command, DEFAULT_MIN_OLAP_LEN);
+
+ return;
+ }
diff --git a/src/Align/sim-cover2.cc b/src/Align/sim-cover2.cc
new file mode 100644
index 0000000..3c54386
--- /dev/null
+++ b/src/Align/sim-cover2.cc
@@ -0,0 +1,633 @@
+// A. L. Delcher
+//
+// File: sim-cover2.cc
+//
+// Last Modified: 13 June 2003
+//
+// Simulate coverage of multiple haplotypes
+
+
+#include "delcher.hh"
+#include <vector>
+#include <algorithm>
+#include <cassert>
+using namespace std;
+
+const unsigned DEFAULT_MIN_OLAP_LEN = 40;
+
+
+struct Pair_t
+ {
+ unsigned a, b;
+ };
+
+struct Position_t
+ {
+ unsigned pos : 30;
+ unsigned haplo : 1;
+ unsigned begin : 1;
+
+ bool operator <
+ (const Position_t & p) const
+ {
+ if (pos < p . pos)
+ return true;
+ if (pos == p . pos && haplo < p . haplo)
+ return true;
+
+ return false;
+ }
+ };
+
+struct Read_t
+ {
+ unsigned lo : 30;
+ unsigned haplo : 1;
+ unsigned unique : 1;
+ unsigned hi : 30;
+ unsigned deleted : 1;
+
+ bool operator <
+ (const Read_t & r) const
+ {
+ if (lo < r . lo)
+ return true;
+ if (lo == r . lo && haplo < r . haplo)
+ return true;
+
+ return false;
+ }
+ };
+
+struct Result_t
+ {
+ double any, both, two_one, two_two;
+ double onex, twox;
+ double c_gaps, u_gaps;
+ double c_gap_ct, u_gap_ct;
+
+ Result_t
+ ()
+ {
+ Clear ();
+ }
+
+ void Clear
+ (void)
+ {
+ any = both = two_one = two_two = onex = twox = c_gaps = u_gaps = 0.0;
+ c_gap_ct = u_gap_ct = 0.0;
+ }
+
+ void Add
+ (const Result_t & r)
+ {
+ any += r . any;
+ both += r . both;
+ two_one += r . two_one;
+ two_two += r . two_two;
+ onex += r . onex;
+ twox += r . twox;
+ c_gaps += r . c_gaps;
+ u_gaps += r . u_gaps;
+ c_gap_ct += r . c_gap_ct;
+ u_gap_ct += r . u_gap_ct;
+ }
+
+ void Divide
+ (double d)
+ {
+ assert (d != 0.0);
+
+ any /= d;
+ both /= d;
+ two_one /= d;
+ two_two /= d;
+ onex /= d;
+ twox /= d;
+ c_gaps /= d;
+ u_gaps /= d;
+ c_gap_ct /= d;
+ u_gap_ct /= d;
+ }
+ };
+
+
+static double Coverage;
+ // Read_Len * Num_Reads / Genome_Len;
+static double Genome_Len;
+ // Length of the genome in bases
+static int Haplo_Count = 1000;
+ // Number of separate distinct-haplotype regions
+static double Haplo_Fraction = 0.40;
+ // Portion of genome assumed to be distinct haplotypes
+static int Haplo_Len;
+ // Length of each distinct-haplotype region
+static int Min_Contig_Count = 2;
+ // Minimum number of reads to make a contig and be counted
+static unsigned Min_Olap_Len = DEFAULT_MIN_OLAP_LEN;
+ // Smallest detected overlap between two reads
+static double Read_Len;
+ // Number of bases in each read
+static vector <Pair_t> Unique_List;
+ // Regions of genome that are completely separate haplotypes
+
+
+static void Analyze_Haplo
+ (unsigned hap, vector <Read_t> read_list, Result_t & result);
+static void Find_Contigs
+ (unsigned hap, vector <Read_t> & list);
+static void Get_Region_Types
+ (unsigned lo, unsigned hi, unsigned & c_len, unsigned & u_len);
+static bool Hits_Any
+ (unsigned lo, unsigned hi, vector <Pair_t> & list);
+static void Make_Unique_List
+ (vector <Pair_t> & list);
+static void Parse_Command_Line
+ (int argc, char * argv []);
+static void Print_Results
+ (const Result_t & a, const Result_t & b);
+static void Usage
+ (const char * command);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ vector <Read_t> read_list;
+ Read_t read;
+ Result_t result_a, result_b, comb_a, comb_b;
+ int num_reads;
+ int iter_count = 10;
+ int i, iter;
+
+ Parse_Command_Line (argc, argv);
+
+ fprintf (stderr, "Starting on %s at %s\n", __DATE__, __TIME__);
+
+ Verbose = 0;
+
+// srand48 (time (NULL));
+
+ num_reads = int ((Coverage * Genome_Len) / Read_Len);
+
+ printf ("Num Reads = %d Read Len = %.0f,s.d.=100.0"
+ " Genome Len = %.0f Coverage = %.1fx\n",
+ num_reads, Read_Len, Genome_Len, Coverage);
+ Haplo_Len = int (Haplo_Fraction * Genome_Len) / Haplo_Count;
+ printf ("Haplos: Fraction = %.2f Count = %d Len = %d\n",
+ Haplo_Fraction, Haplo_Count, Haplo_Len);
+
+ Make_Unique_List (Unique_List);
+
+ if (Verbose > 0)
+ {
+ int n;
+
+ n = Unique_List . size ();
+ for (i = 0; i < n; i ++)
+ printf ("Unique %7u .. %7u\n", Unique_List [i] . a,
+ Unique_List [i] . b);
+ }
+
+ for (iter = 1; iter <= iter_count; iter ++)
+ {
+ read_list . clear ();
+
+ for (i = 0; i < num_reads; i ++)
+ {
+ int read_len;
+
+ read_len = int (Read_Len + Pseudo_Normal () * 100.0);
+
+ read . haplo = (drand48 () < 0.50 ? 0 : 1);
+ read . lo = int (drand48 () * (Genome_Len - read_len));
+ read . hi = read . lo + int (read_len);
+ read . unique = Hits_Any (read . lo, read . hi, Unique_List);
+ read . deleted = 0;
+ read_list . push_back (read);
+ }
+
+ sort (read_list . begin (), read_list . end ());
+
+ if (Verbose > 0)
+ {
+ for (i = 0; i < num_reads; i ++)
+ printf ("Read %3d %7u .. %7u %u %u\n", i,
+ read_list [i] . lo, read_list [i] . hi,
+ read_list [i] . haplo, read_list [i] . unique);
+ }
+
+ Analyze_Haplo (0, read_list, result_a);
+ if (Verbose > 0)
+ printf ("Result A: %7.0f %7.0f %7.0f %7.0f\n",
+ result_a . any, result_a . both, result_a . two_one,
+ result_a . two_two);
+ Analyze_Haplo (1, read_list, result_b);
+ if (Verbose > 0)
+ printf ("Result B: %7.0f %7.0f %7.0f %7.0f\n",
+ result_b . any, result_b . both, result_b . two_one,
+ result_b . two_two);
+
+ comb_a . Add (result_a);
+ comb_b . Add (result_b);
+ }
+
+ comb_a . Divide (iter_count);
+ comb_b . Divide (iter_count);
+ Print_Results (comb_a, comb_b);
+
+ return 0;
+ }
+
+
+
+static void Analyze_Haplo
+ (unsigned hap, vector <Read_t> read, Result_t & result)
+
+// Analyze the genome using unique reads of haplotype hap plus
+// non-unique reads. Reads are in list read . Put results of
+// analysis into result . Note that list read is a *COPY* of
+// the original list--we'll change it without worrying about the original.
+
+ {
+ vector <Position_t> list;
+ Position_t pos;
+ int cov [2];
+ unsigned prev;
+ int i, n, ct;
+
+ result . Clear ();
+
+ Find_Contigs (hap, read);
+
+ n = read . size ();
+ ct = 0;
+ for (i = 0; i < n; i ++)
+ if (! read [i] . deleted)
+ {
+ pos . pos = read [i] . lo;
+ pos . haplo = read [i] . haplo;
+ pos . begin = 1;
+ list . push_back (pos);
+ pos . pos = read [i] . hi;
+ pos . begin = 0;
+ list . push_back (pos);
+ ct += 2;
+ }
+
+ if (ct == 0)
+ return;
+ sort (list . begin (), list . end ());
+
+ cov [0] = cov [1] = 0;
+ prev = list [0] . pos;
+ cov [list [0] . haplo] ++;
+ if (Verbose > 0)
+ printf ("%7u %u %3d %3d\n", list [0] . pos, list [0] . begin,
+ cov [0], cov [1]);
+
+ for (i = 1; i < ct; i ++)
+ {
+ if (list [i] . pos > prev)
+ {
+ unsigned c_len, u_len;
+
+ Get_Region_Types (prev, list [i] . pos, c_len, u_len);
+
+ if (Verbose > 0)
+ printf ("Region %7d .. %7d %5d %5d %3d %3d\n",
+ prev, list [i] . pos, c_len, u_len, cov [0], cov [1]);
+
+ if (cov [0] == 0 && cov [1] == 0)
+ {
+ if (u_len > 0)
+ {
+ result . u_gaps += u_len;
+ result . u_gap_ct += 1.0;
+ }
+ else
+ {
+ result . c_gaps += c_len;
+ result . c_gap_ct += 1.0;
+ }
+ }
+ if (cov [0] > 0 || cov [1] > 0)
+ result . any += c_len;
+ if (cov [0] > 0 && cov [1] > 0)
+ {
+ result . both += c_len;
+ if (cov [0] > 1 || cov [1] > 1)
+ result . two_one += c_len;
+ if (cov [0] > 1 && cov [1] > 1)
+ result . two_two += c_len;
+ }
+ if (cov [hap] > 0)
+ result . onex += u_len;
+ if (cov [hap] > 1)
+ result . twox += u_len;
+ prev = list [i] . pos;
+ }
+ if (list [i] . begin)
+ cov [list [i] . haplo] ++;
+ else
+ cov [list [i] . haplo] --;
+
+ if (Verbose > 0)
+ printf ("%7u %u %3d %3d\n", list [i] . pos, list [i] . begin,
+ cov [0], cov [1]);
+ }
+
+ return;
+ }
+
+
+
+static void Find_Contigs
+ (unsigned hap, vector <Read_t> & read)
+
+// Identify reads in read that could be part of a contig with at
+// least Min_Contig_Count reads. Ignore all unique reads that are
+// not haplotype hap . Set deleted in all the others
+// to true . Also trim the ends of reads on the ends of contigs that
+// overlap by less than Min_Olap_Len bases.
+
+ {
+ vector <int> contig;
+ unsigned adjust_pos, extent;
+ int i, j, m, n;
+
+ adjust_pos = extent = 0;
+
+ n = read . size ();
+ for (i = 0; i < n; i ++)
+ {
+ if (read [i] . unique && read [i] . haplo != hap)
+ {
+ read [i] . deleted = 1;
+ continue;
+ }
+
+ if (extent - read [i] . lo < Min_Olap_Len)
+ { // previous contig has ended
+ m = contig . size ();
+ if (m < Min_Contig_Count)
+ {
+ for (j = 0; j < m; j ++)
+ read [contig [j]] . deleted = 1;
+ }
+ else if (read [i] . lo < extent)
+ { // overlap too small--trim ends
+ adjust_pos = (extent + read [i] . lo) / 2;
+
+ for (j = 0; j < m; j ++)
+ if (read [contig [j]] . hi > adjust_pos)
+ read [contig [j]] . hi = adjust_pos;
+ }
+
+ contig . clear ();
+ }
+
+ if (read [i] . lo < adjust_pos)
+ read [i] . lo = adjust_pos;
+ contig . push_back (i);
+
+ if (extent < read [i] . hi)
+ extent = read [i] . hi;
+ }
+
+ return;
+ }
+
+
+
+static void Get_Region_Types
+ (unsigned lo, unsigned hi, unsigned & c_len, unsigned & u_len)
+
+// Match the region lo .. hi (in gapped coordinates) against
+// the regions in Unique_List and set u_len to the size of the
+// region that intersects a unique and c_len to the size of the
+// remainder. This version assumes lo .. hi hits at most one
+// of the regions in Unique_List .
+
+ {
+ int i, n;
+
+ u_len = 0;
+
+ n = Unique_List . size ();
+ for (i = 0; i < n; i ++)
+ if (lo < Unique_List [i] . b && hi > Unique_List [i] . a)
+ { // found it
+ u_len = Min (hi, Unique_List [i] . b) - Max (Unique_List [i] . a, lo);
+ break;
+ }
+
+ c_len = hi - lo - u_len;
+
+ return;
+ }
+
+
+
+static bool Hits_Any
+ (unsigned lo, unsigned hi, vector <Pair_t> & list)
+
+// Return true iff region lo .. hi (in gapped coordinates)
+// intersects any region on list .
+
+ {
+ int i, n;
+
+ n = list . size ();
+ for (i = 0; i < n; i ++)
+ if (lo < list [i] . b && hi > list [i] . a)
+ return true;
+
+ return false;
+ }
+
+
+
+static void Make_Unique_List
+ (vector <Pair_t> & list)
+
+// Put into list Haplo_Count evenly spaced regions of size
+// Haplo_Len representing a total of Haplo_Fraction of
+// Genome_Len .
+
+ {
+ int i, lo, skip;
+
+ list . clear ();
+
+ skip = int (((1.0 - Haplo_Fraction) * Genome_Len) / Haplo_Count);
+
+ lo = skip / 2;
+ for (i = 0; i < Haplo_Count; i ++)
+ {
+ Pair_t p;
+
+ p . a = lo;
+ p . b = lo + Haplo_Len;
+
+ list . push_back (p);
+
+ lo += skip + Haplo_Len;
+ }
+
+ return;
+ }
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = FALSE;
+ int ch;
+ char * p;
+
+ optarg = NULL;
+
+ while (! errflg
+ && ((ch = getopt (argc, argv, "ho:")) != EOF))
+ switch (ch)
+ {
+ case 'h' :
+ errflg = TRUE;
+ break;
+
+ case 'o' :
+ Min_Olap_Len = (int) strtol (optarg, & p, 10);
+ if (p == optarg)
+ {
+ fprintf (stderr, "ERROR: Bad min olap length \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ break;
+
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+ // fall through
+
+ default :
+ errflg = TRUE;
+ }
+
+ if (errflg || optind != argc - 3)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ Coverage = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad coverage value \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ optind ++;
+
+ Read_Len = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad read len \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ optind ++;
+
+ Genome_Len = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad genome len \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ optind ++;
+
+ return;
+ }
+
+
+
+static void Print_Results
+ (const Result_t & a, const Result_t & b)
+
+// Print to stdout the combined results in a (for haplotype A)
+// and b (for haplotype B).
+
+ {
+ double region_len;
+ double x, y;
+
+ printf ("Common (SNP) Regions:\n");
+ region_len = (1.0 - Haplo_Fraction) * Genome_Len;
+ x = (a . any + b . any) / 2.0;
+ printf ("%20s %9.0f %6.2f%%\n", "Total Coverage", x, Percent (x, region_len));
+ x = (a . both + b . both) / 2.0;
+ printf ("%20s %9.0f %6.2f%%\n", "Both Haplotypes", x, Percent (x, region_len));
+ x = (a . two_one + b . two_one) / 2.0;
+ printf ("%20s %9.0f %6.2f%%\n", "Two + One", x, Percent (x, region_len));
+ x = (a . two_two + b . two_two) / 2.0;
+ printf ("%20s %9.0f %6.2f%%\n", "Two + Two", x, Percent (x, region_len));
+ x = (a . c_gap_ct + b . c_gap_ct) / 2.0;
+ printf ("%20s %9.0f\n", "Num Gaps", x);
+ y = (a . c_gaps + b . c_gaps) / 2.0;
+ printf ("%20s %9.0f\n", "Avg Gap Len", x > 0.0 ? y / x : 0.0);
+
+ printf ("Haplotype A Regions:\n");
+ region_len = Haplo_Fraction * Genome_Len;
+ printf ("%20s %9.0f %6.2f%%\n", "Total Coverage", a . onex ,
+ Percent (a . onex, region_len));
+ printf ("%20s %9.0f %6.2f%%\n", ">=2x Coverage", a . twox ,
+ Percent (a . twox, region_len));
+ x = a . u_gap_ct;
+ printf ("%20s %9.0f\n", "Num Gaps", x);
+ printf ("%20s %9.0f\n", "Avg Gap Len", x > 0.0 ? a . u_gaps / x : 0.0);
+
+ printf ("Haplotype B Regions:\n");
+ printf ("%20s %9.0f %6.2f%%\n", "Total Coverage", b . onex ,
+ Percent (b . onex, region_len));
+ printf ("%20s %9.0f %6.2f%%\n", ">=2x Coverage", b . twox ,
+ Percent (b . twox, region_len));
+ x = b . u_gap_ct;
+ printf ("%20s %9.0f\n", "Num Gaps", x);
+ printf ("%20s %9.0f\n", "Avg Gap Len", x > 0.0 ? b . u_gaps / x : 0.0);
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "USAGE: %s <coverage> <read-len> <genome-len>\n"
+ "\n"
+ "List coverage by multiple haplotypes of a genome assuming\n"
+ "perfect assembly\n"
+ "\n"
+ "Options:\n"
+ " -h Print this message\n"
+ " -o <n> Set minimum overlap length to <n> (default = %d)\n"
+ "\n",
+ command, DEFAULT_MIN_OLAP_LEN);
+
+ return;
+ }
diff --git a/src/Align/sim-shotgun.cc b/src/Align/sim-shotgun.cc
new file mode 100644
index 0000000..415c956
--- /dev/null
+++ b/src/Align/sim-shotgun.cc
@@ -0,0 +1,347 @@
+// A. L. Delcher
+//
+// File: sim-shotgun.cc
+//
+// Last Modified: 4 August 2003
+//
+// Simulate shotgun assembly
+
+
+#include "delcher.hh"
+#include <vector>
+#include <algorithm>
+using namespace std;
+
+const int DEFAULT_MIN_CTG_CT = 2;
+const int DEFAULT_MIN_OLAP_LEN = 40;
+const int ITER_COUNT = 10;
+ // Number of times to run simulation
+
+
+struct Read_t
+ {
+ int lo, hi;
+
+ bool operator <
+ (const Read_t & r) const
+ {
+ if (lo < r . lo)
+ return true;
+ if (lo == r . lo && hi > r . hi)
+ return true;
+
+ return false;
+ }
+ };
+
+
+static double Coverage;
+ // Read_Len * Num_Reads / Genome_Len;
+static double Genome_Len;
+ // Length of the genome in bases
+static int Min_Contig_Count = DEFAULT_MIN_CTG_CT;
+ // Minimum number of reads to make a contig and be counted
+static int Min_Olap_Len = DEFAULT_MIN_OLAP_LEN;
+ // Smallest detected overlap between two reads
+static double Read_Len;
+ // Number of bases in each read
+static double Read_Std_Dev = 0.0;
+ // Standard deviation in length of reads
+
+
+static void Parse_Command_Line
+ (int argc, char * argv []);
+static void Usage
+ (const char * command);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ vector <Read_t> read_list;
+ Read_t read;
+ time_t now;
+ double m1, m2, m3;
+ double sd1, sd2, sd3;
+ double s1 = 0.0, s2 = 0.0, s3 = 0.0;
+ double ss1 = 0.0, ss2 = 0.0, ss3 = 0.0;
+ int num_reads;
+ int i, iter;
+
+ Parse_Command_Line (argc, argv);
+
+ now = time (NULL);
+ fprintf (stderr, "Starting at %s\n", ctime (& now));
+
+ Verbose = 0;
+
+ srand48 (time (NULL));
+
+ num_reads = int ((Coverage * Genome_Len) / Read_Len);
+
+ printf ("Num Reads = %d Read Len = %.0f,s.d.=%.1f"
+ " Genome Len = %.0f\n",
+ num_reads, Read_Len, Read_Std_Dev, Genome_Len);
+ printf ("Coverage = %.1fx Min Reads in Contig = %d Min Olap Len = %d\n",
+ Coverage, Min_Contig_Count, Min_Olap_Len);
+
+ for (iter = 0; iter < ITER_COUNT; iter ++)
+ {
+ int start, extent, len, num_contigs, contig_ct;
+ int cover_start;
+ double cover_sum = 0.0;
+ double avg, sum = 0.0;
+
+
+ read_list . clear ();
+
+double rm, rs = 0.0, rss = 0.0;
+ for (i = 0; i < num_reads; i ++)
+ {
+ int read_len;
+
+ read_len = int (0.5 + Read_Len + Pseudo_Normal () * Read_Std_Dev);
+// read_len = int (Read_Len);
+rs += read_len;
+rss += read_len * read_len;
+
+ read . lo = int (drand48 () * (Genome_Len - read_len));
+ read . hi = read . lo + read_len;
+ read_list . push_back (read);
+ }
+rm = rs / num_reads;
+printf ("read avg = %.1f std = %.1f\n", rm,
+ sqrt (rss / num_reads - (rm * rm)));
+
+ sort (read_list . begin (), read_list . end ());
+
+ if (Verbose > 0)
+ {
+ for (i = 0; i < num_reads; i ++)
+ printf ("Read %3d %7u .. %7u\n", i,
+ read_list [i] . lo, read_list [i] . hi);
+ }
+
+ extent = 0;
+ num_contigs = 0;
+ contig_ct = 0;
+ start = 0;
+ for (i = 0; i < num_reads; i ++)
+ {
+if (Verbose > 0)
+printf ("i = %d lo = %d hi = %d contig_ct = %d start = %d extent = %d olap = %d\n",
+ i, read_list [i] . lo, read_list [i] . hi, contig_ct, start, extent,
+ extent - read_list [i] . lo);
+
+ if (read_list [i] . lo <= extent - Min_Olap_Len)
+ { // same contig
+ contig_ct ++;
+ if (read_list [i] . hi > extent)
+ extent = read_list [i] . hi;
+ }
+ else
+ { // new contig
+ if (contig_ct >= Min_Contig_Count)
+ {
+ num_contigs ++;
+ len = extent - start;
+ sum += len;
+ cover_sum += extent - cover_start;
+if (Verbose > 0)
+printf (" ctgnum = %d len = %d cover_sum = %.0f\n", num_contigs, len, cover_sum);
+ }
+ start = read_list [i] . lo;
+ cover_start = Max (start, extent);
+ contig_ct = 1;
+ extent = read_list [i] . hi;
+ }
+if (Verbose > 0)
+printf (" start = %d extent = %d\n", start, extent);
+ }
+
+ // do the last contig
+ if (contig_ct >= Min_Contig_Count)
+ {
+ num_contigs ++;
+ len = extent - start;
+ sum += len;
+ cover_sum += extent - cover_start;
+if (Verbose > 0)
+printf (" ctgnum = %d len = %d cover_sum = %.0f\n", num_contigs, len, cover_sum);
+ }
+
+ if (num_contigs > 0)
+ avg = sum / num_contigs;
+ else
+ avg = 0.0;
+ printf ("%4d %8d %10.0f %10.0f\n", iter, num_contigs, avg, cover_sum);
+
+ s1 += num_contigs;
+ ss1 += num_contigs * num_contigs;
+ s2 += avg;
+ ss2 += avg * avg;
+ s3 += cover_sum;
+ ss3 += cover_sum * cover_sum;
+ }
+
+ m1 = s1 / ITER_COUNT;
+ m2 = s2 / ITER_COUNT;
+ m3 = s3 / ITER_COUNT;
+ sd1 = sqrt (ss1 / ITER_COUNT - (m1 * m1));
+ sd2 = sqrt (ss2 / ITER_COUNT - (m2 * m2));
+ sd3 = sqrt (ss3 / ITER_COUNT - (m3 * m3));
+ printf ("mean %8.0f %10.0f %10.0f\n", m1, m2, m3);
+ printf ("std %8.0f %10.0f %10.0f\n", sd1, sd2, sd3);
+
+ { // Lander-Waterman values
+ double theta = Min_Olap_Len / Read_Len;
+ double x = Coverage * (1.0 - theta);
+ double lambda = (exp (x) - 1.0) / Coverage + theta;
+ double sum;
+ int j;
+
+ printf ("Lander-Waterman:\n");
+ sum = exp (-1.0 * x);
+ for (j = 1; j < Min_Contig_Count; j ++)
+ sum -= exp (-2.0 * x) * pow (1.0 - exp (-1.0 * x), j - 1);
+ printf ("Number of contigs with >=%d reads = %.1f\n",
+ Min_Contig_Count, num_reads * sum);
+
+ if (Min_Contig_Count > 2)
+ printf ("Number of contigs with >=2 reads = %.1f\n",
+ num_reads * (exp (-1.0 * x) - exp (-2.0 * x)));
+ if (Min_Contig_Count > 1)
+ printf ("Number of contigs with >=1 reads = %.1f\n",
+ num_reads * exp (-1.0 * x));
+ printf ("Contig length = %.1f\n",
+ Read_Len * lambda);
+ }
+
+ return 0;
+ }
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = FALSE;
+ int ch;
+ char * p;
+
+ optarg = NULL;
+
+ while (! errflg
+ && ((ch = getopt (argc, argv, "c:ho:s:")) != EOF))
+ switch (ch)
+ {
+ case 'c' :
+ Min_Contig_Count = (int) strtol (optarg, & p, 10);
+ if (p == optarg)
+ {
+ fprintf (stderr, "ERROR: Bad min contig count \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ break;
+
+ case 'h' :
+ errflg = TRUE;
+ break;
+
+ case 'o' :
+ Min_Olap_Len = (int) strtol (optarg, & p, 10);
+ if (p == optarg)
+ {
+ fprintf (stderr, "ERROR: Bad min olap length \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ break;
+
+ case 's' :
+ Read_Std_Dev = strtod (optarg, & p);
+ if (p == optarg)
+ {
+ fprintf (stderr, "ERROR: Bad std dev \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ break;
+
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+ // fall through
+
+ default :
+ errflg = TRUE;
+ }
+
+ if (errflg || optind != argc - 3)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ Coverage = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad coverage value \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ optind ++;
+
+ Read_Len = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad read len \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ optind ++;
+
+ Genome_Len = strtod (argv [optind], & p);
+ if (p == argv [optind])
+ {
+ fprintf (stderr, "ERROR: Bad genome len \"%s\"\n",
+ optarg);
+ errflg = TRUE;
+ }
+ optind ++;
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "USAGE: %s <coverage> <read-len> <genome-len>\n"
+ "\n"
+ "List number of contigs in true random-shotgunning\n"
+ "assuming perfect assembly\n"
+ "\n"
+ "Options:\n"
+ " -c <n> Set minimum reads in a contig to <n> (default = %d)\n"
+ " -h Print this message\n"
+ " -o <n> Set minimum overlap length to <n> (default = %d)\n"
+ " -s <n> Set read-length std deviation to <n> (default = 0)\n"
+ "\n",
+ command, DEFAULT_MIN_CTG_CT, DEFAULT_MIN_OLAP_LEN);
+
+ return;
+ }
diff --git a/src/Align/simple-overlap.cc b/src/Align/simple-overlap.cc
new file mode 100644
index 0000000..380b617
--- /dev/null
+++ b/src/Align/simple-overlap.cc
@@ -0,0 +1,437 @@
+// A. L. Delcher
+//
+// File: simple-overlap.cc
+//
+// Last Modified: Thu May 27 08:24:56 EDT 2004
+//
+// Compute overlaps among an input set of sequences by
+// direct all-pairs alignment.
+
+
+#include "simple-overlap.hh"
+
+
+static string Bank_Name;
+ // Name of read bank from which reads are obtained
+static double Error_Rate = DEFAULT_ERROR_RATE;
+ // Fraction of errors allowed in overlap alignment
+static bool Fasta_Input = false;
+ // If true, then input comes from the multifasta file named
+ // on the command line
+static int Lo_ID = 0, Hi_ID = INT_MAX;
+ // Range of indices for which to compute overlaps
+static int Min_Overlap_Len = DEFAULT_MIN_OVERLAP_LEN;
+ // Minimum number of bases by which two sequences must overlap
+static bool Show_Alignment = false;
+ // If true, then also output the overlap alignments
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ BankStream_t read_bank (Read_t::NCODE);
+ Simple_Overlap_t olap;
+ vector <char *> string_list, qual_list;
+ vector <char *> tag_list;
+ vector <ID_t> id_list;
+ vector <Range_t> clr_list;
+ Alignment_t ali;
+ time_t now;
+ iostream :: fmtflags status;
+ int i, j, n;
+
+
+ try
+ {
+ now = time (NULL);
+ cerr << "Starting on " << ctime (& now) << endl;
+
+ Verbose = 0;
+
+ Parse_Command_Line (argc, argv);
+
+ if (Fasta_Input)
+ cerr << "Fasta input file is " << Bank_Name << endl;
+ else
+ cerr << "Read bank is " << Bank_Name << endl;
+
+ status = cerr . setf (ios :: fixed);
+ cerr << "Alignment error rate is " << setprecision (2)
+ << Error_Rate << endl;
+ cerr . setf (status);
+ cerr << "Minimum overlap bases is " << Min_Overlap_Len << endl;
+
+ if (Fasta_Input)
+ Read_Fasta_Strings (string_list, id_list, tag_list, Bank_Name);
+ else
+ {
+ read_bank . open (Bank_Name, B_READ);
+ Get_Strings_From_Bank (string_list, qual_list, clr_list,
+ id_list, tag_list, read_bank);
+ }
+
+ n = string_list . size ();
+ for (i = 0; i < n - 1; i ++)
+ {
+ double erate;
+ int lo, hi;
+
+ for (j = i + 1; j < n; j ++)
+ {
+ Simple_Overlap (string_list [i], strlen (string_list [i]),
+ string_list [j], strlen (string_list [j]), olap);
+ if (olap . a_olap_len < Min_Overlap_Len
+ || olap . b_olap_len < Min_Overlap_Len)
+ continue;
+ erate = (2.0 * olap . errors)
+ / (olap . a_olap_len + olap . b_olap_len);
+ if (erate <= Error_Rate)
+ {
+ olap . a_id = id_list [i];
+ olap . b_id = id_list [j];
+ olap . flipped = false;
+ Output (stdout, olap);
+ if (Show_Alignment)
+ {
+ if (olap . a_hang <= 0)
+ {
+ lo = Max (- olap . a_hang - 5, 0);
+ hi = - olap . a_hang + 5;
+ Overlap_Align (string_list [i], strlen (string_list [i]),
+ string_list [j], lo, hi, strlen (string_list [j]),
+ 1, -3, -2, -2, ali);
+ printf (
+ "\nOverlap a: %d .. %d of %d (%s) b: %d .. %d of %d (%s)\n",
+ ali . a_lo, ali . a_hi, id_list [i], tag_list [i],
+ ali . b_lo, ali . b_hi, id_list [j], tag_list [j]);
+ ali . Print (stdout, string_list [i], string_list [j]);
+ }
+ else
+ {
+ lo = Max (olap . a_hang - 5, 0);
+ hi = olap . a_hang + 5;
+ Overlap_Align (string_list [j], strlen (string_list [j]),
+ string_list [i], lo, hi, strlen (string_list [i]),
+ 1, -3, -2, -2, ali);
+ printf (
+ "\nOverlap a: %d .. %d of %d (%s) b: %d .. %d of %d (%s)\n",
+ ali . a_lo, ali . a_hi, id_list [j], tag_list [j],
+ ali . b_lo, ali . b_hi, id_list [i], tag_list [i]);
+ ali . Print (stdout, string_list [j], string_list [i]);
+ }
+ }
+ }
+ }
+
+ Reverse_Complement (string_list [i]);
+
+ for (j = i + 1; j < n; j ++)
+ {
+ Simple_Overlap (string_list [i], strlen (string_list [i]),
+ string_list [j], strlen (string_list [j]), olap);
+ if (olap . a_olap_len < Min_Overlap_Len
+ || olap . b_olap_len < Min_Overlap_Len)
+ continue;
+ erate = (2.0 * olap . errors)
+ / (olap . a_olap_len + olap . b_olap_len);
+ if (erate <= Error_Rate)
+ {
+ int save;
+
+ if (Show_Alignment)
+ {
+ if (olap . a_hang <= 0)
+ {
+ lo = Max (- olap . a_hang - 5, 0);
+ hi = - olap . a_hang + 5;
+ Overlap_Align (string_list [i], strlen (string_list [i]),
+ string_list [j], lo, hi, strlen (string_list [j]),
+ 1, -3, -2, -2, ali);
+ printf (
+ "\nOverlap a: %d .. %d of complement %d (%s) b: %d .. %d of %d (%s)\n",
+ ali . a_lo, ali . a_hi, id_list [i], tag_list [i],
+ ali . b_lo, ali . b_hi, id_list [j], tag_list [j]);
+ ali . Print (stdout, string_list [i], string_list [j]);
+ }
+ else
+ {
+ lo = Max (olap . a_hang - 5, 0);
+ hi = olap . a_hang + 5;
+ Overlap_Align (string_list [j], strlen (string_list [j]),
+ string_list [i], lo, hi, strlen (string_list [i]),
+ 1, -3, -2, -2, ali);
+ printf (
+ "\nOverlap a: %d .. %d of %d (%s) b: %d .. %d of complement %d (%s)\n",
+ ali . a_lo, ali . a_hi, id_list [j], tag_list [j],
+ ali . b_lo, ali . b_hi, id_list [i], tag_list [i]);
+ ali . Print (stdout, string_list [j], string_list [i]);
+ }
+ }
+
+ // Re-orient with a forward and b reversed
+ save = olap . a_hang;
+ olap . a_hang = - olap . b_hang;
+ olap . b_hang = - save;
+
+ olap . a_id = id_list [i];
+ olap . b_id = id_list [j];
+ olap . flipped = true;
+ Output (stdout, olap);
+ }
+ }
+ }
+
+ read_bank . close ();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "** AMOS Exception **" << endl;
+ cerr << e << endl;
+ exit (EXIT_FAILURE);
+ }
+ catch (std :: exception & e)
+ {
+ cerr << "** Standard Exception **" << endl;
+ cerr << e << endl;
+ exit (EXIT_FAILURE);
+ }
+
+ return 0;
+ }
+
+
+
+static void Get_Strings_From_Bank
+ (vector <char *> & s, vector <char *> & q,
+ vector <Range_t> & clr_list, vector <ID_t> & id_list,
+ vector <char * > & tag_list, BankStream_t & read_bank)
+
+// Populate s and q with sequences and quality values, resp.,
+// from read_bank . Put the clear-ranges for the sequences in clr_list .
+// read_bank must already be opened. Put the identifying tags for the
+// sequences in tag_list .
+
+ {
+ Read_t read;
+ Ordered_Range_t position;
+ int i, n;
+
+ n = s . size ();
+ for (i = 0; i < n; i ++)
+ free (s [i]);
+ s . clear ();
+
+ n = q . size ();
+ for (i = 0; i < n; i ++)
+ free (q [i]);
+ q . clear ();
+
+ n = tag_list . size ();
+ for (i = 0; i < n; i ++)
+ free (tag_list [i]);
+ tag_list . clear ();
+ id_list . clear();
+ clr_list . clear ();
+
+ char * tmp, tag_buff [100];
+ string seq;
+ string qual;
+ Range_t clear;
+ int this_offset;
+ int a, b, j, len, qlen;
+
+ while ( read_bank >> read )
+ {
+ id_list . push_back (read . getIID());
+ tag_list . push_back (strdup (read . getEID() . c_str()));
+
+ clear = read . getClearRange ();
+ if (Verbose > 2)
+ cerr << read;
+ seq = read . getSeqString (clear);
+ qual = read . getQualString (clear);
+ clr_list . push_back (clear);
+
+ len = seq . length ();
+ tmp = strdup (seq . c_str ());
+ for (j = 0; j < len; j ++)
+ tmp [j] = tolower (tmp [j]);
+ s . push_back (tmp);
+
+ qlen = qual . length ();
+ if (len != qlen)
+ {
+ sprintf
+ (Clean_Exit_Msg_Line,
+ "ERROR: Sequence length (%d) != quality length (%d) for read %d\n",
+ len, qlen, read . getIID( ));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ tmp = strdup (qual . c_str ());
+ q . push_back (tmp);
+ }
+
+ return;
+ }
+
+
+
+static void Output
+ (FILE * fp, const Simple_Overlap_t & olap)
+
+// Print the contents of olap to fp .
+
+ {
+ fprintf (fp, "%5d %5d %c %5d %5d %5d %5d %5d %3d %4.2f\n",
+ olap . a_id, olap . b_id, olap . flipped ? 'I' : 'N',
+ olap . a_hang, olap . b_hang,
+ olap . a_olap_len, olap . b_olap_len, olap . score,
+ olap . errors,
+ 200.0 * olap . errors
+ / (olap . a_olap_len + olap . b_olap_len));
+
+ return;
+ }
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = false;
+ int ch;
+
+ optarg = NULL;
+
+ while (!errflg && ((ch = getopt (argc, argv, "aE:Fho:v:")) != EOF))
+ switch (ch)
+ {
+ case 'a' :
+ Show_Alignment = true;
+ break;
+
+ case 'E' :
+ Error_Rate = strtod (optarg, NULL);
+ break;
+
+ case 'F' :
+ Fasta_Input = true;
+ break;
+
+ case 'h' :
+ errflg = true;
+ break;
+
+ case 'o' :
+ Min_Overlap_Len = strtol (optarg, NULL, 10);
+ break;
+
+ case 'v' :
+ Verbose = strtol (optarg, NULL, 10);
+ break;
+
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+
+ default :
+ errflg = true;
+ }
+
+ if (errflg)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (optind > argc - 1)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ Bank_Name = argv [optind ++];
+
+ return;
+ }
+
+
+
+static void Read_Fasta_Strings
+ (vector <char *> & s, vector <ID_t> & id_list,
+ vector <char *> & tag_list, const std :: string & fn)
+
+// Open file named fn and read FASTA-format sequences from it
+// into s and their tags into tag_list .
+
+ {
+ FILE * fp;
+ std :: string seq, hdr;
+
+ fp = File_Open (fn . c_str (), "r", __FILE__, __LINE__);
+ s . clear ();
+ id_list . clear();
+ tag_list . clear ();
+
+ char tag [MAX_LINE];
+ char * tmp;
+ int j, len;
+ int cnt = 0;
+
+ while (Fasta_Read (fp, seq, hdr))
+ {
+ if ( cnt >= Lo_ID && cnt < Hi_ID )
+ {
+ tmp = strdup (seq . c_str ());
+ len = seq . length ();
+ for (j = 0; j < len; j ++)
+ tmp [j] = tolower (tmp [j]);
+ s . push_back (tmp);
+
+ sscanf (hdr . c_str (), "%s", tag);
+ tag_list . push_back (strdup (tag));
+ id_list . push_back (cnt);
+ }
+ ++ cnt;
+ }
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "USAGE: %s <bank-name>\n"
+ "\n"
+ "Compute pairwise overlaps among a set of sequences by\n"
+ "brute-force all-pairs alignment. Sequences are obtained\n"
+ "from <bank-name>\n"
+ "\n"
+ "Options:\n"
+ " -a Also show alignments of overlaps \n"
+ " -E <x> Maximum error rate for overlaps is <x>\n"
+ " e.g., -E 0.06 for 6% error rate\n"
+ " -F Input is a fasta file\n"
+ " -h Print this usage message\n"
+ " -o <n> Set minimum overlap length to <n>\n"
+ " -v <n> Set verbose level to <n>. Higher produces more output.\n"
+ "\n",
+ command);
+
+ return;
+ }
+
+
+
diff --git a/src/Align/simple-overlap.hh b/src/Align/simple-overlap.hh
new file mode 100644
index 0000000..4688b58
--- /dev/null
+++ b/src/Align/simple-overlap.hh
@@ -0,0 +1,52 @@
+// A. L. Delcher
+//
+// File: simple-overlap.hh
+//
+// Last Modified: Thu May 13 17:39:09 EDT 2004
+//
+// Declarations for simple-overlap.cc
+
+
+#ifndef __SIMPLE_OVERLAP_HH_INCLUDED
+#define __SIMPLE_OVERLAP_HH_INCLUDED
+
+
+#include "foundation_AMOS.hh"
+#include "delcher.hh"
+#include "align.hh"
+#include "fasta.hh"
+#include <iostream>
+#include <vector>
+#include <string>
+#include <algorithm>
+
+
+using namespace std;
+using namespace AMOS;
+
+
+const double DEFAULT_ERROR_RATE = 0.06;
+ // Default fraction of errors allowed in overlap alignment
+const int DEFAULT_MIN_OVERLAP_LEN = 40;
+ // Default minimum number of bases by which two sequences must overlap
+const int MAX_LINE = 1000;
+const int NEW_SIZE = 1000;
+
+
+static void Get_Strings_From_Bank
+ (vector <char *> & s, vector <char *> & q,
+ vector <Range_t> & clr_list, vector <ID_t> & id_list,
+ vector <char * > & tag_list, BankStream_t & read_bank);
+static void Output
+ (FILE * fp, const Simple_Overlap_t & olap);
+static void Parse_Command_Line
+ (int argc, char * argv []);
+static void Read_Fasta_Strings
+ (vector <char *> & s, vector <ID_t> & id_list,
+ vector <char *> & tag_list, const string & fn);
+static void Usage
+ (const char * command);
+
+#endif
+
+
diff --git a/src/Align/test-align.cc b/src/Align/test-align.cc
new file mode 100644
index 0000000..0dfcaee
--- /dev/null
+++ b/src/Align/test-align.cc
@@ -0,0 +1,176 @@
+// A. L. Delcher
+//
+// File: test-align.cc
+//
+// Last Modified: 25 November 2002
+//
+// Test program to generate a random sequence and then pick
+// a subsequence of it with errors. Then find the alignment
+// between the two and print it.
+
+
+#include "delcher.hh"
+#include "fasta.hh"
+#include "align.hh"
+#include "utility_AMOS.hh"
+#include <vector>
+
+
+const int NEW_SIZE = 1000;
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ Alignment_t ali;
+ Align_Score_Entry_t last_entry;
+ char alphabet [] = "acgt";
+ double error;
+ char * a, * b;
+ int a_len, b_len, a_max;
+ int start, stop;
+ int lo, hi;
+ int err_ct;
+ bool ans;
+ time_t now;
+ int i, j, k;
+
+ now = time (NULL);
+ cerr << "Starting at " << ctime (& now) << endl;
+
+ Verbose = 5;
+
+ a = "aag";
+ b = "aagaaa";
+ printf ("a=%s\n", a);
+ printf ("b=%s\n", b);
+ a_len = strlen (a);
+ b_len = strlen (b);
+
+ while (true)
+ {
+ Alignment_t ali;
+ int t_lo, t_hi;
+
+ cerr << "Enter t_lo and t_hi" << endl;
+ cin >> t_lo >> t_hi;
+
+ Overlap_Align_Full_Matrix
+ (a, a_len, b, t_lo, t_hi, b_len, 1, -3, -2, -2, ali);
+
+ ali . Dump (stdout);
+ ali . Print (stdout, a, b);
+ }
+ exit (-3);
+
+
+ printf ("\nFull_Matrix:\n");
+ Complete_Align_Full_Matrix (a, 0, strlen (a), b, 0, 1, strlen (b),
+ 2, -3, -2, -3, NULL, last_entry, ali);
+ ali . Dump (stdout);
+ ali . Print (stdout, a, b);
+
+ printf ("\nSave_Space:\n");
+ Complete_Align_Save_Space (a, 0, strlen (a), b, 0, 1, strlen (b),
+ 2, -3, -2, -3, NULL, last_entry, ali);
+ ali . Dump (stdout);
+ ali . Print (stdout, a, b);
+ exit (-3);
+
+{
+ vector < vector <int> > v_list;
+ int i, j, k;
+
+ for (i = 0; i < 10000; i ++)
+ {
+ vector <int> v;
+
+ cerr << "i = " << i << endl;
+ v_list . clear ();
+ for (j = 0; j < 1000; j ++)
+ {
+ v . clear ();
+
+ for (k = 0; k < 1000; k ++)
+ v . push_back (rand ());
+ }
+
+ v_list . push_back (v);
+ }
+}
+
+
+
+ a_len = atoi (argv [1]);
+ b_len = atoi (argv [2]);
+ error = strtod (argv [3], NULL);
+
+ a_max = int (10 + a_len * (1.0 + 2.0 * error));
+ a = (char *) AMOS::SafeMalloc (1 + a_max);
+ b = (char *) AMOS::SafeMalloc (1 + b_len);
+
+ for (i = 0; i < b_len; i ++)
+ b [i] = alphabet [lrand48 () % 4];
+ b [i] = '\0';
+
+ start = j = lrand48 () % (b_len - a_len);
+ i = 0;
+ err_ct = 0;
+ for (k = 0; k < a_len && j < b_len; k ++)
+ {
+ if (drand48 () >= error)
+ a [i ++] = b [j ++];
+ else
+ {
+ double p;
+
+ err_ct ++;
+
+ p = drand48 ();
+ if (p < 0.333)
+ {
+ int q;
+
+ q = lrand48 () % 4;
+ if (alphabet [q] == b [j])
+ a [i] = alphabet [(q + 1 + lrand48 () % 3) % 4];
+ else
+ a [i] = alphabet [q];
+ i ++;
+ j ++;
+ }
+ else if (p < 0.667)
+ j ++;
+ else
+ a [i ++] = alphabet [lrand48 () % 4];
+ }
+ }
+ a [i] = '\0';
+ a_len = i;
+ stop = j;
+
+ lo = Max (0, start - 5);
+ hi = Min (b_len - 1, start + 5);
+
+ a_len = strlen (a);
+ b_len = strlen (b);
+
+// ans = Substring_Match_VS
+// (a, a_len, b, b_len, lo, hi, err_ct + 1, ali);
+
+ Global_Align
+ (a, a_len, b, 0, b_len, 10, -2, -2, -20, ali);
+
+ if (! ans)
+ printf ("Not found\n");
+ else
+ {
+ printf ("start = %d stop = %d errors = %d\n",
+ start, stop, err_ct);
+ printf ("Found at %d\n", ali . b_lo);
+ ali . Print (stdout, a, b);
+ }
+
+ return 0;
+ }
diff --git a/src/Align/verify-layout.cc b/src/Align/verify-layout.cc
new file mode 100644
index 0000000..33d173c
--- /dev/null
+++ b/src/Align/verify-layout.cc
@@ -0,0 +1,130 @@
+#include "foundation_AMOS.hh"
+#include "AMOS_Foundation.hh"
+
+#include <string>
+#include <vector>
+using namespace std;
+using namespace HASHMAP;
+using namespace AMOS;
+
+int main (int argc, char * argv [])
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ try
+ {
+ string version = "Version 1.0";
+ string helptext =
+"Verify a layout is correct\n"
+"Usage: verify-layout [options] <bankname>\n"
+"\n"
+"Options\n"
+" --verbose Show the coordinates and bases for each read in layout\n"
+" readid rc offset roffset len bases\n"
+"\n";
+
+ int verbose = 0;
+
+ tf = new AMOS_Foundation(version, helptext, "", argc, argv);
+ tf->disableOptionHelp();
+ tf->getOptions()->addOptionResult("verbose", &verbose);
+
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() != 1)
+ {
+ cerr << "Usage: verify-layout [options] bankname" << endl;
+ return EXIT_FAILURE;
+ }
+
+ string bankname = argvv.front(); argvv.pop_front();
+
+ BankStream_t layout_bank(Layout_t::NCODE);
+ Bank_t read_bank(Read_t::NCODE);
+
+ layout_bank.open(bankname, B_READ|B_SPY);
+ read_bank.open(bankname, B_READ|B_SPY);
+
+ Layout_t lay;
+
+ while (layout_bank >> lay)
+ {
+ cout << "Verifying layout i:" << lay.getIID()
+ << " e:" << lay.getEID()
+ << " reads:" << lay.getTiling().size()
+ << endl;
+
+ vector<Tile_t> & tiling = lay.getTiling();
+
+ sort(tiling.begin(), tiling.end(), TileOrderCmp());
+ int rightmost = 0;
+
+ for (int i = 0; i < tiling.size(); i++)
+ {
+ Read_t red;
+ read_bank.fetch(tiling[i].source, red);
+
+ Range_t clr(red.getClearRange());
+
+ int len = clr.getLength();
+ int right = tiling[i].offset + len - 1;
+ int rc = tiling[i].range.isReverse() ? 1 : 0;
+
+ if (verbose)
+ {
+ if (rc) { clr.swap(); }
+
+ string bases = red.getSeqString(clr);
+ string sp;
+ sp.append(tiling[i].offset, ' ');
+
+ cout << tiling[i].source << "\t"
+ << rc << "\t"
+ << tiling[i].offset << "\t"
+ << right << "\t"
+ << len << "\t"
+ << sp << bases << endl;
+ }
+
+ if (tiling[i].offset > rightmost)
+ {
+ // Coverage hole
+ cout << "*** Coverage hole: offset(" << tiling[i].offset
+ << ") > rightmost(" << rightmost << ")" << endl;
+ }
+
+ if (right > rightmost) { rightmost = right; }
+ }
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ return retval;
+}
+
diff --git a/src/Bambus/Bundler/Bundler.cc b/src/Bambus/Bundler/Bundler.cc
new file mode 100644
index 0000000..bb276c8
--- /dev/null
+++ b/src/Bambus/Bundler/Bundler.cc
@@ -0,0 +1,377 @@
+// $Id$
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string>
+#include <map>
+#include <math.h>
+#include <stdio.h>
+#include <list>
+#include <iostream>
+#include <getopt.h>
+
+#include "ContigLink_AMOS.hh"
+#include "ContigEdge_AMOS.hh"
+#include "datatypes_AMOS.hh"
+#include "Bank_AMOS.hh"
+#include "BankStream_AMOS.hh"
+
+using namespace AMOS;
+using namespace std;
+
+typedef multimap<pair<ID_t, ID_t> , ContigLink_t > LinkMap_t;
+
+map<string, string> globals; // global variables
+ID_t EdgeId = 0; // where numbering starts for edges
+
+void printHelpText()
+{
+ cerr <<
+ "\n"
+ "Bundle links into edges among connected contigs\n"
+ "\n"
+ "USAGE:\n"
+ "\n"
+ "Bundler -b[ank] <bank_name> -t[ype] <comma separated list of link types to process>\n"
+ << endl;
+}
+
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"t", 1, 0, 't'},
+ {"type", 1, 0, 't'},
+ {0, 0, 0, 0}
+ };
+
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -
+ 1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ break;
+ case 'b':
+ globals["bank"] = string(optarg);
+ break;
+ case 't':
+ globals["type"] = string(optarg);
+ break;
+ case '?':
+ return false;
+ }
+ }
+
+ return true;
+} // GetOptions
+
+
+int main(int argc, char *argv[])
+{
+ LinkMap_t linkMap;
+
+ if (!GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ if (globals.find("bank") == globals.end()){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ if (globals.find("type") == globals.end()) {
+ globals["type"] = "ALL";
+ }
+
+
+ BankStream_t link_bank (ContigLink_t::NCODE);
+ try {
+ if (! link_bank.exists(globals["bank"])) {
+ cerr << "Cannot find a contig link account in bank: " << globals["bank"] << endl;
+ exit(1);
+ }
+ link_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open link account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ BankStream_t edge_bank (ContigEdge_t::NCODE);
+ try {
+ if (! edge_bank.exists(globals["bank"]))
+ edge_bank.create(globals["bank"]);
+ else
+ edge_bank.open(globals["bank"]);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open edge account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ Size_t ti;
+ Size_t minlen, maxlen; // contig adjacency gap range;
+
+
+ ContigLink_t ctl;
+
+ while (link_bank >> ctl){
+ ID_t ctgA, ctgB;
+
+ ctgA = ctl.getContigs().first;
+ ctgB = ctl.getContigs().second;
+
+ if (linkMap.find(pair<ID_t, ID_t>(ctgB, ctgA)) != linkMap.end()){
+ // must reverse the link
+ ctl.flip();
+ }
+
+ // make sure we accept this type
+ if (globals["type"].find(ctl.getType()) != string::npos || globals["type"].find("ALL") != string::npos) {
+ linkMap.insert(pair<pair<ID_t, ID_t>, ContigLink_t>
+ (ctl.getContigs(), ctl));
+ }
+ }
+
+ // now all the links should be in the linkMap, nicely grouped by the contigs
+ // they connect.
+
+ map <LinkAdjacency_t, int> adjacencies;
+ LinkMap_t::iterator li = linkMap.begin();
+ while (li != linkMap.end()){
+ pair<ID_t, ID_t> lastPair = (*li).first;
+ cerr << "Doing contig pair (" << lastPair.first << ", "
+ << lastPair.second << ")" << endl;
+ map <LinkAdjacency_t, list<LinkMap_t::iterator> > adjList;
+ map <LinkAdjacency_t, list<LinkMap_t::iterator> > bestList;
+ adjacencies.clear(); // make sure we don't carry unnecessary info from before
+ while (li->first == lastPair){
+ LinkAdjacency_t a = li->second.getAdjacency();
+
+ // handle one pair of contigs
+ adjacencies[a]++;
+ adjList[a].push_back(li);
+
+ assert(adjacencies[a] == adjList[a].size());
+ li++;
+ }
+
+ cerr << "NORMALS: " << adjacencies[(LinkAdjacency_t)ContigLink_t::NORMAL]
+ << " ANTINORMALS: " << adjacencies[(LinkAdjacency_t)ContigLink_t::ANTINORMAL]
+ << " INNIES: " << adjacencies[(LinkAdjacency_t)ContigLink_t::INNIE]
+ << " OUTIES: " << adjacencies[(LinkAdjacency_t)ContigLink_t::OUTIE]
+ << "\n";
+
+ // now, for each innie, outie and such we find a consistent subset of links
+ // using as min and max mean -/+ 3*stdev
+
+ // we'll use Dan Sommer's algorithm for keeping track of the maximum clique
+ // Specifically, for each maximal clique we track the number of links in
+ // the clique, the coordinate (beginning or end) of the clique, and we
+ // track the links belonging to the maximum clique as they get removed from
+ // it.
+ LinkAdjacency_t bestAdj;
+ int bestAdjCount = 0;
+ for (map<LinkAdjacency_t, int>::iterator at = adjacencies.begin();
+ at != adjacencies.end(); at++){
+ if (at->second > 1){ // there are links we have to deal with
+ multimap<Size_t, LinkMap_t::iterator> begins, ends;
+ list<LinkMap_t::iterator> best;
+ list<LinkMap_t::iterator>::iterator bestEnd = best.end();
+ Size_t bestCoord;
+ int ncurrent = 0, nbest = 0;
+
+ cerr << "Doing " << at->second
+ << " links of type " << at->first << endl;
+
+ cerr << " Found " << adjList[at->first].size() << " links " << endl;
+
+ assert (at->second == adjList[at->first].size());
+
+ for (list<LinkMap_t::iterator>::iterator
+ lnks = adjList[at->first].begin();
+ lnks != adjList[at->first].end(); lnks++){
+ begins.insert(pair<Size_t, LinkMap_t::iterator>
+ (((**lnks).second.getSize() - 3 * (**lnks).second.getSD()), *lnks));
+ ends.insert(pair<Size_t, LinkMap_t::iterator>
+ (((**lnks).second.getSize() + 3 * (**lnks).second.getSD()), *lnks));
+ } // for each link
+
+ // because of the way maps work, the elements come sorted by the key
+ multimap<Size_t, LinkMap_t::iterator>::iterator bgi = begins.begin();
+ multimap<Size_t, LinkMap_t::iterator>::iterator eni = ends.begin();
+
+ cerr << " Begins has " << begins.size() << " elements" << endl;
+ cerr << " Ends has " << ends.size() << " elements" << endl;
+
+ while (bgi != begins.end() || eni != ends.end()){
+ if (bgi != begins.end() && bgi->first <= eni->first){
+ Size_t bgiLend = bgi->second->second.getSize()
+ - 3 * bgi->second->second.getSD(),
+ bgiRend = bgi->second->second.getSize()
+ + 3 * bgi->second->second.getSD();
+ // we add to the clique
+ ncurrent++;
+ if (ncurrent > nbest){
+ nbest = ncurrent;
+ bestEnd = best.begin(); // reset best list
+ bestCoord = bgiLend; // where the maximum occured
+ cerr << "best coord is " << bestCoord << endl;
+ }
+ bgi++;
+ } else if (eni != ends.end() &&
+ (bgi == begins.end() ||
+ bgi->first > eni->first)){
+ Size_t eniLend = eni->second->second.getSize()
+ - 3 * eni->second->second.getSD(),
+ eniRend = eni->second->second.getSize()
+ + 3 * eni->second->second.getSD();
+
+ if (eniLend <= bestCoord && eniRend >= bestCoord){
+ // current link was in best clique
+ best.push_front(eni->second);
+ } else {
+ cerr << "link " << eniLend << ", " << eniRend << " did not surround " << bestCoord << endl;
+ }
+
+ // we remove from the clique
+ ncurrent--;
+ eni++;
+ // map<Size_t, LinkMap_t::iterator>::iterator rm = ends.begin();
+ // ends.erase(rm);
+ }
+ } // while bgi != begins.end()
+ // best is a map containing all the links in the current clique
+ at->second = nbest;
+ // keep just the good
+ // adjList[at->first].clear();
+ cerr << "nbest is " << nbest << endl;
+ cerr << "best has " << best.size() << " records " << endl;
+ Size_t minRange, maxRange;
+ list<LinkMap_t::iterator>::iterator bg = best.begin();
+ Size_t sz = (**bg).second.getSize();
+ Size_t sd = (**bg).second.getSD();
+ minRange = sz - 3 * sd;
+ maxRange = sz + 3 * sd;
+ for (list<LinkMap_t::iterator>::iterator bi = best.begin();
+ bi != bestEnd; bi++){
+ bestList[at->first].push_back(*bi);
+ sz = (**bi).second.getSize();
+ sd = (**bi).second.getSD();
+ if (sz - 3 * sd > minRange)
+ minRange = sz - 3 * sd;
+ if (sz + 3 * sd < maxRange)
+ maxRange = sz + 3 * sd;
+ cerr << "Clique range = " << minRange << ", " << maxRange << endl;
+ }
+ // now minRange-maxRange is the range of the clique.
+ // we can mark all links that end before minRange or start after
+ // maxRange as incorrect
+ for (list<LinkMap_t::iterator>::iterator
+ lnks = adjList[at->first].begin();
+ lnks != adjList[at->first].end(); lnks++){
+ sz = (**lnks).second.getSize();
+ sd = (**lnks).second.getSD();
+ if (sz + 3 * sd < minRange)
+ cerr << "Link " << (**lnks).second.getIID() << " ("
+ << (**lnks).second.getSize() << ", "
+ << (**lnks).second.getSD() << ")"
+ << " is too short ( < " << minRange << ")" << endl;
+ if (sz - 3 * sd > maxRange)
+ cerr << "Link " << (**lnks).second.getIID() << " ("
+ << (**lnks).second.getSize() << ", "
+ << (**lnks).second.getSD() << ")"
+ << " is too long ( > " << maxRange << ")" << endl;
+ } // for each link
+
+ } else { // all links are good
+ for (list<LinkMap_t::iterator>::iterator
+ bi = adjList[at->first].begin();
+ bi != adjList[at->first].end(); bi++){
+ cerr << "Link " << (**bi).second.getIID() << " ("
+ << (**bi).second.getSize() << ", "
+ << (**bi).second.getSD() << ")"
+ << " is just right" << endl;
+ bestList[at->first].push_back(*bi);
+ }
+ } // if enough links exist
+
+ if (at->second > bestAdjCount){
+ bestAdjCount = at->second;
+ bestAdj = at->first;
+ }
+ } // for each adjacency
+
+ cerr << "new NORMALS: " << adjacencies[(LinkAdjacency_t)ContigLink_t::NORMAL]
+ << " ANTINORMALS: " << adjacencies[(LinkAdjacency_t)ContigLink_t::ANTINORMAL]
+ << " INNIES: " << adjacencies[(LinkAdjacency_t)ContigLink_t::INNIE]
+ << " OUTIES: " << adjacencies[(LinkAdjacency_t)ContigLink_t::OUTIE]
+ << "\n";
+
+
+ for (map<LinkAdjacency_t, int>::iterator at = adjacencies.begin();
+ at != adjacencies.end(); at++){
+ if (at->second >= 1){ // there are links we have to deal with
+ ContigEdge_t cte;
+ bestAdj = at->first;
+
+ // import adjacency info from first link
+ list<LinkMap_t::iterator>::iterator li = bestList[bestAdj].begin();
+ cte.setContigs((**li).second.getContigs());
+ cte.setAdjacency((**li).second.getAdjacency());
+
+ vector<ID_t> linkIds;
+ linkIds.reserve(bestList[bestAdj].size()); // try to keep memory low - best to prealloc
+
+ // here we want to combine the gaussians described by the "good" links
+ // use the idea of Huson et al. RECOMB 2001
+ float newMean, newSD, p = 0, q = 0;
+ for (list<LinkMap_t::iterator>::iterator ni = bestList[bestAdj].begin();
+ ni != bestList[bestAdj].end(); ni++){
+ float tmp = (**ni).second.getSD();
+ if (tmp == 0) tmp = 1; // avoid overflow errors
+ tmp *= tmp;
+
+ p += (**ni).second.getSize() / tmp;
+ q += 1 / tmp;
+ linkIds.push_back((**ni).second.getIID());
+ }
+
+ newMean = p / q;
+ newSD = 1 / sqrt(q);
+
+ // set size as aggregate of all links
+ cte.setSize((int)newMean);
+ cte.setSD((int)newSD);
+
+ // set contig link IDs
+ cte.setContigLinks(linkIds);
+
+ // give the edge an identifier
+ cte.setIID(++EdgeId);
+
+ if (!edge_bank.existsIID(cte.getIID())) {
+ cerr << "Writing edge link with it " << cte.getIID() << endl;
+ edge_bank << cte;
+ }
+ } // if enough links
+ } // for each adjacency type
+ } // for each contig pair
+
+ edge_bank.close();
+ link_bank.close();
+ return(0);
+} // main
+
diff --git a/src/Bambus/Bundler/Chainer.pl b/src/Bambus/Bundler/Chainer.pl
new file mode 100755
index 0000000..17af580
--- /dev/null
+++ b/src/Bambus/Bundler/Chainer.pl
@@ -0,0 +1,365 @@
+#!/usr/local/bin/perl
+
+use TIGR::Foundation;
+use strict;
+
+my $VERSION = '$Revision$ ';
+my $HELP = q~
+ Joiner -ce contig_edge_file -co contig_overlap_file -c contig_file -o out
+
+ assumes each pair of contigs occurs once in the contig_edge file
+ assumes all overlaps are listed in contig_overlap file (more than one
+ per contig pair)
+~;
+
+my $base = new TIGR::Foundation();
+if (! defined $base) {
+ die("A horrible death\n");
+}
+
+$base->setVersionInfo($VERSION);
+$base->setHelpInfo($HELP);
+
+my $edgefile;
+my $ovlfile;
+my $contigfile;
+my $outfile;
+
+my $err = $base->TIGR_GetOptions("ce=s" => \$edgefile,
+ "co=s" => \$ovlfile,
+ "c=s" => \$contigfile,
+ "o=s" => \$outfile);
+
+my %ctgpos;
+my %ctglen;
+my %ctgseq;
+my $pos;
+
+open(CTG, $contigfile) || $base->bail("Cannot open $contigfile: $!\n");
+
+# first we build an index
+while (<CTG>){
+ if (/^\#\#(\S+) (\d+) (\d+)/){
+ $ctglen{$1} = $3;
+ $ctgseq{$1} = $2;
+ }
+}
+close(CTG);
+
+my %edges;
+
+if (defined $outfile){
+ open(STDOUT, ">$outfile") || $base->bail("cannot open $outfile: $!\n");
+}
+
+open(EDGE, $edgefile) || $base->bail("Cannot open $edgefile: $!\n");
+
+while (<EDGE>){
+ my ($ctgA, $ctgB, $ori, $mean, $sd, $count) = split('\t', $_);
+ $edges{"$ctgA $ctgB $ori"} = "$mean $sd $count";
+}
+
+close(EDGE);
+
+open(OVL, $ovlfile) || $base->bail("Cannot open $ovlfile: $!\n");
+
+my $ctgA;
+my $ctgB;
+my %overlaps;
+while (<OVL>){
+ if (/^(\d+)\(\d+\) (\d+)\(\d+\)/) {
+ $ctgA = $1;
+ $ctgB = $2;
+ }
+ if (/^\t/){
+ my @fields = split('\t', $_);
+# print "A: $fields[0] B: $fields[1] C: $fields[2]\n";
+ $fields[2] =~ /(>|<) (>|<) (\d+) (\d+)/;
+ my $ori; my $rori;
+ my $ahang = $3;
+ my $bhang = $4;
+ my $dist; # distance between beginning of contigs
+
+ if ($1 eq '<' && $2 eq '<'){
+ $ori = 'A'; # anti-normal
+ $rori = 'N';
+ $dist = $bhang;
+ }
+ if ($1 eq '<' && $2 eq '>'){
+ $ori = 'O'; # outie
+ $rori = 'O';
+ $dist = $ctglen{$ctgA} - $ahang;
+ }
+ if ($1 eq '>' && $2 eq '>'){
+ $ori = 'N'; # normal
+ $rori = 'A';
+ $dist = $ahang;
+ }
+ if ($1 eq '>' && $2 eq '<'){
+ $ori = 'I'; # innie
+ $rori = 'I';
+ $dist = $ctglen{$ctgA} + $bhang;
+ }
+
+ if (exists $edges{"$ctgA $ctgB $ori"}){
+ my ($mean, $sd, $count) = split(' ', $edges{"$ctgA $ctgB $ori"});
+ if (abs($mean - $dist) < 2 * $sd){ # accept overlap
+ $overlaps{"$ctgA $ctgB $ori"} .= "$ahang,$bhang ";
+ } else {
+ print STDERR "overlap and edge just don't agree: $ctgA $ctgB $ori $ahang $bhang\n";
+ }
+ } elsif (exists $edges{"$ctgB $ctgA $rori"}){ # just the reverse
+ my ($mean, $sd, $count) = split(' ', $edges{"$ctgB $ctgA $rori"});
+ if (abs($mean - $dist) < 2 * $sd){ # accept overlap
+ $overlaps{"$ctgB $ctgA $rori"} .= "$bhang,$ahang ";
+ } else {
+ print STDERR "overlap and edge just don't agree: $ctgB $ctgA $rori $bhang $ahang\n";
+ }
+ }
+ } # if (^\t)
+} # while <OVL>
+
+close(OVL);
+
+# now I need to check that overlaps are consistent
+# essentially, if two or more contigs overlap the same
+# end of a contig I throw away both
+
+my %ends;
+while (my ($adj, $hangs) = each %overlaps){
+ my @hangs = split(' ', $hangs);
+
+ my ($mean, $sd, $count) = split(' ', $edges{$adj});
+ my ($ctgA, $ctgB, $ori) = split(' ', $adj);
+ my ($ahang, $bhang) = split(',', $hangs[0]);
+ # this I should be able to do better - make sure that
+ # all ahangs and bhangs are compatible and find the "consensus" set
+
+ if (($ahang >= 0 && $bhang <= 0) ||
+ ($ahang <= 0 && $bhang >= 0)){
+ print STDERR "CONTAINMENT $adj $ahang $bhang\n";
+ # maybe get rid of this overlap for now??
+ delete $overlaps{$adj};
+ next;
+ }
+
+ # now I know that ahang and bhang have the same sign.
+ if ($ahang > 0){
+ if ($ori eq 'N'){
+ $ends{"$ctgA E"} .= "$adj:";
+ $ends{"$ctgB B"} .= "$adj:";
+ } elsif ($ori eq 'A'){
+ $ends{"$ctgA B"} .= "$adj:";
+ $ends{"$ctgB E"} .= "$adj:";
+ } elsif ($ori eq 'I'){
+ $ends{"$ctgA E"} .= "$adj:";
+ $ends{"$ctgB E"} .= "$adj:";
+ } elsif ($ori eq 'O'){
+ $ends{"$ctgA B"} .= "$adj:";
+ $ends{"$ctgB B"} .= "$adj:";
+ }
+ } else { # ahang < 0
+ if ($ori eq 'N'){
+ $ends{"$ctgA B"} .= "$adj:";
+ $ends{"$ctgB E"} .= "$adj:";
+ } elsif ($ori eq 'A'){
+ $ends{"$ctgA E"} .= "$adj:";
+ $ends{"$ctgB B"} .= "$adj:";
+ } elsif ($ori eq 'I'){
+ $ends{"$ctgA B"} .= "$adj:";
+ $ends{"$ctgB B"} .= "$adj:";
+ } elsif ($ori eq 'O'){
+ $ends{"$ctgA E"} .= "$adj:";
+ $ends{"$ctgB E"} .= "$adj:";
+ }
+ } # if ahang > 0
+
+ print STDERR "Contigs $adj have ", $#hangs + 1,
+ " overlaps supported by $count edges\n";
+}
+
+while (my ($end, $adj) = each %ends){
+ my @adjs = split(':', $adj);
+ if ($#adjs > 0){
+ print STDERR "Contig $end has multiple overlaps: ";
+ for (my $i = 0; $i <= $#adjs; $i++){
+ my @hangs = split(' ', $overlaps{$adjs[$i]});
+ my ($mean, $sd, $count) = split(' ', $edges{$adjs[$i]});
+ print STDERR "$adjs[$i] $count ", $#hangs + 1, "; ";
+ delete $overlaps{$adjs[$i]};
+ }
+ print STDERR "\n";
+ delete $ends{$end};
+ }
+}
+
+my @chains; # here we store chains of contigs in the format: id offset ori,...
+my @chainlen; # chain lengths
+my @chainseq; # sequences in chain
+
+
+while (my ($adj, $hangs) = each %overlaps){
+ my @hangs = split(' ', $hangs);
+
+ my ($mean, $sd, $count) = split(' ', $edges{$adj});
+ my ($ctgA, $ctgB, $ori) = split(' ', $adj);
+ my ($ahang, $bhang) = split(',', $hangs[0]);
+ print STDERR "Contigs $adj have ", $#hangs + 1,
+ " overlaps supported by $count edges\n";
+}
+
+my $done = 0;
+
+while (! $done){
+ $done = 1;
+ while (my ($ctg, $len) = each %ctglen){
+ my $myoffset;
+ my $myori;
+ my $nextadj;
+ my @nextadj;
+
+ $done = 0;
+ if (! exists $ends{"$ctg B"}){
+ # start with the contig as forward
+ $myoffset = 0;
+ $myori = '>';
+ if (exists $ends{"$ctg E"}){
+ @nextadj = split(':', $ends{"$ctg E"});
+ $nextadj = $nextadj[0];
+ if (! exists $overlaps{$nextadj}) { # we must have removed it
+ $nextadj = undef;
+ }
+ }
+ } elsif (! exists $ends{"$ctg E"}){
+ # start with the contig as reversed
+ $myoffset = 0;
+ $myori = '<';
+ if (exists $ends{"$ctg B"}){
+ @nextadj = split(':', $ends{"$ctg B"});
+ $nextadj = $nextadj[0];
+ if (! exists $overlaps{$nextadj}) { # we must have removed it
+ $nextadj = undef;
+ }
+ }
+ } else {
+ next;
+ }
+ my @hangs = split(' ', $overlaps{$nextadj});
+ my ($ahang, $bhang) = split(',', $hangs[0]);
+ print STDERR "Starting with $ctg $myori and adjacency $nextadj: $ahang, $bhang\n ";
+ print STDERR "$ctg B = ", $ends{"$ctg B"}, " $ctg E = ", $ends{"$ctg E"}, "\n";
+ # now there can only be one contig off the other end
+ $chains[++$#chains] .= "$ctg $myoffset $myori\n";
+ $chainseq[++$#chainseq] += $ctgseq{$ctg};
+ $#chainlen++;
+ my $chainctg = 1;
+ while (defined $nextadj){
+ my ($ctgA, $ctgB, $ori) = split(' ', $nextadj);
+ my @hangs = split(' ', $overlaps{$nextadj});
+ my ($ahang, $bhang) = split(',', $hangs[0]);
+ if ($ctg == $ctgA){
+ # if ctg = > link can oly be N or I
+ # if ctg = < link can only be A or O
+ # ahang and bhang are both positive
+ if ($ahang < 0 || $bhang < 0){
+ $base->bail("The hangs are all wrong ($ctg) - $nextadj, $ahang, $bhang\n");
+ }
+ if ($myori eq '>'){
+ if ($ori eq 'N'){
+ } elsif ($ori eq 'I'){
+ $myori = '<';
+ } else {
+ $base->bail("Wrong orientation $ctg $myori - $nextadj?");
+ }
+ } else {
+ if ($ori eq 'A'){
+ $myori = '<';
+ } elsif ($ori eq 'O'){
+ } else {
+ $base->bail("Wrong orientation $ctg $myori - $nextadj?");
+ }
+ }
+ $myoffset += $ahang;
+ delete $ctglen{$ctg};
+ $ctg = $ctgB;
+ $chains[$#chains] .= "$ctg $myoffset $myori\n";
+ $chainseq[$#chainseq] += $ctgseq{$ctg};
+ $chainctg++;
+ } elsif ($ctg == $ctgB){
+ # if ahang is negative
+ # if ctg = > link can only be N or O
+ # if ctg = < link can only be A or I
+ # if ahang is positive
+ # if ctg = > link can only be
+ # if ctg = < link can only be
+ if ($ahang < 0){
+ if ($myori eq '>'){
+ if ($ori eq 'N'){
+ } elsif ($ori eq 'O'){
+ $myori = '<';
+ } else {
+ $base->bail("Wrong orientation $ctg $myori - $nextadj?");
+ }
+ } else {
+ if ($ori eq 'A'){
+ $myori = '<';
+ } elsif ($ori eq 'I'){
+ } else {
+ $base->bail("Wrong orientation $ctg $myori - $nextadj?");
+ }
+ }
+ if ($bhang > 0){
+ $base->bail("The hangs are all wrong ($ctg) - $nextadj, $ahang, $bhang\n");
+ }
+ $myoffset -= $ahang;
+ } else { #$ahang > 0
+ if ($myori eq '>'){
+ if ($ori eq 'A'){
+ } elsif ($ori eq 'I'){
+ $myori = '<';
+ } else {
+ $base->bail("Wrong orientation $ctg $myori - $nextadj?");
+ }
+ } else {
+ if ($ori eq 'O'){
+ $myori = '>';
+ } elsif ($ori eq 'N'){
+ } else {
+ $base->bail("Wrong orientation $ctg $myori - $nextadj?");
+ }
+ }
+ if ($bhang < 0){
+ $base->bail("The hangs are all wrong ($ctg) - $nextadj, $ahang, $bhang\n");
+ }
+ $myoffset += $bhang;
+ }
+ delete $ctglen{$ctg};
+ $ctg = $ctgA;
+ $chains[$#chains] .= "$ctg $myoffset $myori\n";
+ $chainseq[$#chainseq] += $ctgseq{$ctg};
+ $chainctg++;
+ } else {
+ $base->bail("$ctg is not in $nextadj\n");
+ }
+ if ($myori eq '<' && exists $ends{"$ctg B"}){
+ @nextadj = split(':', $ends{"$ctg B"});
+ $nextadj = $nextadj[0];
+ } elsif ($myori eq '>' && exists $ends{"$ctg E"}){
+ @nextadj = split(':', $ends{"$ctg E"});
+ $nextadj = $nextadj[0];
+ } else {
+ $nextadj = undef;
+ }
+ if (! exists $overlaps{$nextadj}) { # we must have removed it
+ $nextadj = undef;
+ }
+ }
+ $chainlen[$#chainlen] = $ctglen{$ctg} + $myoffset;
+ delete $ctglen{$ctg};
+# print STDERR "Chain ", $#chainlen, " is: $chains[$#chains]\n";
+ print ">$#chainlen $chainctg $chainseq[$#chainseq] $chainlen[$#chainlen]\n";
+ print $chains[$#chains];
+ } # for each contig
+} # while not done
+
+exit(0);
diff --git a/src/Bambus/Bundler/FilterEdgesByCluster.cc b/src/Bambus/Bundler/FilterEdgesByCluster.cc
new file mode 100755
index 0000000..463e75a
--- /dev/null
+++ b/src/Bambus/Bundler/FilterEdgesByCluster.cc
@@ -0,0 +1,313 @@
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <getopt.h>
+#include <math.h>
+#include <string>
+#include <map>
+#include <set>
+#include <queue>
+#include <iterator>
+#include <iostream>
+
+#include "datatypes_AMOS.hh"
+#include "Bank_AMOS.hh"
+#include "BankStream_AMOS.hh"
+
+#include "ContigIterator_AMOS.hh"
+
+#include "Contig_AMOS.hh"
+#include "ContigEdge_AMOS.hh"
+#include "Scaffold_AMOS.hh"
+
+#include "Utilities_Bundler.hh"
+
+using namespace std;
+using namespace HASHMAP;
+using namespace AMOS;
+using namespace Bundler;
+
+// constants for maximum satisfied edge
+static const uint32_t MAX_ITERATIONS = 100;
+static const uint32_t MAX_CLUSTERS = 256;
+static const double_t MIN_CLUSTERED_NEIGHBORS = 0.50;
+//static const double_t MIN_CLUSTERED_NEIGHBORS = 0.35;
+static const double_t MIN_CLUSTER_PERCENT = 0.75;
+
+struct config {
+ int32_t debug;
+ string bank;
+ int maxClusterID;
+ bool removeEdges;
+ HASHMAP::hash_map<ID_t, uint32_t, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > clusters; // contig clusters
+};
+config globals;
+
+HASHMAP::hash_map<AMOS::ID_t, int32_t, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > *Bundler::cte2weight = NULL;
+
+void printHelpText() {
+ cerr <<
+ "\n"
+ "USAGE:\n"
+ "\n"
+ "FilterEdgesByCluster -b[ank] <bank_name> [-clusters fileName] <-noRemoveEdges>\n"
+ "The -clusters option specifies a file containing a two-column list of contig IIDs and their cluster assignment. Cluster 0 means unassigned.\n"
+ "The noRemoveEdges option will not erase edges between clusters, only output the final contig assignments.\n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv) {
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"noRemoveEdges", 0, 0, 'r'},
+ {"clusters", 1, 0, 'c'},
+ {"maxCluster", 1, 0, 'm'},
+ {"debug", 1, 0, 'd'},
+ {0, 0, 0, 0}
+ };
+
+ globals.debug = 1;
+ globals.maxClusterID = 0;
+ globals.removeEdges = true;
+
+ int c;
+ ifstream clusterFile;
+ ID_t contigID;
+ uint32_t clusterID;
+ bool doNotUpdate = false;
+
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ break;
+ case 'b':
+ globals.bank = string(optarg);
+ break;
+ case 'c':
+ // read file here
+ clusterFile.open(optarg, ios::in);
+ if (!clusterFile) {
+ cerr << "Can't open clusters file, will not filter edges " << optarg << endl;
+ break;
+ }
+ while (clusterFile >> contigID >> clusterID) {
+ globals.clusters[contigID] = clusterID;
+
+ if (clusterID > globals.maxClusterID) {
+ globals.maxClusterID = clusterID;
+ }
+ }
+ clusterFile.close();
+ break;
+ case 'm':
+ globals.maxClusterID = atoi(optarg);
+ doNotUpdate = true;
+ break;
+ case 'd':
+ globals.debug = atoi(optarg);
+ break;
+ case 'r':
+ globals.removeEdges = false;
+ break;
+ case '?':
+ return false;
+ }
+ }
+ if (doNotUpdate == false) globals.maxClusterID++;
+
+ // print summary
+ if (globals.debug >= 1) {
+ cerr << "Options summary:" << endl;
+ cerr << "Bank = \t" << globals.bank << endl;
+ }
+
+ return true;
+} // GetOptions
+
+int main(int argc, char *argv[]) {
+ if (!GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ if (globals.bank == ""){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ Bank_t contig_bank (Contig_t::NCODE);
+ if (!contig_bank.exists(globals.bank)) {
+ cerr << "No contig account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ contig_bank.open(globals.bank, B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to openc ontig account in bank " << globals.bank << ": " << endl << e << endl;
+ contig_bank.close();
+ exit(1);
+ }
+
+ Bank_t edge_bank (ContigEdge_t::NCODE);
+ if (! edge_bank.exists(globals.bank)){
+ cerr << "No edge account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ edge_bank.open(globals.bank, B_READ |B_WRITE);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open edge account in bank " << globals.bank << ": " << endl << e << endl;
+ edge_bank.close();
+ exit(1);
+ }
+
+ ContigEdge_t cte;
+ set<ID_t> toRemove;
+ int maxNode = 0;
+
+ hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<ID_t>, equal_to<ID_t> > ctg2lnk; // map from contig to edges
+ cte2weight = new hash_map<ID_t, int32_t, hash<ID_t>, equal_to<ID_t> >();
+
+ hash_map<ID_t, double_t, hash<ID_t>, equal_to<ID_t> > ctg2percent;
+
+ for (AMOS::IDMap_t::const_iterator ci = edge_bank.getIDMap().begin(); ci; ci++) {
+ edge_bank.fetch(ci->iid, cte);
+
+ if (cte.getIID() == 0 || cte.getContigs().first == 0 || cte.getContigs().second == 0) {
+ // TODO: CTGs with links to ID 0 indicate links to/from singletons. Incorporate singletons into assembly?
+ if (globals.debug >= 0) {
+ cerr << "WARNING: link " << cte.getIID() << " (" << cte.getContigs().first << ", " << cte.getContigs().second << ") connects to a singleton, it is being ignored" << endl;
+ }
+ continue;
+ }
+ if (isBadEdge(cte)) {
+ cerr << "WARNING: link " << cte.getIID() << " is marked as bad in the bank, skipping" << endl;
+ continue;
+ }
+
+ (*cte2weight)[cte.getIID()] = cte.getContigLinks().size();
+ set<ID_t, EdgeWeightCmp>* s = ctg2lnk[cte.getContigs().first];
+ if (s == NULL) { s = new set<ID_t, EdgeWeightCmp>();}
+ s->insert(cte.getIID());
+ ctg2lnk[cte.getContigs().first] = s;
+
+ s = ctg2lnk[cte.getContigs().second];
+ if (s == NULL) { s = new set<ID_t, EdgeWeightCmp>();};
+ s->insert(cte.getIID());
+ ctg2lnk[cte.getContigs().second] = s;
+cerr << "Read in edge " << cte.getContigs().first << " AND " << cte.getContigs().second << " WEIGHT " << cte.getContigLinks().size() << endl;
+ }
+
+ for (hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<AMOS::ID_t>, equal_to<AMOS::ID_t> >::iterator i = ctg2lnk.begin(); i != ctg2lnk.end(); i++) {
+ if (i->second != NULL) {
+ int total = 0;
+ set<ID_t, EdgeWeightCmp>* s = i->second;
+ for (set<ID_t, EdgeWeightCmp>::iterator edges = s->begin(); edges != s->end(); edges++) {
+ edge_bank.fetch(*edges, cte);
+ total += cte.getContigLinks().size();
+ }
+cerr << "NODE " << i->first << " HAS " << total << " LINKS" << endl;
+ } else {
+cerr << "NODE " << i->first << " HAS 0 LINKS " << endl;
+ }
+ }
+
+ uint32_t iterations = 0;
+ bool changed = true;
+ while (changed && iterations < MAX_ITERATIONS) {
+ changed = false;
+ cerr << "Iteration " << iterations++ << endl;
+
+ for (hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<AMOS::ID_t>, equal_to<AMOS::ID_t> >::iterator i = ctg2lnk.begin(); i != ctg2lnk.end(); i++) {
+ if (i->second != NULL) {
+ set<ID_t, EdgeWeightCmp>* s = i->second;
+ double_t clusterPercents[MAX_CLUSTERS];
+ uint32_t totalLinks = 0;
+ uint32_t allLinks = 0;
+ memset(clusterPercents, 0, MAX_CLUSTERS*sizeof(double_t));
+
+ // tally up weighted counts for each cluster that our neighbors vote for
+ for (set<ID_t, EdgeWeightCmp>::iterator edges = s->begin(); edges != s->end(); edges++) {
+ edge_bank.fetch(*edges, cte);
+ ID_t otherID = getEdgeDestination(i->first, cte);
+ if (globals.clusters[otherID] != 0 && globals.clusters[otherID] != globals.maxClusterID) {
+ totalLinks += cte.getContigLinks().size();
+ clusterPercents[globals.clusters[otherID]] += cte.getContigLinks().size();
+ }
+ allLinks += cte.getContigLinks().size();
+ }
+ if (globals.debug >= 3) { cerr << "For node " << i->first << " THE CLUSTER ASSIGNMENT IS " << globals.clusters[i->first] << endl; }
+ double_t max = 0;
+ uint32_t maxClust = 0;
+ for (uint32_t clust = 0; clust < globals.maxClusterID; clust++) {
+ clusterPercents[clust] /= totalLinks;
+ if (max < clusterPercents[clust]) {
+ max = clusterPercents[clust];
+ maxClust = clust;
+ }
+ }
+ if (globals.debug >= 3) { cerr << "Node " << i->first << " ASSINGED TO " << globals.clusters[i->first] << " HAS % LINKS TO CLUSTER " << ((double)totalLinks/allLinks) << " AND MAX LINKS " << max << " TO CLUSTER " << maxClust << endl; }
+ ctg2percent[i->first] = (double)totalLinks/allLinks;
+ if ((double)totalLinks/allLinks > MIN_CLUSTERED_NEIGHBORS) {
+ if (max >= MIN_CLUSTER_PERCENT) {
+ // do nothing, it's good
+ } else {
+ maxClust = globals.maxClusterID;
+ }
+ changed |= (maxClust != globals.clusters[i->first]);
+ globals.clusters[i->first] = maxClust;
+ }
+ }
+ }
+ }
+
+/*
+ for (hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<AMOS::ID_t>, equal_to<AMOS::ID_t> >::iterator i = ctg2lnk.begin(); i != ctg2lnk.end(); i++) {
+ if (ctg2percent[i->first] <= MIN_CLUSTERED_NEIGHBORS) {
+ globals.clusters[i->first] = globals.maxClusterID;
+ }
+ }
+*/
+
+ if (globals.removeEdges) {
+ for (AMOS::IDMap_t::const_iterator ci = edge_bank.getIDMap().begin(); ci; ci++) {
+ edge_bank.fetch(ci->iid, cte);
+ if (cte.getContigs().first == 0 || cte.getContigs().second == 0) {
+ } else {
+ if (globals.clusters[cte.getContigs().first] != globals.clusters[cte.getContigs().second] && globals.clusters[cte.getContigs().first] != 0 && globals.clusters[cte.getContigs().second] != 0) {
+ cerr << "Removing edge between nodes " << cte.getContigs().first << " CLUSTER: " << globals.clusters[cte.getContigs().first] << " AND " << cte.getContigs().second << " CLUSTER: " << globals.clusters[cte.getContigs().second] << endl;
+ toRemove.insert(cte.getIID());
+ }
+ if (globals.clusters[cte.getContigs().first] == globals.maxClusterID || globals.clusters[cte.getContigs().second] == globals.maxClusterID) {
+ cerr << "Removing edge between ambiguous nodes " << cte.getContigs().first << " CLUSTER: " << globals.clusters[cte.getContigs().first] << " AND " << cte.getContigs().second << " CLUSTER: " << globals.clusters[cte.getContigs().second] << endl;
+ toRemove.insert(cte.getIID());
+ }
+ }
+ }
+ uint32_t count = 0;
+ for (set<ID_t>::iterator i = toRemove.begin(); i != toRemove.end(); i++) {
+ edge_bank.remove(*i);
+ count++;
+ }
+cerr << "Removed a total of " << count << " edges " << endl;
+ }
+
+ edge_bank.clean();
+ edge_bank.close();
+
+ // finally output updated status for all nodes
+ for (AMOS::IDMap_t::const_iterator ci = contig_bank.getIDMap().begin(); ci; ci++) {
+ cout << ci->iid << " " << globals.clusters[ci->iid] << endl;
+ }
+
+ contig_bank.close();
+
+ return 0;
+}
diff --git a/src/Bambus/Bundler/Joiner.pl b/src/Bambus/Bundler/Joiner.pl
new file mode 100755
index 0000000..099136b
--- /dev/null
+++ b/src/Bambus/Bundler/Joiner.pl
@@ -0,0 +1,145 @@
+#!/usr/local/bin/perl
+
+use TIGR::Foundation;
+use AMOS::ParseFasta;
+use strict;
+
+my $VERSION = '$Revision$ ';
+my $HELP = q~
+ Joiner -ce contig_edge_file -co contig_overlap_file -c contig_file -o out
+
+ assumes each pair of contigs occurs once in the contig_edge file
+ assumes all overlaps are listed in contig_overlap file (more than one
+ per contig pair)
+~;
+
+my $base = new TIGR::Foundation();
+if (! defined $base) {
+ die("A horrible death\n");
+}
+
+$base->setVersionInfo($VERSION);
+$base->setHelpInfo($HELP);
+
+my $chainfile;
+my $contigfile;
+my $outfile;
+
+my $err = $base->TIGR_GetOptions("ch=s" => \$chainfile,
+ "c=s" => \$contigfile,
+ "o=s" => \$outfile);
+
+my %ctgpos;
+my %ctglen;
+my %ctgseq;
+my $pos;
+
+open(CTG, $contigfile) || $base->bail("Cannot open $contigfile: $!\n");
+
+my $maxCtgId = 0;
+
+# first we build an index
+$pos = tell CTG;
+while (<CTG>){
+ if (/^\#\#(\S+) (\d+) (\d+)/){
+ $ctgpos{$1} = $pos;
+ $ctglen{$1} = $3;
+ $ctgseq{$1} = $2;
+ if ($1 > $maxCtgId){
+ $maxCtgId = $1;
+ }
+ }
+ $pos = tell CTG;
+}
+
+$maxCtgId++;
+
+if (defined $outfile){
+ open(STDOUT, ">$outfile") || $base->bail("cannot open $outfile: $!\n");
+}
+
+open(CH, $chainfile)|| $base->bail("Cannot open $chainfile: $!\n");
+my $parser = new ParseFasta(\*CH, '>', "\n");
+if (! defined $parser){
+ $base->bail("Cannot parse fasta file...");
+}
+
+print STDERR "Starting numbering from $maxCtgId\n";
+while (my($head, $data) = $parser->getRecord()){
+
+ my ($chainId, $ctgs, $seqs, $bases) = split(' ', $head);
+ my @contigs = split('\n', $data);
+
+ my $ctgId;
+
+ if ($ctgs > 1){
+ $ctgId = $maxCtgId + $chainId;
+ } else {
+ my ($id, $off, $ori) = split(' ', $contigs[0]);
+ $ctgId = $id;
+ }
+
+ print "##$ctgId $seqs $bases bases\n";
+
+ my %byoffset;
+
+ for (my $ct = 0; $ct <= $#contigs; $ct++){
+ my ($id, $off, $ori) = split(' ', $contigs[$ct]);
+ my $len;
+ print STDERR "Doing $id $off $ori\n";
+
+ seek(CTG, $ctgpos{$id}, 0)
+ || $base->bail("Cannot find contig $id in file: $!\n");
+ $_ = <CTG>;
+ if ($_ =~ /^\#\#(\d+) (\d+) (\d+)/){
+ if ($1 != $id){
+ $base->bail("Contig $id does not match file: $_");
+ }
+ $len = $3;
+ } else {
+ $base->bail("Contig $id does not exist in file: $_");
+ }
+
+ while (<CTG>){
+ if (/^\#\#/){
+ last;
+ }
+ if (/^\#([^(]+)\((\d+)\) (\d+) bases {(\d+) (\d+)} <(\d+) (\d+)>/){
+ my $seqid = $1;
+ my $offset = $2;
+ my $seqlen = $3;
+ my $seq_lend = $4;
+ my $seq_rend = $5;
+ my $asm_lend = $6;
+ my $asm_rend = $7;
+
+ if ($ori eq '<'){
+ my $tmp = $seq_lend;
+ $seq_lend = $seq_rend;
+ $seq_rend = $tmp;
+ $tmp = $asm_lend;
+ $asm_lend = $len - $asm_rend;
+ $asm_rend = $len - $tmp;
+ $offset = $len - $offset;
+ }
+ $offset += $off;
+ $asm_lend += $off;
+ $asm_rend += $off;
+
+ my $idx = $offset;
+
+ while (exists $byoffset{$idx}){
+ $idx += 0.0001;
+ }
+
+ $byoffset{$idx} = "\#$seqid($offset) $seqlen bases {$seq_lend $seq_rend} <$asm_lend $asm_rend>\n";
+ } # if read record
+ } # while <CTG>
+ } # for my $ct in %contigs
+ foreach my $i (sort {$a <=> $b} keys %byoffset){
+ print $byoffset{$i};
+ }
+} # for each chain
+
+close(CTG);
+exit(0);
diff --git a/src/Bambus/Bundler/Makefile.am b/src/Bambus/Bundler/Makefile.am
new file mode 100644
index 0000000..9234ccb
--- /dev/null
+++ b/src/Bambus/Bundler/Makefile.am
@@ -0,0 +1,85 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+##-- TO BE INSTALLED
+amoslib_LIBRARIES = \
+ libBundler.a
+
+amosinclude_HEADERS = \
+ Utilities_Bundler.hh
+
+bin_PROGRAMS = \
+ Bundler \
+ clk \
+ MarkRepeats \
+ FilterEdgesByCluster \
+ OrientContigs
+
+dist_bin_SCRIPTS = \
+ Chainer.pl \
+ Joiner.pl
+
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_srcdir)/src/GNU \
+ $(BOOST_CXXFLAGS) \
+ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
+ -pedantic
+
+##-- Bundler
+Bundler_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+Bundler_SOURCES = \
+ Bundler.cc
+
+
+##-- CLK
+clk_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+clk_SOURCES = \
+ clk.cc
+
+MarkRepeats_LDADD = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+MarkRepeats_SOURCES = \
+ MarkRepeats.cc
+
+OrientContigs_LDADD = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+OrientContigs_SOURCES = \
+ OrientContigs.cc
+
+FilterEdgesByCluster_LDADD = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+FilterEdgesByCluster_SOURCES = \
+ FilterEdgesByCluster.cc
+
+##-- libBundler.a
+libBundler_a_CPPFLAGS = \
+ $(BOOST_CXXFLAGS) \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_builddir)/src/AMOS
+ ## because some system headers will be built if necessary
+libBundler_a_LIBADD = \
+ $(LIBOBJS:%=$(top_builddir)/src/GNU/%) \
+ $(LIBOBJS:%=$(top_builddir)/src/AMOS/%)
+libBundler_a_SOURCES = \
+ Utilities_Bundler.cc
+
+##-- END OF MAKEFILE --##
diff --git a/src/Bambus/Bundler/Makefile.in b/src/Bambus/Bundler/Makefile.in
new file mode 100644
index 0000000..5b790a7
--- /dev/null
+++ b/src/Bambus/Bundler/Makefile.in
@@ -0,0 +1,823 @@
+# 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 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@
+DIST_COMMON = $(amosinclude_HEADERS) $(dist_bin_SCRIPTS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = Bundler$(EXEEXT) clk$(EXEEXT) MarkRepeats$(EXEEXT) \
+ FilterEdgesByCluster$(EXEEXT) OrientContigs$(EXEEXT)
+subdir = src/Bambus/Bundler
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(bindir)" "$(DESTDIR)$(amosincludedir)"
+LIBRARIES = $(amoslib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libBundler_a_AR = $(AR) $(ARFLAGS)
+libBundler_a_DEPENDENCIES = $(LIBOBJS:%=$(top_builddir)/src/GNU/%) \
+ $(LIBOBJS:%=$(top_builddir)/src/AMOS/%)
+am_libBundler_a_OBJECTS = libBundler_a-Utilities_Bundler.$(OBJEXT)
+libBundler_a_OBJECTS = $(am_libBundler_a_OBJECTS)
+PROGRAMS = $(bin_PROGRAMS)
+am_Bundler_OBJECTS = Bundler.$(OBJEXT)
+Bundler_OBJECTS = $(am_Bundler_OBJECTS)
+Bundler_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_FilterEdgesByCluster_OBJECTS = FilterEdgesByCluster.$(OBJEXT)
+FilterEdgesByCluster_OBJECTS = $(am_FilterEdgesByCluster_OBJECTS)
+FilterEdgesByCluster_DEPENDENCIES = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_MarkRepeats_OBJECTS = MarkRepeats.$(OBJEXT)
+MarkRepeats_OBJECTS = $(am_MarkRepeats_OBJECTS)
+MarkRepeats_DEPENDENCIES = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_OrientContigs_OBJECTS = OrientContigs.$(OBJEXT)
+OrientContigs_OBJECTS = $(am_OrientContigs_OBJECTS)
+OrientContigs_DEPENDENCIES = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_clk_OBJECTS = clk.$(OBJEXT)
+clk_OBJECTS = $(am_clk_OBJECTS)
+clk_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+SCRIPTS = $(dist_bin_SCRIPTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(libBundler_a_SOURCES) $(Bundler_SOURCES) \
+ $(FilterEdgesByCluster_SOURCES) $(MarkRepeats_SOURCES) \
+ $(OrientContigs_SOURCES) $(clk_SOURCES)
+DIST_SOURCES = $(libBundler_a_SOURCES) $(Bundler_SOURCES) \
+ $(FilterEdgesByCluster_SOURCES) $(MarkRepeats_SOURCES) \
+ $(OrientContigs_SOURCES) $(clk_SOURCES)
+HEADERS = $(amosinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+amoslib_LIBRARIES = \
+ libBundler.a
+
+amosinclude_HEADERS = \
+ Utilities_Bundler.hh
+
+dist_bin_SCRIPTS = \
+ Chainer.pl \
+ Joiner.pl
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_srcdir)/src/GNU \
+ $(BOOST_CXXFLAGS) \
+ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
+ -pedantic
+
+Bundler_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+Bundler_SOURCES = \
+ Bundler.cc
+
+clk_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+clk_SOURCES = \
+ clk.cc
+
+MarkRepeats_LDADD = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+MarkRepeats_SOURCES = \
+ MarkRepeats.cc
+
+OrientContigs_LDADD = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+OrientContigs_SOURCES = \
+ OrientContigs.cc
+
+FilterEdgesByCluster_LDADD = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+FilterEdgesByCluster_SOURCES = \
+ FilterEdgesByCluster.cc
+
+libBundler_a_CPPFLAGS = \
+ $(BOOST_CXXFLAGS) \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_builddir)/src/AMOS
+
+libBundler_a_LIBADD = \
+ $(LIBOBJS:%=$(top_builddir)/src/GNU/%) \
+ $(LIBOBJS:%=$(top_builddir)/src/AMOS/%)
+
+libBundler_a_SOURCES = \
+ Utilities_Bundler.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Bambus/Bundler/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Bambus/Bundler/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):
+install-amoslibLIBRARIES: $(amoslib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(amoslibdir)" || $(MKDIR_P) "$(DESTDIR)$(amoslibdir)"
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(amoslibdir)'"; \
+ $(INSTALL_DATA) $$list2 "$(DESTDIR)$(amoslibdir)" || exit $$?; }
+ @$(POST_INSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ for p in $$list; do \
+ if test -f $$p; then \
+ $(am__strip_dir) \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && $(RANLIB) $$f )"; \
+ ( cd "$(DESTDIR)$(amoslibdir)" && $(RANLIB) $$f ) || exit $$?; \
+ else :; fi; \
+ done
+
+uninstall-amoslibLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && rm -f "$$files" )"; \
+ cd "$(DESTDIR)$(amoslibdir)" && rm -f $$files
+
+clean-amoslibLIBRARIES:
+ -test -z "$(amoslib_LIBRARIES)" || rm -f $(amoslib_LIBRARIES)
+libBundler.a: $(libBundler_a_OBJECTS) $(libBundler_a_DEPENDENCIES)
+ -rm -f libBundler.a
+ $(libBundler_a_AR) libBundler.a $(libBundler_a_OBJECTS) $(libBundler_a_LIBADD)
+ $(RANLIB) libBundler.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+Bundler$(EXEEXT): $(Bundler_OBJECTS) $(Bundler_DEPENDENCIES)
+ @rm -f Bundler$(EXEEXT)
+ $(CXXLINK) $(Bundler_OBJECTS) $(Bundler_LDADD) $(LIBS)
+FilterEdgesByCluster$(EXEEXT): $(FilterEdgesByCluster_OBJECTS) $(FilterEdgesByCluster_DEPENDENCIES)
+ @rm -f FilterEdgesByCluster$(EXEEXT)
+ $(CXXLINK) $(FilterEdgesByCluster_OBJECTS) $(FilterEdgesByCluster_LDADD) $(LIBS)
+MarkRepeats$(EXEEXT): $(MarkRepeats_OBJECTS) $(MarkRepeats_DEPENDENCIES)
+ @rm -f MarkRepeats$(EXEEXT)
+ $(CXXLINK) $(MarkRepeats_OBJECTS) $(MarkRepeats_LDADD) $(LIBS)
+OrientContigs$(EXEEXT): $(OrientContigs_OBJECTS) $(OrientContigs_DEPENDENCIES)
+ @rm -f OrientContigs$(EXEEXT)
+ $(CXXLINK) $(OrientContigs_OBJECTS) $(OrientContigs_LDADD) $(LIBS)
+clk$(EXEEXT): $(clk_OBJECTS) $(clk_DEPENDENCIES)
+ @rm -f clk$(EXEEXT)
+ $(CXXLINK) $(clk_OBJECTS) $(clk_LDADD) $(LIBS)
+install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Bundler.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/FilterEdgesByCluster.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MarkRepeats.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/OrientContigs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/clk.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libBundler_a-Utilities_Bundler.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+
+libBundler_a-Utilities_Bundler.o: Utilities_Bundler.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libBundler_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libBundler_a-Utilities_Bundler.o -MD -MP -MF $(DEPDIR)/libBundler_a-Utilities_Bundler.Tpo -c -o libBundler_a-Utilities_Bundler.o `test -f 'Utilities_Bundler.cc' || echo '$(srcdir)/'`Utilities_Bundler.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libBundler_a-Utilities_Bundler.Tpo $(DEPDIR)/libBundler_a-Utilities_Bundler.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Utilities_Bundler.cc' object='libBundler_a-Utilities_Bundler.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libBundler_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libBundler_a-Utilities_Bundler.o `test -f 'Utilities_Bundler.cc' || echo '$(srcdir)/'`Utilities_Bundler.cc
+
+libBundler_a-Utilities_Bundler.obj: Utilities_Bundler.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libBundler_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libBundler_a-Utilities_Bundler.obj -MD -MP -MF $(DEPDIR)/libBundler_a-Utilities_Bundler.Tpo -c -o libBundler_a-Utilities_Bundler.obj `if test -f 'Utilities_Bundler.cc'; then $(CYGPATH_W) 'Utilities_Bundler.cc'; else $(CYGPATH_W) '$(srcdir)/Utilities_Bundler.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libBundler_a-Utilities_Bundler.Tpo $(DEPDIR)/libBundler_a-Utilities_Bundler.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Utilities_Bundler.cc' object='libBundler_a-Utilities_Bundler.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libBundler_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libBundler_a-Utilities_Bundler.obj `if test -f 'Utilities_Bundler.cc'; then $(CYGPATH_W) 'Utilities_Bundler.cc'; else $(CYGPATH_W) '$(srcdir)/Utilities_Bundler.cc'; fi`
+install-amosincludeHEADERS: $(amosinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(amosincludedir)" || $(MKDIR_P) "$(DESTDIR)$(amosincludedir)"
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(amosincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(amosincludedir)" || exit $$?; \
+ done
+
+uninstall-amosincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amosincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(amosincludedir)" && rm -f $$files
+
+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) $(SCRIPTS) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(amosincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-amoslibLIBRARIES clean-binPROGRAMS clean-generic \
+ 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-amosincludeHEADERS install-amoslibLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS install-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-amosincludeHEADERS uninstall-amoslibLIBRARIES \
+ uninstall-binPROGRAMS uninstall-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-amoslibLIBRARIES clean-binPROGRAMS clean-generic ctags \
+ distclean distclean-compile distclean-generic distclean-tags \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-amosincludeHEADERS install-amoslibLIBRARIES \
+ install-binPROGRAMS install-data install-data-am \
+ install-dist_binSCRIPTS 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-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-amosincludeHEADERS \
+ uninstall-amoslibLIBRARIES uninstall-binPROGRAMS \
+ uninstall-dist_binSCRIPTS uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Bambus/Bundler/MarkRepeats.cc b/src/Bambus/Bundler/MarkRepeats.cc
new file mode 100755
index 0000000..26f6443
--- /dev/null
+++ b/src/Bambus/Bundler/MarkRepeats.cc
@@ -0,0 +1,400 @@
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <getopt.h>
+#include <math.h>
+#include <limits>
+#include <string>
+#include <map>
+#include <set>
+#include <queue>
+#include <iterator>
+#include <iostream>
+
+#ifdef AMOS_HAVE_BOOST
+#include <boost/graph/connected_components.hpp>
+#include <boost/graph/strong_components.hpp>
+#endif //AMOS_HAVE_BOOST
+
+#include "datatypes_AMOS.hh"
+#include "Bank_AMOS.hh"
+#include "BankStream_AMOS.hh"
+
+#include "Contig_AMOS.hh"
+#include "ContigEdge_AMOS.hh"
+
+#include "Utilities_Bundler.hh"
+
+using namespace std;
+using namespace HASHMAP;
+using namespace AMOS;
+using namespace Bundler;
+
+// constants for repeat resolution
+static const int32_t MAX_REPEAT_SIZE = 10000;
+static const int32_t MAX_REPEAT_STDEV = 3;
+static const double MAX_REPEAT_COV = 0.02;
+static const double MAX_COVERAGE_ERROR = 0.05;
+
+HASHMAP::hash_map<AMOS::ID_t, int32_t, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > *Bundler::cte2weight = NULL;
+
+struct config {
+ string bank;
+ int32_t debug;
+ int32_t redundancy;
+ bool doAgressiveRepeatFinding;
+ bool noPathRepeats;
+ bool noCoverageRepeats;
+ double maxRepeatCoverage;
+};
+config globals;
+void printHelpText() {
+ cerr <<
+ "\n"
+ "Find repetitive contigs and mark them as repeats\n"
+ "\n"
+ "USAGE:\n"
+ "\n"
+ "MarkRepeats -b[ank] <bank_name> [-agressive] [-redundancy] [-noPathRepeats] [-noCoverageRepeats]\n"
+ "The -redundancy option specifies the minimum number of links between two contigs before they will be scaffolded\n"
+ "The -aggressive option will identify repeats using only the size and coverage stat (i.e. global coverage) and not the graph structure of the contigs for the coverage repeat algorithm\n"
+ "The -noPathRepeats and -noCoverageRepeats will control which repeat algorithms are run. The default is to run both.\n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv) {
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"agressive", 0, 0, 'R'},
+ {"redundancy", 1, 0, 'p'},
+ {"debug", 1, 0, 'd'},
+ {"noPathRepeats", 0, 0, 'r'},
+ {"noCoverageRepeats", 0, 0, 'c'},
+ {0, 0, 0, 0}
+ };
+
+ globals.debug = 0;
+ globals.doAgressiveRepeatFinding = false;
+ globals.redundancy = 1;
+ globals.noPathRepeats = false;
+ globals.noCoverageRepeats = false;
+ globals.maxRepeatCoverage = MAX_REPEAT_COV;
+
+ int c;
+ ifstream repeatsFile;
+ ID_t repeatID;
+
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ break;
+ case 'b':
+ globals.bank = string(optarg);
+ break;
+ case 'p':
+ globals.redundancy = atoi(optarg);
+ break;
+ case 'R':
+ globals.doAgressiveRepeatFinding = true;
+ break;
+ case 'r':
+ globals.noPathRepeats = true;
+ break;
+ case 'c':
+ globals.noCoverageRepeats = true;
+ break;
+ case 'd':
+ globals.debug = atoi(optarg);
+ break;
+ case '?':
+ return false;
+ }
+ }
+
+ // print summary
+ if (globals.debug >= 1) {
+ cerr << "Options summary:" << endl;
+ cerr << "Bank = \t" << globals.bank << endl;
+ cerr << "Redundancy = \t" << globals.redundancy << endl;
+ cerr << "AgressiveRepats = \t" << globals.doAgressiveRepeatFinding << endl;
+ }
+
+ return true;
+} // GetOptions
+
+#ifdef AMOS_HAVE_BOOST
+void visitAllPaths(
+ hash_map<ID_t, double, hash<ID_t>, equal_to<ID_t> >&numTimesOnPath,
+ Graph const&g,
+ VertexName &vertexNames,
+ const Vertex* predMap,
+ Vertex const i,
+ Vertex const j) {
+
+ if (i==j) {
+ return;
+ } else if (predMap[j] == boost::graph_traits<Graph>::null_vertex()) {
+ return;
+ } else {
+ visitAllPaths(numTimesOnPath, g, vertexNames, predMap, i, predMap[j]);
+ numTimesOnPath[vertexNames[j]]++;
+ }
+}
+
+void findShortestPathRepeats(Graph &g, Bank_t &contig_bank, set<ID_t> &repeats) {
+ // find the all-pairs shortest paths
+ if (globals.debug > 2) cerr << "FINDING SHORTEST PATHS" << endl;
+
+ VertexName vertexNames = get(boost::vertex_name, g);
+ EdgeWeight edgeWeights = get(boost::edge_weight, g);
+
+ int32_t numVertices = boost::num_vertices(g);
+ double_t* distMap = new double_t[numVertices];
+ Vertex* predMap = new Vertex[numVertices];
+ vector<int32_t> qarray;
+
+ hash_map<ID_t, double, hash<ID_t>, equal_to<ID_t> >numTimesOnPath;
+ pair<VertexIterator, VertexIterator> i;
+ for (i = boost::vertices(g); i.first != i.second; ++i.first) {
+ numTimesOnPath[vertexNames[*i.first]] = 0;
+ }
+
+ for (i = boost::vertices(g); i.first != i.second; ++i.first) {
+ Vertex source = *i.first;
+ // initialize arrays
+ qarray.clear();
+ pair<VertexIterator, VertexIterator> j;
+ for (j = boost::vertices(g); j.first != j.second; ++j.first) {
+ Vertex vertex = *j.first;
+
+ qarray.push_back(vertex);
+ distMap[vertex] = std::numeric_limits<int>::max();
+ predMap[vertex] = boost::graph_traits<Graph>::null_vertex();
+ }
+
+ // initialize distance to the source to be 0
+ distMap[source] = 0;
+ while (qarray.size() != 0) {
+ double_t min = std::numeric_limits<double>::max();
+ Vertex minNode = boost::graph_traits<Graph>::null_vertex();
+ vector<int32_t>::iterator index;
+
+ for (vector<int32_t>::iterator it = qarray.begin(); it < qarray.end(); it++) {
+ // for all nodes we haven't processed yet, check if they have shortest next distance
+ if (distMap[*it] < min) {
+ min = distMap[*it];
+ minNode = *it;
+ index = it;
+ }
+ }
+
+ if (minNode == boost::graph_traits<Graph>::null_vertex() || min == std::numeric_limits<int32_t>::max()) {
+ break;
+ }
+
+ qarray.erase(index);
+ EdgeIterator out_i, out_end;
+ for (tie(out_i, out_end) = boost::out_edges(minNode, g); out_i != out_end; ++out_i) {
+ Vertex t = boost::target(*out_i, g);
+ if (distMap[minNode] + edgeWeights[*out_i] < distMap[t]) {
+ distMap[t] = distMap[minNode] + edgeWeights[*out_i];
+ predMap[t] = minNode;
+ }
+ }
+ }
+ for (j = boost::vertices(g); j.first != j.second; ++j.first) {
+ visitAllPaths(numTimesOnPath, g, vertexNames, predMap, source, *j.first);
+ }
+ }
+
+ // finally adjust our path counts by node sizes, we expect larger nodes to have more connections by chance
+ VertexLength vertexLength = get(boost::vertex_index1, g);
+ for (i = boost::vertices(g); i.first != i.second; ++i.first) {
+ numTimesOnPath[vertexNames[*i.first]] /= vertexLength[*i.first];
+ }
+ delete[] distMap;
+ delete[] predMap;
+
+ if (globals.debug > 2) cerr << "DONE SHORTEST PATHS" << endl;
+
+ double meanOnPath = 0, varianceOnPath = 0, stdevOnPath = 0, N = 0;
+ for (hash_map<ID_t, double, hash<ID_t>, equal_to<ID_t> >::iterator i = numTimesOnPath.begin(); i != numTimesOnPath.end(); i++) {
+ if (i->first == 0) { continue; }
+
+ N++;
+ double delta = (i->second - meanOnPath);
+ meanOnPath += (delta/N);
+ varianceOnPath += delta * (i->second - meanOnPath);
+ }
+ varianceOnPath /= N;
+ stdevOnPath = sqrt(varianceOnPath);
+
+ for (i = boost::vertices(g); i.first != i.second; ++i.first) {
+ ID_t iid = vertexNames[*i.first];
+ if (iid == 0) continue;
+
+ if (globals.debug > 1) cerr << "CONTIG " << iid << " IS NO PATH=" << numTimesOnPath[iid] << " MEAN IS " << meanOnPath << " STDEV: " << stdevOnPath << " DELTA: " << (numTimesOnPath[iid] - (meanOnPath+(MAX_REPEAT_STDEV*stdevOnPath))) << endl;
+ if ((numTimesOnPath[iid] - (meanOnPath+(MAX_REPEAT_STDEV*stdevOnPath))) > 0) {
+ // remove the vertices from our assembly and from the graph that is used for connected components
+ repeats.insert(iid);
+ boost::clear_vertex(*i.first, g);
+
+ if (globals.debug > 1 ) cerr << "CONTIG " << iid << " AND ONPATH=" << numTimesOnPath[iid] << " AND MEAN=" << meanOnPath << " AND STDEV=" << stdevOnPath << " IS A CLASS 3 REPEAT\n";
+ }
+ }
+}
+
+void findConnectedComponentRepeats(Graph &g, Bank_t &contig_bank, set<ID_t> &repeats) {
+ if (globals.debug > 2) cerr << "FINDING CONNECTED COMPONENTS PATHS" << endl;
+ typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, VertexProperty, EdgeProperty> UndirectedGraph;
+ hash_map<ID_t, vector<Contig_t *>, hash<ID_t>, equal_to<ID_t> > ctgsByComponent;
+ vector<Contig_t *> allContigs;
+ UndirectedGraph ug;
+ boost::copy_graph(g, ug);
+
+ VertexName vertexNames = get(boost::vertex_name, g);
+ int32_t* component = new int32_t[boost::num_vertices(ug)];
+
+ // this section is very memory heavy, we load all the contigs from the bank into memory for the ctgsByComponent code
+ // if memory becomes an issue, we can instead read contigs from the bank instead
+ boost::connected_components(ug, &component[0]);
+ pair<VertexIterator, VertexIterator> i;
+ Contig_t *ctg;
+ for (i = boost::vertices(g); i.first != i.second; ++i.first) {
+ if (vertexNames[*i.first] == 0) continue;
+
+ ctg = new Contig_t();
+ contig_bank.fetch(vertexNames[*i.first], (*ctg));
+ allContigs.push_back(ctg);
+ ctgsByComponent[component[*i.first]].push_back(ctg);
+ }
+
+ if (globals.debug > 2) cerr << "COMPUTING CONNECTED COMPONENTS COVERAGE " << endl;
+ double globalArrivalRate = computeArrivalRate(allContigs);
+ allContigs.clear();
+
+double globalMean = 0, globalVariance = 0, globalStdev = 0, globalN = 0;
+ for (hash_map<ID_t, vector<Contig_t *>, hash<ID_t>, equal_to<ID_t> >::iterator i = ctgsByComponent.begin(); i != ctgsByComponent.end(); i++) {
+ double arrivalRate = computeArrivalRate(i->second);
+ for (vector<Contig_t *>::iterator j = i->second.begin(); j < i->second.end(); j++) {
+ double cov = (*j)->getCovStat(arrivalRate);
+
+ globalN++;
+ double globalDelta = cov-globalMean;
+ globalMean+=(globalDelta/globalN);
+ globalVariance += globalDelta * (cov - globalMean);
+ }
+ }
+ globalVariance /= globalN;
+ globalStdev = sqrt(globalVariance);
+
+ for (hash_map<ID_t, vector<Contig_t *>, hash<ID_t>, equal_to<ID_t> >::iterator i = ctgsByComponent.begin(); i != ctgsByComponent.end(); i++) {
+ double arrivalRate = computeArrivalRate(i->second);
+ double mean = 0, variance = 0, stdev = 0, N = 0;
+ for (vector<Contig_t *>::iterator j = i->second.begin(); j < i->second.end(); j++) {
+ double cov = (*j)->getCovStat(arrivalRate);
+
+ N++;
+ double delta = cov - mean;
+ mean += (delta/N);
+ variance += delta * (cov - mean);
+ }
+ variance /= N;
+ stdev = sqrt(variance);
+
+ if (globals.debug > 2) cerr << "Processing Connected component " << i->first << " with " << i->second.size() << " elements with coverage " << mean << " and stdev " << stdev << " GLOBAL ARRIVAL: " << globalArrivalRate << " LOCAL: " << arrivalRate << endl;
+ for (vector<Contig_t *>::iterator j = i->second.begin(); j < i->second.end(); j++) {
+ double cov = (*j)->getCovStat(arrivalRate);
+ double globalCov = (*j)->getCovStat(globalArrivalRate);
+
+ if (globals.debug > 1) cerr << "CONTIG " << (*j)->getIID() << " HAS COVERAGE " << cov << " GLOBAL COV: " << globalCov << " MEAN: " << mean << " STDEV:" << stdev << " SIZE " << (*j)->getUngappedLength() << " DELTA IS " << (cov + (mean - MAX_REPEAT_STDEV*stdev)) << endl;
+ if ((cov < MAX_REPEAT_COV) && (*j)->getUngappedLength() < MAX_REPEAT_SIZE) {
+ if (globals.debug > 1) cerr << "CONTIG " << (*j)->getEID() << " OF SIZE " << (*j)->getUngappedLength() << " WITH " << (*j)->getReadTiling().size() << " READS AND COVERAGE " << cov << " IS TOO LOW" << endl;
+ repeats.insert((*j)->getIID());
+ } else if (i->second.size() == 1 && globalCov < MAX_REPEAT_COV) {
+ if (globals.debug > 1) cerr << "CONTIG " << (*j)->getEID() << " OF SIZE " << (*j)->getUngappedLength() << " GLOBAL COVERAGE " << globalCov << " IS TOO LOW" << endl;
+ repeats.insert((*j)->getIID());
+ } else if (globals.doAgressiveRepeatFinding == true && globalCov <= MAX_REPEAT_COV && (*j)->getUngappedLength() < MAX_REPEAT_SIZE) {
+ if (globals.debug > 1) cerr << "AGRESSIVE REPEAT" << cov << " IS TOO LOW" << endl;
+ repeats.insert((*j)->getIID());
+ }
+ // free memory the contig was using as soon as we're done with it
+ delete (*j);
+ }
+ }
+
+ delete[] component;
+}
+#endif //AMOS_HAVE_BOOST
+
+int main(int argc, char *argv[]) {
+ if (!GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ if (globals.bank == ""){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ BankStream_t edge_stream (ContigEdge_t::NCODE);
+ if (! edge_stream.exists(globals.bank)){
+ cerr << "No edge account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ edge_stream.open(globals.bank, B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open edge account in bank " << globals.bank << ": " << endl << e << endl;
+ edge_stream.close();
+ exit(1);
+ }
+
+ Bank_t contig_bank (Contig_t::NCODE);
+ BankStream_t contig_stream (Contig_t::NCODE);
+ if (! contig_stream.exists(globals.bank)){
+ cerr << "No contig account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ contig_bank.open(globals.bank, B_READ);
+ contig_stream.open(globals.bank, B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open contig account in bank " << globals.bank << ": " << endl << e << endl;
+ contig_bank.close();
+ contig_stream.close();
+ exit(1);
+ }
+
+ Graph g;
+ Contig_t ctg;
+ ContigEdge_t cte;
+ buildGraph(g, contig_stream, edge_stream, &ctg, &cte, globals.redundancy);
+ edge_stream.close();
+ contig_stream.close();
+
+ set<ID_t> repeats;
+#ifdef AMOS_HAVE_BOOST
+ if (globals.noPathRepeats == false) {
+ findShortestPathRepeats(g, contig_bank, repeats);
+ }
+ if (globals.noCoverageRepeats == false) {
+ findConnectedComponentRepeats(g, contig_bank, repeats);
+ }
+#endif //AMOS_HAVE_BOOST
+
+ for (set<ID_t>::iterator i = repeats.begin(); i != repeats.end(); i++) {
+ cout << *i << endl;
+ }
+ contig_bank.close();
+
+ return 0;
+}
diff --git a/src/Bambus/Bundler/OrientContigs.cc b/src/Bambus/Bundler/OrientContigs.cc
new file mode 100755
index 0000000..720243c
--- /dev/null
+++ b/src/Bambus/Bundler/OrientContigs.cc
@@ -0,0 +1,1831 @@
+//TODO: Fix How we compute positions (need to account for stddev when merging edges)
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <getopt.h>
+#include <math.h>
+#include <string>
+#include <map>
+#include <set>
+#include <queue>
+#include <iterator>
+#include <iostream>
+
+#include "Library_AMOS.hh"
+#include "Fragment_AMOS.hh"
+
+#include "datatypes_AMOS.hh"
+#include "Bank_AMOS.hh"
+#include "BankStream_AMOS.hh"
+
+#include "Contig_AMOS.hh"
+#include "ContigEdge_AMOS.hh"
+#include "Scaffold_AMOS.hh"
+#include "Motif_AMOS.hh"
+#include "ContigIterator_AMOS.hh"
+
+#include "Utilities_Bundler.hh"
+
+using namespace std;
+using namespace HASHMAP;
+using namespace AMOS;
+using namespace Bundler;
+
+// constants for maximum satisfied edge
+static const int32_t MAX_STDEV = 3;
+static const int32_t INITIAL_STDEV = 3;
+static const double STDEV_STEP_SIZE = 0.5;
+static const double MIN_OVL_FOR_MOTIF = 0.020;
+
+hash_map<ID_t, Size_t, hash<ID_t>, equal_to<ID_t> > *global_contig_len = NULL;
+struct ContigOrderCmp
+{
+ bool operator () (const AMOS::ID_t & a, const AMOS::ID_t & b)
+ {
+ assert(global_contig_len);
+ Size_t sizeA, sizeB;
+ sizeA = (*global_contig_len)[a];
+ sizeB = (*global_contig_len)[b];
+ return (sizeA >= sizeB);
+ }
+};
+
+struct config {
+ bool initAll;
+ bool compressMotifs;
+ bool doAgressiveScaffolding;
+ bool skipLowWeightEdges;
+ int32_t redundancy;
+ int32_t debug;
+ string bank;
+ int32_t maxOverlap; // disallow contig overlaps
+ set<ID_t> repeats; // repeat contigs to ignore (we ignore all links to them)
+};
+config globals;
+
+ID_t maxContig = 0;
+HASHMAP::hash_map<AMOS::ID_t, int32_t, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > *Bundler::cte2weight = NULL;
+
+void printHelpText() {
+ cerr <<
+ "\n"
+ "Determine contig order and orientation\n"
+ "\n"
+ "USAGE:\n"
+ "\n"
+ "OrientContigs -b[ank] <bank_name> [-all] [-noreduce] [-agressive] [-redundancy minLinks] [-repeats fileName] [-skip]\n"
+ "The -all option will force initialization of all contigs, including those that have no links to them, otherwise they remain uninitialized\n"
+ "The -noreduce option will turn off search for common motifs and recursively remove them, thus simplyfing the graph\n"
+ "The -agressive option will not mark edges that move a contig more than 3 STDEVS away as bad and will try to reconcile the positions\n"
+ "The -redundancy option specifies the minimum number of links between two contigs before they will be scaffolded\n"
+ "The -repeats option specifies a file containing a list of contig IIDs which are considered repeats and whose edges will be unused\n"
+ "The -skip option will skip edges that have too low a weight relative to the weights of the other edges connecting their respective nodes. \n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv) {
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"all", 0, 0, 'a'},
+ {"noreduce", 0, 0, 'n'},
+ {"agressive", 0, 0, 'A'},
+ {"redundancy", 1, 0, 'R'},
+ {"repeats", 1, 0, 'r'},
+ {"maxOverlap", 1, 0, 'o'},
+ {"skip", 0, 0, 's'},
+ {"debug", 1, 0, 'd'},
+ {0, 0, 0, 0}
+ };
+
+ globals.initAll = false;
+ globals.compressMotifs = true;
+ globals.doAgressiveScaffolding = false;
+ globals.debug = 1;
+ globals.redundancy = 0;
+ globals.skipLowWeightEdges = true;
+ globals.maxOverlap = -1;
+
+ int c;
+ ifstream repeatsFile;
+ ID_t repeatID;
+
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ break;
+ case 'b':
+ globals.bank = string(optarg);
+ break;
+ case 'a':
+ globals.initAll = true;
+ break;
+ case 'n':
+ globals.compressMotifs = false;
+ break;
+ case 'A':
+ globals.doAgressiveScaffolding = true;
+ break;
+ case 'R':
+ globals.redundancy = atoi(optarg);
+ if (globals.redundancy < 0) { globals.redundancy = 0; }
+ break;
+ case 'r':
+ // read file here
+ repeatsFile.open(optarg, ios::in);
+ if (!repeatsFile) {
+ cerr << "Can't open repeats file, will not mask repeats " << optarg << endl;
+ break;
+ }
+ while (!repeatsFile.eof()) {
+ repeatsFile >> repeatID;
+ globals.repeats.insert(repeatID);
+ }
+ repeatsFile.close();
+ break;
+ case 's':
+ globals.skipLowWeightEdges = false;
+ break;
+ case 'o':
+ globals.maxOverlap = atoi(optarg);
+ break;
+ case 'd':
+ globals.debug = atoi(optarg);
+ if (globals.debug < 0) { globals.debug = 0; }
+ break;
+ case '?':
+ return false;
+ }
+ }
+
+ // print summary
+ if (globals.debug >= 1) {
+ cerr << "Options summary:" << endl;
+ cerr << "Bank = \t" << globals.bank << endl;
+ cerr << "Redundancy = \t" << globals.redundancy << endl;
+ cerr << "InitAll = \t" << globals.initAll << endl;
+ cerr << "Compress = \t" << globals.compressMotifs << endl;
+ cerr << "AgressiveScf = \t" << globals.doAgressiveScaffolding << endl;
+ cerr << "Max Overlap = \t" << globals.maxOverlap << endl;
+ }
+
+ return true;
+} // GetOptions
+
+void swapContigs(ContigEdge_t & cte, bool isReversed) {
+ pair<ID_t, ID_t> ctgs;
+ ctgs.first = cte.getContigs().second;
+ ctgs.second = cte.getContigs().first;
+ cte.setContigs(ctgs);
+
+ // set what we expect to see, this is used to determine if we should modify the edge adjacency type when we swap the elements
+ bool expected = false;
+ if (cte.getAdjacency() == ContigEdge_t::ANTINORMAL || cte.getAdjacency() == ContigEdge_t::OUTIE) {
+ expected = true;
+ }
+
+ if (isReversed != expected) {
+ if (cte.getAdjacency() == ContigEdge_t::NORMAL) {
+ cte.setAdjacency(ContigEdge_t::ANTINORMAL);
+ } else if (cte.getAdjacency() == ContigEdge_t::ANTINORMAL) {
+ cte.setAdjacency(ContigEdge_t::NORMAL);
+ }
+ } else {
+ if (cte.getAdjacency() == ContigEdge_t::OUTIE) {
+ cte.setAdjacency(ContigEdge_t::INNIE);
+ } else if (cte.getAdjacency() == ContigEdge_t::INNIE) {
+ cte.setAdjacency(ContigEdge_t::OUTIE);
+ }
+ }
+}
+
+double getMaxWeightEdge(ID_t nodeID, hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<ID_t>, equal_to<ID_t> > &ctg2lnk, Bank_t &edge_bank) {
+ assert(cte2weight);
+ set<ID_t, EdgeWeightCmp>* s = ctg2lnk[nodeID];
+ if (s == NULL || s->size() == 0) {
+ return 0;
+ }
+ else {
+ for (set<ID_t, EdgeWeightCmp>::iterator i = s->begin(); i != s->end(); i++) {
+ if (!isBadEdge(*i, edge_bank)) {
+ return (*cte2weight)[(*i)];
+ }
+ }
+ return 0;
+ }
+}
+
+double getTotalWeightEdge(ID_t nodeID, hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<ID_t>, equal_to<ID_t> > &ctg2lnk, Bank_t &edge_bank) {
+ double total = 0;
+ assert(cte2weight);
+
+ set<ID_t, EdgeWeightCmp>* s = ctg2lnk[nodeID];
+ if (s == NULL || s->size() == 0) {
+ // do nothing, nothing to sum
+ }
+ else {
+ for (set<ID_t, EdgeWeightCmp>::iterator i = s->begin(); i != s->end(); i++) {
+ if (!isBadEdge(*i, edge_bank)) {
+ total += (*cte2weight)[(*i)];
+ }
+ }
+ }
+
+ return total;
+}
+
+LinkAdjacency_t getAdjacency(contigOrientation firstOrient, contigOrientation secondOrient, contigOrientation newFirst, contigOrientation newSecond, ContigEdge_t &cte) {
+ if (globals.debug >= 3) {
+ cerr << "We are orienting with first orient is " << firstOrient << " and new first is " << newFirst << " and second is " << secondOrient << " and second new is " << newSecond << endl;
+ }
+
+ if (firstOrient == newFirst && secondOrient == newSecond) {
+ if (globals.debug >= 3) { cerr << "Nothing changed, do nothing" << endl; }
+ return cte.getAdjacency();
+ }
+ else if (firstOrient == newFirst) {
+ if (globals.debug >= 3) { cerr << "First orientation didn't change second did " << endl; }
+ switch (cte.getAdjacency()) {
+ case ContigEdge_t::NORMAL:
+ return ContigEdge_t::INNIE;
+ case ContigEdge_t::ANTINORMAL:
+ return ContigEdge_t::OUTIE;
+ case ContigEdge_t::INNIE:
+ return ContigEdge_t::NORMAL;
+ case ContigEdge_t::OUTIE:
+ return ContigEdge_t::ANTINORMAL;
+ default:
+ cerr << "Unknown orientation " << cte.getAdjacency() << endl;
+ exit(1);
+ };
+ }
+ // the first orientation changed
+ else if (secondOrient == newSecond) {
+ if (globals.debug >= 3) { cerr << "Second orient didn't change first did" << endl; }
+ switch (cte.getAdjacency()) {
+ case ContigEdge_t::NORMAL:
+ return ContigEdge_t::OUTIE;
+ case ContigEdge_t::ANTINORMAL:
+ return ContigEdge_t::INNIE;
+ case ContigEdge_t::INNIE:
+ return ContigEdge_t::ANTINORMAL;
+ case ContigEdge_t::OUTIE:
+ return ContigEdge_t::NORMAL;
+ default:
+ cerr << "Unknown orientation " << cte.getAdjacency() << endl;
+ exit(1);
+ };
+ } else {
+ cerr << "BOTH CONTIG ORIENTATIONS CHANGED, THAT IS NOT POSSIBLE!" << endl;
+ assert(0);
+ }
+}
+
+contigOrientation getOrientationByAllEdges(ID_t nodeID,
+ hash_map<ID_t, contigOrientation, hash<ID_t>, equal_to<ID_t> > &ctg2ort,
+ hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<ID_t>, equal_to<ID_t> > &ctg2lnk,
+ Bank_t &edge_bank) {
+
+ set<ID_t, EdgeWeightCmp>* s = ctg2lnk[nodeID];
+ ContigEdge_t cte;
+ double orientWeights[2] = {0, 0};
+ double max = 0;
+ contigOrientation maxOrient = NONE;
+
+ if (s == NULL || s->size() == 0) {
+ // do nothing, nothing to sum
+ }
+ else {
+ for (set<ID_t, EdgeWeightCmp>::iterator i = s->begin(); i != s->end(); i++) {
+ edge_bank.fetch(*i, cte);
+
+ if (!isBadEdge(*i, edge_bank) && ctg2ort[getEdgeDestination(nodeID, cte)] != NONE) {
+ contigOrientation orient = getOrientation(ctg2ort[getEdgeDestination(nodeID, cte)], cte);
+ orientWeights[orient] += (*cte2weight)[(*i)];
+ if (orientWeights[orient] > max) {
+ max = orientWeights[orient];
+ maxOrient = orient;
+ }
+ }
+ }
+ }
+
+ return maxOrient;
+}
+
+int32_t computePosition(int32_t position, int32_t size) {
+ if (position == UNINITIALIZED) {
+ return UNINITIALIZED;
+ }
+
+ return position+size;
+}
+
+int32_t reconcilePositions(int32_t oldPosition, int32_t newPosition, double weight, SD_t stdev) {
+ if (newPosition == UNINITIALIZED) {
+ return oldPosition;
+ } else if (oldPosition == UNINITIALIZED) {
+ return newPosition;
+ } else {
+ int32_t adjustedPosition = (int32_t) round((oldPosition * (1 - weight)) + (newPosition * (weight)));
+ double dist = abs(adjustedPosition-newPosition);
+
+ if (dist > MAX_STDEV*stdev) {
+ if (globals.doAgressiveScaffolding == true) {
+ // this would move us too far, compromise and move to max dist away
+ adjustedPosition = adjustedPosition>newPosition ? newPosition + MAX_STDEV*stdev : newPosition + -1*MAX_STDEV*stdev;
+ } else {
+ return INVALID_EDGE;
+ }
+ }
+
+ return adjustedPosition;
+ }
+}
+
+edgeStatus isEdgeConsistent(
+ const Contig_t &first, const Contig_t &second,
+ const ContigEdge_t &cte,
+ hash_map<ID_t, contigOrientation, hash<ID_t>, equal_to<ID_t> >& ctg2ort,
+ hash_map<ID_t, int32_t, hash<ID_t>, equal_to<ID_t> >& ctg2srt,
+ hash_map<ID_t, ID_t, hash<ID_t>, equal_to<ID_t> >& ctg2scf)
+{
+ // make sure these nodes are in the same scaffold
+ if (ctg2scf[first.getIID()] != ctg2scf[second.getIID()] || ctg2scf[first.getIID()] == UNINITIALIZED) {
+ return BAD_SCF;
+ }
+
+ // check the orientation
+ if ((getOrientation(ctg2ort[first.getIID()], cte) != ctg2ort[second.getIID()]) || (getOrientation(ctg2ort[second.getIID()], cte) != ctg2ort[first.getIID()])) {
+ return BAD_ORI;
+ }
+
+ // now check the size
+ int32_t size = abs(adjustSizeBasedOnAdjacency(
+ cte.getAdjacency(),
+ cte.getSize(),
+ first.getLength(),
+ second.getLength(),
+ ctg2ort[first.getIID()],
+ ctg2ort[second.getIID()],
+ cte.getSD()/* * MAX_STDEV*/));
+ size -= abs(ctg2srt[second.getIID()] - ctg2srt[first.getIID()]);
+ if (abs(size) >= (MAX_STDEV * cte.getSD())) {
+ return BAD_DST;
+ }
+
+ return GOOD_EDGE;
+}
+
+edgeStatus isEdgeConsistent(
+ const Contig_t &first,
+ const Contig_t &second,
+ const ContigEdge_t &cte,
+ hash_map<ID_t, contigOrientation, hash<ID_t>, equal_to<ID_t> >& ctg2ort,
+ hash_map<ID_t, int32_t, hash<ID_t>, equal_to<ID_t> >& ctg2srt)
+{
+ hash_map<ID_t, ID_t, hash<ID_t>, equal_to<ID_t> > ctg2scf;
+ ctg2scf[first.getIID()] = ctg2scf[second.getIID()] = 1;
+
+ return isEdgeConsistent(first, second, cte, ctg2ort, ctg2srt, ctg2scf);
+}
+
+bool verifyEdgeStatus(Contig_t target, set<ID_t, EdgeWeightCmp>* s,
+ hash_map<ID_t, int32_t, hash<ID_t>, equal_to<ID_t> >& ctg2srt,
+ hash_map<ID_t, contigOrientation, hash<ID_t>, equal_to<ID_t> >& ctg2ort,
+ hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<ID_t>, equal_to<ID_t> > &ctg2lnk,
+ Bank_t &edge_bank, Bank_t &contig_bank)
+{
+ if (s == NULL || s->size() == 0) {
+ return true;
+ }
+
+ bool result = true;
+ ID_t myID = target.getIID();
+ ContigEdge_t cte;
+ Contig_t first;
+
+ for (set<ID_t, EdgeWeightCmp>::iterator i = s->begin(); i != s->end(); i++) {
+ edge_bank.fetch(*i, cte);
+ // only use incoming edges to position ourselves on the second pass
+ if (cte.getContigs().second != myID) {
+ continue;
+ }
+
+ if (!isBadEdge(*i, edge_bank) && ctg2srt[getEdgeDestination(myID, cte)] != UNINITIALIZED) {
+ // fetch the other node
+ contig_bank.fetch(getEdgeDestination(myID, cte), first);
+
+ result = result & (isEdgeConsistent(first, target, cte, ctg2ort, ctg2srt) == GOOD_EDGE);
+ if (result == false) {
+ break;
+ }
+ }
+ }
+
+ return result;
+}
+
+int32_t computeContigPositions(
+ Contig_t &first, Contig_t &second, ContigEdge_t &cte,
+ hash_map<ID_t, int32_t, hash<ID_t>, equal_to<ID_t> >& ctg2srt,
+ hash_map<ID_t, contigOrientation, hash<ID_t>, equal_to<ID_t> >& ctg2ort,
+ hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<ID_t>, equal_to<ID_t> > &ctg2lnk,
+ Bank_t &edge_bank, double initialSD) {
+
+ Range_t nullRange(0,0);
+ Range_t overlap(10,15);
+ double sd = initialSD;
+ double stepSize = STDEV_STEP_SIZE;
+
+ int32_t firstPosition = INVALID_EDGE;
+ int32_t secondPosition = INVALID_EDGE;
+ int32_t initialFirst = INVALID_EDGE;
+ int32_t initialSecond = INVALID_EDGE;
+
+ // try moving the node both backwards and forwards as much as we can
+ for (int i = FWD; i < REV+1; i++) {
+ double adjustment = (i == FWD ? cte.getSD() : -cte.getSD());
+
+ while (nullRange != overlap && sd <= MAX_STDEV) {
+ int32_t size = adjustSizeBasedOnAdjacency(
+ cte.getAdjacency(),
+ cte.getSize(),
+ first.getLength(),
+ second.getLength(),
+ ctg2ort[first.getIID()],
+ ctg2ort[second.getIID()],
+ adjustment * sd);
+
+ // compute the contig positions
+ firstPosition = computePosition(ctg2srt[second.getIID()], -size);
+ secondPosition = computePosition(ctg2srt[first.getIID()], size);
+
+ if (globals.debug >= 3) {
+ cerr << "Edge between " << cte.getContigs().first << " and " << cte.getContigs().second << " and size " << cte.getSize() << " and sd " << cte.getSD() << " of type " << cte.getAdjacency() << endl;
+ cerr << "The adjusted size of the edge is " << size << endl;
+ cerr << "I am positioning " << first.getIID() << " at " << firstPosition << " and " << second.getIID() << " at " << secondPosition << endl;
+ cerr << "Currently they are positioned at " << ctg2srt[first.getIID()] << " and " << ctg2srt[second.getIID()] << endl;
+ cerr << "The first orient is " << ctg2ort[first.getIID()] << " and second is " << ctg2ort[second.getIID()] << " and link type " << cte.getAdjacency() << endl;
+ }
+
+ /*
+ double weight = 0.5;
+ firstPosition = reconcilePositions(ctg2srt[first.getIID()], firstPosition, weight, cte.getSD());
+ secondPosition = reconcilePositions(ctg2srt[second.getIID()], secondPosition, weight, cte.getSD());
+ */
+ // go on its good reconcile it
+ double weight = (double)cte.getContigLinks().size()/getTotalWeightEdge(first.getIID(), ctg2lnk, edge_bank);
+ firstPosition = reconcilePositions(ctg2srt[first.getIID()], firstPosition, weight, cte.getSD());
+ weight = (double)cte.getContigLinks().size()/getTotalWeightEdge(second.getIID(), ctg2lnk, edge_bank);
+ secondPosition = reconcilePositions(ctg2srt[second.getIID()], secondPosition, weight, cte.getSD());
+ /*
+ The code above was meant to better reconcile positions between edges. That is if an edge had a higher weight, it
+ would contribute more to the position. However, this is still a problem if the node is initially positioned poorly.
+
+ Example in B. suis: node 6 places node 170 12 bases ahead of itself (using an edge with SD 971)
+ : node 86 tries to place node 170 approximately 1100 bases (reconciled to 600) but has only an SD of 95 so it cannot be satisfied
+ We need to incorporate other edge's SD when reconciling
+ */
+
+ // check for overlap
+ Range_t firstRange(firstPosition, first.getLength()+firstPosition);
+ Range_t secondRange(secondPosition, second.getLength()+secondPosition);
+ overlap = (firstRange & secondRange);
+
+ if (initialFirst == INVALID_EDGE) {
+ initialFirst = firstPosition;
+ initialSecond = secondPosition;
+ }
+
+ sd += stepSize;
+ }
+if (firstPosition != INVALID_EDGE && secondPosition != INVALID_EDGE) {
+break;
+}
+}
+
+ // if we never found a non-overlapping contig, just go back to what we started with
+ if (overlap != nullRange) {
+ firstPosition = initialFirst;
+ secondPosition = initialSecond;
+ }
+
+ if (firstPosition != INVALID_EDGE && secondPosition != INVALID_EDGE) {
+ ctg2srt[first.getIID()] = firstPosition;
+ ctg2srt[second.getIID()] = secondPosition;
+
+ if (globals.debug >= 3) {
+ cerr << "The position " << ctg2srt[second.getIID()] << " and the other position is " << ctg2srt[first.getIID()] << endl;
+ }
+
+ return 0;
+ } else {
+ return INVALID_EDGE;
+ }
+}
+
+
+int32_t computeContigPositionUsingAllEdges(ID_t myID,
+ hash_map<ID_t, int32_t, hash<ID_t>, equal_to<ID_t> >& ctg2srt,
+ hash_map<ID_t, contigOrientation, hash<ID_t>, equal_to<ID_t> >& ctg2ort,
+ hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<ID_t>, equal_to<ID_t> > &ctg2lnk,
+ Bank_t &edge_bank, Bank_t &contig_bank, double initialSD, bool allowBad) {
+ set<ID_t, EdgeWeightCmp>* s = ctg2lnk[myID];
+ ContigEdge_t cte;
+ Contig_t first;
+ Contig_t second;
+
+ contig_bank.fetch(myID, first);
+ if (s == NULL || s->size() == 0) {
+ // do nothing, nothing to sum
+ }
+ else {
+ // should we sort the edges by SD first and then weight?
+ int oldPosition = ctg2srt[myID];
+
+ // if we're making a second pass, reset our position and let it be computed again
+ if (allowBad == false) {
+ ctg2srt[myID] = UNINITIALIZED;
+ }
+
+ for (set<ID_t, EdgeWeightCmp>::iterator i = s->begin(); i != s->end(); i++) {
+ edge_bank.fetch(*i, cte);
+ // only use incoming edges to position ourselves on the second pass
+ if (allowBad == false && cte.getContigs().second != myID) {
+ continue;
+ }
+
+ if (!isBadEdge(*i, edge_bank) && ctg2srt[getEdgeDestination(myID, cte)] != UNINITIALIZED) {
+ // fetch the other node
+ contig_bank.fetch(getEdgeDestination(myID, cte), second);
+
+ int32_t result = (myID == cte.getContigs().first ? computeContigPositions(first, second, cte, ctg2srt, ctg2ort, ctg2lnk, edge_bank, initialSD) : computeContigPositions(second, first, cte, ctg2srt, ctg2ort, ctg2lnk, edge_bank, initialSD));
+
+ if (result == INVALID_EDGE) {
+ if (allowBad == false) {
+ ctg2srt[myID] = oldPosition;
+ break;
+ }
+
+ // mark edge as bad
+ cerr << "BAD DST EDGE: " << cte.getIID() << " between " << cte.getContigs().first << " and " << cte.getContigs().second << " with dist " << cte.getSize() << " and std " << cte.getSD() << " and the orientation is " << cte.getAdjacency() << endl;
+ // update the edge in the bank so it is marked bad
+ setEdgeStatus(cte, edge_bank, BAD_DST);
+ } else {
+if (allowBad == false) {
+ if (verifyEdgeStatus(first, s, ctg2srt, ctg2ort, ctg2lnk, edge_bank, contig_bank) == false) {
+cerr << "CANT MOVE NODES " << first.getIID() << " AND " << second.getIID() << " ANY CLOSER IT MESSES UP AN EDGE" << endl;
+ ctg2srt[myID] = oldPosition;
+ break;
+ }
+}
+
+
+
+ // update the edge in the bank so it is marked good
+ setEdgeStatus(cte, edge_bank, GOOD_EDGE);
+ }
+ }
+ }
+ if (ctg2srt[myID] == UNINITIALIZED) {
+ ctg2srt[myID] = oldPosition;
+ }
+ }
+}
+
+void addTile(std::vector<Tile_t> &tiles, ID_t contig, Tile_t &newTile) {
+ vector<Tile_t>::iterator it = tiles.begin();
+ bool insert = true;
+
+ for(; it < tiles.end(); ) {
+ if (it->source == contig) {
+ if ((*it) == newTile) {
+ insert = false;
+ it++;
+ } else {
+ it = tiles.erase(it);
+ }
+ } else {
+ it++;
+ }
+ }
+ if (insert) { tiles.push_back(newTile); }
+}
+
+bool validateNeighbors(ID_t node, set<ID_t, EdgeWeightCmp>& neighbors, Bank_t &edge_bank, set<ID_t> &mySet, validateNeighborType type, bool validateLowWeight) {
+ ContigEdge_t cte;
+
+ for (set<ID_t>::iterator i = neighbors.begin(); i != neighbors.end(); i++) {
+ edge_bank.fetch(*i, cte);
+ if (isBadEdge(cte)) {
+ if (cte.getStatus() != BAD_SKIP || !validateLowWeight) {
+ continue;
+ }
+ }
+
+ // process the node
+ if (((type == ALL || type == INCOMING)&& cte.getContigs().second == node) ||
+ ((type == ALL || type == OUTGOING) && cte.getContigs().first == node)) {
+ ID_t otherID = getEdgeDestination(node, cte);
+
+ set<ID_t>::iterator tIt = mySet.find(otherID);
+ if (tIt == mySet.end()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+ID_t findNeighborOfNeighbors(ID_t node, ID_t source, set<ID_t, EdgeWeightCmp>& neighbors, Bank_t &edge_bank, set<ID_t> &lowWeight, bool &validateLowWeight, uint32_t &numNeighbors) {
+ //uint32_t numNeighbors = 0;
+ ID_t sink = 0;
+ ContigEdge_t cte;
+ uint32_t badEdges = 0;
+
+ for (set<ID_t>::iterator i = neighbors.begin(); i != neighbors.end(); i++) {
+ edge_bank.fetch(*i, cte);
+ if (isBadEdge(cte)) {
+ if (cte.getStatus() == BAD_SKIP && cte.getContigs().first == node) {
+ badEdges++;
+ }
+ continue;
+ }
+
+ // continue by looking at the outgoing edge neighbors
+ if (cte.getContigs().first == node) {
+ ID_t otherID = getEdgeDestination(node, cte);
+
+ if (otherID != source && otherID != sink) {
+ numNeighbors++;
+ sink = otherID;
+ }
+ }
+ }
+
+ if (numNeighbors == 0 && badEdges > 0) {
+ // check if our low weight edges can let us restore the connection, if so do it
+ for (set<ID_t>::iterator i = neighbors.begin(); i != neighbors.end(); i++) {
+ edge_bank.fetch(*i, cte);
+ if (cte.getStatus() == BAD_SKIP) {
+ // continue by looking at the outgoing edge neighbors
+ if (cte.getContigs().first == node) {
+ lowWeight.insert(cte.getIID());
+ ID_t otherID = getEdgeDestination(node, cte);
+
+ if (otherID != source && otherID != sink) {
+ numNeighbors++;
+ sink = otherID;
+ }
+ }
+ }
+ }
+cerr << "USING BAD EDGES " << cte.getIID() << " FROM NODE " << node << " FOUND A SINK " << sink << " NEIGHBORS: " << numNeighbors << endl;
+ validateLowWeight = true;
+ }
+
+ if (numNeighbors == 1) {
+ return sink;
+ }
+ else {
+ return 0;
+ }
+}
+
+void updateEdge(
+ contigOrientation &newTileOrient,
+ Tile_t &newTile,
+ bool updateFirst,
+ ContigEdge_t &cte,
+ hash_map<ID_t, contigOrientation, hash<ID_t>, equal_to<ID_t> >& ctg2ort,
+ int32_t edgeAdjustment) {
+ ID_t oldID;
+
+ if (updateFirst) {
+ oldID = cte.getContigs().second;
+ } else {
+ oldID = cte.getContigs().first;
+ }
+
+ if (newTileOrient == NONE && !isBadEdge(cte)) {
+ newTileOrient = getOrientation(ctg2ort[oldID], cte);
+ ctg2ort[newTile.source] = newTileOrient;
+
+ if (newTileOrient == REV) {
+ newTile.range.swap();
+ }
+ if (globals.debug >= 3) {
+ cerr << "Oriented new tile " << newTile.source << " to be " << newTileOrient << endl;
+ }
+ }
+
+ pair<ID_t, ID_t> ctgs;
+ if (updateFirst) {
+ if (!isBadEdge(cte)) {
+ cte.setAdjacency(getAdjacency(ctg2ort[cte.getContigs().first], ctg2ort[cte.getContigs().second], newTileOrient, ctg2ort[oldID], cte));
+ }
+ ctgs.first = newTile.source;
+ ctgs.second = oldID;
+ } else {
+ if (!isBadEdge(cte)) {
+ cte.setAdjacency(getAdjacency(ctg2ort[cte.getContigs().first], ctg2ort[cte.getContigs().second], ctg2ort[oldID], newTileOrient, cte));
+ }
+ ctgs.first = oldID;
+ ctgs.second = newTile.source;
+ }
+ cte.setContigs(ctgs);
+
+ if (globals.debug >= 3) {
+ cerr << "UPDATING EDGE " << cte.getIID() << " FROM " << cte.getContigs().first << " AND " << cte.getContigs().second << " OF LEN " << cte.getSize() << " BY " << edgeAdjustment << endl;
+ }
+ cte.setSize(cte.getSize() - edgeAdjustment);
+ if (globals.debug >= 3) {
+ cerr << "ADJUSTED EDGE SIZE IS " << cte.getSize() << " AND SD " << cte.getSD() << endl;
+ cerr << "CTE IS UPDATED TO BE (" << cte.getContigs().first << ", " << cte.getContigs().second << ") orientation=" << cte.getAdjacency() << endl;
+ }
+}
+
+// replace a specified list of nodes by a single tiling
+double mergeContigs(ID_t scfIID,
+ ID_t newIID,
+ ID_t& maxEdgeIID,
+ set<ID_t> &toMerge, ID_t source,
+ vector<Tile_t> &tiles, vector<ID_t> &edges,
+ Bank_t &edge_bank, /*string comment,*/
+ hash_map<ID_t, contigOrientation, hash<ID_t>, equal_to<ID_t> >& ctg2ort,
+ hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<ID_t>, equal_to<ID_t> > &ctg2lnk,
+ vector<Motif_t> &motifs,
+ Status_t status) {
+ hash_map<Pos_t, uint32_t, hash<Pos_t>, equal_to<Pos_t> > newTileGapIndex;
+ Motif_t motifScaffold;
+ vector<Tile_t> motifTiling;
+ vector<ID_t> motifEdges;
+
+ Tile_t newTile;
+ newTile.source = newIID;
+ newTile.source_type = Motif_t::NCODE;
+ newTile.offset = UNINITIALIZED;
+ newTile.range.begin = 0;
+ newTile.range.end = 0;
+ //newTile.comment = comment;
+
+ hash_map<ID_t, uint32_t, hash<ID_t>, equal_to<ID_t> > tileLayout;
+ hash_map<ID_t, uint32_t, hash<ID_t>, equal_to<ID_t> > tileLength;
+
+ uint32_t totalOverlap = 0;
+ uint32_t lastEnd = 0;
+ for (vector<Tile_t>::iterator i = tiles.begin(); i < tiles.end(); ) {
+ set<ID_t>::iterator it = toMerge.find(i->source);
+
+ if (it != toMerge.end()) {
+ if (globals.debug >= 3) {
+ cerr << "MERGING TO CREATE A NEW TILE FROM " << i->source << " " << i->range.begin << ", " << i->range.end << " AND OFFSET " << i->offset << " AND ORIENT IS " << i->range.isReverse() << endl;
+ }
+ int32_t gapSize = 0;
+ bool contained = false;
+
+ // save this tile in the motif scaffold
+ motifTiling.push_back(*i);
+ if (lastEnd != 0) {
+ // new low contig
+ if (i->offset < newTile.offset) {
+ uint32_t currEnd = i->offset + i->range.getLength();
+ if (currEnd > newTile.offset + newTile.range.getLength()) {
+ currEnd = newTile.offset + newTile.range.getLength();
+ }
+ gapSize = newTile.offset - currEnd;
+ } else if ((i->offset + i->range.getLength()) < (newTile.offset + newTile.range.getLength())) {
+ // contained addition
+ gapSize = 0 - i->range.getLength();
+ contained = true;
+ } else {
+ // normal case
+ gapSize = i->offset - lastEnd;
+ }
+ if (globals.debug >= 3) { cerr << "WHILE MERGING LAST END IS " << lastEnd << " AND OFFSET IS " << i->offset << " AND GAP SIZE IS " << gapSize << endl; }
+ }
+ // count total overlaps between tiles
+ if (gapSize < 0) {
+ totalOverlap += (-1 * gapSize);
+ } else {
+ uint32_t offset = (i->offset < newTile.offset ? (i->offset + i->range.getLength()) : (newTile.offset + newTile.range.end));
+ for (int gapUpdate = 0; gapUpdate < gapSize - 1; gapUpdate++) {
+ newTileGapIndex[offset + gapUpdate] = 1;
+ }
+ if (globals.debug >= 3) { cerr << "ADDED GAP FROM " << offset << " TO " << (offset + gapSize - 1) << endl; }
+ }
+ if (globals.debug >= 3) { cerr << "TOTAL OVERLAP IS " << totalOverlap << " WHILE PROCESSING CONTIG " << i->source << " AT POSITION " << i->offset << " CURR TILE IS " << newTile.offset << " LEN " << newTile.range.getLength() << endl; }
+ // update gap indexes
+ hash_map<Pos_t, uint32_t, hash<Pos_t>, equal_to<Pos_t> > gapIndex;
+ for (vector<Pos_t>::iterator tileGap = i->gaps.begin(); tileGap < i->gaps.end(); tileGap++) {
+ gapIndex[((*tileGap) + i->offset)] = 1;
+ if (((*tileGap) + i->offset) < lastEnd && (((*tileGap) + i->offset) > newTile.offset)) {
+ totalOverlap--;
+ }
+ }
+ if (globals.debug >= 3) {cerr << "AFTER ADJUST FOR GAPS IN INPUT CONTIG WITH " << i->gaps.size() << " THE TOTAL IS " << totalOverlap << endl; }
+ for (hash_map<Pos_t, uint32_t, hash<Pos_t>, equal_to<Pos_t> >::iterator newTileGap = newTileGapIndex.begin(); newTileGap != newTileGapIndex.end(); newTileGap++) {
+ if (newTileGap->second == 1 && (newTileGap->first > i->offset) && (newTileGap->first < i->offset + i->range.getLength())) {
+ if (gapIndex[newTileGap->first] == 0) {
+ totalOverlap--;
+ }
+ }
+ }
+ if (globals.debug >= 3) { cerr << "AFTER ADJUST FOR GAPS IN NEWTILE CONTIG WITH " << newTileGapIndex.size() << " THE TOTAL IS " << totalOverlap << endl; }
+ for (int tileIndex = 0; tileIndex < i->range.getLength(); tileIndex++) {
+ if (newTileGapIndex[i->offset + tileIndex] == 1) {
+ if (gapIndex[i->offset + tileIndex] == 0) {
+ newTileGapIndex[i->offset + tileIndex] = 0;
+ }
+ } else {
+ if (gapIndex[i->offset + tileIndex] == 1) {
+ newTileGapIndex[i->offset + tileIndex] = 1;
+ }
+ }
+ }
+ if (globals.debug >= 3) { cerr << "AFTER UPDATE FOR GAPS IN NEW CONTIG THE COUNT IS " << newTileGapIndex.size() << endl; }
+ // update the size of the tile we're creating
+ if (!contained) {
+ newTile.range.end += i->range.getHi();
+ newTile.range.end += gapSize;
+ }
+ if (newTile.offset > i->offset || newTile.offset == UNINITIALIZED) {
+ // when the offset is moved to a new node, all the other nodes are now that much further from the start of the new contig
+ if (newTile.offset != UNINITIALIZED) {
+ for (hash_map<ID_t, uint32_t, hash<ID_t>, equal_to<ID_t> >::iterator t = tileLayout.begin(); t != tileLayout.end() ; t++) {
+ t->second += (newTile.offset - i->offset);
+ }
+ }
+ newTile.offset = i->offset;
+ }
+ lastEnd = newTile.offset + newTile.range.getLength();
+ tileLayout[i->source] = i->offset - newTile.offset;
+ tileLength[i->source] = i->range.getLength();
+
+ if (globals.debug >= 3) {
+ cerr << "NEW TILE IS NOW " << newTile.source << " " << newTile.range.begin << ", " << newTile.range.end << " AND OFFSET " << newTile.offset << " AND ORIENT IS " << newTile.range.isReverse() << endl;
+ }
+ i = tiles.erase(i);
+ } else {
+ i++;
+ }
+ }
+ // finally update gaps in the new tile
+ for (hash_map<Pos_t, uint32_t, hash<Pos_t>, equal_to<Pos_t> >::iterator newTileGap = newTileGapIndex.begin(); newTileGap != newTileGapIndex.end(); newTileGap++) {
+ if (newTileGap->second == 1) {
+ if (newTileGap->first - newTile.offset < 0) {
+ cerr << "ERROR: NEW TILE IS NEGATIVE WHILE CREATING " << newTile.source << " GAP POSITION " << newTileGap->first << endl;
+ exit(1);
+ }
+ newTile.gaps.push_back(newTileGap->first - newTile.offset);
+ }
+ }
+
+ contigOrientation newTileOrient = NONE;
+
+ // now update the edges
+ set<ID_t, EdgeWeightCmp>* s = ctg2lnk[newTile.source];
+ if (s == NULL) { s = new set<ID_t, EdgeWeightCmp>();}
+ for (vector<ID_t>::iterator i = edges.begin(); i < edges.end(); ) {
+ ContigEdge_t cte;
+ edge_bank.fetch(*i, cte);
+ bool skipEdge = true;
+
+ // while we're at it, orient by the first edge we see to the source contig since they should all be consistent edges
+ if (globals.debug >= 3) {
+ cerr << "**EDGE: " << cte.getIID() << ": " << cte.getContigs().first << "->" << cte.getContigs().second << " AND THE ADJACENCY IS " << cte.getAdjacency() << endl;
+ }
+ // store an old copy of this edge
+ ContigEdge_t oldEdge = cte;
+ std::ostringstream stream;
+ stream << maxEdgeIID++;
+ oldEdge.setIID(maxEdgeIID);
+ oldEdge.setEID(stream.str());
+cerr << "CREATED COPY OF EDGE " << cte.getIID() << " WITH ID " << oldEdge.getIID() << " FROM " << edge_bank.getIDMapSize() << endl;
+ set<ID_t>::iterator it = toMerge.find(cte.getContigs().first);
+ if (it != toMerge.end()) {
+ // since we're the first node, adjust the size based on our distance to the end of the new contig
+ int32_t edgeAdjustment = (newTile.range.getLength() - (tileLayout[cte.getContigs().first] + tileLength[cte.getContigs().first]));
+ updateEdge(newTileOrient, newTile, true, cte, ctg2ort, edgeAdjustment);
+ skipEdge = false;
+ }
+ it = toMerge.find(cte.getContigs().second);
+ if (it != toMerge.end()) {
+ // since we're the second node, adjust the size based on our distance to the front of the new contig
+ int32_t edgeAdjustment = tileLayout[cte.getContigs().first];
+ updateEdge(newTileOrient, newTile, false, cte, ctg2ort, edgeAdjustment);
+ skipEdge = false;
+ }
+
+ if (skipEdge == false) {
+ edge_bank.append(oldEdge);
+ motifEdges.push_back(oldEdge.getIID());
+ if (cte.getContigs().first == cte.getContigs().second) {
+ if (globals.debug >= 3) { cerr << "REMOVING EDGE " << (*i) << endl; }
+ edge_bank.remove(*i);
+ i = edges.erase(i);
+ } else {
+ if (globals.debug >= 3) { cerr << "UPDATING EDGE " << (*i) << endl; }
+ edge_bank.replace(*i, cte);
+
+ // update edge links for the new node we created
+ s->insert(cte.getIID());
+ i++;
+ }
+ } else {
+ i++;
+ }
+ }
+ ctg2lnk[newTile.source] = s;
+
+ std::ostringstream result;
+ result << newIID;
+
+ motifScaffold.setStatus(status);
+ motifScaffold.setIID(newIID);
+ motifScaffold.setScf(scfIID);
+ motifScaffold.setEID(result.str());
+ motifScaffold.setContigTiling(motifTiling);
+ motifScaffold.setContigEdges(motifEdges);
+ // reset type if necessary
+ if ((double)totalOverlap / newTile.range.getLength() <= MIN_OVL_FOR_MOTIF) {
+ motifScaffold.setStatus(LINEAR_SCAFFOLD);
+ }
+
+ motifs.push_back(motifScaffold);
+
+ addTile(tiles, newIID, newTile);
+ return (double)totalOverlap / newTile.range.getLength();
+}
+
+void validateMotif(set<ID_t> &t, ID_t source, ID_t sink, bool validateLowWeight, Bank_t &edge_bank, hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<ID_t>, equal_to<ID_t> > &ctg2lnk) {
+ // double check that all the nodes have no incoming/outgoing edges outside the set
+ // note that for the source we can have incoming edges and for outgoing we can have outgoing
+ for (set<ID_t>::iterator k = t.begin(); k != t.end(); k++) {
+ bool validated = false;
+
+ if (*k != 0) {
+ if (*k == source) {
+ if (globals.debug >= 3) { cerr << "Validating source " << *k << endl; }
+ validated = validateNeighbors(source, *ctg2lnk[source], edge_bank, t, OUTGOING, validateLowWeight);
+ } else if (*k == sink) {
+ if (globals.debug >= 3) { cerr << "Validating sink " << *k << endl; }
+ validated = validateNeighbors(sink, *ctg2lnk[sink], edge_bank, t, INCOMING, validateLowWeight);
+ } else {
+ if (globals.debug >= 3) { cerr << "Validating node " << *k << endl; }
+ validated = validateNeighbors(*k, *ctg2lnk[*k], edge_bank, t, ALL, validateLowWeight);
+ }
+ if (validated == false) {
+ if (globals.debug >= 3) {
+ cerr << "The source is " << source << " and sink is " << sink << endl;
+ cerr << "GIVING UP ON SET ****: ";
+ for (set<ID_t>::iterator k = t.begin(); k != t.end(); k++) {
+ cerr << *k << " ";
+ }
+ cerr << endl;
+ }
+ t.clear();
+ break;
+ }
+ }
+ }
+}
+
+void reduceGraph(std::vector<Scaffold_t>& scaffs,
+ Bank_t &contig_bank,
+ Bank_t &edge_bank,
+ hash_map<ID_t, contigOrientation, hash<ID_t>, equal_to<ID_t> >& ctg2ort,
+ hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<ID_t>, equal_to<ID_t> > &ctg2lnk,
+ vector<Motif_t> &motifs) {
+ ID_t maxIID = contig_bank.getMaxIID()+1;
+ ID_t maxEdgeIID = edge_bank.getMaxIID()+1;
+ uint32_t numUpdated = 0;
+ uint32_t itNum = 0;
+
+ // first reduce all straight paths
+ {
+ hash_map<ID_t, bool, hash<ID_t>, equal_to<ID_t> > visited;
+ numUpdated = 0;
+ itNum++;
+ if (globals.debug >= 1) { cerr << "BEGINNING PATH ITERATION #" << itNum << endl; }
+
+ for(vector<Scaffold_t>::iterator s = scaffs.begin(); s < scaffs.end(); s++) {
+ if (globals.debug >= 1) { cerr << "PROCESSING SCAFFOLD " << s->getIID() << endl; }
+ for (vector<Tile_t>::iterator i = s->getContigTiling().begin(); i < s->getContigTiling().end(); ) {
+ if (visited[i->source] == false) {
+ if (globals.debug >= 1) { cerr << "PROCESSING CONTIG " << i->source << endl; }
+ visited[i->source] = true;
+ ID_t prev = UNINITIALIZED;
+ ID_t curr = i->source;
+ ID_t next = UNINITIALIZED;
+
+ set<ID_t> t;
+ bool extendPath = true;
+
+ while (extendPath) {
+ uint32_t numOut = 0;
+ uint32_t numIn = 0;
+ for (set<ID_t>::iterator j = ctg2lnk[curr]->begin(); j != ctg2lnk[curr]->end(); j++) {
+ ContigEdge_t cte;
+ edge_bank.fetch(*j, cte);
+
+ if (isBadEdge(cte)) { continue; }
+ if (cte.getContigs().first == curr) {
+ next = cte.getContigs().second;
+ numOut++;
+ } else if (cte.getContigs().second == curr) {
+ if (prev != UNINITIALIZED && prev != cte.getContigs().first) {
+ numIn++;
+ }
+ }
+ }
+ extendPath = false;
+ if (numIn == 0) {
+ t.insert(curr);
+
+ if (numOut == 1) {
+ prev = curr;
+ curr = next;
+ extendPath = true;
+ }
+ } else {
+ // go back one since the current wasn't included in our path
+ curr = prev;
+ }
+ }
+ if (globals.debug >= 1) {
+ cerr << "TESTING LINEAR PATH : ";
+ for (set<ID_t>::iterator k = t.begin(); k != t.end(); k++) {
+ cerr << *k << " ";
+ }
+ cerr << endl;
+ }
+ validateMotif(t, i->source, curr, false, edge_bank, ctg2lnk);
+ if (t.size() > 1) {
+ if (globals.debug >= 1) { cerr << "COLLAPSING LINEAR PATH : " << endl; }
+ mergeContigs(s->getIID(), maxIID++, maxEdgeIID, t, i->source, s->getContigTiling(), s->getContigEdges(), edge_bank, ctg2ort, ctg2lnk, motifs, LINEAR_SCAFFOLD);
+ } else {
+ i++;
+ }
+ }
+ }
+ }
+ }
+
+ // now that linear paths are done, look for more interesting motifs
+ do {
+ hash_map<ID_t, bool, hash<ID_t>, equal_to<ID_t> > visited;
+ numUpdated = 0;
+ itNum++;
+ if (globals.debug >= 1) { cerr << "BEGINNING COMPRESSION ITERATION #" << itNum << endl; }
+
+ for(vector<Scaffold_t>::iterator s = scaffs.begin(); s < scaffs.end(); s++) {
+ if (globals.debug >= 1) { cerr << "PROCESSING SCAFFOLD " << s->getIID() << endl; }
+ for (vector<Tile_t>::iterator i = s->getContigTiling().begin(); i < s->getContigTiling().end(); ) {
+ if (visited[i->source] == false) {
+ if (globals.debug >= 1) { cerr << "PROCESSING CONTIG " << i->source << endl; }
+ visited[i->source] = true;
+
+ ID_t sink = 0;
+ //uint32_t numNeighbors;
+ set<ID_t> t;
+ std::stringstream oss;
+ uint32_t badEdges = 0;
+ oss << i->source << " ";
+
+ bool redoWithBadEdges = false;
+ bool validateSkippedEdges = false;
+ set<ID_t> skippedEdges;
+ set<ID_t> skippedTwoDeepEdges;
+
+ for (int redo = 0; redo < 1 || (redo < 2 && redoWithBadEdges); redo++) {
+ // see if we can find a motif
+ // the function below is allowed to use low weight edges we eliminated to try to make the motif
+ // if it uses low weight edges, all low weight edges in the set must still be a motif and will be reset to good
+ for (set<ID_t>::iterator j = ctg2lnk[i->source]->begin(); j != ctg2lnk[i->source]->end(); j++) {
+ ContigEdge_t cte;
+ edge_bank.fetch(*j, cte);
+
+ if (isBadEdge(cte)) {
+ if (cte.getStatus() == BAD_SKIP && cte.getContigs().first == i->source) {
+ badEdges++;
+ if (redoWithBadEdges == false) {
+ continue;
+ }
+ skippedEdges.insert(cte.getIID());
+ } else {
+ continue;
+ }
+ }
+
+ if (cte.getContigs().first == i->source) {
+ // 2-deep motif code
+ ID_t neighbor = 0;
+
+ for (set<ID_t>::iterator k = ctg2lnk[cte.getContigs().second]->begin(); k != ctg2lnk[cte.getContigs().second]->end(); k++) {
+ ContigEdge_t nextCte;
+ edge_bank.fetch(*k, nextCte);
+ if (isBadEdge(nextCte)) {
+ if (nextCte.getStatus() == BAD_SKIP && nextCte.getContigs().first == i->source) {
+ badEdges++;
+ if (redoWithBadEdges == false) {
+ continue;
+ }
+ skippedTwoDeepEdges.insert(nextCte.getIID());
+ } else {
+ continue;
+ }
+ }
+
+ // if we're the outgoing edge of the first neighbors
+ if (nextCte.getContigs().first == cte.getContigs().second) {
+ uint32_t numNeighbors = 0;
+ ID_t otherID = getEdgeDestination(cte.getContigs().second, nextCte);
+ neighbor = findNeighborOfNeighbors(otherID, cte.getContigs().second, *ctg2lnk[otherID], edge_bank, skippedEdges, validateSkippedEdges, numNeighbors);
+
+// hack to get nodes that dead-end as motifs
+ if (neighbor != 0 || (neighbor == 0 && numNeighbors == 0)) {
+ if (neighbor == sink || sink == 0) {
+ sink = neighbor;
+
+ t.insert(sink);
+ t.insert(otherID);
+ t.insert(cte.getContigs().second);
+ t.insert(i->source);
+
+ oss << otherID << " ";
+ }
+ }
+ }
+ }
+ //*/
+
+ /* Original motif code
+ if (globals.debug >= 3) { cerr << "Checking neighbor for edge " << cte.getContigs().first << " to " << cte.getContigs().second << endl; }
+ ID_t otherID = getEdgeDestination(i->source, cte);
+ ID_t neighbor = findNeighborOfNeighbors(otherID, i->source, *ctg2lnk[otherID], edge_bank, skippedEdges, validateSkippedEdges);
+
+ if (neighbor != 0) {
+ if (globals.debug >= 3) { cerr << "Found neighbor " << neighbor << " and sink is " << sink << endl; }
+ if (neighbor == sink || sink == 0) {
+ sink = neighbor;
+
+ t.insert(sink);
+ t.insert(otherID);
+ t.insert(i->source);
+
+ oss << otherID << " ";
+ }
+ }
+
+ */
+ }
+ }
+ oss << sink << " ";
+ validateMotif(t, i->source, sink, validateSkippedEdges, edge_bank, ctg2lnk);
+
+ // try 1-deep motifs
+ if (t.size() == 0) {
+ oss.clear();
+ oss << i->source << " ";
+ ID_t neighbor = 0;
+ sink = 0;
+ skippedTwoDeepEdges.clear();
+
+ // see if we can find a motif
+ // the function below is allowed to use low weight edges we eliminated to try to make the motif
+ // if it uses low weight edges, all low weight edges in the set must still be a motif and will be reset to good
+ for (set<ID_t>::iterator j = ctg2lnk[i->source]->begin(); j != ctg2lnk[i->source]->end(); j++) {
+ ContigEdge_t cte;
+ edge_bank.fetch(*j, cte);
+
+ if (isBadEdge(cte)) {
+ if (cte.getStatus() == BAD_SKIP && cte.getContigs().first == i->source) {
+ badEdges++;
+ if (redoWithBadEdges == false) {
+ continue;
+ }
+ skippedEdges.insert(cte.getIID());
+ } else {
+ continue;
+ }
+ }
+
+ if (cte.getContigs().first == i->source) {
+ ID_t otherID = getEdgeDestination(i->source, cte);
+ uint32_t numNeighbors = 0;
+
+ neighbor = findNeighborOfNeighbors(otherID, i->source, *ctg2lnk[otherID], edge_bank, skippedEdges, validateSkippedEdges, numNeighbors);
+ if (neighbor != 0 || (neighbor == 0 && numNeighbors == 0)) {
+ if (neighbor == sink || sink == 0) {
+ sink = neighbor;
+
+ t.insert(sink);
+ t.insert(otherID);
+ t.insert(i->source);
+
+ oss << otherID << " ";
+ }
+ }
+ }
+ }
+ } else {
+ skippedEdges.insert(skippedTwoDeepEdges.begin(), skippedTwoDeepEdges.end());
+ }
+ oss << sink << " ";
+ validateMotif(t, i->source, sink, validateSkippedEdges, edge_bank, ctg2lnk);
+
+ if (t.size() == 0 && badEdges != 0) {
+ redoWithBadEdges = validateSkippedEdges = true;
+ }
+ }
+ if (t.size() > 0) {
+ if (globals.debug >= 1) {
+ cerr << "SET OF : ";
+ for (set<ID_t>::iterator k = t.begin(); k != t.end(); k++) {
+ cerr << *k << " ";
+ }
+ }
+ // merge the contigs, if we were able to rescue low-weight edges, mark them
+ numUpdated++;
+ if (validateSkippedEdges) { resetEdges(edge_bank, skippedEdges, BAD_SKIP); }
+ double overlapInMotif = mergeContigs(s->getIID(), maxIID++, maxEdgeIID, t, i->source, s->getContigTiling(), s->getContigEdges(), edge_bank, ctg2ort, ctg2lnk, motifs, MOTIF_SCAFFOLD);
+
+ if (globals.debug >= 1) {
+ cerr << " WITH OVERLAP " << overlapInMotif << " HAS BEEN REPLACED WITH SINGLE NODE " << (maxIID-1) << endl;
+ }
+ } else {
+ i++;
+ }
+ }
+ }
+ }
+ if (globals.debug >= 1) { cerr << "END COMPRESSION ITERATION #" << itNum << " UPDATED: " << numUpdated << endl; }
+ } while (numUpdated != 0);
+}
+
+void sortContigs(std::vector<Scaffold_t>& scaffs, Bank_t &contig_bank, Bank_t &edge_bank) {
+ for(vector<Scaffold_t>::iterator s = scaffs.begin(); s < scaffs.end(); s++) {
+ Pos_t adjust = UNINITIALIZED;
+ hash_map<ID_t, Pos_t, hash<ID_t>, equal_to<ID_t> > locations;
+ hash_map<ID_t, bool, hash<ID_t>, equal_to<ID_t> > orientations;
+
+ sort(s->getContigTiling().begin(), s->getContigTiling().end(), TileOrderCmp());
+ for (vector<Tile_t>::iterator i = s->getContigTiling().begin(); i < s->getContigTiling().end(); i++) {
+ // if the offset is not 0, make it 0 and adjust all the other positions, otherwise, do nothing
+ if (adjust == UNINITIALIZED) {
+ if (i->offset == 0) { // do nothing
+ adjust = 0;
+ }
+ else {
+ adjust = 0 - i->offset;
+ }
+ }
+ i->offset += adjust;
+ locations[i->source] = i->offset;
+ orientations[i->source] = i->range.isReverse();
+ }
+
+ // here adjust the edges too so they all point from current to next since it is earlier in scaff
+ for (vector<ID_t>::iterator i = s->getContigEdges().begin(); i < s->getContigEdges().end(); i++) {
+ ContigEdge_t cte;
+ edge_bank.fetch(*i, cte);
+
+ // reverse edge if necessary
+ if (locations[cte.getContigs().second] <= locations[cte.getContigs().first]) {
+ swapContigs(cte, orientations[cte.getContigs().first]);
+ edge_bank.replace(*i, cte);
+ }
+ }
+ }
+}
+
+void compressGaps(std::vector<Scaffold_t> &scaffs,
+ hash_map<ID_t, int32_t, hash<ID_t>, equal_to<ID_t> >& ctg2srt,
+ hash_map<ID_t, contigOrientation, hash<ID_t>, equal_to<ID_t> >& ctg2ort,
+ hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<ID_t>, equal_to<ID_t> > &ctg2lnk,
+ Bank_t &edge_bank, Bank_t &contig_bank) {
+
+ sortContigs(scaffs, contig_bank, edge_bank);
+ for(vector<Scaffold_t>::iterator s = scaffs.begin(); s < scaffs.end(); s++) {
+ Pos_t adjust = UNINITIALIZED;
+ hash_map<ID_t, Pos_t, hash<ID_t>, equal_to<ID_t> > locations;
+ hash_map<ID_t, bool, hash<ID_t>, equal_to<ID_t> > orientations;
+
+ sort(s->getContigTiling().begin(), s->getContigTiling().end(), TileOrderCmp());
+ for (vector<Tile_t>::iterator i = s->getContigTiling().begin(); i < s->getContigTiling().end(); i++) {
+ int32_t pos = ctg2srt[i->source];
+ double sd = 0;
+ while (pos == ctg2srt[i->source] && sd < INITIAL_STDEV) {
+ computeContigPositionUsingAllEdges(i->source, ctg2srt, ctg2ort, ctg2lnk, edge_bank, contig_bank, sd, false);
+ sd++;
+ }
+ i->offset = (i->range.isReverse() ? ctg2srt[i->source] - i->range.getLength() : ctg2srt[i->source]);
+ }
+ }
+}
+
+//TODO: Store scaffolds in bank as well as new contigs (as scaffolds), split this code into several sections
+// Add class that holds the data structure we use in memory so it's not always passed around
+// Also, keep tiles on disk rather than in memory
+// RepeatFinder : find repeats and mark the contigs in the bank rather than outputting their list
+// Scaffolder : build the initial scaffolds and save them (after topological sort and sorting)
+// Reducer : find patterns to reduce in the build scaffolds
+// Avoid making destructive changes to the bank as a result of these operations
+
+int main(int argc, char *argv[]) {
+ if (!GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ if (globals.bank == ""){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ Bank_t edge_bank (ContigEdge_t::NCODE);
+ if (! edge_bank.exists(globals.bank)){
+ cerr << "No edge account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ edge_bank.open(globals.bank, B_READ |B_WRITE, 0, false);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open edge account in bank " << globals.bank << ": " << endl << e << endl;
+ edge_bank.close();
+ exit(1);
+ }
+
+ Bank_t contig_bank (Contig_t::NCODE);
+ BankStream_t contig_stream (Contig_t::NCODE);
+ if (! contig_stream.exists(globals.bank)){
+ cerr << "No contig account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ contig_bank.open(globals.bank, B_READ);
+ contig_stream.open(globals.bank, B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open contig account in bank " << globals.bank << ": " << endl << e << endl;
+ contig_bank.close();
+ contig_stream.close();
+ exit(1);
+ }
+
+ BankStream_t motif_stream (Motif_t::NCODE);
+ try {
+ if (! motif_stream.exists(globals.bank)){
+ motif_stream.create(globals.bank);
+ }
+ motif_stream.open(globals.bank, B_READ | B_WRITE);
+ motif_stream.clearCurrentVersion();
+ } catch (Exception_t & e) {
+ cerr << "Failed to open motif account in bank " << globals.bank << ": " << endl << e << endl;
+ motif_stream.close();
+ exit(1);
+ }
+
+ BankStream_t scaff_stream (Scaffold_t::NCODE);
+ if (!scaff_stream.exists(globals.bank)) {
+ scaff_stream.create(globals.bank);
+ }
+ try {
+ scaff_stream.open(globals.bank, B_READ | B_WRITE);
+ scaff_stream.clearCurrentVersion();
+ } catch (Exception_t & e) {
+ cerr << "Failed to open scaffold account in bank " << globals.bank << ": " << endl << e << endl;
+ scaff_stream.close();
+ exit(1);
+ }
+
+ // initialize contig data structures
+ Contig_t ctg;
+ hash_map<ID_t, Size_t, hash<ID_t>, equal_to<ID_t> > ctg2len; // map from contig to length
+ hash_map<ID_t, contigOrientation, hash<ID_t>, equal_to<ID_t> > ctg2ort; // map from contig to orientation
+ hash_map<ID_t, int32_t, hash<ID_t>, equal_to<ID_t> > ctg2srt; // map from contig to start position
+ hash_map<ID_t, ID_t, hash<ID_t>, equal_to<ID_t> > ctg2scf; //quick lookup for which scaffold a contig belongs to
+ vector<Motif_t> motifs; // scaffold structures representing the simplified motifs
+ vector<ID_t> contigProcessingOrder;
+
+ // initialize position and orientation
+ while (contig_stream >> ctg) {
+ ctg2ort[ctg.getIID()] = NONE;
+ ctg2srt[ctg.getIID()] = UNINITIALIZED;
+ ctg2scf[ctg.getIID()] = UNINITIALIZED;
+ ctg2len[ctg.getIID()] = ctg.getLength();
+ contigProcessingOrder.push_back(ctg.getIID());
+ }
+
+ // initialize scaffold data structure
+ ID_t scfIID = 1;
+ std::vector<Scaffold_t> scaffs;
+
+ // initialize edge data structures
+ hash_map<ID_t, bool, hash<ID_t>, equal_to<ID_t> > visitedEdges;
+ hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<ID_t>, equal_to<ID_t> > ctg2lnk; // map from contig to edges
+ cte2weight = new hash_map<ID_t, int32_t, hash<ID_t>, equal_to<ID_t> >();
+
+ uint32_t badCount = 0, goodCount = 0;
+ ContigEdge_t cte;
+
+ // try to pick a redundancy cutoff
+ double mean = 0;
+ double count = 0;
+ if (globals.redundancy == 0) {
+ for (AMOS::IDMap_t::const_iterator ci = edge_bank.getIDMap().begin(); ci; ci++) {
+ edge_bank.fetch(ci->iid, cte);
+
+ if (isBadEdge(cte)) {
+ continue;
+ }
+ if (globals.maxOverlap > 0 && cte.getSize() + globals.maxOverlap < 0 && cte.getSize() < globals.maxOverlap) {
+ continue;
+ }
+ if (globals.repeats.find(cte.getContigs().first) != globals.repeats.end() ||
+ globals.repeats.find(cte.getContigs().second) != globals.repeats.end()) {
+ continue;
+ }
+ if (cte.getIID() == 0 || cte.getContigs().first == 0 || cte.getContigs().second == 0) {
+ continue;
+ }
+ if (cte.getContigLinks().size() > 0) {
+ mean += cte.getContigLinks().size();
+ count++;
+ }
+ }
+ mean /= count;
+ globals.redundancy = (uint32_t)round(mean);
+ if (globals.debug >= 1) { cerr << "Picked mean cutoff as " << mean << " rounded " << globals.redundancy << endl; }
+ }
+
+ // If we wanted to process edges sequentially, we can insert a loop here
+ // However, this requires a merge scaffolds function as we may see a new edge linking two separate scaffolds so all the scaffolds need to be rectified again
+ // Therefore, it doesn't seem to be simpler than implementing least squares
+ for (AMOS::IDMap_t::const_iterator ci = edge_bank.getIDMap().begin(); ci; ci++) {
+ edge_bank.fetch(ci->iid, cte);
+
+ if (isBadEdge(cte)) {
+ cerr << "Edge " << cte.getIID() << " ALREADY MARKED BAD, SKIPPING" << endl;
+ continue;
+ }
+
+ if (globals.repeats.find(cte.getContigs().first) != globals.repeats.end() ||
+ globals.repeats.find(cte.getContigs().second) != globals.repeats.end()) {
+ if (globals.debug >= 0) {
+ cerr << "WARNING: IGNORING EDGE " << cte.getIID() << " between " << cte.getContigs().first << " and " << cte.getContigs().second << " because one was listed as a repeat" << endl;;
+ }
+ setEdgeStatus(cte, edge_bank, BAD_RPT, false);
+ continue;
+ }
+
+
+ if (globals.maxOverlap > 0 && cte.getSize() + globals.maxOverlap < 0 && cte.getSize() < globals.maxOverlap) {
+ cerr << "WARNING: IGNORING EDGE " << cte.getIID() << " between " << cte.getContigs().first << " and " << cte.getContigs().second << " because it is below overlap threshold of " << globals.maxOverlap << endl;
+ setEdgeStatus(cte, edge_bank, BAD_THRESH, false);
+ continue;
+ }
+
+ if (cte.getContigLinks().size() < globals.redundancy) {
+ // link is not have enough redundancy, ignore it
+ // note we can do this since if it was consistent with other links of similar size and orientation
+ // it would have been bundled into a larger (and thus more believable) link
+ if (globals.debug >= 0) {
+ cerr << "WARNING: link " << cte.getIID() << " (" << cte.getContigs().first << ", " << cte.getContigs().second << ") is too low weight: " << cte.getLinks().size() << " cutoff was: " << globals.redundancy << endl;
+ }
+ setEdgeStatus(cte, edge_bank, BAD_THRESH, false);
+ continue;
+ }
+ if (cte.getIID() == 0 || cte.getContigs().first == 0 || cte.getContigs().second == 0) {
+ // TODO: CTGs with links to ID 0 indicate links to/from singletons. Incorporate singletons into assembly?
+ if (globals.debug >= 0) {
+ cerr << "WARNING: link " << cte.getIID() << " (" << cte.getContigs().first << ", " << cte.getContigs().second << ") connects to a singleton, it is being ignored" << endl;
+ }
+ setEdgeStatus(cte, edge_bank, BAD_THRESH, false);
+ continue;
+ }
+ (*cte2weight)[cte.getIID()] = cte.getContigLinks().size();
+ set<ID_t, EdgeWeightCmp>* s = ctg2lnk[cte.getContigs().first];
+ if (s == NULL) { s = new set<ID_t, EdgeWeightCmp>();}
+ s->insert(cte.getIID());
+ ctg2lnk[cte.getContigs().first] = s;
+
+ s = ctg2lnk[cte.getContigs().second];
+ if (s == NULL) { s = new set<ID_t, EdgeWeightCmp>();};
+ s->insert(cte.getIID());
+ ctg2lnk[cte.getContigs().second] = s;
+ }
+ flushEdgeStatus(edge_bank);
+
+ map<string, LinkAdjacency_t> ctg2edges; // map from pair of contigs to edge type connecting them
+ // need this so we can know that we picked an N edge and not a A edge for two contigs
+ // track visisted nodes
+ hash_map<ID_t, bool, hash<ID_t>, equal_to<ID_t> > visited; // contigs we've processed
+
+ priority_queue<pair<ID_t, uint32_t>, vector<pair<ID_t, uint32_t> >, EdgePairCmp> current_nodes;
+ pair<ID_t, uint32_t> nodeToWeight;
+
+ Scaffold_t scaff;
+ std::vector<Tile_t> tiles;
+ std::vector<ID_t> edges;
+
+ // pull initial contig and initialize bank for subsequent processing
+ global_contig_len = &ctg2len;
+ stable_sort(contigProcessingOrder.begin(), contigProcessingOrder.end(), ContigOrderCmp());
+ global_contig_len = NULL;
+
+ for (vector<ID_t>::iterator iter = contigProcessingOrder.begin(); iter != contigProcessingOrder.end(); iter++) {
+ contig_bank.fetch(*iter, ctg);
+
+ // if we see any contigs without any edges, make sure we allocate an empty set of edges for them
+ if (ctg2lnk[ctg.getIID()] == NULL) {
+ ctg2lnk[ctg.getIID()] = new set<ID_t, EdgeWeightCmp>();
+ }
+
+ // if we've already processed the node in this iteration, dont do it again
+ if (visited[ctg.getIID()] == true) { continue; }
+
+ tiles.clear();
+ edges.clear();
+
+ if (ctg2lnk[ctg.getIID()]->size() == 0) {
+ continue;
+ }
+
+ // orient if we aren't yet
+ if (ctg2ort[ctg.getIID()] == NONE && ctg2srt[ctg.getIID()] == UNINITIALIZED) {
+ ctg2ort[ctg.getIID()] = FWD;
+ ctg2srt[ctg.getIID()] = 0;
+ }
+
+ nodeToWeight.first = ctg.getIID();
+ nodeToWeight.second = MAX_SIZE;
+ current_nodes.push(nodeToWeight);
+ if (globals.debug >= 2) {
+ cerr << "PUSHING NODE " << ctg.getIID() << " AND SIZE IS " << current_nodes.size() << endl;
+ }
+ // process all the nodes in this connected component
+ while (current_nodes.size() != 0) {
+ ID_t myID = current_nodes.top().first;
+ current_nodes.pop();
+ visited[myID] = true;
+
+int max = 0;
+ // keep track of max weight edge for this contig, if we drop too low, ignore it
+ set<ID_t, EdgeWeightCmp>* s = ctg2lnk[myID];
+ for (set<ID_t, EdgeWeightCmp>::iterator i = s->begin(); i != s->end(); i++) {
+ //TODO: CA links incorporated as links with ID 0. Should they be skipped since we generate our own?
+ checkEdgeID(*i);
+ edge_bank.fetch(*i, cte);
+ checkEdge(cte);
+ ID_t otherID = getEdgeDestination(myID, cte);
+
+ // do not process this edge if we have a higher weight node waiting, just add it to our queue
+ if (current_nodes.size() > 0 && current_nodes.top().second > cte.getLinks().size()) {
+ if (visitedEdges[cte.getIID()] == 0) {
+ nodeToWeight.first = otherID;
+ nodeToWeight.second = cte.getLinks().size();
+ current_nodes.push(nodeToWeight);
+ }
+ continue;
+ }
+
+ // if we hit a node that is not yet initialized, try to initialize it using it's highest neighbor
+ // TODO: it would be better to implement scaffold merging instead and initialize the node since its highest initialized neighbor is not necessarely its highest neighbor
+ if (ctg2ort[myID] == NONE && visitedEdges[cte.getIID()] == 0) {
+if (max < cte.getLinks().size()) { max = cte.getLinks().size(); }
+ if (ctg2ort[otherID] != NONE) {
+ if (globals.debug >=1) {
+ cerr << "WE HIT UNINITIALIZED NODE " << myID << " using edge " << cte.getIID() << " (" << cte.getContigs().first << ", " << cte.getContigs().second << ") AND IM BACKPEDALING TO NODE " << otherID << " THIS NODE IS " << (max-cte.getLinks().size()) << " WORSE THAN BEST UNINITIALIZED" << endl;
+ }
+ nodeToWeight.first = otherID;
+ nodeToWeight.second = cte.getLinks().size();
+ current_nodes.push(nodeToWeight);
+ }
+ continue;
+ }
+
+ // orient the node
+ contigOrientation orient = getOrientationByAllEdges(otherID, ctg2ort, ctg2lnk, edge_bank);
+ // add the edge
+ if (visitedEdges[cte.getIID()] == 0) {
+ std::stringstream oss;
+ oss << myID << "_" << otherID;
+
+ if (globals.debug >= 2) {
+ cerr << "LOOKING AT EDGE BETWEEEN " << cte.getContigs().first << " and " << cte.getContigs().second << endl;
+ cerr << "LOOKING AT EDGE BETWEEEN " << cte.getContigs().second << " and " << cte.getContigs().first << endl;
+ }
+
+ double maxWeight = (getMaxWeightEdge(myID, ctg2lnk, edge_bank) < getMaxWeightEdge(otherID, ctg2lnk, edge_bank) ? getMaxWeightEdge(otherID, ctg2lnk, edge_bank) : getMaxWeightEdge(myID, ctg2lnk, edge_bank));
+ if (globals.debug >= 1) {
+ cerr << "PROCESSING EDGE WITH ID " << cte.getIID() << " BETWEEN CONTIGS " << cte.getContigs().first << " AND " << cte.getContigs().second << " WEIGHT " << cte.getLinks().size() << " LAST WEIGHT WAS " << maxWeight << " AND INT VERSION OF LAST IS " << round((double)maxWeight / 4) << endl;
+ }
+
+ if (globals.skipLowWeightEdges && (double)cte.getLinks().size() / (double)maxWeight <= 0.15) {
+ if (globals.debug >= 1) { cerr << "SKIPPING EDGE " << cte.getIID() << endl; }
+ setEdgeStatus(cte, edge_bank, BAD_SKIP);
+ badCount++;
+ }
+ // determine bad edges
+ // an edge is bad if either
+ // 1. It orients the otherID contig inconsistently with it's current orientation
+ // 2. It orients the myID contig inconsistently given otherID orientation
+ // 3. There is already an edge between two nodes of a different adjacency
+ else if (ctg2ort[otherID] != NONE &&
+ ((orient != ctg2ort[otherID] || getOrientation(ctg2ort[otherID], cte) != ctg2ort[myID]) ||
+ (ctg2edges[oss.str()] != ContigEdge_t::NULL_ADJACENCY && ctg2edges[oss.str()] != cte.getAdjacency()))) {
+ //inconsistent edge
+ cerr << "BAD ORI EDGE: " << cte.getIID() << " between " << cte.getContigs().first << " and " << cte.getContigs().second << " with dist " << cte.getSize() << " and std " << cte.getSD() << " and the orientation is " << cte.getAdjacency() << endl;
+ badCount++;
+
+ // update the edge in the bank so it is marked bad
+ setEdgeStatus(cte, edge_bank, BAD_ORI);
+ }
+ // an edge linking to a node in another scaffold is a bad scaffold edge
+ else if (ctg2scf[otherID] != UNINITIALIZED && ctg2scf[otherID] != scfIID) {
+ setEdgeStatus(cte, edge_bank, BAD_SCF);
+ badCount++;
+ }
+ else {
+ ctg2ort[otherID] = orient;
+ ctg2edges[oss.str()] = cte.getAdjacency();
+
+ computeContigPositionUsingAllEdges(otherID, ctg2srt, ctg2ort, ctg2lnk, edge_bank, contig_bank, INITIAL_STDEV, true);
+ if (!isBadEdge(cte.getIID(), edge_bank)) {
+ // add tiling info
+ // offset is always in terms of the lowest position in scaffold of the contig, that is if we have ---> <---- then the offset of the second
+ // contig is computed from the head of the arrow, not the tail
+ Tile_t tile;
+ tile.source = myID;
+ tile.source_type = Contig_t::NCODE;
+
+ uint32_t length = ctg2len[myID];
+ if (ctg2ort[myID] == FWD) {
+ tile.range.begin = 0;
+ tile.range.end = length;
+ tile.offset = ctg2srt[myID];
+ }
+ else {
+ tile.range.begin = length;
+ tile.range.end = 0;
+ tile.offset = ctg2srt[myID] - length;
+ }
+ ctg2scf[myID] = scfIID;
+ addTile(tiles, myID, tile);
+ tile.clear();
+
+ // now add the other contig's tile to the scaffold
+ tile.source = otherID;
+ tile.source_type = Contig_t::NCODE;
+
+ length = ctg2len[otherID];
+ if (ctg2ort[otherID] == FWD) {
+ tile.range.begin = 0;
+ tile.range.end = length;
+ tile.offset = ctg2srt[otherID];
+ }
+ else {
+ tile.range.begin = length;
+ tile.range.end = 0;
+ tile.offset = ctg2srt[otherID] - length;
+ }
+ ctg2scf[otherID] = scfIID;
+ addTile(tiles, otherID, tile);
+ goodCount++;
+ } else {
+ badCount++;
+ }
+ }
+ edges.push_back(cte.getIID());
+ visitedEdges[cte.getIID()] = 1;
+
+ if (!isBadEdge(cte)) {
+ nodeToWeight.first = otherID;
+ nodeToWeight.second = cte.getLinks().size();
+ current_nodes.push(nodeToWeight);
+
+ if (globals.debug >= 2) {
+ cerr << "PUSHING NODE " << otherID << " WHILE PROCESSING " << myID << " AND EDGE WAS " << cte.getStatus() << " AND SIZE IS " << current_nodes.size() << endl;
+ }
+ }
+ }
+ }
+ }
+ if (tiles.size() == 0) {
+ ctg2ort[ctg.getIID()] = NONE;
+ ctg2srt[ctg.getIID()] = UNINITIALIZED;
+ } else {
+ scaff.setContigEdges(edges);
+ scaff.setContigTiling(tiles);
+ scaff.setIID(scfIID);
+ scaffs.push_back(scaff);
+ scfIID++;
+ }
+ } // end of streaming over the contig bank
+
+ // finally initialize any contigs not in scaffolds if we were asked to do it
+ if (globals.initAll == true) {
+ Scaffold_t scaff;
+ std::vector<Tile_t> tiles;
+ std::vector<ID_t> edges;
+
+ contig_stream.seekg(0,BankStream_t::BEGIN);
+ while (contig_stream >> ctg) {
+ if (ctg2ort[ctg.getIID()] == NONE && ctg2srt[ctg.getIID()] == UNINITIALIZED) {
+ Tile_t tile;
+ tile.source = ctg.getIID();
+ tile.source_type = Contig_t::NCODE;
+ tile.offset = 0;
+ tile.range.begin = 0;
+ tile.range.end = ctg.getLength();
+ ctg2ort[ctg.getIID()] = FWD;
+ ctg2srt[ctg.getIID()] = 0;
+ ctg2scf[ctg.getIID()] = scfIID;
+
+ tiles.clear();
+ edges.clear();
+ tiles.push_back(tile);
+
+ scaff.setContigEdges(edges);
+ scaff.setContigTiling(tiles);
+ scaff.setIID(scfIID);
+ scaffs.push_back(scaff);
+ scfIID++;
+ }
+ }
+ }
+
+ // compress gap if we can
+ compressGaps(scaffs, ctg2srt, ctg2ort, ctg2lnk, edge_bank, contig_bank);
+
+ // preform graph simplification
+ sortContigs(scaffs, contig_bank, edge_bank);
+
+ if (globals.debug >= 1) { cerr << "BEGIN COMPRESSION" << endl; }
+ if (globals.compressMotifs == true) {
+ transitiveEdgeRemoval(scaffs, edge_bank, ctg2lnk, globals.debug);
+ // allow low-weight edges to be rescued
+ AMOS::ContigEdge_t cte;
+ for (AMOS::IDMap_t::const_iterator ci = edge_bank.getIDMap().begin(); ci; ci++) {
+ edge_bank.fetch(ci->iid, cte);
+
+ // TODO: ideally this shouldn't rely on the ctg2srt hash table but instead look it up in the scaffold tiling
+ // for that we need to find which scaffold contains the tile
+ // also scaffold should store a hash table that returns the tile given an id quickly
+ if (cte.getStatus() == BAD_SKIP) {
+ Contig_t first, second;
+ contig_bank.fetch(cte.getContigs().first, first);
+ contig_bank.fetch(cte.getContigs().second, second);
+
+ edgeStatus st = isEdgeConsistent(first, second, cte, ctg2ort, ctg2srt, ctg2scf);
+ st = (st == GOOD_EDGE ? BAD_SKIP : st);
+ setEdgeStatus(cte, edge_bank, st, false);
+ if (globals.debug >= 1) { cerr << "FOR SKIPPED EDGE " << cte.getIID() << " SET EDGE STATUS TO BE " << st << endl; }
+ }
+ }
+ flushEdgeStatus(edge_bank);
+ reduceGraph(scaffs, contig_bank, edge_bank, ctg2ort, ctg2lnk, motifs);
+ sortContigs(scaffs, contig_bank, edge_bank);
+ // reset the transitive edges because we may have collapsed nodes so old transitive edges are no longer transitive
+ resetEdges(edge_bank, BAD_TRNS);
+ transitiveEdgeRemoval(scaffs, edge_bank, ctg2lnk, globals.debug);
+ }
+ if (globals.debug >= 1) { cerr << "DONE COMPRESSION" << endl; }
+
+ // finally output to the bank
+ for (vector<Scaffold_t>::iterator itScf = scaffs.begin(); itScf < scaffs.end(); itScf++) {
+ scaff_stream.append(*itScf);
+ }
+
+ for(vector<Motif_t>::iterator itScf = motifs.begin(); itScf < motifs.end(); itScf++) {
+ motif_stream.append(*itScf);
+ }
+
+ // clear data
+ ctg2scf.clear();
+ ctg2srt.clear();
+ ctg2ort.clear();
+ // clear the edge lists
+ for (hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<ID_t>, equal_to<ID_t> >::iterator i = ctg2lnk.begin(); i != ctg2lnk.end(); i++) {
+ delete (i->second);
+ }
+ delete(cte2weight);
+
+ edge_bank.close();
+ contig_stream.close();
+ contig_bank.close();
+ motif_stream.close();
+ scaff_stream.close();
+
+ cerr << "Finished! Had " << goodCount << " Good links and " << badCount << " bad ones." << endl;
+ return 0;
+}
diff --git a/src/Bambus/Bundler/Utilities_Bundler.cc b/src/Bambus/Bundler/Utilities_Bundler.cc
new file mode 100755
index 0000000..0e077d8
--- /dev/null
+++ b/src/Bambus/Bundler/Utilities_Bundler.cc
@@ -0,0 +1,457 @@
+#include <time.h>
+#include <math.h>
+
+#include "Utilities_Bundler.hh"
+
+#include "Library_AMOS.hh"
+#include "Fragment_AMOS.hh"
+#include "Overlap_AMOS.hh"
+#include "Contig_AMOS.hh"
+#include "ContigLink_AMOS.hh"
+#include "ContigEdge_AMOS.hh"
+#include "Scaffold_AMOS.hh"
+#include "Motif_AMOS.hh"
+
+using namespace Bundler;
+
+// internal-only definitions
+HASHMAP::hash_map<AMOS::ID_t, int, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > cte2bad;
+bool cte2badInit = false;
+
+double Bundler::computeArrivalRate(const std::vector<AMOS::Contig_t *> &contigs) {
+ double result = 0;
+ int32_t numFragments = 0;
+
+ for (std::vector<AMOS::Contig_t *>::const_iterator i = contigs.begin(); i < contigs.end(); i++) {
+ // compute global arrival rate
+ result += (*i)->getAvgRho();
+ numFragments += ((*i)->getReadTiling().size() > 0 ? (*i)->getReadTiling().size() - 1 : 0);
+ }
+ if (result == 0) {
+ return 0;
+ }
+
+ return numFragments / result;
+}
+
+#ifdef AMOS_HAVE_BOOST
+void Bundler::buildGraph(
+ Bundler::Graph &g,
+ AMOS::BankStream_t &node_stream, AMOS::BankStream_t &edge_stream,
+ AMOS::IBankable_t *node, AMOS::IBankable_t *edge,
+ int32_t redundancy) {
+ // build boost-based graph
+ HASHMAP::hash_map<AMOS::ID_t, Vertex, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > nodeToDescriptor;
+ VertexName vertexNames = get(boost::vertex_name, g);
+ VertexLength vertexLength = get(boost::vertex_index1, g);
+ EdgeWeight edgeWeights = get(boost::edge_weight, g);
+
+ // build boost-based graph
+ // add node 0, it represents links outside of the set of contings (for example to singletons)
+ nodeToDescriptor[0] = boost::add_vertex(g);
+ vertexNames[nodeToDescriptor[0] ] = 0;
+ vertexLength[nodeToDescriptor[0] ] = 0;
+
+ while (node_stream >> (*node)) {
+ assert(node->getIID() != 0);
+ nodeToDescriptor[node->getIID()] = boost::add_vertex(g);
+ vertexNames[nodeToDescriptor[node->getIID()] ] = node->getIID();
+ if (dynamic_cast<AMOS::Contig_t *>(node) != NULL) {
+ AMOS::Contig_t *ctg = dynamic_cast<AMOS::Contig_t *>(node);
+ vertexLength[nodeToDescriptor[node->getIID()] ] = ctg->getUngappedLength();
+ } else {
+ vertexLength[nodeToDescriptor[node->getIID()] ] = 1;
+ }
+ }
+ node_stream.seekg(0,AMOS::BankStream_t::BEGIN);
+
+ while (edge_stream >> (*edge)) {
+ AMOS::ID_t firstNode, secondNode;
+ double_t weight = 0;
+ if (dynamic_cast<AMOS::ContigEdge_t *>(edge) != NULL) {
+ AMOS::ContigEdge_t* cte = dynamic_cast<AMOS::ContigEdge_t *>(edge);
+ if (cte->getContigLinks().size() < redundancy || cte->getContigLinks().size() == 0) {
+ continue;
+ }
+
+ firstNode = cte->getContigs().first;
+ secondNode = cte->getContigs().second;
+ weight = 1;/*((double)1 / cte->getContigLinks().size());*/
+ }
+ else if (dynamic_cast<AMOS::Overlap_t *>(edge) != NULL) {
+ AMOS::Overlap_t* overlap = dynamic_cast<AMOS::Overlap_t*>(edge);
+ firstNode = overlap->getReads().first;
+ secondNode = overlap->getReads().second;
+ weight = 1;
+ }
+ else {
+ std::cerr << "buildGraph(): error, unknown type of edge bank " << edge_stream.getType() << " skipping record" << std::endl;
+ continue;
+ }
+ std::pair<Edge, bool> e = boost::add_edge(nodeToDescriptor[firstNode], nodeToDescriptor[secondNode], g);
+ edgeWeights[e.first] = weight;
+ }
+ edge_stream.seekg(0,AMOS::BankStream_t::BEGIN);
+}
+#else
+void Bundler::buildGraph(
+ Bundler::Graph &g,
+ AMOS::BankStream_t &node_stream, AMOS::BankStream_t &edge_stream,
+ AMOS::IBankable_t *node, AMOS::IBankable_t *edge,
+ int32_t redundancy) {
+ std::cerr << "Unable to build graph. Boost library is required. Please double check your installation and recompile AMOS" << std::endl;
+}
+#endif //AMOS_HAVE_BOOST
+
+AMOS::ID_t Bundler::getEdgeDestination(const AMOS::ID_t &edgeSrc, const AMOS::ContigEdge_t &cte) {
+ if (cte.getContigs().second == edgeSrc) {
+ return cte.getContigs().first;
+ }
+ else {
+ return cte.getContigs().second;
+ }
+}
+
+Bundler::contigOrientation Bundler::getOrientation(contigOrientation &myOrient, const AMOS::ContigEdge_t &cte) {
+ assert(myOrient != NONE);
+
+ switch (cte.getAdjacency()) {
+ case AMOS::ContigEdge_t::NORMAL:
+ case AMOS::ContigEdge_t::ANTINORMAL:
+ // incase of normal or anti-normal, our directions match
+ return myOrient;
+ break;
+ case AMOS::ContigEdge_t::INNIE:
+ case AMOS::ContigEdge_t::OUTIE:
+ if (myOrient == FWD) { return REV;} else { return FWD;}
+ break;
+ default:
+ std::cerr << "Unknown orientation " << cte.getAdjacency() << std::endl;
+ exit(1);
+ };
+}
+
+AMOS::Size_t Bundler::adjustSizeBasedOnAdjacency(AMOS::LinkAdjacency_t edgeAdjacency, AMOS::Size_t gapSize,
+ AMOS::Size_t firstLength, AMOS::Size_t secondLength,
+ contigOrientation firstOrient, contigOrientation secondOrient,
+ AMOS::SD_t fudgeFactor) {
+ assert(firstOrient != NONE);
+
+ AMOS::Size_t size = gapSize + fudgeFactor;
+ contigOrientation expectedOrient = NONE;
+ switch (edgeAdjacency) {
+ case AMOS::ContigEdge_t::NORMAL:
+ size += firstLength;
+ expectedOrient = FWD;
+ break;
+ case AMOS::ContigEdge_t::ANTINORMAL:
+ size += secondLength;
+ expectedOrient = REV;
+ break;
+ case AMOS::ContigEdge_t::INNIE:
+ size += firstLength;
+ size += secondLength;
+ expectedOrient = FWD;
+ break;
+ case AMOS::ContigEdge_t::OUTIE:
+ // no adjustment for OUTIE
+ expectedOrient = REV;
+ break;
+ default:
+ std::cerr << "Unknown adjacency " << edgeAdjacency << std::endl;
+ exit(1);
+ };
+
+ // place the second contig behind the first one if we are reversed
+ if (firstOrient != expectedOrient) {
+ size *= -1;
+ }
+ return size;
+}
+
+void Bundler::checkEdgeID(const AMOS::ID_t &id) {
+ if (id == 0) {
+ std::cerr << "ERROR: FOUND INVALID EDGES THAT SHOULD HAVE BEEN SCREENED OUT!\n";
+ std::exit(1);
+ }
+}
+
+void Bundler::checkEdge(const AMOS::ContigEdge_t &cte) {
+ if (cte.getContigs().first == 0 || cte.getContigs().second == 0) {
+ std::cerr << "ERROR: FOUND INVALID EDGES THAT SHOULD HAVE BEEN SCREENED OUT!\n";
+ std::exit(1);
+ }
+}
+
+void Bundler::setEdgeStatus(AMOS::ContigEdge_t &cte, AMOS::Bank_t &edge_bank, int status) {
+ setEdgeStatus(cte, edge_bank, status, true);
+}
+
+void Bundler::setEdgeStatus(AMOS::ContigEdge_t &cte, AMOS::Bank_t &edge_bank, int status, bool now) {
+ cte2bad[cte.getIID()] = status;
+ cte.setStatus(status);
+ if (now == true) {
+ edge_bank.replace(cte.getIID(), cte);
+ }
+}
+
+void Bundler::flushEdgeStatus(AMOS::Bank_t &edge_bank) {
+ AMOS::ContigEdge_t cte;
+
+ for (HASHMAP::hash_map<AMOS::ID_t, int, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> >::iterator i = cte2bad.begin(); i != cte2bad.end(); i++) {
+ edge_bank.fetch(i->first, cte);
+ cte.setStatus(i->second);
+ edge_bank.replace(i->first, cte);
+ }
+}
+
+bool Bundler::isBadEdge(AMOS::ID_t cteID, AMOS::Bank_t &edge_bank) {
+ if (cte2badInit = false) {
+ AMOS::ContigEdge_t cte;
+ for (AMOS::IDMap_t::const_iterator ci = edge_bank.getIDMap().begin(); ci; ci++) {
+ edge_bank.fetch(ci->iid, cte);
+ cte2bad[ci->iid] = cte.getStatus();
+ }
+ cte2badInit = true;
+ }
+
+ return (cte2bad[cteID] != GOOD_EDGE && cte2bad[cteID] != NULL_STATUS);
+}
+
+bool Bundler::isBadEdge(const AMOS::ContigEdge_t &cte) {
+ if (cte.getStatus() != GOOD_EDGE && cte.getStatus() != NULL_STATUS) {
+ return true;
+ }
+
+ return false;
+}
+
+void Bundler::resetEdges(AMOS::Bank_t &edge_bank, edgeStatus toChange) {
+ AMOS::ContigEdge_t cte;
+ for (AMOS::IDMap_t::const_iterator ci = edge_bank.getIDMap().begin(); ci; ci++) {
+ edge_bank.fetch(ci->iid, cte);
+
+ if (cte.getStatus() == toChange) {
+ setEdgeStatus(cte, edge_bank, GOOD_EDGE);
+ }
+ }
+}
+
+void Bundler::resetEdges(AMOS::Bank_t &edge_bank, std::set<AMOS::ID_t> &edges, edgeStatus toChange) {
+ AMOS::ContigEdge_t cte;
+ for (std::set<AMOS::ID_t>::iterator i = edges.begin(); i != edges.end(); i++) {
+ edge_bank.fetch(*i, cte);
+ if (cte.getStatus() == toChange) {
+ setEdgeStatus(cte, edge_bank, GOOD_EDGE);
+ }
+ }
+}
+
+AMOS::Size_t Bundler::getTileOverlap(AMOS::Tile_t tileOne, AMOS::Tile_t tileTwo) {
+ AMOS::Size_t start = (tileOne.offset > tileTwo.offset ? tileOne.offset : tileTwo.offset);
+ AMOS::Size_t maxOne = tileOne.offset + (tileOne.range.getLength() - 1);
+ AMOS::Size_t maxTwo = tileTwo.offset + (tileTwo.range.getLength() - 1);
+ AMOS::Size_t end = (maxOne < maxTwo ? maxOne : maxTwo);
+
+ return (end-start+1);
+}
+
+HASHMAP::hash_map<AMOS::ID_t, int32_t, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > *cte2top;
+struct EdgeTopoCmp
+{
+ bool operator () (const AMOS::ContigEdge_t * a, const AMOS::ContigEdge_t* b) const
+ {
+ assert(cte2top);
+ int32_t posA = (*cte2top)[a->getContigs().second];
+ assert(posA);
+ int32_t posB = (*cte2top)[b->getContigs().second];
+ assert(posB);
+
+ if (posA < posB) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+};
+
+bool topoSortRecursive(AMOS::ID_t curr,
+ AMOS::Bank_t &edge_bank,
+ HASHMAP::hash_map<AMOS::ID_t, std::set<AMOS::ID_t, EdgeWeightCmp>*, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > ctg2lnk,
+ HASHMAP::hash_map<AMOS::ID_t, int, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> >& inProcess,
+ HASHMAP::hash_map<AMOS::ID_t, int, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> >& visited,
+ std::vector<AMOS::ID_t> &sorted,
+ int32_t debugLevel)
+{
+ bool result = true;
+
+ if (visited[curr] != 1) {
+ inProcess[curr] = 1;
+
+ std::set<AMOS::ID_t, EdgeWeightCmp>* s = ctg2lnk[curr];
+ if (s != NULL) {
+ for (std::set<AMOS::ID_t, EdgeWeightCmp>::iterator i = s->begin(); i != s->end(); i++) {
+ checkEdgeID(*i);
+ AMOS::ContigEdge_t *cte = new AMOS::ContigEdge_t();
+ edge_bank.fetch(*i, *cte);
+ checkEdge(*cte);
+
+ if (isBadEdge(*cte)) { continue; }
+
+ // outgoing edge
+ if (cte->getContigs().first == curr) {
+ if (visited[cte->getContigs().second] == 1) {
+ // do nothing this node is finished
+ } else if (inProcess[cte->getContigs().second] == 1) {
+ result = false;
+ } else {
+ result &= topoSortRecursive(cte->getContigs().second, edge_bank, ctg2lnk, inProcess, visited, sorted, debugLevel);
+ }
+ }
+ }
+ }
+ sorted.insert(sorted.begin(), curr);
+ }
+
+ visited[curr] = 1;
+ inProcess[curr] = 0;
+ return result;
+}
+
+void transitiveEdgeRecursive(AMOS::ID_t curr,
+ AMOS::ID_t edge,
+ AMOS::Bank_t &edge_bank,
+ HASHMAP::hash_map<AMOS::ID_t, std::set<AMOS::ID_t, EdgeWeightCmp>*, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > ctg2lnk,
+ HASHMAP::hash_map<AMOS::ID_t, int, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> >& inProcess,
+ HASHMAP::hash_map<AMOS::ID_t, int, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> >& visited,
+ HASHMAP::hash_map<AMOS::ID_t, std::pair<double, double>, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> >& mean,
+ HASHMAP::hash_map<AMOS::ID_t, AMOS::Size_t, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> >& size,
+ int32_t debugLevel) {
+
+ std::set<AMOS::ContigEdge_t*, EdgeTopoCmp> edges;
+ AMOS::ContigEdge_t currEdge;
+ inProcess[curr] = 1;
+ if (edge != UNINITIALIZED) { edge_bank.fetch(edge, currEdge); }
+
+ if (debugLevel >= 1) { std::cerr << "VISITING NODE " << curr << " USING EDGE ID " << edge << " WITH SIZE " << currEdge.getSize() << std::endl; }
+ std::set<AMOS::ID_t, EdgeWeightCmp>* s = ctg2lnk[curr];
+ if (s != NULL) {
+ for (std::set<AMOS::ID_t, EdgeWeightCmp>::iterator i = s->begin(); i != s->end(); i++) {
+ checkEdgeID(*i);
+ AMOS::ContigEdge_t *cte = new AMOS::ContigEdge_t();
+ edge_bank.fetch(*i, *cte);
+ checkEdge(*cte);
+
+ if (isBadEdge(*cte)) { continue; }
+
+ // incoming edge
+ if (cte->getContigs().second == curr) {
+ if (cte->getIID() == edge) {
+ // do nothing for this edge
+ }
+ else if (inProcess[cte->getContigs().first] == 1) {
+ assert(edge != UNINITIALIZED);
+ double distance = mean[cte->getContigs().first].first; // mean distance from start of traversal to our incoming node
+ distance -= mean[currEdge.getContigs().first].first; // mean distance to the node in the middle of transitive reduction
+ // distance is now the distance between the start of the transitive reduction and the middle node
+ distance += currEdge.getSize();
+ distance += size[currEdge.getContigs().first];
+
+ // repeat for stdev
+ double sd = mean[cte->getContigs().first].second;
+ sd -= mean[currEdge.getContigs().first].second;
+ sd += currEdge.getSD();
+
+ if (debugLevel >= 1) {
+ std::cerr << "COMPUTE DISTANCE IS " << distance << " MEAN: " << sd << " AND EDG EIS " << cte->getSize() << " AND SIZE OF " << currEdge.getContigs().first << " IS " << size[currEdge.getContigs().first] << std::endl;
+ std::cerr << "CTE - DIST IS " << fabs(cte->getSize() - distance) << " AND SD IS " << (cte->getSD() + sd) << std::endl;
+ }
+ if (fabs(cte->getSize() - distance) <= (cte->getSD() + sd)) {
+ if (debugLevel >= 1) { std::cerr << "DELETING EDGE " << cte->getIID() << " BETWEEN CONTIGS " << cte->getContigs().first << " AND " << cte->getContigs().second << std::endl; }
+ setEdgeStatus(*cte, edge_bank, BAD_TRNS);
+ }
+ }
+ delete cte;
+ } else {
+ edges.insert(cte);
+ }
+ }
+
+ // process outgoing edges
+ for (std::set<AMOS::ContigEdge_t*, EdgeTopoCmp>::iterator i = edges.begin(); i != edges.end(); i++) {
+ AMOS::ContigEdge_t *cte =*i;
+ if (cte->getContigs().first != curr) { std::cerr << "Error, edge is neither incoming nor outgoing " << cte->getIID() << " for node " << curr << std::endl; exit(1); }
+
+ if (isBadEdge(*cte)) { continue; }
+ if (visited[cte->getContigs().second] == 1) { continue; }
+
+ if (inProcess[cte->getContigs().second] == 1) {
+ // we have found a loop, do not go down this path
+ }
+ else {
+ // update distances to include the edge we're traversing
+ mean[curr].first = cte->getSize();
+ mean[curr].second = cte->getSD();
+ for (HASHMAP::hash_map<AMOS::ID_t, std::pair<double, double>, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> >::iterator i = mean.begin(); i != mean.end(); i++) {
+ if (i->first != curr) {
+ i->second.first += cte->getSize();
+ i->second.second += cte->getSD();
+ }
+ }
+ transitiveEdgeRecursive(cte->getContigs().second, cte->getIID(), edge_bank, ctg2lnk, inProcess, visited, mean, size, debugLevel);
+
+ // now remove the distance of the edge just finished in the recursive call above
+ mean[curr].first = 0;
+ mean[curr].second = 0;
+ for (HASHMAP::hash_map<AMOS::ID_t, std::pair<double, double>, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> >::iterator i = mean.begin(); i != mean.end(); i++) {
+ if (i->first != curr) {
+ i->second.first -= cte->getSize();
+ i->second.second -= cte->getSD();
+ }
+ }
+ }
+ delete cte;
+ }
+ }
+
+ inProcess[curr] = 0;
+ visited[curr] = 1;
+}
+
+void Bundler::transitiveEdgeRemoval(std::vector<AMOS::Scaffold_t> &scaffs,
+ AMOS::Bank_t &edge_bank,
+ HASHMAP::hash_map<AMOS::ID_t, std::set<AMOS::ID_t, EdgeWeightCmp>*, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> >& ctg2lnk,
+ int32_t debugLevel) {
+
+ HASHMAP::hash_map<AMOS::ID_t, int, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > inProcess;
+ HASHMAP::hash_map<AMOS::ID_t, int, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > visited;
+ HASHMAP::hash_map<AMOS::ID_t, std::pair<double, double>, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > mean;
+ HASHMAP::hash_map<AMOS::ID_t, AMOS::Size_t, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > size;
+ cte2top = new HASHMAP::hash_map<AMOS::ID_t, int32_t, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> >();
+
+ for(std::vector<AMOS::Scaffold_t>::iterator itScf = scaffs.begin(); itScf < scaffs.end(); itScf++) {
+ if (itScf->getContigTiling().size() > 1) {
+ for (std::vector<AMOS::Tile_t>::const_iterator tileIt = itScf->getContigTiling().begin(); tileIt < itScf->getContigTiling().end(); tileIt++) {
+ size[tileIt->source] = tileIt->range.getLength();
+ }
+
+ for (std::vector<AMOS::Tile_t>::const_iterator tileIt = itScf->getContigTiling().begin(); tileIt < itScf->getContigTiling().end(); tileIt++) {
+ if (visited[tileIt->source] != 1) {
+ HASHMAP::hash_map<AMOS::ID_t, int, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > topoVisited;
+ std::vector<AMOS::ID_t> sorted;
+
+ if (topoSortRecursive(tileIt->source, edge_bank, ctg2lnk, inProcess, topoVisited, sorted, debugLevel)) {
+ for (uint32_t i = 0; i < sorted.size(); i++) {
+ (*cte2top)[sorted[i]] = i;
+ }
+ mean.clear();
+ transitiveEdgeRecursive(tileIt->source, UNINITIALIZED, edge_bank, ctg2lnk, inProcess, visited, mean, size, debugLevel);
+ }
+ }
+ }
+ }
+ }
+
+ delete cte2top;
+}
diff --git a/src/Bambus/Bundler/Utilities_Bundler.hh b/src/Bambus/Bundler/Utilities_Bundler.hh
new file mode 100755
index 0000000..a340609
--- /dev/null
+++ b/src/Bambus/Bundler/Utilities_Bundler.hh
@@ -0,0 +1,129 @@
+#ifndef UTILITIES_BUNDLER_HH_
+#define UTILITIES_BUNDLER_HH_ 1
+
+#include <set>
+#include <queue>
+#include <iterator>
+
+#ifdef AMOS_HAVE_BOOST
+#include <boost/config.hpp>
+#include <boost/utility.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/graphviz.hpp>
+#endif //AMOS_HAVE_BOOST
+
+#include "Contig_AMOS.hh"
+#include "datatypes_AMOS.hh"
+#include "ContigEdge_AMOS.hh"
+#include "Scaffold_AMOS.hh"
+#include <set>
+
+#include "Bank_AMOS.hh"
+#include "BankStream_AMOS.hh"
+
+namespace Bundler
+{
+#ifdef AMOS_HAVE_BOOST
+ /* give access to common Boost data types through our interface */
+ // Vertex properties
+ typedef boost::property<boost::vertex_name_t, unsigned int,
+ boost::property<boost::vertex_index1_t, AMOS::Size_t> > VertexProperty;
+
+ // Edge properties
+ typedef boost::property<boost::edge_weight_t, double> EdgeProperty;
+
+ // Adjacency graph using list data structure
+ typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, VertexProperty, EdgeProperty> Graph;
+
+ // Accessors
+ typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;
+ typedef boost::graph_traits<Graph>::edge_descriptor Edge;
+ typedef boost::graph_traits<Graph>::vertex_iterator VertexIterator;
+ typedef boost::graph_traits<Graph>::out_edge_iterator EdgeIterator;
+
+ // Properties
+ typedef boost::property_map<Graph, boost::vertex_name_t>::type VertexName;
+ typedef boost::property_map<Graph, boost::vertex_index1_t>::type VertexLength;
+ typedef boost::property_map<Graph, boost::edge_weight_t>::type EdgeWeight;
+#else
+ typedef int32_t Graph;
+#endif //AMOS_HAVE_BOOST
+
+ // Other usefull constants
+ static const int32_t UNINITIALIZED = -99999999;
+ static const int32_t INVALID_EDGE = -99999998;
+
+ static const AMOS::Status_t MOTIF_SCAFFOLD = 'M';
+ static const AMOS::Status_t LINEAR_SCAFFOLD = 'L';
+
+ // define constants for orientation of contigs
+ enum contigOrientation {FWD, REV, NONE};
+ enum edgeStatus {NULL_STATUS, BAD_THRESH, BAD_SKIP, BAD_RPT, BAD_ORI, BAD_SCF, BAD_DST, BAD_TRNS, GOOD_EDGE};
+ enum validateNeighborType {ALL, INCOMING, OUTGOING};
+
+ extern HASHMAP::hash_map<AMOS::ID_t, int32_t, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > *cte2weight;
+
+ struct EdgeWeightCmp
+ {
+ bool operator () (const AMOS::ID_t & a, const AMOS::ID_t & b) const
+ {
+ assert(cte2weight);
+ int32_t weightA = (*cte2weight)[a];
+ assert(weightA);
+ int32_t weightB = (*cte2weight)[b];
+ assert(weightB);
+
+ if (weightA < weightB) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+ };
+
+ struct EdgePairCmp
+ {
+ bool operator() (const std::pair<AMOS::ID_t, uint32_t> & a, const std::pair<AMOS::ID_t, uint32_t> &b) const
+ {
+ return a.second < b.second;
+ }
+ };
+
+ double computeArrivalRate(const std::vector<AMOS::Contig_t *> &contigs);
+ void buildGraph(
+ Graph &g,
+ AMOS::BankStream_t &contig_stream, AMOS::BankStream_t &edge_stream,
+ AMOS::IBankable_t *node, AMOS::IBankable_t *edge,
+ int32_t redundancy);
+
+ // get edge statuses
+ // note: edge status are cached in memory so they must be updated through setEdgeStatus
+ void setEdgeStatus(AMOS::ContigEdge_t &cte, AMOS::Bank_t &edge_bank, int status);
+ void setEdgeStatus(AMOS::ContigEdge_t &cte, AMOS::Bank_t &edge_bank, int status, bool now);
+ void flushEdgeStatus(AMOS::Bank_t &edge_bank);
+
+ bool isBadEdge(AMOS::ID_t cteID, AMOS::Bank_t &edge_bank);
+ bool isBadEdge(const AMOS::ContigEdge_t &cte);
+ void checkEdgeID(const AMOS::ID_t &id);
+ void checkEdge(const AMOS::ContigEdge_t &cte);
+ void resetEdges(AMOS::Bank_t &edge_bank, edgeStatus toChange);
+ void resetEdges(AMOS::Bank_t &edge_bank, std::set<AMOS::ID_t> &edges, edgeStatus toChange);
+
+ AMOS::ID_t getEdgeDestination(const AMOS::ID_t &edgeSrc, const AMOS::ContigEdge_t &cte);
+ contigOrientation getOrientation(contigOrientation &myOrient, const AMOS::ContigEdge_t &cte);
+
+ AMOS::Size_t adjustSizeBasedOnAdjacency(AMOS::LinkAdjacency_t edgeAdjacency, AMOS::Size_t gapSize,
+ AMOS::Size_t firstLength, AMOS::Size_t secondLength,
+ contigOrientation firstOrient, contigOrientation secondOrient,
+ AMOS::SD_t fudgeFactor);
+
+ AMOS::Size_t getTileOverlap(AMOS::Tile_t tileOne, AMOS::Tile_t tileTwo);
+
+ void transitiveEdgeRemoval(std::vector<AMOS::Scaffold_t> &scaffs,
+ AMOS::Bank_t &edge_bank,
+ HASHMAP::hash_map<AMOS::ID_t, std::set<AMOS::ID_t, EdgeWeightCmp>*, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> >& ctg2lnk,
+ int32_t debugLevel);
+}
+#endif /*UTILITIES_BUNDLER_HH_*/
diff --git a/src/Bambus/Bundler/clk.cc b/src/Bambus/Bundler/clk.cc
new file mode 100644
index 0000000..0a23266
--- /dev/null
+++ b/src/Bambus/Bundler/clk.cc
@@ -0,0 +1,370 @@
+// $Id$
+
+// This program uses DST, MTP, and CTG records from a bank in order to generate
+// a set of contig links (CLK).
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <getopt.h>
+#include <map>
+#include <set>
+#include <list>
+#include <functional>
+#include "foundation_AMOS.hh"
+
+using namespace std;
+using namespace AMOS;
+using namespace HASHMAP;
+
+map<string, string> globals; // global variables
+
+void printHelpText()
+{
+ cerr <<
+ "\n"
+ "Create links between contigs using mate pair (paired-end) information\n"
+ "\n"
+ "USAGE:\n"
+ "\n"
+ "clk -b[ank] <bank_name>\n"
+ << endl;
+}
+
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {0, 0, 0, 0}
+ };
+
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -
+ 1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ break;
+ case 'b':
+ globals["bank"] = string(optarg);
+ break;
+ case '?':
+ return false;
+ }
+ }
+
+ return true;
+} // GetOptions
+
+void closeBanks(Bank_t &library_bank, BankStream_t &frag_bank, Bank_t &link_bank, Bank_t &contig_bank) {
+ link_bank.close();
+ frag_bank.close();
+ library_bank.close();
+ contig_bank.close();
+// mate_bank.close();
+}
+
+// --------------------------------------------------------------------
+// --------------------------------------------------------------------
+int main(int argc, char **argv)
+{
+ ID_t LinkId = 0; // link IIDs
+
+ if (!GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ if (globals.find("bank") == globals.end()){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ Bank_t library_bank (Library_t::NCODE);
+ if (! library_bank.exists(globals["bank"])){
+ cerr << "No library account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ library_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open library account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ Bank_t contig_bank (Contig_t::NCODE);
+ BankStream_t contig_stream (Contig_t::NCODE);
+ if (! contig_bank.exists(globals["bank"])){
+ cerr << "No contig account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ contig_bank.open(globals["bank"], B_READ);
+ contig_stream.open(globals["bank"], B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open contig account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+// Replaced by new frag methods
+// BankStream_t mate_bank (Matepair_t::NCODE);
+// if (! mate_bank.exists(globals["bank"])){
+// cerr << "No mate account found in bank " << globals["bank"] << endl;
+// exit(1);
+// }
+// try {
+// mate_bank.open(globals["bank"], B_READ);
+// } catch (Exception_t & e) {
+// cerr << "Failed to open mate account in bank " << globals["bank"]
+// << ": " << endl << e << endl;
+// exit(1);
+// }
+
+ Bank_t read_bank (Read_t::NCODE);
+ if (! read_bank.exists(globals["bank"])){
+ cerr << "No read account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ read_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open read account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+
+ BankStream_t frag_bank (Fragment_t::NCODE);
+ if (! frag_bank.exists(globals["bank"])){
+ cerr << "No fragment account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ frag_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open fragment account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+
+ BankStream_t link_bank (ContigLink_t::NCODE);
+ try {
+ if (! link_bank.exists(globals["bank"]))
+ link_bank.create(globals["bank"]);
+ else
+ link_bank.open(globals["bank"]);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open link account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ // stream through contigs and build map of read id to contig id
+ // stream through mates and retain those that link two different contigs
+ // for one read in each of the mates retrieve the set of fragments
+ // for all chosen fragments find the libraries
+ // for all chosen libraries find the mean and standard deviation
+ // for all mate pairs between same pair of contigs, retrieve the exact mapping of the reads in the contigs and generate contig links
+ // repeat until exhausting set of mate pairs
+
+ Contig_t ctg;
+ hash_map<ID_t, ID_t, hash<ID_t>, equal_to<ID_t> > rd2ctg; // map from read to contig
+ hash_map<ID_t, Range_t, hash<ID_t>, equal_to<ID_t> > rd2posn; // position in contig
+ hash_map<ID_t, Size_t, hash<ID_t>, equal_to<ID_t> > ctglen; // length of contig
+
+ while (contig_stream >> ctg)
+ for (vector<Tile_t>::iterator ti = ctg.getReadTiling().begin();
+ ti != ctg.getReadTiling().end(); ti++) {
+ rd2ctg[ti->source] = ctg.getIID();
+
+ Pos_t f, l; // coords of beginning/end of read
+ if (ti->range.end < ti->range.begin) { // reverse
+ f = ti->offset + ti->range.begin - ti->range.end;
+ l = ti->offset;
+ } else {
+ f = ti->offset;
+ l = ti->offset + ti->range.end - ti->range.begin;
+ }
+ rd2posn[ti->source] =
+ Range_t(f, l);
+
+ // rd2posn[ti->source] =
+ // Range_t(ti->offset, ti->offset + ti->range.end - ti->range.begin);
+ ctglen[ctg.getIID()] = ctg.getLength();
+ }
+ // cerr << "Read " << ti->source << " lives in contig " << ctg.getIID() << endl;;
+ contig_stream.close();
+
+ // todo: replace matepair with fragment
+ //Matepair_t mtp;
+ // list<Matepair_t> mtl;
+
+ list<Fragment_t> frl;
+
+ Read_t rd1;
+ Fragment_t frg;
+ set<ID_t> libIDs;
+ hash_map<ID_t, ID_t, hash<ID_t>, equal_to<ID_t> > rd2lib;
+ hash_map<ID_t, ID_t, hash<ID_t>, equal_to<ID_t> > rd2frg;
+
+ // while (mate_bank >> mtp)
+ while (frag_bank >> frg) {
+ if ( rd2ctg[frg.getMatePair().first] != rd2ctg[frg.getMatePair().second] ) {
+
+ // keep this matepair as it links two different contigs
+ frl.push_back(frg);
+ read_bank.fetch(frg.getMatePair().first, rd1); // get the read
+
+ // no longer need to fetch frag already have the frag
+ // frag_bank.fetch(rd1.getFragment(), frg); // get the fragment
+
+ rd2frg[frg.getMatePair().first] = rd1.getFragment();
+
+ libIDs.insert(frg.getLibrary());
+ rd2lib[frg.getMatePair().first] = frg.getLibrary();
+ //cerr << "linking " << rd2ctg[mtp.getReads().first] << " and " << rd2ctg[mtp.getReads().second] << endl;
+ }
+ }
+
+ // now we get the library information for each library
+ hash_map<ID_t, pair<Pos_t, SD_t>, hash<ID_t>, equal_to<ID_t> > lib2size;
+ hash_map<ID_t, char, hash<ID_t>, equal_to<ID_t> > lib2adjacency;
+ Library_t lib;
+ for (set<ID_t>::iterator li = libIDs.begin(); li != libIDs.end(); li++){
+ library_bank.fetch(*li, lib);
+ lib2size[*li] = pair<Pos_t, SD_t> (lib.getDistribution().mean, lib.getDistribution().sd);
+ lib2adjacency[*li] = lib.getAdjacency();
+ }
+
+
+ // now we are ready to make up contig links
+ ContigLink_t ctl;
+ for (list<Fragment_t>::iterator mi = frl.begin(); mi != frl.end(); mi++){
+ ID_t
+ rdA = mi->getMatePair().first,
+ rdB = mi->getMatePair().second;
+
+ ID_t libId = rd2lib[rdA];
+
+ ID_t
+ ctgA = rd2ctg[rdA],
+ ctgB = rd2ctg[rdB];
+
+ Size_t
+ lenA = ctglen[ctgA],
+ lenB = ctglen[ctgB];
+
+ Range_t
+ rangeA = rd2posn[rdA],
+ rangeB = rd2posn[rdB];
+
+ bool
+ forwA = false,
+ forwB = false; // orientation of reads in contigs
+
+ Size_t
+ adjA,
+ adjB; // distance from 5' read end to contig end closest to middle of clone
+
+ if (rangeA.getBegin() > rangeA.getEnd()){
+ forwA = false;
+ adjA = rangeA.getBegin();
+ } else {
+ forwA = true;
+ adjA = lenA - rangeA.getBegin();
+ }
+
+ if (rangeB.getBegin() > rangeB.getEnd()){
+ forwB = false;
+ adjB = rangeB.getBegin();
+ } else {
+ forwB = true;
+ adjB = lenB - rangeB.getBegin();
+ }
+
+ ctl.setType(ContigLink_t::MATEPAIR);
+ ctl.setIID(++LinkId);
+ ctl.setContigs(pair<ID_t, ID_t>(ctgA, ctgB));
+ ctl.setSize(lib2size[libId].first - adjA - adjB); // size is length of gap between contigs
+ ctl.setSD(lib2size[libId].second);
+ ctl.setSource(pair<ID_t, NCode_t>(rd2frg[rdA], Fragment_t::NCODE));
+
+ // this assumes the distance is always measured from the outermost points of the conitgs which could be not true for other mate types
+ Adjacency_t matePairType = lib2adjacency[libId];
+
+ switch (matePairType) {
+ case Library_t::OUTIE:
+ if (forwA && ! forwB)
+ ctl.setAdjacency(ContigLink_t::ANTINORMAL);
+ if (forwA && forwB)
+ ctl.setAdjacency(ContigLink_t::OUTIE);
+ if (! forwA && ! forwB)
+ ctl.setAdjacency(ContigLink_t::INNIE);
+ if (! forwA && forwB)
+ ctl.setAdjacency(ContigLink_t::NORMAL);
+ break;
+ case Library_t::NORMAL:
+ if (forwA && ! forwB)
+ ctl.setAdjacency(ContigLink_t::INNIE);
+ if (forwA && forwB)
+ ctl.setAdjacency(ContigLink_t::NORMAL);
+ if (! forwA && ! forwB)
+ ctl.setAdjacency(ContigLink_t::ANTINORMAL);
+ if (! forwA && forwB)
+ ctl.setAdjacency(ContigLink_t::OUTIE);
+ break;
+ case Library_t::ANTINORMAL:
+ if (forwA && ! forwB)
+ ctl.setAdjacency(ContigLink_t::OUTIE);
+ if (forwA && forwB)
+ ctl.setAdjacency(ContigLink_t::ANTINORMAL);
+ if (! forwA && ! forwB)
+ ctl.setAdjacency(ContigLink_t::INNIE);
+ if (! forwA && forwB)
+ ctl.setAdjacency(ContigLink_t::NORMAL);
+ break;
+ case Library_t::NULL_ADJACENCY:
+ case Library_t::INNIE:
+ if (forwA && ! forwB)
+ ctl.setAdjacency(ContigLink_t::NORMAL);
+ if (forwA && forwB)
+ ctl.setAdjacency(ContigLink_t::INNIE);
+ if (! forwA && ! forwB)
+ ctl.setAdjacency(ContigLink_t::OUTIE);
+ if (! forwA && forwB)
+ ctl.setAdjacency(ContigLink_t::ANTINORMAL);
+ break;
+ default:
+ cerr << "Invalid library adjacency " << matePairType << endl;
+ exit(1);
+ };
+
+ try {
+ link_bank << ctl;
+ cerr << "Adding link " << LinkId << endl;
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to append link " << LinkId << " to bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ closeBanks(library_bank, frag_bank, link_bank, contig_bank);
+ exit(1);
+ }
+ }
+
+ closeBanks(library_bank, frag_bank, link_bank, contig_bank);
+
+ return(0);
+} // main
diff --git a/src/Bambus/Makefile.am b/src/Bambus/Makefile.am
new file mode 100644
index 0000000..e88e410
--- /dev/null
+++ b/src/Bambus/Makefile.am
@@ -0,0 +1,16 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+##include $(top_srcdir)/config/amos.mk
+
+##-- TO BE INSTALLED
+
+#dist_bin_SCRIPTS = \
+# goBambus2.py
+
+##-- SUBDIRS TO RECURSE
+SUBDIRS = \
+ Bundler \
+ Output \
+ Untangler
+
+
+##-- END OF MAKEFILE --##
diff --git a/src/Bambus/Makefile.in b/src/Bambus/Makefile.in
new file mode 100644
index 0000000..5b60a05
--- /dev/null
+++ b/src/Bambus/Makefile.in
@@ -0,0 +1,570 @@
+# 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 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@
+
+#dist_bin_SCRIPTS = \
+# goBambus2.py
+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@
+subdir = src/Bambus
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUBDIRS = \
+ Bundler \
+ Output \
+ Untangler
+
+all: all-recursive
+
+.SUFFIXES:
+$(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) --foreign src/Bambus/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Bambus/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):
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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: ctags-recursive $(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
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(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:
+
+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-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.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 ctags \
+ ctags-recursive distclean distclean-generic 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 \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
+ tags-recursive 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.
+.NOEXPORT:
diff --git a/src/Bambus/Output/Linearize.cc b/src/Bambus/Output/Linearize.cc
new file mode 100644
index 0000000..d3fef4e
--- /dev/null
+++ b/src/Bambus/Output/Linearize.cc
@@ -0,0 +1,323 @@
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <getopt.h>
+
+#include <set>
+#include <vector>
+
+#include "datatypes_AMOS.hh"
+#include "Bank_AMOS.hh"
+#include "BankStream_AMOS.hh"
+
+#include "Contig_AMOS.hh"
+#include "ContigEdge_AMOS.hh"
+#include "Scaffold_AMOS.hh"
+#include "Motif_AMOS.hh"
+#include "Utilities_Bundler.hh"
+
+using namespace std;
+using namespace HASHMAP;
+using namespace AMOS;
+using namespace Bundler;
+
+struct config {
+ string bank;
+ int32_t version;
+ int32_t debug;
+};
+
+HASHMAP::hash_map<AMOS::ID_t, int32_t, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > *Bundler::cte2weight = NULL;
+
+void linearizeScaffolds(std::vector<Scaffold_t> &scaffs,
+ AMOS::Bank_t &edge_bank,
+ HASHMAP::hash_map<AMOS::ID_t, std::set<AMOS::ID_t, EdgeWeightCmp>*, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > &ctg2lnk,
+ int32_t debugLevel) {
+ std::vector<Scaffold_t> linearScaffolds;
+ AMOS::ID_t scfIID = 1;
+
+ for(std::vector<AMOS::Scaffold_t>::iterator itScf = scaffs.begin(); itScf < scaffs.end(); ++itScf) {
+ HASHMAP::hash_map<AMOS::ID_t, std::set<AMOS::ID_t>*, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > ctg2conflict;
+ HASHMAP::hash_map<AMOS::ID_t, int, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > visited; // contigs we've processed
+ AMOS::ContigEdge_t cte;
+
+ for (std::vector<AMOS::Tile_t>::const_iterator tileIt = itScf->getContigTiling().begin(); tileIt < itScf->getContigTiling().end(); ++tileIt) {
+ visited[tileIt->source] = 0;
+
+ std::set<AMOS::ID_t>* s = ctg2conflict[tileIt->source];
+ if (s == NULL) { s = new std::set<AMOS::ID_t>(); ctg2conflict[tileIt->source] = s;}
+cerr << "Initialize conflicts for node " << tileIt->source << endl;
+
+ for (std::vector<AMOS::Tile_t>::const_iterator tilePrev = itScf->getContigTiling().begin(); tilePrev < tileIt; ++tilePrev) {
+ if (tilePrev->offset + (tilePrev->range.getLength() - 1) > tileIt->offset) {
+ // it conflicts me
+ std::set<AMOS::ID_t>* s = ctg2conflict[tileIt->source];
+ s->insert(tilePrev->source);
+ ctg2conflict[tileIt->source] = s;
+ }
+ }
+ for (std::vector<AMOS::Tile_t>::const_iterator tileNext = tileIt+1; tileNext < itScf->getContigTiling().end() && (tileNext->offset < tileIt->offset + (tileIt->range.getLength()-1)); ++tileNext) {
+ // it conflicts me
+ std::set<AMOS::ID_t>* s = ctg2conflict[tileIt->source];
+ s->insert(tileNext->source);
+ ctg2conflict[tileIt->source] = s;
+ }
+ }
+
+ // now that we have conflicting links we can go and add contigs and all their neighbors until we find a conflict
+ bool done = false;
+ while (!done) {
+ done = true;
+ for (std::vector<AMOS::Tile_t>::const_iterator tileIt = itScf->getContigTiling().begin(); tileIt < itScf->getContigTiling().end(); ++tileIt) {
+ if (visited[tileIt->source] == 0) {
+ // create a new scaffold here
+ AMOS::Scaffold_t scaff;
+ std::vector<AMOS::Tile_t> tiles;
+ std::vector<AMOS::ID_t> edges;
+
+ done = false;
+
+ HASHMAP::hash_map<AMOS::ID_t, int, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > inCurrScf;
+ inCurrScf[tileIt->source] = 1;
+
+ std::queue<AMOS::ID_t> current_nodes;
+ current_nodes.push(tileIt->source);
+
+ while (current_nodes.size() != 0) {
+ AMOS::ID_t curr = current_nodes.front();
+ current_nodes.pop();
+
+ if (visited[curr] == 1) continue;
+ visited[curr] = 1;
+
+ std::set<AMOS::ID_t, EdgeWeightCmp>* s = ctg2lnk[curr];
+ if (s == NULL) { continue; }
+ for (std::set<AMOS::ID_t, EdgeWeightCmp>::iterator i = s->begin(); i != s->end(); ++i) {
+ checkEdgeID(*i);
+ edge_bank.fetch(*i, cte);
+ checkEdge(cte);
+
+ if (isBadEdge(cte)) { continue; }
+ AMOS::ID_t neighbor = getEdgeDestination(curr, cte);
+ if (visited[neighbor] == 1 || inCurrScf[neighbor] == 1 || ctg2conflict[neighbor] == NULL) { continue; }
+ std::set<AMOS::ID_t> *conflicts = ctg2conflict[neighbor];
+ bool hasConflicts = false;
+
+ for (std::set<AMOS::ID_t>::iterator j = conflicts->begin(); j != conflicts->end(); ++j) {
+ if (inCurrScf[*j] == 1) {
+ hasConflicts = true;
+ break;
+ }
+ }
+
+ if (hasConflicts) {
+ setEdgeStatus(cte, edge_bank, BAD_RPT, false);
+ } else {
+ current_nodes.push(neighbor);
+ inCurrScf[neighbor] = 1;
+ }
+ } // neighbors loop
+ } // current connected set of nodes
+
+ // loop through all the contigs and edges to see if they should be assigned to the current scaffold
+ for (std::vector<AMOS::Tile_t>::const_iterator scfTiles = itScf->getContigTiling().begin(); scfTiles < itScf->getContigTiling().end(); ++scfTiles) {
+ if (inCurrScf[scfTiles->source] == 1) { tiles.push_back(*scfTiles); }
+ }
+ for (std::vector<AMOS::ID_t>::const_iterator edgeIt = itScf->getContigEdges().begin(); edgeIt < itScf->getContigEdges().end(); ++edgeIt) {
+ edge_bank.fetch(*edgeIt, cte);
+ if (inCurrScf[cte.getContigs().first] == 1 && inCurrScf[cte.getContigs().second] == 1) { edges.push_back(cte.getIID()); }
+ }
+
+ scaff.setContigEdges(edges);
+ scaff.setContigTiling(tiles);
+ scaff.setIID(scfIID);
+ linearScaffolds.push_back(scaff);
+ scfIID++;
+ } // if node is not visited
+ } // for all nodes in the current scaffolds
+ } // while we are not done with the current scaffold
+ }
+
+ scaffs = linearScaffolds;
+}
+
+config globals;
+void printHelpText() {
+ cerr <<
+ "\n"
+ "Output text results for Bambus\n"
+ "\n"
+ "USAGE:\n"
+ "\n"
+ "OutputText -b[ank] <bank_name> [-version n]\n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv) {
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"version", 1, 0, 'v'},
+ {0, 0, 0, 0}
+ };
+
+ globals.version = Bank_t::OPEN_LATEST_VERSION;
+
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ break;
+ case 'b':
+ globals.bank = string(optarg);
+ break;
+ case 'v':
+ globals.version = atoi(optarg);
+ break;
+ case '?':
+ return false;
+ }
+ }
+
+ // print summary
+ if (globals.debug >= 1) {
+ cerr << "Options summary:" << endl;
+ cerr << "Bank = \t" << globals.bank << endl;
+ }
+
+ return true;
+} // GetOptions
+
+int main(int argc, char *argv[]) {
+ if (!GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ if (globals.bank == ""){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ Bank_t edge_bank (ContigEdge_t::NCODE);
+ if (! edge_bank.exists(globals.bank)){
+ cerr << "No edge account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ edge_bank.open(globals.bank, B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open edge account in bank " << globals.bank << ": " << endl << e << endl;
+ edge_bank.close();
+ exit(1);
+ }
+
+ Bank_t contig_bank (Contig_t::NCODE);
+ if (! contig_bank.exists(globals.bank)){
+ cerr << "No contig account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ contig_bank.open(globals.bank, B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open contig account in bank " << globals.bank << ": " << endl << e << endl;
+ contig_bank.close();
+ exit(1);
+ }
+
+ Bank_t motif_bank (Motif_t::NCODE);
+ if (! motif_bank.exists(globals.bank)) {
+ cerr << "No motif account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ motif_bank.open(globals.bank, B_READ | B_WRITE, globals.version, false);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open motif account in bank " << globals.bank << " : " << endl << e << endl;
+ motif_bank.close();
+ exit(1);
+ }
+
+ BankStream_t scf_stream (Scaffold_t::NCODE);
+ if (! scf_stream.exists(globals.bank)) {
+ cerr << "No scaffold account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ scf_stream.open(globals.bank, B_READ | B_WRITE, globals.version, false);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open scaffold account in bank " << globals.bank << " : " << endl << e << endl;
+ scf_stream.close();
+ exit(1);
+ }
+
+ // build index of edges
+ cte2weight = new hash_map<ID_t, int32_t, hash<ID_t>, equal_to<ID_t> >();
+ hash_map<ID_t, set<ID_t, EdgeWeightCmp>*, hash<ID_t>, equal_to<ID_t> > ctg2lnk; // map from contig to edges
+ ContigEdge_t cte;
+ for (AMOS::IDMap_t::const_iterator ci = edge_bank.getIDMap().begin(); ci; ++ci) {
+ edge_bank.fetch(ci->iid, cte);
+
+ if (isBadEdge(cte)) {
+ continue;
+ }
+
+ if (cte.getIID() == 0 || cte.getContigs().first == 0 || cte.getContigs().second == 0) {
+ // TODO: CTGs with links to ID 0 indicate links to/from singletons. Incorporate singletons into assembly?
+ if (globals.debug >= 0) {
+ cerr << "WARNING: link " << cte.getIID() << " (" << cte.getContigs().first << ", " << cte.getContigs().second << ") connects to a singleton, it is being ignored" << endl;
+ }
+ continue;
+ }
+ (*cte2weight)[cte.getIID()] = cte.getContigLinks().size();
+ set<ID_t, EdgeWeightCmp>* s = ctg2lnk[cte.getContigs().first];
+ if (s == NULL) { s = new set<ID_t, EdgeWeightCmp>();}
+ s->insert(cte.getIID());
+ ctg2lnk[cte.getContigs().first] = s;
+
+ s = ctg2lnk[cte.getContigs().second];
+ if (s == NULL) { s = new set<ID_t, EdgeWeightCmp>();};
+ s->insert(cte.getIID());
+ ctg2lnk[cte.getContigs().second] = s;
+ }
+
+ Scaffold_t scf;
+ vector<Scaffold_t> scfs;
+ while (scf_stream >> scf) {
+ scfs.push_back(scf);
+cerr << "Adding scf id " << scf.getIID() << endl;
+ }
+ linearizeScaffolds(scfs, edge_bank, ctg2lnk, globals.debug);
+
+ // finally clear and output the new scaffolds
+ scf_stream.clearCurrentVersion();
+ for (std::vector<Scaffold_t>::iterator it = scfs.begin(); it != scfs.end(); it++) {
+ scf_stream.append(*it);
+ }
+ Motif_t mtf;
+ for (std::vector<Scaffold_t>::iterator it = scfs.begin(); it != scfs.end(); it++) {
+ vector<Tile_t> st = it->getContigTiling();
+ ID_t scfIID = it->getIID();
+
+ for (vector<Tile_t>::iterator tile = st.begin(); tile != st.end(); tile++) {
+ if (tile->source_type == Motif_t::NCODE) {
+ motif_bank.fetch(tile->source, mtf);
+ mtf.setScf(scfIID);
+ motif_bank.replace(mtf.getIID(), mtf);
+ }
+ }
+ }
+
+ edge_bank.close();
+ contig_bank.close();
+ motif_bank.close();
+ scf_stream.close();
+
+ delete(cte2weight);
+}
diff --git a/src/Bambus/Output/Makefile.am b/src/Bambus/Output/Makefile.am
new file mode 100755
index 0000000..d430177
--- /dev/null
+++ b/src/Bambus/Output/Makefile.am
@@ -0,0 +1,55 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+##-- TO BE INSTALLED
+bin_PROGRAMS = \
+ OutputMotifs \
+ OutputScaffolds \
+ Linearize \
+ OutputResults
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_srcdir)/src/GNU \
+ -I$(top_srcdir)/src/Bambus/Bundler \
+ $(BOOST_CXXFLAGS) \
+ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
+ -pedantic
+
+##-- OutputMotifs \
+OutputMotifs_LDADD = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+OutputMotifs_SOURCES = \
+ Position.cc Position.hh OutputMotifs.cc
+
+##-- OutputMotifs \
+OutputScaffolds_LDADD = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+OutputScaffolds_SOURCES = \
+ Position.cc Position.hh OutputScaffolds.cc
+
+OutputResults_LDADD = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+OutputResults_SOURCES = \
+ Output_Utils.cc Output_Utils.hh OutputResults.cc
+
+Linearize_LDADD = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+Linearize_SOURCES = \
+ Linearize.cc
+
+##-- END OF MAKEFILE --##
diff --git a/src/Bambus/Output/Makefile.in b/src/Bambus/Output/Makefile.in
new file mode 100644
index 0000000..9f2c61b
--- /dev/null
+++ b/src/Bambus/Output/Makefile.in
@@ -0,0 +1,648 @@
+# 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 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@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = OutputMotifs$(EXEEXT) OutputScaffolds$(EXEEXT) \
+ Linearize$(EXEEXT) OutputResults$(EXEEXT)
+subdir = src/Bambus/Output
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_Linearize_OBJECTS = Linearize.$(OBJEXT)
+Linearize_OBJECTS = $(am_Linearize_OBJECTS)
+Linearize_DEPENDENCIES = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_OutputMotifs_OBJECTS = Position.$(OBJEXT) OutputMotifs.$(OBJEXT)
+OutputMotifs_OBJECTS = $(am_OutputMotifs_OBJECTS)
+OutputMotifs_DEPENDENCIES = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_OutputResults_OBJECTS = Output_Utils.$(OBJEXT) \
+ OutputResults.$(OBJEXT)
+OutputResults_OBJECTS = $(am_OutputResults_OBJECTS)
+OutputResults_DEPENDENCIES = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_OutputScaffolds_OBJECTS = Position.$(OBJEXT) \
+ OutputScaffolds.$(OBJEXT)
+OutputScaffolds_OBJECTS = $(am_OutputScaffolds_OBJECTS)
+OutputScaffolds_DEPENDENCIES = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(Linearize_SOURCES) $(OutputMotifs_SOURCES) \
+ $(OutputResults_SOURCES) $(OutputScaffolds_SOURCES)
+DIST_SOURCES = $(Linearize_SOURCES) $(OutputMotifs_SOURCES) \
+ $(OutputResults_SOURCES) $(OutputScaffolds_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_srcdir)/src/GNU \
+ -I$(top_srcdir)/src/Bambus/Bundler \
+ $(BOOST_CXXFLAGS) \
+ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
+ -pedantic
+
+OutputMotifs_LDADD = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+OutputMotifs_SOURCES = \
+ Position.cc Position.hh OutputMotifs.cc
+
+OutputScaffolds_LDADD = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+OutputScaffolds_SOURCES = \
+ Position.cc Position.hh OutputScaffolds.cc
+
+OutputResults_LDADD = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+OutputResults_SOURCES = \
+ Output_Utils.cc Output_Utils.hh OutputResults.cc
+
+Linearize_LDADD = \
+ $(top_builddir)/src/Bambus/Bundler/libBundler.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+Linearize_SOURCES = \
+ Linearize.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Bambus/Output/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Bambus/Output/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):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+Linearize$(EXEEXT): $(Linearize_OBJECTS) $(Linearize_DEPENDENCIES)
+ @rm -f Linearize$(EXEEXT)
+ $(CXXLINK) $(Linearize_OBJECTS) $(Linearize_LDADD) $(LIBS)
+OutputMotifs$(EXEEXT): $(OutputMotifs_OBJECTS) $(OutputMotifs_DEPENDENCIES)
+ @rm -f OutputMotifs$(EXEEXT)
+ $(CXXLINK) $(OutputMotifs_OBJECTS) $(OutputMotifs_LDADD) $(LIBS)
+OutputResults$(EXEEXT): $(OutputResults_OBJECTS) $(OutputResults_DEPENDENCIES)
+ @rm -f OutputResults$(EXEEXT)
+ $(CXXLINK) $(OutputResults_OBJECTS) $(OutputResults_LDADD) $(LIBS)
+OutputScaffolds$(EXEEXT): $(OutputScaffolds_OBJECTS) $(OutputScaffolds_DEPENDENCIES)
+ @rm -f OutputScaffolds$(EXEEXT)
+ $(CXXLINK) $(OutputScaffolds_OBJECTS) $(OutputScaffolds_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Linearize.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/OutputMotifs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/OutputResults.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/OutputScaffolds.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Output_Utils.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Position.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+
+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 $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-binPROGRAMS clean-generic 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-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ 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-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Bambus/Output/OutputMotifs.cc b/src/Bambus/Output/OutputMotifs.cc
new file mode 100644
index 0000000..0a8c818
--- /dev/null
+++ b/src/Bambus/Output/OutputMotifs.cc
@@ -0,0 +1,354 @@
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <getopt.h>
+#include <math.h>
+#include <limits>
+#include <string>
+#include <map>
+#include <set>
+#include <queue>
+#include <iterator>
+#include <iostream>
+
+#ifdef AMOS_HAVE_BOOST
+#include <boost/config.hpp>
+#include <boost/utility.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#endif //AMOS_HAVE_BOOST
+
+#include "fasta.hh"
+#include "datatypes_AMOS.hh"
+#include "Bank_AMOS.hh"
+#include "BankStream_AMOS.hh"
+
+#include "Utilities_Bundler.hh"
+#include "Contig_AMOS.hh"
+#include "ContigEdge_AMOS.hh"
+#include "Scaffold_AMOS.hh"
+#include "Motif_AMOS.hh"
+
+#include "Position.hh"
+
+using namespace std;
+using namespace HASHMAP;
+using namespace AMOS;
+
+#ifdef AMOS_HAVE_BOOST
+/* give access to common Boost data types through our interface */
+// Vertex properties
+typedef boost::property<boost::vertex_name_t, uint32_t> VertexProperty;
+// Adjacency graph using list data structure
+typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, VertexProperty> Graph;
+// Accessors
+typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;
+typedef boost::graph_traits<Graph>::edge_descriptor Edge;
+typedef boost::graph_traits<Graph>::vertex_iterator VertexIterator;
+typedef boost::graph_traits<Graph>::out_edge_iterator EdgeIterator;
+
+// Properties
+typedef boost::property_map<Graph, boost::vertex_name_t>::type VertexName;
+#endif //AMOS_HAVE_BOOST
+
+struct config {
+ string bank;
+ int32_t debug;
+ int32_t version;
+};
+config globals;
+void printHelpText() {
+ cerr <<
+ "\n"
+ "Output fasta sequence for Bambus motifs along with alternate sequence\n"
+ "\n"
+ "USAGE:\n"
+ "\n"
+ "OutputMotifs -b[ank] <bank_name> [-version n] \n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv) {
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"version", 1, 0, 'v'},
+ {0, 0, 0, 0}
+ };
+
+ globals.debug = 0;
+ globals.version = Bank_t::OPEN_LATEST_VERSION;
+
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ break;
+ case 'b':
+ globals.bank = string(optarg);
+ break;
+ case 'v':
+ globals.version = atoi(optarg);
+ break;
+ case '?':
+ return false;
+ }
+ }
+
+ // print summary
+ if (globals.debug >= 1) {
+ cerr << "Options summary:" << endl;
+ cerr << "Bank = \t" << globals.bank << endl;
+ }
+
+ return true;
+} // GetOptions
+
+#ifdef AMOS_HAVE_BOOST
+Vertex computeSource(Graph g) {
+ Vertex source;
+ uint32_t counter = 0;
+ hash_map<Vertex, bool, hash<Vertex>, equal_to<Vertex> > edgeIncoming;
+
+ pair<VertexIterator, VertexIterator> i;
+ for (i = boost::vertices(g); i.first != i.second; ++i.first) {
+ Vertex first = *i.first;
+ if (boost::in_degree(first, g) == 0) {
+ if (counter != 0) {
+ cerr << "Error: multiple source nodes for graph" << endl;
+ exit(1);
+ }
+ else {
+ counter++;
+ source = first;
+ }
+ }
+ }
+ if (counter == 0) {
+ cerr << "Error: no source node for graph" << endl;
+ exit(1);
+ } else {
+ return (source);
+ }
+}
+
+Position traverseRecursive(
+ Bank_t &contig_bank,
+ Graph g,
+ ID_t current,
+ hash_map<ID_t, Tile_t, hash<ID_t>, equal_to<ID_t> >& nodeToTile,
+ hash_map<ID_t, Vertex, hash<ID_t>, equal_to<ID_t> >& nodeToDescriptor,
+ hash_map<ID_t, uint32_t, hash<ID_t>, equal_to<ID_t> > &visited,
+ hash_map<ID_t, vector<Position>, hash<ID_t>, equal_to<ID_t> > &paths,
+ hash_map<ID_t, Position, hash<ID_t>, equal_to<ID_t> > &longest,
+ vector<Position> &edits,
+ hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > &seq,
+ hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > &seqNames) {
+ // need to get offset and range for the sequence
+ Tile_t tile = nodeToTile[current];
+ Position p;
+
+ if (tile.source_type == Contig_t::NCODE) {
+ Contig_t ctg;
+ contig_bank.fetch(current, ctg);
+ string gapped = ctg.getSeqString(tile.range);
+ p = Position(ctg.getEID(), tile.offset, tile.offset + tile.range.getLength(), gapped);
+ } else if (seq.find(tile.source) != seq.end()) {
+ // get pre-made sequence
+ p = Position(seqNames[tile.source], tile.offset, tile.offset + tile.range.getLength(), seq[tile.source]);
+ } else {
+ fprintf(stderr, "Error: no sequence known for tile %d\n", tile.source);
+ assert(0);
+ }
+
+ VertexName vertexNames = get(boost::vertex_name, g);
+
+ if (visited.find(current) == visited.end()) {
+ visited[current] = 1;
+
+ // get edges
+ EdgeIterator out_i, out_end;
+ if (boost::out_degree(nodeToDescriptor[current], g) == 0) {
+ paths[current].push_back(p);
+ longest[current] = p;
+ } else {
+ vector<Position> myPaths;
+ for (tie(out_i, out_end) = boost::out_edges(nodeToDescriptor[current], g); out_i != out_end; ++out_i) {
+ myPaths.push_back(traverseRecursive(contig_bank, g, vertexNames[boost::target(*out_i, g)], nodeToTile, nodeToDescriptor, visited, paths, longest, edits, seq, seqNames));
+ }
+
+ Position myLongestPath;
+ for (vector<Position>::const_iterator i = myPaths.begin(); i < myPaths.end(); i++) {
+ Position merged = p.merge(*i, edits);
+ paths[current].push_back(merged);
+
+ if (myLongestPath.getSequence().size() == 0 || merged.getLength() > myLongestPath.getLength()) {
+ myLongestPath = merged;
+ }
+ }
+ longest[current] = myLongestPath;
+ }
+ }
+ return longest[current];
+}
+
+Position traverseSet(Motif_t &scf, Bank_t & contig_bank, Bank_t &edge_bank, vector<Position> &edits,
+ hash_map<ID_t, vector<Position>, hash<AMOS::ID_t>, equal_to<AMOS::ID_t> > &paths,
+ hash_map<AMOS::ID_t, Position, hash<AMOS::ID_t>, equal_to<AMOS::ID_t> > &longest,
+ hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > &seq,
+ hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > &seqNames) {
+ // do a DFS traversal to find if we can skip the node
+ hash_map<ID_t, uint32_t, hash<ID_t>, equal_to<ID_t> > visited;
+ Graph g;
+ hash_map<ID_t, Vertex, hash<ID_t>, equal_to<ID_t> > nodeToDescriptor;
+ hash_map<ID_t, Tile_t, hash<ID_t>, equal_to<ID_t> > nodeToTile;
+ VertexName vertexNames = get(boost::vertex_name, g);
+
+ // build boost-based graph
+ for (vector<Tile_t>::const_iterator tileIt = scf.getContigTiling().begin(); tileIt < scf.getContigTiling().end(); tileIt++) {
+ nodeToDescriptor[tileIt->source] = boost::add_vertex(g);
+ vertexNames[nodeToDescriptor[tileIt->source] ] = tileIt->source;
+ nodeToTile[tileIt->source] = *tileIt;
+ }
+
+ for (vector<ID_t>::const_iterator edgeIt = scf.getContigEdges().begin(); edgeIt < scf.getContigEdges().end(); edgeIt++) {
+ ContigEdge_t cte;
+ edge_bank.fetch((*edgeIt), cte);
+ if (Bundler::isBadEdge(cte)) {
+ continue;
+ }
+ if (nodeToDescriptor.find(cte.getContigs().first) == nodeToDescriptor.end() || nodeToDescriptor.find(cte.getContigs().second) == nodeToDescriptor.end()) {
+ continue;
+ }
+ pair<Edge, bool> e = boost::add_edge(nodeToDescriptor[cte.getContigs().first], nodeToDescriptor[cte.getContigs().second], g);
+ }
+
+ return traverseRecursive(contig_bank, g, vertexNames[computeSource(g)], nodeToTile, nodeToDescriptor, visited, paths, longest, edits, seq, seqNames);
+}
+
+Position translateSetToPaths(Motif_t &scf, Bank_t &motif_bank, Bank_t &contig_bank, Bank_t &edge_bank, vector<Position>& edits, hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > &seq, hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > &seqNames) {
+ Position result;
+ hash_map<ID_t, vector<Position>, hash<ID_t>, equal_to<ID_t> > paths;
+ hash_map<ID_t, Position, hash<ID_t>, equal_to<ID_t> > longest;
+
+ for (std::vector<Tile_t>::const_iterator tileIt = scf.getContigTiling().begin(); tileIt < scf.getContigTiling().end(); tileIt++) {
+ fprintf(stderr, "Processing tile %d in scf %d and tile source type is %d and motif is %d and contig is %d\n", tileIt->source, scf.getIID(), tileIt->source_type, Motif_t::NCODE, Contig_t::NCODE);
+ if (tileIt->source_type == Motif_t::NCODE) {
+ Motif_t subScf;
+ motif_bank.fetch(tileIt->source, subScf);
+ Position subResult = translateSetToPaths(subScf, motif_bank, contig_bank, edge_bank, edits, seq, seqNames);
+ seq[tileIt->source] = subResult.getSequence();
+ seqNames[tileIt->source] = subScf.getEID();
+ result = result.merge(subResult, edits);
+ }
+ }
+ result = result.merge(traverseSet(scf, contig_bank, edge_bank, edits, paths, longest, seq, seqNames), edits);
+
+ // now that we have built up the paths, add the replacements to the edit list
+ for (hash_map<ID_t, vector<Position>, hash<ID_t>, equal_to<ID_t> >::iterator it = paths.begin(); it != paths.end(); it++) {
+ for (vector<Position>::iterator ctg = it->second.begin(); ctg < it->second.end(); ctg++) {
+ if ((*ctg) != (longest[it->first])) {
+ ctg->setEditType(Position::REPLACE);
+ edits.push_back(*ctg);
+ }
+ }
+ }
+
+ return result;
+}
+#endif
+
+void outputMotif(Motif_t &scf, Bank_t &motif_bank, Bank_t &contig_bank, Bank_t &edge_bank) {
+#ifdef AMOS_HAVE_BOOST
+ vector<Position> edits;
+ hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > seq;
+ hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > seqNames;
+ Position result = translateSetToPaths(scf, motif_bank, contig_bank, edge_bank, edits, seq, seqNames);
+ // print the main sequence
+ Fasta_Print(stdout, result.getUngappedSequence().c_str(), result.getName().c_str());
+
+ // output the edits
+ for (vector<Position>::const_iterator it = edits.begin(); it < edits.end(); it++) {
+ stringstream header;
+ header << it->getName() << " "
+ << (it->getEditType() == Position::REPLACE ? "REPLACE" : "EDIT") << " RANGE ("
+ << (it->getStart()-result.getStart()) << ", "
+ << (it->getEnd()-result.getStart()) << ")";
+
+ Fasta_Print(stdout, it->getUngappedSequence().c_str(), header.str().c_str());
+ }
+#else
+ cerr << "Error: the boost library cannot be found. Will not be outputting motif " << scf.getEID() << " consisting of " << scf.getContigTiling().size() << endl;
+#endif
+}
+
+int main(int argc, char *argv[]) {
+ if (!GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ if (globals.bank == ""){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ Bank_t edge_bank (ContigEdge_t::NCODE);
+ if (! edge_bank.exists(globals.bank)){
+ cerr << "No edge account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ edge_bank.open(globals.bank, B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open edge account in bank " << globals.bank << ": " << endl << e << endl;
+ edge_bank.close();
+ exit(1);
+ }
+
+ Bank_t contig_bank (Contig_t::NCODE);
+ if (! contig_bank.exists(globals.bank)){
+ cerr << "No contig account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ contig_bank.open(globals.bank, B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open contig account in bank " << globals.bank << ": " << endl << e << endl;
+ contig_bank.close();
+ exit(1);
+ }
+
+ Bank_t motif_bank (Motif_t::NCODE);
+ if (! motif_bank.exists(globals.bank)) {
+ cerr << "No motif account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ motif_bank.open(globals.bank, B_READ, globals.version);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open motif account in bank " << globals.bank << " : " << endl << e << endl;
+ motif_bank.close();
+ exit(1);
+ }
+
+ Motif_t scf;
+ for (AMOS::IDMap_t::const_iterator ci = motif_bank.getIDMap().begin(); ci; ci++) {
+ motif_bank.fetch(ci->iid, scf);
+
+ // output fasta for motif scaffolds
+ if (scf.getStatus() == Bundler::MOTIF_SCAFFOLD) {
+ outputMotif(scf, motif_bank, contig_bank, edge_bank);
+ }
+ }
+
+ edge_bank.close();
+ contig_bank.close();
+ motif_bank.close();
+}
diff --git a/src/Bambus/Output/OutputResults.cc b/src/Bambus/Output/OutputResults.cc
new file mode 100644
index 0000000..b4a4a24
--- /dev/null
+++ b/src/Bambus/Output/OutputResults.cc
@@ -0,0 +1,176 @@
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <getopt.h>
+
+#include "fasta.hh"
+#include "datatypes_AMOS.hh"
+#include "Bank_AMOS.hh"
+#include "BankStream_AMOS.hh"
+
+#include "Output_Utils.hh"
+#include "Contig_AMOS.hh"
+#include "ContigEdge_AMOS.hh"
+#include "Scaffold_AMOS.hh"
+#include "Motif_AMOS.hh"
+
+using namespace std;
+using namespace HASHMAP;
+using namespace AMOS;
+using namespace Bundler;
+
+struct config {
+ string bank;
+ string prefix;
+ int32_t debug;
+ int32_t version;
+ bool outputBambus;
+};
+config globals;
+void printHelpText() {
+ cerr <<
+ "\n"
+ "Output text results for Bambus\n"
+ "\n"
+ "USAGE:\n"
+ "\n"
+ "OutputText -b[ank] <bank_name> -p <prefix> [-version n]\n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv) {
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"bambus1", 0, 0, '1'},
+ {"prefix", 1, 0, 'p'},
+ {"version", 1, 0, 'v'},
+ {0, 0, 0, 0}
+ };
+
+ globals.prefix = "out";
+ globals.version = Bank_t::OPEN_LATEST_VERSION;
+ globals.outputBambus = false;
+
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ break;
+ case 'b':
+ globals.bank = string(optarg);
+ break;
+ case '1':
+ globals.outputBambus = true;
+ break;
+ case 'p':
+ globals.prefix = string(optarg);
+ break;
+ case 'v':
+ globals.version = atoi(optarg);
+ break;
+ case '?':
+ return false;
+ }
+ }
+
+ // print summary
+ if (globals.debug >= 1) {
+ cerr << "Options summary:" << endl;
+ cerr << "Bank = \t" << globals.bank << endl;
+ cerr << "Prefix = \t" << globals.prefix << endl;
+ }
+
+ return true;
+} // GetOptions
+
+int main(int argc, char *argv[]) {
+ if (!GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ if (globals.bank == ""){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ Bank_t edge_bank (ContigEdge_t::NCODE);
+ if (! edge_bank.exists(globals.bank)){
+ cerr << "No edge account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ edge_bank.open(globals.bank, B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open edge account in bank " << globals.bank << ": " << endl << e << endl;
+ edge_bank.close();
+ exit(1);
+ }
+
+ Bank_t contig_bank (Contig_t::NCODE);
+ if (! contig_bank.exists(globals.bank)){
+ cerr << "No contig account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ contig_bank.open(globals.bank, B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open contig account in bank " << globals.bank << ": " << endl << e << endl;
+ contig_bank.close();
+ exit(1);
+ }
+
+ BankStream_t motif_stream (Motif_t::NCODE);
+ if (! motif_stream.exists(globals.bank)) {
+ cerr << "No motif account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ motif_stream.open(globals.bank, B_READ, globals.version);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open motif account in bank " << globals.bank << " : " << endl << e << endl;
+ motif_stream.close();
+ exit(1);
+ }
+
+ BankStream_t scf_stream (Scaffold_t::NCODE);
+ if (! scf_stream.exists(globals.bank)) {
+ cerr << "No scaffold account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ scf_stream.open(globals.bank, B_READ, globals.version);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open scaffold account in bank " << globals.bank << " : " << endl << e << endl;
+ scf_stream.close();
+ exit(1);
+ }
+
+ outputResults(globals.bank, contig_bank, edge_bank, motif_stream, scf_stream, DOT, globals.prefix, globals.debug);
+ motif_stream.seekg(0,BankStream_t::BEGIN);
+ scf_stream.seekg(0,BankStream_t::BEGIN);
+
+ outputResults(globals.bank, contig_bank, edge_bank, motif_stream, scf_stream, AGP, globals.prefix, globals.debug);
+ motif_stream.seekg(0,BankStream_t::BEGIN);
+ scf_stream.seekg(0,BankStream_t::BEGIN);
+
+ if (globals.outputBambus == true) {
+ outputResults(globals.bank, contig_bank, edge_bank, motif_stream, scf_stream, BAMBUS, globals.prefix, globals.debug);
+ motif_stream.seekg(0,BankStream_t::BEGIN);
+ scf_stream.seekg(0,BankStream_t::BEGIN);
+ }
+
+ outputResults(globals.bank, contig_bank, edge_bank, motif_stream, scf_stream, MOTIFS, globals.prefix, globals.debug);
+
+ edge_bank.close();
+ contig_bank.close();
+ motif_stream.close();
+ scf_stream.close();
+}
diff --git a/src/Bambus/Output/OutputScaffolds.cc b/src/Bambus/Output/OutputScaffolds.cc
new file mode 100644
index 0000000..4aad856
--- /dev/null
+++ b/src/Bambus/Output/OutputScaffolds.cc
@@ -0,0 +1,232 @@
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <getopt.h>
+#include <math.h>
+#include <limits>
+#include <string>
+#include <map>
+#include <set>
+#include <queue>
+#include <iterator>
+#include <iostream>
+
+#ifdef AMOS_HAVE_BOOST
+#include <boost/config.hpp>
+#include <boost/utility.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#endif //AMOS_HAVE_BOOST
+
+#include "fasta.hh"
+#include "datatypes_AMOS.hh"
+#include "Bank_AMOS.hh"
+#include "BankStream_AMOS.hh"
+
+#include "Utilities_Bundler.hh"
+#include "Contig_AMOS.hh"
+#include "ContigEdge_AMOS.hh"
+#include "Scaffold_AMOS.hh"
+#include "Motif_AMOS.hh"
+
+#include "Position.hh"
+
+using namespace std;
+using namespace HASHMAP;
+using namespace AMOS;
+
+struct config {
+ string bank;
+ int32_t debug;
+ int32_t version;
+};
+config globals;
+void printHelpText() {
+ cerr <<
+ "\n"
+ "Output fasta sequence for Bambus scaffolds\n"
+ "\n"
+ "USAGE:\n"
+ "\n"
+ "OutputScaffolds -b[ank] <bank_name> \n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv) {
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"version", 1, 0, 'v'},
+ {0, 0, 0, 0}
+ };
+
+ int c;
+ globals.version = Bank_t::OPEN_LATEST_VERSION;
+
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ break;
+ case 'b':
+ globals.bank = string(optarg);
+ break;
+ case 'v':
+ globals.version = atoi(optarg);
+ break;
+ case '?':
+ return false;
+ }
+ }
+
+ // print summary
+ if (globals.debug >= 1) {
+ cerr << "Options summary:" << endl;
+ cerr << "Bank = \t" << globals.bank << endl;
+ }
+
+ return true;
+} // GetOptions
+
+void outputScaffold(Scaffold_t &scf, Bank_t &contig_bank, Bank_t &edge_bank) {
+ ID_t max = contig_bank.getMaxIID();
+ vector<Position> edits;
+ Position result;
+ std::ostringstream stream;
+ stream << "scf" << scf.getIID();
+
+ for (std::vector<Tile_t>::const_iterator tileIt = scf.getContigTiling().begin(); tileIt < scf.getContigTiling().end(
+); tileIt++) {
+ if (tileIt->source > max) {
+ cerr << "Error: unknown contig id " << tileIt->source << endl;
+ exit(1);
+ }
+ Contig_t ctg;
+ contig_bank.fetch(tileIt->source, ctg);
+ string gapped = ctg.getSeqString(tileIt->range);
+ result = result.merge(Position(ctg.getEID(), tileIt->offset, tileIt->offset + tileIt->range.getLength(), gapped), edits);
+ }
+ // print the main sequence
+ Fasta_Print(stdout, result.getUngappedSequence().c_str(), stream.str().c_str());
+}
+
+int main(int argc, char *argv[]) {
+ if (!GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ if (globals.bank == ""){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ Bank_t edge_bank (ContigEdge_t::NCODE);
+ if (! edge_bank.exists(globals.bank)){
+ cerr << "No edge account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ edge_bank.open(globals.bank, B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open edge account in bank " << globals.bank << ": " << endl << e << endl;
+ edge_bank.close();
+ exit(1);
+ }
+
+ Bank_t contig_bank (Contig_t::NCODE);
+ if (! contig_bank.exists(globals.bank)){
+ cerr << "No contig account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ contig_bank.open(globals.bank, B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open contig account in bank " << globals.bank << ": " << endl << e << endl;
+ contig_bank.close();
+ exit(1);
+ }
+
+ Bank_t scaffold_bank (Scaffold_t::NCODE);
+ if (! scaffold_bank.exists(globals.bank)) {
+ cerr << "No scaffold account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ scaffold_bank.open(globals.bank, B_READ, globals.version);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open scaffold account in bank " << globals.bank << " : " << endl << e << endl;
+ scaffold_bank.close();
+ exit(1);
+ }
+
+ Bank_t motif_bank (Motif_t::NCODE);
+ if (! motif_bank.exists(globals.bank)) {
+ cerr << "No motif account found in bank " << globals.bank << endl;
+ exit(1);
+ }
+ try {
+ motif_bank.open(globals.bank, B_READ, globals.version);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open motif account in bank " << globals.bank << " : " << endl << e << endl;
+ motif_bank.close();
+ exit(1);
+ }
+
+ // first expand motifs if we have any
+ Motif_t mtf;
+ Scaffold_t scf;
+ HASHMAP::hash_map<AMOS::ID_t, Scaffold_t, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > scfMap;
+ for (AMOS::IDMap_t::const_iterator ci = scaffold_bank.getIDMap().begin(); ci; ci++) {
+ scaffold_bank.fetch(ci->iid, scf);
+ scfMap[scf.getIID()] = scf;
+ }
+
+ for (AMOS::IDMap_t::const_iterator ci = motif_bank.getIDMap().begin(); ci; ci++) {
+ motif_bank.fetch(ci->iid, mtf);
+ scf = scfMap[mtf.getScf()];
+ vector<Tile_t> t = mtf.getContigTiling();
+ vector<ID_t> e = mtf.getContigEdges();
+
+ vector<Tile_t> st = scf.getContigTiling();
+ vector<ID_t> se = scf.getContigEdges();
+ st.insert(st.begin(), t.begin(), t.end());
+ se.insert(se.begin(), e.begin(), e.end());
+ scf.setContigTiling(st);
+ scf.setContigEdges(se);
+ scfMap[scf.getIID()] = scf;
+ }
+
+ vector<Scaffold_t> scfs;
+ for (HASHMAP::hash_map<AMOS::ID_t, Scaffold_t, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> >::iterator it = scfMap.begin(); it != scfMap.end(); ++it) {
+ scfs.push_back(it->second);
+ }
+
+ // remove the motif tiles as well
+ for (vector<Scaffold_t>::iterator it = scfs.begin(); it != scfs.end(); ++it) {
+ vector<Tile_t> st = it->getContigTiling();
+ for (vector<Tile_t>::iterator tile = st.begin(); tile != st.end(); ) {
+ if (tile->source_type == Motif_t::NCODE) {
+ tile = st.erase(tile);
+ } else {
+ ++tile;
+ }
+ }
+ it->setContigTiling(st);
+ }
+
+ for (vector<Scaffold_t>::iterator it = scfs.begin(); it != scfs.end(); ++it) {
+ outputScaffold((*it), contig_bank, edge_bank);
+ }
+
+ edge_bank.close();
+ contig_bank.close();
+ motif_bank.close();
+ scaffold_bank.close();
+ motif_bank.close();
+}
diff --git a/src/Bambus/Output/Output_Utils.cc b/src/Bambus/Output/Output_Utils.cc
new file mode 100644
index 0000000..077f893
--- /dev/null
+++ b/src/Bambus/Output/Output_Utils.cc
@@ -0,0 +1,665 @@
+#include <iostream>
+
+#include "Output_Utils.hh"
+#include "Utilities_Bundler.hh"
+
+#include "universals_AMOS.hh"
+#include "Library_AMOS.hh"
+#include "Fragment_AMOS.hh"
+#include "Overlap_AMOS.hh"
+#include "Contig_AMOS.hh"
+#include "ContigLink_AMOS.hh"
+#include "ContigEdge_AMOS.hh"
+#include "Scaffold_AMOS.hh"
+#include "Motif_AMOS.hh"
+
+namespace Bundler
+{
+AMOS::Bank_t *global_edge_bank = NULL;
+
+struct EdgeOrderCmp
+{
+ bool operator () (const AMOS::ID_t & a, const AMOS::ID_t & b)
+ {
+ assert(global_edge_bank);
+ AMOS::ContigEdge_t ctgA, ctgB;
+ global_edge_bank->fetch(a, ctgA);
+ global_edge_bank->fetch(b, ctgB);
+
+ if (ctgA.getContigs().first != ctgB.getContigs().first) {
+ if (ctgA.getContigs().first < ctgB.getContigs().first) return true;
+ if (ctgA.getContigs().first > ctgB.getContigs().first) return false;
+ }
+ if (ctgA.getContigs().second != ctgB.getContigs().second) {
+ if (ctgA.getContigs().second < ctgB.getContigs().second) return true;
+ if (ctgA.getContigs().second > ctgB.getContigs().second) return false;
+ }
+
+ if (!isBadEdge(ctgA)) return true;
+
+ return false;
+ }
+};
+
+AMOS::ID_t translateCLKtoFRG(AMOS::Bank_t &link_bank, AMOS::ID_t linkID);
+void outputEdge(std::ofstream &stream, AMOS::Bank_t &edge_bank, AMOS::ID_t iid, const char *start, const char *end, const char *direction);
+void outputEdges(std::ostream &stream, AMOS::Bank_t &edge_bank, AMOS::ID_t currCtg, int32_t edgeTypes[], int32_t debug);
+
+void outputLibrary(const std::string &outputPrefix, int32_t debug);
+void outputEvidenceXML(const std::string &bank, AMOS::Bank_t &contig_bank, const std::string &outputPrefix, int32_t debug);
+void outputOutXML(const std::string &bank, AMOS::Bank_t &edge_bank, AMOS::BankStream_t &scf_stream, const std::string &outputPrefix, int32_t debug);
+
+void outputAGP(AMOS::Bank_t &contig_bank, AMOS::BankStream_t &scf_stream, const std::string& outputPrefix, int32_t debug);
+void outputDOT(AMOS::Bank_t &contig_bank, AMOS::Bank_t &edge_bank,
+ AMOS::Scaffold_t *node,
+ AMOS::BankStream_t &scf_stream,
+ const std::string &outputPrefix,
+ int32_t debug);
+void outputDOT(AMOS::Bank_t &contig_bank, AMOS::Bank_t &edge_bank,
+ AMOS::Scaffold_t *node,
+ AMOS::BankStream_t &scf_stream,
+ const std::string &outputPrefix,
+ bool allEdges, int32_t debug);
+void outputMotifs(AMOS::Bank_t &contig_bank, AMOS::Bank_t &edge_bank,
+ AMOS::BankStream_t &motif_stream,
+ const std::string &outputPrefix,
+ int32_t debug);
+void outputBAMBUS(const std::string &bank,
+ AMOS::Bank_t &contig_bank,
+ AMOS::Bank_t &edge_bank,
+ AMOS::BankStream_t &scf_stream,
+ const std::string &outputPrefix,
+ int32_t debug);
+
+void outputAGP(AMOS::Bank_t &contig_bank, AMOS::BankStream_t &scf_stream, const std::string &outputPrefix, int32_t debug) {
+ AMOS::Contig_t ctg;
+
+ std::string outputFile = outputPrefix + ".agp";
+ std::ofstream stream;
+ stream.open(outputFile.c_str(), std::ios::out);
+
+ stream << "# DESCRIPTION: WGS SCAFFOLDS GENERATED FROM AMOS BANK" << std::endl;
+
+ AMOS::Scaffold_t scf;
+ AMOS::ID_t maxIID = contig_bank.getMaxIID();
+
+ while (scf_stream >> scf) {
+ int32_t counter = 0;
+ int32_t lastEnd = 0;
+
+ for (std::vector<AMOS::Tile_t>::const_iterator tileIt = scf.getContigTiling().begin(); tileIt < scf.getContigTiling().end(); tileIt++) {
+ // output the gap
+ if (lastEnd != 0 && (tileIt->offset - lastEnd != 0)) {
+ stream << scf.getIID();
+ stream << "\t" << lastEnd << "\t" << tileIt->offset;
+ stream << "\t" << counter;
+ stream << "\t" << (tileIt->offset - lastEnd + 1);
+ stream << "\tfragment\tyes";
+
+ stream << std::endl;
+ counter++;
+ }
+
+ std::string sign = "+";
+ if (tileIt->range.isReverse()) { sign = "-"; }
+
+ stream << scf.getIID();
+ stream << "\t" << (tileIt->offset+1) << "\t" << (tileIt->offset+tileIt->range.getLength());
+ stream << "\t" << counter << "\tW";
+
+ int32_t outputID = 0;
+ if (tileIt->source <= maxIID) {
+ contig_bank.fetch(tileIt->source, ctg);
+ if (ctg.getEID().size() != 0) {
+ stream << "\t" << ctg.getEID();
+ outputID = 1;
+ }
+ }
+ if (outputID == 0) stream << "\t" << tileIt->source;
+
+ stream << "\t" << tileIt->range.getLo()+1 << "\t" << tileIt->range.getHi();
+ stream << "\t" << sign;
+ stream << std::endl;
+
+ counter++;
+ lastEnd = tileIt->offset+tileIt->range.getLength()+1;
+ }
+ }
+
+ stream.close();
+}
+
+void outputEdge(std::ostream &stream, AMOS::Bank_t &edge_bank, AMOS::ID_t iid, const char *start, const char *end, const char *direction) {
+ AMOS::ContigEdge_t outputEdge;
+ edge_bank.fetch(iid, outputEdge);
+
+ stream << outputEdge.getContigs().first << ":" << start << "->" << outputEdge.getContigs().second << ":" << end;
+ stream << " [ label=\"" << outputEdge.getIID() << " orientation=" << outputEdge.getAdjacency() << " weight=" << outputEdge.getContigLinks().size() << " distance=" << outputEdge.getSize() << " stdev=" << outputEdge.getSD();
+
+ if (outputEdge.getStatus() == BAD_TRNS) {
+ stream << " (REDUNDANT) ";
+ }
+ else if (isBadEdge(outputEdge)) {
+ stream << " (UNUSED) ";
+ }
+ stream << "\" dir=\"" << direction << "\" fontsize = 8 solid color=\"black\" ]\n";
+}
+
+void outputEdges(std::ostream &stream, AMOS::Bank_t &edge_bank, AMOS::ID_t currCtg, int32_t edgeTypes[], int32_t debug) {
+ if (currCtg != 0) {
+ if (edgeTypes[3] != 0) {
+ outputEdge(stream, edge_bank, edgeTypes[3], "w", "w", "back");
+ }
+ if (edgeTypes[2] != 0) {
+ outputEdge(stream, edge_bank, edgeTypes[2], "e", "e", "forward");
+ }
+ if (edgeTypes[1] != 0) {
+ outputEdge(stream, edge_bank, edgeTypes[1], "w", "e", "back");
+ }
+ if (edgeTypes[0] != 0) {
+ outputEdge(stream, edge_bank, edgeTypes[0], "e", "w", "forward");
+ } else if (debug >= 3) {
+ std::cerr << "WARNING: NO GOOD EDGE BETWEEN CONTIGS" << std::endl;
+ }
+ }
+}
+
+void outputDOT(AMOS::Bank_t &contig_bank, AMOS::Bank_t &edge_bank,
+ AMOS::Scaffold_t *node, AMOS::BankStream_t &scf_stream,
+ const std::string &outputPrefix,
+ int32_t debug)
+{
+ outputDOT(contig_bank, edge_bank, node, scf_stream, outputPrefix, false, debug);
+}
+
+void outputDOT(AMOS::Bank_t &contig_bank, AMOS::Bank_t &edge_bank,
+ AMOS::Scaffold_t *node, AMOS::BankStream_t &scf_stream,
+ const std::string &outputPrefix,
+ bool allEdges,
+ int32_t debug)
+{
+ AMOS::Contig_t ctg;
+ AMOS::ID_t maxIID = contig_bank.getMaxIID();
+
+ std::string outputFile = outputPrefix + ".dot";
+ std::ofstream stream;
+ stream.open(outputFile.c_str(), std::ios::out);
+
+ stream << "digraph ROOT {" << std::endl;
+ stream << " rankdir = LR" << std::endl;
+ stream << " rotate = 90" << std::endl;
+ stream << " ranksep = 0.01" << std::endl;
+ stream << " nodesep = 0.01" << std::endl;
+ stream << " fontsize = 8" << std::endl;
+ stream << " margin = \".01,.01\"" << std::endl;
+ stream << " ratio = fill" << std::endl;
+ stream << " size = \"11,8.5\"" << std::endl;
+
+ HASHMAP::hash_map<AMOS::ID_t, int32_t, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > visited;
+ while (scf_stream >> (*node)) {
+ AMOS::ID_t scfID = AMOS::NULL_ID;
+ if (dynamic_cast<AMOS::Scaffold_t *>(node) != NULL) {
+ scfID = node->getIID();
+ } else if (dynamic_cast<AMOS::Motif_t *>(node) != NULL) {
+ scfID = (dynamic_cast<AMOS::Motif_t *>(node))->getScf();
+ } else {
+ std::cerr << "Error: Unknown object type passed to output " << node->getNCode() << std::endl;
+ continue;
+ }
+
+ HASHMAP::hash_map<AMOS::ID_t, int32_t, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > ctginscf;
+ HASHMAP::hash_map<AMOS::ID_t, contigOrientation, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > ctgori;
+
+ stream << "subgraph cluster_" << scfID << "{" << std::endl;
+ stream << "\tlabel = \"" << scfID << "\"" << std::endl;
+
+ for (std::vector<AMOS::Tile_t>::const_iterator tileIt = node->getContigTiling().begin(); tileIt < node->getContigTiling().end(); tileIt++) {
+ ctginscf[tileIt->source] = 1;
+ ctgori[tileIt->source] = (tileIt->range.isReverse() ? REV : FWD);
+
+ int32_t angle = -90;
+ if (tileIt->range.isReverse()) { angle = 90; }
+
+ int32_t outputID = 0;
+ stream << "\t" << tileIt->source << " [label=\"" ;
+ if (tileIt->source <= maxIID) {
+ contig_bank.fetch(tileIt->source, ctg);
+ if (ctg.getEID().size() != 0) {
+ stream << ctg.getEID();
+ outputID = 1;
+ }
+ }
+ if (outputID == 0) stream << tileIt->source;
+
+ stream << " position=(" << tileIt->offset << "," << tileIt->offset + tileIt->range.getLength() - 1;
+ stream << ") length=" << tileIt->range.getLength() << "\" height=0.2, fontsize=8, shape=\"house\", ";
+ stream << "orientation=" << angle << " ]" << std::endl;
+ }
+ AMOS::ID_t currCtg = 0;
+ AMOS::ID_t secondCtg = 0;
+ int32_t edgeTypes[4];
+
+ // sort before output
+ global_edge_bank = &edge_bank;
+ sort(node->getContigEdges().begin(), node->getContigEdges().end(), EdgeOrderCmp());
+ global_edge_bank = NULL;
+
+ for (std::vector<AMOS::ID_t>::const_iterator edgeIt = node->getContigEdges().begin(); edgeIt < node->getContigEdges().end(); edgeIt++) {
+ AMOS::ContigEdge_t cte;
+ edge_bank.fetch(*edgeIt, cte);
+
+ if (allEdges == false && (ctginscf[cte.getContigs().first] != 1 || ctginscf[cte.getContigs().second] != 1)) {
+ continue;
+ }
+
+ if (currCtg != cte.getContigs().first || secondCtg != cte.getContigs().second) {
+ outputEdges(stream, edge_bank, currCtg, edgeTypes, debug);
+
+ currCtg = cte.getContigs().first;
+ secondCtg = cte.getContigs().second;
+ memset(edgeTypes, 0, sizeof(int32_t)*4);
+ }
+ if (visited[cte.getIID()] == 0) {
+ // output the edges based on the orient of the contigs
+ contigOrientation edgeFirstCtgOrient = ctgori[cte.getContigs().first];
+ contigOrientation edgeSecondCtgOrient = ctgori[cte.getContigs().second];
+
+ contigOrientation first = FWD;
+ if (cte.getAdjacency() == AMOS::ContigEdge_t::ANTINORMAL || cte.getAdjacency() == AMOS::ContigEdge_t::OUTIE) {
+ first = REV;
+ }
+ contigOrientation secondCtgOrient = getOrientation(first, cte);
+
+ if (debug >= 3) {
+ std::cerr << "****The firstOrient is " << edgeFirstCtgOrient << " and second is " << edgeSecondCtgOrient << std::endl;
+ std::cerr << "The edge type is " << cte.getAdjacency() << " and we initialized first to be " << first << std::endl;
+ std::cerr << "****The orient we get are " << first << " and second is " << secondCtgOrient << std::endl;
+ }
+ if (first == edgeFirstCtgOrient && secondCtgOrient == edgeSecondCtgOrient) {
+ edgeTypes[0] = (edgeTypes[0] == 0 || !isBadEdge(cte.getIID(), edge_bank) ? cte.getIID() : edgeTypes[0]);
+
+ if (debug >= 3) { std::cerr << "*** MAIN EDGE BETWEEN " << cte.getContigs().first << " AND " << cte.getContigs().second << " IS " << cte.getAdjacency() <<std::endl; }
+ }
+ else if (first != edgeFirstCtgOrient && secondCtgOrient == edgeSecondCtgOrient) {
+ if (debug >= 3) { std::cerr << "*** D, S EDGE BETWEEN " << cte.getContigs().first << " AND " << cte.getContigs().second << " IS " << cte.getAdjacency() <<std::endl;}
+ edgeTypes[1] = (edgeTypes[1] == 0 || !isBadEdge(cte.getIID(), edge_bank) ? cte.getIID() : edgeTypes[1]);
+ }
+ else if (first == edgeFirstCtgOrient && secondCtgOrient != edgeSecondCtgOrient) {
+ if (debug >= 3) { std::cerr << "*** S, D EDGE BETWEEN " << cte.getContigs().first << " AND " << cte.getContigs().second << " IS " << cte.getAdjacency() <<std::endl; }
+ edgeTypes[2] = (edgeTypes[2] == 0 || !isBadEdge(cte.getIID(), edge_bank) ? cte.getIID() : edgeTypes[2]);
+ }
+ else {
+ if (debug >= 3) { std::cerr << "*** D, D EDGE BETWEEN " << cte.getContigs().first << " AND " << cte.getContigs().second << " IS " << cte.getAdjacency() <<std::endl; }
+ edgeTypes[3] = (edgeTypes[3] == 0 || !isBadEdge(cte.getIID(), edge_bank) ? cte.getIID() : edgeTypes[3]);
+ }
+ } else {
+ std::cerr << "IN SCAFFOLD " << scfID << " ENCOUNTERED EDGE " << cte.getIID() << "THAT IVE ALREADY SEEN!!" << std::endl;
+ assert(0);
+ }
+ visited[cte.getIID()] = 1;
+ }
+ outputEdges(stream, edge_bank, currCtg, edgeTypes, debug);
+ stream << "}" << std::endl;
+ }
+ stream << "}" << std::endl;
+ stream.close();
+}
+
+void outputMotifs(AMOS::Bank_t &contig_bank, AMOS::Bank_t &edge_bank,
+ AMOS::BankStream_t &motif_stream,
+ const std::string &outputPrefix,
+ int32_t debug)
+{
+ if (motif_stream.getSize() == 0) {
+ return;
+ }
+
+ // output the dot file of motifs
+ AMOS::Motif_t *motif = new AMOS::Motif_t();
+ outputDOT(contig_bank, edge_bank, motif, motif_stream, outputPrefix + ".noreduce", true, debug);
+ motif_stream.seekg(0,AMOS::BankStream_t::BEGIN);
+
+ // output the set of motifs
+ std::string outputFile = outputPrefix + ".sets";
+ std::ofstream stream;
+ stream.open(outputFile.c_str(), std::ios::out);
+
+ while (motif_stream >> (*motif)) {
+ stream << motif->getEID() << " :";
+ for (std::vector<AMOS::Tile_t>::const_iterator tileIt = motif->getContigTiling().begin(); tileIt < motif->getContigTiling().end(); tileIt++) {
+ stream << " " << tileIt->source;
+ }
+ stream << std::endl;
+ }
+ stream.close();
+ delete motif;
+}
+
+AMOS::ID_t translateCLKtoFRG(AMOS::Bank_t &link_bank, AMOS::ID_t linkID) {
+ // for fragment-based links, translate their ID to the source
+ AMOS::ContigLink_t clk;
+ link_bank.fetch(linkID, clk);
+
+ std::pair<AMOS::ID_t, AMOS::NCode_t> source = clk.getSource();
+ AMOS::ID_t iid = linkID;
+
+ if (source.second == AMOS::Fragment_t::NCODE) {
+ iid = source.first;
+ }
+
+ return iid;
+}
+
+void outputLibrary(const std::string &bank, const std::string &outputPrefix, int32_t debug) {
+ AMOS::BankStream_t library_stream (AMOS::Library_t::NCODE);
+ if (!library_stream.exists(bank)){
+ std::cerr << "No library account found in bank " << bank << std::endl;
+ exit(1);
+ }
+ try {
+ library_stream.open(bank, AMOS::B_READ);
+ } catch (AMOS::Exception_t & e) {
+ std::cerr << "Failed to open library account in bank " << bank << ": " << std::endl << e << std::endl;
+ exit(1);
+ }
+
+ std::string outputFile = outputPrefix + ".library";
+ std::ofstream stream;
+ stream.open(outputFile.c_str(), std::ios::out);
+
+ AMOS::Library_t lib;
+ while (library_stream >> lib) {
+ stream << lib.getEID() << " " << lib.getIID() << std::endl;
+ }
+
+ stream.close();
+ library_stream.close();
+}
+
+void outputEvidenceXML(const std::string &bank, AMOS::Bank_t &contig_bank, const std::string &outputPrefix, int32_t debug) {
+ AMOS::BankStream_t library_stream (AMOS::Library_t::NCODE);
+ if (!library_stream.exists(bank)){
+ std::cerr << "No library account found in bank " << bank << std::endl;
+ exit(1);
+ }
+ try {
+ library_stream.open(bank, AMOS::B_READ);
+ } catch (AMOS::Exception_t & e) {
+ std::cerr << "Failed to open library account in bank " << bank << ": " << std::endl << e << std::endl;
+ exit(1);
+ }
+ AMOS::BankStream_t frag_stream (AMOS::Fragment_t::NCODE);
+ if (!frag_stream.exists(bank)){
+ std::cerr << "No fragment account found in bank " << bank << std::endl;
+ exit(1);
+ }
+ try {
+ frag_stream.open(bank, AMOS::B_READ);
+ } catch (AMOS::Exception_t & e) {
+ std::cerr << "Failed to open fragment account in bank " << bank << ": " << std::endl << e << std::endl;
+ exit(1);
+ }
+ AMOS::BankStream_t link_stream (AMOS::ContigLink_t::NCODE);
+ if (!link_stream.exists(bank)){
+ std::cerr << "No contig link account found in bank " << bank << std::endl;
+ exit(1);
+ }
+ try {
+ link_stream.open(bank, AMOS::B_READ);
+ } catch (AMOS::Exception_t & e) {
+ std::cerr << "Failed to open contig link account in bank " << bank << ": " << std::endl << e << std::endl;
+ exit(1);
+ }
+
+ std::string outputFile = outputPrefix + ".evidence.xml";
+ std::ofstream stream;
+ stream.open(outputFile.c_str(), std::ios::out);
+
+ time_t t;
+ time(&t);
+ stream << "<?xml version=\"1.0\" ?>" << std::endl;
+ stream << std::endl;
+ stream << "<EVIDENCE ID=\"" + outputPrefix << "\"" << std::endl;
+ stream << "\t\tDATE=\"" << ctime(&t) << "\"" << std::endl;
+ stream << "\t\tPROJECT=\"catXML\"" << std::endl;
+ stream << "\t\tPARAMETERS=\"" << outputFile << "\"" << std::endl;
+ stream << ">" << std::endl;
+
+ // output libraries
+ // build a map for library to fragments
+ AMOS::Fragment_t frg;
+ HASHMAP::hash_map<AMOS::ID_t, std::vector<AMOS::Fragment_t>, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > lib2frg;
+ while (frag_stream >> frg) {
+ lib2frg[frg.getLibrary()].push_back(frg);
+ }
+
+ AMOS::Library_t lib;
+ while (library_stream >> lib) {
+ double min = lib.getDistribution().mean - (3*lib.getDistribution().sd);
+ double max = lib.getDistribution().mean + (3*lib.getDistribution().sd);
+ stream << "\t<LIBRARY ID=\"" << lib.getIID() << "\" NAME=\"" << lib.getEID() << "\" MIN=\"" << min << "\" MAX=\"" << max << "\">" << std::endl;
+
+ for (std::vector<AMOS::Fragment_t>::const_iterator i = lib2frg[lib.getIID()].begin(); i < lib2frg[lib.getIID()].end(); i++) {
+ stream << "\t\t<INSERT ID=\"ins_" << i->getIID() << "\" NAME=\"" << i->getEID() << "\">" << std::endl;
+ stream << "\t\t\t<SEQUENCE ID=\"seq_" << i->getMatePair().first << "\" NAME=\"" << i->getEID() << "_L\"></SEQUENCE>" << std::endl;
+ stream << "\t\t\t<SEQUENCE ID=\"seq_" << i->getMatePair().second << "\" NAME=\"" << i->getEID() << "_R\"></SEQUENCE>" << std::endl;
+ stream << "\t\t</INSERT>" << std::endl;
+ }
+
+ stream << "\t</LIBRARY>" << std::endl;
+ }
+ frag_stream.close();
+ library_stream.close();
+
+ // output contigs
+ for (AMOS::IDMap_t::const_iterator ci = contig_bank.getIDMap().begin(); ci; ci++) {
+ AMOS::Contig_t ctg;
+ contig_bank.fetch(ci->iid, ctg);
+
+ stream << "\t<CONTIG ID=\"contig_" << ctg.getIID() << "\" NAME=\"" << ctg.getEID() << "\" LEN=\"" << ctg.getLength() << "\">" << std::endl;
+ const std::vector<AMOS::Tile_t> &tiling = ctg.getReadTiling();
+ for (std::vector<AMOS::Tile_t>::const_iterator i = tiling.begin(); i < tiling.end(); i++) {
+ stream << "\t\t<SEQUENCE ID=\"seq_" << i->source
+ << "\" ORI=\"" << (i->range.isReverse() ? "EB" : "BE") << "\" ASM_LEND=\"" << i->offset << "\" ASM_REND=\"" << i->getRightOffset()
+ << "\"></SEQUENCE>" << std::endl;
+ }
+ stream << "\t</CONTIG>" << std::endl;
+ }
+
+ // here we output any CTE between contigs that are not the result of link data
+ AMOS::ContigLink_t clk;
+ while (link_stream >> clk) {
+ if (clk.getSource().second != AMOS::Fragment_t::NCODE) {
+ stream << "\t<LINK ID=\"link_" << clk.getIID() << "\" SIZE=\"" << clk.getSize() << "\"TYPE=\"" << clk.getType() << "\">" << std::endl;
+ std::string oriCtgA = "BE";
+ std::string oriCtgB = "BE";
+ switch (clk.getAdjacency()) {
+ case AMOS::Link_t::NORMAL:
+ oriCtgA = oriCtgB = "BE";
+ break;
+ case AMOS::Link_t::ANTINORMAL:
+ oriCtgA = oriCtgB = "EB";
+ break;
+ case AMOS::Link_t::OUTIE:
+ oriCtgA = "EB";
+ oriCtgB = "BE";
+ break;
+ case AMOS::Link_t::INNIE:
+ oriCtgA = "BE";
+ oriCtgB = "EB";
+ break;
+ };
+ stream << "\t\t<CONTIG ID=\"" << clk.getContigs().first << "\"ORI=\"" << oriCtgA << "\">" << std::endl;
+ stream << "\t\t<CONTIG ID=\"" << clk.getContigs().second << "\"ORI=\"" << oriCtgB << "\">" << std::endl;
+ }
+ }
+
+ stream << "</EVIDENCE>" << std::endl;
+ stream.close();
+ link_stream.close();
+}
+
+void outputOutXML(const std::string &bank, AMOS::Bank_t &edge_bank, AMOS::BankStream_t &scf_stream, const std::string &outputPrefix, int32_t debug) {
+ AMOS::Bank_t link_bank (AMOS::ContigLink_t::NCODE);
+ if (!link_bank.exists(bank)){
+ std::cerr << "No contig link account found in bank " << bank << std::endl;
+ exit(1);
+ }
+ try {
+ link_bank.open(bank, AMOS::B_READ);
+ } catch (AMOS::Exception_t & e) {
+ std::cerr << "Failed to open contig link account in bank " << bank << ": " << std::endl << e << std::endl;
+ exit(1);
+ }
+
+ HASHMAP::hash_map<AMOS::ID_t, int, HASHMAP::hash<AMOS::ID_t>, HASHMAP::equal_to<AMOS::ID_t> > outputLinks;
+ std::string outputFile = outputPrefix + ".out.xml";
+ std::ofstream stream;
+ stream.open(outputFile.c_str(), std::ios::out);
+
+ stream << "<GROUPING>" << std::endl;
+ AMOS::Scaffold_t scf;
+ while (scf_stream >> scf) {
+ stream << "\t<SCAFFOLD ID = \"scaff_" << scf.getIID() << "\">" << std::endl;
+
+ // output the contigs
+ for (std::vector<AMOS::Tile_t>::const_iterator tileIt = scf.getContigTiling().begin(); tileIt < scf.getContigTiling().end(); tileIt++) {
+ std::string ori = "BE";
+ if (tileIt->range.isReverse()) { ori = "EB"; }
+
+ stream << "\t\t<CONTIG ID=\"contig_" << tileIt->source << "\"" << std::endl;
+ stream << "\tX=\"" << tileIt->offset << "\"" << std::endl;
+ stream << "\tORI=\"" << ori << "\"" << std::endl;
+ stream << "></CONTIG>" << std::endl;
+ }
+
+ // output the links in the scaffold
+ for (std::vector<AMOS::ID_t>::const_iterator edgeIt = scf.getContigEdges().begin(); edgeIt < scf.getContigEdges().end(); edgeIt++) {
+ AMOS::ContigEdge_t cte;
+ edge_bank.fetch(*edgeIt, cte);
+
+
+ if (!isBadEdge(cte)) {
+ std::vector<AMOS::ID_t>::const_iterator linkIt = cte.getContigLinks().begin();
+ for (; linkIt < cte.getContigLinks().end(); linkIt++) {
+ stream << "\t\t<LINK ID=\"ins_" << translateCLKtoFRG(link_bank, *linkIt) << "\"" << std::endl;
+ stream << "\tVALID=\"VALID\"" << std::endl;
+ stream << "\tTAG=\"T\"" << std::endl;
+ stream << "></LINK>" << std::endl;
+
+ // store list of links weve output
+ outputLinks[(*linkIt)] = 1;
+ }
+ }
+ }
+ stream << "\t</SCAFFOLD>" << std::endl;
+ }
+
+ // output the bad edges
+ stream << "\t<UNUSED>" << std::endl;
+ for (AMOS::IDMap_t::const_iterator ci = edge_bank.getIDMap().begin(); ci; ci++) {
+ AMOS::ContigEdge_t cte;
+ edge_bank.fetch(ci->iid, cte);
+
+ std::string status;
+ if (!isBadEdge(cte)) {
+ continue;
+ }
+
+ switch (cte.getStatus()) {
+ case BAD_THRESH:
+ case BAD_RPT:
+ status = "UNSEEN";
+ break;
+ case BAD_SKIP:
+ case BAD_SCF:
+ status = "UNUSED";
+ break;
+ case BAD_DST:
+ status = "LEN";
+ break;
+ case BAD_ORI:
+ status = "ORI";
+ break;
+ case BAD_TRNS:
+ status = "TRANSITIVE";
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ for (std::vector<AMOS::ID_t>::const_iterator linkIt = cte.getContigLinks().begin(); linkIt < cte.getContigLinks().end(); linkIt++) {
+ stream << "\t\t<LINK ID=\"ins_" << translateCLKtoFRG(link_bank, *linkIt) << "\"" << std::endl;
+ stream << "\t\t\tVALID=\"" << status << "\"" << std::endl;
+ stream << "\t\t\tTAG=\"T\"" << std::endl;
+ stream << "\t\t></LINK>" << std::endl;
+
+ outputLinks[(*linkIt)] = 1;
+ }
+ }
+
+ // finally make sure all links have been output
+ for (AMOS::IDMap_t::const_iterator ci = link_bank.getIDMap().begin(); ci; ci++) {
+
+ if (outputLinks[ci->iid] != 1) {
+ stream << "\t\t<LINK ID=\"ins_" << translateCLKtoFRG(link_bank, ci->iid) << "\"" << std::endl;
+ stream << "\t\t\tVALID=\"" << "UNUSED" << "\"" << std::endl;
+ stream << "\t\t\tTAG=\"T\"" << std::endl;
+ stream << "\t\t></LINK>" << std::endl;
+ }
+ }
+
+ stream << "\t</UNUSED>" << std::endl;
+ stream << "</GROUPING>" << std::endl;
+ stream.close();
+
+ link_bank.close();
+}
+
+void outputBAMBUS(
+ const std::string &bank,
+ AMOS::Bank_t &contig_bank,
+ AMOS::Bank_t &edge_bank,
+ AMOS::BankStream_t &scf_stream,
+ const std::string &outputPrefix,
+ int32_t debug)
+{
+ outputLibrary(bank, outputPrefix, debug);
+ outputEvidenceXML(bank, contig_bank, outputPrefix, debug);
+ outputOutXML(bank, edge_bank, scf_stream, outputPrefix, debug);
+}
+
+void outputResults(
+ const std::string &bank,
+ AMOS::Bank_t &contig_bank,
+ AMOS::Bank_t &edge_bank,
+ AMOS::BankStream_t &motif_stream,
+ AMOS::BankStream_t &scf_stream,
+ outputType type,
+ const std::string &outputPrefix,
+ int32_t debug)
+{
+ AMOS::Scaffold_t * scf = new AMOS::Scaffold_t();
+
+ if (scf_stream.getSize() == 0) {
+ return;
+ }
+
+ switch (type) {
+ case AGP:
+ outputAGP(contig_bank, scf_stream, outputPrefix, debug);
+ break;
+ case DOT:
+ outputDOT(contig_bank, edge_bank, scf, scf_stream, outputPrefix, debug);
+ break;
+ case MOTIFS:
+ outputMotifs(contig_bank, edge_bank, motif_stream, outputPrefix, debug);
+ break;
+ case BAMBUS:
+ outputBAMBUS(bank, contig_bank, edge_bank, scf_stream, outputPrefix, debug);
+ break;
+ }
+ delete scf;
+ }
+}
diff --git a/src/Bambus/Output/Output_Utils.hh b/src/Bambus/Output/Output_Utils.hh
new file mode 100644
index 0000000..503aa7e
--- /dev/null
+++ b/src/Bambus/Output/Output_Utils.hh
@@ -0,0 +1,23 @@
+#ifndef OUTPUT_UTILS_HH_
+#define OUTPUT_UTILS_HH_
+
+#include <string>
+
+#include "Bank_AMOS.hh"
+#include "BankStream_AMOS.hh"
+
+namespace Bundler
+{
+ enum outputType{AGP, DOT, MOTIFS, BAMBUS};
+
+ void outputResults(
+ const std::string &bank,
+ AMOS::Bank_t &contig_bank,
+ AMOS::Bank_t &edge_bank,
+ AMOS::BankStream_t &motif_stream,
+ AMOS::BankStream_t &scf_stream,
+ outputType type,
+ const std::string &outputPrefix,
+ int32_t debug);
+}
+#endif
diff --git a/src/Bambus/Output/Position.cc b/src/Bambus/Output/Position.cc
new file mode 100644
index 0000000..54cda87
--- /dev/null
+++ b/src/Bambus/Output/Position.cc
@@ -0,0 +1,146 @@
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <limits>
+#include <string>
+
+#include "Position.hh"
+
+Position::Position() {
+ name = sequence = std::string();
+ start = end = 0;
+}
+
+Position::Position(std::string rangeName, uint32_t rangeStart, uint32_t rangeEnd, std::string seq) {
+ name = rangeName;
+ start = rangeStart;
+ end = rangeEnd;
+ sequence = seq;
+}
+
+Position::Position(const Position &other) {
+ name = other.name;
+ start = other.start;
+ end = other.end;
+ sequence = other.sequence;
+ editType = other.editType;
+}
+
+Position Position::merge(const Position &p, std::vector<Position>& edits) {
+ Position result;
+
+ if (sequence.length() == 0) {
+ result = p;
+ } else if (p.sequence.length() == 0) {
+ result = (*this);
+ } else {
+ result.name = name + "_" + p.name;
+ result.start = (p.start < start ? p.start : start);
+ result.end = (p.end > end ? p.end : end);
+
+ std::string fasta(result.end - result.start, 'N');
+ uint32_t ovlStart = (p.start > start ? p.start : start);
+ uint32_t ovlEnd = (p.end < end ? p.end : end);
+
+ fasta.replace(p.start - result.start, p.end - p.start, p.sequence);
+ fasta.replace(start - result.start, end - start, sequence);
+ if (ovlEnd > ovlStart && (ovlEnd-ovlStart) > 0) {
+ // get the real overlapping position (those not involving Ns)
+ std::string overlap = fasta.substr(ovlStart - result.start, ovlEnd - ovlStart);
+ size_t offset = 0;
+
+ // Skip delimiters at beginning.
+ std::string::size_type lastPos = overlap.find_first_not_of("N", 0);
+ // Find first "non-delimiter".
+ std::string::size_type pos = overlap.find_first_of("N", lastPos);
+
+ while (std::string::npos != pos || std::string::npos != lastPos) {
+ std::string token = overlap.substr(lastPos, pos-lastPos);
+ if (token.length() > 0) {
+ uint32_t start = (pos == std::string::npos ? 0 : pos) + ovlStart;
+ uint32_t end = start + token.length();
+ std::string seq = p.sequence.substr(start - p.start, end - start);
+ Position edit(p.name, start, end, seq);
+ edit.editType = Position::REPLACE;
+ edits.push_back(edit);
+ }
+
+ // move to the next token in the list
+ lastPos = overlap.find_first_not_of("N", pos);
+ pos = overlap.find_first_of("N", lastPos);
+ }
+ }
+ result.sequence = fasta;
+ }
+ return result;
+}
+
+uint32_t Position::getLength() const {
+ return end-start;
+}
+
+std::string Position::getName() const {
+ return name;
+}
+
+uint32_t Position::getStart() const {
+ return start;
+}
+
+uint32_t Position::getEnd() const {
+ return end;
+}
+
+std::string Position::getSequence() const {
+ return sequence;
+}
+
+std::string Position::getUngappedSequence() const {
+ std::string retval;
+ retval.reserve(sequence.length());
+
+ for ( uint32_t i = 0; i < sequence.length(); i ++ )
+ {
+ if ( isalpha (sequence[i]) )
+ retval . push_back (sequence[i]);
+ }
+
+ return retval;
+}
+
+Position::PositionEditType Position::getEditType() const {
+ return editType;
+}
+
+void Position::setEditType(Position::PositionEditType edit) {
+ editType = edit;
+}
+
+Position& Position::operator= (const Position & source) {
+ if ( this != &source ) {
+ editType = source.editType;
+ start = source.start;
+ end = source.end;
+ name = source.name;
+ sequence = source.sequence;
+ }
+
+ return *this;
+}
+
+bool operator== (const Position & a, const Position & b) {
+ if (a.getEditType() == b.getEditType()
+ && a.getStart() == b.getStart()
+ && a.getEnd() == b.getEnd()
+ && a.getName() == b.getName()
+ && a.getSequence() == b.getSequence())
+ return true;
+ else
+ return false;
+}
+
+bool operator!= (const Position & a, const Position & b) {
+ return !(a == b);
+}
+
diff --git a/src/Bambus/Output/Position.hh b/src/Bambus/Output/Position.hh
new file mode 100644
index 0000000..1cae025
--- /dev/null
+++ b/src/Bambus/Output/Position.hh
@@ -0,0 +1,41 @@
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <inttypes.h>
+#include <string>
+#include <vector>
+
+class Position {
+public:
+ enum PositionEditType {
+ REPLACE
+ };
+
+ Position();
+ Position(std::string rangeName, uint32_t rangeStart, uint32_t rangeEnd, std::string seq);
+ Position(const Position &other);
+
+ Position merge(const Position& p, std::vector<Position>& edits);
+
+ uint32_t getLength() const;
+ std::string getName() const;
+ uint32_t getStart() const;
+ uint32_t getEnd() const;
+ std::string getSequence() const;
+ std::string getUngappedSequence() const;
+ PositionEditType getEditType() const;
+
+ void setEditType(PositionEditType);
+ Position& operator= (const Position & source);
+
+private:
+ std::string sequence;
+ uint32_t start;
+ uint32_t end;
+ std::string name;
+ PositionEditType editType;
+};
+
+bool operator== (const Position & a, const Position & b);
+bool operator!= (const Position & a, const Position & b);
diff --git a/src/Bambus/Untangler/AsmLib.pm b/src/Bambus/Untangler/AsmLib.pm
new file mode 100755
index 0000000..a38ea4b
--- /dev/null
+++ b/src/Bambus/Untangler/AsmLib.pm
@@ -0,0 +1,434 @@
+# $Id$
+#
+# File: AsmLib.pm
+# Authors: Mihai Pop
+#
+# Copyright @ 2002, The Institute for Genomic Research (TIGR). All
+# rights reserved.
+#
+# This software is provided "AS IS". TIGR makes no warranties, express
+# or implied, including no representation or warranty with respect to
+# the performance of the software and derivatives or their safety,
+# effectiveness, or commercial viability. TIGR does not warrant the
+# merchantability or fitness of the software and derivatives for any
+# particular purpose, or that they may be exploited without infringing
+# the copyrights, patent rights or property rights of others. TIGR shall
+# not be liable for any claim, demand or action for any loss, harm,
+# illness or other damage or injury arising from access to or use of the
+# software or associated information, including without limitation any
+# direct, indirect, incidental, exemplary, special or consequential
+# damages.
+
+# This software program may not be sold, leased, transferred, exported
+# or otherwise disclaimed to anyone, in whole or in part, without the
+# prior written consent of TIGR.
+#
+#
+# Routines that help processing Fasta and Celera .asm files.
+#
+
+=head1 NAME
+
+AsmLib - A library of perl routines for processing Celera .frg, .asm files and
+TIGR .contig, .seq, and .qual files.
+
+=head1 SYNOPSIS
+
+use TIGR::AsmLib;
+
+=head1 DESCRIPTION
+
+A set of functions that help the processing of Celera .asm files and
+Fasta files as well as the creation of TIGR .asm and .contig files.
+
+=cut
+
+package TIGR::AsmLib;
+
+use strict;
+
+## configuration management
+our $VERSION = "2.00";
+our $VERSION_STRING = "$VERSION (Build " . (qw/$Revision$/ )[1] . ")";
+our @DEPEND = ();
+
+BEGIN {
+ use Exporter ();
+ use vars qw(@EXPORT @EXPORT_OK @ISA %EXPORT_TAGS);
+
+ @ISA = qw(Exporter);
+ @EXPORT = qw(&getCARecord
+ &parseCARecord
+ &getCAId
+ &printContigRecord
+ &printSequenceRecord
+ &printFastaSequence
+ &printFastaQual
+ &reverseComplement
+ $VERSION
+ $VERSION_STRING
+ @DEPEND);
+ %EXPORT_TAGS = ();
+ @EXPORT_OK = ();
+}
+
+use vars @EXPORT;
+use vars @EXPORT_OK;
+
+
+##############################################
+
+=over
+
+=item B<my $rec = getCARecord(\*STDIN);>
+
+Reads from stdin the text between "extreme" { and } .
+
+ for example:
+
+ {A
+ {B
+ }
+ }
+
+Returns the whole: {A{B}}
+
+=cut
+
+sub getCARecord
+{
+ my $file = shift;
+
+ my $level = 0;
+ my $block = "";
+
+ while (<$file>){
+ if (/^\s*\{/){
+ $level++;
+ }
+ if (/^\s*\}/){
+ $level--;
+ }
+ $block .= $_;
+ if ($level == 0){
+ last;
+ }
+ }
+
+ if ($level != 0){
+ die ("end of file reached before end of block\n");
+ }
+
+ if ($block ne ""){
+ return $block;
+ } else {
+ return undef;
+ }
+}# getCARecord
+
+sub print_sequence
+{
+ my $file = shift;
+ my $seqs = shift;
+
+ for (my $j = 0; $j < length($seqs); $j += 60){
+ print $file substr($seqs, $j, 60), "\n";
+ }
+}
+
+
+######################################################3
+
+=item B<my($id, $fields, $recs) = parseCARecord($rec);>
+
+Parses a record and returns a triplet consisting of
+ - record type
+ - hash of fields and values
+ - array of sub-records
+
+=cut
+
+sub parseCARecord
+{
+ my $record = shift;
+
+ my @lines = split('\n', $record);
+
+ my $type;
+ my %fields;
+ my @recs;
+
+ # get record type
+ $lines[0] =~ /\{(\w+)/;
+ if (! defined $1){
+ die ("Wierd start of record: $record\n");
+ }
+ $type = $1;
+
+ if ($lines[$#lines] !~ /^\s*\}/){
+ die ("Wierd end of record: $record\n");
+ }
+
+ my $level = 0;
+ my $fieldname;
+ for (my $i = 1; $i < $#lines; $i++){
+ if ($lines[$i] =~ /^(\w+):(\S+)$/){ # simple field
+ $fields{$1} = $2;
+ } # simple field
+ if ($lines[$i] =~ /^(\w+):$/){ # complex field
+ $fieldname = $1;
+ $fields{$fieldname} = "";
+ $i++;
+ while ($i < $#lines && ($lines[$i] !~ /^\.$/)){
+ $fields{$fieldname} .= "$lines[$i]\n";
+ $i++;
+ }
+ } # complex field
+ if ($lines[$i] =~ /^\s*\{/){ # subrecord
+ my $level = 1;
+
+ my $thisrec = ++$#recs;
+
+ $recs[$thisrec] .= "$lines[$i]\n";
+ $i++;
+ while ($level > 0 && $i < $#lines){
+ if ($lines[$i] =~ /^\s*\{/){
+ $level++;
+ }
+ if ($lines[$i] =~ /^\s*\}/){
+ $level--;
+ }
+ $recs[$thisrec] .= "$lines[$i]\n";
+ if ($level == 0){
+ last;
+ } else {
+ $i++;
+ }
+ }
+ if ($level != 0){
+ die ("Error parsing sub_record in: $record\n");
+ }
+ } # subrecord
+ } # for $i...
+
+ return ($type, \%fields, \@recs);
+} # parseCARecord
+
+################################################
+
+=item B<my($id) = getCAId($CAid);>
+
+Obtains the ID from a "paired" id, that is, converts (10, 1000) into 10.
+If the Id is not a pair in parantheses, it returns the input.
+Thus, getCAId('(10, 1000)') returns 10 while getCAId("abba") returns "abba".
+
+=cut
+
+sub getCAId
+{
+ my $string = shift;
+
+ if ($string =~ /\((\d+),(\d+)\)/){
+ return $1;
+ } else {
+ return $string; # just in case we have a real ID
+ }
+} # getCAId
+
+################################################
+
+=item B<printContigRecord($file, $id, $len, $nseq, $sequence, $how);>
+
+Prints contig in specified format
+Inputs are:
+ $file - output file (opened for writing)
+ $id - contig ID
+ $len - contig length
+ $nseq - number of sequences in contig (same as number of sequence records
+that will follow the contig
+ $sequence - consensus sequence for the contig
+ $how - what type of output is required:
+ contig - TIGR .contig format
+ asm - TIGR .asm format
+ fasta - multi-fasta format
+
+=cut
+
+sub printContigRecord
+{
+ my $file = shift;
+ my $id = shift;
+ my $len = shift;
+ my $nseq = shift;
+ my $sequence = shift;
+ my $how = shift;
+
+ if ($how eq "contig"){
+ print $file "\#\#$id $nseq $len bases, 00000000 checksum.\n";
+ print_sequence($file, $sequence);
+ return;
+ } # if $how eq "contig"
+ elsif ($how eq "asm"){
+ my $strip = $sequence;
+ $strip =~ s/-//g;
+# get the current date
+ my $date = `date +'%D %T'`;
+ chomp $date;
+
+ my $quality = "0x";
+ for (my $i = 0; $i < length($sequence); $i++){
+ $quality .= "06";
+ }
+
+ print $file "sequence\t$strip\n";
+ print $file "lsequence\t$sequence\n";
+ print $file "quality\t$quality\n";
+ print $file "asmbl_id\t$id\n";
+ print $file "seq_id\t\n";
+ print $file "com_name\t\n";
+ print $file "type\t\n";
+ print $file "method\tCelera Assembler\n";
+ print $file "ed_status\t\n";
+ print $file "redundancy\t\n";
+ print $file "perc_N\t\n";
+ print $file "seq\#\t$nseq\n";
+ print $file "full_cds\t\n";
+ print $file "cds_start\t\n";
+ print $file "cds_end\t\n";
+ print $file "ed_pn\t$ENV{USER}\@$ENV{HOSTNAME}\n";
+ print $file "ed_date\t$date\n";
+ print $file "comment\t\n";
+ print $file "frameshift\t\n";
+ return;
+ } # if $how eq "asm"
+ elsif ($how eq "fasta")
+ {
+ print $file ">$id $nseq $len bases\n";
+ print_sequence($file, $sequence);
+ return;
+ }
+} # printContigRecord
+
+################################################
+
+=item B<printSequenceRecord($file, $name, $seq, $offset, $rc, $seqleft, $seqright, $asml, $asmr, $type);>
+
+Prints the record for a sequence aligned to a contig
+Inputs are:
+ $file - output file opened for writing
+ $name - sequence name
+ $seq - actual sequence
+ $offset - offset in consensus
+ $rc - "RC" if sequence is reverse complemented, "" otherwise
+ $seqleft, $seqright - alignment range within sequence
+ $asml, $asmr - alignment range within consensus
+ $type - type of output:
+ contig - output is in TIGR .contig format
+ asm - output is in TIGR .asm format
+
+=cut
+
+sub printSequenceRecord
+{
+ my($file, $name, $seq, $offset, $rc,
+ $seqleft, $seqright, $asml, $asmr, $type) = @_;
+
+ if ($type eq "contig"){
+ print $file "\#$name($offset) [$rc] ",
+ length($seq),
+ " bases, 00000000 checksum. {$seqleft $seqright} <$asml $asmr>\n";
+
+ print_sequence($file, $seq);
+ }
+
+ if ($type eq "asm"){
+ print $file "\n";
+ print $file "seq_name\t$name\n";
+ print $file "asm_lend\t$asml\n";
+ print $file "asm_rend\t$asmr\n";
+ print $file "seq_lend\t$seqleft\n";
+ print $file "seq_rend\t$seqright\n";
+ print $file "best\t\n";
+ print $file "comment\t\n";
+ print $file "db\t\n";
+ print $file "offset\t$offset\n";
+ print $file "lsequence\t$seq\n";
+ }
+
+ return;
+} # printSequenceRecord
+
+################################################
+
+=item B<printFastaSequence($file, $header, $seq);>
+
+Prints sequence in Fasta format
+Inputs are:
+ $file - output file opened for writing
+ $header - Fasta header (without >)
+ $seq - sequence to be written
+
+=cut
+
+sub printFastaSequence
+{
+ my($file) = @_[0];
+ my($header) = @_[1];
+ my($seqs) = @_[2];
+
+ print $file ">$header\n";
+ print_sequence($file, $seqs);
+} # printFastaSequence
+
+################################################
+
+=item B<printFastaQual($file, $header, $qual);>
+
+Prints quality values in Fasta format.
+Inputs are:
+ $file - output file
+ $header - fasta header (without >)
+ $qual - string of quality values
+
+=cut
+
+sub printFastaQual
+{
+ my($file) = @_[0];
+ my($header) = @_[1];
+ my($quals) = @_[2];
+ my(@qv);
+
+ print $file ">$header\n";
+
+ @qv = split(' ', $quals);
+
+ for (my $j = 0; $j <= $#qv; $j += 17){
+ print $file join(" ", @qv[$j .. $j + 16]), "\n";
+ }
+} # printFastaQual
+
+
+################################################
+
+=item B<my($rev) = reverseComplement($seq);>
+
+Reverse complements a sequence.
+
+=cut
+
+sub reverseComplement {
+ my($string) = @_;
+
+ $string = reverse($string);
+ $string =~ tr/AaCcTtGgUuMmRrWwSsYyKkVvHhDdBbXxNn.-/TtGgAaCcAaKkYyWwSsRrMmBbDdHhVvXxNn.-/;
+ return $string;
+} # reverseComplement
+
+=back
+
+=cut
+
+END{}
+
+1;
diff --git a/src/Bambus/Untangler/DotLib.pm b/src/Bambus/Untangler/DotLib.pm
new file mode 100755
index 0000000..dedec11
--- /dev/null
+++ b/src/Bambus/Untangler/DotLib.pm
@@ -0,0 +1,238 @@
+# $Id$
+#
+# DotLib.pm - set of procedures for generating .dot files
+#
+
+# Copyright @ 2002, 2003, The Institute for Genomic Research (TIGR). All
+# rights reserved.
+
+
+=head1 Name
+
+DotLib - library of routines for generating .dot files
+
+=head1 Synopsis
+
+ use DotLib;
+
+=head1 Description
+
+ A set of procedures used to create various .dot objects such as
+file headers, file tails, components, nodes, edges, etc.
+
+=cut
+
+package AMOS::DotLib;
+
+use strict;
+
+
+BEGIN {
+ use Exporter ();
+ use vars qw(@EXPORT @EXPORT_OK @ISA %EXPORT_TAGS);
+
+ @ISA = qw(Exporter);
+ @EXPORT = qw(&printHeader
+ &printFooter
+ &printNode
+ &printEdge
+ &startCluster
+ &endCluster
+ );
+ %EXPORT_TAGS = ();
+ @EXPORT_OK = ();
+}
+
+our $VERSION = '1.0';
+our $REVISION = '$Revision$ ';
+our $VERSION_STRING = "$VERSION ($REVISION)";
+
+use vars @EXPORT;
+use vars @EXPORT_OK;
+
+=over 4
+
+=item B<my $ret = printHeader($file, $type);>
+
+Prints a .dot header for the type of output specified in the $type variable.
+Allowable types are "printer", "plotter". If $type is undefined or not
+passed, it generates a default header. Returns 1 upon successful
+completion and 'undef' otherwise.
+
+Example:
+
+ my $err = printHeader(\*STDOUT, "plotter");
+
+=cut
+
+sub printHeader
+{
+ my $file = shift;
+ my $type = shift;
+
+ print $file "digraph ROOT {\n";
+ print $file " rankdir = LR\n";
+ print $file " orientation = landscape\n";
+ print $file " ranksep = 0.3\n";
+ print $file " nodesep = 0.3\n";
+ print $file " fontsize = 8\n";
+ print $file " margin = \".2,.2\"\n";
+
+ if ($type eq "printer"){
+ print $file " ratio = auto\n";
+ print $file " page = \"8.5,11\"\n";
+ } elsif ($type eq "plotter"){
+ print $file " ratio = auto\n";
+ print $file " page = \"36,48\"\n";
+ }
+
+ print $file "\n";
+
+ return 1;
+} # printHeader
+
+
+=item B<my $ret = printFooter($file);>
+
+Prints a .dot footer (currently just a closed brace). Returns 1 upon
+successful completion and 'undef' otherwise.
+
+Example:
+
+ my $err = printFooter(\*STDOUT);
+
+=cut
+
+sub printFooter
+{
+ my $file = shift;
+
+ print $file "}\n";
+
+ return 1;
+} # printFooter
+
+
+=item B<my $ret = printNode($file, $id, $label, $ori);>
+
+Prints a "contig" node with the specified id, label, and orientation.
+If orientation is 1 then the node is a forward facing arrow, otherwise
+it is a backward facing arror. Returns 1 upon successful completion
+and 'undef' otherwise.
+
+Example:
+
+ my $err = printNode(\*STDOUT, $node_id, "$node_id ($node_len)", 1);
+
+=cut
+
+sub printNode
+{
+ my $file = shift;
+ my $id = shift;
+ my $label = shift;
+ my $ori = shift;
+ my $angle;
+
+ $id =~ s/(\W)/_/g;
+
+ if ($ori == 1){
+ $angle = -90;
+ } else {
+ $angle = 90;
+ }
+
+ print $file " $id [ label = \"$label\" height = 0.2, fontsize = 8, shape = \"house\", orientation = $angle ]\n";
+
+ return 1;
+
+} # printNode
+
+
+=item B<my $ret = printEdge($file, $nodeA, $nodeB, $label, $style);>
+
+Prints an edge between two nodes with the specified label. The style can
+be any of the GraphViz acceptable styles ("dotted", "solid", "dashed",
+"invis") or undefined in which case the default is used. Returns 1 upon
+successful completion and 'undef' otherwise.
+
+Example:
+
+ my $err = printEdge(\*STDOUT, $nodeA, $nodeB, "A to B", "invis");
+
+=cut
+
+sub printEdge
+{
+ my $file = shift;
+ my $nodeA = shift;
+ my $nodeB = shift;
+ my $label = shift;
+ my $instyle = shift;
+ my $style;
+
+ $nodeA =~ s/(\W)/_/g;
+ $nodeB =~ s/(\W)/_/g;
+
+ if (defined $instyle){
+ $style = "style = \"" . $instyle . "\"";
+ if ($instyle eq "invis"){
+ $style .= " color = \"white\" ";
+ }
+ }
+
+ print $file " $nodeA -> $nodeB [ label =\"$label\" fontsize = 8 $style ]\n";
+
+ return 1;
+} # printEdge
+
+=item B<my $err = startCluster($file, $id, $label);>
+
+Starts a cluster in the .dot output file with the given label and id.
+Returns 1 upon successful completion and 'undef' otherwise.
+
+Example:
+
+ my $err = startCluster(\*STDOUT, $clust_id, "first cluster");
+
+=cut
+
+sub startCluster
+{
+ my $file = shift;
+ my $id = shift;
+ my $label = shift;
+
+ $id =~ s/(\W)/_/g;
+
+ print $file " subgraph cluster_$id {\n";
+ print $file " label = \"$label\"\n";
+
+ return 1;
+} # startCluster
+
+=item B<my $err = endCluster($file);>
+
+Ends a cluster in the .dot output. Returns 1 upon successful
+completion and 'undef' otherwise.
+
+Example:
+
+ my $err = endCluster(\*STDOUT);
+
+=cut
+
+sub endCluster
+{
+ my $file = shift;
+
+ print $file " }\n";
+
+ return 1;
+} # endCluster
+
+
+1;
+
+
+
diff --git a/src/Bambus/Untangler/Makefile.am b/src/Bambus/Untangler/Makefile.am
new file mode 100644
index 0000000..9e18c71
--- /dev/null
+++ b/src/Bambus/Untangler/Makefile.am
@@ -0,0 +1,20 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+##-- TO BE INSTALLED
+bin_PROGRAMS =
+
+dist_bin_SCRIPTS = \
+ printScaff.pl \
+ untangle.pl
+
+
+dist_amoslib_SCRIPTS = \
+ DotLib.pm
+
+dist_tigrlib_SCRIPTS = \
+ AsmLib.pm
+
+##-- GLOBAL INCLUDE
+
+##-- END OF MAKEFILE --##
diff --git a/src/Bambus/Untangler/Makefile.in b/src/Bambus/Untangler/Makefile.in
new file mode 100644
index 0000000..166add1
--- /dev/null
+++ b/src/Bambus/Untangler/Makefile.in
@@ -0,0 +1,608 @@
+# 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 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@
+DIST_COMMON = $(dist_amoslib_SCRIPTS) $(dist_bin_SCRIPTS) \
+ $(dist_tigrlib_SCRIPTS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+bin_PROGRAMS =
+subdir = src/Bambus/Untangler
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(amoslibdir)" \
+ "$(DESTDIR)$(bindir)" "$(DESTDIR)$(tigrlibdir)"
+PROGRAMS = $(bin_PROGRAMS)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+SCRIPTS = $(dist_amoslib_SCRIPTS) $(dist_bin_SCRIPTS) \
+ $(dist_tigrlib_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+dist_bin_SCRIPTS = \
+ printScaff.pl \
+ untangle.pl
+
+dist_amoslib_SCRIPTS = \
+ DotLib.pm
+
+dist_tigrlib_SCRIPTS = \
+ AsmLib.pm
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Bambus/Untangler/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Bambus/Untangler/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):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+install-dist_amoslibSCRIPTS: $(dist_amoslib_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(amoslibdir)" || $(MKDIR_P) "$(DESTDIR)$(amoslibdir)"
+ @list='$(dist_amoslib_SCRIPTS)'; test -n "$(amoslibdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(amoslibdir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(amoslibdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_amoslibSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_amoslib_SCRIPTS)'; test -n "$(amoslibdir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(amoslibdir)" && rm -f $$files
+install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+install-dist_tigrlibSCRIPTS: $(dist_tigrlib_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(tigrlibdir)" || $(MKDIR_P) "$(DESTDIR)$(tigrlibdir)"
+ @list='$(dist_tigrlib_SCRIPTS)'; test -n "$(tigrlibdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(tigrlibdir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(tigrlibdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_tigrlibSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_tigrlib_SCRIPTS)'; test -n "$(tigrlibdir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(tigrlibdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(tigrlibdir)" && rm -f $$files
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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 $(PROGRAMS) $(SCRIPTS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(tigrlibdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_amoslibSCRIPTS \
+ install-dist_tigrlibSCRIPTS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS install-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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 -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-dist_amoslibSCRIPTS \
+ uninstall-dist_binSCRIPTS uninstall-dist_tigrlibSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic distclean distclean-generic distdir dvi dvi-am \
+ html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am \
+ install-dist_amoslibSCRIPTS install-dist_binSCRIPTS \
+ install-dist_tigrlibSCRIPTS 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 pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-binPROGRAMS uninstall-dist_amoslibSCRIPTS \
+ uninstall-dist_binSCRIPTS uninstall-dist_tigrlibSCRIPTS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Bambus/Untangler/printScaff.pl b/src/Bambus/Untangler/printScaff.pl
new file mode 100755
index 0000000..4e9ff5c
--- /dev/null
+++ b/src/Bambus/Untangler/printScaff.pl
@@ -0,0 +1,1022 @@
+#!/usr/local/bin/perl
+
+# $Id$
+#
+# printScaff.pl takes in the output of grommit together with the input
+# to grommit to generate various reports such as simple summary information
+# or .dot input to the GraphViz package.
+
+# Copyright @ 2002, 2003 The Institute for Genomic Research (TIGR). All
+# rights reserved.
+
+use strict;
+
+use XML::Parser;
+use TIGR::Foundation;
+use TIGR::FASTAreader;
+use TIGR::FASTArecord;
+
+use AMOS::DotLib;
+use TIGR::AsmLib;
+
+my $base = new TIGR::Foundation;
+
+if (! defined $base){
+ die ("Walk, do not run to the nearest exit!");
+}
+
+my $VERSION = "1.01";
+my $VERSION_STRING = "$VERSION (" . '$Revision$ ' . ")";
+
+$base->setVersionInfo($VERSION_STRING);
+
+my $HELPTEXT = q~
+ Report statistics about a scaffold
+
+ printScaff -e <evidencefile> -s <scaffile> -o <outprefix>
+ -l <libconf> [-dot -page -plot -unused -phys -oo -sum] [-detail]
+ -f <fasta_in> [-[no]merge] [-arachne <araprefix>]
+ ~;
+
+$base->setHelpInfo($HELPTEXT);
+
+my $evidencefile;
+my $scaffoldfile;
+my $outprefix;
+my $dodot;
+my $page;
+my $plot;
+my $detail;
+my $unused;
+my $libconf;
+my $physicals; # list particular edges as previously physical gaps
+my $fastain; # fasta file of all contigs
+my $oo; # print object and orientation file
+my $sum; # print summary file
+my $merge = 1; # whether to merge the scaffold extents
+my $arachne; # prefix for arachne outputs
+
+my $fastaSep; # separator of contigs in fasta file
+for (my $i = 0; $i < 60; $i++){
+ $fastaSep .= "N";
+}
+
+my $err = $base->TIGR_GetOptions("e=s" => \$evidencefile,
+ "s=s" => \$scaffoldfile,
+ "o=s" => \$outprefix,
+ "l=s" => \$libconf,
+ "dot" => \$dodot,
+ "page" => \$page,
+ "plot" => \$plot,
+ "detail" => \$detail,
+ "unused" => \$unused,
+ "phys=s" => \$physicals,
+ "f=s" => \$fastain,
+ "oo" => \$oo,
+ "sum" => \$sum,
+ "merge!" => \$merge,
+ "arachne=s" => \$arachne
+ );
+
+$base->bail("Option processing failed") unless $err;
+
+if ((defined $page || defined $plot || defined $unused || defined $physicals)
+ && ! defined $dodot){
+ $base->bail("Options -page, -plot, -phys, and -unused require option -dot");
+}
+
+if (! defined $evidencefile){
+ $base->bail("An evidence file must be provided with option -e");
+}
+
+if (! defined $scaffoldfile){
+ $base->bail("A scaffold file must be provided with option -s");
+}
+
+if (! defined $outprefix){
+ $base->bail("An output prefix must be provided with option -o");
+}
+
+if (! defined $libconf){
+ $base->bail("A library file must be provided with option -l");
+}
+
+my $fr;
+my @errors;
+if (defined $fastain){
+ $fr = new TIGR::FASTAreader($base, \@errors, $fastain);
+ if (! defined $fr){
+ $base->bail("Cannot open $fastain: bad FASTA reader\n");
+ }
+}
+
+my $dotname = $outprefix . ".dot";
+my $statname = $outprefix . ".stats";
+my $detailname = $outprefix . ".details";
+my $physname = $outprefix . ".phys";
+my $fastaout = $outprefix . ".fasta";
+my $ooout = $outprefix . ".oo";
+my $sumout = $outprefix . ".sum";
+
+my $traceinfo = $arachne . ".xml";
+my $aralinks = $arachne . ".links";
+my $arareads = $arachne . ".reads";
+my $arabases = $arachne . ".bases"; # requires a .fasta file
+
+# take care of parsing the XML
+my $xml = new XML::Parser(Style => 'Stream');
+
+my $inInsert;
+my $insId;
+my $conId;
+my $libId;
+my %inserts;
+my %seqName;
+my %contigs;
+my %seqCtg;
+my %seqOri;
+my %seqLend;
+my %seqRend;
+my %libraries;
+my %insertLib;
+my $inLib = 0;
+my $inLink = 0;
+my $inContig = 0;
+my %linkCtg;
+my %conEv;
+my %libClass;
+my $inUnused = 0;
+my $scaffId;
+my %contigScaff; # contig 2 scaffold
+my %scaffContig; # scaffold 2 contig
+my @unseen;
+my %linkValid;
+my %contigStart;
+my %contigEnd;
+my %contigX;
+my %contigOri;
+my %scaffLink;
+my @scaffolds; # list of all scaffolds
+my %scaffSize; # sum of contigs in scaffold
+my $id;
+my $doingUnused = 0; # flag for printDetails
+
+open(LIB, $libconf) ||
+ $base->bail("Cannot open lib file \"$libconf\": $!");
+
+while (<LIB>){
+ chomp;
+ my @fields = split(' ', $_);
+ for (my $i = 1; $i <= $#fields; $i++){
+ $libClass{$fields[$i]} = $fields[0];
+ }
+}
+close(LIB);
+
+my %physicals;
+
+if (defined $physicals){
+ open(PHY, ">$physname") ||
+ $base->bail("Cannot open physical gap file \"$physname\": $!");
+ my @phs = split(',', $physicals);
+ for (my $i = 0; $i <= $#phs; $i++){
+ $physicals{$libClass{$phs[$i]}} = 1;
+ }
+}
+
+my $inEvidence;
+
+$xml->parsefile($evidencefile);
+$xml->parsefile($scaffoldfile);
+
+# sort scaffolds by size
+ at scaffolds = sort {$scaffSize{$b} <=> $scaffSize{$a}} @scaffolds;
+
+if (defined $dodot){
+ open(DOT, ">$dotname") ||
+ $base->bail("Cannot open dot file \"$dotname\": $!");
+ if (defined $plot) {
+ printHeader(\*DOT, "plotter");
+ } elsif (defined $page) {
+ printHeader(\*DOT, "printer");
+ } else {
+ printHeader(\*DOT, undef);
+ }
+}
+
+if (defined $oo){
+ open(OO, ">$ooout") ||
+ $base->bail("Cannot open OO file \"$ooout\": $!");
+}
+
+if (defined $sum){
+ open(SUM, ">$sumout") ||
+ $base->bail("Cannot open SUM file \"$sumout\": $!");
+}
+
+my @scaffSpan;
+my @scaffContigs;
+my $scSz = 0;
+my $scSp = 0;
+my $scCtg = 0;
+
+if (defined $detail){
+ open(DETAIL, ">$detailname") ||
+ $base->bail("Cannot open \"$detailname\": $!");
+}
+
+my %validLs = ();
+my %invalidLens = ();
+my %invalidOris =();
+my %valids = ();
+my %invalidLen = ();
+my %invalidOri = ();
+
+if (defined $fastain){
+ open(FASTA, ">$fastaout") ||
+ $base->bail("Cannot open \"$fastaout\": $!");
+}
+
+for (my $i = 0; $i <= $#scaffolds; $i++){
+ my $scaff = $scaffolds[$i];
+ my @ctgs = split(' ', $scaffContig{$scaff});
+ my @ctgends = @ctgs;
+
+ @ctgs = sort {$contigStart{$a} <=> $contigStart{$b}} @ctgs;
+ @ctgends = sort {$contigEnd{$a} <=> $contigEnd{$b}} @ctgends;
+ my $nctgs = $#ctgs + 1;
+
+ # Two output formats are possible here. First is default in
+ # which the consituent contigs are merged using a string of N's,
+ # with the correct orientation. The second (if the -nomerge
+ # option is specified) prints the contig records with the
+ # scaffoldId_scaffoldSubid_contig_contigId format.
+ #
+ if (defined $fastain){
+ if ($merge){
+ my $scaffSeq = "";
+ for (my $c = 0; $c <= $#ctgs; $c++){
+ my $ctgid = $ctgs[$c];
+ $ctgid =~ s/^contig_(\S+)/$1/;
+ my $rec = $fr->getRecordByIdentifier($ctgid);
+ if (! defined $rec){
+ $base->logError("cannot find fasta record for contig $ctgid\n");
+ next;
+ }
+ my $thisctg = $rec->getData();
+ if ($contigOri{$ctgs[$c]} eq "EB"){
+ $thisctg = reverseComplement($thisctg);
+ }
+ if ($scaffSeq eq ""){
+ $scaffSeq = $thisctg;
+ } else {
+ $scaffSeq .= $fastaSep;
+ $scaffSeq .= $thisctg;
+ }
+ }
+ printFastaSequence(\*FASTA, "$scaff", $scaffSeq);
+ } else { # if no merge
+ my $scaffSeq = "";
+ for (my $c = 0; $c <= $#ctgs; $c++)
+ {
+ my $ctgid = $ctgs[$c];
+ $ctgid =~ s/^contig_(\S+)/$1/;
+ my $rec = $fr->getRecordByIdentifier($ctgid);
+ if (! defined $rec)
+ {
+ $base->bail("cannot find fasta record for contig $ctgid\n");
+ }
+ my $contig_rec = ($contigOri{$ctgs[$c]} eq "EB")?
+ "$scaff" . "_contig_" . $ctgid . "_EB" :
+ "$scaff" . "_contig_" . $ctgid . "_BE" ;
+ my $thisctg = $rec->getData();
+ if ($contigOri{$ctgs[$c]} eq "EB")
+ {
+ $thisctg = reverseComplement($thisctg);
+ }
+ printFastaSequence(\*FASTA, "$contig_rec", $thisctg);
+ } # for each contig
+ } # if no merge
+ } # if defined fastain
+ my $maxSpan = $contigEnd{$ctgs[0]};
+
+ for (my $c = 1; $c <= $#ctgs; $c++){
+ if ($contigEnd{$ctgs[$c]} > $maxSpan){
+ $maxSpan = $contigEnd{$ctgs[$c]};
+ }
+ }
+
+ my $span = $maxSpan - $contigStart{$ctgs[0]};
+
+ if (defined $dodot){
+ startCluster(\*DOT, $scaff, "Scaffold $scaff n:$nctgs size:$scaffSize{$scaff} span:$span");
+ }
+
+ if (defined $sum){
+ print SUM "$scaff\t$nctgs\t$scaffSize{$scaff}\t$span\n";
+ }
+ if (defined $oo){
+ print OO ">$scaff $nctgs $scaffSize{$scaff} $span\n";
+ }
+
+ push(@scaffSpan, $span);
+ push(@scaffContigs, $nctgs);
+
+ if (defined $detail){
+ print DETAIL "Scaffold $scaff $nctgs contigs $scaffSize{$scaff} bases $span span\n";
+ print DETAIL "\n";
+ }
+
+ my $gotTo = $contigEnd{$ctgs[0]};
+ my $lastCtg = $ctgs[0];
+ my $last = 0;
+
+ for (my $c = 0; $c <= $#ctgs; $c++){
+ my $ctg = $ctgs[$c];
+ my $ori = ($contigOri{$ctg} eq "BE") ? 1 : -1;
+
+ if (defined $oo){
+ print OO "$ctg $contigOri{$ctg}\n";
+ }
+
+ if (defined $dodot){
+ printNode(\*DOT, $ctg, "$ctg ($contigs{$ctg})\\n$contigStart{$ctg} $contigEnd{$ctg}", $ori);
+
+ # add invisible edge between two contigs if they don't
+ # overlap
+ while ($last <= $#ctgends && $contigEnd{$ctgends[$last]} - 1 < $contigStart{$ctg}){
+ $last++;
+ }
+ if ($last > 0){
+ printEdge(\*DOT, $ctgends[$last - 1], $ctg, "", "invis");
+ }
+ }
+ if ($contigEnd{$ctg} > $gotTo){
+ $gotTo = $contigEnd{$ctg};
+ $lastCtg = $ctg;
+ }
+ } # for my $c....
+
+ my @links = split(' ', $scaffLink{$scaff});
+ %valids = ();
+ %invalidLen = ();
+ %invalidOri = ();
+
+ %validLs = ();
+ %invalidLens = ();
+ %invalidOris =();
+
+ my %edgeLib = ();
+
+ for (my $l = 0; $l <= $#links; $l++){
+ my $lnk = $links[$l];
+
+ my ($ctgA, $sa, $ctgB, $sb) = ctgPair($lnk);
+
+ if ($sa != $scaff || $sb != $scaff){
+ $base->logError("Wierd link $lnk in scaffold $scaff connects two scaffolds $sa and $sb", 1);
+ next;
+ }
+
+ my $edge = ($contigStart{$ctgA} <= $contigStart{$ctgB}) ? "$ctgA $ctgB" : "$ctgB $ctgA";
+
+ if ($linkValid{$lnk} eq "VALID"){
+ $valids{$edge}++;
+ $validLs{$edge} .= " $lnk";
+ $edgeLib{$edge}{$libClass{$insertLib{$lnk}}}++;
+ } elsif ($linkValid{$lnk} eq "LEN"){
+ $invalidLen{$edge}++;
+ $invalidLens{$edge} .= " $lnk";
+ } elsif ($linkValid{$lnk} eq "ORI"){
+ $invalidOri{$edge}++;
+ $invalidOris{$edge} .= " $lnk";
+ }
+ }
+
+ while (my ($e, $n) = each %valids){
+ my ($ctgA, $ctgB) = split(' ', $e);
+ my $lens;
+ my $oris;
+ if (exists $invalidLen{$e}){
+ $lens = $invalidLen{$e};
+ delete $invalidLen{$e};
+ }
+ if (exists $invalidOri{$e}){
+ $oris = $invalidOri{$e};
+ delete $invalidOri{$e};
+ }
+
+# my $libinfo = getLibInfo($e);
+
+ if (defined $dodot){
+ my $libdata;
+ my $isPhys = 1;
+ while (my ($l, $nn) = each %{$edgeLib{$e}}){
+ $libdata .= "$l:$nn ";
+ if (defined $physicals && ! exists $physicals{$l}){
+ $isPhys = 0;
+ }
+ }
+ printEdge(\*DOT, $ctgA, $ctgB, "$n\\n$libdata\\nL:$lens O:$oris", undef);
+ if (defined $physicals && $isPhys){
+ print PHY "$ctgA $contigOri{$ctgA} $ctgB $contigOri{$ctgB} ",
+ $contigStart{$ctgB} - $contigEnd{$ctgA}, "\n";
+ }
+ }
+ if (defined $detail){
+ printDetail(\*DETAIL, $e);
+ }
+ }
+
+ while (my ($e, $n) = each %invalidLen){
+ my ($ctgA, $ctgB) = split(' ', $e);
+ my $oris;
+ if (exists $invalidOri{$e}){
+ $oris = $invalidOri{$e};
+ delete $invalidOri{$e};
+ }
+ if (defined $dodot){
+ printEdge(\*DOT, $ctgA, $ctgB, "L:$n O:$oris", "dashed");
+ }
+ if (defined $detail) {
+ printDetail(\*DETAIL, $e);
+ }
+ }
+ while (my ($e, $n) = each %invalidOri){
+ my ($ctgA, $ctgB) = split(' ', $e);
+ if (defined $dodot){
+ printEdge(\*DOT, $ctgA, $ctgB, "L:0 O:$n", "dashed");
+ }
+ if (defined $detail) {
+ printDetail(\*DETAIL, $e);
+ }
+ }
+
+ if (defined $dodot){
+ endCluster(\*DOT);
+ }
+} # for each scaffold
+
+$doingUnused = 1;
+
+if (defined $detail){
+ %valids = ();
+ %validLs = ();
+ %invalidLen = ();
+ %invalidLens = ();
+ %invalidOri = ();
+ %invalidOris = ();
+ for (my $l = 0; $l <= $#unseen; $l++){
+ my $lnk = $unseen[$l];
+
+ my ($ctgA, $sa, $ctgB, $sb) = ctgPair($lnk);
+ my $edge = ($contigStart{$ctgA} <= $contigStart{$ctgB}) ? "$ctgA $ctgB" : "$ctgB $ctgA";
+
+ if ($linkValid{$lnk} eq "VALID"){
+ $valids{$edge}++;
+ $validLs{$edge} .= " $lnk";
+# $edgeLib{$edge}{$libClass{$insertLib{$lnk}}}++;
+ } elsif ($linkValid{$lnk} eq "LEN"){
+ $invalidLen{$edge}++;
+ $invalidLens{$edge} .= " $lnk";
+ } elsif ($linkValid{$lnk} eq "ORI"){
+ $invalidOri{$edge}++;
+ $invalidOris{$edge} .= " $lnk";
+ }
+ }
+ print DETAIL "\n\n UNUSED LINKS:\n\n";
+
+ while (my ($e, $n) = each %valids){
+ my ($ctgA, $ctgB) = split(' ', $e);
+ if (exists $invalidLen{$e}){
+ delete $invalidLen{$e};
+ }
+ if (exists $invalidOri{$e}){
+ delete $invalidOri{$e};
+ }
+ printDetail(\*DETAIL, $e);
+ }
+ while (my ($e, $n) = each %invalidLen){
+ my ($ctgA, $ctgB) = split(' ', $e);
+ if (exists $invalidOri{$e}){
+ delete $invalidOri{$e};
+ }
+ printDetail(\*DETAIL, $e);
+ }
+ while (my ($e, $n) = each %invalidOri){
+ my ($ctgA, $ctgB) = split(' ', $e);
+ printDetail(\*DETAIL, $e);
+ }
+}
+
+if (defined $dodot){
+ printFooter(\*DOT);
+ close(DOT);
+}
+
+if (defined $detail){
+ close(DETAIL);
+}
+
+if (defined $fastain){
+ close(FASTA);
+}
+
+if (defined $oo){
+ close(OO);
+}
+
+if (defined $sum){
+ close(SUM);
+}
+
+# now we should have contig stats
+
+# starting to compute link stats
+my %validLib;
+my %lenLib;
+my %oriLib;
+my %unusedLib;
+my $validL = 0;
+my $lenL = 0;
+my $oriL = 0;
+my $unusedL = 0;
+while (my ($lnk, $valid) = each %linkValid){
+ my $lib = $insertLib{$lnk};
+ if (! defined $lib){
+ $base->logError("Cannot find library for insert $lnk\n");
+ next;
+ }
+
+ if ($valid eq "VALID"){
+ $validLib{$lib}++;
+ $validL++;
+ } elsif ($valid eq "LEN"){
+ $lenLib{$lib}++;
+ $lenL++;
+ } elsif ($valid eq "ORI"){
+ $oriLib{$lib}++;
+ $oriL++;
+ } elsif ($valid eq "UNSEEN"){
+ $unusedLib{$lib}++;
+ $unusedL++;
+ }
+}
+
+my $genomeSize;
+if (-e "genome.size"){
+ open(GEN, "genome.size") || $base->logError("Cannot open genome.size: $!\n");
+ while (<GEN>){
+ if (/^(\d+)$/){
+ $genomeSize = $1;
+ }
+ }
+ close(GEN);
+}
+
+# Here we print overall statistics
+open(STAT, ">$statname") ||
+ $base->bail("Cannot open stat file \"$statname\": $!");
+
+ at scaffSpan = sort {$b <=> $a} @scaffSpan;
+ at scaffContigs = sort {$b <=> $a} @scaffContigs;
+my @scaffSz = sort {$b <=> $a} (values %scaffSize);
+
+
+for (my $i = 0; $i <= $#scaffSpan; $i++){
+ $scSp += $scaffSpan[$i];
+}
+
+for (my $i = 0; $i <= $#scaffContigs; $i++){
+ $scCtg += $scaffContigs[$i];
+}
+
+for (my $i = 0; $i <= $#scaffSz; $i++){
+ $scSz += $scaffSz[$i];
+}
+
+if (! defined $genomeSize){
+ $genomeSize = $scSp;
+}
+
+my $n50Span = N50(\@scaffSpan, $genomeSize);
+my $n50Size = N50(\@scaffSz, $genomeSize);
+
+$base->logLocal("Assuming genome size of $genomeSize bases\n", 1);
+
+print STAT "Genome size:\t$genomeSize\n\n";
+print STAT "no. scaffolds:\t", $#scaffolds + 1, "\n";
+print STAT "total scaffold size:\t", $scSz, "\n";
+print STAT "min scaffold size:\t", $scaffSz[$#scaffSz], "\n";
+print STAT "max scaffold size:\t", $scaffSz[0], "\n";
+print STAT "avg scaffold size:\t",
+ sprintf("%.2f", 1.0 * $scSz / ($#scaffolds + 1)), "\n";
+print STAT "N50 scaffold size:\t$n50Size\n";
+print STAT "\n";
+
+print STAT "total scaffold span:\t", $scSp, "\n";
+print STAT "min scaffold span:\t", $scaffSpan[$#scaffSpan], "\n";
+print STAT "max scaffold span:\t", $scaffSpan[0], "\n";
+print STAT "avg scaffold span:\t",
+ sprintf("%.2f", 1.0 * $scSp / ($#scaffolds + 1)), "\n";
+print STAT "N50 scaffold span:\t$n50Span\n";
+print STAT "\n";
+
+print STAT "total # contigs:\t", $scCtg, "\n";
+print STAT "min # contigs:\t", $scaffContigs[$#scaffContigs], "\n";
+print STAT "max # contigs:\t", $scaffContigs[0], "\n";
+print STAT "avg # contigs:\t",
+ sprintf("%.2f", 1.0 * $scCtg / ($#scaffolds + 1)), "\n";
+print STAT "\n";
+
+print STAT "no. valid links:\t$validL\n";
+print STAT "no. incorrect len. links:\t$lenL\n";
+print STAT "no. incorrect ori. links:\t$oriL\n";
+print STAT "no. unchecked links:\t$unusedL\n";
+print STAT "\n";
+
+while (my ($lib, $cls) = each %libClass){
+ print STAT "Library:\t$lib\n";
+ print STAT "no. valid links:\t$validLib{$lib}\n";
+ print STAT "no. incorrect len. links:\t$lenLib{$lib}\n";
+ print STAT "no. incorrect ori. links:\t$oriLib{$lib}\n";
+ print STAT "no. unchecked links:\t$unusedLib{$lib}\n";
+ print STAT "\n";
+}
+
+close(STAT);
+
+exit(0);
+
+
+##################
+# get N50 value for an array. Assumes array is sorted in decreasing
+# order
+sub N50
+{
+ my $arr = shift;
+ my $size = shift;
+ $size /= 2;
+ my $tem = 0;
+
+ for (my $i = 0; $i <= $#$arr; $i++){
+ $tem += $$arr[$i];
+ if ($tem > $size){
+ return $$arr[$i];
+ }
+ }
+}
+
+# prints details about an edge
+sub printDetail
+{
+ my $file = shift;
+ my $edge = shift;
+
+ my ($ctgA, $ctgB) = split(' ', $edge);
+
+ if ($contigStart{$ctgA} > $contigStart{$ctgB}){
+ my $tmp = $ctgA;
+ $ctgA = $ctgB;
+ $ctgB = $tmp;
+ } # orient from leftmost to rightmost
+
+ my @valids = split(' ', $validLs{$edge});
+ my @lens = split(' ', $invalidLens{$edge});
+ my @oris = split(' ', $invalidOris{$edge});
+
+ my $uu;
+ if ($doingUnused) {
+ $uu = "U";
+ } else {
+ $uu = "";
+ }
+
+ print $file "\n$uu $ctgA ($contigStart{$ctgA}, $contigEnd{$ctgA})";
+
+ if ($contigOri{$ctgA} eq "BE"){
+ print $file " ====>";
+ } else {
+ print $file " <====";
+ }
+
+ print $file " v:", $#valids + 1, " l:", $#lens + 1, " o:", $#oris + 1, " ";
+
+ if ($contigOri{$ctgB} eq "BE"){
+ print $file "====> ";
+ } else {
+ print $file "<==== ";
+ }
+
+ print $file "$ctgB ($contigStart{$ctgB}, $contigEnd{$ctgB})";
+
+ print $file "\n";
+
+ my %libs = ();
+ print $file "Valid:\n";
+ for (my $i = 0; $i <= $#valids; $i++){
+ push(@{$libs{$insertLib{$valids[$i]}}}, $valids[$i]);
+ }
+ while (my ($lib, $inserts) = each %libs){
+ print $file " library $lib:\n";
+ for (my $i = 0; $i <= $#$inserts; $i++){
+ printDetailInsert($file, $$inserts[$i], $ctgA, $ctgB);
+ }
+ }
+
+ %libs = ();
+ if ($#lens >= 0){
+ print $file "Invalid length:\n";
+ for (my $i = 0; $i <= $#lens; $i++){
+ push(@{$libs{$insertLib{$lens[$i]}}}, $lens[$i]);
+ }
+ while (my ($lib, $inserts) = each %libs){
+ print $file " library $lib:\n";
+ for (my $i = 0; $i <= $#$inserts; $i++){
+ printDetailInsert($file, $$inserts[$i], $ctgA, $ctgB);
+ }
+ }
+ }
+ %libs = ();
+ if ($#oris >= 0){
+ print $file "Invalid orientation:\n";
+ for (my $i = 0; $i <= $#oris; $i++){
+ push(@{$libs{$insertLib{$oris[$i]}}}, $oris[$i]);
+ }
+ while (my ($lib, $inserts) = each %libs){
+ print $file " library $lib:\n";
+ for (my $i = 0; $i <= $#$inserts; $i++){
+ printDetailInsert($file, $$inserts[$i], $ctgA, $ctgB);
+ }
+ }
+ }
+
+ print $file "\n";
+
+} # printDetail
+
+sub printDetailInsert
+{
+ my $file = shift;
+ my $insert = shift;
+ my $ctgA = shift;
+ my $ctgB = shift;
+
+ if (exists $inserts{$insert}){
+
+ my ($seqA, $seqB) = split(' ', $inserts{$insert});
+ if (! defined $seqA || ! defined $seqB){
+ $base->logError("Can't find sequences for insert $insert", 1);
+ return;
+ }
+
+ if ($seqCtg{$seqA} eq $ctgB){
+ my $tmp = $seqB;
+ $seqB = $seqA;
+ $seqA = $tmp;
+ }
+
+ my $len; # here we try to compute clone sizes
+ my $coordA; # start of seqA in global reference system
+ my $coordB; # same for seqB
+
+ if ($seqOri{$seqA} eq "BE"){
+ $coordA = $seqLend{$seqA};
+ } else {
+ $coordA = $seqRend{$seqA};
+ }
+ if ($contigOri{$ctgA} eq "BE"){
+ $coordA += $contigStart{$ctgA};
+ } else {
+ $coordA = $contigEnd{$ctgA} - $coordA;
+ }
+
+ if ($seqOri{$seqB} eq "BE"){
+ $coordB = $seqLend{$seqB};
+ } else {
+ $coordB = $seqRend{$seqB};
+ }
+ if ($contigOri{$ctgB} eq "BE"){
+ $coordB += $contigStart{$ctgB};
+ } else {
+ $coordB = $contigEnd{$ctgB} - $coordB;
+ }
+
+ $len = $coordB - $coordA;
+
+ print $file " ", sprintf("%7s %7d %7d", $seqName{$seqA}, $seqLend{$seqA}, $seqRend{$seqA});
+ printSeqArrow($file, $seqA, $ctgA);
+ print $file sprintf(" ... %5d ... ", $len);
+ printSeqArrow($file, $seqB, $ctgB);
+ print $file sprintf("%7d %7d %7s\n", $seqLend{$seqB}, $seqRend{$seqB}, $seqName{$seqB});
+ } else { # MUMmer link
+ print $file " $insert:\n";
+ my @ctgs = split(' ', $linkCtg{$insert});
+ print $file $conEv{$ctgs[0]}, "\n";
+ print $file $conEv{$ctgs[1]}, "\n";
+ }
+}
+
+sub printSeqArrow
+{
+ my $file = shift;
+ my $seq = shift;
+ my $ctg = shift;
+
+ if ($contigOri{$ctg} eq "BE"){
+ if ($seqOri{$seq} eq "BE"){
+ print $file " ---> ";
+ } else {
+ print $file " <--- ";
+ }
+ } else {
+ if ($seqOri{$seq} eq "BE"){
+ print $file " <--- ";
+ } else {
+ print $file " ---> ";
+ }
+ }
+}
+
+# here we'll generate a string with information about a link
+sub linkStr
+{
+ my $lnk = shift;
+
+ return "link $lnk " . join(' ', ctgPair($lnk));
+}
+
+# returns the contig pair linked by the specified link
+sub ctgPair
+{
+ my $lnk = shift;
+ my $ctgA;
+ my $ctgB;
+ my $scaffA;
+ my $scaffB;
+
+ if (exists $inserts{$lnk}){
+ my @seqs = split(' ', $inserts{$lnk});
+ if ($#seqs != 1){
+ $base->logError("Link $lnk has less than 2 seqs", 1);
+ } else {
+ my $seqA = $seqs[0];
+ my $seqB = $seqs[1];
+
+ $ctgA = $seqCtg{$seqA};
+ $ctgB = $seqCtg{$seqB};
+ }
+ } else { # ! exists $inserts... link is MUMmer
+ my @ctgs = split(' ', $linkCtg{$lnk});
+ if ($#ctgs != 1){
+ $base->logError("Link $lnk has less than 2 contigs", 1);
+ return (undef, undef, undef, undef);
+ }
+ $ctgA = $ctgs[0];
+ $ctgB = $ctgs[1];
+ }
+
+ $scaffA = $contigScaff{$ctgA};
+ $scaffB = $contigScaff{$ctgB};
+
+ return ($ctgA, $scaffA, $ctgB, $scaffB);
+}
+
+# do contigs overlap?
+sub overlap
+{
+ my $ctgA = shift;
+ my $ctgB = shift;
+
+ if (($contigStart{$ctgA} <= $contigEnd{$ctgB} &&
+ $contigStart{$ctgA} >= $contigStart{$ctgB}) ||
+ ($contigEnd{$ctgA} <= $contigEnd{$ctgB} &&
+ $contigEnd{$ctgA} >= $contigStart{$ctgB}) ||
+ ($contigStart{$ctgB} <= $contigEnd{$ctgA} &&
+ $contigStart{$ctgB} >= $contigStart{$ctgA}) ||
+ ($contigEnd{$ctgB} <= $contigEnd{$ctgA} &&
+ $contigEnd{$ctgB} >= $contigStart{$ctgA})){
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+## XML functions ##
+sub StartDocument
+{
+ print STDERR "starting\n";
+}
+
+sub StartTag
+{
+ my $tag = $_[1];
+
+ if ($tag eq "EVIDENCE"){
+ $inEvidence = 1;
+ } elsif ($tag eq "LIBRARY") {
+ $libId = $_{ID};
+ $libraries{$libId} = "$_{MIN} $_{MAX}";
+ $inLib = 1;
+ } elsif ($tag eq "INSERT"){
+ if (! $inLib){
+ $base->bail("Cannot have insert outside of library");
+ }
+ $inInsert = 1;
+ $insId = $_{ID};
+ $inserts{$insId} = "";
+ $insertLib{$insId} = $libId;
+ } elsif ($tag eq "CONTIG"){
+ $conId = $_{ID};
+ if ($inEvidence){
+ if ($inLink){
+ $inContig = 1;
+ $linkCtg{$id} .= "$conId ";
+ } else {
+ $contigs{$conId} = $_{LEN};
+ }
+ } else {
+ $contigX{$conId} = $_{X};
+ $contigStart{$conId} = ($_{ORI} eq "BE") ?
+ $_{X} : ($_{X} - $contigs{$conId});
+ $contigEnd{$conId} = ($_{ORI} eq "BE") ?
+ ($_{X} + $contigs{$conId}) : $_{X};
+ $contigOri{$conId} = $_{ORI};
+ $contigScaff{$conId} = $scaffId;
+ $scaffContig{$scaffId} .= "$conId ";
+ $scaffSize{$scaffId} += $contigs{$conId};
+ }
+ } elsif ($tag eq "SEQUENCE"){
+ my $id = $_{ID};
+ if ($inInsert){
+ $inserts{$insId} .= "$id ";
+ $seqName{$id} = $_{NAME};
+ } else { # we are in contigs
+ $seqCtg{$id} = $conId;
+ $seqOri{$id} = $_{ORI};
+ $seqLend{$id} = $_{ASM_LEND};
+ $seqRend{$id} = $_{ASM_REND};
+ }
+ } elsif ($tag eq "SCAFFOLD") {
+ $scaffId = $_{ID};
+ push(@scaffolds, $scaffId);
+ } elsif ($tag eq "LINK") {
+ $id = $_{ID};
+ if ($inEvidence){ #&& ($_{TYPE} eq "MUMmer" || $_{TYPE} eq "CA")){
+ if (! exists $libraries{$_{TYPE}}){
+ $libraries{$_{TYPE}} = "0 0";
+ }
+ $insertLib{$id} = $_{TYPE}; # all MUMmer links belong to the MUMmer library
+ $inLink = 1;
+ } else {
+ if ($inUnused) {
+ push(@unseen, $id);
+ } else {
+ $scaffLink{$scaffId} .= "$id ";
+ }
+ $linkValid{$id} = $_{VALID};
+ }
+ } elsif ($tag eq "UNUSED") {
+ $inUnused = 1;
+ } else {
+# print "Unknown tag: $tag\n";
+ }
+}
+
+sub EndTag
+{
+ my $tag = $_[1];
+ if ($tag eq "INSERT"){
+ $inInsert = 0;
+ } elsif ($tag eq "LIBRARY"){
+ $inLib = 0;
+ } elsif ($tag eq "UNUSED"){
+ $inUnused = 0;
+ } elsif ($tag eq "EVIDENCE"){
+ $inEvidence = 0;
+ } elsif ($tag eq "LINK"){
+ if ($inEvidence){
+ $inLink = 0;
+ }
+ } elsif ($tag eq "CONTIG"){
+ if ($inLink){
+ $inContig = 0;
+ }
+ }
+}
+
+sub Text
+{
+ if ($inContig){
+ $conEv{$conId} = $_;
+ }
+}
+
+sub pi
+{
+}
+
+sub EndDocument
+{
+ print STDERR "Done\n";
+}
diff --git a/src/Bambus/Untangler/untangle.pl b/src/Bambus/Untangler/untangle.pl
new file mode 100755
index 0000000..04fda64
--- /dev/null
+++ b/src/Bambus/Untangler/untangle.pl
@@ -0,0 +1,544 @@
+#!/usr/local/bin/perl
+
+# $Id$
+#
+# untangle.pl takes in the output of grommit together with the input
+# to grommit to disambiguate the scaffold. The output is consistent with the
+# .out.xml file format.
+#
+# Copyright @ 2002, 2003 The Institute for Genomic Research (TIGR). All
+# rights reserved.
+
+use strict;
+use XML::Parser;
+use TIGR::Foundation;
+
+my $base = new TIGR::Foundation;
+if (! defined $base){
+ die ("A horrible death");
+}
+
+my $VERSION = "1.0";
+my $VERSION_STRING = "$VERSION (" . '$Revision$ ' . ")";
+
+$base->setVersionInfo($VERSION_STRING);
+
+my $HELPTEXT = q~
+ Take a file of evidence to disambiguate a scaffold.
+
+ untangle -e <evidencefile> -s <scaffile> -o <outfile>
+ ~;
+
+$base->setHelpInfo($HELPTEXT);
+
+my $xmlfile;
+my $evidencefile;
+my $outfile;
+
+my $err = $base->TIGR_GetOptions("e=s" => \$evidencefile,
+ "s=s" => \$xmlfile,
+ "o=s" => \$outfile);
+
+$base->bail("Option processing failed") unless $err;
+
+if (! defined $evidencefile || ! defined $xmlfile || ! defined $outfile) {
+ $base->bail("You need to provide all options listed in the help (try -h)");
+}
+
+open(OUT, ">$outfile") || $base->bail("Cannot open $outfile: $!\n");
+
+print OUT "<GROUPING>\n";
+
+my $xml = new XML::Parser(Style => 'Stream');
+
+# parser definitions. These values are filled as a side-effect of
+# calling $xml->parsefile
+my $inEvidence = 0; # we are in the evidence section
+
+my $inLib = 0; # we are in a library
+my $libId; # ID of current library
+my %libraries; # mapping from lib ids to size range
+
+my $inInsert = 0; # we are in an insert
+my $insId; # ID of current insert
+my %inserts; # insert ID to sequence list mapping
+my %insertLib; # mapping from insert ID to library ID
+
+my $inContig = 0; # we are in a contig
+my $conId; # ID of current contig
+my %contigs; # mapping from contig ID to contig size
+
+my $scaffId; # ID of current scaffold
+my @scaffolds; # list of all scaffold IDs
+my %scaffSize; # sum of lengths of all contigs in scaffold
+my %scaffContig; # mapping from scaffold ID to list of contigs
+my %scaffLink; # mapping from scaffold ID to list of links
+
+my %contigX; # coordinate of contig beginning in scaffold
+my %contigStart; # start of contig in scaffold
+my %contigEnd; # end of contig in scaffold
+my %contigOri; # orientation of contig in scaffold
+my %contigScaff; # mapping from contig ID to scaffold ID
+
+my $inLink = 0; # we are in a link
+my $id; # current link ID
+my %linkCtg; # mapping from link ID to list of contigs
+my %linkValid; # valid codes for all links
+
+my %seqName; # mapping from sequence ID to sequence name
+my %seqCtg; # mapping from sequence ID to contig ID
+my %seqOri; # orientation of sequence within contig
+my %seqLend; # coordinates of sequence within contig
+my %seqRend;
+
+my $inUnused = 0; # we are in the unused link section
+my @unseen; # list of unseen links
+
+# now we parse the files
+$xml->parsefile($evidencefile);
+$xml->parsefile($xmlfile);
+
+# Now we go through each scaffold
+for (my $s = 0 ; $s <= $#scaffolds ; $s++){
+ my $scaffId = $scaffolds[$s];
+
+ my @ctgs = split(' ', $scaffContig{$scaffId});
+ @ctgs = sort {$contigStart{$a} <=> $contigStart{$b}} @ctgs;
+
+ my %conflicts = (); # all conflicts between contigs
+ my %nconflicts = ();
+
+ print STDERR "doing scaffold $scaffId with ", $#ctgs + 1, " contigs\n";
+ for (my $c = 0; $c <= $#ctgs; $c++){
+ my $l = $contigStart{$ctgs[$c]};
+ my $r = $contigEnd{$ctgs[$c]};
+ # now I go for all the contigs that start before the current one
+ my $b = $c - 1;
+ while ($b >= 0 && $contigEnd{$ctgs[$b]} > $l){
+ $conflicts{$ctgs[$c]} .= "$ctgs[$b] ";
+ $nconflicts{$ctgs[$c]}++;
+ $b--;
+ }
+
+ # then the ones afterwards
+ $b = $c + 1;
+ while ($b <= $#ctgs && $contigStart{$ctgs[$b]} < $r){
+ $conflicts{$ctgs[$c]} .= "$ctgs[$b] ";
+ $nconflicts{$ctgs[$c]}++;
+ $b++;
+ }
+
+# for (my $cc = 0; $cc <= $#ctgs; $cc++){
+# if ($ctgs[$cc] eq $ctgs[$c]) { next;} # avoid self matches
+# my $st = $contigStart{$ctgs[$cc]};
+# my $e = $contigEnd{$ctgs[$cc]};
+# if ($e > $l && $st < $r) {
+# $conflicts{$ctgs[$c]} .= "$ctgs[$cc] ";
+# $nconflicts{$ctgs[$c]}++;
+# $conflicts = 1;
+# }
+# } # for each contig
+ if (exists $nconflicts{$ctgs[$c]}){
+ print STDERR "contig $ctgs[$c] has $nconflicts{$ctgs[$c]} conflicts\n";
+ }
+ } # for each contig
+
+ # now %conflicts holds a list of all the contigs conflicting with the key
+
+ # for each contig, we assign it to a cluster
+# my %contigClust;
+# my $clustId = 0;
+
+# for (my $c = 0; $c <= $#ctgs; $c++){
+# my @cluster = ();
+# my @stack = ();
+# my %seen = ();
+# push(@stack, $ctgs[$c]);
+# $clustId++;
+# while (my $contig = pop @stack){
+# $seen{$contig} = 1;
+# $contigClust{$contig} = $clustId;
+# print STDERR "contig $contig is in cluster $clustId\n";
+# print STDERR "checking $contig for conflicts\n";
+# if (exists $nconflicts{$contig}){
+# my @cflcts = split(' ', $conflicts{$contig});
+# for (my $flct = 0; $flct <= $#cflcts; $flct++){
+# if (! exists $seen{$cflcts[$flct]}){
+# push(@stack, $cflcts[$flct]);
+# }
+# }
+# }
+# push(@cluster, $contig);
+# }
+
+# # now cluster contains a cluster of potentially conflicting contigs
+# if ($#cluster >= 1){
+# print STDERR "found a cluster with ", $#cluster + 1, " contigs\n";
+# }
+
+# # now we try to find the longest contig in this cluster
+# my $best = 0;
+# my $bestlen = 0;
+# for (my $cc = 0; $cc <= $#cluster; $cc++){
+# if ($contigs{$cluster[$cc]} > $bestlen){
+# $bestlen = $contigs{$cluster[$cc]};
+# $best = $cluster[$cc];
+# }
+# }
+# $chosen{$best} = 1; # mark the chosen contig
+# } # for each contig
+
+ print STDERR "getting ready to build scaffolds\n";
+# @ctgs = sort {$contigStart{$a} <=> $contigStart{$b}} @ctgs; # sort by start
+# print STDERR "done sorting\n";
+
+ # the basic algorithm goes like this:
+ # starting with the leftmost contig, assign it number 1
+ # find all contigs linked to it
+
+ # from within each group of conflicting contigs, we'll choose one, namely
+ # the longest one
+
+
+ # now the algorithm is pretty simple. Start building "groups" of contigs
+ # by following clone links and stopping when we find a non-chosen contig
+ # that has conflicts
+
+ # first we need to find all contig mates
+ my %valids; # number of valid links
+ my %validLs; # list of valid links
+ my %invalids; # number of invalid links
+ my %invalidLs; # list of invalid links
+ my %neighbors; # right neighbors of contig
+
+ my @links = split(' ', $scaffLink{$scaffId});
+
+ for (my $l = 0; $l <= $#links; $l++){
+ my $lnk = $links[$l];
+
+ my ($ctgA, $sa, $ctgB, $sb) = ctgPair($lnk);
+
+ if ($sa != $scaffId || $sb != $scaffId){
+ $base->logError("Wierd link $lnk in scaffold $scaffId connects two scaffolds $sa and $sb", 1);
+ next;
+ }
+
+ my $edge;
+ if (($contigStart{$ctgA} <= $contigStart{$ctgB})){
+ $edge = "$ctgA $ctgB" ;
+ } else {
+ $edge = "$ctgB $ctgA";
+ }
+
+ $neighbors{$ctgA} .= "$ctgB ";
+ $neighbors{$ctgB} .= "$ctgA ";
+
+ if ($linkValid{$lnk} eq "VALID"){
+ $valids{$edge}++;
+ $validLs{$edge} .= " $lnk";
+ } else {
+ $invalids{$edge}++;
+ $invalidLs{$edge} .= " $lnk";
+ }
+ } # for all links
+
+
+ my $chunk = 0; # which scaffold chunk
+
+ my $busy = 1; # we are not done
+ my %added = (); # contigs added to current scaffold
+
+ while ($busy) {
+ $busy = 0;
+ for (my $con = 0; $con <= $#ctgs; $con++){
+ print STDERR "trying node $ctgs[$con]\n";
+ if (!exists $added{$ctgs[$con]}){
+ print STDERR "contig $ctgs[$con] was not added\n";
+ print STDERR "it is the seed\n";
+ $busy = 1;
+ $chunk++; # start a new scaffold chunk
+ my @scf = ();
+ my @scflinks = ();
+ my @stk = ();
+ my %instack = ();
+ push (@stk, $ctgs[$con]);
+ $instack{$ctgs[$con]} = 1;
+ print STDERR "Adding $ctgs[$con] to stack\n";
+
+ # we add contigs to the scaffold until we meet one that
+ # belongs to a cluster we've already seen
+
+ while ($#stk >= 0){
+ my $ctg = pop(@stk);
+ if (! exists $added{$ctg}){
+ print STDERR "contig $ctg was not added yet\n";
+ push(@scf, $ctg);
+ $added{$ctg} = 1;
+
+ my @nbrs = split(' ', $neighbors{$ctg});
+ print STDERR "and has ", $#nbrs + 1, " neighbors\n";
+ for (my $nb = 0; $nb <= $#nbrs; $nb++){
+ if (exists $added{$nbrs[$nb]}){
+ # if already in scaffold skip it
+ next;
+ }
+ if (exists $instack{$nbrs[$nb]}){
+ # we've already added it to the todo pile
+ next;
+ }
+
+ # now check all it's conflicts
+ my @cf = split(' ', $conflicts{$nbrs[$nb]});
+ my $conflict = 0;
+ my $conflictId;
+ for (my $cfi = 0; $cfi <= $#cf; $cfi++){
+ if (exists $instack{$cf[$cfi]}){
+ $conflict = 1;
+ $conflictId = $cf[$cfi];
+ last;
+ }
+ }
+
+ my $e;
+ if (exists $validLs{"$ctg $nbrs[$nb]"}){
+ $e = "$ctg $nbrs[$nb]";
+ } else {
+ $e = "$nbrs[$nb] $ctg";
+ }
+
+ my @vals = split(' ', $validLs{$e});
+ my @invals = split(' ', $invalidLs{$e});
+ if ($conflict){
+ print STDERR "skipping $nbrs[$nb] because we already saw $conflictId\n";
+ # we don't want this neighborhood relationship
+
+ for (my $ln = 0 ; $ln <= $#vals; $ln++){
+ push(@unseen, $vals[$ln]);
+ }
+
+ for (my $ln = 0; $ln <= $#invals; $ln++){
+ push(@unseen, $invals[$ln]);
+ }
+ } else {
+ # we want this neighbor
+ push (@stk, $nbrs[$nb]);
+ $instack{$nbrs[$nb]} = 1;
+ print STDERR "adding $nbrs[$nb] to the stack\n";
+ for (my $ln = 0 ; $ln <= $#vals; $ln++){
+ push(@scflinks, $vals[$ln]);
+ }
+
+ for (my $ln = 0; $ln <= $#invals; $ln++){
+ push(@scflinks, $invals[$ln]);
+ }
+ }
+ } # for each neighbor
+ } # if ! exists added
+ } # while stack not empy
+
+ # now we simply print out the scaffold chunk;
+ my $newId = $scaffId . "_$chunk";
+
+ print OUT "<SCAFFOLD ID = \"$newId\">\n";
+
+ for (my $c = 0; $c <= $#scf; $c++){
+ my $conId = $scf[$c];
+ print OUT "<CONTIG ID = \"$conId\"\n";
+ print OUT " X = \"$contigX{$conId}\"\n";
+ print OUT " ORI = \"$contigOri{$conId}\"\n";
+ print OUT "></CONTIG>\n";
+
+ } # for each contig
+
+ for (my $l = 0; $l <= $#scflinks; $l++){
+ my $lnId = $scflinks[$l];
+
+ print OUT "<LINK ID = \"$lnId\"\n";
+ print OUT " VALID = \"$linkValid{$lnId}\"\n";
+ print OUT " TAG = \"T\"\n";
+ print OUT "></LINK>\n";
+ } # for each link
+
+ print OUT "</SCAFFOLD>\n";
+
+ } # if ! exists $added
+ } # for each contig
+ } # while ($busy);
+
+} # for each scaffold
+print OUT "<UNUSED>\n";
+
+for (my $l = 0; $l <= $#unseen; $l++){
+ my $lnId = $unseen[$l];
+
+ print OUT "<LINK ID = \"$lnId\"\n";
+ print OUT " VALID = \"$linkValid{$lnId}\"\n";
+ print OUT " TAG = \"T\"\n";
+ print OUT "></LINK>\n";
+} # for each link
+
+print OUT "</UNUSED>\n";
+
+# done with the work
+print OUT "</GROUPING>\n";
+
+exit(0);
+
+###############################
+# Functions
+###############################
+
+# returns the contig pair linked by the specified link
+sub ctgPair
+{
+ my $lnk = shift;
+ my $ctgA;
+ my $ctgB;
+ my $scaffA;
+ my $scaffB;
+
+ if (exists $inserts{$lnk}){
+ my @seqs = split(' ', $inserts{$lnk});
+ if ($#seqs != 1){
+ $base->logError("Link $lnk has less than 2 seqs", 1);
+ } else {
+ my $seqA = $seqs[0];
+ my $seqB = $seqs[1];
+
+ $ctgA = $seqCtg{$seqA};
+ $ctgB = $seqCtg{$seqB};
+ }
+ } else { # ! exists $inserts... link is MUMmer
+ my @ctgs = split(' ', $linkCtg{$lnk});
+ if ($#ctgs != 1){
+ $base->logError("Link $lnk has less than 2 contigs", 1);
+ return (undef, undef, undef, undef);
+ }
+ $ctgA = $ctgs[0];
+ $ctgB = $ctgs[1];
+ }
+
+ $scaffA = $contigScaff{$ctgA};
+ $scaffB = $contigScaff{$ctgB};
+
+ return ($ctgA, $scaffA, $ctgB, $scaffB);
+}
+
+## XML functions ##
+sub StartDocument
+{
+ print STDERR "starting\n";
+}
+
+sub StartTag
+{
+ my $tag = $_[1];
+
+ if ($tag eq "EVIDENCE"){
+ $inEvidence = 1;
+ } elsif ($tag eq "LIBRARY") {
+ $libId = $_{ID};
+ $libraries{$libId} = "$_{MIN} $_{MAX}";
+ $inLib = 1;
+ } elsif ($tag eq "INSERT"){
+ if (! $inLib){
+ $base->bail("Cannot have insert outside of library");
+ }
+ $inInsert = 1;
+ $insId = $_{ID};
+ $inserts{$insId} = "";
+ $insertLib{$insId} = $libId;
+ } elsif ($tag eq "CONTIG"){
+ $conId = $_{ID};
+ if ($inEvidence){
+ if ($inLink){
+ $inContig = 1;
+ $linkCtg{$id} .= "$conId ";
+ } else {
+ $contigs{$conId} = $_{LEN};
+ }
+ } else {
+ $contigX{$conId} = $_{X};
+ $contigStart{$conId} = ($_{ORI} eq "BE") ?
+ $_{X} : ($_{X} - $contigs{$conId});
+ $contigEnd{$conId} = ($_{ORI} eq "BE") ?
+ ($_{X} + $contigs{$conId}) : $_{X};
+ $contigOri{$conId} = $_{ORI};
+ $contigScaff{$conId} = $scaffId;
+ $scaffContig{$scaffId} .= "$conId ";
+ $scaffSize{$scaffId} += $contigs{$conId};
+ }
+ } elsif ($tag eq "SEQUENCE"){
+ my $id = $_{ID};
+ if ($inInsert){
+ $inserts{$insId} .= "$id ";
+ $seqName{$id} = $_{NAME};
+ } else { # we are in contigs
+ $seqCtg{$id} = $conId;
+ $seqOri{$id} = $_{ORI};
+ $seqLend{$id} = $_{ASM_LEND};
+ $seqRend{$id} = $_{ASM_REND};
+ }
+ } elsif ($tag eq "SCAFFOLD") {
+ $scaffId = $_{ID};
+ push(@scaffolds, $scaffId);
+ } elsif ($tag eq "LINK") {
+ $id = $_{ID};
+ if ($inEvidence){ #&& $_{TYPE} eq "MUMmer"){
+ if (! exists $libraries{$_{TYPE}}){
+ $libraries{$_{TYPE}} = "0 0";
+ }
+ $insertLib{$id} = $_{TYPE}; # all MUMmer links belong to the MUMmer library
+ $inLink = 1;
+ } else {
+ if ($inUnused) {
+ push(@unseen, $id);
+ } else {
+ $scaffLink{$scaffId} .= "$id ";
+ }
+ $linkValid{$id} = $_{VALID};
+ }
+ } elsif ($tag eq "UNUSED") {
+ $inUnused = 1;
+ } else {
+# print "Unknown tag: $tag\n";
+ }
+}
+
+sub EndTag
+{
+ my $tag = $_[1];
+ if ($tag eq "INSERT"){
+ $inInsert = 0;
+ } elsif ($tag eq "LIBRARY"){
+ $inLib = 0;
+ } elsif ($tag eq "UNUSED"){
+ $inUnused = 0;
+ } elsif ($tag eq "EVIDENCE"){
+ $inEvidence = 0;
+ } elsif ($tag eq "LINK"){
+ if ($inEvidence){
+ $inLink = 0;
+ }
+ } elsif ($tag eq "CONTIG"){
+ if ($inLink){
+ $inContig = 0;
+ }
+ }
+}
+
+sub Text
+{
+ if ($inContig){
+# $conEv{$conId} = $_;
+ }
+}
+
+sub pi
+{
+}
+
+sub EndDocument
+{
+ print STDERR "Done\n";
+}
diff --git a/src/Bank/Makefile.am b/src/Bank/Makefile.am
new file mode 100644
index 0000000..63ed9ea
--- /dev/null
+++ b/src/Bank/Makefile.am
@@ -0,0 +1,313 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+##-- TO BE INSTALLED
+bin_PROGRAMS = \
+ bank2contig \
+ bank2lib \
+ bank2coverage \
+ bank2fasta \
+ bank2scaff \
+ bank-clean \
+ bank-combine \
+ bank-mapping \
+ bank-report \
+ bank-transact \
+ bank-tutorial \
+ dumpFeatures \
+ dumpmates \
+ dumpreads \
+ extractContig \
+ findMissingMates \
+ grow-readbank \
+ listReadPlacedStatus \
+ listGCContent \
+ load-overlaps \
+ loadFeatures \
+ normalizeScaffold \
+ renameReads \
+ resetFragLibrary \
+ revScaffold \
+ select-reads \
+ simplifyLibraries \
+ simpleContigLoader \
+ updateBankPositions \
+ updateClrRanges \
+ updateLibSizes \
+ dumpContigsAsReads \
+ partitionBank
+
+
+dist_bin_SCRIPTS = \
+ bank-unlock.pl
+
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/CelMsg \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/Slice \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/Foundation
+
+
+
+##-- bank-combine
+bank_combine_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+bank_combine_SOURCES = \
+ bank-combine.cc
+
+##-- bank-mapping
+bank_mapping_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+bank_mapping_SOURCES = \
+ bank-mapping.cc
+
+##-- bank2contig
+bank2contig_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+bank2contig_SOURCES = \
+ bank2contig.cc
+
+##-- bank2lib
+bank2lib_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+bank2lib_SOURCES = \
+ bank2lib.cc
+
+##-- bank2coverage
+bank2coverage_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Slice/libSlice.a
+bank2coverage_SOURCES = \
+ bank2coverage.cc
+
+##-- bank2scaff
+bank2scaff_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+bank2scaff_SOURCES = \
+ bank2scaff.cc
+
+##-- bank-clean
+bank_clean_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+bank_clean_SOURCES = \
+ bank-clean.cc
+
+##-- bank-report
+bank_report_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+bank_report_SOURCES = \
+ bank-report.cc
+
+##-- bank-transact
+bank_transact_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+bank_transact_SOURCES = \
+ bank-transact.cc
+
+##-- normalizeScaffold
+normalizeScaffold_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+normalizeScaffold_SOURCES = \
+ normalizeScaffold.cc
+
+##-- revScaffold
+revScaffold_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+revScaffold_SOURCES = \
+ revScaffold.cc
+
+##-- updateBankPositions
+updateBankPositions_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+updateBankPositions_SOURCES = \
+ updateBankPositions.cc
+
+##-- simpleContigLoader
+simpleContigLoader_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+simpleContigLoader_SOURCES = \
+ simpleContigLoader.cc
+
+##-- updateClrRanges
+updateClrRanges_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+updateClrRanges_SOURCES = \
+ updateClrRanges.cc
+
+##-- updateLibSizes
+updateLibSizes_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+updateLibSizes_SOURCES = \
+ updateLibSizes.cc
+
+##-- resetFragLibrary
+resetFragLibrary_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+resetFragLibrary_SOURCES = \
+ resetFragLibrary.cc
+
+##-- extractContig
+extractContig_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+extractContig_SOURCES = \
+ extractContig.cc
+
+##-- findMissingMates
+findMissingMates_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+findMissingMates_SOURCES = \
+ findMissingMates.cc
+
+##-- listGCContent
+listGCContent_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+listGCContent_SOURCES = \
+ listGCContent.cc
+
+
+##-- listReadPlacedStatus
+listReadPlacedStatus_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+listReadPlacedStatus_SOURCES = \
+ listReadPlacedStatus.cc
+
+##-- dumpmates
+dumpmates_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+dumpmates_SOURCES = \
+ dumpmates.cc
+
+##-- dumpFeatures
+dumpFeatures_LDADD = \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+dumpFeatures_SOURCES = \
+ dumpFeatures.cc
+
+##-- loadFeatures
+loadFeatures_LDADD = \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+loadFeatures_SOURCES = \
+ loadFeatures.cc
+
+##-- bank-tutorial
+bank_tutorial_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+bank_tutorial_SOURCES = \
+ bank-tutorial.cc
+
+##-- select-reads
+select_reads_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+select_reads_SOURCES = \
+ select-reads.cc
+
+##-- dumpreads
+dumpreads_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+dumpreads_SOURCES = \
+ dumpreads.cc
+
+##-- renameReads
+renameReads_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+renameReads_SOURCES = \
+ renameReads.cc
+
+##-- grow-readbank
+grow_readbank_LDADD = \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+grow_readbank_SOURCES = \
+ grow-readbank.cc
+
+##-- load-overlaps
+load_overlaps_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+load_overlaps_SOURCES = \
+ load-overlaps.cc
+
+##-- bank2fasta
+bank2fasta_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU
+bank2fasta_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+bank2fasta_SOURCES = \
+ bank2fasta.cc
+
+##-- dumpContigsAsReads
+dumpContigsAsReads_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU
+dumpContigsAsReads_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+dumpContigsAsReads_SOURCES = \
+ dumpContigsAsReads.cc
+
+##- partitionBank
+partitionBank_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU
+partitionBank_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+partitionBank_SOURCES = \
+ partitionBank.cc
+
+##-- simplifyLibraries
+simplifyLibraries_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU
+simplifyLibraries_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+simplifyLibraries_SOURCES = \
+ simplifyLibraries.cc
+
+##-- END OF MAKEFILE --##
diff --git a/src/Bank/Makefile.in b/src/Bank/Makefile.in
new file mode 100644
index 0000000..613d149
--- /dev/null
+++ b/src/Bank/Makefile.in
@@ -0,0 +1,1263 @@
+# 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 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@
+DIST_COMMON = $(dist_bin_SCRIPTS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = bank2contig$(EXEEXT) bank2lib$(EXEEXT) \
+ bank2coverage$(EXEEXT) bank2fasta$(EXEEXT) bank2scaff$(EXEEXT) \
+ bank-clean$(EXEEXT) bank-combine$(EXEEXT) \
+ bank-mapping$(EXEEXT) bank-report$(EXEEXT) \
+ bank-transact$(EXEEXT) bank-tutorial$(EXEEXT) \
+ dumpFeatures$(EXEEXT) dumpmates$(EXEEXT) dumpreads$(EXEEXT) \
+ extractContig$(EXEEXT) findMissingMates$(EXEEXT) \
+ grow-readbank$(EXEEXT) listReadPlacedStatus$(EXEEXT) \
+ listGCContent$(EXEEXT) load-overlaps$(EXEEXT) \
+ loadFeatures$(EXEEXT) normalizeScaffold$(EXEEXT) \
+ renameReads$(EXEEXT) resetFragLibrary$(EXEEXT) \
+ revScaffold$(EXEEXT) select-reads$(EXEEXT) \
+ simplifyLibraries$(EXEEXT) simpleContigLoader$(EXEEXT) \
+ updateBankPositions$(EXEEXT) updateClrRanges$(EXEEXT) \
+ updateLibSizes$(EXEEXT) dumpContigsAsReads$(EXEEXT) \
+ partitionBank$(EXEEXT)
+subdir = src/Bank
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_bank_clean_OBJECTS = bank-clean.$(OBJEXT)
+bank_clean_OBJECTS = $(am_bank_clean_OBJECTS)
+bank_clean_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_bank_combine_OBJECTS = bank-combine.$(OBJEXT)
+bank_combine_OBJECTS = $(am_bank_combine_OBJECTS)
+bank_combine_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_bank_mapping_OBJECTS = bank-mapping.$(OBJEXT)
+bank_mapping_OBJECTS = $(am_bank_mapping_OBJECTS)
+bank_mapping_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_bank_report_OBJECTS = bank-report.$(OBJEXT)
+bank_report_OBJECTS = $(am_bank_report_OBJECTS)
+bank_report_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_bank_transact_OBJECTS = bank-transact.$(OBJEXT)
+bank_transact_OBJECTS = $(am_bank_transact_OBJECTS)
+bank_transact_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_bank_tutorial_OBJECTS = bank-tutorial.$(OBJEXT)
+bank_tutorial_OBJECTS = $(am_bank_tutorial_OBJECTS)
+bank_tutorial_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_bank2contig_OBJECTS = bank2contig.$(OBJEXT)
+bank2contig_OBJECTS = $(am_bank2contig_OBJECTS)
+bank2contig_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+am_bank2coverage_OBJECTS = bank2coverage.$(OBJEXT)
+bank2coverage_OBJECTS = $(am_bank2coverage_OBJECTS)
+bank2coverage_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Slice/libSlice.a
+am_bank2fasta_OBJECTS = bank2fasta-bank2fasta.$(OBJEXT)
+bank2fasta_OBJECTS = $(am_bank2fasta_OBJECTS)
+bank2fasta_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_bank2lib_OBJECTS = bank2lib.$(OBJEXT)
+bank2lib_OBJECTS = $(am_bank2lib_OBJECTS)
+bank2lib_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+am_bank2scaff_OBJECTS = bank2scaff.$(OBJEXT)
+bank2scaff_OBJECTS = $(am_bank2scaff_OBJECTS)
+bank2scaff_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_dumpContigsAsReads_OBJECTS = \
+ dumpContigsAsReads-dumpContigsAsReads.$(OBJEXT)
+dumpContigsAsReads_OBJECTS = $(am_dumpContigsAsReads_OBJECTS)
+dumpContigsAsReads_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_dumpFeatures_OBJECTS = dumpFeatures.$(OBJEXT)
+dumpFeatures_OBJECTS = $(am_dumpFeatures_OBJECTS)
+dumpFeatures_DEPENDENCIES = \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_dumpmates_OBJECTS = dumpmates.$(OBJEXT)
+dumpmates_OBJECTS = $(am_dumpmates_OBJECTS)
+dumpmates_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a
+am_dumpreads_OBJECTS = dumpreads.$(OBJEXT)
+dumpreads_OBJECTS = $(am_dumpreads_OBJECTS)
+dumpreads_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a
+am_extractContig_OBJECTS = extractContig.$(OBJEXT)
+extractContig_OBJECTS = $(am_extractContig_OBJECTS)
+extractContig_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_findMissingMates_OBJECTS = findMissingMates.$(OBJEXT)
+findMissingMates_OBJECTS = $(am_findMissingMates_OBJECTS)
+findMissingMates_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_grow_readbank_OBJECTS = grow-readbank.$(OBJEXT)
+grow_readbank_OBJECTS = $(am_grow_readbank_OBJECTS)
+grow_readbank_DEPENDENCIES = $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_listGCContent_OBJECTS = listGCContent.$(OBJEXT)
+listGCContent_OBJECTS = $(am_listGCContent_OBJECTS)
+listGCContent_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_listReadPlacedStatus_OBJECTS = listReadPlacedStatus.$(OBJEXT)
+listReadPlacedStatus_OBJECTS = $(am_listReadPlacedStatus_OBJECTS)
+listReadPlacedStatus_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_load_overlaps_OBJECTS = load-overlaps.$(OBJEXT)
+load_overlaps_OBJECTS = $(am_load_overlaps_OBJECTS)
+load_overlaps_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_loadFeatures_OBJECTS = loadFeatures.$(OBJEXT)
+loadFeatures_OBJECTS = $(am_loadFeatures_OBJECTS)
+loadFeatures_DEPENDENCIES = \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_normalizeScaffold_OBJECTS = normalizeScaffold.$(OBJEXT)
+normalizeScaffold_OBJECTS = $(am_normalizeScaffold_OBJECTS)
+normalizeScaffold_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_partitionBank_OBJECTS = partitionBank-partitionBank.$(OBJEXT)
+partitionBank_OBJECTS = $(am_partitionBank_OBJECTS)
+partitionBank_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_renameReads_OBJECTS = renameReads.$(OBJEXT)
+renameReads_OBJECTS = $(am_renameReads_OBJECTS)
+renameReads_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_resetFragLibrary_OBJECTS = resetFragLibrary.$(OBJEXT)
+resetFragLibrary_OBJECTS = $(am_resetFragLibrary_OBJECTS)
+resetFragLibrary_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_revScaffold_OBJECTS = revScaffold.$(OBJEXT)
+revScaffold_OBJECTS = $(am_revScaffold_OBJECTS)
+revScaffold_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_select_reads_OBJECTS = select-reads.$(OBJEXT)
+select_reads_OBJECTS = $(am_select_reads_OBJECTS)
+select_reads_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a
+am_simpleContigLoader_OBJECTS = simpleContigLoader.$(OBJEXT)
+simpleContigLoader_OBJECTS = $(am_simpleContigLoader_OBJECTS)
+simpleContigLoader_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_simplifyLibraries_OBJECTS = \
+ simplifyLibraries-simplifyLibraries.$(OBJEXT)
+simplifyLibraries_OBJECTS = $(am_simplifyLibraries_OBJECTS)
+simplifyLibraries_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_updateBankPositions_OBJECTS = updateBankPositions.$(OBJEXT)
+updateBankPositions_OBJECTS = $(am_updateBankPositions_OBJECTS)
+updateBankPositions_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_updateClrRanges_OBJECTS = updateClrRanges.$(OBJEXT)
+updateClrRanges_OBJECTS = $(am_updateClrRanges_OBJECTS)
+updateClrRanges_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_updateLibSizes_OBJECTS = updateLibSizes.$(OBJEXT)
+updateLibSizes_OBJECTS = $(am_updateLibSizes_OBJECTS)
+updateLibSizes_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+SCRIPTS = $(dist_bin_SCRIPTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(bank_clean_SOURCES) $(bank_combine_SOURCES) \
+ $(bank_mapping_SOURCES) $(bank_report_SOURCES) \
+ $(bank_transact_SOURCES) $(bank_tutorial_SOURCES) \
+ $(bank2contig_SOURCES) $(bank2coverage_SOURCES) \
+ $(bank2fasta_SOURCES) $(bank2lib_SOURCES) \
+ $(bank2scaff_SOURCES) $(dumpContigsAsReads_SOURCES) \
+ $(dumpFeatures_SOURCES) $(dumpmates_SOURCES) \
+ $(dumpreads_SOURCES) $(extractContig_SOURCES) \
+ $(findMissingMates_SOURCES) $(grow_readbank_SOURCES) \
+ $(listGCContent_SOURCES) $(listReadPlacedStatus_SOURCES) \
+ $(load_overlaps_SOURCES) $(loadFeatures_SOURCES) \
+ $(normalizeScaffold_SOURCES) $(partitionBank_SOURCES) \
+ $(renameReads_SOURCES) $(resetFragLibrary_SOURCES) \
+ $(revScaffold_SOURCES) $(select_reads_SOURCES) \
+ $(simpleContigLoader_SOURCES) $(simplifyLibraries_SOURCES) \
+ $(updateBankPositions_SOURCES) $(updateClrRanges_SOURCES) \
+ $(updateLibSizes_SOURCES)
+DIST_SOURCES = $(bank_clean_SOURCES) $(bank_combine_SOURCES) \
+ $(bank_mapping_SOURCES) $(bank_report_SOURCES) \
+ $(bank_transact_SOURCES) $(bank_tutorial_SOURCES) \
+ $(bank2contig_SOURCES) $(bank2coverage_SOURCES) \
+ $(bank2fasta_SOURCES) $(bank2lib_SOURCES) \
+ $(bank2scaff_SOURCES) $(dumpContigsAsReads_SOURCES) \
+ $(dumpFeatures_SOURCES) $(dumpmates_SOURCES) \
+ $(dumpreads_SOURCES) $(extractContig_SOURCES) \
+ $(findMissingMates_SOURCES) $(grow_readbank_SOURCES) \
+ $(listGCContent_SOURCES) $(listReadPlacedStatus_SOURCES) \
+ $(load_overlaps_SOURCES) $(loadFeatures_SOURCES) \
+ $(normalizeScaffold_SOURCES) $(partitionBank_SOURCES) \
+ $(renameReads_SOURCES) $(resetFragLibrary_SOURCES) \
+ $(revScaffold_SOURCES) $(select_reads_SOURCES) \
+ $(simpleContigLoader_SOURCES) $(simplifyLibraries_SOURCES) \
+ $(updateBankPositions_SOURCES) $(updateClrRanges_SOURCES) \
+ $(updateLibSizes_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+dist_bin_SCRIPTS = \
+ bank-unlock.pl
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/CelMsg \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/Slice \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/Foundation
+
+bank_combine_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+bank_combine_SOURCES = \
+ bank-combine.cc
+
+bank_mapping_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+bank_mapping_SOURCES = \
+ bank-mapping.cc
+
+bank2contig_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+
+bank2contig_SOURCES = \
+ bank2contig.cc
+
+bank2lib_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+
+bank2lib_SOURCES = \
+ bank2lib.cc
+
+bank2coverage_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Slice/libSlice.a
+
+bank2coverage_SOURCES = \
+ bank2coverage.cc
+
+bank2scaff_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+bank2scaff_SOURCES = \
+ bank2scaff.cc
+
+bank_clean_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+bank_clean_SOURCES = \
+ bank-clean.cc
+
+bank_report_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+bank_report_SOURCES = \
+ bank-report.cc
+
+bank_transact_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+bank_transact_SOURCES = \
+ bank-transact.cc
+
+normalizeScaffold_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+normalizeScaffold_SOURCES = \
+ normalizeScaffold.cc
+
+revScaffold_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+revScaffold_SOURCES = \
+ revScaffold.cc
+
+updateBankPositions_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+updateBankPositions_SOURCES = \
+ updateBankPositions.cc
+
+simpleContigLoader_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+simpleContigLoader_SOURCES = \
+ simpleContigLoader.cc
+
+updateClrRanges_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+updateClrRanges_SOURCES = \
+ updateClrRanges.cc
+
+updateLibSizes_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+updateLibSizes_SOURCES = \
+ updateLibSizes.cc
+
+resetFragLibrary_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+resetFragLibrary_SOURCES = \
+ resetFragLibrary.cc
+
+extractContig_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+extractContig_SOURCES = \
+ extractContig.cc
+
+findMissingMates_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+findMissingMates_SOURCES = \
+ findMissingMates.cc
+
+listGCContent_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+listGCContent_SOURCES = \
+ listGCContent.cc
+
+listReadPlacedStatus_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+listReadPlacedStatus_SOURCES = \
+ listReadPlacedStatus.cc
+
+dumpmates_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+dumpmates_SOURCES = \
+ dumpmates.cc
+
+dumpFeatures_LDADD = \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+dumpFeatures_SOURCES = \
+ dumpFeatures.cc
+
+loadFeatures_LDADD = \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+loadFeatures_SOURCES = \
+ loadFeatures.cc
+
+bank_tutorial_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+bank_tutorial_SOURCES = \
+ bank-tutorial.cc
+
+select_reads_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+select_reads_SOURCES = \
+ select-reads.cc
+
+dumpreads_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+dumpreads_SOURCES = \
+ dumpreads.cc
+
+renameReads_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+renameReads_SOURCES = \
+ renameReads.cc
+
+grow_readbank_LDADD = \
+ $(top_builddir)/src/CelMsg/libCelMsg.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+grow_readbank_SOURCES = \
+ grow-readbank.cc
+
+load_overlaps_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+load_overlaps_SOURCES = \
+ load-overlaps.cc
+
+bank2fasta_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU
+
+bank2fasta_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+bank2fasta_SOURCES = \
+ bank2fasta.cc
+
+dumpContigsAsReads_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU
+
+dumpContigsAsReads_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+dumpContigsAsReads_SOURCES = \
+ dumpContigsAsReads.cc
+
+partitionBank_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU
+
+partitionBank_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+partitionBank_SOURCES = \
+ partitionBank.cc
+
+simplifyLibraries_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU
+
+simplifyLibraries_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+simplifyLibraries_SOURCES = \
+ simplifyLibraries.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Bank/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Bank/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):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+bank-clean$(EXEEXT): $(bank_clean_OBJECTS) $(bank_clean_DEPENDENCIES)
+ @rm -f bank-clean$(EXEEXT)
+ $(CXXLINK) $(bank_clean_OBJECTS) $(bank_clean_LDADD) $(LIBS)
+bank-combine$(EXEEXT): $(bank_combine_OBJECTS) $(bank_combine_DEPENDENCIES)
+ @rm -f bank-combine$(EXEEXT)
+ $(CXXLINK) $(bank_combine_OBJECTS) $(bank_combine_LDADD) $(LIBS)
+bank-mapping$(EXEEXT): $(bank_mapping_OBJECTS) $(bank_mapping_DEPENDENCIES)
+ @rm -f bank-mapping$(EXEEXT)
+ $(CXXLINK) $(bank_mapping_OBJECTS) $(bank_mapping_LDADD) $(LIBS)
+bank-report$(EXEEXT): $(bank_report_OBJECTS) $(bank_report_DEPENDENCIES)
+ @rm -f bank-report$(EXEEXT)
+ $(CXXLINK) $(bank_report_OBJECTS) $(bank_report_LDADD) $(LIBS)
+bank-transact$(EXEEXT): $(bank_transact_OBJECTS) $(bank_transact_DEPENDENCIES)
+ @rm -f bank-transact$(EXEEXT)
+ $(CXXLINK) $(bank_transact_OBJECTS) $(bank_transact_LDADD) $(LIBS)
+bank-tutorial$(EXEEXT): $(bank_tutorial_OBJECTS) $(bank_tutorial_DEPENDENCIES)
+ @rm -f bank-tutorial$(EXEEXT)
+ $(CXXLINK) $(bank_tutorial_OBJECTS) $(bank_tutorial_LDADD) $(LIBS)
+bank2contig$(EXEEXT): $(bank2contig_OBJECTS) $(bank2contig_DEPENDENCIES)
+ @rm -f bank2contig$(EXEEXT)
+ $(CXXLINK) $(bank2contig_OBJECTS) $(bank2contig_LDADD) $(LIBS)
+bank2coverage$(EXEEXT): $(bank2coverage_OBJECTS) $(bank2coverage_DEPENDENCIES)
+ @rm -f bank2coverage$(EXEEXT)
+ $(CXXLINK) $(bank2coverage_OBJECTS) $(bank2coverage_LDADD) $(LIBS)
+bank2fasta$(EXEEXT): $(bank2fasta_OBJECTS) $(bank2fasta_DEPENDENCIES)
+ @rm -f bank2fasta$(EXEEXT)
+ $(CXXLINK) $(bank2fasta_OBJECTS) $(bank2fasta_LDADD) $(LIBS)
+bank2lib$(EXEEXT): $(bank2lib_OBJECTS) $(bank2lib_DEPENDENCIES)
+ @rm -f bank2lib$(EXEEXT)
+ $(CXXLINK) $(bank2lib_OBJECTS) $(bank2lib_LDADD) $(LIBS)
+bank2scaff$(EXEEXT): $(bank2scaff_OBJECTS) $(bank2scaff_DEPENDENCIES)
+ @rm -f bank2scaff$(EXEEXT)
+ $(CXXLINK) $(bank2scaff_OBJECTS) $(bank2scaff_LDADD) $(LIBS)
+dumpContigsAsReads$(EXEEXT): $(dumpContigsAsReads_OBJECTS) $(dumpContigsAsReads_DEPENDENCIES)
+ @rm -f dumpContigsAsReads$(EXEEXT)
+ $(CXXLINK) $(dumpContigsAsReads_OBJECTS) $(dumpContigsAsReads_LDADD) $(LIBS)
+dumpFeatures$(EXEEXT): $(dumpFeatures_OBJECTS) $(dumpFeatures_DEPENDENCIES)
+ @rm -f dumpFeatures$(EXEEXT)
+ $(CXXLINK) $(dumpFeatures_OBJECTS) $(dumpFeatures_LDADD) $(LIBS)
+dumpmates$(EXEEXT): $(dumpmates_OBJECTS) $(dumpmates_DEPENDENCIES)
+ @rm -f dumpmates$(EXEEXT)
+ $(CXXLINK) $(dumpmates_OBJECTS) $(dumpmates_LDADD) $(LIBS)
+dumpreads$(EXEEXT): $(dumpreads_OBJECTS) $(dumpreads_DEPENDENCIES)
+ @rm -f dumpreads$(EXEEXT)
+ $(CXXLINK) $(dumpreads_OBJECTS) $(dumpreads_LDADD) $(LIBS)
+extractContig$(EXEEXT): $(extractContig_OBJECTS) $(extractContig_DEPENDENCIES)
+ @rm -f extractContig$(EXEEXT)
+ $(CXXLINK) $(extractContig_OBJECTS) $(extractContig_LDADD) $(LIBS)
+findMissingMates$(EXEEXT): $(findMissingMates_OBJECTS) $(findMissingMates_DEPENDENCIES)
+ @rm -f findMissingMates$(EXEEXT)
+ $(CXXLINK) $(findMissingMates_OBJECTS) $(findMissingMates_LDADD) $(LIBS)
+grow-readbank$(EXEEXT): $(grow_readbank_OBJECTS) $(grow_readbank_DEPENDENCIES)
+ @rm -f grow-readbank$(EXEEXT)
+ $(CXXLINK) $(grow_readbank_OBJECTS) $(grow_readbank_LDADD) $(LIBS)
+listGCContent$(EXEEXT): $(listGCContent_OBJECTS) $(listGCContent_DEPENDENCIES)
+ @rm -f listGCContent$(EXEEXT)
+ $(CXXLINK) $(listGCContent_OBJECTS) $(listGCContent_LDADD) $(LIBS)
+listReadPlacedStatus$(EXEEXT): $(listReadPlacedStatus_OBJECTS) $(listReadPlacedStatus_DEPENDENCIES)
+ @rm -f listReadPlacedStatus$(EXEEXT)
+ $(CXXLINK) $(listReadPlacedStatus_OBJECTS) $(listReadPlacedStatus_LDADD) $(LIBS)
+load-overlaps$(EXEEXT): $(load_overlaps_OBJECTS) $(load_overlaps_DEPENDENCIES)
+ @rm -f load-overlaps$(EXEEXT)
+ $(CXXLINK) $(load_overlaps_OBJECTS) $(load_overlaps_LDADD) $(LIBS)
+loadFeatures$(EXEEXT): $(loadFeatures_OBJECTS) $(loadFeatures_DEPENDENCIES)
+ @rm -f loadFeatures$(EXEEXT)
+ $(CXXLINK) $(loadFeatures_OBJECTS) $(loadFeatures_LDADD) $(LIBS)
+normalizeScaffold$(EXEEXT): $(normalizeScaffold_OBJECTS) $(normalizeScaffold_DEPENDENCIES)
+ @rm -f normalizeScaffold$(EXEEXT)
+ $(CXXLINK) $(normalizeScaffold_OBJECTS) $(normalizeScaffold_LDADD) $(LIBS)
+partitionBank$(EXEEXT): $(partitionBank_OBJECTS) $(partitionBank_DEPENDENCIES)
+ @rm -f partitionBank$(EXEEXT)
+ $(CXXLINK) $(partitionBank_OBJECTS) $(partitionBank_LDADD) $(LIBS)
+renameReads$(EXEEXT): $(renameReads_OBJECTS) $(renameReads_DEPENDENCIES)
+ @rm -f renameReads$(EXEEXT)
+ $(CXXLINK) $(renameReads_OBJECTS) $(renameReads_LDADD) $(LIBS)
+resetFragLibrary$(EXEEXT): $(resetFragLibrary_OBJECTS) $(resetFragLibrary_DEPENDENCIES)
+ @rm -f resetFragLibrary$(EXEEXT)
+ $(CXXLINK) $(resetFragLibrary_OBJECTS) $(resetFragLibrary_LDADD) $(LIBS)
+revScaffold$(EXEEXT): $(revScaffold_OBJECTS) $(revScaffold_DEPENDENCIES)
+ @rm -f revScaffold$(EXEEXT)
+ $(CXXLINK) $(revScaffold_OBJECTS) $(revScaffold_LDADD) $(LIBS)
+select-reads$(EXEEXT): $(select_reads_OBJECTS) $(select_reads_DEPENDENCIES)
+ @rm -f select-reads$(EXEEXT)
+ $(CXXLINK) $(select_reads_OBJECTS) $(select_reads_LDADD) $(LIBS)
+simpleContigLoader$(EXEEXT): $(simpleContigLoader_OBJECTS) $(simpleContigLoader_DEPENDENCIES)
+ @rm -f simpleContigLoader$(EXEEXT)
+ $(CXXLINK) $(simpleContigLoader_OBJECTS) $(simpleContigLoader_LDADD) $(LIBS)
+simplifyLibraries$(EXEEXT): $(simplifyLibraries_OBJECTS) $(simplifyLibraries_DEPENDENCIES)
+ @rm -f simplifyLibraries$(EXEEXT)
+ $(CXXLINK) $(simplifyLibraries_OBJECTS) $(simplifyLibraries_LDADD) $(LIBS)
+updateBankPositions$(EXEEXT): $(updateBankPositions_OBJECTS) $(updateBankPositions_DEPENDENCIES)
+ @rm -f updateBankPositions$(EXEEXT)
+ $(CXXLINK) $(updateBankPositions_OBJECTS) $(updateBankPositions_LDADD) $(LIBS)
+updateClrRanges$(EXEEXT): $(updateClrRanges_OBJECTS) $(updateClrRanges_DEPENDENCIES)
+ @rm -f updateClrRanges$(EXEEXT)
+ $(CXXLINK) $(updateClrRanges_OBJECTS) $(updateClrRanges_LDADD) $(LIBS)
+updateLibSizes$(EXEEXT): $(updateLibSizes_OBJECTS) $(updateLibSizes_DEPENDENCIES)
+ @rm -f updateLibSizes$(EXEEXT)
+ $(CXXLINK) $(updateLibSizes_OBJECTS) $(updateLibSizes_LDADD) $(LIBS)
+install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bank-clean.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bank-combine.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bank-mapping.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bank-report.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bank-transact.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bank-tutorial.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bank2contig.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bank2coverage.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bank2fasta-bank2fasta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bank2lib.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bank2scaff.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dumpContigsAsReads-dumpContigsAsReads.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dumpFeatures.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dumpmates.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dumpreads.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/extractContig.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/findMissingMates.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/grow-readbank.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/listGCContent.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/listReadPlacedStatus.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/load-overlaps.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/loadFeatures.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/normalizeScaffold.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/partitionBank-partitionBank.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/renameReads.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/resetFragLibrary.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/revScaffold.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/select-reads.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simpleContigLoader.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/simplifyLibraries-simplifyLibraries.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/updateBankPositions.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/updateClrRanges.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/updateLibSizes.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+
+bank2fasta-bank2fasta.o: bank2fasta.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bank2fasta_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bank2fasta-bank2fasta.o -MD -MP -MF $(DEPDIR)/bank2fasta-bank2fasta.Tpo -c -o bank2fasta-bank2fasta.o `test -f 'bank2fasta.cc' || echo '$(srcdir)/'`bank2fasta.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/bank2fasta-bank2fasta.Tpo $(DEPDIR)/bank2fasta-bank2fasta.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='bank2fasta.cc' object='bank2fasta-bank2fasta.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bank2fasta_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bank2fasta-bank2fasta.o `test -f 'bank2fasta.cc' || echo '$(srcdir)/'`bank2fasta.cc
+
+bank2fasta-bank2fasta.obj: bank2fasta.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bank2fasta_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bank2fasta-bank2fasta.obj -MD -MP -MF $(DEPDIR)/bank2fasta-bank2fasta.Tpo -c -o bank2fasta-bank2fasta.obj `if test -f 'bank2fasta.cc'; then $(CYGPATH_W) 'bank2fasta.cc'; else $(CYGPATH_W) '$(srcdir)/bank2fasta.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/bank2fasta-bank2fasta.Tpo $(DEPDIR)/bank2fasta-bank2fasta.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='bank2fasta.cc' object='bank2fasta-bank2fasta.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bank2fasta_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bank2fasta-bank2fasta.obj `if test -f 'bank2fasta.cc'; then $(CYGPATH_W) 'bank2fasta.cc'; else $(CYGPATH_W) '$(srcdir)/bank2fasta.cc'; fi`
+
+dumpContigsAsReads-dumpContigsAsReads.o: dumpContigsAsReads.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dumpContigsAsReads_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dumpContigsAsReads-dumpContigsAsReads.o -MD -MP -MF $(DEPDIR)/dumpContigsAsReads-dumpContigsAsReads.Tpo -c -o dumpContigsAsReads-dumpContigsAsReads.o `test -f 'dumpContigsAsReads.cc' || echo '$(srcdir)/'`dumpContigsAsReads.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/dumpContigsAsReads-dumpContigsAsReads.Tpo $(DEPDIR)/dumpContigsAsReads-dumpContigsAsReads.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dumpContigsAsReads.cc' object='dumpContigsAsReads-dumpContigsAsReads.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dumpContigsAsReads_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dumpContigsAsReads-dumpContigsAsReads.o `test -f 'dumpContigsAsReads.cc' || echo '$(srcdir)/'`dumpContigsAsReads.cc
+
+dumpContigsAsReads-dumpContigsAsReads.obj: dumpContigsAsReads.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dumpContigsAsReads_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT dumpContigsAsReads-dumpContigsAsReads.obj -MD -MP -MF $(DEPDIR)/dumpContigsAsReads-dumpContigsAsReads.Tpo -c -o dumpContigsAsReads-dumpContigsAsReads.obj `if test -f 'dumpContigsAsReads.cc'; then $(CYGPATH_W) 'dumpContigsAsReads.cc'; else $(CYGPATH_W) '$(srcdir)/dumpContigsAsReads.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/dumpContigsAsReads-dumpContigsAsReads.Tpo $(DEPDIR)/dumpContigsAsReads-dumpContigsAsReads.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dumpContigsAsReads.cc' object='dumpContigsAsReads-dumpContigsAsReads.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dumpContigsAsReads_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dumpContigsAsReads-dumpContigsAsReads.obj `if test -f 'dumpContigsAsReads.cc'; then $(CYGPATH_W) 'dumpContigsAsReads.cc'; else $(CYGPATH_W) '$(srcdir)/dumpContigsAsReads.cc'; fi`
+
+partitionBank-partitionBank.o: partitionBank.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(partitionBank_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT partitionBank-partitionBank.o -MD -MP -MF $(DEPDIR)/partitionBank-partitionBank.Tpo -c -o partitionBank-partitionBank.o `test -f 'partitionBank.cc' || echo '$(srcdir)/'`partitionBank.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/partitionBank-partitionBank.Tpo $(DEPDIR)/partitionBank-partitionBank.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='partitionBank.cc' object='partitionBank-partitionBank.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(partitionBank_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o partitionBank-partitionBank.o `test -f 'partitionBank.cc' || echo '$(srcdir)/'`partitionBank.cc
+
+partitionBank-partitionBank.obj: partitionBank.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(partitionBank_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT partitionBank-partitionBank.obj -MD -MP -MF $(DEPDIR)/partitionBank-partitionBank.Tpo -c -o partitionBank-partitionBank.obj `if test -f 'partitionBank.cc'; then $(CYGPATH_W) 'partitionBank.cc'; else $(CYGPATH_W) '$(srcdir)/partitionBank.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/partitionBank-partitionBank.Tpo $(DEPDIR)/partitionBank-partitionBank.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='partitionBank.cc' object='partitionBank-partitionBank.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(partitionBank_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o partitionBank-partitionBank.obj `if test -f 'partitionBank.cc'; then $(CYGPATH_W) 'partitionBank.cc'; else $(CYGPATH_W) '$(srcdir)/partitionBank.cc'; fi`
+
+simplifyLibraries-simplifyLibraries.o: simplifyLibraries.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(simplifyLibraries_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT simplifyLibraries-simplifyLibraries.o -MD -MP -MF $(DEPDIR)/simplifyLibraries-simplifyLibraries.Tpo -c -o simplifyLibraries-simplifyLibraries.o `test -f 'simplifyLibraries.cc' || echo '$(srcdir)/'`simplifyLibraries.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/simplifyLibraries-simplifyLibraries.Tpo $(DEPDIR)/simplifyLibraries-simplifyLibraries.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='simplifyLibraries.cc' object='simplifyLibraries-simplifyLibraries.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(simplifyLibraries_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o simplifyLibraries-simplifyLibraries.o `test -f 'simplifyLibraries.cc' || echo '$(srcdir)/'`simplifyLibraries.cc
+
+simplifyLibraries-simplifyLibraries.obj: simplifyLibraries.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(simplifyLibraries_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT simplifyLibraries-simplifyLibraries.obj -MD -MP -MF $(DEPDIR)/simplifyLibraries-simplifyLibraries.Tpo -c -o simplifyLibraries-simplifyLibraries.obj `if test -f 'simplifyLibraries.cc'; then $(CYGPATH_W) 'simplifyLibraries.cc'; else $(CYGPATH_W) '$(srcdir)/simplifyLibraries.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/simplifyLibraries-simplifyLibraries.Tpo $(DEPDIR)/simplifyLibraries-simplifyLibraries.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='simplifyLibraries.cc' object='simplifyLibraries-simplifyLibraries.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(simplifyLibraries_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o simplifyLibraries-simplifyLibraries.obj `if test -f 'simplifyLibraries.cc'; then $(CYGPATH_W) 'simplifyLibraries.cc'; else $(CYGPATH_W) '$(srcdir)/simplifyLibraries.cc'; fi`
+
+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 $(PROGRAMS) $(SCRIPTS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-binPROGRAMS clean-generic 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-binPROGRAMS install-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dist_binSCRIPTS \
+ 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-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-dist_binSCRIPTS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Bank/bank-clean.cc b/src/Bank/bank-clean.cc
new file mode 100644
index 0000000..ca419a6
--- /dev/null
+++ b/src/Bank/bank-clean.cc
@@ -0,0 +1,234 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 01/10/2005
+//!
+//! \brief Cleans a bank of it's deleted records and stale file locks
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include <set>
+#include <vector>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <unistd.h>
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//=============================================================== Globals ====//
+string OPT_BankName; // bank name parameter
+bool OPT_IsCleanCodes = false; // clean certain codes
+set<NCode_t> OPT_CleanCodes; // NCodes to clean
+
+
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+ long int cntc = 0; // banks cleand
+ long int cnts = 0; // banks seen
+ NCode_t ncode; // current bank type
+ BankSet_t bnks; // all the banks
+
+ BankSet_t::iterator bi;
+ set<NCode_t>::iterator ci;
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- Output the current time and bank directory
+ cerr << "START DATE: " << Date( ) << endl;
+ cerr << "Bank is: " << OPT_BankName << endl;
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ //-- Iterate through each known bank and clean
+ for ( bi = bnks.begin( ); bi != bnks.end( ); ++ bi )
+ {
+ ncode = bi -> getType( );
+
+ //-- Skip if we're not looking at this one or it doesn't exist
+ if ( (OPT_IsCleanCodes &&
+ OPT_CleanCodes . find (ncode) == OPT_CleanCodes . end( ))
+ ||
+ (!OPT_IsCleanCodes &&
+ !bi -> exists (OPT_BankName)) )
+ continue;
+
+ cnts ++;
+ OPT_CleanCodes . erase (ncode);
+
+ //-- Clean the bank
+ try {
+ cerr << Decode (ncode) << " ... ";
+
+ bi -> open (OPT_BankName);
+ bi -> clean( );
+ bi -> close( );
+
+ cerr << "done\n";
+ }
+ catch (const Exception_t & e) {
+ cerr << "err\n";
+ cerr << "ERROR: " << e . what( ) << endl
+ << " failed to clean '" << Decode (ncode) << "' bank" << endl;
+ exitcode = EXIT_FAILURE;
+ continue;
+ }
+
+ cntc ++;
+ }
+
+ //-- Any codes unrecognized?
+ for ( ci = OPT_CleanCodes.begin( ); ci != OPT_CleanCodes.end( ); ++ ci )
+ {
+ cnts ++;
+ cerr << "ERROR: Unrecognized bank type" << endl
+ << " unknown bank type '" << Decode (*ci) << "' ignored" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+
+ //-- Output the end time
+ cerr << "Clean attempts: " << cnts << endl
+ << "Clean successes: " << cntc << endl
+ << "END DATE: " << Date( ) << endl;
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "b:hv")) != EOF) )
+ switch (ch)
+ {
+ case 'b':
+ OPT_BankName = optarg;
+ break;
+
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'v':
+ PrintBankVersion (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ default:
+ errflg ++;
+ }
+
+ if ( OPT_BankName . empty( ) )
+ {
+ cerr << "ERROR: The -b option is mandatory\n";
+ errflg ++;
+ }
+
+ if ( access (OPT_BankName . c_str( ), R_OK|W_OK|X_OK) )
+ {
+ cerr << "ERROR: Bank directory is not accessible, "
+ << strerror (errno) << endl;
+ errflg ++;
+ }
+
+ if ( errflg > 0 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ if ( optind != argc )
+ {
+ OPT_IsCleanCodes = true;
+ while ( optind != argc )
+ OPT_CleanCodes . insert (Encode (argv [optind ++]));
+ }
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "\n.DESCRIPTION.\n"
+ << " Takes an AMOS bank directory as input. If no NCodes are listed on the\n"
+ << " command line, all bank types will be cleaned of deleted records.\n"
+ << " Otherwise, only the listed bank types will be cleaned. Cleaning the\n"
+ << " deleted records may dramatically reduce the size of the bank if\n"
+ << " numerous remove or replace operations have been performed.\n"
+ << "\n.OPTIONS.\n"
+ << " -b path The directory path of the bank to clean\n"
+ << " -h Display help information\n"
+ << " -v Display the compatible bank version\n"
+ << "\n.KEYWORDS.\n"
+ << " amos bank\n"
+ << endl;
+
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr << "\nUSAGE:\n" << " " << s << " [options] <bank path> [NCodes]\n";
+ return;
+}
diff --git a/src/Bank/bank-combine.cc b/src/Bank/bank-combine.cc
new file mode 100644
index 0000000..6a9f6ca
--- /dev/null
+++ b/src/Bank/bank-combine.cc
@@ -0,0 +1,93 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Mike Schatz
+//! \date 09/09/2005
+//!
+//! \brief Combines multiple banks into a single bank, while mapping iids
+//! Only handles contigs and reads at this time
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <unistd.h>
+using namespace std;
+using namespace AMOS;
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+
+ if (argc < 4)
+ {
+ fprintf(stderr, "USAGE: bank-combine outbank in_1 in_2 ... in_n\n");
+ exit(1);
+ }
+
+ vector<string> inbanks;
+ string outbank = argv[1];
+ for (int i = 2; i < argc; i++)
+ {
+ inbanks.push_back(argv[i]);
+ }
+
+ Bank_t ctg_out (Contig_t::NCODE);
+ Bank_t red_out (Read_t::NCODE);
+
+ BankStream_t ctg_bank (Contig_t::NCODE);
+ BankStream_t red_bank (Read_t::NCODE);
+
+ int redoffset = 0;
+ int ctgoffset = 0;
+
+ Read_t red;
+ Contig_t ctg;
+
+ try
+ {
+ ctg_out.create(outbank, B_READ|B_WRITE);
+ red_out.create(outbank, B_READ|B_WRITE);
+
+ vector<string>::iterator vi;
+ for (vi = inbanks.begin(); vi != inbanks.end(); vi++)
+ {
+ ctg_bank.open(*vi, B_READ);
+ red_bank.open(*vi, B_READ);
+
+ while (red_bank >> red)
+ {
+ red.setIID(red.getIID()+redoffset);
+ red_out.append(red);
+ }
+
+ while (ctg_bank >> ctg)
+ {
+ ctg.setIID(ctg.getIID()+ctgoffset);
+ vector<Tile_t>::iterator ti;
+ for (ti = ctg.getReadTiling().begin();
+ ti != ctg.getReadTiling().end();
+ ti++)
+ {
+ ti->source += redoffset;
+ }
+
+ ctg_out.append(ctg);
+ }
+
+ ctgoffset += ctg_bank.getMaxIID() + 1;
+ redoffset += red_bank.getMaxIID() + 1;
+ }
+ }
+ catch (const Exception_t & e)
+ {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+ return exitcode;
+}
+
diff --git a/src/Bank/bank-mapping.cc b/src/Bank/bank-mapping.cc
new file mode 100644
index 0000000..189f737
--- /dev/null
+++ b/src/Bank/bank-mapping.cc
@@ -0,0 +1,251 @@
+///////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/24/04
+//!
+//! \brief Reports the IDMaps for the requested bank[s]
+//!
+//! bank-mapping reads the IDMap from one or more AMOS banks and writes the
+//! information to an AMOS message file. Columns in the map fields are
+//! BID,IID,EID respectively. With 0=NULL for BID,IID and '\n'=NULL for EID.
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include <set>
+#include <iostream>
+#include <unistd.h>
+using namespace std;
+using namespace AMOS;
+
+
+
+
+//=============================================================== Globals ====//
+string OPT_BankName; // bank name parameter
+bool OPT_IsExtractCodes = false; // extract only certain NCodes
+bool OPT_BankSpy = false; // read or read-only spy
+set<NCode_t> OPT_ExtractCodes; // NCodes to extract
+
+
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+ long int cntc = 0; // mappings output
+ long int cnts = 0; // banks seen
+ NCode_t ncode; // current bank type
+ Message_t msg; // output message
+ BankSet_t bnks; // all the banks
+
+ BankSet_t::iterator bi;
+ set<NCode_t>::iterator ci;
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- Output the current time and bank directory
+ cerr << "START DATE: " << Date( ) << endl;
+ cerr << "Bank is: " << OPT_BankName << endl;
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ //-- Iterate through each bank and dump its map
+ for ( bi = bnks.begin( ); bi != bnks.end( ); ++ bi )
+ {
+ ncode = bi -> getType( );
+
+ //-- Skip if we're not looking at this one or it doesn't exist
+ if ( (OPT_IsExtractCodes &&
+ OPT_ExtractCodes . find (ncode) == OPT_ExtractCodes . end( ))
+ ||
+ (!OPT_IsExtractCodes &&
+ !bi -> exists (OPT_BankName)) )
+ continue;
+
+ cnts ++;
+ OPT_ExtractCodes . erase (ncode);
+
+ //-- Write the map and close the bank
+ try {
+ cerr << Decode (ncode) << " ... ";
+
+ if ( OPT_BankSpy )
+ bi -> open (OPT_BankName, B_SPY);
+ else
+ bi -> open (OPT_BankName, B_READ);
+ bi -> getIDMap( ) . writeMessage (msg);
+ msg . write (cout);
+ bi -> close( );
+
+ cerr << "done\n";
+ }
+ catch (const Exception_t & e) {
+ cerr << "err\n";
+ cerr << "ERROR: " << e . what( ) << endl
+ << " failed to map '" << Decode (ncode) << "' bank" << endl;
+ exitcode = EXIT_FAILURE;
+ continue;
+ }
+
+ cntc ++;
+ }
+
+ //-- Any codes unrecognized?
+ for ( ci = OPT_ExtractCodes.begin( ); ci != OPT_ExtractCodes.end( ); ++ ci )
+ {
+ cnts ++;
+ cerr << "ERROR: Unrecognized bank type" << endl
+ << " unknown bank type '" << Decode (*ci) << "' ignored" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+
+ //-- Output the end time
+ cerr << "Mapping attempts: " << cnts << endl
+ << "Mapping successes: " << cntc << endl
+ << "END DATE: " << Date( ) << endl;
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "b:hsv")) != EOF) )
+ switch (ch)
+ {
+ case 'b':
+ OPT_BankName = optarg;
+ break;
+
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 's':
+ OPT_BankSpy = true;
+ break;
+
+ case 'v':
+ PrintBankVersion (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ default:
+ errflg ++;
+ }
+
+ if ( OPT_BankName . empty( ) )
+ {
+ cerr << "ERROR: The -b option is mandatory" << endl;
+ errflg ++;
+ }
+
+ if ( ( OPT_BankSpy && access (OPT_BankName . c_str( ), R_OK|X_OK)) ||
+ (!OPT_BankSpy && access (OPT_BankName . c_str( ), R_OK|W_OK|X_OK)) )
+ {
+ cerr << "ERROR: Bank directory is not accessible, "
+ << strerror (errno) << endl;
+ errflg ++;
+ }
+
+ if ( errflg > 0 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information." << endl;
+ exit (EXIT_FAILURE);
+ }
+
+ if ( optind != argc )
+ {
+ OPT_IsExtractCodes = true;
+ while ( optind != argc )
+ OPT_ExtractCodes . insert (Encode (argv [optind ++]));
+ }
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+
+ cerr << "\n.DESCRIPTION.\n"
+ << " Takes an AMOS bank directory as input. Will output the ID map\n"
+ << " information contained in the bank in the form of an AMOS message\n"
+ << " to stdout. If no NCodes are listed on the command line, all known\n"
+ << " object types will be reported. Output columns in the map field are\n"
+ << " BID,IID,EID respectively, with 0 being NULL for BID,IID and newline\n"
+ << " being NULL for EID.\n"
+ << "\n.OPTIONS.\n"
+ << " -b path The directory path of the bank to report\n"
+ << " -h Display help information\n"
+ << " -s Disregard bank locks and write permissions (spy mode)\n"
+ << " -v Display the compatible bank version\n"
+ << "\n.KEYWORDS.\n"
+ << " amos bank"
+ << endl;
+
+
+
+
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr << "\n.USAGE.\n" << " " << s << " [options] -b <bank path> [NCodes]\n";
+ return;
+}
diff --git a/src/Bank/bank-report.cc b/src/Bank/bank-report.cc
new file mode 100644
index 0000000..6d65b26
--- /dev/null
+++ b/src/Bank/bank-report.cc
@@ -0,0 +1,502 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 01/07/2004
+//!
+//! \brief Reports the data contained in a bank to a message file
+//!
+//! bank-report reads the assembly data from an AMOS bank and writes it to an
+//! AMOS message file. Will only extract the data of the objects it recognizes.
+//! All links reference IIDs.
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include <set>
+#include <vector>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <unistd.h>
+using namespace AMOS;
+using namespace std;
+
+
+
+
+//=============================================================== Globals ====//
+string OPT_BankName; // bank name parameter
+string OPT_IIDExtractName; // extract by IID file
+string OPT_EIDExtractName; // extract by EID file
+bool OPT_IsBIDs = false; // include BIDs in the output
+bool OPT_IsExtractCodes = false; // extract only certain NCodes
+bool OPT_IsExtractIDs = false; // extract only certain IDs
+bool OPT_BankSpy = false; // read or read-only spy
+bool OPT_FixedOnly = false; // Just print the fixed store
+set<NCode_t> OPT_ExtractCodes; // NCodes to extract
+vector<ID_t> OPT_ExtractIIDs; // IIDs to extract
+vector<string> OPT_ExtractEIDs; // EIDs to extract
+
+bool OPT_OnlyIDs = false; // Just print the eids and iids
+bool OPT_Progress = true; // Print the progress information
+
+
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseExtract -----------
+//! \brief Parses the extract file and loads the appropriate extract maps
+//!
+//! \return void
+//!
+void ParseExtract ( );
+
+
+//----------------------------------------------------- PrintObject ------------
+//! \brief Prints the object message to stdout
+//!
+//! \return void
+//!
+void PrintObject (const Universal_t & obj, ID_t bid);
+
+
+
+//----------------------------------------------------- PrintObjectID ----------
+//! \brief Prints the object EEID and IID to stdout
+//!
+//! \return void
+//!
+void PrintObjectID (const Universal_t & obj, ID_t bid);
+
+
+
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+ long int cntc = 0; // objects reported
+ NCode_t ncode; // current object type
+ UniversalSet_t objs; // all the universal objects
+ ID_t bid; // bank index
+
+ UniversalSet_t::iterator ui;
+ set<NCode_t>::iterator ci;
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- Output the current time and bank directory
+ cerr << "START DATE: " << Date( ) << endl;
+ cerr << "Bank is: " << OPT_BankName << endl;
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ if (OPT_Progress)
+ cerr << " 0% 100%" << endl;
+
+ //-- Iterate through each known object and dump if its got bank
+ for ( ui = objs.begin( ); ui != objs.end( ); ++ ui )
+ {
+ ncode = ui -> getNCode( );
+
+ //-- Skip if we're not looking at this one or it doesn't exist
+ if ( (OPT_IsExtractCodes &&
+ OPT_ExtractCodes . find (ncode) == OPT_ExtractCodes . end( ))
+ ||
+ (!OPT_IsExtractCodes &&
+ !BankExists (ncode, OPT_BankName)) )
+ continue;
+
+ OPT_ExtractCodes . erase (ncode);
+
+ //-- Report the bank
+ try {
+ cerr << Decode (ncode) << " ";
+
+ if ( OPT_IsExtractIDs )
+ {
+ vector<ID_t>::iterator ii = OPT_ExtractIIDs . begin( );
+ vector<string>::iterator ei = OPT_ExtractEIDs . begin( );
+ Bank_t bank (ncode);
+
+ if ( OPT_BankSpy )
+ bank . open (OPT_BankName, B_SPY);
+ else
+ bank . open (OPT_BankName, B_READ);
+
+ ProgressDots_t dots (OPT_ExtractIIDs . size( ) +
+ OPT_ExtractEIDs . size( ), 50);
+
+ //-- Get the requested IIDs
+ for ( ; ii != OPT_ExtractIIDs . end( ); ++ ii )
+ {
+ if (OPT_Progress)
+ dots . update (ii - OPT_ExtractIIDs . begin( ));
+
+ bid = bank . getIDMap( ) . lookupBID (*ii);
+ if ( bid == NULL_ID )
+ {
+ cerr << "ERROR: IID '" << *ii << "' not found in '"
+ << Decode (ncode) << "' bank" << endl;
+ exitcode = EXIT_FAILURE;
+ continue;
+ }
+ if (OPT_FixedOnly)
+ {
+ bank . fetchFix(*ii, *ui);
+ }
+ else
+ {
+ bank . fetch (*ii, *ui);
+ }
+
+ if (OPT_OnlyIDs)
+ PrintObjectID(*ui, bid);
+ else
+ PrintObject (*ui, bid);
+
+ cntc ++;
+ }
+
+ //-- Get the requested EIDs
+ for ( ; ei != OPT_ExtractEIDs . end( ); ++ ei )
+ {
+ if (OPT_Progress)
+ dots . update ((ei - OPT_ExtractEIDs . begin( )) +
+ (ii - OPT_ExtractIIDs . begin( )));
+
+ bid = bank . getIDMap( ) . lookupBID (*ei);
+ if ( bid == NULL_ID )
+ {
+ cerr << "ERROR: EID '" << *ei << "' not found in '"
+ << Decode (ncode) << "' bank" << endl;
+ exitcode = EXIT_FAILURE;
+ continue;
+ }
+ if (OPT_FixedOnly)
+ {
+ bank . fetchFix (*ei, *ui);
+ }
+ else
+ {
+ bank . fetch (*ei, *ui);
+ }
+
+ if (OPT_OnlyIDs)
+ PrintObjectID(*ui, bid);
+ else
+ PrintObject (*ui, bid);
+
+ cntc ++;
+ }
+
+ if (OPT_Progress)
+ dots . end( );
+
+ bank . close( );
+ }
+ else
+ {
+ BankStream_t bankstream (ncode);
+
+ if ( OPT_BankSpy )
+ bankstream . open (OPT_BankName, B_SPY);
+ else
+ bankstream . open (OPT_BankName, B_READ);
+
+ bankstream.setFixedStoreOnly(OPT_FixedOnly);
+
+ long int cntd = 0;
+ ProgressDots_t dots (bankstream . getSize( ), 50);
+
+ //-- Get all objects
+ while ( bankstream >> *ui )
+ {
+ if (OPT_Progress)
+ dots . update (++ cntd);
+
+ if (OPT_OnlyIDs)
+ PrintObjectID(*ui, bid);
+ else
+ PrintObject (*ui, bankstream . tellg( ) - 1);
+
+ cntc ++;
+ }
+
+ if (OPT_Progress)
+ dots . end( );
+
+ bankstream . close( );
+ }
+ }
+ catch (const Exception_t & e) {
+ cerr << "ERROR: " << e . what( ) << endl
+ << " failed to report '" << Decode (ncode) << "' bank" << endl;
+ exitcode = EXIT_FAILURE;
+ continue;
+ }
+ }
+
+ //-- Any codes unrecognized?
+ for ( ci = OPT_ExtractCodes.begin( ); ci != OPT_ExtractCodes.end( ); ++ ci )
+ {
+ cerr << "ERROR: Unrecognized bank type" << endl
+ << " unknown bank type '" << Decode (*ci) << "' ignored" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+
+ //-- Output the end time
+ cerr << "Objects reported: " << cntc << endl
+ << "END DATE: " << Date( ) << endl;
+
+ return exitcode;
+}
+
+
+
+
+//----------------------------------------------------- ParseExtract -----------
+void ParseExtract ( )
+{
+ ifstream infile;
+ string eid;
+ ID_t iid;
+
+ if ( ! OPT_IIDExtractName . empty( ) )
+ {
+ infile . open (OPT_IIDExtractName . c_str( ));
+ if ( !infile )
+ cerr << "ERROR: Could not open " << OPT_IIDExtractName << endl;
+
+ infile >> iid;
+ while ( infile )
+ {
+ OPT_ExtractIIDs . push_back (iid);
+ infile >> iid;
+ }
+
+ infile . close( );
+ }
+
+ if ( ! OPT_EIDExtractName . empty( ) )
+ {
+ infile . open (OPT_EIDExtractName . c_str( ));
+ if ( !infile )
+ cerr << "ERROR: Could not open " << OPT_EIDExtractName << endl;
+
+ getline (infile, eid);
+ while ( infile )
+ {
+ OPT_ExtractEIDs . push_back (eid);
+ getline (infile, eid);
+ }
+
+ infile . close( );
+ }
+}
+
+
+//----------------------------------------------------- PrintObjectID ----------
+void PrintObjectID (const Universal_t & obj, ID_t bid)
+{
+ Message_t msg;
+ ostringstream ss;
+ std::string eid_m;
+ std::string iid_m;
+ std::string type_m;
+ bool eid_ok;
+ bool iid_ok;
+
+ obj . writeMessage (msg);
+
+ if ( OPT_IsBIDs )
+ {
+ ss << bid;
+ msg . setField (F_BID, ss . str( ));
+ }
+
+ eid_ok = false;
+ iid_ok = false;
+ if ( msg . exists (F_EID) ){
+ eid_m = msg . getField (F_EID);
+ eid_ok = true;
+ }
+ if ( msg . exists (F_IID) ){
+ iid_m = msg . getField (F_IID);
+ iid_ok = true;
+ }
+ if (eid_ok & iid_ok){
+ type_m = Decode (msg . getMessageCode());
+ cout << type_m << "\t";
+ cout << eid_m << "\t";
+ cout << iid_m << endl;
+ }
+}
+
+
+//----------------------------------------------------- PrintObject ------------
+void PrintObject (const Universal_t & obj, ID_t bid)
+{
+ Message_t msg;
+ ostringstream ss;
+
+ obj . writeMessage (msg);
+
+ if ( OPT_IsBIDs )
+ {
+ ss << bid;
+ msg . setField (F_BID, ss . str( ));
+ }
+
+ msg . write (cout);
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "b:BE:hI:svFpi")) != EOF) )
+ switch (ch)
+ {
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'v':
+ PrintBankVersion (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'p': OPT_Progress = false; break;
+ case 'i': OPT_OnlyIDs = true; break;
+
+ case 'b': OPT_BankName = optarg; break;
+ case 'B': OPT_IsBIDs = true; break;
+ case 'F': OPT_FixedOnly = true; break;
+ case 's': OPT_BankSpy = true; break;
+
+ case 'E': OPT_IsExtractIDs = true; OPT_EIDExtractName = optarg; break;
+ case 'I': OPT_IsExtractIDs = true; OPT_IIDExtractName = optarg; break;
+
+ default:
+ errflg ++;
+ }
+
+ if ( OPT_BankName . empty( ) )
+ {
+ cerr << "ERROR: The -b option is mandatory\n";
+ errflg ++;
+ }
+
+ if ( ( OPT_BankSpy && access (OPT_BankName . c_str( ), R_OK|X_OK)) ||
+ (!OPT_BankSpy && access (OPT_BankName . c_str( ), R_OK|W_OK|X_OK)) )
+ {
+ cerr << "ERROR: Bank directory is not accessible, "
+ << strerror (errno) << endl;
+ errflg ++;
+ }
+
+ if ( errflg > 0 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ if ( optind != argc )
+ {
+ OPT_IsExtractCodes = true;
+ while ( optind != argc )
+ OPT_ExtractCodes . insert (Encode (argv [optind ++]));
+ }
+
+ if ( OPT_IsExtractIDs )
+ ParseExtract( );
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+
+ cerr << "\n.DESCRIPTION.\n"
+ << " Takes an AMOS bank directory as input. Will output the information\n"
+ << " contained in the bank in the form of an AMOS message to stdout. All\n"
+ << " link information references IIDs. If no NCodes are listed on the\n"
+ << " command line, all object types will be reported. The -E and -I files\n"
+ << " should contain a list of IDs, one per line. Only objects matching an\n"
+ << " entry in either file will be output when these options are used and\n"
+ << " objects are reported as many times as they are listed. This utility\n"
+ << " only outputs bank information. To alter the contents of a bank,\n"
+ << " please use the bank-transact utility.\n"
+ << "\n.OPTIONS.\n"
+ << " -b path The directory path of the bank to report\n"
+ << " -B Include BIDs in the output messages (for debugging)\n"
+ << " -E file Report only objects matching EIDs in file\n"
+ << " -h Display help information\n"
+ << " -I file Report only objects matching IIDs in file\n"
+ << " -p Don't display progress information\n"
+ << " -i Display only the objects ids\n"
+ << " -s Disregard bank locks and write permissions (spy mode)\n"
+ << " -F Just dump the fixed store information\n"
+ << " -v Display the compatible bank version\n"
+ << "\n.KEYWORDS.\n"
+ << " amos bank, report\n"
+ << endl;
+
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr << "\n.USAGE.\n" << " " << s << " [options] -b <bank path> [NCodes]\n";
+}
diff --git a/src/Bank/bank-transact.cc b/src/Bank/bank-transact.cc
new file mode 100644
index 0000000..b2b1df2
--- /dev/null
+++ b/src/Bank/bank-transact.cc
@@ -0,0 +1,509 @@
+///////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 11/12/2004
+//!
+//! \brief Transacts the operations described by the messages on a bank
+//!
+//! bank-transact reads assembly input data from an AMOS message file and
+//! modifies the AMOS bank data as directed. All object links should reference
+//! IIDs (internal IDs), but objects will be accessible from the bank by both
+//! their IID and EID (external ID). Any conflict in the IID, EID mapping, e.g.
+//! a duplicate id, will cause the violating message to be ignored and the
+//! user will be warned of the inconsistency.
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include <iostream>
+#include <vector>
+#include <unistd.h>
+using namespace AMOS;
+using namespace std;
+using namespace HASHMAP;
+
+
+
+
+
+//=============================================================== Globals ====//
+bool OPT_Create = false; // create bank option
+bool OPT_ForceCreate = false; // forcibly create bank option
+bool OPT_Compress = false; // SEQ and RED compression option
+bool OPT_Reassign = false; // Reassign IIDs
+string OPT_BankName; // bank name parameter
+string OPT_MessageName; // message name parameter
+
+
+
+
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+int exitcode = EXIT_SUCCESS;
+long int cnts = 0; // messages seen
+long int cnta = 0; // objects appended
+long int cntd = 0; // objects deleted
+long int cntr = 0; // objects replaced
+NCode_t ncode; // current NCode
+char act; // action enumeration
+
+BankStreamSet_t bnks; // all the banks
+UniversalSet_t objs; // all the objects
+
+BankStream_t * bp; // current bank
+Universal_t * op; // current object
+
+typedef HASHMAP::hash_map<ID_t, ID_t> ReassignMap;
+ReassignMap reassignLIB;
+ReassignMap reassignFRG;
+ReassignMap reassignRED;
+
+
+typedef HASHMAP::hash_map<NCode_t, ID_t> ReassignStart;
+ReassignStart ncodemaxiid;
+
+
+ID_t getNewIID(NCode_t ncode)
+{
+ ReassignStart::iterator ni = ncodemaxiid.find(ncode);
+
+ if (ni == ncodemaxiid.end())
+ {
+ BankStream_t * b = & (bnks[ncode]);
+
+ if (!b)
+ {
+ cerr << "No Bank!" << endl;
+ exit (1);
+ }
+
+ if (!b->isOpen())
+ {
+ if (!b->exists(OPT_BankName))
+ {
+ cerr << "Bank does not exist, starting at 0" << endl;
+ ni = ncodemaxiid.insert(make_pair(ncode, 0)).first;
+ }
+ else
+ {
+ b->open(OPT_BankName);
+ ni = ncodemaxiid.insert(make_pair(ncode, b->getMaxIID())).first;
+ cerr << "Bank exists but closed, starting at " << ni->second << endl;
+ }
+ }
+ else
+ {
+ ni = ncodemaxiid.insert(make_pair(ncode, b->getMaxIID())).first;
+ cerr << "Bank exists and open, starting at " << ni->second << endl;
+ }
+ }
+
+ ni->second++;
+ return ni->second;
+}
+
+ReassignMap::iterator findOrCreate(ReassignMap & map, NCode_t ncode, ID_t oldiid)
+{
+ ReassignMap::iterator retval = map.find(oldiid);
+
+ if (retval == map.end())
+ {
+ ID_t newiid = 0;
+ if (oldiid != 0) { newiid = getNewIID(ncode); }
+
+ cerr << "Map " << Decode(ncode) << " from " << oldiid << " to " << newiid << endl;
+ retval = reassignFRG.insert(make_pair(oldiid, newiid)).first;
+ }
+
+ return retval;
+}
+
+
+
+
+
+void HandleMessage(Message_t & msg)
+{
+ cnts ++;
+ ncode = msg . getMessageCode( );
+
+ if ( ! objs . exists (ncode) )
+ {
+ cerr << "ERROR: Unrecognized message type" << endl
+ << " unknown message type '" << Decode (ncode)
+ << "' ignored" << endl;
+ exitcode = EXIT_FAILURE;
+ return;
+ }
+
+ bp = & (bnks [ncode]);
+ op = & (objs [ncode]);
+ if ( bp -> getStatus( ) )
+ return; // skip objects missing a bank
+
+ //-- Parse the message
+ try {
+ op -> readMessage (msg);
+ }
+ catch (const Exception_t & e) {
+ cerr << "ERROR: " << e . what( ) << endl
+ << " could not parse '" << Decode (ncode)
+ << "' message with iid:"
+ << (msg . exists (F_IID) ? msg . getField (F_IID) : "NULL")
+ << ", message ignored" << endl;
+ exitcode = EXIT_FAILURE;
+ return;
+ }
+
+ //-- Open the bank if necessary
+ try {
+ if ( ! bp -> isOpen( ) )
+ {
+ if ( ! bp -> exists (OPT_BankName) )
+ bp -> create (OPT_BankName);
+ else
+ bp -> open (OPT_BankName);
+ }
+ }
+ catch (const Exception_t & e) {
+ cerr << "ERROR: " << e . what( ) << endl
+ << " could not open '" << Decode (ncode)
+ << "' bank, all messages ignored" << endl;
+ bp -> setStatus (1);
+ exitcode = EXIT_FAILURE;
+ return;
+ }
+
+ //-- Get the message action code
+ act = msg . exists (F_ACTION) ? msg [F_ACTION] [0] : E_ADD;
+
+ //-- Perform the appropriate action on the bank
+ try {
+ switch (act)
+ {
+ case E_ADD:
+
+ if (OPT_Reassign)
+ {
+ if (ncode == Fragment_t::NCODE)
+ {
+ Fragment_t * frg = (Fragment_t *) op;
+
+ // Update the iid for the fragment
+ ReassignMap::iterator fi = findOrCreate(reassignFRG, Fragment_t::NCODE, frg->getIID());
+ frg->setIID(fi->second);
+
+ // Now, update the iids for the matepairs
+ ReassignMap::iterator r1 = findOrCreate(reassignRED, Read_t::NCODE, frg->getMatePair().first);
+ ReassignMap::iterator r2 = findOrCreate(reassignRED, Read_t::NCODE, frg->getMatePair().second);
+ frg->setReads(make_pair(r1->second, r2->second));
+ }
+ else if (ncode == Read_t::NCODE)
+ {
+ Read_t * red = (Read_t *) op;
+
+ // Update the iid of the read
+ ReassignMap::iterator ri = findOrCreate(reassignRED, Read_t::NCODE, red->getIID());
+ red->setIID(ri->second);
+
+ // Now, update the fragment
+ ReassignMap::iterator fi = findOrCreate(reassignFRG, Fragment_t::NCODE, red->getFragment());
+ red->setFragment(fi->second);
+ }
+ }
+
+ //-- Append a new object to the bank
+ bp -> append (*op);
+ cnta ++;
+ break;
+
+ case E_DELETE:
+ //-- Flag an existing object for removal from the bank
+ if ( op -> getIID( ) != NULL_ID )
+ bp -> remove (op -> getIID( ));
+ else if ( ! op -> getEID( ) . empty( ) )
+ bp -> remove (op -> getEID( ));
+ else
+ AMOS_THROW_ARGUMENT ("Cannot remove object w/o IID or EID");
+ cntd ++;
+ break;
+
+ case E_REPLACE:
+ //-- Replace an existing object in the bank
+ if ( op -> getIID( ) != NULL_ID )
+ bp -> replace (op -> getIID( ), *op);
+ else if ( ! op -> getEID( ) . empty( ) )
+ bp -> replace (op -> getEID( ), *op);
+ else
+ AMOS_THROW_ARGUMENT ("Cannot replace object w/o IID or EID");
+ cntr ++;
+ break;
+
+ default:
+ AMOS_THROW_IO ((string)"Unrecognized action field " + act);
+ }
+ }
+ catch (const IOException_t & e) {
+ cerr << "ERROR: " << e . what( ) << endl
+ << " could not commit '" << Decode (ncode)
+ << "' message with iid:"
+ << (msg . exists (F_IID) ? msg . getField (F_IID) : "NULL")
+ << " to bank, message ignored" << endl;
+ exitcode = EXIT_FAILURE;
+ return;
+ }
+ catch (const ArgumentException_t & e) {
+ cerr << "ERROR: " << e . what( ) << endl
+ << " ID conflict caused by '" << Decode (ncode)
+ << "' message with iid:"
+ << (msg . exists (F_IID) ? msg . getField (F_IID) : "NULL")
+ << ", message ignored" << endl;
+ exitcode = EXIT_FAILURE;
+ return;
+ }
+ }
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+
+ Message_t msg; // current message
+ ifstream msgfile; // the message file stream
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- Output the current time and bank directory
+ cerr << "START DATE: " << Date( ) << endl;
+ cerr << "Bank is: " << OPT_BankName << endl;
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ //-- If OPT_ForceCreate, blast away existing banks
+ if ( OPT_ForceCreate )
+ for ( BankStreamSet_t::iterator i = bnks.begin(); i != bnks.end(); ++ i )
+ if ( i -> exists (OPT_BankName) )
+ {
+ i -> open (OPT_BankName);
+ i -> destroy ( );
+ }
+
+ //-- Compress RED and SEQ if option is turned on
+ if ( OPT_Compress )
+ {
+ ((Read_t &)objs [Read_t::NCODE]) . compress( );
+ ((Sequence_t &)objs [Sequence_t::NCODE]) . compress( );
+ }
+
+
+
+ //-- Read the Messages
+ if (OPT_MessageName == "-")
+ {
+ cerr << "Reading messages from standard in" << endl;
+ while ( msg . read (cin) )
+ {
+ HandleMessage(msg);
+ }
+ }
+ else
+ {
+ //-- Open the message file
+ msgfile . open (OPT_MessageName . c_str( ));
+ msgfile . seekg (0, ios::end);
+ ProgressDots_t dots (msgfile.tellg(), 50);
+
+ msgfile . seekg (0, ios::beg);
+
+ if ( ! msgfile )
+ AMOS_THROW_IO ("Could not open message file " + OPT_MessageName);
+
+ cerr << " 0% 100%" << endl
+ << "AFG ";
+
+ //-- Read the message file
+ while ( msg . read (msgfile) )
+ {
+ dots . update (msgfile . tellg( ));
+ HandleMessage(msg);
+ }
+
+ dots . end( );
+ msgfile . close( );
+ }
+
+ bnks . closeAll( );
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << "at offset: " << msgfile.tellg() << " in message file" << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+
+ //-- Output the end time
+ cerr << "Messages read: " << cnts << endl
+ << "Objects added: " << cnta << endl
+ << "Objects deleted: " << cntd << endl
+ << "Objects replaced: " << cntr << endl
+ << "END DATE: " << Date( ) << endl;
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "Rb:cfhm:vz")) != EOF) )
+ switch (ch)
+ {
+ case 'R':
+ OPT_Reassign = true;
+ break;
+
+ case 'b':
+ OPT_BankName = optarg;
+ break;
+
+ case 'c':
+ OPT_Create = true;
+ break;
+
+ case 'f':
+ OPT_Create = true;
+ OPT_ForceCreate = true;
+ break;
+
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'm':
+ OPT_MessageName = optarg;
+ break;
+
+ case 'v':
+ PrintBankVersion (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'z':
+ OPT_Compress = true;
+ break;
+
+ default:
+ errflg ++;
+ }
+
+ if ( OPT_BankName . empty( ) )
+ {
+ cerr << "ERROR: The -b option is mandatory" << endl;
+ errflg ++;
+ }
+
+ if ( OPT_MessageName . empty( ) )
+ {
+ cerr << "ERROR: The -m option is mandatory" << endl;
+ errflg ++;
+ }
+
+ if ( !OPT_Create && access (OPT_BankName . c_str( ), R_OK|W_OK|X_OK) )
+ {
+ cerr << "ERROR: Bank directory is not accessible, "
+ << strerror (errno) << endl;
+ errflg ++;
+ }
+
+ if ( OPT_Create && !OPT_ForceCreate && !access (OPT_BankName.c_str( ), F_OK) )
+ {
+ cerr << "ERROR: Bank path already exists" << endl;
+ errflg ++;
+ }
+
+ if ( errflg > 0 || argc != optind )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information." << endl;
+ exit (EXIT_FAILURE);
+ }
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+
+ cerr << "\n.DESCRIPTION.\n"
+ << " Takes an AMOS bank directory and message file as input. Alters the\n"
+ << " banks as directed by the message file. Messages without an act field\n"
+ << " will, by default, be added to the bank. All object links must\n"
+ << " reference IIDs. If an object has a non-unique ID, the user will be\n"
+ << " warned and the object will be ignored. To retrieve information from\n"
+ << " a bank in message format, please use the bank-report utility.\n"
+ << "\n.OPTIONS.\n"
+ << " -b path The directory path of the banks to open or create\n"
+ << " -c Create new bank directory if path does not exist\n"
+ << " -f Forcibly create new bank by destroying existing\n"
+ << " -h Display help information\n"
+ << " -m path The file path of the input message\n"
+ << " -z Compress sequence and quality values for SEQ and RED\n"
+ << " (only allows [ACGTN] sequence and [0,63] quality)\n"
+ << " -v Display the compatible bank version\n"
+ << "\n.KEYWORDS.\n"
+ << " amos bank"
+ << endl;
+
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr << "\n.USAGE.\n" << " " << s << " [options] -b <bank path> -m <message path>\n";
+ return;
+}
diff --git a/src/Bank/bank-tutorial.cc b/src/Bank/bank-tutorial.cc
new file mode 100644
index 0000000..b5f4bc5
--- /dev/null
+++ b/src/Bank/bank-tutorial.cc
@@ -0,0 +1,174 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+
+/*
+ * Encode and store a 3 read contig. Write the object directly
+ * into a bank, or into a message stream printed to stdout.
+ *
+ * Original Reads: (Clear range indicated with [])
+ * seq1: A[GCACCGGT]AAA
+ * seq2: ACG[GATCAACT]TTAC
+ * seq3: [ATAATT]CG
+ *
+ *
+ * Multiple alignment:
+ *
+ * 0000000000011
+ * Offset: 0123456789012
+ *
+ * Consensus: ACCGAT-CAACTT
+ *
+ * seq1 < ACCGGTGC.....
+ * seq2 > ...GAT-CAACT.
+ * seq3 > ....AT--AA-TT
+ *
+ */
+
+
+using namespace AMOS;
+using namespace std;
+
+int main (int argc, char ** argv)
+{
+ if (argc != 2)
+ {
+ cerr << "Usage: bank-tutorial bankname/-" << endl
+ << endl
+ << " Creates a 3 read contig and writes it directly into a binary bank" << endl
+ << " named bankname, or write to stdout if - is specified." << endl;
+ return EXIT_FAILURE;
+ }
+
+ Message_t msg;
+ BankStream_t contig_bank(Contig_t::NCODE);
+ BankStream_t read_bank(Read_t::NCODE);
+ string bank_name = argv[1];
+
+ // Write to stdout if the bank_name is "-", otherwise write the binary
+ // objects directly to a bank named bank_name.
+ bool printmsg = (bank_name == "-");
+
+ Read_t read;
+ Contig_t contig;
+ Tile_t tile;
+ vector<Tile_t> tiling;
+
+ if (!printmsg)
+ {
+ cerr << "Creating " << bank_name << " at " << Date() << endl;
+ }
+
+ try
+ {
+ if (!printmsg)
+ {
+ // Create the banks, alternatively use bank.open() to open an existing bank
+ read_bank.create(bank_name);
+ contig_bank.create(bank_name);
+ }
+
+ // Internal IDs must be numeric (IID)
+ read.setIID(1);
+
+ // External IDs can be any string without newline (EID)
+ read.setEID("seq1");
+
+ // Quality values are stored as (numeric value) - '0'
+ // For example 0 => '0', 10 => ':', 20 => 'D' , 30 => 'N', Max: 60
+ // Here I set the quality values to be 1,2,3,...,12.
+ read.setSequence("AGCACCGGTAAA", "123456789:;<");
+
+ // Clear ranges are stored [s,e) with inclusive start,
+ // and exclusive end coordinates (0-based). In this case, base 1 (0-based)
+ // is the first good base, and base 9 (0-based) is the first bad base.
+ // The length of the clear range is therefore e-s.
+ read.setClearRange(Range_t(1,9));
+
+ // The objects can be written directly to a binary bank,
+ // or written to a message file to be loaded with bank-transact
+ if (printmsg) { read.writeMessage(msg); msg.write(cout); }
+ else { read_bank << read; }
+
+
+ // Objects can be reused, but be careful to reset every value or call obj.clear()!
+ read.setIID(2);
+ read.setEID("seq2");
+ read.setSequence("ACGGATCAACTTTAC", "123456789:;<=>?");
+ read.setClearRange(Range_t(3,11));
+ if (printmsg) { read.writeMessage(msg); msg.write(cout); }
+ else { read_bank << read; }
+
+ read.setIID(3);
+ read.setEID("seq3");
+ read.setSequence("ATAATTCG", "12345678");
+ read.setClearRange(Range_t(0,6));
+ if (printmsg) { read.writeMessage(msg); msg.write(cout); }
+ else { read_bank << read; }
+
+ contig.setIID(1);
+ contig.setEID("contig1");
+
+ // Note consensus sequences are stored gapped, quality values
+ // are required at each position (including gaps)
+ contig.setSequence("ACCGAT-CAACTT", "XXXXXXXXXXXXX");
+
+ // The read -> contig mapping is stored in tile objects.
+ // The source field indicates the iid of the read
+ tile.source = 1;
+
+ // The offset is the 0-based position where the leftmost base of the read
+ // tiles the leftmost base of the consensus
+ tile.offset = 0;
+
+ // Range indicates the actual range of the read used in the contig
+ // If the numbers are reversed, it indicates the read was reverse
+ // complemented, and is stored (e,s].
+ tile.range = Range_t(9,1);
+
+ // There can be any number of reads, so they are stored in a vector
+ tiling.push_back(tile);
+
+ tile.source = 2;
+ tile.offset = 3;
+ tile.range = Range_t(3,11);
+
+ // This indicates there should be 1 gap inserted into the read after 3
+ // bases of the aligned clear range. Gaps for reversed reads are still stored
+ // left to right (contig orientation).
+ tile.gaps.push_back(3);
+ tiling.push_back(tile);
+
+ tile.gaps.clear();
+ tile.source = 3;
+ tile.offset = 4;
+ tile.range = Range_t(0,6);
+
+ // Adjacent gaps are stored with the same position.
+ // The gap at 4 is still relative to the ungapped aligned clear range
+ tile.gaps.push_back(2);
+ tile.gaps.push_back(2);
+ tile.gaps.push_back(4);
+ tiling.push_back(tile);
+
+ contig.setReadTiling(tiling);
+
+ if (printmsg) { contig.writeMessage(msg); msg.write(cout); }
+ else { contig_bank << contig; }
+
+ if (!printmsg)
+ {
+ // You should now be able to open the bank with bankViewer
+ // and see the multiple alignment described above.
+ read_bank.close();
+ contig_bank.close();
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ if (!printmsg) { cerr << "End: " << Date() << endl; }
+ return EXIT_SUCCESS;
+}
diff --git a/src/Bank/bank-unlock.pl b/src/Bank/bank-unlock.pl
new file mode 100755
index 0000000..4cd9189
--- /dev/null
+++ b/src/Bank/bank-unlock.pl
@@ -0,0 +1,94 @@
+#!/usr/bin/perl
+
+use strict;
+use File::Basename;
+
+if ( scalar (@ARGV) == 0 ) {
+ die "USAGE: $0 <bankdir>\n";
+}
+
+foreach (@ARGV)
+{
+ my $dir = $_;
+
+ if ( !defined ($dir) || !(-d $dir) ) {
+ print STDERR "ERROR: Cannot find bank dir '$dir'\n";
+ next;
+ }
+
+ if ( !(-w $dir) || !(-x $dir) ) {
+ print STDERR "ERROR: Invalid permissions for bank dir '$dir'\n";
+ next;
+ }
+
+ my $banks = 0;
+ my $flcks = 0;
+ my $blcks = 0;
+
+ print STDERR "Entering '$dir'\n";
+ while ( glob "$dir/*.ifo" ) {
+ my @lines;
+ my @locks;
+ my $file = $_;
+ my $base = basename ($file);
+
+ #-- Read the IFO file
+ open (IFO, "<$file")
+ or die "ERROR: Could not open file '$base' for reading, $!\n";
+
+ $_ = <IFO>;
+ push @lines, $_;
+ if ( /([\w]{3}) BANK INFORMATION/ ) {
+ $banks ++;
+ print STDERR "Found $1 bank\n";
+ my $lock = "$1.lck";
+ if ( -e "$dir/$lock" ) {
+ $flcks ++;
+ unlink ("$dir/$lock")
+ or die "ERROR: Could not unlink '$lock', $!\n";
+ print STDERR " unlinking '$lock'\n";
+ }
+ } else {
+ print STDERR "WARNING: Unrecognized file '$base' skipped\n";
+ next;
+ }
+
+ while ( <IFO> ) {
+ push @lines, $_;
+ if ( /^locks =/ ) {
+ while ( <IFO> ) {
+ $blcks ++;
+ push @locks, $_;
+ chomp;
+ print STDERR " unlocking '$_'\n";
+ }
+ last;
+ }
+ }
+
+ close (IFO)
+ or die "ERROR: Could not close '$base', $!\n";
+
+
+ #-- Rewrite the IFO file without the locks
+ if ( scalar (@locks) ) {
+ open (IFO, ">$file")
+ or die "ERROR: Could not open '$file' for writing, $!\n";
+
+ foreach (@lines) {
+ print IFO;
+ }
+
+ close (IFO)
+ or die "ERROR: Could not close '$file', $!\n";
+ }
+ }
+
+ print "\n";
+ print "IFOs found: $banks\n";
+ print "File locks: $flcks\n";
+ print "Bank locks: $blcks\n";
+
+ print "\n";
+ print "\n";
+}
diff --git a/src/Bank/bank2contig.cc b/src/Bank/bank2contig.cc
new file mode 100644
index 0000000..f02d2c5
--- /dev/null
+++ b/src/Bank/bank2contig.cc
@@ -0,0 +1,546 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+using namespace AMOS;
+using namespace std;
+
+bool OPT_LayoutOnly = 0;
+bool OPT_SimpleLayout = false;
+bool OPT_UseEIDs = 0;
+bool OPT_UseIIDs = 0;
+bool OPT_Trapper = 0;
+bool OPT_SAM = 0;
+
+string OPT_BankName;
+
+string OPT_EIDFile;
+string OPT_IIDFile;
+
+void PrintUsage (const char * s)
+{
+ cerr << "\n.USAGE.\n" << " " << s << " [options] <bank path>\n\n";
+}
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage(s);
+
+ cerr << ".DESCRIPTION.\n"
+ << " This program takes an AMOS bank directory and dumps the contigs to stdout.\n\n"
+ << ".OPTIONS.\n"
+ << " -h Display help information\n"
+ << " -v Display the compatible bank version\n"
+ << " -e Use EIDs for names (DEFAULT)\n"
+ << " -i Use IIDs for names\n"
+ << " -E file Dump just the contig eids listed in file\n"
+ << " -I file Dump just the contig iids listed in file\n"
+ << " -L Just create a layout file (no sequence)\n"
+ << " -S Simple Layout style\n"
+ << " -s SAM Format (http://samtools.sf.net)\n"
+ << " -T XML Format suitable for DNPTrapper\n"
+ << ".KEYWORDS.\n"
+ << " converters, bank, contigs\n\n"
+ << endl;
+
+}
+
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hveiTLsSE:I:")) != EOF) )
+ {
+ switch (ch)
+ {
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'v':
+ PrintBankVersion (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'e': OPT_UseEIDs = true; break;
+ case 'i': OPT_UseIIDs = true; break;
+ case 'L': OPT_LayoutOnly = true; break;
+ case 'E': OPT_EIDFile = optarg; break;
+ case 'I': OPT_IIDFile = optarg; break;
+ case 'S': OPT_SimpleLayout = true; break;
+ case 'T': OPT_Trapper = true; break;
+ case 's': OPT_SAM = true; break;
+
+ default: errflg ++;
+ }
+ }
+
+ if ( errflg > 0 || optind != argc - 1 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_BankName = argv [optind];
+
+ if (!OPT_UseEIDs && !OPT_UseIIDs) { OPT_UseEIDs = true; }
+}
+
+bool firstContig = true;
+
+
+void printContig(Contig_t & contig, Bank_t & read_bank)
+{
+ Read_t read;
+ std::vector<Tile_t> & tiling = contig.getReadTiling();
+ sort(tiling.begin(), tiling.end(), TileOrderCmp());
+
+ if (OPT_SAM)
+ {
+ // get the contig name
+ string contigeid = contig.getEID();
+ if (!OPT_UseEIDs || contigeid.empty())
+ {
+ char buffer[20];
+ sprintf(buffer, "%d", contig.getIID());
+ contigeid=buffer;
+ }
+
+ const string cons = contig.getSeqString();
+
+ // convert each read in the contig
+ vector<Tile_t>::const_iterator ti;
+ for (ti = tiling.begin();
+ ti != tiling.end();
+ ti++)
+ {
+ Range_t range = ti->range;
+ bool rc = (range.begin > range.end);
+
+ // render the sequence
+
+ read_bank.fetch(ti->source, read);
+
+ string fullseq = read.getSeqString();
+ string qualstr = read.getQualString();
+
+ if (rc) { range.swap(); }
+ string sequence = read.getSeqString(range);
+ if (rc) { Reverse_Complement(sequence); }
+
+ Pos_t gapcount = 0;
+
+ vector<Pos_t>::const_iterator g;
+ for (g = ti->gaps.begin();
+ g != ti->gaps.end();
+ g++)
+ {
+ sequence.insert(*g+gapcount, "-", 1);
+ gapcount++;
+ }
+
+
+ // print the record
+
+ if (OPT_UseEIDs)
+ {
+ string s = read_bank.lookupEID(ti->source);
+ int i = s.find(' ');
+ if (i != s.npos) { s = s.substr(0,i); }
+ cout << s;
+ }
+ else
+ {
+ cout << ti->source;
+ }
+
+ int flag = 0;
+ int mapqual = 255;
+
+ if (rc)
+ {
+ flag = 0x0010;
+ }
+
+ cout << "\t" << flag
+ << "\t" << contigeid
+ << "\t" << contig.gap2ungap(ti->offset)
+ << "\t" << mapqual
+ << "\t";
+
+ // now print cigar string
+
+ int leftclip = range.begin;
+ int rightclip = fullseq.length() - range.end;
+
+ if (rc)
+ {
+ int t = leftclip;
+ leftclip = rightclip;
+ rightclip = t;
+ }
+
+ if (leftclip)
+ {
+ cout << leftclip << 'S';
+ }
+
+ int pos = 0;
+ int end = sequence.length();
+
+ while (pos < end)
+ {
+ bool seqgap = (sequence[pos] == '-');
+ bool consgap = (cons[pos+ti->offset] == '-');
+
+ int len = 1;
+ pos++;
+
+ char type = 'M'; // match
+
+ if (seqgap && consgap) { type = 'P'; } // pad
+ else if (seqgap) { type = 'D'; } // deletion
+ else if (consgap) { type = 'I'; } // insertion
+
+ while ((pos < end) &&
+ ((sequence[pos] == '-') == seqgap) &&
+ ((cons[pos+ti->offset] == '-') == consgap))
+ {
+ pos++;
+ len++;
+ }
+
+ cout << len << type;
+ }
+
+ if (rightclip)
+ {
+ cout << rightclip << 'S';
+ }
+
+ cout << "\t" << "*" // Mate reference sequence name
+ << "\t" << "0" // Mate position
+ << "\t" << "0"; // Insert size
+
+ // now sequence and qual
+
+ if (rc)
+ {
+ Reverse_Complement(fullseq);
+ reverse(qualstr.begin(), qualstr.end());
+ }
+
+ const int SAM_QUAL_BASE = 33;
+
+ for (int i = 0; i < qualstr.length(); i++)
+ {
+ qualstr[i] = Char2Qual(qualstr[i]) + SAM_QUAL_BASE;
+ }
+
+ cout << "\t" << fullseq
+ << "\t" << qualstr
+ << "\n";
+ }
+ }
+ else if (OPT_Trapper)
+ {
+ if (firstContig) { cout << "<TRAPPER>" << endl; firstContig = false;}
+
+ printf("<contig name=\"%s\">\n", contig.getEID().c_str());
+
+ int row = 0;
+
+ // do a quick first pass to figure out how much the reads need to be shifted to ensure no one goes negative
+ int leftmost = 0;
+ vector<Tile_t>::const_iterator ti;
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ Range_t clr = ti->range;
+ int lefttrim = clr.getLo();
+
+ if (clr.isReverse())
+ {
+ Read_t read;
+ read_bank.fetch(ti->source, read);
+
+ lefttrim = read.getLength() - clr.getHi();
+ }
+
+ if (ti->offset-lefttrim < leftmost)
+ {
+ leftmost = ti->offset - lefttrim;
+ }
+ }
+
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ row++;
+ bool rc = 0;
+ Range_t range = ti->range;
+ Range_t clr = range;
+ Pos_t gappedLen = ti->getGappedLength();
+
+ if (ti->range.begin > ti->range.end) { rc = 1; }
+
+ Read_t read;
+ read_bank.fetch(ti->source, read);
+ string sequence = read.getSeqString();
+ string qual = read.getQualString();
+
+ if (rc) { range.swap(), Reverse_Complement(sequence); reverse(qual.begin(), qual.end()); }
+
+ Pos_t gapcount = 0;
+
+ int origlen = sequence.length();
+
+ int lefttrim = clr.getLo();
+ int righttrim = origlen - clr.getHi();
+
+ if (rc)
+ {
+ int t = lefttrim;
+ lefttrim = righttrim;
+ righttrim = t;
+ }
+
+ int beginGood = lefttrim;
+ int endGood = lefttrim + ti->getGappedLength()-1;
+ int gappedseqlen = qual.length();
+
+ vector<Pos_t>::const_iterator g;
+ for (g = ti->gaps.begin();
+ g != ti->gaps.end();
+ g++)
+ {
+ sequence.insert(lefttrim+*g+gapcount, "*", 1);
+ qual.insert(lefttrim+*g+gapcount, "0", 1);
+ gapcount++;
+ gappedseqlen++;
+ }
+
+ int OPT_TrapperFull = 0;
+ if (OPT_TrapperFull)
+ {
+ if (rc) { beginGood = 0; }
+ else { endGood = gappedseqlen; }
+ }
+
+ printf("<ReadData row=\"%d\" name=\"%s\" startPos=\"%d\" endPos=\"%d\" strand=\"%c\" beginGood=\"%d\" endGood=\"%d\">\n",
+ row, read_bank.lookupEID(ti->source).c_str(), ti->offset-lefttrim-leftmost, ti->getRightOffset()+righttrim-leftmost, (rc ? 'C' : 'U'), beginGood, endGood);
+
+ printf("<DnaStrData startPos=\"%d\" endPos=\"%d\" trappervector=\"%s\"/>\n",
+ 0, gappedseqlen, sequence.c_str());
+
+ printf("<QualityData startPos=\"%d\" endPos=\"%d\" trappervector=\"",
+ 0, gappedseqlen);
+
+ for (int i = 0; i < gappedseqlen; i++)
+ {
+ printf(" %d", qual[i]-'0');
+ }
+ printf("\"/>\n");
+
+ printf("<ChromatData startPos=\"%d\" endPos=\"%d\"/>\n",
+ 0, gappedseqlen);
+
+ printf("</ReadData>\n");
+ }
+
+ printf("</contig>\n");
+ }
+ else if (OPT_SimpleLayout)
+ {
+ string contigeid = contig.getEID();
+ if (!OPT_UseEIDs)
+ {
+ char buffer[20];
+ sprintf(buffer, "%d", contig.getIID());
+ contigeid=buffer;
+ }
+
+ char status = contig.getStatus();
+ if (status == 0) { status = '?'; }
+
+ vector<Tile_t>::const_iterator ti;
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ cout << contigeid << "\t"
+ << status << "\t"
+ << read_bank.lookupEID(ti->source) << "\t"
+ << (ti->range.isReverse() ? 1 : 0) << "\t"
+ << ti->offset
+ << endl;
+ }
+ }
+ else
+ {
+ cout << "##";
+
+ if (OPT_UseEIDs)
+ {
+ string s(contig.getEID());
+ int i = s.find(' ');
+ if (i != s.npos) { s = s.substr(0,i); }
+ if (s.empty()) { cout << contig.getIID(); }
+ else { cout << s; }
+ }
+ else
+ {
+ cout << contig.getIID();
+ }
+
+ const string cons = contig.getSeqString();
+
+ cout << " " << tiling.size()
+ << " " << cons.length()
+ << " bases, 00000000 checksum." << endl;
+
+ if (!OPT_LayoutOnly)
+ {
+ Fasta_Print(stdout, cons.c_str(), NULL, 60);
+ }
+
+ vector<Tile_t>::const_iterator i;
+ for (i = tiling.begin();
+ i != tiling.end();
+ i++)
+ {
+ bool rc = 0;
+ Range_t range = i->range;
+ Range_t clr = range;
+ Pos_t gappedLen = i->getGappedLength();
+
+ if (i->range.begin > i->range.end) { clr.end++; rc = 1; }
+ else { clr.begin++; }
+
+ cout << "#";
+
+ if (OPT_UseEIDs)
+ {
+ string s = read_bank.lookupEID(i->source);
+ int i = s.find(' ');
+ if (i != s.npos) { s = s.substr(0,i); }
+ cout << s;
+ }
+ else
+ {
+ cout << i->source;
+ }
+
+ cout << "(" << i->offset
+ << ((rc) ? ") [RC] " : ") [] ") << gappedLen
+ << " bases, 00000000 checksum."
+ << " {" << clr.begin << " " << clr.end << "}"
+ << " <" << contig.gap2ungap(i->offset)
+ << " " << contig.gap2ungap(i->getRightOffset())
+ << ">" << endl;
+
+ if (!OPT_LayoutOnly)
+ {
+ read_bank.fetch(i->source, read);
+ if (rc) { range.swap(); }
+ string sequence = read.getSeqString(range);
+ if (rc) { Reverse_Complement(sequence); }
+
+ Pos_t gapcount = 0;
+
+ vector<Pos_t>::const_iterator g;
+ for (g = i->gaps.begin();
+ g != i->gaps.end();
+ g++)
+ {
+ sequence.insert(*g+gapcount, "-", 1);
+ gapcount++;
+ }
+
+
+ Fasta_Print(stdout, sequence.c_str(), NULL, 60);
+ }
+ }
+ }
+}
+
+int main (int argc, char ** argv)
+{
+ ParseArgs (argc, argv);
+
+ BankStream_t contig_bank(Contig_t::NCODE);
+ Bank_t read_bank(Read_t::NCODE);
+
+ cerr << "Processing " << OPT_BankName << " at " << Date() << endl;
+
+ try
+ {
+ read_bank.open(OPT_BankName, B_READ);
+ contig_bank.open(OPT_BankName, B_READ);
+
+ Contig_t contig;
+ ifstream file;
+ string id;
+
+ if (!OPT_EIDFile.empty())
+ {
+ file.open(OPT_EIDFile.c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open EID File", __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ contig_bank.seekg(contig_bank.getIDMap().lookupBID(id));
+ contig_bank >> contig;
+ printContig(contig, read_bank);
+ }
+ }
+ else if (!OPT_IIDFile.empty())
+ {
+ file.open(OPT_IIDFile.c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open IID File", __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ contig_bank.seekg(contig_bank.getIDMap().lookupBID(atoi(id.c_str())));
+ contig_bank >> contig;
+ printContig(contig, read_bank);
+ }
+ }
+ else
+ {
+ while (contig_bank >> contig)
+ {
+ printContig(contig, read_bank);
+ }
+ }
+
+ read_bank.close();
+ contig_bank.close();
+
+ if (OPT_Trapper && !firstContig)
+ {
+ printf("</TRAPPER>\n");
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+ catch (...)
+ {
+ cerr << "Unexpected error: Possible data corruption or malformed data.\n";
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return EXIT_SUCCESS;
+}
diff --git a/src/Bank/bank2coverage.cc b/src/Bank/bank2coverage.cc
new file mode 100644
index 0000000..96220cb
--- /dev/null
+++ b/src/Bank/bank2coverage.cc
@@ -0,0 +1,299 @@
+#include <algorithm>
+
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "Slice.h"
+
+using namespace AMOS;
+using namespace std;
+
+const int MIN_QUAL = 4;
+
+
+bool USE_EID = 1;
+
+inline bool hasOverlap(Pos_t rangeStart, // 0-based exact offset of range
+ Pos_t rangeEnd, // 0-based exact end of range
+ Pos_t seqOffset, // 0-bases exact offset of seq
+ Pos_t seqLen, // count of bases of seq (seqend+1)
+ Pos_t contigLen) // count of bases in contig (contigend+1)
+{
+ int retval = 1;
+
+ if (seqOffset >= 0)
+ {
+ if ((seqOffset > rangeEnd) // sequence right flanks
+ || (seqOffset + seqLen-1 < rangeStart)) // sequence left flanks
+ {
+ retval = 0;
+ }
+ }
+ else
+ {
+ // Negative Offset, test left and right separately
+ retval = hasOverlap(rangeStart, rangeEnd,
+ 0, seqLen+seqOffset, contigLen) ||
+ hasOverlap(rangeStart, rangeEnd,
+ contigLen+seqOffset, -seqOffset, contigLen);
+ }
+
+ return retval;
+}
+
+class Render_t
+{
+public:
+ Render_t();
+ ~Render_t();
+ void load(Bank_t & read_bank, vector<Tile_t>::const_iterator tile);
+
+ string m_nucs;
+ string m_qual;
+ bool m_rc;
+ Pos_t m_offset;
+
+ Read_t m_read;
+};
+
+Render_t::Render_t()
+{ }
+
+Render_t::~Render_t()
+{ }
+
+void Render_t::load(Bank_t & read_bank, vector<Tile_t>::const_iterator tile)
+{
+ read_bank.fetch(tile->source, m_read);
+ Range_t range = tile->range;
+
+ m_offset = tile->offset;
+ m_rc = 0;
+ if (tile->range.begin > tile->range.end) { m_rc = 1; range.swap();}
+
+ m_nucs = m_read.getSeqString(range);
+ m_qual = m_read.getQualString(range);
+
+ if (m_rc)
+ {
+ Reverse_Complement(m_nucs);
+ reverse (m_qual.begin(), m_qual.end());
+ }
+
+ // Insert gaps
+ Pos_t gapcount;
+ vector<Pos_t>::const_iterator g;
+ for (g = tile->gaps.begin(), gapcount = 0;
+ g != tile->gaps.end();
+ g++, gapcount++)
+ {
+ m_nucs.insert(*g+gapcount, 1, '-');
+
+ // qv of a gap is the min of the flanking values
+ char lqv = (*g+gapcount > 0) ? m_qual[*g+gapcount-1] : -1;
+ char rqv = (*g+gapcount < m_qual.size()) ? m_qual[*g+gapcount] : -1;
+ char gapqv = (lqv < rqv)
+ ? (lqv != -1) ? lqv : rqv
+ : (rqv != -1) ? rqv : lqv;
+
+ m_qual.insert(*g+gapcount, 1, gapqv);
+ }
+}
+
+struct TilingOrderCmp
+{
+ bool operator() (const Tile_t & a, const Tile_t & b)
+ {
+ int offdiff = b.offset - a.offset;
+
+ if (offdiff)
+ {
+ if (offdiff < 0) { return false; }
+ return true;
+ }
+
+ int lendiff = (b.range.getLength() + b.gaps.size()) -
+ (a.range.getLength() + a.gaps.size());
+
+ if (lendiff)
+ {
+ if (lendiff < 0) { return false; }
+ return true;
+ }
+
+ return (a.source < b.source);
+ }
+};
+
+
+int main (int argc, char ** argv)
+{
+ if (argc != 3)
+ {
+ cerr << "Usage: bank2coverage bankname outprefix" << endl;
+ return EXIT_FAILURE;
+ }
+
+ BankStream_t contig_bank(Contig_t::NCODE);
+ Bank_t read_bank(Read_t::NCODE);
+ string bank_name = argv[1];
+ string outprefix = argv[2];
+
+ string tcovfile = outprefix + ".tcov";
+ string idtblfile = outprefix + ".idTbl";
+
+ ofstream tstream(tcovfile.c_str());
+ if (!tstream.is_open()) { AMOS_THROW_IO("Could not open " + tcovfile); }
+
+ ofstream itbl(idtblfile.c_str());
+ if (!itbl.is_open()) { AMOS_THROW_IO("Could not open " + idtblfile); }
+
+ cerr << "Processing " << bank_name << " at " << Date() << endl;
+
+ try
+ {
+ read_bank.open(bank_name);
+ contig_bank.open(bank_name);
+
+ Contig_t contig;
+ int contig_count = 1;
+ int vectoroffset = 0;
+
+ while (contig_bank >> contig)
+ {
+ string eid = contig.getEID();
+ int iid = contig.getIID();
+ std::vector<Tile_t> & tiling = contig.getReadTiling();
+ const string & consensus = contig.getSeqString();
+ const Pos_t clen = consensus.size();
+
+ sort(tiling.begin(), tiling.end(), TilingOrderCmp());
+
+ Pos_t grangeStart = 0;
+ Pos_t grangeEnd = clen-1;
+
+ // Render the aligned sequences
+ int vectorpos;
+ vector<Tile_t>::const_iterator vi;
+
+ vector<Render_t> renderedSeqs;
+ for (vi = tiling.begin(), vectorpos = 0;
+ vi != tiling.end();
+ vi++, vectorpos++)
+ {
+ Render_t rendered;
+ rendered.load(read_bank, vi);
+
+ itbl << vectorpos + vectoroffset
+ << " " << rendered.m_read.getEID()
+ << " " << (rendered.m_rc ? '1' : '0')
+ << endl;
+
+ renderedSeqs.push_back(rendered);
+ }
+
+ vector<int> reads;
+ reads.reserve(tiling.size());
+
+ libSlice_Slice s;
+ int dcov;
+ dcov = tiling.size(); // trivially, this is the greatest dcov in the contig
+ s.bc = new char [dcov+1];
+ s.qv = new char [dcov];
+ s.rc = new char [dcov];
+
+ Pos_t gindex, index;
+ for (gindex = grangeStart, index = contig.gap2ungap(grangeStart);
+ gindex <= grangeEnd;
+ gindex++)
+ {
+ // Figure out which reads tile this position
+ vector<Render_t>::const_iterator ri;
+ dcov = 0;
+
+ for (ri = renderedSeqs.begin(), vectorpos = 0;
+ ri != renderedSeqs.end();
+ ri++, vectorpos++)
+ {
+ if (hasOverlap(gindex, gindex,
+ ri->m_offset, ri->m_nucs.size(),
+ clen))
+ {
+ s.rc[dcov] = ri->m_rc;
+ s.bc[dcov] = ri->m_nucs[gindex - ri->m_offset];
+
+ s.qv[dcov] = ri->m_qual[gindex - ri->m_offset]-AMOS::MIN_QUALITY;
+ if (s.qv[dcov] < MIN_QUAL) { s.qv[dcov] = MIN_QUAL; }
+
+ reads[dcov] = vectorpos+vectoroffset;
+
+ dcov++;
+ }
+ }
+
+ // Compute consensus qv
+
+ libSlice_Consensus consensusResults;
+ s.c = consensus[gindex];
+ s.dcov = dcov;
+ s.bc[dcov] = '\0';
+
+ libSlice_getConsensusParam(&s, &consensusResults, NULL, 0, 0);
+ int cqv = consensusResults.qvConsensus;
+
+ int coordinate = index;
+ if (consensus[gindex] == '-' && coordinate > 1) { coordinate--; }
+
+ // Print Slice
+
+ tstream << iid << " "
+ << gindex+1 << " "
+ << coordinate << " "
+ << consensus[gindex] << " "
+ << cqv;
+
+ if (consensus[gindex] != '-') { index++; }
+
+ if (dcov)
+ {
+ tstream << " " << s.bc << " ";
+
+ int j;
+ for (j = 0; j < dcov; j++)
+ {
+ if (j) { tstream << ":"; }
+ tstream << (int) s.qv[j];
+ }
+
+ tstream << " ";
+
+ for (j = 0; j < dcov; j++)
+ {
+ if (j) { tstream << ":"; }
+ tstream << (int) reads[j];
+ }
+ }
+
+ tstream << endl;
+ }
+
+ delete [] s.bc;
+ delete [] s.qv;
+ delete [] s.rc;
+
+ vectoroffset += tiling.size();
+ contig_count++;
+ }
+
+ read_bank.close();
+ contig_bank.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return EXIT_SUCCESS;
+}
diff --git a/src/Bank/bank2fasta.cc b/src/Bank/bank2fasta.cc
new file mode 100644
index 0000000..a7de8e7
--- /dev/null
+++ b/src/Bank/bank2fasta.cc
@@ -0,0 +1,272 @@
+// $Id$
+
+// This program reads a set of contigs from a bank then reports
+// regions where mate-pair information indicates a problem
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <getopt.h>
+#include <map>
+#include <set>
+#include <list>
+#include <vector>
+#include <string>
+#include <math.h>
+#include <functional>
+#include "foundation_AMOS.hh"
+#include <fstream>
+#include <ctype.h>
+
+using namespace std;
+using namespace AMOS;
+using namespace HASHMAP;
+
+// endl is a sham: die endl, die!
+#define endl "\n"
+
+map<string, string> globals; // global variables
+
+void printHelpText()
+{
+ cerr << "\n.USAGE.\n"
+ << " bank2fasta -b <bank_name>\n"
+ << "\n.DESCRIPTION.\n"
+ << " bank2fasta - generates a .fasta (and .qual) file from the contigs in a bank\n"
+ << "\n.OPTIONS.\n"
+ << " -h, -help print out help message\n"
+ << " -b <bank_name>, -bank bank where assembly is stored\n"
+ << " -eid report eids\n"
+ << " -iid report iids (default)\n"
+ << " -E file Dump just the contig eids listed in file\n"
+ << " -I file Dump just the contig iids listed in file\n"
+ << " -q file Report qualities in file\n"
+ << " -d Show contig details (num reads, coverage) on fasta header line\n"
+ << "\n.KEYWORDS.\n"
+ << " AMOS bank, Converters\n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"d", 0, 0, 'd'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"eid", 0, 0, 'e'},
+ {"iid", 0, 0, 'i'},
+ {"E", 1, 0, 'E'},
+ {"I", 1, 0, 'I'},
+ {"q", 1, 0, 'q'},
+ {0, 0, 0, 0}
+ };
+
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ exit(0);
+ break;
+ case 'b':
+ globals["bank"] = string(optarg);
+ break;
+ case 'd':
+ globals["details"] = "true";
+ break;
+ case 'e':
+ globals["eid"] = "true";
+ globals["iid"] = "false";
+ break;
+ case 'i':
+ globals["iid"] = "true";
+ globals["eid"] = "false";
+ break;
+ case 'E':
+ globals["eidfile"] = string(optarg);
+ break;
+ case 'I':
+ globals["iidfile"] = string(optarg);
+ break;
+ case 'q':
+ globals["qualfile"] = string(optarg);
+ break;
+ case '?':
+ return false;
+ }
+ }
+
+ return true;
+} // GetOptions
+
+void printFasta(const Contig_t & ctg, ofstream & qual)
+{
+ string seq = ctg.getSeqString();
+ string quals = ctg.getQualString();
+
+ if (globals["eid"] == "true") {
+ cout << ">" << ctg.getEID();
+ if (globals.find("qualfile") != globals.end())
+ qual << ">" << ctg.getEID();
+ } else {
+ cout << ">" << ctg.getIID();
+ if (globals.find("qualfile") != globals.end())
+ qual << ">" << ctg.getIID();
+ }
+
+ if (globals.find("details") != globals.end())
+ {
+ int len = ctg.getUngappedLength();
+
+ std::vector<Tile_t>::const_iterator ti;
+ const std::vector<Tile_t> & tiling = ctg.getReadTiling();
+
+ int nreads = ctg.getReadTiling().size();
+ double covsum = 0.0;
+
+ for (ti = tiling.begin();
+ ti != tiling.end();
+ ti++)
+ {
+ covsum += ti->range.getLength();
+ }
+
+ double cov = len ? covsum / len : 0.0;
+
+ cout << " len=" << len
+ << " nreads=" << nreads
+ << " cov=" << cov;
+ }
+
+ int nout = 0;
+ for (int i = 0; i < seq.length(); i++)
+ {
+ if (seq[i] == '-') { continue; }
+ if (nout % 60 == 0)
+ cout << endl;
+
+ if (nout % 20 == 0 && globals.find("qualfile") != globals.end())
+ qual << endl;
+
+ nout++;
+ cout << seq[i];
+ if (globals.find("qualfile") != globals.end())
+ qual << (int) (toascii(quals[i]) - toascii('0')) << " ";
+ }
+ cout << endl;
+ if (globals.find("qualfile") != globals.end())
+ qual << endl;
+
+} // printFasta
+
+//----------------------------------------------
+int main(int argc, char **argv)
+{
+ ofstream outqual;
+ globals["iid"] = "true";
+ globals["eid"] = "false";
+
+ if (! GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ if (globals.find("qualfile") != globals.end()){ // have qual file will travel
+ outqual.open(globals["qualfile"].c_str(), ofstream::out | ofstream::trunc);
+ if (! outqual.is_open()){
+ cerr << "Could not open " << globals["qualfile"] << endl;
+ exit(1);
+ }
+ }
+
+ // open necessary files
+ if (globals.find("bank") == globals.end()){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ Bank_t contig_bank (Contig_t::NCODE);
+ BankStream_t contig_stream (Contig_t::NCODE);
+ if (! contig_bank.exists(globals["bank"])){
+ cerr << "No contig account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+
+
+ try
+ {
+ contig_stream.open(globals["bank"], B_READ);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Failed to open contig account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+
+ try
+ {
+ Contig_t ctg;
+ ifstream file;
+ string id;
+
+ if (!globals["eidfile"].empty())
+ {
+ file.open(globals["eidfile"].c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open EID File", __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ contig_stream.seekg(contig_stream.getIDMap().lookupBID(id));
+ contig_stream >> ctg;
+ printFasta(ctg, outqual);
+ }
+ }
+ else if (!globals["iidfile"].empty())
+ {
+ file.open(globals["iidfile"].c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open IID File", __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ contig_stream.seekg(contig_stream.getIDMap().lookupBID(atoi(id.c_str())));
+ contig_stream >> ctg;
+ printFasta(ctg, outqual);
+ }
+ }
+ else
+ {
+ while (contig_stream >> ctg)
+ {
+ printFasta(ctg, outqual);
+ }
+ }
+
+ contig_stream.close();
+ if (globals.find("qualfile") != globals.end())
+ outqual.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+
+ return(0);
+} // main
+
diff --git a/src/Bank/bank2lib.cc b/src/Bank/bank2lib.cc
new file mode 100644
index 0000000..fd36983
--- /dev/null
+++ b/src/Bank/bank2lib.cc
@@ -0,0 +1,188 @@
+// $Id$
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <getopt.h>
+#include <map>
+#include <set>
+#include <list>
+#include <vector>
+#include <string>
+#include <math.h>
+#include <functional>
+#include "foundation_AMOS.hh"
+#include <fstream>
+#include <ctype.h>
+
+using namespace std;
+using namespace AMOS;
+using namespace HASHMAP;
+
+// endl is a sham: die endl, die!
+#define endl "\n"
+
+map<string, string> globals; // global variables
+
+void printHelpText()
+{
+ cerr << "\n.USAGE.\n"
+ << " bank2libs -b <bank_name> -o <prefix>\n"
+ << "\n.DESCRIPTION.\n"
+ << " bank2lbs - output the read to lib mapping in the bank. Also output list of libs\n"
+ << "\n.OPTIONS.\n"
+ << " -h, -help print out help message\n"
+ << " -b <bank_name>, -bank bank where assembly is stored\n"
+ << " -eid report eids\n"
+ << " -iid report iids (default)\n"
+ << " -o prefix output prefix\n"
+ << "\n.KEYWORDS.\n"
+ << " AMOS bank, Converters\n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"eid", 0, 0, 'e'},
+ {"iid", 0, 0, 'i'},
+ {"o", 1, 0, 'o'},
+ {0, 0, 0, 0}
+ };
+
+ globals["iid"] = "true";
+ globals["eid"] = "false";
+ globals["prefix"] = "asm";
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ exit(0);
+ break;
+ case 'b':
+ globals["bank"] = string(optarg);
+ break;
+ case 'e':
+ globals["eid"] = "true";
+ globals["iid"] = "false";
+ break;
+ case 'i':
+ globals["iid"] = "true";
+ globals["eid"] = "false";
+ break;
+ case 'o':
+ globals["prefix"] = string(optarg);
+ break;
+ case '?':
+ return false;
+ }
+ }
+
+ return true;
+} // GetOptions
+
+//----------------------------------------------
+int main(int argc, char **argv)
+{
+ if (! GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ // open necessary files
+ if (globals.find("bank") == globals.end()){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ Bank_t frag_bank (Fragment_t::NCODE);
+ Bank_t lib_bank (Library_t::NCODE);
+ BankStream_t read_stream (Read_t::NCODE);
+ if (! read_stream.exists(globals["bank"]) || ! frag_bank.exists(globals["bank"]) || ! lib_bank.exists(globals["bank"])) {
+ cerr << "No read account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+
+
+ try
+ {
+ read_stream.open(globals["bank"], B_SPY);
+ lib_bank.open(globals["bank"], B_SPY);
+ frag_bank.open(globals["bank"], B_SPY);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Failed to open contig account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+
+ try
+ {
+ Read_t read;
+ Fragment_t frag;
+ Library_t lib;
+ ofstream file;
+ ofstream libs;
+ file.open(string(globals["prefix"] + ".readToLib").c_str(), ios::out);
+ libs.open(string(globals["prefix"] + ".libList").c_str(), ios::out);
+ map<ID_t, int> printedLibs;
+
+ while (read_stream >> read)
+ {
+ ID_t fragID = read.getFragment();
+ ID_t libID = NULL_ID;
+
+ if (fragID == NULL_ID) {
+ continue;
+ } else {
+ frag_bank.fetch(fragID, frag);
+ libID = frag.getLibrary();
+ }
+ if (libID == NULL_ID) {
+ continue;
+ }
+
+ if (globals["iid"] == "true") {
+ file << read.getIID() << "\t" << libID << endl;
+ if (printedLibs[libID] == 0) {
+ libs << libID << endl;
+ printedLibs[libID] = 1;
+ }
+ } else {
+ lib_bank.fetch(libID, lib);
+ string libEID = lib.getEID();
+ file << read.getEID() << "\t" << libEID << endl;
+ if (printedLibs[libID] == 0) {
+ libs << libEID << endl;
+ printedLibs[libID] = 1;
+ }
+ }
+ }
+
+ file.close();
+ libs.close();
+
+ read_stream.close();
+ frag_bank.close();
+ lib_bank.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+
+ return(0);
+} // main
+
diff --git a/src/Bank/bank2scaff.cc b/src/Bank/bank2scaff.cc
new file mode 100644
index 0000000..cab1767
--- /dev/null
+++ b/src/Bank/bank2scaff.cc
@@ -0,0 +1,370 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+using namespace AMOS;
+using namespace std;
+
+bool OPT_UseEIDs = false;
+bool OPT_UseIIDs = false;
+bool OPT_FASTA = false;
+int OPT_Spacer = 100;
+int OPT_MinGapsize = 100;
+bool OPT_UseExpected = false;
+bool OPT_UseUngapped = false;
+bool OPT_CreateLinks = false;
+bool OPT_Join = false;
+
+string OPT_BankName;
+
+string OPT_EIDFile;
+string OPT_IIDFile;
+
+void PrintUsage (const char * s)
+{
+ cerr << "\n.USAGE.\n" << " " << s << " [options] <bank path>\n";
+}
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage(s);
+ cerr << "\n.DESCRIPTION.\n"
+ << " Takes an AMOS bank directory and prints the scaffolds to stdout.\n\n"
+ << " Default format:\n"
+ << " >scaffid numcontigs scaffbases scaffspan\n"
+ << " contigid orientation contiglen leftgapsize\n"
+ << "\n.OPTIONS.\n"
+ << " -h Display help information\n"
+ << " -v Display the compatible bank version\n"
+ << " -e Use EIDs for names (DEFAULT)\n"
+ << " -i Use IIDs for names\n"
+ << " -E file Print just the contig eids listed in file\n"
+ << " -I file Print just the contig iids listed in file\n"
+ << " -u Show the ungapped contig lengths in the scaff file\n"
+ << " -l Create a Arachne links file\n"
+ << "\n"
+ << " -f Print the scaffold consensus sequences in multi-fasta format\n"
+ << " -g Use the estimated gaps size to space contigs\n"
+ << " -j Join contigs spaced by less than 2 bp (needs -f, if G provided overrides 2)\n"
+ << " -G val Gaps < val will have val N's between them (-g)\n"
+ << " -N val Specify number of N's to place between contigs\n"
+ << "\n.KEYWORDS.\n"
+ << " bank, converters, scaffolds"
+ << endl;
+
+}
+
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hveiE:I:fN:gG:ulj")) != EOF) )
+ {
+ switch (ch)
+ {
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'v':
+ PrintBankVersion (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'e': OPT_UseEIDs = true; break;
+ case 'i': OPT_UseIIDs = true; break;
+ case 'E': OPT_EIDFile = optarg; break;
+ case 'I': OPT_IIDFile = optarg; break;
+
+ case 'f': OPT_FASTA = true; break;
+ case 'g': OPT_UseExpected = true; break;
+ case 'j': OPT_Join = true; break;
+ case 'G': OPT_MinGapsize = atoi(optarg); break;
+ case 'N': OPT_Spacer = atoi(optarg); break;
+ case 'u': OPT_UseUngapped = true; break;
+ case 'l': OPT_CreateLinks = true; break;
+
+ default: errflg ++;
+ }
+ }
+
+ if (OPT_UseExpected) { OPT_FASTA = true; }
+
+ if ( errflg > 0 || optind != argc - 1 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_BankName = argv [optind];
+
+ if (!OPT_UseEIDs && !OPT_UseIIDs) { OPT_UseEIDs = true; }
+}
+
+
+void printScaffold(Scaffold_t & scaff, Bank_t & contig_bank)
+{
+ vector<Tile_t> & contigs = scaff.getContigTiling();
+ vector<Tile_t>::const_iterator ci;
+ int chunk = 0;
+ string names = "";
+
+ sort(contigs.begin(), contigs.end(), TileOrderCmp());
+
+ if (!OPT_CreateLinks)
+ {
+ cout << ">";
+ if (OPT_UseEIDs) { cout << scaff.getEID(); }
+ else { cout << scaff.getIID(); }
+ // if (OPT_Join) {cout << "_" << ++chunk;}
+ }
+
+ int bases = 0, span = 0, numcontigs = contigs.size();
+
+ for (ci = contigs.begin(); ci != contigs.end(); ci++)
+ {
+ bases += ci->getGappedLength();
+ int right = ci->getRightOffset();
+
+ if (right > span) { span = right; }
+ }
+
+ if (!OPT_CreateLinks && !OPT_Join)
+ {
+ cout << " " << contigs.size() << " " << bases << " " << span << endl;
+ }
+
+ string seq;
+ Contig_t contig;
+
+ int lastrightoffset;
+ int leftgapsize = 0;
+ int contignum = 0;
+
+ for (ci = contigs.begin(); ci != contigs.end(); ci++)
+ {
+ contignum++;
+
+ if (ci != contigs.begin())
+ {
+ leftgapsize = ci->offset - lastrightoffset;
+ } //else if (OPT_Join) {
+ // names.append(contig_bank.getIDMap().lookupEID(ci->source));
+ //}
+
+ lastrightoffset = ci->getRightOffset();
+
+ if (OPT_CreateLinks)
+ {
+ int rightgapsize = 0;
+ vector<Tile_t>::const_iterator ni = ci;
+ ni++;
+
+ if (ni != contigs.end())
+ {
+ rightgapsize = ni->offset - lastrightoffset;
+ }
+
+ if (OPT_UseEIDs)
+ {
+ cout << scaff.getEID() << "\t"
+ << bases << "\t"
+ << numcontigs << "\t"
+ << contignum << "\t"
+ << contig_bank.getIDMap().lookupEID(ci->source) << "\t"
+ << ci->range.getLength() << "\t"
+ << leftgapsize << "\t"
+ << rightgapsize << "\t" << endl;
+ }
+ else
+ {
+ cout << scaff.getIID() << "\t"
+ << bases << "\t"
+ << numcontigs << "\t"
+ << contignum << "\t"
+ << ci->source << "\t"
+ << ci->range.getLength() << "\t"
+ << leftgapsize << "\t"
+ << rightgapsize << "\t" << endl;
+ }
+ }
+ else if (OPT_FASTA)
+ {
+ if (ci != contigs.begin())
+ {
+ int spaces = OPT_Spacer;
+
+ if (OPT_UseExpected)
+ {
+ spaces = leftgapsize;
+
+ if (leftgapsize < OPT_MinGapsize)
+ {
+ spaces = OPT_MinGapsize;
+ }
+ }
+ if (OPT_Join){
+ if (leftgapsize <= ((OPT_MinGapsize != 100)?OPT_MinGapsize:2))
+ {
+ // cerr << "Names is: " << names << " gap is " << leftgapsize <<endl;
+ names.append("+");
+ names.append(contig_bank.getIDMap().lookupEID(ci->source));
+ } else {
+ // cerr << "ElseNames is: " << names << " gap is " << leftgapsize <<endl;
+ ++chunk;
+ cout << "_" << chunk << " " << names << endl;
+ Fasta_Print(stdout, seq.c_str(), NULL, 60);
+ cout << ">";
+ if (OPT_UseEIDs) { cout << scaff.getEID(); }
+ else { cout << scaff.getIID(); }
+
+ names = "";
+ names.append(contig_bank.getIDMap().lookupEID(ci->source));
+ seq = "";
+ }
+ } else
+ seq.append(spaces, 'N');
+ } else if (OPT_Join) {
+ names.append(contig_bank.getIDMap().lookupEID(ci->source));
+ }
+
+ contig_bank.fetch(ci->source, contig);
+
+ string s = contig.getUngappedSeqString();
+
+ if (ci->range.isReverse()) { ReverseComplement(s); }
+
+ seq.append(s);
+ }
+ else
+ {
+ if (ci != contigs.begin())
+ {
+ cout << " " << leftgapsize << endl;
+ }
+
+ if (OPT_UseEIDs)
+ {
+ cout << contig_bank.getIDMap().lookupEID(ci->source);
+ }
+ else
+ {
+ cout << ci->source;
+ }
+
+ if (ci->range.isReverse()) { cout << " EB "; }
+ else { cout << " BE "; }
+
+ if (OPT_UseUngapped)
+ {
+ contig_bank.fetch(ci->source, contig);
+ string s = contig.getUngappedSeqString();
+ cout << s.length();
+ }
+ else
+ {
+ cout << ci->range.getLength();
+ }
+ }
+ }
+
+ if (OPT_FASTA)
+ {
+ if (!OPT_Join)
+ Fasta_Print(stdout, seq.c_str(), NULL, 60);
+ else {
+ if (! seq.empty()){
+ cout << "_" << ++chunk << " " << names <<endl;
+ Fasta_Print(stdout, seq.c_str(), NULL, 60);
+ }
+ }
+ }
+ else if (!OPT_CreateLinks)
+ {
+ leftgapsize = 0; // No gap after last contig
+ cout << " " << leftgapsize << endl;
+ }
+}
+
+
+
+
+int main (int argc, char ** argv)
+{
+ ParseArgs (argc, argv);
+
+ BankStream_t scaff_bank(Scaffold_t::NCODE);
+ Bank_t contig_bank(Contig_t::NCODE);
+
+ cerr << "Processing " << OPT_BankName << " at " << Date() << endl;
+
+ if (OPT_CreateLinks)
+ {
+ cout << "#super_id num_bases_in_super num_contigs_in_super ordinal_num_of_contig_in_super contig_id length_of_contig estimated_gap_before_contig estimated_gap_after_contig" << endl;
+ }
+
+ try
+ {
+ scaff_bank.open(OPT_BankName, B_READ);
+ contig_bank.open(OPT_BankName, B_READ);
+
+ Scaffold_t scaffold;
+ ifstream file;
+ string id;
+
+ if (!OPT_EIDFile.empty())
+ {
+ file.open(OPT_EIDFile.c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open EID File", __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ scaff_bank.seekg(scaff_bank.getIDMap().lookupBID(id));
+ scaff_bank >> scaffold;
+ printScaffold(scaffold, contig_bank);
+ }
+ }
+ else if (!OPT_IIDFile.empty())
+ {
+ file.open(OPT_IIDFile.c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open IID File", __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ scaff_bank.seekg(scaff_bank.getIDMap().lookupBID(atoi(id.c_str())));
+ scaff_bank >> scaffold;
+ printScaffold(scaffold, contig_bank);
+ }
+ }
+ else
+ {
+ while (scaff_bank >> scaffold)
+ {
+ printScaffold(scaffold, contig_bank);
+ }
+ }
+
+ contig_bank.close();
+ scaff_bank.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return EXIT_SUCCESS;
+}
diff --git a/src/Bank/dumpContigsAsReads.cc b/src/Bank/dumpContigsAsReads.cc
new file mode 100644
index 0000000..2decc13
--- /dev/null
+++ b/src/Bank/dumpContigsAsReads.cc
@@ -0,0 +1,202 @@
+// $Id$
+
+// This program reads a set of contigs from a bank then reports
+// regions where mate-pair information indicates a problem
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <getopt.h>
+#include <map>
+#include <set>
+#include <list>
+#include <vector>
+#include <string>
+#include <math.h>
+#include <functional>
+#include "foundation_AMOS.hh"
+
+using namespace std;
+using namespace AMOS;
+using namespace HASHMAP;
+
+// endl is a sham: die endl, die!
+#define endl "\n"
+
+map<string, string> globals; // global variables
+
+void printHelpText()
+{
+ cerr <<
+ "\n.USAGE.\n"
+ " dumpContigsAsReads -b[ank] <bank_name>\n"
+ "\n.DESCRIPTION.\n"
+ " dumpContigsAsReads - dumps the contigs in a bank as reads in a new .afg\n"
+ "\n.OPTIONS.\n"
+ " -h, -help print out help message\n"
+ " -b, -bank bank where assembly is stored\n"
+ " -E file Dump just the contig eids listed in file\n"
+ " -I file Dump just the contig iids listed in file\n"
+ "\n.KEYWORDS.\n"
+ " AMOS bank, Converters, contigs\n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"E", 1, 0, 'E'},
+ {"I", 1, 0, 'I'},
+ {0, 0, 0, 0}
+ };
+
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ exit(0);
+ break;
+ case 'b':
+ globals["bank"] = string(optarg);
+ break;
+ case 'E':
+ globals["eidfile"] = string(optarg);
+ break;
+ case 'I':
+ globals["iidfile"] = string(optarg);
+ break;
+ case '?':
+ return false;
+ }
+ }
+
+ return true;
+} // GetOptions
+
+void printContigAsRead(const Contig_t & ctg)
+{
+ Read_t nrd;
+ Message_t message;
+
+ string seq = ctg.getSeqString();
+ string quals = ctg.getQualString();
+ string newseq = "";
+ string newqual = "";
+
+ for (int i = 0; i < seq.length(); i++)
+ {
+ if (seq[i] == '-') { continue; }
+
+ newseq += seq[i];
+ newqual += quals[i];
+ }
+
+ nrd.setSequence(newseq, newqual);
+ nrd.setIID(ctg.getIID());
+ nrd.setEID(ctg.getEID());
+ nrd.setClearRange(Range_t(0,nrd.getLength() - 1));
+
+ nrd.writeMessage(message);
+ message.write(cout);
+} // printFasta
+
+//----------------------------------------------
+int main(int argc, char **argv)
+{
+ if (! GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ // open necessary files
+ if (globals.find("bank") == globals.end()){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ Bank_t contig_bank (Contig_t::NCODE);
+ BankStream_t contig_stream (Contig_t::NCODE);
+ if (! contig_bank.exists(globals["bank"])){
+ cerr << "No contig account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+
+
+ try
+ {
+ contig_stream.open(globals["bank"], B_READ);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Failed to open contig account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+
+ try
+ {
+ Contig_t ctg;
+ ifstream file;
+ string id;
+
+ if (!globals["eidfile"].empty())
+ {
+ file.open(globals["eidfile"].c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open EID File", __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ contig_stream.seekg(contig_stream.getIDMap().lookupBID(id));
+ contig_stream >> ctg;
+ printContigAsRead(ctg);
+ }
+ }
+ else if (!globals["iidfile"].empty())
+ {
+ file.open(globals["iidfile"].c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open IID File", __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ contig_stream.seekg(contig_stream.getIDMap().lookupBID(atoi(id.c_str())));
+ contig_stream >> ctg;
+ printContigAsRead(ctg);
+ }
+ }
+ else
+ {
+ while (contig_stream >> ctg)
+ {
+ printContigAsRead(ctg);
+ }
+ }
+
+ contig_stream.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+
+ return(0);
+} // main
+
diff --git a/src/Bank/dumpFeatures.cc b/src/Bank/dumpFeatures.cc
new file mode 100644
index 0000000..1ee074e
--- /dev/null
+++ b/src/Bank/dumpFeatures.cc
@@ -0,0 +1,221 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+
+using namespace AMOS;
+using namespace std;
+
+int USEIID = 0;
+int GFF = 0;
+
+void printFeature(Bank_t & contig_bank, ID_t iid, char type, int b, int e, const string & comment)
+{
+ if (GFF)
+ {
+ if (USEIID) { cout << iid; }
+ else { cout << contig_bank.lookupEID(iid); }
+
+ cout << "\t" << "AMOS" // program
+ << "\t" << "misc_feature" // feature type
+ << "\t" << b // beginning
+ << "\t" << e // end
+ << "\t" << "." // score
+ << "\t" << "+" // strand
+ << "\t" << "." // frame
+ << "\t"
+ << "Experiment \""
+ << type << "\";" // feature type
+ << "Note \""
+ << comment << "\"" << endl; // comment
+ }
+ else
+ {
+ if (USEIID)
+ {
+ cout << iid << " "
+ << type << " "
+ << b << " "
+ << e << " "
+ << comment << endl;
+ }
+ else
+ {
+ cout << contig_bank.lookupEID(iid) << " "
+ << type << " "
+ << b << " "
+ << e << " "
+ << comment << endl;
+ }
+ }
+}
+
+int main (int argc, char ** argv)
+{
+ AMOS_Foundation * tf = NULL;
+ int retval = 0;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"\n.USAGE.\n"
+" dumpFeatures [options] bankname\n"
+"\n.DESCRIPTION.\n"
+" Dump contig features from a bank as a tab deliminated list. Scaffold\n"
+" features are converted to appropriate contig locatations.\n\n"
+" Format of output is:\n"
+" contigeid type end5 end3 [comment]\n"
+" \n"
+" contigeid is the contig which has the feature\n"
+" type is the single character feature type. \n"
+" end5 and end3 are the gapped coordinates of the feature\n"
+" [comment] is an optional comment string describing the feature\n"
+"\n.OPTIONS.\n"
+" -i report contig iids instead of eids\n"
+" -u report ungapped coordinates instread of gapped coordinates\n"
+" -g report features in .gff format\n"
+"\n.KEYWORDS.\n"
+" amos bank, converters\n";
+
+
+
+ int CONVERTUNGAPPED = 0;
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+ tf->getOptions()->addOptionResult("u", &CONVERTUNGAPPED);
+ tf->getOptions()->addOptionResult("i", &USEIID);
+ tf->getOptions()->addOptionResult("g", &GFF);
+
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() != 1)
+ {
+ cerr << "Usage: dumpFeatures [options] bankname" << endl;
+ return 0;
+ }
+
+ BankStream_t feat_bank(Feature_t::NCODE);
+ Bank_t contig_bank(Contig_t::NCODE);
+ Bank_t scaffold_bank(Scaffold_t::NCODE);
+
+ Feature_t feat;
+ Contig_t contig;
+ Scaffold_t scaffold;
+
+ string bank_name = argvv.front(); argvv.pop_front();
+
+ cerr << "Processing " << bank_name << " at " << Date() << endl;
+
+ if (!feat_bank.exists(bank_name))
+ {
+ cerr << "WARNING: No features in bank" << endl;
+ exit(0);
+ }
+
+ feat_bank.open(bank_name, B_READ);
+
+ if (scaffold_bank.exists(bank_name))
+ {
+ scaffold_bank.open(bank_name, B_READ);
+ }
+
+ contig_bank.open(bank_name, B_READ);
+
+
+ ID_t contigloaded = 0;
+ int featcount = 0;
+
+ while (feat_bank >> feat)
+ {
+ if (scaffold_bank.isOpen() &&
+ feat.getSource().second == Scaffold_t::NCODE)
+ {
+ int b = feat.getRange().begin;
+ int e = feat.getRange().end;
+
+ ID_t iid = feat.getSource().first;
+
+ scaffold_bank.fetch(iid, scaffold);
+
+ vector<Tile_t> & tiling = scaffold.getContigTiling();
+ vector<Tile_t>::iterator ti;
+
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ if ((ti->offset < e) && (ti->getRightOffset() > b))
+ {
+ // This contig overlaps the feature
+ int cb = b - ti->offset;
+ int ce = e - ti->offset;
+
+ if (CONVERTUNGAPPED)
+ {
+ cerr << "Converting to ungapped coordinates is unsupported for scaffold features" << endl;
+ }
+
+ printFeature(contig_bank, ti->source, feat.getType(), cb, ce, feat.getComment());
+ }
+ }
+ }
+ else if (feat.getSource().second == Contig_t::NCODE)
+ {
+ featcount++;
+
+ int b = feat.getRange().begin;
+ int e = feat.getRange().end;
+
+ ID_t iid = feat.getSource().first;
+
+ if (CONVERTUNGAPPED)
+ {
+ if (iid != contigloaded)
+ {
+ contig_bank.fetch(iid, contig);
+ contigloaded = iid;
+ }
+
+ b = contig.gap2ungap(b);
+ e = contig.gap2ungap(b);
+ }
+
+ printFeature(contig_bank, iid, feat.getType(), b, e, feat.getComment());
+ }
+ }
+
+ cerr << "Printed " << featcount << " features" << endl;
+ contig_bank.close();
+ feat_bank.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/Bank/dumpmates.cc b/src/Bank/dumpmates.cc
new file mode 100644
index 0000000..63c2f36
--- /dev/null
+++ b/src/Bank/dumpmates.cc
@@ -0,0 +1,207 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 03/08/2004
+//!
+//! \brief Dumps a bambus .mates file from an AMOS bank
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <cassert>
+#include <unistd.h>
+using namespace std;
+using namespace AMOS;
+
+
+//=============================================================== Globals ====//
+string OPT_BankName; // bank name parameter
+bool OPT_BankSpy = false; // read or read-only spy
+bool OPT_UseEIDs = false; // print EIDs instead of IIDs
+
+
+
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+ Fragment_t frg;
+ Library_t lib;
+ pair<ID_t, ID_t> mtp;
+
+ Bank_t red_bank (Read_t::NCODE);
+ BankStream_t frg_bank (Fragment_t::NCODE);
+ BankStream_t lib_bank (Library_t::NCODE);
+
+ long int cntw = 0; // written object count
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ BankMode_t bm = OPT_BankSpy ? B_SPY : B_READ;
+ frg_bank . open (OPT_BankName, bm);
+ lib_bank . open (OPT_BankName, bm);
+
+ if ( OPT_UseEIDs )
+ red_bank . open (OPT_BankName, bm);
+
+ //-- Iterate through each library in the bank
+ while ( lib_bank >> lib )
+ {
+ // if ( OPT_UseEIDs )
+ // cout << "library\t" << lib . getEID( );
+ // else
+ cout << "library\t" << lib . getIID( );
+
+ cout << '\t'
+ << lib.getDistribution( ).mean - (lib.getDistribution( ).sd * 3)
+ << '\t'
+ << lib.getDistribution( ).mean + (lib.getDistribution( ).sd * 3)
+ << endl;
+ }
+
+ //-- Iterate through each fragment in the bank
+ while ( frg_bank >> frg )
+ {
+ mtp = frg . getMatePair( );
+ if ( mtp . first != NULL_ID && mtp . second != NULL_ID )
+ {
+ if ( OPT_UseEIDs )
+ cout << red_bank . lookupEID (mtp . first) << '\t'
+ << red_bank . lookupEID (mtp . second);
+ else
+ cout << mtp . first << '\t' << mtp . second;
+
+ cout << '\t' << frg . getLibrary( ) << endl;
+ cntw ++;
+ }
+ }
+
+ frg_bank . close( );
+ lib_bank . close( );
+ red_bank . close( );
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+
+ cerr << "Objects written: " << cntw << endl;
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "ehsv")) != EOF) )
+ switch (ch)
+ {
+ case 'e':
+ OPT_UseEIDs = true;
+ break;
+
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 's':
+ OPT_BankSpy = true;
+ break;
+
+ case 'v':
+ PrintBankVersion (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ default:
+ errflg ++;
+ }
+
+ if ( errflg > 0 || optind != argc - 1 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_BankName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+
+ cerr << "\n.DESCRIPTION.\n"
+ << " Takes an AMOS bank directory and dumps a bambus .mates files to\n"
+ << " stdout\n\n"
+ << "\n.OPTIONS.\n"
+ << " -e Report objects by EID instead of IID\n"
+ << " -h Display help information\n"
+ << " -s Disregard bank locks and write permissions (spy mode)\n"
+ << " -v Display the compatible bank version\n"
+ << "\n.KEYWORDS.\n"
+ << " amos bank, converters, mate pairs, Bambus\n"
+ << endl;
+
+
+
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr << "\n.USAGE.\n" << " " << s << " [options] -b <bank path>\n";
+ return;
+}
diff --git a/src/Bank/dumpreads.cc b/src/Bank/dumpreads.cc
new file mode 100644
index 0000000..5803fe8
--- /dev/null
+++ b/src/Bank/dumpreads.cc
@@ -0,0 +1,332 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 03/08/2004
+//!
+//! \brief Dumps the reads in a bank by IID to stdout w/ clear range trimmed
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <unistd.h>
+using namespace std;
+using namespace AMOS;
+
+
+//=============================================================== Globals ====//
+string OPT_BankName; // bank name parameter
+bool OPT_BankSpy = false; // read or read-only spy
+bool OPT_UseEIDs = false; // print EIDs instead of IIDs
+bool OPT_UseRaw = false; // pull entire seqlen
+bool OPT_DumpQual = false; // dump qualities
+bool OPT_ShowClear = false; // show clear range info
+bool OPT_DumpFastq = false; // do fastq instead of seq/quals
+char OPT_FastqOffset = 33; // Sanger Qualities by default
+
+string OPT_IIDFile; // Filename of IIDs to dump
+string OPT_EIDFile; // Filename of EIDs to dump
+
+long int cnts = 0; // seen object count
+long int cntw = 0; // written object count
+
+int OPT_basesperline = 70;
+
+// Daniela Puiu: May 7th 2008
+int OPT_minIID=0;
+int OPT_maxIID=0;
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+void DumpQuals(ostream & out, const string & quals, int lineLen)
+{
+ int len = quals.length();
+ char buffer[16];
+
+ for (int i = 0; i < len; i++)
+ {
+ // Print each number followed by a character
+ // '\n' if last number in that row or final element
+ // ' ' otherwise
+
+ sprintf (buffer, "%.2d%c", quals[i] - AMOS::MIN_QUALITY,
+ ( ( ( i % ( lineLen ) == ( lineLen - 1 ) ) ) || ( i == len - 1 ) ) ? '\n' : ' ' );
+
+ out << buffer;
+ }
+}
+
+
+void dumpRead(Read_t & red)
+{
+ cnts++;
+
+ if ( red . getLength( ) <= 0 )
+ {
+ cerr << "WARNING: read with IID " << red . getIID( )
+ << " has no sequence, skipped\n";
+ return;
+ }
+ if ( ! OPT_UseRaw && red . getClearRange( ) . getLength( ) <= 0 )
+ {
+ cerr << "WARNING: read with IID " << red . getIID( )
+ << " has no clear range sequence, skipped\n";
+ return;
+ }
+
+ // Daniela Puiu
+ if(!OPT_UseEIDs)
+ {
+ if(OPT_minIID && red.getIID()<=OPT_minIID || OPT_maxIID && red.getIID()>OPT_maxIID) return;
+ }
+
+ if (OPT_DumpFastq)
+ {
+ if ( OPT_UseEIDs ) { cout << "@" << red.getEID() << endl; }
+ else { cout << "@" << red.getIID() << endl; }
+
+ if (OPT_UseRaw) { cout << red.getSeqString() << endl; }
+ else { cout << red.getSeqString(red.getClearRange()) << endl; }
+
+ cout << "+" << endl;
+
+ string quals;
+
+ if (OPT_UseRaw) { quals = red.getQualString(); }
+ else { quals = red.getQualString(red.getClearRange()); }
+
+ for (int i = 0; i < quals.length(); i++)
+ {
+ quals[i] = quals[i] - AMOS::MIN_QUALITY + OPT_FastqOffset;
+ }
+
+ cout << quals << endl;
+ }
+ else
+ {
+ if ( OPT_UseEIDs ) { cout << ">" << red.getEID(); }
+ else { cout << ">" << red.getIID(); }
+
+ if (OPT_ShowClear)
+ {
+ cout << " 0 0 0 " << red.getClearRange().getLo() + 1 << " " << red.getClearRange().getHi();
+ }
+
+ cout << endl;
+
+ if (OPT_DumpQual)
+ {
+ if (OPT_UseRaw) { DumpQuals(cout, red.getQualString(), OPT_basesperline); }
+ else { DumpQuals(cout, red.getQualString(red.getClearRange()), OPT_basesperline); }
+ }
+ else
+ {
+ if (OPT_UseRaw) { WrapString (cout, red . getSeqString( ), OPT_basesperline); }
+ else { WrapString (cout, red . getSeqString(red . getClearRange( )), OPT_basesperline); }
+ }
+ }
+
+ cntw++;
+}
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+ BankStream_t red_bank (Read_t::NCODE);
+ Read_t red;
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ if ( OPT_BankSpy )
+ red_bank . open (OPT_BankName, B_SPY);
+ else
+ red_bank . open (OPT_BankName, B_READ);
+
+ ifstream file;
+ string id;
+
+ if (!OPT_EIDFile.empty())
+ {
+ // Dump just the specified list of EIDs
+ file.open(OPT_EIDFile.c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open EID File",
+ __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ red_bank.seekg(red_bank.getIDMap().lookupBID(id));
+ red_bank >> red;
+
+ dumpRead(red);
+ }
+ }
+ else if (!OPT_IIDFile.empty())
+ {
+ // Dump just the specified list of EIDs
+ file.open(OPT_IIDFile.c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open IID File",
+ __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ red_bank.seekg(red_bank.getIDMap().lookupBID(atoi(id.c_str())));
+ red_bank >> red;
+ dumpRead(red);
+ }
+ }
+ else
+ {
+ //-- Iterate through each object in the bank
+ while ( red_bank >> red )
+ {
+ dumpRead(red);
+ }
+ }
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ cerr << "iid: " << red.getIID() << " eid: " << red.getEID() << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+
+ cerr << "Objects seen: " << cnts << endl
+ << "Objects written: " << cntw << endl;
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "cehrsvqE:I:L:m:M:fQ:")) != EOF) )
+ switch (ch)
+ {
+ case 'c': OPT_ShowClear = true; break;
+ case 'e': OPT_UseEIDs = true; break;
+ case 's': OPT_BankSpy = true; break;
+
+ case 'E': OPT_EIDFile = optarg; break;
+ case 'I': OPT_IIDFile = optarg; break;
+ case 'r': OPT_UseRaw = true; break;
+ case 'q': OPT_DumpQual = true; OPT_basesperline = 17; break;
+ case 'L': OPT_basesperline = atoi(optarg); break;
+
+ case 'm': OPT_minIID = atoi(optarg); break;
+ case 'M': OPT_maxIID = atoi(optarg); break;
+
+ case 'f': OPT_DumpFastq = true; break;
+ case 'Q': OPT_FastqOffset = atoi(optarg); break;
+
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'v': PrintBankVersion (argv[0]); exit (EXIT_SUCCESS); break;
+
+ default:
+ errflg ++;
+ }
+
+ if ( errflg > 0 || optind != argc - 1 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_BankName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+
+ cerr << "\n.DESCRIPTION.\n"
+ << " Takes an AMOS bank directory and dumps selected reads to\n"
+ << " stdout in FASTA or FASTQ format.\n"
+ << "\n.OPTIONS.\n"
+ << " -f Dump reads in fastq format\n"
+ << " -Q int Use this as the min base quality (default: 33 / Sanger FASTQ)\n"
+ << " -q Dump qualities in fasta format instead of sequence\n"
+ << " -e Use EIDs for FastA header instead of IIDs\n"
+ << " -r Ignore clear range and dump entire sequence\n"
+ << " -c Display clear range information on FASTA header for TIGR Assembler\n"
+ << " -E file Dump just the eids listed in file\n"
+ << " -I file Dump just the iids listed in file\n"
+ << " -L num Set the maximum number of bases per line (Default: 70)\n"
+ << " -m num Minimum IID to display (not included) (Default all; not compatible with -e,-E,-I options)\n"
+ << " -M num Maximum IID to display (included) (Default all; not compatible with -e,-E,-I options)\n"
+ << " -h Display help information\n"
+ << " -s Disregard bank locks and write permissions (spy mode)\n"
+ << " -v Display the compatible bank version\n"
+ << "\n.KEYWORDS.\n"
+ << " amos bank, reads, converters"
+ << endl;
+
+
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr << "\n.USAGE.\n" << " " << s << " [options] <bank path>\n";
+ return;
+}
diff --git a/src/Bank/extractContig.cc b/src/Bank/extractContig.cc
new file mode 100644
index 0000000..300b14f
--- /dev/null
+++ b/src/Bank/extractContig.cc
@@ -0,0 +1,124 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+
+using namespace AMOS;
+using namespace std;
+
+
+int main(int argc, char ** argv)
+{
+ if (argc != 4)
+ {
+ cerr << "Usage: extractContig bankname contigiid newbank" << endl;
+ cerr << "Extracts selected contig and associated reads, fragments, and libraries" << endl
+ << "and writes them to new bank" << endl;
+
+ return EXIT_FAILURE;
+ }
+
+ Bank_t contig_bank(Contig_t::NCODE);
+ Bank_t read_bank(Read_t::NCODE);
+ Bank_t fragment_bank(Fragment_t::NCODE);
+ Bank_t library_bank(Library_t::NCODE);
+
+ Bank_t newcontig_bank(Contig_t::NCODE);
+ Bank_t newread_bank(Read_t::NCODE);
+ Bank_t newfragment_bank(Fragment_t::NCODE);
+ Bank_t newlibrary_bank(Library_t::NCODE);
+
+ string bank_name = argv[1];
+ string contigid = argv[2];
+ string new_name = argv[3];
+
+ cerr << "Extracting contig " << contigid << " from " << bank_name
+ << " into " << new_name << " at " << Date() << endl;
+
+ try
+ {
+ contig_bank.open(bank_name, B_READ);
+ read_bank.open(bank_name, B_READ);
+ fragment_bank.open(bank_name, B_READ);
+ library_bank.open(bank_name, B_READ);
+
+ if(!newcontig_bank.exists(new_name)) {newcontig_bank.create(new_name); }
+ if(!newread_bank.exists(new_name)) {newread_bank.create(new_name); }
+ if(!newfragment_bank.exists(new_name)){newfragment_bank.create(new_name);}
+ if(!newlibrary_bank.exists(new_name)) {newlibrary_bank.create(new_name); }
+
+ newcontig_bank.open(new_name);
+ newread_bank.open(new_name);
+ newfragment_bank.open(new_name);
+ newlibrary_bank.open(new_name);
+
+ Contig_t contig;
+ Read_t read;
+ Fragment_t fragment;
+ Library_t library;
+
+ contig_bank.fetch(atoi(contigid.c_str()), contig);
+
+ const std::vector<Tile_t> & tiling = contig.getReadTiling();
+
+ std::vector<Tile_t>::const_iterator ti;
+ for (ti = tiling.begin();
+ ti != tiling.end();
+ ti++)
+ {
+ read_bank.fetch(ti->source, read);
+
+ if (!newread_bank.existsIID(read.getIID()))
+ {
+ fragment_bank.fetch(read.getFragment(), fragment);
+
+ if (!newfragment_bank.existsIID(fragment.getIID()))
+ {
+ library_bank.fetch(fragment.getLibrary(), library);
+
+ if (!newlibrary_bank.existsIID(library.getIID()))
+ {
+ newlibrary_bank.append(library);
+ }
+
+ newfragment_bank.append(fragment);
+
+ ID_t mateid = 0;
+
+ if (fragment.getMatePair().first == read.getIID())
+ {
+ mateid = fragment.getMatePair().second;
+ }
+ else if (fragment.getMatePair().second == read.getIID())
+ {
+ mateid = fragment.getMatePair().first;
+ }
+
+ if (mateid != 0)
+ {
+ Read_t mate;
+ read_bank.fetch(mateid, mate);
+
+ newread_bank.append(mate);
+ }
+ }
+
+ newread_bank.append(read);
+ }
+ }
+
+ if (!newcontig_bank.existsIID(contig.getIID()))
+ {
+ newcontig_bank.append(contig);
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return EXIT_SUCCESS;
+}
+
diff --git a/src/Bank/findMissingMates.cc b/src/Bank/findMissingMates.cc
new file mode 100644
index 0000000..42e147c
--- /dev/null
+++ b/src/Bank/findMissingMates.cc
@@ -0,0 +1,512 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 03/08/2004
+//!
+//! \brief Dumps a bambus .mates file from an AMOS bank
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <cassert>
+#include <unistd.h>
+#include <map>
+using namespace std;
+using namespace AMOS;
+
+
+//=============================================================== Globals ====//
+string OPT_BankName; // bank name parameter
+bool OPT_BankSpy = false; // read or read-only spy
+bool OPT_UseScaffolds = false;
+bool OPT_MissingOnly = false;
+bool OPT_USEMATES = true;
+typedef map <ID_t, ID_t> IDMap;
+
+ID_t contigiid = AMOS::NULL_ID;
+string contigeid;
+int rangeStart = -1;
+int rangeEnd = -1;
+bool verbosemode = false;
+
+
+
+bool hasOverlap(Pos_t rangeStart, // 0-based exact offset of range
+ Pos_t rangeEnd, // 0-based exact end of range
+ Pos_t seqOffset, // 0-bases exact offset of seq
+ Pos_t seqLen, // count of bases of seq (seqend+1)
+ Pos_t contigLen) // count of bases in contig (contigend+1)
+{
+ int retval = 1;
+
+ if (seqOffset >= (Pos_t) 0)
+ {
+ if ((seqOffset > rangeEnd) // sequence right flanks
+ || (seqOffset + seqLen-1 < rangeStart)) // sequence left flanks
+ {
+ retval = 0;
+ }
+ }
+ else
+ {
+ // Negative Offset, test left and right separately
+ retval = hasOverlap(rangeStart, rangeEnd,
+ 0, seqLen+seqOffset, contigLen) ||
+ hasOverlap(rangeStart, rangeEnd,
+ contigLen+seqOffset, -seqOffset, contigLen);
+ }
+
+ return retval;
+}
+
+
+
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+ Read_t red;
+ Fragment_t frg;
+ Library_t lib;
+
+ map <ID_t, Distribution_t> libmap;
+ map <ID_t, Pos_t> readlens;
+
+ IDMap mates;
+ IDMap readliblookup;
+ IDMap frgliblookup;
+ IDMap contigscafflookup;
+
+ Scaffold_t scaff;
+ Contig_t contig;
+
+ BankStream_t lib_bank (Library_t::NCODE);
+ BankStream_t frg_bank (Fragment_t::NCODE);
+ BankStream_t ctg_bank (Contig_t::NCODE);
+ BankStream_t scf_bank (Scaffold_t::NCODE);
+ BankStream_t red_bank (Read_t::NCODE);
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ BankMode_t bm = OPT_BankSpy ? B_SPY : B_READ;
+ red_bank . open (OPT_BankName, bm);
+ frg_bank . open (OPT_BankName, bm);
+ lib_bank . open (OPT_BankName, bm);
+ ctg_bank . open (OPT_BankName, bm);
+
+ if (OPT_UseScaffolds)
+ {
+ cerr << "Opening scaffold bank" << endl;
+ scf_bank . open (OPT_BankName, bm);
+ }
+
+
+ while ( lib_bank >> lib )
+ {
+ libmap[lib.getIID()] = lib.getDistribution();
+ }
+ cerr << "Indexed " << libmap.size() << " libraries" << endl;
+
+
+ cerr << "Indexing frgs... ";
+ while (frg_bank >> frg)
+ {
+ frgliblookup[frg.getIID()] = frg.getLibrary();
+
+ std::pair<ID_t, ID_t> mtp = frg.getMatePair();
+
+ mates[mtp.first] = mtp.second;
+ mates[mtp.second] = mtp.first;
+ }
+ cerr << frgliblookup.size() << " fragments" << endl;
+ cerr << mates.size() << " mates" << endl;
+
+ cerr << "Indexing reds... ";
+ while (red_bank >> red)
+ {
+ IDMap::const_iterator fi = frgliblookup.find(red.getFragment());
+
+ if (fi != frgliblookup.end())
+ {
+ readliblookup[red.getIID()] = fi->second;
+ }
+
+ readlens[red.getIID()] = red.getClearRange().getLength();
+ }
+ cerr << readliblookup.size() << " reads in fragments" << endl;
+
+
+ if (OPT_UseScaffolds)
+ {
+ cerr << "Indexing scaffolds... ";
+ int scaffcount = 0;
+ while (scf_bank >> scaff)
+ {
+ scaffcount++;
+ vector<Tile_t> & ctiling = scaff.getContigTiling();
+ vector<Tile_t>::const_iterator ci;
+
+ for (ci = ctiling.begin(); ci != ctiling.end(); ci++)
+ {
+ contigscafflookup[ci->source] = scaff.getIID();
+ }
+ }
+ cerr << contigscafflookup.size() << " contigs in "
+ << scaffcount << " scaffolds" << endl;
+ }
+
+
+
+ // load read tiling for scaffold of this contig
+ if (contigiid == AMOS::NULL_ID)
+ {
+ contigiid = ctg_bank.lookupIID(contigeid.c_str());
+ }
+
+ if (contigiid == AMOS::NULL_ID)
+ {
+ cerr << "contigiid == AMOS::NULL_ID" << endl;
+ exit (1);
+ }
+
+ vector <Tile_t> rtiling;
+ map<ID_t, Tile_t *> tilelookup;
+ map<ID_t, Tile_t *>::iterator tli;
+ vector<Tile_t>::iterator ri;
+
+ IDMap::iterator si = contigscafflookup.find(contigiid);
+ if (si == contigscafflookup.end())
+ {
+ if (OPT_UseScaffolds)
+ {
+ cerr << "Contig not in scaffold, using original read tiling" << endl;
+ }
+
+ ctg_bank.seekg(ctg_bank.getIDMap().lookupBID(contigiid));
+ ctg_bank >> contig;
+ rtiling = contig.getReadTiling();
+ }
+ else
+ {
+ scf_bank.seekg(scf_bank.getIDMap().lookupBID(si->second));
+ scf_bank >> scaff;
+
+ vector<Tile_t> & ctiling = scaff.getContigTiling();
+ vector<Tile_t>::const_iterator ci;
+
+ cerr << "Mapping reads to scaffold " << scaff.getEID() << "... ";
+
+ for (ci = ctiling.begin(); ci != ctiling.end(); ci++)
+ {
+ ctg_bank.seekg(ctg_bank.getIDMap().lookupBID(ci->source));
+ ctg_bank >> contig;
+
+ int clen = contig.getLength();
+
+ // map original range to scaffold coordinates
+ if (ci->source == contigiid)
+ {
+ if (ci->range.isReverse())
+ {
+ rangeStart = clen - rangeStart;
+ rangeEnd = clen - rangeEnd;
+ }
+
+ rangeStart += ci->offset;
+ rangeEnd += ci->offset;
+
+ cerr << "new range: " << rangeStart << "," << rangeEnd << endl;
+ }
+
+ vector<Tile_t> & crtiling = contig.getReadTiling();
+ for (ri = crtiling.begin(); ri != crtiling.end(); ri++)
+ {
+ Tile_t mappedTile;
+ mappedTile.source = ri->source;
+ mappedTile.gaps = ri->gaps;
+ mappedTile.range = ri->range;
+
+ int offset = ri->offset;
+ if (ci->range.isReverse())
+ {
+ mappedTile.range.swap();
+ offset = clen - (offset + ri->range.getLength() + ri->gaps.size());
+ }
+
+ mappedTile.offset = ci->offset + offset;
+
+ rtiling.push_back(mappedTile);
+ }
+ }
+
+ cerr << rtiling.size() << " reads mapped" << endl;
+ }
+
+ tilelookup.clear();
+ for (ri = rtiling.begin(); ri != rtiling.end(); ri++)
+ {
+ tilelookup.insert(make_pair(ri->source, &(*ri)));
+ }
+
+ if (rangeEnd < rangeStart)
+ {
+ int t = rangeEnd;
+ rangeEnd = rangeStart;
+ rangeStart = t;
+ }
+
+
+
+ cerr << "Finding reads that overlap [" << rangeStart << "," << rangeEnd << "]" << endl;
+ int count = 0;
+ for (ri = rtiling.begin(); ri != rtiling.end(); ri++)
+ {
+ bool hasovl = false;
+ if (hasOverlap(rangeStart, rangeEnd,
+ ri->offset, ri->getGappedLength(),
+ 10000000))
+ {
+ hasovl = true;
+ }
+
+ if (verbosemode)
+ {
+ if (hasovl) { cout << "*"; }
+ cout << "read: " << ri->source
+ << "\t" << red_bank.lookupEID(ri->source)
+ << "\t" << ri->offset
+ << "\t" << ri->getRightOffset()
+ << "\t" << (ri->range.isReverse() ? "R" : "F")
+ << endl;
+ }
+ else if (hasovl)
+ {
+ if (!OPT_MissingOnly)
+ {
+ cout << "t\t" << red_bank.lookupEID(ri->source)
+ << "\t" << ri->offset << "\t" << ri->getRightOffset()
+ << "\t" << (ri->range.isReverse() ? "R" : "F") << endl; }
+ }
+
+ if (OPT_USEMATES)
+ {
+ IDMap::const_iterator mi = mates.find(ri->source);
+ if (mi != mates.end())
+ {
+ IDMap::const_iterator rli = readliblookup.find(ri->source);
+ if (rli != readliblookup.end())
+ {
+ map<ID_t, Distribution_t>::const_iterator li = libmap.find(rli->second);
+ if (li != libmap.end())
+ {
+ int projectedStart;
+ int projectedEnd;
+
+ int NUMSD = 3;
+ int readlen = readlens[mi->second];
+
+ if (ri->range.isReverse())
+ {
+ int roffset = ri->offset + ri->range.getLength() + ri->gaps.size() - 1;
+ projectedStart = roffset - li->second.mean - NUMSD*li->second.sd;
+ projectedEnd = roffset - li->second.mean + NUMSD*li->second.sd + readlen;
+ }
+ else
+ {
+ projectedStart = ri->offset + li->second.mean - NUMSD*li->second.sd - readlen;
+ projectedEnd = ri->offset + li->second.mean + NUMSD*li->second.sd;
+ }
+
+ hasovl = false;
+
+ if (hasOverlap(rangeStart, rangeEnd,
+ projectedStart, projectedEnd - projectedStart + 1,
+ 10000000))
+ {
+ hasovl = true;
+ }
+
+ if (verbosemode)
+ {
+ if (hasovl) { cout << "*"; }
+
+ cout << "mate: " << mi->second
+ << "\t" << red_bank.lookupEID(mi->second)
+ << "\t" << projectedStart
+ << "\t" << projectedEnd
+ << "\t" << (ri->range.isReverse() ? "F" : "R")
+ << endl;
+ }
+ else if (hasovl)
+ {
+ if (OPT_MissingOnly)
+ {
+ tli = tilelookup.find(mi->second);
+ }
+
+ if (!OPT_MissingOnly || tli == tilelookup.end())
+ {
+ cout << "p\t" << red_bank.lookupEID(mi->second) << "\t" << projectedStart << "\t" << projectedEnd
+ << "\t" << (ri->range.isReverse() ? "F" : "R") << endl;
+ }
+ }
+ }
+ else if (verbosemode)
+ {
+ cout << "no dist" << endl;
+ }
+ }
+ else if (verbosemode)
+ {
+ cout << "no lib" << endl;
+ }
+ }
+ else if (verbosemode)
+ {
+ cout << "no mate" << endl;
+ }
+ }
+ }
+
+ red_bank.close();
+ frg_bank.close();
+ lib_bank.close();
+ ctg_bank.close();
+
+ if (OPT_UseScaffolds)
+ {
+ scf_bank.close();
+ }
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hsvVE:I:x:y:SMm")) != EOF) )
+ switch (ch)
+ {
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 's': OPT_BankSpy = true; break;
+ case 'v': PrintBankVersion (argv[0]); exit (EXIT_SUCCESS); break;
+ case 'E': contigeid = optarg; break;
+ case 'I': contigiid = atoi(optarg); break;
+ case 'x': rangeStart = atoi(optarg); break;
+ case 'y': rangeEnd = atoi(optarg); break;
+ case 'V': verbosemode = true; break;
+ case 'S': OPT_UseScaffolds = true; break;
+ case 'M': OPT_MissingOnly = true; break;
+ case 'm' :OPT_USEMATES = false; break;
+
+ default: errflg ++;
+ }
+
+ if (errflg > 0 || optind != argc - 1)
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+
+ if (rangeStart == -1 || rangeEnd == -1 ||
+ (contigeid.empty() && contigiid == AMOS::NULL_ID))
+ {
+ cerr << "Range coordinates and contig id are required" << endl;
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_BankName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+
+ cerr << "\n.DESCRIPTION.\n"
+ << " Finds all reads that should overlap a given contig range. Includes reads that\n"
+ << " should be present by the virtue of their mate and the scaffold\n"
+ << "\n.OPTIONS.\n"
+ << " -h Display help information\n"
+ << " -s Disregard bank locks and write permissions (spy mode)\n"
+ << " -v Display the compatible bank version\n"
+ << " -S Looks for mates by virtue of the scaffold\n"
+ << " -M Only display missing mates (not reads already present in range)\n"
+ << " -m Don't use mate information, just read tiling\n"
+ << " -E contigeid Contig eid of interest\n"
+ << " -I contigiid Contig iid of interest\n"
+ << " -x start Start of range\n"
+ << " -y end End of range\n"
+ << "\n.KEYWORDS.\n"
+ << " amos bank, mates"
+ << endl;
+
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr << "\n.USAGE.\n" << " " << s << " [options] -b <bank path>\n";
+ return;
+}
diff --git a/src/Bank/grow-readbank.cc b/src/Bank/grow-readbank.cc
new file mode 100644
index 0000000..649478e
--- /dev/null
+++ b/src/Bank/grow-readbank.cc
@@ -0,0 +1,275 @@
+// A. L. Delcher
+//
+// File: grow-readbank.cc
+//
+// Last Modified: 20 February 2003
+//
+// Add reads to a readbank, creating a new one if specfied.
+
+
+#include "foundation_AMOS.hh"
+#include "delcher.hh"
+#include "CelMsg.hh"
+#include <vector>
+#include <string>
+
+using namespace std;
+using namespace AMOS;
+
+const int MAX_LINE = 1000;
+const int NEW_SIZE = 1000;
+
+
+enum Input_Format_t
+ {FASTA_FORMAT, CELERA_MSG_FORMAT};
+
+
+static string Bank_Name;
+ // Name of read bank to be added to.
+static bool Create_New_Bank = false;
+ // If true, then start a new read bank
+static bool Force_New_Bank = false;
+ // If true, then force a new read bank by deleting existing one first
+static bool Compress_Reads = false;
+ // If true, then compress reads before appending them to bank
+static Input_Format_t Input_Format = FASTA_FORMAT;
+ // Type of input
+static char * Input_File_1, * Input_File_2;
+ // Names of input file(s)
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv []);
+static void Usage
+ (const char * command);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ Bank_t read_bank (Read_t::NCODE);
+ Read_t read;
+ Celera_Message_t msg;
+ int ct;
+
+ fprintf (stderr, "Starting on %s at %s\n", __DATE__, __TIME__);
+
+ Verbose = 0;
+
+ Parse_Command_Line (argc, argv);
+
+ cout << "Bank is " << Bank_Name << endl;
+
+ try {
+
+ if ( Create_New_Bank &&
+ !Force_New_Bank &&
+ read_bank . exists (Bank_Name) )
+ {
+ cerr << "Bank already exists: " << Bank_Name << endl;
+ exit (1);
+ }
+
+ if ( Create_New_Bank )
+ read_bank . create (Bank_Name);
+ else
+ read_bank . open (Bank_Name);
+
+ ct = 0;
+ if (Input_Format == CELERA_MSG_FORMAT)
+ {
+ FILE * fp;
+ fp = File_Open (Input_File_1, "r");
+ while (msg . read (fp))
+ if (msg . getMsgType () == FRG_MSG)
+ {
+ string s;
+
+ ct ++;
+ read . setClearRange (msg . getClearRange ());
+ read . setEID (msg . getSource());
+ read . setIID (ct);
+ read . setSequence (msg . getSequence (), msg . getQuality ());
+ if ( Compress_Reads )
+ read . compress( );
+ read_bank . append (read);
+ }
+ }
+ else if (Input_Format == FASTA_FORMAT)
+ {
+ FILE * fp1, * fp2;
+ string s, q, tag_line1, tag_line2;
+ char id1 [MAX_LINE], id2 [MAX_LINE];
+
+ fp1 = File_Open (Input_File_1, "r");
+ fp2 = File_Open (Input_File_2, "r");
+
+ while (Fasta_Read (fp1, s, tag_line1))
+ {
+ char * p1, * p2;
+ int len;
+
+ Fasta_Qual_Read (fp2, q, tag_line2);
+ strcpy (id1, tag_line1 . c_str ());
+ strcpy (id2, tag_line2 . c_str ());
+ p1 = strtok (id1, " \t\n");
+ p2 = strtok (id2, " \t\n");
+ if (strcmp (p1, p2) != 0)
+ {
+ sprintf (Clean_Exit_Msg_Line, "seq id %s doesn't match quality id %s", p1, p2);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+ len = s . length ();
+ if (s . length () != q . length ())
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "seq length %d doesn't match quality length %d",
+ len, int (q . length ()));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ ct ++;
+ read . setClearRange (Range_t(0, len));
+ read . setEID (p1);
+ read . setIID (ct);
+ read . setSequence (s . c_str (), q . c_str ());
+ if ( Compress_Reads )
+ read . compress( );
+ read_bank . append (read);
+ }
+ }
+ fprintf (stderr, "Processed %d reads\n", ct);
+
+ read_bank . close ();
+
+#if 0 // test random access reads from store
+{
+ int i, j;
+
+ read_bank . open (Bank_Name);
+ for (i = 0; i < 10; i ++)
+ {
+ j = 1 + lrand48 () % ct;
+ read_bank . fetch (j, read);
+ cout << read;
+ }
+ read_bank . close ();
+}
+#endif
+
+ } catch ( Exception_t & e ) {
+ cerr << "ERROR: " << e . what( ) << endl;
+ return 1;
+ }
+
+ return 0;
+ }
+
+
+
+static void Parse_Command_Line
+ (int argc, char * argv [])
+
+// Get options and parameters from command line with argc
+// arguments in argv [0 .. (argc - 1)] .
+
+ {
+ bool errflg = false;
+ int ch;
+
+ optarg = NULL;
+
+ while (! errflg && ((ch = getopt (argc, argv, "cCfsh")) != EOF))
+ switch (ch)
+ {
+ case 'c' :
+ Create_New_Bank = true;
+ break;
+
+ case 'C' :
+ Input_Format = CELERA_MSG_FORMAT;
+ break;
+
+ case 'f' :
+ Force_New_Bank = true;
+ break;
+
+ case 's' :
+ Compress_Reads = true;
+ break;
+
+ case 'h' :
+ errflg = true;
+ break;
+
+ case '?' :
+ fprintf (stderr, "Unrecognized option -%c\n", optopt);
+
+ default :
+ errflg = true;
+ }
+
+ if (errflg)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ if (Input_Format == CELERA_MSG_FORMAT && optind > argc - 2)
+ {
+ fprintf (stderr, "ERROR: Must specify bank name and .frg file\n");
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+ if (Input_Format == FASTA_FORMAT && optind > argc - 3)
+ {
+ fprintf (stderr, "ERROR: Must specify bank name, seq and qual files\n");
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ Bank_Name = argv [optind ++];
+ Input_File_1 = argv [optind ++];
+ if (Input_Format == FASTA_FORMAT)
+ Input_File_2 = argv [optind ++];
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ ".USAGE.\n"
+ " %s <bank-name> <input-file[s]>\n"
+ "\n"
+ ".DESCRIPTION.\n"
+ " Add reads from specified file(s) to the readbank\n"
+ " <bank-name>. Default input format is fasta which\n"
+ " is two separate files (sequence and quality).\n"
+ " If Celera msg format is used, then only one file is\n"
+ " specified.\n"
+ "\n"
+ ".OPTIONS.\n"
+ " -c Create a new read bank\n"
+ " -C Input is Celera msg format, i.e., a .frg file\n"
+ " -f Force new read bank by deleting existing one first\n"
+ " -s Compress reads in the Bank, only allows chars ACGTN\n"
+ " -h Print this usage message\n"
+ "\n"
+ ".KEYWORDS.\n"
+ " amos bank, reads\n",
+ command);
+
+ return;
+ }
diff --git a/src/Bank/listGCContent.cc b/src/Bank/listGCContent.cc
new file mode 100644
index 0000000..2e68d96
--- /dev/null
+++ b/src/Bank/listGCContent.cc
@@ -0,0 +1,269 @@
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <unistd.h>
+using namespace std;
+using namespace AMOS;
+
+
+//=============================================================== Globals ====//
+string OPT_BankName;
+bool OPT_BankSpy = false;
+bool OPT_UseEIDs = false;
+bool OPT_DumpContigs = false;
+bool OPT_UseRaw = false;
+
+
+string OPT_IIDFile; // Filename of IIDs to dump
+string OPT_EIDFile; // Filename of EIDs to dump
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+void dumpRead(Read_t & red)
+{
+ Range_t rng = red.getClearRange();
+
+ if (OPT_UseRaw)
+ {
+ rng.begin = 0;
+ rng.end = red.getLength();
+ }
+
+ if (OPT_UseEIDs)
+ {
+ printf("%s\t%0.06f\n", red.getEID().c_str(), red.getGCContent(rng));
+ }
+ else
+ {
+ printf("%d\t%0.06f\n", red.getIID(), red.getGCContent(rng));
+ }
+}
+
+void dumpContig(Contig_t & ctg)
+{
+ if (OPT_UseEIDs)
+ {
+ printf("%s\t%0.06f\n", ctg.getEID().c_str(), ctg.getGCContent());
+ }
+ else
+ {
+ printf("%d\t%0.06f\n", ctg.getIID(), ctg.getGCContent());
+ }
+}
+
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+ BankStream_t red_bank(Read_t::NCODE);
+ BankStream_t ctg_bank(Contig_t::NCODE);
+ Read_t red;
+ Contig_t ctg;
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try
+ {
+ int mode = B_READ;
+ if (OPT_BankSpy) { mode = B_SPY; }
+
+ if (OPT_DumpContigs)
+ {
+ ctg_bank.open(OPT_BankName, mode);
+ }
+ else
+ {
+ red_bank.open (OPT_BankName, mode);
+ }
+
+ ifstream file;
+ string id;
+
+ if (!OPT_EIDFile.empty())
+ {
+ // Dump just the specified list of EIDs
+ file.open(OPT_EIDFile.c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open EID File",
+ __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ if (OPT_DumpContigs)
+ {
+ ctg_bank.fetch(id, ctg);
+ dumpContig(ctg);
+ }
+ else
+ {
+ red_bank.fetch(id, red);
+ dumpRead(red);
+ }
+ }
+ }
+ else if (!OPT_IIDFile.empty())
+ {
+ // Dump just the specified list of EIDs
+ file.open(OPT_IIDFile.c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open IID File",
+ __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ ID_t iid = atoi(id.c_str());
+ if (OPT_DumpContigs)
+ {
+ ctg_bank.fetch(iid, ctg);
+ dumpContig(ctg);
+ }
+ else
+ {
+ red_bank.fetch(iid, red);
+ dumpRead(red);
+ }
+ }
+ }
+ else
+ {
+ //-- Iterate through each object in the bank
+ if (OPT_DumpContigs)
+ {
+ while (ctg_bank >> ctg)
+ {
+ dumpContig(ctg);
+ }
+ }
+ else
+ {
+ while (red_bank >> red)
+ {
+ dumpRead(red);
+ }
+ }
+ }
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hsverCE:I:")) != EOF) )
+ switch (ch)
+ {
+ case 'e': OPT_UseEIDs = true; break;
+ case 'E': OPT_EIDFile = optarg; break;
+ case 'I': OPT_IIDFile = optarg; break;
+ case 'r': OPT_UseRaw = true; break;
+ case 'C': OPT_DumpContigs = true; break;
+
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 's': OPT_BankSpy = true; break;
+
+ case 'v':
+ PrintBankVersion (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ default:
+ errflg ++;
+ }
+
+ if ( errflg > 0 || optind != argc - 1 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_BankName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+
+ cerr << "\n.DESCRIPTION.\n"
+ << " Prints the GC Content of reads or contigs to stdout\n"
+ << "\n.OPTIONS.\n"
+ << " -h Display help information\n"
+ << " -s Disregard bank locks and write permissions (spy mode)\n"
+ << " -v Display the compatible bank version\n"
+ << " -e Use EIDs instead of IIDs for identifiers\n"
+ << " -r Ignore clear range and dump entire sequence\n"
+ << " -C Dump Contigs instead of reads\n"
+ << " -E file Dump just the eids listed in file\n"
+ << " -I file Dump just the iids listed in file\n"
+ << "\n.KEYWORDS.\n"
+ << " amos bank, GC content\n"
+ << endl;
+
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr << "\n.USAGE.\n" << " " << s << " [options] -b <bank path>\n";
+ return;
+}
diff --git a/src/Bank/listReadPlacedStatus.cc b/src/Bank/listReadPlacedStatus.cc
new file mode 100644
index 0000000..53b2949
--- /dev/null
+++ b/src/Bank/listReadPlacedStatus.cc
@@ -0,0 +1,217 @@
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <cassert>
+#include <unistd.h>
+using namespace std;
+using namespace AMOS;
+
+
+//=============================================================== Globals ====//
+string OPT_BankName;
+bool OPT_BankSpy = false;
+
+bool OPT_Singletons = false;
+bool OPT_Dups = false;
+bool OPT_Placed = false;
+
+bool OPT_JustEID = false;
+bool OPT_JustIID = false;
+
+
+void ParseArgs (int argc, char ** argv);
+void PrintHelp (const char * s);
+void PrintUsage (const char * s);
+
+
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+
+ HASHMAP::hash_map<ID_t, vector<ID_t> > readdups;
+ HASHMAP::hash_map<ID_t, vector<ID_t> >::iterator rdi;
+
+ Contig_t contig;
+
+ BankStream_t ctg_bank (Contig_t::NCODE);
+ BankStream_t red_bank (Read_t::NCODE);
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try
+ {
+ BankMode_t bm = OPT_BankSpy ? B_SPY : B_READ;
+ ctg_bank.open (OPT_BankName, bm);
+ red_bank.open(OPT_BankName, bm);
+
+ while (ctg_bank >> contig)
+ {
+ ID_t ciid = contig.getIID();
+ vector<Tile_t> & rtiling = contig.getReadTiling();
+ vector<Tile_t>::const_iterator ti;
+
+ if ( rtiling.size() > 1 ) // only count non-singleton contigs
+ for (ti = rtiling.begin(); ti != rtiling.end(); ti++)
+ {
+ rdi = readdups.find(ti->source);
+ if (rdi == readdups.end())
+ {
+ rdi = readdups.insert
+ (make_pair(ti->source, vector<ID_t>())).first;
+ }
+
+ rdi->second.push_back(ciid);
+ }
+ }
+
+ AMOS::IDMap_t::const_iterator ri;
+ for (ri = red_bank.getIDMap().begin();
+ ri;
+ ri++)
+ {
+ int numcontigs = 0;
+ char code = 'S';
+ rdi = readdups.find(ri->iid);
+
+ if (rdi == readdups.end())
+ {
+ if (OPT_Singletons)
+ {
+ if (OPT_JustEID) { cout << ri->eid << endl; }
+ else if (OPT_JustIID) { cout << ri->iid << endl; }
+ else
+ {
+ cout << ri->iid << "\t"
+ << ri->eid << "\t"
+ << code << "\t"
+ << numcontigs
+ << endl;
+ }
+ }
+ }
+ else
+ {
+ numcontigs = rdi->second.size();
+
+ if (numcontigs == 1) { code = 'P'; }
+ else { code = 'D'; }
+
+ if ((OPT_Placed && numcontigs == 1) ||
+ (OPT_Dups && numcontigs > 1))
+ {
+ if (OPT_JustEID) { cout << ri->eid << endl; }
+ else if (OPT_JustIID) { cout << ri->iid << endl; }
+ else
+ {
+ cout << ri->iid << "\t"
+ << ri->eid << "\t"
+ << code << "\t"
+ << numcontigs;
+
+ vector<ID_t>::iterator vi;
+ for (vi = rdi->second.begin(); vi != rdi->second.end(); vi++)
+ {
+ cout << "\t" << *vi;
+ }
+
+ cout << endl;
+ }
+ }
+ }
+ }
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+
+ return exitcode;
+}
+
+
+
+
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hsvSDPEI")) != EOF) )
+ switch (ch)
+ {
+ case 'h': PrintHelp (argv[0]); exit (EXIT_SUCCESS); break;
+ case 'v': PrintBankVersion (argv[0]); exit (EXIT_SUCCESS); break;
+ case 's': OPT_BankSpy = true; break;
+
+ case 'S': OPT_Singletons = true; break;
+ case 'D': OPT_Dups = true; break;
+ case 'P': OPT_Placed = true; break;
+
+ case 'E': OPT_JustEID = true; break;
+ case 'I': OPT_JustIID = true; break;
+
+ default:
+ errflg ++;
+ }
+
+ if (errflg > 0 || optind != argc - 1)
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_BankName = argv [optind ++];
+
+ if (!OPT_Singletons && !OPT_Dups && !OPT_Placed)
+ {
+ OPT_Singletons = OPT_Dups = OPT_Placed = true;
+ }
+}
+
+
+
+
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+
+ cerr << "\n.DESCRIPTION.\n"
+ << " Prints the status and containing contig(s) of each read as:\n"
+ << " iid eid code numcontigs contig iid list\n"
+ << "\n"
+ << " Codes are:\n"
+ << " S: Singleton read\n"
+ << " P: Placed in a single contig\n"
+ << " D: Placed in multiple contigs\n"
+ << "\n.OPTIONS.\n"
+ << " -h Display help information\n"
+ << " -s Disregard bank locks and write permissions (spy mode)\n"
+ << " -v Display the compatible bank version\n"
+ << "\n"
+ << " -S Just list singleton reads\n"
+ << " -D Just list duplicate reads\n"
+ << " -P Just list placed reads\n"
+ << "\n"
+ << " -E Just list read EIDs\n"
+ << " -I Just list read IIDs\n"
+ << "\n.KEYWORDS.\n"
+ << " amos bank, reads\n"
+ << endl;
+
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr << "\n.USAGE.\n" << " " << s << " [options] -b <bank path>\n";
+ return;
+}
diff --git a/src/Bank/load-overlaps.cc b/src/Bank/load-overlaps.cc
new file mode 100644
index 0000000..f6fa68f
--- /dev/null
+++ b/src/Bank/load-overlaps.cc
@@ -0,0 +1,502 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 04/30/2004
+//!
+//! Build overlaps from mummer alignment data
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "delta.hh"
+#include <list>
+#include <map>
+#include <algorithm>
+#include <iostream>
+#include <cassert>
+#include <unistd.h>
+using namespace std;
+using namespace AMOS;
+
+
+
+//=============================================================== Options ====//
+string OPT_BankName; // bank name parameter
+string OPT_AlignName; // alignment name parameter
+
+int OPT_MaxTrimLen = 20; // maximum ignorable trim length
+
+float OPT_MinIdentity = 90.0; // minimum overlap identity
+
+
+//============================================================= Constants ====//
+const char FORWARD_CHAR = '+';
+const char REVERSE_CHAR = '-';
+
+
+struct Align_t
+{
+ ID_t idB;
+ char oriB;
+ long int lo, hi, loB, hiB;
+ float idy;
+};
+
+struct ReadAlign_t
+{
+ ID_t id;
+ long int len;
+
+ vector<Align_t *> all;
+
+ ~ReadAlign_t ( )
+ {
+ vector<Align_t *>::iterator api;
+ for ( api = all . begin( ); api != all . end( ); api ++ )
+ delete (*api);
+ }
+};
+
+struct Mapping_t
+{
+ map<ID_t, ReadAlign_t *> reads;
+
+ ~Mapping_t ( )
+ {
+ map<ID_t, ReadAlign_t *>::iterator rapi;
+ for ( rapi = reads . begin( ); rapi != reads . end( ); rapi ++ )
+ delete (rapi -> second);
+ }
+};
+
+struct Overlaps_t
+{
+ list<Overlap_t *> ovls;
+
+ ~Overlaps_t ( )
+ {
+ list<Overlap_t *>::iterator opi;
+ for ( opi = ovls . begin( ); opi != ovls . end( ); opi ++ )
+ delete (*opi);
+ }
+};
+
+struct OverlapCmp_t
+{
+ bool operator( ) (const Overlap_t * A, const Overlap_t * B)
+ {
+ if ( A -> getReads( ) . first < B -> getReads( ) . first )
+ return true;
+ else
+ return false;
+ }
+};
+
+
+//========================================================== Fuction Decs ====//
+long int lmin (long int a, long int b)
+{ return (a < b ? a : b); }
+
+long int lmax (long int a, long int b)
+{ return (a < b ? b : a); }
+
+
+//---------------------------------------------------------- LoadOverlaps ----//
+//! \brief Uploads the overlaps into the AMOS bank
+//!
+//! \return void
+//!
+void LoadOverlaps (const Overlaps_t & overlaps);
+
+
+//--------------------------------------------------------------- Overlap ----//
+//! \brief Get the overlaps
+//!
+//! \post overlaps are sorted by read A ID
+//! \return void
+//!
+void Overlap (Mapping_t & mapping, Overlaps_t & overlaps);
+
+
+//------------------------------------------------------------ ParseAlign ----//
+//! \brief Parse, sort and store the alignment input
+//!
+//! \return void
+//!
+void ParseAlign (Mapping_t & mapping);
+
+
+//------------------------------------------------------------- PrintOVL -----//
+//! \brief Prints the overlaps to stdout
+//!
+//! \param overlaps The overlaps
+//! \return void
+//!
+void PrintOVL (const Overlaps_t & overlaps);
+
+
+//------------------------------------------------------------- ParseArgs ----//
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//------------------------------------------------------------- PrintHelp ----//
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//------------------------------------------------------------ PrintUsage ----//
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+//========================================================== Inline Funcs ====//
+//------------------------------------------------------------- IsOverlap ----//
+bool IsOverlap (const ReadAlign_t * A,
+ const ReadAlign_t * B,
+ const Align_t * cand)
+{
+ return (
+ (cand -> idy >= OPT_MinIdentity)
+ &&
+ (cand -> lo <= OPT_MaxTrimLen ||
+ cand -> loB <= OPT_MaxTrimLen)
+ &&
+ (cand -> hi + OPT_MaxTrimLen > A -> len ||
+ cand -> hiB + OPT_MaxTrimLen > B -> len)
+ );
+}
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ Mapping_t mapping;
+ Overlaps_t overlaps;
+
+ //-- COMMAND
+ ParseArgs (argc, argv); // parse the command line arguments
+
+ //-- INPUT
+ ParseAlign (mapping); // parse the alignment data
+
+ //-- OVERLAP
+ Overlap (mapping, overlaps);
+
+ //-- OUTPUT
+ // PrintOVL (overlaps);
+
+ //-- UPLOAD
+ LoadOverlaps (overlaps);
+
+ return EXIT_SUCCESS;
+}
+
+
+
+
+//---------------------------------------------------------- LoadOverlaps ----//
+void LoadOverlaps (const Overlaps_t & overlaps)
+{
+ BankStream_t ovl_bank (Overlap_t::NCODE);
+ list<Overlap_t *>::const_iterator opi;
+
+ try {
+ if ( ovl_bank . exists (OPT_BankName) )
+ ovl_bank . open (OPT_BankName);
+ else
+ ovl_bank . create (OPT_BankName);
+
+ //-- Upload da overlaps
+ for ( opi = overlaps . ovls . begin( );
+ opi != overlaps . ovls . end( ); opi ++ )
+ ovl_bank << **opi;
+
+ ovl_bank . close( );
+ }
+ catch (Exception_t & e) {
+
+ //-- On error, print debugging information
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ exit (EXIT_FAILURE);
+ }
+}
+
+
+
+
+//--------------------------------------------------------------- Overlap ----//
+void Overlap (Mapping_t & mapping, Overlaps_t & overlaps)
+{
+ list<Overlap_t *>::iterator opi;
+ vector<Align_t *>::iterator api;
+ map<ID_t, ReadAlign_t *>::iterator rmpiA, rmpiB;
+ ReadAlign_t * rapA, * rapB;
+ Align_t * ap;
+ Overlap_t * op;
+ pair<ID_t, ID_t> idp;
+
+ //-- For each read, get it's overlaps
+ for ( rmpiA = mapping . reads . begin( );
+ rmpiA != mapping . reads . end( ); rmpiA ++ )
+ {
+ rapA = rmpiA -> second;
+
+ //-- For each alignment
+ for ( api = rapA -> all . begin( );
+ api != rapA -> all . end( ); api ++ )
+ {
+ ap = *api;
+
+ rmpiB = mapping . reads . find (ap -> idB);
+ assert ( rmpiB != mapping . reads . end( ));
+ rapB = rmpiB -> second;
+
+ //-- If an overlap
+ if ( IsOverlap (rapA, rapB, ap) )
+ {
+ overlaps . ovls . push_back (new Overlap_t( ));
+ op = overlaps . ovls . back( );
+
+ op -> setReads (make_pair (rapA -> id, rapB -> id));
+
+ if ( ap -> oriB == FORWARD_CHAR )
+ op -> setAdjacency (Overlap_t::NORMAL);
+ else
+ op -> setAdjacency (Overlap_t::INNIE);
+
+ op -> setAhang (ap->lo - ap->loB);
+ op -> setBhang ((rapB->len - ap->hiB) - (rapA->len - ap->hi));
+ }
+ }
+ }
+
+ //-- Sort by read A
+ overlaps . ovls . sort (OverlapCmp_t( ));
+
+ //-- Remove redundant overlaps, all overlaps where idB <= idA
+ opi = overlaps . ovls . begin( );
+ while ( opi != overlaps . ovls . end( ) )
+ {
+ idp = (*opi) -> getReads( );
+ if ( idp . second <= idp . first )
+ {
+ delete (*opi);
+ opi = overlaps . ovls . erase (opi);
+ }
+ else
+ opi ++;
+ }
+}
+
+
+
+
+//------------------------------------------------------------ ParseAlign ----//
+void ParseAlign (Mapping_t & mapping)
+{
+ bool insret;
+ DeltaReader_t dr;
+ ID_t id, idB;
+ stringstream ss;
+ ReadAlign_t * rap;
+ Align_t * ap;
+ vector<DeltaAlignment_t>::const_iterator dai;
+
+ dr . open (OPT_AlignName);
+
+ rap = NULL;
+
+ //-- Process the delta input
+ while ( dr . readNextHeadersOnly( ) )
+ {
+ ss . str (dr . getRecord( ) . idR);
+ ss >> idB;
+ assert (!ss . fail( ));
+ ss . clear( );
+
+ ss . str (dr . getRecord( ) . idQ);
+ ss >> id;
+ assert (!ss . fail( ));
+ ss . clear( );
+
+ //-- If a new read, push it
+ if ( rap == NULL || id != rap -> id )
+ {
+ rap = new ReadAlign_t( );
+ insret = (mapping . reads . insert (make_pair (id, rap))) . second;
+ assert (insret);
+
+ rap -> id = id;
+ rap -> len = dr . getRecord( ) . lenQ;
+ }
+
+ //-- For all the alignments in this record
+ for ( dai = dr . getRecord( ) . aligns . begin( );
+ dai != dr . getRecord( ) . aligns . end( ); dai ++ )
+ {
+ rap -> all . push_back (new Align_t( ));
+ ap = rap -> all . back( );
+
+ ap -> idB = idB;
+ ap -> idy = dai -> idy;
+
+ //-- Force ascending coordinates
+ if ( dai -> sQ < dai -> eQ )
+ {
+ ap -> lo = dai -> sQ;
+ ap -> hi = dai -> eQ;
+ }
+ else
+ {
+ ap -> lo = dai -> eQ;
+ ap -> hi = dai -> sQ;
+ }
+
+ if ( (dai -> sQ < dai -> eQ && dai -> sR < dai -> eR) ||
+ (dai -> sQ > dai -> eQ && dai -> sR > dai -> eR) )
+ {
+ ap -> oriB = FORWARD_CHAR;
+ if ( dai -> sR < dai -> eR )
+ {
+ ap -> loB = dai -> sR;
+ ap -> hiB = dai -> eR;
+ }
+ else
+ {
+ ap -> loB = dai -> eR;
+ ap -> hiB = dai -> sR;
+ }
+ }
+ else
+ {
+ ap -> oriB = REVERSE_CHAR;
+ if ( dai -> sR < dai -> eR )
+ {
+ ap -> loB = RevComp1 (dai -> eR, dr . getRecord( ) . lenR);
+ ap -> hiB = RevComp1 (dai -> sR, dr . getRecord( ) . lenR);
+ }
+ else
+ {
+ ap -> loB = RevComp1 (dai -> sR, dr . getRecord( ) . lenR);
+ ap -> hiB = RevComp1 (dai -> eR, dr . getRecord( ) . lenR);
+ }
+ }
+ }
+ }
+
+ dr . close( );
+}
+
+
+
+
+//------------------------------------------------------------- PrintOVL -----//
+void PrintOVL (const Overlaps_t & overlaps)
+{
+ list<Overlap_t *>::const_iterator opi;
+ Message_t msg;
+
+ for ( opi = overlaps . ovls . begin( );
+ opi != overlaps . ovls . end( ); opi ++ )
+ {
+ (*opi) -> writeMessage (msg);
+ msg . write (cout);
+ }
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg &&
+ ((ch = getopt (argc, argv, "b:hi:t:")) != EOF) )
+ switch (ch)
+ {
+ case 'b':
+ OPT_BankName = optarg;
+ break;
+
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'i':
+ OPT_MinIdentity = atof (optarg);
+ break;
+
+ case 't':
+ OPT_MaxTrimLen = atoi (optarg);
+ break;
+
+ default:
+ errflg ++;
+ }
+
+ if ( OPT_BankName . empty( ) )
+ {
+ cerr << "ERROR: The -b option is mandatory\n";
+ errflg ++;
+ }
+
+ if ( errflg > 0 || optind != argc - 1 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_AlignName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "-b path Set path of the AMOS bank to populate\n"
+ << "-h Display help information\n"
+ << "-i float Set the minimum alignment identity, default "
+ << OPT_MinIdentity << endl
+ << "-t uint Set maximum ignorable trim length, default "
+ << OPT_MaxTrimLen << endl
+ << endl;
+
+ cerr
+ << " Populate overlap store based on the all vs. all alignment\n"
+ << "of sequencing reads.\n\n";
+
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr
+ << "\nUSAGE: " << s << " [options] -b <bank path> <deltafile>\n\n";
+ return;
+}
diff --git a/src/Bank/loadFeatures.cc b/src/Bank/loadFeatures.cc
new file mode 100644
index 0000000..39c550e
--- /dev/null
+++ b/src/Bank/loadFeatures.cc
@@ -0,0 +1,220 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+
+
+using namespace AMOS;
+using namespace std;
+
+int DEBUG = 0;
+int LOAD = 1;
+
+int main (int argc, char ** argv)
+{
+ AMOS_Foundation * tf = NULL;
+ int retval = 0;
+
+ Contig_t contig;
+ ID_t contigloaded = 0;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"\n"
+".USAGE.\n"
+" loadFeatures [options] bankname featfile\n"
+"\n.DESCRIPTION.\n"
+" Load features into a bank.\n"
+" Format of featfile is:\n"
+" contigeid type end5 end3 [comment]\n"
+"\n"
+" contigeid is the contig which has the feature\n"
+" type is the single character feature type. \n"
+" end5 and end3 are the coordinates of the feature\n"
+" [comment] is an optional comment string describing the feature\n"
+"\n"
+" Standard types are: \n"
+" (B)reakpoint\n"
+" (C)overage\n"
+" (O)rf\n"
+" (S)NP\n"
+" (U)nitig\n"
+"\n"
+".OPTIONS.\n"
+" -u Coordinates are ungapped\n"
+" -i Contigid is the IID\n"
+"\n.KEYWORDS.\n"
+" amos bank, features"
+"\n";
+
+ int CONVERTUNGAPPED = 0;
+ int USEIID = 0;
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+ tf->getOptions()->addOptionResult("u", &CONVERTUNGAPPED);
+ tf->getOptions()->addOptionResult("i", &USEIID);
+ tf->getOptions()->addOptionResult("d", &DEBUG);
+
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() != 2)
+ {
+ cerr << "Usage: loadFeatures [options] bankname featfile" << endl;
+ return 0;
+ }
+
+
+ Bank_t contig_bank(Contig_t::NCODE);
+ Bank_t feat_bank(Feature_t::NCODE);
+ ifstream features;
+
+ string bank_name = argvv.front(); argvv.pop_front();
+ string feat_file = argvv.front(); argvv.pop_front();
+
+ cerr << "Loading features from " << feat_file << " into " << bank_name << endl;
+
+ Range_t range;
+
+ features.open(feat_file.c_str());
+
+ if (!features)
+ {
+ AMOS_THROW_IO("Couldn't open feature file " + feat_file);
+ }
+
+ contig_bank.open(bank_name);
+ if (feat_bank.exists(bank_name))
+ {
+ feat_bank.open(bank_name);
+ }
+ else
+ {
+ feat_bank.create(bank_name);
+ }
+
+ string eid;
+ int end3;
+ int end5;
+ string count;
+ string density;
+ char type;
+
+
+ int featurecount = 0;
+
+ while (features >> eid
+ >> type
+ >> end5
+ >> end3)
+ {
+ string comment;
+ char delim;
+ features.get(delim);
+
+ if (delim != '\n')
+ {
+ getline(features, comment);
+ }
+
+ range.begin = end5;
+ range.end = end3;
+
+ Feature_t feat;
+ feat.setType(type);
+ feat.setRange(range);
+ feat.setComment(comment);
+
+
+ if (DEBUG)
+ {
+ cerr << "contigeid: " << eid << endl
+ << "type: " << type << endl
+ << "range: " << end5 << "," << end3 << endl
+ << "coment: \"" << comment << "\"" << endl << endl;
+ }
+
+ if (LOAD)
+ {
+ ID_t iid;
+
+ if (USEIID)
+ {
+ iid = atoi(eid.c_str());
+
+ if (!contig_bank.existsIID(iid))
+ {
+ iid = AMOS::NULL_ID;
+ }
+ }
+ else
+ {
+ iid = contig_bank.lookupIID(eid);
+ }
+
+ if (iid != AMOS::NULL_ID)
+ {
+ if (CONVERTUNGAPPED)
+ {
+ if (iid != contigloaded)
+ {
+ contig_bank.fetch(iid, contig);
+ contigloaded = iid;
+ }
+
+ range.begin = contig.ungap2gap(range.begin);
+ range.end = contig.ungap2gap(range.end);
+ feat.setRange(range);
+ }
+
+ feat.setSource(std::make_pair(iid, Contig_t::NCODE));
+ feat_bank.append(feat);
+ featurecount++;
+ cerr << ".";
+ }
+ else
+ {
+ cerr << "WARNING: Contig " << eid << " not found, skipping" << endl;
+ }
+ }
+ }
+
+ cerr << endl
+ << "Loaded " << featurecount << " features" << endl;
+
+ contig_bank.close();
+ feat_bank.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ return retval;;
+}
diff --git a/src/Bank/normalizeScaffold.cc b/src/Bank/normalizeScaffold.cc
new file mode 100644
index 0000000..03f6cd5
--- /dev/null
+++ b/src/Bank/normalizeScaffold.cc
@@ -0,0 +1,224 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+using namespace AMOS;
+using namespace std;
+
+string OPT_BankName;
+
+string OPT_EIDFile;
+string OPT_IIDFile;
+string OPT_scaffeid;
+int OPT_scaffiid;
+
+void PrintUsage (const char * s)
+{
+ cerr << "\nUSAGE: " << s << " [options] <bank path>\n\n";
+}
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage(s);
+ cerr << "-h Display help information\n"
+ << "-v Display the compatible bank version\n"
+ << "-E file Just normalize the scaffolds eids listed in file\n"
+ << "-I file Just normalize the scaffolds iids listed in file\n\n"
+ << "-e eid Just normalize the specified scaffold eid\n"
+ << "-i iid Just normalize the specified scaffold iid\n"
+ << endl;
+
+ cerr << "Normalizes the scaffolds in a AMOS bank by ensuring all of the\n"
+ << "contigs are forward oriented. Also fixes contig features, but not\n"
+ << "contig links\n"
+ << endl;
+}
+
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hvE:I:e:i:")) != EOF) )
+ {
+ switch (ch)
+ {
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'v':
+ PrintBankVersion (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'E': OPT_EIDFile = optarg; break;
+ case 'I': OPT_IIDFile = optarg; break;
+ case 'i': OPT_scaffiid = atoi(optarg); break;
+ case 'e': OPT_scaffeid = optarg; break;
+
+ default: errflg ++;
+ }
+ }
+
+ if ( errflg > 0 || optind != argc - 1 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_BankName = argv [optind];
+}
+
+
+map<ID_t, int> contigFeaturesToFlip;
+
+
+bool normalizeScaffold(Scaffold_t & scaff, Bank_t & contig_bank)
+{
+ bool changed = false;
+ vector<Tile_t> & contigs = scaff.getContigTiling();
+ vector<Tile_t>::iterator ci;
+
+ sort(contigs.begin(), contigs.end(), TileOrderCmp());
+
+ for (ci = contigs.begin(); ci != contigs.end(); ci++)
+ {
+ if (ci->range.isReverse())
+ {
+ Contig_t contig;
+ contig_bank.fetch(ci->source, contig);
+
+ cerr << "Flipping ciid: " << ci->source
+ << " ceid: " << contig.getEID()
+ << endl;
+
+ ci->range.swap();
+ contig.reverseComplement();
+
+ contig_bank.replace(ci->source, contig);
+
+ changed = true;
+ contigFeaturesToFlip.insert(make_pair(ci->source, contig.getLength()));
+ }
+ }
+
+ return changed;
+}
+
+
+
+
+int main (int argc, char ** argv)
+{
+ ParseArgs (argc, argv);
+
+ Bank_t scaff_bank(Scaffold_t::NCODE);
+ Bank_t contig_bank(Contig_t::NCODE);
+ BankStream_t feat_bank(Feature_t::NCODE);
+
+ cerr << "Processing " << OPT_BankName << " at " << Date() << endl;
+
+ try
+ {
+ scaff_bank.open(OPT_BankName, B_READ | B_WRITE);
+ contig_bank.open(OPT_BankName, B_READ | B_WRITE);
+
+ Scaffold_t scaffold;
+ ifstream file;
+ string id;
+
+ if (!OPT_scaffeid.empty()) { OPT_scaffiid = scaff_bank.lookupIID(OPT_scaffeid); }
+
+ if (OPT_scaffiid)
+ {
+ scaff_bank.fetch(OPT_scaffiid, scaffold);
+ bool changed = normalizeScaffold(scaffold, contig_bank);
+ if (changed) { scaff_bank.replace(OPT_scaffiid, scaffold); }
+ }
+ else if (!OPT_EIDFile.empty())
+ {
+ file.open(OPT_EIDFile.c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open EID File", __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ scaff_bank.fetch(id, scaffold);
+ bool changed = normalizeScaffold(scaffold, contig_bank);
+ if (changed) { scaff_bank.replace(id, scaffold); }
+ }
+ }
+ else if (!OPT_IIDFile.empty())
+ {
+ file.open(OPT_IIDFile.c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open IID File", __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ scaff_bank.fetch(atoi(id.c_str()), scaffold);
+ bool changed = normalizeScaffold(scaffold, contig_bank);
+ if (changed) { scaff_bank.replace(scaffold.getIID(), scaffold); }
+ }
+ }
+ else
+ {
+ AMOS::IDMap_t::const_iterator si;
+ for (si = scaff_bank.getIDMap().begin(); si; si++)
+ {
+ scaff_bank.fetch(si->iid, scaffold);
+ bool changed = normalizeScaffold(scaffold, contig_bank);
+ if (changed) { scaff_bank.replace(scaffold.getIID(), scaffold); }
+ }
+ }
+
+ if (!contigFeaturesToFlip.empty())
+ {
+ Feature_t feat;
+
+ feat_bank.open(OPT_BankName, B_READ | B_WRITE);
+
+ while (feat_bank >> feat)
+ {
+ ID_t bid = feat_bank.tellg()-1;
+ if (feat.getSource().second == Contig_t::NCODE)
+ {
+ map<ID_t, int>::iterator mi = contigFeaturesToFlip.find(feat.getSource().first);
+
+ if (mi != contigFeaturesToFlip.end())
+ {
+ Range_t rng = feat.getRange();
+ rng.begin = mi->second - rng.begin - 1;
+ rng.end = mi->second - rng.end - 1;
+
+ feat.setRange(rng);
+ }
+
+ feat_bank.replaceByBID(bid, feat);
+ }
+ }
+ }
+
+ feat_bank.close();
+ contig_bank.close();
+ scaff_bank.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return EXIT_SUCCESS;
+}
diff --git a/src/Bank/partitionBank.cc b/src/Bank/partitionBank.cc
new file mode 100755
index 0000000..1427c08
--- /dev/null
+++ b/src/Bank/partitionBank.cc
@@ -0,0 +1,218 @@
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <getopt.h>
+#include <map>
+#include <set>
+#include <list>
+#include <functional>
+#include "foundation_AMOS.hh"
+
+using namespace std;
+using namespace AMOS;
+using namespace HASHMAP;
+
+map<string, string> globals; // global variables
+
+void printHelpText()
+{
+ cerr <<
+ "\n"
+ "Partition a bank into <bank name>_1..N"
+ "\n"
+ "USAGE:\n"
+ "\n"
+ "partition-bank -b[ank] <bank_name> <-partitions N>\n"
+ << endl;
+}
+
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"partitions", 1, 0, 'p'},
+ {0, 0, 0, 0}
+ };
+
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -
+ 1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ break;
+ case 'b':
+ globals["bank"] = string(optarg);
+ break;
+ case 'p':
+ globals["partitions"] = string(optarg);
+ break;
+ case '?':
+ return false;
+ }
+ }
+
+ return true;
+} // GetOptions
+
+void closeBanks(Bank_t &library_bank, Bank_t &frag_bank, Bank_t &red_bank, Bank_t &layout_bank) {
+ if (layout_bank.isOpen())
+ layout_bank.close();
+ if (frag_bank.isOpen())
+ frag_bank.close();
+ if (library_bank.isOpen())
+ library_bank.close();
+ if (red_bank.isOpen())
+ red_bank.close();
+}
+
+// --------------------------------------------------------------------
+// --------------------------------------------------------------------
+int main(int argc, char **argv)
+{
+ ID_t LinkId = 0; // link IIDs
+
+ if (!GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ if (globals.find("bank") == globals.end()){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ Bank_t library_bank (Library_t::NCODE);
+ Bank_t read_bank (Read_t::NCODE);
+ BankStream_t frag_bank (Fragment_t::NCODE);
+ Bank_t layout_bank (Layout_t::NCODE);
+ BankStream_t layout_stream (Layout_t::NCODE);
+
+ try {
+ if (! library_bank.exists(globals["bank"])){
+ cerr << "No library account found in bank " << globals["bank"] << endl;
+ } else {
+ try {
+ library_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open library account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ }
+
+ if (! layout_bank.exists(globals["bank"])){
+ cerr << "No contig account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ layout_bank.open(globals["bank"], B_READ);
+ layout_stream.open(globals["bank"], B_READ);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open contig account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ if (! read_bank.exists(globals["bank"])){
+ cerr << "No read account found in bank " << globals["bank"] << endl;
+ } else {
+ try {
+ read_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open read account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ }
+
+ if (! frag_bank.exists(globals["bank"])){
+ cerr << "No fragment account found in bank " << globals["bank"] << endl;
+ } else {
+ try {
+ frag_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open fragment account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ }
+
+ // figure out how many layout we want to create and then partition the banks
+ ID_t maxLayout = (layout_bank.getSize() / atoi(globals["partitions"].c_str())) + 1;
+ Layout_t lay;
+ uint32_t count = 0;
+ uint32_t partition = 1;
+
+ Bank_t tmp_lib (Library_t::NCODE);
+ Bank_t tmp_frag (Fragment_t::NCODE);
+ Bank_t tmp_read (Read_t::NCODE);
+ Bank_t tmp_layout (Layout_t::NCODE);
+ while (layout_stream >> lay) {
+ if (count % maxLayout == 0) {
+ // create the partitions
+ if (tmp_lib.isOpen()) {
+ closeBanks(tmp_lib, tmp_frag, tmp_read, tmp_layout);
+ }
+ stringstream ss;
+ ss << globals["bank"] << "_partition" << partition << ".bnk";
+ if (tmp_lib.exists(ss.str()) || tmp_frag.exists(ss.str()) || tmp_read.exists(ss.str()) || tmp_layout.exists(ss.str())) {
+ cerr << "Error partition " << ss.str() << " already exists" << endl;
+ exit(1);
+ }
+ tmp_lib.create(ss.str(), B_READ | B_WRITE);
+ tmp_frag.create(ss.str(), B_READ | B_WRITE);
+ tmp_read.create(ss.str(), B_READ | B_WRITE);
+ tmp_layout.create(ss.str(), B_READ | B_WRITE);
+ partition++;
+ }
+
+ // store the object to the bank
+ tmp_layout.append(lay);
+ vector<Tile_t> tiling = lay.getTiling();
+ for (std::vector<Tile_t>::iterator i = tiling.begin(); i != tiling.end(); ++i) {
+ assert(i->source != NULL_ID);
+ // fetch the read, frag, and library if needed
+ Read_t read;
+ read_bank.fetch(i->source, read);
+ if (tmp_read.getIDMap().exists(i->source)) {
+ continue;
+ }
+ tmp_read.append(read);
+ if (read.getFragment() != NULL_ID) {
+ Fragment_t frag;
+ frag_bank.fetch(read.getFragment(), frag);
+ tmp_frag.append(frag);
+
+ if (frag.getLibrary() != NULL_ID) {
+ Library_t lib;
+ library_bank.fetch(frag.getLibrary(), lib);
+ tmp_lib.append(lib);
+ }
+ }
+ }
+
+ count++;
+ }
+ closeBanks(tmp_lib, tmp_frag, tmp_read, tmp_layout);
+
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open fragment account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ layout_stream.close();
+ closeBanks(library_bank, frag_bank, read_bank, layout_bank);
+
+ return(0);
+} // main
diff --git a/src/Bank/renameReads.cc b/src/Bank/renameReads.cc
new file mode 100644
index 0000000..ac57c4e
--- /dev/null
+++ b/src/Bank/renameReads.cc
@@ -0,0 +1,124 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+
+using namespace AMOS;
+using namespace std;
+
+HASHMAP::hash_map<ID_t, ID_t> idmap;
+
+ID_t getNewIID(ID_t oldiid)
+{
+ HASHMAP::hash_map<ID_t, ID_t>::const_iterator idmapiter;
+ idmapiter = idmap.find(oldiid);
+ if (idmapiter != idmap.end())
+ {
+ return idmapiter->second;
+ }
+
+ return oldiid;
+}
+
+
+
+int main(int argc, char ** argv)
+{
+ if (argc != 3)
+ {
+ cerr << "Usage: renameReads bankname oldiid.newiid" << endl;
+ cerr << "Reassigns the iid to reads, updating RED, CTG, and FRG messages"
+ << "and writes back to the bank" << endl;
+
+ return EXIT_FAILURE;
+ }
+
+ Bank_t contig_bank(Contig_t::NCODE);
+ Bank_t read_bank(Read_t::NCODE);
+ Bank_t fragment_bank(Fragment_t::NCODE);
+
+ string bank_name = argv[1];
+ string newidsfile = argv[2];
+
+ cerr << "Loading bank " << bank_name << " at " << Date() << endl;
+
+ try
+ {
+ ifstream file;
+
+ file.open(newidsfile.c_str());
+ if (!file)
+ {
+ throw Exception_t("Couldn't open id map file", __LINE__, __FILE__);
+ }
+
+
+ contig_bank.open(bank_name, B_READ|B_WRITE);
+ read_bank.open(bank_name, B_READ|B_WRITE);
+ fragment_bank.open(bank_name, B_READ|B_WRITE);
+
+ cerr << "Loading iid translation data... ";
+ ID_t oldiid, newiid;
+ while (file >> oldiid >> newiid)
+ {
+ idmap.insert(make_pair(oldiid, newiid));
+ }
+ cerr << idmap.size() << " translations loaded" << endl;
+
+
+ cerr << "Processing reads... ";
+ AMOS::IDMap_t::const_iterator ri;
+ for (ri = read_bank.getIDMap().begin();
+ ri;
+ ri++)
+ {
+ read_bank.assignIID(ri->eid, getNewIID(ri->iid));
+ }
+ cerr << read_bank.getIDMapSize() << " reads processed." << endl;
+
+
+ cerr << "Processing fragments... ";
+ Fragment_t frag;
+ AMOS::IDMap_t::const_iterator fi;
+ for (fi = fragment_bank.getIDMap().begin();
+ fi;
+ fi++)
+ {
+ fragment_bank.fetch(fi->iid, frag);
+ pair<ID_t, ID_t> mtp = frag.getMatePair();
+ frag.setReads(make_pair(getNewIID(mtp.first), getNewIID(mtp.second)));
+ fragment_bank.replace(fi->iid, frag);
+ }
+ cerr << fragment_bank.getIDMapSize() << " fragments processed." << endl;
+
+
+ cerr << "Processing contigs... ";
+ Contig_t contig;
+ AMOS::IDMap_t::const_iterator ci;
+ for (ci = contig_bank.getIDMap().begin();
+ ci;
+ ci++)
+ {
+ contig_bank.fetch(ci->iid, contig);
+ vector<Tile_t> tiling = contig.getReadTiling();
+ vector<Tile_t>::iterator ti;
+ for (ti = tiling.begin();
+ ti != tiling.end();
+ ti++)
+ {
+ ti->source = getNewIID(ti->source);
+ }
+ contig_bank.replace(contig.getIID(), contig);
+ }
+ cerr << contig_bank.getIDMapSize() << " contigs." << endl;
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return EXIT_SUCCESS;
+}
+
diff --git a/src/Bank/resetFragLibrary.cc b/src/Bank/resetFragLibrary.cc
new file mode 100644
index 0000000..7c9e00b
--- /dev/null
+++ b/src/Bank/resetFragLibrary.cc
@@ -0,0 +1,70 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+
+using namespace AMOS;
+using namespace std;
+
+
+
+int main(int argc, char ** argv)
+{
+ if (argc != 3)
+ {
+ cerr << "Usage: updateClrRanges bankname fragid.newlibid" << endl;
+ return EXIT_FAILURE;
+ }
+
+ Bank_t lib_bank(Library_t::NCODE);
+ Bank_t frag_bank(Fragment_t::NCODE);
+ string bank_name = argv[1];
+ string file_name = argv[2];
+
+ int verbose = 0;
+
+ cerr << "Processing " << bank_name << " at " << Date() << endl;
+
+
+ try
+ {
+ frag_bank.open(bank_name, B_READ | B_WRITE);
+ lib_bank.open(bank_name, B_READ);
+
+ FILE * file = fopen(file_name.c_str(), "r");
+
+ if (!file)
+ {
+ cerr << "Can't open file: " << file_name << endl;
+ return EXIT_FAILURE;
+ }
+
+ int fragid, libid;
+ int count = 0;
+
+ Fragment_t frag;
+
+ while(fscanf(file, "%d %d", &fragid, &libid) > 0)
+ {
+ count++;
+
+ frag_bank.fetch(fragid, frag);
+ frag.setLibrary(libid);
+ frag_bank.replace(fragid, frag);
+ }
+
+ cerr << "Updated " << count << " records." << endl;
+
+ lib_bank.close();
+ frag_bank.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/Bank/revScaffold.cc b/src/Bank/revScaffold.cc
new file mode 100644
index 0000000..78b106b
--- /dev/null
+++ b/src/Bank/revScaffold.cc
@@ -0,0 +1,173 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+using namespace AMOS;
+using namespace std;
+
+string OPT_BankName;
+
+string OPT_EIDFile;
+string OPT_IIDFile;
+
+string OPT_scaffeid;
+int OPT_scaffiid;
+
+void PrintUsage (const char * s)
+{
+ cerr << "\nUSAGE: " << s << " [options] <bank path>\n\n";
+}
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage(s);
+ cerr << "-h Display help information\n"
+ << "-v Display the compatible bank version\n"
+ << "\n"
+ << "-e eid Flip scaffold eid\n"
+ << "-i iid Flip scaffold iid\n"
+ << "-E file Flip the scaffolds eids listed in file\n"
+ << "-I file Flip the scaffolds iids listed in file\n\n"
+ << endl;
+
+ cerr << "Reverse the specified scaffold(s) including underlying contigs\n"
+ << "Doesn't update scaffold features, nor contig links\n"
+ << endl;
+}
+
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hvE:I:e:i:")) != EOF) )
+ {
+ switch (ch)
+ {
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'v':
+ PrintBankVersion (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'E': OPT_EIDFile = optarg; break;
+ case 'I': OPT_IIDFile = optarg; break;
+ case 'e': OPT_scaffeid = optarg; break;
+ case 'i': OPT_scaffiid = atoi(optarg); break;
+
+ default: errflg ++;
+ }
+ }
+ cerr << "Done" << endl;
+
+ if ( errflg > 0 || optind != argc - 1 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_BankName = argv [optind];
+}
+
+
+void flipScaffold(Scaffold_t & scaff)
+{
+ vector<Tile_t> & contigs = scaff.getContigTiling();
+ vector<Tile_t>::iterator ci;
+
+ sort(contigs.begin(), contigs.end(), TileOrderCmp());
+ reverse(contigs.begin(), contigs.end());
+
+ int newoffset = 0;
+ int newgap = 0;
+
+ int span = contigs.begin()->getRightOffset();
+
+ for (ci = contigs.begin(); ci != contigs.end(); ci++)
+ {
+ ci->offset = span - ci->getRightOffset();
+ ci->range.swap();
+ }
+}
+
+
+
+
+int main (int argc, char ** argv)
+{
+ ParseArgs (argc, argv);
+
+ Bank_t scaff_bank(Scaffold_t::NCODE);
+
+ cerr << "Processing " << OPT_BankName << " at " << Date() << endl;
+
+ try
+ {
+ scaff_bank.open(OPT_BankName, B_READ | B_WRITE);
+
+ Scaffold_t scaffold;
+ ifstream file;
+ string id;
+
+ if (!OPT_scaffeid.empty()) { OPT_scaffiid = scaff_bank.lookupIID(OPT_scaffeid); }
+
+ if (OPT_scaffiid)
+ {
+ scaff_bank.fetch(OPT_scaffiid, scaffold);
+ flipScaffold(scaffold);
+ scaff_bank.replace(OPT_scaffiid, scaffold);
+ }
+ else if (!OPT_EIDFile.empty())
+ {
+ file.open(OPT_EIDFile.c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open EID File", __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ scaff_bank.fetch(id, scaffold);
+ flipScaffold(scaffold);
+ scaff_bank.replace(id, scaffold);
+ }
+ }
+ else if (!OPT_IIDFile.empty())
+ {
+ file.open(OPT_IIDFile.c_str());
+
+ if (!file)
+ {
+ throw Exception_t("Couldn't open IID File", __LINE__, __FILE__);
+ }
+
+ while (file >> id)
+ {
+ scaff_bank.fetch(atoi(id.c_str()), scaffold);
+ flipScaffold(scaffold);
+ scaff_bank.replace(scaffold.getIID(), scaffold);
+ }
+ }
+ else
+ {
+ cerr << "No Scaffold specified!" << endl;
+ }
+
+ scaff_bank.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return EXIT_SUCCESS;
+}
diff --git a/src/Bank/select-reads.cc b/src/Bank/select-reads.cc
new file mode 100644
index 0000000..c18f858
--- /dev/null
+++ b/src/Bank/select-reads.cc
@@ -0,0 +1,554 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Mike Schatz
+//! \date 03/14/2005
+//!
+//! \brief Dumps RED, FRG, LIB messages associated with a list of reads
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <cassert>
+#include <unistd.h>
+#include <algorithm>
+#include <set>
+
+using namespace std;
+using namespace AMOS;
+
+string OPT_BankName;
+bool OPT_BankSpy = false;
+
+bool OPT_NullMates = false;
+bool OPT_AutoMate = false;
+bool OPT_ReadEID = false;
+bool OPT_ReadIID = false;
+bool OPT_NAMEONLY = false;
+
+string OPT_EIDInclude;
+string OPT_IIDInclude;
+string OPT_EIDExclude;
+string OPT_IIDExclude;
+
+void ParseArgs(int argc, char ** argv);
+void PrintHelp(const char * s);
+void PrintUsage(const char * s);
+
+char EXCLUDE = 0;
+char INCLUDE = 1;
+char PRINTED = 3;
+char UNKNOWN = 4;
+
+typedef HASHMAP::hash_map<AMOS::ID_t, char> idmap;
+idmap iidStatus;
+
+typedef set<ID_t> LibSet;
+LibSet libraries;
+
+typedef set<ID_t> FrgSet;
+FrgSet fragments;
+
+inline void printLibrary(Bank_t & lib_bank, ID_t libid)
+{
+ if (!OPT_NAMEONLY)
+ {
+ LibSet::iterator li = libraries.find(libid);
+ if (li == libraries.end())
+ {
+ Library_t lib;
+ lib_bank.fetch(libid, lib);
+
+ Message_t msg;
+ lib.writeMessage(msg);
+ msg.write(cout);
+
+ libraries.insert(libid);
+ }
+ }
+}
+
+
+
+int inexcount[4] = {0,0,0,0};
+
+void loadEIDs(Bank_t & red_bank, const string & eidfilename, int value)
+{
+ if (!eidfilename.empty())
+ {
+ ifstream eidfile;
+ eidfile.open(eidfilename.c_str());
+
+ if (!eidfile) { throw Exception_t("Couldn't open EID File", __LINE__, __FILE__); }
+
+ string eid;
+ while (eidfile >> eid)
+ {
+ ID_t iid = red_bank.lookupIID(eid.c_str());
+ if (iid != AMOS::NULL_ID)
+ {
+ iidStatus[iid] = value;
+ inexcount[value]++;
+ }
+ else
+ {
+ cerr << "ERROR: EID:" << eid << " not found in bank, skipping" << endl;
+ }
+ }
+ }
+}
+
+void loadIIDs(Bank_t & red_bank, const string & iidfilename, int value)
+{
+ if (!iidfilename.empty())
+ {
+ ifstream iidfile;
+ iidfile.open(iidfilename.c_str());
+
+ if (!iidfile) { throw Exception_t("Couldn't open IID File", __LINE__, __FILE__); }
+
+ ID_t iid;
+ while (iidfile >> iid)
+ {
+ if (iid != AMOS::NULL_ID)
+ {
+ iidStatus[iid] = value;
+ inexcount[value]++;
+ }
+ else
+ {
+ cerr << "ERROR: IID:" << iid << " not found in bank, skipping" << endl;
+ }
+ }
+ }
+}
+
+int printCount = 0;
+inline void printRead(Bank_t & red_bank, ID_t iid)
+{
+ if (iid)
+ {
+ if (OPT_ReadEID)
+ {
+ cout << red_bank.lookupEID(iid) << endl;
+ }
+ else if (OPT_ReadIID)
+ {
+ cout << iid << endl;
+ }
+ else
+ {
+ Read_t red;
+ Message_t msg;
+ red_bank.fetch(iid, red);
+
+ if (red.getClearRange().isReverse())
+ {
+ Range_t rng = red.getClearRange();
+ rng.swap();
+ red.setClearRange(rng);
+ }
+
+ red.writeMessage(msg);
+ msg.write(cout);
+ }
+
+ iidStatus[iid] = PRINTED;
+ printCount++;
+ }
+}
+
+
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+ Read_t red1, red2;
+ Fragment_t frg;
+ Library_t lib;
+ pair<ID_t, ID_t> mtp;
+
+ Bank_t red_bank (Read_t::NCODE);
+ Bank_t lib_bank (Library_t::NCODE);
+ BankStream_t frg_bank (Fragment_t::NCODE);
+
+ ParseArgs (argc, argv);
+ OPT_NAMEONLY = (OPT_ReadEID || OPT_ReadIID);
+
+
+ try
+ {
+ BankMode_t bm = OPT_BankSpy ? B_SPY : B_READ;
+ red_bank.open(OPT_BankName, bm);
+
+ cerr << "Bank has " << red_bank.getSize() << " reads" << endl;
+
+ loadEIDs(red_bank, OPT_EIDInclude, INCLUDE);
+ loadIIDs(red_bank, OPT_IIDInclude, INCLUDE);
+
+ cerr << "Loaded " << inexcount[INCLUDE] << " reads to include" << endl;
+
+ loadEIDs(red_bank, OPT_EIDExclude, EXCLUDE);
+ loadIIDs(red_bank, OPT_IIDExclude, EXCLUDE);
+
+ cerr << "Loaded " << inexcount[EXCLUDE] << " reads to exclude" << endl;
+
+ bool doInclude = inexcount[INCLUDE] > 0;
+ bool doExclude = inexcount[EXCLUDE] > 0;
+
+ // if doInclude && doExclude => Print {Included} - {Excluded} ==> Default Exclude, clobbering
+ // if doInclude && !doExclude => Print {Included} ==> Default Exclude
+ // if !doInclude && doExclude => Print {Everyone} - {Excluded} ==> Default Include
+ // if !doInclude && !doExclude => Error
+
+ char DEFAULT = EXCLUDE;
+ if (doExclude && !doInclude) { DEFAULT = INCLUDE; }
+
+ if (iidStatus.empty())
+ {
+ cerr << "No reads selected to include/exclude" << endl;
+ return 0;
+ }
+
+ Message_t msg;
+
+ int nullified = 0;
+ int halfmates = 0;
+ int mateinclude = 0;
+ int mateexclude = 0;
+ int clobbered = 0;
+ int unmated = 0;
+
+ if (frg_bank.exists(OPT_BankName))
+ {
+ cerr << "Processing FRG bank..." << endl;
+
+ frg_bank.open(OPT_BankName, bm);
+ lib_bank.open(OPT_BankName, bm);
+
+ // Visit each fragment once. Note: mate-pairs may be undefined
+ while (frg_bank >> frg)
+ {
+ mtp = frg.getMatePair();
+ idmap::iterator r1 = iidStatus.find(mtp.first);
+ idmap::iterator r2 = iidStatus.find(mtp.second);
+
+ const char r1status = (r1 == iidStatus.end()) ? UNKNOWN : r1->second; // { UNKNOWN, INCLUDE, EXCLUDE }
+ const char r2status = (r2 == iidStatus.end()) ? UNKNOWN : r2->second; // { UNKNOWN, INCLUDE, EXCLUDE }
+
+ const char r1print = (r1status == UNKNOWN) ? DEFAULT : r1status; // { INCLUDE, EXCLUDE }
+ const char r2print = (r2status == UNKNOWN) ? DEFAULT : r2status; // { INCLUDE, EXCLUDE }
+
+ if (0)
+ {
+ if (r1 != iidStatus.end() || r2 != iidStatus.end())
+ {
+ cerr << "r1: " << mtp.first << " r1status: " << (int) r1status << " r1print: " << (int) r1print << endl;
+ cerr << "r2: " << mtp.second << " r2status: " << (int) r2status << " r2print: " << (int) r2print << endl;
+ }
+ }
+
+ if (((mtp.first == AMOS::NULL_ID) && (mtp.second == AMOS::NULL_ID)) ||
+ ((mtp.first == AMOS::NULL_ID) && (r2print == EXCLUDE)) ||
+ ((mtp.second == AMOS::NULL_ID) && (r1print == EXCLUDE)))
+
+ {
+ // Skip both because of 1 NULLID + Exclude or 2 NULLIDs
+ // Otherwise there is at least 1 to print
+ // don't mark NULL_ID as EXCLUDE, though, or AutoMate will screw up
+ }
+ else if (((r1print == EXCLUDE) && (r2print == EXCLUDE)) ||
+ ((r1status == EXCLUDE) && OPT_AutoMate) || // override r2 include
+ ((r2status == EXCLUDE) && OPT_AutoMate)) // override r1 include
+ {
+ // skipping both reads and frg because of exclusion
+
+ // only mark reads excluded because of mate
+ if ((r2status == EXCLUDE) && (r1status != EXCLUDE))
+ {
+ if (r1status == INCLUDE) { clobbered++; }
+ iidStatus[mtp.first] = EXCLUDE; mateexclude++;
+ }
+
+ if ((r1status == EXCLUDE) && (r2status != EXCLUDE))
+ {
+ if (r2status == INCLUDE) { clobbered++; }
+ iidStatus[mtp.second] = EXCLUDE; mateexclude++;
+ }
+ }
+ else
+ {
+ // printing at least 1 read
+
+ // status = {UNKNOWN, EXCLUDE, INCLUDE}
+ // print = {INCLUDE, EXCLUDE}
+
+ printLibrary(lib_bank, frg.getLibrary());
+
+ bool printr1 = (r1print == INCLUDE);
+ bool printr2 = (r2print == INCLUDE);
+
+ if ((r1status == UNKNOWN) && printr2 && OPT_AutoMate) { printr1 = true; }
+ if ((r2status == UNKNOWN) && printr1 && OPT_AutoMate) { printr2 = true; }
+
+ if (!printr1 && !printr2)
+ {
+ cerr << "INTERNAL ERROR: not printing either!!!" << endl;
+ cerr << "r1: " << mtp.first << " r1status: " << (int) r1status << " DEFAULT: " << (int) DEFAULT << " AutoMate: " << OPT_AutoMate << endl;
+ cerr << "r2: " << mtp.second << " r2status: " << (int) r2status << " DEFAULT: " << (int) DEFAULT << " AutoMate: " << OPT_AutoMate << endl;
+
+ return 1;
+ }
+ else if (printr1 && r1status == EXCLUDE)
+ {
+ cerr << "INTERNAL ERROR: printr1 but r1status == EXCLUDE" << endl;
+ cerr << "r1: " << mtp.first << " r1status: " << (int) r1status << " DEFAULT: " << (int) DEFAULT << " AutoMate: " << OPT_AutoMate << endl;
+ cerr << "r2: " << mtp.second << " r2status: " << (int) r2status << " DEFAULT: " << (int) DEFAULT << " AutoMate: " << OPT_AutoMate << endl;
+
+ return 1;
+ }
+ else if (printr2 && r2status == EXCLUDE)
+ {
+ cerr << "INTERNAL ERROR: printr2 but r2status == EXCLUDE" << endl;
+ cerr << "r1: " << mtp.first << " r1status: " << (int) r1status << " DEFAULT: " << (int) DEFAULT << " AutoMate: " << OPT_AutoMate << endl;
+ cerr << "r2: " << mtp.second << " r2status: " << (int) r2status << " DEFAULT: " << (int) DEFAULT << " AutoMate: " << OPT_AutoMate << endl;
+
+ return 1;
+ }
+
+ bool brokenmate = !(printr1 && printr2);
+
+ if (brokenmate)
+ {
+ if(OPT_NullMates)
+ {
+ nullified++;
+ frg.setReads(make_pair(NULL_ID, NULL_ID));
+ }
+ else
+ {
+ halfmates++;
+ }
+ }
+
+ if (!OPT_NAMEONLY)
+ {
+ frg.writeMessage(msg);
+ msg.write(cout);
+ fragments.insert(frg.getIID());
+ }
+
+ if (printr1)
+ {
+ printRead(red_bank, mtp.first);
+
+ if (r2status == INCLUDE && OPT_AutoMate && r1status == UNKNOWN)
+ {
+ mateinclude++;
+ }
+ }
+
+ if (printr2)
+ {
+ printRead(red_bank, mtp.second);
+
+ if (r1status == INCLUDE && OPT_AutoMate && r2status == UNKNOWN)
+ {
+ mateinclude++;
+ }
+ }
+ }
+ }
+
+ if (doInclude && OPT_AutoMate) { cerr << "Included " << mateinclude << " extra mates" << endl; }
+ if (doExclude && OPT_AutoMate) { cerr << "Excluded " << mateexclude << " extra mates" << endl; }
+
+ if (doInclude && doExclude && OPT_AutoMate)
+ { cerr << "Clobbered " << clobbered << " mates" << endl; }
+
+ if (OPT_NullMates)
+ { cerr << "Nullified " << nullified << " half mates" << endl; }
+
+ if (!OPT_NullMates && !OPT_AutoMate && halfmates)
+ { cerr << "WARNING: Printed " << halfmates << " half mates" << endl; }
+
+ // iidStatus == PRINTED => Printed
+ // iidStatus == EXCLUDE => Exclude listed or by mate
+ // iidStatus == INCLUDE => Should be printed, but not in a mate-pair
+ // iidStatus == UNKNOWN => Take default action
+
+ cerr << "Printing unmated reads..." << endl;
+
+ IDMap_t::const_iterator ri;
+ for (ri = red_bank.getIDMap().begin();
+ ri != red_bank.getIDMap().end();
+ ri++)
+ {
+ idmap::iterator r1 = iidStatus.find(ri->iid);
+
+ if (((r1 == iidStatus.end()) && (DEFAULT == INCLUDE)) ||
+ ((r1 != iidStatus.end()) && (r1->second == INCLUDE)))
+ {
+ if (!OPT_NAMEONLY)
+ {
+ red_bank.fetch(ri->iid, red1);
+
+ frg_bank.seekg(frg_bank.lookupBID(red1.getFragment()));
+ frg_bank >> frg;
+
+ printLibrary(lib_bank, frg.getLibrary());
+
+ FrgSet::iterator fi;
+
+ fi = fragments.find(frg.getIID());
+
+ if (fi == fragments.end())
+ {
+ frg.writeMessage(msg);
+ msg.write(cout);
+ fragments.insert(frg.getIID());
+ }
+ }
+
+ printRead(red_bank, ri->iid);
+ unmated++;
+ }
+ }
+
+ cerr << "Included " << unmated << " unmated reads" << endl;
+
+ frg_bank.close();
+ lib_bank.close();
+ }
+ else
+ {
+ cerr << "WARNING: No fragment bank, only printing reads" << endl;
+
+ IDMap_t::const_iterator ri;
+ for (ri = red_bank.getIDMap().begin();
+ ri != red_bank.getIDMap().end();
+ ri++)
+ {
+ idmap::iterator r1 = iidStatus.find(ri->iid);
+
+ if (((r1 == iidStatus.end()) && (DEFAULT == INCLUDE)) ||
+ ((r1 != iidStatus.end()) && (r1->second == INCLUDE)))
+ {
+ printRead(red_bank, ri->iid);
+ unmated++;
+ }
+ }
+ }
+
+ cerr << endl;
+ cerr << "Printed " << printCount << " reads, "
+ << fragments.size() << " fragments, "
+ << libraries.size() << " libraries." << endl;
+
+ red_bank.close();
+ }
+ catch (const Exception_t & e)
+ {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hvsLlMNI:i:X:x:")) != EOF) )
+ {
+ switch (ch)
+ {
+ case 'h': PrintHelp (argv[0]); exit (EXIT_SUCCESS); break;
+ case 'v': PrintBankVersion (argv[0]); exit (EXIT_SUCCESS); break;
+ case 's': OPT_BankSpy = true; break;
+
+ case 'M': OPT_AutoMate = true; break;
+ case 'N': OPT_NullMates = true; break;
+
+ case 'I': OPT_EIDInclude = optarg; break;
+ case 'i': OPT_IIDInclude = optarg; break;
+
+ case 'X': OPT_EIDExclude = optarg; break;
+ case 'x': OPT_IIDExclude = optarg; break;
+
+ case 'L': OPT_ReadEID = true; break;
+ case 'l': OPT_ReadIID = true; break;
+
+ default: errflg ++;
+ };
+ }
+
+ if ( errflg > 0 || optind != argc - 1 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_BankName = argv [optind ++];
+}
+
+
+
+
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "Print RED, FRG & LIB messages of selected reads from an AMOS Bank\n\n"
+ << "-h Display help information\n"
+ << "-s Disregard bank locks and write permissions (spy mode)\n"
+ << "-v Display the compatible bank version\n"
+ << "-i IIDFile Specify file containing list of iid's to print\n"
+ << "-I EIDFile Specify file containing list of eid's to print\n"
+ << "-L Just output read names that would be printed by eid\n"
+ << "-l Just output read names that would be printed by iid\n"
+ << "-M Automatically consider mates\n"
+ << "-N Nullify mates in FRG if not printing both mate-pairs\n"
+ << "-x IIDFile File of list reads iids to exclude\n"
+ << "-X EIDFile File of list reads eids to exclude\n"
+ << "\n"
+ << "Notes:\n"
+ << ". If there is no fragment bank, then it only prints read messages\n"
+ << "\n"
+ << ". By default, reads are considered independently so you can\n"
+ << " print a read, but not its mate. The -N option removes references\n"
+ << " to unprinted mate-pairs in the FRG messages.\n"
+ << "\n"
+ << ". In most cases, you should use -M to automatically select mates.\n"
+ << "\n"
+ << "You must specify included and/or excluded reads. Precedence is:\n"
+ << "1) If a read is excluded by -X or -x, it will not be printed\n"
+ << " (-M) Mates of excluded reads will not be printed either\n"
+ << "\n"
+ << "2) If a read is included by -I or -i, it will be printed except if excluded\n"
+ << " (-M) Mates of included reads will be printed, except if either is excluded\n"
+ << " (Included Reads or mates may be clobbered by excluded reads or mates)\n"
+ << "\n"
+ << "3) If no reads are included, all reads except those excluded will be printed\n"
+ << "\n"
+ << "Exclusion takes precedence over inclusion!\n";
+
+ return;
+}
+
+
+
+
+void PrintUsage (const char * s)
+{
+ cerr
+ << "\nUSAGE: " << s << " [options] <bank path>\n\n";
+ return;
+}
diff --git a/src/Bank/simpleContigLoader.cc b/src/Bank/simpleContigLoader.cc
new file mode 100644
index 0000000..41b7711
--- /dev/null
+++ b/src/Bank/simpleContigLoader.cc
@@ -0,0 +1,286 @@
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <cassert>
+#include <unistd.h>
+using namespace std;
+using namespace AMOS;
+
+
+//=============================================================== Globals ====//
+string OPT_BankName;
+string OPT_ContigFile;
+bool VERBOSE = 0;
+bool OPT_APPEND = 0;
+bool OPT_EID = 0;
+
+
+
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+
+void loadContig(Contig_t & contig, Bank_t & bank)
+{
+ bank.append(contig);
+ cerr << "Loaded contig: " << contig.getEID() << " "
+ << contig.getLength() << " bp, "
+ << contig.getReadTiling().size() << " reads" << endl;
+}
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+
+ Bank_t read_bank (Read_t::NCODE);
+ Bank_t contig_bank(Contig_t::NCODE);
+
+ long int cntw = 0; // written object count
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ ifstream cfile;
+ cfile.open(OPT_ContigFile.c_str());
+
+ if (!cfile)
+ {
+ AMOS_THROW_IO("Can't open " + OPT_ContigFile);
+ }
+
+ read_bank.open (OPT_BankName, B_READ|B_SPY);
+
+ if (contig_bank.exists(OPT_BankName))
+ {
+ contig_bank.open(OPT_BankName, B_READ|B_WRITE);
+
+ if (!OPT_APPEND)
+ {
+ cerr << "WARNING: Removing old contigs" << endl;
+ contig_bank.clear();
+ }
+ else
+ {
+ cerr << "Appending to bank" << endl;
+ }
+ }
+ else
+ {
+ contig_bank.create(OPT_BankName, B_READ|B_WRITE);
+ }
+
+ Contig_t ctg;
+ bool first = true;
+ string id;
+ cfile >> id;
+
+ while (cfile)
+ {
+ if (id[0] == '>')
+ {
+ if (!first)
+ {
+ loadContig(ctg, contig_bank);
+ ctg.clear();
+ }
+
+ first = false;
+ ctg.setEID(id.substr(1,id.length()));
+ ctg.setIID(contig_bank.getMaxIID()+1);
+
+ string cons;
+ cfile >> cons;
+
+ string cqual;
+ cqual.append(cons.length(), 'X');
+
+ ctg.setSequence(cons,cqual);
+
+ if (VERBOSE)
+ {
+ cout << "Saw contig header: " << id << ", " << cons.length() << "bp." << endl;
+ }
+ }
+ else if (id[0] == '#')
+ {
+ ID_t readiid = 0;
+ int offset;
+ char dir;
+
+ if (OPT_EID)
+ {
+ readiid = read_bank.lookupIID(id.c_str()+1);
+ if (readiid == 0)
+ {
+ cerr << "Unknown eid: " << id << endl;
+ exit(1);
+ }
+ }
+ else
+ {
+ readiid = atoi(id.c_str()+1);
+ }
+
+ cfile >> offset;
+ cfile >> dir;
+
+ Read_t read;
+ read_bank.fetch(readiid, read);
+
+ Range_t clr = read.getClearRange();
+
+ if (dir == 'F') { }
+ else if (dir == 'R') { clr.swap(); }
+ else
+ {
+ AMOS_THROW_IO((string)"Invalid Direction Specified " + dir + " for read " + id);
+ }
+
+ Tile_t tle;
+ tle.source = readiid;
+ tle.offset = offset;
+ tle.range = clr;
+
+ ctg.getReadTiling().push_back(tle);
+
+ if (tle.offset + clr.getLength() > ctg.getLength())
+ {
+ cerr << "WARNING: Read " << readiid << " extends beyond consensus" << endl;
+ }
+
+ if (VERBOSE)
+ {
+ cout << "Added read: " << id << " " << offset << " " << dir << endl;
+ }
+ }
+ else
+ {
+ AMOS_THROW_IO("Invalid field: " + id);
+ }
+
+ cfile >> id;
+ }
+
+ loadContig(ctg, contig_bank);
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hvae")) != EOF) )
+ switch (ch)
+ {
+
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'v':
+ VERBOSE = true;
+ break;
+
+ case 'a':
+ OPT_APPEND = true;
+ break;
+
+ case 'e':
+ OPT_EID = true;
+ break;
+
+ default:
+ errflg ++;
+ }
+
+ if ( errflg > 0 || optind != argc - 2 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_BankName = argv [optind ++];
+ OPT_ContigFile = argv[optind++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "-h Display help information\n"
+ << "-v Be Verbose\n"
+ << "-a Append contigs instead of overwriting them\n"
+ << "-e Use read eids instead of iids\n"
+ << endl;
+ cerr
+ << "Loads contigs from file into a bank\n"
+ << "Format of contig file is:\n\n"
+ << ">contig1 consensus\n"
+ << "#readiid1 offset dir\n"
+ << "#readiid2 offset dir\n"
+ << "#readiid3 offset dir\n"
+ << ">contig2 consensus\n"
+ << "#readiid4 offset dir\n\n"
+ << "WARNING: All previously loaded contigs are removed\n";
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr
+ << "\nUSAGE: " << s << " <bank path> <contig file>\n\n";
+ return;
+}
diff --git a/src/Bank/simplifyLibraries.cc b/src/Bank/simplifyLibraries.cc
new file mode 100644
index 0000000..0e6c3dd
--- /dev/null
+++ b/src/Bank/simplifyLibraries.cc
@@ -0,0 +1,122 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+
+using namespace AMOS;
+using namespace std;
+
+// Collapse libraries with identical mean and sd into a single library
+// Also fixes fragments to point to new libraries
+
+
+int main(int argc, char ** argv)
+{
+ if (argc != 2)
+ {
+ cerr << "Usage: simplifyLibraries bankname" << endl;
+ return EXIT_FAILURE;
+ }
+
+ Bank_t lib_bank(Library_t::NCODE);
+ Bank_t frg_bank(Fragment_t::NCODE);
+ string bank_name = argv[1];
+
+ int verbose = 0;
+
+ cerr << "Processing " << bank_name << " at " << Date() << endl;
+
+
+ try
+ {
+ lib_bank.open(bank_name, B_READ | B_WRITE);
+ frg_bank.open(bank_name, B_READ|B_WRITE);
+
+ map<ID_t, ID_t> newlibraries;
+ map<ID_t, ID_t>::iterator mi;
+
+ vector<Library_t> keeplibraries;
+ vector<Library_t>::const_iterator vi;
+
+ const IDMap_t & map = lib_bank.getIDMap();
+ IDMap_t::const_iterator li;
+ for (li = map.begin(); li != map.end(); li++)
+ {
+ Library_t lib;
+ lib_bank.fetch(li->iid, lib);
+
+ Distribution_t dist = lib.getDistribution();
+
+ bool duplicate = false;
+ for (vi = keeplibraries.begin(); vi != keeplibraries.end(); vi++)
+ {
+ if ((dist.mean == vi->getDistribution().mean) &&
+ (dist.sd == vi->getDistribution().sd))
+ {
+ duplicate = true;
+ newlibraries.insert(make_pair(lib.getIID(), vi->getIID()));
+ break;
+ }
+ }
+
+ if (!duplicate)
+ {
+ newlibraries.insert(make_pair(lib.getIID(), lib.getIID()));
+ keeplibraries.push_back(lib);
+ }
+ }
+
+ int removecount = 0;
+ int keepcount = 0;
+
+ for (mi = newlibraries.begin(); mi != newlibraries.end(); mi++)
+ {
+ if (mi->first != mi->second)
+ {
+ lib_bank.remove(mi->first);
+ removecount++;
+ }
+ else
+ {
+ keepcount++;
+ }
+ }
+
+ cerr << "Kept " << keepcount << " libraries, deleted " << removecount << endl;
+ lib_bank.close();
+
+
+ const IDMap_t & frgmap = frg_bank.getIDMap();
+ int update = 0;
+ int all = 0;
+
+ for (li = frgmap.begin(); li != frgmap.end(); li++)
+ {
+ Fragment_t frg;
+ frg_bank.fetch(li->iid, frg);
+
+ all++;
+
+ ID_t oldlib = frg.getLibrary();
+ ID_t newlib = newlibraries[oldlib];
+
+ if (oldlib != newlib)
+ {
+ update++;
+ frg.setLibrary(newlib);
+ frg_bank.replace(li->iid, frg);
+ }
+ }
+
+ cerr << "Updated " << update << " of " << all << " fragments" << endl;
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/Bank/updateBankPositions.cc b/src/Bank/updateBankPositions.cc
new file mode 100644
index 0000000..58530ac
--- /dev/null
+++ b/src/Bank/updateBankPositions.cc
@@ -0,0 +1,143 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+
+using namespace AMOS;
+using namespace std;
+
+
+
+int main(int argc, char ** argv)
+{
+ if (argc != 3)
+ {
+ cerr << "Usage: updateBankPositions bankname posfile" << endl;
+ return EXIT_FAILURE;
+ }
+
+ Bank_t read_bank(Read_t::NCODE);
+ string bank_name = argv[1];
+ string pos_name = argv[2];
+
+ int verbose = 0;
+
+ vector<string> badSeqs;
+
+ cerr << "Processing " << bank_name << " at " << Date() << endl;
+
+ try
+ {
+ read_bank.open(bank_name);
+ Read_t read;
+
+ FILE * fpos = fopen(pos_name.c_str(), "r");
+
+ if (!fpos)
+ {
+ cerr << "Can't open posfile: " << pos_name << endl;
+ return EXIT_FAILURE;
+ }
+
+ char c;
+ char hex[5];
+ hex[4] = '\0';
+
+ int MAX_SEQNAME=100;
+ char seqname[MAX_SEQNAME];
+ int version;
+ int x;
+ int count = 0;
+
+ while(fscanf(fpos, "%s\t%d\t", seqname, &version) > 0)
+ {
+ if (!strcmp(seqname, "SequenceName"))
+ {
+ c = ' ';
+ while (c != '\n')
+ {
+ c = fgetc(fpos);
+ }
+ }
+ else
+ {
+ if (verbose) { cerr << "Loading " << seqname; }
+ vector<int16_t> positions;
+
+ c = fgetc(fpos);
+ ungetc(c, fpos);
+
+ while (c != '\n' && fgets (hex, 5, fpos))
+ {
+ sscanf(hex, "%04x", &x);
+ positions.push_back(x);
+
+ c = fgetc(fpos);
+ ungetc(c, fpos);
+ }
+
+ if (verbose) {cerr << " " << positions.size(); }
+
+ if (read_bank.existsEID(seqname))
+ {
+ if (verbose) { cerr << "."; }
+ read_bank.fetch(seqname, read);
+
+ if (read.getLength() != positions.size())
+ {
+ badSeqs.push_back(seqname);
+
+ if (0)
+ {
+ throw Exception_t("Length mismatch detected!",
+ __LINE__, __FILE__);
+ }
+ }
+
+ read.setBasePositions(positions);
+ read_bank.replace(read.getIID(), read);
+ count++;
+ }
+
+ if (verbose) { cerr << endl; }
+ }
+ }
+
+ cerr << "Loaded " << count << " records." << endl;
+
+ cerr << "Cleaning Bank" << endl;
+ read_bank.clean();
+
+ cerr << badSeqs.size() << " mismatches detected" << endl;
+ vector<string>::iterator si;
+ for (si = badSeqs.begin();
+ si != badSeqs.end();
+ si++)
+ {
+ cerr << *si;
+ read_bank.fetch(si->c_str(), read);
+
+ cerr << " slen:" << read.getLength()
+ << " plen:" << read.getBasePositions().size()
+ << endl;
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+
+
+ return EXIT_SUCCESS;
+}
+
+
+
+
+
+
+
+
diff --git a/src/Bank/updateClrRanges.cc b/src/Bank/updateClrRanges.cc
new file mode 100644
index 0000000..6836ba6
--- /dev/null
+++ b/src/Bank/updateClrRanges.cc
@@ -0,0 +1,97 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+
+using namespace AMOS;
+using namespace std;
+
+
+
+int main(int argc, char ** argv)
+{
+ if (argc < 3)
+ {
+ cerr << "Usage: updateClrRanges [-i] bankname seqname.end5.end3.txt" << endl;
+ return EXIT_FAILURE;
+ }
+
+ bool useIIDs = false;
+ int argn = 1;
+
+ Bank_t read_bank(Read_t::NCODE);
+ string bank_name = argv[argn]; argn++;
+
+ if (bank_name == "-i") { useIIDs = true; bank_name = argv[argn]; argn++; }
+ string clr_name = argv[argn];
+
+ cerr << "Processing " << bank_name << " at " << Date() << endl;
+
+ try
+ {
+ read_bank.open(bank_name);
+ Read_t read;
+
+ FILE * fclr = fopen(clr_name.c_str(), "r");
+
+ if (!fclr)
+ {
+ cerr << "Can't open clrrangefile: " << clr_name << endl;
+ return EXIT_FAILURE;
+ }
+
+ int MAX_SEQNAME=100;
+ char seqname[MAX_SEQNAME];
+ int count = 0;
+ int a,b;
+
+ while(fscanf(fclr, "%s %d %d", seqname, &a, &b) > 0)
+ {
+ // cerr << "Updating " << seqname << ": " << a << " " << b << endl;
+
+ bool skip = false;
+
+ if (useIIDs)
+ {
+ int iid = atoi(seqname);
+ read_bank.fetch(iid, read);
+ }
+ else
+ {
+ if (read_bank.existsEID(seqname))
+ {
+ read_bank.fetch(seqname, read);
+ }
+ else
+ {
+ cerr << "Warning: " << seqname << " not found, skipping" << endl;
+ skip = true;
+ }
+ }
+
+ if (!skip)
+ {
+ Range_t range(a,b);
+ if (range.isReverse()) { range.swap(); }
+
+ read.setClearRange(range);
+ read_bank.replace(read.getIID(), read);
+ count++;
+ }
+ }
+
+ cerr << "Loaded " << count << " records." << endl;
+
+ cerr << "Cleaning Bank" << endl;
+ read_bank.clean();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/Bank/updateLibSizes.cc b/src/Bank/updateLibSizes.cc
new file mode 100644
index 0000000..4b7ce98
--- /dev/null
+++ b/src/Bank/updateLibSizes.cc
@@ -0,0 +1,83 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+
+using namespace AMOS;
+using namespace std;
+
+
+
+int main(int argc, char ** argv)
+{
+ if (argc != 3)
+ {
+ cerr << "Usage: updateLibSizes bankname [libiid.mea.std | -dump]" << endl;
+ return EXIT_FAILURE;
+ }
+
+ BankStream_t lib_bank(Library_t::NCODE);
+ string bank_name = argv[1];
+ string sizes_name = argv[2];
+
+ int verbose = 0;
+
+ cerr << "Processing " << bank_name << " at " << Date() << endl;
+
+ try
+ {
+ lib_bank.open(bank_name, B_READ | B_WRITE);
+
+ if (sizes_name == "-dump")
+ {
+ Library_t lib;
+
+ while (lib_bank >> lib)
+ {
+ Distribution_t dist = lib.getDistribution();
+ ID_t libid = lib.getIID();
+
+ cout << libid << " " << dist.mean << " " << dist.sd << endl;
+ }
+ }
+ else
+ {
+ FILE * fclr = fopen(sizes_name.c_str(), "r");
+
+ if (!fclr)
+ {
+ cerr << "Can't open sizes: " << sizes_name << endl;
+ return EXIT_FAILURE;
+ }
+
+ int libid,a,b;
+ int count = 0;
+
+ while(fscanf(fclr, "%d %d %d", &libid, &a, &b) > 0)
+ {
+ count++;
+ Distribution_t d;
+ d.mean=a;
+ d.sd = b;
+ Library_t lib;
+
+ lib_bank.fetch(libid, lib);
+ lib.setDistribution(d);
+ lib_bank.replace(libid, lib);
+
+ }
+ cerr << "Loaded " << count << " records." << endl;
+ }
+
+ lib_bank.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/Casm/Makefile.am b/src/Casm/Makefile.am
new file mode 100644
index 0000000..1220c52
--- /dev/null
+++ b/src/Casm/Makefile.am
@@ -0,0 +1,42 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+##-- TO BE INSTALLED
+bin_PROGRAMS = \
+ casm-layout \
+ casm-breaks
+
+noinst_PROGRAMS = \
+ casm-libsize
+
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS
+
+
+#-- casm-layout
+casm_layout_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+casm_layout_SOURCES = \
+ casm-layout.cc
+
+
+#-- casm-breaks
+casm_breaks_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+casm_breaks_SOURCES = \
+ casm-breaks.cc
+
+
+#-- casm-libsize
+casm_libsize_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+casm_libsize_SOURCES = \
+ casm-libsize.cc
+
+##-- END OF MAKEFILE --##
\ No newline at end of file
diff --git a/src/Casm/Makefile.in b/src/Casm/Makefile.in
new file mode 100644
index 0000000..1d0cfbe
--- /dev/null
+++ b/src/Casm/Makefile.in
@@ -0,0 +1,608 @@
+# 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 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@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = casm-layout$(EXEEXT) casm-breaks$(EXEEXT)
+noinst_PROGRAMS = casm-libsize$(EXEEXT)
+subdir = src/Casm
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_casm_breaks_OBJECTS = casm-breaks.$(OBJEXT)
+casm_breaks_OBJECTS = $(am_casm_breaks_OBJECTS)
+casm_breaks_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_casm_layout_OBJECTS = casm-layout.$(OBJEXT)
+casm_layout_OBJECTS = $(am_casm_layout_OBJECTS)
+casm_layout_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_casm_libsize_OBJECTS = casm-libsize.$(OBJEXT)
+casm_libsize_OBJECTS = $(am_casm_libsize_OBJECTS)
+casm_libsize_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(casm_breaks_SOURCES) $(casm_layout_SOURCES) \
+ $(casm_libsize_SOURCES)
+DIST_SOURCES = $(casm_breaks_SOURCES) $(casm_layout_SOURCES) \
+ $(casm_libsize_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS
+
+
+#-- casm-layout
+casm_layout_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+casm_layout_SOURCES = \
+ casm-layout.cc
+
+
+#-- casm-breaks
+casm_breaks_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+casm_breaks_SOURCES = \
+ casm-breaks.cc
+
+
+#-- casm-libsize
+casm_libsize_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+casm_libsize_SOURCES = \
+ casm-libsize.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Casm/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Casm/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):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+casm-breaks$(EXEEXT): $(casm_breaks_OBJECTS) $(casm_breaks_DEPENDENCIES)
+ @rm -f casm-breaks$(EXEEXT)
+ $(CXXLINK) $(casm_breaks_OBJECTS) $(casm_breaks_LDADD) $(LIBS)
+casm-layout$(EXEEXT): $(casm_layout_OBJECTS) $(casm_layout_DEPENDENCIES)
+ @rm -f casm-layout$(EXEEXT)
+ $(CXXLINK) $(casm_layout_OBJECTS) $(casm_layout_LDADD) $(LIBS)
+casm-libsize$(EXEEXT): $(casm_libsize_OBJECTS) $(casm_libsize_DEPENDENCIES)
+ @rm -f casm-libsize$(EXEEXT)
+ $(CXXLINK) $(casm_libsize_OBJECTS) $(casm_libsize_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/casm-breaks.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/casm-layout.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/casm-libsize.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+
+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 $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-binPROGRAMS clean-generic 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-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-noinstPROGRAMS ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS 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-compile mostlyclean-generic pdf pdf-am \
+ ps ps-am tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Casm/casm-breaks.cc b/src/Casm/casm-breaks.cc
new file mode 100644
index 0000000..0a44796
--- /dev/null
+++ b/src/Casm/casm-breaks.cc
@@ -0,0 +1,918 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 06/08/2005
+//!
+//! \brief Layout the qry seqs and report alternate paths through the ref
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include "delta.hh"
+#include "delta.cc"
+#include "amp.hh"
+#include <climits>
+#include <list>
+#include <sstream>
+#include <fstream>
+using namespace std;
+using namespace AMOS;
+using namespace HASHMAP;
+
+
+//=============================================================== Options ====//
+string OPT_AlignName; // alignment name parameter
+string OPT_BankName; // bank name parameter
+
+string OPT_FeaturesName; // features output file
+string OPT_PathsName; // paths output file
+int OPT_Fuzzy = 3; // fuzzy equals tolerance
+int OPT_Seed = -1; // random seed
+int OPT_Redundancy = 3; // needed concurring signatures
+float OPT_MinIdentity = 0.0; // min identity to tile
+int OPT_MaxTrim = 500; // max ignorable trim length
+
+const long int MAXIMAL = LONG_MAX; // maximum integer
+
+
+//============================================================= Constants ====//
+struct Signature_t
+//!< mis-alignment signature
+{
+ long int fc; // foward support
+ long int rc; // reverse support
+ list<const DeltaNode_t *> qry; // supporting queries
+
+ vector<const DeltaNode_t *> ref; // reference ids
+ vector<long int> pos; // reference alignment positions
+ vector<long int> gap; // query alignment gaps/overlaps
+
+ // [sR]---[eR] [sR]---[eR] [sR]---[eR]
+ // [nodeR] [nodeR] [nodeR]
+ // [gap] [gap]
+
+ Signature_t() { fc = rc = 0; }
+};
+
+
+struct Placement_t
+//!< placement of a read on the reference
+{
+ ID_t iid; // iid of the read
+ const DeltaNode_t * read; // read alignment info
+ const DeltaEdgelet_t * chain; // head of the alignment chain
+ Placement_t * mate; // mated read's placement
+
+ Placement_t() { iid = NULL_ID; read = NULL; chain = NULL; mate = NULL; }
+};
+
+
+struct Mapping_t
+//!< placements of reads on the reference
+{
+ vector<Placement_t *> reads;
+ list<Signature_t> sigs;
+
+ Mapping_t() { }
+ ~Mapping_t()
+ {
+ vector<Placement_t *>::iterator ppi;
+ for ( ppi = reads.begin(); ppi != reads.end(); ++ ppi )
+ delete (*ppi);
+ }
+};
+
+
+struct EdgeletCmp_t
+//!< Compares query lo coord
+{
+ bool operator() (const DeltaEdgelet_t * a, const DeltaEdgelet_t * b) const
+ { return ( a->loQ < b->loQ ); }
+};
+
+
+//========================================================== Fuction Decs ====//
+
+//------------------------------------------------------- CleanSignatures ----//
+void CleanSignatures (Mapping_t & mapping);
+
+
+//----------------------------------------------------- CombineSignatures ----//
+//! \brief Combine like signatures
+//!
+//! \pre sigs vector is populated
+//! \post Like signatures have been collapsed
+//! \param mapping The mapping containing the list of signatures
+//! \return void
+//!
+void CombineSignatures (Mapping_t & mapping);
+
+
+//----------------------------------------------------- CompareSignatures ----//
+//! \brief Compares two signatures for equality
+//!
+//! Returns 1 if signatures match in foward direction, -1 if match in reverse,
+//! or 0 if they don't match.
+//!
+//! \param a First signature
+//! \param b Second signature
+//! \return 1,-1 for match, 0 for no match
+//!
+int CompareSignatures (const Signature_t & a, const Signature_t & b);
+
+
+//--------------------------------------------------------- GetAlignments ----//
+//! \brief Read in the alignment info
+//!
+//! \param graph The empty alignment graph
+//! \return void
+//!
+void GetAlignments (DeltaGraph_t & graph);
+
+
+//-------------------------------------------------------------- GetReads ----//
+//! \brief Read in the read and mate info, if any
+//!
+//! \param graph The filled alignment graph
+//! \param mapping The empty read mapping
+//! \return void
+//!
+void GetReads (const DeltaGraph_t & graph, Mapping_t & mapping);
+
+
+//-------------------------------------------------------- OutputFeatures ----//
+void OutputFeatures (const Mapping_t & mapping);
+
+
+//----------------------------------------------------------- OutputPaths ----//
+void OutputPaths (const Mapping_t & mapping);
+
+
+//----------------------------------------------------------- PlaceUnique ----//
+//! \brief Place reads with an unambiguous mapping to the reference
+//!
+//! \param mapping The read mapping
+//! \return void
+//!
+void PlaceUnique (Mapping_t & mapping);
+
+
+//---------------------------------------------------------- PlaceRepeats ----//
+//! \brief Place reads with an ambiguous mapping to the reference
+//!
+//! \param mapping The read mapping
+//! \return void
+//!
+void PlaceRepeats (Mapping_t & mapping);
+
+
+//------------------------------------------------------ RecordSignatures ----//
+//! \brief Reads the alignment graph and records the alignment signatures
+//!
+//! \param graph Alignment graph
+//! \param mapping The mapping containing the empty signature list
+//! \pre Alignment graph has been filtered and cleaned
+//! \post Populates the sigs list, one per aligned sequence
+//! \return void
+//!
+void RecordSignatures (const DeltaGraph_t & graph, Mapping_t & mapping);
+
+
+//------------------------------------------------------------- ParseArgs ----//
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \param argc
+//! \param argv
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//------------------------------------------------------------- PrintHelp ----//
+//! \brief Prints help information to cout
+//!
+//! \param s The program name
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//------------------------------------------------------------ PrintUsage ----//
+//! \brief Prints usage information to cout
+//!
+//! \param s The program name
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+//========================================================== Inline Funcs ====//
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ DeltaGraph_t graph;
+ Mapping_t mapping;
+
+ //-- COMMAND
+ ParseArgs (argc, argv); // parse the command line arguments
+ srand (OPT_Seed);
+
+ //-- GET/CLEAN ALIGNMENTS
+ cerr << "Building alignment graph\n";
+ GetAlignments (graph);
+
+ //-- GET READS
+ cerr << "Fetching read and mate information\n";
+ GetReads (graph, mapping);
+
+ //-- PLACE UNAMBIGUOUS READS
+ cerr << "Placing unique reads\n";
+ PlaceUnique (mapping);
+
+ //-- PLACE READS IN REPEATS
+ cerr << "Placing repetitive reads\n";
+ PlaceRepeats (mapping);
+
+
+ //-- GENERATE SIGNATURES
+ RecordSignatures (graph, mapping);
+
+ //-- COMBINE SIGNATURES
+ CombineSignatures (mapping);
+
+ CleanSignatures (mapping);
+
+ //-- OUTPUT
+ cerr << "Outputting read paths\n";
+ if ( ! OPT_FeaturesName.empty() )
+ OutputFeatures (mapping);
+
+ if ( ! OPT_PathsName.empty() )
+ OutputPaths (mapping);
+
+
+ return EXIT_SUCCESS;
+}
+
+
+//------------------------------------------------------- CleanSignatures ----//
+void CleanSignatures (Mapping_t & mapping)
+{
+ list<Signature_t>::iterator i (mapping.sigs.begin());
+
+ while ( i != mapping.sigs.end() )
+ {
+ //-- Remove signatures with insufficient support
+ if ( i->qry.size() < OPT_Redundancy )
+ i = mapping.sigs.erase (i);
+ else
+ ++ i;
+ }
+}
+
+
+//----------------------------------------------------- CombineSignatures ----//
+void CombineSignatures (Mapping_t & mapping)
+{
+ int cmp;
+ list<Signature_t>::iterator i, j;
+
+ //-- Walk through the list and combine everything that's equal
+ for ( i = mapping.sigs.begin(); i != mapping.sigs.end(); ++ i )
+ {
+ j = i; ++ j;
+ while ( j != mapping.sigs.end() )
+ {
+ cmp = CompareSignatures (*i, *j);
+
+ if ( cmp )
+ {
+ if ( cmp > 0 ) // forward match
+ {
+ i->fc += j->fc;
+ i->rc += j->rc;
+ }
+ else // reverse match
+ {
+ i->fc += j->rc;
+ i->rc += j->fc;
+ }
+
+ i->qry.splice (i->qry.end(), j->qry);
+ j = mapping.sigs.erase (j);
+ }
+ else
+ ++ j;
+ }
+ }
+}
+
+
+//----------------------------------------------------- CompareSignatures ----//
+int CompareSignatures (const Signature_t & a, const Signature_t & b)
+{
+ //-- ** BEWARE ** of overflow for MAXIMAL values, use subtraction only!
+ int match = 1;
+ vector<long int>::const_iterator i, j;
+ vector<long int>::const_reverse_iterator k;
+
+ //-- Check the forward pos vector
+ for ( i = a.pos.begin(), j = b.pos.begin();
+ i != a.pos.end() && j != b.pos.end(); ++ i, ++ j )
+ if ( labs(*i) - OPT_Fuzzy > labs(*j)
+ ||
+ labs(*j) - OPT_Fuzzy > labs(*i) )
+ break;
+
+ //-- If not the same forward positions, try reverse
+ if ( i != a.pos.end() || j != b.pos.end() )
+ {
+ for ( i = a.pos.begin(), k = b.pos.rbegin();
+ i != a.pos.end() && k != b.pos.rend(); ++ i, ++ k )
+ if ( labs(*i) - OPT_Fuzzy > labs(*k)
+ ||
+ labs(*k) - OPT_Fuzzy > labs(*i) )
+ break;
+
+ //-- Different or same reverse positions?
+ match = ( i != a.pos.end() || k != b.pos.rend() ) ? 0 : -1;
+ }
+
+ //-- 'match' is now either 1 for forward, -1 for reverse or 0 for no match
+
+ //-- Check the gap vector
+ if ( match == 1 )
+ {
+ for ( i = a.gap.begin(), j = b.gap.begin();
+ i != a.gap.end() && j != b.gap.end(); ++ i, ++ j )
+ if ( labs(*i) - OPT_Fuzzy > labs(*j)
+ ||
+ labs(*j) - OPT_Fuzzy > labs(*i) )
+ break;
+
+ //-- If not the same forward gaps
+ if ( i != a.gap.end() || j != b.gap.end() )
+ match = 0;
+ }
+ else if ( match == -1 )
+ {
+ for ( i = a.gap.begin(), k = b.gap.rbegin();
+ i != a.gap.end() && k != b.gap.rend(); ++ i, ++ k )
+ if ( labs(*i) - OPT_Fuzzy > labs(*k)
+ ||
+ labs(*k) - OPT_Fuzzy > labs(*i) )
+ break;
+
+ //-- If not the same reverse gaps
+ if ( i != a.gap.end() || k != b.gap.rend() )
+ match = 0;
+ }
+
+
+ //-- If not the same references
+ if ( match != 0 && a.ref != b.ref )
+ match = 0;
+
+ return match;
+}
+
+
+
+//--------------------------------------------------------- GetAlignments ----//
+void GetAlignments (DeltaGraph_t & graph)
+{
+ //-- Short and sweet thanks to delta.hh
+ cerr << " build\n";
+ graph.build (OPT_AlignName, false);
+ cerr << " flag score\n";
+ graph.flagScore (0, OPT_MinIdentity);
+ cerr << " flag QLIS\n";
+ graph.flagQLIS();
+ cerr << " clean\n";
+ graph.clean();
+}
+
+
+//-------------------------------------------------------------- GetReads ----//
+void GetReads (const DeltaGraph_t & graph, Mapping_t & mapping)
+{
+ //-- If a bank exists, try and populate the read/mate info from it
+ if ( ! OPT_BankName.empty() )
+ {
+ Index_t mtpx, libx;
+ Bank_t red_bank (Read_t::NCODE);
+
+ //-- Mate info
+ cerr << " getting mate info from bank\n";
+ try {
+ mtpx.buildReadMate (OPT_BankName);
+ libx.buildReadLibrary (OPT_BankName);
+ } catch (const Exception_t & e) {
+ cerr << "WARNING: " << e.what() << endl
+ << " could not collect mate-pair information from bank\n";
+ }
+
+ //-- Read info
+ cerr << " getting read info from bank\n";
+ try {
+ red_bank.open (OPT_BankName, B_READ);
+
+ //-- Check if alignment file uses IIDs or EIDs
+ bool isIID = true;
+ if ( ! graph.qrynodes.empty() )
+ {
+ ID_t tempid;
+ string tempstr (*(graph.qrynodes.begin()->second.id));
+ istringstream ss (tempstr);
+ ss >> tempid;
+ if ( ! ss || ! red_bank.existsIID (tempid) )
+ {
+ if ( red_bank.existsEID (tempstr) )
+ isIID = false;
+ else
+ AMOS_THROW ("Query IDs do not match the read bank");
+ }
+ }
+ if ( isIID )
+ cerr << " looks like alignment uses IIDs\n";
+ else
+ cerr << " looks like alignment uses EIDs\n";
+
+ //-- Iterating through the IDMap will be quicker than streaming
+ ID_t r1, r2;
+ string s1, s2;
+ Placement_t * p1, * p2;
+ ostringstream ss;
+ Index_t::iterator ii;
+ map<string, DeltaNode_t>::const_iterator mi;
+
+ IDMap_t::const_iterator idmi;
+ const IDMap_t & idmap = red_bank.getIDMap();
+ IDMap_t seen (idmap.getBuckets());
+ for ( idmi = idmap.begin(); idmi != idmap.end(); ++ idmi )
+ {
+ if ( idmi->iid == NULL_ID )
+ AMOS_THROW ("All read objects must have an IID");
+
+ //-- If we've seen it already, don't do it again
+ if ( seen.exists (idmi->iid) )
+ continue;
+
+ r1 = idmi->iid;
+ r2 = mtpx.lookup (r1);
+
+ seen.insert (r1);
+ seen.insert (r2);
+
+ //-- Translate from IID to alignment ID
+ if ( isIID )
+ {
+ ss.str("");
+ ss << r1;
+ s1 = ss.str();
+ ss.str("");
+ ss << r2;
+ s2 = ss.str();
+ }
+ else
+ {
+ s1 = idmi->eid;
+ s2 = idmap.lookupEID (r2);
+ }
+
+ //-- Add the read to the mapping
+ p1 = new Placement_t();
+ p1->iid = r1;
+ mi = graph.qrynodes.find (s1.c_str());
+ if ( mi != graph.qrynodes.end() )
+ p1->read = &(mi->second);
+ mapping.reads.push_back (p1);
+
+ //-- Add it's mate to the mapping
+ if ( r2 != NULL_ID )
+ {
+ p2 = new Placement_t();
+ p2->iid = r2;
+ mi = graph.qrynodes.find (s2.c_str());
+ if ( mi != graph.qrynodes.end() )
+ p2->read = &(mi->second);
+ mapping.reads.push_back (p2);
+
+ //-- Link the mates
+ p1->mate = p2;
+ p2->mate = p1;
+ }
+ }
+
+ red_bank.close();
+ }
+ catch (const Exception_t & e) {
+ cerr << "WARNING: " << e.what() << endl
+ << " could not collect read information from bank\n";
+ }
+ }
+
+ //-- If no bank reads, populate from alignment info
+ if ( mapping.reads.empty() )
+ {
+ cerr << " getting partial list of reads from alignment graph\n";
+
+ map<string, DeltaNode_t>::const_iterator mi;
+ for ( mi = graph.qrynodes.begin(); mi != graph.qrynodes.end(); ++ mi )
+ {
+ Placement_t * pp = new Placement_t();
+ pp->read = &(mi->second);
+ mapping.reads.push_back (pp);
+ }
+ }
+}
+
+
+//-------------------------------------------------------- OutputFeatures ----//
+void OutputFeatures (const Mapping_t & mapping)
+{
+ ofstream out (OPT_FeaturesName.c_str());
+ if ( !out )
+ cerr << "WARNING: could not open " << OPT_FeaturesName << endl;
+
+ list<Signature_t>::const_iterator si;
+ vector<long int>::const_iterator pi;
+ vector<const DeltaNode_t *>::const_iterator ri;
+ vector<long int>::const_iterator gi;
+ long int s, e;
+
+ for ( si = mapping.sigs.begin(); si != mapping.sigs.end(); ++ si )
+ {
+ ostringstream ss;
+
+ ss << si->qry.size() << " ("
+ << si->fc << ',' << si->rc << ") ";
+
+ ri = si->ref.begin();
+ gi = si->gap.begin();
+ for ( pi = si->pos.begin(); pi != si->pos.end(); ++ pi, ++ ri )
+ {
+ if ( labs (*pi) == MAXIMAL )
+ ss << 'B';
+ else
+ ss << labs (*pi);
+
+ if ( *pi < *(++ pi) )
+ ss << " <-[" << *((*ri)->id) << "]- ";
+ else
+ ss << " -[" << *((*ri)->id) << "]-> ";
+
+ if ( labs (*pi) == MAXIMAL )
+ ss << 'E';
+ else
+ ss << labs (*pi);
+
+ if ( gi != si->gap.end() )
+ ss << " |" << *(gi++) << "| ";
+ }
+ ss << '\n';
+
+ ri = si->ref.begin();
+ for ( pi = si->pos.begin(); pi != si->pos.end(); ++ pi, ++ ri )
+ {
+ if ( labs (*pi) != MAXIMAL )
+ {
+ s = e = labs (*pi);
+
+ if ( *pi > *(pi+1) ) ++ s;
+ else ++ e;
+
+ out << "{FEA\n"
+ << "typ:B\n"
+ << "src:" << *((*ri)->id) << ",CTG\n"
+ << "com:" << ss.str()
+ << "clr:" << s << ',' << e << '\n'
+ << "}\n";
+ }
+
+ ++ pi;
+
+ if ( labs (*pi) != MAXIMAL )
+ {
+ s = e = labs (*pi);
+
+ if ( *pi > *(pi-1) ) ++ s;
+ else ++ e;
+
+ out << "{FEA\n"
+ << "typ:B\n"
+ << "src:" << *((*ri)->id) << ",CTG\n"
+ << "com:" << ss.str()
+ << "clr:" << s << ',' << e << '\n'
+ << "}\n";
+ }
+ }
+ }
+
+ out.close();
+}
+
+
+//----------------------------------------------------------- OutputPaths ----//
+void OutputPaths (const Mapping_t & mapping)
+{
+ ofstream out (OPT_PathsName.c_str());
+ if ( !out )
+ cerr << "WARNING: could not open " << OPT_PathsName << endl;
+
+ list<Signature_t>::const_iterator si;
+ list<const DeltaNode_t *>::const_iterator qi;
+ vector<long int>::const_iterator pi;
+ vector<const DeltaNode_t *>::const_iterator ri;
+ vector<long int>::const_iterator gi;
+
+ for ( si = mapping.sigs.begin(); si != mapping.sigs.end(); ++ si )
+ {
+ out << "> "
+ << si->qry.size() << " ("
+ << si->fc << ',' << si->rc << ") ";
+
+ ri = si->ref.begin();
+ gi = si->gap.begin();
+ for ( pi = si->pos.begin(); pi != si->pos.end(); ++ pi, ++ ri )
+ {
+ if ( labs (*pi) == MAXIMAL )
+ out << 'B';
+ else
+ out << labs (*pi);
+
+ if ( *pi < *(++ pi) )
+ out << " <-[" << *((*ri)->id) << "]- ";
+ else
+ out << " -[" << *((*ri)->id) << "]-> ";
+
+ if ( labs (*pi) == MAXIMAL )
+ out << 'E';
+ else
+ out << labs (*pi);
+
+ if ( gi != si->gap.end() )
+ out << " |" << *(gi++) << "| ";
+ }
+ out << '\n';
+
+ for ( qi = si->qry.begin(); qi != si->qry.end(); ++ qi )
+ out << *((*qi)->id) << '\n';
+ out << '\n';
+ }
+
+ out.close();
+}
+
+
+//----------------------------------------------------------- PlaceUnique ----//
+void PlaceUnique (Mapping_t & mapping)
+{
+ vector<Placement_t *>::iterator ppi;
+
+ for ( ppi = mapping.reads.begin(); ppi != mapping.reads.end(); ++ ppi )
+ {
+ //-- Skip if no alignments or already placed
+ if ( (*ppi)->read == NULL || (*ppi)->chain != NULL )
+ continue;
+
+ //-- If unambiguous mapping, place the read
+ if ( (*ppi)->read->chains.size() == 1 )
+ {
+ (*ppi)->chain = (*ppi)->read->chains.front();
+ }
+ }
+}
+
+
+//---------------------------------------------------------- PlaceRepeats ----//
+void PlaceRepeats (Mapping_t & mapping)
+{
+ vector<Placement_t *>::iterator ppi;
+
+ for ( ppi = mapping.reads.begin(); ppi != mapping.reads.end(); ++ ppi )
+ {
+ //-- Skip if no alignments or already placed
+ if ( (*ppi)->read == NULL || (*ppi)->chain != NULL )
+ continue;
+
+ //-- If ambiguous mapping, place the read
+ if ( (*ppi)->read->chains.size() != 1 )
+ {
+ (*ppi)->chain = (*ppi)->read->chains.front();
+ }
+ }
+}
+
+
+//------------------------------------------------------ RecordSignatures ----//
+//
+// Signatures will be generated as group of integer vectors, such that for the
+// set of alignments of a query to the reference will be represented as:
+//
+// [sR]---[eR] [sR]---[eR] [sR]---[eR]
+// [nodeR] [nodeR] [nodeR]
+// [gap] [gap]
+//
+// where the [sR] [eR] pairs are the start and end of each query alignment in
+// the reference, and the corresponding [nodeR] is the reference in which the
+// alignment occurs. The [gap] is the distance (negative for overlap) between
+// adjacent alignments in the query. The [sR] [eR] pairs are ordered by the
+// alignment's query position, lo to hi, and the [nodeR], [gap] values are
+// similarly ordered. The [sR] [eR] values are also given a sign to represent
+// represent the direction of the match in the reference (i.e. the alignment
+// slope), +- for forward, -+ for reverse. If the first or last position is
+// maximal, that is cannot be extended without reaching the end of the query,
+// it is marked with the MAXIMAL value to indicate the break as incidental.
+//
+void RecordSignatures (const DeltaGraph_t & graph, Mapping_t & mapping)
+{
+ long int qlen;
+ const string * qid;
+ vector<DeltaEdgelet_t *> edgelets;
+
+ map<string, DeltaNode_t>::const_iterator mi;
+ vector<DeltaEdge_t *>::const_iterator ei;
+ vector<DeltaEdgelet_t *>::iterator eli;
+
+ for ( mi = graph.qrynodes.begin(); mi != graph.qrynodes.end(); ++ mi )
+ {
+ qid = mi->second.id;
+ qlen = mi->second.len;
+
+ //-- Collect the alignments for this query
+ // graph should be clean, so no need to worry about bad alignments
+ edgelets.clear();
+ for ( ei = (mi->second).edges.begin();
+ ei != (mi->second).edges.end(); ++ ei )
+ for ( eli = (*ei)->edgelets.begin();
+ eli != (*ei)->edgelets.end(); ++ eli )
+ edgelets.push_back (*eli);
+
+ assert ( !edgelets.empty() );
+
+ //-- Sort by loQ
+ sort (edgelets.begin(), edgelets.end(), EdgeletCmp_t());
+
+ int slope;
+ long int pos;
+ vector<DeltaEdgelet_t *>::iterator first = edgelets.begin();
+ vector<DeltaEdgelet_t *>::iterator last = -- edgelets.end();
+
+ //-- If alignment is clean, we don't need a signature from it
+ if ( first == last &&
+ (*first)->loQ <= 1 + OPT_MaxTrim &&
+ (*first)->hiQ >= qlen - OPT_MaxTrim )
+ continue;
+
+ //-- Make a signature
+ mapping.sigs.push_back (Signature_t());
+ Signature_t & sig = mapping.sigs.back();
+ sig.qry.push_back (&(mi->second));
+ sig.fc ++;
+
+ for ( eli = edgelets.begin(); eli != edgelets.end(); ++ eli )
+ {
+ slope = ((*eli)->dirR == (*eli)->dirQ) ? 1 : -1;
+
+ //-- [sR]
+ if ( eli == first && (*eli)->loQ <= 1 + OPT_MaxTrim )
+ pos = MAXIMAL * slope;
+ else
+ pos = (slope == 1) ? (*eli)->loR * slope : (*eli)->hiR * slope;
+ sig.pos.push_back (pos);
+
+ //-- [nodeR]
+ sig.ref.push_back ((*eli)->edge->refnode);
+
+ //-- [eR]
+ if ( eli == last && (*eli)->hiQ >= qlen - OPT_MaxTrim )
+ pos = MAXIMAL * -slope;
+ else
+ pos = (slope == 1) ? (*eli)->hiR * -slope : (*eli)->loR * -slope;
+ sig.pos.push_back (pos);
+
+ //-- [gap]
+ if ( eli != last )
+ sig.gap.push_back ((*(eli + 1))->loQ - (*eli)->hiQ - 1);
+ }
+ }
+}
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg &&
+ ((ch = getopt (argc, argv, "b:c:f:F:hi:P:s:t:")) != EOF) )
+ switch (ch)
+ {
+ case 'b':
+ OPT_BankName = optarg;
+ break;
+
+ case 'c':
+ OPT_Redundancy = atoi (optarg);
+ break;
+
+ case 'f':
+ OPT_Fuzzy = atoi (optarg);
+ break;
+
+ case 'F':
+ OPT_FeaturesName = optarg;
+ break;
+
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'i':
+ OPT_MinIdentity = atof (optarg);
+ break;
+
+ case 'P':
+ OPT_PathsName = optarg;
+ break;
+
+ case 's':
+ OPT_Seed = atoi (optarg);
+ break;
+
+ case 't':
+ OPT_MaxTrim = atoi (optarg);
+ break;
+
+ default:
+ errflg ++;
+ }
+
+ if ( errflg > 0 || optind != argc - 1 )
+ {
+ PrintUsage (argv[0]);
+ cout << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ if ( OPT_Seed < 0 )
+ OPT_Seed = time (NULL);
+
+ OPT_AlignName = argv [optind ++];
+}
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ cout
+ << ".NAME.\n\n"
+ << s << "\n\n"
+ << "Comparative assembly layout\n\n";
+
+ PrintUsage (s);
+
+ cout
+ << ".OPTIONS.\n\n"
+ << "-b string Bank for mate/read info and layout/scaffold output\n"
+ << "-c int Number of concurring signatures required, default "
+ << OPT_Redundancy << endl
+ << "-f uint Set the fuzzy equals tolerance for break positions,\n"
+ << " default " << OPT_Fuzzy << endl
+ << "-F file Output read paths to file as AMOS features\n"
+ << "-h Display help information\n"
+ << "-i float Set the minimum alignment identity, default "
+ << OPT_MinIdentity << endl
+ << "-P file Output read paths to file in wacky format\n"
+ << "-s uint Set random generator seed to unsigned int, default\n"
+ << " seed is generated by the system clock\n"
+ << "-t uint Set maximum ignorable trim length, default "
+ << OPT_MaxTrim << endl
+ << endl;
+
+ cout
+ << ".DESCRIPTION.\n\n"
+ << s << " in development\n"
+ << endl;
+
+ cout
+ << ".KEYWORDS.\n\n"
+ << "assembly, validation, comparison\n\n";
+
+ return;
+}
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cout
+ << ".USAGE.\n\n"
+ << s << " <deltafile>\n\n";
+
+ return;
+}
diff --git a/src/Casm/casm-layout.cc b/src/Casm/casm-layout.cc
new file mode 100644
index 0000000..9d45383
--- /dev/null
+++ b/src/Casm/casm-layout.cc
@@ -0,0 +1,2368 @@
+///////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 03/08/2004
+//!
+//! \brief Layout the query seqs based on alignment and mate-pair info
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "delta.hh"
+#include <algorithm>
+#include <cstdlib>
+#include <climits>
+#include <ctime>
+#include <cmath>
+#include <fstream>
+#include <map>
+#include <set>
+#include <vector>
+#include <list>
+#include <string>
+#include <sstream>
+#include <iostream>
+#include <cassert>
+#include <unistd.h>
+using namespace std;
+
+
+
+
+//=============================================================== Options ====//
+string OPT_BankName; // bank name parameter
+string OPT_AlignName; // alignment name parameter
+
+string OPT_ConflictName; // conflict output file
+string OPT_MapName; // read map name
+string OPT_TigrName; // tigr contig name
+string OPT_UmdName; // umd contig name
+
+bool OPT_Random = false; // randomly place ambiguous reads
+bool OPT_OnlyUsePairs = false; // place only happy mate pairs
+bool OPT_Singletons = false; // keep singletons
+
+int OPT_Stdvs = 5; // "happy" number of stdvs from mean
+int OPT_MinOverlap = 10; // minimum overlap between reads
+int OPT_MaxTrimLen = 20; // maximum ignorable trim length
+int OPT_MaxGap = 10000; // maximum gap in an alignment chain
+int OPT_Seed = -1; // random seed
+
+float OPT_Majority = 70.0; // majority needed to call a conflict
+float OPT_MinCoverage = 25.0; // min coverage to tile
+float OPT_MinIdentity = 70.0; // min identity to tile
+float OPT_MaxCoverageDiff = 2.0; // max %coverage diff between 'best'
+float OPT_MaxIdentityDiff = 2.0; // max %identity diff between 'best'
+
+
+//============================================================= Constants ====//
+const char FORWARD_CHAR = '+';
+const char REVERSE_CHAR = '-';
+
+const int FUZZY = 10; // fuzzy equals tolerance
+
+struct ReadMap_t;
+struct Contig_t;
+
+struct Conflict_t
+{
+ // don't swap order, sorts depend on values
+ enum
+ {
+ INDEL, // both breaks of an indel present
+ HIBREAK, // read breaks early at hi end
+ LOBREAK, // read breaks early at lo end
+ };
+ enum
+ {
+ SUPPORTED, // majority supported conflict
+ UNSUPPORTED, // majority unsupported conflict
+ ARTIFACT, // break is an artifact of a supported indel conflict
+ AMBIGUOUS, // no majority either way
+ };
+
+ short int status; // include this conflict in the layout
+ int type; // type of the conflict (enum above)
+ long int pos; // reference pos of the conflict
+ long int gapR, gapQ; // gap in the ref and query
+ set<ReadMap_t *> support; // the supporting reads
+ set<ReadMap_t *> discount; // the disagreeing reads
+
+ Conflict_t (int t, long int p, long int gr, long int gq, ReadMap_t * rmp)
+ {
+ status = UNSUPPORTED;
+ type = t;
+ pos = p;
+ gapR = gr;
+ gapQ = gq;
+ support . insert (rmp);
+ }
+};
+
+struct Reference_t
+{
+ const string * id; // points to reference map key
+ long int len; // length of reference
+ list<Conflict_t *> conflicts; // conflicts on reference
+
+ Reference_t ( ) { id = NULL; }
+ ~Reference_t ( )
+ {
+ list<Conflict_t *>::iterator cpi;
+ for ( cpi = conflicts . begin( ); cpi != conflicts . end( ); ++ cpi )
+ delete (*cpi);
+ }
+};
+
+struct Mate_t
+{
+ ReadMap_t * read; // points to read mate or NULL
+ int minoff, maxoff; // min and max offsets
+ AMOS::FragmentType_t type;
+ //TODO implement transposon mates, etc.
+
+ Mate_t ( ) { read = NULL; type = AMOS::Fragment_t::INSERT; }
+};
+
+struct ReadAlign_t
+{
+ Reference_t * ref; // ponits to the reference map value
+ char ori; // orientation of read relative to ref
+ long int loR, hiR, lo, hi; // lo hi in ref, lo hi in read
+ float idy; // identity of alignment
+ ReadAlign_t * from; // linking for chained alignments
+
+ ReadAlign_t ( ) { ref = NULL; from = NULL; }
+};
+
+struct ReadAlignChain_t
+{
+ ReadAlign_t * head; // points to head of alignment chain
+
+ long int beg, end; // begin and end map points in the reference
+ long int tbeg, tend; // lo and hi trim points
+ long int len; // read chain length (sum of align lens)
+ float idy; // read weighted avg identity
+
+ ReadAlignChain_t ( ) { head = NULL; }
+ ReadAlignChain_t (const ReadMap_t * rmp, ReadAlign_t * rap);
+};
+
+struct ReadMap_t
+{
+ AMOS::ID_t id; // ID of read
+ long int len; // len of read
+
+ vector<ReadAlign_t *> all; // all alignments for this read
+ list<ReadAlignChain_t *> best; // list of best alignment chains
+ ReadAlignChain_t * place; // read placement chain
+
+ Mate_t mate; // the read's mate
+
+ bool exclude; // exclude the read from the layout
+
+ ReadMap_t ( ) { place = NULL; exclude = false; }
+ ~ReadMap_t ( )
+ {
+ vector<ReadAlign_t *>::iterator rapi;
+ for ( rapi = all . begin( ); rapi != all . end( ); ++ rapi )
+ delete (*rapi);
+ list<ReadAlignChain_t *>::iterator rcpi;
+ for ( rcpi = best . begin( ); rcpi != best . end( ); ++ rcpi )
+ delete (*rcpi);
+ }
+};
+
+struct Mapping_t
+{
+ map<string, Reference_t> references; // map of references
+ vector<ReadMap_t *> reads; // vector of reads
+
+ ~Mapping_t ( )
+ {
+ vector<ReadMap_t *>::iterator rmpi;
+ for ( rmpi = reads . begin( ); rmpi != reads . end( ); ++ rmpi )
+ delete (*rmpi);
+ }
+};
+
+struct Tile_t
+{
+ ReadMap_t * read;
+ long int off;
+ long int beg, end;
+
+ Tile_t ( ) { read = NULL; }
+ Tile_t (ReadMap_t * rmp, Contig_t * cp);
+};
+
+struct Contig_t
+{
+ vector<Tile_t *> tiles;
+ long int len;
+ long int adjust;
+
+ Contig_t ( ) { len = adjust = 0; }
+ ~Contig_t ( )
+ {
+ vector<Tile_t *>::iterator tpi;
+ for ( tpi = tiles . begin( ); tpi != tiles . end( ); ++ tpi )
+ delete (*tpi);
+ }
+};
+
+struct Assembly_t
+{
+ vector<Contig_t *> contigs;
+
+ ~Assembly_t ( )
+ {
+ vector<Contig_t *>::iterator cpi;
+ for ( cpi = contigs . begin( ); cpi != contigs . end( ); ++ cpi )
+ delete (*cpi);
+ }
+};
+
+
+struct ConflictCmp_t
+{
+ bool operator( ) (const Conflict_t * A, const Conflict_t * B)
+ {
+ if ( A -> pos < B -> pos )
+ return true;
+ else if ( A -> pos > B -> pos )
+ return false;
+
+ else if ( A -> type < B -> type )
+ return true;
+ else if ( A -> type > B -> type )
+ return false;
+
+ else if ( A -> gapR < B -> gapR )
+ return true;
+ else if ( A -> gapR > B -> gapR )
+ return false;
+
+ else if ( A -> gapQ < B -> gapQ )
+ return true;
+ else
+ return false;
+ }
+};
+
+struct ReadAlignCmp_t
+{
+ bool operator( ) (const ReadAlign_t * A, const ReadAlign_t * B)
+ { return ( A -> lo < B -> lo ); }
+};
+
+struct ReadHeapCmp_t
+{
+ bool operator( ) (const ReadMap_t * A, const ReadMap_t * B)
+ { return ( A -> place -> end > B -> place -> end ); }
+};
+
+struct ReadIdCmp_t
+{
+ bool operator( ) (const ReadMap_t * A, const ReadMap_t * B)
+ { return ( A -> id < B -> id ); }
+};
+
+struct ReadPlaceCmp_t
+{
+ bool operator( ) (const ReadMap_t * A, const ReadMap_t * B)
+ {
+ if ( A -> place == NULL || B -> place == NULL )
+ {
+ if ( A -> place == NULL && B -> place != NULL )
+ return true;
+ else
+ return false;
+ }
+
+ if ( A -> place -> head -> ref < B -> place -> head -> ref )
+ return true;
+ else if ( A -> place -> head -> ref > B -> place -> head -> ref )
+ return false;
+
+ if ( A -> place -> tbeg < B -> place -> tbeg )
+ return true;
+ else
+ return false;
+ }
+};
+
+struct ReadReferenceCmp_t
+{
+ bool operator( ) (const ReadMap_t * A, const ReadMap_t * B)
+ {
+ if ( A -> place == NULL || B -> place == NULL )
+ {
+ if ( A -> place == NULL && B -> place != NULL )
+ return true;
+ else
+ return false;
+ }
+
+ if ( A -> place -> head -> ref < B -> place -> head -> ref )
+ return true;
+ else
+ return false;
+ }
+};
+
+struct TileCmp_t
+{
+ bool operator( ) (const Tile_t * A, const Tile_t * B)
+ { return ( A -> off < B -> off ); }
+};
+
+struct ReadExcludePredicate_t
+{
+ bool operator( ) (const ReadMap_t * A)
+ { return ( A -> exclude ); }
+};
+
+struct ConflictExcludePredicate_t
+{
+ bool operator( ) (const Conflict_t * A)
+ { return ( A -> status != Conflict_t::SUPPORTED &&
+ A -> status != Conflict_t::AMBIGUOUS); }
+};
+
+
+
+//========================================================== Fuction Decs ====//
+//-------------------------------------------------------------- Assemble ----//
+//! \brief Construct the assembly
+//!
+//! Construct the read layout by throwing out disagreeing reads and adjusting
+//! layout offsets for reference differences (i.e. large indels).
+//!
+//! \param mapping The read mapping
+//! \param assembly The assembly contigs
+//! \pre RefineConflicts has been called
+//! \return void
+//!
+void Assemble (Mapping_t & mapping, Assembly_t & assembly);
+
+
+//----------------------------------------------------------- ChainAligns ----//
+//! \brief Run LAS and store the best alignment chains for each read
+//!
+//! \param mapping The read mapping
+//! \return void
+//!
+void ChainAligns (Mapping_t & mapping);
+
+
+//---------------------------------------------------------- CleanContigs ----//
+//! \breif Clean contigs
+//!
+//! Sort by offset. Get rid of negative offsets. Get rid of zero coverage.
+//! Sets length.
+//!
+//! \param assembly The assembly contigs
+//! \return void
+//!
+void CleanContigs (Assembly_t & assembly);
+
+
+//--------------------------------------------------------- FindConflicts ----//
+//! \brief Find and store conflicts between the reads and the refs
+//!
+//! \param mapping The read mapping
+//! \return void
+//!
+void FindConflicts (Mapping_t & mapping);
+
+
+//------------------------------------------------------------ ParseAlign ----//
+//! \brief Parse, sort and store the alignment input
+//!
+//! \param mapping The uninitialized read mapping
+//! \post All reads sorted by read ID
+//! \post All alignments are sorted by lo read coordinate
+//! \post All mate records are NULL
+//! \return void
+//!
+void ParseAlign (Mapping_t & mapping);
+
+
+//------------------------------------------------------------ ParseMates ----//
+//! \brief Parse, sort and store the matepair input
+//!
+//! \param mates The read-initialized mapping
+//! \pre mapping is sorted by read ID
+//! \post All mate records in reads are populated
+//! \return void
+//!
+void ParseMates (Mapping_t & mapping);
+
+
+//------------------------------------------------------- PlaceHappyMates ----//
+//! \brief Place all unplaced read matepairs while keeping them 'happy'
+//!
+//! If a matepair can be happy at more than one spot, it will not be placed,
+//! unless the OPT_Random option is turned on, then it will be placed at
+//! random into one of it's happy spots.
+//!
+//! \param mapping The read mapping
+//! \return void
+//!
+void PlaceHappyMates (Mapping_t & mapping);
+
+
+//----------------------------------------------------------- PlaceRandom ----//
+//! \brief Randomly place all unplaced reads
+//!
+//! \param mapping The read mapping
+//! \return void
+//!
+void PlaceRandom (Mapping_t & mapping);
+
+
+//------------------------------------------------------ PlaceUnambiguous ----//
+//! \brief Place all unplaced reads with unambiguous mappings
+//!
+//! \param mapping The read mapping with everything populated except placements
+//! \return void
+//!
+void PlaceUnambiguous (Mapping_t & mapping);
+
+
+//------------------------------------------------------- OutputConflicts ----//
+//! \brief Outputs all of the reference conflicts
+//!
+//! \param mapping The read mapping with conflicts generated
+//! \return void
+//!
+void OutputConflicts (const Mapping_t & mapping);
+
+
+//--------------------------------------------------------- OutputLayouts ----//
+//! \brief Outputs all of the layouts to the bank
+//!
+//! \param mapping The read mapping with conflicts generated
+//! \return void
+//!
+void OutputLayouts (const Assembly_t & assembly);
+
+
+//--------------------------------------------------------- OutputMapping ----//
+//! \brief Outputs all the read mappings
+//!
+//! \param mapping The read mapping
+//! \pre read list is sorted by place
+//! \return void
+//!
+void OutputMapping (Mapping_t & mapping);
+
+
+//------------------------------------------------------------ OutputTigr ----//
+//! \brief Outputs the assembly in TIGR CTG format
+//!
+//! \param assembly The assembly
+//! \return void
+//!
+void OutputTigr (const Assembly_t & assembly);
+
+
+//------------------------------------------------------------ OutputUMD -----//
+//! \brief Outputs the assembly in UMD CTG format
+//!
+//! \param assembly The assembly
+//! \return void
+//!
+void OutputUMD (const Assembly_t & assembly);
+
+
+//------------------------------------------------------- RefineConflicts ----//
+//! \brief Count discounting reads, combine and select conflicts
+//!
+//! Leaves support and discount vectors sorted by ReadMap *
+//!
+//! \param mapping The read mapping
+//! \pre FindConflicts has been called
+//! \return void
+//!
+void RefineConflicts (Mapping_t & mapping);
+
+
+//------------------------------------------------------------- ParseArgs ----//
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//------------------------------------------------------------- PrintHelp ----//
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//------------------------------------------------------------ PrintUsage ----//
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+//========================================================== Inline Funcs ====//
+//------------------------------------------------------------------ lmin ----//
+inline long int lmin (long int a, long int b)
+{ return (a < b ? a : b); }
+
+
+//------------------------------------------------------------------ lmax ----//
+inline long int lmax (long int a, long int b)
+{ return (a < b ? b : a); }
+
+
+//---------------------------------------------------------- CallConflict ----//
+inline void CallConflict (Conflict_t * c)
+{
+ long int yay = c -> support . size( );
+ long int nay = c -> discount . size( );
+ float tot = yay + nay;
+ if ( tot == 0 ) tot = -1;
+
+ if ( (float)yay / tot * 100.0 >= OPT_Majority )
+ c -> status = Conflict_t::SUPPORTED;
+ else if ( (float)nay / tot * 100.0 >= OPT_Majority )
+ c -> status = Conflict_t::UNSUPPORTED;
+ else
+ c -> status = Conflict_t::AMBIGUOUS;
+}
+
+
+//----------------------------------------------------------- GapDistance ----//
+pair<long int, long int> GapDistance (ReadAlign_t * loa, ReadAlign_t * hia)
+{
+ long int gapR = hia -> loR - loa -> hiR - 1;
+ return make_pair ( - gapR < hia -> ref -> len / 2 ? gapR :
+ (hia -> loR - 1) + (hia -> ref -> len - loa -> hiR),
+ hia -> lo - loa -> hi - 1 );
+}
+
+
+//--------------------------------------------------------- IsBetterChain ----//
+inline bool IsBetterChain (const ReadAlignChain_t * cand,
+ const ReadAlignChain_t * best,
+ const ReadMap_t * read)
+{
+ if ( (float)labs(best -> len - cand -> len) /
+ (float)(read -> len) * 100.0 > OPT_MaxCoverageDiff )
+ return cand -> len > best -> len;
+ else
+ {
+ if ( fabs(best -> idy - cand -> idy) > OPT_MaxIdentityDiff )
+ return cand -> idy > best -> idy;
+ else
+ {
+ if ( cand -> idy <= best -> idy && cand -> len <= best -> len )
+ return false;
+ if ( cand -> idy >= best -> idy && cand -> len >= best -> len )
+ return true;
+ if ( cand -> head -> from == NULL && best -> head -> from != NULL )
+ return true;
+ if ( cand -> head -> from != NULL && best -> head -> from == NULL )
+ return false;
+ }
+ }
+
+ return cand -> len > best -> len;
+}
+
+
+//---------------------------------------------------------- IsEqualChain ----//
+inline bool IsEqualChain (const ReadAlignChain_t * cand,
+ const ReadAlignChain_t * best,
+ const ReadMap_t * read)
+{
+ return ((float)(best -> len - cand -> len) /
+ (float)(read -> len) * 100.0 <= OPT_MaxCoverageDiff &&
+ best -> idy - cand -> idy <= OPT_MaxIdentityDiff);
+}
+
+
+//------------------------------------------------------- IsEqualConflict ----//
+inline bool IsEqualConflict (const Conflict_t * A, const Conflict_t * B)
+{
+ return ( A -> type == B -> type &&
+ labs (A -> pos - B -> pos) <= FUZZY &&
+ labs (A -> gapR - B -> gapR) <= FUZZY &&
+ labs (A -> gapQ - B -> gapQ) <= FUZZY );
+}
+
+
+//---------------------------------------------------------- IsValidChain ----//
+inline bool IsValidChain(const ReadAlignChain_t * cand,
+ const ReadMap_t * read)
+{
+ return ((float)cand->len / (float)read->len * 100.0 >= OPT_MinCoverage &&
+ cand -> idy >= OPT_MinIdentity);
+}
+
+
+//-------------------------------------------------------------- PushHeap ----//
+inline void PushHeap (vector<ReadMap_t *> & heap, ReadMap_t * rmp)
+{
+ heap . push_back (rmp);
+ push_heap (heap . begin( ), heap . end( ), ReadHeapCmp_t( ));
+}
+
+
+//--------------------------------------------------------------- PopHeap ----//
+inline void PopHeap (vector<ReadMap_t *> & heap)
+{
+ pop_heap (heap . begin( ), heap . end( ), ReadHeapCmp_t( ));
+ heap . pop_back( );
+}
+
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ Mapping_t mapping;
+ Assembly_t assembly;
+
+ //-- COMMAND
+ ParseArgs (argc, argv); // parse the command line arguments
+ srand (OPT_Seed);
+
+ //-- INPUT
+ cerr << "INPUT" << endl;
+ cerr << " reads" << endl;
+ ParseAlign (mapping); // parse the alignment data
+ cerr << " lis" << endl;
+ ChainAligns (mapping); // build the LAS chains for each read
+ if ( !OPT_BankName . empty( ) )
+ {
+ cerr << " mates" << endl;
+ ParseMates (mapping); // parse the matepair data
+ }
+
+ //-- READ PLACEMENT
+ cerr << "PLACEMENT" << endl;
+
+ if ( !OPT_OnlyUsePairs )
+ PlaceUnambiguous(mapping); // place unambiguous reads
+
+ PlaceHappyMates(mapping); // place 'happy' matepairs
+
+ if ( OPT_Random && !OPT_OnlyUsePairs )
+ PlaceRandom(mapping); // randomly place all unplaced reads
+
+ sort (mapping.reads.begin( ), mapping.reads.end( ), ReadPlaceCmp_t( ));
+
+ //-- CONFLICT DETECTION
+ cerr << "CONFLICT" << endl;
+ FindConflicts (mapping); // find conflicts btwn reads and refs
+ RefineConflicts (mapping); // assess, combine and select conflicts
+
+ //-- ASSEMBLY
+ cerr << "ASSEMBLY" << endl;
+ Assemble (mapping, assembly); // layout the reads to form the assembly
+ CleanContigs (assembly); // clean up the contigs
+
+ //-- OUTPUT
+ cerr << "OUTPUT" << endl;
+ if ( ! OPT_ConflictName . empty( ) )
+ OutputConflicts (mapping); // print conflicts
+
+ if ( ! OPT_MapName . empty( ) )
+ OutputMapping (mapping); // print read mapping
+
+ if ( ! OPT_BankName . empty( ) )
+ OutputLayouts (assembly); // output layouts to AMOS bank
+
+ if ( ! OPT_TigrName . empty( ) )
+ OutputTigr (assembly); // print TIGR contigs
+
+ if ( ! OPT_UmdName . empty( ) )
+ OutputUMD (assembly); // print UMD contigs
+
+ return EXIT_SUCCESS;
+}
+
+
+
+
+//-------------------------------------------------------------- Assemble ----//
+void Assemble (Mapping_t & mapping, Assembly_t & assembly)
+{
+ ReadMap_t temprm;
+ temprm . place = new ReadAlignChain_t( );
+ temprm . place -> head = new ReadAlign_t( );
+
+ Reference_t * rp;
+ Contig_t * cp;
+ Tile_t * tp;
+
+ map<string, Reference_t>::iterator rmi;
+ list<ReadMap_t *>::iterator rmpi, rmpic;
+ list<Conflict_t *>::iterator cpi;
+
+ pair<
+ vector<ReadMap_t *>::iterator,
+ vector<ReadMap_t *>::iterator
+ > rmpip;
+
+ long int confbeg, confend;
+
+
+ //-- For each reference
+ for ( rmi = mapping . references . begin( );
+ rmi != mapping . references . end( ); ++ rmi )
+ {
+ rp = &(rmi -> second);
+
+ //-- Find the read mapping range
+ temprm . place -> head -> ref = rp;
+ rmpip = equal_range (mapping . reads . begin( ), mapping . reads . end( ),
+ &temprm, ReadReferenceCmp_t( ));
+
+ //-- For all reads mapping to the reference
+ list<ReadMap_t *> reads (rmpip.first, rmpip.second);
+ reads . remove_if (ReadExcludePredicate_t( ));
+
+ //-- For all non-excluded conflicts to this reference
+ list<Conflict_t *> confs (rp->conflicts.begin( ), rp->conflicts.end( ));
+ confs . remove_if (ConflictExcludePredicate_t( ));
+
+
+ //-- Keep going until all reads have been assembled
+ cp = NULL;
+ rmpi = reads . end( );
+ while ( ! reads . empty( ) )
+ {
+ //-- If end of list reached, push a new contig and start over
+ if ( rmpi == reads . end( ) )
+ {
+ if ( cp == NULL || !cp -> tiles . empty( ) )
+ {
+ cp = new Contig_t( );
+ assembly . contigs . push_back (cp);
+ }
+ rmpi = reads . begin( );
+ }
+
+
+ //-- Jump to the next conflict
+ for ( cpi = confs . begin( ); cpi != confs . end( ); ++ cpi )
+ if ( (*cpi) -> pos + FUZZY > (*rmpi) -> place -> tbeg )
+ {
+ confbeg = (*cpi) -> pos;
+ confend = (*cpi) -> gapR == 0
+ ? confbeg : confbeg + (*cpi) -> gapR + 1;
+ break;
+ }
+
+
+ //-- Assemble reads not involved in the conflict
+ while ( rmpi != reads . end( ) &&
+ (cpi == confs . end( ) ||
+ (*rmpi) -> place -> beg < lmax (confbeg, confend)) )
+ {
+ //-- Assemble pre-conflict reads
+ if ( cpi == confs . end( ) ||
+ (*rmpi) -> place -> end <= confbeg + OPT_MaxTrimLen )
+ {
+ tp = new Tile_t (*rmpi, cp);
+
+ //-- ASSEMBLE the read
+ cp -> tiles . push_back (tp);
+ rmpi = reads . erase (rmpi);
+ }
+ //-- Skip involved reads
+ else
+ ++ rmpi;
+ }
+
+
+ //-- If no conflict to process, continue
+ if ( cpi == confs . end( ) )
+ continue;
+
+
+ //-- If SUPPORTED, process the conflict
+ if ( (*cpi) -> status == Conflict_t::SUPPORTED )
+ {
+ //-- If LOBREAK, push a new contig
+ if ( (*cpi) -> type == Conflict_t::LOBREAK &&
+ !cp -> tiles . empty( ) )
+ {
+ cp = new Contig_t( );
+ assembly . contigs . push_back (cp);
+ }
+
+ //-- Assemble reads overlapping the conflict
+ for ( rmpic = reads . begin( ); rmpic != rmpi; )
+ {
+ //-- If a supporting read
+ if ( (*cpi)->support.find(*rmpic) != (*cpi)->support.end( ) )
+ {
+ tp = new Tile_t (*rmpic, cp);
+
+ //-- If LOBREAK on an INDEL, need to adjust the offset
+ if ( (*cpi) -> type == Conflict_t::INDEL &&
+ (*rmpic) -> place -> tbeg >= confend - FUZZY &&
+ (*rmpic) -> place -> tbeg -
+ (*rmpic) -> place -> beg > OPT_MaxTrimLen )
+ tp -> off += (*cpi) -> gapQ - (*cpi) -> gapR;
+
+ //-- ASSEMBLE the read
+ cp -> tiles . push_back (tp);
+ rmpic = reads . erase (rmpic);
+ }
+ else
+ ++ rmpic;
+ }
+
+ //-- Conflict post-processing
+ switch ( (*cpi) -> type )
+ {
+ case Conflict_t::LOBREAK: // do nothing
+ break;
+ case Conflict_t::HIBREAK: // new contig
+ rmpi = reads . end( );
+ break;
+ case Conflict_t::INDEL: // adjust for reference gap
+ cp -> adjust += (*cpi) -> gapQ - (*cpi) -> gapR;
+ break;
+ }
+ }
+ //-- If AMBIGUOUS, push a new contig if necessary
+ else if ( !cp -> tiles . empty( ) )
+ {
+ cp = new Contig_t( );
+ assembly . contigs . push_back (cp);
+ }
+
+
+ //-- Back up to end of resovled conflict
+ while ( rmpi != reads . begin( ) )
+ {
+ -- rmpi;
+ if ( (*rmpi) -> place -> beg < confend - OPT_MaxTrimLen )
+ {
+ ++ rmpi;
+ break;
+ }
+ }
+
+
+ //-- Resovled the conflict, remove it
+ cpi = confs . erase (cpi);
+ }
+ }
+
+ delete temprm . place -> head;
+ delete temprm . place;
+}
+
+
+
+
+//----------------------------------------------------------- ChainAligns ----//
+void ChainAligns (Mapping_t & mapping)
+{
+ struct ScoreLAS
+ {
+ ReadAlign_t * a;
+ long int score;
+ long int from;
+ };
+
+ ScoreLAS * las = NULL;
+
+ bool olapflag;
+ long int i, j, n, best;
+ long int olap1, olap2, olap, len;
+
+ vector<ReadMap_t *>::iterator rmpi;
+ list<ReadAlignChain_t *>::iterator rcpi;
+ ReadAlignChain_t * bestchain, * currchain;
+
+ //-- For each read in the mapping
+ for ( rmpi = mapping . reads . begin( );
+ rmpi != mapping . reads . end( ); ++ rmpi )
+ {
+ //-- Initialize the dynamic programming matrix
+ n = (*rmpi) -> all . size( );
+ las = (ScoreLAS *) AMOS::SafeRealloc (las, sizeof (ScoreLAS) * n);
+ for ( i = 0; i < n; i ++ )
+ {
+ las [i] . a = (*rmpi) -> all[i];
+ las [i] . score = las [i] . a -> hi - las [i] . a -> lo + 1;
+ las [i] . from = -1;
+ }
+
+ //-- Isn't it dynamic?
+ for ( i = 0; i < n; i ++ )
+ for ( j = 0; j < i; j ++ )
+ {
+ if ( las [i] . a -> ref != las [j] . a -> ref ||
+ las [i] . a -> ori != las [j] . a -> ori )
+ continue;
+
+ olap1 = las [j] . a -> hiR - las [i] . a -> loR + 1;
+ if ( OPT_MaxGap >= 0 && olap1 < -(OPT_MaxGap) )
+ continue;
+ olap = olap1 > 0 ? olap1 : 0;
+
+ olap2 = las [j] . a -> hi - las [i] . a -> lo + 1;
+ if ( OPT_MaxGap >= 0 && olap2 < -(OPT_MaxGap) )
+ continue;
+ olap = olap > olap2 ? olap : olap2;
+
+ len = las [i] . a -> hi - las [i] . a -> lo + 1;
+ if ( las [j] . score + len - olap > las [i] . score )
+ {
+ las [i] . from = j;
+ las [i] . score = las [j] . score + len - olap;
+ }
+ }
+
+ //-- Store all the non-redundant chains and store sorted by score
+ bestchain = NULL;
+ while (true)
+ {
+ best = 0;
+ for ( i = 1; i < n; i ++ )
+ if ( las [i] . score > las [best] . score )
+ best = i;
+ if ( las [best] . score <= 0 )
+ break;
+
+ olapflag = false;
+ for ( i = best; las [i] . from >= 0; i = las [i] . from )
+ {
+ if ( las [i] . score == 0 )
+ olapflag = true;
+ las [i] . score = 0;
+ las [i] . a -> from = las [las [i] . from] . a;
+ }
+ if ( las [i] . score == 0 )
+ olapflag = true;
+ las [i] . score = 0;
+ las [i] . a -> from = NULL;
+
+ if ( !olapflag )
+ {
+ currchain = new ReadAlignChain_t (*rmpi, las [best] . a);
+ (*rmpi) -> best . push_back (currchain);
+ if ( bestchain == NULL )
+ bestchain = currchain;
+ else if ( IsBetterChain (currchain, bestchain, *rmpi) )
+ bestchain = currchain;
+ }
+ }
+
+ //-- Keep only the 'best' chains, thus best . size > 0 == ambiguity
+ // i.e. within OPT_MaxCoverageDiff of the longest and within
+ // OPT_MaxIdentityDiff of the longest (with the higest idy)
+ rcpi = (*rmpi) -> best . begin( );
+ while ( rcpi != (*rmpi) -> best . end( ) )
+ {
+ if ( IsEqualChain (*rcpi, bestchain, *rmpi) )
+ ++ rcpi;
+ else
+ {
+ delete (*rcpi);
+ rcpi = (*rmpi) -> best . erase (rcpi);
+ }
+ }
+ }
+
+ free (las);
+}
+
+
+
+
+//---------------------------------------------------------- CleanContigs ----//
+void CleanContigs (Assembly_t & assembly)
+{
+ vector<Contig_t *>::iterator cpi;
+ vector<Tile_t *>::iterator tpi;
+ Contig_t * cp;
+ long int adj, end;
+
+ vector<Contig_t *> contigs;
+
+ for ( cpi = assembly . contigs . begin( );
+ cpi != assembly . contigs . end( ); ++ cpi )
+ {
+ //-- Sort the tiled reads
+ sort ((*cpi) -> tiles . begin( ), (*cpi) -> tiles . end( ), TileCmp_t( ));
+
+ //-- Write new clean contigs
+ cp = NULL;
+ for ( tpi = (*cpi)->tiles.begin( ); tpi != (*cpi)->tiles.end( ); ++ tpi )
+ {
+ //-- If a new contig or a zero coverage gap
+ if ( cp == NULL || (*tpi)->off - adj > cp->len - OPT_MinOverlap )
+ {
+ cp = new Contig_t( );
+ cp -> adjust = (*cpi) -> adjust;
+ contigs . push_back (cp);
+
+ adj = (*tpi) -> off;
+ }
+
+ (*tpi) -> off -= adj;
+ cp -> tiles . push_back (*tpi);
+ end = (*tpi) -> off + labs ((*tpi) -> end - (*tpi) -> beg) + 1;
+ if ( end > cp -> len )
+ cp -> len = end;
+ }
+ }
+
+ //-- Use the new clean contigs
+ assembly . contigs . clear( );
+ for ( cpi = contigs . begin( ); cpi != contigs . end( ); ++ cpi )
+ {
+ if ( (*cpi) -> tiles . size( ) <= 1 )
+ if ( (*cpi) -> tiles . size( ) == 0 || ! OPT_Singletons )
+ continue;
+ assembly . contigs . push_back (*cpi);
+ }
+}
+
+
+
+
+//--------------------------------------------------------- FindConflicts ----//
+void FindConflicts (Mapping_t & mapping)
+{
+ ReadAlign_t * curraln;
+ ReadMap_t * currmap;
+ pair<long int, long int> gap;
+ vector<ReadMap_t *>::iterator rmpi;
+ set<ReadMap_t *> yay;
+
+
+ //-- For each read
+ for ( rmpi = mapping . reads . begin( );
+ rmpi != mapping . reads . end( ); ++ rmpi )
+ {
+ if ( (*rmpi) -> place == NULL )
+ continue;
+
+ currmap = *rmpi;
+ curraln = currmap -> place -> head;
+
+ //-- If there is a HIBREAK
+ if ( currmap -> place -> end - currmap -> place -> tend > OPT_MaxTrimLen )
+ curraln -> ref -> conflicts . push_back
+ (new Conflict_t (Conflict_t::HIBREAK, curraln -> hiR, 0, 0, currmap));
+
+ for ( ; curraln -> from != NULL; curraln = curraln -> from )
+ {
+ gap = GapDistance (curraln -> from, curraln);
+ //-- If there is an INDEL, push it and it's break points
+ if ( labs (gap . first) > FUZZY || labs (gap . second) > FUZZY )
+ {
+ curraln -> ref -> conflicts . push_back
+ (new Conflict_t (Conflict_t::INDEL,
+ curraln -> from -> hiR,
+ gap . first, gap . second, currmap));
+ curraln -> ref -> conflicts . push_back
+ (new Conflict_t (Conflict_t::HIBREAK,
+ curraln -> from -> hiR,
+ 0, 0, currmap));
+ curraln -> ref -> conflicts . push_back
+ (new Conflict_t (Conflict_t::LOBREAK,
+ curraln -> from -> hiR + gap . first + 1,
+ 0, 0, currmap));
+ }
+ }
+
+ //-- If there is a LOBREAK
+ if ( currmap -> place -> tbeg - currmap -> place -> beg > OPT_MaxTrimLen )
+ curraln -> ref -> conflicts . push_back
+ (new Conflict_t (Conflict_t::LOBREAK, curraln -> loR, 0, 0, currmap));
+ }
+
+ //-- For each reference, sort and remove redundant conflicts
+ map<string, Reference_t>::iterator rmi;
+ list<Conflict_t *>::iterator first, last, next, nxtf;
+ for ( rmi = mapping . references . begin( );
+ rmi != mapping . references . end( ); ++ rmi )
+ {
+ if ( rmi -> second . conflicts . empty( ) )
+ continue;
+
+ rmi -> second . conflicts . sort (ConflictCmp_t( ));
+
+ //-- Do my own 'unique' method instead of STL, needed for fuzzy equals
+ first = next = rmi -> second . conflicts . begin( );
+ last = nxtf = rmi -> second . conflicts . end( );
+ while ( ++ next != last )
+ {
+ if ( IsEqualConflict (*first, *next) )
+ {
+ //-- Merge the two support sets
+ set_union
+ ((*first) -> support . begin( ), (*first) -> support . end( ),
+ (*next) -> support . begin( ), (*next) -> support . end( ),
+ insert_iterator<set<ReadMap_t *> > (yay, yay . begin( )));
+ (*first) -> support . swap (yay);
+ yay . clear( );
+
+ delete (*next);
+ rmi -> second . conflicts . erase (next);
+ next = first;
+ }
+ else
+ {
+ if ( labs ((*first) -> pos - (*next) -> pos) <= FUZZY )
+ {
+ if ( nxtf == last )
+ nxtf = next;
+ }
+ else
+ {
+ if ( nxtf != last )
+ {
+ next = nxtf;
+ nxtf = last;
+ }
+
+ first = next;
+ }
+ }
+ }
+ }
+}
+
+
+
+
+//------------------------------------------------------- OutputConflicts ----//
+void OutputConflicts (const Mapping_t & mapping)
+{
+ ofstream out (OPT_ConflictName . c_str( ));
+ if ( !out )
+ cerr << "WARNING: could not open " << OPT_ConflictName << endl;
+
+ list<Conflict_t *>::const_iterator cpi;
+ map<string, Reference_t>::const_iterator rmi;
+
+ for ( rmi = mapping . references . begin( );
+ rmi != mapping . references . end( ); ++ rmi )
+ {
+ out << '>' << rmi -> first << endl;
+ for ( cpi = rmi -> second . conflicts . begin( );
+ cpi != rmi -> second . conflicts . end( ); ++ cpi )
+ {
+ switch ( (*cpi) -> status )
+ {
+ case Conflict_t::SUPPORTED:
+ out << "+ ";
+ break;
+ case Conflict_t::UNSUPPORTED:
+ out << "- ";
+ break;
+ case Conflict_t::ARTIFACT:
+ out << ". ";
+ break;
+ case Conflict_t::AMBIGUOUS:
+ out << "? ";
+ break;
+ }
+
+ out << (*cpi) -> pos
+ << "\t" << (*cpi) -> gapR
+ << "\t" << (*cpi) -> gapQ
+ << "\t" << (*cpi) -> type
+ << "\tN." << (*cpi) -> discount . size( )
+ << "\tY." << (*cpi) -> support . size( ) << "\t" << endl;
+
+ //--
+ set<ReadMap_t *>::const_iterator rmpi;
+ out << " S: ";
+ for (rmpi = (*cpi) -> support . begin( );
+ rmpi != (*cpi) -> support . end( ); ++ rmpi )
+ out << ((*rmpi) -> exclude ? '-' : '+') << (*rmpi) -> id << ' ';
+ out << "\n D: ";
+ for (rmpi = (*cpi) -> discount . begin( );
+ rmpi != (*cpi) -> discount . end( ); ++ rmpi )
+ out << ((*rmpi) -> exclude ? '-' : '+') << (*rmpi) -> id << ' ';
+ out << endl << endl;
+ //--
+ }
+ }
+
+ out . close( );
+}
+
+
+
+
+//--------------------------------------------------------- OutputLayouts ----//
+void OutputLayouts (const Assembly_t & assembly)
+{
+ vector<Contig_t *>::const_iterator cpi;
+ vector<Tile_t *>::const_iterator tpi;
+ AMOS::ID_t ctgs = 0;
+ AMOS::ID_t scfs = 0;
+ const string * cid = NULL;
+ const string * pid = NULL;
+
+ AMOS::BankStream_t lay_bank (AMOS::Layout_t::NCODE);
+ AMOS::BankStream_t scf_bank (AMOS::Scaffold_t::NCODE);
+
+ try {
+ lay_bank . create (OPT_BankName, AMOS::B_WRITE);
+ scf_bank . create (OPT_BankName, AMOS::B_WRITE);
+
+ AMOS::Scaffold_t scf;
+
+ for ( cpi = assembly . contigs . begin( );
+ cpi != assembly . contigs . end( ); ++ cpi )
+ {
+ AMOS::Layout_t lay;
+ AMOS::Tile_t red;
+ AMOS::Tile_t ctg;
+
+ lay . setIID (++ctgs);
+ ctg . source = ctgs;
+ ctg . offset = (*cpi) -> tiles . front( ) -> read -> place -> beg;
+ ctg . range . setRange (0, (*cpi) -> len);
+ cid = (*cpi)->tiles.front( )->read->place->head->ref->id;
+
+ ostringstream ss;
+ ss << ctgs << '_'
+ << *((*cpi)->tiles.front( )->read->place->head->ref->id);
+ lay . setEID (ss . str( ));
+
+ for ( tpi = (*cpi) -> tiles . begin( );
+ tpi != (*cpi) -> tiles . end( ); ++ tpi )
+ {
+ red . source = (*tpi) -> read -> id;
+ red . offset = (*tpi) -> off;
+ red . range . begin = (*tpi) -> beg;
+ red . range . end = (*tpi) -> end;
+
+ lay . getTiling( ) . push_back (red);
+ }
+
+ lay_bank << lay;
+
+ if ( pid != NULL && cid != pid )
+ {
+ scf . setIID (++scfs);
+ scf . setEID (*pid);
+ scf_bank << scf;
+ scf . clear( );
+ }
+
+ scf . getContigTiling( ) . push_back (ctg);
+
+ pid = cid;
+ }
+
+ if ( ! scf . getContigTiling( ) . empty( ) )
+ {
+ scf . setIID (++scfs);
+ scf . setEID (*pid);
+ scf_bank << scf;
+ scf . clear( );
+ }
+
+ lay_bank . close( );
+ scf_bank . close( );
+ }
+ catch (const AMOS::Exception_t & e) {
+ cerr << "WARNING: " << e . what( )
+ << " could not output layouts to bank" << endl;
+ }
+
+// ctgs = 0;
+// for ( cpi = assembly . contigs . begin( );
+// cpi != assembly . contigs . end( ); ++ cpi )
+// {
+// out
+// << "C " << ++ctgs << '\t'
+// << (*cpi) -> tiles . size( ) << '\t'
+// << *((*cpi)->tiles.front( )->read->place->head->ref->id) << '\t'
+// << (*cpi) -> tiles . front( ) -> read -> place -> beg << "-"
+// << (*cpi) -> tiles . front( ) -> read -> place -> beg
+// + (*cpi) -> len - 1 << endl;
+
+// for ( tpi = (*cpi) -> tiles . begin( );
+// tpi != (*cpi) -> tiles . end( ); ++ tpi )
+// {
+// out
+// << (*tpi) -> read -> id << ' '
+// << (*tpi) -> off + (*tpi) -> beg - 1 << ' '
+// << (*tpi) -> off + (*tpi) -> end - 1 << '\t'
+
+// << (*tpi) -> read -> place -> tbeg -
+// (*tpi) -> read -> place -> beg << '\t'
+// << (*tpi) -> read -> place -> end -
+// (*tpi) -> read -> place -> tend << '\t'
+// << (*tpi) -> read -> place -> idy << endl;
+// }
+
+// out << endl;
+// }
+}
+
+
+
+
+//--------------------------------------------------------- OutputMapping ----//
+void OutputMapping (Mapping_t & mapping)
+{
+ ofstream out (OPT_MapName . c_str( ));
+ if ( !out )
+ cerr << "WARNING: could not open " << OPT_MapName << endl;
+
+ ReadMap_t temprm;
+ temprm . place = new ReadAlignChain_t( );
+ temprm . place -> head = new ReadAlign_t( );
+
+ map<string, Reference_t>::iterator rmi;
+ vector<ReadMap_t *>::iterator rmpi;
+
+ ReadAlign_t * curraln;
+ list<ReadAlignChain_t *>::iterator racpi;
+
+ pair<
+ vector<ReadMap_t *>::iterator,
+ vector<ReadMap_t *>::iterator
+ > rmpip;
+
+
+ //-- For each reference
+ for ( rmi = mapping . references . begin( );
+ rmi != mapping . references . end( ); ++ rmi )
+ {
+ //-- Find the reference range
+ temprm . place -> head -> ref = &(rmi -> second);
+ rmpip = equal_range (mapping . reads . begin( ), mapping . reads . end( ),
+ &temprm, ReadReferenceCmp_t( ));
+
+ out << '>' << rmi -> first << '\t'
+ << (rmi -> second) . len
+ << endl;
+
+ //-- For each read mapping to this reference
+ for ( rmpi = rmpip . first; rmpi != rmpip . second; ++ rmpi )
+ {
+ long int s = (*rmpi) -> place -> beg;
+ long int e = (*rmpi) -> place -> beg + (*rmpi) -> len - 1;
+ if ( (*rmpi) -> place -> head -> ori == REVERSE_CHAR )
+ {
+ long int t = s;
+ s = e;
+ e = t;
+ }
+
+ out << (*rmpi) -> id << '\t'
+ << s << '\t' << e << '\t'
+ << ((*rmpi) -> place -> head -> ori == FORWARD_CHAR ? '+' : '-');
+ if ( (*rmpi) -> mate . read == NULL )
+ out << "\tNULL";
+ else
+ out << '\t' << (*rmpi) -> mate . read -> id;
+ out << endl;
+
+ /*
+ for ( racpi = (*rmpi) -> best . begin( );
+ racpi != (*rmpi) -> best . end( ); racpi ++ )
+ {
+ out << "#\n";
+ for ( curraln = (*racpi) -> head;
+ curraln != NULL; curraln = curraln -> from )
+ out << ' ' << curraln -> loR << '\t' << curraln -> hiR << endl;
+ }
+ */
+ }
+ }
+
+ delete temprm . place -> head;
+ delete temprm . place;
+
+ out . close( );
+}
+
+
+
+
+//------------------------------------------------------------ OutputTigr ----//
+void OutputTigr (const Assembly_t & assembly)
+{
+ ofstream out (OPT_TigrName . c_str( ));
+ if ( !out )
+ cerr << "WARNING: could not open " << OPT_TigrName << endl;
+
+ vector<Contig_t *>::const_iterator cpi;
+ vector<Tile_t *>::const_iterator tpi;
+ long int ctgs, len;
+
+ ctgs = 0;
+ for ( cpi = assembly . contigs . begin( );
+ cpi != assembly . contigs . end( ); ++ cpi )
+ {
+ out
+ << "##" << ++ctgs << ' '
+ << (*cpi) -> tiles . size( ) << ' '
+ << (*cpi) -> len << " 00000000 checksum."
+ << endl;
+
+ for ( tpi = (*cpi) -> tiles . begin( );
+ tpi != (*cpi) -> tiles . end( ); ++ tpi )
+ {
+ len = labs ((*tpi) -> end - (*tpi) -> beg) + 1;
+
+ out
+ << '#' << (*tpi) -> read -> id
+ << '(' << (*tpi) -> off << ')'
+ << " [" << ((*tpi) -> beg < (*tpi) -> end ? "" : "RC") << "] "
+ << len << " bases, 00000000 checksum. "
+ << '{' << (*tpi) -> beg << ' ' << (*tpi) -> end << "} "
+ << '<' << (*tpi) -> off + 1 << ' ' << (*tpi) -> off + len << '>'
+ << endl;
+ }
+ }
+
+ out . close( );
+}
+
+
+
+
+//------------------------------------------------------------- OutputUMD ----//
+void OutputUMD (const Assembly_t & assembly)
+{
+ ofstream out (OPT_UmdName . c_str( ));
+ if ( !out )
+ cerr << "WARNING: could not open " << OPT_UmdName << endl;
+
+ vector<Contig_t *>::const_iterator cpi;
+ vector<Tile_t *>::const_iterator tpi;
+ long int ctgs;
+
+ ctgs = 0;
+ for ( cpi = assembly . contigs . begin( );
+ cpi != assembly . contigs . end( ); ++ cpi )
+ {
+ out
+ << "C " << ++ctgs << '\t'
+ << (*cpi) -> tiles . size( ) << '\t'
+ << *((*cpi)->tiles.front( )->read->place->head->ref->id) << '\t'
+ << (*cpi) -> tiles . front( ) -> read -> place -> beg << "-"
+ << (*cpi) -> tiles . front( ) -> read -> place -> beg
+ + (*cpi) -> len - 1 << endl;
+
+ for ( tpi = (*cpi) -> tiles . begin( );
+ tpi != (*cpi) -> tiles . end( ); ++ tpi )
+ {
+ out
+ << (*tpi) -> read -> id << ' '
+ << (*tpi) -> off + (*tpi) -> beg - 1 << ' '
+ << (*tpi) -> off + (*tpi) -> end - 1 << '\t'
+
+ << (*tpi) -> read -> place -> tbeg -
+ (*tpi) -> read -> place -> beg << '\t'
+ << (*tpi) -> read -> place -> end -
+ (*tpi) -> read -> place -> tend << '\t'
+ << (*tpi) -> read -> place -> idy << endl;
+ }
+
+ out << endl;
+ }
+
+ out . close( );
+}
+
+
+
+
+//------------------------------------------------------------ ParseAlign ----//
+void ParseAlign (Mapping_t & mapping)
+{
+ DeltaReader_t dr;
+ Reference_t * refp;
+ AMOS::ID_t id;
+ stringstream ss;
+ ReadMap_t * currmp;
+ ReadAlign_t * currap;
+ vector<DeltaAlignment_t>::const_iterator dai;
+ pair<map<string, Reference_t>::iterator, bool> insret;
+ map<AMOS::ID_t,ReadMap_t *> id2read;
+ map<AMOS::ID_t,ReadMap_t *>::iterator idm;
+
+ dr . open (OPT_AlignName);
+
+ currmp = NULL;
+
+ //-- Process the delta input
+ while ( dr . readNextHeadersOnly( ) )
+ {
+ insret = mapping . references . insert
+ (map<string, Reference_t>::value_type
+ (dr . getRecord( ) . idR, Reference_t( )));
+ refp = &((insret . first) -> second);
+
+ //-- If a new reference ID
+ if ( insret . second )
+ {
+ refp -> id = &((insret . first) -> first);
+ refp -> len = dr . getRecord( ) . lenR;
+ }
+ else
+ assert (refp -> len == (long int)dr . getRecord( ) . lenR);
+
+ ss . str (dr . getRecord( ) . idQ);
+ ss >> id;
+ assert (!ss . fail( ));
+ ss . clear( );
+
+ //-- Find read struct
+ idm = id2read.find(id);
+
+ //-- If a new read, create it
+ if ( idm == id2read.end() )
+ {
+ mapping . reads . push_back (new ReadMap_t( ));
+ currmp = mapping . reads . back( );
+ currmp -> id = id;
+ currmp -> len = dr . getRecord( ) . lenQ;
+ currmp -> place = NULL;
+ currmp -> mate . read = NULL;
+ id2read.insert(make_pair(id,currmp));
+ }
+ else
+ {
+ currmp = idm->second;
+ }
+
+ //-- For all the alignments in this record
+ for ( dai = dr . getRecord( ) . aligns . begin( );
+ dai != dr . getRecord( ) . aligns . end( ); ++ dai )
+ {
+ currmp -> all . push_back (new ReadAlign_t ( ));
+ currap = currmp -> all . back( );
+
+ currap -> ref = refp;
+ currap -> idy = dai -> idy;
+
+ //-- Force ascending coordinates
+ if ( dai -> sR < dai -> eR )
+ {
+ currap -> loR = dai -> sR;
+ currap -> hiR = dai -> eR;
+ }
+ else
+ {
+ currap -> loR = dai -> eR;
+ currap -> hiR = dai -> sR;
+ }
+
+ if ( (dai -> sR < dai -> eR && dai -> sQ < dai -> eQ) ||
+ (dai -> sR > dai -> eR && dai -> sQ > dai -> eQ) )
+ {
+ currap -> ori = FORWARD_CHAR;
+ if ( dai -> sQ < dai -> eQ )
+ {
+ currap -> lo = dai -> sQ;
+ currap -> hi = dai -> eQ;
+ }
+ else
+ {
+ currap -> lo = dai -> eQ;
+ currap -> hi = dai -> sQ;
+ }
+ }
+ else
+ {
+ currap -> ori = REVERSE_CHAR;
+ if ( dai -> sQ < dai -> eQ )
+ {
+ currap -> lo = RevComp1 (dai -> eQ, currmp -> len);
+ currap -> hi = RevComp1 (dai -> sQ, currmp -> len);
+ }
+ else
+ {
+ currap -> lo = RevComp1 (dai -> sQ, currmp -> len);
+ currap -> hi = RevComp1 (dai -> eQ, currmp -> len);
+ }
+ }
+ }
+
+ //-- Sort the alignments by lo read coordinate
+ sort (currmp -> all.begin( ), currmp -> all.end( ), ReadAlignCmp_t( ));
+ }
+
+ dr . close( );
+
+ sort (mapping . reads . begin( ), mapping . reads . end( ), ReadIdCmp_t( ));
+}
+
+
+
+
+//------------------------------------------------------------ ParseMates ----//
+void ParseMates (Mapping_t & mapping)
+{
+ AMOS::Fragment_t frg;
+ AMOS::Library_t lib;
+ pair<AMOS::ID_t, AMOS::ID_t> mtp;
+
+ AMOS::Bank_t lib_bank (AMOS::Library_t::NCODE);
+ AMOS::BankStream_t frg_bank (AMOS::Fragment_t::NCODE);
+
+ ReadMap_t * rmp, temprm;
+ pair<
+ vector<ReadMap_t *>::iterator,
+ vector<ReadMap_t *>::iterator
+ > rmpip;
+
+ try {
+ frg_bank . open (OPT_BankName, AMOS::B_READ);
+ lib_bank . open (OPT_BankName, AMOS::B_READ);
+
+ //-- Populate the mate records
+ while ( frg_bank >> frg )
+ {
+ mtp = frg . getMatePair( );
+
+ //-- Find the read
+ temprm . id = mtp . first;
+ rmpip = equal_range (mapping . reads . begin( ),
+ mapping . reads . end( ),
+ &temprm, ReadIdCmp_t( ));
+
+ //-- If 0 or >1 reads, or already mated, skip
+ if ( rmpip . second - rmpip . first != 1 ||
+ (*(rmpip . first)) -> mate . read != NULL )
+ continue;
+ rmp = *(rmpip . first);
+
+ //-- Find the mate
+ temprm . id = mtp . second;
+ rmpip = equal_range (mapping . reads . begin( ),
+ mapping . reads . end( ),
+ &temprm, ReadIdCmp_t( ));
+
+ //-- If 0 or >1 mates
+ if ( rmpip . second - rmpip . first != 1 )
+ continue;
+ assert ( (*(rmpip . first)) -> mate . read == NULL );
+
+ //- Link the mated reads
+ rmp -> mate . read = *(rmpip . first);
+ rmp -> mate . read -> mate . read = rmp;
+
+ //-- Get the library record for this insert
+ lib_bank . fetch (frg . getLibrary( ), lib);
+
+ //-- Set the mate offsets
+ rmp -> mate . minoff = rmp -> mate . maxoff =
+ lib . getDistribution( ) . mean;
+ rmp -> mate . minoff -= lib . getDistribution( ) . sd * OPT_Stdvs;
+ rmp -> mate . maxoff += lib . getDistribution( ) . sd * OPT_Stdvs;
+ rmp -> mate . read -> mate . minoff = rmp -> mate . minoff;
+ rmp -> mate . read -> mate . maxoff = rmp -> mate . maxoff;
+ }
+ }
+ catch (const AMOS::Exception_t & e) {
+ cerr << "WARNING: " << e . what( ) << endl
+ << " could not retrieve mate-pair information" << endl;
+ }
+
+ frg_bank . close( );
+ lib_bank . close( );
+}
+
+
+
+
+//------------------------------------------------------- PlaceHappyMates ----//
+void PlaceHappyMates (Mapping_t & mapping)
+{
+ ReadMap_t * rmp, * mrmp;
+ ReadAlignChain_t * rcp, * mrcp;
+ vector< pair<ReadAlignChain_t *, ReadAlignChain_t *> > places;
+ vector<ReadMap_t *>::iterator rmpi;
+ list<ReadAlignChain_t *>::iterator rcpi, mrcpi;
+
+ //-- For each read in the mapping
+ for ( rmpi = mapping . reads . begin( );
+ rmpi != mapping . reads . end( ); ++ rmpi )
+ {
+ rmp = *rmpi;
+
+ //-- Get the matepair
+ mrmp = rmp -> mate . read;
+
+ //-- If the read has already been placed, or no mate, skip
+ if ( rmp -> place != NULL || mrmp == NULL )
+ continue;
+
+ //-- Find all the happy placements
+ places . clear( );
+ for ( mrcpi = mrmp -> best . begin( );
+ mrcpi != mrmp -> best . end( ); ++ mrcpi )
+ {
+ //-- If mate not placed, search through all its best
+ if ( mrmp -> place == NULL )
+ mrcp = *mrcpi;
+ else
+ {
+ mrcp = mrmp -> place;
+ mrcpi = mrmp -> best . end( );
+ -- mrcpi; // last loop iteration
+ }
+
+ for ( rcpi = rmp -> best . begin( );
+ rcpi != rmp -> best . end( ); ++ rcpi )
+ {
+ rcp = *rcpi;
+
+ //-- Skip if constraints are not satisfied
+ if ( rcp -> head -> ref != mrcp -> head -> ref )
+ continue;
+
+ if ( mrcp -> head -> ori == FORWARD_CHAR )
+ {
+ if (rcp -> head -> ori != REVERSE_CHAR
+ ||
+ rcp -> end < mrcp -> beg + mrmp -> mate . minoff
+ ||
+ rcp -> end > mrcp -> beg + mrmp -> mate . maxoff )
+ continue;
+ }
+ else
+ {
+ if (rcp -> head -> ori != FORWARD_CHAR
+ ||
+ rcp -> beg < mrcp -> end - mrmp -> mate . maxoff
+ ||
+ rcp -> beg > mrcp -> end - mrmp -> mate . minoff )
+ continue;
+ }
+
+ //-- Happy link! Add the matepair if valid
+ if ( IsValidChain (rcp, rmp) && IsValidChain (mrcp, mrmp) )
+ places . push_back (make_pair (rcp, mrcp));
+ }
+ }
+
+
+
+ //-- Pick the highest identity happy mate-pair or randomly
+ // choose between many within OPT_MaxIdentityDiff
+ if ( ! places.empty() )
+ {
+ float idy;
+ float bestidy = 0;
+ for ( int i = 0; i < places.size(); ++ i )
+ {
+ idy = places[i].first->idy * places[i].second->idy;
+ if ( idy > bestidy )
+ bestidy = idy;
+ }
+
+ vector< pair<ReadAlignChain_t *, ReadAlignChain_t *> > newplaces;
+ for ( int i = 0; i < places.size(); ++ i )
+ {
+ idy = places[i].first->idy * places[i].second->idy;
+ if ( bestidy - idy <= OPT_MaxIdentityDiff )
+ newplaces.push_back (places[i]);
+ }
+
+ if ( newplaces.size() == 1 || OPT_Random )
+ {
+ int i =
+ (int)((double)newplaces.size( ) * rand( ) / (RAND_MAX + 1.0));
+ rmp -> place = newplaces[i].first;
+ mrmp -> place = newplaces[i].second;
+ }
+ }
+ }
+}
+
+
+
+
+//----------------------------------------------------------- PlaceRandom ----//
+void PlaceRandom (Mapping_t & mapping)
+{
+ ReadMap_t * rmp;
+ vector<ReadAlignChain_t *> places;
+ vector<ReadMap_t *>::iterator rmpi;
+ list<ReadAlignChain_t *>::iterator rcpi;
+
+ //-- For each read in the mapping
+ for ( rmpi = mapping . reads . begin( );
+ rmpi != mapping . reads . end( ); ++ rmpi )
+ {
+ rmp = *rmpi;
+
+ //-- If already placed, skip
+ if ( rmp -> place != NULL )
+ continue;
+
+ //-- Get all of the valid chains
+ float bestidy = 0;
+ for ( rcpi = rmp -> best . begin( );
+ rcpi != rmp -> best . end( ); ++ rcpi )
+ if ( IsValidChain (*rcpi, rmp) )
+ if ( (*rcpi)->idy > bestidy )
+ bestidy = (*rcpi)->idy;
+
+ places . clear( );
+ for ( rcpi = rmp -> best . begin( );
+ rcpi != rmp -> best . end( ); ++ rcpi )
+ if ( IsValidChain (*rcpi, rmp) )
+ if ( bestidy - (*rcpi)->idy <= OPT_MaxIdentityDiff )
+ places . push_back (*rcpi);
+
+ //-- Randomly pick a valid chain
+ if ( !places . empty( ) )
+ rmp -> place = places
+ [(int)((double)places . size( ) * rand( ) / (RAND_MAX + 1.0))];
+ }
+}
+
+
+
+
+//------------------------------------------------------ PlaceUnambiguous ----//
+void PlaceUnambiguous (Mapping_t & mapping)
+{
+ ReadMap_t * rmp;
+ vector<ReadMap_t *>::iterator rmpi;
+
+ //-- For each read in the mapping
+ for ( rmpi = mapping . reads . begin( );
+ rmpi != mapping . reads . end( ); ++ rmpi )
+ {
+ rmp = *rmpi;
+
+ //-- If not placed, unambiguous, and valid, place the read
+ if ( rmp -> place == NULL
+ &&
+ rmp -> best . front( ) == rmp -> best . back( )
+ &&
+ IsValidChain (rmp -> best . front( ), rmp) )
+ rmp -> place = rmp -> best . front( );
+ }
+}
+
+
+
+
+//------------------------------------------------------- RefineConflicts ----//
+void RefineConflicts (Mapping_t & mapping)
+{
+ ReadMap_t temprm;
+ temprm . place = new ReadAlignChain_t( );
+ temprm . place -> head = new ReadAlign_t( );
+
+ long int cpos, beg, end, tot;
+ Reference_t * rp;
+ ReadAlign_t * rap;
+
+ list<Conflict_t *>::iterator cpi, locpi, hicpi, bcpi, ecpi;
+ map<string, Reference_t>::iterator rmi;
+ vector<ReadMap_t *>::iterator rmpi, rmpie, ri, rj;
+ set<ReadMap_t *>::iterator si;
+ pair<
+ vector<ReadMap_t *>::iterator,
+ vector<ReadMap_t *>::iterator
+ > rmpip;
+
+ vector<ReadMap_t *> heap;
+ vector<Conflict_t *> breaks;
+ vector<Conflict_t *>::iterator bi;
+ set<ReadMap_t *> readsetA;
+ set<ReadMap_t *> readsetB;
+
+
+ //-- For each reference and its conflicts
+ for ( rmi = mapping . references . begin( );
+ rmi != mapping . references . end( ); ++ rmi )
+ {
+ rp = &(rmi -> second);
+ bcpi = rp -> conflicts . begin( );
+ ecpi = rp -> conflicts . end( );
+
+ //-- Find the read mapping range
+ temprm . place -> head -> ref = rp;
+ rmpip = equal_range (mapping . reads . begin( ), mapping . reads . end( ),
+ &temprm, ReadReferenceCmp_t( ));
+ rmpi = rmpip . first;
+ rmpie = rmpip . second;
+
+
+ //-- For each *BREAK*, collect nay counts
+ for ( cpi = bcpi; cpi != ecpi; ++ cpi )
+ {
+ if ( (*cpi) -> type == Conflict_t::INDEL )
+ continue;
+
+ cpos = (*cpi) -> pos;
+
+ //-- Update the heap to current conflict pos
+ while ( !heap . empty( ) && heap . front( ) -> place -> end < cpos )
+ PopHeap (heap);
+
+ //-- Load up the heap with reads that overlap the conflict
+ for ( ; rmpi != rmpie && (*rmpi) -> place -> beg <= cpos; ++ rmpi )
+ if ( (*rmpi) -> place -> end >= cpos )
+ PushHeap (heap, *rmpi);
+
+ //-- Collect the nay counts, i.e. reads that do not agree on break
+ for ( ri = heap . begin( ); ri != heap . end( ); ++ ri )
+ for ( rap = (*ri)->place->head; rap != NULL; rap = rap->from )
+ if ( rap -> loR < cpos - FUZZY && rap -> hiR > cpos + FUZZY )
+ {
+ (*cpi) -> discount . insert (*ri);
+ break;
+ }
+
+ //-- Can't discount break if supporting it
+ set_difference
+ ((*cpi) -> discount . begin( ), (*cpi) -> discount . end( ),
+ (*cpi) -> support . begin( ), (*cpi) -> support . end( ),
+ insert_iterator<set<ReadMap_t *> >
+ (readsetA, readsetA . begin( )));
+ (*cpi) -> discount . swap (readsetA);
+ readsetA . clear( );
+
+ //-- Call the break SUPPORTED, UNSUPPORTED, AMBIGUOUS
+ CallConflict (*cpi);
+
+ //-- We don't want to accept breaks, so call them ambiguous
+ if ( (*cpi) -> status == Conflict_t::SUPPORTED )
+ (*cpi) -> status = Conflict_t::AMBIGUOUS;
+ }
+ heap . clear( );
+
+
+ //-- For each *INDEL*, sum yay/nay counts from its break counts
+ for ( cpi = bcpi; cpi != ecpi; ++ cpi )
+ {
+ if ( (*cpi)->type != Conflict_t::INDEL )
+ continue;
+
+ //-- The reference breaks for the gap
+ beg = (*cpi) -> pos;
+ end = (*cpi) -> pos + (*cpi) -> gapR + 1;
+
+ //-- Find conflicts corresponding to the reference HIBREAK
+ for ( hicpi = bcpi; hicpi != ecpi; ++ hicpi )
+ if ( hicpi != cpi &&
+ labs ((*hicpi)->pos - beg) <= FUZZY )
+ {
+ breaks . push_back (*hicpi);
+
+ if ( (*hicpi) -> type == Conflict_t::HIBREAK )
+ {
+
+ //-- Add to INDEL support if hang isn't too large
+ for ( si = (*hicpi) -> support . begin( );
+ si != (*hicpi) -> support . end( ); ++ si )
+ if ( (*si) -> place -> end - beg <
+ (*cpi) -> gapQ + OPT_MaxTrimLen )
+ (*cpi) -> support . insert (*si);
+
+ //-- Add to hibreak discount
+ for ( si = (*hicpi) -> discount . begin( );
+ si != (*hicpi) -> discount . end( ); ++ si )
+ readsetA . insert (*si);
+ }
+ }
+
+ //-- Find conflicts corresponding to the reference LOBREAK
+ for ( locpi = bcpi; locpi != ecpi; ++ locpi )
+ if ( locpi != cpi &&
+ labs ((*locpi)->pos + (*locpi)->gapR + 1 - end) <= FUZZY )
+ {
+ breaks . push_back (*locpi);
+
+ if ( (*locpi) -> type == Conflict_t::LOBREAK )
+ {
+ //-- Add to INDEL support if hang isn't too large
+ for ( si = (*locpi) -> support . begin( );
+ si != (*locpi) -> support . end( ); ++ si )
+ if ( end - (*si) -> place -> beg <
+ (*cpi) -> gapQ + OPT_MaxTrimLen )
+ (*cpi) -> support . insert (*si);
+
+ //-- Add to lobreak discount
+ for ( si = (*locpi) -> discount . begin( );
+ si != (*locpi) -> discount . end( ); ++ si )
+ readsetB . insert (*si);
+ }
+ }
+
+ //-- One break discounted good enough for regular gap
+ if ( (*cpi) -> gapR > 0 )
+ set_union
+ (readsetA . begin( ), readsetA . end( ),
+ readsetB . begin( ), readsetB . end( ),
+ insert_iterator<set<ReadMap_t *> >
+ ((*cpi) -> discount, (*cpi) -> discount . begin( )));
+ //-- Tandems with reference overlap need both breaks discounted
+ else
+ set_intersection
+ (readsetA . begin( ), readsetA . end( ),
+ readsetB . begin( ), readsetB . end( ),
+ insert_iterator<set<ReadMap_t *> >
+ ((*cpi) -> discount, (*cpi) -> discount . begin( )));
+ readsetA . clear( );
+ readsetB . clear( );
+
+ //-- Can't support indel if discounting it
+ set_difference
+ ((*cpi) -> support . begin( ), (*cpi) -> support . end( ),
+ (*cpi) -> discount . begin( ), (*cpi) -> discount . end( ),
+ insert_iterator<set<ReadMap_t *> >
+ (readsetA, readsetA . begin( )));
+ (*cpi) -> support . swap (readsetA);
+ readsetA . clear( );
+
+ //-- Call the indel SUPPORTED, UNSUPPORTED, AMBIGUOUS
+ CallConflict (*cpi);
+
+ //-- Flag indel breaks as artifacts
+ if ( (*cpi) -> status != Conflict_t::UNSUPPORTED )
+ for ( bi = breaks . begin( ); bi != breaks . end( ); ++ bi )
+ {
+ if ( (*bi) -> type != Conflict_t::INDEL )
+ (*bi) -> status = Conflict_t::ARTIFACT;
+ else if ( (*bi) -> status != Conflict_t::UNSUPPORTED &&
+ (*cpi) -> status != Conflict_t::ARTIFACT )
+ {
+ long int byay = (*bi) -> support . size( );
+ long int cyay = (*cpi) -> support . size( );
+ float tyay = byay + cyay;
+ if ( tyay == 0 ) tyay = -1;
+
+ if ((float)byay / tyay * 100.0 >= OPT_Majority)
+ (*cpi) -> status = Conflict_t::ARTIFACT;
+ else if ((float)cyay / tyay * 100.0 >= OPT_Majority)
+ (*bi) -> status = Conflict_t::ARTIFACT;
+ else
+ {
+ long int bnay = (*bi) -> discount . size( );
+ long int cnay = (*cpi) -> discount . size( );
+ float tnay = bnay + cnay;
+ if ( tnay == 0 ) tnay = -1;
+
+ if ((float)bnay / tnay * 100.0 >= OPT_Majority)
+ (*bi) -> status = Conflict_t::ARTIFACT;
+ else if ((float)cnay / tnay * 100.0 >= OPT_Majority)
+ (*cpi) -> status = Conflict_t::ARTIFACT;
+ else
+ {
+ (*bi) -> status = Conflict_t::AMBIGUOUS;
+ (*cpi) -> status = Conflict_t::AMBIGUOUS;
+ }
+ }
+ }
+ }
+
+ breaks . clear( );
+ }
+
+
+ //-- INCLUDE/EXCLUDE reads based on consistency
+ for ( cpi = bcpi; cpi != ecpi; ++ cpi )
+ if ( (*cpi) -> status == Conflict_t::ARTIFACT )
+ {
+ //-- Exclude supporting reads (will be revived later if good)
+ for ( si = (*cpi) -> support . begin( );
+ si != (*cpi) -> support . end( ); ++ si )
+ (*si) -> exclude = true;
+ }
+
+ for ( cpi = bcpi; cpi != ecpi; ++ cpi )
+ if ( (*cpi) -> status == Conflict_t::SUPPORTED )
+ {
+ //-- Include supporting reads (revives supporting artifacts)
+ for ( si = (*cpi) -> discount . begin( );
+ si != (*cpi) -> discount . end( ); ++ si )
+ (*si) -> exclude = true;
+ //-- Exclude discounting reads
+ for ( si = (*cpi) -> support . begin( );
+ si != (*cpi) -> support . end( ); ++ si )
+ (*si) -> exclude = false;
+ }
+
+ for ( cpi = bcpi; cpi != ecpi; ++ cpi )
+ if ( (*cpi) -> status == Conflict_t::UNSUPPORTED )
+ {
+ //-- Exclude supporting reads
+ for ( si = (*cpi) -> support . begin( );
+ si != (*cpi) -> support . end( ); ++ si )
+ (*si) -> exclude = true;
+ }
+ else if ( (*cpi) -> status == Conflict_t::AMBIGUOUS )
+ {
+ //-- Exclude everything ambiguous
+ for ( si = (*cpi) -> discount . begin( );
+ si != (*cpi) -> discount . end( ); ++ si )
+ (*si) -> exclude = true;
+ for ( si = (*cpi) -> support . begin( );
+ si != (*cpi) -> support . end( ); ++ si )
+ (*si) -> exclude = true;
+ }
+ }
+
+ delete temprm . place -> head;
+ delete temprm . place;
+}
+
+
+
+
+//------------------------------------------------------ ReadAlignChain_t ----//
+ReadAlignChain_t::ReadAlignChain_t (const ReadMap_t * rmp, ReadAlign_t * rap)
+{
+ long int n;
+ long int olap1, olap2, nrlen;
+ float idyt;
+
+ head = rap;
+
+ tend = rap -> hiR;
+ end = tend + (rmp -> len - rap -> hi);
+
+ n = 0;
+ idyt = 0;
+ len = rap -> hi - rap -> lo + 1;
+ idy = rap -> idy * len;
+ while ( rap -> from != NULL )
+ {
+ assert ( rap -> from -> lo <= rap -> lo );
+
+ olap1 = rap -> from -> hiR - rap -> loR + 1;
+ if ( olap1 < 0 )
+ olap1 = 0;
+ olap2 = rap -> from -> hi - rap -> lo + 1;
+
+ nrlen = rap -> from -> hi - rap -> from -> lo + 1 -
+ (olap1 > olap2 ? olap1 : olap2);
+
+ len += nrlen;
+ idy += rap -> from -> idy * nrlen;
+
+ rap = rap -> from;
+ }
+
+ tbeg = rap -> loR;
+ beg = tbeg - (rap -> lo - 1);
+
+ idy /= (float)len;
+}
+
+
+
+
+//---------------------------------------------------------------- Tile_t ----//
+Tile_t::Tile_t (ReadMap_t * rmp, Contig_t * cp)
+{
+ if ( cp -> tiles . empty( ) )
+ cp -> adjust = - (rmp -> place -> beg);
+
+ read = rmp;
+ off = rmp -> place -> beg + cp -> adjust;
+ beg = 1;
+ end = rmp -> len;
+
+ if ( rmp -> place -> head -> ori == REVERSE_CHAR )
+ {
+ beg = RevComp1 (beg, rmp -> len);
+ end = RevComp1 (end, rmp -> len);
+ }
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg &&
+ ((ch = getopt (argc, argv, "b:C:d:g:hi:I:m:M:o:prs:St:T:U:v:V:")) != EOF) )
+ switch (ch)
+ {
+ case 'b':
+ OPT_BankName = optarg;
+ break;
+
+ case 'C':
+ OPT_ConflictName = optarg;
+ break;
+
+ case 'd':
+ OPT_Stdvs = atoi(optarg);
+ break;
+
+ case 'g':
+ OPT_MaxGap = atoi (optarg);
+ break;
+
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'i':
+ OPT_MinIdentity = atof (optarg);
+ break;
+
+ case 'I':
+ OPT_MaxIdentityDiff = atof (optarg);
+ break;
+
+ case 'm':
+ OPT_Majority = atof (optarg);
+ break;
+
+ case 'M':
+ OPT_MapName = optarg;
+ break;
+
+ case 'o':
+ OPT_MinOverlap = atoi (optarg);
+ break;
+
+ case 'p':
+ OPT_OnlyUsePairs = true;
+ break;
+
+ case 'r':
+ OPT_Random = true;
+ break;
+
+ case 's':
+ OPT_Seed = atoi (optarg);
+ break;
+
+ case 'S':
+ OPT_Singletons = true;
+ break;
+
+ case 't':
+ OPT_MaxTrimLen = atoi (optarg);
+ break;
+
+ case 'T':
+ OPT_TigrName = optarg;
+ break;
+
+ case 'U':
+ OPT_UmdName = optarg;
+ break;
+
+ case 'v':
+ OPT_MinCoverage = atof (optarg);
+ break;
+
+ case 'V':
+ OPT_MaxCoverageDiff = atof (optarg);
+ break;
+
+ default:
+ errflg ++;
+ }
+
+ if ( errflg > 0 || optind != argc - 1 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ if ( OPT_Seed < 0 )
+ OPT_Seed = time (NULL);
+
+ OPT_AlignName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "-b path Set path of the AMOS bank to use\n"
+ << "-C path Output conflict positions and support counts to file\n"
+ << "-d uint Set acceptable number of stdvs for mate-pairs, default "
+ << OPT_Stdvs << endl
+ << "-g uint Set maximum alignment gap length, default "
+ << OPT_MaxGap << endl
+ << "-h Display help information\n"
+ << "-i float Set the minimum alignment identity, default "
+ << OPT_MinIdentity << endl
+ << "-I float Set the identity tolerance between repeats, default "
+ << OPT_MaxIdentityDiff << endl
+ << "-m float Set the majority needed to discern a conflict, default "
+ << OPT_Majority << endl
+ << "-M path Output read mappings to file\n"
+ << "-o uint Set minimum overlap length for assembly, default "
+ << OPT_MinOverlap << endl
+ << "-p Only place reads with happy mate-pairs\n"
+ << "-r Randomly place repetitive reads into one of their copy\n"
+ << " locations if they cannot be placed via mate-pair info\n"
+ << "-s uint Set random generator seed to unsigned int, default\n"
+ << " seed is generated by the system clock\n"
+ << "-S Include singleton contigs in the output\n"
+ << "-t uint Set maximum ignorable trim length, default "
+ << OPT_MaxTrimLen << endl
+ << "-T path Output TIGR contig to file\n"
+ << "-U path Output UMD contig to file\n"
+ << "-v float Set the minimum alignment coverage, default "
+ << OPT_MinCoverage << endl
+ << "-V float Set the coverage tolerance between repeats, default "
+ << OPT_MaxCoverageDiff << endl
+ << endl;
+
+ cerr
+ << " Position query sequences on a reference based on the alignment\n"
+ << "information contained in the deltafile. Can utilize mate-pair\n"
+ << "information to place repetitive sequences, or random placement\n"
+ << "to simulate even coverage. If an AMOS bank is provided by the -b\n"
+ << "option, mate-pair info will be retrieved from and final layouts\n"
+ << "will be written to the bank.\n"
+ << endl;
+
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr
+ << "\nUSAGE: " << s << " [options] [-b amosbank] <deltafile>\n\n";
+ return;
+}
diff --git a/src/Casm/casm-libsize.cc b/src/Casm/casm-libsize.cc
new file mode 100644
index 0000000..c5955b0
--- /dev/null
+++ b/src/Casm/casm-libsize.cc
@@ -0,0 +1,93 @@
+#include "foundation_AMOS.hh"
+#include <cmath>
+#include <climits>
+#include <iostream>
+#include <string>
+#include <sstream>
+
+using namespace std;
+using namespace AMOS;
+using namespace HASHMAP;
+
+int main (int argc, char ** argv)
+{
+ if ( argc != 2 )
+ {
+ cerr << "bad args\n";
+ exit(1);
+ }
+
+ string bankname = argv[1];
+
+ Index_t mtpx;
+ Index_t libx;
+ mtpx . buildReadMate (bankname);
+ libx . buildReadLibrary (bankname);
+
+ ID_t red;
+ Pos_t s, e;
+ string line;
+
+ istringstream ss;
+ hash_map<ID_t, Pos_t> reads;
+ hash_map<ID_t, vector<Size_t> > libs;
+
+ bool good = true;
+
+ while ( cin )
+ {
+ getline (cin, line);
+
+ if ( ! cin || line . empty() || line[0] == '>' )
+ {
+ hash_map<ID_t, Pos_t>::iterator i;
+ hash_map<ID_t, Pos_t>::iterator j;
+ for ( i = reads . begin( ); i != reads . end( ); ++ i )
+ {
+ if ( i->second == -INT_MAX )
+ continue;
+ j = reads.find (mtpx.lookup (i->first));
+ if ( j != reads . end( ) )
+ {
+ if ( labs (i->second - j->second) < 20000 )
+ {
+ ID_t lib = libx.lookup (i->first);
+ libs[lib].push_back(labs (i->second - j->second));
+ }
+
+ cout << i->first << '\t' << j->first << '\t'
+ << labs (i->second - j->second) << endl;
+
+ i->second = -INT_MAX;
+ j->second = -INT_MAX;
+ }
+ }
+
+ reads . clear( );
+ }
+ else
+ {
+ ss . str (line);
+ ss >> red >> s;
+ reads . insert (make_pair(red, s));
+ }
+ }
+
+ hash_map<ID_t, vector<Size_t> >::iterator i;
+ for ( i = libs . begin( ); i != libs . end( ); ++ i )
+ {
+ long sum = 0;
+ vector<Size_t>::iterator j;
+
+ for ( j = i->second.begin(); j != i->second.end(); ++ j )
+ sum += *j;
+ long int mean = sum / i->second.size();
+
+ sort (i->second.begin(), i->second.end());
+ long int median = i->second[i->second.size() / 2];
+
+ cerr << "lib\t" << i->first << '\t' << mean << '\t' << median << endl;
+ }
+
+ return 0;
+}
diff --git a/src/CelMsg/CelMsg.cc b/src/CelMsg/CelMsg.cc
new file mode 100644
index 0000000..da21293
--- /dev/null
+++ b/src/CelMsg/CelMsg.cc
@@ -0,0 +1,2563 @@
+////////////////////////////////////////////////////////////////////////////////
+///
+/// \file CelMsgWGA.cc
+/// \author Arthur L. Delcher
+/// \date 02/25/2003
+///
+/// \brief Code for routines to manipulate Celera-format messages
+///
+/// \remark Under development
+/// \todo Add other messages
+/// \bug
+///
+////////////////////////////////////////////////////////////////////////////////
+
+
+
+#include "CelMsg.hh"
+using namespace AMOS;
+
+void Celera_ADL_Sub_Msg_t :: clear
+ (void)
+
+// Clear all entries in this message
+
+ {
+ who . erase ();
+ time_stamp . erase ();
+ version . erase ();
+ comment . erase ();
+
+ return;
+ }
+
+
+bool Celera_ADL_Sub_Msg_t :: print
+ (FILE * fp)
+
+// Print the contents of this ADL submessage to fp
+
+ {
+ fprintf (fp, "{ADL\n");
+ fprintf (fp, "who:%s\n", who . c_str ());
+ fprintf (fp, "ctm:%s\n", time_stamp . c_str ());
+ fprintf (fp, "vsn:%s\n", version . c_str ());
+ fprintf (fp, "com:\n%s.\n", comment . c_str ());
+ fprintf (fp, "}\n");
+
+ return false;
+ }
+
+
+bool Celera_ADL_Sub_Msg_t :: read_body
+ (FILE * fp)
+
+// Read the rest of the body of an ADL submessage
+
+ {
+ char line [MAX_MSG_LINE];
+ string s;
+ int level;
+
+ level = 1;
+ while (level > 0 && fgets (line, MAX_MSG_LINE, fp) != NULL)
+ {
+ int len;
+
+ len = strlen (line);
+ if (len >= MAX_MSG_LINE - 1)
+ throw IOException_t ("Celera message line too long");
+
+ if (strncmp (line, "who:", 4) == 0)
+ who . append (Strip_Trailing (line + 4, '\n'));
+ else if (strncmp (line, "ctm:", 4) == 0)
+ time_stamp . append (Strip_Trailing (line + 4, '\n'));
+ else if (strncmp (line, "vsn:", 4) == 0)
+ version . append (Strip_Trailing (line + 4, '\n'));
+ else if (strncmp (line, "com:", 4) == 0)
+ {
+ Read_Comment_String (fp, s);
+ comment . append (s);
+ }
+ else if (line [0] == '}')
+ level --;
+ else
+ {
+ cerr << line << endl;
+ throw IOException_t ("Bad line in ADL sub-message");
+ }
+ }
+
+ return (level == 0);
+ }
+
+
+
+void Celera_IMP_Sub_Msg_t :: clear
+ (void)
+
+// Clear all entries in this message
+
+ {
+ read_type = NULL_READ;
+ id = 0;
+ contained = false;
+ source . erase ();
+ position . clear ();
+ del . clear ();
+
+ return;
+ }
+
+
+
+bool Celera_IMP_Sub_Msg_t :: Is_Empty
+ (void)
+
+// Return true iff both positions are zero
+
+{
+ return (position . getBegin () == 0 && position . getEnd () == 0);
+}
+
+
+
+bool Celera_IMP_Sub_Msg_t :: print
+ (FILE * fp)
+
+// Print the contents of this IMP submessage to fp
+
+ {
+ int i, n, ct;
+
+ fprintf (fp, "{IMP\n");
+ fprintf (fp, "typ:%c\n", Convert_Char (read_type));
+ fprintf (fp, "mid:%d\n", id);
+ fprintf (fp, "con:%d\n", contained);
+ fprintf (fp, "src:\n%s\n.\n", source . c_str ());
+ fprintf (fp, "pos:%d,%d\n", position . getBegin (), position . getEnd ());
+
+ n = del . size ();
+ fprintf (fp, "dln:%d\n", n);
+ fprintf (fp, "del:\n");
+
+ ct = 0;
+ for (i = 0; i < n; i ++)
+ {
+ if (ct > 0)
+ fprintf (fp, " ");
+ fprintf (fp, "%d", del [i]);
+ ct ++;
+ if (i == n - 1 || ct == 20)
+ {
+ fprintf (fp, "\n");
+ ct = 0;
+ }
+ }
+
+ fprintf (fp, "}\n");
+
+ return false;
+ }
+
+
+bool Celera_IMP_Sub_Msg_t :: read_body
+ (FILE * fp)
+
+// Read the rest of the body of an IMP submessage
+
+ {
+ char line [MAX_MSG_LINE];
+ int ct, level, state;
+
+ del . clear ();
+ level = 1;
+ ct = state = 0;
+ while (level > 0 && fgets (line, MAX_MSG_LINE, fp) != NULL)
+ {
+ int len;
+
+ len = strlen (line);
+ if (len >= MAX_MSG_LINE - 1)
+ throw IOException_t ("Celera message line too long");
+ if (line [len - 1] == '\n')
+ line [-- len] = '\0';
+
+ if (state > 0 && strcmp (line, ".") == 0)
+ state = 0;
+ else if (state == 1)
+ {
+ ct ++;
+ if (ct == 1)
+ source = line;
+ else
+ {
+ source . append ("\n");
+ source . append (line);
+ }
+ }
+ else if (state == 2)
+ {
+ if (line [0] == '}')
+ level --;
+ else
+ {
+ char * p;
+ int k;
+
+ for (p = strtok (line, " \t\n"); p != NULL;
+ p = strtok (NULL, " \t\n"))
+ {
+ k = strtol (p, NULL, 10);
+ del . push_back (k);
+ }
+ }
+ }
+ else if (strncmp (line, "typ:", 4) == 0)
+ Convert_Assign (read_type, line [4]);
+ else if (strncmp (line, "mid:", 4) == 0)
+ id = int (strtol (line + 4, NULL, 10));
+ else if (strncmp (line, "con:", 4) == 0)
+ contained = int (strtol (line + 4, NULL, 10));
+ else if (strncmp (line, "src:", 4) == 0)
+ state = 1;
+ else if (strncmp (line, "pos:", 4) == 0)
+ {
+ uint32_t start, end;
+
+ if (sscanf (line + 4, "%u,%u", & start, & end) != 2)
+ {
+ cerr << line << endl;
+ throw IOException_t ("Bad position range in IMP message");
+ }
+ position . setRange (start, end);
+ }
+ else if (strncmp (line, "dln:", 4) == 0)
+ ; // ignore
+ else if (strncmp (line, "del:", 4) == 0)
+ state = 2;
+ else if (line [0] == '}')
+ level --;
+ else
+ {
+ cerr << line << endl;
+ throw IOException_t ("Bad line in IMP sub-message");
+ }
+ }
+
+ return (level == 0);
+ }
+
+
+
+void Celera_MPS_Sub_Msg_t :: clear
+ (void)
+
+// Clear all entries in this message
+
+ {
+ read_type = NULL_READ;
+ id = 0;
+ source . erase ();
+ position . clear ();
+ del . clear ();
+
+ return;
+ }
+
+
+bool Celera_MPS_Sub_Msg_t :: print
+ (FILE * fp)
+
+// Print the contents of this MPS submessage to fp
+
+ {
+ int i, n, ct;
+
+ fprintf (fp, "{MPS\n");
+ fprintf (fp, "typ:%c\n", Convert_Char (read_type));
+ fprintf (fp, "mid:%d\n", id);
+ fprintf (fp, "src:\n%s\n.\n", source . c_str ());
+ fprintf (fp, "pos:%d,%d\n", position . getBegin (), position . getEnd ());
+
+ n = del . size ();
+ fprintf (fp, "dln:%d\n", n);
+ fprintf (fp, "del:\n");
+
+ ct = 0;
+ for (i = 0; i < n; i ++)
+ {
+ if (ct > 0)
+ fprintf (fp, " ");
+ fprintf (fp, "%d", del [i]);
+ ct ++;
+ if (i == n - 1 || ct == 20)
+ {
+ fprintf (fp, "\n");
+ ct = 0;
+ }
+ }
+
+ fprintf (fp, "}\n");
+
+ return false;
+ }
+
+
+bool Celera_MPS_Sub_Msg_t :: read_body
+ (FILE * fp)
+
+// Read the rest of the body of an MPS submessage
+
+ {
+ char line [MAX_MSG_LINE];
+ int ct, dln, level, state;
+
+ del . clear ();
+ level = 1;
+ ct = state = 0;
+ while (level > 0 && fgets (line, MAX_MSG_LINE, fp) != NULL)
+ {
+ int len;
+
+ len = strlen (line);
+ if (len >= MAX_MSG_LINE - 1)
+ throw IOException_t ("Celera message line too long");
+ if (line [len - 1] == '\n')
+ line [-- len] = '\0';
+
+ if (state > 0 && strcmp (line, ".") == 0)
+ state = 0;
+ else if (state == 1)
+ {
+ ct ++;
+ if (ct == 1)
+ source = line;
+ else
+ {
+ source . append ("\n");
+ source . append (line);
+ }
+ }
+ else if (line [0] == '}')
+ level --;
+ else if (state == 2)
+ {
+ char * p;
+ int k;
+
+ for (p = strtok (line, " \t\n"); p != NULL;
+ p = strtok (NULL, " \t\n"))
+ {
+ k = strtol (p, NULL, 10);
+ del . push_back (k);
+ }
+ }
+ else if (strncmp (line, "typ:", 4) == 0)
+ Convert_Assign (read_type, line [4]);
+ else if (strncmp (line, "mid:", 4) == 0)
+ id = int (strtol (line + 4, NULL, 10));
+ else if (strncmp (line, "src:", 4) == 0)
+ state = 1;
+ else if (strncmp (line, "pos:", 4) == 0)
+ {
+ uint32_t start, end;
+
+ if (sscanf (line + 4, "%u,%u", & start, & end) != 2)
+ {
+ cerr << line << endl;
+ throw IOException_t ("Bad position range in MPS sub-message");
+ }
+ position . setRange (start, end);
+ }
+ else if (strncmp (line, "dln:", 4) == 0)
+ dln = int (strtol (line + 4, NULL, 10));
+ else if (strncmp (line, "del:", 4) == 0)
+ state = 2;
+ else
+ {
+ cerr << line << endl;
+ throw IOException_t ("Bad line in MPS sub-message");
+ }
+ }
+
+ assert (size_t (dln) == del . size ());
+
+ return (level == 0);
+ }
+
+
+
+void Celera_UPS_Sub_Msg_t :: clear
+ (void)
+
+// Clear all entries in this message
+
+ {
+ unitig_type = NULL_UNI_T;
+ id = 0;
+ position . clear ();
+ del . clear ();
+
+ return;
+ }
+
+
+bool Celera_UPS_Sub_Msg_t :: print
+ (FILE * fp)
+
+// Print the contents of this UPS submessage to fp
+
+ {
+ int i, n, ct;
+
+ fprintf (fp, "{UPS\n");
+ fprintf (fp, "typ:%c\n", Convert_Char (unitig_type));
+ fprintf (fp, "lid:%d\n", id);
+ fprintf (fp, "pos:%d,%d\n", position . getBegin (), position . getEnd ());
+
+ n = del . size ();
+ fprintf (fp, "dln:%d\n", n);
+ fprintf (fp, "del:\n");
+
+ ct = 0;
+ for (i = 0; i < n; i ++)
+ {
+ if (ct > 0)
+ fprintf (fp, " ");
+ fprintf (fp, "%d", del [i]);
+ ct ++;
+ if (i == n - 1 || ct == 20)
+ {
+ fprintf (fp, "\n");
+ ct = 0;
+ }
+ }
+
+ fprintf (fp, "}\n");
+
+ return false;
+ }
+
+
+bool Celera_UPS_Sub_Msg_t :: read_body
+ (FILE * fp)
+
+// Read the rest of the body of an UPS submessage
+
+ {
+ char line [MAX_MSG_LINE];
+ int ct, dln, level, state;
+
+ del . clear ();
+ level = 1;
+ ct = state = 0;
+ while (level > 0 && fgets (line, MAX_MSG_LINE, fp) != NULL)
+ {
+ int len;
+
+ len = strlen (line);
+ if (len >= MAX_MSG_LINE - 1)
+ throw IOException_t ("Celera message line too long");
+ if (line [len - 1] == '\n')
+ line [-- len] = '\0';
+
+ if (line [0] == '}')
+ level --;
+ else if (state == 2)
+ {
+ char * p;
+ int k;
+
+ for (p = strtok (line, " \t\n"); p != NULL;
+ p = strtok (NULL, " \t\n"))
+ {
+ k = strtol (p, NULL, 10);
+ del . push_back (k);
+ }
+ }
+ else if (strncmp (line, "typ:", 4) == 0)
+ Convert_Assign (unitig_type, line [4]);
+ else if (strncmp (line, "lid:", 4) == 0)
+ id = int (strtol (line + 4, NULL, 10));
+ else if (strncmp (line, "pos:", 4) == 0)
+ {
+ uint32_t start, end;
+
+ if (sscanf (line + 4, "%u,%u", & start, & end) != 2)
+ {
+ cerr << line << endl;
+ throw IOException_t ("Bad position range in UPS sub-message");
+ }
+ position . setRange (start, end);
+ }
+ else if (strncmp (line, "dln:", 4) == 0)
+ dln = int (strtol (line + 4, NULL, 10));
+ else if (strncmp (line, "del:", 4) == 0)
+ state = 2;
+ else
+ {
+ cerr << line << endl;
+ throw IOException_t ("Bad line in UPS sub-message");
+ }
+ }
+
+ assert (size_t (dln) == del . size ());
+
+ return (level == 0);
+ }
+
+
+
+const string & Celera_Msg_Body_t :: getAccession
+ (void)
+ {
+ sprintf (Clean_Exit_Msg_Line, "getAccession illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+const Range_t & Celera_Msg_Body_t :: getClearRange
+ (void)
+ {
+ sprintf (Clean_Exit_Msg_Line, "getClearRange illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+const string & Celera_Msg_Body_t :: getConsensus
+ (void)
+ {
+ sprintf (Clean_Exit_Msg_Line, "getConsensus illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+vector <Celera_IMP_Sub_Msg_t> & Celera_Msg_Body_t :: getIMPList
+ (void)
+
+ {
+ sprintf (Clean_Exit_Msg_Line, "getIMPList illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+const vector <Celera_MPS_Sub_Msg_t> & Celera_Msg_Body_t :: getMPSList
+ (void)
+
+ {
+ sprintf (Clean_Exit_Msg_Line, "getMPSList illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+int Celera_Msg_Body_t :: getNumFrags
+ (void)
+
+ {
+ sprintf (Clean_Exit_Msg_Line, "getNumFrags illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+int Celera_Msg_Body_t :: getNumUnitigs
+ (void)
+
+ {
+ sprintf (Clean_Exit_Msg_Line, "getNumUnitigs illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+const string & Celera_Msg_Body_t :: getQuality
+ (void)
+ {
+ sprintf (Clean_Exit_Msg_Line, "getQuality illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+const string & Celera_Msg_Body_t :: getSequence
+ (void)
+ {
+ sprintf (Clean_Exit_Msg_Line, "getSequence illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+const string & Celera_Msg_Body_t :: getSource
+ (void)
+ {
+ sprintf (Clean_Exit_Msg_Line, "getAccession illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+const vector <Celera_UPS_Sub_Msg_t> & Celera_Msg_Body_t :: getUPSList
+ (void)
+
+ {
+ sprintf (Clean_Exit_Msg_Line, "getUPSList illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+void Celera_Msg_Body_t :: setAccession
+ (const char * s)
+ {
+ sprintf (Clean_Exit_Msg_Line, "setAccession illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+void Celera_Msg_Body_t :: setAccession
+ (const string & s)
+ {
+ sprintf (Clean_Exit_Msg_Line, "setAccession illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+void Celera_Msg_Body_t :: setClearRange
+ (Pos_t a, Pos_t b)
+ {
+ sprintf (Clean_Exit_Msg_Line, "setClearRange illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+void Celera_Msg_Body_t :: setIMPs
+ (const vector <int> & f, const vector <Ordered_Range_t> & p)
+ {
+ sprintf (Clean_Exit_Msg_Line, "setIMPs illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+void Celera_Msg_Body_t :: setQuality
+ (const char * q)
+ {
+ sprintf (Clean_Exit_Msg_Line, "setQuality illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+void Celera_Msg_Body_t :: setQuality
+ (const string & q)
+ {
+ sprintf (Clean_Exit_Msg_Line, "setQuality illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+void Celera_Msg_Body_t :: setSequence
+ (const char * s)
+ {
+ sprintf (Clean_Exit_Msg_Line, "setSequence illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+void Celera_Msg_Body_t :: setSequence
+ (const string & s)
+ {
+ sprintf (Clean_Exit_Msg_Line, "setSequence illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+void Celera_Msg_Body_t :: setStatus
+ (Celera_Unitig_Status_t s)
+ {
+ sprintf (Clean_Exit_Msg_Line, "setStatus illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+void Celera_Msg_Body_t :: setUniLen
+ (int n)
+ {
+ sprintf (Clean_Exit_Msg_Line, "setUniLen illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+void Celera_Msg_Body_t :: Remove_Empty_IMPs
+ (void)
+{
+ sprintf (Clean_Exit_Msg_Line, "Remove_Empty_IMPs illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+}
+
+
+void Celera_Msg_Body_t :: Update_IMPs
+ (const vector <Range_t> & pos, const vector <int> & ref,
+ const vector < vector <int> > & del_list)
+ {
+ sprintf (Clean_Exit_Msg_Line, "Update_IMPs illegal for %s message",
+ id_string ());
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+
+
+void Celera_ADT_Msg_Body_t :: clear
+ (void)
+
+// Clear all entries in this message
+
+ {
+ adl_list . clear ();
+
+ return;
+ }
+
+
+
+bool Celera_ADT_Msg_Body_t :: print_body
+ (FILE * fp)
+
+// Print the body of this ADT message to fp
+
+ {
+ vector <Celera_ADL_Sub_Msg_t> :: iterator p;
+
+ for (p = adl_list . begin (); p != adl_list . end (); p ++)
+ p -> print (fp);
+
+ fprintf (fp, ".\n");
+
+ return true;
+ }
+
+
+
+bool Celera_ADT_Msg_Body_t :: read_body
+ (FILE * fp)
+
+// Read the rest of the body of an ADT message
+
+ {
+ Celera_ADL_Sub_Msg_t adt_msg;
+ char line [MAX_MSG_LINE];
+
+ adl_list . clear ();
+
+ while (fgets (line, MAX_MSG_LINE, fp) != NULL)
+ if (strcmp (line, "{ADL\n") == 0)
+ {
+ adt_msg . clear ();
+ adt_msg . read_body (fp);
+ adl_list . push_back (adt_msg);
+ }
+ else if (strcmp (line, ".\n") == 0)
+ {
+ char * result;
+
+ result = fgets (line, MAX_MSG_LINE, fp);
+ if (result == NULL || strcmp (line, "}\n") != 0)
+ {
+ sprintf (Clean_Exit_Msg_Line, "Unexpected end of ADT message");
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+ return true;
+ }
+ else
+ return false;
+
+ return false;
+ }
+
+
+
+void Celera_BAT_Msg_Body_t :: clear
+ (void)
+
+// Clear all entries in this message
+
+ {
+ batch_name . erase ();
+ time_stamp . erase ();
+ accession . erase ();
+ comment . erase ();
+
+ return;
+ }
+
+
+
+bool Celera_BAT_Msg_Body_t :: print_body
+ (FILE * fp)
+
+// Print the body of this BAT message to fp
+
+ {
+ fprintf (fp, "bna:%s\n", batch_name . c_str ());
+ fprintf (fp, "crt:%s\n", time_stamp . c_str ());
+ fprintf (fp, "acc:%s\n", accession . c_str ());
+ fprintf (fp, "com:\n%s.\n", comment . c_str ());
+
+ return true;
+ }
+
+
+
+bool Celera_BAT_Msg_Body_t :: read_body
+ (FILE * fp)
+
+// Read the rest of the body of an BAT message
+
+ {
+ char line [MAX_MSG_LINE];
+ string s;
+ int level;
+
+ level = 1;
+ while (level > 0 && fgets (line, MAX_MSG_LINE, fp) != NULL)
+ if (strncmp (line, "bna:", 4) == 0)
+ batch_name . append (Strip_Trailing (line + 4, '\n'));
+ else if (strncmp (line, "crt:", 4) == 0)
+ time_stamp . append (Strip_Trailing (line + 4, '\n'));
+ else if (strncmp (line, "acc:", 4) == 0)
+ accession . append (Strip_Trailing (line + 4, '\n'));
+ else if (strncmp (line, "com:", 4) == 0)
+ {
+ Read_Comment_String (fp, s);
+ comment . append (s);
+ }
+ else if (line [0] == '}')
+ level --;
+ else
+ {
+ cerr << line << endl;
+ throw IOException_t ("Bad line in BAT message");
+ }
+
+ return (level == 0);
+ }
+
+
+
+void Celera_CCO_Msg_Body_t :: clear
+ (void)
+
+// Clear all entries in this message
+
+ {
+ accession . erase ();
+ placed = NULL_PLACEMENT;
+ len = 0;
+ consensus . erase ();
+ quality . erase ();
+ forced = false;
+ num_frags = 0;
+ num_unitigs = 0;
+ mps_list . clear ();
+ ups_list . clear ();
+
+ return;
+ }
+
+
+
+bool Celera_CCO_Msg_Body_t :: print_body
+ (FILE * fp)
+
+// Print the body of this CCO message to fp
+
+ {
+ vector <Celera_MPS_Sub_Msg_t> :: iterator p;
+ vector <Celera_UPS_Sub_Msg_t> :: iterator q;
+
+ fprintf (fp, "acc:%s\n", accession . c_str ());
+ fprintf (fp, "pla:%c\n", Convert_Char (placed));
+ fprintf (fp, "len:%d\n", len);
+ fprintf (fp, "cns:\n");
+ Fasta_Print (fp, consensus . c_str (), NULL);
+ fprintf (fp, ".\n");
+ fprintf (fp, "qlt:\n");
+ Fasta_Print (fp, quality . c_str (), NULL);
+ fprintf (fp, ".\n");
+ fprintf (fp, "for:%c\n", forced ? '1' : '0');
+ fprintf (fp, "npc:%d\n", num_frags);
+ fprintf (fp, "nou:%d\n", num_unitigs);
+
+ for (p = mps_list . begin (); p != mps_list . end (); p ++)
+ p -> print (fp);
+
+ for (q = ups_list . begin (); q != ups_list . end (); q ++)
+ q -> print (fp);
+
+ return false;
+ }
+
+
+
+bool Celera_CCO_Msg_Body_t :: read_body
+ (FILE * fp)
+
+// Read the rest of the body of an CCO message
+
+ {
+ char line [MAX_MSG_LINE];
+ int level, state;
+ int line_ct = 0;
+
+ consensus . erase ();
+ quality . erase ();
+
+ level = 1;
+ state = 0;
+ while (level > 0 && fgets (line, MAX_MSG_LINE, fp) != NULL)
+ {
+ int len;
+
+ line_ct ++;
+ len = strlen (line);
+ if (len >= MAX_MSG_LINE - 1)
+ throw IOException_t ("Celera message line too long");
+ if (line [len - 1] == '\n')
+ line [-- len] = '\0';
+
+ if (state > 0 && strcmp (line, ".") == 0)
+ state = 0;
+ else if (state == 1)
+ consensus . append (line);
+ else if (state == 2)
+ quality . append (line);
+ else if (strncmp (line, "acc:", 4) == 0)
+ accession . append (line + 4);
+ else if (strncmp (line, "pla:", 4) == 0)
+ Convert_Assign (placed, line [4]);
+ else if (strncmp (line, "len:", 4) == 0)
+ len = int (strtol (line + 4, NULL, 10));
+ else if (strncmp (line, "cns:", 4) == 0)
+ state = 1;
+ else if (strncmp (line, "qlt:", 4) == 0)
+ state = 2;
+ else if (strncmp (line, "for:", 4) == 0)
+ forced = (line [4] != '0');
+ else if (strncmp (line, "npc:", 4) == 0)
+ num_frags = int (strtol (line + 4, NULL, 10));
+ else if (strncmp (line, "nou:", 4) == 0)
+ {
+ Celera_MPS_Sub_Msg_t mps_message;
+ Celera_UPS_Sub_Msg_t ups_message;
+ int i;
+
+ num_unitigs = int (strtol (line + 4, NULL, 10));
+
+ mps_list . clear ();
+ for (i = 0; i < num_frags; i ++)
+ {
+ char * p;
+
+ p = fgets (line, MAX_MSG_LINE, fp);
+ if (p == NULL || strcmp (line, "{MPS\n") != 0)
+ {
+ cerr << line;
+ throw IOException_t ("Line should have been \"{MPS\"\n");
+ }
+ mps_message . read_body (fp);
+ mps_list . push_back (mps_message);
+ }
+
+ ups_list . clear ();
+ for (i = 0; i < num_unitigs; i ++)
+ {
+ if (fgets (line, MAX_MSG_LINE, fp) == NULL
+ || strcmp (line, "{UPS\n") != 0)
+ {
+ cerr << line;
+ throw IOException_t ("Line should have been \"{UPS\"\n");
+ }
+ ups_message . read_body (fp);
+ ups_list . push_back (ups_message);
+ }
+ }
+ else if (line [0] == '}')
+ level --;
+ else
+ {
+ cerr << line << endl;
+ throw IOException_t ("Bad line in CCO message");
+ }
+ }
+
+ return (level == 0);
+ }
+
+
+
+void Celera_DST_Msg_Body_t :: clear
+ (void)
+
+// Clear all entries in this message
+
+ {
+ action = NULL_ACTION;
+ accession . erase ();
+ mean = 0.0;
+ std_dev = 0.0;
+
+ return;
+ }
+
+
+
+bool Celera_DST_Msg_Body_t :: print_body
+ (FILE * fp)
+
+// Print the body of this DST message to fp
+
+ {
+ fprintf (fp, "act:%c\n", Convert_Char (action));
+ fprintf (fp, "acc:%s\n", accession . c_str ());
+ fprintf (fp, "mea:%.2f\n", mean);
+ fprintf (fp, "std:%.2f\n", std_dev);
+
+ return true;
+ }
+
+
+
+bool Celera_DST_Msg_Body_t :: read_body
+ (FILE * fp)
+
+// Read the rest of the body of an DST message
+
+ {
+ char line [MAX_MSG_LINE];
+ int level;
+
+ level = 1;
+ while (level > 0 && fgets (line, MAX_MSG_LINE, fp) != NULL)
+ if (strncmp (line, "act:", 4) == 0)
+ Convert_Assign (action, line [4]);
+ else if (strncmp (line, "acc:", 4) == 0)
+ accession . append (Strip_Trailing (line + 4, '\n'));
+ else if (strncmp (line, "mea:", 4) == 0)
+ mean = strtod (line + 4, NULL);
+ else if (strncmp (line, "std:", 4) == 0)
+ std_dev = strtod (line + 4, NULL);
+ else if (line [0] == '{')
+ level ++;
+ else if (line [0] == '}')
+ level --;
+
+ return (level == 0);
+ }
+
+
+
+void Celera_FRG_Msg_Body_t :: clear
+ (void)
+
+// Clear all entries in this message
+
+ {
+ action = NULL_ACTION;
+ accession . erase ();
+ read_type = NULL_READ;
+ source . erase ();
+ time_stamp . erase ();
+ sequence . erase ();
+ quality . erase ();
+ clear_range . setRange (0, 0);
+
+ return;
+ }
+
+
+
+bool Celera_FRG_Msg_Body_t :: print_body
+ (FILE * fp)
+
+// Print the body of this FRG message to fp
+
+ {
+ fprintf (fp, "act:%c\n", Convert_Char (action));
+ fprintf (fp, "acc:%s\n", accession . c_str ());
+ fprintf (fp, "typ:%c\n", Convert_Char (read_type));
+ fprintf (fp, "src:\n%s.\n", source . c_str ());
+ fprintf (fp, "etm:%s\n", time_stamp . c_str ());
+ fprintf (fp, "seq:\n");
+ Fasta_Print (fp, sequence . c_str (), NULL);
+ fprintf (fp, ".\n");
+ fprintf (fp, "qlt:\n");
+ Fasta_Print (fp, quality . c_str (), NULL);
+ fprintf (fp, ".\n");
+ fprintf (fp, "clr:%d,%d\n", int (clear_range . getBegin ()),
+ int (clear_range . getEnd ()));
+
+ return true;
+ }
+
+
+
+bool Celera_FRG_Msg_Body_t :: read_body
+ (FILE * fp)
+
+// Read the rest of the body of an FRG message
+
+ {
+ char line [MAX_MSG_LINE];
+ string s;
+ int level;
+
+ level = 1;
+ while (level > 0 && fgets (line, MAX_MSG_LINE, fp) != NULL)
+ {
+ int len;
+
+ len = strlen (line);
+ if (len >= MAX_MSG_LINE - 1)
+ throw IOException_t ("Celera message line too long");
+
+ if (strncmp (line, "act:", 4) == 0)
+ Convert_Assign (action, line [4]);
+ else if (strncmp (line, "acc:", 4) == 0)
+ accession . append (Strip_Trailing (line + 4, '\n'));
+ else if (strncmp (line, "typ:", 4) == 0)
+ Convert_Assign (read_type, line [4]);
+ else if (strncmp (line, "src:", 4) == 0)
+ {
+ Read_Comment_String (fp, s);
+ source . append (s);
+ }
+ else if (strncmp (line, "etm:", 4) == 0)
+ time_stamp . append (Strip_Trailing (line + 4, '\n'));
+ else if (strncmp (line, "seq:", 4) == 0)
+ {
+ Read_Sequence_String (fp, s);
+ sequence . append (s);
+ }
+ else if (strncmp (line, "qlt:", 4) == 0)
+ {
+ Read_Sequence_String (fp, s);
+ quality . append (s);
+ }
+ else if (strncmp (line, "clr:", 4) == 0)
+ {
+ uint32_t lo, hi;
+
+ if (sscanf (line + 4, "%u,%u", & lo, & hi) != 2
+ || hi < lo)
+ {
+ cerr << line << endl;
+ throw IOException_t ("Bad clear range in FRG message");
+ }
+ clear_range . setRange (lo, hi);
+ }
+ else if (line [0] == '}')
+ level --;
+ else
+ {
+ cerr << line << endl;
+ throw IOException_t ("Bad line in FRG message");
+ }
+ }
+
+ return (level == 0);
+ }
+
+
+
+void Celera_ICM_Msg_Body_t :: clear
+ (void)
+
+// Clear all entries in this message
+
+ {
+ content . erase ();
+
+ return;
+ }
+
+
+
+bool Celera_ICM_Msg_Body_t :: print_body
+ (FILE * fp)
+
+// Print the body of this ICM message to fp
+
+ {
+ // Stub. Print nothing
+
+ return false;
+ }
+
+
+
+bool Celera_ICM_Msg_Body_t :: read_body
+ (FILE * fp)
+
+// Read the rest of the body of an ICM message
+
+ {
+ char line [MAX_MSG_LINE];
+ int level;
+
+ // Stub. Just skips over message
+
+ level = 1;
+ while (level > 0 && fgets (line, MAX_MSG_LINE, fp) != NULL)
+ if (line [0] == '{')
+ level ++;
+ else if (line [0] == '}')
+ level --;
+
+ return (level == 0);
+ }
+
+
+
+void Celera_IUM_Msg_Body_t :: clear
+ (void)
+
+// Clear all entries in this message
+
+ {
+ accession . erase ();
+ source . erase ();
+ cover_stat = 0.0;
+ status = NULL_UNITIG;
+ a_branch_point = b_branch_point = 0;
+ uni_len = 0;
+ consensus . erase ();
+ quality . erase ();
+ forced = false;
+ num_frags = 0;
+ imp_list . clear ();
+
+ return;
+ }
+
+
+
+bool Celera_IUM_Msg_Body_t :: print_body
+ (FILE * fp)
+
+// Print the body of this IUM message to fp
+
+ {
+ vector <Celera_IMP_Sub_Msg_t> :: iterator p;
+
+ fprintf (fp, "acc:%s\n", accession . c_str ());
+ fprintf (fp, "src:\n%s\n.\n", source . c_str ());
+ fprintf (fp, "cov:%.3f\n", cover_stat);
+ fprintf (fp, "sta:%c\n", Convert_Char (status));
+ fprintf (fp, "abp:%d\n", a_branch_point);
+ fprintf (fp, "bbp:%d\n", b_branch_point);
+ fprintf (fp, "len:%d\n", uni_len);
+ fprintf (fp, "cns:\n");
+ Fasta_Print (fp, consensus . c_str (), NULL);
+ fprintf (fp, ".\n");
+ fprintf (fp, "qlt:\n");
+ Fasta_Print (fp, quality . c_str (), NULL);
+ fprintf (fp, ".\n");
+ fprintf (fp, "for:%c\n", forced ? '1' : '0');
+ fprintf (fp, "nfr:%d\n", num_frags);
+
+ for (p = imp_list . begin (); p != imp_list . end (); p ++)
+ p -> print (fp);
+
+ return true;
+ }
+
+
+
+bool Celera_IUM_Msg_Body_t :: read_body
+ (FILE * fp)
+
+// Read the rest of the body of an IUM message
+
+ {
+ char line [MAX_MSG_LINE];
+ int ct, level, state;
+
+ level = 1;
+ ct = state = 0;
+ while (level > 0 && fgets (line, MAX_MSG_LINE, fp) != NULL)
+ {
+ int len;
+
+ len = strlen (line);
+ if (len >= MAX_MSG_LINE - 1)
+ throw IOException_t ("Celera message line too long");
+ if (line [len - 1] == '\n')
+ line [-- len] = '\0';
+
+ if (state > 0 && strcmp (line, ".") == 0)
+ state = 0;
+ else if (state == 1)
+ {
+ ct ++;
+ if (ct == 1)
+ source = line;
+ else
+ {
+ source . append ("\n");
+ source . append (line);
+ }
+ }
+ else if (state == 2)
+ consensus . append (line);
+ else if (state == 3)
+ quality . append (line);
+ else if (strncmp (line, "acc:", 4) == 0)
+ accession . append (line + 4);
+ else if (strncmp (line, "cov:", 4) == 0)
+ cover_stat = float (strtod (line + 4, NULL));
+ else if (strncmp (line, "sta:", 4) == 0)
+ Convert_Assign (status, line [4]);
+ else if (strncmp (line, "abp:", 4) == 0)
+ a_branch_point = int (strtol (line + 4, NULL, 10));
+ else if (strncmp (line, "bbp:", 4) == 0)
+ b_branch_point = int (strtol (line + 4, NULL, 10));
+ else if (strncmp (line, "len:", 4) == 0)
+ uni_len = int (strtol (line + 4, NULL, 10));
+ else if (strncmp (line, "src:", 4) == 0)
+ state = 1;
+ else if (strncmp (line, "cns:", 4) == 0)
+ state = 2;
+ else if (strncmp (line, "qlt:", 4) == 0)
+ state = 3;
+ else if (strncmp (line, "for:", 4) == 0)
+ forced = (line [4] != '0');
+ else if (strncmp (line, "nfr:", 4) == 0)
+ {
+ int i;
+ Celera_IMP_Sub_Msg_t sub_message;
+ bool success;
+
+
+ num_frags = int (strtol (line + 4, NULL, 10));
+ imp_list . clear ();
+ for (i = 0; i < num_frags; i ++)
+ {
+ line [0] = '\0';
+ if (fgets (line, MAX_MSG_LINE, fp) == NULL
+ || strcmp (line, "{IMP\n") != 0)
+ {
+ cerr << line;
+ throw IOException_t ("Line should have been \"{IMP\"\n");
+ }
+ success = sub_message . read_body (fp);
+ if (! success)
+ {
+ cerr << "accession = " << accession << " i = " << i << endl;
+ throw IOException_t ("Failed to read IMP submessage");
+ }
+ imp_list . push_back (sub_message);
+ }
+ }
+ else if (line [0] == '}')
+ level --;
+ else
+ {
+ cerr << line << endl;
+ throw IOException_t ("Bad line in IUM message");
+ }
+ }
+
+ return (level == 0);
+ }
+
+
+
+void Celera_IUM_Msg_Body_t :: Remove_Empty_IMPs
+ (void)
+
+// Remove all IMP submessages with positions that are both zero from
+// this message.
+
+{
+ vector <Celera_IMP_Sub_Msg_t> new_list;
+ Celera_IMP_Sub_Msg_t m;
+ int remove_ct = 0;
+ int i;
+
+ for (i = 0; i < num_frags; i ++)
+ if (imp_list [i] . Is_Empty ())
+ remove_ct ++;
+
+ if (remove_ct == 0)
+ return; // nothing to remove
+
+ for (i = 0; i < num_frags; i ++)
+ if (! imp_list [i] . Is_Empty ())
+ new_list . push_back (imp_list [i]);
+
+ imp_list = new_list;
+ num_frags -= remove_ct;
+
+ return;
+}
+
+
+
+void Celera_IUM_Msg_Body_t :: setIMPs
+ (const vector <int> & f, const vector <Ordered_Range_t> & p)
+
+// Make the IMP submessages of this message be the reads with IDs
+// in f and consensus positions in p .
+
+ {
+ Celera_IMP_Sub_Msg_t m;
+ int i, n;
+
+ m . setReadType (READ_READ);
+ m . setContained (0);
+ m . setSource ("");
+
+ imp_list . clear ();
+
+ n = f . size ();
+ for (i = 0; i < n; i ++)
+ {
+ m . setID (f [i]);
+ m . setPosition (p [i]);
+ imp_list . push_back (m);
+ }
+ num_frags = n;
+
+ return;
+ }
+
+
+
+void Celera_IUM_Msg_Body_t :: Update_IMPs
+ (const vector <Range_t> & pos, const vector <int> & ref,
+ const vector < vector <int> > & del_list)
+
+// Adjust the IMP position entries in this message body
+// to the values in pos . ref [i] is the subscript of the IMP
+// entry that corresponds to pos [i] . Only applies to IUM and
+// ICM messages.
+
+ {
+ int i, n;
+
+ n = pos . size ();
+ if (n != int (ref . size ())
+ || n != int (imp_list . size ())
+ || n != int (del_list . size ()))
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "Bad sizes in Update_IMPs n = %d\n"
+ " refsize = %d listsize = %d delsize = %d",
+ n, int (ref . size ()), int (imp_list . size ()),
+ int (del_list . size ()));
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+ for (i = 0; i < n; i ++)
+ {
+ int a, b, j;
+
+ j = ref [i];
+ a = imp_list [j] . getPosition () . getBegin ();
+ b = imp_list [j] . getPosition () . getEnd ();
+ if (a <= b)
+ imp_list [j] . setPosition (pos [i] . getBegin (), pos [i] . getEnd ());
+ else
+ imp_list [j] . setPosition (pos [i] . getEnd (), pos [i] . getBegin ());
+ imp_list [j] . setDel (del_list [i]);
+ }
+
+ return;
+ }
+
+
+
+void Celera_LKG_Msg_Body_t :: clear
+ (void)
+
+// Clear all entries in this message
+
+ {
+ action = NULL_ACTION;
+ link_type = NULL_LINK;
+ accession1 . erase ();
+ accession2 . erase ();
+ time_stamp . erase ();
+ dst_ref . erase ();
+ ori = NULL_ORIENT;
+
+ return;
+ }
+
+
+
+bool Celera_LKG_Msg_Body_t :: print_body
+ (FILE * fp)
+
+// Print the body of this LKG message to fp
+
+ {
+ fprintf (fp, "act:%c\n", Convert_Char (action));
+ fprintf (fp, "typ:%c\n", Convert_Char (link_type));
+ fprintf (fp, "fg1:%s\n", accession1 . c_str ());
+ fprintf (fp, "fg2:%s\n", accession2 . c_str ());
+ fprintf (fp, "etm:%s\n", time_stamp . c_str ());
+ fprintf (fp, "dst:%s\n", dst_ref . c_str ());
+ fprintf (fp, "ori:%c\n", Convert_Char (ori));
+
+ return false;
+ }
+
+
+
+bool Celera_LKG_Msg_Body_t :: read_body
+ (FILE * fp)
+
+// Read the rest of the body of an LKG message
+
+ {
+ char line [MAX_MSG_LINE];
+ int level;
+
+ // Stub. Just skips over message
+
+ level = 1;
+ while (level > 0 && fgets (line, MAX_MSG_LINE, fp) != NULL)
+ if (strncmp (line, "act:", 4) == 0)
+ Convert_Assign (action, line [4]);
+ else if (strncmp (line, "typ:", 4) == 0)
+ Convert_Assign (link_type, line [4]);
+ else if (strncmp (line, "fg1:", 4) == 0)
+ accession1 . append (Strip_Trailing (line + 4, '\n'));
+ else if (strncmp (line, "fg2:", 4) == 0)
+ accession2 . append (Strip_Trailing (line + 4, '\n'));
+ else if (strncmp (line, "etm:", 4) == 0)
+ time_stamp . append (Strip_Trailing (line + 4, '\n'));
+ else if (strncmp (line, "dst:", 4) == 0)
+ dst_ref . append (Strip_Trailing (line + 4, '\n'));
+ else if (strncmp (line, "ori:", 4) == 0)
+ Convert_Assign (ori, line [4]);
+ else if (line [0] == '{')
+ level ++;
+ else if (line [0] == '}')
+ level --;
+
+ return (level == 0);
+ }
+
+
+
+const string & Celera_Message_t :: getAccession
+ (void) const
+
+// Return the accession field of this message if it's valid
+
+ {
+ switch (msg_type)
+ {
+ case CCO_MSG :
+ case FRG_MSG :
+ case IUM_MSG :
+ return body -> getAccession ();
+ default :
+ throw IOException_t ("Message type does not have accession field");
+ }
+ }
+
+
+
+const Range_t & Celera_Message_t :: getClearRange
+ (void) const
+
+// Return the range field of this message if it's valid
+
+ {
+ switch (msg_type)
+ {
+ case FRG_MSG :
+ return body -> getClearRange ();
+ default :
+ throw IOException_t ("Message type does not have range field");
+ }
+ }
+
+
+
+const string & Celera_Message_t :: getConsensus
+ (void) const
+
+// Return the consensus field of this message if it's valid
+
+ {
+ switch (msg_type)
+ {
+ case CCO_MSG :
+ case IUM_MSG :
+ return body -> getConsensus ();
+ default :
+ throw IOException_t ("Message type does not have quality field");
+ }
+ }
+
+
+
+vector <Celera_IMP_Sub_Msg_t> & Celera_Message_t :: getIMPList
+ (void) const
+
+// Return the imp_list field of this message if it's valid
+
+ {
+ switch (msg_type)
+ {
+ case IUM_MSG :
+ return body -> getIMPList ();
+ default :
+ throw IOException_t ("Message type does not have IMP-list field");
+ }
+ }
+
+
+
+const vector <Celera_MPS_Sub_Msg_t> & Celera_Message_t :: getMPSList
+ (void) const
+
+// Return the mps_list field of this message if it's valid
+
+ {
+ switch (msg_type)
+ {
+ case CCO_MSG :
+ return body -> getMPSList ();
+ default :
+ throw IOException_t ("Message type does not have MPS-list field");
+ }
+ }
+
+
+
+int Celera_Message_t :: getNumFrags
+ (void) const
+
+// Return the num_frags field of this message if it's valid
+
+ {
+ switch (msg_type)
+ {
+ case CCO_MSG :
+ case IUM_MSG :
+ return body -> getNumFrags ();
+ default :
+ throw IOException_t ("Message type does not have num-frags field");
+ }
+ }
+
+
+
+int Celera_Message_t :: getNumUnitigs
+ (void) const
+
+// Return the num_unitigs field of this message if it's valid
+
+ {
+ switch (msg_type)
+ {
+ case CCO_MSG :
+ return body -> getNumUnitigs ();
+ default :
+ throw IOException_t ("Message type does not have num-unitigs field");
+ }
+ }
+
+
+
+const string & Celera_Message_t :: getQuality
+ (void) const
+
+// Return the quality field of this message if it's valid
+
+ {
+ switch (msg_type)
+ {
+ case CCO_MSG :
+ case FRG_MSG :
+ return body -> getQuality ();
+ default :
+ throw IOException_t ("Message type does not have quality field");
+ }
+ }
+
+
+
+const string & Celera_Message_t :: getSequence
+ (void) const
+
+// Return the sequence field of this message if it's valid
+
+ {
+ switch (msg_type)
+ {
+ case FRG_MSG :
+ return body -> getSequence ();
+ default :
+ throw IOException_t ("Message type does not have sequence field");
+ }
+ }
+
+
+
+const string & Celera_Message_t :: getSource
+ (void) const
+
+// Return the source field of this message if it's valid
+
+ {
+ switch (msg_type)
+ {
+ case FRG_MSG :
+ return body -> getSource ();
+ default :
+ throw IOException_t ("Message type does not have source field");
+ }
+ }
+
+
+
+const vector <Celera_UPS_Sub_Msg_t> & Celera_Message_t :: getUPSList
+ (void) const
+
+// Return the ups_list field of this message if it's valid
+
+ {
+ switch (msg_type)
+ {
+ case CCO_MSG :
+ return body -> getUPSList ();
+ default :
+ throw IOException_t ("Message type does not have MPS-list field");
+ }
+ }
+
+
+
+void Celera_Message_t :: setAccession
+ (const char * s)
+
+// Set the accession field of this message to s if it's valid
+
+ {
+ body -> setAccession (s);
+ }
+
+
+
+void Celera_Message_t :: setAccession
+ (const string & s)
+
+// Set the accession field of this message to s if it's valid
+
+ {
+ body -> setAccession (s);
+ }
+
+
+
+void Celera_Message_t :: setClearRange
+ (Pos_t a, Pos_t b)
+
+// Set the clear_range field of this message to s if it's valid
+
+ {
+ body -> setClearRange (a, b);
+ }
+
+
+void Celera_Message_t :: setIMPs
+ (const vector <int> & f, const vector <Ordered_Range_t> & p)
+
+// Set the IMP submessages of this message to the read IDs in f
+// and the positions in p .
+
+ {
+ body -> setIMPs (f, p);
+ }
+
+
+
+void Celera_Message_t :: setQuality
+ (const char * q)
+
+// Set the quality field of this message to q if it's valid
+
+ {
+ body -> setQuality (q);
+ }
+
+
+
+void Celera_Message_t :: setQuality
+ (const string & q)
+
+// Set the quality field of this message to q if it's valid
+
+ {
+ body -> setQuality (q);
+ }
+
+
+
+void Celera_Message_t :: setSequence
+ (const char * s)
+
+// Set the sequence field of this message to s if it's valid
+
+ {
+ body -> setSequence (s);
+ }
+
+
+
+void Celera_Message_t :: setSequence
+ (const string & s)
+
+// Set the sequence field of this message to s if it's valid
+
+ {
+ body -> setSequence (s);
+ }
+
+
+
+void Celera_Message_t :: setStatus
+ (Celera_Unitig_Status_t s)
+
+// Set the status field of this message to s if it's valid
+
+ {
+ body -> setStatus (s);
+ }
+
+
+
+void Celera_Message_t :: setType
+ (Celera_Message_Type_t t)
+
+// Set the type of this message to t
+
+ {
+ if (msg_type == t)
+ {
+ body -> clear ();
+ return;
+ }
+
+ if (msg_type != NULL_MSG)
+ delete body;
+
+ msg_type = t;
+ switch (t)
+ {
+ case ADT_MSG :
+ body = new Celera_ADT_Msg_Body_t;
+ break;
+ case BAT_MSG :
+ body = new Celera_BAT_Msg_Body_t;
+ break;
+ case DST_MSG :
+ body = new Celera_DST_Msg_Body_t;
+ break;
+ case FRG_MSG :
+ body = new Celera_FRG_Msg_Body_t;
+ break;
+ case ICM_MSG :
+ body = new Celera_ICM_Msg_Body_t;
+ break;
+ case IUM_MSG :
+ body = new Celera_IUM_Msg_Body_t;
+ break;
+ case LKG_MSG :
+ body = new Celera_LKG_Msg_Body_t;
+ break;
+ default :
+ sprintf (Clean_Exit_Msg_Line,
+ "Celera message setType for type %s not supported",
+ Convert_String (t));
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ body -> clear ();
+ }
+
+
+
+void Celera_Message_t :: setUniLen
+ (int n)
+
+// Set the uni_len field of this message to n if it's valid
+
+ {
+ body -> setUniLen (n);
+ }
+
+
+
+void Celera_Message_t :: print
+ (FILE * fp, const char * seq, const char * qv)
+
+// Print this message to fp . If seq and qv are not
+// NULL , print them as the sequence and quality if this is
+// an IUM message.
+
+ {
+ fprintf (fp, "{%s\n", Convert_String (msg_type));
+
+ body -> print_body (fp); // add next
+
+ fprintf (fp, "}\n");
+
+ return;
+ }
+
+
+
+bool Celera_Message_t :: read
+ (FILE * fp)
+
+// Read the next message from fp and return a pointer to it.
+// Return true if successful; false , otherwise.
+
+ {
+ char line [MAX_MSG_LINE];
+ int len, line_ct = 0;
+
+ while (fgets (line, MAX_MSG_LINE, fp) != NULL)
+ {
+ line_ct ++;
+ if (line [0] == '{')
+ break;
+ }
+
+ if (line_ct == 0 || line [0] != '{')
+ return false;
+
+ len = strlen (line);
+ if (len >= MAX_MSG_LINE - 1)
+ throw IOException_t ("Celera message line too long");
+
+ clear ();
+
+ line [4] = '\0';
+ if (strcmp (line + 1, "ADT") == 0)
+ {
+ if (msg_type == ADT_MSG)
+ body -> clear ();
+ else
+ {
+ clear ();
+ msg_type = ADT_MSG;
+ body = new Celera_ADT_Msg_Body_t;
+ }
+ }
+ else if (strcmp (line + 1, "BAT") == 0)
+ {
+ if (msg_type == BAT_MSG)
+ body -> clear ();
+ else
+ {
+ clear ();
+ msg_type = BAT_MSG;
+ body = new Celera_BAT_Msg_Body_t;
+ }
+ }
+ else if (strcmp (line + 1, "CCO") == 0)
+ {
+ if (msg_type == CCO_MSG)
+ body -> clear ();
+ else
+ {
+ clear ();
+ msg_type = CCO_MSG;
+ body = new Celera_CCO_Msg_Body_t;
+ }
+ }
+ else if (strcmp (line + 1, "DST") == 0)
+ {
+ if (msg_type == DST_MSG)
+ body -> clear ();
+ else
+ {
+ clear ();
+ msg_type = DST_MSG;
+ body = new Celera_DST_Msg_Body_t;
+ }
+ }
+ else if (strcmp (line + 1, "FRG") == 0)
+ {
+ if (msg_type == FRG_MSG)
+ body -> clear ();
+ else
+ {
+ clear ();
+ msg_type = FRG_MSG;
+ body = new Celera_FRG_Msg_Body_t;
+ }
+ }
+ else if (strcmp (line + 1, "ICM") == 0)
+ {
+ if (msg_type == ICM_MSG)
+ body -> clear ();
+ else
+ {
+ clear ();
+ msg_type = ICM_MSG;
+ body = new Celera_ICM_Msg_Body_t;
+ }
+ }
+ else if (strcmp (line + 1, "IUM") == 0)
+ {
+ if (msg_type == IUM_MSG)
+ body -> clear ();
+ else
+ {
+ clear ();
+ msg_type = IUM_MSG;
+ body = new Celera_IUM_Msg_Body_t;
+ }
+ }
+ else if (strcmp (line + 1, "LKG") == 0)
+ {
+ if (msg_type == LKG_MSG)
+ body -> clear ();
+ else
+ {
+ clear ();
+ msg_type = LKG_MSG;
+ body = new Celera_LKG_Msg_Body_t;
+ }
+ }
+ else
+ {
+ strcat (line, " <== Unrecognized message type");
+ throw IOException_t (line);
+ }
+
+ return body -> read_body (fp);
+ }
+
+
+
+void Celera_Message_t :: Remove_Empty_IMPs
+ (void)
+
+// Remove IMP entries with both values equal to zero in the body
+// of this message. Only applies to IUM and ICM messages.
+
+ {
+ switch (msg_type)
+ {
+ case IUM_MSG :
+ case ICM_MSG :
+ body -> Remove_Empty_IMPs ();
+ return;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "Attempt to Update_IMPs for %s message",
+ Convert_String (msg_type));
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+ }
+
+
+
+void Celera_Message_t :: Update_IMPs
+ (const vector <Range_t> & pos, const vector <int> & ref,
+ const vector < vector <int> > & del_list)
+
+// Adjust the IMP position entries in the body of this message
+// to the values in pos . ref [i] is the subscript of the IMP
+// entry that corresponds to pos [i] . Only applies to IUM and
+// ICM messages.
+
+ {
+ switch (msg_type)
+ {
+ case IUM_MSG :
+ case ICM_MSG :
+ body -> Update_IMPs (pos, ref, del_list);
+ return;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "Attempt to Update_IMPs for %s message",
+ Convert_String (msg_type));
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+ }
+
+
+
+const char * Convert_String
+ (Celera_Message_Type_t msg_type)
+
+// Return a printable version of msg_type
+
+ {
+ switch (msg_type)
+ {
+ case NULL_MSG :
+ return "NULL";
+ case ADT_MSG :
+ return "ADT";
+ case BAT_MSG :
+ return "BAT";
+ case CCO_MSG :
+ return "CCO";
+ case DST_MSG :
+ return "DST";
+ case FRG_MSG :
+ return "FRG";
+ case ICM_MSG :
+ return "ICM";
+ case IUM_MSG :
+ return "IUM";
+ case LKG_MSG :
+ return "LKG";
+ default :
+ throw IOException_t ("Invalid message type");
+ }
+ }
+
+
+void Convert_Assign
+ (Celera_Msg_Action_t & action, char ch)
+
+// Set action to the message action encoded by character ch .
+
+ {
+ switch (ch)
+ {
+ case 'A' :
+ action = ADD_ACTION;
+ break;
+ case 'D' :
+ action = DELETE_ACTION;
+ break;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "Illegal action code = %c", ch);
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+ return;
+ }
+
+
+char Convert_Char
+ (Celera_Msg_Action_t t)
+
+// Return a printable version of t
+
+ {
+ switch (t)
+ {
+ case ADD_ACTION :
+ return 'A';
+ case DELETE_ACTION :
+ return 'D';
+ default :
+ throw IOException_t ("Invalid action type");
+ }
+ }
+
+
+
+void Convert_Assign
+ (Celera_Msg_Read_Type_t & read_type , char ch)
+
+// Set read_type to the read type encoded by character ch .
+
+ {
+ switch (ch)
+ {
+ case 'R' :
+ read_type = READ_READ;
+ break;
+ case 'B' :
+ read_type = BACTIG_READ;
+ break;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "Illegal read type code = %c", ch);
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+ return;
+ }
+
+
+char Convert_Char
+ (Celera_Msg_Read_Type_t t)
+
+// Return a printable version of t
+
+ {
+ switch (t)
+ {
+ case READ_READ :
+ return 'R';
+ case BACTIG_READ :
+ return 'B';
+ default :
+ throw IOException_t ("Invalid read type");
+ }
+ }
+
+
+
+void Convert_Assign
+ (Celera_Msg_Link_Type_t & link_type , char ch)
+
+// Set link_type to the read type encoded by character ch .
+
+ {
+ switch (ch)
+ {
+ case 'M' :
+ link_type = MATE_LINK;
+ break;
+ case 'B' :
+ link_type = BAC_GUIDE;
+ break;
+ case 'S' :
+ link_type = STS_GUIDE;
+ break;
+ case 'R' :
+ link_type = REREAD_LINK;
+ break;
+ case 'Y' :
+ link_type = MAY_JOIN;
+ break;
+ case 'T' :
+ link_type = MUST_JOIN;
+ break;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "Illegal link type code = %c", ch);
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+ return;
+ }
+
+
+char Convert_Char
+ (Celera_Msg_Link_Type_t t)
+
+// Return a printable version of t
+
+ {
+ switch (t)
+ {
+ case MATE_LINK :
+ return 'M';
+ case BAC_GUIDE :
+ return 'B';
+ case STS_GUIDE :
+ return 'S';
+ case REREAD_LINK :
+ return 'R';
+ case MAY_JOIN :
+ return 'Y';
+ case MUST_JOIN :
+ return 'T';
+ default :
+ throw IOException_t ("Invalid link type");
+ }
+ }
+
+
+
+void Convert_Assign
+ (Celera_Msg_Orientation_Type_t & ori_type , char ch)
+
+// Set ori_type to the read type encoded by character ch .
+
+ {
+ switch (ch)
+ {
+ case 'N' :
+ ori_type = NORMAL_ORIENT;
+ break;
+ case 'I' :
+ ori_type = INNIE_ORIENT;
+ break;
+ case 'O' :
+ ori_type = OUTTIE_ORIENT;
+ break;
+ case 'A' :
+ ori_type = ANTI_ORIENT;
+ break;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "Illegal orientation type code = %c", ch);
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+ return;
+ }
+
+
+char Convert_Char
+ (Celera_Msg_Orientation_Type_t t)
+
+// Return a printable version of t
+
+ {
+ switch (t)
+ {
+ case NORMAL_ORIENT :
+ return 'N';
+ case INNIE_ORIENT :
+ return 'I';
+ case OUTTIE_ORIENT :
+ return 'O';
+ case ANTI_ORIENT :
+ return 'A';
+ default :
+ throw IOException_t ("Invalid orientation type");
+ }
+ }
+
+
+
+void Convert_Assign
+ (Celera_Placement_Status_t & p, char ch)
+
+// Set p to the placement status encoded by character ch .
+
+ {
+ switch (ch)
+ {
+ case 'P' :
+ p = PLACED;
+ break;
+ case 'U' :
+ p = UNPLACED;
+ break;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "Illegal placement status code = %c", ch);
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+ return;
+ }
+
+
+char Convert_Char
+ (Celera_Placement_Status_t p)
+
+// Return a printable version of p
+
+ {
+ switch (p)
+ {
+ case PLACED :
+ return 'P';
+ case UNPLACED :
+ return 'U';
+ default :
+ throw IOException_t ("Invalid placement status type");
+ }
+ }
+
+
+
+void Convert_Assign
+ (Celera_Unitig_Status_t & us , char ch)
+
+// Set us to the unitig status encoded by character ch .
+
+ {
+ switch (ch)
+ {
+ case 'C' :
+ us = CHIMERIC_UNITIG;
+ break;
+ case 'N' :
+ us = NOT_REZ_UNITIG;
+ break;
+ case 'S' :
+ us = SEP_UNITIG;
+ break;
+ case 'U' :
+ us = UNIQUE_UNITIG;
+ break;
+ case 'X' :
+ us = UNASSIGNED_UNITIG;
+ break;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "Illegal unitig status code = %c", ch);
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+ return;
+ }
+
+
+char Convert_Char
+ (Celera_Unitig_Status_t s)
+
+// Return a printable version of s
+
+ {
+ switch (s)
+ {
+ case UNIQUE_UNITIG :
+ return 'U';
+ case CHIMERIC_UNITIG :
+ return 'C';
+ case NOT_REZ_UNITIG :
+ return 'N';
+ case SEP_UNITIG :
+ return 'S';
+ case UNASSIGNED_UNITIG :
+ return 'X';
+ default :
+ throw IOException_t ("Invalid unitig status type");
+ }
+ }
+
+
+
+void Convert_Assign
+ (Celera_Unitig_Type_t & t , char ch)
+
+// Set t to the unitig type encoded by character ch .
+
+ {
+ switch (ch)
+ {
+ case 'U' :
+ t = UNIQUE_UNI_T;
+ break;
+ case 'R' :
+ t = ROCK_UNI_T;
+ break;
+ case 'S' :
+ t = STONE_UNI_T;
+ break;
+ case 'P' :
+ t = PEBBLE_UNI_T;
+ break;
+ case 's' :
+ t = SINGLE_UNI_T;
+ break;
+ case 'X' :
+ t = OTHER_UNI_T;
+ break;
+ default :
+ sprintf (Clean_Exit_Msg_Line, "Illegal unitig type code = %c", ch);
+ throw IOException_t (Clean_Exit_Msg_Line);
+ }
+
+ return;
+ }
+
+
+char Convert_Char
+ (Celera_Unitig_Type_t t)
+
+// Return a printable version of t
+
+ {
+ switch (t)
+ {
+ case UNIQUE_UNI_T :
+ return 'U';
+ case ROCK_UNI_T :
+ return 'R';
+ case STONE_UNI_T :
+ return 'S';
+ case PEBBLE_UNI_T :
+ return 'P';
+ case SINGLE_UNI_T :
+ return 's';
+ case OTHER_UNI_T :
+ return 'X';
+ default :
+ throw IOException_t ("Invalid unitig type type");
+ }
+ }
+
+
+
+void Read_Comment_String
+ (FILE * fp, string & s)
+
+// Read lines from fp until a line containing just a
+// period at the beginning is encountered. Append the
+// lines (including the newline characters but not the period-line)
+// and put them into s .
+
+ {
+ char line [MAX_MSG_LINE];
+
+ s . erase ();
+
+ while (fgets (line, MAX_MSG_LINE, fp) != NULL)
+ {
+ if (strcmp (line, ".\n") == 0)
+ return;
+
+ s . append (line);
+ }
+
+ throw IOException_t ("Unexpected file error reading comment");
+
+ return;
+ }
+
+
+
+void Read_Sequence_String
+ (FILE * fp, string & s)
+
+// Read lines from fp until a line containing just a
+// period at the beginning is encountered. Append the
+// lines (without the period-line and discarding newlines)
+// and put them into s .
+
+ {
+ char line [MAX_MSG_LINE];
+
+ s . erase ();
+
+ while (fgets (line, MAX_MSG_LINE, fp) != NULL)
+ {
+ if (strcmp (line, ".\n") == 0)
+ return;
+
+ s . append (Strip_Trailing (line, '\n'));
+ }
+
+ throw IOException_t ("Unexpected file error reading comment");
+
+ return;
+ }
+
+
+
diff --git a/src/CelMsg/CelMsg.hh b/src/CelMsg/CelMsg.hh
new file mode 100644
index 0000000..5d473f3
--- /dev/null
+++ b/src/CelMsg/CelMsg.hh
@@ -0,0 +1,847 @@
+////////////////////////////////////////////////////////////////////////////////
+///
+/// \file CelMsgWGA.hh
+/// \author Arthur L. Delcher
+/// \date 02/25/2003
+///
+/// \brief Declarations for routines to manipulate Celera-format messages
+///
+/// \remark Under development
+/// \todo Add other messages
+/// \bug
+///
+////////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __CEL_MSG_HH
+#define __CEL_MSG_HH
+
+#define __DEBUG
+
+
+#include "datatypes_AMOS.hh"
+#include "exceptions_AMOS.hh"
+#include "delcher.hh"
+#include "fasta.hh"
+#include <vector>
+#include <string>
+
+using namespace std;
+
+
+static const int MAX_MSG_LINE = 1000;
+ // Longest line used for messages
+static const char MAX_CELERA_QUALITY_CHAR = char (48 + 60);
+ // Largest quality value allowed is 60
+
+
+
+enum Celera_Message_Type_t
+ {NULL_MSG, ADT_MSG, BAT_MSG, CCO_MSG, DST_MSG, FRG_MSG, ICM_MSG,
+ IUM_MSG, LKG_MSG};
+
+const char * Convert_String
+ (Celera_Message_Type_t msg_type);
+
+
+enum Celera_Msg_Action_t
+ {NULL_ACTION, ADD_ACTION, DELETE_ACTION};
+
+void Convert_Assign
+ (Celera_Msg_Action_t & action, char ch);
+
+char Convert_Char
+ (Celera_Msg_Action_t t);
+
+
+enum Celera_Msg_Read_Type_t
+ {NULL_READ, READ_READ, BACTIG_READ};
+
+void Convert_Assign
+ (Celera_Msg_Read_Type_t & read_type , char ch);
+
+char Convert_Char
+ (Celera_Msg_Read_Type_t t);
+
+
+enum Celera_Msg_Link_Type_t
+ {NULL_LINK, MATE_LINK, BAC_GUIDE, STS_GUIDE, REREAD_LINK, MAY_JOIN,
+ MUST_JOIN};
+
+void Convert_Assign
+ (Celera_Msg_Link_Type_t & link_type , char ch);
+
+char Convert_Char
+ (Celera_Msg_Link_Type_t t);
+
+
+enum Celera_Msg_Orientation_Type_t
+ {NULL_ORIENT, NORMAL_ORIENT, INNIE_ORIENT, OUTTIE_ORIENT, ANTI_ORIENT};
+
+void Convert_Assign
+ (Celera_Msg_Orientation_Type_t & ori_type , char ch);
+
+char Convert_Char
+ (Celera_Msg_Orientation_Type_t t);
+
+
+enum Celera_Placement_Status_t
+ {NULL_PLACEMENT, PLACED, UNPLACED};
+
+void Convert_Assign
+ (Celera_Placement_Status_t & p , char ch);
+
+char Convert_Char
+ (Celera_Placement_Status_t p);
+
+
+enum Celera_Unitig_Status_t
+ {NULL_UNITIG, UNIQUE_UNITIG, CHIMERIC_UNITIG, NOT_REZ_UNITIG, SEP_UNITIG,
+ UNASSIGNED_UNITIG};
+
+void Convert_Assign
+ (Celera_Unitig_Status_t & us , char ch);
+
+char Convert_Char
+ (Celera_Unitig_Status_t s);
+
+
+enum Celera_Unitig_Type_t
+ {NULL_UNI_T, UNIQUE_UNI_T, ROCK_UNI_T, STONE_UNI_T, PEBBLE_UNI_T,
+ SINGLE_UNI_T, OTHER_UNI_T}; // Other includes surrogate
+
+void Convert_Assign
+ (Celera_Unitig_Type_t & t , char ch);
+
+char Convert_Char
+ (Celera_Unitig_Type_t t);
+
+
+
+class Celera_ADL_Sub_Msg_t
+ {
+ private:
+ string who;
+ string time_stamp;
+ string version;
+ string comment;
+
+ public:
+ ~ Celera_ADL_Sub_Msg_t
+ ()
+ {} // Nothing to do here
+
+ void clear
+ (void);
+ const char * id_string
+ (void)
+ { return "ADL"; }
+ bool print
+ (FILE * fp);
+ bool read_body
+ (FILE * fp);
+ };
+
+
+class Celera_IMP_Sub_Msg_t
+ {
+ private:
+ Celera_Msg_Read_Type_t read_type;
+ int id;
+ int contained;
+ string source;
+ AMOS::Ordered_Range_t position;
+ vector <int> del;
+
+ public:
+ ~ Celera_IMP_Sub_Msg_t
+ ()
+ {} // Nothing to do here
+
+ int getId
+ (void) const
+ { return id; }
+ AMOS::Ordered_Range_t getPosition
+ (void) const
+ { return position; }
+
+ void setContained
+ (int c)
+ { contained = c; }
+ void setDel
+ (const vector <int> v)
+ { del = v; }
+ void setID
+ (int i)
+ { id = i; }
+ void setPosition
+ (AMOS::Pos_t s, AMOS::Pos_t e)
+ { position . setRange (s, e); }
+ void setPosition
+ (AMOS::Ordered_Range_t p)
+ { position = p; }
+ void setReadType
+ (Celera_Msg_Read_Type_t t)
+ { read_type = t; }
+ void setSource
+ (const char * s)
+ { source = s; }
+
+ void clear
+ (void);
+ const char * id_string
+ (void)
+ { return "IMP"; }
+ bool Is_Empty
+ (void);
+ bool print
+ (FILE * fp);
+ bool read_body
+ (FILE * fp);
+ };
+
+
+
+class Celera_MPS_Sub_Msg_t
+ {
+ private:
+ Celera_Msg_Read_Type_t read_type;
+ int id;
+ string source;
+ AMOS::Ordered_Range_t position;
+ vector <int> del;
+
+ public:
+ ~ Celera_MPS_Sub_Msg_t
+ ()
+ {} // Nothing to do here
+
+ int getId
+ (void) const
+ { return id; }
+ AMOS::Ordered_Range_t getPosition
+ (void) const
+ { return position; }
+ const vector <int> & getDel
+ (void) const
+ { return del; }
+
+ void setDel
+ (const vector <int> v)
+ { del = v; }
+ void setID
+ (int i)
+ { id = i; }
+ void setPosition
+ (AMOS::Pos_t s, AMOS::Pos_t e)
+ { position . setRange (s, e); }
+ void setPosition
+ (AMOS::Ordered_Range_t p)
+ { position = p; }
+ void setReadType
+ (Celera_Msg_Read_Type_t t)
+ { read_type = t; }
+ void setSource
+ (const char * s)
+ { source = s; }
+
+ void clear
+ (void);
+ const char * id_string
+ (void)
+ { return "MPS"; }
+ bool print
+ (FILE * fp);
+ bool read_body
+ (FILE * fp);
+ };
+
+
+
+class Celera_UPS_Sub_Msg_t
+ {
+ private:
+ Celera_Unitig_Type_t unitig_type;
+ int id;
+ AMOS::Ordered_Range_t position;
+ vector <int> del;
+
+ public:
+ ~ Celera_UPS_Sub_Msg_t
+ ()
+ {} // Nothing to do here
+
+ Celera_Unitig_Type_t getUnitigType
+ (void) const
+ { return unitig_type; }
+ int getId
+ (void) const
+ { return id; }
+ AMOS::Ordered_Range_t getPosition
+ (void) const
+ { return position; }
+ const vector <int> & getDel
+ (void) const
+ { return del; }
+
+ void setDel
+ (const vector <int> v)
+ { del = v; }
+ void setID
+ (int i)
+ { id = i; }
+ void setPosition
+ (AMOS::Pos_t s, AMOS::Pos_t e)
+ { position . setRange (s, e); }
+ void setPosition
+ (AMOS::Ordered_Range_t p)
+ { position = p; }
+ void setUnitigType
+ (Celera_Unitig_Type_t t)
+ { unitig_type = t; }
+
+ void clear
+ (void);
+ const char * id_string
+ (void)
+ { return "UPS"; }
+ bool print
+ (FILE * fp);
+ bool read_body
+ (FILE * fp);
+ };
+
+
+
+class Celera_Msg_Body_t
+ {
+ public:
+ virtual ~ Celera_Msg_Body_t
+ ()
+ {} // Ensure derived destructor is called
+
+ virtual const string & getAccession
+ (void);
+ virtual const AMOS::Range_t & getClearRange
+ (void);
+ virtual const string & getConsensus
+ (void);
+ virtual vector <Celera_IMP_Sub_Msg_t> & getIMPList
+ (void);
+ virtual const vector <Celera_MPS_Sub_Msg_t> & getMPSList
+ (void);
+ virtual const vector <Celera_UPS_Sub_Msg_t> & getUPSList
+ (void);
+ virtual int getNumFrags
+ (void);
+ virtual int getNumUnitigs
+ (void);
+ virtual const string & getQuality
+ (void);
+ virtual const string & getSequence
+ (void);
+ virtual const string & getSource
+ (void);
+
+ virtual void setAccession
+ (const char * s);
+ virtual void setAccession
+ (const string & s);
+ virtual void setClearRange
+ (AMOS::Pos_t a, AMOS::Pos_t b);
+ virtual void setIMPs
+ (const vector <int> & f, const vector <AMOS::Ordered_Range_t> & p);
+ virtual void setQuality
+ (const char * q);
+ virtual void setQuality
+ (const string & q);
+ virtual void setSequence
+ (const char * s);
+ virtual void setSequence
+ (const string & s);
+ virtual void setStatus
+ (Celera_Unitig_Status_t s);
+ virtual void setUniLen
+ (int n);
+
+ virtual void clear
+ (void) = 0;
+ virtual const char * id_string
+ (void) = 0;
+ virtual bool print_body
+ (FILE * fp) = 0;
+ virtual bool read_body
+ (FILE * fp) = 0;
+ virtual void Remove_Empty_IMPs
+ (void);
+ virtual void Update_IMPs
+ (const vector <AMOS::Range_t> & pos, const vector <int> & ref,
+ const vector < vector <int> > & del_list);
+ };
+
+
+class Celera_ADT_Msg_Body_t : public Celera_Msg_Body_t
+ {
+ private:
+ vector <Celera_ADL_Sub_Msg_t> adl_list;
+
+ public:
+ ~ Celera_ADT_Msg_Body_t
+ ()
+ {} // Nothing to do here
+
+ void clear
+ (void);
+ const char * id_string
+ (void)
+ { return "ADT"; }
+
+ bool print_body
+ (FILE * fp);
+ bool read_body
+ (FILE * fp);
+ };
+
+
+class Celera_BAT_Msg_Body_t : public Celera_Msg_Body_t
+ {
+ private:
+ string batch_name;
+ string time_stamp;
+ string accession;
+ string comment;
+ public:
+ ~ Celera_BAT_Msg_Body_t
+ ()
+ {} // Nothing to do here
+
+ void clear
+ (void);
+ const char * id_string
+ (void)
+ { return "BAT"; }
+ bool print_body
+ (FILE * fp);
+ bool read_body
+ (FILE * fp);
+ };
+
+
+class Celera_CCO_Msg_Body_t : public Celera_Msg_Body_t
+ {
+ private:
+ string accession;
+ Celera_Placement_Status_t placed;
+ int len;
+ string consensus;
+ string quality;
+ bool forced;
+ int num_frags;
+ int num_unitigs;
+ vector <Celera_MPS_Sub_Msg_t> mps_list;
+ vector <Celera_UPS_Sub_Msg_t> ups_list;
+
+ public:
+ ~ Celera_CCO_Msg_Body_t
+ ()
+ {} // Nothing to do here
+
+ const string & getAccession
+ (void)
+ { return accession; }
+ Celera_Placement_Status_t getPlaced
+ (void)
+ { return placed; }
+ int getLen
+ (void)
+ { return len; }
+ const string & getConsensus
+ (void)
+ { return consensus; }
+ const string & getQuality
+ (void)
+ { return quality; }
+ bool getForced
+ (void)
+ { return forced; }
+ int getNumFrags
+ (void)
+ { return num_frags; }
+ int getNumUnitigs
+ (void)
+ { return num_unitigs; }
+ const vector <Celera_MPS_Sub_Msg_t> & getMPSList
+ (void)
+ { return mps_list; }
+ const vector <Celera_UPS_Sub_Msg_t> & getUPSList
+ (void)
+ { return ups_list; }
+
+ void clear
+ (void);
+ const char * id_string
+ (void)
+ { return "CCO"; }
+ bool print_body
+ (FILE * fp);
+ bool read_body
+ (FILE * fp);
+ };
+
+
+class Celera_DST_Msg_Body_t : public Celera_Msg_Body_t
+ {
+ private:
+ Celera_Msg_Action_t action;
+ string accession;
+ double mean;
+ double std_dev;
+
+ public:
+ ~ Celera_DST_Msg_Body_t
+ ()
+ {} // Nothing to do here
+
+ void clear
+ (void);
+ const char * id_string
+ (void)
+ { return "DST"; }
+ bool print_body
+ (FILE * fp);
+ bool read_body
+ (FILE * fp);
+ };
+
+
+class Celera_FRG_Msg_Body_t : public Celera_Msg_Body_t
+ {
+ private:
+ Celera_Msg_Action_t action;
+ string accession;
+ Celera_Msg_Read_Type_t read_type;
+ string source;
+ string time_stamp;
+ string sequence;
+ string quality;
+ AMOS::Range_t clear_range;
+
+ public:
+ ~ Celera_FRG_Msg_Body_t
+ ()
+ {} // Nothing to do here
+
+ Celera_Msg_Action_t getAction
+ (void)
+ { return action; }
+ const string & getAccession
+ (void)
+ { return accession; }
+ Celera_Msg_Read_Type_t getReadType
+ (void)
+ { return read_type; }
+ const string & getSource
+ (void)
+ { return source; }
+ const string & getTimeStamp
+ (void)
+ { return time_stamp; }
+ const string & getQuality
+ (void)
+ { return quality; }
+ const string & getSequence
+ (void)
+ { return sequence; }
+ const AMOS::Range_t & getClearRange
+ (void)
+ { return clear_range; }
+
+ void setClearRange
+ (AMOS::Pos_t a, AMOS::Pos_t b)
+ { clear_range . setRange (a, b); }
+ void setQuality
+ (const char * q)
+ { quality = q; }
+ void setQuality
+ (const string & q)
+ { quality = q; }
+ void setSequence
+ (const char * s)
+ { sequence = s; }
+ void setSequence
+ (const string & s)
+ { sequence = s; }
+
+ void clear
+ (void);
+ const char * id_string
+ (void)
+ { return "FRG"; }
+ bool print_body
+ (FILE * fp);
+ bool read_body
+ (FILE * fp);
+ };
+
+
+class Celera_ICM_Msg_Body_t : public Celera_Msg_Body_t
+ {
+ private:
+ string content;
+ public:
+ ~ Celera_ICM_Msg_Body_t
+ ()
+ {} // Nothing to do here
+
+ void clear
+ (void);
+ const char * id_string
+ (void)
+ { return "ICM"; }
+ bool print_body
+ (FILE * fp);
+ bool read_body
+ (FILE * fp);
+ };
+
+
+class Celera_IUM_Msg_Body_t : public Celera_Msg_Body_t
+ {
+ private:
+ string accession;
+ string source;
+ float cover_stat;
+ Celera_Unitig_Status_t status;
+ int a_branch_point;
+ int b_branch_point;
+ int uni_len;
+ string consensus;
+ string quality;
+ bool forced;
+ int num_frags;
+ vector <Celera_IMP_Sub_Msg_t> imp_list;
+
+ public:
+ ~ Celera_IUM_Msg_Body_t
+ ()
+ {} // Nothing to do here
+
+ const string & getAccession
+ (void)
+ { return accession; }
+ const string & getSource
+ (void)
+ { return source; }
+ float getCoverStat
+ (void)
+ { return cover_stat; }
+ Celera_Unitig_Status_t getStatus
+ (void)
+ { return status; }
+ int getABranchPoint
+ (void)
+ { return a_branch_point; }
+ int getBBranchPoint
+ (void)
+ { return b_branch_point; }
+ int getUniLen
+ (void)
+ { return uni_len; }
+ const string & getConsensus
+ (void)
+ { return consensus; }
+ const string & getQuality
+ (void)
+ { return quality; }
+ bool getForced
+ (void)
+ { return forced; }
+ int getNumFrags
+ (void)
+ { return num_frags; }
+ vector <Celera_IMP_Sub_Msg_t> & getIMPList
+ (void)
+ { return imp_list; }
+
+ void setAccession
+ (const char * s)
+ { accession = s; }
+ void setAccession
+ (const string & s)
+ { accession = s; }
+ void setIMPs
+ (const vector <int> & f, const vector <AMOS::Ordered_Range_t> & p);
+ void setQuality
+ (const char * q)
+ { quality = q; }
+ void setSequence
+ (const char * s)
+ { consensus = s; }
+ void setStatus
+ (Celera_Unitig_Status_t s)
+ { status = s; }
+ void setUniLen
+ (int n)
+ { uni_len = n; }
+
+ void clear
+ (void);
+ const char * id_string
+ (void)
+ { return "IUM"; }
+ bool print_body
+ (FILE * fp);
+ bool read_body
+ (FILE * fp);
+ void Remove_Empty_IMPs
+ (void);
+ void Update_IMPs
+ (const vector <AMOS::Range_t> & pos, const vector <int> & ref,
+ const vector < vector <int> > & del_list);
+ };
+
+
+class Celera_LKG_Msg_Body_t : public Celera_Msg_Body_t
+ {
+ private:
+ Celera_Msg_Action_t action;
+ Celera_Msg_Link_Type_t link_type;
+ string accession1, accession2;
+ string time_stamp;
+ string dst_ref;
+ Celera_Msg_Orientation_Type_t ori;
+
+
+ public:
+ ~ Celera_LKG_Msg_Body_t
+ ()
+ {} // Nothing to do here
+
+ void clear
+ (void);
+ const char * id_string
+ (void)
+ { return "LKG"; }
+ bool print_body
+ (FILE * fp);
+ bool read_body
+ (FILE * fp);
+ };
+
+
+
+class Celera_Message_t
+ {
+ protected:
+ static const int MAX_MSG_LINE = 1000;
+ // length of longest possible message input line
+
+ Celera_Message_Type_t msg_type;
+ Celera_Msg_Body_t * body;
+
+ public:
+ Celera_Message_t
+ ()
+ {
+ msg_type = NULL_MSG;
+ body = NULL;
+ }
+
+ ~ Celera_Message_t
+ ()
+ {
+ clear ();
+ }
+
+ void clear
+ (void)
+ {
+ delete body;
+ body = NULL;
+ msg_type = NULL_MSG;
+
+ return;
+ }
+
+ const Celera_Message_Type_t & getMsgType
+ (void) const
+ { return msg_type; }
+ const Celera_Msg_Body_t * getBody
+ (void) const
+ { return body; }
+
+ const string & getAccession
+ (void) const;
+ const AMOS::Range_t & getClearRange
+ (void) const;
+ const string & getConsensus
+ (void) const;
+ vector <Celera_IMP_Sub_Msg_t> & getIMPList
+ (void) const;
+ const vector <Celera_MPS_Sub_Msg_t> & getMPSList
+ (void) const;
+ const vector <Celera_UPS_Sub_Msg_t> & getUPSList
+ (void) const;
+ int getNumFrags
+ (void) const;
+ int getNumUnitigs
+ (void) const;
+ const string & getQuality
+ (void) const;
+ const string & getSequence
+ (void) const;
+ const string & getSource
+ (void) const;
+
+ void setAccession
+ (const char * s);
+ void setAccession
+ (const string & s);
+ void setClearRange
+ (AMOS::Pos_t a, AMOS::Pos_t b);
+ void setIMPs
+ (const vector <int> & f, const vector <AMOS::Ordered_Range_t> & p);
+ void setQuality
+ (const char * q);
+ void setQuality
+ (const string & q);
+ void setSequence
+ (const char * s);
+ void setSequence
+ (const string & s);
+ void setStatus
+ (Celera_Unitig_Status_t s);
+ void setType
+ (Celera_Message_Type_t t);
+ void setUniLen
+ (int n);
+
+ const char * id_string
+ (void) const
+ {
+ if (body == NULL)
+ return "NULL";
+ else
+ return body -> id_string ();
+ }
+ void print
+ (FILE * fp, const char * seq = NULL, const char * qv = NULL);
+ bool read
+ (FILE * fp);
+ void Remove_Empty_IMPs
+ (void);
+ void Update_IMPs
+ (const vector <AMOS::Range_t> & pos, const vector <int> & ref,
+ const vector < vector <int> > & del_list);
+ };
+
+
+
+void Read_Comment_String
+ (FILE * fp, string & s);
+void Read_Sequence_String
+ (FILE * fp, string & s);
+
+
+
+#endif // #ifndef __CEL_MSG_HH
diff --git a/src/CelMsg/Makefile.am b/src/CelMsg/Makefile.am
new file mode 100644
index 0000000..0f1edd0
--- /dev/null
+++ b/src/CelMsg/Makefile.am
@@ -0,0 +1,24 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+##-- TO BE INSTALLED
+amoslib_LIBRARIES = \
+ libCelMsg.a
+
+amosinclude_HEADERS = \
+ CelMsg.hh
+
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS
+
+
+##-- libCelMsg.a
+libCelMsg_a_SOURCES = \
+ CelMsg.cc
+
+
+##-- END OF MAKEFILE --##
\ No newline at end of file
diff --git a/src/CelMsg/Makefile.in b/src/CelMsg/Makefile.in
new file mode 100644
index 0000000..df015b5
--- /dev/null
+++ b/src/CelMsg/Makefile.in
@@ -0,0 +1,611 @@
+# 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 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@
+DIST_COMMON = $(amosinclude_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+subdir = src/CelMsg
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(amoslibdir)" \
+ "$(DESTDIR)$(amosincludedir)"
+LIBRARIES = $(amoslib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libCelMsg_a_AR = $(AR) $(ARFLAGS)
+libCelMsg_a_LIBADD =
+am_libCelMsg_a_OBJECTS = CelMsg.$(OBJEXT)
+libCelMsg_a_OBJECTS = $(am_libCelMsg_a_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(libCelMsg_a_SOURCES)
+DIST_SOURCES = $(libCelMsg_a_SOURCES)
+HEADERS = $(amosinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+amoslib_LIBRARIES = \
+ libCelMsg.a
+
+amosinclude_HEADERS = \
+ CelMsg.hh
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS
+
+libCelMsg_a_SOURCES = \
+ CelMsg.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/CelMsg/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/CelMsg/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):
+install-amoslibLIBRARIES: $(amoslib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(amoslibdir)" || $(MKDIR_P) "$(DESTDIR)$(amoslibdir)"
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(amoslibdir)'"; \
+ $(INSTALL_DATA) $$list2 "$(DESTDIR)$(amoslibdir)" || exit $$?; }
+ @$(POST_INSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ for p in $$list; do \
+ if test -f $$p; then \
+ $(am__strip_dir) \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && $(RANLIB) $$f )"; \
+ ( cd "$(DESTDIR)$(amoslibdir)" && $(RANLIB) $$f ) || exit $$?; \
+ else :; fi; \
+ done
+
+uninstall-amoslibLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && rm -f "$$files" )"; \
+ cd "$(DESTDIR)$(amoslibdir)" && rm -f $$files
+
+clean-amoslibLIBRARIES:
+ -test -z "$(amoslib_LIBRARIES)" || rm -f $(amoslib_LIBRARIES)
+libCelMsg.a: $(libCelMsg_a_OBJECTS) $(libCelMsg_a_DEPENDENCIES)
+ -rm -f libCelMsg.a
+ $(libCelMsg_a_AR) libCelMsg.a $(libCelMsg_a_OBJECTS) $(libCelMsg_a_LIBADD)
+ $(RANLIB) libCelMsg.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CelMsg.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+install-amosincludeHEADERS: $(amosinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(amosincludedir)" || $(MKDIR_P) "$(DESTDIR)$(amosincludedir)"
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(amosincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(amosincludedir)" || exit $$?; \
+ done
+
+uninstall-amosincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amosincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(amosincludedir)" && rm -f $$files
+
+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) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(amosincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-amoslibLIBRARIES clean-generic 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-amosincludeHEADERS install-amoslibLIBRARIES
+
+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:
+
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-amosincludeHEADERS uninstall-amoslibLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-amoslibLIBRARIES clean-generic ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-amosincludeHEADERS install-amoslibLIBRARIES \
+ 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-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-amosincludeHEADERS \
+ uninstall-amoslibLIBRARIES uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Common/Makefile.am b/src/Common/Makefile.am
new file mode 100644
index 0000000..6a50aea
--- /dev/null
+++ b/src/Common/Makefile.am
@@ -0,0 +1,34 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+#-- TO BE INSTALLED
+amoslib_LIBRARIES = \
+ libCommon.a
+
+amosinclude_HEADERS = \
+ alloc.hh \
+ amp.hh \
+ delcher.hh \
+ delta.hh \
+ fasta.hh \
+ prob.hh \
+ fastq.hh
+
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/AMOS
+
+
+##-- libCommon.a
+libCommon_a_SOURCES = \
+ amp.cc \
+ delcher.cc \
+ delta.cc \
+ fasta.cc \
+ prob.cc \
+ fastq.cc
+
+
+##-- END OF MAKEFILE --##
\ No newline at end of file
diff --git a/src/Common/Makefile.in b/src/Common/Makefile.in
new file mode 100644
index 0000000..2ee4771
--- /dev/null
+++ b/src/Common/Makefile.in
@@ -0,0 +1,629 @@
+# 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 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@
+DIST_COMMON = $(amosinclude_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+subdir = src/Common
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(amoslibdir)" \
+ "$(DESTDIR)$(amosincludedir)"
+LIBRARIES = $(amoslib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libCommon_a_AR = $(AR) $(ARFLAGS)
+libCommon_a_LIBADD =
+am_libCommon_a_OBJECTS = amp.$(OBJEXT) delcher.$(OBJEXT) \
+ delta.$(OBJEXT) fasta.$(OBJEXT) prob.$(OBJEXT) fastq.$(OBJEXT)
+libCommon_a_OBJECTS = $(am_libCommon_a_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(libCommon_a_SOURCES)
+DIST_SOURCES = $(libCommon_a_SOURCES)
+HEADERS = $(amosinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+#-- TO BE INSTALLED
+amoslib_LIBRARIES = \
+ libCommon.a
+
+amosinclude_HEADERS = \
+ alloc.hh \
+ amp.hh \
+ delcher.hh \
+ delta.hh \
+ fasta.hh \
+ prob.hh \
+ fastq.hh
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/AMOS
+
+libCommon_a_SOURCES = \
+ amp.cc \
+ delcher.cc \
+ delta.cc \
+ fasta.cc \
+ prob.cc \
+ fastq.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Common/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Common/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):
+install-amoslibLIBRARIES: $(amoslib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(amoslibdir)" || $(MKDIR_P) "$(DESTDIR)$(amoslibdir)"
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(amoslibdir)'"; \
+ $(INSTALL_DATA) $$list2 "$(DESTDIR)$(amoslibdir)" || exit $$?; }
+ @$(POST_INSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ for p in $$list; do \
+ if test -f $$p; then \
+ $(am__strip_dir) \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && $(RANLIB) $$f )"; \
+ ( cd "$(DESTDIR)$(amoslibdir)" && $(RANLIB) $$f ) || exit $$?; \
+ else :; fi; \
+ done
+
+uninstall-amoslibLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && rm -f "$$files" )"; \
+ cd "$(DESTDIR)$(amoslibdir)" && rm -f $$files
+
+clean-amoslibLIBRARIES:
+ -test -z "$(amoslib_LIBRARIES)" || rm -f $(amoslib_LIBRARIES)
+libCommon.a: $(libCommon_a_OBJECTS) $(libCommon_a_DEPENDENCIES)
+ -rm -f libCommon.a
+ $(libCommon_a_AR) libCommon.a $(libCommon_a_OBJECTS) $(libCommon_a_LIBADD)
+ $(RANLIB) libCommon.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/amp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/delcher.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/delta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fasta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fastq.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/prob.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+install-amosincludeHEADERS: $(amosinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(amosincludedir)" || $(MKDIR_P) "$(DESTDIR)$(amosincludedir)"
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(amosincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(amosincludedir)" || exit $$?; \
+ done
+
+uninstall-amosincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amosincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(amosincludedir)" && rm -f $$files
+
+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) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(amosincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-amoslibLIBRARIES clean-generic 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-amosincludeHEADERS install-amoslibLIBRARIES
+
+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:
+
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-amosincludeHEADERS uninstall-amoslibLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-amoslibLIBRARIES clean-generic ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-amosincludeHEADERS install-amoslibLIBRARIES \
+ 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-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-amosincludeHEADERS \
+ uninstall-amoslibLIBRARIES uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Common/alloc.hh b/src/Common/alloc.hh
new file mode 100644
index 0000000..b4601ed
--- /dev/null
+++ b/src/Common/alloc.hh
@@ -0,0 +1,108 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 03/06/2003
+//!
+//! \brief C++ exception throwing for C style memory allocation
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __ALLOC_HH
+#define __ALLOC_HH
+
+#include <new>
+#include <cstdlib>
+#include <cstring>
+
+
+
+
+
+//--------------------------------------------------- SafeCalloc ---------------
+//! \brief Safe calloc wrapper
+//!
+//! Detects calloc failure and throws std::bad_alloc exception instead of
+//! returning a NULL pointer.
+//!
+//! \param num Number of elements to allocate
+//! \param size Number of bytes per element
+//! \post The memory is allocated
+//! \exception bad_alloc On memory exhaustion
+//! \return Pointer to the new memory block
+//!
+inline void * SafeCalloc (size_t num, size_t size)
+{
+ void * Q = calloc (num, size);
+ if ( Q == NULL )
+ throw std::bad_alloc ( );
+
+ return Q;
+}
+
+
+//--------------------------------------------------- SafeMalloc ---------------
+//! \brief Safe malloc wrapper
+//!
+//! Detects malloc failure and throws std::bad_alloc exception instead of
+//! returning a NULL pointer.
+//!
+//! \param size Number of bytes to allocate
+//! \post The memory is allocated
+//! \exception bad_alloc On memory exhaustion
+//! \return Pointer to the new memory block
+//!
+inline void * SafeMalloc (size_t size)
+{
+ void * Q = malloc (size);
+ if ( Q == NULL )
+ throw std::bad_alloc ( );
+
+ return Q;
+}
+
+
+//--------------------------------------------------- SafeRealloc --------------
+//! \brief Safe realloc wrapper
+//!
+//! Detects realloc failure and throws std::bad_alloc exception instead of
+//! returning a NULL pointer. This helps prevent memory leaks by preventing the
+//! original memory block from being lost when the realloc function returns
+//! NULL.
+//!
+//! \param P The memory block to re-allocate
+//! \param size Number of bytes to allocate
+//! \post The memory is allocated
+//! \exception bad_alloc On memory exhaustion
+//! \return Pointer to the new memory block
+//!
+inline void * SafeRealloc (void * P, size_t size)
+{
+ void * Q = realloc (P, size);
+ if ( Q == NULL && size != 0 )
+ throw std::bad_alloc ( );
+
+ return Q;
+}
+
+
+//--------------------------------------------------- SafeStrdup ---------------
+//! \brief Safe strdup wrapper
+//!
+//! Detects malloc failure and throws std::bad_alloc exception instead of
+//! returning a NULL pointer.
+//!
+//! \param str The string to copy
+//! \post The memory is allocated and the string is copied
+//! \exception bad_alloc On memory exhaustion
+//! \return Pointer to the new string copy
+//!
+inline char * SafeStrdup (const char * str)
+{
+ char * Q = strdup (str);
+ if ( Q == NULL )
+ throw std::bad_alloc ( );
+ return Q;
+}
+
+
+#endif // #ifndef __ALLOC_HH
diff --git a/src/Common/amp.cc b/src/Common/amp.cc
new file mode 100644
index 0000000..829a228
--- /dev/null
+++ b/src/Common/amp.cc
@@ -0,0 +1,84 @@
+#include "amp.hh"
+#include <new>
+#include <cstdio>
+#include <iostream>
+#include <cstring>
+#include <ctime>
+using namespace std;
+
+#define MAX_FILE_NAME 1024
+
+const char * Date
+ ( )
+
+ // Returns a date and time string
+
+{
+ int last;
+ char * cp;
+ time_t tp;
+ time (&tp);
+ cp = asctime (localtime (&tp));
+ last = strlen(cp) - 1;
+ if ( cp [last] == '\n' )
+ cp [last] = '\0';
+ return cp;
+}
+
+void ProgressDots_t::update (long long progress)
+{
+ int dots = (long long)((double)progress / (double)end_m * (double)count_m);
+ while ( total_m < dots && total_m < count_m )
+ {
+ cerr << '.';
+ total_m ++;
+ }
+}
+
+void ProgressDots_t::end ( )
+{
+ update (end_m);
+ cerr << endl;
+}
+
+
+EventTime_t::EventTime_t()
+{
+ start();
+ memset(&m_end, 0, sizeof(struct timeval));
+}
+
+void EventTime_t::start()
+{
+ gettimeofday(&m_start, NULL);
+}
+
+void EventTime_t::end()
+{
+ gettimeofday(&m_end, NULL);
+}
+
+double EventTime_t::length()
+{
+ if ((m_end.tv_sec == 0) && (m_end.tv_usec == 0)) { end(); }
+ return ((m_end.tv_sec - m_start.tv_sec)*1000000.0 + (m_end.tv_usec - m_start.tv_usec)) / 1e6;
+}
+
+string EventTime_t::str(bool format, int precision)
+{
+ double r = length();
+
+ char buffer[1024];
+ sprintf(buffer, "%0.*f", precision, r);
+
+ if (format)
+ {
+ string s("[");
+ s += buffer;
+ s += "s]";
+ return s;
+ }
+
+ return buffer;
+}
+
diff --git a/src/Common/amp.hh b/src/Common/amp.hh
new file mode 100644
index 0000000..2dc2761
--- /dev/null
+++ b/src/Common/amp.hh
@@ -0,0 +1,55 @@
+#ifndef __AMP_HH
+#define __AMP_HH
+
+#include <sys/time.h>
+#include <string>
+
+// Return a character string representing the current date
+const char * Date ( );
+
+// Reverse complement a 1 based coordinate
+inline long long int RevComp1 (long long int c, long long int len)
+{ return len - c + 1; }
+
+// Reverse complement a 0 based coordinate
+inline long long int RevComp0 (long long int c, long long int len)
+{ return len - c - 1; }
+
+// Shows progress dots across the screen
+class ProgressDots_t
+{
+private:
+
+ long long total_m; // number of dots currently printed
+ long long count_m; // total number of dots to print
+ long long end_m; // end of job progress (progress measured between 0 - end)
+
+public:
+
+ ProgressDots_t (long long end, long long count = 100)
+ : total_m (0), count_m (count), end_m (end)
+ { }
+
+ void update (long long progress); // update job progress with respect to end
+
+ void end ( ); // job complete, flush remaining dots and newline
+};
+
+
+
+// Record length of event in seconds
+class EventTime_t
+{
+public:
+ EventTime_t();
+ void start();
+ void end();
+ double length();
+ std::string str(bool format = true, int precision=2);
+
+private:
+ struct timeval m_start;
+ struct timeval m_end;
+};
+
+#endif // _AMP_HH
diff --git a/src/Common/delcher.cc b/src/Common/delcher.cc
new file mode 100644
index 0000000..528f29f
--- /dev/null
+++ b/src/Common/delcher.cc
@@ -0,0 +1,265 @@
+// A. L. Delcher
+//
+// File: delcher.cc
+//
+// Last Modified: 25 November 2002
+//
+// Common generic routines.
+
+
+#include "delcher.hh"
+
+
+const int COMMATIZE_BUFF_LEN = 50;
+ // Length of buffer for creating string with commas
+
+
+char Clean_Exit_Msg_Line [MAX_ERROR_MSG_LEN];
+ // String to write error messages to before exiting
+int Verbose = 0;
+ // Flag to determine level of debugging output
+
+
+const char * Commatize
+ (long int n)
+
+// Return a string representing the value of n with commas
+// every three digits.
+
+ {
+ static char buff [COMMATIZE_BUFF_LEN];
+ bool is_negative = false;
+ int i, ct;
+
+ buff [COMMATIZE_BUFF_LEN - 1] = '\0';
+
+ if (n == 0)
+ {
+ buff [COMMATIZE_BUFF_LEN - 2] = '0';
+ return buff + 48;
+ }
+
+ i = COMMATIZE_BUFF_LEN - 2;
+ if (n < 0)
+ {
+ is_negative = true;
+ n *= -1;
+ }
+
+ for (ct = 0; n > 0; ct ++)
+ {
+ if (ct == 3)
+ {
+ buff [i --] = ',';
+ ct = 0;
+ }
+ buff [i --] = char ('0' + n % 10);
+ n /= 10;
+ }
+
+ if (is_negative)
+ buff [i --] = '-';
+
+ return buff + i + 1;
+ }
+
+
+
+void Clean_Exit
+ (const char * msg, const char * src_fname, size_t line_num)
+
+// Write string msg to stderr and also a line indicating
+// the error happen in source file src_fname at line line_num
+// if they are not NULL and 0 respectively.
+// Then exit with an error condition.
+
+ {
+ fprintf (stderr, "%s\n", msg);
+ if (src_fname != NULL)
+ fprintf (stderr, " in file %s", src_fname);
+ if (line_num != 0)
+ fprintf (stderr, " at line %lu", (long unsigned) (line_num));
+ fprintf (stderr, " errno = %d\n", errno);
+
+ exit (EXIT_FAILURE);
+ }
+
+
+
+FILE * File_Open
+ (const char * fname, const char * mode, const char * src_fname,
+ size_t line_num)
+
+// Open fname in mode and return a pointer to its control
+// block. If fail, print a message and exit, assuming the call came from
+// source file src_fname at line line_num .
+
+ {
+ FILE * fp;
+
+ fp = fopen (fname, mode);
+ if (fp == NULL)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: Could not open file %s \n", fname);
+ Clean_Exit (Clean_Exit_Msg_Line, src_fname, line_num);
+ }
+
+ return fp;
+ }
+
+
+
+double Percent
+ (double a, double b)
+
+// Return a / b as a percentage. Return 0.0 if b = 0.0 .
+
+ {
+ if (b == 0.0)
+ return 0.0;
+
+ return 100.0 * (a / b);
+ }
+
+
+
+double Pseudo_Normal
+ (void)
+
+// Return a simple approximation to a standard normally distributed value,
+// i.e., mean = 0.0 and s.d. = 1.0
+
+ {
+ double sum = 0.0;
+ int i;
+
+ for (i = 0; i < 12; i ++)
+ sum += drand48 ();
+
+ return sum - 6.0;
+ }
+
+
+
+double Ratio
+ (double a, double b)
+
+// Return a / b , or 0.0 if b = 0.0 .
+
+ {
+ if (b == 0.0)
+ return 0.0;
+
+ return a / b;
+ }
+
+
+
+void * Safe_calloc
+ (size_t n, size_t len, const char * src_fname, size_t line_num)
+
+// Allocate and return a pointer to enough memory to hold an
+// array with n entries of len bytes each. All memory is
+// cleared to 0. If fail, print a message and exit, assuming the
+// call came from source file src_fname at line line_num .
+
+ {
+ void * p;
+
+ p = calloc (n, len);
+ if (p == NULL)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: calloc failed %lu x %lu",
+ (long unsigned) (n), (long unsigned) (len));
+ Clean_Exit (Clean_Exit_Msg_Line, src_fname, line_num);
+ }
+
+ return p;
+ }
+
+
+
+void * Safe_malloc
+ (size_t len, const char * src_fname, size_t line_num)
+
+// Allocate and return a pointer to len bytes of memory.
+// If fail, print a message and exit, assuming the call came from
+// source file src_fname at line line_num .
+
+ {
+ void * p;
+
+ p = malloc (len);
+ if (p == NULL)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: malloc failed %lu bytes",
+ (long unsigned) (len));
+ Clean_Exit (Clean_Exit_Msg_Line, src_fname, line_num);
+ }
+
+ return p;
+ }
+
+
+
+void * Safe_realloc
+ (void * q, size_t len, const char * src_fname, size_t line_num)
+
+// Reallocate memory for q to len bytes and return a
+// pointer to the new memory. If fail, print a message and exit,
+// assuming the call came from source file src_fname at line line_num .
+
+ {
+ void * p;
+
+ p = realloc (q, len);
+ if (p == NULL)
+ {
+ sprintf (Clean_Exit_Msg_Line,
+ "ERROR: realloc failed %lu bytes",
+ (long unsigned) (len));
+ Clean_Exit (Clean_Exit_Msg_Line, src_fname, line_num);
+ }
+
+ return p;
+ }
+
+
+char * Strip_Trailing
+ (char * s, char ch)
+
+// Remove all occurrences of ch at the end of s by writing
+// '\0's over them. Return s so this can be used as a function.
+
+ {
+ int i, len;
+
+ len = strlen (s);
+
+ for (i = len - 1; i >= 0 && s [i] == ch; i --)
+ s [i] = '\0';
+
+ return s;
+ }
+
+
+
+void Uppercase
+ (char * s)
+
+// Convert all letters in string s to upper-case.
+
+ {
+ char * p;
+
+ for (p = s; * p != '\0'; p ++)
+ * p = toupper (* p);
+
+ return;
+ }
+
+
+
diff --git a/src/Common/delcher.hh b/src/Common/delcher.hh
new file mode 100644
index 0000000..2129311
--- /dev/null
+++ b/src/Common/delcher.hh
@@ -0,0 +1,142 @@
+// A. L. Delcher
+//
+// File: delcher.hh
+//
+// Last Modified: 11 September 2003
+//
+// Common generic routines.
+
+
+#ifndef __DELCHER_HH
+#define __DELCHER_HH
+
+#include <cstdio>
+#include <cstdlib>
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+#include <cstring>
+#include <cctype>
+#include <climits>
+#include <cfloat>
+#include <ctime>
+#include <cassert>
+#include <errno.h>
+#include <unistd.h>
+
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef EXIT_FAILURE
+ #define EXIT_FAILURE -1
+#endif
+#ifndef EXIT_SUCCESS
+ #define EXIT_SUCCESS 0
+#endif
+
+
+const int MAX_ERROR_MSG_LEN = 1000;
+ // Length of longest possible error message
+
+
+extern char Clean_Exit_Msg_Line [MAX_ERROR_MSG_LEN];
+ // String to write error messages to before exiting
+extern int Verbose;
+ // Flag to determine level of debugging output
+
+
+const char * Commatize
+ (long int n);
+void Clean_Exit
+ (const char * msg, const char * src_fname = NULL, size_t line_num = 0);
+FILE * File_Open
+ (const char * fname, const char * mode, const char * src_fname = NULL,
+ size_t line_num = 0);
+double Percent
+ (double a, double b);
+double Pseudo_Normal
+ (void);
+double Ratio
+ (double a, double b);
+void * Safe_calloc
+ (size_t n, size_t len, const char * src_fname = NULL,
+ size_t line_num = 0);
+void * Safe_malloc
+ (size_t len, const char * src_fname = NULL, size_t line_num = 0);
+void * Safe_realloc
+ (void * q, size_t len, const char * src_fname = NULL,
+ size_t line_num = 0);
+char * Strip_Trailing
+ (char * s, char ch);
+void Uppercase
+ (char * s);
+
+
+
+template <class DT>
+void Incr_Limited (DT & A, DT limit)
+
+// Increment A by 1, but only if it's less than limit .
+
+ {
+ if (A < limit)
+ A ++;
+
+ return;
+ }
+
+
+
+template <class DT>
+DT Max (DT A, DT B)
+
+// Return the larger of A and B .
+
+ {
+ if (A > B)
+ return A;
+ else
+ return B;
+ }
+
+
+
+template <class DT>
+DT Min (DT A, DT B)
+
+// Return the smaller of A and B .
+
+ {
+ if (A < B)
+ return A;
+ else
+ return B;
+ }
+
+
+
+template <class DT>
+void Swap (DT & A, DT & B)
+
+// Swap the values in A and B .
+
+ {
+ DT Save;
+
+ Save = A;
+ A = B;
+ B = Save;
+
+ return;
+ }
+
+
+
+#endif // #ifndef __DELCHER_HH
diff --git a/src/Common/delta.cc b/src/Common/delta.cc
new file mode 100644
index 0000000..b60f924
--- /dev/null
+++ b/src/Common/delta.cc
@@ -0,0 +1,1229 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 03/26/2003
+//!
+//! \brief Source for non-inline member functions of delta.hh
+//!
+//! \see delta.hh
+////////////////////////////////////////////////////////////////////////////////
+
+#include "delta.hh"
+#include "fasta.hh"
+#include "delcher.hh"
+#include <cmath>
+#include <sstream>
+#include <algorithm>
+using namespace std;
+
+
+
+inline long int ScoreLocal
+(long int scorej,
+ long int leni, long int lenj,
+ long int olap, float idyi, float maxolap);
+
+
+struct LIS_t
+//!< LIS score
+{
+ DeltaEdgelet_t * a;
+ long int score;
+ long int diff;
+ long int from;
+ bool used;
+};
+
+
+struct EdgeletQCmp_t
+//!< Compares query lo coord
+{
+ bool operator( ) (const DeltaEdgelet_t * i, const DeltaEdgelet_t * j) const
+ {
+ //-- Sorting by score in the event of a tie ensures that when building
+ // LIS chains, the highest scoring ones get seen first, thus avoiding
+ // overlap problems
+
+ if ( i -> loQ < j -> loQ )
+ return true;
+ else if ( i -> loQ > j -> loQ )
+ return false;
+ else if ( ScoreLocal (0, i->hiQ - i->loQ + 1, 0, 0, i->idy, 0) >
+ ScoreLocal (0, j->hiQ - j->loQ + 1, 0, 0, j->idy, 0) )
+ return true;
+ else
+ return false;
+ }
+};
+
+
+struct EdgeletRCmp_t
+//!< Compares reference lo coord
+{
+ bool operator( ) (const DeltaEdgelet_t * i, const DeltaEdgelet_t * j) const
+ {
+ //-- Sorting by score in the event of a tie ensures that when building
+ // LIS chains, the highest scoring ones get seen first, thus avoiding
+ // overlap problems
+
+ if ( i -> loR < j -> loR )
+ return true;
+ else if ( i -> loR > j -> loR )
+ return false;
+ else if ( ScoreLocal (0, i->hiR - i->loR + 1, 0, 0, i->idy, 0) >
+ ScoreLocal (0, j->hiR - j->loR + 1, 0, 0, j->idy, 0) )
+ return true;
+ else
+ return false;
+ }
+};
+
+
+struct NULLPred_t
+//!< Return true if pointer is not NULL
+{
+ bool operator( ) (const void * i) const
+ { return (i != NULL); }
+};
+
+
+//------------------------------------------------------------ DiffAligns ------
+inline long int DiffAligns
+(const DeltaEdgelet_t * i, const DeltaEdgelet_t * j)
+{
+ return
+ ( ( j->loR < i->loR ) ? labs (j->hiR - i->loR) : labs (i->hiR - j->loR) ) +
+ ( ( j->loQ < i->loQ ) ? labs (j->hiQ - i->loQ) : labs (i->hiQ - j->loQ) );
+}
+
+
+//------------------------------------------------------------ PickBest --------
+long int PickBest
+(const LIS_t * lis, const vector<long int> & allbest, float epsilon)
+{
+ long int size = allbest . size( );
+ if ( epsilon < 0 && size != 0 )
+ {
+ long int eqc = 0;
+ for ( ; eqc < size; ++ eqc )
+ if ( lis[allbest[eqc]] . diff != lis[allbest . front( )] . diff )
+ break;
+
+ return (int)((double)eqc*rand() / (RAND_MAX + 1.0));
+ }
+ return size;
+}
+
+
+//------------------------------------------------------------------ RevC ------
+inline unsigned long int RevC (const unsigned long int & coord,
+ const unsigned long int & len)
+{
+ return len - coord + 1;
+}
+
+
+//------------------------------------------------------------ ScoreLocal ------
+inline long int ScoreLocal
+(long int scorej, long int leni, long int lenj,
+long int olap, float idyi, float maxolap)
+{
+ if ( olap > 0 &&
+ ((float)olap / (float)leni * 100.0 > maxolap ||
+ (float)olap / (float)lenj * 100.0 > maxolap) )
+ return -1;
+ else
+ return (scorej + (long int)((leni - olap) * pow (idyi, 2)));
+}
+
+
+//----------------------------------------------------------- ScoreGlobal ------
+inline long int ScoreGlobal
+(long int scorej, long int leni, long int olap, float idyi)
+{
+ return (scorej + (long int)((leni - olap) * pow (idyi, 2)));
+}
+
+
+//------------------------------------------------------------------ Swap ------
+inline void Swap (unsigned long int & a, unsigned long int & b)
+{
+ unsigned long int t = a; a = b; b = t;
+}
+
+
+//------------------------------------------------------------ UpdateBest ------
+bool UpdateBest
+(LIS_t * lis, long int size, vector<long int> & allbest, float epsilon)
+{
+ if ( size == 0 )
+ return false;
+
+ long int best, i;
+
+ //-- Find the best
+ for ( best = 0; best < size; ++ best )
+ if ( ! lis[best] . used )
+ break;
+ for ( i = best + 1; i < size; ++ i )
+ if ( ! lis[i] . used
+ &&
+ ( lis[i] . score > lis[best] . score
+ ||
+ (lis[i] . score == lis[best] . score &&
+ lis[i] . diff < lis[best] . diff) ) )
+ best = i;
+
+ //-- Nonequivalent
+ if ( ! allbest . empty( )
+ &&
+ (best == size
+ ||
+ (epsilon < 0 &&
+ lis[best].score < lis[allbest.front( )].score)
+ ||
+ (epsilon >= 0 &&
+ (float)(lis[allbest . front( )].score - lis[best].score) /
+ (float)(lis[allbest . front( )].score) * 100.0 > epsilon)) )
+ return false;
+
+ //-- Equivalent
+ allbest . push_back (best);
+
+ for ( i = best; i >= 0 && i < size; i = lis[i] . from )
+ lis[i] . used = true;
+
+ return true;
+}
+
+
+//===================================================== DeltaReader_t ==========
+//----------------------------------------------------- open -------------------
+void DeltaReader_t::open
+ (const string & delta_path)
+{
+ delta_path_m = delta_path;
+
+ //-- Open the delta file
+ delta_stream_m.open (delta_path_m.c_str ( ));
+ checkStream ( );
+
+ //-- Read the file header
+ delta_stream_m >> reference_path_m;
+ delta_stream_m >> query_path_m;
+ delta_stream_m >> data_type_m;
+ if ( (data_type_m != NUCMER_STRING && data_type_m != PROMER_STRING) )
+ delta_stream_m.setstate (ios::badbit);
+ checkStream ( );
+ is_open_m = true;
+
+ //-- Advance to first record header
+ while ( delta_stream_m.peek ( ) != '>' )
+ if ( delta_stream_m.get ( ) == EOF )
+ break;
+}
+
+
+//----------------------------------------------------- readNextAlignment ------
+void DeltaReader_t::readNextAlignment
+ (DeltaAlignment_t & align, const bool read_deltas)
+{
+ long int delta;
+ float total;
+
+ //-- Make way for the new alignment
+ align.clear ( );
+
+ //-- Read the alignment header
+ delta_stream_m >> align.sR;
+ delta_stream_m >> align.eR;
+ delta_stream_m >> align.sQ;
+ delta_stream_m >> align.eQ;
+ delta_stream_m >> align.idyc;
+ delta_stream_m >> align.simc;
+ delta_stream_m >> align.stpc;
+ if ( align.sR <= 0 || align.eR <= 0 ||
+ align.sQ <= 0 || align.eQ <= 0 ||
+ align.idyc < 0 || align.simc < 0 || align.stpc < 0 )
+ delta_stream_m.setstate (ios::badbit);
+ checkStream ( );
+
+ total = labs(align.eR - align.sR) + 1.0;
+ if ( data_type_m == PROMER_STRING )
+ total /= 3.0;
+
+ //-- Get all the deltas
+ do
+ {
+ delta_stream_m >> delta;
+ checkStream ( );
+
+ if ( delta < 0 )
+ total ++;
+ if ( read_deltas )
+ align.deltas.push_back (delta);
+ } while ( delta != 0 );
+
+ //-- Flush the remaining whitespace
+ while ( delta_stream_m.get ( ) != '\n' );
+
+ //-- Calculate the identity, similarity and stopity
+ align.idy = (total - (float)align.idyc) / total * 100.0;
+ align.sim = (total - (float)align.simc) / total * 100.0;
+ align.stp = (float)align.stpc / (total * 2.0) * 100.0;
+}
+
+
+//----------------------------------------------------- readNextRecord ---------
+bool DeltaReader_t::readNextRecord (const bool read_deltas)
+{
+ //-- If EOF or any other abnormality
+ if ( delta_stream_m.peek ( ) != '>' )
+ return false;
+
+ //-- Make way for the new record
+ record_m.clear ( );
+ is_record_m = true;
+
+ //-- Read the record header
+ delta_stream_m.get ( );
+ delta_stream_m >> record_m.idR;
+ delta_stream_m >> record_m.idQ;
+ delta_stream_m >> record_m.lenR;
+ delta_stream_m >> record_m.lenQ;
+ if ( record_m.lenR <= 0 || record_m.lenQ <= 0 )
+ delta_stream_m.setstate (ios::badbit);
+ checkStream ( );
+
+ //-- Flush the remaining whitespace
+ while ( delta_stream_m.get ( ) != '\n' );
+
+ //-- For each alignment...
+ DeltaAlignment_t align;
+ while ( delta_stream_m.peek ( ) != '>' &&
+ delta_stream_m.peek ( ) != EOF )
+ {
+ readNextAlignment (align, read_deltas);
+ record_m.aligns.push_back (align);
+ }
+
+ return true;
+}
+
+
+//===================================================== DeltaEdge_t ============
+//------------------------------------------------------build ------------------
+void DeltaEdge_t::build (const DeltaRecord_t & rec)
+{
+ stringstream ss;
+ vector<long int>::const_iterator di;
+ DeltaEdgelet_t * p;
+
+ vector<DeltaAlignment_t>::const_iterator i;
+ for ( i = rec . aligns . begin( ); i != rec . aligns . end( ); ++ i )
+ {
+ //-- Set the edgelet
+ p = new DeltaEdgelet_t( );
+
+ p -> edge = this;
+
+ p -> idy = i -> idy / 100.0;
+ p -> sim = i -> sim / 100.0;
+ p -> stp = i -> stp / 100.0;
+
+ p -> idyc = i -> idyc;
+ p -> simc = i -> simc;
+ p -> stpc = i -> stpc;
+
+ p -> loR = i -> sR;
+ p -> hiR = i -> eR;
+ p -> loQ = i -> sQ;
+ p -> hiQ = i -> eQ;
+
+ p -> dirR = p -> hiR < p -> loR ? REVERSE_DIR : FORWARD_DIR;
+ p -> dirQ = p -> hiQ < p -> loQ ? REVERSE_DIR : FORWARD_DIR;
+
+ //-- Get the delta information
+ for ( di = i -> deltas . begin( ); di != i -> deltas . end( ); ++ di )
+ {
+ ss << *di << '\n';
+ p -> delta . append (ss . str( ));
+ ss . str ("");
+ }
+
+ //-- Force loR < hiR && loQ < hiQ
+ if ( p -> dirR == REVERSE_DIR )
+ Swap (p -> loR, p -> hiR);
+ if ( p -> dirQ == REVERSE_DIR )
+ Swap (p -> loQ, p -> hiQ);
+
+ edgelets . push_back (p);
+ }
+}
+
+
+//===================================================== DeltaGraph_t ===========
+//----------------------------------------------------- build ------------------
+void DeltaGraph_t::build (const string & deltapath, bool getdeltas)
+{
+ DeltaReader_t dr;
+ DeltaEdge_t * dep;
+ pair<map<string, DeltaNode_t>::iterator, bool> insret;
+
+
+ //-- Open the delta file and read in the alignment information
+ dr . open (deltapath);
+
+ refpath = dr . getReferencePath( );
+ qrypath = dr . getQueryPath( );
+
+ if ( dr . getDataType( ) == NUCMER_STRING )
+ datatype = NUCMER_DATA;
+ else if ( dr . getDataType( ) == PROMER_STRING )
+ datatype = PROMER_DATA;
+ else
+ datatype = NULL_DATA;
+
+ //-- Read in the next graph edge, i.e. a new delta record
+ while ( dr . readNext (getdeltas) )
+ {
+ dep = new DeltaEdge_t( );
+
+
+ //-- Find the reference node in the graph, add a new one if necessary
+ insret = refnodes . insert
+ (map<string, DeltaNode_t>::value_type
+ (dr.getRecord( ).idR, DeltaNode_t( )));
+ dep -> refnode = &((insret . first) -> second);
+
+ //-- If a new reference node
+ if ( insret . second )
+ {
+ dep -> refnode -> id = &((insret . first) -> first);
+ dep -> refnode -> len = dr . getRecord( ) . lenR;
+ }
+
+
+ //-- Find the query node in the graph, add a new one if necessary
+ insret = qrynodes . insert
+ (map<string, DeltaNode_t>::value_type
+ (dr.getRecord( ).idQ, DeltaNode_t( )));
+ dep -> qrynode = &((insret . first) -> second);
+
+ //-- If a new query node
+ if ( insret . second )
+ {
+ dep -> qrynode -> id = &((insret . first) -> first);
+ dep -> qrynode -> len = dr . getRecord( ) . lenQ;
+ }
+
+
+ //-- Build the edge
+ dep -> build (dr . getRecord( ));
+ dep -> refnode -> edges . push_back (dep);
+ dep -> qrynode -> edges . push_back (dep);
+ }
+ dr . close ( );
+}
+
+
+//------------------------------------------------------------------- clean ----
+void DeltaGraph_t::clean( )
+{
+ map<string, DeltaNode_t>::iterator i;
+ map<string, DeltaNode_t>::iterator ii;
+ vector<DeltaEdge_t *>::iterator j;
+ vector<DeltaEdgelet_t *>::iterator k;
+
+ //-- For all ref nodes
+ for ( i = refnodes . begin( ); i != refnodes . end( ); )
+ {
+ //-- For all edges
+ for ( j = i -> second . edges . begin( );
+ j != i -> second . edges . end( ); ++ j )
+ {
+ //-- For all edgelets
+ for ( k = (*j) -> edgelets . begin( );
+ k != (*j) -> edgelets . end( ); ++ k )
+ {
+ if ( ! (*k) -> isGOOD )
+ {
+ //-- Delete the bad edgelet and mark for erasure
+ delete (*k);
+ *k = NULL;
+ }
+ }
+
+ //-- Erase the marked edgelets
+ k = partition ((*j) -> edgelets . begin( ),
+ (*j) -> edgelets . end( ),
+ NULLPred_t( ));
+ (*j) -> edgelets . erase (k, (*j) -> edgelets . end( ));
+
+ //-- Mark the edge if empty
+ if ( (*j) -> edgelets . empty( ) )
+ *j = NULL;
+ }
+
+ //-- Erase the marked edges
+ j = partition (i -> second . edges . begin( ),
+ i -> second . edges . end( ),
+ NULLPred_t( ));
+ i -> second . edges . erase (j, i -> second . edges . end( ));
+
+ //-- Erase the node if empty
+ ii = i ++;
+ if ( ii -> second . edges . empty( ) )
+ refnodes . erase (ii);
+ }
+
+ //-- For all qry nodes
+ for ( i = qrynodes . begin( ); i != qrynodes . end( ); )
+ {
+ for ( j = i -> second . edges . begin( );
+ j != i -> second . edges . end( ); ++ j )
+ {
+ //-- Delete the edge if empty and mark for erasure
+ if ( (*j) -> edgelets . empty( ) )
+ {
+ delete (*j);
+ *j = NULL;
+ }
+ }
+
+ //-- Erase the marked edges
+ j = partition (i -> second . edges . begin( ),
+ i -> second . edges . end( ),
+ NULLPred_t( ));
+ i -> second . edges . erase (j, i -> second . edges . end( ));
+
+ //-- Erase the node if empty
+ ii = i ++;
+ if ( ii -> second . edges . empty( ) )
+ qrynodes . erase (ii);
+ }
+
+}
+
+
+//------------------------------------------------------------ getNodeCount ----
+long int DeltaGraph_t::getNodeCount( )
+{
+ long int sum = refnodes . size( ) + qrynodes . size( );
+ return sum;
+}
+
+
+//------------------------------------------------------------ getEdgeCount ----
+long int DeltaGraph_t::getEdgeCount( )
+{
+ long int sum = 0;
+
+ map<string, DeltaNode_t>::iterator i;
+ for ( i = refnodes . begin( ); i != refnodes . end( ); ++ i )
+ sum += i -> second . edges . size( );
+
+ return sum;
+}
+
+
+//--------------------------------------------------------- getEdgeletCount ----
+long int DeltaGraph_t::getEdgeletCount( )
+{
+ long int sum = 0;
+
+ map<string, DeltaNode_t>::iterator i;
+ vector<DeltaEdge_t *>::iterator j;
+ for ( i = refnodes . begin( ); i != refnodes . end( ); ++ i )
+ for ( j = i -> second . edges . begin( );
+ j != i -> second . edges . end( ); ++ j )
+ sum += (*j) -> edgelets . size( );
+
+ return sum;
+}
+
+
+//-------------------------------------------------------------- flagGLIS ------
+void DeltaGraph_t::flagGLIS (float epsilon)
+{
+ LIS_t * lis = NULL;
+ long int lis_size = 0;
+ long int i, j, n;
+ long int olap, olapQ, olapR, len, lenQ, lenR, score, diff;
+
+ vector<DeltaEdgelet_t *> edgelets;
+
+ map<string, DeltaNode_t>::iterator mi;
+ vector<DeltaEdge_t *>::iterator ei;
+ vector<DeltaEdgelet_t *>::iterator eli;
+
+
+ //-- For each reference sequence
+ for ( mi = refnodes . begin( ); mi != refnodes.end( ); ++ mi )
+ {
+ //-- For each query aligning to this reference
+ for ( ei = (mi -> second) . edges . begin( );
+ ei != (mi -> second) . edges . end( ); ++ ei )
+ {
+ //-- Clear any previous chains
+ (*ei) -> chains . clear( );
+
+ //-- Collect all the good edgelets
+ edgelets . clear( );
+ for ( eli = (*ei) -> edgelets . begin( );
+ eli != (*ei) -> edgelets . end( ); ++ eli )
+ {
+ //-- Clear any previous chain info
+ (*eli) -> next = NULL;
+
+ if ( (*eli) -> isGOOD )
+ {
+ edgelets . push_back (*eli);
+
+ //-- Fix the coordinates to make global LIS work
+ if ( (*eli) -> dirR == (*eli) -> dirQ )
+ {
+ (*eli) -> dirQ = FORWARD_DIR;
+ }
+ else
+ {
+ if ( (*eli) -> dirQ == REVERSE_DIR )
+ Swap ((*eli) -> loQ, (*eli) -> hiQ);
+ (*eli) -> loQ = RevC ((*eli) -> loQ, (*ei)->qrynode->len);
+ (*eli) -> hiQ = RevC ((*eli) -> hiQ, (*ei)->qrynode->len);
+ (*eli) -> dirQ = REVERSE_DIR;
+ }
+ }
+ }
+
+ //-- Resize and initialize
+ n = edgelets . size( );
+ if ( n > lis_size )
+ {
+ lis = (LIS_t *) Safe_realloc (lis, sizeof (LIS_t) * n);
+ lis_size = n;
+ }
+ for ( i = 0; i < n; ++ i )
+ lis[i] . used = false;
+
+ //-- Sort by lo query coord
+ sort (edgelets . begin( ), edgelets . end( ), EdgeletQCmp_t( ));
+
+ //-- Continue until all equivalent repeats are extracted
+ vector<long int> allbest;
+ do
+ {
+ //-- Dynamic
+ for ( i = 0; i < n; ++ i )
+ {
+ if ( lis[i] . used ) continue;
+
+ lis[i] . a = edgelets[i];
+
+ lenR = lis[i] . a -> hiR - lis[i] . a -> loR + 1;
+ lenQ = lis[i] . a -> hiQ - lis[i] . a -> loQ + 1;
+ len = lenR > lenQ ? lenQ : lenR;
+ lis[i] . score = ScoreGlobal (0, len, 0, lis[i] . a -> idy);
+
+ lis[i] . from = -1;
+ lis[i] . diff = 0;
+
+ for ( j = 0; j < i; ++ j )
+ {
+ if ( lis[j] . used ) continue;
+
+ if ( lis[i] . a -> dirQ != lis[j] . a -> dirQ )
+ continue;
+
+ lenR = lis[i] . a -> hiR - lis[i] . a -> loR + 1;
+ lenQ = lis[i] . a -> hiQ - lis[i] . a -> loQ + 1;
+ len = lenR > lenQ ? lenQ : lenR;
+
+ olapR = lis[j] . a -> hiR - lis[i] . a -> loR + 1;
+ olapQ = lis[j] . a -> hiQ - lis[i] . a -> loQ + 1;
+ olap = olapR > olapQ ? olapR : olapQ;
+ if ( olap < 0 )
+ olap = 0;
+
+ diff = lis[j] . diff + DiffAligns (lis[i].a, lis[j].a);
+
+ score = ScoreGlobal
+ (lis[j] . score, len, olap, lis[i] . a -> idy);
+
+ if ( score > lis[i] . score
+ ||
+ (score == lis[i] . score && diff < lis[i] . diff) )
+ {
+ lis[i] . from = j;
+ lis[i] . score = score;
+ lis[i] . diff = diff;
+ }
+ }
+ }
+ } while ( UpdateBest (lis, n, allbest, epsilon) );
+
+ long int beg = PickBest (lis, allbest, epsilon);
+ long int end = allbest . size( );
+ if ( beg == end ) beg = 0;
+ else end = beg + 1;
+
+ //-- Flag the edgelets
+ DeltaEdgelet_t * last;
+ for ( ; beg < end; ++ beg )
+ {
+ last = NULL;
+ for ( i = allbest[beg]; i >= 0 && i < n; i = lis[i] . from )
+ {
+ lis[i] . a -> isGLIS = true;
+ lis[i] . a -> next = last;
+ last = lis[i] . a;
+ }
+ (*ei) -> chains . push_back (last);
+ }
+
+ //-- Repair the coordinates
+ for ( eli = edgelets . begin( ); eli != edgelets . end( ); ++ eli )
+ {
+ if ( ! (*eli) -> isGLIS )
+ (*eli) -> isGOOD = false;
+
+ if ( (*eli) -> dirQ == FORWARD_DIR )
+ {
+ (*eli) -> dirQ = (*eli) -> dirR;
+ }
+ else
+ {
+ if ( (*eli) -> dirR == FORWARD_DIR )
+ Swap ((*eli) -> loQ, (*eli) -> hiQ);
+ (*eli) -> loQ = RevC ((*eli) -> loQ, (*ei)->qrynode->len);
+ (*eli) -> hiQ = RevC ((*eli) -> hiQ, (*ei)->qrynode->len);
+ (*eli) -> dirQ =
+ (*eli) -> dirR == FORWARD_DIR ? REVERSE_DIR : FORWARD_DIR;
+ }
+ }
+ }
+ }
+
+ free (lis);
+}
+
+
+//------------------------------------------------------------- flagScore ------
+void DeltaGraph_t::flagScore (long int minlen, float minidy)
+{
+ map<string, DeltaNode_t>::const_iterator mi;
+ vector<DeltaEdge_t *>::const_iterator ei;
+ vector<DeltaEdgelet_t *>::iterator eli;
+
+ for ( mi = refnodes . begin( ); mi != refnodes . end( ); ++ mi )
+ for ( ei = (mi -> second) . edges . begin( );
+ ei != (mi -> second) . edges . end( ); ++ ei )
+ for ( eli = (*ei) -> edgelets . begin( );
+ eli != (*ei) -> edgelets . end( ); ++ eli )
+ if ( (*eli) -> isGOOD )
+ {
+ //-- Flag low identities
+ if ( (*eli)->idy * 100.0 < minidy )
+ (*eli) -> isGOOD = false;
+
+ //-- Flag small lengths
+ if ( (*eli)->hiR - (*eli)->loR + 1 < (unsigned long)minlen ||
+ (*eli)->hiQ - (*eli)->loQ + 1 < (unsigned long)minlen )
+ (*eli) -> isGOOD = false;
+ }
+}
+
+
+//-------------------------------------------------------------- flagQLIS ------
+void DeltaGraph_t::flagQLIS (float epsilon, float maxolap)
+{
+ LIS_t * lis = NULL;
+ long int lis_size = 0;
+ long int i, j, n;
+ long int olap, leni, lenj, score, diff;
+
+ vector<DeltaEdgelet_t *> edgelets;
+
+ map<string, DeltaNode_t>::iterator mi;
+ vector<DeltaEdge_t *>::iterator ei;
+ vector<DeltaEdgelet_t *>::iterator eli;
+
+
+ //-- For each query sequence
+ for ( mi = qrynodes . begin( ); mi != qrynodes . end( ); ++ mi )
+ {
+ //-- Clean any previous chains
+ (mi -> second) . chains . clear( );
+
+ //-- For each reference aligning to this query
+ edgelets . clear( );
+ for ( ei = (mi -> second) . edges . begin( );
+ ei != (mi -> second) . edges . end( ); ++ ei )
+ {
+ //-- Collect all the good edgelets
+ for ( eli = (*ei) -> edgelets . begin( );
+ eli != (*ei) -> edgelets . end( ); ++ eli )
+ {
+ //-- Clean any previous chain info
+ (*eli) -> next = NULL;
+
+ if ( (*eli) -> isGOOD )
+ edgelets . push_back (*eli);
+ }
+ }
+
+ //-- Resize and initialize
+ n = edgelets . size( );
+ if ( n > lis_size )
+ {
+ lis = (LIS_t *) Safe_realloc (lis, sizeof (LIS_t) * n);
+ lis_size = n;
+ }
+ for ( i = 0; i < n; ++ i )
+ lis[i] . used = false;
+
+ //-- Sort by lo query coord
+ sort (edgelets . begin( ), edgelets . end( ), EdgeletQCmp_t( ));
+
+ //-- Continue until all equivalent repeats are extracted
+ vector<long int> allbest;
+ do
+ {
+ //-- Dynamic
+ for ( i = 0; i < n; ++ i )
+ {
+ if ( lis[i] . used ) continue;
+
+ lis[i] . a = edgelets[i];
+
+ leni = lis[i] . a -> hiQ - lis[i] . a -> loQ + 1;
+ lis[i] . score =
+ ScoreLocal (0, leni, 0, 0, lis[i].a->idy, 0);
+
+ lis[i] . from = -1;
+ lis[i] . diff = 0;
+
+ for ( j = 0; j < i; ++ j )
+ {
+ if ( lis[j] . used ) continue;
+
+ leni = lis[i] . a -> hiQ - lis[i] . a -> loQ + 1;
+ lenj = lis[j] . a -> hiQ - lis[j] . a -> loQ + 1;
+ olap = lis[j] . a -> hiQ - lis[i] . a -> loQ + 1;
+ if ( olap < 0 )
+ olap = 0;
+
+ diff = lis[j] . diff + DiffAligns (lis[i].a, lis[j].a);
+
+ score = ScoreLocal
+ (lis[j] . score, leni, lenj, olap, lis[i].a->idy, maxolap);
+
+ if ( score > lis[i] . score
+ ||
+ (score == lis[i] . score && diff < lis[i] . diff) )
+ {
+ lis[i] . from = j;
+ lis[i] . score = score;
+ lis[i] . diff = diff;
+ }
+ }
+ }
+ } while ( UpdateBest (lis, n, allbest, epsilon) );
+
+ long int beg = PickBest (lis, allbest, epsilon);
+ long int end = allbest . size( );
+ if ( beg == end ) beg = 0;
+ else end = beg + 1;
+
+ //-- Flag the edgelets
+ DeltaEdgelet_t * last;
+ for ( ; beg < end; ++ beg )
+ {
+ last = NULL;
+ for ( i = allbest[beg]; i >= 0 && i < n; i = lis[i] . from )
+ {
+ lis[i] . a -> isQLIS = true;
+ lis[i] . a -> next = last;
+ last = lis[i] . a;
+ }
+ (mi -> second) . chains . push_back (last);
+ }
+
+ for ( eli = edgelets . begin( ); eli != edgelets . end( ); ++ eli )
+ if ( ! (*eli) -> isQLIS )
+ (*eli) -> isGOOD = false;
+ }
+
+ free (lis);
+}
+
+
+//-------------------------------------------------------------- flagRLIS ------
+void DeltaGraph_t::flagRLIS (float epsilon, float maxolap)
+{
+ LIS_t * lis = NULL;
+ long int lis_size = 0;
+ long int i, j, n;
+ long int olap, leni, lenj, score, diff;
+
+ vector<DeltaEdgelet_t *> edgelets;
+
+ map<string, DeltaNode_t>::iterator mi;
+ vector<DeltaEdge_t *>::iterator ei;
+ vector<DeltaEdgelet_t *>::iterator eli;
+
+
+ //-- For each reference sequence
+ for ( mi = refnodes . begin( ); mi != refnodes . end( ); ++ mi )
+ {
+ //-- Clean any previous chains
+ (mi -> second) . chains . clear( );
+
+ //-- For each query aligning to this reference
+ edgelets . clear( );
+ for ( ei = (mi -> second) . edges . begin( );
+ ei != (mi -> second) . edges . end( ); ++ ei )
+ {
+ //-- Collect all the good edgelets
+ for ( eli = (*ei) -> edgelets . begin( );
+ eli != (*ei) -> edgelets . end( ); ++ eli )
+ {
+ //-- Clean any previous chain info
+ (*eli) -> next = NULL;
+
+ if ( (*eli) -> isGOOD )
+ edgelets . push_back (*eli);
+ }
+ }
+
+ //-- Resize
+ n = edgelets . size( );
+ if ( n > lis_size )
+ {
+ lis = (LIS_t *) Safe_realloc (lis, sizeof (LIS_t) * n);
+ lis_size = n;
+ }
+ for ( i = 0; i < n; ++ i )
+ lis[i] . used = false;
+
+ //-- Sort by lo reference coord
+ sort (edgelets . begin( ), edgelets . end( ), EdgeletRCmp_t( ));
+
+ //-- Continue until all equivalent repeats are extracted
+ vector<long int> allbest;
+ do
+ {
+ //-- Dynamic
+ for ( i = 0; i < n; ++ i )
+ {
+ if ( lis[i] . used ) continue;
+
+ lis[i] . a = edgelets[i];
+
+ leni = lis[i] . a -> hiR - lis[i] . a -> loR + 1;
+ lis[i] . score =
+ ScoreLocal (0, leni, 0, 0, lis[i].a->idy, 0);
+
+ lis[i] . from = -1;
+ lis[i] . diff = 0;
+
+ for ( j = 0; j < i; ++ j )
+ {
+ if ( lis[j] . used ) continue;
+
+ leni = lis[i] . a -> hiR - lis[i] . a -> loR + 1;
+ lenj = lis[j] . a -> hiR - lis[j] . a -> loR + 1;
+ olap = lis[j] . a -> hiR - lis[i] . a -> loR + 1;
+ if ( olap < 0 )
+ olap = 0;
+
+ diff = lis[j] . diff + DiffAligns (lis[i].a, lis[j].a);
+
+ score = ScoreLocal
+ (lis[j] . score, leni, lenj, olap, lis[i].a->idy, maxolap);
+
+ if ( score > lis[i] . score
+ ||
+ (score == lis[i] . score && diff < lis[i] . diff) )
+ {
+ lis[i] . from = j;
+ lis[i] . score = score;
+ lis[i] . diff = diff;
+ }
+ }
+ }
+ } while ( UpdateBest (lis, n, allbest, epsilon) );
+
+ long int beg = PickBest (lis, allbest, epsilon);
+ long int end = allbest . size( );
+ if ( beg == end ) beg = 0;
+ else end = beg + 1;
+
+ //-- Flag the edgelets
+ DeltaEdgelet_t * last;
+ for ( ; beg < end; ++ beg )
+ {
+ last = NULL;
+ for ( i = allbest[beg]; i >= 0 && i < n; i = lis[i] . from )
+ {
+ lis[i] . a -> isRLIS = true;
+ lis[i] . a -> next = last;
+ last = lis[i] . a;
+ }
+ (mi -> second) . chains . push_back (last);
+ }
+
+ for ( eli = edgelets . begin( ); eli != edgelets . end( ); ++ eli )
+ if ( ! (*eli) -> isRLIS )
+ (*eli) -> isGOOD = false;
+ }
+
+ free (lis);
+}
+
+
+//-------------------------------------------------------------- flagUNIQ ------
+void DeltaGraph_t::flagUNIQ (float minuniq)
+{
+ unsigned long int i, uniq, len;
+
+ vector<DeltaEdgelet_t *> edgelets;
+
+ map<string, DeltaNode_t>::const_iterator mi;
+ vector<DeltaEdge_t *>::const_iterator ei;
+ vector<DeltaEdgelet_t *>::iterator eli;
+
+
+ //-- For each reference sequence
+ unsigned long int ref_size = 0;
+ unsigned long int ref_len = 0;
+ unsigned char * ref_cov = NULL;
+ for ( mi = refnodes . begin( ); mi != refnodes . end( ); ++ mi )
+ {
+ //-- Reset the reference coverage array
+ ref_len = (mi -> second) . len;
+ if ( ref_len > ref_size )
+ {
+ ref_cov = (unsigned char *) Safe_realloc (ref_cov, ref_len + 1);
+ ref_size = ref_len;
+ }
+ for ( i = 1; i <= ref_len; ++ i )
+ ref_cov[i] = 0;
+
+ //-- Collect all the good edgelets
+ edgelets . clear( );
+ for ( ei = (mi -> second) . edges . begin( );
+ ei != (mi -> second) . edges . end( ); ++ ei )
+ for ( eli = (*ei) -> edgelets . begin( );
+ eli != (*ei) -> edgelets . end( ); ++ eli )
+ if ( (*eli) -> isGOOD )
+ {
+ edgelets . push_back (*eli);
+
+ //-- Add to the reference coverage
+ for ( i = (*eli) -> loR; i <= (*eli) -> hiR; i ++ )
+ if ( ref_cov[i] < UCHAR_MAX )
+ ref_cov[i] ++;
+ }
+
+ //-- Calculate the uniqueness of each edgelet
+ for ( eli = edgelets . begin( ); eli != edgelets . end( ); ++ eli )
+ {
+ uniq = 0;
+ len = (*eli) -> hiR - (*eli) -> loR + 1;
+ for ( i = (*eli) -> loR; i <= (*eli) -> hiR; i ++ )
+ if ( ref_cov[i] == 1 )
+ uniq ++;
+
+ //-- Flag low reference uniqueness
+ if ( (float)uniq / (float)len * 100.0 < minuniq )
+ (*eli) -> isGOOD = false;
+ }
+ }
+ free (ref_cov);
+
+
+ //-- For each query sequence
+ unsigned long int qry_size = 0;
+ unsigned long int qry_len = 0;
+ unsigned char * qry_cov = NULL;
+ for ( mi = qrynodes . begin( ); mi != qrynodes . end( ); ++ mi )
+ {
+ //-- Reset the query coverage array
+ qry_len = (mi -> second) . len;
+ if ( qry_len > qry_size )
+ {
+ qry_cov = (unsigned char *) Safe_realloc (qry_cov, qry_len + 1);
+ qry_size = qry_len;
+ }
+ for ( i = 1; i <= qry_len; ++ i )
+ qry_cov[i] = 0;
+
+ //-- Collect all the good edgelets
+ edgelets . clear( );
+ for ( ei = (mi -> second) . edges . begin( );
+ ei != (mi -> second) . edges . end( ); ++ ei )
+ for ( eli = (*ei) -> edgelets . begin( );
+ eli != (*ei) -> edgelets . end( ); ++ eli )
+ if ( (*eli) -> isGOOD )
+ {
+ edgelets . push_back (*eli);
+
+ //-- Add to the query coverage
+ for ( i = (*eli) -> loQ; i <= (*eli) -> hiQ; i ++ )
+ if ( qry_cov[i] < UCHAR_MAX )
+ qry_cov[i] ++;
+ }
+
+ //-- Calculate the uniqueness of each edgelet
+ for ( eli = edgelets . begin( ); eli != edgelets . end( ); ++ eli )
+ {
+ uniq = 0;
+ len = (*eli) -> hiQ - (*eli) -> loQ + 1;
+ for ( i = (*eli) -> loQ; i <= (*eli) -> hiQ; i ++ )
+ if ( qry_cov[i] == 1 )
+ uniq ++;
+
+ //-- Flag low query uniqueness
+ if ( (float)uniq / (float)len * 100.0 < minuniq )
+ (*eli) -> isGOOD = false;
+ }
+ }
+ free (qry_cov);
+}
+
+
+//----------------------------------------------------- loadSequences ----------
+void DeltaGraph_t::loadSequences ( )
+{
+ const int init_size = 10000;
+ const int max_line = 1024;
+
+ map<string, DeltaNode_t>::iterator mi;
+
+ FILE * qryfile, * reffile;
+ char * R = NULL;
+ char * Q = NULL;
+ char id [max_line];
+ long int initsize;
+ long int len;
+
+ //-- Read in the reference sequences
+ reffile = File_Open (refpath . c_str( ), "r");
+ initsize = init_size;
+ R = (char *) Safe_malloc (initsize);
+ while ( Fasta_Read_String (reffile, R, initsize, id, FALSE) )
+ if ( (mi = refnodes . find (id)) != refnodes . end( ) )
+ {
+ len = strlen (R + 1);
+ mi -> second . seq = (char *) Safe_malloc (len + 2);
+ mi -> second . seq[0] = '\0';
+ strcpy (mi -> second . seq + 1, R + 1);
+ if ( (unsigned long) len != mi -> second . len )
+ {
+ cerr << "ERROR: Reference input does not match delta file\n";
+ exit (EXIT_FAILURE);
+ }
+ }
+ fclose (reffile);
+ free (R);
+
+ //-- Read in the query sequences
+ qryfile = File_Open (qrypath . c_str( ), "r");
+ initsize = init_size;
+ Q = (char *) Safe_malloc (initsize);
+ while ( Fasta_Read_String (qryfile, Q, initsize, id, FALSE) )
+ if ( (mi = qrynodes . find (id)) != qrynodes . end( ) )
+ {
+ len = strlen (Q + 1);
+ mi -> second . seq = (char *) Safe_malloc (len + 2);
+ mi -> second . seq[0] = '\0';
+ strcpy (mi -> second . seq + 1, Q + 1);
+ if ( (unsigned long) len != mi -> second . len )
+ {
+ cerr << "ERROR: Query input does not match delta file\n";
+ exit (EXIT_FAILURE);
+ }
+ }
+ fclose (qryfile);
+ free (Q);
+
+
+ //-- Check that we found all the sequences
+ for ( mi = refnodes.begin( ); mi != refnodes.end( ); ++ mi )
+ if ( mi -> second . seq == NULL )
+ {
+ cerr << "ERROR: '" << mi -> first << "' not found in reference file\n";
+ exit (EXIT_FAILURE);
+ }
+
+ for ( mi = qrynodes.begin( ); mi != qrynodes.end( ); ++ mi )
+ if ( mi -> second . seq == NULL )
+ {
+ cerr << "ERROR: '" << mi -> first << "' not found in query file\n";
+ exit (EXIT_FAILURE);
+ }
+}
+
+
+//----------------------------------------------------- outputDelta ------------
+ostream & DeltaGraph_t::outputDelta (ostream & out)
+{
+ bool header;
+ unsigned long int s1, e1, s2, e2;
+
+ map<string, DeltaNode_t>::const_iterator mi;
+ vector<DeltaEdge_t *>::const_iterator ei;
+ vector<DeltaEdgelet_t *>::const_iterator eli;
+
+ //-- Print the file header
+ cout
+ << refpath << ' ' << qrypath << '\n'
+ << (datatype == PROMER_DATA ? PROMER_STRING : NUCMER_STRING) << '\n';
+
+ for ( mi = qrynodes . begin( ); mi != qrynodes . end( ); ++ mi )
+ {
+ for ( ei = (mi -> second) . edges . begin( );
+ ei != (mi -> second) . edges . end( ); ++ ei )
+ {
+ header = false;
+
+ for ( eli = (*ei) -> edgelets . begin( );
+ eli != (*ei) -> edgelets . end( ); ++ eli )
+ {
+ if ( ! (*eli) -> isGOOD )
+ continue;
+
+ //-- Print the sequence header
+ if ( ! header )
+ {
+ cout
+ << '>'
+ << *((*ei) -> refnode -> id) << ' '
+ << *((*ei) -> qrynode -> id) << ' '
+ << (*ei) -> refnode -> len << ' '
+ << (*ei) -> qrynode -> len << '\n';
+ header = true;
+ }
+ //-- Print the alignment
+ s1 = (*eli) -> loR;
+ e1 = (*eli) -> hiR;
+ s2 = (*eli) -> loQ;
+ e2 = (*eli) -> hiQ;
+ if ( (*eli) -> dirR == REVERSE_DIR )
+ Swap (s1, e1);
+ if ( (*eli) -> dirQ == REVERSE_DIR )
+ Swap (s2, e2);
+
+ cout
+ << s1 << ' ' << e1 << ' ' << s2 << ' ' << e2 << ' '
+ << (*eli) -> idyc << ' '
+ << (*eli) -> simc << ' '
+ << (*eli) -> stpc << '\n'
+ << (*eli) -> delta;
+ }
+ }
+ }
+ return out;
+}
+
diff --git a/src/Common/delta.hh b/src/Common/delta.hh
new file mode 100644
index 0000000..7a21c94
--- /dev/null
+++ b/src/Common/delta.hh
@@ -0,0 +1,618 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 03/26/2003
+//!
+//! \brief Class declarations for the handling of delta alignment files
+//!
+//! \see delta.cc
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __DELTA_HH
+#define __DELTA_HH
+
+#include <map>
+#include <cassert>
+#include <string>
+#include <vector>
+#include <fstream>
+#include <cstdlib>
+#include <iostream>
+
+
+const std::string NUCMER_STRING = "NUCMER"; //!< nucmer id string
+const std::string PROMER_STRING = "PROMER"; //!< promer id string
+
+typedef char AlignmentType_t; //!< type of alignment data
+const AlignmentType_t NULL_DATA = 0; //!< unknown alignment data type
+const AlignmentType_t NUCMER_DATA = 'N'; //!< nucmer alignment data
+const AlignmentType_t PROMER_DATA = 'P'; //!< promer alignment data
+
+typedef unsigned char Dir_t; //!< directional type
+const Dir_t FORWARD_DIR = 0; //!< forward direction
+const Dir_t REVERSE_DIR = 1; //!< reverse direction
+
+
+
+//===================================================== DeltaAlignment_t =======
+struct DeltaAlignment_t
+//!< A single delta encoded alignment region
+{
+ unsigned long int sR; //!< start coordinate in the reference
+ unsigned long int eR; //!< end coordinate in the reference
+ unsigned long int sQ; //!< start coordinate in the reference
+ unsigned long int eQ; //!< end coordinate in the reference
+ unsigned long int idyc; //!< number of mismatches in the alignment
+ unsigned long int simc; //!< number of similarity scores < 1 in the alignment
+ unsigned long int stpc; //!< number of stop codons in the alignment
+
+ float idy; //!< percent identity [0 - 100]
+ float sim; //!< percent similarity [0 - 100]
+ float stp; //!< percent stop codon [0 - 100]
+
+ std::vector<long int> deltas; //!< delta encoded alignment informaiton
+
+ DeltaAlignment_t ( )
+ {
+ clear ( );
+ }
+
+ void clear ( )
+ {
+ sR = eR = sQ = eQ = 0;
+ idy = sim = stp = 0;
+ deltas.clear ( );
+ }
+};
+
+
+
+//===================================================== DeltaRecord_t ==========
+struct DeltaRecord_t
+//!< A delta record representing the alignments between two sequences
+{
+ std::string idR; //!< reference contig ID
+ std::string idQ; //!< query contig ID
+ unsigned long int lenR; //!< length of the reference contig
+ unsigned long int lenQ; //!< length of the query contig
+
+ std::vector<DeltaAlignment_t> aligns; //!< alignments between the two seqs
+
+ DeltaRecord_t ( )
+ {
+ clear ( );
+ }
+
+ void clear ( )
+ {
+ idR.erase ( );
+ idQ.erase ( );
+ lenR = lenQ = 0;
+ aligns.clear ( );
+ }
+};
+
+
+
+//===================================================== DeltaReader_t ==========
+//! \brief Delta encoded file reader class
+//!
+//! Handles the input of delta encoded alignment information for various MUMmer
+//! utilities. Very basic functionality, can be expanded as necessary...
+//!
+//! \see DeltaRecord_t
+//==============================================================================
+class DeltaReader_t {
+
+private:
+
+ std::string delta_path_m; //!< the name of the delta input file
+ std::ifstream delta_stream_m; //!< the delta file input stream
+ std::string data_type_m; //!< the type of alignment data
+ std::string reference_path_m; //!< the name of the reference file
+ std::string query_path_m; //!< the name of the query file
+ DeltaRecord_t record_m; //!< the current delta information record
+ bool is_record_m; //!< there is a valid record in record_m
+ bool is_open_m; //!< delta stream is open
+
+
+ //--------------------------------------------------- readNextAlignment ------
+ //! \brief Reads in a delta encoded alignment
+ //!
+ //! \param align read info into this structure
+ //! \param read_deltas read delta information yes/no
+ //! \pre delta_stream is positioned at the beginning of an alignment header
+ //! \return void
+ //!
+ void readNextAlignment (DeltaAlignment_t & align, const bool read_deltas);
+
+
+ //--------------------------------------------------- readNextRecord ---------
+ //! \brief Reads in the next delta record from the delta file
+ //!
+ //! \param read_deltas read delta information yes/no
+ //! \pre delta file must be open
+ //! \return true on success, false on EOF
+ //!
+ bool readNextRecord (const bool read_deltas);
+
+
+ //--------------------------------------------------- checkStream ------------
+ //! \brief Check stream status and abort program if an error has occured
+ //!
+ //! \return void
+ //!
+ void checkStream ( )
+ {
+ if ( !delta_stream_m.good ( ) )
+ {
+ std::cerr << "ERROR: Could not parse delta file, "
+ << delta_path_m << std::endl;
+ exit (-1);
+ }
+ }
+
+
+public:
+ //--------------------------------------------------- DeltaReader_t ----------
+ //! \brief Default constructor
+ //!
+ //! \return void
+ //!
+ DeltaReader_t ( )
+ {
+ is_record_m = false;
+ is_open_m = false;
+ }
+
+
+ //--------------------------------------------------- ~DeltaReader_t ---------
+ //! \brief Default destructor
+ //!
+ //! \return void
+ //!
+ ~DeltaReader_t ( )
+ {
+ close ( );
+ }
+
+
+ //--------------------------------------------------- open -------------------
+ //! \brief Opens a delta file by path
+ //!
+ //! \param delta file to open
+ //! \return void
+ //!
+ void open (const std::string & delta_path);
+
+
+ //--------------------------------------------------- close ------------------
+ //! \brief Closes any open delta file and resets class members
+ //!
+ //! \return void
+ //!
+ void close ( )
+ {
+ delta_path_m.erase ( );
+ delta_stream_m.close ( );
+ data_type_m.erase ( );
+ reference_path_m.erase ( );
+ query_path_m.erase ( );
+ record_m.clear ( );
+ is_record_m = false;
+ is_open_m = false;
+ }
+
+
+ //--------------------------------------------------- readNext --------------
+ //! \brief Reads in the next delta record from the delta file
+ //!
+ //! \param read_deltas read delta information yes/no
+ //! \pre delta file must be open
+ //! \return true on success, false on EOF
+ //!
+ inline bool readNext (bool getdeltas = true)
+ {
+ return readNextRecord (getdeltas);
+ }
+
+
+
+ //--------------------------------------------------- readNextHeadersOnly ----
+ //! \brief Reads in the next delta record from the delta file
+ //!
+ //! Only reads the alignment header information, does not read in the delta
+ //! information and leaves each alignment structure's delta vector empty.
+ //!
+ //! \pre delta file must be open
+ //! \return true on success, false on EOF
+ //!
+ inline bool readNextHeadersOnly ( )
+ {
+ return readNextRecord (false);
+ }
+
+
+ //--------------------------------------------------- getRecord --------------
+ //! \brief Returns a reference to the current delta record
+ //!
+ //! \pre readNext( ) was successfully called in advance
+ //! \return true on success, false on failure or end of file
+ //!
+ const DeltaRecord_t & getRecord ( ) const
+ {
+ assert (is_record_m);
+ return record_m;
+ }
+
+
+ //--------------------------------------------------- getDeltaPath -----------
+ //! \brief Get the path of the current delta file
+ //!
+ //! \pre delta file is open
+ //! \return the path of the delta file
+ //!
+ const std::string & getDeltaPath ( ) const
+ {
+ assert (is_open_m);
+ return delta_path_m;
+ }
+
+
+ //--------------------------------------------------- getDataType ------------
+ //! \brief Get the data type of the current delta file
+ //!
+ //! \pre delta file is open
+ //! \return the data type of the current file
+ //!
+ const std::string & getDataType ( ) const
+ {
+ assert (is_open_m);
+ return data_type_m;
+ }
+
+
+ //--------------------------------------------------- getReferencePath -------
+ //! \brief Get the path of the MUMmer reference file
+ //!
+ //! \pre delta file is open
+ //! \return the path of the MUMmer reference file
+ //!
+ const std::string & getReferencePath ( ) const
+ {
+ assert (is_open_m);
+ return reference_path_m;
+ }
+
+
+ //--------------------------------------------------- getQueryPath -----------
+ //! \brief Get the path of the MUMmer query file
+ //!
+ //! \pre delta file is open
+ //! \return the path of the MUMmer query file
+ //!
+ const std::string & getQueryPath ( ) const
+ {
+ assert (is_open_m);
+ return query_path_m;
+ }
+};
+
+
+
+//===================================================== SNP_t ==================
+struct DeltaEdgelet_t;
+struct DeltaEdge_t;
+struct DeltaNode_t;
+struct SNP_t
+ //!< A single nuc/aa poly
+{
+ long int buff;
+ char cQ, cR;
+ long int pQ, pR;
+ int conQ, conR;
+ std::string ctxQ, ctxR;
+ DeltaEdgelet_t * lp;
+ DeltaEdge_t * ep;
+
+ SNP_t ( )
+ {
+ cQ = cR = 0;
+ buff = pQ = pR = 0;
+ conQ = conR = 0;
+ };
+};
+
+
+
+//===================================================== DeltaEdgelet_t =========
+struct DeltaEdgelet_t
+//!< A piece of a delta graph edge, a single alignment
+{
+ unsigned char isGOOD : 1; //!< meets the requirements
+ unsigned char isQLIS : 1; //!< is part of the query's LIS
+ unsigned char isRLIS : 1; //!< is part of the reference's LIS
+ unsigned char isGLIS : 1; //!< is part of the reference/query LIS
+ unsigned char dirR : 1; //!< reference match direction
+ unsigned char dirQ : 1; //!< query match direction
+
+ DeltaEdge_t * edge;
+ DeltaEdgelet_t * next; //!< stores chaining info
+ float idy, sim, stp; //!< percent identity [0 - 1]
+ unsigned long int idyc, simc, stpc; //!< idy, sim, stp counts
+ unsigned long int loQ, hiQ, loR, hiR; //!< alignment bounds
+ int frmQ, frmR; //!< reading frame
+
+ std::string delta; //!< delta information
+ std::vector<SNP_t *> snps; //!< snps for this edgelet
+
+ DeltaEdgelet_t ( )
+ {
+ next = NULL;
+ isGOOD = true;
+ isQLIS = isRLIS = isGLIS = false;
+ dirR = dirQ = FORWARD_DIR;
+ idy = sim = stp = 0;
+ idyc = simc = stpc = 0;
+ loQ = hiQ = loR = hiR = 0;
+ frmQ = frmR = 1;
+ }
+
+ ~DeltaEdgelet_t ( )
+ {
+ std::vector<SNP_t *>::iterator i;
+ for ( i = snps . begin( ); i != snps . end( ); ++ i )
+ delete (*i);
+ }
+};
+
+
+
+//===================================================== DeltaEdge_t ============
+struct DeltaEdge_t
+//!< A delta graph edge, alignments between a single reference and query
+{
+ DeltaNode_t * refnode; //!< the adjacent reference node
+ DeltaNode_t * qrynode; //!< the adjacent query node
+ std::vector<DeltaEdgelet_t *> edgelets; //!< the set of individual alignments
+ std::vector<DeltaEdgelet_t *> chains; //!< stores GLIS chains
+
+ DeltaEdge_t ( )
+ {
+ refnode = qrynode = NULL;
+ }
+
+ ~DeltaEdge_t ( )
+ {
+ std::vector<DeltaEdgelet_t *>::iterator i;
+ for ( i = edgelets . begin( ); i != edgelets . end( ); ++ i )
+ delete (*i);
+ }
+
+ void build (const DeltaRecord_t & rec);
+};
+
+
+//===================================================== DeltaNode_t ============
+struct DeltaNode_t
+//!< A delta graph node, contains the sequence information
+{
+ const std::string * id; //!< the id of the sequence
+ char * seq; //!< the DNA sequence
+ unsigned long int len; //!< the length of the sequence
+ std::vector<DeltaEdge_t *> edges; //!< the set of related edges
+ std::vector<DeltaEdgelet_t *> chains; //!< stores RLIS/QLIS chains
+
+ DeltaNode_t ( )
+ {
+ id = NULL;
+ seq = NULL;
+ len = 0;
+ }
+
+ ~DeltaNode_t ( )
+ {
+ free (seq);
+ // DeltaGraph_t will take care of destructing the edges
+ }
+};
+
+
+
+//===================================================== DeltaGraph_t ===========
+//! \brief A graph of sequences (nodes) and their alignments (edges)
+//!
+//! A bipartite graph with two partite sets, R and Q, where R is the set of
+//! reference sequences and Q is the set of query sequences. These nodes are
+//! named "DeltaNode_t". We connect a node in R to a node in Q if an alignment
+//! is present between the two sequences. The group of all alignments between
+//! the two is named "DeltaEdge_t" and a single alignment between the two is
+//! named a "DeltaEdgelet_t". Alignment coordinates reference the forward
+//! strand and are stored lo before hi.
+//!
+//==============================================================================
+class DeltaGraph_t
+{
+public:
+
+ std::map<std::string, DeltaNode_t> refnodes;
+ //!< the reference graph nodes, 1 per aligned sequence
+
+ std::map<std::string, DeltaNode_t> qrynodes;
+ //!< the query graph nodes, 1 per aligned sequence
+
+ std::string refpath; //!< path of the reference FastA file
+ std::string qrypath; //!< path of the query FastA file
+ AlignmentType_t datatype; //!< alignment data type
+
+ DeltaGraph_t ( )
+ {
+ datatype = NULL_DATA;
+ }
+
+ ~DeltaGraph_t ( )
+ {
+ clear( );
+ }
+
+ //--------------------------------------------------- build ------------------
+ //! \brief Build a new graph from a deltafile
+ //!
+ //! Does not populate:
+ //! node->seq
+ //! edgelet->frmR/frmQ
+ //! edgelet->snps
+ //!
+ //! \param deltapath The path of the deltafile to read
+ //! \param getdeltas Read the delta-encoded gap positions? yes/no
+ //! \return void
+ //!
+ void build (const std::string & deltapath, bool getdeltas = true);
+
+
+ //--------------------------------------------------- clean ------------------
+ //! \brief Clean the graph of all edgelets where isGOOD = false
+ //!
+ //! Removes all edgelets from the graph where isGOOD = false. Afterwhich, all
+ //! now empty edges or nodes are also removed.
+ //!
+ //! \return void
+ //!
+ void clean ( );
+
+
+ //--------------------------------------------------- clear ------------------
+ //! \brief Clear the graph of all nodes, edges and edgelets
+ //!
+ //! \return void
+ //!
+ void clear ( )
+ {
+ //-- Make sure the edges only get destructed once
+ std::map<std::string, DeltaNode_t>::iterator i;
+ std::vector<DeltaEdge_t *>::iterator j;
+ for ( i = refnodes . begin( ); i != refnodes . end( ); ++ i )
+ for ( j = i -> second . edges . begin( );
+ j != i -> second . edges . end( ); ++ j )
+ delete (*j);
+
+ refnodes.clear( );
+ qrynodes.clear( );
+ refpath.erase( );
+ qrypath.erase( );
+ datatype = NULL_DATA;
+ }
+
+
+ //--------------------------------------------------- getNodeCount -----------
+ //! \brief Counts and returns the number of graph nodes (sequences)
+ //!
+ //! \return The number of graph nodes
+ //!
+ long int getNodeCount ( );
+
+
+ //--------------------------------------------------- getEdgeCount -----------
+ //! \brief Counts and returns the number of graph edges
+ //!
+ //! \return void
+ //!
+ long int getEdgeCount ( );
+
+
+ //--------------------------------------------------- getEdgeletCount --------
+ //! \brief Counts and returns the number of graph edgelets (alignments)
+ //!
+ //! \return void
+ //!
+ long int getEdgeletCount ( );
+
+
+ //--------------------------------------------------- flagGLIS ---------------
+ //! \brief Flag edgelets in the global LIS and unflag those who are not
+ //!
+ //! Runs a length*identity weigthed LIS to determine the longest, mutually
+ //! consistent set of alignments between all pairs of sequences. This
+ //! essentially constructs the global alignment between all sequence pairs.
+ //!
+ //! Sets isGLIS flag for good and unsets isGOOD flag for bad.
+ //!
+ //! \param epsilon Keep repeat alignments within epsilon % of the best align
+ //! \return void
+ //!
+ void flagGLIS (float epsilon = -1);
+
+
+ //--------------------------------------------------- flagQLIS ---------------
+ //! \brief Flag edgelets in the query LIS and unflag those who are not
+ //!
+ //! Runs a length*identity weighted LIS to determine the longest, QUERY
+ //! consistent set of alignments for all query sequences. This effectively
+ //! identifies the "best" alignments for all positions of each query.
+ //!
+ //! Sets isQLIS flag for good and unsets isGOOD flag for bad.
+ //!
+ //! \param epsilon Keep repeat alignments within epsilon % of the best align
+ //! \param maxolap Only allow alignments to overlap by maxolap percent [0-100]
+ //! \return void
+ //!
+ void flagQLIS (float epsilon = -1, float maxolap = 100.0);
+
+
+ //--------------------------------------------------- flagRLIS ---------------
+ //! \brief Flag edgelets in the reference LIS and unflag those who are not
+ //!
+ //! Runs a length*identity weighted LIS to determine the longest, REFERENCE
+ //! consistent set of alignments for all reference sequences. This effectively
+ //! identifies the "best" alignments for all positions of each reference.
+ //!
+ //! Sets isRLIS flag for good and unsets isGOOD flag for bad.
+ //!
+ //! \param epsilon Keep repeat alignments within epsilon % of the best align
+ //! \param maxolap Only allow alignments to overlap by maxolap percent [0-100]
+ //! \return void
+ //!
+ void flagRLIS (float epsilon = -1, float maxolap = 100.0);
+
+
+ //--------------------------------------------------- flagScore --------------
+ //! \brief Flag edgelets with scores below a score threshold
+ //!
+ //! Unsets isGOOD for bad.
+ //!
+ //! \param minlen Flag edgelets if less than minlen in length
+ //! \param minidy Flag edgelets if less than minidy identity [0-100]
+ //! \return void
+ //!
+ void flagScore (long int minlen, float minidy);
+
+
+ //--------------------------------------------------- flagUNIQ ---------------
+ //! \brief Flag edgelets with uniqueness below a certain threshold
+ //!
+ //! Unsets isGOOD for bad.
+ //!
+ //! \param minuniq Flag edgelets if less that minuniq percent [0-100] unique
+ //! \return void
+ //!
+ void flagUNIQ (float minuniq);
+
+
+ //--------------------------------------------------- loadSequences ----------
+ //! \brief Load the sequence information into the DeltaNodes
+ //!
+ //! \return void
+ //!
+ void loadSequences ( );
+
+
+ //--------------------------------------------------- outputDelta ------------
+ //! \brief Outputs the contents of the graph as a deltafile
+ //!
+ //! \param out The output stream to write to
+ //! \return The output stream
+ //!
+ std::ostream & outputDelta (std::ostream & out);
+};
+
+#endif // #ifndef __DELTA_HH
diff --git a/src/Common/fasta.cc b/src/Common/fasta.cc
new file mode 100644
index 0000000..1dc3794
--- /dev/null
+++ b/src/Common/fasta.cc
@@ -0,0 +1,422 @@
+// A. L. Delcher
+//
+// File: fasta.cc
+//
+// Last Modified: 25 November 2002
+//
+// Routines to manipulate FASTA format files
+
+
+#include "inttypes_AMOS.hh"
+#include "fasta.hh"
+using namespace std;
+
+static const char Complement_Table []
+ = "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"
+ " nnnnnnnnn*nn-.nnnnnnnnnnnnnnnnn"
+ "nTVGHNNCDNNMNKNNNNYSANBSNRNnnnn_"
+ "ntvghnncdnnmnknnnnysanbsnrnnnnnn";
+
+
+char Complement
+ (char ch)
+
+// Returns the DNA complement of ch
+
+ {
+ return Complement_Table [(int)ch];
+ }
+
+
+
+void Fasta_Print
+ (FILE * fp, const char * s, const char * hdr, int fasta_width)
+
+// Print string s in fasta format to fp . Put string hdr
+// on header line, unless it's NULL in which case do not print
+// a header line at all. Print at most fasta_width characters per
+// line.
+
+ {
+ int ct = 0;
+
+ if (hdr != NULL)
+ fprintf (fp, ">%s\n", hdr);
+
+ while (* s != '\0')
+ {
+ if (ct == fasta_width)
+ {
+ fputc ('\n', fp);
+ ct = 0;
+ }
+ fputc (* s, fp);
+ s ++;
+ ct ++;
+ }
+
+ fputc ('\n', fp);
+
+ return;
+ }
+
+
+
+void Fasta_Print_N
+ (FILE * fp, const char * s, int n, const char * hdr, int fasta_width)
+
+// Print first n bytes of string s in fasta format to fp .
+// Put string hdr on header line. Print at most fasta_width
+// characters per line.
+
+ {
+ int ct = 0, i;
+
+ if (hdr != NULL)
+ fprintf (fp, ">%s\n", hdr);
+
+ for (i = 0; i < n; i ++)
+ {
+ if (ct == fasta_width)
+ {
+ fputc ('\n', fp);
+ ct = 0;
+ }
+ fputc (s [i], fp);
+ ct ++;
+ }
+
+ fputc ('\n', fp);
+
+ return;
+ }
+
+
+
+void Fasta_Print_Skip
+ (FILE * fp, const char * s, const char * skip, const char * hdr,
+ int fasta_width)
+
+// Print string s in fasta format to fp but omit any characters
+// that occur in string skip . Put string hdr
+// on header line, unless it's NULL in which case do not print
+// a header line at all. Print at most fasta_width characters per
+// line.
+
+ {
+ int ct = 0;
+
+ if (hdr != NULL)
+ fprintf (fp, ">%s\n", hdr);
+
+ while (* s != '\0')
+ {
+ if (strchr (skip, * s) == NULL)
+ {
+ if (ct == fasta_width)
+ {
+ fputc ('\n', fp);
+ ct = 0;
+ }
+ fputc (* s, fp);
+ ct ++;
+ }
+ s ++;
+ }
+
+ fputc ('\n', fp);
+
+ return;
+ }
+
+
+
+bool Fasta_Qual_Read
+ (FILE * fp, string & q, string & hdr)
+
+// Read next fasta-like-format quality value sequence from
+// file fp (which must already be open) into string q
+// (encoded by adding the quality value to the MIN_QUALITY value).
+// Put the faster header line (without the '>' and trailing spaces) into
+// string hdr . Return true if a string is successfully,
+// read; false, otherwise.
+
+ {
+ bool have_value;
+ int ch, val;
+
+ q . erase ();
+ hdr . erase ();
+
+ // skip till next '>' if necessary
+ while ((ch = fgetc (fp)) != EOF && ch != '>')
+ ;
+
+ if (ch == EOF)
+ return false;
+
+ // skip spaces if any
+ while ((ch = fgetc (fp)) != EOF && ch == ' ')
+ ;
+ if (ch == EOF)
+ return false;
+ ungetc (ch, fp);
+
+ // put rest of line into hdr
+ while ((ch = fgetc (fp)) != EOF && ch != '\n')
+ hdr . push_back (char (ch));
+
+ // put all numbers up till next '>' into q
+ have_value = false;
+ val = 0;
+ while ((ch = fgetc (fp)) != EOF && ch != '>')
+ {
+ if (isspace (ch))
+ {
+ if (have_value)
+ q . push_back (char (val + AMOS::MIN_QUALITY));
+ have_value = false;
+ val = 0;
+ }
+ else if (isdigit (ch))
+ {
+ have_value = true;
+ val = 10 * val + ch - '0';
+ }
+ }
+
+ if (ch == '>')
+ ungetc (ch, fp);
+
+ return true;
+ }
+
+
+
+bool Fasta_Read
+ (FILE * fp, string & s, string & hdr)
+
+// Read next fasta-format string from file fp (which must
+// already be open) into string s . Put the faster
+// header line (without the '>' and trailing spaces) into
+// string hdr . Return true if a string is successfully,
+// read; false, otherwise.
+
+ {
+ int ch;
+
+ s . erase ();
+ hdr . erase ();
+
+ // skip till next '>' if necessary
+ while ((ch = fgetc (fp)) != EOF && ch != '>')
+ ;
+
+ if (ch == EOF)
+ return false;
+
+ // skip spaces if any
+ while ((ch = fgetc (fp)) != EOF && ch == ' ')
+ ;
+ if (ch == EOF)
+ return false;
+ ungetc (ch, fp);
+
+ // put rest of line into hdr
+ while ((ch = fgetc (fp)) != EOF && ch != '\n')
+ hdr . push_back (char (ch));
+
+ // put everything up till next '>' into s
+ while ((ch = fgetc (fp)) != EOF && ch != '>')
+ {
+ if (! isspace (ch))
+ s . push_back (char (ch));
+ }
+
+ if (ch == '>')
+ ungetc (ch, fp);
+
+ return true;
+ }
+
+
+
+void Reverse_Complement
+ (char * s)
+
+// Set string s to its DNA Watson-Crick reverse complement
+
+ {
+ int i, j, n;
+
+ n = strlen (s);
+ for (i = 0, j = n - 1; i < j; i ++, j --)
+ {
+ char ch;
+
+ ch = s [j];
+ s [j] = Complement (s [i]);
+ s [i] = Complement (ch);
+ }
+
+ if (i == j)
+ s [i] = Complement (s [i]);
+
+ return;
+ }
+
+
+
+void Reverse_Complement
+ (string & s)
+
+// Set string s to its DNA Watson-Crick reverse complement
+
+ {
+ int i, j, n;
+
+ n = s . length ();
+ for (i = 0, j = n - 1; i < j; i ++, j --)
+ {
+ char ch;
+
+ ch = s [j];
+ s [j] = Complement (s [i]);
+ s [i] = Complement (ch);
+ }
+
+ if (i == j)
+ s [i] = Complement (s [i]);
+
+ return;
+ }
+
+
+
+void Reverse_String
+ (char * s)
+
+// Reverse the order of characters in string s .
+
+ {
+ int i, j, n;
+
+ n = strlen (s);
+ for (i = 0, j = n - 1; i < j; i ++, j --)
+ {
+ char ch;
+
+ ch = s [i];
+ s [i] = s [j];
+ s [j] = ch;
+ }
+
+ return;
+ }
+
+
+
+void Reverse_String
+ (string & s)
+
+// Reverse the order of characters in string s .
+
+ {
+ int i, j, n;
+
+ n = s . length ();
+ for (i = 0, j = n - 1; i < j; i ++, j --)
+ {
+ char ch;
+
+ ch = s [i];
+ s [i] = s [j];
+ s [j] = ch;
+ }
+
+ return;
+ }
+
+
+
+int Fasta_Read_String (FILE * fp, char * & T, long int & Size, char Name [],
+ int Partial)
+
+/* Read next string from fp (assuming FASTA format) into T [1 ..]
+* which has Size characters. Allocate extra memory if needed
+* and adjust Size accordingly. Return TRUE if successful, FALSE
+* otherwise (e.g., EOF). Partial indicates if first line has
+* numbers indicating a subrange of characters to read.
+*/
+
+ {
+ const int max_line = 1024;
+ const int fasta_incr = 10000;
+
+ char * P, Line [max_line];
+ long int Len, Lo, Hi;
+ int Ch, Ct;
+
+ while ((Ch = fgetc (fp)) != EOF && Ch != '>')
+ ;
+
+ if (Ch == EOF)
+ return FALSE;
+
+ fgets (Line, max_line, fp);
+ Len = strlen (Line);
+ assert (Len > 0 && Line [Len - 1] == '\n');
+ P = strtok (Line, " \t\n");
+ if (P != NULL)
+ strcpy (Name, P);
+ else
+ Name [0] = '\0';
+ Lo = 0; Hi = LONG_MAX;
+ if (Partial)
+ {
+ P = strtok (NULL, " \t\n");
+ if (P != NULL)
+ {
+ Lo = strtol (P, NULL, 10);
+ P = strtok (NULL, " \t\n");
+ if (P != NULL)
+ Hi = strtol (P, NULL, 10);
+ }
+ assert (Lo <= Hi);
+ }
+
+ Ct = 0;
+ T [0] = '\0';
+ Len = 1;
+ while ((Ch = fgetc (fp)) != EOF && Ch != '>')
+ {
+ if (isspace (Ch))
+ continue;
+
+ Ct ++;
+ if (Ct < Lo || Ct > Hi)
+ continue;
+
+ if (Len >= Size)
+ {
+ Size += fasta_incr;
+ T = (char *) Safe_realloc (T, Size);
+ }
+ Ch = tolower (Ch);
+
+ if (! isalpha (Ch) && Ch != '*')
+ {
+ fprintf (stderr, "Unexpected character `%c\' in string %s\n",
+ Ch, Name);
+ Ch = 'x';
+ }
+
+ T [Len ++] = Ch;
+ }
+
+ T [Len] = '\0';
+ if (Ch == '>')
+ ungetc (Ch, fp);
+
+ return TRUE;
+ }
diff --git a/src/Common/fasta.hh b/src/Common/fasta.hh
new file mode 100644
index 0000000..ded885b
--- /dev/null
+++ b/src/Common/fasta.hh
@@ -0,0 +1,51 @@
+// A. L. Delcher
+//
+// File: fasta.h
+//
+// Last Modified: 25 November 2002
+//
+// Routines to manipulate FASTA format files
+
+
+#ifndef __FASTA_HH
+#define __FASTA_HH
+
+
+#include "delcher.hh"
+#include <string>
+#include <vector>
+#include <cstring>
+
+
+const int DEFAULT_FASTA_WIDTH = 60;
+ // Max number of characters to print on a FASTA data line
+
+
+char Complement
+ (char ch);
+void Fasta_Print
+ (FILE * fp, const char * s, const char * hdr = NULL,
+ int fasta_width = DEFAULT_FASTA_WIDTH);
+void Fasta_Print_N
+ (FILE * fp, const char * s, int n, const char * hdr = NULL,
+ int fasta_width = DEFAULT_FASTA_WIDTH);
+void Fasta_Print_Skip
+ (FILE * fp, const char * s, const char * skip, const char * hdr = NULL,
+ int fasta_width = DEFAULT_FASTA_WIDTH);
+bool Fasta_Qual_Read
+ (FILE * fp, std::string & q, std::string & hdr);
+bool Fasta_Read
+ (FILE * fp, std::string & s, std::string & hdr);
+void Reverse_Complement
+ (char * s);
+void Reverse_Complement
+ (std::string & s);
+void Reverse_String
+ (char * s);
+void Reverse_String
+ (std::string & s);
+
+int Fasta_Read_String (FILE *, char * &, long int &, char [], int);
+
+
+#endif // #ifndef __FASTA_HH
diff --git a/src/Common/fastq.cc b/src/Common/fastq.cc
new file mode 100644
index 0000000..6aaf5c8
--- /dev/null
+++ b/src/Common/fastq.cc
@@ -0,0 +1,92 @@
+// Daniel Sommer
+//
+// - FasqOffset[qualType] File: fastq.cc
+//
+// Last Modified: April 2011
+//
+// Routines to manipulate FASTQ format files
+
+#include "exceptions_AMOS.hh"
+#include "inttypes_AMOS.hh"
+#include "fastq.hh"
+using namespace std;
+
+static const char FastqOffset[] = {'@', '!'};
+
+bool Fastq_Read(FILE * fp, string & s, string & hdr, string & q, string & qualHdr, FastqQualType qualType)
+// Read next fastq-format string from file fp (which must
+// already be open) into string s . Put the fasta header line into
+// string hdr . Return true if a string is successfully,
+// read; false, otherwise.
+
+ {
+ int ch, val;
+
+ s.erase();
+ hdr.erase();
+ q.erase();
+ qualHdr.erase();
+
+ // skip till next '@' if necessary
+ while ((ch = fgetc (fp)) != EOF && ch != '@')
+ ;
+
+ if (ch == EOF)
+ return false;
+
+ // skip spaces if any
+ while ((ch = fgetc (fp)) != EOF && ch == ' ')
+ ;
+ if (ch == EOF)
+ return false;
+ ungetc(ch, fp);
+
+ // put rest of line into hdr
+ while ((ch = fgetc (fp)) != EOF && ch != '\n')
+ hdr.push_back (char (ch));
+
+ // put everything up till '+' into s
+ while(( ch = fgetc(fp) ) != EOF && ch != '\n')
+ {
+ if (! isspace(ch))
+ s.push_back(char (ch));
+ }
+
+ if (ch == EOF)
+ return false;
+
+ // skip spaces if any
+ while ((ch = fgetc (fp)) != EOF && ch == ' ')
+ ;
+
+ ungetc (ch, fp);
+
+ // put rest of line into hdr
+ while ((ch = fgetc (fp)) != EOF && ch != '\n')
+ qualHdr.push_back (char (ch));
+
+ // put all numbers up till newline into q
+ while((ch = fgetc(fp)) != EOF && ch != '\n')
+ {
+ // check of errors
+ int qlVal = (int)ch;
+ qlVal -= (int) FastqOffset[qualType];
+ int maxQlt = (int)AMOS::MAX_QUALITY - (int)AMOS::MIN_QUALITY;
+ if (qlVal < 0) {
+ sprintf (Clean_Exit_Msg_Line,
+ "Failed: invalid quality value too low %c %d. Please check quality type\n", ch, qlVal);
+ throw AMOS::Exception_t(Clean_Exit_Msg_Line, __LINE__, __FILE__);
+ } else if (qlVal > maxQlt) {
+ ch = FastqOffset[qualType] + AMOS::MAX_QUALITY;
+ }
+ q.push_back(char (ch - FastqOffset[qualType] + AMOS::MIN_QUALITY));
+ }
+
+
+ return true;
+ }
+
+
+
+
+
diff --git a/src/Common/fastq.hh b/src/Common/fastq.hh
new file mode 100644
index 0000000..5e08859
--- /dev/null
+++ b/src/Common/fastq.hh
@@ -0,0 +1,31 @@
+// Daniel Sommer
+//
+// File: fastq.h
+//
+// Last Modified: April 2011
+//
+// Routines to manipulate FASTQ format files
+
+
+#ifndef __FASTQ_HH
+#define __FASTQ_HH
+
+
+#include "delcher.hh"
+#include "inttypes_AMOS.hh"
+#include <string>
+#include <vector>
+#include <cstring>
+
+
+const int DEFAULT_FASTQ_WIDTH = 60;
+ // Max number of characters to print on a FASTA data line
+
+enum FastqQualType {ILLUMINA, SANGER};
+const std::string FASTQ_QUALITY_NAMES[] = {"ILLUMINA", "SANGER"};
+const uint32_t FASTQ_QUALITY_COUNT = 2;
+const FastqQualType FASTQ_DEFAULT_QUALITY_TYPE = SANGER;
+
+bool Fastq_Read(FILE * fp, std::string & s, std::string & hdr, std::string & q, std::string & qualHdr, FastqQualType qualType = FASTQ_DEFAULT_QUALITY_TYPE);
+
+#endif // #ifndef __FASTQ_HH
diff --git a/src/Common/prob.cc b/src/Common/prob.cc
new file mode 100644
index 0000000..68e86a9
--- /dev/null
+++ b/src/Common/prob.cc
@@ -0,0 +1,101 @@
+// A. L. Delcher
+//
+// File: prob.cc
+//
+// Last Modified: 30 December 2002
+//
+// Routines to do probability things
+
+
+
+#include "prob.hh"
+
+
+
+int Binomial_Cutoff
+ (int n, double p, double e_prob)
+
+// Return k such that the probability of >= k successes in
+// n trials is < e_prob , where p is the probability
+// of success of each trial.
+
+ {
+ double lambda, target, sum, term, q;
+ int i;
+
+ if (n <= 0)
+ {
+ sprintf (Clean_Exit_Msg_Line, "ERROR: n = %d <= 0", n);
+ Clean_Exit (Clean_Exit_Msg_Line, __FILE__, __LINE__);
+ }
+
+ lambda = n * p;
+ q = 1.0 - p;
+
+ if (Verbose > 3)
+ fprintf (stderr, "Binomial Cutoff: n = %d p = %e lambda = %e\n",
+ n, p, lambda);
+
+ if (n >= 30.0)
+ {
+ if (lambda <= 5.0)
+ {
+ // use Poisson approximation
+ if (Verbose > 4)
+ fprintf (stderr, "Binomial Cutoff: using Poisson approximation\n");
+
+ target = (1.0 - e_prob) * exp (lambda);
+ sum = term = 1.0;
+ for (i = 1; sum <= target && i < 50; i ++)
+ {
+ term = term * lambda / (double) i;
+ sum += term;
+ }
+
+ if (sum <= target)
+ fprintf (stderr, "Binomial Cutoff: sum <= target... Is this a problem?\n");
+
+ }
+ else // lambda > 5.0
+ {
+ // use Normal approximation
+ if (Verbose > 4)
+ fprintf (stderr, "Binomial Cutoff: using Normal approximation\n");
+
+ double t, x, y;
+
+ if (e_prob <= 0.5)
+ t = sqrt (- 2.0 * log (e_prob));
+ else
+ t = sqrt (- 2.0 * log ((1.0 - e_prob)));
+
+ y = t - (((0.010328 * t + 0.802853) * t + 2.515517)
+ /
+ (((0.001308 * t + 0.189269) * t + 1.432788) * t + 1.0));
+
+ if (e_prob <= 0.5)
+ x = y;
+ else
+ x = -y;
+
+ i = int (ceil (x * sqrt (lambda * q) + lambda));
+ }
+ }
+ else
+ {
+ // brute force
+ if (Verbose > 4)
+ fprintf (stderr, "Binomial Cutoff: using brute force method\n");
+
+ target = 1.0 - e_prob;
+ sum = term = pow (q, n);
+ for (i = 1; sum <= target && i < n; i ++)
+ {
+ term *= double (n + 1 - i) / i;
+ term *= p / q;
+ sum += term;
+ }
+ }
+ return i;
+ }
+
diff --git a/src/Common/prob.hh b/src/Common/prob.hh
new file mode 100644
index 0000000..60e7b12
--- /dev/null
+++ b/src/Common/prob.hh
@@ -0,0 +1,23 @@
+// A. L. Delcher
+//
+// File: prob.h
+//
+// Last Modified: 30 December 2002
+//
+// Routines to do probability things
+
+
+#ifndef __PROB_HH
+#define __PROB_HH
+
+
+#include "delcher.hh"
+
+
+
+int Binomial_Cutoff
+ (int n, double p, double e_prob);
+
+
+
+#endif // #ifndef __PROB_HH
diff --git a/src/Compare/Makefile.am b/src/Compare/Makefile.am
new file mode 100644
index 0000000..f1b8b32
--- /dev/null
+++ b/src/Compare/Makefile.am
@@ -0,0 +1,22 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+##-- TO BE INSTALLED
+bin_PROGRAMS = \
+ contig-cmp
+
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common
+
+
+##-- contig-cmp
+contig_cmp_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+contig_cmp_SOURCES = \
+ contig-cmp.cc
+
+
+##-- END OF MAKEFILE --##
\ No newline at end of file
diff --git a/src/Compare/Makefile.in b/src/Compare/Makefile.in
new file mode 100644
index 0000000..cc0d144
--- /dev/null
+++ b/src/Compare/Makefile.in
@@ -0,0 +1,564 @@
+# 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 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@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = contig-cmp$(EXEEXT)
+subdir = src/Compare
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_contig_cmp_OBJECTS = contig-cmp.$(OBJEXT)
+contig_cmp_OBJECTS = $(am_contig_cmp_OBJECTS)
+contig_cmp_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(contig_cmp_SOURCES)
+DIST_SOURCES = $(contig_cmp_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common
+
+contig_cmp_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a
+
+contig_cmp_SOURCES = \
+ contig-cmp.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Compare/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Compare/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):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+contig-cmp$(EXEEXT): $(contig_cmp_OBJECTS) $(contig_cmp_DEPENDENCIES)
+ @rm -f contig-cmp$(EXEEXT)
+ $(CXXLINK) $(contig_cmp_OBJECTS) $(contig_cmp_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/contig-cmp.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+
+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 $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-binPROGRAMS clean-generic 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-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ 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-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Compare/contig-cmp.cc b/src/Compare/contig-cmp.cc
new file mode 100644
index 0000000..6d9804e
--- /dev/null
+++ b/src/Compare/contig-cmp.cc
@@ -0,0 +1,588 @@
+// A. L. Delcher
+//
+// File: contig-cmp.cc
+//
+// Last Modified: 7 January 2003
+//
+// Compare contigs based on the list of fragments in each
+
+
+#include "delcher.hh"
+#include <vector>
+#include <algorithm>
+using namespace std;
+
+
+struct Unitig_t
+ {
+ unsigned sub : 30;
+ // subscript of containing contig if there is only one;
+ // otherwise, subscript of Overflow list of multiple contigs
+ unsigned status : 2;
+ // 0 means empty; 1 means only one contig; 2 means
+ // use Overflow list of contigs
+
+ Unitig_t () // default constructor
+ {
+ status = 0;
+ }
+ };
+
+struct Compare_t
+ {
+ int a_sub, b_sub;
+ int a_only, b_only, both;
+
+ void Clear
+ (void)
+ {
+ a_only = b_only = both = 0;
+ }
+ };
+
+struct Contig_t
+ {
+ char * id;
+ vector <int> list;
+ // of unitigs contained in it
+ vector <bool> matched;
+ int unmatched;
+ };
+
+
+
+static vector < vector <int> > Overflow;
+ // Lists of contigs for unitigs that are contained in
+ // multiple contigs
+
+
+
+static void Compare_Lists
+ (Contig_t & a, Contig_t & b, Compare_t & cmp);
+static void Make_Intersecting_Contig_List
+ (vector <int> & v, const vector <int> & u_list,
+ const vector <Unitig_t> & contig, int max_id);
+static void Usage
+ (const char * command);
+
+
+
+int main
+ (int argc, char * argv [])
+
+ {
+ vector <Compare_t> exact;
+ vector <Compare_t> close;
+ vector <Compare_t> contained;
+ vector <Compare_t> all_unmatched;
+ vector < vector <Compare_t> > other;
+ vector <Contig_t> a, b;
+ vector <int> v;
+ Compare_t cmp, save;
+ vector <Compare_t> cmp_list;
+ Contig_t con;
+ char * p;
+ char line [50000];
+ FILE * fp;
+ int total_a_frags = 0, total_b_frags = 0;
+ int total_a_unmatched = 0, total_b_unmatched = 0;
+ int aun, bun, bother, ct;
+ int max_id;
+ int i, j, k, m, n, num;
+
+ fprintf (stderr, "Starting on %s at %s\n", __DATE__, __TIME__);
+
+ Verbose = 3;
+
+ if (argc < 3)
+ {
+ Usage (argv [0]);
+ exit (EXIT_FAILURE);
+ }
+
+ // read contigs from file a
+ fp = File_Open (argv [1], "r");
+
+ max_id = 0;
+ while (fgets (line, 50000, fp) != NULL)
+ {
+ con . list . clear ();
+ con . matched . clear ();
+
+ p = strtok (line, " \t\n");
+ con . id = strdup (p);
+
+ p = strtok (NULL, " \t\n");
+ n = strtol (p, NULL, 10);
+
+ for (i = 0; i < n; i ++)
+ {
+ p = strtok (NULL, " \t\n");
+ num = strtol (p, NULL, 10);
+ con . list . push_back (num);
+ if (num > max_id)
+ max_id = num;
+ }
+
+ sort (con . list . begin (), con . list . end ());
+ m = con . list . size ();
+ for (i = k = 1; i < m; i ++)
+ if (con . list [i] != con . list [i - 1])
+ {
+ if (i != k)
+ con . list [k] = con . list [i];
+ k ++;
+ }
+ for ( ; k < m; k ++)
+ con . list . pop_back ();
+ m = con . list . size ();
+ for (i = 0; i < m; i ++)
+ con . matched . push_back (false);
+
+ con . unmatched = 0;
+ a . push_back (con);
+ }
+
+ fclose (fp);
+
+ fprintf (stderr, "%u a contigs\n", a . size ());
+ vector <Unitig_t> a_contig (max_id + 1);
+ n = a . size ();
+ for (i = 0; i < n; i ++)
+ {
+ m = a [i] . list . size ();
+ for (j = 0; j < m; j ++)
+ {
+ int u = a [i] . list [j];
+
+ switch (a_contig [u] . status)
+ {
+ case 0 :
+ a_contig [u] . sub = i;
+ a_contig [u] . status = 1;
+ break;
+ case 1 :
+ v . clear ();
+ v . push_back (a_contig [u] . sub);
+ v . push_back (i);
+ a_contig [u] . sub = Overflow . size ();
+ Overflow . push_back (v);
+ a_contig [u] . status = 2;
+ break;
+ case 2 :
+ Overflow [a_contig [u] . sub] . push_back (i);
+ break;
+ default :
+ assert (0);
+ }
+ }
+ }
+ for (i = 1; i <= max_id; i ++)
+ if (a_contig [i] . status == 2)
+ {
+ fprintf (stderr, "%7d in", i);
+ k = a_contig [i] . sub;
+ m = Overflow [k] . size ();
+ for (j = 0; j < m; j ++)
+ fprintf (stderr, " %7d", Overflow [k] [j]);
+ fprintf (stderr, "\n");
+ }
+
+
+ // read contigs from file b
+ fp = File_Open (argv [2], "r");
+
+ max_id = 0;
+ while (fgets (line, 50000, fp) != NULL)
+ {
+ con . list . clear ();
+ con . matched . clear ();
+
+ p = strtok (line, " \t\n");
+ con . id = strdup (p);
+
+ p = strtok (NULL, " \t\n");
+ n = strtol (p, NULL, 10);
+
+ for (i = 0; i < n; i ++)
+ {
+ p = strtok (NULL, " \t\n");
+ num = strtol (p, NULL, 10);
+ con . list . push_back (num);
+ if (num > max_id)
+ max_id = num;
+ }
+
+ sort (con . list . begin (), con . list . end ());
+ m = con . list . size ();
+ for (i = k = 1; i < m; i ++)
+ if (con . list [i] != con . list [i - 1])
+ {
+ if (i != k)
+ con . list [k] = con . list [i];
+ k ++;
+ }
+ for ( ; k < m; k ++)
+ con . list . pop_back ();
+ m = con . list . size ();
+ for (i = 0; i < m; i ++)
+ con . matched . push_back (false);
+
+ con . unmatched = 0;
+ b . push_back (con);
+ }
+
+ fclose (fp);
+
+ fprintf (stderr, "%u b contigs\n", b . size ());
+ vector <Unitig_t> b_contig (max_id + 1);
+ n = b . size ();
+ for (i = 0; i < n; i ++)
+ {
+ m = b [i] . list . size ();
+ for (j = 0; j < m; j ++)
+ {
+ int u = b [i] . list [j];
+
+ switch (b_contig [u] . status)
+ {
+ case 0 :
+ b_contig [u] . sub = i;
+ b_contig [u] . status = 1;
+ break;
+ case 1 :
+ v . clear ();
+ v . push_back (b_contig [u] . sub);
+ v . push_back (i);
+ b_contig [u] . sub = Overflow . size ();
+ Overflow . push_back (v);
+ b_contig [u] . status = 2;
+ break;
+ case 2 :
+ Overflow [b_contig [u] . sub] . push_back (i);
+ break;
+ default :
+ assert (0);
+ }
+ }
+ }
+ for (i = 1; i <= max_id; i ++)
+ if (b_contig [i] . status == 2)
+ {
+ fprintf (stderr, "%7d in", i);
+ k = b_contig [i] . sub;
+ m = Overflow [k] . size ();
+ for (j = 0; j < m; j ++)
+ fprintf (stderr, " %7d", Overflow [k] [j]);
+ fprintf (stderr, "\n");
+ }
+
+
+ // compare contigs
+ m = a . size ();
+ n = b . size ();
+
+
+ // first get unmatched counts
+ for (i = 0; i < m; i ++)
+ {
+ assert (a [i] . list . size () == a [i] . matched . size ());
+
+ Make_Intersecting_Contig_List (v, a [i] . list, b_contig, max_id);
+
+ k = v . size ();
+ for (j = 0; j < k; j ++)
+ Compare_Lists (a [i], b [v [j]], cmp);
+
+ k = a [i] . matched . size ();
+ for (j = 0; j < k; j ++)
+ if (! a [i] . matched [j])
+ a [i] . unmatched ++;
+ total_a_unmatched += a [i] . unmatched;
+ total_a_frags += a [i] . list . size ();
+ }
+
+ for (j = 0; j < n; j ++)
+ {
+ k = b [j] . matched . size ();
+ for (i = 0; i < k; i ++)
+ if (! b [j] . matched [i])
+ b [j] . unmatched ++;
+ total_b_unmatched += b [j] . unmatched;
+ total_b_frags += b [j] . list . size ();
+ }
+
+ fprintf (stderr, "total_a_unmatched = %d\n", total_a_unmatched);
+ fprintf (stderr, "total_b_unmatched = %d\n", total_b_unmatched);
+
+
+ // re-do comparisons to get the other matches
+ for (i = 0; i < m; i ++)
+ {
+ cmp . a_sub = i;
+ save = cmp;
+ cmp_list . clear ();
+
+ Make_Intersecting_Contig_List (v, a [i] . list, b_contig, max_id);
+
+ k = v . size ();
+ for (j = 0; j < k; j ++)
+ {
+ Compare_Lists (a [i], b [v [j]], cmp);
+
+ if (cmp . both > 0)
+ {
+ cmp . b_sub = v [j];
+ cmp_list . push_back (cmp);
+ save = cmp;
+ }
+ else
+ fprintf (stderr, "cmp . both == 0 for i = %d v [j] = %d\n",
+ i, v [j]);
+ }
+
+ if (cmp_list . size () == 0)
+ {
+ save . a_only = a [i] . unmatched;
+ all_unmatched . push_back (save);
+ }
+ else if (cmp_list . size () == 1)
+ {
+ assert (save . a_only == a [i] . unmatched);
+ if (save . b_only == 0 && save . a_only == 0)
+ exact . push_back (save);
+ else if (b [save . b_sub] . unmatched == save . b_only)
+ close . push_back (save);
+ else
+ contained . push_back (save);
+ }
+ else
+ other . push_back (cmp_list);
+ }
+
+ printf ("\n%-25s %6s\n", "Exact Matches:", "match");
+ n = exact . size ();
+ ct = 0;
+ for (i = 0; i < n; i ++)
+ {
+ printf ("%12s %12s %6d\n", a [exact [i] . a_sub] . id,
+ b [exact [i] . b_sub] . id, exact [i] . both);
+ ct += exact [i] . both;
+ }
+ printf ("Contigs = %d match = %d\n", n, ct);
+
+ printf ("\n%-25s %6s %6s %6s\n", "Close Matches:", "match", "Aunmat", "Bunmat");
+ n = close . size ();
+ aun = bun = ct = 0;
+ for (i = 0; i < n; i ++)
+ {
+ printf ("%12s %12s %6d %6d %6d\n",
+ a [close [i] . a_sub] . id, b [close [i] . b_sub] . id,
+ close [i] . both, close [i] . a_only, close [i] . b_only);
+ ct += close [i] . both;
+ aun += close [i] . a_only;
+ bun += close [i] . b_only;
+ }
+ printf ("Contigs = %d match = %d Aunmat = %d Bunmat = %d tot = %d\n",
+ n, ct, aun, bun, ct + aun + bun);
+
+ printf ("\n%-25s %6s %6s %6s %6s\n", "Contained Matches:", "match", "Aunmat",
+ "Bother", "Bunmat");
+ n = contained . size ();
+ aun = bun = bother = ct = 0;
+ for (i = 0; i < n; i ++)
+ {
+ j = contained [i] . b_sub;
+ printf ("%12s %12s %6d %6d %6d %6d\n",
+ a [contained [i] . a_sub] . id, b [contained [i] . b_sub] . id,
+ contained [i] . both, contained [i] . a_only,
+ contained [i] . b_only - b [j] . unmatched,
+ b [j] . unmatched);
+ ct += contained [i] . both;
+ aun += contained [i] . a_only;
+ bother += contained [i] . b_only - b [j] . unmatched;
+ bun += b [j] . unmatched;
+ }
+ printf ("Contigs = %d match = %d Aun = %d Bother = %d Bun = %d tot = %d\n",
+ n, ct, aun, bother, bun, ct + aun + bother + bun);
+
+ printf ("\n%-14s %6s\n", "All Unmatched:", "frags");
+ n = all_unmatched . size ();
+ ct = 0;
+ for (i = 0; i < n; i ++)
+ {
+ printf ("%14s %6d\n", a [all_unmatched [i] . a_sub] . id,
+ all_unmatched [i] . a_only);
+ ct += all_unmatched [i] . a_only;
+ }
+ printf ("Contigs = %d Frags = %d\n", n, ct);
+
+ printf ("\n%-18s %6s %6s %6s\n", "Other Matches:", "match",
+ "Bother", "Bunmat");
+ n = other . size ();
+ ct = 0;
+ for (i = 0; i < n; i ++)
+ {
+ int q;
+
+ q = other [i] [0] . a_sub;
+ printf ("%s:\n", a [q] . id);
+ m = other [i] . size ();
+ for (j = 0; j < m; j ++)
+ {
+ int k;
+
+ k = other [i] [j] . b_sub;
+ printf ("%18s %6d %6d %6d\n", b [k] . id,
+ other [i] [j] . both,
+ other [i] [j] . b_only - b [k] . unmatched,
+ b [k] . unmatched);
+ ct += other [i] [j] . both;
+
+ }
+ if (a [q] . unmatched > 0)
+ {
+ printf ("%18s %6d\n", "unmatched", a [q] . unmatched);
+ ct += a [q] . unmatched;
+ }
+ }
+ printf ("Contigs = %d Frags = %d\n", n, ct);
+
+
+ printf ("\nTotal A contigs = %d\n", int (a . size ()));
+ printf ("Total A frags = %d\n", total_a_frags);
+ printf ("Total B contigs = %d\n", int (b . size ()));
+ printf ("Total B frags = %d\n", total_b_frags);
+ printf ("Total A unmatched = %d\n", total_a_unmatched);
+ printf ("Total B unmatched = %d\n", total_b_unmatched);
+
+ fprintf (stderr, "Finished on %s at %s\n", __DATE__, __TIME__);
+
+ return 0;
+ }
+
+
+
+static void Compare_Lists
+ (Contig_t & a, Contig_t & b, Compare_t & cmp)
+
+// Compare contents of lists in a and b and save in
+// cmp the number of entries that are in a only, b only,
+// and in both. Also mark entries in a and b that are
+// matched.
+
+ {
+ int i, j, m, n;
+
+ m = a . list . size ();
+ n = b . list . size ();
+
+ cmp . Clear ();
+
+ i = j = 0;
+ while (i < m && j < n)
+ {
+ if (a . list [i] < b . list [j])
+ {
+ cmp . a_only ++;
+ i ++;
+ }
+ else if (b . list [j] < a . list [i])
+ {
+ cmp . b_only ++;
+ j ++;
+ }
+ else
+ {
+ cmp . both ++;
+ a . matched [i] = b . matched [j] = true;
+ i ++;
+ j ++;
+ }
+ }
+ while (i < m)
+ {
+ cmp . a_only ++;
+ i ++;
+ }
+ while (j < n)
+ {
+ cmp . b_only ++;
+ j ++;
+ }
+
+ return;
+ }
+
+
+
+static void Make_Intersecting_Contig_List
+ (vector <int> & v, const vector <int> & u_list,
+ const vector <Unitig_t> & contig, int max_id)
+
+// Make list v contain the subscripts of all the contigs
+// that unitigs in u_list belong to, using the information
+// in contig to find those contigs. max_id is the highest
+// subscript in contig .
+
+ {
+ vector <int> c_list;
+ int i, n, ct;
+
+ v . clear ();
+ ct = 0;
+
+ n = u_list . size ();
+ for (i = 0; i < n; i ++)
+ {
+ int j, k, m, u;
+
+ u = u_list [i];
+ if (u > max_id || contig [u] . status == 0)
+ continue;
+ c_list . clear ();
+ if (contig [u] . status == 1)
+ c_list . push_back (contig [u] . sub);
+ else
+ c_list = Overflow [contig [u] . sub];
+
+ m = c_list . size ();
+ for (k = 0; k < m; k ++)
+ {
+ for (j = 0; j < ct && c_list [k] != v [j]; j ++)
+ ;
+
+ if (j == ct)
+ {
+ v . push_back (c_list [k]);
+ ct ++;
+ }
+ }
+ }
+
+ return;
+ }
+
+
+
+static void Usage
+ (const char * command)
+
+// Print to stderr description of options and command line for
+// this program. command is the command that was used to
+// invoke it.
+
+ {
+ fprintf (stderr,
+ "USAGE: %s <a-file> <b-file>\n"
+ "\n"
+ "Compare contigs in file <a-file> with those in <b-file>\n"
+ "by comparing their lists of fragments\n"
+ "\n"
+ "Options:\n"
+ " none\n"
+ "\n",
+ command);
+
+ return;
+ }
diff --git a/src/Contig/ContigUtils.cc b/src/Contig/ContigUtils.cc
new file mode 100644
index 0000000..28c2769
--- /dev/null
+++ b/src/Contig/ContigUtils.cc
@@ -0,0 +1,955 @@
+#include "ContigUtils.hh"
+
+using namespace std;
+using namespace AMOS;
+
+// Trim 'lefttrim' bases from a contig by trimming the consensus and then
+// adjusting the offset and clear range of the tiling reads, or by
+// dropping the read entirely from the multiple alignment
+void leftTrimContig(Contig_t & contig, int lefttrim)
+{
+ string cons = contig.getSeqString();
+ string cqual = contig.getQualString();
+
+ cerr << "Left Trimming " << lefttrim << " bases from consensus length of " << cons.length() << endl;
+
+ cons.erase(0, lefttrim);
+ cqual.erase(0, lefttrim);
+
+ contig.setSequence(cons,cqual);
+
+ int curread = 0;
+ int tilecount = 0;
+ vector<Tile_t> & tiling = contig.getReadTiling();
+
+ for (curread = 0; curread < tiling.size(); curread++)
+ {
+ if (tiling[curread].getRightOffset() >= lefttrim)
+ {
+ // This read should exist in the new tiling
+ tiling[curread].offset -= lefttrim;
+
+ if (tiling[curread].offset < 0)
+ {
+ // fix range and gaps
+ int trim = -tiling[curread].offset;
+ tiling[curread].offset = 0;
+
+ vector<Pos_t> & gaps = tiling[curread].gaps;
+ int curgap = 0;
+ int gapstodrop = 0;
+ int gapstokeep = 0;
+
+ for (curgap = 0; curgap < gaps.size(); curgap++)
+ {
+ if (gaps[curgap] + curgap < trim) { gapstodrop++; }
+ else
+ {
+ gaps[gapstokeep] = gaps[curgap]-(trim-gapstodrop);
+ gapstokeep++;
+ }
+ }
+
+ gaps.resize(gapstokeep);
+
+ if (tiling[curread].range.isReverse())
+ {
+ tiling[curread].range.begin -= (trim - gapstodrop);
+ }
+ else
+ {
+ tiling[curread].range.begin += (trim - gapstodrop);
+ }
+ }
+
+ tiling[tilecount] = tiling[curread];
+ tilecount++;
+ }
+ }
+
+ tiling.resize(tilecount);
+}
+
+
+// Right trim the contig to the new length
+void lengthTrimContig(Contig_t & contig, int newlength)
+{
+ string cons = contig.getSeqString();
+ string cqual = contig.getQualString();
+
+ int righttrim = cons.length() - newlength;
+
+ cerr << "Right Trimming " << righttrim << " bases from " << cons.length() << endl;
+
+ cons.resize(newlength);
+ cqual.resize(newlength);
+
+ contig.setSequence(cons,cqual);
+
+ int curread = 0;
+ int tilecount = 0;
+ vector<Tile_t> & tiling = contig.getReadTiling();
+
+ for (curread = 0; curread < tiling.size(); curread++)
+ {
+ if (tiling[curread].offset < newlength)
+ {
+ // This read should exist in the new tiling
+
+ if (tiling[curread].getRightOffset() >= newlength)
+ {
+ // This read extends beyond new width
+ // fix range and gaps
+ int trim = tiling[curread].getRightOffset() - newlength + 1;
+ int last = newlength - 1 - tiling[curread].offset;
+
+ vector<Pos_t> & gaps = tiling[curread].gaps;
+ int curgap = 0;
+ int gapstodrop = 0;
+ int gapstokeep = 0;
+
+ for (curgap = 0; curgap < gaps.size(); curgap++)
+ {
+ if (gaps[curgap] + curgap > last) { gapstodrop++; }
+ else
+ {
+ gaps[gapstokeep] = gaps[curgap];
+ gapstokeep++;
+ }
+ }
+
+ gaps.resize(gapstokeep);
+
+ if (tiling[curread].range.isReverse())
+ {
+ tiling[curread].range.end += (trim - gapstodrop);
+ }
+ else
+ {
+ tiling[curread].range.end -= (trim - gapstodrop);
+ }
+ }
+
+ tiling[tilecount] = tiling[curread];
+ tilecount++;
+ }
+ }
+
+ tiling.resize(tilecount);
+}
+
+// Trim 'righttrim' bases from a contig by trimming the last righttrim bases
+// from the consensus, and then adjusting the clear range of the tiling
+// reads, or by dropping them entirely from the contig.
+void rightTrimContig(Contig_t & contig, int righttrim)
+{
+ int clen = contig.getLength();
+
+ lengthTrimContig(contig, clen-righttrim);
+}
+
+
+// Slide the tiling to the right by contigShiftDistance, insert - into
+// the consensus
+void shiftContigRight(Contig_t & contig, int contigShiftDistance)
+{
+ string cons = contig.getSeqString();
+ string cqual = contig.getQualString();
+
+ cons.insert(cons.begin(), contigShiftDistance, '-');
+ cqual.insert(cqual.begin(), contigShiftDistance, 'X');
+
+ contig.setSequence(cons, cqual);
+
+ vector<Tile_t>::iterator ti;
+ for (ti = contig.getReadTiling().begin();
+ ti != contig.getReadTiling().end();
+ ti++)
+ {
+ ti->offset += contigShiftDistance;
+ }
+}
+
+// Add contigGrowDistance gaps to the consensus
+void widenContig(Contig_t & contig, int contigGrowDistance)
+{
+ string cons = contig.getSeqString();
+ string cqual = contig.getQualString();
+
+ cons.append(contigGrowDistance, '-');
+ cqual.append(contigGrowDistance, 'X');
+
+ contig.setSequence(cons, cqual);
+}
+
+
+
+
+
+
+ID_t lookupIID(Bank_t & bnk, const string & eid)
+{
+ ID_t retval = bnk.lookupIID(eid);
+
+ if (!retval)
+ {
+ cerr << "EID " << eid << " not found!" << endl;
+ throw Exception_t("Invalid eid", __LINE__, __FILE__);
+ }
+
+ return retval;
+}
+
+void checkClr(vector<Tile_t>::iterator & mti, vector<Tile_t>::iterator & pti, const string & side)
+{
+ if (mti->range != pti->range)
+ {
+ cerr << "Clear range of " << side << " stitch read differs!!!" << endl;
+ cerr << "master: " << mti->range.begin << "," << mti->range.end << endl;
+ cerr << "patch: " << pti->range.begin << "," << pti->range.end << endl;
+
+ throw Exception_t("ERROR", __LINE__, __FILE__);
+ }
+}
+
+void checkCons(const string & mc, const string & pc, const string & side)
+{
+ if (mc != pc)
+ {
+ cerr << side << " stitch consensus mismatch!" << endl;
+ cerr << "pc: " << pc << endl;
+ cerr << "mc: " << mc << endl;
+
+ throw Exception_t("Stitch consensus mismatch", __LINE__, __FILE__);
+ }
+
+ cerr << " " << side << " stitch consensus match (len = " << mc.length() << ")" << endl;
+}
+
+
+void reverseContig(AMOS::Bank_t & contig_bank,
+ AMOS::Bank_t & scaffold_bank,
+ AMOS::BankStream_t & feat_bank,
+ AMOS::ID_t contigiid)
+{
+ Contig_t contig;
+ contig_bank.fetch(contigiid, contig);
+ contig.reverseComplement();
+ contig_bank.replace(contigiid, contig);
+
+ int contiglen = contig.getLength();
+
+ try
+ {
+ // try to reverse the contig in the scaffold as well
+ Scaffold_t scaffold;
+ bool done = false;
+
+ AMOS::IDMap_t::const_iterator ci;
+ for (ci = scaffold_bank.getIDMap().begin();
+ ci && !done;
+ ci++)
+ {
+ scaffold_bank.fetch(ci->iid, scaffold);
+
+ vector<Tile_t> & tiling = scaffold.getContigTiling();
+ vector<Tile_t>::iterator ti;
+
+ for (ti = tiling.begin();
+ ti != tiling.end();
+ ti++)
+ {
+ if (ti->source == contigiid)
+ {
+ ti->range.swap();
+
+ scaffold_bank.replace(scaffold.getIID(), scaffold);
+ cout << "Updated scaffold i" << scaffold.getIID() << endl;
+ done = true;
+ break;
+ }
+ }
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "WARNING: Scaffold not updated!" << endl;
+ cerr << e << endl;
+ }
+
+ try
+ {
+ Feature_t feat;
+
+ cout << "Reversing features:";
+
+ feat_bank.seekg(1);
+ while (feat_bank >> feat)
+ {
+ ID_t bid = feat_bank.tellg() - 1;
+ if ((feat.getSource().second == Contig_t::NCODE) &&
+ (feat.getSource().first == contigiid))
+ {
+ Range_t rng = feat.getRange();
+ rng.begin = contiglen - rng.begin - 1;
+ rng.end = contiglen - rng.end - 1;
+ feat.setRange(rng);
+
+ feat_bank.replaceByBID(bid, feat);
+ cout << ".";
+ }
+ }
+
+ cout << endl;
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "WARNING: Features not updated!" << endl;
+ cerr << e << endl;
+ }
+}
+
+
+void updateStitchFeatures(BankStream_t & master_feat,
+ BankStream_t & patch_feat,
+ Range_t & stitchRegion,
+ ID_t masteriid,
+ bool masterrc,
+ ID_t master2iid,
+ bool master2rc,
+ ID_t newmasteriid,
+ ID_t patchiid,
+ const string & leftstitchread,
+ const string & rightstitchread,
+ int rightmasterbaseoffset,
+ int oldmasterlen,
+ int newmasterlen,
+ int oldmaster2len,
+ int patchleftoffset,
+ int patchrightoffset,
+ bool savetonew)
+{
+ // Update the features, and add a new one about the join
+ cerr << "Updating features: ";
+ vector<Feature_t> newfeatures;
+
+ Feature_t feat;
+ feat.setRange(stitchRegion);
+ feat.setSource(make_pair(newmasteriid, Contig_t::NCODE));
+ feat.setType(Feature_t::JOIN);
+
+ char buffer[16];
+ snprintf(buffer, 16, "%d", patchiid);
+ feat.setComment((string) "Stitch from patch i:" + buffer + " left: " + leftstitchread + " right: " + rightstitchread);
+ newfeatures.push_back(feat);
+
+ cerr << "n";
+
+ master_feat.seekg(1);
+ while (master_feat >> feat)
+ {
+ ID_t bid = master_feat.tellg()-1;
+ bool change = false;
+ bool remove = false;
+
+ if (feat.getSource().second == Contig_t::NCODE)
+ {
+ if (feat.getSource().first == masteriid)
+ {
+ change = true; // This ensures new iid gets set
+ feat.setSource(make_pair(newmasteriid, Contig_t::NCODE));
+
+ //cout << "master: " << feat.getRange().getLo() << "," << feat.getRange().getHi() << endl;
+
+ if (masterrc && master2iid)
+ {
+ cerr << "unsupported rc master feature" << endl;
+ }
+ else
+ {
+ if (feat.getRange().getHi() < stitchRegion.begin)
+ {
+ // before patch, keep the coord unchanged
+ cout << "m";
+ }
+ else if (!master2iid && (feat.getRange().getLo() > rightmasterbaseoffset))
+ {
+ // past patch region, adjust coords
+ Range_t rng = feat.getRange();
+ rng.begin = newmasterlen - (oldmasterlen - rng.begin);
+ rng.end = newmasterlen - (oldmasterlen - rng.end);
+ feat.setRange(rng);
+
+ cout << "u";
+ }
+ else
+ {
+ // in patch or past patch region, but in master2
+ remove = true;
+ cout << "r";
+ }
+ }
+ }
+ else if (master2iid && feat.getSource().first == master2iid)
+ {
+ change = true;
+ feat.setSource(make_pair(newmasteriid, Contig_t::NCODE));
+
+ if (master2rc)
+ {
+ cerr << "unsupported rc master2 feature" << endl;
+ }
+ else
+ {
+ if (feat.getRange().getLo() > rightmasterbaseoffset)
+ {
+ // after patch region, adjust coordinates
+ Range_t rng = feat.getRange();
+ rng.begin = newmasterlen - (oldmaster2len - rng.begin);
+ rng.end = newmasterlen - (oldmaster2len - rng.end);
+ feat.setRange(rng);
+ cout << "2";
+ }
+ else
+ {
+ // before patch region, clobber feature
+ remove = true;
+ cout << "r";
+ }
+ }
+ }
+ }
+
+ if (remove)
+ {
+ if (!savetonew)
+ {
+ master_feat.removeByBID(bid);
+ }
+ }
+ else if (change)
+ {
+ if (savetonew)
+ {
+ newfeatures.push_back(feat);
+ }
+ else
+ {
+ master_feat.replaceByBID(bid, feat);
+ }
+ }
+ }
+
+ patch_feat.seekg(1);
+ while (patch_feat >> feat)
+ {
+ if ((feat.getSource().second == Contig_t::NCODE) &&
+ (feat.getSource().first == patchiid))
+ {
+ Range_t rng = feat.getRange();
+
+ // Check for contained features
+ if ((rng.getLo() >= patchleftoffset) &&
+ (rng.getHi() <= patchrightoffset))
+ {
+ rng.begin = stitchRegion.begin + (rng.begin - patchleftoffset);
+ rng.end = stitchRegion.begin + (rng.end - patchleftoffset);
+
+ feat.setRange(rng);
+ feat.setSource(make_pair(newmasteriid, Contig_t::NCODE));
+
+ newfeatures.push_back(feat);
+
+ cout << "p";
+ }
+ }
+ }
+ cout << endl;
+
+ for (int i = 0; i < newfeatures.size(); i++)
+ {
+ master_feat << newfeatures[i];
+ }
+}
+
+void stitchContigs(Bank_t & master_contig,
+ Bank_t & master_reads,
+ Bank_t & master_scaff,
+ BankStream_t & master_feat,
+ Bank_t & patch_contig,
+ Bank_t & patch_reads,
+ BankStream_t & patch_feat,
+ const string & leftstitchread,
+ const string & rightstitchread,
+ set<ID_t> & masterreads,
+ set<ID_t> & patchreads,
+ Range_t & stitchRegion,
+ ID_t masteriid,
+ ID_t master2iid,
+ ID_t patchiid,
+ bool savetonew,
+ bool perfectovl)
+{
+ Contig_t master, master2, patch;
+
+ ID_t mleftiid = 0, pleftiid = 0;
+ ID_t mrightiid = 0, prightiid = 0;
+
+ if (!leftstitchread.empty())
+ {
+ mleftiid = lookupIID(master_reads, leftstitchread);
+ pleftiid = lookupIID(patch_reads, leftstitchread);
+ }
+
+ if (!rightstitchread.empty())
+ {
+ mrightiid = lookupIID(master_reads, rightstitchread);
+ prightiid = lookupIID(patch_reads, rightstitchread);
+ }
+
+ master_contig.fetch(masteriid, master);
+ if (master2iid) { master_contig.fetch(master2iid, master2); }
+ patch_contig.fetch(patchiid, patch);
+
+ int oldmasterlen = master.getLength();
+ int oldmaster2len = 0;
+ int rightmasterbaseoffset = 0;
+ int patchleftoffset = 0;
+ int patchrightoffset = 0;
+
+ // master
+ string mcons = master.getSeqString();
+ string mqual = master.getQualString();
+
+ // patch
+ string pcons = patch.getSeqString();
+ string pqual = patch.getQualString();
+
+ vector<Tile_t> & ptiling = patch.getReadTiling();
+ sort(ptiling.begin(), ptiling.end(), TileOrderCmp());
+ vector<Tile_t>::iterator pti = ptiling.begin();
+
+
+ // new
+ string newcons;
+ string newqual;
+ vector<Tile_t> newtiling;
+
+ int masterbaseoffset = 0;
+ int patchbaseoffset = 0;
+
+
+ stitchRegion.begin = 0;
+ stitchRegion.end = 0;
+
+ sort(master.getReadTiling().begin(), master.getReadTiling().end(), TileOrderCmp());
+ vector<Tile_t>::iterator mti = master.getReadTiling().begin();
+
+
+ if (mleftiid)
+ {
+ // Find the left read in the master
+ vector<Tile_t> & mtiling = master.getReadTiling();
+
+ cout << "Handling Left" << endl;
+
+ int rightmost = 0;
+ while (mti != mtiling.end())
+ {
+ if (mti->offset + mti->getGappedLength() > rightmost)
+ {
+ rightmost = mti->offset + mti->getGappedLength();
+ }
+
+ if (mti->source == mleftiid)
+ {
+ cout << " Found left stitch read in master, offset:" << mti->offset << endl;
+ masterbaseoffset = mti->offset;
+ break;
+ }
+
+ newtiling.push_back(*mti);
+ mti++;
+ }
+
+ if (mti == mtiling.end())
+ {
+ cout << "ERROR: Didn't find left stitch read in master!!!" << endl;
+ throw Exception_t("ERROR", __LINE__, __FILE__);
+ }
+
+ cout << " Left Consensus = mcons[0, " << masterbaseoffset - 1 << "]" << endl;
+
+ newcons = mcons.substr(0, masterbaseoffset);
+ newqual = mqual.substr(0, masterbaseoffset);
+
+ stitchRegion.begin = masterbaseoffset;
+
+ // Find the left read in the patch
+ while (pti != ptiling.end())
+ {
+ if (pti->source == pleftiid)
+ {
+ patchleftoffset = pti->offset;
+ patchbaseoffset = pti->offset;
+ cout << " Found left stitch read in patch, offset: " << pti->offset << endl;
+
+ checkClr(mti, pti, "left");
+ break;
+ }
+
+ pti++;
+ }
+
+ if (pti == ptiling.end())
+ {
+ cout << "Didn't find left read in patch!" << endl;
+ throw Exception_t("ERROR", __LINE__, __FILE__);
+ }
+
+ if (perfectovl)
+ {
+ // Check that at least the consensi across the left stitch read are identical
+ string pc = pcons.substr(patchbaseoffset, rightmost-masterbaseoffset);
+ string mc = mcons.substr(masterbaseoffset, rightmost-masterbaseoffset);
+ checkCons(mc, pc, "Left");
+ }
+ }
+
+ cout << endl;
+ cout << "Handling Patch Region" << endl;
+
+ // pti points at first read to patch
+ // stitch the reads into the master
+
+ int porigoffset = 0;
+ int rightmost = 0;
+ int lentocheck = 0;
+ while (pti != ptiling.end())
+ {
+ if (pti->offset + pti->getGappedLength() > rightmost)
+ {
+ rightmost = pti->offset + pti->getGappedLength();
+ }
+
+ porigoffset = pti->offset;
+ pti->offset = pti->offset - patchbaseoffset + masterbaseoffset;
+ pti->source = lookupIID(master_reads, patch_reads.lookupEID(pti->source));
+ newtiling.push_back(*pti);
+
+ if (pti->source == mrightiid) // right read was converted, so use mrightiid
+ {
+ cout << " Found right stitch read in patch, offset: " << porigoffset << endl;
+
+ if (rightmost > porigoffset + pti->getGappedLength())
+ {
+ cout << " WARNING: Read in patch extends beyond right stitch read" << endl;
+ }
+
+ lentocheck = rightmost - porigoffset;
+ rightmost = porigoffset + pti->getGappedLength();
+ patchrightoffset = rightmost;
+
+ break;
+ }
+
+ patchreads.insert(lookupIID(master_reads, patch_reads.lookupEID(pti->source)));
+ pti++;
+ }
+
+ if (prightiid && (pti == ptiling.end()))
+ {
+ cout << "Didn't find right read in patch" << endl;
+ throw Exception_t("ERROR", __LINE__, __FILE__);
+ }
+
+ int len = rightmost - patchbaseoffset;
+ cout << " Patch Consensus[" << newcons.length()
+ << "].append pcons[" << patchbaseoffset << "," << len << "]" << endl;
+
+ newcons.append(pcons, patchbaseoffset, len);
+ newqual.append(pqual, patchbaseoffset, len);
+
+ stitchRegion.end = newcons.size() - 1;
+
+
+ if (prightiid)
+ {
+ cout << endl;
+ cout << "Handling Right" << endl;
+
+ // handle right flank from master
+ bool stitchreads = false;
+ patchbaseoffset = pti->offset; // pti must exist
+
+ vector<Tile_t> & mtiling = (master2iid) ? master2.getReadTiling() : master.getReadTiling();
+
+ if (master2iid)
+ {
+ oldmaster2len = master2.getLength();
+ while (mti != master.getReadTiling().end())
+ {
+ masterreads.insert(mti->source);
+ mti++;
+ }
+
+ sort(mtiling.begin(), mtiling.end(), TileOrderCmp());
+ mti = mtiling.begin();
+
+ mcons = master2.getSeqString();
+ mqual = master2.getQualString();
+ }
+
+ while (mti != mtiling.end())
+ {
+ if (stitchreads)
+ {
+ mti->offset = mti->offset - masterbaseoffset + patchbaseoffset;
+ newtiling.push_back(*mti);
+ }
+
+ // mrightiid is the last read from patch, don't stitch it
+ if (mti->source == mrightiid)
+ {
+ stitchreads = true;
+ masterbaseoffset = mti->offset;
+
+ int roffset = mti->offset + mti->getGappedLength();
+ cout << " Found right stitch read in master, offset: " << mti->offset << endl;
+
+ rightmasterbaseoffset = roffset;
+
+ checkClr(mti, pti, "right");
+
+ if (perfectovl)
+ {
+ // Ensure the consensi across the right stitch read are identical
+ string mc = mcons.substr(masterbaseoffset, lentocheck);
+ string pc = pcons.substr(porigoffset, lentocheck);
+ checkCons(mc, pc, "Right");
+ }
+
+ len = mcons.length() - roffset;
+ cout << " Right Consensus [" << newcons.length() << "].append mcons[" << roffset << "," << len << "]" << endl;
+ newcons.append(mcons, roffset, len);
+ newqual.append(mcons, roffset, len);
+ }
+
+ if (!stitchreads)
+ {
+ masterreads.insert(mti->source);
+ }
+
+ mti++;
+ }
+
+ if (!stitchreads)
+ {
+ cerr << "ERROR: Didn't find right stitch read in master" << endl;
+ throw Exception_t("ERROR", __LINE__, __FILE__);
+ }
+ }
+
+ int newmasterlen = newcons.length();
+
+ master.setReadTiling(newtiling);
+ master.setSequence(newcons, newqual);
+
+
+ if (savetonew)
+ {
+ master.setIID(master_contig.getMaxIID()+1);
+ master.setEID(master.getEID() + "_stitched");
+ master_contig.append(master);
+
+ cout << "Saved new contig i:" << master.getIID() << " e:" << master.getEID() << endl;
+ }
+ else
+ {
+ master_contig.replace(master.getIID(), master);
+ cout << "Updated contig i:" << master.getIID() << " e:" << master.getEID() << endl;
+
+ if (master2iid)
+ {
+ cout << "Removed contig i:" << master2iid << " e:" << master_contig.lookupEID(master2iid) << endl;
+ master_contig.remove(master2iid);
+ }
+ }
+
+ bool masterrc = false;
+ bool master2rc = false;
+
+ if (oldmasterlen != newmasterlen || master2iid)
+ {
+ Scaffold_t masterscaff;
+ Scaffold_t master2scaff;
+
+ bool foundmaster = false;
+ bool foundmaster2 = false;
+
+ cout << endl;
+ cout << "Updating scaffold" << endl;
+
+ vector<Tile_t>::iterator ci;
+
+ const IDMap_t & scaffmap = master_scaff.getIDMap();
+ IDMap_t::const_iterator si;
+ for (si = scaffmap.begin(); si != scaffmap.end(); si++)
+ {
+ Scaffold_t scaff;
+ master_scaff.fetch(si->iid, scaff);
+
+ for (ci = scaff.getContigTiling().begin();
+ ci != scaff.getContigTiling().end();
+ ci++)
+ {
+ if (ci->source == masteriid)
+ {
+ masterscaff = scaff;
+ foundmaster = true;
+ cout << " Found masterscaffold i:" << masterscaff.getIID() << endl;
+ }
+ else if (ci->source == master2iid)
+ {
+ master2scaff = scaff;
+ foundmaster2 = true;
+ cout << " Found master2scaffold i:" << master2scaff.getIID() << endl;
+ }
+ }
+
+ if (foundmaster && (!master2iid || foundmaster2))
+ {
+ break;
+ }
+ }
+
+ if (foundmaster)
+ {
+ cout << " Updating scaffold information" << endl;
+ vector<Tile_t> newcontigs;
+
+ sort(masterscaff.getContigTiling().begin(), masterscaff.getContigTiling().end(), TileOrderCmp());
+
+ // masterscaff must contain masteriid
+
+ for (ci = masterscaff.getContigTiling().begin();
+ ci != masterscaff.getContigTiling().end();
+ ci++)
+ {
+ if (ci->source == masteriid)
+ {
+ break;
+ }
+
+ newcontigs.push_back(*ci);
+ }
+
+ int offsetadjust = newmasterlen - oldmasterlen;
+
+ if (ci->range.isReverse())
+ {
+ masterrc = true;
+ ci->range.setBegin(ci->range.getBegin() + offsetadjust);
+ }
+ else
+ {
+ masterrc = false;
+ ci->range.setEnd(ci->range.getEnd() + offsetadjust);
+ }
+
+ ci->source = master.getIID();
+ int newmasterright = ci->getRightOffset();
+
+ cout << " Found mastercontig, adjusting downstream offsets by " << offsetadjust << endl;
+
+ newcontigs.push_back(*ci);
+ ci++;
+
+ if (master2iid && foundmaster2)
+ {
+ vector<Tile_t> & ctiling = (master2scaff.getIID() == masterscaff.getIID()) ? masterscaff.getContigTiling() : master2scaff.getContigTiling();
+
+ if (master2scaff.getIID() != masterscaff.getIID())
+ {
+ sort(ctiling.begin(), ctiling.end(), TileOrderCmp());
+ ci = ctiling.begin();
+ }
+
+ bool copycontigs = false;
+ while (ci != ctiling.end())
+ {
+ if (copycontigs)
+ {
+ ci->offset += offsetadjust;
+ newcontigs.push_back(*ci);
+ }
+
+ if (ci->source == master2iid)
+ {
+ offsetadjust = newmasterright - ci->getRightOffset();
+ copycontigs = true;
+ master2rc = ci->range.isReverse();
+ }
+
+ ci++;
+ }
+ }
+ else
+ {
+ // Just adjust the downstream offsets
+ while (ci != masterscaff.getContigTiling().end())
+ {
+ ci->offset += offsetadjust;
+ newcontigs.push_back(*ci);
+ ci++;
+ }
+ }
+
+ masterscaff.setContigTiling(newcontigs);
+
+ if (savetonew)
+ {
+ masterscaff.setIID(master_scaff.getMaxIID()+1);
+ masterscaff.setEID(masterscaff.getEID() + "_stitched");
+ master_scaff.append(masterscaff);
+
+ cout << "Saved new scaffold i:" << masterscaff.getIID() << " e:" << masterscaff.getEID() << endl;
+ }
+ else
+ {
+ master_scaff.replace(masterscaff.getIID(), masterscaff);
+ cout << "Updated scaffold i:" << masterscaff.getIID() << " e:" << masterscaff.getEID() << endl;
+
+ if (master2iid && master2scaff.getIID() && (masterscaff.getIID() != master2scaff.getIID()))
+ {
+ cout << "Removed scaffold i:" << master2scaff.getIID() << " e:" << master2scaff.getEID() << endl;
+ master_scaff.remove(master2scaff.getIID());
+ }
+ }
+ }
+ else if (foundmaster2)
+ {
+ cerr << "Error master not in scaffold, but master2 is" << endl;
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ updateStitchFeatures(master_feat,
+ patch_feat,
+ stitchRegion,
+ masteriid,
+ masterrc,
+ master2iid,
+ master2rc,
+ master.getIID(),
+ patchiid,
+ leftstitchread,
+ rightstitchread,
+ rightmasterbaseoffset,
+ oldmasterlen,
+ newmasterlen,
+ oldmaster2len,
+ patchleftoffset,
+ patchrightoffset,
+ savetonew);
+}
diff --git a/src/Contig/ContigUtils.hh b/src/Contig/ContigUtils.hh
new file mode 100644
index 0000000..12612fe
--- /dev/null
+++ b/src/Contig/ContigUtils.hh
@@ -0,0 +1,46 @@
+#ifndef CONTIGUTILS_HH_
+#define CONTIGUTILS_HH_ 1
+
+#include "foundation_AMOS.hh"
+#include <string>
+#include <set>
+
+void leftTrimContig(AMOS::Contig_t & contig, int lefttrim);
+void rightTrimContig(AMOS::Contig_t & contig, int righttrim);
+void lengthTrimContig(AMOS::Contig_t & contig, int righttrim);
+
+
+void shiftContigRight(AMOS::Contig_t & contig, int contigShiftDistance);
+void widenContig(AMOS::Contig_t & contig, int contigGrowDistance);
+
+
+
+AMOS::ID_t lookupIID(AMOS::Bank_t & bnk, const std::string & eid);
+
+void reverseContig(AMOS::Bank_t & contig_bank,
+ AMOS::Bank_t & scaffold_bank,
+ AMOS::BankStream_t & feat_bnk,
+ AMOS::ID_t contigiid);
+
+void stitchContigs(AMOS::Bank_t & master_contig,
+ AMOS::Bank_t & master_reads,
+ AMOS::Bank_t & master_scaff,
+ AMOS::BankStream_t & master_feat,
+ AMOS::Bank_t & patch_contig,
+ AMOS::Bank_t & patch_reads,
+ AMOS::BankStream_t & patch_feat,
+ const std::string & leftstitchread,
+ const std::string & rightstitchread,
+ std::set<AMOS::ID_t> & masterreads,
+ std::set<AMOS::ID_t> & patchreads,
+ AMOS::Range_t & stitchRegion,
+ AMOS::ID_t masteriid,
+ AMOS::ID_t master2iid,
+ AMOS::ID_t patchiid,
+ bool savetonew,
+ bool perfectovl);
+
+
+
+
+#endif
diff --git a/src/Contig/CoverageStats.cc b/src/Contig/CoverageStats.cc
new file mode 100644
index 0000000..74ec876
--- /dev/null
+++ b/src/Contig/CoverageStats.cc
@@ -0,0 +1,184 @@
+#include "CoverageStats.hh"
+#include <math.h>
+
+using namespace AMOS;
+using namespace std;
+
+CoverageStats::CoverageStats() :
+ m_coverage(0),
+ m_libid(0),
+ m_maxdepth(0),
+ m_curpos(0),
+ m_sum(0)
+{}
+
+CoverageStats::CoverageStats(int numpoints, ID_t libid, Distribution_t dist) :
+ m_coverage(numpoints),
+ m_libid(libid),
+ m_dist(dist),
+ m_maxdepth(0),
+ m_curpos(0),
+ m_sum(0)
+{
+ //cerr << "Allocated to hold " << numpoints << " values" << endl;
+ m_cestat.resize(numpoints);
+}
+
+CoverageStats::CoverageStats(const CoverageStats & other)
+{
+ *this = other;
+}
+
+CoverageStats & CoverageStats::operator=(const CoverageStats & other)
+{
+ if ( this != &other )
+ {
+ m_coverage = other.m_coverage;
+ m_cestat = other.m_cestat;
+ m_libid = other.m_libid;
+ m_dist = other.m_dist;
+ m_maxdepth = other.m_maxdepth;
+ m_curpos = other.m_curpos;
+ m_sum = other.m_sum;
+ m_endpoints = other.m_endpoints;
+ }
+
+ return *this;
+}
+
+void CoverageStats::addEndpoints(int curloffset, int curroffset)
+{
+ EndPoints::iterator vi, vi2;
+ int eps = m_endpoints.size();
+
+ // find end points that have already passed
+ vi = m_endpoints.begin();
+ while (vi != m_endpoints.end())
+ {
+ if (vi->first <= curloffset)
+ {
+ eps = handlePoint(vi->first, eps, -vi->second);
+ vi2 = vi; vi2++; m_endpoints.erase(vi); vi = vi2;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ int len = curroffset - curloffset + 1;
+
+ // Add this insert's beginning and end
+ eps = handlePoint(curloffset, eps, +len);
+ m_endpoints.insert(make_pair(curroffset, len));
+
+ if (eps > m_maxdepth) { m_maxdepth = eps; }
+
+ if (eps != m_endpoints.size())
+ {
+ cerr << "eps: " << eps << " m_endpoints.size():" << m_endpoints.size() << endl;
+ }
+}
+
+void CoverageStats::finalize()
+{
+ EndPoints::iterator vi, vi2;
+
+ int eps = m_endpoints.size();
+
+ // Handle remaining end points
+
+ for (EndPoints::iterator vi = m_endpoints.begin(); vi != m_endpoints.end(); vi++)
+ {
+ eps = handlePoint(vi->first, eps, -vi->second);
+ }
+
+ m_endpoints.clear();
+
+ if (eps != 0 || m_endpoints.size() != 0)
+ {
+ cerr << "not zero eps: " << eps << " m_endpoints.size():" << m_endpoints.size() << endl;
+ }
+
+ if (m_sum != 0)
+ {
+ cerr << "not zero sum: " << m_sum << endl;
+ }
+}
+
+void CoverageStats::finalizeCE(int vheight)
+{
+ int half = vheight / 2;
+
+ for (int i = 0; i < m_curpos; i++)
+ {
+ double numerator = (m_cestat[i] - m_dist.mean) * sqrt((double)m_coverage[i].y());
+ double denominator = m_dist.sd;
+ double val = (denominator) ? (numerator)/(denominator) : numerator / 0.0001;
+
+ // cestat gets the raw ce value
+ m_cestat[i] = val;
+
+ int plotval = (int)(val*8);
+
+ if (plotval > half) { plotval = half; }
+ else if (plotval < -half) { plotval = -half; }
+
+ plotval += half;
+
+ // make sure plotval is within the vertical range
+ plotval = max(0,plotval);
+ plotval = min(vheight, plotval);
+
+ // coverage gets the value to plot
+ m_coverage[i].setY(plotval);
+
+ //cerr << "lib: " << m_libid << " x: " << m_coverage[i].x() << " plotted: " << m_coverage[i].y()
+ // << " ce: " << val << " = " << numerator << " / " << denominator << endl;
+ }
+}
+
+void CoverageStats::normalize(float hscale, int hoffset, int voffset)
+{
+ // Adjust coordinates for painting
+ for (int i = 0; i < m_curpos; i++)
+ {
+ m_coverage[i].setX((int)((m_coverage[i].x()+hoffset) * hscale));
+ m_coverage[i].setY(voffset-m_coverage[i].y());
+ }
+}
+
+
+int CoverageStats::handlePoint(int pos, int eps, int sumdelta)
+{
+ if (m_curpos+1 >= m_coverage.size())
+ {
+ cerr << "WARNING: resizing coverage array" << endl;
+ m_coverage.resize(m_coverage.size()*2+2);
+ m_cestat.resize(m_cestat.size()*2+2);
+ }
+
+ m_coverage[m_curpos] = Point_t(pos, eps);
+ m_cestat[m_curpos] = eps ? m_sum/eps : 0;
+ m_curpos++;
+
+ if (sumdelta < 0) { eps--; }
+ else { eps++; }
+
+ m_sum += sumdelta;
+
+ m_coverage[m_curpos] = Point_t(pos, eps);
+ m_cestat[m_curpos] = eps ? m_sum/eps : 0;
+ m_curpos++;
+
+ return eps;
+}
+
+
+void CoverageStats::addPoint(int x, int y)
+{
+ m_coverage[m_curpos] = Point_t(x,y);
+ m_curpos++;
+
+ if (y > m_maxdepth) { m_maxdepth = y; }
+}
diff --git a/src/Contig/CoverageStats.hh b/src/Contig/CoverageStats.hh
new file mode 100644
index 0000000..8e0eb69
--- /dev/null
+++ b/src/Contig/CoverageStats.hh
@@ -0,0 +1,59 @@
+#ifndef COVERAGE_STATS_HH_
+#define COVERAGE_STATS_HH_ 1
+
+#include <foundation_AMOS.hh>
+#include <map>
+#include <vector>
+
+struct Point_t
+{
+ Point_t() : m_x(0.0), m_y(0.0) {}
+ Point_t(double x, double y) : m_x(x), m_y(y) {}
+
+ double m_x;
+ double m_y;
+
+ double x() const { return m_x; }
+ double y() const { return m_y; }
+
+ void setX(double x) { m_x = x; }
+ void setY(double y) { m_y = y; }
+};
+
+typedef std::vector<Point_t> PointArray_t;
+
+class CoverageStats
+{
+public:
+ CoverageStats();
+ CoverageStats(int numpoints, AMOS::ID_t libid, AMOS::Distribution_t dist);
+ CoverageStats(const CoverageStats &);
+ CoverageStats & operator=(const CoverageStats &);
+
+ typedef std::multimap<int, int> EndPoints;
+
+ PointArray_t m_coverage;
+ std::vector<double> m_cestat;
+
+ AMOS::ID_t m_libid;
+ AMOS::Distribution_t m_dist;
+
+ int m_maxdepth;
+ int m_curpos;
+
+ void addEndpoints(int curloffset, int curroffset);
+ void finalize();
+ void finalizeCE(int vheight);
+ void normalize(float hscale, int hoffset, int voffset);
+
+ void addPoint(int x, int y);
+
+private:
+ int handlePoint(int pos, int eps, int sumdelta);
+ int m_sum;
+ EndPoints m_endpoints;
+};
+
+
+
+#endif
diff --git a/src/Contig/DataStore.cc b/src/Contig/DataStore.cc
new file mode 100644
index 0000000..64e4a73
--- /dev/null
+++ b/src/Contig/DataStore.cc
@@ -0,0 +1,925 @@
+#include "DataStore.hh"
+#include "Insert.hh"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <dirent.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "amp.hh"
+#include "delcher.hh"
+#include "fasta.hh"
+
+
+using namespace AMOS;
+using namespace std;
+
+DataStore::DataStore()
+ : contig_bank(Contig_t::NCODE),
+ read_bank(Read_t::NCODE),
+ frag_bank(Fragment_t::NCODE),
+ lib_bank(Library_t::NCODE),
+ scaffold_bank(Scaffold_t::NCODE),
+ edge_bank(ContigEdge_t::NCODE),
+ link_bank(ContigLink_t::NCODE),
+ feat_bank(Feature_t::NCODE)
+{
+ m_loaded = false;
+ m_contigId = AMOS::NULL_ID;
+ m_scaffoldId = AMOS::NULL_ID;
+
+ Kmer_Len = 0;
+}
+
+DataStore::~DataStore()
+{
+
+}
+
+int DataStore::openBank(const string & bankname)
+{
+ int retval = 1;
+
+ try
+ {
+ cerr << "Opening " << bankname << "... ";
+
+ EventTime_t timer;
+
+ read_bank.open(bankname, B_SPY);
+ contig_bank.open(bankname, B_SPY);
+
+ cerr << timer.str() << endl;
+
+ m_bankname = bankname;
+ m_contigId = AMOS::NULL_ID;
+ m_scaffoldId = AMOS::NULL_ID;
+
+ m_readmatelookup.clear();
+ m_readcontiglookup.clear();
+ m_fragliblookup.clear();
+ m_readfraglookup.clear();
+ m_contigscafflookup.clear();
+ m_libdistributionlookup.clear();
+
+ indexContigs();
+ m_scaffoldId = AMOS::NULL_ID;
+ retval = 0;
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR in openBank():\n" << e;
+ }
+
+ if (!retval)
+ {
+ try
+ {
+ scaffold_bank.open(bankname, B_SPY);
+ indexScaffolds();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Scaffold information not available" << endl;
+ }
+
+ try
+ {
+ frag_bank.open(bankname, B_SPY);
+ lib_bank.open(bankname, B_SPY);
+
+ indexLibraries();
+
+ int BIGMEM = 1;
+
+ if (BIGMEM)
+ {
+ indexFrags();
+ indexReads();
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Mates not available:" << e << endl;
+ }
+
+ if (0)
+ {
+ try
+ {
+ edge_bank.open(bankname, B_SPY);
+ link_bank.open(bankname, B_SPY);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Contig Graph not available\n";
+ }
+ }
+
+ try
+ {
+ feat_bank.open(bankname, B_SPY);
+ }
+ catch (const Exception_t & e)
+ {
+ cerr << "Features not available" << endl;
+ }
+ }
+
+ return retval;
+}
+
+
+void DataStore::indexReads()
+{
+ cerr << "Indexing Reads ";
+ ProgressDots_t dots(read_bank.getSize(), 10);
+ int count = 0;
+
+ EventTime_t timer;
+
+ m_readfraglookup.clear();
+ m_readfraglookup.resize(read_bank.getMaxBID()+1);
+
+ Read_t red;
+
+ read_bank.seekg(1);
+ read_bank.setFixedStoreOnly(true);
+
+ while (read_bank >> red)
+ {
+ count++;
+ dots.update(count);
+
+ m_readfraglookup[read_bank.lookupBID(red.getIID())] = red.getFragment();
+ }
+
+ read_bank.setFixedStoreOnly(false);
+
+ cerr << " " << timer.str() << " "
+ << m_readfraglookup.size() << " reads" << endl;
+}
+
+void DataStore::indexFrags()
+{
+ cerr << "Indexing Mates ";
+ ProgressDots_t dots(frag_bank.getSize(), 10);
+
+ EventTime_t timer;
+
+ m_fragliblookup.clear();
+ m_fragliblookup.resize(frag_bank.getMaxBID()+1);
+
+ m_readmatelookup.clear();
+ m_readmatelookup.resize(read_bank.getMaxBID()+1);
+
+
+ Fragment_t frg;
+ frag_bank.seekg(1);
+ int fragments = 0;
+ int reads = 0;
+
+ frag_bank.setFixedStoreOnly(true);
+
+ while (frag_bank >> frg)
+ {
+ fragments++;
+ dots.update(fragments);
+
+ m_fragliblookup[frag_bank.lookupBID(frg.getIID())] = frg.getLibrary();
+
+ std::pair<ID_t, ID_t> mates = frg.getMatePair();
+ if (mates.first)
+ {
+ m_readmatelookup[read_bank.lookupBID(mates.first)] = make_pair(mates.second, frg.getType());
+ reads++;
+ }
+
+ if (mates.second)
+ {
+ m_readmatelookup[read_bank.lookupBID(mates.second)] = make_pair(mates.first, frg.getType());
+ reads++;
+ }
+ }
+
+ frag_bank.setFixedStoreOnly(false);
+
+ cerr << " " << timer.str() << " "
+ << reads << " mated reads in "
+ << fragments << " fragments" << endl;
+}
+
+DataStore::MateInfo_t DataStore::getMatePair(ID_t readid)
+{
+ if (!m_readmatelookup.empty())
+ {
+ return m_readmatelookup[read_bank.lookupBID(readid)];
+ }
+ else if (frag_bank.isOpen())
+ {
+ Read_t read;
+ read_bank.fetchFix(readid, read);
+
+ if (read.getFragment() != 0);
+ {
+ Fragment_t frag;
+ frag_bank.fetchFix(read.getFragment(), frag);
+
+ if (frag.getMatePair().first == readid)
+ {
+ return make_pair(frag.getMatePair().second, frag.getType());
+ }
+ else if (frag.getMatePair().second == readid)
+ {
+ return make_pair(frag.getMatePair().first, frag.getType());
+ }
+ }
+ }
+
+ return make_pair(0,0);
+}
+
+void DataStore::indexLibraries()
+{
+ cerr << "Indexing Libraries ";
+ ProgressDots_t dots(lib_bank.getSize(), 10);
+
+ EventTime_t timer;
+
+ m_libdistributionlookup.clear();
+ m_libdistributionlookup.resize(lib_bank.getSize());
+
+ Library_t lib;
+ lib_bank.seekg(1);
+
+ int count = 0;
+ while (lib_bank >> lib)
+ {
+ m_libdistributionlookup.insert(make_pair(lib.getIID(), lib.getDistribution()));
+
+ count++;
+ dots.update(count);
+ }
+
+ cerr << " " << timer.str() << " "
+ << m_libdistributionlookup.size() << " libraries" << endl;
+}
+
+void DataStore::indexContigs()
+{
+ cerr << "Indexing Contigs ";
+ ProgressDots_t dots(contig_bank.getSize(), 10);
+
+ EventTime_t timer;
+
+ m_readcontiglookup.clear();
+ m_readcontiglookup.resize(read_bank.getMaxBID()+1, 0);
+
+ int contigs = 0;
+ int reads = 0;
+ contig_bank.seekg(1);
+ Contig_t contig;
+ while (contig_bank >> contig)
+ {
+ int contigid = contig_bank.tellg() - 1;
+ contigs++;
+ dots.update(contigs);
+
+ vector<Tile_t> & tiling = contig.getReadTiling();
+ vector<Tile_t>::const_iterator ti;
+ for (ti = tiling.begin();
+ ti != tiling.end();
+ ti++)
+ {
+ m_readcontiglookup[read_bank.lookupBID(ti->source)] = contigid;
+ reads++;
+ }
+ }
+
+ cerr << " " << timer.str() << " "
+ << reads << " reads in "
+ << contigs << " contigs" << endl;
+}
+
+void DataStore::indexScaffolds()
+{
+ cerr << "Indexing Scaffolds ";
+
+ ProgressDots_t dots(scaffold_bank.getSize(), 10);
+
+ EventTime_t timer;
+
+ m_contigscafflookup.clear();
+ m_contigscafflookup.resize(contig_bank.getMaxBID()+1);
+
+ int scaffolds = 0;
+ int contigs = 0;
+
+ scaffold_bank.seekg(1);
+ Scaffold_t scaffold;
+ while (scaffold_bank >> scaffold)
+ {
+ int scaffid = scaffold_bank.tellg() - 1;
+ scaffolds++;
+ dots.update(scaffolds);
+
+ vector<Tile_t> & tiling = scaffold.getContigTiling();
+ vector<Tile_t>::const_iterator ti;
+
+ for (ti = tiling.begin();
+ ti != tiling.end();
+ ti++)
+ {
+ contigs++;
+ m_contigscafflookup[contig_bank.lookupBID(ti->source)] = scaffid;
+ }
+ }
+
+ cerr << " " << timer.str() << " "
+ << contigs << " contigs in "
+ << scaffolds << " scaffolds" << endl;
+}
+
+int DataStore::setContigId(int bid)
+{
+ int retval = 0;
+
+ try
+ {
+ if (bid != 0)
+ {
+ EventTime_t timer;
+ cerr << "Loading Contig " << bid << "...";
+
+ fetchContigBID(bid, m_contig);
+ m_scaffoldId = lookupScaffoldId(bid);
+ m_contigId = bid;
+ m_loaded = true;
+
+ cerr << " " << timer.str() << " "
+ << m_contig.getReadTiling().size() << " reads" << endl;
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR in setContigId()\n" << e;
+ retval = 1;
+ }
+
+ return retval;
+}
+
+void DataStore::fetchReadIID(ID_t readid, Read_t & read)
+{
+ try
+ {
+ read_bank.fetch(readid, read);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: Can't fetch read iid:" << readid << "\n" << e;
+ }
+}
+
+void DataStore::fetchContigBID(ID_t contigid, Contig_t & contig)
+{
+ try
+ {
+ contig_bank.seekg(contigid);
+ contig_bank >> contig;
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR in fetchContig()\n" << e;
+ }
+}
+
+void DataStore::fetchContigIID(ID_t contigid, Contig_t & contig)
+{
+ try
+ {
+ contig_bank.fetch(contigid, contig);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR in fetchContig()\n" << e;
+ }
+}
+
+void DataStore::fetchContigEID(const string & eid, Contig_t & contig)
+{
+ contig_bank.fetch(eid, contig);
+}
+
+void DataStore::fetchScaffoldBID(ID_t scaffid, Scaffold_t & scaff)
+{
+ try
+ {
+ scaffold_bank.seekg(scaffid);
+ scaffold_bank >> scaff;
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR in fetchScaffold()\n" << e;
+ }
+}
+
+
+void DataStore::fetchScaffoldIID(ID_t scaffid, Scaffold_t & scaff)
+{
+ try
+ {
+ scaffold_bank.fetch(scaffid, scaff);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR in fetchScaffold()\n" << e;
+ }
+}
+
+void DataStore::fetchFragIID(ID_t fragid, Fragment_t & frag)
+{
+ try
+ {
+ frag_bank.fetch(fragid, frag);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR in fetchFrag()\n" << e;
+ }
+}
+
+ID_t DataStore::lookupFragId(ID_t readid)
+{
+ if (!m_readfraglookup.empty())
+ {
+ return m_readfraglookup[read_bank.lookupBID(readid)];
+ }
+ else
+ {
+ Read_t read;
+ read_bank.fetchFix(readid, read);
+ return read.getFragment();
+ }
+}
+
+AMOS::ID_t DataStore::getLibrary(ID_t readid)
+{
+ if (!m_libdistributionlookup.empty())
+ {
+ try
+ {
+ ID_t fragid, libid;
+
+ fragid = lookupFragId(readid);
+ if (fragid != AMOS::NULL_ID)
+ {
+ if (!m_fragliblookup.empty())
+ {
+ libid = m_fragliblookup[frag_bank.lookupBID(fragid)];
+ }
+ else
+ {
+ Fragment_t frag;
+ frag_bank.fetchFix(fragid, frag);
+ libid = frag.getLibrary();
+ }
+
+ return libid;
+ }
+ }
+ catch (Exception_t & e)
+ {
+ }
+ }
+
+ return AMOS::NULL_ID;
+}
+
+
+Distribution_t DataStore::getLibrarySize(ID_t libid)
+{
+ if (libid)
+ {
+ return m_libdistributionlookup[libid];
+ }
+
+ return Distribution_t();
+}
+
+ID_t DataStore::lookupContigId(ID_t readid)
+{
+ return m_readcontiglookup[read_bank.lookupBID(readid)];
+}
+
+ID_t DataStore::lookupScaffoldId(ID_t contigid)
+{
+ if (m_contigscafflookup.empty()){return 0;}
+ return m_contigscafflookup[contig_bank.lookupBID(contigid)];
+}
+
+
+AMOS::ID_t DataStore::getPersistantRead(AMOS::ID_t readiid, int errorrate)
+{
+ string eid = read_bank.lookupEID(readiid);
+ eid = eid.substr(0, eid.find_first_of("_")+1);
+
+ char buffer[16];
+ sprintf(buffer, "%04d", errorrate);
+ eid += buffer;
+
+ ID_t newiid = read_bank.lookupIID(eid);
+ return newiid;
+}
+
+
+typedef HASHMAP::hash_map<ID_t, Tile_t *> SeqTileMap_t;
+
+
+void DataStore::mapReadsToScaffold(Scaffold_t & scaff,
+ vector<Tile_t> & tiling,
+ int verbose)
+{
+ Contig_t contig;
+ vector<Tile_t> & ctiling = scaff.getContigTiling();
+ vector<Tile_t>::const_iterator ci;
+
+ if (verbose) { cerr << "Mapping reads to scaffold " << scaff.getEID() << "... "; }
+
+ for (ci = ctiling.begin(); ci != ctiling.end(); ci++)
+ {
+ contig_bank.fetch(ci->source, contig);
+
+ int clen = contig.getLength();
+
+ vector<Tile_t> & crtiling = contig.getReadTiling();
+ vector<Tile_t>::const_iterator ri;
+ for (ri = crtiling.begin(); ri != crtiling.end(); ri++)
+ {
+ Tile_t mappedTile;
+ mappedTile.source = ri->source;
+ mappedTile.gaps = ri->gaps;
+ mappedTile.range = ri->range;
+
+ int offset = ri->offset;
+ if (ci->range.isReverse())
+ {
+ mappedTile.range.swap();
+ offset = clen - (offset + ri->range.getLength() + ri->gaps.size());
+ }
+
+ mappedTile.offset = ci->offset + offset;
+
+ tiling.push_back(mappedTile);
+ }
+ }
+
+ if (verbose) { cerr << tiling.size() << " reads mapped" << endl; }
+}
+
+
+void DataStore::calculateInserts(vector<Tile_t> & tiling,
+ vector<Insert *> & inserts,
+ bool connectMates,
+ int verbose)
+{
+ if (verbose) { cerr << "Loading mates "; }
+
+ SeqTileMap_t seqtileLookup;
+
+ int mated = 0;
+ int unmated = 0;
+ int matelisted = 0;
+
+ int happycount = 0;
+ int unhappycount = 0;
+
+ vector<Tile_t>::iterator ti;
+
+ // map iid -> tile * (within this contig)
+ for (ti = tiling.begin();
+ ti != tiling.end();
+ ti++)
+ {
+ seqtileLookup[ti->source] = &(*ti);
+ }
+
+
+ Insert * insert;
+
+ ProgressDots_t dots(seqtileLookup.size(), 50);
+ int count = 0;
+
+ // For each read in the contig
+ SeqTileMap_t::iterator ai;
+ for (ai = seqtileLookup.begin();
+ ai != seqtileLookup.end();
+ ai++)
+ {
+ count++;
+ if (verbose) { dots.update(count); }
+
+ if (ai->second == NULL)
+ {
+ //cerr << "Skipping already seen read" << endl;
+ continue;
+ }
+
+ ID_t aid = ai->first;
+ ID_t acontig = lookupContigId(aid);
+ Tile_t * atile = ai->second;
+
+ AMOS::ID_t libid = getLibrary(aid);
+ AMOS::Distribution_t dist = getLibrarySize(libid);
+
+ DataStore::MateInfo_t mates = getMatePair(aid);
+
+ // Does it have a mate
+ if (mates.first == 0)
+ {
+ // no mate
+ unmated++;
+ insert = new Insert(aid, acontig, atile,
+ AMOS::NULL_ID, AMOS::NULL_ID, NULL,
+ libid, dist,
+ AMOS::Fragment_t::NULL_FRAGMENT);
+ }
+ else
+ {
+ matelisted++;
+
+ ID_t bid = mates.first;
+ ID_t bcontig = AMOS::NULL_ID;
+ Tile_t * btile = NULL;
+ bcontig = lookupContigId(bid);
+
+ SeqTileMap_t::iterator bi = seqtileLookup.find(bid);
+
+ if (bi != seqtileLookup.end())
+ {
+ mated++;
+
+ btile = bi->second;
+ bi->second = NULL;
+ }
+
+ insert = new Insert(aid, acontig, atile,
+ bid, bcontig, btile,
+ libid, dist,
+ mates.second);
+
+ if (insert->m_state == Insert::Happy) { happycount++; }
+ else { unhappycount++; }
+
+
+ if (connectMates && insert->reasonablyConnected())
+ {
+ // A and B are within this contig, and should be drawn together
+ insert->m_active = 2;
+ }
+ else if (btile)
+ {
+ // A and B are within this contig, but not reasonably connected
+ //Insert * j = new Insert(*insert);
+
+ Insert * j = new Insert(aid, acontig, atile,
+ bid, bcontig, btile,
+ libid, dist,
+ mates.second);
+ j->setActive(1, insert, connectMates);
+ inserts.push_back(j);
+
+ insert->setActive(0, j, connectMates);
+ }
+ else
+ {
+ // Just A is valid
+ insert->setActive(0, NULL, connectMates);
+ }
+ }
+
+ inserts.push_back(insert);
+
+ // Mark that this read has been taken care of already
+ ai->second = NULL;
+ }
+
+ sort(inserts.begin(), inserts.end(), Insert::TilingOrderCmp());
+
+ if (verbose)
+ {
+ cerr << endl;
+
+ cerr << "inserts: " << inserts.size()
+ << " mated: " << mated
+ << " matelisted: " << matelisted
+ << " unmated: " << unmated
+ << " happy: " << happycount
+ << " unhappy: " << unhappycount << endl;
+ }
+}
+
+
+map<ID_t, CoverageStats> DataStore::computeCEStats(vector<Insert *> & inserts)
+{
+ typedef map<ID_t, CoverageStats> LibStats;
+ LibStats libStats;
+ LibStats::iterator li;
+
+ int curloffset = 0, curroffset = 0;
+ int totalinsertlen = 0;
+
+ vector<Insert *>::iterator ii;
+ for (ii = inserts.begin(); ii != inserts.end(); ii++)
+ {
+ curloffset = (*ii)->m_loffset;
+ curroffset = (*ii)->m_roffset;
+
+ totalinsertlen += (curroffset - curloffset + 1);
+
+ if ((*ii)->ceConnected())
+ {
+ li = libStats.find((*ii)->m_libid);
+
+ if (li == libStats.end())
+ {
+ li = libStats.insert(make_pair((*ii)->m_libid, CoverageStats(inserts.size()*4, (*ii)->m_libid, (*ii)->m_dist))).first;
+ }
+
+ li->second.addEndpoints(curloffset, curroffset);
+ }
+ }
+
+ int cestatsheight = 100;
+
+ for (li = libStats.begin(); li != libStats.end(); li++)
+ {
+ li->second.finalize();
+ li->second.finalizeCE(cestatsheight);
+ }
+
+ return libStats;
+}
+
+
+static unsigned Char_To_Binary (char ch)
+// Return the binary equivalent of ch .
+ {
+ switch (tolower (ch))
+ {
+ case 'a' :
+ case 'n' :
+ return 0;
+ case 'c' :
+ return 1;
+ case 'g' :
+ return 2;
+ case 't' :
+ return 3;
+ default :
+ return 0;
+ }
+ return 0;
+ }
+
+
+
+
+char BinaryToAscii(char b)
+{
+ switch(b)
+ {
+ case 0: return 'A';
+ case 1: return 'C';
+ case 2: return 'G';
+ case 3: return 'T';
+ }
+
+ return '*';
+}
+
+void DataStore::MerToAscii(Mer_t mer, string & s)
+{
+ s.erase();
+
+ for (int i = 0; i < Kmer_Len; i++)
+ {
+ char a = BinaryToAscii(mer & 0x3);
+ mer >>= 2;
+
+ s.append(1, a);
+ }
+
+ reverse(s.begin(), s.end());
+}
+
+
+void DataStore::Forward_Add_Ch (DataStore::Mer_t & mer, char ch)
+
+// Add ch to mer on the right, sliding one character
+// off the left end of mer .
+
+ {
+ mer &= Forward_Mask;
+ mer <<= 2;
+ mer |= Char_To_Binary (ch);
+
+ return;
+ }
+
+void DataStore::Reverse_Add_Ch (DataStore::Mer_t & mer, char ch)
+
+// Add the Watson-Crick complement of ch to mer on the left,
+// sliding one character off the right end of mer .
+
+ {
+ mer >>= 2;
+ mer |= ((long long unsigned) (3 ^ Char_To_Binary (ch)) << (2 * Kmer_Len - 2));
+
+ return;
+ }
+
+void DataStore::Fasta_To_Binary (const string & s, Mer_t & mer)
+
+// Convert string s to its binary equivalent in mer .
+
+ {
+ int i, n;
+
+ n = s . length ();
+ mer = 0;
+ for (i = 0; i < n; i ++)
+ {
+ mer <<= 2;
+ mer |= Char_To_Binary (s [i]);
+ }
+
+ return;
+ }
+
+
+
+void DataStore::Read_Mers (const char * fname)
+
+// Read kmers from file name fname and save them
+// in binary form in mer_list . Input format is
+// a multi-fasta file. Mers are assumed to contain only
+// ACGT's
+
+{
+ FILE * fp;
+ string s, tag;
+ Mer_t mer;
+
+ cerr << "Loading mers... ";
+
+ fp = File_Open (fname, "r", __FILE__, __LINE__);
+
+ mer_table . clear ();
+
+ while (Fasta_Read (fp, s, tag))
+ {
+ unsigned short mercount = atoi(tag.c_str());
+
+ if (Kmer_Len == 0)
+ {
+ Kmer_Len = s . length ();
+ }
+ else if (Kmer_Len != int (s . length ()))
+ {
+ cerr << "New kmer " << s << " has length " << s.length() << " instead of " << Kmer_Len << endl;
+ throw "Error!";
+ }
+ Fasta_To_Binary (s, mer);
+
+ // MerToAscii(mer, tag);
+ // fprintf(stderr, "orig: %s mer: %032llx asc: %s\n", s.c_str(), mer, tag.c_str());
+
+ mer_table.insert(make_pair(mer, mercount));
+ }
+
+ cerr << mer_table.size() << " mers loaded." << endl;
+
+ Forward_Mask = ((long long unsigned) 1 << (2 * Kmer_Len - 2)) - 1;
+
+ return;
+}
+
+unsigned int DataStore::getMerCoverage(Mer_t fwd_mer, Mer_t rev_mer)
+{
+ unsigned int fcount = 0;
+ unsigned int rcount = 0;
+
+ MerTable_t::const_iterator fi = mer_table.find(fwd_mer);
+ MerTable_t::const_iterator ri = mer_table.find(rev_mer);
+
+ if (fi != mer_table.end()) { fcount = fi->second; }
+ if (ri != mer_table.end()) { rcount = ri->second; }
+
+ unsigned int mcount = (fcount > rcount) ? fcount : rcount;
+
+
+ return mcount;
+}
+
diff --git a/src/Contig/DataStore.hh b/src/Contig/DataStore.hh
new file mode 100644
index 0000000..e679d11
--- /dev/null
+++ b/src/Contig/DataStore.hh
@@ -0,0 +1,137 @@
+#ifndef DATA_STORE_HH_
+#define DATA_STORE_HH_ 1
+
+#include "foundation_AMOS.hh"
+#include <string>
+#include <map>
+#include <vector>
+#include "CoverageStats.hh"
+
+using std::string;
+using std::map;
+using std::pair;
+using std::vector;
+
+class Insert;
+
+namespace __gnu_cxx
+{
+ template<> struct hash< long long unsigned >
+ {
+ size_t operator() (const long long unsigned x) const
+ {
+ return (x ^ ( x >> 32));
+ }
+ };
+}
+
+
+
+
+
+class DataStore
+{
+public:
+
+ DataStore();
+ ~DataStore();
+
+ int openBank(const string & bank_name);
+ int setContigId(int id);
+
+ void fetchScaffoldIID(AMOS::ID_t scaffid, AMOS::Scaffold_t & scaff);
+ void fetchScaffoldBID(AMOS::ID_t scaffid, AMOS::Scaffold_t & scaff);
+
+ void fetchContigIID(AMOS::ID_t contigid, AMOS::Contig_t & contig);
+ void fetchContigEID(const std::string & eid, AMOS::Contig_t & contig);
+ void fetchContigBID(AMOS::ID_t contigid, AMOS::Contig_t & contig);
+
+ void fetchFragIID(AMOS::ID_t fragid, AMOS::Fragment_t & frag);
+ void fetchReadIID(AMOS::ID_t readid, AMOS::Read_t & read);
+
+ AMOS::Distribution_t getLibrarySize(AMOS::ID_t libid);
+ AMOS::ID_t getLibrary(AMOS::ID_t readid);
+ AMOS::ID_t lookupContigId(AMOS::ID_t readid);
+ AMOS::ID_t lookupScaffoldId(AMOS::ID_t readid);
+ AMOS::ID_t lookupFragId(AMOS::ID_t readid);
+
+ typedef pair<AMOS::ID_t, AMOS::FragmentType_t> MateInfo_t;
+
+ MateInfo_t getMatePair(AMOS::ID_t readid);
+
+ AMOS::BankStream_t contig_bank;
+ AMOS::BankStream_t read_bank;
+ AMOS::BankStream_t frag_bank;
+ AMOS::BankStream_t lib_bank;
+ AMOS::BankStream_t scaffold_bank;
+ AMOS::BankStream_t feat_bank;
+
+ AMOS::BankStream_t edge_bank;
+ AMOS::Bank_t link_bank;
+
+ std::string m_bankname;
+
+ AMOS::ID_t m_contigId;
+ AMOS::ID_t m_scaffoldId;
+ bool m_loaded;
+
+ AMOS::Contig_t m_contig;
+
+ typedef vector<MateInfo_t> MateLookupMap;
+ MateLookupMap m_readmatelookup;
+
+
+ typedef vector<AMOS::ID_t> IdLookup_t;
+ IdLookup_t m_fragliblookup;
+ IdLookup_t m_contigscafflookup;
+ IdLookup_t m_readcontiglookup;
+ IdLookup_t m_readfraglookup;
+
+ typedef HASHMAP::hash_map<AMOS::ID_t, AMOS::Distribution_t> LibLookup_t;
+ LibLookup_t m_libdistributionlookup;
+
+ AMOS::ID_t getPersistantRead(AMOS::ID_t readiid, int errorrate);
+
+ void calculateInserts(vector<AMOS::Tile_t> & tiling,
+ vector<Insert *> & inserts,
+ bool connectMates,
+ int verbose);
+
+ void mapReadsToScaffold(AMOS::Scaffold_t & scaff,
+ vector<AMOS::Tile_t> & tiling,
+ int verbose);
+
+ std::map<AMOS::ID_t, CoverageStats> computeCEStats(std::vector<Insert *> & inserts);
+
+
+
+
+
+
+ typedef long long unsigned Mer_t;
+ typedef HASHMAP::hash_map<Mer_t, unsigned short> MerTable_t;
+
+ MerTable_t mer_table;
+ int Kmer_Len;
+
+ void Forward_Add_Ch (Mer_t & mer, char ch);
+ void Reverse_Add_Ch (Mer_t & mer, char ch);
+ void Read_Mers (const char * fname);
+ void MerToAscii(Mer_t mer, string & s);
+ void Fasta_To_Binary (const string & s, Mer_t & mer);
+ unsigned int getMerCoverage(Mer_t fwd_mer, Mer_t rev_mer);
+
+
+ Mer_t Forward_Mask;
+
+
+private:
+ void indexFrags();
+ void indexReads();
+ void indexLibraries();
+ void indexContigs();
+ void indexScaffolds();
+};
+
+
+#endif
diff --git a/src/Contig/Insert.cc b/src/Contig/Insert.cc
new file mode 100644
index 0000000..df6bfd5
--- /dev/null
+++ b/src/Contig/Insert.cc
@@ -0,0 +1,279 @@
+#include "Insert.hh"
+#include <algorithm>
+
+using namespace AMOS;
+using namespace std;
+
+const int MAXTRANSPOSONDIST = 100;
+const int MIN3PRIMETRIM = 250;
+const int REASONABLY_CONNECTED_SD = 10;
+const int CE_CONNECTED_SD = 8;
+const int READLEN = 500;
+
+float Insert::MAXSTDEV = 2;
+const char * Insert::allstates = "HECOLSNU";
+
+Insert::Insert(ID_t aid,
+ ID_t acontig,
+ Tile_t * atile,
+ ID_t bid,
+ ID_t bcontig,
+ Tile_t * btile,
+ ID_t libid,
+ Distribution_t dist,
+ AMOS::FragmentType_t matetype)
+{
+ m_atile = atile;
+ m_aid = aid;
+ m_acontig = acontig;
+
+ m_btile = btile;
+ m_bid = bid;
+ m_bcontig = bcontig;
+
+ m_matetype = matetype;
+ m_dist = dist;
+ m_libid = libid;
+
+ m_state = Unknown;
+ m_active = -1;
+ m_actual = -1;
+
+ m_length = m_dist.mean;
+
+ m_arc = 0;
+ m_brc = 0;
+
+ // Gapped ranges on the contig
+ Range_t arange, brange;
+
+ if (atile)
+ {
+ m_arc = atile->range.isReverse();
+ arange.setBegin(atile->offset);
+ arange.setEnd(atile->offset + atile->getGappedLength() - 1);
+ }
+
+ if (btile)
+ {
+ m_brc = btile->range.isReverse();
+ brange.setBegin(btile->offset);
+ brange.setEnd(btile->offset + btile->getGappedLength() - 1);
+ }
+
+ if (atile && btile)
+ {
+ m_loffset = min(arange.begin, brange.begin);
+ m_roffset = max(arange.end, brange.end);
+
+ m_length = m_roffset - m_loffset + 1;
+
+ m_state = Happy;
+ m_active = 2;
+
+ if (m_matetype == Fragment_t::TRANSPOSON)
+ {
+ if (m_arc) { m_actual = brange.begin - arange.end; }
+ else { m_actual = arange.begin - brange.end; }
+
+ if (m_actual > MAXTRANSPOSONDIST)
+ {
+ m_state = ExpandedMate;
+ }
+
+ if ((m_arc + m_brc != 1) ||
+ (m_arc && arange.end > brange.end) ||
+ (m_arc && brange.begin < arange.begin) ||
+ (m_brc && brange.end > arange.end) ||
+ (m_brc && arange.begin < brange.begin))
+ {
+ m_state = OrientationViolation;
+ }
+ }
+ else
+ {
+ if ((unsigned int)m_length > (unsigned int)(dist.mean + MAXSTDEV*dist.sd))
+ {
+ m_state = ExpandedMate;
+ }
+ else if ((int)(m_length + MAXSTDEV*dist.sd) < dist.mean)
+ {
+ m_state = CompressedMate;
+ }
+
+ // Orientation violation if the reads point in the same direction, or
+ // there is at least one 3' base not covered:
+ // <--------
+ // -------->
+ // ^ ^
+
+ if ((m_arc + m_brc != 1) ||
+ (m_arc && arange.begin < brange.begin) ||
+ (m_arc && brange.end > arange.end) ||
+ (m_brc && brange.begin < arange.begin) ||
+ (m_brc && arange.end > brange.end))
+ {
+ m_state = OrientationViolation;
+ }
+ }
+ }
+ else if (atile)
+ {
+ m_state = LinkingMate;
+ m_loffset = arange.begin;
+ m_roffset = arange.end;
+
+ if (bid == NULL_ID)
+ {
+ m_state = NoMate;
+ m_length = m_roffset - m_loffset + 1;
+ m_active = 0;
+ }
+ else if (bcontig == NULL_ID)
+ {
+ m_state = SingletonMate;
+ }
+ }
+ else
+ {
+ if (btile)
+ {
+ throw "btile, but no atile!";
+ }
+
+ throw "No Tile!";
+ }
+
+ if (m_actual == -1)
+ {
+ m_actual = m_roffset - m_loffset + 1;
+ }
+ m_other = NULL;
+ m_canvasItem = NULL;
+}
+
+void Insert::printInsert() const
+{
+ cerr << m_aid << "," << m_bid << " l:" << m_loffset << " r:" << m_roffset << " s:" << (char)m_state << endl;
+}
+
+int Insert::getProjectedPosition(Tile_t * tile, Distribution_t dist)
+{
+ if (tile->range.isReverse())
+ {
+ return (int)(tile->offset + tile->getGappedLength() - 1 - dist.mean - MAXSTDEV*dist.sd - READLEN);
+ }
+ else
+ {
+ return (int)(tile->offset + dist.mean + MAXSTDEV*dist.sd + READLEN);
+ }
+}
+
+
+bool Insert::reasonablyConnected() const
+{
+ if (!m_atile || !m_btile) { return false; }
+
+ if (m_matetype == Fragment_t::TRANSPOSON)
+ {
+ return true;
+ }
+
+ return (m_state == Happy) ||
+ (m_state == CompressedMate) ||
+ (m_state == ExpandedMate && (m_actual <= m_dist.mean + REASONABLY_CONNECTED_SD * m_dist.sd));
+
+
+ /* //This would force reads that overlap to be disconnected
+ (m_state == CompressedMate && (m_actual > (m_atile->getGappedLength() + m_btile->getGappedLength())));
+ */
+}
+
+bool Insert::ceConnected() const
+{
+ // if (m_acontig != m_bcontig) {return false;}
+ if (m_matetype == Fragment_t::TRANSPOSON)
+ {
+ return false;
+ }
+
+ return ((m_state == Happy) ||
+ (m_state == CompressedMate) ||
+ (m_state == ExpandedMate)) &&
+ (abs(m_actual - m_dist.mean) < (CE_CONNECTED_SD * m_dist.sd));
+}
+
+void Insert::setActive(int i, Insert * other, bool includeLibrary)
+{
+ Tile_t * tile;
+ m_other = other;
+
+ m_active = i;
+
+ if (i == 0) { tile = m_atile; }
+ else { tile = m_btile; }
+
+ int len = tile->getGappedLength();
+
+ if (includeLibrary)
+ {
+ if (tile->range.isReverse())
+ {
+ m_roffset = tile->offset + len - 1;
+
+ if (m_dist.mean > len)
+ {
+ m_loffset = m_roffset - m_dist.mean;
+ }
+ else
+ {
+ m_loffset = tile->offset - MIN3PRIMETRIM;
+ }
+ }
+ else
+ {
+ m_loffset = tile->offset;
+
+ if (m_dist.mean > len)
+ {
+ m_roffset = m_loffset + m_dist.mean;
+ }
+ else
+ {
+ m_roffset = m_loffset + len + MIN3PRIMETRIM - 1;
+ }
+ }
+ }
+ else
+ {
+ m_loffset = tile->offset;
+ m_roffset = tile->offset + len - 1;
+ }
+
+ m_length = m_roffset - m_loffset + 1;
+}
+
+static const char * happystr = "Happy";
+static const char * compressedstr = "Compressed Mate";
+static const char * expandedstr = "Stretched Mate";
+static const char * orientationstr = "Orientation Violation";
+static const char * linkingstr = "Linking Mate";
+static const char * singletonstr = "Singleton Mate";
+static const char * unmatedstr = "Unmated";
+static const char * unknownstr = "Unknown";
+
+const char * Insert::getInsertTypeStr(MateState state)
+{
+ switch (state)
+ {
+ case Happy: return happystr;
+ case ExpandedMate: return expandedstr;
+ case CompressedMate: return compressedstr;
+ case OrientationViolation: return orientationstr;
+ case LinkingMate: return linkingstr;
+ case SingletonMate: return singletonstr;
+ case NoMate: return unmatedstr;
+ default: return unknownstr;
+ }
+}
+
diff --git a/src/Contig/Insert.hh b/src/Contig/Insert.hh
new file mode 100644
index 0000000..45304b0
--- /dev/null
+++ b/src/Contig/Insert.hh
@@ -0,0 +1,96 @@
+#ifndef INSERT_HH_
+#define INSERT_HH_ 1
+
+#include "foundation_AMOS.hh"
+
+class InsertCanvasItem;
+
+class Insert
+{
+public:
+ Insert(AMOS::ID_t aid, AMOS::ID_t acontig, AMOS::Tile_t * atile,
+ AMOS::ID_t bid, AMOS::ID_t bcontig, AMOS::Tile_t * btile,
+ AMOS::ID_t libid, AMOS::Distribution_t distribution,
+ AMOS::FragmentType_t matetype);
+
+ void setActive(int i, Insert * other, bool includeLibrary);
+ int getProjectedPosition(AMOS::Tile_t * tile, AMOS::Distribution_t dist);
+ void printInsert() const;
+ bool reasonablyConnected() const;
+ bool ceConnected() const;
+
+ int m_loffset;
+ int m_roffset;
+ int m_length;
+ int m_actual;
+
+ static float MAXSTDEV;
+
+ int m_arc;
+ int m_brc;
+
+ AMOS::FragmentType_t m_matetype;
+
+ Insert * m_other;
+ InsertCanvasItem * m_canvasItem;
+
+ AMOS::Distribution_t m_dist;
+ AMOS::ID_t m_libid;
+
+ int m_active;
+
+ enum MateState
+ {
+ Happy = 'H',
+ ExpandedMate = 'E',
+ CompressedMate = 'C',
+ OrientationViolation = 'O',
+ LinkingMate = 'L',
+ SingletonMate = 'S',
+ NoMate = 'N',
+ Unknown = 'U',
+ };
+
+ MateState m_state;
+
+ AMOS::Tile_t * m_atile;
+ AMOS::ID_t m_acontig;
+ AMOS::ID_t m_aid;
+
+ AMOS::Tile_t * m_btile;
+ AMOS::ID_t m_bcontig;
+ AMOS::ID_t m_bid;
+
+
+ struct TilingOrderCmp
+ {
+ bool operator() (Insert * const & a, Insert * const & b)
+ {
+ int offdiff = b->m_loffset - a->m_loffset;
+
+ if (offdiff)
+ {
+ if (offdiff < 0) { return false; }
+ return true;
+ }
+
+ int lendiff = b->m_roffset - a->m_roffset;
+
+ if (lendiff)
+ {
+ if (lendiff < 0) { return false; }
+ return true;
+ }
+
+ // stl requires a strict weak ordering. Return false if tie.
+ return false;
+ }
+ };
+
+
+ static const char * getInsertTypeStr(MateState state);
+ static const char * allstates;
+
+};
+
+#endif
diff --git a/src/Contig/InsertStats.cc b/src/Contig/InsertStats.cc
new file mode 100644
index 0000000..c4e4544
--- /dev/null
+++ b/src/Contig/InsertStats.cc
@@ -0,0 +1,121 @@
+#include "InsertStats.hh"
+#include <cmath>
+#include <algorithm>
+#include <functional>
+#include <iostream>
+
+using namespace std;
+
+
+InsertStats::InsertStats(const string & label)
+ : m_label(label)
+{
+}
+
+void InsertStats::addSize(double size)
+{
+ m_sizes.push_back(size);
+}
+
+
+int InsertStats::count() const
+{
+ return m_sizes.size();
+}
+
+
+double InsertStats::mean() const
+{
+ if (m_sizes.size() == 0) { return 0; }
+
+ double sum = 0;
+ for (int i = 0; i < m_sizes.size(); i++)
+ { sum += m_sizes[i]; }
+
+ return (sum) / m_sizes.size();
+}
+
+
+double InsertStats::stdev() const
+{
+ if (m_sizes.size() == 0) { return 0; }
+
+ double mea = mean();
+
+ double sumdiff = 0;
+
+ for (int i = 0; i < m_sizes.size(); i++)
+ {
+ double diff = m_sizes[i] - mea;
+ sumdiff += (diff *diff);
+ }
+
+ sumdiff /= m_sizes.size() -1;
+
+ return sqrt(sumdiff);
+}
+
+void InsertStats::histogram(int buckets, bool fitzero)
+{
+ if (m_sizes.size() == 0) { return; }
+
+ m_buckets.resize(buckets);
+ m_bucketlow.resize(buckets);
+
+ m_low = m_sizes[0];
+ m_high = m_sizes[0];
+
+ vector<double>::iterator vi;
+ for (vi = m_sizes.begin(); vi != m_sizes.end(); vi++)
+ {
+ if (*vi < m_low) { m_low = *vi; }
+ if (*vi > m_high) { m_high = *vi; }
+ }
+
+ double base = m_low;
+ if (fitzero) { base = 0.0; }
+
+ m_bucketsize = (m_high - base + 1) / (buckets);
+
+ if (m_high <= 1.0)
+ {
+ m_bucketsize = 1.0L / buckets;
+ }
+
+ for (int i = 0; i < buckets; i++)
+ {
+ m_buckets[i] = 0;
+ m_bucketlow[i] = base + (i*m_bucketsize);
+ }
+
+ for (vi = m_sizes.begin(); vi != m_sizes.end(); vi++)
+ {
+ int bucket = (int)floor(((*vi) - base)/m_bucketsize);
+ m_buckets[bucket]++;
+ }
+
+ m_maxcount = m_buckets[0];
+ for (int i = 0; i < buckets; i++)
+ {
+ if (m_buckets[i] > m_maxcount) { m_maxcount = m_buckets[i]; }
+ }
+}
+
+int InsertStats::withinSD(double numsd) const
+{
+ double mea = mean();
+ double sd = stdev();
+
+ double lo = mea - numsd * sd;
+ double hi = mea + numsd * sd;
+
+ int count = 0;
+
+ vector<double>::const_iterator vi;
+ for (vi = m_sizes.begin(); vi != m_sizes.end(); vi++)
+ {
+ count += (lo <= *vi && *vi <= hi);
+ }
+
+ return count;
+}
diff --git a/src/Contig/InsertStats.hh b/src/Contig/InsertStats.hh
new file mode 100644
index 0000000..534b3c1
--- /dev/null
+++ b/src/Contig/InsertStats.hh
@@ -0,0 +1,32 @@
+#ifndef INSERTSTATS_HH_
+#define INSERTSTATS_HH_ 1
+
+#include <vector>
+#include <string>
+
+class InsertStats
+{
+public:
+ InsertStats(const std::string & label);
+ std::string m_label;
+
+ void addSize(double size);
+ void histogram(int buckets, bool fitzero=true);
+
+ int count() const;
+ double mean() const;
+ double stdev() const;
+ int withinSD(double numsd) const;
+
+ std::vector<double> m_sizes;
+
+ std::vector<int> m_buckets;
+ std::vector<double> m_bucketlow;
+ double m_bucketsize;
+ double m_low;
+ double m_high;
+ int m_maxcount;
+};
+
+
+#endif
diff --git a/src/Contig/Makefile.am b/src/Contig/Makefile.am
new file mode 100644
index 0000000..5aae3af
--- /dev/null
+++ b/src/Contig/Makefile.am
@@ -0,0 +1,45 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+amoslib_LIBRARIES = \
+ libContigUtils.a \
+ libDataStore.a
+
+
+amosinclude_HEADERS = \
+ ContigUtils.hh \
+ DataStore.hh \
+ CoverageStats.hh \
+ Insert.hh \
+ InsertStats.hh
+
+
+##-- TO BE INSTALLED
+bin_PROGRAMS = \
+ olapsFromContig
+
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Slice \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/Foundation
+
+libContigUtils_a_SOURCES = \
+ ContigUtils.cc
+
+libDataStore_a_SOURCES = \
+ DataStore.cc \
+ CoverageStats.cc \
+ Insert.cc \
+ InsertStats.cc
+
+##-- olapsFromContig
+olapsFromContig_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+olapsFromContig_SOURCES = \
+ olapsFromContig.cc
+
diff --git a/src/Contig/Makefile.in b/src/Contig/Makefile.in
new file mode 100644
index 0000000..d63b923
--- /dev/null
+++ b/src/Contig/Makefile.in
@@ -0,0 +1,698 @@
+# 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 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@
+DIST_COMMON = $(amosinclude_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = olapsFromContig$(EXEEXT)
+subdir = src/Contig
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(amosincludedir)"
+LIBRARIES = $(amoslib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libContigUtils_a_AR = $(AR) $(ARFLAGS)
+libContigUtils_a_LIBADD =
+am_libContigUtils_a_OBJECTS = ContigUtils.$(OBJEXT)
+libContigUtils_a_OBJECTS = $(am_libContigUtils_a_OBJECTS)
+libDataStore_a_AR = $(AR) $(ARFLAGS)
+libDataStore_a_LIBADD =
+am_libDataStore_a_OBJECTS = DataStore.$(OBJEXT) \
+ CoverageStats.$(OBJEXT) Insert.$(OBJEXT) InsertStats.$(OBJEXT)
+libDataStore_a_OBJECTS = $(am_libDataStore_a_OBJECTS)
+PROGRAMS = $(bin_PROGRAMS)
+am_olapsFromContig_OBJECTS = olapsFromContig.$(OBJEXT)
+olapsFromContig_OBJECTS = $(am_olapsFromContig_OBJECTS)
+olapsFromContig_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(libContigUtils_a_SOURCES) $(libDataStore_a_SOURCES) \
+ $(olapsFromContig_SOURCES)
+DIST_SOURCES = $(libContigUtils_a_SOURCES) $(libDataStore_a_SOURCES) \
+ $(olapsFromContig_SOURCES)
+HEADERS = $(amosinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+amoslib_LIBRARIES = \
+ libContigUtils.a \
+ libDataStore.a
+
+amosinclude_HEADERS = \
+ ContigUtils.hh \
+ DataStore.hh \
+ CoverageStats.hh \
+ Insert.hh \
+ InsertStats.hh
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Slice \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/Foundation
+
+libContigUtils_a_SOURCES = \
+ ContigUtils.cc
+
+libDataStore_a_SOURCES = \
+ DataStore.cc \
+ CoverageStats.cc \
+ Insert.cc \
+ InsertStats.cc
+
+olapsFromContig_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+olapsFromContig_SOURCES = \
+ olapsFromContig.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Contig/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Contig/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):
+install-amoslibLIBRARIES: $(amoslib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(amoslibdir)" || $(MKDIR_P) "$(DESTDIR)$(amoslibdir)"
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(amoslibdir)'"; \
+ $(INSTALL_DATA) $$list2 "$(DESTDIR)$(amoslibdir)" || exit $$?; }
+ @$(POST_INSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ for p in $$list; do \
+ if test -f $$p; then \
+ $(am__strip_dir) \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && $(RANLIB) $$f )"; \
+ ( cd "$(DESTDIR)$(amoslibdir)" && $(RANLIB) $$f ) || exit $$?; \
+ else :; fi; \
+ done
+
+uninstall-amoslibLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && rm -f "$$files" )"; \
+ cd "$(DESTDIR)$(amoslibdir)" && rm -f $$files
+
+clean-amoslibLIBRARIES:
+ -test -z "$(amoslib_LIBRARIES)" || rm -f $(amoslib_LIBRARIES)
+libContigUtils.a: $(libContigUtils_a_OBJECTS) $(libContigUtils_a_DEPENDENCIES)
+ -rm -f libContigUtils.a
+ $(libContigUtils_a_AR) libContigUtils.a $(libContigUtils_a_OBJECTS) $(libContigUtils_a_LIBADD)
+ $(RANLIB) libContigUtils.a
+libDataStore.a: $(libDataStore_a_OBJECTS) $(libDataStore_a_DEPENDENCIES)
+ -rm -f libDataStore.a
+ $(libDataStore_a_AR) libDataStore.a $(libDataStore_a_OBJECTS) $(libDataStore_a_LIBADD)
+ $(RANLIB) libDataStore.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+olapsFromContig$(EXEEXT): $(olapsFromContig_OBJECTS) $(olapsFromContig_DEPENDENCIES)
+ @rm -f olapsFromContig$(EXEEXT)
+ $(CXXLINK) $(olapsFromContig_OBJECTS) $(olapsFromContig_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ContigUtils.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CoverageStats.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/DataStore.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Insert.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/InsertStats.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/olapsFromContig.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+install-amosincludeHEADERS: $(amosinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(amosincludedir)" || $(MKDIR_P) "$(DESTDIR)$(amosincludedir)"
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(amosincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(amosincludedir)" || exit $$?; \
+ done
+
+uninstall-amosincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amosincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(amosincludedir)" && rm -f $$files
+
+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:
+ for dir in "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(amosincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-amoslibLIBRARIES clean-binPROGRAMS clean-generic \
+ 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-amosincludeHEADERS install-amoslibLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-amosincludeHEADERS uninstall-amoslibLIBRARIES \
+ uninstall-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-amoslibLIBRARIES clean-binPROGRAMS clean-generic ctags \
+ distclean distclean-compile distclean-generic distclean-tags \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-amosincludeHEADERS install-amoslibLIBRARIES \
+ install-binPROGRAMS 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-compile mostlyclean-generic pdf pdf-am \
+ ps ps-am tags uninstall uninstall-am \
+ uninstall-amosincludeHEADERS uninstall-amoslibLIBRARIES \
+ uninstall-binPROGRAMS uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Contig/olapsFromContig.cc b/src/Contig/olapsFromContig.cc
new file mode 100644
index 0000000..51a4785
--- /dev/null
+++ b/src/Contig/olapsFromContig.cc
@@ -0,0 +1,637 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//!
+//! Reports read overlaps inferred from CTG (contig) multi alignments.
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+// Note: Some olaps can be really horrible because of unnecssary
+// gaps. Think about refining the alignments.
+
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include <getopt.h>
+#include <stdlib.h>
+#include <assert.h>
+
+using namespace AMOS;
+using namespace std;
+
+#define PROGNAME "olapsFromContig"
+
+#define MIN(a,b) ( (a) < (b) ? (a) : (b) )
+
+//=============================================================== Globals ======
+string OPT_BankName; // bank name parameter
+int OPT_MinOlapLen = 20; // minimum overlap len
+float OPT_MaxOlapErr = 0.05; // maximum overlap err
+
+
+struct TilingOrderCmp_t
+{
+ bool operator() (const Tile_t & a, const Tile_t & b)
+ { return ( a.offset < b.offset ); }
+};
+
+
+struct SimpleOverlap_t
+{
+ int aHang, bHang;
+ float err;
+};
+
+
+//--------------------------------------------------- GetOlapLens --------------
+//! \brief Returns the length of each read involved in the overlap
+//!
+//! \return void
+//!
+void GetOlapLens
+(int aLen, int bLen, int aHang, int bHang, int &aOlapLen, int &bOlapLen)
+{
+ aOlapLen = aLen;
+ bOlapLen = bLen;
+
+ if ( aHang > 0 ) aOlapLen -= aHang;
+ else bOlapLen += aHang;
+
+ if ( bHang > 0 ) bOlapLen -= bHang;
+ else aOlapLen += bHang;
+}
+
+
+//------------------------------------------------------- Overlap --------------
+//! \brief Finds best overlap between readA and readB
+//!
+//! \return void
+//!
+SimpleOverlap_t Overlap(const char *A, int aLen, const char *B, int bLen, float maxErr);
+
+
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+//========================================================= Function Defs ======
+int main (int argc, char ** argv)
+{
+ long nOlaps = 0;
+ int exitcode = EXIT_SUCCESS;
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ Bank_t readBank(Read_t::NCODE);
+ readBank.open(OPT_BankName, B_SPY);
+ Read_t readA, readB;
+
+ BankStream_t contigBank(Contig_t::NCODE);
+ contigBank.open(OPT_BankName, B_SPY);
+ Contig_t contig;
+
+ while ( contigBank >> contig )
+ {
+ vector<Tile_t> & tiling = contig.getReadTiling();
+ sort(tiling.begin(), tiling.end(), TilingOrderCmp_t());
+
+ vector<Tile_t>::iterator ati;
+ vector<Tile_t>::iterator bti;
+ for ( ati = tiling.begin(); ati != tiling.end(); ++ati )
+ {
+ for ( bti = ati+1; bti != tiling.end(); ++bti )
+ {
+ if ( bti->offset > ati->offset + ati->getGappedLength() - 1 )
+ break;
+
+ //-- Potential overlap between read A and B
+ int aOlapHang = bti->offset - ati->offset;
+ int bOlapHang =
+ (bti->offset + bti->getGappedLength()) -
+ (ati->offset + ati->getGappedLength());
+ Pos_t lOlapPos = bti->offset;
+ Pos_t rOlapPos =
+ MIN(ati->offset + ati->getGappedLength() - 1,
+ bti->offset + bti->getGappedLength() - 1);
+ int aOlapLen = rOlapPos - lOlapPos + 1;
+ int bOlapLen = rOlapPos - lOlapPos + 1;
+ vector<Pos_t> aGaps;
+ vector<Pos_t> bGaps;
+
+ sort(ati->gaps.begin(), ati->gaps.end());
+ sort(bti->gaps.begin(), bti->gaps.end());
+
+ //-- Adjust hangs for alignment gaps
+ vector<Pos_t>::const_iterator agi = ati->gaps.begin();
+ vector<Pos_t>::const_iterator bgi = bti->gaps.begin();
+ while ( agi != ati->gaps.end() || bgi != bti->gaps.end() )
+ {
+ Pos_t gapPos;
+ Pos_t aGapPos = MAX_POS;
+ Pos_t bGapPos = MAX_POS;
+
+ //-- gapped contig gap pos calculation
+ // gapped offset + ungapped gap pos + #previous gaps + 1
+ if ( agi != ati->gaps.end() )
+ {
+ aGapPos =
+ ati->offset + *agi + (agi - ati->gaps.begin()) + 1;
+ }
+ if ( bgi != bti->gaps.end() )
+ {
+ bGapPos =
+ bti->offset + *bgi + (bgi - bti->gaps.begin()) + 1;
+ }
+ if ( aGapPos == bGapPos )
+ {
+ // remove double gap in overlap
+ ++agi;
+ ++bgi;
+ aOlapLen--;
+ bOlapLen--;
+ }
+ else
+ {
+ // check left-most gap
+ if ( aGapPos < bGapPos )
+ { gapPos = aGapPos; ++agi; }
+ else
+ { gapPos = bGapPos; ++bgi; }
+
+ if ( gapPos < lOlapPos )
+ {
+ // shrink a hang
+ if ( aOlapHang > 0 ) aOlapHang--;
+ else aOlapHang++;
+ }
+ else if ( gapPos > rOlapPos )
+ {
+ // shrink b hang
+ if ( bOlapHang > 0 ) bOlapHang--;
+ else bOlapHang++;
+ }
+ else
+ {
+ // overlap gaps
+ if ( aGapPos < bGapPos )
+ {
+ aOlapLen--; // a gap
+ aGaps.push_back(*(agi-1));
+ }
+ else
+ {
+ bOlapLen--; // b gap
+ bGaps.push_back(*(bgi-1));
+ }
+ }
+ }
+ }
+
+ // fix hangs if a is reversed
+ if ( ati->range.isReverse() )
+ {
+ int oaOlapHang = aOlapHang;
+ int obOlapHang = bOlapHang;
+ aOlapHang = -obOlapHang;
+ bOlapHang = -oaOlapHang;
+ }
+
+ // skip if olap is too short
+ if ( aOlapLen < OPT_MinOlapLen && bOlapLen < OPT_MinOlapLen )
+ continue;
+
+ char olapType =
+ ati->range.isReverse() == bti->range.isReverse() ? 'N' : 'I';
+
+ //-- Get reads and check error rate of olap
+ readBank.fetch(ati->source, readA);
+ readBank.fetch(bti->source, readB);
+
+ int aLen = readA.getClearRange().getLength();
+ int bLen = readB.getClearRange().getLength();
+ int alignLen = aLen + aGaps.size();
+ if ( aOlapHang < 0 ) alignLen -= aOlapHang;
+ if ( bOlapHang > 0 ) alignLen += bOlapHang;
+
+ char alignA[alignLen+1];
+ char alignB[alignLen+1];
+ for ( int i = 0; i < alignLen; i++ )
+ {
+ alignA[i] = '.';
+ alignB[i] = '.';
+ }
+ alignA[alignLen] = '\0';
+ alignB[alignLen] = '\0';
+
+ int aOff = 0;
+ int bOff = 0;
+ if ( aOlapHang < 0 )
+ aOff -= aOlapHang;
+ else
+ bOff += aOlapHang;
+
+ string A = readA.getSeqString(readA.getClearRange());
+ string B = readB.getSeqString(readB.getClearRange());
+
+ // lazy way to handle the reverse gap math
+ if ( ati->range.isReverse() ) ReverseComplement(A);
+ if ( bti->range.isReverse() ) ReverseComplement(B);
+
+ for ( int i = 0; i < aGaps.size(); ++i )
+ A.insert(aGaps[i]+i, 1, '-');
+ for ( int i = 0; i < bGaps.size(); ++i )
+ B.insert(bGaps[i]+i, 1, '-');
+
+ if ( ati->range.isReverse() ) ReverseComplement(A);
+ if ( bti->range.isReverse() ) ReverseComplement(B);
+
+ if ( olapType == 'I' ) ReverseComplement(B);
+
+ for ( int i = 0; i < A.size(); ++i )
+ alignA[aOff+i] = A[i];
+ for ( int i = 0; i < B.size(); ++i )
+ alignB[bOff+i] = B[i];
+
+ /*
+ cout << alignA << endl;
+ cout << alignB << endl;
+ for ( int i = 1; i <= alignLen; ++i )
+ {
+ if ( i % 10 == 0 ) putchar('|');
+ else putchar(' ');
+ }
+ putchar('\n');
+ */
+
+ int olapErrs = 0;
+ int olapColumns = 0;
+ for ( int i = 0; i < alignLen; ++i )
+ if ( alignA[i] != '.' && alignB[i] != '.' )
+ {
+ olapColumns++;
+ if ( alignA[i] != alignB[i] )
+ olapErrs++;
+ }
+
+ float olapErr = float(olapErrs) / float(olapColumns);
+
+ // if olap too noisy, try to realign from scratch
+ if ( olapErr > OPT_MaxOlapErr )
+ {
+ fprintf(stderr, "Redoing overlap:\n");
+ fprintf(stderr, "%d\t%d\t%c\t%d\t%d\t%d\t%d\t%.2f\t%.2f\n",
+ ati->source, bti->source, olapType,
+ aOlapHang, bOlapHang,
+ aOlapLen, bOlapLen,
+ olapErr*100.0, olapErr*100.0);
+
+ string A = readA.getSeqString(readA.getClearRange());
+ string B = readB.getSeqString(readB.getClearRange());
+ if ( olapType == 'I' ) ReverseComplement(B);
+
+ // needleman-wunsch with no end penalties
+ SimpleOverlap_t newolap =
+ Overlap(A.c_str(), aLen, B.c_str(), bLen, OPT_MaxOlapErr);
+
+ aOlapHang = newolap.aHang;
+ bOlapHang = newolap.bHang;
+ olapErr = newolap.err;
+ GetOlapLens(aLen, bLen,
+ aOlapHang, bOlapHang,
+ aOlapLen, bOlapLen);
+
+ fprintf(stderr, "%d\t%d\t%c\t%d\t%d\t%d\t%d\t%.2f\t%.2f\n",
+ ati->source, bti->source, olapType,
+ aOlapHang, bOlapHang,
+ aOlapLen, bOlapLen,
+ olapErr*100.0, olapErr*100.0);
+
+ if ( aOlapLen >= OPT_MinOlapLen &&
+ bOlapLen >= OPT_MinOlapLen &&
+ olapErr <= OPT_MaxOlapErr )
+ { fprintf(stderr, "Accepted\n"); }
+ else
+ { fprintf(stderr, "Rejected\n"); }
+ }
+
+
+ if ( aOlapLen >= OPT_MinOlapLen &&
+ bOlapLen >= OPT_MinOlapLen &&
+ olapErr <= OPT_MaxOlapErr )
+ {
+ printf("%d\t%d\t%c\t%d\t%d\t%.2f\t%.2f\n",
+ ati->source, bti->source, olapType,
+ aOlapHang, bOlapHang,
+ olapErr*100.0, olapErr*100.0);
+
+ if ( ++nOlaps % 10000 == 0 )
+ fprintf(stderr, "Processed %ld overlaps\n", nOlaps);
+ }
+ }
+ }
+ }
+
+ contigBank.close();
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+ return exitcode;
+}
+
+
+//--------------------------------------------------------------- Overlap ------
+SimpleOverlap_t Overlap(const char *A, int aLen, const char *B, int bLen, float maxErr)
+{
+ // %maxErr flat line
+ double MatchScore = 1;
+ double MismatchScore = (double(maxErr) - MatchScore) / double(maxErr);
+ double GapScore = MismatchScore;
+
+ Pos_t i,j;
+ char O[aLen][bLen];
+ double S[aLen][bLen];
+ double score, bestScore;
+ char bestOp;
+
+ // Fill first column
+ for ( i = 0, j = 0; i < aLen; ++i )
+ {
+ // no gap penalty in first column
+ S[i][j] = ( A[i] == B[j] ? MatchScore : MismatchScore );
+ O[i][j] = '\\';
+ }
+
+ // Fill first row
+ for ( i = 0, j = 0; j < bLen; ++j )
+ {
+ // no gap penalty in first row
+ S[i][j] = ( A[i] == B[j] ? MatchScore : MismatchScore );
+ O[i][j] = '\\';
+ }
+
+ // Fill interior cells
+ for ( i = 1; i < aLen-1; ++i )
+ for ( j = 1; j < bLen-1; ++j )
+ {
+ bestScore = S[i-1][j-1] + ( A[i] == B[j] ? MatchScore : MismatchScore );
+ bestOp = '\\';
+
+ score = S[i][j-1] + GapScore;
+ if ( score > bestScore )
+ {
+ bestScore = score;
+ bestOp = '-';
+ }
+
+ score = S[i-1][j] + GapScore;
+ if ( score > bestScore )
+ {
+ bestScore = score;
+ bestOp = '|';
+ }
+
+ S[i][j] = bestScore;
+ O[i][j] = bestOp;
+ }
+
+ // Fill last column
+ j = bLen-1;
+ for ( i = 1; i < aLen-1; ++i )
+ {
+ bestScore = S[i-1][j-1] + ( A[i] == B[j] ? MatchScore : MismatchScore );
+ bestOp = '\\';
+
+ score = S[i][j-1] + GapScore;
+ if ( score > bestScore )
+ {
+ bestScore = score;
+ bestOp = '-';
+ }
+
+ score = S[i-1][j]; // no gap penalty in last column
+ if ( score > bestScore )
+ {
+ bestScore = score;
+ bestOp = '|';
+ }
+
+ S[i][j] = bestScore;
+ O[i][j] = bestOp;
+ }
+
+ // Fill last row
+ i = aLen-1;
+ for ( j = 1; j < bLen; ++j )
+ {
+ bestScore = S[i-1][j-1] + ( A[i] == B[j] ? MatchScore : MismatchScore );
+ bestOp = '\\';
+
+ score = S[i][j-1]; // no gap penalty in last row
+ if ( score > bestScore )
+ {
+ bestScore = score;
+ bestOp = '-';
+ }
+
+ score = S[i-1][j] + GapScore;
+ if ( score > bestScore )
+ {
+ bestScore = score;
+ bestOp = '|';
+ }
+
+ S[i][j] = bestScore;
+ O[i][j] = bestOp;
+ }
+
+ /*
+ char showA[2*(aLen+bLen)];
+ char showB[2*(aLen+bLen)];
+ int showCnt = 0;
+ */
+
+ // Backtrack
+ i = aLen-1;
+ j = bLen-1;
+ int olapErrs = 0;
+ int olapColumns = 0;
+ SimpleOverlap_t olap;
+ while ( i >= 0 && j >= 0 )
+ {
+ switch ( O[i][j] )
+ {
+ case '\\':
+ if ( i == aLen - 1 )
+ {
+ // showCnt = 0;
+ olapErrs = 0;
+ olapColumns = 0;
+ olap.bHang = (bLen-1-j);
+ }
+ if ( j == bLen - 1 )
+ {
+ // showCnt = 0;
+ olapErrs = 0;
+ olapColumns = 0;
+ olap.bHang = -(aLen-1-i);
+ }
+ /*
+ showA[showCnt] = A[i];
+ showB[showCnt] = B[j];
+ showCnt++;
+ */
+ if ( A[i] != B[j] )
+ olapErrs++;
+ olapColumns++;
+ i--; j--;
+ break;
+
+ case '-':
+ /*
+ showA[showCnt] = '.';
+ showB[showCnt] = B[j];
+ showCnt++;
+ */
+ olapErrs++;
+ olapColumns++;
+ j--;
+ break;
+
+ case '|':
+ /*
+ showA[showCnt] = A[i];
+ showB[showCnt] = '.';
+ showCnt++;
+ */
+ olapErrs++;
+ olapColumns++;
+ i--;
+ break;
+
+ default:
+ fprintf(stderr,"Error: i = %d, j = %d, O = %c\n", i, j, O[i][j]);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if ( i < 0 ) olap.aHang = -(j+1);
+ if ( j < 0 ) olap.aHang = (i+1);
+ olap.err = float(olapErrs) / float(olapColumns);
+ /*
+ for ( i = showCnt - 1; i >= 0; --i )
+ putchar(showA[i]);
+ putchar('\n');
+ for ( i = showCnt - 1; i >= 0; --i )
+ putchar(showB[i]);
+ putchar('\n');
+ printf("%f\n", S[aLen-1][bLen-1]);
+ */
+ return olap;
+}
+
+
+//------------------------------------------------------------- ParseArgs ------
+void ParseArgs (int argc, char **argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt(argc, argv, "he:o:")) != EOF) )
+ switch (ch)
+ {
+ case 'h':
+ PrintHelp(PROGNAME);
+ exit(EXIT_SUCCESS);
+ break;
+
+ case 'e':
+ OPT_MaxOlapErr = atof(optarg);
+ break;
+
+ case 'o':
+ OPT_MinOlapLen = atoi(optarg);
+ break;
+
+ default:
+ errflg ++;
+ }
+
+ if ( optind+1 == argc )
+ OPT_BankName = argv[optind++];
+ else
+ errflg ++;
+
+ if ( OPT_MaxOlapErr < 0 || OPT_MaxOlapErr > 1 )
+ {
+ cerr << "Error: Maximum overlap error must be 0 < err < 1\n";
+ errflg++;
+ }
+
+ if ( OPT_MinOlapLen <= 0 )
+ {
+ cerr << "Error: Minimum overlap length must be > 0\n";
+ errflg++;
+ }
+
+ if ( errflg > 0 )
+ {
+ PrintUsage(PROGNAME);
+ cerr << "Try '" << PROGNAME << " -h' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+}
+
+
+//------------------------------------------------------------- PrintHelp ------
+void PrintHelp (const char *s)
+{
+ PrintUsage(s);
+
+ cerr
+ << "-e float Set maximum overlap error, default "
+ << OPT_MaxOlapErr << endl
+ << "-o int Set minimum overlap length, default "
+ << OPT_MinOlapLen << endl
+ << endl;
+ cerr
+ << " Converts bank CTG messages to overlaps.\n"
+ << endl;
+
+ return;
+}
+
+
+//------------------------------------------------------------ PrintUsage ------
+void PrintUsage (const char *s)
+{
+ cerr << "\nUSAGE: " << s << " [OPTION]... BANK\n";
+}
diff --git a/src/Converters/Makefile.am b/src/Converters/Makefile.am
new file mode 100644
index 0000000..0dea586
--- /dev/null
+++ b/src/Converters/Makefile.am
@@ -0,0 +1,65 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+bin_PROGRAMS = \
+ toAmos_new
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common
+
+##-- TO BE INSTALLED
+dist_bin_SCRIPTS = \
+ ace2contig.pl \
+ agp2amos.pl \
+ amos2frg.pl \
+ amos2mates.pl \
+ amos2sq.pl \
+ amos2ace.pl \
+ arachne2ctg.pl \
+ arachne2scaff.pl \
+ benchmark2arachne.pl \
+ benchmark2ca.pl \
+ benchmark2mates.pl \
+ benchmark2ta.pl \
+ blat2nucmer.pl \
+ blasr2coords.pl \
+ ca2ctg.pl \
+ ca2mates.pl \
+ ca2scaff.pl \
+ ca2ta.pl \
+ cgb2ctg.pl \
+ contig2contig.pl \
+ ctg2fasta.pl \
+ ctg2umdcontig.pl \
+ frg2fasta.pl \
+ frg2fastq.pl \
+ frg2ta.pl \
+ ta2ace.pl \
+ tarchive2amos.pl \
+ tarchive2ca.pl \
+ toAmos.pl \
+ toArachne.pl \
+ scaff2fasta.pl \
+ parsecasm.pl \
+ castats.pl \
+ ca2singletons.pl \
+ phd2afg.pl
+
+##-- GLOBAL INCLUDE
+
+##-- toAmos
+toAmos_new_CPPFLAGS = \
+ $(CA_CXXFLAGS) \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_srcdir)/src/Common
+toAmos_new_LDADD = \
+ $(CA_LDADD) \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ -lexpat
+toAmos_new_SOURCES = \
+ toAmos_new.cc
+
+##-- END OF MAKEFILE --##
diff --git a/src/Converters/Makefile.in b/src/Converters/Makefile.in
new file mode 100644
index 0000000..abddef2
--- /dev/null
+++ b/src/Converters/Makefile.in
@@ -0,0 +1,686 @@
+# 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 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@
+DIST_COMMON = $(dist_bin_SCRIPTS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = toAmos_new$(EXEEXT)
+subdir = src/Converters
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_toAmos_new_OBJECTS = toAmos_new-toAmos_new.$(OBJEXT)
+toAmos_new_OBJECTS = $(am_toAmos_new_OBJECTS)
+am__DEPENDENCIES_1 =
+toAmos_new_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+SCRIPTS = $(dist_bin_SCRIPTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(toAmos_new_SOURCES)
+DIST_SOURCES = $(toAmos_new_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common
+
+dist_bin_SCRIPTS = \
+ ace2contig.pl \
+ agp2amos.pl \
+ amos2frg.pl \
+ amos2mates.pl \
+ amos2sq.pl \
+ amos2ace.pl \
+ arachne2ctg.pl \
+ arachne2scaff.pl \
+ benchmark2arachne.pl \
+ benchmark2ca.pl \
+ benchmark2mates.pl \
+ benchmark2ta.pl \
+ blat2nucmer.pl \
+ blasr2coords.pl \
+ ca2ctg.pl \
+ ca2mates.pl \
+ ca2scaff.pl \
+ ca2ta.pl \
+ cgb2ctg.pl \
+ contig2contig.pl \
+ ctg2fasta.pl \
+ ctg2umdcontig.pl \
+ frg2fasta.pl \
+ frg2fastq.pl \
+ frg2ta.pl \
+ ta2ace.pl \
+ tarchive2amos.pl \
+ tarchive2ca.pl \
+ toAmos.pl \
+ toArachne.pl \
+ scaff2fasta.pl \
+ parsecasm.pl \
+ castats.pl \
+ ca2singletons.pl \
+ phd2afg.pl
+
+toAmos_new_CPPFLAGS = \
+ $(CA_CXXFLAGS) \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_srcdir)/src/Common
+
+toAmos_new_LDADD = \
+ $(CA_LDADD) \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ -lexpat
+
+toAmos_new_SOURCES = \
+ toAmos_new.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Converters/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Converters/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):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+toAmos_new$(EXEEXT): $(toAmos_new_OBJECTS) $(toAmos_new_DEPENDENCIES)
+ @rm -f toAmos_new$(EXEEXT)
+ $(CXXLINK) $(toAmos_new_OBJECTS) $(toAmos_new_LDADD) $(LIBS)
+install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/toAmos_new-toAmos_new.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+
+toAmos_new-toAmos_new.o: toAmos_new.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(toAmos_new_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT toAmos_new-toAmos_new.o -MD -MP -MF $(DEPDIR)/toAmos_new-toAmos_new.Tpo -c -o toAmos_new-toAmos_new.o `test -f 'toAmos_new.cc' || echo '$(srcdir)/'`toAmos_new.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/toAmos_new-toAmos_new.Tpo $(DEPDIR)/toAmos_new-toAmos_new.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='toAmos_new.cc' object='toAmos_new-toAmos_new.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(toAmos_new_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o toAmos_new-toAmos_new.o `test -f 'toAmos_new.cc' || echo '$(srcdir)/'`toAmos_new.cc
+
+toAmos_new-toAmos_new.obj: toAmos_new.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(toAmos_new_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT toAmos_new-toAmos_new.obj -MD -MP -MF $(DEPDIR)/toAmos_new-toAmos_new.Tpo -c -o toAmos_new-toAmos_new.obj `if test -f 'toAmos_new.cc'; then $(CYGPATH_W) 'toAmos_new.cc'; else $(CYGPATH_W) '$(srcdir)/toAmos_new.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/toAmos_new-toAmos_new.Tpo $(DEPDIR)/toAmos_new-toAmos_new.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='toAmos_new.cc' object='toAmos_new-toAmos_new.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(toAmos_new_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o toAmos_new-toAmos_new.obj `if test -f 'toAmos_new.cc'; then $(CYGPATH_W) 'toAmos_new.cc'; else $(CYGPATH_W) '$(srcdir)/toAmos_new.cc'; fi`
+
+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 $(PROGRAMS) $(SCRIPTS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-binPROGRAMS clean-generic 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-binPROGRAMS install-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dist_binSCRIPTS \
+ 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-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-dist_binSCRIPTS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Converters/ace2contig.pl b/src/Converters/ace2contig.pl
new file mode 100755
index 0000000..15452cf
--- /dev/null
+++ b/src/Converters/ace2contig.pl
@@ -0,0 +1,244 @@
+#!/usr/local/bin/perl
+
+# $Id$
+#
+# Converts from a TIGR .asm file to a new .ace file
+#
+# Copyright @ 2002, The Institute for Genomic Research (TIGR).
+
+use strict;
+use File::Spec;
+use AMOS::AmosLib;
+use TIGR::Foundation;
+
+my $base = new TIGR::Foundation;
+if (! defined $base){
+ die("Weird problem!\n");
+}
+
+my $VERSION = '1.0 $Revision$ ';
+
+my $acefile;
+my $contigfile;
+
+my $HELP_INFO = q~
+.USAGE.
+ ace2contig [-o <output prefix>] [-i <acefile>]
+
+.DESCRIPTION.
+ This program extracts contig information from an Ace file and outputs
+ a .contig file.
+
+.OPTIONS.
+ -i Ace file
+ -o output prefix (output is <prefix>.contig)
+
+.KEYWORDS.
+ converter, ace, contig
+
+~;
+
+$base->setHelpInfo($HELP_INFO);
+
+my $err = $base->TIGR_GetOptions("i=s" => \$acefile,
+ "o=s" => \$contigfile
+ );
+
+if (! defined $acefile){
+ $acefile = $ARGV[0];
+ if (! defined $acefile) {
+ $base->bail("You must specify an .ACE file\n");
+ }
+}
+
+if ($acefile !~ /\.ace$/){
+ $base->bail("Ace file \"$acefile\" must end in .ace\n");
+}
+
+if (! defined $contigfile){
+ my $prefix;
+ $acefile =~ /(.*)\.ace$/;
+ $prefix = $1;
+ $contigfile = $prefix . ".contig";
+}
+
+open(ACE, $acefile) || $base->bail("Cannot open \"$acefile\": $!\n");
+open(CONTIG, ">$contigfile") || $base->bail("Cannot open \"$contigfile\": $!\n");
+
+my $contigName;
+my $contigLen;
+my $contigSeqs;
+my $inContig = 0;
+my $inSequence = 0;
+my $seqName;
+my $seq;
+my $ctgSeq;
+my %offset;
+my %rc;
+my @gaps;
+my $contigSequence;
+my $ctgLeft;
+my $ctgRight; # where we'll trim the contig
+my $asmLeft;
+my $asmRight;
+my $nseq;
+my $tmpdir = $base->getTempDir();
+my $tmpfile = File::Spec->catfile($tmpdir, "tmpfile.$$");
+while (<ACE>){
+ if (/^CO (\S+) (\d+) (\d+)/){
+ if (defined $ctgSeq){
+ $ctgSeq = substr($ctgSeq, $ctgLeft, $ctgRight - $ctgLeft);
+# print "trimming to $ctgLeft $ctgRight\n";
+ printContigRecord(\*CONTIG, $contigName, length($ctgSeq), $nseq, $ctgSeq, "contig");
+ close(TMP);
+ open(TMP, $tmpfile) || $base->bail("Cannot open $tmpfile: $!\n");
+ while (<TMP>){
+ chomp;
+ if (/^\#(\S+)\((\d+)\)(.*)\{(\d+) (\d+)\} <(\d+) (\d+)>$/){
+ print CONTIG sprintf("#%s(%d)%s{%d %d} <%d %d>\n",
+ $1, $2 - $ctgLeft, $3, $4, $5, $6 - $asmLeft + 1, $7 - $asmLeft + 1);;
+ } else {
+ print CONTIG "$_\n";
+ }
+ }
+ close(TMP);
+ }
+ open(TMP, ">$tmpfile") || $base->bail("Cannot open $tmpfile: $!\n");
+ $nseq = 0;
+ $ctgLeft = $ctgRight = -1;
+ $asmLeft = $asmRight = -1;
+ $contigName = $1;
+ $contigLen = $2;
+ $contigSeqs = $3;
+
+ $inContig = 1;
+ $ctgSeq = "";
+ $seq = "";
+ %offset = ();
+ next;
+ }
+ if ($inContig && /^\s*$/){
+ $inContig = 0;
+ $seq =~ s/\*/-/g;
+ @gaps = ();
+ my $gap = index($seq, "-");
+ while ($gap != -1){
+ push(@gaps, $gap + 1);
+ $gap = index($seq, "-", $gap + 1);
+ }
+
+ $ctgSeq = $seq;
+ next;
+ }
+ if ($inSequence && $_ =~ /^\s*$/){
+ $inSequence = 0;
+ next;
+ }
+ if ($inContig || $inSequence) {
+ chomp;
+ $seq .= $_;
+ next;
+ }
+ if (/^AF (\S+) (\w) (-?\d+)/){
+ $offset{$1} = $3;
+ $rc{$1} = $2;
+ next;
+ }
+ if (/^RD (\S+)/){
+ $inSequence = 1;
+ $seqName = $1;
+ $seq = "";
+ next;
+ }
+ if (/^QA (-?\d+) (-?\d+) (\d+) (\d+)/){ # qual range, align range
+ my $offset = $offset{$seqName};
+ my $cll = $1;
+ my $clr = $2;
+ my $end5 = $3;
+ my $end3 = $4;
+ if ($cll == -1 && $clr == -1){ # poor quality sequence - exclude
+ next;
+ }
+ $nseq++;
+
+ if ($cll > $end5) { $end5 = $cll;} # trim poor quality sequence
+ if ($clr < $end3) { $end3 = $clr;}
+
+ $seq =~ s/\*/-/g;
+ my $len = length($seq);
+ $offset += $end5 - 2;
+ if ($ctgLeft == -1 || $offset < $ctgLeft){
+# print "setting ctgLeft to $offset\n";
+ $ctgLeft = $offset;
+ }
+ if ($ctgRight == -1 || $offset + $end3 - $end5 + 1 > $ctgRight){
+ $ctgRight = $offset + $end3 - $end5 + 1;
+# print "setting ctgRight to $ctgRight\n";
+ }
+
+ $seq = substr($seq, $end5 - 1, $end3 - $end5 + 1);
+
+ my $i = 0;
+ my $asml = $offset + 1;
+ my $asmr = $asml + $end3 - $end5 + 1;
+ while ($i <= $#gaps && $offset > $gaps[$i]){
+ $asml--; $asmr--; $i++;
+ } # get rid of gaps from offset here
+# print "finding gaps between $offset and $offset + $clr - $cll + 1\n";
+ while ($i <= $#gaps && ($offset + $clr - $cll + 1 > $gaps[$i])){
+ $asmr--; $i++;
+ }
+
+ if ($asmLeft == -1 || $asml < $asmLeft){
+ $asmLeft = $asml;
+ }
+ if ($asmRight == -1 || $asmr > $asmRight){
+ $asmRight = $asmr;
+ }
+
+ if ($rc{$seqName} eq "C"){ # make coordinates with respect to forw strand
+ $cll = $len - $cll + 1;
+ $clr = $len - $clr + 1;
+ my $tmp = $cll;
+ $cll = $clr;
+ $clr = $tmp;
+ }
+
+ while ($seq =~ /-/g){ #make $clr ungapped
+ $clr--;
+ }
+
+ if ($rc{$seqName} eq "C"){
+ my $tmp = $cll;
+ $cll = $clr;
+ $clr = $tmp;
+ }
+
+ printSequenceRecord(\*TMP, $seqName, $seq, $offset, (($rc{$seqName} eq "U")?"" : "RC"), $cll, $clr, $asml, $asmr, "contig");
+ next;
+ }
+}
+
+if (defined $ctgSeq){
+# print "trimming to $ctgLeft $ctgRight\n";
+ $ctgSeq = substr($ctgSeq, $ctgLeft, $ctgRight - $ctgLeft);
+ printContigRecord(\*CONTIG, $contigName, length($ctgSeq), $nseq, $ctgSeq, "contig");
+ close(TMP);
+ open(TMP, $tmpfile) || $base->bail("Cannot open $tmpfile: $!\n");
+ while (<TMP>){
+ chomp;
+ if (/^\#(\S+)\((\d+)\)(.*)\{(\d+) (\d+)\} <(\d+) (\d+)>$/){
+ print CONTIG sprintf("#%s(%d)%s{%d %d} <%d %d>\n",
+ $1, $2 - $ctgLeft, $3, $4, $5, $6 - $asmLeft + 1, $7 - $asmLeft + 1);
+ } else {
+ print CONTIG "$_\n";
+ }
+ }
+ close(TMP);
+}
+unlink($tmpfile)|| $base->bail("Cannot remove $tmpfile: $!\n");
+
+
+close(CONTIG);
+close(ACE);
+exit(0);
diff --git a/src/Converters/agp2amos.pl b/src/Converters/agp2amos.pl
new file mode 100755
index 0000000..768f30a
--- /dev/null
+++ b/src/Converters/agp2amos.pl
@@ -0,0 +1,80 @@
+#!/usr/bin/perl -w
+use strict;
+
+## Load agp scaffold information into a bank
+## First construct the bank with contigs, and then post-process with this
+## script
+
+my $USAGE = "agp2amos.pl agp bnk | bank-transact -m - -b bnk\n";
+
+my $scaff = shift @ARGV or die $USAGE;
+my $bnk = shift @ARGV or die $USAGE;
+
+my $map = "$bnk/CTG.map";
+
+open SCAFF, "< $scaff" or die "Can't open $scaff ($!)\n";
+open MAP, "< $map" or die "Can't open $map ($!)\n";
+
+my %eid2iid;
+
+while (<MAP>)
+{
+ if (/(\d+)\s+(\d+)\s+(\S+)/)
+ {
+ $eid2iid{$3} = $2;
+ }
+}
+
+my $scaffid = "";
+my $iid = 1;
+
+sub endScaff
+{
+ print "}\n" if (defined $scaffid);
+}
+
+
+while (<SCAFF>)
+{
+ my @vals = split /\s+/, $_;
+
+ if ($scaffid ne $vals[0])
+ {
+ endScaff();
+
+ $scaffid = $vals[0];
+ print "{SCF\n";
+ print "eid:$scaffid\n";
+ print "iid:$iid\n";
+ $iid++;
+ }
+
+ if ($vals[4] eq "W")
+ {
+ ## contig record
+
+ my $s = $vals[1];
+ my $e = $vals[2];
+
+ my $oo = $vals[8];
+
+ my $ceid = $vals[5];
+
+ my $len = $e - $s + 1;
+
+ my $ciid = $eid2iid{$ceid};
+
+ print "{TLE\n";
+
+ if ($oo eq "+") { print "clr:0,$len\n"; }
+ else { print "clr:$len,0\n"; }
+
+ print "off:$s\n";
+ print "src:$ciid\n";
+ print "}\n";
+ }
+}
+
+endScaff();
+
+
diff --git a/src/Converters/amos2ace.pl b/src/Converters/amos2ace.pl
new file mode 100755
index 0000000..298aade
--- /dev/null
+++ b/src/Converters/amos2ace.pl
@@ -0,0 +1,467 @@
+#!/usr/local/bin/perl
+
+# $Id$
+#
+# Converts from an AMOS assembly file to a new .ace file
+#
+
+use strict;
+use File::Spec;
+use AMOS::AmosLib;
+use TIGR::Foundation;
+
+my $base = new TIGR::Foundation;
+if (! defined $base){
+ die ("Foundation cannot be created. FATAL!\n");
+}
+
+my $GREP = "/bin/grep";
+
+my $VERSION = '$Revision$ ';
+$base->setVersionInfo($VERSION);
+
+my $HELPTEXT = q~
+.USAGE.
+ amos2ace [opts] [infile1] [infile2] ...
+
+.DESCRIPTION.
+ Amos2ace reads one or more AMOS message files specified on the command line and produces
+ a .ACE file. The message files must be provided in a "reasonable" order: the file
+ defining a specific object must occur before a file using it. The output file name is
+ generated from the first file on the command line unless specifically set through option
+ -o (see below).
+
+.OPTIONS.
+ -o <outfile> Output file, by default <infile1>.ace
+ -c <chromat_dir> Location of the chromatograms
+ -p <phd_dir> Location of the PHD directory
+
+ The multiple input files must be presented in "proper" order - each message needs to
+ be defined before being referenced. Note: the chromat_dir and phd_dir parameters are
+ only used to provide consed with the necessary information used to display
+ chromatograms. These options are only relevant if the assembler inputs were generated
+ using the phred pipeline.
+
+.KEYWORDS.
+ converter, amos, ace.
+
+~;
+
+$base->setHelpInfo($HELPTEXT);
+
+my $infile;
+my $outfile;
+my $chromodir = "";
+my $phddir = "";
+my $frgfile;
+
+my $err = $base->TIGR_GetOptions(
+ "o=s" => \$outfile,
+ "c=s" => \$chromodir,
+ "p=s" => \$phddir
+ );
+
+if (! $err){
+ $base->bail("Error processing options!");
+}
+
+if ($#ARGV < 0){
+ $base->bail("At least one input file must be specified");
+}
+
+my $prefix;
+
+$ARGV[0] =~ /(.*)\.[^.]*$/;
+$prefix = $1;
+
+if (! defined $outfile){
+ $outfile = "$prefix.ace";
+}
+
+# add trailing slashes
+$chromodir =~ s/[^\/]$/\// unless $chromodir eq "";
+$phddir =~ s/[^\/]$/\// unless $phddir eq "";
+
+
+# Here's the process
+#
+# * get contig information and generate contig record in contig temp file
+# * for each of the sequences generate sequence information and store coords in
+# contig writing sequence records in another sequence temp file
+# * generate tiling info and concatenate both temp files into an output temp
+# file
+#
+# * when all contigs are done generate output file header and concatenate
+# output temp file to output.
+
+
+# counters for the useful information
+my $nContigs = 0;
+my $nReads = 0;
+
+my $fr;
+
+my $TMP = $$ . time();
+my $dirTmp = $base->getTempDir();
+my $ctgTmp = File::Spec->catfile($dirTmp, "$TMP.CTG.TMP");
+my $seqTmp = File::Spec->catfile($dirTmp, "$TMP.SEQ.TMP");
+my $outTmp = File::Spec->catfile($dirTmp, "$TMP.OUT.TMP");
+
+open(OUT, ">$outTmp") ||
+ $base->bail("Cannot open output temp \"$outTmp\" : $!");
+
+my $nseqs; # number of sequences in this contig
+my $seenseqs; # number of sequences we've actually seen
+my $contigid; # contigId
+my $seqName;
+my %seqClr; # clear range from seq file
+my %seqAlnClr; # clear range from .asm file
+my %seqAlnRng; # assembly range from .asm file
+my %seqOff; # sequence offset
+my %rend; # right end of sequences
+my $al; # aligned coordinates (asm_lend, rend)
+my $ar;
+my $end5; # clear range
+my $end3;
+my $contigLen; # # bases in the contig
+my $contigSeq;
+
+my %seqpos;
+my %seqnames;
+my %seqfile;
+
+my @files;
+
+my %seqclr;
+for (my $f = 0; $f <= $#ARGV; $f++){
+ open($files[$f], $ARGV[$f]) || $base->bail("Cannot open $ARGV[$f]: $!");
+
+ my $seekpos = tell $files[$f];
+
+ while (my $record = getRecord($files[$f])){
+ my ($rec, $fields, $recs) = parseRecord($record);
+ my $nseqs = 0;
+ my $id = $$fields{iid};
+ $contigid = $$fields{iid};
+
+ if ($rec eq "RED"){
+ $seqpos{$$fields{iid}} = $seekpos;
+ $seqfile{$$fields{iid}} = $f;
+ if (! exists $$fields{eid} || $$fields{eid} =~ /^\s*$/){
+ $seqnames{$$fields{iid}} = $$fields{iid};
+ } else {
+ $seqnames{$$fields{iid}}= $$fields{eid};
+ $seqnames{$$fields{iid}} =~ s/^\s+//; # clean up any initial spaces
+ if ($seqnames{$$fields{iid}} =~ /^(\S+)\s+.*$/) {
+ # if the eid is a space-separated name, use just the first token
+ $seqnames{$$fields{iid}} = $1;
+ }
+ }
+ $seqclr{$$fields{iid}} = $$fields{clr};
+ #print STDERR "setting clear range for $$fields{iid} to $$fields{clr}\n";
+ } elsif ($rec eq "CTG"){
+ my $seq = $$fields{seq};
+ my @lines = split('\n', $seq);
+ $seq = join ('', @lines);
+ $seq =~ s/-/*/g;
+ $contigLen = length($seq);
+ my @offsets;
+ my $coord;
+ $#offsets = length($seq) - 1;
+ for (my $i = 0; $i < length($seq); $i++){
+ if (substr($seq, $i, 1) ne "*"){
+ $coord++;
+ }
+ $offsets[$i] = $coord;
+ }
+
+ my $qual = $$fields{qlt};
+ @lines = split('\n', $qual);
+ $qual = join('', @lines);
+ open(CTGOUT, ">$ctgTmp")||
+ $base->bail("Cannot open contig temp $ctgTmp: $!\n");
+
+ for (my $i = 0; $i < length($seq); $i += 50){
+ print CTGOUT substr($seq, $i, 50), "\n";
+ }
+ print CTGOUT "\n";
+ $nContigs++;
+
+ print CTGOUT "BQ\n";
+ my @qualvals;
+ # .ace qualities are only assigned to unpadded bases
+ for (my $i = 0; $i < length($qual); $i++){
+ my $qualval = substr($seq, $i, 1);
+ if ($qualval ne "*"){
+ push(@qualvals, ord($qualval) - ord('0'));
+ }
+ }
+ for (my $i = 0; $i <= $#qualvals; $i+=50){
+ my $end = $i + 49;
+ if ($end > $#qualvals){
+ $end = $#qualvals;
+ }
+ print CTGOUT " ", join(" ", @qualvals[$i .. $end]), "\n";
+ }
+
+ print CTGOUT "\n";
+
+ %seqClr = ();
+ %seqAlnClr = ();
+ %seqAlnRng = ();
+ %seqOff = ();
+ %rend = ();
+ open(SEQOUT, ">$seqTmp") ||
+ $base->bail("Cannot open seq temp $seqTmp: $!");
+
+ for (my $r = 0; $r <= $#$recs; $r++){
+ my ($srec, $sfields, $srecs) = parseRecord($$recs[$r]);
+ if ($srec eq "TLE"){
+
+ $nReads++;
+ $nseqs++;
+ if (! exists $$sfields{src}){
+ $base->bail("Error: TLE record contains no src: field\n");
+ }
+ if (! exists $seqnames{$$sfields{src}}){
+ $base->bail("Sequence with ID $$sfields{src} not found\nSequence records (RED) either not provided or in wrong order\n");
+ }
+ $seqName = $seqnames{$$sfields{src}};
+ my $sequence = get_seq($seqfile{$$sfields{src}}, $$sfields{src});
+ @lines = split('\n', $sequence);
+ $sequence = join('', @lines);
+
+ my $seql = 0;
+ my $seqr = length $sequence;
+
+ if (defined $seqclr{$$sfields{src}}) {
+ ($seql, $seqr) = split(',', $seqclr{$$sfields{src}});
+ }
+
+ #print STDERR "sequence $$sfields{src} has range $seql, $seqr\n";
+
+ my @gaps;
+ if (defined $$sfields{gap}) {
+ @gaps = split(/\s+/, $$sfields{gap});
+ }
+ my ($asml, $asmr) = split(',', $$sfields{clr});
+
+ #print STDERR "asml and asmr are $asml $asmr\n";
+ if ($asml < $asmr){
+ $asmr -= $asml;
+ $asml = 0;
+ } else {
+ $asml -= $asmr;
+ $asmr = 0;
+ }
+ #print STDERR "asml and asmr are $asml $asmr\n";
+ $asml += $$sfields{off};
+ $asmr += $$sfields{off};
+ #print STDERR "asml and asmr are $asml $asmr\n";
+
+ my $left = $seql;
+ if ($asml > $asmr){
+ $sequence = reverseComplement($sequence);
+ my $tmp = $asmr;
+ $asmr = $asml;
+ $asml = $tmp;
+
+ $tmp = $seqr;
+ $seqr = $seql;
+ $seql = $tmp;
+ $left = length($sequence) - $seql;
+ }
+ #print STDERR "asml and asmr are $asml $asmr\n";
+ # now we add gaps to the sequence
+ my $outseq = "";
+ my $gapindex = 0;
+ #print STDERR "have ", $#gaps + 1, " gaps and ", length($sequence), " bases\n";
+ for (my $j = 0; $j < length($sequence); $j++){
+ my $seqj = $j - $left;# + $seql{$id} - 1; # index in untrimmed sequence
+ #my $seqj = $j; # if index in trimmed sequence
+ if ($gapindex <= $#gaps && $seqj > $gaps[$gapindex]){
+ print STDERR "Weird $seqnames{$id}, $seqj > $gaps[$gapindex]\n";
+ }
+ while ($gapindex <= $#gaps && $seqj == $gaps[$gapindex]){
+ $outseq .= "*";
+ $asmr++;
+ $gapindex++;
+ }
+ $outseq .= substr($sequence, $j, 1);
+ }
+ $seqAlnRng{$seqName} = sprintf("%d %d", $asml + 1, $asmr);
+ $seqAlnClr{$seqName} = sprintf("%d %d",
+ (($seql < $seqr)?$seql + 1:$seql),
+ (($seql < $seqr)?$seqr : $seqr + 1));
+ my $off = $$sfields{off};
+ my $ori = ($seql > $seqr) ? "C" : "U";
+
+ $seqOff{$seqName} = $asml;
+ $rend{$seqName} = $asmr;
+
+ $seqOff{$seqName}++;
+ if ($ori eq "C"){
+ $off -= length($sequence) - $seql;
+ } else {
+ $off -= $seql;
+ }
+
+ $off++;
+
+ print CTGOUT "AF $seqName $ori $off\n";
+ print SEQOUT "RD $seqName ", length($outseq), " 0 0\n";
+ for (my $i = 0; $i <= length($outseq); $i += 50){
+ print SEQOUT substr($outseq, $i, 50), "\n";
+ }
+ print SEQOUT "\n";
+
+ my $end5;
+ my $end3;
+ if ($ori eq "C"){
+ $end5 = length($sequence) - $seql;
+ $end3 = length($outseq) - $seqr;
+ } else {
+ $end5 = $seql;
+ $end3 = length($outseq) - length($sequence) + $seqr;
+ }
+ $end5++; #all coordinates are 1 based
+
+ print SEQOUT sprintf("QA %d %d %d %d\n",
+ $end5, $end3, $end5, $end3);
+ my $chrmfile = $chromodir . "$seqName";
+ my $phdfile = "";
+ if ($phddir eq ""){
+ $phdfile = "phd_dir/$seqName.phd.1";
+ } else {
+ $phdfile = $phddir . "$seqName.phd.1";
+ }
+ my $time;
+
+ if (-r $phdfile){
+ $time = `$GREP TIME $phdfile`;
+ $time =~ s/TIME: //;
+ }
+
+ if (! defined $time){
+ if (-e $phddir) {
+ $base->logError("Cannot stat phd file \"$phdfile\"", 1);
+ }
+ $time = localtime;
+ }
+
+ my $dir = ($ori eq "C") ? "rev" : "forw";
+
+ print SEQOUT "DS CHROMAT_FILE: $chrmfile PHD_FILE: $seqName.phd.1 TIME: $time\n"; # CHEM: unknown DYE: big TEMPLATE: $seqName DIRECTION: $dir\n";
+ } # if TILE
+ } # for each tile
+ close(SEQOUT);
+ my $prev;
+ my $nBS = 0;
+
+ @offsets = keys %seqOff;
+ #print STDERR " I have ", $#offsets + 1, " offsets\n";
+ foreach my $sequence ( sort {
+ ($seqOff{$a} == $seqOff{$b}) ?
+ ($rend{$b} <=> $rend{$a}) :
+ ($seqOff{$a} <=> $seqOff{$b})
+ } (keys %seqOff)) {
+ #print STDERR "${sequence}($seqOff{$sequence}), ";
+ if (defined $prev) {
+ if ($seqOff{$sequence} - 1 < $seqOff{$prev} ||
+ $rend{$sequence} < $rend{$prev}){
+ next;
+ }
+ $nBS++;
+ print CTGOUT "BS $seqOff{$prev} ", $seqOff{$sequence} - 1, " $prev\n";
+ }
+ $prev = $sequence;
+ }
+ #print STDERR "\n";
+ $nBS++;
+ if (defined $prev) {
+ print CTGOUT "BS $seqOff{$prev} $contigLen $prev\n";
+ }
+ close(CTGOUT);
+
+ print OUT "CO $contigid $contigLen $nseqs $nBS U\n";
+ open(CTGOUT, "$ctgTmp") ||
+ $base->bail("Cannot open \"$ctgTmp\": $!");
+ while (<CTGOUT>){
+ print OUT;
+ }
+ close(CTGOUT);
+ print OUT "\n";
+ open(SEQOUT, "$seqTmp") ||
+ $base->bail("Cannot open \"$seqTmp\": $!");
+ while (<SEQOUT>){
+ print OUT;
+ }
+ close(SEQOUT);
+ print OUT "\n";
+ } # if CTG
+ $seekpos = tell $files[$f];
+ } ## while getrecord
+}
+close(OUT);
+
+# now we need to create the output file and attach to it the temp file.
+open(OUT, ">$outfile") ||
+ $base->bail("Cannot open output file \"$outfile\": $!");
+
+print OUT "AS $nContigs $nReads\n\n";
+
+open(TMP, "$outTmp") ||
+ $base->bail("Cannot open temp file \"$outTmp\" : $!");
+while (<TMP>){
+ print OUT;
+}
+close(TMP);
+
+# now print some info
+print OUT "WA{\n";
+print OUT "amos2ace $VERSION\n";
+my $time = `date`;
+chomp $time;
+print OUT "Run by $ENV{USER} on $time\n";
+print OUT "}\n";
+close(OUT);
+
+# then remove all the temp files
+unlink($outTmp, $seqTmp, $ctgTmp);
+
+exit(0);
+
+# gets a sequence by Id from a file;
+sub get_seq
+{
+ my $file = shift;
+ my $id = shift;
+
+ my $currloc = tell $files[$file];
+
+ if (! exists $seqpos{$id}){
+ $base->bail("Failure: could not find RED record for id $id\n");
+ }
+
+ seek $files[$file], $seqpos{$id}, 0; # seek set
+ my $record = getRecord($files[$file]);
+ seek $files[$file], $currloc, 0; # come back to the original location
+
+ if (! defined $record){
+ $base->bail("Weird error - no record found\n");
+ return;
+ }
+
+ my ($rec, $fields, $recs) = parseRecord($record);
+
+ if ($rec ne "RED"){
+ $base->bail("weird error in get_seq for read $id, expecting RED not $rec at position $seqpos{$id} in file $file\n");
+ return;
+ }
+ if ($$fields{iid} != $id){
+ $base->bail("weird error in get_seq, expecting $id, got $$fields{acc}\n
+");
+ return;
+ }
+ return $$fields{seq};
+}
diff --git a/src/Converters/amos2frg.pl b/src/Converters/amos2frg.pl
new file mode 100755
index 0000000..59c6381
--- /dev/null
+++ b/src/Converters/amos2frg.pl
@@ -0,0 +1,216 @@
+#!/usr/bin/perl -w
+
+use AMOS::AmosLib;
+use TIGR::Foundation;
+
+use strict;
+
+my $VERSION = '$Revision$ ';
+my $HELP = q~
+.USAGE.
+ amos2frg [-i infile] [-o outfile] [-a accession]
+
+.DESCRIPTION.
+ This program converts from an AMOS message file to a frg file (Celera
+ Assembler message file).
+
+.OPTIONS.
+ if -i and -o are not provided reads from STDIN and writes to STDOUT
+ if -i is provided but -o is not, outfile is same as infile except for the
+ extension
+ otherwise -i and -o are those specified in the command line
+ if -i is provided the filename must end in .afg
+ if -a is specified starts numbering output at specified accession, else
+ the accessions from the input file are used in the output
+
+.KEYWORDS.
+ converter, amos, frg
+
+~;
+
+my $base = new TIGR::Foundation();
+if (! defined $base) {
+ die("A horrible death\n");
+}
+
+
+$base->setVersionInfo($VERSION);
+$base->setHelpInfo($HELP);
+
+my $infile;
+my $outfile;
+my $inname = "stdin";
+my $accession = 1;
+my $date = time();
+my $firstunv = 1;
+my %libids;
+my %frg2lib;
+my %rd2lib;
+my %rd2typ;
+my %rdids;
+my %mates;
+
+my $err = $base->TIGR_GetOptions("i=s" => \$infile,
+ "o=s" => \$outfile,
+ "a=i" => \$accession);
+
+
+
+# if infile is provided, make sure it ends in .afg and open it
+if (defined $infile){
+ if ($infile !~ /\.afg$/){
+ $base->bail ("Input file name must end in .afg");
+ }
+ $inname = $infile;
+ open(STDIN, "$infile") || $base->bail("Cannot open $infile: $!\n");
+}
+
+# if infile is provided but outfile isn't make outfile by changing the extension
+if (! defined $outfile && defined $infile){
+ $outfile = $infile;
+ $outfile =~ s/\.afg$/.frg/;
+}
+
+# if outfile is provided (or computed above) simply open it
+if (defined $outfile){
+ open(STDOUT, ">$outfile") || $base->bail("Cannot open $outfile: $!\n");
+}
+
+while (my $record = getRecord(\*STDIN)){
+ my ($type, $fields, $recs) = parseRecord($record);
+ my $acc;
+
+ $acc = $accession++;
+
+# print "Got $type\n";
+ if ($type eq "UNV"){
+ next unless $firstunv;
+
+ print qq~{BAT
+bna:CeleraAssembler
+crt:$date
+acc:$acc
+com:
+.
+}
+{ADT
+{ADL
+who:
+ctm:$date
+vsn:1.00
+com:
+Generated by $0 from file: $inname
+.
+}
+{ADL
+who:
+ctm:$date
+vsn:1.00
+com:
+AMOS UNV header
+$$fields{com}.
+}
+.
+}
+~;
+
+ $firstunv = 0;
+ } # type is UNV
+
+ if ($type eq "LIB"){
+ # only use the first DST record
+ if ($#$recs < 0){
+ $base->bail("LIB record doesn't have any DST record at or around line $. in input");
+ }
+ $libids{$$fields{"iid"}} = $acc;
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[0]);
+ if ($sid ne "DST"){
+ $base->bail("LIB record doesn't start with DST record at or around line $. in input");
+ }
+ if ($$sfs{mea} == 0) {
+ $$sfs{mea} = 10;
+ }
+ if ($$sfs{std} == 0) {
+ $$sfs{std} = 3;
+ }
+print qq~{DST
+act:A
+acc:$acc
+mea:$$sfs{mea}
+std:$$sfs{std}
+}
+~;
+ } # type is LIB
+
+ if ($type eq "FRG"){
+ $frg2lib{$$fields{"iid"}} = $$fields{"lib"};
+ if ( exists $$fields{"rds"} ) {
+ $$fields{"rds"} =~ /^(\d+),(\d+)/;
+ $mates{$1} = $2;
+ $rd2typ{$1} = $$fields{"typ"};
+ }
+ } # type is FRG
+
+ if ($type eq "RED"){
+ $rd2lib{$$fields{"iid"}} = $frg2lib{$$fields{"frg"}};
+ $rdids{$$fields{"iid"}} = $acc;
+
+my @clr = split /,/, $$fields{clr};
+if ($clr[0] > $clr[1])
+{
+ my $t = $clr[0];
+ $clr[0] = $clr[1];
+ $clr[1] = $t;
+ $$fields{clr} = "$clr[0],$clr[1]";
+}
+
+
+print qq~{FRG
+act:A
+acc:$acc
+typ:R
+src:
+$$fields{eid}
+.
+etm:0
+seq:
+$$fields{seq}.
+qlt:
+$$fields{qlt}.
+clr:$$fields{clr}
+}
+~;
+
+ } # type is RED
+} # while each record
+
+foreach my $rd1 ( keys %mates ) {
+ my $rd2 = $mates{$rd1};
+ if ($rd2lib{$rd1} != $rd2lib{$rd2}){
+ $base->bail("Reads $rd1 and $rd2 don't appear to map to the same library ($rd2lib{$rd1} != $rd2lib{$rd2})");
+ }
+
+my $typ = $rd2typ{$rd1};
+my $ori = "I";
+if ($typ eq "T")
+{
+ $ori = "O";
+}
+else
+{
+ $typ = "M";
+}
+
+print qq~{LKG
+act:A
+typ:$typ
+fg1:$rdids{$rd1}
+fg2:$rdids{$rd2}
+etm:0
+dst:$libids{$rd2lib{$rd1}}
+ori:$ori
+}
+~;
+} # for each mate
+
+exit(0);
diff --git a/src/Converters/amos2mates.pl b/src/Converters/amos2mates.pl
new file mode 100755
index 0000000..85a9fee
--- /dev/null
+++ b/src/Converters/amos2mates.pl
@@ -0,0 +1,123 @@
+#!/usr/local/bin/perl
+
+use AMOS::AmosLib;
+use TIGR::Foundation;
+
+use strict;
+
+my $VERSION = '$Revision$ ';
+my $HELP = q~
+.USAGE.
+ amos2mates [-i infile] [-o outfile]
+
+.DESCRIPTION.
+ Converts an AMOS message file to Bambus .mates file.
+
+.OPTIONS.
+ if -i and -o are not provided reads from STDIN and writes to STDOUT
+ if -i is provided but -o is not, outfile is same as infile except for the
+ extension
+ otherwise -i and -o are those specified in the command line
+ if -i is provided the filename must end in .afg
+
+.KEYWORDS.
+converter, amos, mates, bambus
+
+~;
+
+my $base = new TIGR::Foundation();
+if (! defined $base) {
+ die("A horrible death\n");
+}
+
+
+$base->setVersionInfo($VERSION);
+$base->setHelpInfo($HELP);
+
+my $infile;
+my $outfile;
+my $inname = "stdin";
+my $accession = 1;
+my $date = time();
+my $firstunv = 1;
+my %libids;
+my %frg2lib;
+my %rd2lib;
+my %rdids;
+my %mates;
+
+my $err = $base->TIGR_GetOptions("i=s" => \$infile,
+ "o=s" => \$outfile);
+
+
+
+# if infile is provided, make sure it ends in .afg and open it
+if (defined $infile){
+ if ($infile !~ /\.afg$/){
+ $base->bail ("Input file name must end in .afg");
+ }
+ $inname = $infile;
+ open(STDIN, $infile) || $base->bail("Cannot open $infile: $!\n");
+}
+
+# if infile is provided but outfile isn't make outfile by changing the extension
+if (! defined $outfile && defined $infile){
+ $outfile = $infile;
+ $outfile =~ s/(.*)\.afg$/\1.mates/;
+}
+
+# if outfile is provided (or computed above) simply open it
+if (defined $outfile){
+ open(STDOUT, ">$outfile") || $base->bail("Cannot open $outfile: $!\n");
+}
+
+while (my $record = getRecord(\*STDIN)){
+ my ($type, $fields, $recs) = parseRecord($record);
+
+ if ($type eq "LIB"){
+ # only use the first DST record
+ if ($#$recs < 0){
+ $base->bail("LIB record doesn't have any DST record at or around line $. in input");
+ }
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[0]);
+ if ($sid ne "DST"){
+ $base->bail("LIB record doesn't start with DST record at or around line $. in input");
+ }
+ my $min = int($$sfs{mea} - 3 * $$sfs{std});
+ my $max = int($$sfs{mea} + 3 * $$sfs{std});
+ $min = 0 if $min < 0;
+
+ print "library\t$$fields{iid}\t$min\t$max\n";
+ } # type is LIB
+
+ if ($type eq "FRG"){
+ $frg2lib{$$fields{"iid"}} = $$fields{"lib"};
+ if ( exists $$fields{"rds"} ) {
+ $$fields{"rds"} =~ /^(\d+),(\d+)/;
+ $mates{$1} = $2;
+ }
+ } # type is FRG
+
+ if ($type eq "RED"){
+ $rd2lib{$$fields{"iid"}} = $frg2lib{$$fields{"frg"}};
+
+ my $seqname;
+ if ( defined $$fields{eid} ) {
+ $seqname = $$fields{eid};
+ } else {
+ $seqname = $$fields{iid};
+ }
+
+ $rdids{$$fields{"iid"}} = $seqname;
+ } # type is RED
+} # while each record
+
+foreach my $rd1 ( keys %mates ) {
+ my $rd2 = $mates{$rd1};
+ if ($rd2lib{$rd1} != $rd2lib{$rd1}){
+ $base->bail("Reads $rd1 and $rd2 don't appear to map to the same library ($rd2lib{$rd1} != $rd2lib{$rd2})");
+ }
+ print "$rdids{$rd1}\t$rdids{$rd2}\t$rd2lib{$rd1}\n";
+} # for each mate
+
+exit(0);
diff --git a/src/Converters/amos2sq.pl b/src/Converters/amos2sq.pl
new file mode 100755
index 0000000..8e0ba24
--- /dev/null
+++ b/src/Converters/amos2sq.pl
@@ -0,0 +1,123 @@
+#!/usr/local/bin/perl
+
+use AMOS::AmosLib;
+use TIGR::Foundation;
+
+use strict;
+
+my $VERSION = '$Revision$ ';
+my $HELP = q~
+.USAGE.
+ amos2sq [-i] infile [-o outprefix]
+
+.DESCRIPTION.
+ Converters an AMOS message file to .seq/.qual files
+
+.OPTIONS.
+ infile must end in .afg
+ outputs will be placed in outprefix.seq and outprefix.qual
+ if -o is not specified, outprefix is infile stripped of .afg
+
+.KEYWORDS.
+ converter, amos, seq, qual
+
+~;
+
+my $base = new TIGR::Foundation();
+if (! defined $base) {
+ die("A horrible death\n");
+}
+
+
+$base->setVersionInfo($VERSION);
+$base->setHelpInfo($HELP);
+
+my $infile;
+my $outprefix;
+my %libinfo;
+my %frg2lib;
+
+my $err = $base->TIGR_GetOptions("i=s" => \$infile,
+ "o=s" => \$outprefix);
+
+
+
+# if infile is provided, make sure it ends in .afg and open it
+if (!defined $infile){
+ $infile = $ARGV[0];
+}
+
+if (! defined $infile){
+ $base->bail ("You must supply an input file");
+}
+
+if ($infile !~ /\.afg$/){
+ $base->bail ("Input file name must end in .afg");
+}
+if (! defined $outprefix){
+ $outprefix = $infile;
+ $outprefix =~ s/.afg$//;
+}
+open(IN, $infile) || $base->bail("Cannot open $infile: $!\n");
+
+
+# if infile is provided but outfile isn't make outfile by changing the extension
+open(SEQ, ">$outprefix.seq") || $base->bail("Cannot open $outprefix.seq :$!\n");
+open(QUAL, ">$outprefix.qual") || $base->bail("Cannot open $outprefix.qual: $!\n");
+
+while (my $record = getRecord(\*IN)){
+ my ($type, $fields, $recs) = parseRecord($record);
+
+ if ($type eq "LIB"){
+ # only use the first DST record
+ if ($#$recs < 0){
+ $base->bail("LIB record doesn't have any DST record at or around line $. in input");
+ }
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[0]);
+ if ($sid ne "DST"){
+ $base->bail("LIB record doesn't start with DST record at or around line $. in input");
+ }
+ my $med = int($$sfs{mea});
+ my $min = int($$sfs{mea} - 3 * $$sfs{std});
+ my $max = int($$sfs{mea} + 3 * $$sfs{std});
+ $min = 0 if $min < 0;
+
+ $libinfo{$$fields{iid}} = "$min $max $med";
+
+ } # type is LIB
+
+ if ($type eq "FRG"){
+ $frg2lib{$$fields{"iid"}} = $$fields{"lib"};
+ } # type is FRG
+
+ if ($type eq "RED"){
+ my @lines;
+ @lines = split('\n', $$fields{seq});
+ my $sequence = join('', @lines);
+ @lines = split('\n', $$fields{qlt});
+ my $qualities = join('', @lines);
+
+ my $seqname;
+ if ( defined $$fields{eid} ) {
+ $seqname = $$fields{eid};
+ } else {
+ $seqname = $$fields{iid};
+ }
+
+ my ($cll, $clr) = split(',', $$fields{clr});
+ $cll++; # TIGRize coordinates
+
+ my $quals = sprintf("%02d", ord(substr($qualities, 0, 1)) - ord('0'));
+ for (my $c = 1; $c < length($qualities); $c++){
+ $quals .= sprintf(" %02d", ord(substr($qualities, $c, 1)) - ord('0'));
+ }
+ printFastaSequence(\*SEQ, "$seqname $libinfo{$frg2lib{$$fields{frg}}} $cll $clr", uc($sequence));
+ printFastaQual(\*QUAL, "$seqname", $quals);
+ } # type is RED
+} # while each record
+
+close(IN);
+close(SEQ);
+close(QUAL);
+
+exit(0);
diff --git a/src/Converters/arachne2ctg.pl b/src/Converters/arachne2ctg.pl
new file mode 100755
index 0000000..4662b6e
--- /dev/null
+++ b/src/Converters/arachne2ctg.pl
@@ -0,0 +1,87 @@
+#!/usr/local/bin/perl
+
+use TIGR::Foundation;
+
+my $base = new TIGR::Foundation;
+
+if (! defined $base){
+ die ("Walk, do not run to the nearest EXIT!\n");
+}
+
+my $VERSION = '1.0 $Revision$ ';
+$base->setVersionInfo($VERSION);
+my $HELPTEXT = q~
+ arachne2ctg -o <file>.ctg assembly.reads
+ ~;
+
+$base->setHelpInfo($HELPTEXT);
+
+my $outname;
+my $err = $base->TIGR_GetOptions("o=s" => \$outname);
+
+if ($err == 0){
+ $base->bail("Command line parsing failed\n");
+}
+
+if (! defined $outname) {
+ $base->bail("You must specify an output file name\n");
+}
+
+if ($#ARGV != 0){
+ $base->bail("You must specify exactly one input file\n");
+}
+
+open(IN, $ARGV[0]) ||
+ $base->bail("Cannot open $ARGV[0]: $!\n");
+
+open(OUT, ">$outname") ||
+ $base->bail("Cannot open $outname: $!\n");
+
+my $last;
+
+while (<IN>){
+ chomp;
+
+ if (/^\#/) {
+ next; # skip comments
+ }
+
+ if (/^\s*$/){
+ next; # skip empty lines
+ }
+
+ my @fields = split('\t', $_);
+ my $read = $fields[0];
+ my $sta = $fields[1];
+ my $seqlen = $fields[4];
+ my $seql = $fields[3];
+ my $seqr = $seql + $seqlen;
+ my $asmblid = $fields[5];
+ my $asmlen = $fields[6];
+ my $asml = $fields[7];
+ my $asmr = $fields[8];
+ my $rc = $fields[9];
+
+ my $tmp;
+
+ if ($rc eq "-") {
+ $rc = "RC";
+ $tmp = $seql; # also invert $seql and $seqr
+ $seql = $seqr;
+ $seqr = $tmp;
+ } else {
+ $rc = "";
+ }
+
+ if (! defined $last || $asmblid != $last){
+ print OUT "##$asmblid 0 $asmlen bases, 00000000 checksum.\n";
+ }
+ $last = $asmblid;
+
+ print OUT "#$read($asml) [$rc] $seqlen bases, 00000000 checksum. {$seql $seqr} <$asml $asmr>\n";
+}
+
+close(OUT);
+close(IN);
+exit(0);
+
diff --git a/src/Converters/arachne2scaff.pl b/src/Converters/arachne2scaff.pl
new file mode 100755
index 0000000..0134ed8
--- /dev/null
+++ b/src/Converters/arachne2scaff.pl
@@ -0,0 +1,98 @@
+#!/usr/local/bin/perl
+
+use TIGR::Foundation;
+
+my $base = new TIGR::Foundation;
+
+if (! defined $base){
+ die ("Walk, do not run to the nearest EXIT!\n");
+}
+
+my $VERSION = '1.0 $Revision$ ';
+$base->setVersionInfo($VERSION);
+my $HELPTEXT = q~
+ arachne2scaff -o <prefix> assembly.links
+ ~;
+
+$base->setHelpInfo($HELPTEXT);
+
+my $outname;
+my $err = $base->TIGR_GetOptions("o=s" => \$outname);
+
+if ($err == 0){
+ $base->bail("Command line parsing failed\n");
+}
+
+if (! defined $outname) {
+ $base->bail("You must specify an output file name\n");
+}
+
+if ($#ARGV != 0){
+ $base->bail("You must specify exactly one input file\n");
+}
+
+open(IN, $ARGV[0]) ||
+ $base->bail("Cannot open $ARGV[0]: $!\n");
+
+my $oofile = "$outname.oo";
+my $sumfile = "$outname.sum";
+my $gapfile = "$outname.gaps";
+
+open(OO, ">$oofile") ||
+ $base->bail("Cannot open $oofile: $!\n");
+open(SUM, ">$sumfile") ||
+ $base->bail("Cannot open $sumfile: $!\n");
+open(GAP, ">$gapfile") ||
+ $base->bail("Cannot open $gapfile: $!\n");
+
+my $last;
+my $lastctg;
+my $lastspan;
+my $lastnctg;
+my $size = 0;
+while (<IN>){
+ chomp;
+
+ if (/^\#/) {
+ next; # skip comments
+ }
+
+ if (/^\s*$/){
+ next; # skip empty lines
+ }
+
+ my @fields = split('\t', $_);
+ my $id = $fields[0];
+ my $bases = $fields[1];
+ my $nctg = $fields[2];
+ my $ctg = $fields[4];
+ my $ctglen = $fields[5];
+ my $gap = $fields[6];
+
+ if (! defined $last || $id != $last){
+ print OO ">$id\n";
+ if (defined $last) {
+ print SUM "$last $lastnctg $size $lastspan\n";
+ }
+ print GAP ">$id\n";
+ $lastctg = undef;
+ $size = 0;
+ }
+ $last = $id;
+ if (defined $lastctg){
+ print GAP "$lastctg $ctg $gap\n";
+ }
+ $size += $ctglen;
+ $lastctg = $ctg;
+ $lastnctg = $nctg;
+ $lastspan = $bases;
+ print OO "$ctg BE\n";
+}
+print SUM "$last $lastnctg $size $lastspan\n";
+
+close(OO);
+close(SUM);
+close(GAP);
+close(IN);
+exit(0);
+
diff --git a/src/Converters/benchmark2arachne.pl b/src/Converters/benchmark2arachne.pl
new file mode 100755
index 0000000..e1c3f8e
--- /dev/null
+++ b/src/Converters/benchmark2arachne.pl
@@ -0,0 +1,274 @@
+#!/usr/local/bin/perl
+
+# Copyright (c) 2003, The Institute for Genomic Research (TIGR), Rockville,
+# Maryland, U.S.A. All rights reserved.
+
+use TIGR::Foundation;
+use TIGR::FASTAiterator;
+use TIGR::FASTArecord;
+
+my $base = new TIGR::Foundation;
+if (! defined $base){
+ die("Ouch!\n");
+}
+
+my $VERSION = 'version 1.0 ($Revision$)';
+$base->setVersionInfo($VERSION);
+
+my $HELP = q~
+ benchmark2arachne -o <out_dir> -g <genomesize> fasta1 fasta2 ... fastan
+
+<out_dir> is the output directory given relative to $ARACHNE_DATA_DIR
+ (which must be set for this program to run)
+<genomesize> is an estimate on the size of the genome being assembled. This
+ parameter is also required.
+ ~;
+
+$base->setHelpInfo($HELP);
+
+my $outdir;
+my $genomesize;
+my $err = $base->TIGR_GetOptions("o=s" => \$outdir,
+ "g=i" => \$genomesize);
+
+if ($err == 0) {
+ $base->bail("Command line processing failed\n");
+}
+
+if (! exists $ENV{ARACHNE_DATA_DIR}) {
+ $base->bail("The environment variable ARACHNE_DATA_DIR must be set\n");
+}
+
+if (! defined $outdir){
+ $base->bail("You must set the output directory with option -o \n");
+}
+
+if (! defined $genomesize){
+ $base->bail("You must provide a genome size with option -g \n");
+}
+
+my $basedir = $ENV{ARACHNE_DATA_DIR};
+
+# check that the relevant directories exist
+if (! -d "$basedir/$outdir") {
+ # output directory does not exist, make it
+ mkdir("$basedir/$outdir") ||
+ $base->bail("Cannot create directory $basedir/$outdir: $!\n");
+}
+
+my $seqdir = "$basedir/$outdir/fasta";
+my $qualdir = "$basedir/$outdir/qual";
+my $tracedir = "$basedir/$outdir/traceinfo";
+
+if (! -d $seqdir) {
+ # sequence directory does not exist, make it
+ mkdir($seqdir) ||
+ $base->bail("Cannot create directory $seqdir: $!\n");
+}
+
+if (! -d $qualdir) {
+ # quality directory does not exist, make it
+ mkdir($qualdir) ||
+ $base->bail("Cannot create directory $qualdir: $!\n");
+}
+
+if (! -d $tracedir) {
+ # trace directory does not exist make it
+ mkdir($tracedir) ||
+ $base->bail("Cannot create directory $tracedir: $!\n");
+}
+
+my $seqname = "$seqdir/$outdir.fasta";
+my $qualname = "$qualdir/$outdir.qual";
+my $tracename = "$tracedir/$outdir.xml";
+my $sizename = "$basedir/$outdir/genome.size";
+my $confname = "$basedir/$outdir/reads_config.xml";
+
+my @errors;
+
+my %mean;
+my %stdev;
+
+open(LIB, "library.info") || $base->bail("cannot open library.info: $!\n");
+
+while (<LIB>){
+ if (/^\#/) {
+ next;
+ }
+
+ my @fields = split('\t', $_);
+ $mean{$fields[0]} = $fields[1];
+ $stdev{$fields[0]} = $fields[2];
+}
+
+close(LIB);
+
+open(SIZE, ">$sizename") ||
+ $base->bail("Cannot open $sizename: $!\n");
+print SIZE "$genomesize\n";
+close(SIZE);
+
+open(CONF, ">$confname") ||
+ $base->bail("Cannot open $confname: $!\n");
+print CONF
+q~<?xml version="1.0"?>
+<!DOCTYPE configuration SYSTEM "configuration.dtd">
+<configuration>
+ <rule>
+ <name> all reads are paired production reads </name>
+ <match>
+ <match_field>trace_name</match_field>
+ <regex>.</regex>
+ </match>
+ <action>
+ <set>
+ <set_field>type</set_field>
+ <value>paired_production</value>
+ </set>
+ </action>
+ </rule>
+</configuration>
+ ~;
+close(CONF);
+
+
+open(SEQ, ">$seqname") ||
+ $base->bail("Cannot open $seqname: $!\n");
+
+open(QUAL, ">$qualname") ||
+ $base->bail("Cannot open $qualname: $!\n");
+
+open(XMLOUT, ">$tracename") ||
+ $base->bail("Cannot open $tracename: $!\n");
+ print XMLOUT "<?xml version=\"1.0\"?>\n";
+ print XMLOUT "<trace_volume>\n";
+
+for (my $i = 0; $i <= $#ARGV; $i++){
+ my $fname = $ARGV[$i];
+ my $prefix;
+ if ($fname =~ /(.*)\.seq$/) {
+ $prefix = $1;
+ } else {
+ $base->bail("Sequence file ($fname) must end in .seq\n");
+ }
+ open(FASTA, "$fname") ||
+ $base->bail("Cannot open $fname: $!\n");
+ open(INQUAL, "$prefix.qual") ||
+ $base->bail("Cannot open $prefix.qual: $!\n");
+
+ my $rec;
+ my $head;
+ my $sequence;
+ my $id;
+ my $clipl;
+ my $clipr;
+ my %clips = ();
+ while (<FASTA>) {
+ chomp;
+ if (/^>/) {
+ # first we write what we already got
+ if ($sequence ne ""){
+ $sequence = substr($sequence, $clipl - 1, $clipr - $clipl + 1);
+ print SEQ ">$id\n";
+ for (my $j = 0; $j < length($sequence); $j += 60){
+ print SEQ substr($sequence, $j, 60), "\n";
+ }
+ $sequence = "";
+ }
+
+ $head = $_;
+ $head =~ />(\S+)\s(\S+)\s(\S+)\s(\S+)\s(\d+)\s(\d+)/;
+
+ $id = $1;
+ my $insert = $3;
+ my $library = $2;
+ $clipl = $5;
+ $clipr = $6;
+ $clips{$id} = "$clipl,$clipr";
+ my $dir = $4;
+ my $plate = substr($id, 0, 5);
+ my $well = substr($id, 5, 2);
+ if ($dir =~ /^R/) {
+ $dir = "R";
+ } else {
+ $dir = "F";
+ }
+
+ print XMLOUT " <trace>\n";
+ print XMLOUT " <trace_name>$id</trace_name>\n";
+ print XMLOUT " <plate_id>$plate</plate_id>\n";
+ print XMLOUT " <well_id>$well</well_id>\n";
+ print XMLOUT " <template_id>$insert</template_id>\n";
+ print XMLOUT " <trace_end>$dir</trace_end>\n";
+# print XMLOUT " <clip_quality_left>$clipl</clip_quality_left>\n";
+# print XMLOUT " <clip_quality_right>$clipr</clip_quality_right>\n";
+ print XMLOUT " <library_id>$library</library_id>\n";
+ print XMLOUT " <insert_size>$mean{$library}</insert_size>\n";
+ print XMLOUT " <insert_stdev>", int($stdev{$library}), "</insert_stdev>\n";
+ print XMLOUT " <center_name>TIGR</center_name>\n";
+ print XMLOUT " <type>paired_production</type>\n";
+ print XMLOUT " </trace>\n";
+ } else {
+ $sequence .= $_;
+ }
+
+ }
+ if ($sequence ne ""){
+ $sequence = substr($sequence, $clipl - 1, $clipr - $clipl + 1);
+ print SEQ ">$id\n";
+ for (my $j = 0; $j < length($sequence); $j += 60){
+ print SEQ substr($sequence, $j, 60), "\n";
+ }
+ }
+ close(FASTA);
+
+ my @qualval = ();
+ while (<INQUAL>){
+ chomp;
+ if (/>(\S+)/){
+ if ($#qualval >= 0){
+ print QUAL ">$id\n";
+ @qualval = @qualval[($clipl - 1) .. ($clipr - 1)];
+ for (my $j = 0; $j <= $#qualval; $j += 18){
+ if ($j + 18 > $#qualval) {
+ print QUAL join(" ", @qualval[$j .. $#qualval]), "\n";
+ } else {
+ print QUAL join(" ", @qualval[$j .. $j + 17]), "\n";
+ }
+ }
+ }
+
+
+ $id = $1;
+ if (exists $clips{$id}){
+ ($clipl, $clipr) = split(',', $clips{$id});
+ } else {
+ $base->bail("Cannot find sequence record for quality $id\n");
+ }
+ @qualval = ();
+ } else {
+ push(@qualval, split(' ', $_));
+ }
+ }
+ if ($#qualval >= 0){
+ print QUAL ">$id\n";
+# print "clipping $id at $clipl, $clipr\n";
+ @qualval = @qualval[($clipl - 1) .. ($clipr - 1)];
+# print "$id has ", $#qualval + 1, " entries\n";
+ for (my $j = 0; $j <= $#qualval; $j += 18){
+ if ($j + 18 > $#qualval) {
+ print QUAL join(" ", @qualval[$j .. $#qualval]), "\n";
+ } else {
+ print QUAL join(" ", @qualval[$j .. $j + 17]), "\n";
+ }
+ }
+ }
+
+ close(INQUAL);
+}
+print XMLOUT "</trace_volume>\n";
+close(XMLOUT);
+close(SEQ);
+close(QUAL);
+
+exit(0);
diff --git a/src/Converters/benchmark2ca.pl b/src/Converters/benchmark2ca.pl
new file mode 100755
index 0000000..50518d4
--- /dev/null
+++ b/src/Converters/benchmark2ca.pl
@@ -0,0 +1,303 @@
+#!/usr/local/bin/perl
+
+use strict;
+
+use TIGR::Foundation;
+use AMOS::AmosLib;
+
+my $MINSEQ = 100;
+my $MAXSEQ = 2048;
+my $ID = 1;
+
+my $base = new TIGR::Foundation;
+
+if (! defined $base){
+ die("Ouch\n");
+}
+
+my $VERSION = '1.0 ($Revision$)';
+$base->setVersionInfo($VERSION);
+
+my $HELP = q~
+ benchmark2ca -o <outprefix> fasta1 fasta2 ... fastan
+
+<outprefix> - prefix for the resulting .frg file. Required.
+ ~;
+$base->setHelpInfo($HELP);
+
+my $outfname;
+my $err = $base->TIGR_GetOptions("o=s" => \$outfname);
+if ($err == 0) {
+ $base->bail("Command line processing failed\n");
+}
+
+my %clones;
+my %seqs;
+my %seqId;
+my %lib ;
+my %clr;
+
+
+# steps : generate .frg headers
+# generate .frg FRG records
+# generate .seq and .qual files
+# add DST and LKG records to .frg file
+my $fragname = "$outfname.frg";
+
+#my $seqname = "$prefix.seq";
+#my $qualname = "$prefix.qual";
+
+open(FRAG, ">$fragname") || die ("Cannot open $fragname: $!");
+
+printFragHeader(\*FRAG);
+
+my %inserts; # inserts in a library
+my %end3; # insert end3
+my %end5; # insert end5
+my %seenins;
+for (my $f = 0; $f <= $#ARGV; $f++){
+ my $sfname = $ARGV[$f];
+ my $qfname;
+ if ($sfname =~ /^(.*)\.seq$/){
+ $qfname = "$1.qual";
+ } else {
+ $base->bail("File $sfname does not end in .seq\n");
+ }
+
+ print STDERR "parsing $sfname and $qfname\n";
+
+ open(CSEQ, "$sfname") || die ("Cannot open $sfname: $!");
+ open(CQUAL, "$qfname") || die ("Cannot open $qfname: $!");
+
+ my ($frec, $fhead) = getFastaContent(\*CSEQ, undef);
+ my ($qrec, $qhead) = getFastaContent(\*CQUAL, 1);
+
+ while (defined $fhead){
+ $fhead =~ />(\S+)\s(\S+)\s(\S+)\s(\S+)\s(\d+)\s(\d+)/;
+ my $fid = $1;
+ my $l = $5 - 1; my $r = $6;
+ my $lb = $2;
+ my $ins = $3;
+ my $dir = $4;
+
+ $clr{$fid} = "$l,$r";
+ if (! exists $seenins{$ins}){
+ $inserts{$lb} .= "$ins ";
+ $seenins{$ins} = 1;
+ }
+
+ if ($dir =~ /^R/){
+ if (! exists $end3{$ins} ||
+ $end3{$ins} lt $fid){
+ $end3{$ins} = $fid;
+ }
+ } else {
+ if (! exists $end5{$ins} ||
+ $end5{$ins} lt $fid){
+ $end5{$ins} = $fid;
+ }
+ }
+
+ $qhead =~ />(\S+)/;
+ my $qid = $1;
+
+ if ($fid != $qid){
+ die ("fasta and qual records have different IDs: $fid vs $qid\n");
+ }
+
+ ($frec, $fhead) = getFastaContent(\*CSEQ, undef);
+ ($qrec, $qhead) = getFastaContent(\*CQUAL, 1);
+
+ if (! exists $clr{$fid}){
+ print "$fid has no clear range\n";
+ next;
+ }
+
+ if (eof(CSEQ)){
+ print STDERR "found end of seq file\n";
+ $frec .= $fhead;
+ $qrec .= " $qhead";
+ $fhead = undef;
+ }
+
+ my $seqlen = length($frec);
+ if ($seqlen < $MINSEQ){
+ print STDERR "sequence is too short\n";
+ next;
+ }
+ my ($seq_lend, $seq_rend) = split(',', $clr{$fid});
+
+ my $recId = getId();
+
+ $seqId{$fid} = $recId;
+
+ my @quals = split(' ', $qrec);
+ if ($#quals + 1 != $seqlen) {
+ die ("\nFasta and quality disagree ($fid): $seqlen vs " . sprintf("%d", $#quals + 1) . "\n");
+ }
+
+ my $caqual = "";
+ for (my $q = 0; $q <= $#quals; $q++){
+ my $qv = $quals[$q];
+ if ($qv > 60) {
+ $qv = 60;
+ }
+
+ $caqual .= chr(ord('0') + $qv);
+ }
+
+ print STDERR "$recId\r";
+
+ if ($seqlen > $MAXSEQ){
+ $frec = substr($frec, 0, $seq_rend + 1);
+ $caqual = substr($caqual, 0, $seq_rend + 1);
+ $seqlen = length($frec);
+ if ($seqlen > $MAXSEQ){
+ print STDERR "\nskipping sequence $fid due to length $seqlen\n";
+ delete $seqId{$fid};
+ next;
+ }
+ }
+
+ print FRAG "{FRG\n";
+ print FRAG "act:A\n";
+ print FRAG "acc:$recId\n";
+ print FRAG "typ:R\n";
+ print FRAG "src:\n$fid\n.\n";
+ print FRAG "etm:0\n";
+ print FRAG "seq:\n";
+ $frec =~ s/[^actgnACTGN]/N/g;
+ for (my $s = 0; $s < $seqlen; $s += 60){
+ print FRAG substr($frec, $s, 60), "\n";
+ }
+ print FRAG ".\n";
+ print FRAG "qlt:\n";
+ for (my $s = 0; $s < $seqlen; $s += 60){
+ print FRAG substr($caqual, $s, 60), "\n";
+ }
+ print FRAG ".\n";
+ print FRAG "clr:$seq_lend,$seq_rend\n";
+ print FRAG "}\n";
+ } # while $fhead
+} # for each file
+
+print STDERR "done\n";
+close(CSEQ);
+close(CQUAL);
+
+print STDERR "doing mates\n";
+
+
+open(LIB, "library.info") ||
+ die ("Cannot open library.info: $!\n");
+
+while (<LIB>){
+ if (/^\#/){
+ next;
+ }
+
+ my @fields = split('\t', $_);
+
+ my $lib = $fields[0];
+ my $mea = $fields[1];
+ my $std = $fields[2];
+
+ if ($mea == 0){
+ next;
+ }
+
+ my $dstId = getId();
+
+ print FRAG "{DST\n";
+ print FRAG "act:A\n";
+ print FRAG "acc:$dstId\n";
+ print FRAG "mea:$mea\n";
+ print FRAG "std:$std\n";
+ print FRAG "}\n";
+
+ my @insert = split(' ', $inserts{$lib});
+
+ for (my $ii = 0; $ii <= $#insert; $ii++){
+ if (! exists $end5{$insert[$ii]} ||
+ ! exists $end3{$insert[$ii]}){
+ next;
+ }
+
+ print FRAG "{LKG\n";
+ print FRAG "act:A\n";
+ print FRAG "typ:M\n";
+ print FRAG "fg1:$seqId{$end5{$insert[$ii]}}\n";
+ print FRAG "fg2:$seqId{$end3{$insert[$ii]}}\n";
+ print FRAG "etm:0\n";
+ print FRAG "dst:$dstId\n";
+ print FRAG "ori:I\n";
+ print FRAG "}\n";
+ }
+}
+
+close(LIB);
+print STDERR "done\n";
+close(FRAG);
+
+
+exit(0);
+
+
+sub getFastaContent
+{
+ my $file = shift;
+ my $isqual = shift;
+
+ if (eof($file)){
+ return undef;
+ }
+
+ $_ = <$file>;
+
+ chomp;
+ my $outline = "";
+
+ while (! eof($file) && $_ !~ /^>/){
+ if (defined $isqual){
+ $outline .= " ";
+ }
+ $outline .= $_;
+ $_ = <$file>;
+ chomp;
+ }
+ return ($outline, $_);
+}
+
+sub printFragHeader
+{
+ my $file = shift;
+
+ my $id = getId();
+
+ print $file "{BAT\n";
+ print $file "bna:Celera Assembler\n";
+ print $file "crt:" . time() . "\n";
+ print $file "acc:$id\n";
+ print $file "com:\n";
+ for (my $i = 0; $i <= $#ARGV; $i++){
+ print $file "$ARGV[$i]\n";
+ }
+ print $file ".\n";
+ print $file "}\n";
+
+ print $file "{ADT\n";
+ print $file "{ADL\n";
+ print $file "who:$ENV{USER}\n";
+ print $file "ctm:" . time() . "\n";
+ print $file "vsn:1.00\n";
+ print $file "com:\nGenerated by cs2ca.pl\n.\n";
+ print $file "}\n";
+ print $file ".\n";
+ print $file "}\n";
+}
+
+sub getId
+{
+ return $ID++;
+}
+
diff --git a/src/Converters/benchmark2mates.pl b/src/Converters/benchmark2mates.pl
new file mode 100755
index 0000000..c62a851
--- /dev/null
+++ b/src/Converters/benchmark2mates.pl
@@ -0,0 +1,205 @@
+#!/usr/local/bin/perl
+
+use strict;
+
+use TIGR::Foundation;
+use AMOS::AmosLib;
+
+my $ID = 1;
+
+my $base = new TIGR::Foundation;
+
+if (! defined $base){
+ die("Ouch\n");
+}
+
+my $VERSION = '1.0 ($Revision$)';
+$base->setVersionInfo($VERSION);
+
+my $HELP = q~
+.USAGE.
+ benchmark2mates [-C] [-o <outprefix>] fasta1 fasta2 ... fastan
+
+.DESCRIPTION.
+ This program converts
+
+.OPTIONS.
+ -o prefix for the resulting .mates file. (required)
+ -C generate Bambus <outprefix>.conf file (optional)
+
+.KEYWORDS.
+ converter, mates,
+
+~;
+$base->setHelpInfo($HELP);
+
+my $outfname;
+my $doConf;
+my $err = $base->TIGR_GetOptions("o=s" => \$outfname,
+ "C" => \$doConf);
+if ($err == 0) {
+ $base->bail("Command line processing failed\n");
+}
+
+my %clones;
+my %seqs;
+my %seqId;
+my %lib ;
+my %clr;
+
+if (! defined $outfname) {
+ $base->bail("You must provide an output prefix\n");
+}
+
+my $matename = "$outfname.mates";
+my $conffile = "$outfname.conf";
+
+if (defined $doConf){
+ open(CONF, ">$conffile") || $base->bail("Cannot open $conffile: $!");
+}
+open(MATE, ">$matename") || $base->bail("Cannot open $matename: $!");
+
+my %inserts; # inserts in a library
+my %end3; # insert end3
+my %end5; # insert end5
+my %seenins;
+for (my $f = 0; $f <= $#ARGV; $f++){
+ my $sfname = $ARGV[$f];
+
+ print STDERR "parsing $sfname\n";
+
+ open(CSEQ, "$sfname") || $base->bail("Cannot open $sfname: $!");
+
+ my ($frec, $fhead) = getFastaContent(\*CSEQ, undef);
+
+ while (defined $fhead){
+ $fhead =~ />(\S+)\s(\S+)\s(\S+)\s(\S+)\s(\d+)\s(\d+)/;
+ my $fid = $1;
+ my $l = $5 - 1; my $r = $6;
+ my $lb = $2;
+ my $ins = $3;
+ my $dir = $4;
+
+ $clr{$fid} = "$l,$r";
+ if (! exists $seenins{$ins}){
+ $inserts{$lb} .= "$ins ";
+ $seenins{$ins} = 1;
+ }
+
+ if ($dir =~ /^R/){
+ if (! exists $end3{$ins} ||
+ $end3{$ins} lt $fid){
+ $end3{$ins} = $fid;
+ }
+ } else {
+ if (! exists $end5{$ins} ||
+ $end5{$ins} lt $fid){
+ $end5{$ins} = $fid;
+ }
+ }
+
+ ($frec, $fhead) = getFastaContent(\*CSEQ, undef);
+
+ if (eof(CSEQ)){
+ print STDERR "found end of seq file\n";
+ $frec .= $fhead;
+ $fhead = undef;
+ }
+
+ my $recId = getId();
+
+ $seqId{$fid} = $recId;
+
+ print STDERR "$recId\r";
+ } # while $fhead
+} # for each file
+
+print STDERR "done\n";
+close(CSEQ);
+
+print STDERR "doing mates\n";
+
+
+open(LIB, "library.info") || $base->bail("Cannot open library.info: $!\n");
+
+while (<LIB>){
+ if (/^\#/){
+ next;
+ }
+
+ my @fields = split('\t', $_);
+
+ my $lib = $fields[0];
+ my $mea = $fields[1];
+ my $std = $fields[2];
+
+ my $minlib = $mea - 3 * $std;
+ if ($minlib < 0 ) {$minlib = 0;}
+
+ my $maxlib = $mea + 3 * $std;
+
+ if ($mea == 0){
+ next;
+ }
+
+ my $dstId = getId();
+
+ if (defined $doConf){
+ print CONF "priority lib_$dstId 1\n";
+ print CONF "overlaps lib_$dstId Y\n";
+ }
+ print MATE "library\t$dstId\t$minlib\t$maxlib\n";
+
+ my @insert = split(' ', $inserts{$lib});
+
+ for (my $ii = 0; $ii <= $#insert; $ii++){
+ if (! exists $end5{$insert[$ii]} ||
+ ! exists $end3{$insert[$ii]}){
+ next;
+ }
+
+ print MATE "$end5{$insert[$ii]}\t$end3{$insert[$ii]}\t$dstId\n";
+ }
+}
+
+if (defined $doConf){
+ print CONF "mingroupsize 0\n";
+ print CONF "redundancy 2\n";
+ close(CONF);
+}
+close(LIB);
+print STDERR "done\n";
+
+exit(0);
+
+
+sub getFastaContent
+{
+ my $file = shift;
+ my $isqual = shift;
+
+ if (eof($file)){
+ return undef;
+ }
+
+ $_ = <$file>;
+
+ chomp;
+ my $outline = "";
+
+ while (! eof($file) && $_ !~ /^>/){
+ if (defined $isqual){
+ $outline .= " ";
+ }
+ $outline .= $_;
+ $_ = <$file>;
+ chomp;
+ }
+ return ($outline, $_);
+}
+
+sub getId
+{
+ return $ID++;
+}
+
diff --git a/src/Converters/benchmark2ta.pl b/src/Converters/benchmark2ta.pl
new file mode 100755
index 0000000..4b53b10
--- /dev/null
+++ b/src/Converters/benchmark2ta.pl
@@ -0,0 +1,183 @@
+#!/usr/local/bin/perl
+
+# Copyright (c) 2003, The Institute for Genomic Research (TIGR), Rockville,
+# Maryland, U.S.A. All rights reserved.
+
+use TIGR::Foundation;
+
+my $base = new TIGR::Foundation;
+if (! defined $base){
+ die("Ouch!\n");
+}
+
+my $VERSION = 'version 1.0 ($Revision$)';
+$base->setVersionInfo($VERSION);
+
+my $HELP = q~
+ benchmark2ta -o <out_prefix> fasta1 fasta2 ... fastan
+
+<out_prefix> - prefix for the output files (<out_prefix>.seq and
+ <out_prefix>.qual).
+ ~;
+
+$base->setHelpInfo($HELP);
+
+my $outprefix;
+my $err = $base->TIGR_GetOptions("o=s" => \$outdir);
+
+if ($err == 0) {
+ $base->bail("Command line processing failed\n");
+}
+
+if (! defined $outprefix){
+ $base->bail("You must set the output prefix with option -o \n");
+}
+
+my $seqname = "$outprefix.seq";
+my $qualname = "$outprefix.qual";
+
+my %mean;
+my %stdev;
+
+open(LIB, "library.info") || $base->bail("cannot open library.info: $!\n");
+
+while (<LIB>){
+ if (/^\#/) {
+ next;
+ }
+
+ my @fields = split('\t', $_);
+ $mean{$fields[0]} = $fields[1];
+ $stdev{$fields[0]} = $fields[2];
+}
+
+close(LIB);
+
+open(SEQ, ">$seqname") ||
+ $base->bail("Cannot open $seqname: $!\n");
+
+open(QUAL, ">$qualname") ||
+ $base->bail("Cannot open $qualname: $!\n");
+
+for (my $i = 0; $i <= $#ARGV; $i++){
+ my $fname = $ARGV[$i];
+ my $prefix;
+ if ($fname =~ /(.*)\.seq$/) {
+ $prefix = $1;
+ } else {
+ $base->bail("Sequence file ($fname) must end in .seq\n");
+ }
+ open(FASTA, "$fname") ||
+ $base->bail("Cannot open $fname: $!\n");
+ open(INQUAL, "$prefix.qual") ||
+ $base->bail("Cannot open $prefix.qual: $!\n");
+
+ my $rec;
+ my $head;
+ my $sequence;
+ my $id;
+ my $clipl;
+ my $clipr;
+ my %clips;
+ my $library;
+ while (<FASTA>) {
+ chomp;
+ if (/^>/) {
+ # first we write what we already got
+ if ($sequence ne ""){
+# $sequence = substr($sequence, $clipl - 1, $clipr - $clipl + 1);
+ print SEQ ">$id";
+
+ my $libmin = $mean{$library} - 3 * $stdev{$library};
+ my $libmax = $mean{$library} + 3 * $stdev{$library};
+ if ($libmin < 0) {
+ $libmin = 0;
+ }
+
+ print SEQ " $libmin $libmax $mean{$library} $clipl $clipr\n";
+
+ for (my $j = 0; $j < length($sequence); $j += 60){
+ print SEQ substr($sequence, $j, 60), "\n";
+ }
+ $sequence = "";
+ }
+
+ $head = $_;
+ $head =~ />(\S+)\s(\S+)\s(\S+)\s(\S+)\s(\d+)\s(\d+)/;
+
+ $id = $1;
+ $library = $2;
+ $clipl = $5;
+ $clipr = $6;
+ $clips{$id} = "$clipl,$clipr";
+ } else {
+ $sequence .= $_;
+ }
+
+ }
+ if ($sequence ne ""){
+ $sequence = substr($sequence, $clipl - 1, $clipr - $clipl + 1);
+ print SEQ ">$id";
+ my $libmin = $mean{$library} - 3 * $stdev{$library};
+ my $libmax = $mean{$library} + 3 * $stdev{$library};
+ if ($libmin < 0) {
+ $libmin = 0;
+ }
+
+ print SEQ " $libmin $libmax $mean{$library} $clipl $clipr\n";
+ for (my $j = 0; $j < length($sequence); $j += 60){
+ print SEQ substr($sequence, $j, 60), "\n";
+ }
+ }
+ close(FASTA);
+
+ my @qualval = ();
+ while (<INQUAL>){
+ chomp;
+ if (/>(\S+)/){
+ if ($#qualval >= 0){
+ print QUAL ">$id\n";
+# @qualval = @qualval[($clipl - 1) .. ($clipr - 1)];
+ for (my $j = 0; $j <= $#qualval; $j += 18){
+ if ($j + 18 > $#qualval) {
+ print QUAL join(" ", @qualval[$j .. $#qualval]), "\n";
+ } else {
+ print QUAL join(" ", @qualval[$j .. $j + 17]), "\n";
+ }
+ }
+ }
+
+
+ $id = $1;
+ if (exists $clips{$id}){
+ ($clipl, $clipr) = split(',', $clips{$id});
+ } else {
+ $base->bail("Cannot find sequence record for quality $id\n");
+ }
+ @qualval = ();
+ } else {
+ push(@qualval, split(' ', $_));
+ }
+ }
+ if ($#qualval >= 0){
+ print QUAL ">$id\n";
+# print "clipping $id at $clipl, $clipr\n";
+# @qualval = @qualval[($clipl - 1) .. ($clipr - 1)];
+# print "$id has ", $#qualval + 1, " entries\n";
+ for (my $j = 0; $j <= $#qualval; $j += 18){
+ if ($j + 18 > $#qualval) {
+ print QUAL join(" ", @qualval[$j .. $#qualval]), "\n";
+ } else {
+ print QUAL join(" ", @qualval[$j .. $j + 17]), "\n";
+ }
+ }
+ }
+
+ close(INQUAL);
+}
+print XMLOUT "</trace_volume>\n";
+close(XMLOUT);
+close(SEQ);
+close(QUAL);
+
+exit(0);
diff --git a/src/Converters/blasr2coords.pl b/src/Converters/blasr2coords.pl
new file mode 100755
index 0000000..e887f8d
--- /dev/null
+++ b/src/Converters/blasr2coords.pl
@@ -0,0 +1,30 @@
+#!/usr/bin/perl -w
+use strict;
+
+while (<>)
+{
+ chomp;
+ my @vals = split /\s/, $_;
+
+ my $qname = $vals[0];
+ my $rname = $vals[1];
+ my $qoo = $vals[2];
+ my $score = $vals[3];
+ my $id = $vals[4];
+
+ my $rstart = $vals[5] + 1;
+ my $rend = $vals[6] + 1;
+ my $rlen = $vals[7];
+
+ my $qstart = $vals[8] + 1;
+ my $qend = $vals[9] + 1;
+ my $qlen = $vals[10];
+
+ printf("%8d %8d | %8d %8d | %8d %8d | %9.02f | %8d %8d | %8.02f %9.02f | $rname\t$qname\n",
+ $rstart, $rend,
+ (($qoo == 0) ? $qstart : $qend), (($qoo == 0) ? $qend : $qstart),
+ $rend - $rstart, $qend - $qstart,
+ $id,
+ $rlen, $qlen,
+ 100 * (($rend - $rstart)/$rlen), 100 * (($qend-$qstart)/$qlen));
+}
diff --git a/src/Converters/blat2nucmer.pl b/src/Converters/blat2nucmer.pl
new file mode 100755
index 0000000..d4e4ede
--- /dev/null
+++ b/src/Converters/blat2nucmer.pl
@@ -0,0 +1,154 @@
+#! /usr/bin/env perl
+
+# blat2nucmer is a script to convert BLAT's .psl files to the nucmer format
+# Author: Nagarjun Vijay
+
+# From http://genome.ucsc.edu/goldenPath/help/blatSpec.html :
+# A .psl file describes a series of alignments in a dense easily parsed text
+# format. It begins with a five line header which describes each field.
+# Following this is one line for each alignment with a tab between each field.
+# The fields are describe below in a format suitable for many relational
+# databases.
+#
+# matches int unsigned , # Number of bases that match that aren't repeats
+# misMatches int unsigned , # Number of bases that don't match
+# repMatches int unsigned , # Number of bases that match but are part of repeats
+# nCount int unsigned , # Number of 'N' bases
+# qNumInsert int unsigned , # Number of inserts in query
+# qBaseInsert int unsigned , # Number of bases inserted in query
+# tNumInsert int unsigned , # Number of inserts in target
+# tBaseInsert int unsigned , # Number of bases inserted in target
+# strand char(2) , # + or - for query strand, optionally followed by + or – for target strand
+# qName varchar(255) , # Query sequence name
+# qSize int unsigned , # Query sequence size
+# qStart int unsigned , # Alignment start position in query
+# qEnd int unsigned , # Alignment end position in query
+# tName varchar(255) , # Target sequence name
+# tSize int unsigned , # Target sequence size
+# tStart int unsigned , # Alignment start position in target
+# tEnd int unsigned , # Alignment end position in target
+# blockCount int unsigned , # Number of blocks in alignment. A block contains no gaps.
+# blockSizes longblob , # Size of each block in a comma separated list
+# qStarts longblob , # Start of each block in query in a comma separated list
+# tStarts longblob , # Start of each block in target in a comma separated list
+#
+# In general the coordinates in psl files are “zero based half open.” The first
+# base in a sequence is numbered zero rather than one. When representing a range
+# the end coordinate is not included in the range. Thus the first 100 bases of a
+# sequence are represented as 0-100, and the second 100 bases are represented as
+# 100-200. There is a another little unusual feature in the .psl format. It has
+# to do with how coordinates are handled on the negative strand. In the qStart/
+# qEnd fields the coordinates are where it matches from the point of view of the
+# forward strand (even when the match is on the reverse strand). However on the
+# qStarts[] list, the coordinates are reversed.
+#
+# Here's an example of a 30-mer that has 2 blocks that align on the minus strand
+# and 2 blocks on the plus strand (this sort of stuff happens in real life in
+# response to assembly errors sometimes).
+#
+# 0 1 2 3 tens position in query
+# 0123456789012345678901234567890 ones position in query
+# ++++ +++++ plus strand alignment on query
+# -------- ---------- minus strand alignment on query
+#
+# Plus strand:
+# qStart 12 qEnd 31 blockSizes 4,5 qStarts 12,26
+# Minus strand:
+# qStart 4 qEnd 26 blockSizes 10,8 qStarts 5,19
+#
+# Essentially the minus strand blockSizes and qStarts are what you would get if
+# you reverse complemented the query.However the qStart and qEnd are non-
+# reversed. To get from one to the other:
+# qStart = qSize - revQEnd
+# qEnd = qSize - revQStart
+
+use strict;
+use warnings;
+use TIGR::Foundation;
+
+my $VERSION = '$Revision$ ';
+my $HELP = qq~
+.USAGE.
+ blat2nucmer -i psl_file
+
+.DESCRIPTION.
+ psl2nucmer converts BLAT .psl files into a tab-delimited format that nucmer
+ can use. The results are printed on screen.
+
+.KEYWORDS.
+ converter, nucmer, blat
+
+~;
+
+my $base = new TIGR::Foundation();
+if (! defined $base) {
+ die("Error: Could not initialize foundation.\n");
+}
+
+$base->setVersionInfo($VERSION);
+$base->setHelpInfo($HELP);
+
+my $pslfile;
+
+my $err = $base->TIGR_GetOptions(
+ "i=s" => \$pslfile,
+);
+
+
+if (! defined $pslfile){
+ die "You must specify an input .psl file with option -i\n";
+}
+
+blat2nucmer($pslfile);
+
+exit;
+
+
+
+
+sub blat2nucmer {
+ my ($pslfile) = @_;
+ open my $in, "<", $pslfile or die $!;
+ while ( my $z = <$in> ) {
+ my @values = split(/\t/, $z);
+ if($values[8] =~ /\+/){#writing positive strand as is
+ print
+ ($values[15]+1)."\t".#zero to one based
+ $values[16]."\t|\t".
+ ($values[11]+1)."\t".#zero to one based
+ $values[12]."\t|\t".
+ abs($values[16]-$values[15])."\t".
+ abs($values[12]-$values[11])."\t|\t".
+ (sprintf "%.2f",(($values[0]+$values[2]+$values[3])*100)/abs($values[12]-$values[11]))."\t|\t".
+ $values[14]."\t".
+ $values[10]."\t|\t".
+ (sprintf "%.2f",(abs($values[16]-$values[15])*100/$values[14]))."\t".
+ (sprintf "%.2f",(abs($values[12]-$values[11])*100/$values[10]))."\t|\t".
+ $values[13]."\t".
+ $values[9]."\n";
+ }
+ elsif($values[8] =~ /\-/){#for negative strand writing qry coordinates in reverse
+ print
+ ($values[15]+1)."\t".#zero to one based
+ $values[16]."\t|\t".
+ $values[12]."\t|\t".
+ ($values[11]+1)."\t".#zero to one based
+ abs($values[16]-$values[15])."\t".
+ abs($values[12]-$values[11])."\t|\t".
+ (sprintf "%.2f",(($values[0]+$values[2]+$values[3])*100)/abs($values[12]-$values[11]))."\t|\t".
+ $values[14]."\t".
+ $values[10]."\t|\t".
+ (sprintf "%.2f",(abs($values[16]-$values[15])*100/$values[14]))."\t".
+ (sprintf "%.2f",(abs($values[12]-$values[11])*100/$values[10]))."\t|\t".
+ $values[13]."\t".
+ $values[9]."\n";
+ }
+ else{#few blocks match on positive and few on negative strand. Ignore these hits
+ }
+ }
+ close $in;
+ return 1;
+}
+
+
+
diff --git a/src/Converters/ca2ctg.pl b/src/Converters/ca2ctg.pl
new file mode 100755
index 0000000..2e5fb46
--- /dev/null
+++ b/src/Converters/ca2ctg.pl
@@ -0,0 +1,249 @@
+#!/usr/local/bin/perl
+
+# $Id$
+#
+# This program creates an empty .ctg file that only contains
+# the headers for the sequences and contigs
+#
+
+use IO::File;
+use File::Basename;
+use TIGR::Foundation;
+use AMOS::AmosLib;
+use strict;
+
+my $MY_VERSION = " Version 1.0 (Build " . (qw/$Revision$/ )[1] . ")";
+
+# Constants
+
+my $MY_HELPTEXT = qq~
+ ca2ctg -i file.asm -o file.ctg -f file.frg -s select.list [-p]
+
+ you can specify multiple frg files on the command line
+~;
+
+my $base = new TIGR::Foundation;
+
+if (! defined $base){
+ print STDERR "Nasty error, hide!\n";
+ exit(1);
+}
+
+
+
+$base->setHelpInfo($MY_HELPTEXT);
+$base->setVersionInfo($MY_VERSION);
+
+my $infile;
+my $outfile;
+my @frgfiles;
+my $selfile;
+my $promote; # promote unitigs?
+
+my $err = $base->TIGR_GetOptions("i=s" => \$infile,
+ "o=s" => \$outfile,
+ "f=s" => \@frgfiles,
+ "s=s" => \$selfile,
+ "p" => \$promote);
+
+
+if ($err == 0){
+ $base->bail("Command line parsing failed. See -h option");
+}
+
+if (! defined $infile){
+ if ($#ARGV < 0){
+ $base->bail("Must specify an input file name. See -h option");
+ } else {
+ $infile = $ARGV[0];
+ }
+}
+
+my %selected;
+
+if (defined $selfile){
+ open(SEL, $selfile) || $base-bail("Cannot open $selfile :$!\n");
+ while (<SEL>){
+ chomp;
+ $selected{$_} = 1;
+ }
+ close(SEL);
+}
+
+my $record;
+
+my %seqnames;
+for (my $i = 0; $i <= $#frgfiles; $i++){
+ my $frgfile = $frgfiles[$i];
+ print STDERR "Doing $frgfile\n";
+ open(FRG, $frgfile) || $base->bail("Cannot open $frgfile: $!\n");
+ while ($record = getRecord(\*FRG)){
+ my ($type, $fields, $recs) = parseRecord($record);
+ if ($type eq "FRG"){
+ my $id = getCAId($$fields{acc});
+ my $nm = $$fields{src};
+ my @lines = split('\n', $nm);
+ $nm = join(' ', @lines);
+ if ($nm ne "" && $nm !~ /^\s*$/){
+ $seqnames{$id} = $nm;
+ }
+ }
+ }
+ close(FRG);
+}
+print STDERR "done\n";
+
+if (defined $outfile){
+ open(STDOUT, ">$outfile") ||
+ $base->bail("Cannot open \"$outfile\": $!\n");
+}
+
+open(IN, $infile) || $base->bail("Cannot open $infile: $!");
+my $prefix = (split /\./,basename($infile))[0];
+
+print STDERR "first pass through asm\n";
+my %clear;
+my %referenced; # number of times each unitig is referenced
+
+if (defined $promote) {
+ while ($record = getRecord(\*IN)){
+ my ($type, $fields, $recs) = parseRecord($record);
+ if ($type eq "CCO"){
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+ if ($sid eq "UPS") {
+ if ($$sfs{typ} eq "S"){
+ $referenced{$$sfs{lid}}++;
+ }
+ }
+ }
+ }
+ }
+ seek(IN, 0, 0); # rewind the input
+}
+
+print STDERR "done\n";
+my %readmap; # map of reads in each unitig
+
+print STDERR "second pass through asm\n";
+while ($record = getRecord(\*IN)){
+ my ($type, $fields, $recs) = parseRecord($record);
+
+ if ($type eq "CCO" || $type eq "UTG"){
+ my $id = getCAId($$fields{"acc"});
+
+ if ($type eq "CCO" && defined $selfile && ! exists $selected{$id}){
+ next; # contig wasn't selected
+ }
+ if ($type eq "UTG" && ! defined $promote && ! defined $selfile) {
+ next; # don't do untigs unless selected
+ }
+ if ($type eq "UTG" && defined $promote &&
+ $referenced{$id} != 1 && ! exists $selected{$id}){
+ next;
+ }
+ if ($type eq "UTG" && ! defined $promote && ! exists $selected{$id}) {
+ next;
+ }
+
+ print STDERR ">$id\n";
+ my @gaps = ();
+ my $contiglen = $$fields{"len"};
+ while ($$fields{"cns"} =~ /-/g){
+ push(@gaps, $-[0]);
+ print STDERR "found gap at ", $gaps[$#gaps], " $-[0]\n";
+ $contiglen--;
+ }
+
+ my $nreads = ($type eq "UTG") ? $$fields{"nfr"} : $$fields{"npc"};
+
+ if ((defined $selfile && exists $selected{$id}) || $type eq "CCO"){
+ print "##$id $nreads $contiglen bases\n";
+ }
+
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+ if ($sid eq "MPS"){
+ my $fid = getCAId($$sfs{"mid"});
+ my ($cll, $clr) = split(',', $clear{$fid});
+ my $flen = $clr - $cll + 1;
+ my ($asml, $asmr) = split(',', $$sfs{"pos"});
+ if ($asml > $asmr) {
+ my $tmp = $cll;
+ $cll = $clr;
+ $clr = $tmp;
+ $tmp = $asml;
+ $asml = $asmr;
+ $asmr = $tmp;
+ }
+
+ my $g = 0;
+ while ($g <= $#gaps && $gaps[$g] < $asml){
+ $g++;
+ }
+ print STDERR "$asml saw $g gaps\n";
+ $asml -= $g;
+ while ($g <= $#gaps && $gaps[$g] < $asmr){
+ $g++;
+ }
+ print STDERR "$asmr saw $g gaps\n";
+ $asmr -= $g;
+
+ $asmr--;
+
+ if ($type eq "UTG" && defined $promote && ! exists $selected{$id}){
+ $readmap{$id} .= "$fid,$asml,$asmr ";
+ next;
+ }
+
+ my $off = $asml;
+ if (exists $seqnames{$fid}){
+ $fid = $seqnames{$fid};
+ }
+
+ if ((defined $selfile && exists $selected{$id}) || $type eq "CCO"){
+ print "#$fid($off) $flen bases {$cll $clr} <$asml $asmr>\n";}
+ } # if MPS
+ if ($sid eq "UPS"){
+ if ($$sfs{"typ"} ne "S" || ! defined $promote || $referenced{$$sfs{"lid"}} != 1){
+ next;
+ }
+ my @reads = split(' ', $readmap{$$sfs{"lid"}});
+ my ($ul, $ur) = split(',', $$sfs{"pos"});
+ my $sign = ($ul < $ur) ? 1 : -1;
+ for (my $rr = 0; $rr <= $#reads; $rr++){
+ my ($rid, $rlef, $rrig) = split(',', $reads[$rr]);
+ my ($cll, $clr) = split(',', $clear{$rid});
+ my $flen = $clr - $cll;
+ if (exists $seqnames{$rid}){
+ $rid = $seqnames{$rid};
+ }
+ my $asml = $ul + $sign * $rlef;
+ my $asmr = $ul + $sign * $rrig;
+ if ($asml > $asmr) {
+ my $tmp = $cll;
+ $cll = $clr;
+ $clr = $tmp;
+ $tmp = $asml;
+ $asml = $asmr;
+ $asmr = $tmp;
+ }
+ $asmr--;
+ my $off = $asml;
+ print "#$rid($off) $flen bases {$cll $clr} <$asml $asmr>\n"; }
+ } # if UPS
+ } # for each record
+
+
+ } # if $type = CCO
+
+
+ if ($type eq "AFG")
+ {
+ my $id = getCAId($$fields{"acc"});
+ my $clrs = $$fields{"clr"};
+ $clear{$id} = $clrs;
+ }
+
+} # while $record
+print STDERR "done\n";
diff --git a/src/Converters/ca2mates.pl b/src/Converters/ca2mates.pl
new file mode 100755
index 0000000..d079807
--- /dev/null
+++ b/src/Converters/ca2mates.pl
@@ -0,0 +1,156 @@
+#!/usr/local/bin/perl
+
+use strict;
+use AMOS::AmosLib;
+use TIGR::Foundation;
+
+my $version = '$Revision$ ';
+
+my $helptext = qq~
+.USAGE.
+ ca2mates [-a .asm file] prefix
+
+.DESCRIPTION.
+ Extracts BAMBUS .mates information from a .frg file. If a .asm file
+ is provided as well, it uses the library sizes specified in this file.
+
+ if prefix ends in .frg program assumes that it represents the .frg file
+ otherwise the program attaches the .frg extension when looking for the
+ input file <prefix.frg>.
+
+.OPTIONS.
+ -a .asm file
+
+.KEYWORDS.
+ converter, celera assembler, mates
+ ~;
+
+my $base = new TIGR::Foundation;
+
+if (! defined $base){
+ print STDERR "Nasty error, hide!\n";
+ exit(1);
+}
+
+
+$base->setHelpInfo($helptext);
+$version =~ s/\$//g;
+$base->setVersionInfo($version);
+
+my $asmfile;
+$base->TIGR_GetOptions("a=s" => \$asmfile);
+
+my $infile;
+my $ids = $ARGV[1];
+$infile = $ARGV[0];
+
+if (! defined $infile){
+ $base->bail("You must provide a file");
+}
+
+#my $asmfile = $infile . ".asm";
+my $frgfile;
+if ($infile =~ /\.frg$/){
+ $frgfile = $infile;
+} else {
+ $frgfile = $infile . ".frg";
+}
+
+my $outfile = $infile . ".mates";
+
+my %sequences;
+
+
+if (! -e $frgfile) {
+ $base->bail("Cannot find $frgfile");
+}
+
+if (defined $asmfile){
+ open(ASM, $asmfile) ||
+ $base->bail("Cannot open $asmfile: $!");
+}
+open(OUT, ">$outfile") ||
+ $base->bail("Cannot open $outfile: $!");
+
+my $foundMDI = 0;
+
+if (defined $asmfile){
+ print STDERR "Reading $asmfile\n";
+
+ while ( my $record = getRecord(\*ASM)){
+ my ($type, $fields, $recs) = parseRecord($record);
+
+ if ($type eq "MDI"){
+ my $id = getCAId($$fields{"ref"});
+ my $mean = $$fields{"mea"};
+ my $stdev = $$fields{"std"};
+
+ my $min = $mean - 3 * $stdev;
+ if ($min < 0) {$min = 0;}
+
+ my $max = $mean + 3 * $stdev;
+
+ print STDERR "library\t$id\t$min\t$max\n";
+ print OUT "library\t$id\t$min\t$max\n";
+
+ $foundMDI = 1;
+ } else {
+ if ($foundMDI){
+ print STDERR "Last record was an $type\n";
+ last;
+ }
+ }
+ }
+
+ close(ASM);
+}
+
+print STDERR "done\n";
+print STDERR "Reading $frgfile\n";
+
+open(FRG, "$frgfile") ||
+ $base->bail("Cannot open $frgfile : $!");
+
+while ( my $record = getRecord(\*FRG)){
+ my ($type, $fields, $recs) = parseRecord($record);
+
+ if ($type eq "DST"){
+ if (! defined $asmfile){
+ my $id = getCAId($$fields{"acc"});
+ my $mean = $$fields{"mea"};
+ my $stdev = $$fields{"std"};
+ my $min = $mean - 3 * $stdev;
+ if ($min < 0) {$min = 0;}
+
+ my $max = $mean + 3 * $stdev;
+ print OUT "library\t$id\t$min\t$max\n";
+ }
+ }elsif ($type eq "FRG"){
+ my $id = getCAId($$fields{"acc"});
+ my $name = getCAId($$fields{"src"});
+
+ my @name = split('\n', $name);
+ $name = join('', @name);
+
+ $sequences{$id} = $name;
+ } elsif ($type eq "LKG"){
+ my $seqA;
+ my $seqB;
+ if (defined $ids) {
+ $seqA = $$fields{"fg1"};
+ $seqB = $$fields{"fg2"};
+ } else {
+ $seqA = $sequences{$$fields{"fg1"}};
+ $seqB = $sequences{$$fields{"fg2"}};
+ }
+
+ print OUT "$seqA\t$seqB\t$$fields{dst}\n";
+ }
+}
+
+close(FRG);
+close(OUT);
+
+print STDERR "done\n";
+
+exit(0);
diff --git a/src/Converters/ca2scaff.pl b/src/Converters/ca2scaff.pl
new file mode 100755
index 0000000..3bdaf3d
--- /dev/null
+++ b/src/Converters/ca2scaff.pl
@@ -0,0 +1,257 @@
+#!/usr/local/bin/perl
+
+# $Id$
+#
+# This program creates an empty .ctg file that only contains
+# the headers for the sequences and contigs
+#
+
+use IO::File;
+use File::Basename;
+use AMOS::AmosFoundation;
+use AMOS::AmosLib;
+use strict;
+
+my $MY_VERSION = " Version 1.0 (Build " . (qw/$Revision$/ )[1] . ")";
+
+# Constants
+
+my $MY_HELPTEXT = qq~
+ ca2scaff -i file.asm -o prefix [-details -f file.frg] -clk
+~;
+
+my $base = new AMOS::AmosFoundation;
+
+if (! defined $base){
+ print STDERR "Nasty error, hide!\n";
+ exit(1);
+}
+
+
+$base->setHelpText($MY_HELPTEXT);
+$base->setUsage($MY_HELPTEXT);
+$base->setVersion($MY_VERSION);
+
+my $infile;
+my $outfile;
+my $frgfile;
+my $dodetails;
+my $doclk;
+
+my $err = $base->getOptions("i=s" => \$infile,
+ "o=s" => \$outfile,
+ "details" => \$dodetails,
+ "f=s" => \$frgfile,
+ "clk" => \$doclk);
+
+
+if ($err == 0){
+ $base->bail("Command line parsing failed. See -h option");
+}
+
+if (! defined $infile){
+ if ($#ARGV < 0){
+ $base->bail("Must specify an input file name. See -h option");
+ } else {
+ $infile = $ARGV[0];
+ }
+}
+
+if (! defined $outfile){
+ $base->bail("Must specify an output prefix. See -h option");
+}
+
+
+my $record;
+
+my %seqnames;
+if (defined $frgfile){
+ open(FRG, $frgfile) || $base->bail("Cannot open $frgfile: $!\n");
+ while ($record = getRecord(\*FRG)){
+ my ($type, $fields, $recs) = parseRecord($record);
+ if ($type eq "FRG"){
+ my $id = $$fields{"acc"};
+ my $name = $$fields{"src"};
+ my @name = split('\n', $name);
+ $name = join("", @name);
+ $seqnames{$id} = $name;
+ }
+ }
+}
+
+my $oofile = "$outfile.oo";
+my $sumfile = "$outfile.sum";
+my $gapfile = "$outfile.gaps";
+my $linkfile = "$outfile.links";
+my $detailfile = "$outfile.details";
+
+open(OO, ">$oofile") ||
+ $base->bail("Cannot open $oofile: $!\n");
+open(SUM, ">$sumfile") ||
+ $base->bail("Cannot open $sumfile: $!\n");
+open(GAP, ">$gapfile") ||
+ $base->bail("Cannot open $gapfile: $!\n");
+open(LNK, ">$linkfile") ||
+ $base->bail("Cannot open $linkfile: $!\n");
+if (defined $dodetails) {
+ open(DET, ">$detailfile") ||
+ $base->bail("Cannot open $detailfile: $!\n");
+}
+
+print LNK "<?xml version = \"1.0\" ?>\n";
+print LNK "<EVIDENCE>\n";
+
+open(IN, $infile) ||
+ $base->bail("Cannot open $infile: $!");
+my $prefix = (split /\./,basename($infile))[0];
+
+
+my %ctglen;
+my %ctglinks;
+my $lnkid = 0;
+while ($record = getRecord(\*IN)){
+ my ($type, $fields, $recs) = parseRecord($record);
+
+ if ($type eq "CCO"){
+ my $id = getCAId($$fields{"acc"});
+ my $contiglen = $$fields{"len"};
+ while ($$fields{"cns"} =~ /-/g){
+ $contiglen--;
+ }
+
+ $ctglen{$id} = $contiglen;
+ }
+ if ($type eq "CLK"){
+ if (defined $dodetails){
+ my $pair;
+ $pair = "$$fields{co1} $$fields{co2}";
+ my @seqs = split('\n', $$fields{"jls"});
+ for (my $s = 0; $s <= $#seqs; $s++){
+ my @mates = split(',', $seqs[$s]);
+ $ctglinks{$pair} .= "$seqnames{$mates[0]} $seqnames{$mates[1]} ";
+ }
+ } elsif (defined $doclk){
+ my $c1 = $$fields{co1};
+ my $c2 = $$fields{co2};
+ my $o1;
+ my $o2;
+
+ if ($$fields{ori} eq "I"){ # innie
+ $o1 = "BE";
+ $o2 = "EB";
+ } elsif ($$fields{ori} eq "O") { #outie
+ $o1 = "EB";
+ $o2 = "BE";
+ } elsif ($$fields{ori} eq "N") { #normal
+ $o1 = "BE";
+ $o2 = "BE";
+ } elsif ($$fields{ori} eq "A") { # anti
+ $o1 = "EB";
+ $o2 = "EB";
+ }
+ my $gap = $$fields{mea};
+
+ for (my $ll = 0; $ll < $$fields{num}; $ll++){
+ print LNK "<LINK ID = \"lnk_$lnkid\" SIZE = \"$gap\" TYPE =\"CA\">\n";
+ print LNK " <CONTIG ID=\"contig_$c1\" ORI=\"$o1\"></CONTIG>\n";
+ print LNK " <CONTIG ID=\"contig_$c2\" ORI=\"$o2\"></CONTIG>\n";
+ print LNK "</LINK>\n";
+ $lnkid++;
+ }
+ }
+ }
+ if ($type eq "SCF"){
+ my $id = getCAId($$fields{"acc"});
+ my $scflen = 0;
+ my $scfspan = 0;
+ my $nctg = $$fields{"noc"} + 1;
+
+ print OO ">$id\n";
+ print GAP ">$id\n";
+
+ if (defined $dodetails && $nctg > 1){
+ print DET "\nScaffold $id\n";
+ }
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+ if ($sid eq "CTP"){
+ my $c1 = $$sfs{"ct1"};
+ my $c2 = $$sfs{"ct2"};
+ my $pair = "$c1 $c2";
+ my $rev = 0;
+ if (! exists $ctglinks{$pair}){
+ $pair = "$c2 $c1";
+ $rev = 1;
+ }
+ my $ori = $$sfs{"ori"};
+ my $o1;
+ my $o2;
+ if ($ori eq "N" || $ori eq "I"){
+ $o1 = "BE";
+ } else {
+ $o1 = "EB";
+ }
+
+ if ($ori eq "N" || $ori eq "O"){
+ $o2 = "BE";
+ } else {
+ $o2 = "EB";
+ }
+
+ if (defined $dodetails && $nctg > 1){
+ if ($rev){
+ print DET "$c2 $o2 ---- $c1 $o1\n";
+ } else {
+ print DET "$c1 $o1 ---- $c2 $o2\n";
+ }
+ my @mates = split(' ', $ctglinks{$pair});
+ for (my $m = 0; $m <= $#mates; $m+= 2){
+ print DET " $mates[$m] - ", $mates[$m + 1], "\n";
+ }
+ }
+
+ if ($i == 0){
+ print OO "$c1 $o1\n";
+ $scflen += $ctglen{$c1};
+ $scfspan += $ctglen{$c1};
+ }
+ if ($nctg != 1){
+ print OO "$c2 $o2\n";
+ $scflen += $ctglen{$c2};
+ $scfspan += $ctglen{$c2};
+
+ print GAP "$c1 $c2 $$sfs{mea}\n";
+ my $gap = $$sfs{mea};
+ $scfspan += $gap;
+ $gap = int($gap);
+# if ($o1 eq "BE"){
+# $gap += $ctglen{$c1};
+# }
+# if ($o2 eq "EB"){
+# $gap += $ctglen{$c2};
+# }
+ my $gapmin = $gap - 10;
+ my $gapmax = $gap + 10;
+ if (! defined $doclk){
+ print LNK "<LINK ID = \"lnk_${id}_$lnkid\" SIZE = \"$gap\" TYPE =\"CA\">\n";
+ print LNK " <CONTIG ID=\"contig_$c1\" ORI=\"$o1\"></CONTIG>\n";
+ print LNK " <CONTIG ID=\"contig_$c2\" ORI=\"$o2\"></CONTIG>\n";
+ print LNK "</LINK>\n";
+ }
+# print LNK "link ins_" . "$id" . "$lnkid" . " contig_$c1 $o1 contig_$c2 $o2 J " . "$gapmin $gapmax Y\n";
+ $lnkid++;
+ }
+ } # if CTP
+ } # for each rec
+ print SUM "$id $nctg $scflen ", int($scfspan), "\n";
+
+ } # if $type = SCF
+} # while $record
+print LNK "</EVIDENCE>\n";
+close(LNK);
+close(SUM);
+close(GAP);
+close(OO);
+close(IN);
+if (defined $dodetails){ close(DET);}
+exit(0);
diff --git a/src/Converters/ca2singletons.pl b/src/Converters/ca2singletons.pl
new file mode 100755
index 0000000..0dc2e6d
--- /dev/null
+++ b/src/Converters/ca2singletons.pl
@@ -0,0 +1,168 @@
+#!/usr/bin/perl
+
+#
+# This program outputs the set of singleton reads in an assembly in one of
+# three formats:
+#
+# FASTA file (either the entire read or just the clear range)
+# Contig file (just the header for use in Bambus)
+# list (simply a list of the sequence names)
+#
+# A singleton is a read present in the .frg file that is not referenced by any
+# CCO or UTG record in the .asm file
+
+use IO::File;
+use File::Basename;
+use AMOS::AmosFoundation;
+use AMOS::AmosLib;
+use strict;
+
+my $MY_VERSION = " Version 1.0 (Build " . (qw/$Revision$/ )[1] . ")";
+
+# Constants
+
+my $MY_HELPTEXT = qq~
+.USAGE.
+ ca2singletons -i file.asm -o file.fasta -f file.frg [-contig|-clear|-list]
+
+.DESCRIPTION.
+ This program converts from a Celera .frg and .asm file to a list of singleton
+ read sequences in fasta format.
+
+.OPTIONS.
+ -i input .asm file
+ -o output .fasta file name
+ -f input .frg file
+ -clear outputs just the clear range of the singletons
+ -contig outputs singletons in TIGR .contig format
+ -list outputs a list of the singleton names
+
+.KEYWORDS.
+ converter, celera, singletons
+~;
+
+my $base = new AMOS::AmosFoundation;
+
+if (! defined $base){
+ print STDERR "Nasty error, hide!\n";
+ exit(1);
+}
+
+
+
+$base->setHelpText($MY_HELPTEXT);
+$base->setUsage("getSingletons -i file.asm -o file.fasta -f file.frg [-contig|-clear|-list]");
+$base->setVersion($MY_VERSION);
+
+my $infile;
+my $outfile;
+my $frgfile;
+my $selfile;
+my $clear;
+my $contig;
+my $list;
+
+my $err = $base->getOptions("i=s" => \$infile,
+ "o=s" => \$outfile,
+ "f=s" => \$frgfile,
+ "contig" => \$contig,
+ "clear" => \$clear,
+ "list" => \$list);
+
+
+if ($err == 0){
+ $base->bail("Command line parsing failed. See -h option");
+}
+
+if (! defined $infile){
+ if ($#ARGV < 0){
+ $base->bail("Must specify an input file name. See -h option");
+ } else {
+ $infile = $ARGV[0];
+ }
+}
+
+my $record;
+my %seqnames;
+
+open(IN, $infile) || $base->bail("Cannot open $infile: $!");
+my $prefix = (split /\./,basename($infile))[0];
+
+if (defined $outfile){
+ open(STDOUT, ">$outfile") ||
+ $base->bail("Cannot open \"$outfile\": $!\n");
+}
+
+print STDERR "pass through asm\n";
+while ($record = getRecord(\*IN)){
+ my ($type, $fields, $recs) = parseRecord($record);
+
+ if ($type eq "CCO"){# || $type eq "UTG"){
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+ if ($sid eq "MPS"){
+ my $fid = getCAId($$sfs{"mid"});
+ $seqnames{$fid} = 1;
+ } # if MPS
+ } # for each record
+
+ } # if $type = CCO
+ if ($type eq "UTG"){
+ if ($$fields{"sta"} eq "N" ||
+ $$fields{"sta"} eq "U"){
+ next;
+ }
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+ if ($sid eq "MPS"){
+ my $fid = getCAId($$sfs{"mid"});
+ $seqnames{$fid} = 1;
+ } # if MPS
+ } # for each record
+ }
+
+} # while $record
+print STDERR "done\n";
+
+
+if (defined $frgfile){
+ print STDERR "Doing $frgfile\n";
+ open(FRG, $frgfile) || $base->bail("Cannot open $frgfile: $!\n");
+ while ($record = getRecord(\*FRG)){
+ my ($type, $fields, $recs) = parseRecord($record);
+ if ($type eq "FRG"){
+ my $id = getCAId($$fields{acc});
+ my $nm = $$fields{src};
+ my @lines = split('\n', $nm);
+ $nm = join(' ', @lines);
+ if ($nm =~ /^\s*$/){
+ $nm = $id;
+ }
+ if (! exists $seqnames{$id}){
+ # print record
+ my ($cll, $clr) = split(',', $$fields{clr});
+ my $len = $clr - $cll;
+ if (defined $contig){
+ print "##$nm 1 $len bases, 00000000 checksum.\n";
+ print "$nm(0) [] $len bases, 00000000 checksum. {1 $len} <1 $len>\n";
+ } elsif (defined $list){
+ print "$nm\n";
+ } else {
+ my $sequence = $$fields{seq};
+ my @seq = split('\n', $sequence);
+ $sequence = join('', @seq);
+ if (defined $clear){
+ $sequence = substr($sequence, $cll, $clr - $cll);
+ }
+ print ">$nm\n";
+ for (my $j = 0; $j < length($sequence); $j+=60){
+ print substr($sequence, $j, 60), "\n";
+ }
+ }
+ }
+ }
+ }
+ close(FRG);
+}
+print STDERR "done\n";
+exit(0);
diff --git a/src/Converters/ca2ta.pl b/src/Converters/ca2ta.pl
new file mode 100755
index 0000000..7348f8f
--- /dev/null
+++ b/src/Converters/ca2ta.pl
@@ -0,0 +1,865 @@
+#!/usr/local/bin/perl
+
+use strict;
+use Fcntl;
+use TIGR::Foundation;
+use AMOS::AmosLib;
+use IO::Handle;
+
+my $FILEBUF;
+my %seql; # id -> clear range correspondence
+my %seqr;
+my %seqpos; # id -> file offset correspondence
+my %namepos; # name -> file offset correspondence
+my %seqnames; # id -> seqname correspondence
+my @usednames; # seqnames used in .contig file
+my %chosen; # chosen IDs
+my %deleted; # list of deleted IDs
+
+my $MINSEQSIZE = 64;
+
+my $contigname;
+my $tigrasmname;
+my $fragfname;
+my $fastafname;
+my $seqfname;
+my $qualfname;
+my $cfn;
+my $opref;
+my $frgStore;
+my $gkpStore;
+
+my @offsets; # offset -> asm_lend, asm_rend correspondence
+
+my $version = '$Revision$ ';
+my $helptext = qq~
+.USAGE.
+ ca2ta [options] file.asm
+
+.DESCRIPTION.
+ Converts CA output file.asm into file.fasta, file.contig, file.tasm similar
+ to the corresponding outputs of TA. A file named file.frg must be present
+ in the current directory.
+
+.OPTIONS.
+ -select fname Only performs this operation for contigs and unitigs
+ specified in fname
+ -contigs Does not report unitigs in .tasm
+ -nofasta Do not create .fasta output
+ -justfasta Only create .fasta output
+ -o prefix Output prefix
+ -nonames Uses Ids rather than trying to figure out seqnames
+
+
+ ca2ta [options] file.frg
+ converts CA input file.frg into file.seq, file.qual similar to
+ inputs for TA
+
+ -check Prints out those seqnames that are shorter than MINSEQ
+ -minseq sets MINSEQ. Default is 64
+ -o prefix Output prefix
+ -filter filters the .frg file for sequences shorter than MINSEQ
+ -noqual doesnt create .qual file
+ -mates creates a .mates file indicating which sequences are mates
+
+.KEYWORDS.
+ converter, Celera, TIGR assembler
+~;
+
+my $base = new TIGR::Foundation;
+
+if (! defined $base){
+ print STDERR "the sky is falling, run away!\n";
+ exit(1);
+}
+
+$base->setHelpInfo($helptext);
+$version =~ s/\$//g;
+$base->setVersionInfo($version);
+
+my $frgInfo = "/local/asmg/bin/CA/bin/get_frag_info";
+$base->addDependInfo($frgInfo);
+
+my $ischeck = 0;
+my $contigsonly;
+my $nofasta;
+my $justfasta;
+my $noqual;
+my $filter;
+my $getmates;
+my %accname; # correspondence between accessions and seqnames
+my %meandist; # library sizes
+my %stdevdist;
+my %uid2iid;
+my $nonames;
+
+my $err = $base->TIGR_GetOptions("select=s" => \$cfn,
+ "contigs" => \$contigsonly,
+ "check" => \$ischeck,
+ "minseq=i" => \$MINSEQSIZE,
+ "nofasta" => \$nofasta,
+ "justfasta" => \$justfasta,
+ "o=s" => \$opref,
+ "filter" => \$filter,
+ "noqual" => \$noqual,
+ "mates" => \$getmates,
+ "nonames" => \$nonames);
+if ($err == 0){
+ $base->bail("Command line parsing failed. See -h option");
+}
+
+if (defined $cfn){
+ open (CH, "$cfn") ||
+ $base->bail("Cannot open \"$cfn\": $!\n");
+
+ while (<CH>){
+ chomp;
+ $chosen{$_} = 1;
+ }
+ close(CH);
+}
+my $fh = new IO::Handle;
+
+open(IN, "$ARGV[0]") ||
+ $base->bail("Cannot open \"$ARGV[0]\": $!\n");
+
+$fh->fdopen(fileno(IN), "r") || $base->bail("Cannot open IN: $!\n");
+$fh->setvbuf($FILEBUF, IO::Handle::_IOFBF, 102400); # set a 100 k buffer
+
+my $isfrag = 0;
+if ($ARGV[0] =~ /(\S+)\.frg/){
+ if (!defined $opref){
+ $opref = $1;
+ }
+ $isfrag = 1;
+
+ if (defined $filter){
+ if ($opref eq $1){
+ $base->bail("You must choose a different output name with -o\n");
+ }
+ open(NEWFRG, ">$opref.frg") ||
+ $base->bail("Cannot open \"$opref.frg\": $!\n");
+ }
+
+ if ($ischeck != 1){
+ open (SEQ, ">$opref.seq") ||
+ $base->bail("Cannot open \"$opref.seq\": $!\n");
+ if (! defined $noqual){
+ open (QUAL, ">$opref.qual") ||
+ $base->bail("Cannot open \"$opref.qual\": $!\n");
+ }
+ if (defined $getmates){
+ open (MATES, ">$opref.mates") ||
+ $base->bail("Cannot open \"$opref.mates\": $!\n");
+ }
+ }
+} else {
+ $ARGV[0] =~ /(\S+)\.asm/;
+ if (! defined $1){
+ $base->bail("\"$ARGV[0]\" not recognized, must have extension .asm or .frg\n");
+ }
+
+# $frgStore = "$1.frgStore";
+# if (! -d $frgStore){
+# $base->bail("Cannot find fragment store \"$frgStore\"");
+# }
+# $gkpStore = "$1.gkpStore";
+# if (! -d $gkpStore){
+# $base->bail("Cannot find gatekeeper store \"$gkpStore\"");
+# }
+
+ if (!defined $opref){
+ $opref = $1;
+ }
+ $contigname = "$opref.contig";
+ $tigrasmname = "$opref.tasm";
+ $fragfname = "$1.frg";
+ $fastafname = "$opref.fasta";
+ $seqfname = "$opref.seq";
+ $qualfname = "$opref.qual";
+ if (!defined $justfasta) {
+ open(OUT, ">$contigname") ||
+ $base->bail("Cannot open \"$contigname\": $!\n");
+ open(TASM, ">$tigrasmname")||
+ $base->bail("Cannot open \"$tigrasmname\": $!\n");
+ open(FRG, "$fragfname") ||
+ $base->bail("Cannot open \"$fragfname\": $!\n");
+ }
+ if (!defined $nofasta){
+ open(FASTA, "> $fastafname") ||
+ $base->bail("Cannot open \"$fastafname\": $!\n");
+ }
+ if (defined $cfn){
+ open(SEQ, ">$seqfname") ||
+ $base->bail("Cannot open \"$seqfname\": $!\n");
+ if (!defined $noqual){
+ open(QUAL, ">$qualfname") ||
+ $base->bail("Cannot open \"$qualfname\": $!\n");
+ }
+ }
+
+ # get the seek positions within the FRG file
+ if (! defined $justfasta){
+ my $seekpos = tell FRG;
+ while (my $record = getRecord(\*FRG)){
+ my ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec eq "FRG"){
+ # print "setting $$fields{acc} to $seekpos\n";
+ $seqpos{$$fields{acc}} = $seekpos;
+ my $nm = $$fields{src};
+ my @lines = split('\n', $nm);
+ $nm = join(' ', @lines);
+ if ($nm eq "" || $nm =~ /^\s*$/){
+ $nm = "$$fields{acc}";
+ }
+ $seqnames{$$fields{acc}} = $nm;
+ $namepos{$nm} = $seekpos;
+ }
+ $seekpos = tell FRG;
+ }
+ } # if ! defined $justfasta
+}
+
+my $record = "";
+my $first = 1;
+my $number = 0;
+
+while ($record = getRecord(\*IN)){
+ my ($rec, $fields, $recs) = parseRecord($record);
+
+ if ($rec eq "ADT"){ # audit
+ if (defined $filter){
+ print NEWFRG $record;
+ }
+ next;
+ } # audit
+
+ if ($rec eq "MDI"){ # mate distance
+ if (defined $filter){
+ print NEWFRG $record;
+ }
+ print "Distance id: $$fields{ref} revised to \n",
+ "mean: $$fields{mea}, stddev: $$fields{std}, min: $$fields{min}, ",
+ "max: $$fields{max}\n";
+ next;
+ } # mate distance
+
+ if ($rec eq "AFG"){ # augmented fragment
+ if ($#$recs != -1){
+ print "Fragment ", getCAId($$fields{acc}),
+ " matches ", $#$recs + 1, " screens\n";
+ }
+
+ # convert the external ids into internal ids
+ $$fields{acc} =~ /\((\d+),(\d+)\)/;
+ if (!defined $1){
+ $base->bail("Can't understand accession \"$$fields{acc}\"");
+ }
+ $uid2iid{$1} = $2;
+
+ # get the new clear range
+ $$fields{clr} =~ /(\d+),(\d+)/;
+ if (!defined $1){
+ print STDERR "Wierd clear range for fragment, ", getCAId($$fields{acc}), "\n";
+ next;
+ }
+ $seql{getCAId($$fields{acc})} = $1;
+ $seqr{getCAId($$fields{acc})} = $2;
+ next;
+ } # augmented fragment
+
+ if ($rec eq "UTG"){ # unitig record
+ if (defined $contigsonly || defined $justfasta){
+ next;
+ }
+ if ($$fields{"sta"} ne "S"){
+ # we only report the Separable repeats in the output
+ # and only in the .asm file.
+ next;
+ }
+ @offsets = ();
+ my $id = getCAId($$fields{acc});
+
+ if (defined $cfn && (! exists($chosen{$id}))){
+ next;
+ }
+
+ my $len = $$fields{len};
+ my $lseq = $$fields{cns};
+ my $nseq = $$fields{nfr};
+
+ my @fields = split('\n', $lseq);
+ $lseq = join('', @fields);
+
+ if (length($lseq) == 0){
+ next;
+ }
+
+ if ($first != 1){
+ print TASM "|\n";
+ }
+ $first = 0;
+ print_contig(\*TASM, $id, $len, $nseq, $lseq, "asm", "CA_FREE");
+ if (defined $cfn){
+ print_contig(\*OUT, $id, $len, $nseq, $lseq, "contig");
+ }
+
+# here the offsets array will contain one entry for each position
+# in the consensus ($lseq). That entry is the number of non-gap
+# characters in the consensus, up to the current coordinate.
+#
+# these numbers follow the asm_lend, asm_rend convention and start at 1.
+ $#offsets = length($lseq) - 1;
+ my $coord = 0;
+ for (my $i = 0; $i < length($lseq); $i++){
+ if (substr($lseq, $i, 1) ne "-"){
+ $coord++;
+ }
+ $offsets[$i] = $coord;
+ }
+
+# here we parse the individual sequences aligned to the contig
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+
+ if ($sid eq "MPS"){
+ if ($$sfs{typ} ne "R"){
+ print STDERR "wierd type $$sfs{typ}\n";
+ next;
+ }
+ } else {
+ next;
+ }
+
+ my ($id, $sequence, $asml, $asmr, $rc, $seqleft, $seqright) =
+ deal_with_mps($sfs);
+
+ print_aligned(\*TASM, $seqnames{$id}, $sequence, $asml, $rc,
+ $seqleft, $seqright,
+ $offsets[$asml], $offsets[$asmr], "asm");
+ if (defined $cfn){
+ print_aligned(\*OUT, $seqnames{$id}, $sequence, $asml, $rc,
+ $seqleft, $seqright,
+ $offsets[$asml], $offsets[$asmr], "contig");
+ $usednames[++$#usednames] = $seqnames{$id};
+ }
+ }
+ next;
+
+ } # unitig
+
+ if ($rec eq "ULK"){ # unitig link
+ # don't need to worry about it now
+ next;
+ } # unitig link
+
+ if ($rec eq "CCO"){ # contig record
+ @offsets = ();
+ my $id = getCAId($$fields{acc});
+
+ if (defined $cfn && (! exists ($chosen{$id}))){
+ next;
+ }
+
+ my $len = $$fields{len};
+ my $lseq = $$fields{cns};
+ my $nseq = $$fields{npc};
+
+ my @fields = split('\n', $lseq);
+ $lseq = join('', @fields);
+
+ if (length($lseq) == 0){
+ next;
+ }
+
+ if ($first != 1 && !defined $justfasta){
+ print TASM "|\n";
+ }
+ $first = 0;
+ if (!defined $nofasta){
+ print_contig(\*FASTA, $id, $len, $nseq, $lseq, "fasta");
+ }
+ if (!defined $justfasta){
+ print_contig(\*TASM, $id, $len, $nseq, $lseq, "asm", "CA_CONTIG");
+ print_contig(\*OUT, $id, $len, $nseq, $lseq, "contig");
+ }
+# here the offsets array will contain one entry for each position
+# in the consensus ($lseq). That entry is the number of non-gap
+# characters in the consensus, up to the current coordinate.
+#
+# these numbers follow the asm_lend, asm_rend convention and start at 1.
+ $#offsets = length($lseq) - 1;
+ my $coord = 0;
+ for (my $i = 0; $i < length($lseq); $i++){
+ if (substr($lseq, $i, 1) ne "-"){
+ $coord++;
+ }
+ $offsets[$i] = $coord;
+ }
+
+# here we parse the individual sequences aligned to the contig
+ if (!defined $justfasta){
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+
+ if ($sid eq "MPS"){
+ if ($$sfs{typ} ne "R"){
+ print STDERR "wierd type $$sfs{typ}\n";
+ next;
+ }
+ } else {
+ next;
+ }
+
+ my ($id, $sequence, $asml, $asmr, $rc, $seqleft, $seqright) =
+ deal_with_mps($sfs);
+
+ print_aligned(\*OUT, $seqnames{$id}, $sequence, $asml, $rc,
+ $seqleft, $seqright,
+ $offsets[$asml], $offsets[$asmr], "contig");
+ print_aligned(\*TASM, $seqnames{$id}, $sequence, $asml, $rc,
+ $seqleft, $seqright,
+ $offsets[$asml], $offsets[$asmr], "asm");
+ $usednames[++$#usednames] = $seqnames{$id};
+
+ } # for $i = 0...
+ }
+ next;
+ } # contig
+
+ if ($rec eq "CLK") { # contig link
+ # this will generate a group.xml file so we'll ignore it for now
+ next;
+ } # contig link
+
+ if ($rec eq "FRG") { # fragment info
+ my $sequence = $$fields{seq};
+ my $qualities = $$fields{qlt};
+ my $clear = $$fields{clr};
+ my $seqname = $$fields{src};
+ my $id = getCAId($$fields{acc});
+
+ my @lines = split('\n', $sequence);
+ $sequence = join('', @lines);
+ @lines = split('\n', $qualities);
+ $qualities = join('', @lines);
+ @lines = split('\n', $seqname);
+ $seqname = $lines[0];
+ if ($seqname eq "" ||
+ $seqname =~ /^\s*$/){
+# $seqname = ++$number;
+ $seqname = "$id";
+ }
+ if (defined $nonames){
+ $accname{$id} = $id;
+ } else {
+ $accname{$id} = $seqname;
+ }
+ $clear =~ /(\d+),(\d+)/;
+
+ if (defined $filter){
+ if ($2 - $1 < $MINSEQSIZE){
+ $deleted{$id} = 1;
+ next;
+ } else {
+ print NEWFRG $record;
+ next;
+ }
+ }
+
+ if ($ischeck == 1){
+ if ($2 - $1 < $MINSEQSIZE){
+ print "$seqname ", $2 - $1, " < $MINSEQSIZE\n";
+ }
+ next;
+ }
+ my $cll = $1 + 1;
+ my $clr = $2;
+
+ my $quals = sprintf("%02d", ord(substr($qualities, 0, 1)) - ord('0'));
+ for (my $c = 1; $c < length($qualities); $c++){
+ $quals .= sprintf(" %02d", ord(substr($qualities, $c, 1)) - ord('0'));
+ }
+
+ printFastaSequence(\*SEQ, "$seqname 0 0 0 $cll $clr", uc($sequence));
+ if (!defined $noqual){
+ printFastaQual(\*QUAL, "$seqname", $quals);
+ }
+
+ next;
+ }
+
+ if ($rec eq "LKG") {
+ if (defined $getmates){
+ print MATES "$accname{$$fields{fg1}} $accname{$$fields{fg2}} $meandist{$$fields{dst}} $stdevdist{$$fields{dst}}\n";
+ }
+ if (defined $filter){
+ if (exists $deleted{$$fields{fg1}} ||
+ exists $deleted{$$fields{fg2}}){
+ next;
+ } else {
+ print NEWFRG $record;
+ next;
+ }
+ }
+ next;
+ }
+
+ if ($rec eq "DST"){
+ if (defined $getmates){
+ $meandist{$$fields{acc}} = $$fields{mea};
+ $stdevdist{$$fields{acc}} = $$fields{std};
+ }
+ if (defined $filter){
+ print NEWFRG $record;
+ }
+ next;
+ }
+
+ if (defined $filter){
+ print NEWFRG $record;
+ }
+
+
+ print STDERR "$rec ($$fields{acc}) is not currently parsed and has $#$recs sub-records\n";
+}
+
+if (defined $cfn){
+ # now we create .seq and .qual files
+ for (my $i = 0; $i <= $#usednames; $i++){
+ print_seq_for_name(\*FRG , $usednames[$i], \*SEQ, \*QUAL);
+ }
+
+ close(SEQ);
+ if (!defined $noqual){
+ close(QUAL);
+ }
+ if (defined $getmates){
+ close(MATES);
+ }
+}
+
+if (defined $filter){
+ close(NEWFRG);
+}
+
+if ($isfrag == 0){
+ if (!defined $nofasta){
+ close(FASTA);
+ }
+ close(FRG);
+ close(OUT);
+ close(TASM);
+} elsif ($ischeck == 0){
+ close (SEQ);
+ if (!defined $noqual){
+ close (QUAL);
+ }
+ if (defined $getmates){
+ close (MATES);
+ }
+}
+
+close(IN);
+
+# The end
+exit(0);
+
+
+##########################################
+
+# this is not truly a function. It tries to abstract
+# out the section on dealing with the MPS records that
+# is used in both the CCO and the UTG records
+sub deal_with_mps
+{
+ my $sfs = shift;
+
+
+ my $id = getCAId($$sfs{mid});
+ my $asms = $$sfs{pos};
+ $asms =~ /(\d+),(\d+)/;
+ if (! defined $1){
+ die ("wierd pos record: $$sfs{pos}\n");
+ }
+ my $asml = 0;
+ my $asmr = 0;
+ if ($1 > $2){
+ $asml = $1 - 1;
+ $asmr = $2;
+ } else {
+ $asml = $1;
+ $asmr = $2 - 1;
+ }
+
+ my $gapno = $$sfs{dln};
+ my $gaps = $$sfs{del};
+ my @gaps = split(' ', $gaps);
+ if ($gapno != $#gaps + 1){
+ print STDERR "wierd, $gapno != ", $#gaps + 1, "\n";
+ }
+
+ # print "seql = $seql{$id}, seqr = $seqr{$id}\n";
+
+ my $sequence = get_seq(\*FRG, $id);
+
+
+ my @lines = split('\n', $sequence);
+ $sequence = join('', @lines);
+ $sequence = uc($sequence);
+
+ $sequence = substr($sequence, $seql{$id}, $seqr{$id} - $seql{$id});
+
+# my $sequence = getStoreSeq($id);
+
+ my $seqleft = $seql{$id} + 1;
+ my $seqright = $seqr{$id};
+
+ my $rc = "";
+ # sequence is reverse complemented
+ if ($asml > $asmr){
+ $sequence = reverseComplement($sequence);
+ my $tmp = $asmr;
+ $asmr = $asml;
+ $asml = $tmp;
+
+ $tmp = $seqright;
+ $seqright = $seqleft;
+ $seqleft = $tmp;
+ $rc = "RC";
+ }
+
+ # now we add in the gaps and print the sequence
+ my $outseq = "";
+ my $gapindex = 0;
+ for (my $j = 0; $j < length($sequence); $j++){
+ my $seqj = $j;# + $seql{$id} - 1; # index in untrimmed sequence
+ if ($gapindex <= $#gaps && $seqj > $gaps[$gapindex]){
+ print STDERR "Wierd $seqnames{$id}, $seqj > $gaps[$gapindex]\n";
+ }
+ # this here is a fix for cases when the last gap index
+ # is equal to the length of the sequence. In this case
+ # the sequence gets an extra gap at the very end (which
+ # I might add, is completely stupid).
+ while ($gapindex <= $#gaps && $seqj == $gaps[$gapindex]){
+# print "GS $gapindex $#gaps $seqj $gaps[$gapindex] ",
+ length($sequence), "\n";
+ $outseq .= "-";
+ $gapindex++;
+# print "GE $gapindex\n";
+ }
+ $outseq .= substr($sequence, $j, 1);
+ }
+
+ if ($gapindex == $#gaps && length($sequence) == $gaps[$gapindex]){
+ $outseq .= "-";
+ } elsif ($gapindex < $#gaps){
+ print STDERR "Where are all the gaps $seqnames{$id}: $gapindex, $#gaps\n";
+ }
+
+ $sequence = $outseq;
+
+ return ($id, $sequence, $asml, $asmr, $rc, $seqleft, $seqright);
+} # deal_with_mps
+
+# prints contig in specified format
+sub print_contig
+{
+ my $file = shift;
+ my $id = shift;
+ my $len = shift;
+ my $nseq = shift;
+ my $sequence = shift;
+ my $how = shift;
+ my $type = shift;
+
+ if (length($sequence) == 0){
+ return;
+ }
+
+ if ($how eq "contig"){
+ print $file "\#\#$id $nseq $len bases, 00000000 checksum.\n";
+ print_sequence($file, $sequence);
+ return;
+ } # if $how eq "contig"
+ elsif ($how eq "asm"){
+ my $strip = $sequence;
+ $strip =~ s/-//g;
+# get the current date
+ my $date = `date +'%D %T'`;
+ chomp $date;
+
+ my $quality = "0x";
+ for (my $i = 0; $i < length($sequence); $i++){
+ $quality .= "06";
+ }
+
+ print $file "sequence\t$strip\n";
+ print $file "lsequence\t$sequence\n";
+ print $file "quality\t$quality\n";
+ print $file "asmbl_id\t$id\n";
+ print $file "seq_id\t\n";
+ print $file "com_name\t\n";
+ print $file "type\t\n";
+ print $file "method\tCelera Assembler\n";
+ print $file "ed_status\t\n";
+ print $file "redundancy\t\n";
+ print $file "perc_N\t\n";
+ print $file "seq\#\t$nseq\n";
+ print $file "full_cds\t\n";
+ print $file "cds_start\t\n";
+ print $file "cds_end\t\n";
+ print $file "ed_pn\t$ENV{USER}\@$ENV{HOSTNAME}\n";
+ print $file "ed_date\t$date\n";
+ print $file "comment\t$type ID: $id\n";
+ print $file "frameshift\t\n";
+ return;
+ } # if $how eq "asm"
+ elsif ($how eq "fasta")
+ {
+ print $file ">$id $nseq $len bases\n";
+ $sequence =~ s/-//g; # get rid of all gaps
+ print_sequence($file, $sequence);
+ return;
+ }
+} # print_contig
+
+sub print_aligned
+{
+ my($file, $name, $seq, $offset, $rc,
+ $seqleft, $seqright, $asml, $asmr, $type) = @_;
+
+ if ($type eq "contig"){
+ print $file "\#$name($offset) [$rc] ",
+ length($seq),
+ " bases, 00000000 checksum. {$seqleft $seqright} <$asml $asmr>\n";
+
+ print_sequence($file, $seq);
+ }
+
+ if ($type eq "asm"){
+ print $file "\n";
+ print $file "seq_name\t$name\n";
+ print $file "asm_lend\t$asml\n";
+ print $file "asm_rend\t$asmr\n";
+ print $file "seq_lend\t$seqleft\n";
+ print $file "seq_rend\t$seqright\n";
+ print $file "best\t\n";
+ print $file "comment\t\n";
+ print $file "db\t\n";
+ print $file "offset\t$offset\n";
+ print $file "lsequence\t$seq\n";
+ }
+
+ return;
+}
+
+# prints sequence in specified format
+sub print_sequence
+{
+ my $file = shift;
+ my $seqs = shift;
+
+ for (my $j = 0; $j < length($seqs); $j += 60){
+ print $file substr($seqs, $j, 60), "\n";
+ }
+} # print_sequence
+
+# gets a sequence from the specified file depending on the seqpos array
+sub get_seq
+{
+ my $file = shift;
+ my $id = shift;
+
+ seek $file, $seqpos{$id}, 0; # seek set
+ my $record = getRecord($file);
+ if (! defined $record){
+ print "wierd error\n";
+ return;
+ }
+
+ my ($rec, $fields, $recs) = parseRecord($record);
+
+ if ($rec ne "FRG"){
+ print STDERR "wierd error in get_seq, expecting frg\n";
+ return;
+ }
+ if ($$fields{acc} != $id){
+ print STDERR "wierd error in get_seq, expecting $id, got $$fields{acc}\n";
+ return;
+ }
+ return $$fields{seq};
+}
+
+# gets the seq and qual records for the seqname given as parameter and
+# prints them in the .seq and .qual files.
+sub print_seq_for_name {
+ my $file = shift;
+ my $nm = shift;
+ my $seqfile = shift;
+ my $qualfile = shift;
+
+ seek $file, $namepos{$nm}, 0;
+ my $record = getRecord($file);
+ if (!defined $record){
+ print STDERR "record for name \"$nm\" not found in file\n";
+ return;
+ }
+ my ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec ne "FRG"){
+ print STDERR "expecting FRG record for name \"$nm\"\n";
+ return;
+ }
+
+ my $sequence = $$fields{seq};
+ my $qualities = $$fields{qlt};
+ my $clear = $$fields{clr};
+ my $seqname = $$fields{src};
+
+ my @lines = split('\n', $sequence);
+ $sequence = join('', @lines);
+ @lines = split('\n', $qualities);
+ $qualities = join('', @lines);
+ @lines = split('\n', $seqname);
+ $seqname = $lines[0];
+ $clear =~ /(\d+),(\d+)/;
+
+ my $cll = $1 + 1;
+ my $clr = $2;
+
+ my $quals = sprintf("%02d", ord(substr($qualities, 0, 1)) - ord('0'));
+ for (my $c = 1; $c < length($qualities); $c++){
+ $quals .= sprintf(" %02d", ord(substr($qualities, $c, 1)) - ord('0'));
+ }
+
+ printFastaSequence($seqfile, "$seqname 0 0 0 $cll $clr", uc($sequence));
+ if (!defined $noqual){
+ printFastaQual($qualfile, "$seqname", $quals);
+ }
+} # sub print_seq_for_name
+
+# gets a sequence from the stores
+sub getStoreSeq {
+ my $uid = shift;
+
+ my $iid = $uid2iid{$uid};
+
+ my $infoPrg = "$frgInfo $frgStore $gkpStore $iid";
+
+ print STDERR "getting info for id $uid, $iid\n";
+
+ open(INFO, "$infoPrg 2>>info.log |") || $base->bail("Cannot open \"$infoPrg\"");
+ my $seq = "";
+ while (<INFO>){
+ if (/^>/){
+ next;
+ }
+ $seq .= $_;
+ }
+ close(INFO);
+
+ my @lines = split('\n', $seq);
+ $seq = join('', @lines);
+ $seq = uc($seq);
+ return $seq;
+}
diff --git a/src/Converters/castats.pl b/src/Converters/castats.pl
new file mode 100755
index 0000000..639fe3d
--- /dev/null
+++ b/src/Converters/castats.pl
@@ -0,0 +1,740 @@
+#!/usr/bin/perl
+
+# This program reads a Celera .asm file and produces aggregate information
+# about the assembly
+
+use strict;
+use Statistics::Descriptive;
+use AMOS::AmosFoundation;
+use AMOS::AmosLib;
+
+my $MY_VERSION = '$Revision $';
+
+# Constants
+my $MINQUAL = 20;
+my $MINCONTIG = 10000;
+
+my $MY_HELPTEXT = qq~
+.USAGE.
+ castats <prefix>.asm [options]
+
+.DESCRIPTION.
+ Generate quality statistics from the specified Celera assembly .asm file.
+
+.OPTIONS.
+ prefix.asm The Celera .asm file
+ -minqual <n> Minimum quality value threshhold to report as bad
+ quality (default $MINQUAL)
+ -mincontig <n> Minimum contig size to report as a big contig
+ (default $MINCONTIG)
+ -g <n> Genome size used in the calculation of N50 numbers
+ (default: TotalBasesInContigs)
+
+.KEYWORDS.
+ converter, Celera, statistics
+~;
+
+my $base = new AMOS::AmosFoundation;
+
+if (! defined $base){
+ print STDERR "Nasty error, hide!\n";
+ exit(1);
+}
+
+$base->setHelpText($MY_HELPTEXT);
+$base->setUsage("castats <prefix>.asm [options]");
+$base->setVersion($MY_VERSION);
+
+my $infile;
+my $genomesize;
+
+my $err = $base->getOptions("i=s" => \$infile,
+ "minqual=i" => \$MINQUAL,
+ "mincontig=i" => \$MINCONTIG,
+ "g=i" => \$genomesize
+ );
+
+if ($err == 0){
+ $base->bail("Command line parsing failed. See -h option");
+}
+
+if (! defined $infile){
+ if ($#ARGV < 0){
+ $base->bail("Must specify an input file name. See -h option");
+ } else {
+ $infile = $ARGV[0];
+ }
+}
+
+open(IN, $infile) or $base->bail("Cannot open $infile: ($!)");
+
+my $record;
+
+my %lens; # contig lengths wihtout gaps
+my %sizes; # contig sizes with gaps
+my %bads; # contig bad qualities
+my %seqs; # contig number of reads
+my %scaflen; # sum of contig sizes in scaffold
+my %scafcontig; # # contigs in scaffold
+my %inscaff; # contigs in scaffolds
+my %adjscaflen; # length of scaffold including inner-scaffold gaps
+my %readlens; # sum of lengths of reads in contig
+my %libs_initial; # the libraries for a project before assembly
+my %libs_final; # the libraries for a project after assembly
+
+my $totalReadLength = 0; # Aggregate length of CLR of input reads used in assembly
+my $totalSeqs = 0; # Total number of reads used in assembly
+
+my $ncontigs = 0;
+my $nunitigs = 0;
+my $utgSeqs = 0;
+my $surrReadLen = 0; # reads in surrogates
+my $contigReadLen = 0; # reads in contigs
+my $degenReadLen = 0; # reads in degenerates
+my %utglens = ();
+my $utgs = Statistics::Descriptive::Sparse->new();
+my %Results = ();
+my %readLen;
+my $scaffLinkWeights = 0; # sum of links connecting scaffolds
+
+while ($record = getRecord(\*IN)){
+ my ($type, $fields, $recs) = parseRecord($record);
+
+ if ($type eq "CCO"){
+ $ncontigs++;
+ my $contiglen = $$fields{"len"};
+ my $nreads = $$fields{"npc"};
+ my $qual = $$fields{"qlt"};
+ my $id = getCAId($$fields{"acc"});
+
+ my @quals = split('\n', $qual);
+ $qual = join("", @quals);
+
+ my $badquals = 0;
+ for (my $i = 0; $i < length($qual); $i++){
+ my $thisqual = substr($qual, $i, 1);
+
+ my $qualval = ord($thisqual) - ord('0');
+
+ if ($qualval < $MINQUAL){
+ $badquals++;
+ }
+ } # for $i < length($qual)
+ $sizes{$id} = $contiglen;
+ $lens{$id} = $contiglen;
+ my $ngaps = 0;
+ while ($$fields{"cns"} =~ /-/g){
+ $ngaps++;
+ }
+ $lens{$id} -= $ngaps;
+ $bads{$id} = $badquals;
+ $seqs{$id} = $nreads;
+ for (my $rd = 0 ;$rd <= $#$recs; $rd++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$rd]);
+ if ($sid eq "MPS"){
+ my ($l, $r) = $$sfs{pos};
+ $readlens{$id} += $readLen{$$sfs{"mid"}};#abs($r - $l);
+ }
+ }
+
+ } # if $type = CCO
+
+ if ($type eq "UTG"){
+ if ($$fields{"sta"} ne "U" &&
+ $$fields{"sta"} ne "N"){
+ $nunitigs++;
+ $utgs->add_data($$fields{"len"});
+ $utgSeqs += $$fields{"nfr"};
+ $utglens{getCAId($$fields{"acc"})} = $$fields{"len"};
+ for (my $rd = 0 ;$rd <= $#$recs; $rd++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$rd]);
+ if ($sid eq "MPS"){
+ my ($l, $r) = $$sfs{pos};
+ $surrReadLen += $readLen{$$sfs{"mid"}};#abs($r - $l);
+ }
+ }
+ }
+ }
+
+ if ($type eq "SCF"){
+ my $id = getCAId($$fields{"acc"});
+ my %scaffcontigs = ();
+ my $adj = 0;
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($lrec, $lfield, $lrecs) = parseRecord($$recs[$i]);
+
+ $scaffcontigs{$$lfield{"ct1"}}++;
+ $scaffcontigs{$$lfield{"ct2"}}++;
+ $inscaff{$$lfield{"ct1"}} = 1;
+ $inscaff{$$lfield{"ct2"}} = 1;
+ $adj += $$lfield{"mea"};
+ }
+
+ $scafcontig{$id} = 0;
+ $scaflen{$id} = 0;
+ while (my ($ct, $freq) = each %scaffcontigs){
+ $scafcontig{$id}++;
+ $scaflen{$id} += $lens{$ct};
+ }
+
+ $adjscaflen{$id} = $scaflen{$id} + int($adj);
+ } # if $type = SCF
+
+ if ($type eq "SLK") { # scaffold link
+ $Results{TotalScaffoldLinks}++;
+ $scaffLinkWeights += $$fields{num};
+ }
+
+ if ($type eq "AFG")
+ {
+ my $id = getCAId($$fields{"acc"});
+ my $clrs = getCAId($$fields{"clr"});
+ my ($clrl,$clrr) = split /,/,$clrs;
+ my $length = $clrr - $clrl;
+ $totalReadLength += $length;
+ $readLen{$id} = $length;
+ $totalSeqs++;
+ if ($$fields{"mst"} eq "N"){
+ $Results{ReadsWithNoMate}++;
+ } elsif ($$fields{"mst"} eq "B"){
+ $Results{ReadsWithBadMate}++;
+ } elsif ($$fields{"mst"} eq "G"){
+ $Results{ReadsWithGoodMate}++;
+ } elsif ($$fields{"mst"} eq "U"){
+ $Results{ReadsWithUnusedMate}++;
+ }
+ }
+} # while $record
+
+
+# Initialize the Results hash so that we never get blanks for values
+
+$Results{TotalScaffolds} = 0;
+$Results{TotalContigsInScaffolds} = 0;
+$Results{MeanContigsPerScaffold} = 0.0;
+#$Results{MinContigsPerScaffold} = 0;
+$Results{MaxContigsPerScaffold} = 0;
+$Results{TotalBasesInScaffolds} = 0;
+$Results{MeanBasesInScaffolds} = 0.0;
+#$Results{MinBasesInScaffolds} = 0;
+$Results{MaxBasesInScaffolds} = 0;
+$Results{N50ScaffoldBases} = 0;
+$Results{TotalSpanOfScaffolds} = 0;
+$Results{MeanSpanOfScaffolds} = 0.0;
+#$Results{MinScaffoldSpan} = 0;
+$Results{MaxScaffoldSpan} = 0;
+$Results{N50ScaffoldSpan} = 0;
+$Results{IntraScaffoldGaps} = 0;
+$Results{MeanSequenceGapSize} = 0.0;
+$Results{TotalContigsInScaffolds} = 0;
+$Results{TotalBasesInScaffolds} = 0;
+$Results{MeanContigSize} = 0.0;
+#$Results{MinContigSize} = 0;
+$Results{MaxContigSize} = 0;
+$Results{N50ContigBases} = 0;
+$Results{TotalBigContigs} = 0;
+$Results{BigContigLength} = 0;
+$Results{MeanBigContigSize} = 0.0;
+#$Results{MinBigContig} = 0;
+$Results{MaxBigContig} = 0;
+$Results{BigContigsPercentBases} = 0.0;
+$Results{TotalSmallContigs} = 0;
+$Results{SmallContigLength} = 0;
+$Results{MeanSmallContigSize} = 0.0;
+#$Results{MinSmallContig} = 0;
+$Results{MaxSmallContig} = 0;
+$Results{SmallContigsPercentBases} = 0.0;
+$Results{TotalDegenContigs} = 0;
+$Results{DegenContigLength} = 0;
+$Results{MeanDegenContigSize} = 0.0;
+#$Results{MinDegenContig} = 0;
+$Results{MaxDegenContig} = 0;
+$Results{DegenPercentBases} = 0.0;
+$Results{TotalReads} = 0;
+$Results{ReadsInContigs} = 0;
+$Results{BigContigReads} = 0;
+$Results{SmallContigReads} = 0;
+$Results{DegenContigReads} = 0;
+$Results{ReadsInSurrogates} = 0;
+$Results{SingletonReads} = 0;
+$Results{AllReads} = 0.0;
+$Results{ContigsOnly} = 0.0;
+$Results{ContigsAndDegens} = 0.0;
+$Results{NumSurrogates} = $utgs->count();
+$Results{SurrogateSize} = $utgs->sum();
+$Results{MeanSurrogateSize} = $utgs->mean();
+$Results{MinSurrogateSize} = $utgs->min();
+$Results{MaxSurrogateSize} = $utgs->max();
+$Results{SDSurrogateSize} = $utgs->standard_deviation();
+$Results{RangeSurrogateSize} = $utgs->sample_range();
+if (! exists $Results{ReadsWithNoMate}){
+ $Results{ReadsWithNoMate} = 0;
+}
+if (! exists $Results{ReadsWithBadMate}){
+ $Results{ReadsWithBadMate} = 0;
+}
+if (! exists $Results{ReadsWithGoodMate}){
+ $Results{ReadsWithGoodMate} = 0;
+}
+if (! exists $Results{ReadsWithUnusedMate}){
+ $Results{ReadsWithUnusedMate} = 0;
+}
+if (! exists $Results{TotalScaffoldLinks}){
+ $Results{TotalScaffoldLinks} = 0;
+ $Results{MeanScaffoldLinkWeight} = 0;
+} else {
+ $Results{MeanScaffoldLinkWeight} =
+ $scaffLinkWeights / $Results{TotalScaffoldLinks};
+}
+
+my $totlen = 0;
+my $totbads = 0;
+my $totseqs = 0;
+
+my $biglen = 0;
+my $bigbads = 0;
+my $bigseqs = 0;
+my $nbigs = 0;
+
+my $maxcontig = 0;
+
+for (my $i = 0; $i < $ncontigs; $i++){
+ my ($id, $len) = each(%lens);
+
+ my $number;
+ my $min;
+ my $max;
+ my $totlen;
+ my $nseq;
+
+ if (exists $inscaff{$id}){ # the good guys
+ if ($len >= $MINCONTIG) { # the good big guys
+ $number = "TotalBigContigs";
+ $min = "MinBigContig";
+ $max = "MaxBigContig";
+ $totlen = "BigContigLength";
+ $nseq = "BigContigReads";
+ } else { # the small good guys
+ $number = "TotalSmallContigs";
+ $min = "MinSmallContig";
+ $max = "MaxSmallContig";
+ $totlen = "SmallContigLength";
+ $nseq = "SmallContigReads";
+ }
+ $contigReadLen += $readlens{$id};
+ } else { # the chaff
+ $number = "TotalDegenContigs";
+ $min = "MinDegenContig";
+ $max = "MaxDegenContig";
+ $totlen = "DegenContigLength";
+ $nseq = "DegenContigReads";
+ $degenReadLen += $readlens{$id};
+ }
+
+ $Results{$max} = max($len, $Results{$max});
+ $Results{$min} = (exists $Results{$min}) ? min($len, $Results{$min}) : $len;
+ $Results{$number}++;
+ $Results{$totlen} += $len;
+ $Results{$nseq} += $seqs{$id};
+} # for $i < $ncontigs
+
+$Results{'TotalContigs'} = 0 +
+ $Results{'TotalBigContigs'} + $Results{'TotalSmallContigs'};
+$Results{'TotalBasesInContigs'} = 0 +
+ $Results{'BigContigLength'} + $Results{'SmallContigLength'};
+$Results{'MeanContigSize'} = ($Results{'TotalContigs'} > 0)?
+ $Results{'TotalBasesInContigs'} * 1.0
+ / $Results{'TotalContigs'} :
+ 0;
+
+$Results{'ReadsInContigs'} = 0 +
+ $Results{'BigContigReads'} + $Results{'SmallContigReads'};
+$Results{'MinContigSize'} = ($Results{MinSmallContig} > 0) ? $Results{'MinSmallContig'} : $Results{'MinBigContig'};
+$Results{'MaxContigSize'} = max($Results{'MaxBigContig'}, $Results{'MaxSmallContig'});
+
+$Results{'MeanBigContigSize'} = ($Results{'TotalBigContigs'} > 0)?
+ $Results{'BigContigLength'} * 1.0
+ / $Results{'TotalBigContigs'} :
+ 0;
+
+$Results{'MeanSmallContigSize'} = ($Results{'TotalSmallContigs'})?
+ $Results{'SmallContigLength'} * 1.0
+ / $Results{'TotalSmallContigs'} :
+ 0;
+
+$Results{'BigContigsPercentBases'} = ($Results{'TotalBasesInContigs'} > 0)?
+ $Results{'BigContigLength'} * 100.0
+ / $Results{'TotalBasesInContigs'} :
+ 0;
+
+$Results{'SmallContigsPercentBases'} = ($Results{'TotalBasesInContigs'} > 0)?
+ $Results{'SmallContigLength'} * 100.0
+ / $Results{'TotalBasesInContigs'} :
+ 0;
+
+$Results{'MeanDegenContigSize'} = ($Results{'TotalDegenContigs'})?
+ $Results{'DegenContigLength'} * 1.0
+ / $Results{'TotalDegenContigs'} :
+ 0;
+
+$Results{'DegenPercentBases'} = ($Results{'TotalBasesInContigs'} > 0)?
+ $Results{'DegenContigLength'} * 100.0
+ / $Results{'TotalBasesInContigs'} :
+ 0;
+
+# compute N50 values and top 5 guys
+my @sortContig = sort {$lens{$b} <=> $lens{$a}} (keys %inscaff);
+my $top5contig;
+my $sum = 0;
+my $reads_tot = 0;
+my $bases_tot = 0;
+for (my $cc = 0; $cc <= $#sortContig; $cc++){
+ if ($cc < 5){
+ $top5contig .=
+ "$cc $seqs{$sortContig[$cc]} $lens{$sortContig[$cc]}\n";
+ $reads_tot += $seqs{$sortContig[$cc]};
+ $bases_tot += $lens{$sortContig[$cc]};
+ }
+}
+
+for (my $cc = 0; $cc <= $#sortContig; $cc++){
+ $sum += $lens{$sortContig[$cc]};
+ my $gsz;
+ if (! defined $genomesize){
+ $gsz = $Results{'TotalBasesInContigs'};
+ $Results{"EstimatedGenomeSize"} = $gsz;
+ } else {
+ $gsz = $genomesize;
+ $Results{"FromCommandLine"} = 1;
+ }
+ $Results{"EstimatedGenomeSize"} = $gsz;
+ if ($sum > $gsz / 2){
+ $Results{'N50ContigBases'} = $lens{$sortContig[$cc]};
+ last;
+ }
+}
+
+# do scaffold stats
+while (my ($id, $ctgs) = each %scafcontig)
+{
+ $Results{'TotalScaffolds'}++;
+ $Results{'TotalContigsInScaffolds'} += $scafcontig{$id};
+ $Results{'IntraScaffoldGaps'} += $scafcontig{$id} - 1;
+
+ $Results{'MinContigsPerScaffold'} =
+ (exists $Results{MinContigsPerScaffold}) ? min($Results{'MinContigsPerScaffold'}, $scafcontig{$id}): $scafcontig{$id};
+ $Results{'MaxContigsPerScaffold'} =
+ max($Results{'MaxContigsPerScaffold'}, $scafcontig{$id});
+ $Results{'TotalSpanOfScaffolds'} += $adjscaflen{$id};
+
+ $Results{'MinScaffoldSpan'} = (exists $Results{MinScaffoldSpan})?
+ min($Results{'MinScaffoldSpan'}, $adjscaflen{$id}): $adjscaflen{$id};
+ $Results{'MaxScaffoldSpan'} =
+ max($Results{'MaxScaffoldSpan'}, $adjscaflen{$id});
+
+ $Results{'TotalBasesInScaffolds'} += $scaflen{$id};
+
+ $Results{'MinBasesInScaffolds'} =
+ (exists $Results{MinBasesInScaffolds}) ? min($Results{'MinBasesInScaffolds'}, $scaflen{$id}) : $scaflen{$id};
+ $Results{'MaxBasesInScaffolds'} =
+ max($Results{'MaxBasesInScaffolds'}, $scaflen{$id});
+} # while each %scafcontigs
+
+$Results{'MeanContigsPerScaffold'} =
+ ($Results{'TotalScaffolds'} > 0)
+ ? $Results{'TotalContigsInScaffolds'} * 1.0
+ / $Results{'TotalScaffolds'}
+: 0.0;
+$Results{'MeanBasesInScaffolds'} =
+ ($Results{'TotalScaffolds'} > 0)
+ ? $Results{'TotalBasesInScaffolds'} * 1.0
+ / $Results{'TotalScaffolds'}
+: 0.0;
+$Results{'MeanSpanOfScaffolds'} =
+ ($Results{'TotalScaffolds'} > 0)
+ ? $Results{'TotalSpanOfScaffolds'} * 1.0
+ / $Results{'TotalScaffolds'}
+: 0.0;
+$Results{'MeanSequenceGapSize'} =
+ ($Results{'IntraScaffoldGaps'} > 0)
+ ? ($Results{'TotalSpanOfScaffolds'}
+ - $Results{'TotalBasesInScaffolds'}) * 1.0
+ / $Results{'IntraScaffoldGaps'}
+: 0.0;
+
+# compute N50 values and top 5 guys
+my @sortScaff = sort {$scaflen{$b} <=> $scaflen{$a}} (keys %scaflen);
+my $top5scaff;
+$sum = 0;
+
+my $contigs_tot = 0;
+my $size_tot = 0;
+my $span_tot = 0;
+my $avgContig_tot = 0;
+my $avgGap_tot = 0;
+
+for (my $ss = 0; $ss <= $#sortScaff; $ss++){
+ my $scf = $sortScaff[$ss];
+ if ($ss < 5){
+ $top5scaff .=
+ "$ss $scafcontig{$scf} $scaflen{$scf} $adjscaflen{$scf} " .
+ sprintf("%.2f", $scaflen{$scf} * 1.0 / $scafcontig{$scf}) . " " .
+ sprintf("%.2f", ($scafcontig{$scf} - 1 > 0)?
+ (($adjscaflen{$scf} - $scaflen{$scf}) * 1.0 / ($scafcontig{$scf} - 1)) :
+ 0.0
+ ) .
+ "\n"
+ ;
+
+ $contigs_tot += $scafcontig{$scf};
+ $size_tot += $scaflen{$scf};
+ $span_tot += $adjscaflen{$scf};
+ $avgContig_tot += sprintf("%.2f", $scaflen{$scf} * 1.0 / $scafcontig{$scf});
+ $avgGap_tot += sprintf("%.2f", ($scafcontig{$scf} - 1 > 0)?
+ (($adjscaflen{$scf} - $scaflen{$scf}) * 1.0 / ($scafcontig{$scf} - 1)) :
+ 0.0);
+ }
+}
+my $gsz;
+for (my $ss = 0; $ss <= $#sortScaff; $ss++){
+ $sum += $scaflen{$sortScaff[$ss]};
+ if (! defined $genomesize){
+ $gsz = $Results{'TotalBasesInScaffolds'};
+ } else {
+ $gsz = $genomesize;
+ }
+ if ($sum > $gsz / 2){
+ $Results{'N50ScaffoldBases'} = $scaflen{$sortScaff[$ss]};
+ last;
+ }
+}
+
+
+$Results{'AllReads'} =
+ ($gsz > 0)
+ ? sprintf("%0.2f", $totalReadLength / $gsz)
+ : 0.0;
+
+$Results{'ContigsOnly'} = ($Results{'TotalBasesInScaffolds'} > 0) ?
+ (($surrReadLen + $contigReadLen) / $Results{'TotalBasesInScaffolds'}) :
+ 0.0;
+
+
+$Results{'ContigsAndDegens'} = ($Results{'TotalBasesInScaffolds'} +
+ $Results{'DegenContigLen'} > 0)
+ ? (($surrReadLen + $contigReadLen + $degenReadLen) /
+ ($Results{'TotalBasesInScaffolds'} + $Results{'DegenContigLen'}))
+ : 0.0;
+
+
+# Surrogates
+$Results{'ReadsInSurrogates'} = $utgSeqs;
+
+# Coverage
+$Results{'TotalReads'} = $totalSeqs;
+$Results{'SingletonReads'} = $Results{'TotalReads'}
+- $Results{'BigContigReads'}
+- $Results{'SmallContigReads'}
+- $Results{'DegenContigReads'}
+- $Results{'ReadsInSurrogates'};
+
+# Parameter settings
+$Results{'MinBigContigSizeParm'} = $MINCONTIG;
+$Results{'MinQualityParm'} = $MINQUAL;
+
+my $tag = -25;
+my $val = 10;
+my $fval = 13;
+
+if (exists $Results{FromCommandLine}){
+ print "Genome size specified on command line\n";
+}
+print sprintf("%${tag}s %${val}d\n", "EstimatedGenomeSize", $Results{EstimatedGenomeSize});
+print "\n";
+
+print "Scaffolds\n";
+print "---------\n";
+
+print sprintf("%${tag}s %${val}d\n", "TotalScaffolds",
+ $Results{TotalScaffolds});
+print sprintf("%${tag}s %${val}d\n", "TotalContigsInScaffolds",
+ $Results{TotalContigsInScaffolds});
+print sprintf("%${tag}s %${fval}.2f\n", "MeanContigsPerScaffold",
+ $Results{MeanContigsPerScaffold});
+print sprintf("%${tag}s %${val}d\n", "MinContigsPerScaffold",
+ $Results{MinContigsPerScaffold});
+print sprintf("%${tag}s %${val}d\n", "MaxContigsPerScaffold",
+ $Results{MaxContigsPerScaffold});
+print "\n";
+print sprintf("%${tag}s %${val}d\n", "TotalBasesInScaffolds",
+ $Results{TotalBasesInScaffolds});
+print sprintf("%${tag}s %${val}d\n", "MeanBasesInScaffolds",
+ $Results{MeanBasesInScaffolds});
+print sprintf("%${tag}s %${val}d\n", "MinBasesInScaffolds",
+ $Results{MinBasesInScaffolds});
+print sprintf("%${tag}s %${val}d\n", "MaxBasesInScaffolds",
+ $Results{MaxBasesInScaffolds});
+print sprintf("%${tag}s %${val}d\n", "N50ScaffoldBases",
+ $Results{N50ScaffoldBases});
+print "\n";
+print sprintf("%${tag}s %${val}d\n", "TotalSpanOfScaffolds",
+ $Results{TotalSpanOfScaffolds});
+print sprintf("%${tag}s %${val}d\n", "MeanSpanOfScaffolds",
+ $Results{MeanSpanOfScaffolds});
+print sprintf("%${tag}s %${val}d\n", "MinScaffoldSpan",
+ $Results{MinScaffoldSpan});
+print sprintf("%${tag}s %${val}d\n", "MaxScaffoldSpan",
+ $Results{MaxScaffoldSpan});
+print sprintf("%${tag}s %${val}d\n", "IntraScaffoldGaps",
+ $Results{IntraScaffoldGaps});
+print sprintf("%${tag}s %${val}d\n", "MeanSequenceGapSize",
+ $Results{MeanSequenceGapSize});
+print "\n";
+
+print "Top 5 Scaffolds: \#contigs size span avgContig avgGap\n";
+print "-----------------------------------------------------\n";
+print $top5scaff;
+print "\n";
+
+print "Contigs\n";
+print "-------\n";
+print sprintf("%${tag}s %${val}d\n", "TotalContigsInScaffolds",
+ $Results{TotalContigsInScaffolds});
+print sprintf("%${tag}s %${val}d\n", "TotalBasesInScaffolds",
+ $Results{TotalBasesInScaffolds});
+print sprintf("%${tag}s %${fval}.2f\n", "MeanContigSize",
+ $Results{MeanContigSize});
+print sprintf("%${tag}s %${val}d\n", "MinContigSize",
+ $Results{MinContigSize});
+print sprintf("%${tag}s %${val}d\n", "MaxContigSize",
+ $Results{MaxContigSize});
+print sprintf("%${tag}s %${val}d\n", "N50ContigBases",
+ $Results{N50ContigBases});
+print "\n";
+
+print "Big Contigs (>$MINCONTIG)\n";
+print "-----------------\n";
+print sprintf("%${tag}s %${val}d\n", "TotalBigContigs",
+ $Results{TotalBigContigs});
+print sprintf("%${tag}s %${val}d\n", "BigContigLength",
+ $Results{BigContigLength});
+print sprintf("%${tag}s %${fval}.2f\n", "MeanBigContigSize",
+ $Results{MeanBigContigSize});
+print sprintf("%${tag}s %${val}d\n", "MinBigContig",
+ $Results{MinBigContig});
+print sprintf("%${tag}s %${val}d\n", "MaxBigContig",
+ $Results{MaxBigContig});
+print sprintf("%${tag}s %${fval}.2f%%\n", "BigContigsPercentBases",
+ $Results{BigContigsPercentBases});
+print "\n";
+
+print "Small Contigs (<$MINCONTIG)\n";
+print "-----------------\n";
+print sprintf("%${tag}s %${val}d\n", "TotalSmallContigs",
+ $Results{TotalSmallContigs});
+print sprintf("%${tag}s %${val}d\n", "SmallContigLength",
+ $Results{SmallContigLength});
+print sprintf("%${tag}s %${fval}.2f\n", "MeanSmallContigSize",
+ $Results{MeanSmallContigSize});
+print sprintf("%${tag}s %${val}d\n", "MinSmallContig",
+ $Results{MinSmallContig});
+print sprintf("%${tag}s %${val}d\n", "MaxSmallContig",
+ $Results{MaxSmallContig});
+print sprintf("%${tag}s %${fval}.2f%%\n", "SmallContigsPercentBases",
+ $Results{SmallContigsPercentBases});
+print "\n";
+
+print "Degenerate Contigs\n";
+print "------------------\n";
+print sprintf("%${tag}s %${val}d\n", "TotalDegenContigs",
+ $Results{TotalDegenContigs});
+print sprintf("%${tag}s %${val}d\n", "DegenContigLength",
+ $Results{DegenContigLength});
+print sprintf("%${tag}s %${fval}.2f\n", "MeanDegenContigSize",
+ $Results{MeanDegenContigSize});
+print sprintf("%${tag}s %${val}d\n", "MinDegenContig",
+ $Results{MinDegenContig});
+print sprintf("%${tag}s %${val}d\n", "MaxDegenContig",
+ $Results{MaxDegenContig});
+print sprintf("%${tag}s %${fval}.2f%%\n", "DegenPercentBases",
+ $Results{DegenPercentBases});
+print "\n";
+
+print "Top 5 Contigs: reads bases\n";
+print "--------------------------\n";
+print $top5contig;
+print "\n";
+
+print "Surrogates\n";
+print "----------\n";
+print sprintf("%${tag}s %${val}d\n", "NumSurrogates",
+ $Results{NumSurrogates});
+print sprintf("%${tag}s %${val}d\n", "SurrogateSize",
+ $Results{SurrogateSize});
+print sprintf("%${tag}s %${val}d\n", "MinSurrogateSize",
+ $Results{MinSurrogateSize});
+print sprintf("%${tag}s %${val}d\n", "MaxSurrogateSize",
+ $Results{MaxSurrogateSize});
+print sprintf("%${tag}s %${fval}.2f\n", "MeanSurrogateSize",
+ $Results{MeanSurrogateSize});
+print sprintf("%${tag}s %${fval}.2f\n", "SDSurrogateSize",
+ $Results{SDSurrogateSize});
+print "\n";
+
+print "Mates\n";
+print "-----\n";
+print sprintf("%${tag}s %${val}d\n", "ReadsWithNoMate",
+ $Results{ReadsWithNoMate});
+print sprintf("%${tag}s %${val}d\n", "ReadsWithBadMate",
+ $Results{ReadsWithBadMate});
+print sprintf("%${tag}s %${val}d\n", "ReadsWithGoodMate",
+ $Results{ReadsWithGoodMate});
+print sprintf("%${tag}s %${val}d\n", "ReadsWithUnusedMate",
+ $Results{ReadsWithUnusedMate});
+print sprintf("%${tag}s %${val}d\n", "TotalScaffoldLinks",
+ $Results{TotalScaffoldLinks});
+print sprintf("%${tag}s %${fval}.2f\n", "MeanScaffoldLinkWeight",
+ $Results{MeanScaffoldLinkWeight});
+print "\n";
+
+print "Reads\n";
+print "-----\n";
+print sprintf("%${tag}s %${val}d\n", "TotalReads", $Results{TotalReads});
+print sprintf("%${tag}s %${val}d\n", "ReadsInContigs",
+ $Results{ReadsInContigs});
+print sprintf("%${tag}s %${val}d\n", "BigContigReads",
+ $Results{BigContigReads});
+print sprintf("%${tag}s %${val}d\n", "SmallContigReads",
+ $Results{SmallContigReads});
+print sprintf("%${tag}s %${val}d\n", "DegenContigReads",
+ $Results{DegenContigReads});
+print sprintf("%${tag}s %${val}d\n", "ReadsInSurrogates",
+ $Results{ReadsInSurrogates});
+print sprintf("%${tag}s %${val}d\n", "SingletonReads",
+ $Results{SingletonReads});
+print "\n";
+
+print "Coverage\n";
+print "--------\n";
+print sprintf("%${tag}s %${fval}.2f\n", "ContigsOnly", $Results{ContigsOnly});
+print sprintf("%${tag}s %${fval}.2f\n", "ContigsAndDegens",
+ $Results{ContigsAndDegens});
+print sprintf("%${tag}s %${fval}.2f\n", "AllReads", $Results{AllReads});
+print "\n";
+
+
+exit(0);
+
+####################
+sub max($$)
+{
+ my ($a,$b) = @_;
+ return ($a > $b)? $a : $b;
+}
+
+sub min($$)
+{
+ my ($a,$b) = @_;
+ return ($a < $b)? $a : $b;
+}
+
diff --git a/src/Converters/cgb2ctg.pl b/src/Converters/cgb2ctg.pl
new file mode 100755
index 0000000..119e13f
--- /dev/null
+++ b/src/Converters/cgb2ctg.pl
@@ -0,0 +1,124 @@
+#!/usr/local/bin/perl
+
+use AMOS::AmosLib;
+use TIGR::Foundation;
+
+use strict;
+
+my $VERSION = '$Revision$ ';
+my $HELP = q~
+ cgb2ctg [-i infile] [-o outfile] -f frgfile
+
+ if -i and -o are not provided reads from STDIN and writes to STDOUT
+ if -i is provided but -o is not, outfile is same as infile except for the
+ extension
+ otherwise -i and -o are those specified in the command line
+ if -i is provided the filename must end in .cgb
+~;
+
+my $base = new TIGR::Foundation();
+if (! defined $base) {
+ die("A horrible death\n");
+}
+
+
+$base->setVersionInfo($VERSION);
+$base->setHelpInfo($HELP);
+
+my $infile;
+my $outfile;
+my $frgfile;
+my %clears;
+my $uidmap;
+
+my $err = $base->TIGR_GetOptions("i=s" => \$infile,
+ "o=s" => \$outfile,
+ "f=s" => \$frgfile,
+ "map=s" => \$uidmap);
+
+
+
+# if infile is provided, make sure it ends in .afg and open it
+if (defined $infile){
+ if ($infile !~ /\.cgb$/){
+ $base->bail ("Input file name must end in .afg");
+ }
+ open(STDIN, $infile) || $base->bail("Cannot open $infile: $!\n");
+}
+
+# if infile is provided but outfile isn't make outfile by changing the extension
+if (! defined $outfile && defined $infile){
+ $outfile = $infile;
+ $outfile =~ s/(.*)\.cgb$/\1.ctg/;
+}
+
+# if outfile is provided (or computed above) simply open it
+if (defined $outfile){
+ open(STDOUT, ">$outfile") || $base->bail("Cannot open $outfile: $!\n");
+}
+
+if (defined $uidmap){
+ open(UID, ">$uidmap") || $base->bail("Cannot open $uidmap: $!\n");
+}
+
+if (defined $frgfile){
+ open(FRG, $frgfile) || $base->bail("CAnnot open $frgfile: $!\n");
+ while (my $record = getRecord(\*FRG)){
+ my ($type, $fields, $recs) = parseRecord($record);
+ if ($type eq "FRG"){
+ my $id = $$fields{acc};
+ my @lines = split('\n', $$fields{src});
+ my $seqname = join('', @lines);
+ if ($seqname =~ /^\s*$/){
+ $seqname = $$fields{acc};
+ }
+ $clears{$seqname} = $$fields{clr};
+ }
+ }
+ close(FRG);
+}
+
+while (my $record = getRecord(\*STDIN)){
+ my ($type, $fields, $recs) = parseRecord($record);
+ if ($type eq "IUM"){
+ print "##$$fields{acc} $$fields{nfr} $$fields{len} bases\n";
+ }
+ for (my $r = 0; $r <= $#$recs; $r++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$r]);
+ if ($sid eq "IMP"){
+ my $id = $$sfs{mid};
+ my @lines = split('\n', $$sfs{src});
+ my $seqname = $lines[0];
+ my $cll; my $clr;
+ my ($asml, $asmr) = split(',', $$sfs{pos});
+ if (defined $uidmap){
+ print UID "$seqname $id\n";
+ }
+ if (exists $clears{$seqname}){
+ ($cll, $clr) = split(',', $clears{$seqname});
+ } else {
+ $cll = ($asml < $asmr) ? $asml : $asmr;
+ $clr = ($asml > $asmr) ? $asml : $asmr;
+ }
+
+ my $len = $clr - $cll;
+ if ($asml > $asmr){
+ my $tmp = $asml;
+ $asml = $asmr;
+ $asmr = $tmp;
+ $tmp = $cll;
+ $cll = $clr;
+ $clr = $tmp;
+ }
+ my $off = $asml;
+
+ printf("#%s(%d) %d bases {%d %d} <%d %d>\n", $seqname, $off, $len, $cll, $clr, $asml, $asmr);
+ }# if IMP
+ }# if IUM
+} # for each record
+
+if (defined $uidmap){
+ close(UID);
+}
+
+exit(0);
diff --git a/src/Converters/contig2contig.pl b/src/Converters/contig2contig.pl
new file mode 100755
index 0000000..89b23c6
--- /dev/null
+++ b/src/Converters/contig2contig.pl
@@ -0,0 +1,77 @@
+#!/usr/local/bin/perl
+
+use strict;
+use File::Spec;
+use TIGR::Foundation;
+my $base = new TIGR::Foundation;
+if (! defined $base){
+ die ("Foundation cannot be created. FATAL!\n");
+}
+
+print STDERR "Usage: contig2contig <seqfile> <contigfile> <outcontigfile>\n";
+my @names;
+open(FASTA, "$ARGV[0]") || die("Cannot open $ARGV[0]: $!\n");
+
+while (<FASTA>){
+ if (/>(\S+)/){
+ push(@names, $1);
+ }
+}
+close(FASTA);
+
+open(CONTIG, "$ARGV[1]") || die ("Cannot open $ARGV[1]: $!\n");
+open(OUT, ">$ARGV[2]") || die ("Cannot open $ARGV[2]: $!\n");
+my $contig_id;
+my $contig_len;
+my $nseqs;
+my $tmpfile = File::Spec->catfile($base->getTempDir(),"tmp.txt");
+while (<CONTIG>){
+ if (/^\s*$/){ # end of a contig
+ close(TMP);
+ print OUT "##$contig_id $nseqs $contig_len bases\n";
+ open(TMP, $tmpfile) || die ("Cannot open $tmpfile: $!\n");
+ while (<TMP>){
+ print OUT;
+ }
+ close(TMP);
+ } elsif (/^C (\d+)$/) {
+ $contig_id = $1;
+ $contig_len = 0;
+ $nseqs = 0;
+ open(TMP, ">$tmpfile") || die ("Cannot open $tmpfile: $!\n");
+ } elsif (/^(\d+) (\d+) (\d+)/){
+ my $id = $1;
+ my $asml = $2;
+ my $asmr = $3;
+ my $seql;
+ my $seqr;
+ my $seqlen;
+
+ $nseqs++;
+ if ($asml < $asmr){
+ $seql = 0;
+ $seqr = $seqlen = $asmr - $asml;
+ } else {
+ $seql = $seqlen = $asml - $asmr;
+ $seqr = 0;
+ my $tmp = $asml;
+ $asml = $asmr;
+ $asmr = $tmp;
+ }
+ if ($contig_len < $asmr) {
+ $contig_len = $asmr;
+ }
+ print TMP "#$names[$id]($asml) $seqlen bases {$seql $seqr} <$asml $asmr>\n";
+ }
+}
+
+close(TMP);
+print OUT "##$contig_id $nseqs $contig_len bases\n";
+open(TMP, "$tmpfile") || die ("Cannot open $tmpfile: $!\n");
+while (<TMP>){
+ print OUT;
+}
+close(TMP);
+
+close(OUT);
+close(CONTIG);
diff --git a/src/Converters/ctg2fasta.pl b/src/Converters/ctg2fasta.pl
new file mode 100755
index 0000000..2ffa492
--- /dev/null
+++ b/src/Converters/ctg2fasta.pl
@@ -0,0 +1,19 @@
+#!/usr/local/bin/perl
+
+use strict;
+use AMOS::AmosLib;
+use AMOS::ParseFasta;
+
+my $parser = new AMOS::ParseFasta(\*STDIN, '#', '');
+
+while (my ($head, $data) = $parser->getRecord()){
+
+ if ($head =~ /^\#(\S+)/){
+ my $name = $1;
+ $data =~ s/-//g;
+ printFastaSequence(\*STDOUT, $name, $data);
+ }
+
+}
+
+exit(0);
diff --git a/src/Converters/ctg2umdcontig.pl b/src/Converters/ctg2umdcontig.pl
new file mode 100755
index 0000000..30a2f79
--- /dev/null
+++ b/src/Converters/ctg2umdcontig.pl
@@ -0,0 +1,104 @@
+#!/usr/local/bin/perl
+
+my $idmap = $ARGV[1];
+my $ctg = $ARGV[0];
+
+if ($#ARGV < 0 || $#ARGV > 2){
+ print STDERR "Usage: ctg2umdcontig.pl file.ctg file.idmap [tigr] > file.uct\n";
+ print STDERR "tigr - assumes .ctg file has 1-based coordinates\n";
+ exit(1);
+}
+
+my %name2id;
+
+my $tigr;
+if (defined $ARGV[2]){
+ $tigr = 1;
+} else {
+ if ($ARGV[1] eq "tigr"){
+ $tigr = 1;
+ $idmap = undef;
+ }
+}
+
+if (defined $idmap){
+ open(ID, $idmap) || die ("cannot open $idmap: $!\n");
+ while (<ID>){
+ chomp;
+ my ($id, $name) = split(' ', $_);
+
+ $name2id{$name} = $id;
+ }
+ close(ID);
+}
+
+
+
+my $ctgid = 0;
+my $first = 1;
+my %reads;
+open(CTG, $ctg) || die ("Cannot open $ctg: $!\n");
+while (<CTG>){
+ if (/^\#\#(\d+) /){
+ if (! $first){
+ foreach my $left (sort {$a <=> $b} (keys %reads)){
+ print $reads{$left};
+ }
+ %reads = ();
+ print "\n";
+ }
+ $first = 0;
+ print "C $1\n";
+ next;
+ }
+ if (/^\#\#(\S+) /){ # not a number
+ if (! $first){
+ foreach my $left (sort {$a <=> $b} (keys %reads)){
+ print $reads{$left};
+ }
+ %reads = ();
+ print "\n";
+ }
+ $first = 0;
+ print "C $ctgid\n";
+ $ctgid++;
+ next;
+ }
+ if (/^\#(\S+)\(.*{(\d+) (\d+)} <(\d+) (\d+)>/){
+ my $name = $1;
+ my $left = $4;
+ my $right = $5;
+ my $seql = $2;
+ my $seqr = $3;
+
+ my $id;
+ if (exists $name2id{$name}){
+ $id = $name2id{$name};
+ } elsif ($name =~ /^(\d+)$/){
+ $id = $1;
+ } else {
+ die ("Cannot figure out id for read $name\n");
+ }
+
+ if (defined $tigr){
+ $left--;
+ }
+ my $asml; my $asmr;
+ if ($seql < $seqr){
+ $asml = $left;
+ $asmr = $right;
+ } else {
+ $asml = $right;
+ $asmr = $left;
+ }
+# print " name is $name\n";
+ while (exists $reads{$left}){
+ $left += 0.0001;
+ }
+ $reads{$left} = "$id $asml $asmr\n";
+# print "$name2id{$name} $asml $asmr\n";
+ }
+}
+foreach my $left (sort {$a <=> $b} (keys %reads)){
+ print $reads{$left};
+}
diff --git a/src/Converters/frg2fasta.pl b/src/Converters/frg2fasta.pl
new file mode 100755
index 0000000..4e34454
--- /dev/null
+++ b/src/Converters/frg2fasta.pl
@@ -0,0 +1,24 @@
+#!/usr/local/bin/perl
+
+use AMOS::AmosLib;
+
+
+while ($record = getRecord(\*STDIN)){
+ my ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec eq "FRG"){
+ my $sq = $$fields{seq};
+ my $nm = $$fields{src};
+ my @lines = split('\n', $nm);
+ $nm = join('', at lines);
+ if ($nm =~ /^\s*$/){
+ $nm = $$fields{acc};
+ }
+ @lines = split('\n', $sq);
+ $sq = join('', @lines);
+ my ($l, $r) = split(',', $$fields{clr});
+ $sq = substr($sq, $l, $r - $l + 1);
+ printFastaSequence(\*STDOUT, $nm, $sq);
+ next;
+ }
+}
+
diff --git a/src/Converters/frg2fastq.pl b/src/Converters/frg2fastq.pl
new file mode 100755
index 0000000..b930144
--- /dev/null
+++ b/src/Converters/frg2fastq.pl
@@ -0,0 +1,31 @@
+#!/usr/local/bin/perl
+use AMOS::AmosLib;
+# converts frg (phred 48) to fastq (phred 33)
+
+
+while ($record = getRecord(\*STDIN)){
+ my ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec eq "FRG"){
+ my $sq = $$fields{seq};
+ my $ql = $$fields{qlt};
+ my $nm = $$fields{src};
+ my @lines = split('\n', $nm);
+ $nm = join('', at lines);
+ if ($nm =~ /^\s*$/){
+ $nm = $$fields{acc};
+ }
+ @lines = split('\n', $sq);
+ $sq = join('', @lines);
+ @lines = split('\n', $ql);
+ $ql = join('', @lines);
+ my ($l, $r) = split(',', $$fields{clr});
+ $sq = substr($sq, $l, $r - $l + 1);
+ $ql = substr($ql, $l, $r - $l + 1);
+ @qla = split('', $ql);
+ for ( $i = 0; $i < scalar(@qla); $i++ )
+ { $qla[$i] = chr(ord($qla[$i]) - 15); }
+ $ql = join('', @qla);
+ print "\@$nm\n$sq\n+\n$ql\n";
+ next;
+ }
+}
diff --git a/src/Converters/frg2ta.pl b/src/Converters/frg2ta.pl
new file mode 100755
index 0000000..389b1f3
--- /dev/null
+++ b/src/Converters/frg2ta.pl
@@ -0,0 +1,312 @@
+#!/usr/local/bin/perl
+
+use lib "/local/asmg/lib";
+
+###########################################################################
+# Author: Mihai Pop
+#
+# Description:
+#
+# Converts Celera Assembler input to TIGR Assembler input.
+#
+# Test and Debug Features:
+# Debug level 0 - All errors
+# Debug level 1 - Basic Application progress messages and warnings
+# Debug level 9 - Full Application progress messages (Verbose)
+###########################################################################
+
+
+use strict;
+use Fcntl;
+use TIGR::Foundation;
+use TIGR::AsmLib;
+use IO::File;
+use File::Basename;
+
+my %deleted; # list of deleted IDs
+my %accname; # correspondence between accessions and seqnames
+my %meandist; # library sizes
+my %stdevdist;
+
+my $MINSEQSIZE = 64;
+my $version = "Version 1.2 (Build " . (qw/$Revision$/ )[1] . ")";
+my $HELPTEXT = qq~
+.USAGE.
+ frg2ta [options] PREFIX.frg
+
+.DESCRIPTION.
+ Converts Celera Assembler input to TIGR Assembler input. Converts CA input
+ PREFIX.frg into PREFIX.seq, PREFIX.qual similar to inputs for TA
+
+.OPTIONS.
+ -check Prints out those seqnames that are shorter than MINSEQ
+ -minseq sets MINSEQ. Default is 64
+ -o prefix Output prefix
+ -filter filters the .frg file for sequences shorter than MINSEQ
+ -noqual doesnt create .qual file
+ -qualidx creates an index for the qual file [needed by cutAsm]
+ -mates creates a .mates file indicating which sequences are mates
+ -nonames Uses Ids rather than trying to figure out seqnames
+ -h Prints help
+ -V Prints version information
+
+.KEYWORDS.
+ converter, Celera, TIGR
+
+~;
+
+my $tf = new TIGR::Foundation;
+if (! defined $tf) {
+ print STDERR "the sky is falling, run away!\n";
+ exit(1);
+}
+
+MAIN:
+{
+ $tf->setHelpInfo($HELPTEXT);
+ $tf->setVersionInfo($version);
+
+ my %opts = ( 'minseq' => \$MINSEQSIZE);
+ my $frag_fh;
+ my $opref;
+
+ my $err = $tf->TIGR_GetOptions(\%opts,
+ 'check',
+ 'minseq=i',
+ 'o=s',
+ 'filter',
+ 'noqual',
+ 'qualidx',
+ 'mates',
+ 'nonames');
+
+ if ($err == 0){
+ $tf->bail("Command line parsing failed. See -h option");
+ }
+
+ if (isReadableFile($ARGV[0])) {
+ $frag_fh = new IO::File "$ARGV[0]" or
+ $tf->bail("Cannot open \"$ARGV[0]\": $!\n");
+ } else {
+ $tf->bail("You must specify a .frg file!");
+ }
+
+ $ARGV[0] =~ /(\S+)\.frg/;
+ if (! defined $1) {
+ $tf->bail("\"$ARGV[0]\" not recognized, must have extension .frg");
+ }
+ if (defined $opts{'o'}) {
+ $opref = $opts{'o'};
+ } else {
+ $opref = $1;
+ }
+
+ if (defined $opts{'filter'}) {
+ $tf->logLocal("Filtering $ARGV[0] for sequences < $MINSEQSIZE...", 9);
+ if ($opref eq $1) {
+ $tf->bail("You must choose a different output name with -o\n");
+ }
+ open(NEWFRG, ">$opref.frg") or
+ $tf->bail("Cannot open \"$opref.frg\": $!\n");
+ } elsif (! defined $opts{'check'}) {
+ open (SEQ, ">$opref.seq") or
+ $tf->bail("Cannot open \"$opref.seq\": $!\n");
+ if (! defined $opts{'noqual'}){
+ open (QUAL, ">$opref.qual") or
+ $tf->bail("Cannot open \"$opref.qual\": $!\n");
+ if (defined $opts{'qualidx'}) {
+ open (QUALIDX, ">$opref.qual.qlx") or
+ $tf->bail("Cannot open \"$opref.qual.qlx\": $!\n");
+ }
+ }
+ if (defined $opts{'mates'}){
+ open (MATES, ">$opref.mates") or
+ $tf->bail("Cannot open \"$opref.mates\": $!\n");
+ }
+ } else {
+ $tf->logLocal("Checking $ARGV[0] for sequences < $MINSEQSIZE...", 9);
+ }
+
+ my $record = "";
+ while ($record = getCARecord($frag_fh)) {
+ my ($rec, $fields, $recs) = parseCARecord($record);
+
+ if ($rec eq "ADT") {
+ processADT($record, \%opts);
+ } elsif ($rec eq "MDI") {
+ processMDI($record, $fields, \%opts);
+ } elsif ($rec eq "FRG") {
+ processFRG($record, $fields, \%opts);
+ } elsif ($rec eq "LKG") {
+ processLKG($record, $fields, \%opts);
+ } elsif ($rec eq "DST") {
+ processDST($record, $fields, \%opts);
+ } else {
+ if (defined $opts{'filter'}) {
+ print NEWFRG $record;
+ }
+ $tf->logLocal("$rec ($$fields{acc}) is not currently parsed " .
+ "and has $#$recs sub-records", 1);
+ }
+
+ }
+
+ if (defined $opts{'filter'}) { close(NEWFRG); }
+
+ if (! defined $opts{'check'}) {
+ close (SEQ);
+ if (! defined $opts{'noqual'}) { close (QUAL); }
+ if (defined $opts{'qualidx'}) { close(QUALIDX); }
+ if (defined $opts{'mates'}) { close (MATES); }
+ }
+ $frag_fh->close();
+
+ # The end
+ exit(0);
+}
+
+######################################################################
+# process an ADT record
+######################################################################
+sub processADT {
+ my $record = shift;
+ my $rh_opts = shift;
+
+ if (defined $$rh_opts{'filter'}){
+ print NEWFRG $record;
+ }
+}
+
+######################################################################
+# process an MDI record
+######################################################################
+sub processMDI {
+ my $record = shift;
+ my $fields = shift;
+ my $rh_opts = shift;
+ $tf->logLocal("Processing MDI record...", 9);
+
+ if (defined $$rh_opts{'filter'}){
+ print NEWFRG $record;
+ }
+
+ $tf->logLocal("Distance id: $$fields{ref} revised to " .
+ "mean: $$fields{mea}, stddev: $$fields{std}, min: $$fields{min}, " .
+ "max: $$fields{max}", 1);
+}
+
+######################################################################
+# process a FRG record
+######################################################################
+sub processFRG {
+ my $record = shift;
+ my $fields = shift;
+ my $rh_opts = shift;
+
+ my $sequence = $$fields{seq};
+ my $qualities = $$fields{qlt};
+ my $clear = $$fields{clr};
+ my $seqname = $$fields{src};
+ my $id = getCAId($$fields{acc});
+
+ $tf->logLocal("Processing FRG record for $id...", 9);
+
+ my @lines = split('\n', $sequence);
+ $sequence = join('', @lines);
+ @lines = split('\n', $qualities);
+ $qualities = join('', @lines);
+ @lines = split('\n', $seqname);
+ $seqname = $lines[0];
+ if ($seqname eq "" || $seqname =~ /^\s*$/) {
+ $seqname = "$id";
+ }
+ if (defined $$rh_opts{'nonames'}) {
+ $accname{$id} = $id;
+ $seqname = $id;
+ } else {
+ $accname{$id} = $seqname;
+ }
+ $clear =~ /(\d+),(\d+)/;
+
+ if (defined $$rh_opts{'filter'}) {
+ if ($2 - $1 < $MINSEQSIZE){
+ $deleted{$id} = 1;
+ $tf->logLocal("Clear range for $seqname (" . ($2 - $1) .
+ ") < $MINSEQSIZE", 1);
+ print "Clear range for $seqname (", $2 - $1, ") < $MINSEQSIZE\n";
+ } else {
+ print NEWFRG $record;
+ }
+ } elsif ($$rh_opts{'check'}) {
+ if ($2 - $1 < $MINSEQSIZE) {
+ $tf->logLocal("Clear range for $seqname (" . ($2 - $1) .
+ ") < $MINSEQSIZE", 1);
+ print "Clear range for $seqname (", $2 - $1, ") < $MINSEQSIZE\n";
+ }
+ } else {
+ my $cll = $1 + 1;
+ my $clr = $2;
+
+ my $quals = sprintf("%02d", ord(substr($qualities, 0, 1)) - ord('0'));
+ for (my $c = 1; $c < length($qualities); $c++){
+ $quals .= sprintf(" %02d", ord(substr($qualities, $c, 1)) -
+ ord('0'));
+ }
+
+ my($pos,$pos1,$pos2,$seqname_len);
+ printFastaSequence(\*SEQ, "$seqname 0 0 0 $cll $clr", uc($sequence));
+ if (! defined $$rh_opts{'noqual'}){
+ if (defined $$rh_opts{'qualidx'}) {
+ $seqname_len = length($seqname) + 1;
+ $pos = tell QUAL;
+ $pos1 = $pos + $seqname_len;
+ printFastaQual(\*QUAL, "$seqname", $quals);
+ $pos = tell QUAL;
+ $pos2 = $pos - 1;
+ print QUALIDX "$seqname,$pos1,$pos2\n";
+ } else {
+ printFastaQual(\*QUAL, "$seqname", $quals);
+ }
+ }
+ }
+}
+
+######################################################################
+# process a LKG record
+######################################################################
+sub processLKG {
+ my $record = shift;
+ my $fields = shift;
+ my $rh_opts = shift;
+ $tf->logLocal("Processing LKG record...", 9);
+
+ if (defined $$rh_opts{'mates'}){
+ print MATES "$accname{$$fields{fg1}} $accname{$$fields{fg2}} " .
+ "$meandist{$$fields{dst}} $stdevdist{$$fields{dst}}\n";
+ }
+ if (defined $$rh_opts{'filter'}) {
+ unless (exists $deleted{$$fields{fg1}} or
+ exists $deleted{$$fields{fg2}}) {
+ print NEWFRG $record;
+ }
+ }
+}
+
+######################################################################
+# process a DST record
+######################################################################
+sub processDST {
+ my $record = shift;
+ my $fields = shift;
+ my $rh_opts = shift;
+ $tf->logLocal("Processing DST record...", 9);
+
+ if (defined $$rh_opts{'mates'}){
+ $meandist{$$fields{acc}} = $$fields{mea};
+ $stdevdist{$$fields{acc}} = $$fields{std};
+ }
+
+ if (defined $$rh_opts{'filter'}) {
+ print NEWFRG $record;
+ }
+}
diff --git a/src/Converters/parsecasm.pl b/src/Converters/parsecasm.pl
new file mode 100755
index 0000000..2bc4f72
--- /dev/null
+++ b/src/Converters/parsecasm.pl
@@ -0,0 +1,656 @@
+#!/usr/bin/perl
+
+#$Id$
+
+use strict;
+use Fcntl;
+use AMOS::AmosFoundation;
+use AMOS::AmosLib;
+use IO::File;
+
+my %seql; # id -> clear range correspondence
+my %seqr;
+my %seqpos; # id -> file offset correspondence
+my %seqnames; # id -> seqname correspondence
+my @usednames; # seqnames used in .contig file
+my %chosen; # chosen IDs
+my %deleted; # list of deleted IDs
+
+my $MINSEQSIZE = 64;
+
+my $contigname;
+my $tigrasmname;
+my $fragfname;
+my $fastafname;
+my $seqfname;
+my $qualfname;
+my $opref;
+my $frgStore;
+my $gkpStore;
+
+my @offsets; # offset -> asm_lend, asm_rend correspondence
+
+my $version = '$Revision$ ';
+my $helptext = qq~
+.USAGE.
+ parsecasm [options] file.asm [file1.frg file2.frg ...]
+
+.DESCRIPTION.
+ Converts CA output file.asm into file.fasta, file.contig. A file
+ named file.frg must be present in the current directory,
+ alternatively, a list of .frg files must be provided on the
+ command line.
+
+.OPTIONS.
+ -nofasta Do not create .fasta output
+ -justfasta Only create .fasta output
+ -o prefix Output prefix
+ -nonames Uses Ids rather than trying to figure out seqnames
+
+.KEYWORDS.
+ converters, Celera
+ ~;
+
+my $base = new AMOS::AmosFoundation;
+
+if (! defined $base){
+ print STDERR "the sky is falling, run away!\n";
+ exit(1);
+}
+
+$base->setHelpText($helptext);
+$base->setUsage("parsecasm [options] file.asm [file1.frg file2.frg ...]");
+$version =~ s/\$//g;
+$base->setVersion($version);
+
+my $ischeck = 0;
+my $nofasta;
+my $justfasta;
+my $noqual;
+my $filter;
+my $getmates;
+my %accname; # correspondence between accessions and seqnames
+my %meandist; # library sizes
+my %stdevdist;
+my %uid2iid;
+my $nonames;
+
+my $err = $base->getOptions("nofasta" => \$nofasta,
+ "justfasta" => \$justfasta,
+ "o=s" => \$opref,
+ "nonames" => \$nonames);
+if ($err == 0){
+ $base->bail("Command line parsing failed. See -h option");
+}
+
+open(IN, "$ARGV[0]") ||
+ $base->bail("Cannot open \"$ARGV[0]\": $!\n");
+
+$ARGV[0] =~ /(\S+)\.asm/;
+
+if (! defined $1){
+ $base->bail("\"$ARGV[0]\" not recognized, must have extension .asm\n");
+}
+
+if (!defined $opref){
+ $opref = $1;
+}
+
+my @frags;
+my @frgFiles;
+
+if ($#ARGV == 0){
+ $frags[0] = "$1.frg";
+} else {
+ @frags = @ARGV[1 .. $#ARGV];
+}
+
+if (! defined $justfasta){
+ my $nerr = 0;
+ for (my $i = 0; $i <= $#frags; $i++){
+ if (! -e $frags[$i]){
+ $nerr++;
+ print STDERR "file $frags[$i] doesn't exists!\n";
+ }
+ }
+ if ($nerr != 0){
+ $base->bail("One or more frg files could not be found\n");
+ }
+
+
+ for (my $i = 0; $i <= $#frags; $i++){
+ $frgFiles[$i] = new IO::File;
+ if (! $frgFiles[$i]->open($frags[$i])){
+ $nerr++;
+ print STDERR "file $frags[$i] cannot be opened: $! \n";
+ }
+ }
+ if ($nerr != 0){
+ $base->bail("One or more frg files could not be opened\n");
+ }
+}
+
+$contigname = "$opref.placed.contig";
+my $surrogatename = "$opref.surrogate.contig";
+my $degenname = "$opref.degen.contig";
+$fastafname = "$opref.placed.fasta";
+my $fastasurrname = "$opref.surrogate.fasta";
+my $fastadegenname = "$opref.degen.fasta";
+my $fastaqname = "$opref.placed.fasta.qual";
+my $fastasurrqname = "$opref.surrogate.fasta.qual";
+my $fastadegenqname = "$opref.degen.fasta.qual";
+my $libname = "$opref.libs";
+
+if (!defined $justfasta) {
+ open(OUT, ">$contigname") ||
+ $base->bail("Cannot open \"$contigname\": $!\n");
+ open(DEG, ">$degenname") ||
+ $base->bail("Cannot open $degenname: $!\n");
+ open(SUR, ">$surrogatename") ||
+ $base->bail("Cannot open $surrogatename: $!\n");
+ open(QUAL, ">$fastaqname") ||
+ $base->bail("Cannot open \"$fastaqname\": $!\n");
+ open(QUALSUR, ">$fastasurrqname") ||
+ $base->bail("Cannot open \"$fastasurrqname\": $!\n");
+ open(QUALDEG, ">$fastadegenqname") ||
+ $base->bail("Cannot open \"$fastadegenqname\": $!\n");
+ open(LIB, ">$libname") ||
+ $base->bail("Cannot open \"$libname\": $!\n");
+}
+
+if (!defined $nofasta){
+ open(FASTA, ">$fastafname") ||
+ $base->bail("Cannot open \"$fastafname\": $!\n");
+ open(FASTASUR, ">$fastasurrname") ||
+ $base->bail("Cannot open \"$fastasurrname\": $!\n");
+ open(FASTADEG, ">$fastadegenname") ||
+ $base->bail("Cannot open \"$fastadegenname\": $!\n");
+}
+
+my %seekfile;
+my %stdevs;
+my %means;
+
+# get the seek positions within the FRG file
+if (! defined $justfasta){
+ for (my $i = 0; $i <= $#frgFiles; $i++){
+ my $seekpos = tell $frgFiles[$i];
+ while (my $record = getRecord($frgFiles[$i])){
+ my ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec eq "FRG"){
+# print "setting $$fields{acc} to $seekpos\n";
+ $seqpos{$$fields{acc}} = $seekpos;
+ $seekfile{$$fields{acc}} = $i;
+ my $nm = $$fields{src};
+ my @lines = split('\n', $nm);
+ $nm = join(' ', @lines);
+ if ($nm eq "" || $nm =~ /^\s*$/){
+ $nm = "$$fields{acc}";
+ }
+ $seqnames{$$fields{acc}} = $nm;
+ }
+ if ($rec eq "DST"){
+ $stdevs{$$fields{acc}} = $$fields{std};
+ $means{$$fields{acc}} = $$fields{mea};
+ }
+ $seekpos = tell $frgFiles[$i];
+ } # for each record in FRG
+ } # for each input FRG file
+} # if ! defined $justfasta
+
+my $record = "";
+my $first = 1;
+my $number = 0;
+
+while ($record = getRecord(\*IN)){
+ my ($rec, $fields, $recs) = parseRecord($record);
+
+ if ($rec eq "MDI"){ # mate distance
+ my $id = getCAId($$fields{ref});
+
+ if (! defined $justfasta){
+ print LIB "Distance $id changed from ($means{$id}, $stdevs{$id}) to ($$fields{mea}, $$fields{std})\n\tmin = $$fields{min}, max= $$fields{max}\n" if ($$fields{buc} != 0);
+ print LIB "Distance $id unchanged from ($means{$id}, $stdevs{$id})\n" if ($$fields{buc} == 0);
+ }
+ next;
+ } # mate distance
+
+ if ($rec eq "AFG"){ # augmented fragment
+ if ($#$recs != -1){
+ print "Fragment ", getCAId($$fields{acc}),
+ " matches ", $#$recs + 1, " screens\n";
+ }
+
+ # convert the external ids into internal ids
+ $$fields{acc} =~ /\((\d+),(\d+)\)/;
+ if (!defined $1){
+ $base->bail("Can't understand accession \"$$fields{acc}\"");
+ }
+ $uid2iid{$1} = $2;
+
+ # get the new clear range
+ $$fields{clr} =~ /(\d+),(\d+)/;
+ if (!defined $1){
+ print STDERR "Weird clear range for fragment, ", getCAId($$fields{acc}), "\n";
+ next;
+ }
+ $seql{getCAId($$fields{acc})} = $1;
+ $seqr{getCAId($$fields{acc})} = $2;
+ next;
+ } # augmented fragment
+
+ if ($rec eq "UTG"){ # unitig record
+ if (defined $justfasta){
+ next;
+ }
+ if ($$fields{"sta"} ne "S"){
+ # we only report the Separable repeats in the output
+ next;
+ }
+
+ @offsets = ();
+ my $id = getCAId($$fields{acc});
+
+ my $len = $$fields{len};
+ my $lseq = $$fields{cns};
+ my $nseq = $$fields{nfr};
+ my $qualities = $$fields{qlt};
+
+ my @lines = split('\n', $qualities);
+ $qualities = join('', @lines);
+ my $quals = "";#sprintf("%02d", ord(substr($qualities, 0, 1)) - ord('0'));
+ my @fields = split('\n', $lseq);
+ $lseq = join('', @fields);
+
+ for (my $c = 0; $c < length($qualities); $c++){
+ if (substr($lseq, $c, 1) ne '-'){
+ $quals .= sprintf(" %02d",
+ ord(substr($qualities, $c, 1)) - ord('0'));
+ }
+ }
+
+
+ if (length($lseq) == 0){
+ next;
+ }
+
+ if (! defined $justfasta){
+ print_contig(\*SUR, $id, $len, $nseq, $lseq, "contig");
+ printFastaQual(\*QUALSUR, $id, $quals);
+ }
+ if (! defined $nofasta){
+ print_contig(\*FASTASUR, $id, $len, $nseq, $lseq, "fasta");
+ }
+
+# here the offsets array will contain one entry for each position
+# in the consensus ($lseq). That entry is the number of non-gap
+# characters in the consensus, up to the current coordinate.
+#
+# these numbers follow the asm_lend, asm_rend convention and start at 1.
+ $#offsets = length($lseq) - 1;
+ my $coord = 0;
+ for (my $i = 0; $i < length($lseq); $i++){
+ if (substr($lseq, $i, 1) ne "-"){
+ $coord++;
+ }
+ $offsets[$i] = $coord;
+ }
+
+# here we parse the individual sequences aligned to the contig
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+
+ if ($sid eq "MPS"){
+ if ($$sfs{typ} ne "R"){
+ print STDERR "weird type $$sfs{typ}\n";
+ next;
+ }
+ } else {
+ next;
+ }
+
+ my ($id, $sequence, $asml, $asmr, $rc, $seqleft, $seqright) =
+ deal_with_mps($sfs);
+
+ if (! defined $justfasta) {
+ print_aligned(\*SUR, $seqnames{$id}, $sequence, $asml, $rc,
+ $seqleft, $seqright,
+ $offsets[$asml], $offsets[$asmr], "contig");
+ }
+ $usednames[++$#usednames] = $seqnames{$id};
+ }
+ next;
+
+ } # unitig
+
+ if ($rec eq "CCO"){ # contig record
+ @offsets = ();
+ my $id = getCAId($$fields{acc});
+ my $len = $$fields{len};
+ my $lseq = $$fields{cns};
+ my $nseq = $$fields{npc};
+ my $qualities = $$fields{qlt};
+
+ my @lines = split('\n', $qualities);
+ $qualities = join('', @lines);
+ my $quals = "";#sprintf("%02d", ord(substr($qualities, 0, 1)) - ord('0'));
+ my @fields = split('\n', $lseq);
+ $lseq = join('', @fields);
+
+ for (my $c = 0; $c < length($qualities); $c++){
+ if (substr($lseq, $c, 1) ne '-'){
+ $quals .= sprintf(" %02d",
+ ord(substr($qualities, $c, 1)) - ord('0'));
+ }
+ }
+
+ if (length($lseq) == 0){
+ next;
+ }
+
+ if ($$fields{pla} eq "P") { # placed contig
+ if (!defined $nofasta){
+ print_contig(\*FASTA, $id, $len, $nseq, $lseq, "fasta");
+ printFastaQual(\*QUAL, $id, $quals);
+ }
+ if (!defined $justfasta){
+ print_contig(\*OUT, $id, $len, $nseq, $lseq, "contig");
+ }
+ } else {
+ if (!defined $nofasta){
+ print_contig(\*FASTADEG, $id, $len, $nseq, $lseq, "fasta");
+ printFastaQual(\*QUALDEG, $id, $quals);
+ }
+ if (!defined $justfasta){
+ print_contig(\*DEG, $id, $len, $nseq, $lseq, "contig");
+ }
+ }
+# here the offsets array will contain one entry for each position
+# in the consensus ($lseq). That entry is the number of non-gap
+# characters in the consensus, up to the current coordinate.
+#
+# these numbers follow the asm_lend, asm_rend convention and start at 1.
+ $#offsets = length($lseq) - 1;
+ my $coord = 0;
+ for (my $i = 0; $i < length($lseq); $i++){
+ if (substr($lseq, $i, 1) ne "-"){
+ $coord++;
+ }
+ $offsets[$i] = $coord;
+ }
+
+# here we parse the individual sequences aligned to the contig
+ if (!defined $justfasta){
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+
+ if ($sid eq "MPS"){
+ if ($$sfs{typ} ne "R"){
+ print STDERR "weird type $$sfs{typ}\n";
+ next;
+ }
+ } else {
+ next;
+ }
+
+ my ($id, $sequence, $asml, $asmr, $rc, $seqleft, $seqright) =
+ deal_with_mps($sfs);
+
+ if ($$fields{pla} eq "P"){
+ print_aligned(\*OUT, $seqnames{$id}, $sequence, $asml, $rc,
+ $seqleft, $seqright,
+ $offsets[$asml], $offsets[$asmr], "contig");
+ } else {
+ print_aligned(\*DEG, $seqnames{$id}, $sequence, $asml, $rc,
+ $seqleft, $seqright,
+ $offsets[$asml], $offsets[$asmr], "contig");
+ }
+ $usednames[++$#usednames] = $seqnames{$id};
+ } # for $i = 0...
+ }
+ next;
+ } # contig
+} # while getRecord
+
+if (!defined $nofasta){
+ close(FASTA);
+ close(FASTADEG);
+ close(FASTASUR);
+}
+
+if (! defined $justfasta){
+ close(LIB);
+ close(QUAL);
+ close(QUALDEG);
+ close(QUALSUR);
+ for (my $i = 0; $i <= $#frgFiles; $i++){
+ $frgFiles[$i]->close();
+ }
+ close(OUT);
+ close(DEG);
+ close(SUR);
+}
+
+close(IN);
+
+# The end
+exit(0);
+
+
+##########################################
+# this tries to abstract out the section on dealing with the MPS
+#records that is used in both the CCO and the UTG records
+sub deal_with_mps
+{
+ my $sfs = shift;
+
+
+ my $id = getCAId($$sfs{mid});
+ my $asms = $$sfs{pos};
+ $asms =~ /(\d+),(\d+)/;
+ if (! defined $1){
+ die ("weird pos record: $$sfs{pos}\n");
+ }
+ my $asml = 0;
+ my $asmr = 0;
+ if ($1 > $2){
+ $asml = $1 - 1;
+ $asmr = $2;
+ } else {
+ $asml = $1;
+ $asmr = $2 - 1;
+ }
+
+ my $gapno = $$sfs{dln};
+ my $gaps = $$sfs{del};
+ my @gaps = split(' ', $gaps);
+ if ($gapno != $#gaps + 1){
+ print STDERR "weird, $gapno != ", $#gaps + 1, "\n";
+ }
+
+ my $sequence = get_seq($frgFiles[$seekfile{$id}], $id);
+
+ my @lines = split('\n', $sequence);
+ $sequence = join('', @lines);
+ $sequence = uc($sequence);
+
+ $sequence = substr($sequence, $seql{$id}, $seqr{$id} - $seql{$id});
+
+ my $seqleft = $seql{$id} + 1;
+ my $seqright = $seqr{$id};
+
+ my $rc = "";
+ # sequence is reverse complemented
+ if ($asml > $asmr){
+ $sequence = reverseComplement($sequence);
+ my $tmp = $asmr;
+ $asmr = $asml;
+ $asml = $tmp;
+
+ $tmp = $seqright;
+ $seqright = $seqleft;
+ $seqleft = $tmp;
+ $rc = "RC";
+ }
+
+ # now we add in the gaps and print the sequence
+ my $outseq = "";
+ my $gapindex = 0;
+ for (my $j = 0; $j < length($sequence); $j++){
+ my $seqj = $j;# + $seql{$id} - 1; # index in untrimmed sequence
+ if ($gapindex <= $#gaps && $seqj > $gaps[$gapindex]){
+ print STDERR "Weird $seqnames{$id}, $seqj > $gaps[$gapindex]\n";
+ }
+ # this here is a fix for cases when the last gap index
+ # is equal to the length of the sequence. In this case
+ # the sequence gets an extra gap at the very end (which
+ # I might add, is completely stupid).
+ while ($gapindex <= $#gaps && $seqj == $gaps[$gapindex]){
+# print "GS $gapindex $#gaps $seqj $gaps[$gapindex] ",
+ length($sequence), "\n";
+ $outseq .= "-";
+ $gapindex++;
+# print "GE $gapindex\n";
+ }
+ $outseq .= substr($sequence, $j, 1);
+ }
+
+ if ($gapindex == $#gaps && length($sequence) == $gaps[$gapindex]){
+ $outseq .= "-";
+ } elsif ($gapindex < $#gaps){
+ print STDERR "Where are all the gaps $seqnames{$id}: $gapindex, $#gaps\n";
+ }
+
+ $sequence = $outseq;
+
+ return ($id, $sequence, $asml, $asmr, $rc, $seqleft, $seqright);
+} # deal_with_mps
+
+# prints contig in specified format
+sub print_contig
+{
+ my $file = shift;
+ my $id = shift;
+ my $len = shift;
+ my $nseq = shift;
+ my $sequence = shift;
+ my $how = shift;
+ my $type = shift;
+
+ if (length($sequence) == 0){
+ return;
+ }
+
+ if ($how eq "contig"){
+ print $file "\#\#$id $nseq $len bases, 00000000 checksum.\n";
+ print_sequence($file, $sequence);
+ return;
+ } # if $how eq "contig"
+ elsif ($how eq "asm"){
+ my $strip = $sequence;
+ $strip =~ s/-//g;
+# get the current date
+ my $date = `date +'%D %T'`;
+ chomp $date;
+
+ my $quality = "0x";
+ for (my $i = 0; $i < length($sequence); $i++){
+ $quality .= "06";
+ }
+
+ print $file "sequence\t$strip\n";
+ print $file "lsequence\t$sequence\n";
+ print $file "quality\t$quality\n";
+ print $file "asmbl_id\t$id\n";
+ print $file "seq_id\t\n";
+ print $file "com_name\t\n";
+ print $file "type\t\n";
+ print $file "method\tCelera Assembler\n";
+ print $file "ed_status\t\n";
+ print $file "redundancy\t\n";
+ print $file "perc_N\t\n";
+ print $file "seq\#\t$nseq\n";
+ print $file "full_cds\t\n";
+ print $file "cds_start\t\n";
+ print $file "cds_end\t\n";
+ print $file "ed_pn\t$ENV{USER}\@$ENV{HOSTNAME}\n";
+ print $file "ed_date\t$date\n";
+ print $file "comment\t$type ID: $id\n";
+ print $file "frameshift\t\n";
+ return;
+ } # if $how eq "asm"
+ elsif ($how eq "fasta")
+ {
+ print $file ">$id $nseq $len bases\n";
+ $sequence =~ s/-//g; # get rid of all gaps
+ print_sequence($file, $sequence);
+ return;
+ }
+} # print_contig
+
+sub print_aligned
+{
+ my($file, $name, $seq, $offset, $rc,
+ $seqleft, $seqright, $asml, $asmr, $type) = @_;
+
+ if ($type eq "contig"){
+ print $file "\#$name($offset) [$rc] ",
+ length($seq),
+ " bases, 00000000 checksum. {$seqleft $seqright} <$asml $asmr>\n";
+
+ print_sequence($file, $seq);
+ }
+
+ if ($type eq "asm"){
+ print $file "\n";
+ print $file "seq_name\t$name\n";
+ print $file "asm_lend\t$asml\n";
+ print $file "asm_rend\t$asmr\n";
+ print $file "seq_lend\t$seqleft\n";
+ print $file "seq_rend\t$seqright\n";
+ print $file "best\t\n";
+ print $file "comment\t\n";
+ print $file "db\t\n";
+ print $file "offset\t$offset\n";
+ print $file "lsequence\t$seq\n";
+ }
+
+ return;
+}
+
+# prints sequence in specified format
+sub print_sequence
+{
+ my $file = shift;
+ my $seqs = shift;
+
+ for (my $j = 0; $j < length($seqs); $j += 60){
+ print $file substr($seqs, $j, 60), "\n";
+ }
+} # print_sequence
+
+# gets a sequence from the specified file depending on the seqpos array
+sub get_seq
+{
+ my $file = shift;
+ my $id = shift;
+
+ seek $file, $seqpos{$id}, 0; # seek set
+ my $record = getRecord($file);
+ if (! defined $record){
+ print STDERR "weird error - no record found\n";
+ return;
+ }
+
+ my ($rec, $fields, $recs) = parseRecord($record);
+
+ if ($rec ne "FRG"){
+ print STDERR "weird error in get_seq, expecting frg\n";
+ return;
+ }
+ if ($$fields{acc} != $id){
+ print STDERR "weird error in get_seq, expecting $id, got $$fields{acc}\n";
+ return;
+ }
+ return $$fields{seq};
+}
diff --git a/src/Converters/phd2afg.pl b/src/Converters/phd2afg.pl
new file mode 100755
index 0000000..ff4ceea
--- /dev/null
+++ b/src/Converters/phd2afg.pl
@@ -0,0 +1,466 @@
+#!/usr/bin/perl
+
+use AMOS::AmosFoundation;
+
+my $base = new AMOS::AmosFoundation;
+
+if (! defined $base) {
+ die ("Foundation cannot be created. FATAL!\n");
+}
+
+my $HELPTEXT = q~
+.USAGE.
+ phd2afg -d phd_dir -o file.afg [-c file.clr] [-m file.mates]
+
+.DESCRIPTION.
+ This program takes a directory of phd files and produces a .afg file
+ with options for clear ranges and mates.
+
+.OPTIONS.
+ -d phd_dir directory where phd files are located
+ -o file.afg name of the output file
+ -c file.clr optional: file containing clipping coordinates
+ -m file.mates optional: file containing mate-pair info in Bambus .mates format
+
+.KEYWORDS.
+ converters, phd, afg
+ ~;
+
+$base->setHelpText($HELPTEXT);
+
+
+my $phddir = undef;
+my $outfile = undef;
+my $matefile = undef;
+my $clrfile = undef;
+
+my $err = $base->getOptions(
+ "d=s" => \$phddir,
+ "o=s" => \$outfile,
+ "m=s" => \$matefile,
+ "c=s" => \$clrfile
+ );
+
+if (! $err){
+ $base->bail("Error processing options !");
+}
+
+if (! defined $phddir || ! defined $outfile){
+ $base->bail("Both options -d and -o must be specified (see -h)\n");
+}
+
+open(OUT, ">$outfile") || die ("Cannot open $outfile:$!\n");
+
+my %libraries; # store library information
+my %seqids; # identifiers attached with each sequence
+my %seqnames; # names attached with each identifier
+my %seqrev; # which revision of the sequence we are dealing with
+my %seqfile; # phd file corresponding to each sequence
+my %insertlib; # mapping from libraries to inserts
+my %seenlib; # mapping from insert to library
+my %insid; # mapping from insert name to id
+my %forw; # forward read in each insert
+my %rev; # reverse read in each insert
+my %seqinsert; # insert for each sequence
+my %clears; # clear ranges for the reads
+
+$minSeqID = 1;
+
+if (defined $clrfile){
+ open(CLR, $clrfile) || die ("Cannot open $clrfile: $!\n");
+ while (<CLR>){
+ chomp;
+ my ($id, $l, $r) = split(' ', $_);
+# $id =~ s/\.ab1$//;
+ $clears{$id} = "$l,$r";
+ }
+ close(CLR);
+}
+
+opendir(PHD, $phddir) || die ("Cannot open $phddir: $!\n");
+
+# get all names & associate name to latest phd file
+# parse mates file
+# start writing .afg file:
+# first libraries
+# then fragments
+# then reads: open each phd file and produce the corresponding afg record
+
+while (my $file = readdir(PHD)){
+ if ($file =~ /^\./){next;} # skip hidden files
+ if ($file !~ /\.phd\.\d/) {next;} # skip non-phd files
+ $file =~ /^(.*)\.phd\.(\d)/;
+ my $seqname = $1;
+ my $rev = $3;
+
+ if (defined $clrfile && ! exists $clears{$seqname}){
+ print "No clear range for $seqname\n";
+ next;
+ } # skip reads with no clear range
+
+ if (! exists $seqfile{$seqname} ||
+ $seqrev{$seqname} < $rev){
+ $seqfile{$seqname} = "$phddir/$file";
+ $seqrev{$seqname} = $rev;
+ }
+ if (! exists $seqids{$seqname}){
+ $seqids{$seqname} = $minSeqID++;
+ $seqnames{$seqids{$seqname}} = $seqname;
+ }
+}
+
+closedir(PHD);
+
+if (defined $matefile){
+ open(MATE, $matefile) || die ("Cannot open $matefile: $!\n");
+# print STDERR "Parsing $matefile\n";
+ parseMatesFile(\*MATE);
+ close(MATE);
+}
+
+my $ll = $minSeqID++;
+$libraries{$ll} = "0 0";
+$libnames{$ll} = "dummy";
+$libid{$ll} = $ll;
+
+my $needdummy = 0;
+while (my ($sid, $sname) = each %seqnames){
+ if (! exists $seqinsert{$sid}){
+ my $id = $minSeqID++;
+ $seqinsert{$sid} = $id;
+# $insid{$id} = $id;
+ $seenlib{$id} = $ll;
+ $insertlib{$ll} .= "$id ";
+ $forw{$id} = $sid;
+ $needdummy = 1;
+ }
+}
+
+if ($needdummy == 0){
+ delete $libraries{$ll};
+ delete $libnames{$ll};
+ delete $libid{$ll};
+}
+
+my $date = localtime();
+
+print OUT "{UNV\n";
+print OUT "eid:afg\n";
+print OUT "com:\n";
+print OUT "generated by $0\n";
+print OUT "on: $date\n";
+print OUT ".\n";
+print OUT "}\n";
+
+# then print out one library at a time
+while (my ($lib, $range) = each %libraries){
+ my ($mean, $sd) = split(' ', $range);
+ print OUT "{LIB\n";
+
+ $libid{$lib} = $minSeqID;
+ print OUT "iid:", $minSeqID++, "\n";
+
+ if (exists $libnames{$lib}){
+ print OUT "eid:$libnames{$lib}\n";
+ } else {
+ print OUT "eid:$lib\n";
+ }
+ print OUT "{DST\n";
+ print OUT "mea:$mean\n";
+ print OUT "std:", sprintf("%.2f\n", $sd);
+ print OUT "}\n";
+ print OUT "}\n";
+}
+
+# then all the inserts
+while (my ($ins, $lib) = each %seenlib){
+ if (! exists $insid{$ins}) {
+ $insid{$ins} = $minSeqID++;
+ };
+ print OUT "{FRG\n";
+ print OUT "eid:$ins\n";
+ print OUT "iid:$insid{$ins}\n";
+ print OUT "lib:$libid{$lib}\n";
+
+# add rds.
+ if (exists $forw{$ins} && exists $rev{$ins}){
+ print OUT "rds:$forw{$ins},$rev{$ins}\n";
+ }
+
+ print OUT "typ:I\n";
+ print OUT "}\n";
+}
+
+# then all the sequences
+while (my ($sid, $sname) = each %seqnames){
+ my $seq;
+ my $qual;
+ my $pos;
+ my $cll;
+ my $clr;
+
+ open(SEQ, $seqfile{$sname}) || die ("Cannot open $seqfile{$sname}: $!\n");
+ parsePHDFile(\*SEQ, \$seq, \$qual, \$pos, \$cll, \$clr);
+ close(SEQ);
+
+ if (defined $clrfile){
+ if (! exists $clears{$sname}){
+ die ("Bizarre.... should have clear range for $sname\n");
+ }
+ ($cll, $clr) = split(',', $clears{$sname});
+ }
+
+ if ($cll < 0 || $clr < 0){next;} # skip bad sequences
+
+ print OUT "{RED\n";
+ print OUT "iid:$sid\n";
+ print OUT "eid:$sname\n";
+ print OUT "seq:\n";
+ for (my $i = 0; $i < length($seq); $i+=60){
+ print OUT substr($seq, $i, 60), "\n";
+ }
+ print OUT ".\n";
+ print OUT "qlt:\n";
+ for (my $i = 0; $i < length($qual); $i+=60){
+ print OUT substr($qual, $i, 60), "\n";
+ }
+ print OUT ".\n";
+ print OUT "bcp:\n";
+ my @posn = split(' ', $pos);
+ for (my $i = 0; $i <= $#posn; $i+=15){
+ if ($i + 14 <= $#posn){
+ print OUT join(" ", @posn[$i .. $i+14]), "\n";
+ } else {
+ print OUT join(" ", @posn[$i .. $#posn]), "\n";
+ }
+ }
+ print OUT ".\n";
+ print OUT "clr:$cll,$clr\n";
+ if (! exists $seqinsert{$sid}){
+ die ("Cannot find insert for $sid $sname\n");
+ }
+ print OUT "frg:$insid{$seqinsert{$sid}}\n";
+ print OUT "}\n";
+}
+
+close(OUT);
+exit(0);
+
+
+
+####################################################
+
+# parses a PHD file into 5 values;
+# sequence, quality, positions, clear left, clear right
+sub parsePHDFile()
+{
+ my $file = shift;
+ my $seq = shift;
+ my $qual = shift;
+ my $pos = shift;
+ my $cll = shift;
+ my $clr = shift;
+
+ $$cll = undef; $$clr = undef;
+ $$seq = ""; $$qual = ""; $$pos = "";
+
+ my @posn;
+
+ my $inseq = 0;
+
+ while (<$file>){
+ if (/^BEGIN_DNA/){
+ $inseq = 1;
+ next;
+ }
+ if (/^END_DNA/){
+ $inseq = 0;
+ next;
+ }
+ if (/^TRIM: (\d+) (\d+) /){
+ $$cll = $1 - 1; $$clr = $2;
+ next;
+ }
+ if ($inseq == 1){
+ chomp;
+ my ($base, $q, $p) = split(" ", $_);
+ $$seq .= $base;
+ if ($q > 60) {$q = 60;}
+ $$qual .= chr(ord('0') + $q);
+# if ($#posn == -1){
+ push @posn, $p;
+# } else {
+# push @posn, $p; # - $posn[$#posn]; # delta encoding
+# }
+ }
+ }
+
+ $$pos = join(" ", @posn);
+
+ if (! defined $$cll){
+ $$cll = 0;
+ $$clr = length($$seq);
+ }
+
+ return;
+} # parsePHDFile
+
+# parses BAMBUS style .mates file
+# * expects %seqids to be populated
+# * populates %libraries, %forw, %rev, %insertlib, %seenlib, %seqinsert
+sub parseMatesFile {
+ my $IN = shift;
+
+ my @libregexp;
+ my @libids;
+ my @pairregexp;
+ my $insname = 1;
+
+ while (<$IN>){
+ chomp;
+ if (/^library/){
+ my @recs = split('\t', $_);
+ if ($#recs < 3 || $#recs > 4){
+ print STDERR "Only ", $#recs + 1, " fields\n";
+ print STDERR "Improperly formated line $. in \"$matesfile\".\nMaybe you didn't use TABs to separate fields\n";
+ next;
+ }
+
+ if ($#recs == 4){
+ $libregexp[++$#libregexp] = $recs[4];
+ $libids[++$#libids] = $recs[1];
+ }
+ my $mean = ($recs[2] + $recs[3]) / 2;
+ my $stdev = ($recs[3] - $recs[2]) / 6;
+ $libraries{$recs[1]} = "$mean $stdev";
+ next;
+ } # if library
+
+ if (/^pair/){
+ my @recs = split('\t', $_);
+ if ($#recs != 2){
+ print STDERR "Improperly formated line $. in \"$matesfile\".\nMaybe you didn't use TABs to separate fields\n";
+ next;
+ }
+ @pairregexp[++$#pairregexp] = "$recs[1] $recs[2]";
+ next;
+ }
+ if (/^\#/) { # comment
+ next;
+ }
+ if (/^\s*$/) { # empty line
+ next;
+ }
+
+ # now we just deal with the pair lines
+ my @recs = split('\t', $_);
+ if ($#recs < 1 || $#recs > 2){
+ print STDERR "Improperly formated line $. in \"$matesfile\".\nMaybe you didn't use TABs to separate fields\n";
+ next;
+ }
+
+# make sure we've seen these sequences
+ if (! defined $seqids{$recs[0]}){
+ print STDERR "Sequence $recs[0] has no ID at line $. in \"$matesfile\"\n";
+ next;
+ }
+ if (! defined $seqids{$recs[1]} ){
+ print STDERR "Sequence $recs[1] has no ID at line $. in \"$matesfile\"\n";
+ next;
+ }
+
+ if (defined $recs[2]){
+ $insertlib{$recs[2]} .= "$insname ";
+ $seenlib{$insname} = $recs[2];
+ } else {
+ print STDERR "$insname has no library\n";
+ }
+
+ $forw{$insname} = $seqids{$recs[0]};
+ $rev{$insname} = $seqids{$recs[1]};
+
+ $seqinsert{$seqids{$recs[0]}} = $insname;
+ $seqinsert{$seqids{$recs[1]}} = $insname;
+
+ $insname++;
+ } # while <IN>
+
+ # now we have to go through all the sequences and assign them to
+ # inserts
+ while (my ($nm, $sid) = each %seqids){
+ for (my $r = 0; $r <= $#pairregexp; $r++){
+ my ($freg, $revreg) = split(' ', $pairregexp[$r]);
+ print STDERR "trying $freg and $revreg on $nm\n";
+ if ($nm =~ /$freg/){
+ my $iname = "";
+ for (my $in = 1; $in <= $#+; $in++){
+ $iname .= substr($nm, $-[$in], $+[$in] - $-[$in]);
+ }
+ print STDERR "got forw $iname\n";
+#imhere
+ if (! exists $forw{$iname}){
+ $forw{$iname} = $sid;
+ $seqinsert{$sid} = $iname;
+ }
+ last;
+ }
+ if ($nm =~ /$revreg/){
+ my $iname = "";
+ for (my $in = 1; $in <= $#+; $in++){
+ $iname .= substr($nm, $-[$in], $+[$in] - $-[$in]);
+ }
+ print STDERR "got rev $iname\n";
+ if (! exists $rev{$iname}){
+ $rev{$iname} = $sid;
+ $seqinsert{$sid} = $iname;
+ }
+ last;
+ }
+ } # for each pairreg
+ } # while each %seqids
+
+ while (my ($ins, $nm) = each %forw) {
+ if (! exists $seenlib{$ins}){
+ my $found = 0;
+
+ $nm = $seqnames{$nm};
+
+ for (my $l = 0; $l <= $#libregexp; $l++){
+ print STDERR "Trying $libregexp[$l] on $nm\n";
+ if ($nm =~ /$libregexp[$l]/){
+ print STDERR "found $libids[$l]\n";
+ $insertlib{$libids[$l]} .= "$ins ";
+ $seenlib{$ins} = $libids[$l];
+ $found = 1;
+ last;
+ }
+ }
+ if ($found == 0){
+ print STDERR "Cannot find library for \"$nm\"\n";
+ next;
+ }
+ }
+ }
+ while (my ($ins, $nm) = each %rev) {
+ if (! exists $seenlib{$ins}){
+ my $found = 0;
+
+ $nm = $seqnames{$nm};
+
+ for (my $l = 0; $l <= $#libregexp; $l++){
+ print STDERR "Trying $libregexp[$l] on $nm\n";
+ if ($nm =~ /$libregexp[$l]/){
+ print STDERR "found $libids[$l]\n";
+ $insertlib{$libids[$l]} .= "$ins ";
+ $seenlib{$ins} = $libids[$l];
+ $found = 1;
+ last;
+ }
+ }
+ if ($found == 0){
+ print STDERR "Cannot find library for \"$nm\"\n";
+ next;
+ }
+ }
+ }
+} # parseMateFile;
diff --git a/src/Converters/scaff2fasta.pl b/src/Converters/scaff2fasta.pl
new file mode 100755
index 0000000..3250c29
--- /dev/null
+++ b/src/Converters/scaff2fasta.pl
@@ -0,0 +1,314 @@
+#!/usr/bin/perl
+
+#$Id$
+
+use strict;
+use Fcntl;
+use AMOS::AmosFoundation;
+use AMOS::AmosLib;
+use IO::Handle;
+
+my $FILEBUF;
+
+my %seekpos; # id -> file offset correspondence
+my %reverse;
+my $pos;
+
+my %scaffolds;
+my %scaffgaps;
+
+my $fastafname;
+
+my $version = " 1.01 (Build " . (qw/$Revision$/ )[1] . ")";
+my $helptext = qq~
+.USAGE.
+ scaff2fasta [-gaps] [-linker <linker>] [-contig <ctg>] <prefix>.asm
+
+.DESCRIPTION.
+ Produces a .scaffolds.fasta file of the bases of contigs in the
+ order and orientation found in a Celera scaffold. <prefix>.asm
+ file is required as input.
+
+.OPTIONS.
+ if -gaps is provided outputs a number of Ns proportional to gap size (a minimum of 100 Ns)
+ if -linker is provided uses the <linker> sequence as separator between contigs
+ if neither -gaps nor -linker are given, the space between contigs is filled with 100 Ns
+ if -contig is provided also generates a .contig-like file for the scaffold
+
+.KEYWORDS.
+ converters, scaffolds
+ ~;
+
+my $base = new AMOS::AmosFoundation;
+
+if (! defined $base){
+ print STDERR "the sky is falling, run away!\n";
+ exit(1);
+}
+
+$base->setHelpText($helptext);
+$base->setUsage("scaff2fasta [-gaps] [-linker <linker>] [-contig <ctg>] <prefix>.asm");
+$base->setVersion($version);
+
+my $dogaps;
+my $linker;
+my $contig;
+
+my $err = $base->getOptions("gaps" => \$dogaps,
+ "linker=s" => \$linker,
+ "contig=s" => \$contig);
+if ($err == 0){
+ $base->bail("Command line parsing failed. See -h option");
+}
+
+my $fh = new IO::Handle;
+
+open(IN, "$ARGV[0]") ||
+ $base->bail("Cannot open \"$ARGV[0]\": $!\n");
+
+$fh->fdopen(fileno(IN), "r") || $base->bail("Cannot open IN: $!\n");
+
+$ARGV[0] =~ /(\S+)\.asm/;
+if (! defined $1){
+ $base->bail("\"$ARGV[0]\" not recognized, must have extension .asm or .frg\n");
+}
+
+$fastafname = "$1.scaffolds.fasta";
+my $record = "";
+
+my %seqname;
+my %clears;
+
+if (defined $contig){
+ open(CTG, ">$contig") ||
+ $base->bail("Cannot open $contig: $!\n");
+
+ open(FRG, "$1.frg") ||
+ $base->bail("Cannot open $1.frg needed by -contig: $!\n");
+ while ($record = getRecord(\*FRG)){
+ my ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec eq "FRG"){
+ my @nm = split('\n', $$fields{src});
+ my $nm = join('', @nm);
+ if ($nm =~ /^\s*$/){
+ $nm = $$fields{acc};
+ }
+ $seqname{$$fields{acc}} = $nm;
+ $clears{$$fields{acc}} = $$fields{clr};
+ }
+ }
+}
+
+open(FASTA, "> $fastafname") ||
+ $base->bail("Cannot open \"$fastafname\": $!\n");
+
+my %ctglen;
+my %scafflen;
+my %scaffread;
+my %ctgread;
+
+my $pos = tell IN;
+while ($record = getRecord(\*IN)){
+ my ($rec, $fields, $recs) = parseRecord($record);
+
+ if ($rec eq "CCO"){ # contig record
+ my $id = getCAId($$fields{acc});
+
+ $seekpos{$id} = $pos;
+ my $cns = $$fields{cns};
+ my @cns = split('\n', $cns);
+ my $cns = join('', @cns);
+ $cns =~ s/-//g;
+ $ctglen{$id} = length($cns);
+ $ctgread{$id} = $$fields{npc};
+ }
+
+ if ($rec eq "SCF"){ #scaffold record
+ my $id = getCAId($$fields{"acc"});
+
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($lrec, $lfield, $lrecs) = parseRecord($$recs[$i]);
+
+ my $ct1 = $$lfield{"ct1"};
+ my $ct2 = $$lfield{"ct2"};
+ my $gap = int($$lfield{"mea"});
+ if (! defined $dogaps || $gap < 100) {$gap = 100;}
+
+ if ($$lfield{"ori"} eq "A"){
+ if (exists $reverse{$ct1} &&
+ $reverse{$ct1} != 1){
+ print STDERR "$ct1\'s orientation is inconsistent\n";
+ }
+ if (exists $reverse{$ct2} &&
+ $reverse{$ct2} != 1){
+ print STDERR "$ct2\'s orientation is inconsistent\n";
+ }
+ $reverse{$ct1} = 1;
+ $reverse{$ct2} = 1;
+ } elsif ($$lfield{"ori"} eq "O"){
+ if (exists $reverse{$ct1} &&
+ $reverse{$ct1} != 1){
+ print STDERR "$ct1\'s orientation is inconsistent\n";
+ }
+ $reverse{$ct1} = 1;
+ if (exists $reverse{$ct2} &&
+ $reverse{$ct2} == 1){
+ print STDERR "$ct2\'s orientation is inconsistent\n";
+ }
+ $reverse{$ct2} = 0;
+ } elsif ($$lfield{"ori"} eq "I"){
+ if (exists $reverse{$ct1} &&
+ $reverse{$ct1} == 1){
+ print STDERR "$ct1\'s orientation is inconsistent\n";
+ }
+ $reverse{$ct1} = 0;
+ if (exists $reverse{$ct2} &&
+ $reverse{$ct2} != 1){
+ print STDERR "$ct2\'s orientation is inconsistent\n";
+ }
+ $reverse{$ct2} = 1;
+ } else {
+ if (exists $reverse{$ct1} &&
+ $reverse{$ct1} == 1){
+ print STDERR "$ct1\'s orientation is inconsistent\n";
+ }
+ $reverse{$ct1} = 0;
+ if (exists $reverse{$ct2} &&
+ $reverse{$ct2} == 1){
+ print STDERR "$ct2\'s orientation is inconsistent\n";
+ }
+ $reverse{$ct2} = 0;
+ }
+ print "Adding $ct1 to scaffold $id\n";
+ $scaffolds{$id} .= "$ct1 ";
+ $scafflen{$id} += $ctglen{$ct1};
+ $scaffread{$id} += $ctgread{$ct1};
+ $scaffgaps{$id} .= "$gap ";
+# if (! defined $dogaps || $gap < 100) {$gap = 100;}
+ if ($ct1 != $ct2){ # if same contig don't need to add the gap
+ $scafflen{$id} += $gap;
+ }
+
+ if ($ct1 != $ct2 && $i == $#$recs){
+ $scaffolds{$id} .= "$ct2";
+ $scafflen{$id} += $ctglen{$ct2};
+ $scaffread{$id} += $ctgread{$ct2};
+ print "Adding $ct2 to scaffold $id\n";
+ }
+ }
+ }
+ $pos = tell IN;
+}
+
+while (my ($scaff, $ctgs) = each (%scaffolds)){
+ my @contigs = split(' ', $ctgs);
+ my @gaps = split(' ', $scaffgaps{$scaff});
+
+ print "handling $scaff: $ctgs\n";
+
+ my $scaffconsensus = "";
+
+ if (defined $contig){
+ print CTG "##$scaff $scaffread{$scaff} $scafflen{$scaff}\n";
+ }
+
+ my $off = 0;
+ for (my $i = 0; $i <= $#contigs; $i++){
+ seek IN, $seekpos{$contigs[$i]}, 0; # seek set
+ my $record = getRecord(\*IN);
+ if (! defined $record){
+ print "wierd error\n";
+ return;
+ }
+
+ my ($rec, $fields, $recs) = parseRecord($record);
+
+ if ($rec ne "CCO"){
+ print STDERR "wierd error in get_seq, expecting frg\n";
+ return;
+ }
+
+ my $id = getCAId($$fields{"acc"});
+ my $consensus = $$fields{"cns"};
+ my @fields = split('\n', $consensus);
+ $consensus = join('', @fields);
+ my @offsets = ();
+
+ if (defined $contig){
+ my $coord = 0;
+ for (my $j = 0; $j < length($consensus); $j++){
+ if (substr($consensus, $j, 1) ne "-"){
+ $coord++;
+ }
+ $offsets[$j] = $coord;
+ }
+ }
+ $consensus =~ s/-//g;
+
+ my $len = length($consensus);
+
+ if (defined $contig){
+ for (my $j = 0; $j <= $#$recs; $j++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$j]);
+ if ($sid eq "MPS"){
+ my $o;
+ my ($l, $r) = split(',', $$sfs{pos});
+ if ($l > $r) {$l--; $o = $r;} else {$r--; $o = $l;};
+ $l = $offsets[$l];
+ $r = $offsets[$r];
+ if ($reverse{$id}){
+ my $tmp = $l;
+ $l = $len - $r + 1;
+ $r = $len - $tmp + 1;
+ }
+ my ($cll, $clr) = split(',', $clears{$$sfs{mid}});
+ if ($l > $r){
+ my $tmp = $cll;
+ $cll = $clr;
+ $clr = $tmp;
+ $tmp = $l;
+ $l = $r;
+ $r = $tmp;
+ }
+
+ $l += $off;
+ $r += $off;
+ $o += $off;
+
+ print CTG "#$seqname{$$sfs{mid}}($o) {$cll $clr} <$l $r>\n";
+ }
+ }
+ } # if contig
+
+ $off += $len;
+
+ if ($reverse{$id}){
+ $consensus = reverseComplement($consensus);
+ }
+ $scaffconsensus .= $consensus;
+
+ if ($i != $#contigs){ # add Ns
+ if (defined $linker){
+ $scaffconsensus .= $linker;
+ $off += length($linker);
+ } else {
+ $off += $gaps[$i];
+ for (my $pad = 0; $pad < $gaps[$i]; $pad++){
+ $scaffconsensus .= "N";
+ }
+ }
+ }
+ }
+ printFastaSequence(\*FASTA, sprintf("%s %d bp %d contigs", $scaff, length($scaffconsensus), $#contigs + 1), $scaffconsensus);
+} # for scaff
+
+close(FASTA);
+close(IN);
+if (defined $contig){
+ close(CTG);
+}
+
+# The end
+exit(0);
+
+
diff --git a/src/Converters/ta2ace.pl b/src/Converters/ta2ace.pl
new file mode 100755
index 0000000..8225816
--- /dev/null
+++ b/src/Converters/ta2ace.pl
@@ -0,0 +1,628 @@
+#!/usr/local/bin/perl
+
+# $Id$
+#
+# Converts from a TIGR .asm file to a new .ace file
+#
+# Copyright @ 2002, The Institute for Genomic Research (TIGR). All
+# rights reserved.
+
+# This software is provided "AS IS". TIGR makes no warranties, express
+# or implied, including no representation or warranty with respect to
+# the performance of the software and derivatives or their safety,
+# effectiveness, or commercial viability. TIGR does not warrant the
+# merchantability or fitness of the software and derivatives for any
+# particular purpose, or that they may be exploited without infringing
+# the copyrights, patent rights or property rights of others. TIGR shall
+# not be liable for any claim, demand or action for any loss, harm,
+# illness or other damage or injury arising from access to or use of the
+# software or associated information, including without limitation any
+# direct, indirect, incidental, exemplary, special or consequential
+# damages.
+
+# This software program may not be sold, leased, transferred, exported
+# or otherwise disclaimed to anyone, in whole or in part, without the
+# prior written consent of TIGR.
+
+use strict;
+use File::Spec;
+use TIGR::Foundation;
+use TIGR::FASTAreader;
+use TIGR::FASTArecord;
+use DBI;
+
+my $base = new TIGR::Foundation;
+
+if (! defined $base){
+ die ("Foundation cannot be created. FATAL!\n");
+}
+
+my $VERSION = 'ta2ace version 1.0 $Revision$ ';
+$base->setVersionInfo($VERSION);
+
+my $GREP = "/bin/grep";
+$base->addDependInfo($GREP);
+
+my %TA2ACEQUAL = (1 => 40,
+ 2 => 40,
+ 3 => 40,
+ 4 => 40,
+ 5 => 40,
+ 6 => 40,
+ 7 => 30,
+ 8 => 30,
+ 9 => 20,
+ 10 => 20,
+ 11 => 20,
+ 12 => 20,
+ 13 => 20,
+ 14 => 20,
+ 15 => 0,
+ 16 => 0,
+ 17 => 0,
+ 18 => 0,
+ 19 => 0,
+ 20 => 0,
+ 21 => 0,
+ 22 => 0,
+ 23 => 0); # TIGR quality class to phrap quality value match
+
+
+my $HELPTEXT = q~
+ ta2ace [opts] [infile]
+
+ Options:
+ -i <infile>.asm TIGR .asm file. Must end in .asm
+ -o <outfile> Output file, by default <infile>.ace
+ -c <chromat_dir> Location of the chromatograms
+ -p <phd_dir> Location of the PHD directory
+ -s <seqfile> Sequence file, by default <infile>.seq
+ -D <db> Database (if not using -i and -s)
+ -S <server> Database info
+ -U <user>
+ -P <pass>
+ -a <asmfile> List of assemblies to put in .ace file
+ ~;
+
+$base->setHelpInfo($HELPTEXT);
+
+my $infile;
+my $outfile;
+my $seqfile;
+my $chromodir = "../chromat_dir";
+my $phddir = "../phd_dir";
+my $asmfile;
+my $dbtype = "Sybase";
+my $dbserver = "SYBTIGR";
+my $dbuser = "access";
+my $dbpass = "access";
+my $db;
+
+my $err = $base->TIGR_GetOptions(
+ "i=s" => \$infile,
+ "o=s" => \$outfile,
+ "c=s" => \$chromodir,
+ "p=s" => \$phddir,
+ "s=s" => \$seqfile,
+ "D=s" => \$db,
+ "a=s" => \$asmfile,
+ "S=s" => \$dbserver,
+ "U=s" => \$dbuser,
+ "P=s" => \$dbpass
+ );
+
+if (! $err){
+ $base->bail("Error processing options!");
+}
+
+if (! defined $infile){
+ $infile = $ARGV[0];
+}
+
+if (defined $infile && $infile !~ /\.t*asm$/){
+ $base->bail("Input file must end in .asm");
+}
+
+my $prefix;
+
+if (defined $infile){
+ $infile =~ /(.*)\.t*asm$/;
+ $prefix = $1;
+}
+
+if (defined $db && defined $infile) {
+ $base->bail("You must use either -D or -i");
+}
+
+if (defined $db && ! defined $asmfile){
+ $base->bail("Option -D requires option -a");
+}
+
+if (! defined $prefix){
+ $prefix = $asmfile;
+}
+
+if (! defined $outfile){
+ $outfile = "$prefix.ace";
+}
+
+if (! defined $seqfile && defined $infile){
+ $seqfile = "$prefix.seq";
+}
+
+# get rid of trailing slashes
+$chromodir =~ s/\/+$//;
+$phddir =~ s/\/+$//;
+
+
+# Here's the process
+#
+# * get contig information and generate contig record in contig temp file
+# * for each of the sequences generate sequence information and store coords in
+# contig writing sequence records in another sequence temp file
+# * generate tiling info and concatenate both temp files into an output temp
+# file
+#
+# * when all contigs are done generate output file header and concatenate
+# output temp file to output.
+
+
+# counters for the useful information
+my $nContigs = 0;
+my $nReads = 0;
+
+my $dbproc;
+my $fr;
+if (defined $db){
+ $dbproc = DBI->connect("dbi:$dbtype:server=$dbserver;packetSize=8092",
+ $dbuser, $dbpass);
+
+ if (! defined $dbproc) {
+ $base->bail("Cannot connect to database server \"$dbserver\"");
+ }
+
+ $dbproc->do("set textsize 50000000") ||
+ $base->bail("Cannot set maximum assembly size");
+
+ $dbproc->do("use $db") ||
+ $base->bail("Cannot select database \"$db\"");
+
+ open(IN, $asmfile) ||
+ $base->bail("Cannot open input file \"$asmfile\" : $!");
+} else {
+ open(IN, $infile) ||
+ $base->bail("Cannot open input file \"$infile\" : $!");
+
+ my @readErr;
+ $fr = new TIGR::FASTAreader($base, \@readErr, $seqfile);
+ if (! defined $fr){
+ while (my $err = pop(@readErr)){
+ $base->logError($err);
+ }
+ $base->bail("Could not read sequence file \"$seqfile\"");
+ }
+} # if defined $db
+
+my $TMP = $$ . time();
+my $dirTmp = $base->getTempDir();
+my $ctgTmp = File::Spec->catfile($dirTmp, "$TMP.CTG.TMP");
+my $seqTmp = File::Spec->catfile($dirTmp, "$TMP.SEQ.TMP");
+my $outTmp = File::Spec->catfile($dirTmp, "$TMP.OUT.TMP");
+
+open(OUT, ">$outTmp") ||
+ $base->bail("Cannot open output temp \"$outTmp\" : $!");
+
+my $inAsm = 1; # are we in an assembly record
+my $nseqs; # number of sequences in this contig
+my $seenseqs; # number of sequences we've actually seen
+my $contigid; # contigId
+my $seqName;
+my %seqClr; # clear range from seq file
+my %seqAlnClr; # clear range from .asm file
+my %seqAlnRng; # assembly range from .asm file
+my %seqOff; # sequence offset
+my %rend; # right end of sequences
+my $cll; # aligned clear range
+my $clr;
+my $al; # aligned coordinates (asm_lend, rend)
+my $ar;
+my $end5; # clear range
+my $end3;
+my $contigLen; # # bases in the contig
+my $contigSeq;
+while (<IN>){
+ my $seq;
+ my $qual;
+ if (defined $db){
+ chomp;
+ $contigid = $_;
+
+ print STDERR "Doing contig $contigid\n";
+ my $ctgQuery = qq~
+ select lsequence, quality, seq\#
+ from assembly
+ where asmbl_id = $contigid
+ ~;
+
+ my $qh = $dbproc->prepare($ctgQuery) ||
+ $base->bail("Cannot prepare query: $ctgQuery");
+
+ $qh->execute() ||
+ $base->bail("Cannot execute query: $ctgQuery");
+
+ my $lineref = $qh->fetchrow_arrayref;
+ $qh->finish;
+
+ $seq = $$lineref[0];
+ $qual = $$lineref[1];
+ $nseqs = $$lineref[2];
+ $seenseqs = 0;
+ }
+# if ($inAsm){ # this is for the contig part of the record
+ if (defined $db || ($inAsm && $_ =~ /^lsequence\t(.*)$/)){
+ open(CTGOUT, ">$ctgTmp") ||
+ $base->bail("Cannot open contig temp \"$ctgTmp\" : $!");
+ if (! defined $db) {
+ $seq = $1;
+ }
+ $seq =~ s/-/*/g;
+ $contigSeq = $seq;
+ $contigLen = length($seq);
+# print "gotseq ", length($seq), "\n";
+ for (my $i = 0; $i < length($seq); $i += 50){
+ print CTGOUT substr($seq, $i, 50), "\n";
+ }
+ print CTGOUT "\n";
+ $nContigs++;
+ }
+
+ if (defined $db || ($inAsm && $_ =~ /^quality\t0x(.*)$/)){
+ if (! defined $db) {
+ $qual = $1;
+ }
+ my @qualvals;
+
+ if (length($qual) / 2 != $contigLen){
+ $base->bail("difference in qualities contig_len=$contigLen, qual_len = " . length($qual) / 2 );
+ }
+
+ for (my $i = 0; $i < length($qual); $i += 2){
+ if (substr($contigSeq, $i / 2, 1) ne "*"){
+ push(@qualvals, hex(substr($qual, $i, 2)));
+ } else {
+ # print "skipping ", $i / 2, "\n";
+ }
+ }
+# print "gotqual ", $#qualvals + 1, " ", length($qual), "\n";
+
+ print CTGOUT "BQ\n";
+
+ @qualvals = map {$_ = (exists $TA2ACEQUAL{$_}) ?
+ $TA2ACEQUAL{$_} :
+ 5} @qualvals;
+
+ for (my $i = 0; $i <= $#qualvals; $i += 50){
+ my $end = $i + 49;
+ if ($end > $#qualvals){
+ $end = $#qualvals;
+ }
+ print CTGOUT " ", join(" ", @qualvals[$i .. $end]), "\n";
+ }
+
+ print CTGOUT "\n";
+ }
+ if (! defined $db && $inAsm && $_ =~ /^asmbl_id\t(\d+)$/){
+ $contigid = $1;
+ print STDERR "Doing contig $contigid\n";
+ }
+ if (! defined $db && $inAsm && $_ =~ /^seq\#\t(\d+)$/){
+ $nseqs = $1;
+ $seenseqs = 0;
+ }
+ if (defined $db || ($inAsm && $_ =~ /^frameshift/)){
+ $inAsm = 0;
+ %seqClr = ();
+ %seqAlnClr = ();
+ %seqAlnRng = ();
+ %seqOff = ();
+ %rend = ();
+ open(SEQOUT, ">$seqTmp") ||
+ $base->bail("Cannot open seq temp \"$seqTmp\" : $!");
+ } # ifs...
+
+
+ my $qh;
+ if (defined $db) {
+ my $seqQuery = qq~
+ select al.seq_name, al.offset, al.seq_lend, al.seq_rend, al.asm_lend, al.asm_rend, f.end5, f.end3, al.lsequence, s.sequence
+ from asmbl_link al, feature f, sequence s
+ where al.asmbl_id = $contigid
+ and s.seq_name = al.seq_name
+ and f.seq_name = al.seq_name
+ and f.feat_type = "CLR"
+ order by al.offset
+ ~;
+
+ $qh = $dbproc->prepare($seqQuery) ||
+ $base->bail("Cannot prepare sequence query \"$seqQuery\"");
+
+ $qh->execute() ||
+ $base->bail("Cannot execute sequence query \"$seqQuery\"");
+ }
+
+ my $step = 1;
+ my $lsequence;
+ my $allseq;
+ while ((defined $db && (my $lineref = $qh->fetchrow_arrayref)) ||
+ (! defined $db && $step > 0)){
+ $step = 0;
+
+ if (defined $db) {
+ $seqName = $$lineref[0];
+ $seqOff{$seqName} = $$lineref[1] + 1;
+ $rend{$seqName} = $$lineref[1] + 1 + length($$lineref[8]);
+ $seqAlnRng{$seqName} = "$$lineref[4] $$lineref[5]";
+ $al = $$lineref[4];
+ $ar = $$lineref[5];
+ $seqAlnClr{$seqName} = "$$lineref[2] $$lineref[3]";
+ $cll = $$lineref[2];
+ $clr = $$lineref[3];
+ $end5 = $$lineref[6];
+ $end3 = $$lineref[7];
+ $lsequence = $$lineref[8];
+ $allseq = $$lineref[9];
+ $seenseqs++;
+ }
+
+ if (! defined $db && ! $inAsm && $_ =~ /^seq_name\t(\S+)$/){
+ $seenseqs++;
+ $seqName = $1;
+ } elsif (! defined $db && ! $inAsm && $_ =~ /^asm_lend\t(\d+)$/){
+ $seqAlnRng{$seqName} = $1;
+ $al = $1;
+ } elsif (! defined $db && ! $inAsm && $_ =~ /^asm_rend\t(\d+)$/){
+ $seqAlnRng{$seqName} .= " $1";
+ $ar = $1;
+ } elsif (! defined $db && ! $inAsm && $_ =~ /^seq_lend\t(\d+)$/){
+ $seqAlnClr{$seqName} = $1;
+ $cll = $1;
+ } elsif (! defined $db && ! $inAsm && $_ =~ /^seq_rend\t(\d+)$/){
+ $seqAlnClr{$seqName} .= " $1";
+ $clr = $1;
+ } elsif (! defined $db && ! $inAsm && $_ =~ /^offset\t(\d+)$/){
+ $seqOff{$seqName} = $1 + 1;
+ }
+
+ if (defined $db || (! $inAsm && $_ =~ /^lsequence\t(.*)$/)){
+ if (! defined $db) {
+ $lsequence = $1;
+ $rend{$seqName} = $seqOff{$seqName} + length($lsequence);
+ }
+ my $ori = ($cll > $clr) ? "C" : "U";
+
+ if (! defined $db){
+ my $sr = $fr->getRecordByIdentifier($seqName);
+ if (! defined $sr){
+ $base->logError("Cannot find record for sequence \"$seqName\"", 1);
+ }
+ my $head = $sr->getHeader();
+ $allseq = $sr->getData(); # the whole sequence
+ if ($head =~ /^>\S+\s+\d+\s+\d+\s+\d+\s+(\d+)\s+(\d+)\s*$/){
+ $seqClr{$seqName} = "$1 $2";
+ $end5 = $1;
+ $end3 = $2;
+ } else {
+ $base->logError("Cannot find clear range for sequence \"$seqName\"", 1);
+ $end5 = 1;
+ $end3 = length($allseq);
+ $seqClr{$seqName} = "$end5 $end3";
+ $base->logError("Assuming $end5 - $end3\n", 1);
+ }
+ } # if ! defined $db
+
+ if ($ori eq "C") { # make it all forward, we'll complement it again later
+ $lsequence = reverseComplement($lsequence);
+ my $tmp = $cll;
+ $cll = $clr;
+ $clr = $tmp;
+ }
+
+# print "$seqName $cll $clr\n";
+
+ my $begin = substr($allseq, 0, $cll - 1);
+ my $end = substr($allseq, $clr);
+
+# print length($allseq), " = ", length($begin), " + ", length($lsequence) , " + ", length($end), "\n";
+
+ my $off = $seqOff{$seqName};
+ if ($ori eq "C") {
+ $off -= length($end);
+ } else {
+ $off -= length($begin);
+ }
+
+ print CTGOUT "AF $seqName $ori $off\n";
+
+ my $outseq = $begin . $lsequence;
+ $end3 = $end3 - $clr + length($outseq); # adjust for gaps in lseq.
+ $clr = length($outseq);
+ $outseq .= $end;
+
+
+ # now outseq is an lsequence together with the untrimmed stuff
+ # moreover $clr $cll $end5 and $end3 are all coordinates in the
+ # forward strand
+ if ($ori eq "C"){
+ $outseq = reverseComplement($outseq);
+ $cll = length($outseq) - $cll + 1;
+ $clr = length($outseq) - $clr + 1;
+ $end5 = length($outseq) - $end5 + 1;
+ $end3 = length($outseq) - $end3 + 1;
+
+ my $tmp = $cll;
+ $cll = $clr;
+ $clr = $tmp;
+
+ $tmp = $end5;
+ $end5 = $end3;
+ $end3 = $tmp;
+
+ }
+ $nReads++;
+
+ $outseq =~ s/-/*/g;
+
+ print SEQOUT "RD $seqName ", length($outseq), " 0 0\n";
+ for (my $i = 0; $i <= length($outseq); $i += 50){
+ print SEQOUT substr($outseq, $i, 50), "\n";
+ }
+ print SEQOUT "\n";
+
+ print SEQOUT "QA $end5 $end3 $cll $clr\n";
+
+ my $chrmfile = $chromodir . "/$seqName";
+ my $phdfile = $phddir . "/$seqName.phd.1";
+
+ my $time;
+
+ if (-r $phdfile){
+ $time = `$GREP TIME $phdfile`;
+ $time =~ s/TIME: //;
+ }
+
+ if (! defined $time){
+ $base->logError("Cannot stat phd file \"$phdfile\"", 1);
+ $time = localtime;
+ }
+
+ my $dir = ($ori eq "C") ? "rev" : "forw";
+
+ print SEQOUT "DS CHROMAT_FILE: $chrmfile PHD_FILE: $phdfile TIME: $time\n"; # CHEM: unknown DYE: big TEMPLATE: $seqName DIRECTION: $dir\n";
+
+ if ($seenseqs == $nseqs){ # we are at the end of a record
+ close(SEQOUT);
+
+ # this is where we deal with BSs
+ my $prev;
+ my $nBS = 0;
+ foreach my $sequence ( sort {($seqOff{$a} == $seqOff{$b}) ? ($rend{$b} <=> $rend{$a}) : ($seqOff{$a} <=> $seqOff{$b})} (keys %seqOff)) {
+ if (defined $prev) {
+ if ($seqOff{$sequence} - 1 < $seqOff{$prev} ||
+ $rend{$sequence} < $rend{$prev}){
+ next;
+ }
+ $nBS++;
+ print CTGOUT "BS $seqOff{$prev} ", $seqOff{$sequence} - 1, " $prev\n";
+ }
+ $prev = $sequence;
+ }
+ $nBS++;
+ print CTGOUT "BS $seqOff{$prev} $contigLen $prev\n";
+ close(CTGOUT);
+
+ print OUT "CO $contigid $contigLen $nseqs $nBS U\n";
+ open(CTGOUT, "$ctgTmp") ||
+ $base->bail("Cannot open \"$ctgTmp\": $!");
+ while (<CTGOUT>){
+ print OUT;
+ }
+ close(CTGOUT);
+ print OUT "\n";
+ open(SEQOUT, "$seqTmp") ||
+ $base->bail("Cannot open \"$seqTmp\": $!");
+ while (<SEQOUT>){
+ print OUT;
+ }
+ close(SEQOUT);
+ print OUT "\n";
+
+ $inAsm = 1; # switch back to assembly mode
+ open(CTGOUT, ">$ctgTmp") ||
+ $base->bail("Cannot open contig temp \"$ctgTmp\" : $!");
+ } # if $seenseqs = $nseqs
+ } # if lsequence
+ } # if $inAsm
+} # while (<IN>)
+
+close(CTGOUT);
+close(OUT);
+
+# now we need to create the output file and attach to it the temp file.
+open(OUT, ">$outfile") ||
+ $base->bail("Cannot open output file \"$outfile\": $!");
+
+print OUT "AS $nContigs $nReads\n\n";
+
+open(TMP, "$outTmp") ||
+ $base->bail("Cannot open temp file \"$outTmp\" : $!");
+while (<TMP>){
+ print OUT;
+}
+close(TMP);
+
+# now print some info
+print OUT "WA{\n";
+print OUT "TA_convert $VERSION\n";
+my $time = `date`;
+chomp $time;
+print OUT "Run by $ENV{USER} on $time\n";
+print OUT "}\n";
+close(OUT);
+
+# then remove all the temp files
+unlink($outTmp, $seqTmp, $ctgTmp);
+
+exit(0);
+
+sub reverseComplement {
+ my($string) = @_;
+ my($rev) = "";
+
+ my(%complement) = (
+ 'A' => 'T',
+ 'T' => 'A',
+ 'C' => 'G',
+ 'G' => 'C',
+ 'U'=> 'A',
+ 'M'=> 'K',
+ 'R'=> 'Y',
+ 'W'=> 'W',
+ 'S'=> 'S',
+ 'Y'=> 'R',
+ 'K'=> 'M',
+ 'V'=> 'B',
+ 'H'=> 'D',
+ 'D'=> 'H',
+ 'B'=> 'V',
+ 'X'=> 'N',
+ 'N'=> 'N',
+ '.'=> '.',
+ '-'=> '-',
+ 'a' => 't',
+ 't' => 'a',
+ 'c' => 'g',
+ 'g' => 'c',
+ 'u'=> 'a',
+ 'm'=> 'k',
+ 'r'=> 'y',
+ 'w'=> 'w',
+ 's'=> 's',
+ 'y'=> 'r',
+ 'k'=> 'm',
+ 'v'=> 'b',
+ 'h'=> 'd',
+ 'd'=> 'h',
+ 'b'=> 'v',
+ 'x'=> 'n',
+ 'n'=> 'n'
+ );
+
+ $string = reverse ($string);
+
+ my ($i);
+ for ($i = 0; $i < length($string); $i++){
+ substr($string, $i, 1, $complement{substr($string, $i, 1)});
+ }
+
+ return $string;
+} # reverseComplement
diff --git a/src/Converters/tarchive2amos.pl b/src/Converters/tarchive2amos.pl
new file mode 100755
index 0000000..58864e5
--- /dev/null
+++ b/src/Converters/tarchive2amos.pl
@@ -0,0 +1,1172 @@
+#!/usr/bin/perl
+
+use strict;
+
+use AMOS::AmosLib;
+use AMOS::ParseFasta;
+use AMOS::AmosFoundation;
+use TIGR::Foundation;
+use XML::Parser;
+use IO::Handle;
+use File::Spec;
+
+my $MINSEQ = 0;
+my $MAXSEQ = undef;
+my $DEFAULT_QUAL = 20;
+
+my $tag; # XML tag
+my $library;
+my $template;
+my $clipl;
+my $clipr;
+my $mean;
+my $stdev;
+my $end;
+my $seqId;
+
+my %end5; # the reads at the 5', resp. 3', end of an insert
+my %end3;
+my %means; # mean and standard deviation for libraries
+my %libraries; # all libraries in the input
+my %stdevs;
+my %clr; # clear range for each sequence
+my %seq2ins; # insert name for each sequence
+my %ins2lib; # library name for each insert
+my %lib2id; # mapping from library name to iid
+my %ins2id; # mapping from insert name to iid
+my %seq2id; # mapping from read name to iid
+
+my @libregexp; # when using mates files contains list of libraries regular expressions
+my @libnames; # library names corresponding to the regular expressions
+my @pairregexp; # read mating regular expressions
+
+my $gzip = "gzip";
+
+#getTempDir() function is located in TIGR::Foundation
+my $tigrbase = new TIGR::Foundation;
+if (! defined $tigrbase)
+{
+ die ("Walk, do not run, to the nearest exit!\n");
+}
+
+my $tmprefix = "tmp.$$";
+my $tmpdir = $tigrbase->getTempDir();
+my $tmpfile = File::Spec->catfile($tmpdir, "$tmprefix.red");
+
+my $base = new AMOS::AmosFoundation;
+if (! defined $base) {
+ die ("Walk, do not run, to the nearest exit!\n");
+}
+#$base->setLogLevel(1);
+
+my $VERSION = '$Revision$ ';
+$base->setVersion($VERSION);
+
+$base->setLogFile("tarchive2amos.log");
+$base->setMihaiMode();
+
+my $HELPTEXT = qq~
+.USAGE.
+ tarchive2amos -o <prefix> [options] fasta1 ... fastan
+
+.DESCRIPTION.
+ This program takes a files from the NCBI trace archive and produces
+ an afg file for AMOS.
+
+ <prefix> - prefix for the output files
+
+ fasta1 ... fastan - list of files to be converted.
+
+ The program assumes that for each file called <file>.seq there
+ is a <file>.qual and a <file>.xml. (alternatively the files may
+ be called fasta.<file>, qual.<file> and xml.<file>).
+ If no .xml file is present the program will only produce a set of
+ RED (read) records.
+
+
+.OPTIONS.
+ -assembly <assembly> - XML file containing assembly in assembly archive format
+ http://www.ncbi.nlm.nih.gov/Traces/assembly/assmbrowser.cgi
+ usually named ASSEMBLY.xml in the tar-ball downloaded from NCBI
+
+ -tracedir <tracedir> - directory containing the trace information as downloaded
+ from the NCBI, either from the assembly archive or through
+ a direct query in the trace archive. This directory must contain
+ a file named TRACEINFO.xml as well as one or more subdirs
+ containing the trace information for the organism(s) whose
+ traces are being processed.
+
+ -c <clip> - file containing clear ranges for the reads. If this file
+ is provided, any sequence that does not appear in it is
+ excluded from the output.
+
+ -m <mates> - file containing mate-pair information as specified in the
+ BAMBUS documentation. This file replaces information
+ provided in .xml files
+
+ -l <lib> - file containing mean/stdev information for libraries.
+ Overrides .xml input.
+
+ -i <id> - start numbering messages with id <id>
+ (useful when appending to a bank)
+
+ -min <minlen> - reads shorter than <minlen> are rejected (default $MINSEQ)
+ -max <maxlen> - reads longer than <maxlen> are rejected (default no limit)
+
+ -qual <qval> - default quality value assigned when no quality file is
+ provided (default $DEFAULT_QUAL)
+
+.KEYWORDS.
+ converters, trace archive, AMOS
+
+~;
+
+$base->setHelpText($HELPTEXT);
+
+my $outprefix;
+my $clears;
+my $mates ; # name of file containing mate pairs
+my $ID = 1;
+my $TEM_ID = 1; # generic identifier for reads with no template
+my $silent = undef;
+my $libs;
+my $aaxmlname = undef;
+my $tracedir = undef;
+my $err = $base->getOptions("o=s" => \$outprefix,
+ "c=s" => \$clears,
+ "m=s" => \$mates,
+ "l=s" => \$libs,
+ "i=i" => \$ID,
+ "silent" => \$silent,
+ "min=i" => \$MINSEQ,
+ "max=i" => \$MAXSEQ,
+ "qual=i" => \$DEFAULT_QUAL,
+ "assembly=s" => \$aaxmlname,
+ "tracedir=s" => \$tracedir
+ );
+
+if ($err == 0) {
+ $base->bail("Command line processing failed\n");
+}
+
+if (! defined $outprefix) {
+ $base->bail("A prefix must be set with option -o\n");
+}
+
+my $xml = new XML::Parser(Style => 'Stream');
+if (!defined $xml) {
+ $base->bail("Cannot create an XML parser");
+}
+
+
+my %clones;
+my %seqs;
+my %lib ;
+
+my $fragname;
+if ($outprefix =~ /\.afg$/) {
+ $fragname = $outprefix;
+} else {
+ $fragname = "$outprefix.afg";
+}
+
+if (defined $libs) {
+ print STDERR "Reading library information\n" unless $silent;
+ open(LIB, $libs) || die ("Cannot open $libs: $!");
+ while (<LIB>) {
+ chomp;
+ if (/^(\S+)\t(\d+.?\d*)\t(\d+.?\d*)$/) {
+ $means{$1} = $2;
+ $stdevs{$1} = $3;
+ } else {
+ print STDERR "Cannot parse line $. of $libs: $_\n";
+ }
+ }
+ close(LIB);
+}
+
+# get the clear ranges if externally determined
+if (defined $clears) {
+ # print "Processing $clears\n";
+ print STDERR "Processing clear ranges\n" unless $silent;
+ open(CLR, $clears) || $base->bail("Cannot open $clears: $!\n");
+ while (<CLR>) {
+ chomp;
+ my @fields = split(' ', $_);
+ # if ($fields[0] =~ /gnl\|ti\|/){
+ $fields[0] =~ s/gnl\|ti\|//;
+ # }
+ $clr{$fields[0]} = "$fields[1],$fields[2]";
+ # print "clear is $fields[0] $fields[1] $fields[2]\n";
+ }
+ close(CLR);
+}
+
+# first we figure out which files we'll use
+my @seqfiles;
+my @qualfiles;
+my @xmlfiles;
+my $hasxml;
+
+
+print STDERR "Collecting file information\n" unless $silent;
+if (defined $tracedir){
+### Here we process an NCBI traces/ directory, as downloaded from the assembly archive
+### or from a direct query from the trace archive
+### Files downloaded with FTP from the trace archive directly have a different format
+###
+### We assume the following directory structure
+###
+### traces/ - directory pointed at by $tracedir
+### traces/TRACEINFO.xml - XML summary
+### traces/MYORGANISM/ - sub-directory(ies) organized by organism
+### traces/MYORGANISM/MYCENTER - sub-directory(ies) organized by sequencing center
+### traces/MYORGANISM/MYCENTER/fasta - directory containing all the sequence records
+### traces/MYORGANISM/MYCENTER/qscore - directory containing all the quality records
+
+ push @xmlfiles, "$tracedir/TRACEINFO.xml";
+ my @orgnames = (); # organisms
+
+ opendir(TOP, $tracedir) || $base->bail ("Cannot open $tracedir: $!\n");
+ while (my $fn = readdir(TOP)){
+ if ($fn eq "." || $fn eq "..") {next;}
+ if (-d "$tracedir/$fn") {
+ push @orgnames, "$tracedir/$fn";
+# print "GOT $fn\n";
+ }
+ } # for each top file
+ closedir(TOP);
+
+ for (my $org = 0; $org <= $#orgnames; $org++){
+ my @centers = (); #
+ print STDERR "Processing $orgnames[$org]\n" unless $silent;
+ opendir(ORG, $orgnames[$org]) || $base->bail ("Cannot open $orgnames[$org]:$!\n");
+ while (my $fn = readdir(ORG)){
+ if ($fn eq "." || $fn eq "..") {next;}
+ if (-d "$orgnames[$org]/$fn"){
+ push @centers, "$orgnames[$org]/$fn";
+# print "GOT $fn\n";
+ }
+ } # for each organism subdir
+
+ for (my $ctr = 0; $ctr <= $#centers; $ctr++){
+ print STDERR "Processing $centers[$ctr]\n" unless $silent;
+ opendir(FA, "$centers[$ctr]/fasta") || $base->bail ("Cannot open fasta dir in $centers[$ctr]: $!\n");
+ my %qfs;
+ if (opendir(QU, "$centers[$ctr]/qscore")){
+ while (my $fn = readdir(QU)){
+ $qfs{$fn} = 1;
+ }
+ closedir(QU);
+ }
+
+ my $filenum = 0;
+ while (my $fn = readdir(FA)){
+ if ($fn =~ /^(\S+)\.fasta$/){
+ push @seqfiles, "$centers[$ctr]/fasta/$fn";
+# print "got $centers[$ctr]/fasta/$fn\n";
+ if (exists $qfs{"$1.qscore"}){
+ push @qualfiles, "$centers[$ctr]/qscore/$1.qscore";
+# print "got $centers[$ctr]/qscore/$1.qscore\n";
+ } else {
+ push @qualfiles, "";
+ }
+ if (! defined $silent && ($filenum++ % 100 == 0)) {
+ print STDERR "$filenum\r";
+ }
+ }
+ }
+ print STDERR "$filenum files\n" unless $silent;
+ } # for each center
+ } # for each organism
+} else {
+ for (my $f = 0; $f <= $#ARGV; $f++) {
+ my $seqname = $ARGV[$f];
+ my $qualname;
+ my $xmlname;
+ my $prefix;
+
+ if ($seqname =~ /fasta\.(.*)(\.gz)?/) {
+ $prefix = $1;
+ $qualname = "qual.${prefix}$2";
+ $xmlname = "xml.${prefix}$2";
+ } elsif ($seqname =~ /(.*)\.seq(\.gz)?/) {
+ $prefix = $1;
+ $qualname = "${prefix}.qual$2";
+ $xmlname = "${prefix}.xml$2";
+ } else {
+ $base->bail("Fasta file ($seqname) must be called either fasta.<file> or <file>.seq\n");
+ }
+
+ if (! -e $qualname) {
+ $base->log("Cannot find the qual file corresponding to $seqname\n", 1);
+ $qualname = "";
+ }
+
+ if (! -e $xmlname) {
+ $base->log("Cannot find the xml file corresponding to $seqname\n");
+ } else {
+ push @xmlfiles, $xmlname;
+ }
+
+ push @seqfiles, $seqname;
+ push @qualfiles, $qualname;
+ }
+
+ if ($#xmlfiles <= $#ARGV) { # fewer XML files than inputs
+ $hasxml = 0;
+ } else {
+ $hasxml = 1;
+ }
+
+} # if parameters provided on command line
+
+if ($#xmlfiles >= 0) {
+ print STDERR "Parsing the XML files\n" unless $silent;
+}
+## Parse XML information
+for (my $f = 0; $f <= $#xmlfiles; $f++) {
+ my $xmlname = $xmlfiles[$f];
+
+ my $XML = new IO::Handle;
+
+ if ($xmlname =~ /\.gz$/) {
+ open($XML, "$gzip -dc $xmlname |") ||
+ $base->bail("Cannot open $xmlname: $!\n");
+ } else {
+ open($XML, "$xmlname") ||
+ $base->bail("Cannot open $xmlname: $!\n");
+ }
+
+ $xml->parse($XML);
+
+ close($XML);
+} # parse xml
+
+
+## Parse .mates file, if provided
+if (defined $mates) {
+ print STDERR "Parsing mates information\n" unless $silent;
+ open(MATES, $mates) || $base->bail("Cannot open $mates: $!\n");
+
+ while (<MATES>) {
+ chomp;
+ if (/^library/) {
+ my @recs = split('\t', $_);
+
+ if ($#recs < 3 || $#recs > 4) {
+ $base->log("Improperly formated line $. in \"$mates\".\nMaybe you didn't use TABs to separate fields\n", 1);
+ next;
+ }
+
+ if ($#recs == 4) {
+ push(@libregexp, $recs[4]);
+ push(@libnames, $recs[1]);
+ }
+
+ my $mean = ($recs[2] + $recs[3]) / 2;
+ my $stdev = ($recs[3] - $recs[2]) / 6;
+
+ $libraries{$recs[1]} = $mean;
+
+ $means{$recs[1]} = $mean;
+ $stdevs{$recs[1]} = $stdev;
+
+ next;
+ } # if library
+
+ if (/^pair/) {
+ my @recs = split('\t', $_);
+ if ($#recs != 2) {
+ $base->log("Improperly formated line $. in \"$mates\".\nMaybe you didn't use TABs to separate fields\n");
+ next;
+ }
+ push(@pairregexp, "$recs[1] $recs[2]");
+ next;
+ }
+
+ if (/^\#/) { # comment
+ next;
+ }
+
+ if (/^\s*$/) { # empty line
+ next;
+ }
+
+ # now we just deal with the pair lines
+ my @recs = split('\t', $_);
+ if ($#recs < 1 || $#recs > 2) {
+ $base->log("Improperly formated line $. in \"$mates\".\nMaybe you didn't use TABs to separate fields\n");
+ next;
+ }
+
+ my $insname = getId();
+ $ins2id{$insname} = $insname;
+
+ if (defined $recs[2]) {
+ $ins2lib{$insname} = $recs[2];
+ } else {
+ $base->log("$insname has no library\n");
+ }
+
+ $end5{$insname} = $recs[0];
+ $end3{$insname} = $recs[1];
+
+ $seq2ins{$recs[0]} = $insname;
+ $seq2ins{$recs[1]} = $insname;
+ } # while <MATES>
+
+ close(MATES);
+} # parse .mates
+
+
+print STDERR "Processing the files\n" unless $silent;
+
+## get ready to produce the output
+open(FRAG, ">$fragname") || $base->bail("Cannot open $fragname: $!");
+printFragHeader(\*FRAG);
+
+open(TMPRED, ">$tmpfile") || $base->bail("Cannot open $tmpfile: $!\n");
+
+## now we are ready to print the library information
+while (my ($lib, $mean) = each %libraries) {
+ $mean = $means{$lib};
+ if (! defined $mean) {
+ $mean = 33333;
+ $stdevs{$lib} = 3333.3;
+ $base->log("No mean found for $lib, setting to 33333\n");
+ }
+ if (! defined $stdevs{$lib}){
+ $stdevs{$lib} = $mean / 10;
+ }
+ my $libid = getId();
+ $lib2id{$lib} = $libid;
+
+ print FRAG "{LIB\n";
+ print FRAG "iid:$libid\n";
+ print FRAG "eid:$lib\n";
+ print FRAG "{DST\n";
+ print FRAG "mea:$mean\n";
+ print FRAG "std:$stdevs{$lib}\n";
+ print FRAG "}\n";
+ print FRAG "}\n";
+} # print library info
+
+## process seq and qual files
+my $hasqual;
+for (my $f = 0; $f <= $#seqfiles; $f++) {
+ # for each file
+ # read the seq and qual files
+ my $seqname = $seqfiles[$f];
+ my $qualname = $qualfiles[$f];
+ my $prefix;
+
+ if ($qualname eq ""){
+ $hasqual = 0;
+ } else {
+ $hasqual = 1;
+ }
+
+ if ($seqname =~ /\.gz$/) {
+ open(SEQ, "$gzip -dc $seqname |") ||
+ $base->bail("Cannot open $seqname: $!\n");
+ } else {
+ open(SEQ, "$seqname") ||
+ $base->bail("Cannot open $seqname: $!\n");
+ }
+
+ if ($hasqual == 1) {
+ if ($qualname =~ /\.gz$/) {
+ open(QUAL, "$gzip -dc $qualname |") ||
+ $base->bail("Cannot open $qualname: $!\n");
+ } else {
+ open(QUAL, "$qualname") ||
+ $base->bail("Cannot open $qualname: $!\n");
+ }
+ }
+
+ if (! defined $silent && ! defined $tracedir) {
+ print STDERR "Parsing $seqname and $qualname\n";
+ }
+
+ my $seqparse = new AMOS::ParseFasta(\*SEQ);
+ my $qualparse;
+ if ($hasqual == 1) {
+ $qualparse = new AMOS::ParseFasta(\*QUAL, ">", " ");
+ }
+
+ my $fhead; my $frec;
+ my $qhead; my $qrec;
+
+ while (($fhead, $frec) = $seqparse->getRecord()) {
+ my $qid;
+ my $fid;
+ my $fidname;
+
+ if ($hasqual == 1) {
+ ($qhead, $qrec) = $qualparse->getRecord();
+ $qhead =~ /^(\S+)/;
+ $qid = $1;
+ $fhead =~ /^(\S+)/;
+ $fid = $1;
+
+ # print "$fid and $qid match\n";
+
+ if ($fid ne $qid) {
+ $base->bail("fasta and qual records have different IDs: $fid vs $qid\n");
+ }
+ }
+
+ if ($fhead =~ /^(\S+)\s+\d+\s+\d+\s+\d+\s+(\d+)\s+(\d+)/) {
+ # if TIGR formatted, fetch the clear range
+ # print STDERR "got TIGR: $1 $2 $3\n";
+ my $l = $2;
+ my $r = $3;
+ $l--;
+ $fidname = $1;
+ $fid = $1;
+ if (defined $clears && ! exists $clr{$fid}) {
+ # clear range file decides which sequences stay and which go
+ next;
+ }
+ # allow XML or clear file to override the clear range info
+ if (! exists $clr{$fid}) {
+ $clr{$fid} = "$l,$r";
+ }
+ } elsif ($fhead =~ /^gnl\|ti\|(\d+).* name:(\S+)/ ||
+ $fhead =~ /^gnl\|ti\|(\d+)\s+(\S+)/) {
+ # print "got ncbi: $1 $2\n";
+ # NCBI formatted using keywords
+ $fid = $1;
+ $fidname = $2;
+ if (defined $clears &&
+ ! exists $clr{$fid} &&
+ ! exists $clr{$fidname}) {
+ # clear range file decides with sequences stay and which go
+ $base->log("Couldn't find clear for $fid or $fidname\n");
+ next;
+ }
+ if (exists $clr{$fidname} && ! exists $clr{$fid}) {
+ $clr{$fid} = $clr{$fidname};
+ }
+ } elsif ($fhead =~ /^ ?(\S+) ?(\S+)?/) {
+ # print STDERR "got ncbi: $1 $2\n";
+ # NCBI formatted, first is the trace id then the trace name
+ $fid = $1;
+ $fidname = $2;
+
+ if (! defined $fidname || $fidname eq "bases") {
+ $fidname = $fid;
+ }
+
+ if (defined $clears &&
+ ! exists $clr{$fid} &&
+ ! exists $clr{$fidname}) {
+ $base->log("Couldn't find clear for $fid or $fidname\n");
+ # clear range file decides which sequences stay and which go
+ next;
+ }
+ if (exists $clr{$fidname} && ! exists $clr{$fid}) {
+ $clr{$fid} = $clr{$fidname};
+ }
+ } # processing depending on FASTA header
+
+ my $recId = getId();
+
+ if (defined $mates) {
+ for (my $r = 0; $r <= $#pairregexp; $r++) {
+ my ($freg, $revreg) = split(' ', $pairregexp[$r]);
+ my $insertname = undef;
+ if ($fidname =~ /$freg/) {
+ $insertname = $1;
+ $seq2ins{$fidname} = $insertname;
+ if (! exists $end5{$insertname} ||
+ $end5{$insertname} lt $fidname) {
+ $end5{$insertname} = $fidname;
+ }
+ } elsif ($fidname =~ /$revreg/) {
+ $insertname = $1;
+ $seq2ins{$fidname} = $insertname;
+ if (! exists $end3{$insertname} ||
+ $end3{$insertname} lt $fidname) {
+ $end3{$insertname} = $fidname;
+ }
+ } elsif ($fid =~ /$freg/) {
+ $insertname = $1;
+ $seq2ins{$fid} = $insertname;
+ if (! exists $end5{$insertname} ||
+ $end5{$insertname} lt $fid) {
+ $end5{$insertname} = $fid;
+ }
+ } elsif ($fid =~ /$revreg/) {
+ $insertname = $1;
+ $seq2ins{$fid} = $insertname;
+ if (! exists $end3{$insertname} ||
+ $end3{$insertname} lt $fid) {
+ $end3{$insertname} = $fid;
+ }
+ } # if forw or rev regexp match
+
+ if (defined $insertname) {
+ my $found = 0;
+
+ if (! exists $ins2id{$insertname}) {
+ $ins2id{$insertname} = getId();
+ }
+
+ for (my $l = 0; $l <= $#libregexp; $l++) {
+ if ($fidname =~ /$libregexp[$l]/) {
+ $ins2lib{$insertname} = $libnames[$l];
+ $found = 1;
+ last;
+ } elsif ($fid =~ /$libregexp[$l]/) {
+ $ins2lib{$insertname} = $libnames[$l];
+ $found = 1;
+ last;
+ }
+ }
+ if ($found == 0) {
+ $base->log("Cannot find library for \"$insertname\"");
+ }
+
+ last;
+ } # if found insert
+ } # for each pairreg
+ } # if defined mates
+
+ my $seqlen = length($frec);
+ my @quals = ();
+ if ($hasqual == 1) {
+ # print $fid, "\n";
+ # print $qid, "\n";
+ # print $qrec, "\n";
+ $qrec =~ s/^\s+//;
+ # $qrec =~ s/ +/ /g;
+ @quals = split(/\s+/, $qrec);
+ # print join(',', @quals), "\n";
+ if ($#quals + 1 != $seqlen) {
+ # print join(',', @quals), "\n";
+ $base->bail("Fasta and quality for $fid($fidname) disagree: $seqlen vs " . sprintf("%d\n", $#quals + 1));
+ }
+ } else {
+ for (my $q = 0; $q < $seqlen; $q++) { # fill in qualities with 20
+ $quals[$q] = $DEFAULT_QUAL;
+ }
+ }
+
+ my $caqual = "";
+ for (my $q = 0; $q <= $#quals; $q++) {
+ my $qv = $quals[$q];
+ if ($qv > 60) {
+ $qv = 60;
+ }
+
+ $caqual .= chr(ord('0') + $qv);
+ }
+
+ if (! defined $silent && ($recId % 100 == 0)) {
+ print STDERR "$recId\r";
+ }
+
+ if (! exists $clr{$fid}) {
+ $clr{$fid} = "0,$seqlen";
+ }
+
+ $seq2id{$fidname} = $recId;
+ $seq2id{$fid} = $recId;
+
+ my $seq_lend;
+ my $seq_rend;
+
+ ($seq_lend, $seq_rend) = split(',', $clr{$fid});
+
+ if (defined $MAXSEQ && $seqlen > $MAXSEQ) {
+ $frec = substr($frec, 0, $seq_rend + 1);
+ $caqual = substr($caqual, 0, $seq_rend + 1);
+ $seqlen = length($frec);
+ if (defined $MAXSEQ && $seqlen > $MAXSEQ) {
+ if (! defined $silent) {
+ $base->log("skipping sequence $fidname due to length $seqlen\n");
+ }
+ delete $seq2id{$fidname};
+ delete $seq2id{$fid};
+ next;
+ }
+ }
+ if ($seq_rend - $seq_lend < $MINSEQ) {
+ if (! defined $silent) {
+ $base->log("skipping sequence $fidname since it's short\n");
+ }
+ delete $seq2id{$fidname};
+ delete $seq2id{$fid};
+ next;
+ }
+
+ if (! exists $seq2ins{$fid} && exists $seq2ins{$fidname}) {
+ $seq2ins{$fid} = $seq2ins{$fidname};
+ }
+
+ if (! exists $seq2ins{$fid} ||
+ ! exists $ins2id{$seq2ins{$fid}}) {
+ if ($hasxml || defined $mates) {
+ $base->log("Found a sequence without a template - probably not in XML or mates file: $fidname\n");
+ next;
+ } #else {
+ # $seq2ins{$fid} = 0; #insid
+ # $ins2id{0} = 0; #$insid;
+ # }
+ }
+
+ print TMPRED "{RED\n"; # read
+ print TMPRED "iid:$recId\n";
+ print TMPRED "eid:$fid\n";
+ print TMPRED "seq:\n";
+ $frec =~ s/[^actgnACTGN]/N/g;
+ for (my $s = 0; $s < $seqlen; $s += 60) {
+ print TMPRED substr($frec, $s, 60), "\n";
+ }
+ print TMPRED ".\n";
+ print TMPRED "qlt:\n";
+ for (my $s = 0; $s < $seqlen; $s += 60) {
+ print TMPRED substr($caqual, $s, 60), "\n";
+ }
+ if ($seq_rend > $seqlen) {
+ $base->log("right end of clear range $seq_rend > $seqlen - shrinking it\n");
+ $seq_rend = $seqlen;
+ }
+ print TMPRED ".\n";
+ if (exists $ins2id{$seq2ins{$fid}}) {
+ print TMPRED "frg:$ins2id{$seq2ins{$fid}}\n";
+ }
+ print TMPRED "clr:$seq_lend,$seq_rend\n";
+ print TMPRED "}\n";
+ } # while each read
+
+ if (! defined $silent && ! defined $tracedir) {
+ print STDERR "done\n";
+ }
+ close(SEQ);
+ close(QUAL);
+}
+close(TMPRED);
+
+if (! defined $silent) {
+ print STDERR "doing fragments\n";
+}
+
+while (my ($ins, $id) = each %ins2id) {
+ print FRAG "{FRG\n";
+ print FRAG "iid:$id\n";
+ print FRAG "eid:$ins\n";
+ print FRAG "lib:$lib2id{$ins2lib{$ins}}\n";
+ print FRAG "typ:I\n";
+
+ if ( exists $end5{$ins} && exists $end3{$ins} &&
+ exists $seq2id{$end5{$ins}} && exists $seq2id{$end3{$ins}}) {
+ print FRAG "rds:$seq2id{$end5{$ins}},$seq2id{$end3{$ins}}\n";
+ }
+
+ print FRAG "}\n";
+}
+
+if (! defined $silent) {
+ print STDERR "putting it together\n";
+}
+
+if (-f $tmpfile) {
+ open(TMPRED, $tmpfile) || $base->bail("Cannot open $tmpfile:$!\n");
+ while (<TMPRED>) {
+ print FRAG;
+ }
+ close(TMPRED);
+ unlink($tmpfile) || $base->bail("Cannot remove $tmpfile: $!\n");
+}
+
+###
+# added assembly archive conversion
+###
+my $aatag;
+my $aaptag;
+my $aavalid = 0;
+my $aaiid = 1;
+my $clr1 = 0;
+my $clr2 = 0;
+my @congaps;
+my $gval;
+my $cval;
+
+sub Start_handler {
+ my $p = shift;
+ my $el = shift;
+ $aaptag = $aatag;
+ $aatag = lc($el);
+
+ if ($aatag eq "contig") {
+ my ($attr, $cval) = @_;
+ print "\n\n contig $cval \n";
+ print FRAG "\n{CTG\n";
+ print FRAG "iid:$aaiid\n";
+ print FRAG "sts:C\n";
+ print FRAG "eid:Contig$aaiid-$cval\n";
+ $aaiid++;
+ } elsif ($aatag eq "consensus") {
+ print FRAG "seq:\n";
+ } elsif ($aatag eq "conqualities") {
+ print FRAG "qlt:\n";
+ } elsif ($aatag eq "trace") {
+ print FRAG "{TLE\n";
+ } elsif ($aatag eq "valid") {
+ $aavalid = 1;
+ } elsif ($aatag eq "tiling") {
+ my $attr;
+ ($attr, $gval) = @_;
+ if (lc($gval) eq "reverse") {
+ print FRAG "clr:$clr2,$clr1\n";
+ } else {
+ print FRAG "clr:$clr1,$clr2\n";
+ }
+ $clr1 = 0; $clr2 = 0;
+ }
+}
+
+my $contig_seq = "";
+my $contig_qual = "";
+my $ti_global = "";
+
+sub Char_handler {
+ my ($p, $data) = @_;
+ my $el = lc($p->current_element);
+
+ if ($el eq "consensus") {
+ chomp($data);
+ $contig_seq .= $data;
+ } elsif ($el eq "conqualities") {
+ chomp($data);
+ $data =~ s/^ //;
+ my @quals = split / +/, $data;
+
+ for (my $q = 0; $q <= $#quals; $q++) {
+ my $qv = $quals[$q];
+ if ($qv > 60) {
+ $qv = 60;
+ }
+
+ $contig_qual .= chr(ord('0') + $qv);
+ }
+
+ } elsif (($el eq "start") && ($aavalid)) {
+ $clr1 = $data -1;
+
+ } elsif (($el eq "stop") && ($aavalid)) {
+ $clr2 = $data -1;
+ } elsif (($el eq "ti") && ($aaptag eq "trace")) {
+ $ti_global .= $data;
+
+
+ } elsif ($el eq "tracegaps") {
+ print FRAG "gap:\n";
+ chomp($data);
+ $data =~ s/^ //;
+ my @redgaps = split / +/, $data;
+ my $c = 0;
+ foreach (@redgaps) {
+ $c += $_;
+ print FRAG "$c ";
+ }
+ print FRAG "\n.\n";
+
+ } elsif (($el eq "start") && ($aaptag eq "tiling")) {
+ if (lc($gval) eq "forward") {
+ $data--;
+ }
+ print FRAG "off:$data\n";
+ } elsif ($el eq "congaps") {
+ chomp($data);
+ $data =~ s/^ //;
+ @congaps = split / +/, $data;
+ }
+}
+
+sub End_handler {
+ my $p = shift;
+ my $el = lc(shift);
+ $aatag = $aaptag;
+
+ if (($el eq "contig") || ($el eq "trace")) {
+ print FRAG "}\n";
+ } elsif ($el eq "consensus") {
+ my $ii= 0;
+ my $ss = "";
+
+ foreach (@congaps) {
+ if (($_ + $ii) > length($contig_seq)) {
+ my $err = $_ + $ii;
+ print " ERROR - gap placement outside of contig, placement = $err\n";
+ last;
+ }
+ $ss .= substr($contig_seq, $ii, $_) . "-";
+ $ii += $_;
+ }
+ $ss .= substr($contig_seq, $ii);
+
+ for (my $s = 0; $s < length($ss); $s += 60) {
+ print FRAG substr($ss, $s, 60), "\n";
+ }
+ print FRAG ".\n";
+ $contig_seq = $ss;
+ } elsif ($el eq "conqualities") {
+ my $ii= 0;
+ my $ss = "";
+
+ if (length($contig_qual) != length($contig_seq)) {
+ foreach (@congaps) {
+ if (($_ + $ii) > length($contig_seq)) {
+ my $err = $_ + $ii;
+ print " ERROR - gap placement outside of contig, placement = $err \n";
+ last;
+ }
+ $ss .= substr($contig_qual, $ii, $_);
+ $ii += $_;
+ $ss .= substr($contig_qual, $ii, 1);
+
+ }
+ $ss .= substr($contig_qual, $ii);
+ } else {
+ $ss = $contig_qual;
+ }
+
+ $ss = substr($ss, 0, length($contig_seq));
+
+ for (my $s = 0; $s < length($ss); $s += 60) {
+ print FRAG substr($ss, $s, 60), "\n";
+ }
+ print FRAG ".\n";
+ $contig_qual = "";
+ $contig_seq = "";
+ @congaps = ();
+ } elsif ($el eq "valid") {
+ $aavalid = 0;
+ } elsif ($el eq "ti") {
+ if ( defined $seq2id{$ti_global} ) {
+ my $tid = $seq2id{$ti_global};
+ print FRAG "src:$tid\n";
+ } else {
+ my $cl = $p->current_line;
+ print "ERROR no source found for ti - $ti_global\n";
+ print " trace tag = $aaptag , ti tag $el \n";
+ print " current line in xml is $cl \n\n";
+ }
+ $ti_global = "";
+ }
+
+}
+
+if (defined($aaxmlname)) {
+ my $aaxml = new XML::Parser(Style => 'Stream');
+ if (!defined $aaxml) {
+ print "Cannot create an XML parser";
+ }
+
+ my $AAXML;
+ open($AAXML, "$aaxmlname") || die " cannot open assembly archive xml file: $aaxmlname";
+
+ $xml->setHandlers(Char => \&Char_handler, Start => \&Start_handler, End => \&End_handler);
+
+ $xml->parse($AAXML);
+
+ close($AAXML);
+}
+###
+# end assembly archive conversion
+###
+
+close(FRAG);
+
+if (! defined $silent) {
+ print STDERR "done\n";
+}
+
+exit(0);
+
+
+########
+#
+# The XML parser functions for parsing Trace Archive formatted .xml files
+
+sub StartDocument
+{
+ if (! defined $silent) {
+ print "starting\n";
+ }
+}
+
+sub EndDocument
+{
+ if (! defined $silent) {
+ print "done\n";
+ }
+}
+
+sub StartTag
+{
+ $tag = lc($_[1]);
+
+ if ($tag eq "trace") {
+ $library = undef;
+ $template = undef;
+ $clipl = undef;
+ $clipr = undef;
+ $mean = undef;
+ $stdev = undef;
+ $end = undef;
+ $seqId = undef;
+ }
+}
+
+sub EndTag
+{
+ $tag = lc($_[1]);
+ if ($tag eq "trace") {
+ if (! defined $seqId) {
+ if (! defined $silent) {
+ $base->log("trace has no name???\n");
+ }
+ }
+ # if (defined $clears &&
+ # ! defined $clr{$seqId}){
+ # return; # only handle reads with a clear range
+ # }
+ if (! defined $library) {
+ if (! defined $silent) {
+ $base->log("trace $seqId has no library\n");
+ }
+ }
+ $libraries{$library} = 1;
+ # if (! defined $mean && ! exists $means{$library}){
+ # if (! defined $silent){
+ # $base->log("library $library has no mean - replacing with 33333\n");
+ # }
+ # $means{$library} = 33333;
+ # $mean = 33333;
+ # } els
+ if (defined $mean && ! exists $means{$library}) {
+ $means{$library} = $mean;
+ }
+
+ # if (! defined $stdev && ! exists $stdevs{$library}){
+ # if (! defined $silent){
+ # $base->log("library $library has no stdev - replacing with 10% of $mean\n");
+ # }
+ # $stdevs{$library} = $mean * 0.1;
+ # } els
+ if (defined $stdev && ! exists $stdevs{$library}) {
+ $stdevs{$library} = $stdev;
+ }
+
+ if (! defined $template) {
+ $template = "TEM_" . $TEM_ID++;
+ if (! defined $silent) {
+ $base->log("trace $seqId has no template. Setting to $template\n");
+ }
+ }
+
+ if (! defined $end) {
+ if (! defined $silent) {
+ $base->log("trace $seqId has no end\n");
+ }
+ }
+
+ if ($end =~ /^R/i) {
+ if (! exists $end3{$template} ||
+ $seqId gt $end3{$template}) {
+ $end3{$template} = $seqId;
+ }
+ }
+
+ if ($end =~ /^F/i) {
+ if (! exists $end5{$template} ||
+ $seqId gt $end5{$template}) {
+ $end5{$template} = $seqId;
+ }
+ }
+
+
+ if (defined $clipl && defined $clipr) {
+ $clipr--;
+ # we don't care about clear ranges if defined elsewhere
+ if (! defined $clears) {
+ $clr{$seqId} = "$clipl,$clipr";
+ }
+ }
+ $seq2ins{$seqId} = $template;
+ $ins2lib{$template} = $library;
+ if (! defined $ins2id{$template}) {
+ $ins2id{$template} = getId();
+ }
+ }
+
+ $tag = undef;
+}
+
+sub Text
+{
+ if (defined $tag) {
+ if ($tag eq "insert_size") {
+ $mean = $_;
+ } elsif ($tag eq "insert_stdev") {
+ $stdev = $_;
+ } elsif ($tag eq "trace_name") {
+ $seqId = $_;
+ } elsif ($tag eq "library_id") {
+ $library = $_;
+ } elsif ($tag eq "seq_lib_id") {
+ if (! defined $library) {
+ $library = $_;
+ }
+ } elsif ($tag eq "template_id") {
+ $template = $_;
+ } elsif ($tag eq "trace_end") {
+ $end = $_;
+ } elsif ($tag eq "clip_quality_left" ||
+ $tag eq "clip_vector_left" ||
+ $tag eq "clip_left") {
+ if (! defined $clipl || $_ > $clipl) {
+ $clipl = $_;
+ }
+ } elsif ($tag eq "clip_quality_right" ||
+ $tag eq "clip_vector_right" ||
+ $tag eq "clip_right") {
+ if (! defined $clipr || $_ < $clipr) {
+ $clipr = $_;
+ }
+ }
+ }
+}
+
+sub pi
+{
+
+}
+
+
+## Some other useful functions
+
+sub printFragHeader
+{
+ my $file = shift;
+
+ my $date = localtime();
+
+ print $file "{UNV\n";
+ print $file "iid:1\n";
+ print $file "com:\nGenerated by $ENV{USER} with tarchive2amos on $date\n.\n";
+ print $file "}\n";
+}
+
+sub getId
+{
+ return $ID++;
+}
+
+
+
diff --git a/src/Converters/tarchive2ca.pl b/src/Converters/tarchive2ca.pl
new file mode 100755
index 0000000..d711b52
--- /dev/null
+++ b/src/Converters/tarchive2ca.pl
@@ -0,0 +1,612 @@
+#!/usr/local/bin/perl
+
+use strict;
+
+use AMOS::AmosLib;
+use AMOS::AmosFoundation;
+use AMOS::ParseFasta;
+use XML::Parser;
+use IO::Handle;
+
+my $MINSEQ = 64;
+my $MAXSEQ = 2048;
+
+my $tag; # XML tag
+my $library;
+my $template;
+my $clipl;
+my $clipr;
+my $mean;
+my $stdev;
+my $end;
+my $seqId;
+
+my %end5;
+my %end3;
+my %means;
+my %stdevs;
+my %inserts;
+my %clr;
+
+my $gzip = "gzip";
+
+my $base = new AMOS::AmosFoundation;
+
+if (! defined $base) {
+ die ("Walk, do not run, to the nearest exit!\n");
+}
+
+#$base->setLogLevel(1);
+
+my $VERSION = '1.0 ($Revision$)';
+$base->setVersion($VERSION);
+
+$base->setLogFile("tarchive2ca.log");
+$base->setMihaiMode();
+
+my $HELPTEXT = qq~
+.USAGE.
+ tarchive2ca -o <out_prefix> [-c <clear_ranges>] [-l <libinfo>] fasta1 ... fastan
+
+.DESCRIPTION.
+ This program takes files from the NCBI trace archive and produces an input file for
+ the Celera Assembler, a .frg file.
+
+ fasta1 ... fastan - list of files to be converted.
+ The program assumes that for each program called <file>.seq there
+ is a <file>.qual and a <file>.xml.
+
+.OPTIONS.
+ -o <out_prefix> prefix for the output files
+ -c <clear_ranges> file containing clear ranges for the reads. If this file
+ is provided, any sequence that does not appear in it is excluded
+ from the output.
+ -l <libinfo> tab-delimited file of lib_id, mean, stdev
+
+.KEYWORDS.
+ converters, trace archive, Celera
+
+ ~;
+$base->setHelpText($HELPTEXT);
+
+
+my $outprefix;
+my $clears;
+my $ID = 1;
+my $silent;
+my $libfile;
+my $err = $base->getOptions("o=s" => \$outprefix,
+ "c=s" => \$clears,
+ "i=i" => \$ID,
+ "l=s" => \$libfile,
+ "silent" => \$silent);
+if ($err == 0) {
+ $base->bail("Command line processing failed\n");
+}
+
+if (! defined $outprefix) {
+ $base->bail("A prefix must be set with option -o\n");
+}
+
+my $xml = new XML::Parser(Style => 'Stream');
+if (!defined $xml) {
+ $base->bail("Cannot create an XML parser");
+}
+
+
+my %clones;
+my %seqs;
+my %seqId;
+my %lib ;
+
+if ($outprefix =~ /\.frg$/){
+ $outprefix =~ s/\.frg$//;
+}
+my $fragname = "$outprefix.frg";
+my $dstname = "$outprefix.dst";
+
+open(FRAG, ">$fragname") || die ("Cannot open $fragname: $!");
+open(DST, ">$dstname") || die ("Cannot open $dstname: $!");
+printFragHeader(\*FRAG);
+
+if (defined $libfile){
+ open(LIB, $libfile) || die ("Cannot open $libfile: $!");
+ while (<LIB>){
+ chomp;
+ if (/^(\S+)\t(\d+.?\d*)\t(\d+.?\d*)$/){
+ $means{$1} = $2;
+ $stdevs{$1} = $3;
+ } else {
+ print STDERR "Cannot parse line $. of $libfile: $_\n";
+ }
+ }
+ close(LIB);
+}
+
+for (my $f = 0; $f <= $#ARGV; $f++){
+# for each file
+# read anciliary XML data
+# read the seq and qual files
+ my $seqname = $ARGV[$f];
+ my $qualname;
+ my $xmlname;
+ my $prefix;
+
+ if ($seqname =~ /fasta\.(.*)(\.gz)?/){
+ $prefix = $1;
+ } elsif ($seqname =~ /(.*)\.seq(\.gz)?/){
+ $prefix = $1;
+ } else {
+ $base->bail("Fasta file ($seqname) must be called either fasta.<file> or <file>.seq\n");
+ }
+
+ if (-e "qual.$prefix"){
+ $qualname = "qual.$prefix";
+ } elsif (-e "qual.$prefix.gz") {
+ $qualname = "qual.$prefix.gz";
+ } elsif (-e "$prefix.qual"){
+ $qualname = "$prefix.qual";
+ } elsif ( -e "$prefix.qual.gz") {
+ $qualname = "$prefix.qual.gz";
+ } else {
+ $base->bail("Cannot find the quality file corresponding to $seqname");
+ }
+
+ if (-e "xml.$prefix"){
+ $xmlname = "xml.$prefix";
+ } elsif (-e "xml.$prefix.gz") {
+ $xmlname = "xml.$prefix.gz";
+ } elsif (-e "$prefix.xml"){
+ $xmlname = "$prefix.xml";
+ } elsif ( -e "$prefix.xml.gz") {
+ $xmlname = "$prefix.xml.gz";
+ } else {
+ $base->bail("Cannot find the xml file corresponding to $seqname");
+ }
+
+ my $XML = new IO::Handle;
+
+ if ($xmlname =~ /\.gz$/){
+ open($XML, "$gzip -dc $xmlname |") ||
+ $base->bail("Cannot open $xmlname: $!\n");
+ } else {
+ open($XML, "$xmlname") ||
+ $base->bail("Cannot open $xmlname: $!\n");
+ }
+
+ $xml->parse($XML);
+
+ close($XML);
+
+ if (defined $clears){
+ open(CLR, $clears) || $base->bail("Cannot open $clears: $!\n");
+ while (<CLR>){
+ chomp;
+ my @fields = split(' ', $_);
+ $fields[0] =~ s/gnl\|ti\|//;
+ $clr{$fields[0]} = "$fields[1],$fields[2]";
+ }
+ close(CLR);
+ }
+
+ if ($seqname =~ /\.gz$/){
+ open(SEQ, "$gzip -dc $seqname |") ||
+ $base->bail("Cannot open $seqname: $!\n");
+ } else {
+ open(SEQ, "$seqname") ||
+ $base->bail("Cannot open $seqname: $!\n");
+ }
+
+ if ($qualname =~ /\.gz$/){
+ open(QUAL, "$gzip -dc $qualname |") ||
+ $base->bail("Cannot open $qualname: $!\n");
+ } else {
+ open(QUAL, "$qualname") ||
+ $base->bail("Cannot open $qualname: $!\n");
+ }
+
+ if (! defined $silent){
+ print STDERR "Parsing $seqname and $qualname\n";
+ }
+
+ my $seqparse = new AMOS::ParseFasta(\*SEQ);
+ my $qualparse = new AMOS::ParseFasta(\*QUAL, ">", " ");
+
+ my $fhead; my $frec;
+ my $qhead; my $qrec;
+ while (($fhead, $frec) = $seqparse->getRecord()){
+ my $qid;
+ my $fid;
+ my $fidname;
+
+ ($qhead, $qrec) = $qualparse->getRecord();
+ $fhead =~ /^(\S+)/;
+ $fid = $1;
+ $qhead =~ /^(\S+)/;
+ $qid = $1;
+ if ($fid ne $qid) {
+ $base->bail("fasta and qual records have different IDs: $fid vs $qid\n");
+ }
+
+ if ($fhead =~ /^(\S+)\s+\d+\s+\d+\s+\d+\s+(\d+)\s+(\d+)/){
+# if TIGR formatted, fetch the clear range
+# print STDERR "got TIGR: $1 $2 $3\n";
+ my $l = $2;
+ my $r = $3;
+ $l--;
+ $fidname = $1;
+ $fid = $1;
+ if (defined $clears && ! exists $clr{$fid}){
+ # clear range file decides which sequences stay and which go
+ next;
+ }
+ # allow XML or clear file to override the clear range info
+ if (! exists $clr{$fid}) {
+ $clr{$fid} = "$l,$r";
+ }
+ } elsif ($fhead =~ /^gnl\|ti\|(\d+).* name:(\S+)/) {
+# print STDERR "got ncbi: $1 $2\n";
+ # NCBI formatted using keywords
+ $fid = $1;
+ $fidname = $2;
+ if (defined $clears &&
+ ! exists $clr{$fid} &&
+ ! exists $clr{$fidname}) {
+ # clear range file decides with sequences stay and which go
+ $base->log("Couldn't find clear for $fid or $fidname\n");
+ next;
+ }
+ if (exists $clr{$fidname} && ! exists $clr{$fid}) {
+ $clr{$fid} = $clr{$fidname};
+ }
+ } elsif ($fhead =~ /^ ?(\S+) ?(\S+)?/){
+# print STDERR "got ncbi: $1 $2\n";
+# NCBI formatted, first is the trace id then the trace name
+ $fid = $1;
+ $fidname = $2;
+
+ if (! defined $fidname || $fidname eq "bases"){
+ $fidname = $fid;
+ }
+
+ if (defined $clears &&
+ ! exists $clr{$fid} &&
+ ! exists $clr{$fidname}) {
+ $base->log("Couldn't find clear for $fid or $fidname\n");
+ # clear range file decides which sequences stay and which go
+ next;
+ }
+ if (exists $clr{$fidname} && ! exists $clr{$fid}) {
+ $clr{$fid} = $clr{$fidname};
+ }
+ } # done parsing head
+
+
+ my $recId = getId();
+
+ my $seqlen = length($frec);
+ $qrec =~ s/^\s+//;
+ my @quals = split(/\s+/, $qrec);
+ if ($#quals + 1 != $seqlen) {
+ $base->bail("Fasta and quality for $fid($fidname) disagree: $seqlen vs " . sprintf("%d\n", $#quals + 1));
+ }
+
+ my $caqual = "";
+ for (my $q = 0; $q <= $#quals; $q++){
+ my $qv = $quals[$q];
+ if ($qv > 60) {
+ $qv = 60;
+ }
+
+ $caqual .= chr(ord('0') + $qv);
+ }
+
+ if (! defined $silent && ($recId % 100 == 0)){
+ print STDERR "$recId\r";
+ }
+
+ if (! exists $clr{$fid}){
+ $clr{$fid} = "0,$seqlen";
+ }
+
+ $seqId{$fidname} = $recId;
+
+ my $seq_lend;
+ my $seq_rend;
+
+ ($seq_lend, $seq_rend) = split(',', $clr{$fid});
+
+ if ($seqlen > $MAXSEQ){
+ $frec = substr($frec, 0, $seq_rend + 1);
+ $caqual = substr($caqual, 0, $seq_rend + 1);
+ $seqlen = length($frec);
+ if ($seqlen > $MAXSEQ){
+ if (! defined $silent){
+ $base->log("skipping sequence $fidname due to length $seqlen\n");
+ }
+ delete $seqId{$fidname};
+ next;
+ }
+ }
+ if ($seq_rend - $seq_lend < $MINSEQ){
+ if (! defined $silent){
+ $base->log("skipping sequence $fidname since it's short\n");
+ }
+ delete $seqId{$fidname};
+ next;
+ }
+
+ print FRAG "{FRG\n";
+ print FRAG "act:A\n";
+ print FRAG "acc:$recId\n";
+ print FRAG "typ:R\n";
+ print FRAG "src:\n$fidname\n.\n";
+ print FRAG "etm:0\n";
+ print FRAG "seq:\n";
+ $frec =~ s/[^actgnACTGN]/N/g;
+ for (my $s = 0; $s < $seqlen; $s += 60){
+ print FRAG substr($frec, $s, 60), "\n";
+ }
+ print FRAG ".\n";
+ print FRAG "qlt:\n";
+ for (my $s = 0; $s < $seqlen; $s += 60){
+ print FRAG substr($caqual, $s, 60), "\n";
+ }
+ if ($seq_rend > $seqlen){
+ print "right end of clear range $seq_rend > $seqlen - shrinking it\n";
+ $seq_rend = $seqlen;
+ }
+ print FRAG ".\n";
+ print FRAG "clr:$seq_lend,$seq_rend\n";
+ print FRAG "}\n";
+ } # while $fhead
+
+ if (! defined $silent){
+ print STDERR "done\n";
+ }
+ close(SEQ);
+ close(QUAL);
+}
+
+if (! defined $silent){
+ print STDERR "doing mates\n";
+}
+my %seentem;
+
+while (my ($lib, $mean) = each %means){
+ if ($#{$inserts{$lib}} == -1){
+ next; # nothing to see here
+ }
+
+ my $dstId = getId();
+
+ print DST "$dstId\t$lib\t$means{$lib} +/- $stdevs{$lib}\n";
+
+ if ($stdevs{$lib} > $means{$lib} / 3){
+ $stdevs{$lib} = int($means{$lib} / 3);
+ }
+
+ print FRAG "{DST\n";
+ print FRAG "act:A\n";
+ print FRAG "acc:$dstId\n";
+ print FRAG "mea:$means{$lib}\n";
+ print FRAG "std:$stdevs{$lib}\n";
+ print FRAG "}\n";
+
+ for (my $tem = 0 ; $tem <= $#{$inserts{$lib}}; $tem++){
+ my $tmplte = ${$inserts{$lib}}[$tem];
+ if (exists $seentem{$tmplte}){
+ next;
+ }
+
+ if (! exists $end5{$tmplte} ||
+ ! exists $end3{$tmplte} ||
+ ! exists $seqId{$end5{$tmplte}} ||
+ ! exists $seqId{$end3{$tmplte}}){
+ if (! defined $silent){
+ $base->log("Template $tmplte ($tem) does not have both mates\n");
+ }
+ } else {
+ $seentem{$tmplte} = 1;
+ print FRAG "{LKG\n";
+ print FRAG "act:A\n";
+ print FRAG "typ:M\n";
+ print FRAG "fg1:$seqId{$end5{$tmplte}}\n";
+ print FRAG "fg2:$seqId{$end3{$tmplte}}\n";
+ print FRAG "etm:0\n";
+ print FRAG "dst:$dstId\n";
+ print FRAG "ori:I\n";
+ print FRAG "}\n";
+ }
+ }
+}
+
+if (! defined $silent){
+ print STDERR "done\n";
+}
+close(FRAG);
+close(DST);
+
+
+exit(0);
+
+
+sub StartDocument
+{
+ if (! defined $silent){
+ print "starting\n";
+ }
+}
+
+sub EndDocument
+{
+ if (! defined $silent){
+ print "done\n";
+ }
+}
+
+sub StartTag
+{
+ $tag = lc($_[1]);
+
+ if ($tag eq "trace"){
+ $library = undef;
+ $template = undef;
+ $clipl = undef;
+ $clipr = undef;
+ $mean = undef;
+ $stdev = undef;
+ $end = undef;
+ $seqId = undef;
+ }
+}
+
+sub EndTag
+{
+ $tag = lc($_[1]);
+ if ($tag eq "trace"){
+ if (! defined $seqId){
+ if (! defined $silent){
+ $base->log("trace has no name???\n");
+ }
+ }
+ if (! defined $library){
+ if (! defined $silent){
+ $base->log("trace $seqId has no library\n");
+ }
+ }
+ if (! defined $mean && ! exists $means{$library}){
+ if (! defined $silent){
+ $base->log("library $library has no mean - replacing with 33333\n");
+ }
+ $means{$library} = 33333;
+ $mean = 33333;
+ } else {
+ if (defined $mean && ! exists $means{$library}){
+ $means{$library} = $mean;
+ } else {
+ $mean = $means{$library};
+ }
+ }
+
+ if (! defined $stdev && ! exists $stdevs{$library}){
+ if (! defined $silent){
+ $base->log("library $library has no stdev - replacing with 10% of $mean\n");
+ }
+ $stdevs{$library} = $means{$library} * 0.1;
+ $stdev = $means{$library} * 0.1;
+ } else {
+ if (! exists $stdevs{$library}){
+ $stdevs{$library} = $stdev;
+ } else {
+ $stdev = $stdevs{$library};
+ }
+ }
+
+ if (! defined $template){
+ if (! defined $silent){
+ $base->log("trace $seqId has no template\n");
+ }
+ }
+
+ if (! defined $end) {
+ if (! defined $silent){
+ $base->log("trace $seqId has no end\n");
+ }
+ }
+
+ if ($end =~ /^R/i){
+ if (! exists $end3{$template} ||
+ $seqId gt $end3{$template}){
+ $end3{$template} = $seqId;
+ }
+ }
+
+ if ($end =~ /^F/i){
+ if (! exists $end5{$template} ||
+ $seqId gt $end5{$template}){
+ $end5{$template} = $seqId;
+ }
+ }
+
+ push (@{$inserts{$library}}, $template);
+
+ if (defined $clipl && defined $clipr){
+ $clipr--;
+ if (! defined $clears) {$clr{$seqId} = "$clipl,$clipr";}
+ }
+ }
+
+ $tag = undef;
+}
+
+sub Text
+{
+ if (defined $tag){
+ if ($tag eq "insert_size"){
+ $mean = $_;
+ } elsif ($tag eq "insert_stdev"){
+ $stdev = $_;
+ } elsif ($tag eq "trace_name"){
+ $seqId = $_;
+ } elsif ($tag eq "library_id"){
+ $library = $_;
+ } elsif ($tag eq "seq_lib_id") {
+ if (! defined $library) {
+ $library = $_;
+ }
+ } elsif ($tag eq "template_id"){
+ $template = $_;
+ } elsif ($tag eq "trace_end"){
+ $end = $_;
+ } elsif ($tag eq "clip_quality_left" ||
+ $tag eq "clip_vector_left" ||
+ $tag eq "clip_left"){
+ if (! defined $clipl || $_ > $clipl){
+ $clipl = $_;
+ }
+ } elsif ($tag eq "clip_quality_right" ||
+ $tag eq "clip_vector_right" ||
+ $tag eq "clip_right"){
+ if (! defined $clipr || $_ < $clipr){
+ $clipr = $_;
+ }
+ }
+ }
+}
+
+sub pi
+{
+
+}
+
+sub printFragHeader
+{
+ my $file = shift;
+
+ my $id = getId();
+
+ print $file "{BAT\n";
+ print $file "bna:Celera Assembler\n";
+ print $file "crt:" . time() . "\n";
+ print $file "acc:$id\n";
+ print $file "com:\nDrosophila pseudoobscura\n.\n";
+ print $file "}\n";
+
+ print $file "{ADT\n";
+ print $file "{ADL\n";
+ print $file "who:$ENV{USER}\n";
+ print $file "ctm:" . time() . "\n";
+ print $file "vsn:1.00\n";
+ print $file "com:\nGenerated by cs2ca.pl\n.\n";
+ print $file "}\n";
+ print $file ".\n";
+ print $file "}\n";
+
+}
+
+sub getId
+{
+ return $ID++;
+}
+
diff --git a/src/Converters/toAmos.pl b/src/Converters/toAmos.pl
new file mode 100755
index 0000000..501cb80
--- /dev/null
+++ b/src/Converters/toAmos.pl
@@ -0,0 +1,2101 @@
+#! /usr/bin/env perl
+
+use strict;
+use warnings;
+use File::Spec;
+use TIGR::Foundation;
+use AMOS::AmosLib;
+use AMOS::ParseFasta;
+use XML::Parser;
+
+my $GOODQUAL = 30;
+my $BADQUAL = 10;
+my $INCLUDE_SURROGATE = 0;
+my $UTG_MESSAGES = 0;
+
+# more to do
+# 1. allow to specify clear ranges from a separate file
+# 2. error if multiple sequence or multiple contig files provided
+
+my $VERSION = '$Revision$ ';
+my $HELP = qq~
+.USAGE.
+ toAmos -o out_file
+ (-s fasta_reads (-q qual_file) (-gq good_qual) (-bq bad_qual))
+ (-c tigr_contig | -a celera_asm [-S][-utg] | -ta tigr_asm | -ace phrap_ace [-phd])
+ (-m bambus_mates | -x trace_xml | -f celera_frg [-acc])
+ (-arachne arachne_links | -scaff bambus_scaff)
+ (-i insert_file | -map dst_map)
+ (-pos pos_file)
+ (-id min_id)
+
+.DESCRIPTION.
+ toAmos is primarily designed for converting the output of an assembly
+ program into the AMOS format so that it can be stored in an AMOS bank.
+
+ If you simply need a program to generate assembly inputs for one the
+ AMOS-based assemblers (e.g. minimus or AMOS-cmp) use tarchive2amos.
+
+ toAmos reads the inputs specified on the command line and converts the
+ information into AMOS message format. The following types of
+ information can be provided to toAmos:
+ -> Sequence and quality data: options -f, -s, -q, -gq, or -bq
+ -> Library and mate-pair data: options -m, -x, -f, -i, or -map
+ -> Contig data: options -c, -a, -ta, or -ace
+ -> Scaffold data: option -a, or -arachne
+
+.OPTIONS.
+ -o <out_file> - output filename ('-' for standard output)
+ -s <fasta_reads> - sequence data file in FASTA format (reads names ending
+ in .1 or /1 are taken as mate pairs)
+ -q <qual_file> - sequence quality score file in QUAL format
+ -gq <bad_qual> - minimum quality score for high-quality bases (default: $GOODQUAL)
+ -bq <good_qual> - maximum quality score for low-quality bases (default: $BADQUAL)
+ -c <tigr_contig> - provide TIGR .contig file
+ -a <celera_asm> - use Celera Assembler .asm contig file
+ -S - include the surrogate unitigs in the .asm file as AMOS contigs
+ -utg - include all UTG unitig messages in the .asm file as AMOS contigs
+ -ta <tigr_asm> - contig file in TIGR Assembler format (.tasm)
+ -ace <phrap_ace> - contig file in Phred ACE format (can be accompanied by -q)
+ -phd - read the content of PHD file referenced in ACE files
+ -m <bambus_mates> - library and mate-pair information file in Bambus format
+ -x <trace_xml> - ancilliary data file (library, mate-pair, clear range)
+ in Trace Archive XML format
+ -f <celera_frg> - library, mate-pair, sequence, quality, and clear
+ range data file in Celera Assembler format
+ -acc - use accession numbers in FRG files
+ -arachne <arachne_links> - scaffold file in Arachne .links format
+ -scaff <bambus_scaff> - scaffold file in Bambus .scaff format
+ -i <insert_file> - read insert information
+ -map <dst_map> - read map information
+ -pos <pos_file> - TIGR-style .pos position file
+ -id <min_id> - start numbering AMOS internal IDs at this number
+
+.KEYWORDS.
+ converter, universal, amos format
+
+~;
+
+my $base = new TIGR::Foundation();
+if (! defined $base) {
+ die("A horrible death\n");
+}
+
+
+$base->setVersionInfo($VERSION);
+$base->setHelpInfo($HELP);
+
+my $matesfile;
+my $traceinfofile;
+my $ctgfile;
+my $frgfile;
+my $asmfile;
+my $tasmfile;
+my $acefile;
+my $outfile;
+my $fastafile;
+my $qualfile;
+my $insertfile;
+my $libmap;
+my $posfile;
+my $byaccession = undef;
+my $phd_opt = undef;
+my $arachne_scaff = undef;
+my $scaffile = undef;
+
+my $minSeqId = 1; # where to start numbering reads
+my $err = $base->TIGR_GetOptions(
+ "m=s" => \$matesfile,
+ "x=s" => \$traceinfofile,
+ "c=s" => \$ctgfile,
+ "f=s" => \$frgfile,
+ "a=s" => \$asmfile,
+ "ta=s" => \$tasmfile,
+ "ace=s" => \$acefile,
+ "o=s" => \$outfile,
+ "i=s" => \$insertfile,
+ "map=s" => \$libmap,
+ "arachne=s" => \$arachne_scaff,
+ "scaff=s" => \$scaffile,
+ "gq=i" => \$GOODQUAL,
+ "bq=i" => \$BADQUAL,
+ "q=s" => \$qualfile,
+ "s=s" => \$fastafile,
+ "pos=s" => \$posfile,
+ "id=i" => \$minSeqId,
+ "acc" => \$byaccession,
+ "phd" => \$phd_opt,
+ "S" => \$INCLUDE_SURROGATE,
+ "utg" => \$UTG_MESSAGES
+);
+
+my $matesDone = 0;
+my $readsDone = 0;
+
+# this is where all my data live
+my %contigs; # contig ids to contig length map
+my %seqids; # seq_name to seq_id map
+my %seqnames; # seq id to seq name map
+my %seqcontig; # seq id to contig map
+my %contigseq; # contig id to sequence id list
+my %seq_range; # seq id to clear range
+my %asm_range; # seq id to range within contig
+my %contigcons; # contig id to consensus sequence
+
+my %forw; # insert to forw (rev resp) end mapping
+my %rev;
+my %libraries; # libid to lib range (mean, stdev) mapping
+my %inserttype; # the type of insert, if undefined assume 'E'
+my %seenlib; # insert id to lib id map
+my %seqinsert; # sequence id to insert id map
+my %libnames; # lib id to lib name
+my %ctgnames; # ctg id to ctg name
+my %ctgids; # ctg name to ctg id
+my %posidx; # position of sequence in pos file
+
+my $minCtgId = $minSeqId; # where to start numbering contigs
+
+if (! defined $outfile){
+ die "You must specify an output AMOS AFG file with option -o\n";
+}
+elsif ($outfile eq '-')
+{
+ open(OUT, ">&STDOUT") || $base->bail("Could not write AMOS AFG file on stdout: $!\n");
+}
+else
+{
+ open(OUT, ">$outfile") || $base->bail("Could not write AMOS AFG file $outfile: $!\n");
+}
+
+
+my $tmprefix = "tmp.$$";
+my $tmpdir = $base->getTempDir();
+my $tmpseq = File::Spec->catfile($tmpdir, $tmprefix.'.seq');
+my $tmpctg = File::Spec->catfile($tmpdir, $tmprefix.'.ctg');
+my $tmpscf = File::Spec->catfile($tmpdir, $tmprefix.'.scf');
+open(TMPSEQ, ">$tmpseq") || $base->bail("Could not write temporary sequence file $tmpseq: $!\n");
+open(TMPCTG, ">$tmpctg") || $base->bail("Could not write temporary contig file $tmpctg: $!\n");
+open(TMPSCF, ">$tmpscf") || $base->bail("Could not write temporary scaffold file $tmpscf: $!\n");
+
+#then figure out the mates
+if (defined $frgfile) {
+ open(IN, $frgfile) || $base->bail("Could not read Celera Assembler FRG file $frgfile: $!\n");
+ parseFrgFile(\*IN);
+ close(IN);
+ $matesDone = 1;
+ $readsDone = 1;
+}
+
+if (defined $fastafile) {
+ # Guess mate pairs unless a .mates files was provided
+ my $guess_mates = $matesfile ? 0 : 1;
+ # Open and parse FASTA (and QUAL) files
+ open(IN, $fastafile) || $base->bail("Could not read FASTA file $fastafile: $!\n");
+ if (defined $qualfile){
+ open(QUAL, $qualfile) || $base->bail("Could not read QUAL file $qualfile: $!\n");
+ parseFastaFile(\*IN, \*QUAL, $guess_mates);
+ close(QUAL);
+ } else {
+ parseFastaFile(\*IN, undef, $guess_mates);
+ }
+ close(IN);
+ $readsDone = 1;
+ $matesDone = 1 if $guess_mates;
+}
+
+if (defined $posfile){
+ open(IN, $posfile) || $base->bail("Could not read position file $posfile: $!\n");
+ parsePosFile(\*IN);
+ close(IN);
+}
+
+if (defined $asmfile){
+ open(IN, $asmfile) || $base->bail("Could not read Celera Assembler ASM file $asmfile: $!\n");
+ parseAsmFile(\*IN);
+ close(IN);
+}
+
+if (defined $ctgfile){
+ open(IN, $ctgfile) || $base->bail("Could not read TIGR .contig file $ctgfile: $!\n");
+ if (defined $qualfile){
+ open(QUAL, $qualfile) || $base->bail("Cannot open $qualfile: $!\n");
+ parseContigFile(\*IN, \*QUAL);
+ close(QUAL);
+ } else {
+ parseContigFile(\*IN);
+ }
+ close(IN);
+}
+
+if (defined $tasmfile) {
+
+ die("This option is not yet fully functional\n"); # TODO
+
+ open(IN, $tasmfile) || $base->bail("Could not read TIGR Assembler assembly file $tasmfile: $!\n");
+ parseTAsmFile(\*IN);
+ close(IN);
+}
+
+if (defined $acefile){
+ open(IN, $acefile) || $base->bail("Could not read ACE assembly file $acefile: $!\n");
+ if (defined $qualfile){
+ open(QUAL, $qualfile) || $base->bail("Cannot open $qualfile: $!\n");
+ parseACEFile(\*IN, \*QUAL);
+ close(QUAL);
+ } else {
+ parseACEFile(\*IN);
+ }
+ close(IN);
+ if ($phd_opt) {
+ open(IN, $acefile) || $base->bail("Could not read PHD file $acefile: $!\n");
+ parsePHDFiles(\*IN);
+ close(IN);
+ }
+}
+
+# now it's time for library and mates information
+
+if (defined $traceinfofile){
+ $matesDone = 1;
+ open(IN, $traceinfofile) || $base->bail("Could not read XML tracefile $traceinfofile: $!\n");
+ parseTraceInfoFile(\*IN);
+ close(IN);
+}
+
+if (! $matesDone && defined $matesfile) { # the mate file contains either mates
+ # or regular expressions defining them
+ open(IN, $matesfile) || $base->bail("Could not read Bambus mates file $matesfile: $!\n");
+ parseMatesFile(\*IN);
+ close(IN);
+} # if mates not done defined matesfile
+
+if (defined $insertfile){
+ open(IN, $insertfile) || $base->bail("Could not read insert file $insertfile: $!\n");
+ parseInsertFile(\*IN);
+ close(IN);
+}
+
+if (defined $libmap){
+ open(IN, $libmap) || $base->bail("Could not read map file $libmap: $!\n");
+ parseLibMapFile(\*IN);
+ close(IN);
+}
+
+if (defined $arachne_scaff){
+ open(IN, $arachne_scaff) || $base->bail("Could not read Arachne scaffold file $arachne_scaff: $!\n");
+ parseArachneScaff(\*IN);
+ close(IN);
+}
+
+if (defined $scaffile){
+ open(IN, $scaffile) || $base->bail("Could not read Bambus scaffold file $scaffile: $!\n");
+ parseScaff(\*IN);
+ close(IN);
+}
+
+close(TMPSEQ);
+close(TMPCTG);
+close(TMPSCF);
+
+## add a dummy to hold all the unmated reads
+my $ll = $minSeqId++;
+$libraries{$ll} = '0 0';
+$libnames{$ll} = 'unmated';
+
+## make sure all reads have an insert
+my %libid;
+my %insid;
+while (my ($sid, $sname) = each %seqnames){
+ if (! exists $seqinsert{$sid}){
+ my $id = $minSeqId++;
+ $seqinsert{$sid} = $id;
+ $insid{$id} = $id;
+ $seenlib{$id} = $ll;
+ $forw{$id} = $sid;
+ }
+}
+
+
+## here's where we output all the stuff
+
+# first print out a pretty header message
+my $date = localtime();
+
+print OUT "{UNV\n";
+print OUT "eid:afg\n";
+print OUT "com:\n";
+print OUT "generated by $0\n";
+print OUT "$date\n";
+print OUT ".\n";
+print OUT "}\n";
+
+
+# then print out one library at a time
+while (my ($lib, $range) = each %libraries){
+ my ($mean, $sd) = split(' ', $range);
+ print OUT "{LIB\n";
+
+ $libid{$lib} = $minSeqId++;
+ print OUT "iid:$libid{$lib}\n";
+
+ if (exists $libnames{$lib}){
+ print OUT "eid:$libnames{$lib}\n";
+ } else {
+ print OUT "eid:$lib\n";
+ }
+
+ if (defined $mean && defined $sd) {
+ print OUT "{DST\n";
+ print OUT "mea:$mean\n";
+ print OUT "std:$sd\n";
+ print OUT "}\n";
+ }
+
+ print OUT "}\n";
+
+}
+
+# then all the inserts
+while (my ($ins, $lib) = each %seenlib){
+ print OUT "{FRG\n";
+ #if ($ins =~ /^\d+$/){
+ # print OUT "iid:$ins\n";
+ # $insid{$ins} = $ins;
+ #} else {
+ $insid{$ins} = $minSeqId;
+ print OUT "iid:", $minSeqId++, "\n";
+ print OUT "eid:", $ins, "\n";
+ #}
+ if (! exists $libid{$lib}){
+ $base->bail("Have not seen library \"$lib\" yet: possible error in input\n");
+ }
+ print OUT "lib:$libid{$lib}\n";
+
+ if ( exists $forw{$ins} && exists $rev{$ins} ) {
+ print OUT "rds:$forw{$ins},$rev{$ins}\n";
+ }
+
+ if ( exists $inserttype{$ins} && $inserttype{$ins} eq "T") {
+ print OUT "typ:T\n";
+ } else {
+ print OUT "typ:I\n";
+ }
+ print OUT "}\n";
+}
+
+# then all the reads from file tmp.*.seq
+
+# #internal_read_id
+# dna
+# dna
+# #
+# qual
+# qual
+# #
+
+if (defined $posfile){
+ open(POS, $posfile) || $base->bail("Could not read position file $posfile: $!\n");
+}
+open(TMPSEQ, $tmpseq) || $base->bail("Could not read temporary sequence file $tmpseq: $!\n");
+
+my %reids;
+while (<TMPSEQ>){
+
+ if (not /^\#(\d+)/){
+ $base->bail("Error: Temporary read file $tmpseq was not formatted as expected at line $.:\n$_");
+ }
+
+ my $rid = $1;
+ my $reid;
+ if (exists $seqnames{$rid}){
+ $reid = $seqnames{$rid};
+ }
+
+ # Check that this read ID is not already taken
+ if (exists $reids{$reid}) {
+ $base->logError("Cannot use read ID '$reid' multiple times. Skipping it...\n", 1);
+ $_ = <TMPSEQ>;
+ while ($_ !~ /^\#/){ $_ = <TMPSEQ>; };
+ $_ = <TMPSEQ>;
+ while ($_ !~ /^\#/){ $_ = <TMPSEQ>; };
+ next;
+ } else {
+ $reids{$reid} = undef;
+ }
+
+ # Write RED message
+ print OUT "{RED\n";
+ print OUT "iid:$rid\n";
+ print OUT "eid:$reid\n" if defined $reid;
+ print OUT "seq:\n";
+ $_ = <TMPSEQ>;
+ while ($_ !~ /^\#/){
+ print OUT;
+ $_ = <TMPSEQ>;
+ }
+ print OUT ".\n";
+ print OUT "qlt:\n";
+ $_ = <TMPSEQ>;
+ while ($_ !~ /^\#/){
+ print OUT;
+ $_ = <TMPSEQ>;
+ }
+ print OUT ".\n";
+ if (defined $posfile){
+ if (exists $posidx{$rid}){
+ seek POS, $posidx{$rid}, 0;
+ my $line = <POS>;
+ chomp $line;
+ my ($seqname, $ver, $poss) = split('\t', $line);
+ #print "unpacking $poss\n";
+ my @poss = unpack("(a4)*", $poss);
+ @poss = map(hex, @poss);
+ #print "got $#poss pieces\n";
+
+ print OUT "bcp:\n";
+ for (my $p = 0; $p <= $#poss; $p += 15){
+ print OUT join(" ", @poss[$p .. $p + 14]), "\n";
+ }
+ print OUT ".\n";
+ }# else {
+ #print "What bcp: $rid $seqnames{$rid}\n";
+ #}
+ } elsif (defined $phd_opt) {
+
+ if (exists $posidx{$rid}){
+ my $pos = $posidx{$rid};
+
+ print OUT "bcp:\n";
+ my @posn = split(' ', $pos);
+ for (my $i = 0; $i <= $#posn; $i+=15){
+ if ($i + 14 <= $#posn){
+ print OUT join(" ", @posn[$i .. $i+14]), "\n";
+ } else {
+ print OUT join(" ", @posn[$i .. $#posn]), "\n";
+ }
+ }
+ print OUT ".\n";
+ }
+ }
+
+
+ if (! exists $seqinsert{$rid}){
+ $base->bail("Could not find insert for $rid ($seqnames{$rid})\n");
+ }
+ if (! exists $insid{$seqinsert{$rid}}){
+ $base->bail("Could not find insert ID for insert $seqinsert{$rid}, sequence $rid, $seqnames{$rid}\n");
+ }
+ print OUT "frg:$insid{$seqinsert{$rid}}\n";
+ my ($cll, $clr) = split(' ', $seq_range{$rid});
+ print OUT "clr:$cll,$clr\n";
+ print OUT "}\n";
+
+}
+close(TMPSEQ);
+undef %reids;
+
+
+if (defined $posfile){ close(POS);}
+
+unlink($tmpseq) || $base->bail("Could not remove temporary sequence file $tmpseq: $!\n");
+
+# then all the contigs. The temporary contig file tmp.*.ctg is structured this way:
+
+# #internal_contig_id C
+# dna
+# dna
+# #
+# qual
+# qual
+# #internal_read_id
+# pos_gap_1 pos_gap_2 ...
+# #internal_read_id
+# pos_gap_1 ...
+
+# the reads refered to by internal_read_id are from the temporary read file tmp.*.seq
+
+open(TMPCTG, $tmpctg) || $base->bail("Could not read temporary contig file $tmpctg: $!\n");
+
+my %ceids;
+while (<TMPCTG>){
+ if (not /^\#(\d+) (.)/) {
+ $base->bail("Error: Temporary contig file $tmpctg was not formatted as expected at line $.:\n$_");
+ }
+
+ my ($cid, $sts) = ($1, $2);
+ my $ceid;
+ if (exists $ctgnames{$cid}) {
+ $ceid = $ctgnames{$cid};
+ }
+
+ # Check that this contig ID is not already taken
+ if (exists $ceids{$ceid}) {
+ $base->logError("Cannot use contig ID '$ceid' multiple times. Skipping it...\n", 1);
+ $_ = <TMPCTG>;
+ while (/^\#(\d+)/){
+ $_ = <TMPCTG>;
+ while ($_ !~ /^\#/){ $_ = <TMPCTG>; };
+ }
+ next;
+ } else {
+ $ceids{$ceid} = undef;
+ }
+
+ # Write the CTG message
+ print OUT "{CTG\n";
+ print OUT "iid:$cid\n"; # internal ID
+ print OUT "sts:$sts\n"; # status (C for contig)
+ print OUT "eid:$ceid\n" if defined $ceid; # external ID
+ print OUT "seq:\n"; # sequence
+ $_ = <TMPCTG>;
+ while ($_ !~ /^\#/){
+ print OUT;
+ $_ = <TMPCTG>;
+ }
+ print OUT ".\n";
+ print OUT "qlt:\n";
+ $_ = <TMPCTG>;
+ while ($_ !~ /^\#/) {
+ print OUT;
+ $_ = <TMPCTG>;
+ }
+ print OUT ".\n";
+ while (/^\#(\d+)/) {
+ my $rid = $1;
+ if (! exists $seq_range{$rid}){
+ $base->bail ("No clear range for read $rid\n");
+ }
+ my ($cl, $cr) = split(' ', $seq_range{$rid});
+ if (! exists $asm_range{$rid}){
+ $base->bail ("No asm range for read $rid\n");
+ }
+ my ($len, $ren) = split(' ', $asm_range{$rid});
+ my $tmp;
+ if ($len > $ren){
+ $tmp = $len;
+ $len = $ren;
+ $ren = $tmp;
+ $tmp = $cr;
+ $cr = $cl;
+ $cl = $tmp;
+ }
+ print OUT "{TLE\n";
+ print OUT "src:$rid\n";
+ print OUT "off:$len\n";
+ print OUT "clr:$cl,$cr\n";
+ my $deltastring;
+ $_ = <TMPCTG>;
+ while ($_ !~ /^\#/){
+ $deltastring .= $_;
+ $_ = <TMPCTG>;
+ }
+ if (defined $deltastring && $deltastring !~ /^\s*$/){
+ print OUT "gap:\n";
+ print OUT $deltastring;
+ print OUT ".\n";
+ }
+ print OUT "}\n";
+ }
+ print OUT "}\n";
+
+}
+close(TMPCTG);
+undef %ceids;
+
+unlink($tmpctg) || $base->bail("Cannot remove temporary contig file $tmpctg: $!\n");
+
+# all the contig links
+# all the contig edges
+# and all the scaffolds
+
+if (-f $tmpscf){
+ open(TMPSCF, $tmpscf) || $base->bail("Could not read temporary scaffold file $tmpscf: $!\n");
+ while (<TMPSCF>){
+ print OUT;
+ }
+ close(TMPSCF);
+ unlink($tmpscf) || $base->bail("Could not remove temporary scaffold file $tmpscf: $!\n");
+}
+close(OUT);
+
+if ($minSeqId > $minCtgId){
+ print "Max ID: $minSeqId\n";
+} else {
+ print "Max ID: $minCtgId\n";
+}
+
+exit(0);
+
+
+
+
+###############################################################################
+
+
+# LIBRARY NAME PARSING
+sub parseInsertFile {
+ my $IN = shift;
+
+ while (<IN>){
+ if (/GenomicLibrary Id=\"(\S+)\" acc=\"(\d+)\"/){
+ $libnames{$2} = $1;
+ print STDERR "lib-id = $2; lib-name = $1\n";
+ }
+ }
+} # parseInsertFile
+
+sub parseLibMapFile {
+ my $IN = shift;
+
+ while (<IN>){
+ my ($id, $name) = split(' ', $_);
+ $libnames{$id} = $name;
+ }
+}
+
+# POSITION FILE PARSER
+
+# parse TIGR-style .pos file
+sub parsePosFile {
+ my $IN = shift;
+ my $pos = tell IN;
+ while (<IN>){
+ chomp;
+ my ($seqname, $ver, $poss) = split('\t', $_);
+ if ($seqname ne "SequenceName"){ # skip header
+ if (! exists $seqids{$seqname}){
+ $base->bail("Have not seen sequence $seqname before processing pos file");
+ }
+ #print "pos of $seqids{$seqname} $seqname is $pos\n";
+ $posidx{$seqids{$seqname}} = $pos;
+ }
+ $pos = tell IN;
+ }
+} # parse TIGR-style .pos file
+
+
+# MATES PARSING FUNCTIONS
+
+# parse Trace Archive style XML files
+my $tag;
+my $library;
+my $template;
+my $clipl;
+my $clipr;
+my $mean;
+my $stdev;
+my $end;
+my $seqId;
+
+sub parseTraceInfoFile {
+ my $IN = shift;
+
+ my $xml = new XML::Parser(Style => 'Stream');
+
+ if (! defined $xml){
+ $base->bail("Cannot create an XML parser");
+ }
+
+ # start parsing away. The hashes will magically fill up
+
+ $xml->parse($IN);
+
+} # parseTraceInfoFile
+
+
+# Celera .frg
+# populates %seqids, %seqnames, and %seq_range, %libraries, %seenlib, %seqinsert
+sub parseFrgFile {
+ my $IN = shift;
+
+ my $FRG_VERSION = 1;
+
+ my %seqlibrary;
+ my %liborientation;
+
+ while (my $record = getRecord($IN)) {
+ my ($type, $fields, $recs) = parseRecord($record);
+
+ if ($type eq "VER") {
+ $FRG_VERSION = $$fields{ver};
+ next;
+ }
+
+ if ($type eq "FRG") {
+ my $id = getCAId($$fields{acc});
+ my $iid = $minSeqId++;
+ my $nm = $$fields{src};
+ my @lines = split('\n', $nm);
+ $nm = $lines[0]; # join('', @lines);
+ if ($byaccession || !defined $nm || $nm =~ /^\s*$/) {
+ $seqnames{$iid} = $id;
+ } else {
+ $seqnames{$iid} = $nm;
+ $seqids{$nm} = $iid;
+ }
+ $seqids{$id} = $iid;
+ my ($seql, $seqr) = split(',', $$fields{clr});
+ $seq_range{$iid} = "$seql $seqr";
+ #print STDERR "$id $iid clr: $seql $seqr\n";
+ print TMPSEQ "#$iid\n";
+ print TMPSEQ "$$fields{seq}";
+ print TMPSEQ "#\n";
+ print TMPSEQ "$$fields{qlt}";
+ print TMPSEQ "#\n";
+
+ if ($FRG_VERSION == 2) {
+ my $lib = $$fields{lib};
+ $seqlibrary{$$fields{acc}} = $lib;
+
+ ## generate the unmated insert
+ if ($liborientation{$lib} eq "U") {
+ my $id = $minSeqId++;
+ $seqinsert{$iid} = $id;
+ $insid{$id} = $id;
+ $seenlib{$id} = $lib;
+ $forw{$id} = $iid;
+ }
+ }
+
+ next;
+ }
+
+ if (($type eq "DST") || ($type eq "LIB")) {
+ my $id = getCAId($$fields{acc});
+ $libraries{$id} = "$$fields{mea} $$fields{std}";
+ #$libid{$id} = $minSeqId++;
+
+ if ($FRG_VERSION == 2) {
+ $liborientation{$id} = $$fields{ori};
+ }
+ next;
+ }
+
+ if ($type eq "LKG") {
+ my $id = $minSeqId++;
+
+ if ($FRG_VERSION == 2) {
+ my $frgcount = 0;
+ my $lib1 = undef;
+ my $frg1 = undef;
+
+ ## Version 2 has 2 fields named frg, so we can't use the parseRecord results
+ foreach (split /\n/, $record) {
+ chomp;
+ my ($key, $acc) = split /:/;
+
+ if ($key eq "frg") {
+ $base->bail("LKG References unknown frg $acc\n")
+ if (!exists $seqlibrary{$acc});
+
+ $base->bail("Only 2 frgs per LKG is supported: frg:$acc!\n")
+ if ($frgcount == 3);
+
+ $frgcount++;
+
+ my $lib = $seqlibrary{$acc};
+ $seqinsert{$seqids{$acc}} = $id;
+
+ if ($frgcount == 1) {
+ $seenlib{$id} = $lib;
+ $forw{$id} = $seqids{$acc};
+
+ $lib1 = $lib;
+ $frg1 = $acc;
+
+ if ($liborientation{$lib} eq "I") {} # standard, nothing to do
+ elsif ($liborientation{$lib} eq "O") { $inserttype{$id} = "T" }
+ else {
+ $base->bail("ERROR: Library $lib has unsupported orienation $liborientation{$lib}\n");
+ }
+ } elsif ($frgcount == 2) {
+ $rev{$id} = $seqids{$acc};
+
+ $base->bail("ERROR: Frgs come from different libraries $frg1 [$lib1] $acc [$lib]\n")
+ if ($lib ne $lib1);
+ }
+ }
+ }
+ } else {
+ $seenlib{$id} = $$fields{dst};
+ $seqinsert{$seqids{$$fields{fg1}}} = $id;
+ $seqinsert{$seqids{$$fields{fg2}}} = $id;
+ $forw{$id} = $seqids{$$fields{fg1}};
+ $rev{$id} = $seqids{$$fields{fg2}};
+ if ($$fields{ori} eq "O") {
+ $inserttype{$id} = "T";
+ }
+ }
+
+ next;
+ }
+ }
+
+} #parseFrgFile
+
+# multi-fasta formatted file
+# accepts one of the following headers:
+# >seqname
+# >seqname clearleft clearright
+# >seqname \d+ \d+ \d+ clearleft clearright
+sub parseFastaFile {
+ my ($seqfile, $qualfile, $guess_mates) = @_;
+
+ my $pf = new AMOS::ParseFasta($seqfile);
+ my $qf;
+ if (defined $qualfile){
+ $qf = new AMOS::ParseFasta($qualfile, '>', ' ');
+ }
+ my %inserts;
+ while (my ($head, $data) = $pf->getRecord()){
+ my $seqname;
+ my $cll;
+ my $clr;
+ if ($head =~ /^(\S+)\s+\d+\s+\d+\s+\d+\s+(\d+)\s+(\d+)/){
+ # TIGR format
+ $seqname = $1; $cll = $2; $clr = $3;
+ } elsif ($head =~ /^(\S+)\s+(\d+)\s+(\d+)/){
+ # just name and clear range
+ $seqname = $1; $cll = $2; $clr = $3;
+ } elsif ($head =~ /^(\S+)/){
+ # just name
+ $seqname = $1;
+ }
+
+ if (! defined $cll){
+ $cll = 0;
+ $clr = length($data);
+ }
+
+ my $id = $minSeqId++;
+ $seqnames{$id} = $seqname;
+ #print STDERR "got $seqname $id\n";
+ $seqids{$seqname} = $id;
+
+ # Detect mate pairs
+ if ($guess_mates && $seqname =~ m/^(.+)[.\/]([12])$/) {
+ # Sequences with names ending in .1 or .2 or /1 or /2 are mate pairs
+ my $insname = $1;
+ $inserts{$insname}{$2} = $id;
+ #push @{$inserts{$insname}}, $id;
+ }
+
+ # so we don't overwrite an externally provided clear range
+ if (! exists $seq_range{$id}){
+ $seq_range{$id} = "$cll $clr";
+ } else {
+ ($cll, $clr) = split(' ', $seq_range{$id});
+ }
+
+ print TMPSEQ "#$id\n";
+ for (my $i = 0; $i <= length($data); $i+= 60){
+ print TMPSEQ substr($data, $i, 60), "\n";
+ }
+ print TMPSEQ "#\n";
+ my $qualdata = "";
+ if (defined $qualfile){
+ my ($qh, $qdata) = $qf->getRecord();
+ if ($qh !~ /^$seqname/){
+ $base->bail("Sequence and quality records must agree: $seqname != $qh\n");
+ }
+ my @quals = split(' ', $qdata);
+ if ($#quals + 1 != length($data)){
+ $base->bail(sprintf("Sequence and quality records must have same length for $seqname: %d vs %d\n", length($data), $#quals + 1));
+ }
+ for (my $i = 0; $i <= $#quals; $i++){
+ if ($quals[$i] <= 0) {$quals[$i] = 1;}
+ if ($quals[$i] > 60) {$quals[$i] = 60;}
+ $qualdata .= chr(ord('0') + $quals[$i]);
+ }
+ } else {
+ for (my $i = 0; $i < $cll; $i++){
+ $qualdata .= chr(ord('0') + $BADQUAL);
+ }
+ for (my $i = $cll; $i < $clr; $i++){
+ $qualdata .= chr(ord('0') + $GOODQUAL);
+ }
+ for (my $i = $clr; $i < length($data); $i++){
+ $qualdata .= chr(ord('0') + $BADQUAL);
+ }
+ }
+
+ for (my $i = 0; $i <= length($qualdata); $i+= 60){
+ print TMPSEQ substr($qualdata, $i, 60), "\n";
+ }
+ print TMPSEQ "#\n";
+ }
+
+ # Put mated reads in a proper library
+ if ($guess_mates && scalar keys %inserts > 0) {
+ print STDERR "Processing mates\n";
+ my $insid = 1;
+ my $libname = 'mated';
+ my $inssize = ''; # insert avg size and stddev is unknown
+ $libraries{$libname} = $inssize;
+ for my $insname (keys %inserts) {
+ my %hash = %{$inserts{$insname}};
+ if (scalar keys %hash == 2) {
+ # a mate pair
+ $seqinsert{$hash{'1'}} = $insid;
+ $seqinsert{$hash{'2'}} = $insid;
+ $forw{$insid} = $hash{'1'};
+ $rev{$insid} = $hash{'1'};
+ $seenlib{$insid} = $libname;
+ $insid{$insid} = $insid;
+ $insid++;
+ delete $inserts{$insname};
+ }
+ }
+ }
+
+}
+
+# parses BAMBUS style .mates file
+# * expects %seqids to be populated
+# * populates %libraries, %forw, %rev, %seenlib, %seqinsert
+sub parseMatesFile {
+ my $IN = shift;
+
+ print STDERR "Processing mates\n";
+
+ my @libregexp;
+ my @libids;
+ my @pairregexp;
+ my $insname = 1;
+
+ while (<$IN>){
+ chomp;
+
+ if (/^\#/) { # comment
+ next;
+ }
+
+ elsif (/^\s*$/) { # empty line
+ next;
+ }
+
+ elsif (/^library/){
+ # line should match: library <name> <min_size> <max_size> <regexp>
+ my @recs = split('\t', $_);
+ if ($#recs < 3 || $#recs > 4){
+ print STDERR "Only ", $#recs + 1, " fields\n";
+ $base->logError("Improperly formated line $. in \"$matesfile\".\nMaybe you didn't use TABs to separate fields\n", 1);
+ next;
+ }
+ if ($#recs == 4){
+ $libregexp[++$#libregexp] = $recs[4];
+ $libids[++$#libids] = $recs[1];
+ }
+ my $mean = ($recs[2] + $recs[3]) / 2;
+ my $stdev = ($recs[3] - $recs[2]) / 6;
+ $libraries{$recs[1]} = "$mean $stdev";
+ next;
+ } # if library
+
+ elsif (/^pair/){
+ # line expected to match: pair <regexp_forw> <regexp_rev>
+ my @recs = split('\t', $_);
+ if ($#recs != 2){
+ $base->logError("Improperly formated line $. in \"$matesfile\".\nMaybe you didn't use TABs to separate fields\n");
+ next;
+ }
+ $pairregexp[++$#pairregexp] = "$recs[1] $recs[2]";
+ next;
+ }
+
+ else {
+ # now we just deal with lines for pairs: <seq_forw> <seq_rev> <library_name>
+ my @recs = split('\t', $_);
+ if ($#recs != 2){
+ $base->logError("Improperly formated line $. in \"$matesfile\".\nMaybe you didn't use TABs to separate fields\n");
+ next;
+ }
+ # make sure we've seen these sequences
+ if (! defined $seqids{$recs[0]}){
+ $base->logError("Sequence $recs[0] has no ID at line $. in \"$matesfile\"");
+ next;
+ }
+ if (! defined $seqids{$recs[1]} ){
+ $base->logError("Sequence $recs[1] has no ID at line $. in \"$matesfile\"");
+ next;
+ }
+ if (defined $recs[2]){
+ $seenlib{$insname} = $recs[2];
+ } else {
+ $base->logError("$insname has no library\n");
+ }
+ $forw{$insname} = $seqids{$recs[0]};
+ $rev{$insname} = $seqids{$recs[1]};
+ $seqinsert{$seqids{$recs[0]}} = $insname;
+ $seqinsert{$seqids{$recs[1]}} = $insname;
+ $insname++;
+ }
+
+ } # while <IN>
+
+ # now we have to go through all the sequences and assign them to inserts
+ while (my ($nm, $sid) = each %seqids) {
+ for my $r (0 .. $#pairregexp){
+ my ($freg, $revreg) = split(' ', $pairregexp[$r]);
+ $base->logLocal("trying $freg and $revreg on $nm\n", 2);
+ if ($nm =~ /$freg/){
+ $base->logLocal("got forw $1\n", 2);
+ if (! exists $forw{$1}){
+ $forw{$1} = $sid;
+ $seqinsert{$sid} = $1;
+ }
+ last;
+ }
+ if ($nm =~ /$revreg/){
+ $base->logLocal("got rev $1\n", 2);
+ if (! exists $rev{$1}){
+ $rev{$1} = $sid;
+ $seqinsert{$sid} = $1;
+ }
+ last;
+ }
+ } # for each pairregexp
+ } # while each %seqids
+
+ while (my ($ins, $nm) = each %forw) {
+ if (! exists $insid{$ins}){
+ $insid{$ins} = $minSeqId++;
+ }
+ if (! exists $seenlib{$ins}){
+ my $found = 0;
+ $nm = $seqnames{$nm};
+ for (my $l = 0; $l <= $#libregexp; $l++){
+ $base->logLocal("Trying $libregexp[$l] on $nm\n", 2);
+ if ($nm =~ /$libregexp[$l]/){
+ $base->logLocal("found $libids[$l]\n", 2);
+ $seenlib{$ins} = $libids[$l];
+ $found = 1;
+ last;
+ }
+ }
+ if ($found == 0){
+ $base->logError("Cannot find library for \"$nm\"");
+ next;
+ }
+ }
+ }
+
+ while (my ($ins, $nm) = each %rev) {
+ if (! exists $insid{$ins}){
+ $insid{$ins} = $minSeqId++;
+ }
+ if (! exists $seenlib{$ins}){
+ my $found = 0;
+ $nm = $seqnames{$nm};
+ for (my $l = 0; $l <= $#libregexp; $l++){
+ $base->logLocal("Trying $libregexp[$l] on $nm\n", 2);
+ if ($nm =~ /$libregexp[$l]/){
+ $base->logLocal("found $libids[$l]\n", 2);
+ $seenlib{$ins} = $libids[$l];
+ $found = 1;
+ last;
+ }
+ }
+ if ($found == 0){
+ $base->logError("Cannot find library for \"$nm\"");
+ next;
+ }
+ }
+ }
+
+} # parseMateFile;
+
+
+# CONTIG PARSING FUNCTIONS
+#
+# Each function parses either a file or a database table and
+# fills in the following hashes:
+#
+# %contigs - contig_ids and sizes
+# %seqids - seq_name to seq_id
+# %seqnames - seq_id to seq_name
+# %seq_range - seq_id to seq_range
+# %asm_range - seq_id to asm_range as blank delimited string
+# %seqcontig - seq_id to contig
+# %contigcons - contig consensus for each contig
+
+
+
+# Celera .asm
+# populates %contigs, %asm_range, %seqcontig, %contigcons
+# expects %seq_range to be populated
+sub parseAsmFile {
+ my $IN = shift;
+
+ while (my $record = getRecord($IN))
+ {
+ my ($type, $fields, $recs) = parseRecord($record);
+
+ if (($type eq "CCO") ||
+ ($INCLUDE_SURROGATE && ($type eq "UTG") && ($$fields{sta} eq "S")) ||
+ ($UTG_MESSAGES && ($type eq "UTG")))
+ {
+ my $sts = "C";
+ $sts = $$fields{sta} if $type eq "UTG";
+ $sts = $$fields{pla} if $type eq "CCO";
+
+ my $id = getCAId($$fields{acc});
+ my $iid = $minCtgId++;
+ my $contiglen = $$fields{len};
+
+ $ctgnames{$iid} = $id;
+ $ctgids{$id} = $iid;
+
+ my $coord;
+
+ my $consensus = $$fields{cns};
+ my @consensus = split('\n', $consensus);
+ $consensus = join('', @consensus);
+
+ print TMPCTG "#$iid $sts\n";
+ print TMPCTG $$fields{cns};
+ print TMPCTG "#\n";
+ print TMPCTG $$fields{qlt};
+
+ $contigs{$iid} = $contiglen;
+
+ for (my $i = 0; $i <= $#$recs; $i++)
+ {
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+ if ($sid eq "MPS")
+ {
+ if (! exists $seqids{getCAId($$sfs{mid})}){
+ $base->bail("Have not seen sequence with id " . getCAId($$sfs{mid}));
+ }
+
+ my $fid = $seqids{getCAId($$sfs{mid})};
+ print TMPCTG "#$fid\n";
+ print TMPCTG $$sfs{del};
+ $seqcontig{$fid} = $id;
+ $contigseq{$id} .= "$fid ";
+
+ my ($asml, $asmr) = split(',', $$sfs{pos});
+ $asm_range{$fid} = "$asml $asmr";
+ }
+ }
+ print TMPCTG "#\n";
+ }
+ elsif ($type eq "SCF")
+ {
+ my $off = 0;
+ print TMPSCF "{SCF\n";
+ my $id = getCAId($$fields{acc});
+ my $iid = $minCtgId++;
+ $ctgids{$id} = $iid;
+ $ctgnames{$iid} = $id;
+ print TMPSCF "iid:$iid\n";
+ print TMPSCF "eid:$id\n";
+ for (my $i = 0; $i <= $#$recs; $i++)
+ {
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+ if ($sid eq "CTP")
+ {
+ print TMPSCF "{TLE\n";
+ print TMPSCF "src:$ctgids{$$sfs{ct1}}\n";
+ print TMPSCF "off:$off\n";
+
+ if ($$sfs{ori} eq "N" ||
+ $$sfs{ori} eq "I")
+ {
+ print TMPSCF "clr:0,$contigs{$ctgids{$$sfs{ct1}}}\n";
+ }
+ else
+ {
+ print TMPSCF "clr:$contigs{$ctgids{$$sfs{ct1}}},0\n";
+ }
+
+ print TMPSCF "}\n";
+ $off += $contigs{$ctgids{$$sfs{ct1}}};
+ $off += int($$sfs{mea});
+
+ if ($i == $#$recs && $$sfs{ct1} != $$sfs{ct2})
+ {
+ print TMPSCF "{TLE\n";
+ print TMPSCF "src:$ctgids{$$sfs{ct2}}\n";
+ print TMPSCF "off:$off\n";
+
+ if ($$sfs{ori} eq "N" ||
+ $$sfs{ori} eq "O")
+ {
+ print TMPSCF "clr:0,$contigs{$ctgids{$$sfs{ct2}}}\n";
+ }
+ else
+ {
+ print TMPSCF "clr:$contigs{$ctgids{$$sfs{ct2}}},0\n";
+ }
+
+ print TMPSCF "}\n";
+ }
+ }
+ }
+ print TMPSCF "}\n";
+ }
+ elsif ($type eq "CLK")
+ {
+ print TMPSCF "{CTE\n";
+ print TMPSCF "nds:$ctgids{$$fields{co1}},$ctgids{$$fields{co2}}\n";
+ print TMPSCF "adj:$$fields{ori}\n";
+ print TMPSCF "sze:$$fields{mea}\n";
+ print TMPSCF "std:$$fields{std}\n";
+ print TMPSCF "typ:M\n";
+ print TMPSCF "}\n";
+ }
+ elsif ($type eq "AFG")
+ {
+ ## Grab the clear range from the AFG records if present
+
+ if (exists $$fields{clr})
+ {
+ my $acc = getCAId($$fields{acc});
+
+ if ($acc =~ /^\((\w+),(\w+)\)/)
+ {
+ $acc = $1;
+ }
+
+ my $iid = $seqids{$acc};
+
+ my ($seql, $seqr) = split(/,/, $$fields{clr});
+ my $clrstr = "$seql $seqr";
+
+ # if (!defined $seq_range{$iid} || $seq_range{$iid} ne $clrstr)
+ # {
+ # my $origclr = $seq_range{$iid};
+ # print STDERR "Updating $acc \"$iid\" clr range from $origclr to $clrstr\n";
+ # }
+
+ $seq_range{$iid} = $clrstr;
+ }
+ }
+ }
+} # parseAsmFile
+
+# TIGR .asm
+sub parseTAsmFile {
+ my $IN = shift;
+
+ my $ctg;
+ my $len;
+ my $sname;
+ my $alend;
+ my $arend;
+ my $slend;
+ my $srend;
+ my $sid;
+ my $consensus;
+ my $iid;
+ while (<$IN>){
+ if (/^sequence\s+(\w+)/){
+ $len = length($1);
+ $consensus = $1;
+ next;
+ }
+ if (/^asmbl_id\s+(\w+)/){
+ $ctg = $1;
+ $iid = $minCtgId++;
+ $ctgnames{$iid} = $ctg;
+ $ctgids{$ctg} = $iid;
+ $contigs{$iid} = $len; # here we assume that length
+ # was already computed
+ next;
+ }
+ if (/^seq_name\s+(\S+)/){
+ $sname = $1;
+ if (! exists $seqids{$sname}){
+ $sid = $minSeqId++;
+ $seqids{$sname} = $sid;
+ $seqnames{$sid} = $sname;
+ } else {
+ $sid = $seqids{$sname};
+ }
+
+ $seqcontig{$sid} = $iid;
+ $contigseq{$iid} .= "$sid ";
+ next;
+ }
+ if (/^asm_lend\s+(\d+)/){
+ $alend = $1 - 1; # 0 based
+ next;
+ }
+ if (/^asm_rend\s+(\d+)/){
+ $arend = $1;
+ next;
+ }
+ if (/^seq_lend\s+(\d+)/){
+ $slend = $1 - 1;
+ next;
+ }
+ if (/^seq_rend\s+(\d+)/){
+ $srend = $1;
+ next;
+ }
+ if (/^offset/){
+ $seq_range{$sid} = "$slend $srend";
+ $asm_range{$sid} = "$alend $arend";
+ next;
+ }
+ }
+} # parseTAsmFile
+
+
+sub parsePHDFiles {
+ my $IN = shift;
+
+ while(<$IN>) {
+ if(m/^DS CHROMAT_FILE: (\S+) PHD_FILE: (\S+)/) {
+ open(PHD_FILE, "<../phd_dir/$2") || $base->bail("Could not read file $2: $!\n");
+
+ my $seqname = $1;
+ my $pos_list;
+
+ while(<PHD_FILE>) {
+ if(m/BEGIN_DNA/) {
+ my $seq;
+
+
+ while(<PHD_FILE>) {
+ if (m/END_DNA/) {
+ last;
+ }
+ chomp();
+ my ($nuc, $qual, $p) = split;
+ $seq .= $nuc;
+ $pos_list .= " " . $p;
+ }
+
+ last;
+ }
+ }
+
+ if (! exists $seqids{$seqname}){
+ print("Have not seen sequence $seqname before processing pos file");
+ } else {
+ # put pos into posidx
+ $posidx{$seqids{$seqname}} = $pos_list;
+ }
+ }
+ close(PHD_FILE);
+ }
+}
+
+
+# New .ACE format
+sub parseACEFile {
+ my ($IN, $qualfile) = @_;
+
+ my $ctg;
+ my $len;
+ my $sname;
+ my $alend;
+ my $arend;
+ my $slend;
+ my $srend;
+ my $sid;
+
+ my $inContig = 0;
+ my $inSequence = 0;
+ my $inQual = 0;
+
+ my $contigName;
+ my $contigLen;
+ my $contigSeqs;
+ my $seqName;
+ my %offset;
+ my %rc;
+ my $seq;
+ my @gaps;
+ my $iid;
+ my $first = 1;
+ my $qual = "";
+ my $qf;
+ my %qRecPos;
+ if (defined $qualfile){
+ $qf = new AMOS::ParseFasta($qualfile, '>', ' ');
+ # index the records by headers and file positions
+ my $nextPos = $qf->tell();
+ while (my ($qh) = $qf->getRecord()){
+ $qh =~ /^(\S+)/; # extract short name
+ $qRecPos{$1} = $nextPos;
+ $nextPos = $qf->tell();
+ }
+ }
+ while (<$IN>){
+ if (/^CO (\S+) (\d+) (\d+)/){
+ ($contigName, $contigLen, $contigSeqs) = ($1, $2, $3);
+ if ($first != 1){print TMPCTG "#\n";}
+ $first = 0;
+ $iid = $minCtgId++;
+ $ctgnames{$iid} = $contigName;
+ $ctgids{$contigName} = $iid;
+ #$contigs{$iid} = $contigLen;
+ $inContig = 1;
+ $seq = "";
+ %offset = ();
+ next;
+ }
+ if ($inContig == 1 && /^\s*$/){ # end of contig
+ $inContig = 0;
+ $seq =~ s/\*/-/g;
+ @gaps = ();
+ my $gap = index($seq, "-");
+ while ($gap != -1){
+ push(@gaps, $gap + 1);
+ $gap = index($seq, "-", $gap + 1);
+ }
+ $contigs{$iid} = $contigLen;
+ # print consensus record
+ print TMPCTG "#$iid C\n";
+ for (my $c = 0; $c < length($seq); $c+= 60){
+ print TMPCTG substr($seq, $c, 60), "\n";
+ }
+ print TMPCTG "#\n";
+ #my $qual = $seq;
+ #$qual =~ s/./X/;
+ ## print quality values (all Xs
+ #for (my $c = 0; $c < length($qual); $c += 60){
+ #print TMPCTG substr($qual, $c, 60), "\n";
+ #}
+
+ next;
+ }
+
+ if ($inSequence == 1 && $_ =~ /^\s*$/){
+ $inSequence = 0;
+ next;
+ }
+
+ if ($inContig == 1 || $inSequence == 1) {
+ chomp;
+ $seq .= $_;
+ next;
+ }
+
+ if (/^BQ/){
+ $inQual = 1;
+ $qual = "";
+ next;
+ }
+
+ if ($inQual == 1 && $_ =~ /^\s*$/){
+ $inQual = 0;
+ my $tmpqual = $qual;
+ my $qual = "";
+ my $q = 0;
+ # create quality values for consensus gaps
+ for (my $c = 0; $c < length($seq); $c++){
+ if (substr($seq, $c, 1) eq "-"){
+ if ($q >= length($tmpqual)){
+ $q = length($tmpqual) - 1;
+ }
+ $qual .= substr($tmpqual, $q, 1); # next seen quality
+ } else {
+ $qual .= substr($tmpqual, $q++, 1);
+ }
+ }
+ for (my $c = 0; $c < length($qual); $c += 60){
+ print TMPCTG substr($qual, $c, 60), "\n";
+ }
+ }
+
+ if ($inQual == 1){
+ chomp;
+ $_ =~ s/^\s+//;
+ my @quals = split(' ', $_);
+ for (my $q = 0; $q <= $#quals; $q++){
+ if ($quals[$q] > 60) {$quals[$q] = 60;}
+ $qual .= chr(ord("0")+ $quals[$q]);
+ }
+ }
+
+
+ if (/^AF (\S+) (\w) (-?\d+)/){
+ # AF record contains the offset of the sequence
+ # in the contig, 1-based. Also indicates whether sequence
+ # is reverse complemented
+ $offset{$1} = $3 - 1;
+ $rc{$1} = $2;
+ next;
+ }
+
+ if (/^RD (\S+)/){
+ # indicates start of a sequence record
+ $inSequence = 1;
+ $seqName = $1;
+ $seq = "";
+ next;
+ }
+
+ if (/^QA -?(\d+) -?(\d+) -?(\d+) (\d+)/){
+ # at this point the sequence ended
+ my ($end5, $end3, $cll, $clr) = ($1, $2, $3, $4);
+ $cll--;
+ my $offset = $offset{$seqName};
+
+ # ACE files gaps are '*' instead of '-'
+ $seq =~ s/\*/-/g;
+
+ # shift offset to beginning of clear range
+ # otherwise it points to the beginning of the entire sequence
+ # shown in the file
+ $len = length($seq);
+ $offset += $cll;
+
+ # @sdels contains the positions of gaps in the sequence
+ my $ndel = 0;
+ my @sdels = ();
+
+ my $allseq = $seq; # all the sequence (will be chopped later)
+
+ # gap positions are wrt to the clear range
+ # in the aligned orientation
+ $seq = substr($seq, $cll, $clr - $cll);
+ for (my $s = 0; $s < length($seq); $s++){
+ if (substr($seq, $s, 1) eq "-"){
+ push @sdels, $ndel;
+ } else {
+ $ndel++;
+ }
+ }
+ if ($rc{$seqName} eq "C"){
+ $seq = reverseComplement($seq);
+ $allseq = reverseComplement($allseq);
+ }
+
+
+ # if read is reversed swap cll and clr
+ if ($rc{$seqName} eq "C"){
+ my $tmp = $len - $cll;
+ $cll = $len - $clr;
+ $clr = $tmp;
+ }
+
+ my $pref = substr($allseq, 0, $cll); # prefix of sequence
+
+ my $i = 0;
+ my $asml = $offset;
+ my $asmr = $asml + $clr - $cll;
+
+ while ($pref =~ /-/g) { # make $cll ungapped
+ $cll--;
+ $clr--;
+ }
+ while ($seq =~ /-/g){ #make $clr ungapped
+ $clr--;
+ }
+
+ # if reverse complemented, reverse the assembly range
+ if ($rc{$seqName} eq "C"){
+ my $tmp = $asml;
+ $asml = $asmr;
+ $asmr = $tmp;
+ }
+
+ # assign sequence id and populate all necessary data-structures
+ my $seqId;
+ if (! exists $seqids{$seqName}){
+ #print STDERR "Couldnt find id for $seqName\n";
+ $seqId = $minSeqId++;
+ $seqids{$seqName} = $seqId;
+ $seqnames{$seqId} = $seqName;
+ } else {
+ $seqId = $seqids{$seqName};
+ }
+ $seqcontig{$seqId} = $iid;
+ $contigseq{$iid} .= "$seqId ";
+ if ($cll > $clr) {
+ $seq_range{$seqId} = "$clr $cll";
+ } else {
+ $seq_range{$seqId} = "$cll $clr";
+ }
+ $asm_range{$seqId} = "$asml $asmr";
+
+ if ($readsDone == 0) { # no read info, must generate
+ # Sequence string
+ print TMPSEQ "#$seqId\n";
+ $allseq =~ s/-//g;
+ for (my $i = 0; $i <= length($allseq); $i+= 60){
+ print TMPSEQ substr($allseq, $i, 60), "\n";
+ }
+ # Quality values
+ print TMPSEQ "#\n";
+ my $qualdata = "";
+ if (defined $qualfile){
+ $seqName =~ /^([^.]+)/;
+ my $shortName = $1;
+ if ( ! defined $qRecPos{$shortName} ){
+ $base->bail("Sequence $shortName not found in quality file\n");
+ }
+ $qf->seek($qRecPos{$shortName});
+ my ($qh, $qdata) = $qf->getRecord();
+ my @quals = split(/ +/, $qdata);
+ for (my $i = 0; $i <= $#quals; $i++){
+ if ($quals[$i] <= 0) {$quals[$i] = 1;}
+ if ($quals[$i] > 60) {$quals[$i] = 60;}
+ $qualdata .= chr(ord('0') + $quals[$i]);
+ }
+ } else {
+ for (my $i = 0; $i < $cll; $i++){
+ $qualdata .= chr(ord('0') + $BADQUAL);
+ }
+ for (my $i = $cll; $i < $clr; $i++){
+ $qualdata .= chr(ord('0') + $GOODQUAL);
+ }
+ for (my $i = $clr; $i < length($allseq); $i++){
+ $qualdata .= chr(ord('0') + $BADQUAL);
+ }
+ }
+
+ my $seqlength = length $allseq;
+ my $quallength = length $qualdata;
+ if ( $seqlength != $quallength ) {
+ $base->bail("Error: There should be a quality score for each nucleotide in read $seqName, but got $seqlength nt and $quallength scores\n");
+ }
+ for (my $i = 0; $i <= length($qualdata); $i+= 60){
+ print TMPSEQ substr($qualdata, $i, 60), "\n";
+ }
+ print TMPSEQ "#\n";
+ } # if $readsDone == 0
+ print TMPCTG "#$seqId\n";
+ print TMPCTG join (" ", @sdels), "\n";
+ next;
+ }
+ } # while <$IN>
+
+ if (defined $contigName) {
+ print TMPCTG "#\n";
+ } # else there were no contigs
+
+} #parseAceFile
+
+
+
+# TIGR .contig file
+sub parseContigFile {
+ my $IN = shift;
+
+ my $ctg;
+ my $len;
+ my $sname;
+ my $alend;
+ my $arend;
+ my $slend;
+ my $srend;
+ my $sid;
+ my $incontig = 0;
+ my $consensus = "";
+ my $read_seq = "";
+ my @sdels;
+ my $ndel;
+ my $slen;
+ my $iid;
+
+ my ($qualDb, $qRecPos) = _index_qual_file($qualfile);
+
+ my ($firstContig, $firstRead) = (1, 1);
+
+ while (<$IN>) {
+ chomp;
+
+ if (/^#/) {
+ # New contig or read
+
+ if ( ($incontig == 0) && ($firstRead == 0) ) {
+ # End of a read. Save it!
+ _addRead( $sid, $sname, $read_seq, $slend, $srend, $qualDb, $qRecPos);
+ $read_seq = "";
+ }
+
+ if (/^\#\#(\S+) \d+ (\d+)/ ) {
+ # Beginning of a new contig
+ if ($firstContig != 1){
+ print TMPCTG "#$sid\n";
+ print TMPCTG join(" ", @sdels), "\n";
+ print TMPCTG "#\n";
+ $arend = $alend + $slen;
+ $asm_range{$sid} = "$alend $arend";
+ #print TMPCTG "#\n";
+ }
+ $firstContig = 0;
+ $consensus = "";
+ $ctg = $1;
+ $iid = $minCtgId++;
+ $ctgids{$ctg} = $iid;
+ $ctgnames{$iid} = $ctg;
+ $contigs{$iid} = $2;
+ $incontig = 1;
+ $slen = 0;
+ }
+
+ elsif (/^\#(\S+)\((\S+)\) .*\{(\S+) (\S+)\} <(\S+) (\S+)>/){
+ # Beginning of a new read (in a contig)
+ ($sname, $alend, my $clearleft, my $clearright) = ($1, $2, $3, $4);
+ $firstRead = 0;
+ if ($incontig == 1) {
+ print TMPCTG "#$iid C\n";
+ for (my $c = 0; $c < length($consensus); $c+=60){
+ print TMPCTG substr($consensus, $c, 60), "\n";
+ }
+ #print TMPCTG "$consensus\n";
+ print TMPCTG "#\n";
+ for (my $c = 0; $c < length($consensus); $c+=60){
+ for ($b = 0; $b < 60; $b++){
+ if ($b + $c >= length($consensus)){last;}
+ print TMPCTG "X";
+ }
+ print TMPCTG "\n";
+ }
+ #print TMPCTG "\n";
+ } else {
+ print TMPCTG "#$sid\n";
+ print TMPCTG join(" ", @sdels), "\n";
+ $arend = $alend + $slen;
+ $asm_range{$sid} = "$alend $arend";
+ $slen = 0;
+ }
+ $incontig = 0;
+ @sdels = ();
+ $ndel = 0;
+
+ # Assign sequence ID and populate all necessary data-structures
+ if (! exists $seqids{$sname}){
+ #$base->bail("Cannot find ID for sequence $sname\n");
+ $sid = $minSeqId++;
+ $seqids{$sname} = $sid;
+ $seqnames{$sid} = $sname;
+ } else {
+ $sid = $seqids{$sname};
+ }
+ $seqcontig{$sid} = $iid;
+ $contigseq{$iid} .= "$sid ";
+ if ($clearleft < $clearright){
+ $slend = $clearleft - 1;
+ $srend = $clearright;
+ } else {
+ $slend = $clearleft;
+ $srend = $clearright - 1;
+ }
+ $seq_range{$sid} = "$slend $srend";
+ }
+
+ else {
+ die "Internal error\n";
+ }
+ }
+ else {
+ if ($incontig){
+ # Contig sequence
+ $consensus .= $_;
+ } else {
+ # Read sequence
+ $read_seq .= $_;
+ $slen += length($_);
+ for (my $s = 0; $s < length($_); $s++){
+ if (substr($_, $s, 1) eq "-"){
+ push @sdels, $ndel;
+ } else {
+ $ndel++;
+ }
+ }
+ }
+ }
+ } # while in
+ # process last sequence
+ print TMPCTG "#$sid\n";
+ print TMPCTG join(" ", @sdels), "\n";
+ print TMPCTG "#\n";
+ $arend = $alend + $slen;
+ $asm_range{$sid} = "$alend $arend";
+ _addRead( $sid, $sname, $read_seq, $slend, $srend, $qualDb, $qRecPos);
+
+} # parseContigFile
+
+sub _addRead {
+ my ( $readIid, $readName, $readSeq, $clrLeft, $clrRight, $qualDb, $qRecPos) = @_;
+ if ($readsDone == 0) { # no read info, must generate
+ # Sequence string
+ print TMPSEQ "#$readIid\n";
+ $readSeq =~ s/-//g;
+ for (my $i = 0; $i <= length($readSeq); $i+= 60){
+ print TMPSEQ substr($readSeq, $i, 60), "\n";
+ }
+ # Quality values
+ print TMPSEQ "#\n";
+ my $qualdata = "";
+ if (defined $qualfile){
+ $readName =~ /^([^.]+)/;
+ my $shortName = $1;
+ if ( ! defined $$qRecPos{$shortName} ){
+ $base->bail("Sequence $shortName not found in quality file\n");
+ }
+ $qualDb->seek($$qRecPos{$shortName});
+ my ($qh, $qdata) = $qualDb->getRecord();
+ my @quals = split(/ +/, $qdata);
+ for (my $i = 0; $i <= $#quals; $i++) {
+ if ($quals[$i] <= 0) {$quals[$i] = 1;}
+ if ($quals[$i] > 60) {$quals[$i] = 60;}
+ $qualdata .= chr(ord('0') + $quals[$i]);
+ }
+ } else {
+ for (my $i = 0; $i < $clrLeft; $i++){
+ $qualdata .= chr(ord('0') + $BADQUAL);
+ }
+ for (my $i = $clrLeft; $i < $clrRight; $i++){
+ $qualdata .= chr(ord('0') + $GOODQUAL);
+ }
+ for (my $i = $clrRight; $i < length($readSeq); $i++){
+ $qualdata .= chr(ord('0') + $BADQUAL);
+ }
+ }
+
+ my $seqlength = length $readSeq;
+ my $quallength = length $qualdata;
+ if ( $seqlength != $quallength ) {
+ $base->bail("Error: There should be a quality score for each nucleotide in read $readName, but got $seqlength nt and $quallength scores\n");
+ }
+
+ for (my $i = 0; $i <= $quallength; $i+= 60){
+ print TMPSEQ substr($qualdata, $i, 60), "\n";
+ }
+ print TMPSEQ "#\n";
+ } # if $readsDone == 0
+} # _addRead
+
+sub _index_qual_file {
+ my ($qualfile) = @_;
+ my $qualDb;
+ my %qRecPos;
+ if (defined $qualfile){
+ $qualDb = new AMOS::ParseFasta($qualfile, '>', ' ');
+ # index the records by headers and file positions
+ my $nextPos = $qualDb->tell();
+ while (my ($qualHeader) = $qualDb->getRecord()){
+ $qualHeader =~ /^(\S+)/; # extract short name
+ $qRecPos{$1} = $nextPos;
+ $nextPos = $qualDb->tell();
+ }
+ }
+ return $qualDb, \%qRecPos;
+}
+
+# Arachne .links scaffold file
+# assumptions: all contigs are forward
+# super ids are integers
+sub parseArachneScaff {
+ my $IN = shift;
+
+ # Fields in TAB delimited file
+ # 0 - super_id
+ # 1 - num_bases_in_super
+ # 2 - num_contigs_in_super
+ # 3 - ordinal_num_of_contig_in_super
+ # 4 - contig_id
+ # 5 - length_of_contig
+ # 6 - estimated_gap_before_contig
+ # 7 - estimated_gap_after_contig
+
+ my $lastsuper = undef;
+ my $offset = 0;
+ while (<$IN>) {
+ if (/^\#/) { next;}
+ my @fields = split('\t', $_);
+ #if ($fields[0] != $lastsuper){
+ if (!defined $lastsuper || $fields[0] != $lastsuper){
+ if (defined $lastsuper){
+ print TMPSCF "}\n"; # close scaffold
+ }
+ $lastsuper = $fields[0];
+ $offset = 0;
+ print TMPSCF "{SCF\n";
+ print TMPSCF "iid:$lastsuper\n";
+ print TMPSCF "eid:$lastsuper\n";
+ }
+ my $id = "contig_".$fields[4];
+ if (! exists $ctgids{$id}) {
+ $base->logError("Cannot find id for contig $id\n");
+ next;
+ }
+ # print contig tile
+ print TMPSCF "{TLE\n";
+ print TMPSCF "src:$ctgids{$id}\n";
+ print TMPSCF "off:$offset\n";
+ print TMPSCF "clr:0,$contigs{$ctgids{$id}}\n";
+ print TMPSCF "}\n";
+
+ # update offset
+ $offset += $fields[5] + $fields[7];
+ }
+ print TMPSCF "}\n"; # done here
+} # parseArachneScaff
+
+
+# Bambus/AMOS .scaff file
+sub parseScaff {
+ my $IN = shift;
+
+ # format of scaff file
+ #>scaffid numcontigs scaffbases scaffspan
+ #contigid orientation contiglen gapsize
+
+ # note gapsize is gap after contig
+
+ my $ps = new AMOS::ParseFasta($IN, ">", "\n");
+ while (my ($head, $data) = $ps->getRecord()){
+ $head =~ /(\S+).*/;
+ my $scfnam = $1;
+ my $scfid = $minSeqId++;
+
+ print TMPSCF "{SCF\n";
+ print TMPSCF "iid:$scfid\n";
+ print TMPSCF "eid:$scfnam\n";
+
+ my $offset = 0;
+
+ my @lines = split('\n', $data);
+ for (my $i = 0; $i <= $#lines; $i++){
+ my @fields = split(/\s+/, $lines[$i]);
+
+ if (! exists $ctgids{$fields[0]}) {
+ $base->logError("Cannot find id for contig $fields[0]\n");
+ next;
+ }
+
+ # print contig tile
+ print TMPSCF "{TLE\n";
+ print TMPSCF "src:$ctgids{$fields[0]}\n";
+ print TMPSCF "off:$offset\n";
+ if ($fields[1] eq "BE"){
+ print TMPSCF "clr:0,$contigs{$ctgids{$fields[0]}}\n";
+ } else {
+ print TMPSCF "clr:$contigs{$ctgids{$fields[0]}},0\n";
+ }
+ print TMPSCF "}\n";
+ $offset += $contigs{$ctgids{$fields[0]}} + $fields[3];
+ }
+
+ print TMPSCF "}\n";
+ }
+
+} # parseScaff
+
+###############################################################
+# XML parser functions
+###############################################################
+sub StartDocument {
+# print "starting\n";
+}
+
+sub EndDocument {
+# print "done\n";
+}
+
+sub StartTag {
+ $tag = lc($_[1]);
+
+ if ($tag eq "trace"){
+ $library = undef;
+ $template = undef;
+ $clipl = undef;
+ $clipr = undef;
+ $mean = undef;
+ $stdev = undef;
+ $end = undef;
+ $seqId = undef;
+ }
+}
+
+
+sub EndTag {
+ $tag = lc($_[1]);
+ if ($tag eq "trace"){
+ if (! defined $seqId){
+ $base->logError("trace has no name???\n");
+ }
+ if (! defined $library){
+ $base->logError("trace $seqId has no library\n");
+ }
+ if (! defined $mean){
+ $base->logError("library $library has no mean\n");
+ }
+
+ if (! defined $stdev){
+ $base->logError("library $library has no stdev\n");
+ }
+
+ if (defined $mean and defined $stdev){
+ $libraries{$library} = "$mean $stdev";
+ }
+
+ if (! defined $template){
+ $base->logError("trace $seqId has no template\n");
+ }
+
+ if (! defined $end) {
+ $base->logError("trace $seqId has no end\n");
+ }
+
+ if ($end eq "R"){
+ if (! exists $rev{$template} ||
+ $seqnames{$seqId} gt $seqnames{$rev{$template}}){
+ $rev{$template} = $seqId;
+ }
+ }
+
+ if ($end eq "F"){
+ if (! exists $forw{$template} ||
+ $seqnames{$seqId} gt $seqnames{$forw{$template}}){
+ $forw{$template} = $seqId;
+ }
+ }
+
+ $seqinsert{$seqId} = $template;
+ $seenlib{$template} = $library;
+
+
+ if (defined $clipl && defined $clipr){
+ $seq_range{$seqId} = "$clipl $clipr";
+ }
+ }
+
+ $tag = undef;
+}
+
+
+sub Text {
+ if (defined $tag){
+ if ($tag eq "insert_size"){
+ $mean = $_;
+ } elsif ($tag eq "insert_stdev"){
+ $stdev = $_;
+ } elsif ($tag eq "trace_name"){
+ my $seqName = $_;
+ $seqId = $minSeqId++;
+ $seqids{$seqName} = $seqId;
+ $seqnames{$seqId} = $seqName;
+ } elsif ($tag eq "library_id"){
+ $library = $_;
+ } elsif ($tag eq "seq_lib_id") {
+ if (! defined $library) {
+ $library = $_;
+ }
+ } elsif ($tag eq "template_id"){
+ $template = $_;
+ } elsif ($tag eq "trace_end"){
+ $end = $_;
+ } elsif ($tag eq "clip_quality_left" ||
+ $tag eq "clip_vector_left"){
+ if (! defined $clipl || $_ > $clipl){
+ $clipl = $_;
+ }
+ } elsif ($tag eq "clip_quality_right" ||
+ $tag eq "clip_vector_right"){
+ if (! defined $clipr || $_ < $clipr){
+ $clipr = $_;
+ }
+ }
+ }
+}
diff --git a/src/Converters/toAmos_new.cc b/src/Converters/toAmos_new.cc
new file mode 100644
index 0000000..c3ccd6a
--- /dev/null
+++ b/src/Converters/toAmos_new.cc
@@ -0,0 +1,1433 @@
+///////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Sergey Koren
+//! \date 06/24/04
+//!
+//! \brief Directly places files in multiple formats into the AMOS Bank
+//!
+//!
+//!
+//!
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+extern "C" {
+#include <getopt.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <sys/stat.h>
+#include <stdio.h>
+}
+
+#include <map>
+#include <set>
+#include <list>
+#include <string>
+#include <functional>
+#include <fasta.hh>
+#include <fastq.hh>
+#include <algorithm>
+#include "foundation_AMOS.hh"
+#include <Contig_AMOS.hh>
+#include <fstream>
+#include <iostream>
+#include "amp.hh"
+
+#ifdef AMOS_HAVE_CA
+#include "AS_MSG_pmesg.h"
+#endif
+
+using namespace AMOS;
+using namespace std;
+using namespace HASHMAP;
+
+
+//==============================================================================//
+// Globals
+//==============================================================================//
+int PRINT_INTERVAL = 100000;
+int GOODQUAL = 30;
+int BADQUAL = 10;
+
+int MAX_LINE_LEN = 256;
+char GAP_CHAR = '-';
+
+struct config {
+ uint32_t readSurrogates;
+ uint32_t readCCO;
+ uint32_t readUTG;
+ uint32_t fastqType;
+ uint32_t surrogateAsFragment;
+ string posfile;
+ string bank;
+ string matesfile;
+ string traceinfofile;
+ string ctgfile;
+ string frgfile;
+ string asmfile;
+ string tasmfile;
+ string qualfile;
+ string fastafile;
+ string fastqfile;
+ FastqQualType fastqQualityType;
+ string libmap;
+ uint32_t surroageAsFragment;
+ uint32_t layoutOnly;
+ uint8_t debugLevel;
+};
+config globals;
+
+Bank_t lib_stream (Library_t::NCODE);
+Bank_t read_stream (Read_t::NCODE);
+Bank_t contig_stream (Contig_t::NCODE);
+Bank_t frag_stream (Fragment_t::NCODE);
+Bank_t link_stream (ContigLink_t::NCODE);
+Bank_t edge_stream (ContigEdge_t::NCODE);
+Bank_t scf_stream (Scaffold_t::NCODE);
+Bank_t layout_stream (Layout_t::NCODE);
+
+bool matesDone = false;
+bool readsDone = false;
+bool contigsDone = false;
+
+int minSeqID = 1;
+int minCtgID = 1;
+int minScfID = 1;
+
+// this is where all my data live
+/*
+map<int,vector< string > > insertlib; // lib id to insert list
+map<string,char> inserttype; // the type of insert, if undefined assume 'E'
+map<string,string> seenlib; // insert id to lib id map
+map<int,string> seqinsert; // sequence id to insert id map
+map<int,string> libnames; // lib id to lib name
+map<int,int> posidx; // position of sequence in pos file
+*/
+map<string,string> seq2qual; // a map of all the qual file names found.
+
+//==============================================================================//
+// Function Prototypes
+//==============================================================================//
+int *computeGapIndex(char *sequence, uint32_t length);
+bool parseFastaFile();
+bool parseFastqFile();
+bool parseMatesFile(ifstream&);
+bool parseFrgFile(string);
+bool parseAsmFile(string);
+bool parseContigFile(ifstream&);
+void Tokenize(const string& str,
+ vector<string>& tokens,
+ const string& delimiters);
+
+
+//==============================================================================//
+// Documentation
+//==============================================================================//
+void PrintHelp()
+{
+ cerr << "\n"
+ << ".USAGE."
+ << " toAmos (-m mates|-f frg)\n"
+ << " (-c contig|-s fasta|-q qual|-Q fastq)\n"
+ << " -t fastqQualtyType [SCUFL]\n"
+ << ".DESCRIPTION.\n"
+ << " toAmos_new is designed as a replacement for the current perl script.\n"
+ << " It does not cover all of the formats but will encompass the main ones. \n"
+ << " It inserts the output of an assembly program into the AMOS bank.\n\n"
+ << " If you simply need a program to generate assembly inputs for one the\n"
+ << " AMOS-based assemblers (e.g. minimus or AMOS-cmp) use tarchive2amos.\n\n"
+ << " toAmos reads the inputs specified on the command line and stores the \n"
+ << " information directly into the AMOS Bank. The following types of \n"
+ << " information can be provided to toAmos: \n"
+ << " -> Sequence and quality data (options -f, -s, -q, -Q) \n"
+ << " -> Fastq data (options -Q, -t) \n"
+ << " -> Library and mate-pair data (options -m, or -f) \n"
+ << " -> Contig data (options -c, -a) \n"
+ << " -> Scaffold data (option -a) \n"
+ << ".OPTIONS. \n"
+ << " -m <matefile> - library and mate-pair information in Bambus format \n"
+ << " in Trace Archive format \n"
+ << " -b <bank> - The location where the AMOS bank will be stored.\n"
+ << " -S - include the surrogate unitigs in the .asm file as AMOS contigs.\n"
+ << " -C - include the contigs in the .asm file as AMOS contigs.\n"
+ << " -U - include the unitigs in the .asm file as AMOS contigs (implies -S and turns off -C).\n"
+ << " -F - include the surrogate unitigs as reads in the tilling for a contig. Without this option the contig may have 0-coverage regions of coverage.\n"
+ << " -L - output only the layout, not the consensus sequence for contigs. Will not output contig links or scaffolds. Implies -F.\n"
+ << " -t - fastq quality type. The currently supported types are";
+ for (uint32_t i = 0; i < FASTQ_QUALITY_COUNT; i++) {
+ cerr << " " << FASTQ_QUALITY_NAMES[i];
+ }
+ cerr << ". The default is " << FASTQ_QUALITY_NAMES[FASTQ_DEFAULT_QUALITY_TYPE] << "\n"
+ << ".KEYWORDS. \n"
+ << " converter, amos format\n"
+ << endl;
+}
+
+//----------------------------------------------------- GetOptions -----------//
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+//----------------------------------------------------------------------- ----//
+
+static int help_flag;
+static int listed_flag;
+
+bool GetOptions (int argc, char ** argv)
+{
+ globals.readSurrogates = 0;
+ globals.readCCO = 1;
+ globals.readUTG = 0;
+ globals.fastqQualityType = FASTQ_DEFAULT_QUALITY_TYPE;
+ globals.surrogateAsFragment = 0;
+ globals.debugLevel = 0;
+
+ while (1)
+ {
+ int ch, option_index = 0;
+ static struct option long_options[] = {
+ {"help", no_argument, &help_flag, 1},
+ {"list", no_argument, &listed_flag, 1},
+ {"bank", required_argument, 0, 'b'},
+ {"qual", required_argument, 0, 'q'},
+ {"seq", required_argument, 0, 's'},
+ {"Q", required_argument, 0, 'Q'},
+ {"map", required_argument, 0, 'M'},
+ {"gq", required_argument, 0, 'G'},
+ {"bq", required_argument, 0, 'B'},
+ {"pos", required_argument, 0, 'p'},
+ {"readSurrogates", no_argument, 0, 'S'},
+ {"readCCO", no_argument, 0, 'C'},
+ {"readUTG", no_argument, 0, 'U'},
+ {"surrogateUTGAsReads", no_argument, 0, 'F'},
+ {"layoutsOnly",no_argument, 0, 'L'},
+ {"fasqQuality", required_argument, 0, 't'},
+ {"debugLevel", required_argument, 0, 'd'},
+ {0, 0, 0, 0}
+ };
+
+ ch = getopt_long(argc, argv, "hlb:m:c:f:x:a:t:i:k:q:s:Q:M:G:B:p:SCUFLt:", long_options, &option_index);
+ if (ch == -1)
+ break;
+
+ string qualName;
+ uint32_t i;
+
+ switch (ch)
+ {
+ case 0:
+ /* If this option set a flag, do nothing else now. */
+ if (long_options[option_index].flag != 0)
+ break;
+ case 'G':
+ GOODQUAL = atoi(optarg);
+ break;
+ case 'B':
+ BADQUAL = atoi(optarg);
+ break;
+ case 'p':
+ globals.posfile = string(optarg);
+ break;
+ case 'b':
+ globals.bank = string(optarg);
+ break;
+ case 'm':
+ globals.matesfile = string(optarg);
+ break;
+ case 'x':
+ globals.traceinfofile = string(optarg);
+ break;
+ case 'c':
+ globals.ctgfile = string(optarg);
+ break;
+ case 'f':
+ globals.frgfile = string(optarg);
+ break;
+ case 'a':
+ globals.asmfile = string(optarg);
+ break;
+ case 'q':
+ globals.qualfile = string(optarg);
+ break;
+ case 's':
+ globals.fastafile = string(optarg);
+ break;
+ case 'Q':
+ globals.fastqfile = string(optarg);
+ break;
+ case 't':
+ qualName = string(optarg);
+ transform(qualName.begin(), qualName.end(), qualName.begin(), ::toupper);
+
+ for (i = 0; i < FASTQ_QUALITY_COUNT; i++) {
+ if (qualName == FASTQ_QUALITY_NAMES[i]) {
+ globals.fastqQualityType = (FastqQualType) i;
+ break;
+ }
+ }
+ if (i == FASTQ_QUALITY_COUNT) {
+ cerr << "Unknown fastq quality type " << optarg << " specified" << endl;
+ help_flag = TRUE;
+ }
+ break;
+ case 'M':
+ globals.libmap = string(optarg);
+ break;
+ case 'S':
+ globals.readSurrogates = 1;
+ break;
+ case 'U':
+ globals.readUTG = 1;
+ globals.readCCO = 0;
+ break;
+ case 'C':
+ globals.readCCO = 1;
+ break;
+ case 'F':
+ globals.surrogateAsFragment = 1;
+ break;
+ case 'L':
+ globals.surroageAsFragment = 1;
+ globals.layoutOnly = 1;
+ break;
+ case 'd':
+ globals.debugLevel = atoi(optarg);
+ break;
+ case 'h':
+ PrintHelp();
+ return (EXIT_SUCCESS);
+ case '?':
+ break;
+ }
+ }
+ if (help_flag){
+ PrintHelp();
+ return (EXIT_SUCCESS);
+ }
+ if (listed_flag && optind < argc)
+ {
+ cerr << "non-option ARGV-elements: " << endl;
+ string curFile;
+ while (optind < argc) {
+ curFile = string(argv[optind++]);
+ seq2qual[curFile] = curFile.substr(0,curFile.rfind('.'));
+ struct stat stFileInfo;
+ bool bInReturn;
+ int intStat;
+ intStat = stat(string(seq2qual[curFile] + ".QUL").c_str(),&stFileInfo);
+ if (intStat == 0)
+ // We were able to get the file attributes,
+ // so the file exists
+ continue;
+ else
+ seq2qual[curFile] = "";
+ }
+ }
+ return true;
+}
+
+int main(int argc, char ** argv)
+{
+ // Handle all initial parsing of hashmaps and temp files via options parsing
+ if (! GetOptions (argc, argv)) {
+ cerr << "Command line parsing failed" << endl;
+ PrintHelp();
+ exit(1);
+ }
+
+ if (globals.bank.length() == 0){ // No bank specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ try
+ {
+ if (globals.asmfile.length() > 0 || globals.ctgfile.length() > 0) {
+ int maxLayout = 0;
+
+ if (contig_stream.exists(globals.bank)) {
+ cerr << "Contig Bank exists; opening" << endl;;
+ contig_stream.open(globals.bank, B_WRITE);
+ } else {
+ cerr << "Contig Bank doesn't exist; creating" << endl;
+ contig_stream.create(globals.bank, B_WRITE);
+ }
+ if (globals.layoutOnly) {
+ if (layout_stream.exists(globals.bank)) {
+ layout_stream.open(globals.bank, B_WRITE);
+ }
+ else {
+ layout_stream.create(globals.bank, B_WRITE);
+ }
+ maxLayout = layout_stream.getMaxIID();
+ }
+
+ minCtgID = contig_stream.getMaxIID();
+ if (maxLayout >= minCtgID) {
+ minCtgID = maxLayout+1;
+ };
+ }
+ if (read_stream.exists(globals.bank)) {
+ cerr << "Read bank exists; opening" << endl;
+ read_stream.open(globals.bank, B_READ | B_WRITE);
+ } else {
+ cerr << "Read Bank doesn't exist; creating" << endl;
+ read_stream.create(globals.bank, B_READ | B_WRITE);
+ }
+
+ int maxRead = read_stream.getMaxIID();
+ if (maxRead >= minSeqID) {
+ minSeqID = maxRead+1;
+ }
+ if (frag_stream.exists(globals.bank)) {
+ cerr << "frag bank exists; opening" << endl;
+ frag_stream.open(globals.bank, B_WRITE);
+ } else {
+ cerr << "frag Bank doesn't exist; creating" << endl;
+ frag_stream.create(globals.bank, B_WRITE);
+
+ int maxFrg = frag_stream.getMaxIID();
+ if (maxFrg >= minSeqID) {
+ minSeqID = maxFrg + 1;
+ }
+ }
+ if (lib_stream.exists(globals.bank)) {
+ cerr << "lib bank exists; opening" << endl;
+ lib_stream.open(globals.bank, B_WRITE);
+ } else {
+ cerr << "lib Bank doesn't exist; creating" << endl;
+ lib_stream.create(globals.bank, B_WRITE);
+ }
+ int maxLib = lib_stream.getMaxIID();
+ if (maxLib >= minSeqID) {
+ minSeqID = maxLib +1;
+ }
+
+ if (globals.asmfile.length() > 0) {
+ if (scf_stream.exists(globals.bank)) {
+ cerr << "scf bank exists; opening" << endl;
+ scf_stream.open(globals.bank, B_WRITE);
+ } else {
+ cerr << "scf Bank doesn't exist; creating" << endl;
+ scf_stream.create(globals.bank, B_WRITE);
+ }
+ if (link_stream.exists(globals.bank)) {
+ cerr << "link bank exists; opening" << endl;
+ link_stream.open(globals.bank, B_WRITE);
+ } else {
+ cerr << "link Bank doesn't exist; creating" << endl;
+ link_stream.create(globals.bank, B_WRITE);
+ }
+ if (edge_stream.exists(globals.bank)) {
+ cerr << "edge bank exists; opening" << endl;
+ edge_stream.open(globals.bank, B_WRITE);
+ } else {
+ cerr << "edge Bank doesn't exist; creating" << endl;
+ edge_stream.create(globals.bank, B_WRITE);
+ }
+ int maxScf = scf_stream.getMaxIID();
+ int maxLink = link_stream.getMaxIID();
+ int maxEdge = edge_stream.getMaxIID();
+ if (maxScf >= minScfID) {
+ minScfID = maxScf + 1;
+ }
+ if (maxLink >= minScfID) {
+ minScfID = maxLink + 1;
+ }
+ if (maxEdge >= minScfID) {
+ minScfID = maxEdge + 1;
+ }
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Failed to open contig account in bank " << globals.bank
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ // figure out the reads
+ if (globals.fastafile.size() > 0) {
+ cerr << "parsing fasta file" << endl;
+ parseFastaFile();
+ readsDone = true;
+ }
+
+ // parse fastq file
+ if (globals.fastqfile.size() > 0) {
+ cerr << "parsing fastq file" << endl;
+ parseFastqFile();
+ readsDone = true;
+ }
+
+ if (!readsDone && globals.frgfile.size() > 0) {
+ parseFrgFile(globals.frgfile);
+ readsDone = true;
+ }
+
+ if (! matesDone && globals.matesfile.size() > 0) { // the mate file contains either mates
+ // or regular expressions defining them.
+ ifstream mates(globals.matesfile.c_str());
+ parseMatesFile(mates);
+ mates.close();
+ matesDone = true;
+ }
+
+ if (globals.ctgfile.size() > 0) {
+ ifstream curCtg(globals.ctgfile.c_str());
+ parseContigFile(curCtg);
+ curCtg.close();
+ contigsDone = true;
+ }
+
+ if (!contigsDone && globals.asmfile.size() > 0) {
+ parseAsmFile(globals.asmfile);
+ contigsDone = true;
+ }
+
+ lib_stream.close();
+ if (lib_stream.isOpen()) {
+ cerr << "ERROR: Lib bank is still open" << endl;
+ }
+ //-----------------------------------------------------------------------------
+ cerr << "Closing frag stream/bank" << endl;
+ frag_stream.close();
+ if (frag_stream.isOpen()) {
+ cerr << "ERROR: Frag bank is still open " << endl;
+ }
+ //------------------------------------------------------------------------------
+ cerr << "Closing read stream/bank" << endl;
+ read_stream.close();
+ if (read_stream.isOpen()) {
+ cerr << "ERROR: Read bank is still open " << endl;
+ }
+ if (globals.asmfile.length() > 0 || globals.ctgfile.length() > 0) {
+ cerr << "Handling contigs" << endl;
+ contig_stream.close();
+ if (contig_stream.isOpen()) {
+ cerr << "ERROR: Contig bank is still open " << endl;
+ } else
+ cerr << "Contig stream closed." << endl;
+ }
+ if (globals.layoutOnly) {
+ layout_stream.close();
+ }
+
+ if (globals.asmfile.length() > 0) {
+ link_stream.close();
+ edge_stream.close();
+ scf_stream.close();
+
+ if (link_stream.isOpen() || edge_stream.isOpen() || scf_stream.isOpen()) {
+ cerr << "ERROR: Scaffold, Link, or Edge stream still open" << endl;
+ } else {
+ cerr << "Scaffold, link, and edge streams closed" << endl;
+ }
+ }
+}
+
+map<FILE*, bool> fileCompressed;
+
+FILE *fileOpen(const char *name, const char *permission) {
+ FILE *inFile = NULL;
+ bool isCompressed = false;
+
+ if (strcasecmp(name + strlen(name) - 3, ".gz") == 0) {
+ char cmd[1024];
+ sprintf(cmd, "gzip -dc %s", name);
+ errno = 0; inFile = popen(cmd, permission);
+ isCompressed = 1;
+ } else if (strcasecmp(name + strlen(name) - 4, ".bz2") == 0) {
+ char cmd[1024];
+ sprintf(cmd, "bzip2 -dc %s", name);
+ inFile = popen(cmd, permission);
+ isCompressed = 1;
+ } else {
+ errno = 0;
+ inFile = fopen(name, permission);
+ }
+
+ fileCompressed[inFile] = isCompressed;
+ return inFile;
+}
+
+void fileClose(FILE *file) {
+ if (fileCompressed[file] == true) {
+ pclose(file);
+ } else {
+ fclose(file);
+ }
+}
+
+bool parseFastaFile() {
+ int counter = 0;
+ string tempSeqHeader;
+ string tempSeqBuff;
+ string tempQualHeader;
+ string tempQualBuff;
+ string seqname;
+ int cll = -1;
+ int clr = -1;
+ int temp1 = 0;
+ int temp2 = 0;
+ int id = 0;
+
+ FILE* fastafile = fileOpen(globals.fastafile.c_str(), "r");
+ FILE* qualFile = NULL;
+ if (globals.qualfile.size() > 0)
+ qualFile = fileOpen(globals.qualfile.c_str(), "r");
+
+ while (Fasta_Read(fastafile,tempSeqBuff,tempSeqHeader) != 0) {
+ if (counter % PRINT_INTERVAL == 0 && globals.debugLevel > 0) {
+ cerr << "Read " << counter << " reads " << endl;
+ }
+ counter++;
+
+ stringstream qualheaderstream (stringstream::in | stringstream::out);
+ stringstream seqheaderstream (stringstream::in);
+ seqheaderstream.str(tempSeqHeader.c_str());
+ seqheaderstream >> seqname;
+ if (!seqheaderstream.eof()) {
+ seqheaderstream >> temp1;
+ seqheaderstream >> temp2;
+ if (!seqheaderstream.eof()) {
+ seqheaderstream.ignore(5, ' ');
+ seqheaderstream >> cll;
+ seqheaderstream >> clr;
+ } else {
+ cll = temp1;
+ clr = temp2;
+ }
+ } else {
+ cll = 0;
+ clr = tempSeqBuff.length();
+ //cerr << "Format not recognized" << endl;
+ }
+
+ // So we don't overwrite an externally provided clear range
+ if (cll == -1) {
+ cll = 0;
+ clr = tempSeqBuff.length();
+ }
+ Read_t read;
+ read.setIID(minSeqID++);
+ read.setEID(seqname);
+
+ string tempheader;
+ if (globals.qualfile.length() > 0) {
+ Fasta_Qual_Read(qualFile,tempQualBuff,tempQualHeader);
+ qualheaderstream.str(tempQualHeader.c_str());
+ qualheaderstream >> tempheader;
+ if (tempheader != seqname) {
+ cerr << "Sequence and quality records must agree: " << seqname << " != " << tempheader << endl;
+ return 1;
+ }
+ if (tempQualBuff.length() != tempSeqBuff.length()) {
+ cerr << "Sequence and quality records must have same length for " << seqname << ": "
+ << tempSeqBuff.length() << " vs " << tempQualBuff.length() << endl;
+ return 1;
+ }
+
+ } else {
+ tempQualBuff.clear();
+ for (int i = 0; i < cll; i++)
+ tempQualBuff += char(AMOS::MIN_QUALITY + BADQUAL);
+ for (int i = cll; i < clr; i++)
+ tempQualBuff += char(AMOS::MIN_QUALITY + GOODQUAL);
+ for (int i = clr; i < tempSeqBuff.length(); i++)
+ tempQualBuff += char(AMOS::MIN_QUALITY + BADQUAL);
+ }
+ read.setClearRange(Range_t(cll, clr));
+ read.setSequence(tempSeqBuff.c_str(), tempQualBuff.c_str());
+ read_stream.append(read);
+
+ // reset the clear ranges
+ cll = clr = -1;
+ }
+
+ fileClose(fastafile);
+ if (qualFile != NULL) {
+ fileClose(qualFile);
+ }
+}
+
+bool parseFastqFile() {
+ int counter = 0;
+ string tempSeqHeader;
+ string tempSeqBuff;
+ string tempQualHeader;
+ string tempQualBuff;
+ string seqname;
+ int cll = -1;
+ int clr = -1;
+ int temp1 = 0;
+ int temp2 = 0;
+ int id = 0;
+
+ FILE* fastqfile = fileOpen(globals.fastqfile.c_str(), "r");
+
+ while (Fastq_Read(fastqfile,tempSeqBuff,tempSeqHeader,tempQualBuff,tempQualHeader, globals.fastqQualityType) != 0) {
+ if (counter % PRINT_INTERVAL == 0 && globals.debugLevel > 0) {
+ cerr << "Read " << counter << " reads " << endl;
+ }
+ counter++;
+
+ stringstream seqheaderstream (stringstream::in);
+ seqheaderstream.str(tempSeqHeader.c_str());
+ seqheaderstream >> seqname;
+ if (!seqheaderstream.eof()) {
+ seqheaderstream >> temp1;
+ seqheaderstream >> temp2;
+ if (!seqheaderstream.eof()) {
+ seqheaderstream.ignore(5, ' ');
+ seqheaderstream >> cll;
+ seqheaderstream >> clr;
+ } else {
+ cll = temp1;
+ clr = temp2;
+ }
+ } else {
+ cll = 0;
+ clr = tempSeqBuff.length();
+ //cerr << "Format not recognized" << endl;
+ }
+
+ // So we don't overwrite an externally provided clear range
+ if (cll == -1) {
+ cll = 0;
+ clr = tempSeqBuff.length();
+ }
+ Read_t read;
+ read.setIID(minSeqID++);
+ read.setEID(seqname);
+
+ if (tempQualBuff.length() != tempSeqBuff.length()) {
+ cerr << "Sequence and quality records must have same length for " << seqname << ": "
+ << tempSeqBuff.length() << " vs " << tempQualBuff.length() << endl;
+ return 1;
+ }
+
+ read.setClearRange(Range_t(cll, clr));
+ read.setSequence(tempSeqBuff.c_str(), tempQualBuff.c_str());
+ read_stream.append(read);
+
+ // reset the clear ranges
+ cll = clr = -1;
+ }
+ cerr << "Finished reading " << counter << " reads " << endl;
+
+ fileClose(fastqfile);
+}
+
+
+vector<string> &split(const string &s, char delim, vector<string> &elems) {
+ stringstream ss(s);
+ string item;
+ while(getline(ss, item, delim)) {
+ elems.push_back(item);
+ }
+}
+
+
+vector<string> split(const string &s, char delim) {
+ vector<string> elems;
+ return split(s, delim, elems);
+}
+
+// parse only the non-regex mates file for now
+bool parseMatesFile(ifstream &matesFile) {
+ string temp;
+ uint32_t counter = 0;
+
+ while (matesFile >> temp) {
+ char peekChar = temp[0];
+
+ if (peekChar == ' ' || peekChar == '\n' || peekChar == '\t') { // empty line
+ matesFile.ignore(MAX_LINE_LEN,'\n');
+ continue;
+ }
+ if (peekChar=='#') { // comment
+ matesFile.ignore(MAX_LINE_LEN,'\n');
+ continue;
+ }
+
+ if (peekChar == 'l'){
+ if (temp == "library") {
+ string name;
+ float min, max;
+ matesFile >> name;
+ matesFile >> min;
+ matesFile >> max;
+ matesFile.ignore(MAX_LINE_LEN, '\n');
+
+ Pos_t mean = (min + max) / 2;
+ SD_t stdev = (max - min) / 6;
+ Distribution_t dist;
+ dist.mean = mean;
+ dist.sd = stdev;
+
+ Library_t lib;
+ lib.setDistribution(dist);
+ lib.setIID(minSeqID++);
+ lib.setEID(name);
+ lib_stream.append(lib);
+
+ continue;
+ }
+ }
+ if (peekChar == 'p') {
+ // skip regex for now
+ continue;
+ }
+
+ // now that we've handled everything else, this must be a simple pair of reads
+ string frg1 = temp;
+ string frg2, name;
+ matesFile >> frg2;
+ matesFile >> name;
+ matesFile.ignore(MAX_LINE_LEN, '\n');
+
+ stringstream templateID(stringstream::in | stringstream::out);
+
+ Size_t offset = 0;
+ for (offset = 0; offset < frg1.length(); ++offset) {
+ if (frg2.length() < offset) {
+ break;
+ }
+ if (frg1[offset] != frg2[offset]) {
+ break;
+ }
+ }
+ if (offset == 0) {
+ cerr << "Error fragments " << frg1 << " AND " << frg2 << " do not have any common template substring" << endl;
+ continue;
+ }
+ templateID.str(frg1.substr(0, offset));
+ templateID << "_" << counter;
+ ID_t libID = lib_stream.lookupIID(name);
+ if (libID == NULL_ID) {
+ cerr << "Error library " << name << " is not defined" << endl;
+ continue;
+ }
+ ID_t read1 = read_stream.lookupIID(frg1);
+ ID_t read2 = read_stream.lookupIID(frg2);
+ if (read1 == NULL_ID || read2 == NULL_ID) {
+ cerr << "Error fragments " << frg1 << " AND " << frg2 << " are not defined" << endl;
+ continue;
+ }
+
+ Fragment_t frag;
+ frag.setLibrary(libID);
+ frag.setIID(minSeqID++);
+ frag.setEID(templateID.str());
+ frag.setReads(std::pair<ID_t, ID_t>(read1, read2));
+ frag.setType(Fragment_t::INSERT);
+ frag_stream.append(frag);
+
+ // also update the reads
+ Read_t read;
+ read_stream.fetch(read1, read);
+ read.setFragment(frag.getIID());
+ read_stream.replace(read.getIID(), read);
+
+ read_stream.fetch(read2, read);
+ read.setFragment(frag.getIID());
+ read_stream.replace(read.getIID(), read);
+ counter++;
+ }
+}
+
+
+#ifdef AMOS_HAVE_CA
+bool parseFrgFile(string fileName) {
+ GenericMesg *pmesg = NULL;
+ FILE *f = fileOpen(fileName.c_str(), "r");
+ map<uint64, uint64> readToLib;
+ map<uint64, ID_t> readToFrag;
+ uint32_t counter = 0;
+
+ while (EOF != ReadProtoMesg_AS(f, &pmesg)) {
+ if (pmesg->t == MESG_DST) {
+ DistanceMesg *dst = (DistanceMesg *)pmesg->m;
+ if (dst->action == AS_ADD) {
+ Library_t lib;
+ Distribution_t dist;
+ dist.mean = dst->mean;
+ dist.sd = dst->stddev;
+
+ lib.setDistribution(dist);
+ lib.setIID(minSeqID++);
+ lib.setEID(AS_UID_toString(dst->eaccession));
+ lib_stream.append(lib);
+ }
+ } else if (pmesg->t == MESG_LIB) {
+ LibraryMesg *dst = (LibraryMesg *)pmesg->m;
+ if (dst->action != AS_ADD) {
+ continue;
+ }
+ // set unknown ones to default to iniie
+ if (dst->link_orient.isUnknown()) {
+ dst->link_orient.setIsInnie();
+ }
+ if (!dst->link_orient.isInnie()) {
+ cerr << "Error, library " << AS_UID_toString(dst->eaccession) << " has orientation that is not innie. Only innie mates are currently supported" << endl;
+ continue;
+ }
+ Library_t lib;
+ Distribution_t dist;
+ dist.mean = dst->mean;
+ dist.sd = dst->stddev;
+
+ lib.setDistribution(dist);
+ lib.setIID(minSeqID++);
+ lib.setEID(AS_UID_toString(dst->eaccession));
+ lib_stream.append(lib);
+ } else if (pmesg->t == MESG_FRG) {
+ FragMesg *fmesg = (FragMesg *)pmesg->m;
+ if (fmesg->action != AS_ADD) {
+ continue;
+ }
+
+ if (AS_UID_isDefined(fmesg->library_uid) == TRUE) {
+ readToLib[AS_UID_toInteger(fmesg->eaccession)] = AS_UID_toInteger(fmesg->library_uid);
+ }
+ Read_t read;
+ read.setEID(AS_UID_toString(fmesg->eaccession));
+ read.setIID(minSeqID++);
+ read.setClearRange(Range_t(fmesg->clear_rng.bgn, fmesg->clear_rng.end));
+ read.setSequence(fmesg->sequence, fmesg->quality);
+ readToFrag[AS_UID_toInteger(fmesg->eaccession)] = 0;
+ read_stream.append(read);
+
+ if (counter % PRINT_INTERVAL == 0 && globals.debugLevel > 0) {
+ cerr << "Read " << counter << " fragments" << endl;
+ }
+ counter++;
+ } else if (pmesg->t == MESG_LKG) {
+ LinkMesg *lmesg = (LinkMesg *)pmesg->m;
+ if (lmesg->action != AS_ADD) {
+ continue;
+ }
+
+ ID_t read1 = read_stream.lookupIID(AS_UID_toString(lmesg->frag1));
+ ID_t read2 = read_stream.lookupIID(AS_UID_toString(lmesg->frag2));
+ if (read1 == NULL_ID || read2 == NULL_ID) {
+ cerr << "Error fragments " << AS_UID_toString(lmesg->frag1) << " AND " << AS_UID_toString(lmesg->frag2) << " are not defined" << endl;
+ continue;
+ }
+
+ // in version 1 frgs library is specified by LKG record, in version 2 it's by fragment. Figure out which one we want and use that
+ string libEID = "0";
+ if (AS_UID_isDefined(lmesg->distance) == TRUE) {
+ libEID = AS_UID_toString(lmesg->distance);
+ } else {
+ if (readToLib[AS_UID_toInteger(lmesg->frag1)] != readToLib[AS_UID_toInteger(lmesg->frag1)]) {
+ cerr << "Fragments " << AS_UID_toString(lmesg->frag1) << " AND " << AS_UID_toString(lmesg->frag2) << " are in different libraries" << endl;
+ continue;
+ }
+ libEID = AS_UID_toString(AS_UID_fromInteger(readToLib[AS_UID_toInteger(lmesg->frag1)]));
+ }
+
+ if (libEID == "0") {
+ // special case for CA with version 1 fragments
+ // they end up with library 0 which equals unmated fragments so we just don't create a frg record for them
+ cerr << "Skipping invalid library " << libEID << endl;
+ continue;
+ }
+
+ ID_t libID = lib_stream.lookupIID(libEID);
+ if (libID == NULL_ID) {
+ cerr << "Error library " << libEID << " is not defined" << endl;
+ continue;
+ }
+
+ Fragment_t frag;
+ frag.setLibrary(libID);
+ frag.setIID(minSeqID++);
+ string uid = AS_UID_toString(lmesg->frag1);
+ uid += "_";
+ uid += AS_UID_toString(lmesg->frag2);
+ frag.setEID(uid);
+ frag.setReads(std::pair<ID_t, ID_t>(read1, read2));
+ frag.setType(Fragment_t::INSERT);
+ frag_stream.append(frag);
+
+ // also update the reads
+ Read_t read;
+ read_stream.fetch(read1, read);
+ read.setFragment(frag.getIID());
+ readToFrag[AS_UID_toInteger(lmesg->frag1)] = frag.getIID();
+ read_stream.replace(read.getIID(), read);
+
+ read_stream.fetch(read2, read);
+ read.setFragment(frag.getIID());
+ readToFrag[AS_UID_toInteger(lmesg->frag2)] = frag.getIID();
+ read_stream.replace(read.getIID(), read);
+ } else if (pmesg->t == MESG_PLC) {
+ // ignore
+ } else if (pmesg->t == MESG_VER) {
+ // ignore
+ } else {
+ // Ignore messages we don't understand
+ }
+ }
+
+ // finally create fragments for unmated reads to associate them to a library
+ for (map<uint64, ID_t>::iterator i = readToFrag.begin(); i != readToFrag.end(); ++i) {
+ if (i->second == 0) {
+ ID_t read1 = read_stream.lookupIID(AS_UID_toString(AS_UID_fromInteger(i->first)));
+ if (read1 == NULL_ID) {
+ cerr << "Cannot find record for read " << i->first << endl;
+ continue;
+ }
+
+ ID_t libID;
+ if (readToLib.find(i->first) == readToLib.end()) {
+ continue;
+ } else {
+ libID = lib_stream.lookupIID(AS_UID_toString(AS_UID_fromInteger(readToLib[i->first])));
+ }
+ Fragment_t frag;
+ frag.setLibrary(libID);
+ frag.setIID(minSeqID++);
+ string uid = i->first + "_frag";
+ frag.setEID(uid);
+ frag.setType(Fragment_t::INSERT);
+ frag_stream.append(frag);
+
+ // also update the reads
+ Read_t read;
+ read_stream.fetch(read1, read);
+ read.setFragment(frag.getIID());
+ readToFrag[i->first] = frag.getIID();
+ read_stream.replace(read.getIID(), read);
+ }
+ }
+ fileClose(f);
+
+ cerr << "Finished reading " << counter << " fragments" << endl;
+}
+
+int *computeGapIndex(char *sequence, uint32_t length) {
+ // compute the gap index for the consensus sequence
+ int *gapIndex = (int*) safe_malloc(sizeof(int) * length);
+ int gapCounter = 0;
+ for (int i = 0; i < length; i++) {
+ if (sequence[i] == GAP_CHAR) {
+ gapCounter++;
+ }
+ gapIndex[i] = gapCounter;
+ }
+
+ return gapIndex;
+}
+
+/**
+ * Parse Celera Assembler output file
+ * This assumes quality values are compatible between the two which they currently are
+ * Both are offset by '0' or AMOS::MIN_QUALITY
+**/
+bool parseAsmFile(string fileName) {
+ GenericMesg *pmesg = NULL;
+ FILE *f = fileOpen(fileName.c_str(), "r");
+ map<ID_t, uint32_t> ctgLens;
+ bool readUTG = globals.readUTG == 1;
+ bool readCCO = globals.readCCO == 1;
+ bool readSurrogates = globals.readSurrogates == 1;
+ bool storeSurrogatesAsFragments = globals.surrogateAsFragment == 1;
+ bool storeLayoutOnly = globals.layoutOnly == 1;
+ uint32_t counter = 0;
+
+ while (EOF != ReadProtoMesg_AS(f, &pmesg)) {
+ // utg
+ if (pmesg->t == MESG_UTG) {
+ SnapUnitigMesg *utg = (SnapUnitigMesg *)pmesg->m;
+
+ if (readCCO && utg->status != AS_UNIQUE) {
+ // we need to read this unitig as a read to use it in consensus potentially
+ Read_t read;
+ read.setIID(minSeqID++);
+ read.setEID(AS_UID_toString(utg->eaccession));
+
+ // remove gaps from sequence
+ char *sequence = (char *) safe_malloc(sizeof(char) * (utg->length + 1));
+ char *qual = (char *) safe_malloc(sizeof(char) * (utg->length + 1));
+ int j = 0;
+ for (int i = 0; i < utg->length; i++) {
+ if (utg->consensus[i] != GAP_CHAR) {
+ sequence[j] = utg->consensus[i];
+ qual[j] = utg->quality[i];
+ if (j > i || j >=utg->length) {
+ AMOS_THROW("Error: The ungapped position is smaller than the gapped: " + i);
+ }
+ j++;
+ }
+ }
+ sequence[j]='\0';
+ qual[j] = '\0';
+ read.setSequence(sequence, qual);
+ read.setClearRange(Range_t(0, j));
+ read_stream.append(read);
+ safe_free(sequence);
+ safe_free(qual);
+ }
+ if (utg->status == AS_SEP && !readSurrogates && !readUTG) {
+ continue;
+ }
+ if (utg->status != AS_SEP && !readUTG) {
+ continue;
+ }
+
+ if (counter % PRINT_INTERVAL == 0 && globals.debugLevel > 0) {
+ cerr << "Read " << counter << " unitigs" << endl;
+ }
+ counter++;
+
+ Contig_t contig;
+ vector<Tile_t> reads;
+ vector<Tile_t> readsForLayout;
+
+ contig.setEID(AS_UID_toString(utg->eaccession));
+ contig.setIID(minCtgID++);
+ contig.setSequence(utg->consensus, utg->quality);
+
+ int *gapIndex = computeGapIndex(utg->consensus, utg->length);
+ for (int i = 0; i < utg->num_frags; i++) {
+ ID_t readID = read_stream.lookupIID(AS_UID_toString(utg->f_list[i].eident));
+ if (readID == NULL_ID) {
+ cerr << "Error fragments " << AS_UID_toString(utg->f_list[i].eident) << " are not defined" << endl;
+ continue;
+ }
+ int start = (utg->f_list[i].position.bgn < utg->f_list[i].position.end ? utg->f_list[i].position.bgn : utg->f_list[i].position.end);
+
+ Tile_t tile;
+ tile.source = readID;
+ tile.offset = start;
+ if (utg->f_list[i].position.bgn < utg->f_list[i].position.end) {
+ utg->f_list[i].position.end -= utg->f_list[i].delta_length;
+ } else {
+ utg->f_list[i].position.bgn -= utg->f_list[i].delta_length;
+ }
+ tile.range.begin = utg->f_list[i].position.bgn - start;
+ tile.range.end = utg->f_list[i].position.end - start;
+
+ for (int j = 0; j < utg->f_list[i].delta_length; j++) {
+ tile.gaps.push_back(utg->f_list[i].delta[j]);
+ }
+ reads.push_back(tile);
+
+ // store the ungapped tile as well if we need to save the layout
+ Tile_t layoutTile = tile;
+ layoutTile.offset = start - gapIndex[start];
+ layoutTile.gaps.clear();
+ readsForLayout.push_back(layoutTile);
+ }
+
+ if (storeLayoutOnly == true) {
+ Layout_t lay;
+ lay.setEID(AS_UID_toString(utg->eaccession));
+ lay.setIID(minCtgID++);
+ lay.setTiling(readsForLayout);
+ layout_stream.append(lay);
+ } else {
+ contig.setReadTiling(reads);
+ contig_stream.append(contig);
+ }
+ safe_free(gapIndex);
+ } else if (pmesg->t == MESG_CCO && readCCO) {
+ SnapConConMesg *ctg = (SnapConConMesg *)pmesg->m;
+ Contig_t contig;
+ vector<Tile_t> reads;
+ vector<Tile_t> readsForLayout;
+ int *gapIndex = (int*) computeGapIndex(ctg->consensus, ctg->length);
+
+ contig.setEID(AS_UID_toString(ctg->eaccession));
+ contig.setIID(minCtgID++);
+ contig.setSequence(ctg->consensus, ctg->quality);
+ for (int i = 0; i < ctg->num_pieces; i++) {
+ ID_t readID = read_stream.lookupIID(AS_UID_toString(ctg->pieces[i].eident));
+ if (readID == NULL_ID) {
+ cerr << "Error fragments " << AS_UID_toString(ctg->pieces[i].eident) << " are not defined" << endl;
+ continue;
+ }
+ Tile_t tile;
+ tile.source = readID;
+
+ int start = (ctg->pieces[i].position.bgn < ctg->pieces[i].position.end ? ctg->pieces[i].position.bgn : ctg->pieces[i].position.end);
+ tile.offset = start;
+
+ if (ctg->pieces[i].position.bgn < ctg->pieces[i].position.end) {
+ ctg->pieces[i].position.end -= ctg->pieces[i].delta_length;
+ } else {
+ ctg->pieces[i].position.bgn -= ctg->pieces[i].delta_length;
+ }
+ tile.range.begin = ctg->pieces[i].position.bgn - start;
+ tile.range.end = ctg->pieces[i].position.end - start;
+
+ for (int j = 0; j < ctg->pieces[i].delta_length; j++) {
+ tile.gaps.push_back(ctg->pieces[i].delta[j]);
+ }
+
+ Tile_t layoutTile = tile;
+ layoutTile.offset = start - gapIndex[start];
+ layoutTile.gaps.clear();
+ reads.push_back(tile);
+ readsForLayout.push_back(layoutTile);
+ }
+ for (int i = 0; i < ctg->num_unitigs; i++) {
+ ID_t utgID = read_stream.lookupIID(AS_UID_toString(ctg->unitigs[i].eident));
+ if (utgID == NULL_ID) {
+ // skip this unitig, if its not a read its because it was not a surrogate
+ continue;
+ }
+ Tile_t tile;
+
+ tile.source = utgID;
+
+ int start = (ctg->unitigs[i].position.bgn < ctg->unitigs[i].position.end ? ctg->unitigs[i].position.bgn : ctg->unitigs[i].position.end);
+ tile.offset = start;
+
+ if (ctg->unitigs[i].position.bgn < ctg->unitigs[i].position.end) {
+ ctg->unitigs[i].position.end -= ctg->unitigs[i].delta_length;
+ } else {
+ ctg->unitigs[i].position.bgn -= ctg->unitigs[i].delta_length;
+ }
+ tile.range.begin = ctg->unitigs[i].position.bgn - start;
+ tile.range.end = ctg->unitigs[i].position.end - start;
+
+ for (int j = 0; j < ctg->unitigs[i].delta_length; j++) {
+ tile.gaps.push_back(ctg->unitigs[i].delta[j]);
+ }
+
+ Tile_t layoutTile = tile;
+ layoutTile.offset = start - gapIndex[start];
+ reads.push_back(tile);
+ readsForLayout.push_back(layoutTile);
+ }
+ if (storeLayoutOnly == true) {
+ Layout_t lay;
+ lay.setEID(AS_UID_toString(ctg->eaccession));
+ lay.setIID(minCtgID++);
+ lay.setTiling(readsForLayout);
+ layout_stream.append(lay);
+ } else {
+ contig.setReadTiling(reads);
+ contig_stream.append(contig);
+ }
+ ctgLens[contig.getIID()] = contig.getUngappedLength();
+ safe_free(gapIndex);
+ } else if (pmesg->t == MESG_CLK && readCCO && !storeLayoutOnly) {
+ SnapContigLinkMesg *clk = (SnapContigLinkMesg *)pmesg->m;
+
+ ID_t ctg1 = contig_stream.lookupIID(AS_UID_toString(clk->econtig1));
+ ID_t ctg2 = contig_stream.lookupIID(AS_UID_toString(clk->econtig2));
+ if (ctg1 == NULL_ID || ctg2 == NULL_ID) {
+ cerr << "Error contigs " << AS_UID_toString(clk->econtig1) << " AND " << AS_UID_toString(clk->econtig2) << " are not defined" << endl;
+ continue;
+ }
+ ContigEdge_t cte;
+ ID_t iid = minCtgID++;
+ stringstream uidseq(stringstream::in | stringstream::out);
+ uidseq << AS_UID_toString(clk->econtig1) << "_" << AS_UID_toString(clk->econtig2) << "_" << iid;
+ cte.setEID(uidseq.str());
+ cte.setIID(iid);
+ cte.setContigs(pair<ID_t, ID_t>(ctg1, ctg2));
+ cte.setAdjacency(clk->orientation.toLetter());
+ cte.setSize(clk->mean_distance);
+ cte.setSD(clk->std_deviation);
+ cte.setType(ContigEdge_t::MATEPAIR);
+
+ int32_t numLinks = clk->num_contributing;
+ vector<ID_t> links;
+ ContigLink_t ctl;
+ if (clk->overlap_type != AS_NO_OVERLAP) {
+ numLinks--;
+ uidseq.str("");
+ uidseq << cte.getEID() << "_OVL";
+ ctl.setEID(uidseq.str());
+ ctl.setIID(minSeqID++);
+ ctl.setContigs(pair<ID_t, ID_t>(ctg1, ctg2));
+ ctl.setAdjacency(clk->orientation.toLetter());
+ ctl.setSize(clk->mean_distance);
+ ctl.setSD(clk->std_deviation);
+ ctl.setType(ContigLink_t::OVERLAP);
+ links.push_back(ctl.getIID());
+ link_stream.append(ctl);
+ }
+
+ for (int i = 0; i < numLinks; i++) {
+ Read_t read;
+ read_stream.fetch(AS_UID_toString(clk->jump_list[i].in1), read);
+
+ uidseq.str("");
+ uidseq << cte.getEID() << "_" << i;
+ ctl.setEID(uidseq.str());
+ ctl.setIID(minSeqID++);
+ ctl.setContigs(pair<ID_t, ID_t>(ctg1, ctg2));
+ ctl.setSource(pair<ID_t, NCode_t>(read.getFragment(), Fragment_t::NCODE));
+ ctl.setAdjacency(clk->orientation.toLetter());
+ ctl.setSize(clk->mean_distance);
+ ctl.setSD(clk->std_deviation);
+ ctl.setType(ContigLink_t::MATEPAIR);
+ links.push_back(ctl.getIID());
+ link_stream.append(ctl);
+ }
+ cte.setContigLinks(links);
+ edge_stream.append(cte);
+ }else if (pmesg->t == MESG_SCF && readCCO && !storeLayoutOnly) {
+ SnapScaffoldMesg *scf = (SnapScaffoldMesg *)pmesg->m;
+ Scaffold_t scaffold;
+
+ scaffold.setEID(AS_UID_toString(scf->eaccession));
+ scaffold.setIID(minScfID++);
+ vector<Tile_t> contigs;
+ int32_t offset = 0;
+
+ for (int i = 0; i < (scf->num_contig_pairs == 0 ? 1 : scf->num_contig_pairs); i++) {
+ ID_t ctg1 = contig_stream.lookupIID(AS_UID_toString(scf->contig_pairs[i].econtig1));
+ ID_t ctg2 = contig_stream.lookupIID(AS_UID_toString(scf->contig_pairs[i].econtig2));
+
+ if (ctg1 == NULL_ID || ctg2 == NULL_ID) {
+ cerr << "Error contigs " << AS_UID_toString(scf->contig_pairs[i].econtig1) << " AND " << AS_UID_toString(scf->contig_pairs[i].econtig2) << " are not defined" << endl;
+ continue;
+ }
+
+ Tile_t tile;
+ if (i == 0) {
+ tile.source = ctg1;
+ tile.offset = offset;
+ if (scf->contig_pairs[i].orient.isUnknown() || scf->contig_pairs[i].orient.isNormal() || scf->contig_pairs[i].orient.isInnie()) {
+ tile.range.begin = offset;
+ tile.range.end = offset + ctgLens[ctg1];
+ } else if (scf->contig_pairs[i].orient.isOuttie() || scf->contig_pairs[i].orient.isAnti()) {
+ tile.range.begin = offset + ctgLens[ctg1];
+ tile.range.end = offset;
+ }
+ contigs.push_back(tile);
+ offset += ctgLens[ctg1];
+ }
+ offset += scf->contig_pairs[i].mean;
+
+ if (ctg1 != ctg2) {
+ tile.source = ctg2;
+ tile.offset = offset;
+ if (scf->contig_pairs[i].orient.isUnknown() || scf->contig_pairs[i].orient.isNormal() || scf->contig_pairs[i].orient.isOuttie()) {
+ tile.range.begin = offset;
+ tile.range.end = offset + ctgLens[ctg2];
+ } else if (scf->contig_pairs[i].orient.isInnie() || scf->contig_pairs[i].orient.isAnti()) {
+ tile.range.begin = offset + ctgLens[ctg2];
+ tile.range.end = offset;
+ }
+ contigs.push_back(tile);
+ offset += ctgLens[ctg2];
+ }
+ }
+ scaffold.setContigTiling(contigs);
+ scf_stream.append(scaffold);
+ }
+ }
+
+ cerr << "Finished reading " << counter << " unitigs" << endl;
+}
+#else
+bool parseFrgFile(string fileName) {
+ cerr << "Error: Celera Assembler was not available when AMOS was compiled. Please recompile AMOS with the --enable-CA option" << endl;
+}
+bool parseAsmFile(string fileName) {
+ cerr << "Error: Celera Assembler was not available when AMOS was compiled. Please recompile AMOS with the --enable-CA option" << endl;
+}
+#endif // if defined CA
+
+ bool parseContigFile(ifstream &curCtg) {
+ Contig_t ctg;
+ vector<Tile_t> reads;
+ string id;
+
+ stringstream buffer(stringstream::in | stringstream::out);
+ stringstream consensus(stringstream::in | stringstream::out);
+ stringstream qualseq(stringstream::in | stringstream::out);
+
+ char curline[MAX_LINE_LEN];
+ string line;
+ bool first = true;
+ bool readConsensus = true;
+
+ while (curCtg.getline(curline, MAX_LINE_LEN, '\n')) {
+ line = curline;
+
+ if (curline[0] == '#' && curline[1] == '#') {
+ if (!first) {
+ ctg.setEID(id);
+ ctg.setIID(minCtgID++);
+ ctg.setReadTiling(reads);
+ ctg.setSequence(consensus.str().c_str(), qualseq.str().c_str());
+ contig_stream.append(ctg);
+ }
+ first = false;
+ reads.clear();
+ consensus.str("");
+ qualseq.str("");
+ id = line.substr(2, line.find_first_of(' ')-2);
+ readConsensus = true;
+ }
+ else if (curline[0] == '#') {
+ readConsensus = false;
+
+ Tile_t read;
+ string eid = line.substr(1, line.find('(')-1);
+ ID_t iid = read_stream.lookupIID(eid);
+ if (iid == NULL_ID) {
+ cerr << "Error could not find eid " << eid << " in bank, skipping" << endl;
+ continue;
+ }
+ read.source = iid;
+ buffer.str("");
+ buffer << line.substr(line.find_first_of('(')+1, line.find_first_of(')'));
+ buffer >> read.offset;
+
+ buffer.str("");
+ buffer << line.substr(line.find_first_of('{')+1, line.find_last_of('}'));
+ buffer >> read.range.begin;
+ buffer >> read.range.end;
+ read.range.begin--;
+ read.range.end--;
+ reads.push_back(read);
+ }
+ else if (readConsensus == true) {
+ consensus << line;
+ string qual(line.length(), char('0' + GOODQUAL));
+ qualseq << qual;
+ }
+ } // while in
+
+ // output last sequence
+ if (reads.size() != 0) {
+ ctg.setEID(id);
+ ctg.setIID(minCtgID++);
+ ctg.setReadTiling(reads);
+ ctg.setSequence(consensus.str().c_str(), qualseq.str().c_str());
+ contig_stream.append(ctg);
+ }
+} // parseContigFile
+
+void Tokenize(const string& str,
+ vector<string>& tokens,
+ const string& delimiters = " ")
+{
+ // Skip delimiters at beginning.
+ string::size_type breakPos = str.find_first_not_of(delimiters, 0);
+ // Find first "non-delimiter".
+ string::size_type pos = str.find_first_of(delimiters, breakPos);
+
+ while (string::npos != pos || string::npos != breakPos)
+ {
+ // Found a token, add it to the vector.
+ tokens.push_back(str.substr(breakPos, pos - breakPos));
+ // Skip delimiters. Note the "not_of"
+ breakPos = str.find_first_not_of(delimiters, pos);
+ // Find next "non-delimiter"
+ pos = str.find_first_of(delimiters, breakPos);
+ }
+}
+
diff --git a/src/Converters/toArachne.pl b/src/Converters/toArachne.pl
new file mode 100755
index 0000000..c33826a
--- /dev/null
+++ b/src/Converters/toArachne.pl
@@ -0,0 +1,768 @@
+#!/usr/local/bin/perl
+
+# $Id$
+
+# Copyright @ 2002, 2003, The Institute for Genomic Research (TIGR). All
+# rights reserved.
+
+use strict;
+use DBI;
+use TIGR::Foundation;
+
+my $REVISION = '$Revision$ ';
+our $VERSION = '1.0';
+our $VERSION_STRING = "$VERSION (Build $REVISION)";
+
+my $REPEAT_RANGE = 30; # minimum overlap with the repeat region.
+
+my $__HELP_INFO =
+q~NAME
+toArachne - generates inputs for GMOD
+
+SYNOPSIS
+toArachne [-D database] [ -S server ] [ -U username ]
+ { { -a asm_file } | { -C contig_file }| {-m mate_file}
+ } [-o out_prefix]
+ [ -debug level ] [ -h ] [ -V ]
+
+SUMMARY
+
+PARAMETERS
+
+OPTIONS
+
+EXIT CODES
+ 0 Successful completion
+ 1 Failed completion
+
+
+EXAMPLES
+
+USAGE
+
+SEE ALSO
+
+~;
+
+# initiate / define a TIGR Foundation object in the global scope
+my $base = new TIGR::Foundation;
+if (! defined $base){
+ print STDERR "the sky is falling, run away!\n";
+ exit(1);
+}
+
+$base->setVersionInfo($VERSION_STRING);
+$base->setHelpInfo($__HELP_INFO);
+
+# set up application defaults
+my $SERVER = "SYBTIGR";
+my $USER = "access";
+my $PASSWD = "access";
+my $DBTYPE = "Sybase";
+my $dbproc;
+
+my $db;
+my $matefile;
+my $asmfile;
+my $acefile;
+my $grpinp;
+my $outFile = "assembly";
+my $contigFile; # contig file
+
+# global variables
+my $minSeqId = 1; # for numbering sequences
+my %seqids; # correspondence between seq_names and ids
+my %seqnames;
+my %seq_range; # range of sequences
+my %contigs; # correspondence between contigs and lengths
+my %seqcontig; # correspondence between sequences and contigs
+my %contigseq; # correspondence between contigs and sequences
+my $matesDone = 0; # keep track of whether we found the mates
+my %forw; # forward end of insert
+my %rev; # reverse end of insert
+my %insertlib; # inserts for each library
+my %seenlib; # library for each insert
+my %libraries; # library parameter
+my %libMap; # mapping between 4 letter codes and actual libraries
+my %contigcons;
+my $scffile;
+my @scaffolds;
+my @scaffCtg;
+my @scaffctgs;
+my @scaffbases;
+my %obssize;
+
+# parse command line parameters
+my $err = $base->TIGR_GetOptions("D=s" => \$db,
+ "S=s" => \$SERVER,
+ "U=s" => \$USER,
+ "P=s" => \$PASSWD,
+ "m=s" => \$matefile,
+ "a=s" => \$asmfile,
+ "g=s" => \$grpinp,
+ "o=s" => \$outFile,
+ "C=s" => \$contigFile,
+ "ace=s" => \$acefile,
+ "s=s" => \$scffile);
+
+if ($err == 0){
+ $base->bail("Command parsing failed. See -h option");
+}
+
+if (! defined $matefile &&
+ (defined $asmfile || defined $contigFile || defined $acefile)) {
+ if (!defined $db){
+ $base->bail("You must provide either a mate file or a database!");
+ }
+ $dbproc = DBI->connect("dbi:$DBTYPE:server=$SERVER", $USER, $PASSWD);
+ if (! defined $dbproc){
+ $base->bail("Connection to server \"$SERVER\" failed");
+ }
+
+ $dbproc->do("use $db") ||
+ $base->bail("Failed to open database \"$db\"");
+}
+
+if (! defined $db && ! defined $matefile){
+ $base->bail("Either -D or -m must be defined. See -h option");
+}
+
+if (defined $asmfile){
+ open(IN, $asmfile) || $base->bail("Cannot open \"$asmfile\" : $!");
+
+ parseAsmFile(\*IN);
+
+ close(IN);
+}
+
+if (defined $contigFile){
+ open(IN, $contigFile) ||
+ $base->bail("Cannot open \"$contigFile\" : $!");
+
+ parseContigFile(\*IN);
+
+ close(IN);
+}
+
+if (defined $acefile){
+ open(IN, $acefile) ||
+ $base->bail("Cannot open \"$contigFile\" : $!");
+
+ parseACEFile(\*IN);
+
+ close(IN);
+}
+
+
+# since some files contain the mating relationship we only do this step
+# for those who don't.
+
+my %seeninsert;
+my %seqinsert;
+# here we generate the insert hashes: %insertlib, %libraries, %forw, %rev
+# %seqlib %seqmate;
+if (! $matesDone){
+ if (defined $db){ # do the TIGR thing
+ # this is where the get_mates routines will go in
+
+ while (my ($snm, $sid) = each %seqids){
+ if (length($snm) > 10){
+ next; # get rid of closure seqs
+ }
+ my $insert = substr($snm, 0, 7);
+ my $library = substr($snm, 0, 4);
+ if (! exists $seeninsert{$insert}){
+ $insertlib{$library} .= "$insert ";
+ $seeninsert{$insert} = 1;
+ }
+ $seqinsert{$snm} = $insert;
+ $seenlib{$insert} = $library;
+ $libraries{$library} = "";
+ if (substr($snm, 7, 1) eq "F" ||
+ substr($snm, 8, 1) eq "F"){
+ if (! exists $forw{$insert} ||
+ $snm gt $forw{$insert}){
+ $forw{$insert} = $snm;
+ }
+ } elsif (substr($snm, 7, 1) eq "R" ||
+ substr($snm, 8, 1) eq "R"){
+ if (! exists $rev{$insert} ||
+ $snm gt $rev{$insert}) {
+ $rev{$insert} = $snm;
+ }
+ }
+ }
+ while (my $lib = each %insertlib){
+ get_lib_info($lib);
+ }
+ } elsif (defined $matefile) { # the mate file contains either mates
+ # or regular expressions defining them
+ open(MATE, $matefile) || $base->bail("Cannot open \"$matefile\": $!\n");
+ my @libregexp;
+ my @libids;
+ my @pairregexp;
+ my $insname = 1;
+ while (<MATE>){
+ chomp;
+ if (/^library/){
+ my @recs = split('\t', $_);
+ if ($#recs < 3|| $#recs > 4){
+ print STDERR "Only ", $#recs + 1, " fields\n";
+ $base->logError("Improperly formated line $. in \"$matefile\".\nMaybe you didn't use TABs to separate fields\n", 1);
+ next;
+ }
+
+ if ($#recs == 4){
+ $libregexp[++$#libregexp] = $recs[4];
+ $libids[++$#libids] = $recs[1];
+ }
+ $libraries{$recs[1]} = "$recs[2] $recs[3]";
+ next;
+ } # if library
+ if (/^pair/){
+ my @recs = split('\t', $_);
+ if ($#recs != 2){
+ $base->logError("Improperly formated line $. in \"$matefile\".\nMaybe you didn't use TABs to separate fields\n");
+ next;
+ }
+ @pairregexp[++$#pairregexp] = "$recs[1] $recs[2]";
+ next;
+ }
+ if (/^\#/) { # comment
+ next;
+ }
+ if (/^\s*$/) { # empty line
+ next;
+ }
+
+ # now we just deal with the pair lines
+ my @recs = split('\t', $_);
+ if ($#recs < 1 || $#recs > 2){
+ $base->logError("Improperly formated line $. in \"$matefile\".\nMaybe you didn't use TABs to separate fields\n");
+ next;
+ }
+
+# make sure we've seen these sequences
+ if (! defined $seqids{$recs[0]}){
+ $base->logError("No contig contains sequence $recs[0] at line $. in \"$matefile\"");
+ next;
+ }
+ if (! defined $seqids{$recs[1]} ){
+ $base->logError("No contig contains sequence $recs[1] at line $. in \"$matefile\"");
+ next;
+ }
+
+ if (defined $recs[2]){
+ $insertlib{$recs[2]} .= "$insname ";
+ $seenlib{$insname} = $recs[2];
+ }
+
+ $forw{$insname} = $recs[0];
+ $rev{$insname} = $recs[1];
+
+ $seqinsert{$recs[0]} = $insname;
+ $seqinsert{$recs[1]} = $insname;
+
+ $insname++;
+ } # while <MATE>
+ close(MATE);
+
+ # now we have to go through all the sequences and assign them to
+ # inserts
+ while (my ($nm, $sid) = each %seqids){
+ for (my $r = 0; $r <= $#pairregexp; $r++){
+ my ($freg, $revreg) = split(' ', $pairregexp[$r]);
+ $base->logLocal("trying $freg and $revreg on $nm\n", 2);
+ if ($nm =~ /$freg/){
+ $base->logLocal("got forw $1\n", 2);
+ if (! exists $forw{$1}){
+ $forw{$1} = $nm;
+ $seqinsert{$nm} = $1;
+ }
+ last;
+ }
+ if ($nm =~ /$revreg/){
+ $base->logLocal("got rev $1\n", 2);
+ if (! exists $rev{$1}){
+ $rev{$1} = $nm;
+ $seqinsert{$nm} = $1;
+ }
+ last;
+ }
+ } # for each pairreg
+ } # while each %seqids
+
+ while (my ($ins, $nm) = each %forw) {
+ if (! exists $seenlib{$ins}){
+ my $found = 0;
+
+ for (my $l = 0; $l <= $#libregexp; $l++){
+ $base->logLocal("Trying $libregexp[$l] on $nm\n", 2);
+ if ($nm =~ /$libregexp[$l]/){
+ $base->logLocal("found $libids[$l]\n", 2);
+ $insertlib{$libids[$l]} .= "$ins ";
+ $seenlib{$ins} = $libids[$l];
+ $found = 1;
+ last;
+ }
+ }
+ if ($found == 0){
+ $base->logError("Cannot find library for \"$nm\"");
+ next;
+ }
+ }
+ }
+ } # elsif
+} # if ! matesDone
+
+if (defined $scffile){
+ open(IN, $scffile) ||
+ $base->bail("Cannot open \"$scffile\" : $!");
+
+ parseSCFile(\*IN);
+
+ close(IN);
+
+ open(SCF, ">$outFile.links") || $base->bail("Cannot open $outFile.links: $!\n");
+
+ for (my $s = 0; $s <= $#scaffolds; $s++){
+ my $sid = $scaffolds[$s];
+ my $sctgs = $scaffctgs[$s];
+ my $slen = $scaffbases[$s];
+
+ my $coords = $scaffCtg[$s];
+ my %starts; my %ends;
+ my @scafctgs;
+ while (my ($cid, $ccrds) = each %{$coords}){
+ my ($l, $r, $ori) = split(' ', $ccrds);
+ $starts{$cid} = $l;
+ $ends{$cid} = $r;
+ push(@scafctgs, $cid);
+ if ($ori eq "<"){ # need to reverse the contig
+ $contigcons{$cid} = reverseComplement($contigcons{$cid});
+ my @seqs = split(' ', $contigseq{$cid});
+ for (my $seq = 0; $seq <= $#seqs; $seq++){
+ my ($al, $ar, $sl, $sr) = split(' ', $seq_range{$seqs[$seq]});
+ my $nal = $contigs{$cid} - $ar;
+ my $nar = $contigs{$cid} - $al;
+ my $nsl = $sr;
+ my $nsr = $sl;
+ $seq_range{$seqs[$seq]} = "$nal $nar $nsl $nsr";
+ }
+ }
+ }
+
+ @scafctgs = sort {$starts{$a} <=> $starts{$b}} @scafctgs;
+ my $last = 0;
+ for (my $sc = 0; $sc <= $#scafctgs; $sc++){
+ print SCF
+ sprintf("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n",
+ $sid, $slen, $sctgs, $sc + 1, $scafctgs[$sc],
+ $contigs{$scafctgs[$sc]},
+ $starts{$scafctgs[$sc]} - $last,
+ (($sc != $#scafctgs) ? ($starts{$scafctgs[$sc + 1]} - $ends{$scafctgs[$sc]}) : ($slen - $ends{$scafctgs[$sc]})));
+ $last = $ends{$scafctgs[$sc]};
+ }
+
+ }
+
+ close(SCF);
+}
+
+open(XML, ">$outFile.reads.xml") || $base->bail("Cannot open \"$outFile.xml\": $!\n");
+
+print XML "<?xml version=\"1.0\"?>\n";
+print XML "<trace_volume>\n";
+
+while (my ($nm, $sid) = each %seqids){
+ my $ins = $seqinsert{$nm};
+ my $lib = $seenlib{$ins};
+ my ($min, $max) = split(' ', $libraries{$lib});
+ my $mean = ($min + $max) / 2;
+ my $stdev = ($max - $min) / 6;
+ $stdev = sprintf("%d", $stdev);
+ my $end;
+ if ($nm eq $forw{$ins}) {
+ $end = "F";
+ } elsif ($nm eq $rev{$ins}){
+ $end = "R";
+ } else {
+ $end = "C";
+ }
+
+
+ print XML " <trace>\n";
+ print XML " <trace_name>$nm</trace_name>\n";
+ print XML " <template_id>$ins</template_id>\n";
+ print XML " <trace_end>$end</trace_end>\n";
+ print XML " <library_id>$lib</library_id>\n";
+ print XML " <insert_size>$mean</insert_size>\n";
+ print XML " <insert_stdev>$stdev</insert_stdev>\n";
+ print XML " <center_name>TIGR</center_name>\n";
+ print XML " <type>paired_production</type>\n";
+ print XML " </trace>\n";
+}
+print XML "</trace_volume>\n";
+
+close(XML);
+
+# now inserts should be defined we just pick those that connect distinct
+# contigs
+
+open(RDS, ">$outFile.bases") || $base->bail("Cannot open \"$outFile.bases\": $!\n");
+
+open(OUT, ">$outFile.reads") || $base->bail("Cannot open \"$outFile.reads\": $!\n");
+
+while (my ($ctg, $len) = each %contigs){
+ my @seqs = split(' ', $contigseq{$ctg});
+
+ print RDS ">contig_$ctg\n";
+ for (my $ll = 0; $ll < length($contigcons{$ctg}); $ll += 80){
+ print RDS substr($contigcons{$ctg}, $ll, 80), "\n";
+ }
+
+ for (my $seq = 0; $seq <= $#seqs; $seq++){
+ if (! exists $seqids{$seqnames{$seqs[$seq]}}){
+ $base->logError("Cannot find $seqnames{$seqs[$seq]}", 1);
+ next;
+ }
+ my ($al, $ar, $sl, $sr) = split(' ', $seq_range{$seqs[$seq]});
+ my $ori = ($sl < $sr) ? "+" : "-";
+
+ if ($ori eq "-"){
+ my $tmp = $sl;
+ $sl = $sr;
+ $sr = $tmp;
+ }
+
+ if (! exists $seqinsert{$seqnames{$seqs[$seq]}}){
+ $base->logError("Cannot find insert for $seqs[$seq]");
+ next;
+ }
+ my $ins = $seqinsert{$seqnames{$seqs[$seq]}};
+ my $obs = $obssize{$ins};
+ my $mate;
+
+ if ($seqnames{$seqs[$seq]} eq $forw{$ins}) {
+ $mate = $rev{$ins};
+ } elsif ($seqnames{$seqs[$seq]} eq $rev{$ins}){
+ $mate = $forw{$ins};
+ } else {
+ $base->logError("$seqnames{$seqs[$seq]} is not in $ins\n");
+ }
+
+ if (defined $mate){
+ my $mateC = $seqcontig{$seqids{$mate}};
+ my ($mal, $mar, $msl, $msr) = split(' ', $seq_range{$seqids{$mate}});
+
+ if ($mateC == $ctg){
+ my $low; my $high;
+ if ($mal < $al){
+ $low = $mal;
+ } else {
+ $low = $al;
+ }
+ if ($mar > $ar){
+ $high = $mar;
+ } else {
+ $high = $ar;
+ }
+
+ $obs = $high - $low;
+ }
+ }
+
+ my $lib = $seenlib{$ins};
+ my ($min, $max) = split(' ', $libraries{$lib});
+ my $mean = ($min + $max) / 2;
+ my $stdev = ($max - $min) / 6;
+
+ $base->logLocal("Insert: $ins library: $lib min: $min max: $max\n",0);
+
+ if (! defined $mate){
+ print OUT
+ sprintf("%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%s\t\t\t\t\t\t\t\n",
+ $seqnames{$seqs[$seq]}, $sr, $sl, $sr - $sl, $ctg, $len,
+ $al, $ar, $ori);
+ } else {
+ print OUT
+ sprintf("%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%s\t%s\t\t%d\t%d\t%d\t%d\t\n",
+ $seqnames{$seqs[$seq]}, $sr, $sl, $sr - $sl, $ctg, $len,
+ $al, $ar, $ori, $mate, $seqcontig{$seqids{$mate}},
+ $obs, $mean, $stdev);
+ }
+ }
+}
+
+
+close(OUT);
+close(RDS);
+#I'm done, wshew
+
+exit(0);
+###############################################################
+
+sub parseSCFile {
+ my $IN = shift;
+
+ while (<$IN>){
+ if (/^Scaffold scaff_(\d+) (\d+) contigs \d+ bases (\d+) span/){
+ my $scaffId = $1;
+ push(@scaffolds, $scaffId);
+ push(@scaffctgs, $2);
+ push(@scaffbases, $3);
+ $#scaffCtg++;
+
+ $base->logLocal("Got $1 - $2 - $3\n", 1);
+ }
+ if (/contig_(\S+) \((\d+), (\d+)\) \S*(<|>)\S* .* \S*(<|>)\S* contig_(\S+) \((\d+), (\d+)\)/){
+ ${$scaffCtg[$#scaffCtg]}{$1} = "$2 $3 $4";
+ ${$scaffCtg[$#scaffCtg]}{$6} = "$7 $8 $5";
+ $base->logLocal("Got $1 $2 $3 $4 and $6 $7 $8 $5\n", 1);
+ }
+ if (/---/){
+ $_ =~ /\s+(\S+) .*\.\.\.\s+(\d+)/;
+ my $ins = $seqinsert{$1};
+# print "insert for $1 is $ins with $2\n";
+ if (defined $ins){
+ $obssize{$ins} = $2;
+ }
+ }
+ if (/UNUSED LINKS/){
+ last;
+ }
+ }
+}
+
+
+# PARSING FUNCTIONS
+#
+# Each function parses either a file or a database table and
+# fills in the following hashes:
+#
+# %contigs - contig_ids and sizes
+# %seqids - seq_name to seq_id
+# %seq_range - seq_id to seq_range and asm_range as blank delimited string
+# %seqcontig - seq_id to contig
+sub parseAsmFile {
+ my $IN = shift;
+
+ my $ctg;
+ my $len;
+ my $sname;
+ my $alend;
+ my $arend;
+ my $slend;
+ my $srend;
+ my $sid;
+ while (<$IN>){
+ if (/^sequence\s+(\w+)/){
+ $len = length($1);
+ next;
+ }
+ if (/^asmbl_id\s+(\w+)/){
+ $ctg = $1;
+ $contigs{$ctg} = $len; # here we assume that length
+ # was already computed
+ next;
+ }
+ if (/^seq_name\s+(\S+)/){
+ $sname = $1;
+ $sid = $minSeqId++;
+ $seqcontig{$sid} = $ctg;
+ $contigseq{$ctg} .= "$sid ";
+ $seqids{$sname} = $sid;
+ $seqnames{$sid} = $sname;
+ next;
+ }
+ if (/^asm_lend\s+(\d+)/){
+ $alend = $1;
+ next;
+ }
+ if (/^asm_rend\s+(\d+)/){
+ $arend = $1;
+ next;
+ }
+ if (/^seq_lend\s+(\d+)/){
+ $slend = $1;
+ next;
+ }
+ if (/^seq_rend\s+(\d+)/){
+ $srend = $1;
+ next;
+ }
+ if (/^offset/){
+ $seq_range{$sid} = "$alend $arend $slend $srend";
+ next;
+ }
+ }
+}
+
+
+sub parseACEFile {
+ my $IN = shift;
+
+ my $ctg;
+ my $len;
+ my $sname;
+ my $alend;
+ my $arend;
+ my $slend;
+ my $srend;
+ my $sid;
+ my $incontig = 0;
+ my $consensus = "";
+ while (<$IN>){
+ if (/^CO (\S+) (\d+) (\d+)/){
+ $ctg = $1;
+ $contigs{$ctg} = $2;
+ $incontig = 1;
+ $consensus = "";
+# %offset = ();
+ next;
+ }
+
+ if (/^AF (\S+) (\w) (-?\d+)/){
+
+ }
+
+ if (/^\#(\S+)\(\d+\) .*\{(\d+) (\d+)\} <(\d+) (\d+)>/){
+ $incontig = 0;
+ $sname = $1;
+ $sid = $minSeqId++;
+ $seqcontig{$sid} = $ctg;
+ $contigseq{$ctg} .= "$sid ";
+# print STDERR "adding $sname to $ctg\n";
+ $seqids{$sname} = $sid;
+ $seqnames{$sid} = $sname;
+ $alend = $4;
+ $arend = $5;
+ $slend = $2;
+ $srend = $3;
+ $seq_range{$sid} = "$alend $arend $slend $srend";
+ next;
+ }
+
+ if ($incontig && /^\s*$/){
+ # here I try to get rid of dashes when computing contig sizes
+ my $ind = -1;
+ $incontig = 0;
+
+ while (($ind = index($consensus ,"*", $ind + 1)) != -1){
+ $contigs{$ctg}--;
+ }
+ $consensus =~ s/\*//g ;
+ $contigcons{$ctg} = $consensus;
+ next;
+ }
+
+ if ($incontig){
+ chomp;
+ $consensus .= $_;
+ next;
+ }
+
+ }
+}
+
+
+
+# parser for ace files
+sub parseContigFile {
+ my $IN = shift;
+
+ my $ctg;
+ my $len;
+ my $sname;
+ my $alend;
+ my $arend;
+ my $slend;
+ my $srend;
+ my $sid;
+ my $incontig = 0;
+ my $consensus = "";
+ while (<$IN>){
+ if (/^\#\#(\S+) \d+ (\d+)/ ){
+ if (defined $consensus){
+ $consensus =~ s/-//g;
+ $contigcons{$ctg} = $consensus;
+ }
+ $consensus = "";
+ $ctg = $1;
+ $contigs{$ctg} = $2;
+ $incontig = 1;
+ next;
+ }
+
+ if (/^\#(\S+)\(\d+\) .*\{(\d+) (\d+)\} <(\d+) (\d+)>/){
+ $incontig = 0;
+ $sname = $1;
+ $sid = $minSeqId++;
+ $seqcontig{$sid} = $ctg;
+ $contigseq{$ctg} .= "$sid ";
+# print STDERR "adding $sname to $ctg\n";
+ $seqids{$sname} = $sid;
+ $seqnames{$sid} = $sname;
+ $alend = $4;
+ $arend = $5;
+ $slend = $2;
+ $srend = $3;
+ $seq_range{$sid} = "$alend $arend $slend $srend";
+ next;
+ }
+
+ if ($incontig){
+ # here I try to get rid of dashes when computing contig sizes
+ my $ind = -1;
+ while (($ind = index($_ ,"-", $ind + 1)) != -1){
+ $contigs{$ctg}--;
+ }
+ chomp;
+ $consensus .= $_;
+ }
+ }
+ if (defined $consensus){
+ $consensus =~ s/-//g;
+ $contigcons{$ctg} = $consensus;
+ }
+
+}
+
+
+# TIGR DB INTERACTION
+
+# get_lib_info retrieves information from the database for a particular
+# lib_id and writes it into the %libraries array.
+# assumes $dbproc is already defined
+sub get_lib_info
+{
+ my $lib = shift;
+
+ my $query =
+qq~
+select min_clone_len, max_clone_len, cat#
+from track..library
+where lib_id = "$lib"
+~;
+
+ my $rh = $dbproc->prepare($query) ||
+ $base->bail("Cannot prepare query: \"$query\"");
+
+ $rh->execute() || $base->bail("query \"$query\" failed");
+
+ while (my $lineref = $rh->fetchrow_arrayref){
+ $libraries{$lib} = "$$lineref[0] $$lineref[1]";
+ $libMap{$lib} = $$lineref[2];
+ }
+
+ $rh->finish;
+}
+
+sub reverseComplement {
+ my($string) = @_;
+
+ $string = reverse($string);
+ $string =~ tr/AaCcTtGgUuMmRrWwSsYyKkVvHhDdBbXxNn.-/TtGgAaCcAaKkYyWwSsRrMmBbD
+dHhVvXxNn.-/;
+ return $string;
+} # reverseComplement
diff --git a/src/CtgTrim/Makefile.am b/src/CtgTrim/Makefile.am
new file mode 100644
index 0000000..614f442
--- /dev/null
+++ b/src/CtgTrim/Makefile.am
@@ -0,0 +1,20 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+##-- TO BE INSTALLED
+dist_bin_SCRIPTS = \
+ excl_seqs.pl \
+ findChimeras.pl \
+ find_ends.pl \
+ fixfrg.pl \
+ iterate.pl \
+ kmers.pl \
+ singles.pl \
+ tab2ovls.pl \
+ trimends.pl \
+ trimfrg.pl \
+ vecfix.pl
+
+
+##-- END OF MAKEFILE --##
\ No newline at end of file
diff --git a/src/CtgTrim/Makefile.in b/src/CtgTrim/Makefile.in
new file mode 100644
index 0000000..4360400
--- /dev/null
+++ b/src/CtgTrim/Makefile.in
@@ -0,0 +1,494 @@
+# 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 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@
+DIST_COMMON = $(dist_bin_SCRIPTS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+subdir = src/CtgTrim
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(bindir)"
+SCRIPTS = $(dist_bin_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+dist_bin_SCRIPTS = \
+ excl_seqs.pl \
+ findChimeras.pl \
+ find_ends.pl \
+ fixfrg.pl \
+ iterate.pl \
+ kmers.pl \
+ singles.pl \
+ tab2ovls.pl \
+ trimends.pl \
+ trimfrg.pl \
+ vecfix.pl
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/CtgTrim/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/CtgTrim/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):
+install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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 $(SCRIPTS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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 mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+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-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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 -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-dist_binSCRIPTS 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 pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-dist_binSCRIPTS uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/CtgTrim/excl_seqs.pl b/src/CtgTrim/excl_seqs.pl
new file mode 100755
index 0000000..978820d
--- /dev/null
+++ b/src/CtgTrim/excl_seqs.pl
@@ -0,0 +1,52 @@
+#!/usr/local/bin/perl
+
+$infile = $ARGV[0];
+$exclfile = $ARGV[1];
+
+if (exists $ARGV[2] && $ARGV[2] eq "include"){
+ $revert = 0;
+} else {
+ $revert = 1;
+}
+
+open(EXCL, $exclfile) || die ("Cannot open \"$exclfile\": $!\n");
+while (<EXCL>){
+ chomp;
+ if (/^(\S+)/){
+ $contig = $1;
+ $exclude{$1} = 1;
+ }
+ if (/^\t(\S+)/){
+# print STDERR "excluding \"$1\"\n";
+ $exclude{$1} = 1;
+ $contigs{$contig}++;
+ }
+}
+close(EXCL);
+
+$toprint = $revert;
+open(IN, $infile) || die ("Cannot open \"$infile\": $!\n");
+while (<IN>){
+ if (/^\#\#(\S+) (\d+) (\d+)/){
+ $ctg = $1; $nseq = $2; $len = $3;
+ $nseq -= $contigs{$ctg};
+
+ print "\#\#$ctg $nseq $len bases, 00000000 checksum.\n";
+
+ $toprint = $revert;
+ next;
+ }
+ if (/^[\#>]([^\#][^\s\(]+)/){ # header found
+# print STDERR "Checking \"$1\"\n";
+ if (exists $exclude{$1}){
+# print STDERR "bye bye\n";
+ $toprint = 1 - $revert;
+ } else {
+ $toprint = $revert;
+ }
+ }
+ if ($toprint == 1){
+ print;
+ }
+}
+close(IN);
diff --git a/src/CtgTrim/findChimeras.pl b/src/CtgTrim/findChimeras.pl
new file mode 100755
index 0000000..06ee8cb
--- /dev/null
+++ b/src/CtgTrim/findChimeras.pl
@@ -0,0 +1,196 @@
+#!/usr/local/bin/perl
+
+use strict;
+use TIGR::Foundation;
+
+my $base = new TIGR::Foundation;
+
+if (! defined $base){
+ die("Walk do not run to the nearest EXIT!\n");
+}
+
+my $VERSION = '${Revision}$ ';
+my $HELP = "findChimeras -o ovlp_file -l len_file";
+
+$base->setHelpInfo($HELP);
+$base->setVersionInfo($VERSION);
+
+
+my $ovlpfile;
+my $lenfile;
+
+my $ret = $base->TIGR_GetOptions("o=s" => \$ovlpfile,
+ "l=s" => \$lenfile);
+
+
+my %seqnames;
+my %seqlens;
+my %olaps;
+my %ovl; # quick lookup if two fragments overlap
+my %insert; # insert of each sequence
+my %exts; # extensions of each sequence
+
+if (! defined $lenfile) {
+ $base->bail("Must provide a length file (see -h)");
+}
+open(LEN, "$lenfile") || $base->bail("Cannot open \"$lenfile\": $!");
+my @fields;
+my $insertname;
+while (<LEN>){
+ chomp;
+ @fields = split('\t');
+ $seqnames{$fields[0]} = $fields[1];
+ $seqlens{$fields[0]} = $fields[2];
+ $insertname = substr($fields[1], 0, 7);
+ $insert{$fields[0]} = $insertname;
+}
+
+close(LEN);
+
+if (! defined $ovlpfile) {
+ $base->bail("Must provide an overlap file (see -h)");
+}
+open(OVLP, "$ovlpfile") || $base->bail("Cannot open \"$ovlpfile\": $!");
+
+my $last;
+my $this;
+my $that;
+my $ori;
+my $start;
+my $end;
+while (<OVLP>){
+ chomp;
+ @fields = split(/\s+/);
+
+ $this = $fields[1];
+ $that = $fields[2];
+ $ori = $fields[3];
+ $start = $fields[4];
+ $end = $fields[5];
+
+ print STDERR "$this\r";
+
+ if ($insert{$this} eq $insert{$that}) {
+ next;
+ } # skip same insert overlaps
+
+ $last = $this;
+
+ $ovl{"$this $that"} = 1;
+
+
+ # first check the beginning
+ if ($start <= 0) {
+ $start = 0;
+ $exts{"$this B"} .= "$that "; # that extends this at the beginning
+ }
+
+ # then check the end
+ if ($end >= 0) {
+ $end = $seqlens{$this};
+ $exts{"$this E"} .= "$that "; # that extends this at the end
+ } else { # $end < 0
+ $end = $seqlens{$this} + $end;
+ }
+
+ print "$this $that $seqnames{$this} $seqnames{$that} $start $end $seqlens{$this}\n";
+}
+
+
+# now we look for "break points" - that is points through which no sequence
+# extends
+select STDOUT;
+$| = 1;
+
+my $end;
+my $nconflicts = 0;
+my $other;
+my $j;
+my $b;
+my $bori;
+my $bs;
+my $be;
+my $i;
+my $a;
+my $ovls;
+
+seek(OVLP, 0, 0); # rewind the file
+
+while (<OVLP>){
+ chomp;
+ @fields = split(/\s+/);
+
+ $a = $fields[1];
+ $b = $fields[2];
+ $bori = $fields[3];
+ $bs = $fields[4];
+ $be = $fields[5];
+
+ if ($bs <= 0 ) {
+ $bs = 0;
+ }
+ if ($be >=0 ) {
+ $be = $seqlens{$a};
+ } else {
+ $be += $seqlens{$a};
+ }
+
+ print STDERR "$a\r";
+
+ if ($insert{$a} eq $insert{$b}) {
+ next;
+ } # skip same insert overlaps
+
+ print "checking $a $seqnames{$a} $b $seqnames{$b} $bori $bs $be\n";
+ if ($be < $seqlens{$a}) { # we check extension to the right
+ $end = ($bori eq 'N') ? "E" : "B";
+ my @ex = split(' ', $exts{"$b $end"});
+ for ($j = 0; $j <= $#ex; $j++){
+ # check all reads extending $b
+ $other = $ex[$j];
+ print "end looking at $other\n";
+ if ($insert{$other} eq $insert{$a}) {
+ # skip same insert reads
+ next;
+ }
+ if (exists $ovl{"$a $other"} ||
+ exists $ovl{"$other $a"}) {
+ $nconflicts = 0;
+ last; # we found an extension, this is not a conflict
+ } else {
+ $nconflicts++;
+ }
+ } # for my $j = ...
+ if ($nconflicts != 0){
+ print "$a $seqnames{$a} has $nconflicts conflicts with $b $seqnames{$b} at end $be\n";
+ }
+ } # if $be < $seqlens
+ $nconflicts = 0;
+ if ($bs > 0 ) { # we check extension to the left
+ $end = ($bori eq 'N') ? "B" : "E";
+ my @ex = split(' ', $exts{"$b $end"});
+ for ($j = 0; $j <= $#ex; $j++){
+ # check all reads extending $b
+q $other = $ex[$j];
+ print "beginning looking at $other\n";
+ if ($insert{$other} eq $insert{$a}) {
+ # skip same insert reads
+ next;
+ }
+ if (exists $ovl{"$a $other"} ||
+ exists $ovl{"$other $a"}) {
+ $nconflicts = 0;
+ last; # we found an extension, this is not a conflict
+ } else {
+ $nconflicts++;
+ }
+ } # for $j <= $#exts
+ if ($nconflicts != 0){
+ print "$a $seqnames{$a} has $nconflicts conflicts with $b $seqnames{$b} at beginning $bs\n";
+ }
+ } # if $bs > 0
+} # while (<OVLP>)
+
+close(OVLP);
+print "DONE\n";
+exit(0); #Main ends here
diff --git a/src/CtgTrim/find_ends.pl b/src/CtgTrim/find_ends.pl
new file mode 100755
index 0000000..ee77286
--- /dev/null
+++ b/src/CtgTrim/find_ends.pl
@@ -0,0 +1,94 @@
+#!/usr/local/bin/perl
+
+$infile = $ARGV[0];
+$ovlpfile = $ARGV[1];
+
+$MARGIN = 100;
+$BEG = 50; # how far from the beginning the true beginning can be
+
+if (defined $ovlpfile){
+ open(OVLP, $ovlpfile) || die ("Cannot open \"$ovlpfile\": $!\n");
+ while (<OVLP>){
+ @recs = split;
+ $recs[0] =~ /(\d+)\(\d+\)/;
+ $ctg1 = $1;
+ $recs[3] =~ /(\d+)\(\d+\)/;
+ $ctg2 = $2;
+
+ $l1 = ($recs[1] < $recs[2]) ? $recs[1] : $recs[2];
+ $r1 = ($recs[1] < $recs[2]) ? $recs[2] : $recs[1];
+ $l2 = ($recs[4] < $recs[5]) ? $recs[4] : $recs[5];
+ $r2 = ($recs[4] < $recs[5]) ? $recs[5] : $recs[4];
+
+ if ($l1 < $BEG) {
+ $ctg1 .= "B";
+ } else {
+ $ctg1 .= "E";
+ }
+ if ($l2 < $BEG) {
+ $cgt2 .= "B";
+ } else {
+ $ctg2 .= "E";
+ }
+
+ if (! exists $left{$ctg1} || $left{$ctg1} > $l1){
+ $left{$ctg1} = $l1;
+ }
+ if (! exists $left{$ctg2} || $left{$ctg2} > $l2){
+ $left{$ctg2} = $l2;
+ }
+ if (! exists $right{$ctg1} || $right{$ctg1} < $r1){
+ $right{$ctg1} = $r1;
+ }
+ if (! exists $right{$ctg2} || $right{$ctg2} < $r2){
+ $right{$ctg2} = $r2;
+ }
+# print STDERR "$ctg1 ($left{$ctg1}, $right{$ctg1}) - $ctg2 ($left{$ctg2}, $right{$ctg2}) \n";
+ }
+ close(OVLPS);
+} # if defined ovlpfile
+
+open(IN, $infile) || die ("Cannot open \"$infile\": $!\n");
+
+while (<IN>){
+ if (/^\#\#(\S+) (\d+) (\d+)/){
+ $contig = $1;
+ $contiglen = $3;
+
+# print STDERR "$contig (", $left{"${contig}B"}, ", ",
+ $right{"${contig}B"}, ") (", $left{"${contig}E"}, ", ",
+ $right{"${contig}E"}, ")\n";
+ print "$contig\n";
+ next;
+ }
+ if (/^\#(\w+)\((\d+)\).*checksum. \{(\d+) (\d+)\}/){
+ $seq = $1;
+ $off = $2;
+ $sl = $3;
+ $sr = $4;
+
+ if (defined $ovlpfile && exists $right{"${contig}B"} &&
+ $off < $right{"${contig}B"} ||
+ ! defined $ovlpfile && $off < $MARGIN){
+ if (! exists $seen{$seq}){
+ $seen{$seq} = 1;
+# print STDERR "$seq ($off, $sl, $sr) from $contig ($contiglen) excluded due to $off < ",
+ $right{"${contig}B"}, " or < $MARGIN\n";
+ print "\t$seq B\n";
+ }
+ }
+ if (defined $ovlpfile && exists $left{"${contig}E"} &&
+ $off + abs($sl - $sr) + 1 > $left{"${contig}E"} ||
+ ! defined $ovlpfile &&
+ $off + abs($sl - $sr) + 1 > $contiglen - $MARGIN){
+ if (! exists $seen{$seq}){
+ $seen{$seq} = 1;
+# print STDERR "$seq ($off, $sl, $sr) from $contig ($contiglen) excluded due to ", $off + abs($sl - $sr) + 1, " > ",
+ $left{"${contig}E"}, " or > ", $contiglen - $MARGIN, "\n";
+ print "\t$seq E\n";
+ }
+ }
+ }
+}
+
+close(IN);
diff --git a/src/CtgTrim/fixfrg.pl b/src/CtgTrim/fixfrg.pl
new file mode 100755
index 0000000..3f8ced6
--- /dev/null
+++ b/src/CtgTrim/fixfrg.pl
@@ -0,0 +1,46 @@
+#!/usr/local/bin/perl
+
+use AMOS::AmosLib;
+
+$seqfile = $ARGV[0];
+$frgfile = $ARGV[1];
+
+open(SEQ, $seqfile) || die ("Cannot open $seqfile\n");
+while (<SEQ>){
+ if (/^>(\S+) \d+ \d+ \d+ (\d+) (\d+)/){
+ $seq = $1;
+ $cll = $2;
+ $clr = $3;
+
+ $cll -= 1;
+
+ $clear{$seq} = "$cll,$clr";
+ }
+}
+close(SEQ);
+
+open(FRG, $frgfile) || die ("Cannot open $frgfile\n");
+
+while ($record = getRecord(\*FRG)){
+ my ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec eq "FRG"){
+ my $nm = $$fields{src};
+ my @lines = split('\n', $nm);
+ $nm = join('', @lines);
+ if (exists $clear{$nm}){
+ #print "updating clear range of $nm to $clear{$nm}\n";
+ $record =~ s/clr:(\d+),(\d+)/clr:$clear{$nm}/m;
+ $seen{$$fields{acc}} = 1;
+ print $record;
+ }
+ next;
+ }
+ if ($rec eq "LKG"){
+ if (exists $seen{$$fields{fg1}} && exists $seen{$$fields{fg2}}){
+ print $record;
+ }
+ next;
+ }
+ print $record;
+}
+
diff --git a/src/CtgTrim/iterate.pl b/src/CtgTrim/iterate.pl
new file mode 100755
index 0000000..ce46a98
--- /dev/null
+++ b/src/CtgTrim/iterate.pl
@@ -0,0 +1,70 @@
+#!/usr/local/bin/perl
+
+my $BASEDIR = "/local/asmg/work/mpop/WGA/";
+my $BINDIR = $BASEDIR . "bin/";
+
+$trim = $BINDIR . "trimends";
+$grep = "/bin/grep";
+
+
+$infile = $ARGV[0];
+
+$inittime = time();
+$time = time();
+print "###Doing prelimnary trimming\n";
+system("$trim $infile");
+($sec, $min, $hour, $day) = gmtime(time() - $time); $day--;
+print "###finished trimming in $day days $hour:$min:$sec\n";
+if (! -s "${infile}_trimmed.qc"){
+ die ("trimming ($trim $infile) appears to have failed\n");
+}
+
+$iter = 0;
+do {
+ $iter++;
+ print "###Starting iteration $iter\n";
+ $time = time();
+
+ open(STAT, "$grep \"SeqsInBigContigs\" ${infile}_trimmed.qc |") ||
+ die ("couldn't run $grep :$!\n");
+ $_ = <STAT>;
+ $_ =~ /=(\d+)$/;
+ $startbases = $1;
+ print "###we start with $startbases sequences in big contigs now\n";
+ close(STAT);
+
+
+ system("$trim ${infile}_trimmed");
+
+ if (! -s "${infile}_trimmed_trimmed.qc"){
+ die ("trimming appears to have failed\n");
+ }
+
+ open(STAT, "$grep \"SeqsInBigContigs\" ${infile}_trimmed_trimmed.qc |") ||
+ die ("couldn't run $grep :$!\n");
+ $_ = <STAT>;
+ $_ =~ /=(\d+)$/;
+ $endbases = $1;
+ print "###we have $endbases sequences in big contigs now\n";
+ close(STAT);
+
+ $diff = 100.0 * ($endbases - $startbases) / $startbases;
+ print "### the difference is $diff %\n";
+
+ system("rm -rf ${infile}_trimmed.*");
+
+ @copyprefixes = ("qc", "seq", "qual", "frg", "contig", "fasta", "tasm", "asm");
+ for ($i = 0; $i <= $#copyprefixes; $i++){
+ rename("${infile}_trimmed_trimmed.$copyprefixes[$i]",
+ "${infile}_trimmed.$copyprefixes[$i]") ||
+ die ("Cannot rename ${infile}_trimmed_trimmed.$copyprefixes[$i]: $!\n");
+ }
+
+ system("rm -rf ${infile}_trimmed_trimmed.*");
+
+ ($sec, $min, $hour, $day) = gmtime(time() - $time); $day--;
+ print "###iteration $iter finished in $day days $hour:$min:$sec\n";
+ ($sec, $min, $hour, $day) = gmtime(time() - $inittime); $day--;
+ print "###total elapsed time: $day days $hour:$min:$sec\n";
+} until ($diff < 1);
+
diff --git a/src/CtgTrim/kmers.pl b/src/CtgTrim/kmers.pl
new file mode 100755
index 0000000..4443955
--- /dev/null
+++ b/src/CtgTrim/kmers.pl
@@ -0,0 +1,46 @@
+#!/usr/local/bin/perl
+
+use AMOS::AmosLib;
+
+$N = 8;
+$START = 60;
+my %starts;
+my %ends;
+my $nseqs = 0;
+while (<>){
+ chomp;
+ if (/^>/) {
+ print STDERR "$nseqs\r";
+ $nseqs++;
+ $seq = uc($seq);
+ #print "$seq\n";
+ for ($i = 0; $i < length($seq) - $N + 1; $i++){
+ # print "nmer: ", substr($seq, $i, $N), "\n";
+ if ($i <= 60) {
+ $starts{substr($seq, $i, $N)}++;
+# $starts{reverseComplement(substr($seq, $i, $N))}++;
+ } else {
+ $ends{substr($seq, $i, $N)}++;
+# $ends{reverseComplement(substr($seq, $i, $N))}++;
+ }
+ }
+ $seq = "";
+ next;
+ }
+ $seq .= $_;
+}
+$seq = uc($seq);
+for ($i = 0; $i < length($seq) - $N + 1; $i++){
+ # print "nmer: ", substr($seq, $i, $N), "\n";
+ if ($i <= 60) {
+ $starts{substr($seq, $i, $N)}++;
+ $starts{reverseComplement(substr($seq, $i, $N))}++;
+ } else {
+ $ends{substr($seq, $i, $N)}++;
+ $ends{reverseComplement(substr($seq, $i, $N))}++;
+ }
+}
+
+while (($nmer, $n) = each %starts){
+ print "$nmer\t$n\t$ends{$nmer}\n";
+}
diff --git a/src/CtgTrim/singles.pl b/src/CtgTrim/singles.pl
new file mode 100755
index 0000000..b1e8332
--- /dev/null
+++ b/src/CtgTrim/singles.pl
@@ -0,0 +1,23 @@
+#!/usr/local/bin/perl
+
+$ctg = $ARGV[0];
+$seq = $ARGV[1];
+
+open(CTG, $ctg) || die ("Cannot open \"$ctg\": $!\n");
+while (<CTG>){
+ if (/^\#([^\#\(\s]+)/){
+ $seen{$1} = 1;
+ }
+}
+close(CTG);
+
+print "00000\n";
+open(IN, $seq) || die ("Cannot open \"$seq\": $!\n");
+while (<IN>){
+ if (/^>(\S+)/){
+ if (! exists $seen{$1}){
+ print "\t$1\n";
+ }
+ }
+}
+close(IN);
diff --git a/src/CtgTrim/tab2ovls.pl b/src/CtgTrim/tab2ovls.pl
new file mode 100755
index 0000000..f051458
--- /dev/null
+++ b/src/CtgTrim/tab2ovls.pl
@@ -0,0 +1,113 @@
+#!/usr/local/bin/perl
+
+$MARGIN = 20;
+
+if (defined $ARGV[2] && $ARGV[2] eq "tab"){
+ $tab = 1;
+} else {
+ $tab = 0;
+}
+
+# load in map of IDs to contig lengths
+
+if ($ARGV[1] ne "nuc") {
+ open(LENS, $ARGV[1]) || die ("Cannot open $ARGV[1]: $!\n");
+
+ while (<LENS>){
+ chomp;
+
+ ($id, $len) = split(' ', $_);
+ $lens{$id} = $len;
+ }
+ close(LENS);
+}
+
+$inhead = 1;
+open(TAB, $ARGV[0]) || die ("Cannot open $ARGV[0]: $!\n");
+while (<TAB>){
+ @elements = split;
+
+# print join('|', @elements), "\n";
+# here we collect the data
+ if ($ARGV[1] ne "nuc"){
+ $contig1 = $elements[0];
+ $contig2 = $elements[1];
+ } else {
+ $contig1 = $elements[11];
+ $contig2 = $elements[12];
+ }
+ if ($contig1 eq $contig2){ next;}
+
+ if ($ARGV[1] ne "nuc"){
+ $reflen = $lens{$contig1};
+ $querylen = $lens{$contig2};
+ $refl = $elements[6];
+ $refr = $elements[7];
+ $queryl = $elements[8];
+ $queryr = $elements[9];
+ } else {
+ $reflen = $elements[7];
+ $lens{$contig1} = $elements[7];
+ $querylen = $elements[8];
+ $lens{$contig2} = $elements[8];
+ $refl = $elements[0];
+ $refr = $elements[1];
+ $queryl = $elements[2];
+ $queryr = $elements[3];
+ }
+
+# keep track of where each query contig hits
+
+ if ($refl > $refr){
+ print "Wierd\n";
+ }
+
+ $refbeg =
+ ($refl < $MARGIN) ? 1 : 0;
+ $refend =
+ ($reflen - $refr < $MARGIN) ? 1 : 0;
+ $queryforw =
+ ($queryl < $queryr) ? 1 : 0;
+ $querybeg =
+ ($queryl < $MARGIN || $queryr < $MARGIN) ? 1 : 0;
+ $queryend =
+ ($querylen - $queryl < $MARGIN || $querylen - $queryr < $MARGIN)
+ ? 1 : 0;
+
+ # find out if the alignment is "proper".
+ # only print matches that hit the end of the query
+ if ($querybeg && $queryend){
+ $matches{$contig1} .= "$contig2 $queryl $queryr 0 0 ";
+ } elsif (($refend && $querybeg && $queryforw) ||
+ ($refend && $queryend && ! $queryforw) |
+ ($refbeg && $queryend && $queryforw) ||
+ ($refbeg && $querybeg && ! $queryforw)) {
+ $matches{$contig1} .=
+ "$contig2 $queryl $queryr $refl $refr ";
+ }
+}
+close(NUCS);
+
+$n = 0;
+while (($ctg, $mtch) = each %matches){
+ @fields = split(' ', $mtch);
+ %match = ();
+
+ $n++;
+
+# pick the matches in groups of 5.
+ if ($tab == 1){
+ for ($j = 0; $j <= $#fields; $j += 5){
+ if (exists $seen{$ctg}) {next;}
+ print "$ctg($lens{$ctg})\t$fields[$j+3]\t$fields[$j+4]\t$fields[$j]($lens{$fields[$j]})\t$fields[$j+1]\t$fields[$j+2]\n";
+ $seen{$fields[$j]} = 1;
+ }
+ } else {
+ print "$n:$ctg($lens{$ctg})\n";
+ for ($j = 0; $j <= $#fields; $j += 5){
+ print "\t$fields[$j]($lens{$fields[$j]}) ", join(" ", @fields[($j + 1) .. ($j + 2)]), " - ", join(" ", @fields[($j + 3) .. ($j + 4)]), "\n";
+ }
+ }
+}
+
+exit(0);
diff --git a/src/CtgTrim/trimends.pl b/src/CtgTrim/trimends.pl
new file mode 100755
index 0000000..62ce4b7
--- /dev/null
+++ b/src/CtgTrim/trimends.pl
@@ -0,0 +1,232 @@
+#!/usr/local/bin/perl
+
+my $BASEDIR = "/local/asmg/work/mpop/WGA/";
+my $BINDIR = $BASEDIR . "bin/";
+
+$findends = $BINDIR . "find_ends";
+$exclude = $BINDIR . "excl_seqs";
+$fixfrg = $BINDIR . "fixfrg";
+$vecfix = $BINDIR . "vecfix";
+$ovlps = $BINDIR . "tab2ovls";
+$findsingles = $BINDIR . "singles";
+
+$tasm = "/usr/local/bin/run_TA";
+$casm = "/local/asmg/bin/run_CA";
+$lucy = "/usr/local/bin/lucy";
+$lucyparms = "-error 0.025 0.02 -window 50 0.03 5 0.01 -bracket 10 0.02";
+$nucmum = "/usr/local/bin/nucmer";
+$show = "/usr/local/bin/show-coords";
+$blast = "/usr/local/bin/blastall";
+$format = "/usr/local/bin/formatdb";
+$getlens = "/local/asmg/bin/getlengths";
+$qc = "/local/asmg/bin/caqc";
+$grep = "/bin/grep";
+$cat = "/bin/cat";
+
+select STDOUT;
+$| = 1;
+
+
+$infile = $ARGV[0];
+
+# run CA
+if (! -f "$infile.seq" ||
+ ! -f "$infile.qual" ||
+ ! -f "$infile.frg"){
+ die ("$infile.seq, $infile.qual, and $infile.frg must exist\n");
+}
+
+if (-f "$infile.contig"){
+ print "$infile.contig exists, skipping first run of CA\n";
+} else {
+ print "running CA for the first time...";
+ system("$casm $infile > ca.log 2>&1");
+ print "done\n";
+}
+
+
+# run nucmummer
+if (! -f "$infile.fasta"){
+ die ("looks like CA died before creating $infile.fasta\n");
+}
+
+if (-s "$infile.coords"){
+ print "$infile.delta exists, skipping nucmer\n";
+} else {
+ print "running nucmer db...";
+ system("$nucmum -a max-match -p $infile $infile.fasta $infile.fasta");
+ print "done\n";
+ print "Running show-coords...";
+ system("$show -HTcl $infile.delta > $infile.coords");
+ print "done\n";
+}
+
+#find "grasta" ends
+if (! -s "$infile.coords"){
+ die ("looks like blast died before creating $infile.coords\n");
+}
+
+if (-s "$infile.ovlps"){
+ print "$infile.ovlps exists, skipping overlap finding\n";
+} else {
+# print "getting seq lens...";
+# system("$getlens $infile.fasta > $infile.lens");
+# print "done\n";
+ print "finding overlaps...";
+ system("$ovlps $infile.coords nuc tab > $infile.ovlps");
+ print "done\n";
+}
+
+# find "end" sequences
+if (! -s "$infile.ovlps"){
+ die ("looks like $ovlps died before creating $infile.ovlps\n");
+}
+
+if (-s "$infile.excl"){
+ print "$infile.excl exists, skipping the finding of end sequences\n";
+} else {
+ print "finding ends...";
+ system("$findends $infile.contig $infile.ovlps> $infile.excl");
+ print "done\n";
+}
+
+# find singletons
+if (! -s "$infile.excl"){
+ die ("looks like ends were not found\n");
+}
+
+if (system ("$grep '^00000' $infile.excl") == 0){
+ print "singletons were already found\n";
+} else {
+ print "finding singletons...";
+ system("$findsingles $infile.contig $infile.seq >> $infile.excl");
+ print "done\n";
+}
+
+# creating trimmable files
+if (! -s "$infile.excl"){
+ die ("looks like $findends died before creating $infile.excl");
+}
+
+if (-s "$infile.iseq"){
+ print "$infile.iseq exists, skipping creation of trimmable files\n";
+} else {
+ print "excluding seq file...";
+ system("$exclude $infile.seq $infile.excl > $infile.iseq");
+ print "done\n";
+
+ print "excluding qual file...";
+ system("$exclude $infile.qual $infile.excl > $infile.iqual");
+ print "done\n";
+
+ print "creating trimmable seq file ...";
+ system("$exclude $infile.seq $infile.excl include > $infile.eseq");
+ print "done\n";
+
+ print "creating trimmable qual file ...";
+ system("$exclude $infile.qual $infile.excl include > $infile.equal");
+ print "done\n";
+}
+
+# trimming
+if (! -s "$infile.eseq"){
+ die ("looks like trimmable files were not created\n");
+}
+
+if (-s "$infile.lseq"){
+ print "$infile.lseq exists skipping trimming step\n";
+} else {
+ print "running lucy...";
+ system("$lucy $lucyparms -output $infile.lseq $infile.lqual $infile.eseq $infile.equal");
+ print "done\n";
+}
+
+# catting the files
+if (! -s "$infile.lseq"){
+ die ("looks like lucy died before creating $infile.lseq\n");
+}
+
+if (-s "${infile}_trimmed.seq"){
+ print "${infile}_trimmed.seq exists, skipping file concatenation\n";
+} else {
+ print "fixing vector...";
+ system("$vecfix $infile.lseq $infile.seq > $infile.vseq");
+ print "done\n";
+ print "cating files...";
+ system("$cat $infile.iseq $infile.vseq> ${infile}_trimmed.seq");
+ open(SEQS, "$grep \'>\' ${infile}_trimmed.seq |") ||
+ die ("Cannot read ${infile}_trimmed.seq: $!\n");
+ while (<SEQS>){
+ if (/^>(\S+)/){
+ $seqname{$1} = 1;
+ }
+ }
+ close(SEQS);
+
+ system("cp $infile.iqual ${infile}_trimmed.qual");
+ open(OUT, ">>${infile}_trimmed.qual") ||
+ die ("Cannot append to ${infile}_trimmed.qual: $!\n");
+
+ open(IN, "$infile.lqual") ||
+ die ("Cannot open $infile.lqual: $!\n");
+
+ $toout = 1;
+ while (<IN>){
+ if (/^>(\S+)/){
+ if (! exists $seqname{$1}){
+ $toout = 0;
+ } else {
+ $toout = 1;
+ }
+ }
+ if ($toout == 1){
+ print OUT;
+ }
+ }
+ close(IN);
+ close(OUT);
+ $seqname = ();
+
+ print "done\n";
+}
+
+# updating the .frg file
+if (! -s "${infile}_trimmed.seq"){
+ die ("looks like catting failed\n");
+}
+
+if (-s "${infile}_trimmed.frg"){
+ print "${infile}_trimmed.frg exists, skipping .frg file generation\n";
+} else {
+ print "fixing FRG file...";
+ system("$fixfrg ${infile}_trimmed.seq $infile.frg > ${infile}_trimmed.frg");
+ print "done\n";
+}
+
+# running the assembler again
+if (! -s "${infile}_trimmed.frg"){
+ die ("file ${infile}_trimmed does not exists\n");
+}
+
+if (-s "${infile}_trimmed.contig"){
+ print "${infile}_trimmed.contig exists, skipping second CA\n";
+} else {
+ print "running CA for the second time...";
+ system("$casm ${infile}_trimmed > ca.log 2>&1");
+ print "done\n";
+}
+
+if (! -s "${infile}_trimmed.contig"){
+ die ("Assembly failed\n");
+}
+
+# collecting stats
+if (-s "${infile}_trimmed.qc"){
+ print "${infile}_trimmed.qc exists, skipping QC step\n";
+} else {
+ print "Collecting statistics...";
+ system("$qc ${infile}_trimmed.asm >/dev/null");
+ print "done\n";
+}
+
+exit(0);
diff --git a/src/CtgTrim/trimfrg.pl b/src/CtgTrim/trimfrg.pl
new file mode 100755
index 0000000..e64bac5
--- /dev/null
+++ b/src/CtgTrim/trimfrg.pl
@@ -0,0 +1,70 @@
+#!/usr/local/bin/perl
+
+$MAXSEQ = 2048;
+$MINSEQ = 64;
+$MINVEC = 60;
+
+use AMOS::AmosLib;
+
+$frgfile = $ARGV[0];
+my $splicename = $ARGV[1];
+
+my @splice;
+open(SP, $splicename) || die ("Cannot open $splicename: $!\n");
+while (<SP>){
+ chomp;
+ push(@splice, $_);
+}
+close(SP);
+#my @splice = @ARGV[1..$#ARGV];
+#$splice = uc($splice);
+
+open(FRG, $frgfile) || die ("Cannot open $frgfile\n");
+while ($record = getRecord(\*FRG)){
+ my ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec eq "FRG"){
+ my $seq = $$fields{seq};
+ my @lines = split('\n', $seq);
+ $seq = join('', @lines);
+ $seq = uc($seq);
+
+ my ($l, $r) = split(',', $$fields{clr});
+
+ foreach $splice (@splice) {
+ $splice = uc($splice);
+ my $ind = index($seq, $splice);
+ my $lastind = -1;
+ while ($ind > 0 && $ind < $MINVEC){
+ $lastind = $ind;
+ $ind = index($seq, $splice, $ind + 1);
+ }
+
+ if ($lastind > 0){
+ if ($l < $lastind + length($splice)){
+ print STDERR "trimming sequence $$fields{acc} due to vector ", $lastind + length($splice) - $l + 1, "\n";
+ $l = $lastind + length($splice) + 1;
+ }
+ }
+ } # for each splice
+
+ if ($r - $l < $MINSEQ) {
+ print STDERR "skipping short sequence $$fields{acc}\n";
+ next;
+ }
+
+ #print "updating clear range of $nm to $clear{$nm}\n";
+ $record =~ s/clr:(\d+),(\d+)/clr:$l,$r/m;
+ $seen{$$fields{acc}} = 1;
+ print $record;
+
+ next;
+ } # if rec eq FRG
+ if ($rec eq "LKG"){
+ if (exists $seen{$$fields{fg1}} && exists $seen{$$fields{fg2}}){
+ print $record;
+ }
+ next;
+ }
+ print $record;
+}
+
diff --git a/src/CtgTrim/vecfix.pl b/src/CtgTrim/vecfix.pl
new file mode 100755
index 0000000..43a88a5
--- /dev/null
+++ b/src/CtgTrim/vecfix.pl
@@ -0,0 +1,46 @@
+#!/usr/local/bin/perl
+
+$seqfile = $ARGV[0];
+$initfile = $ARGV[1];
+
+open(INIT, $initfile) || die ("Cannot open $initfile\n");
+while (<INIT>){
+ if (/^>(\S+) (\d+ \d+ \d+) (\d+) (\d+)/){
+ $seq = $1;
+ $cll = $3;
+ $clr = $4;
+
+ $cll{$seq} = $cll;
+ $clr{$seq} = $clr;
+ $lib{$seq} = $2;
+ }
+}
+close(INIT);
+
+$toout = 1;
+open(SEQ, $seqfile) || die ("Cannot open $seqfile\n");
+while (<SEQ>){
+ if (/^>(\S+) \d+ \d+ \d+ (\d+) (\d+)/){
+ $seq = $1;
+ $cll = $2;
+ $clr = $3;
+
+ if ($cll < $cll{$seq}){
+ $cll = $cll{$seq};
+ }
+ if ($clr > $clr{$seq}){
+ $clr = $clr{$seq};
+ }
+ if ($clr - $cll < 64){
+ $toout = 0;
+ } else {
+ $toout = 1;
+ print ">$seq $lib{$seq} $cll $clr\n";
+ }
+ next;
+ }
+ if ($toout == 1){
+ print;
+ }
+}
+close(SEQ);
diff --git a/src/Experimental/ContigFattener.cc b/src/Experimental/ContigFattener.cc
new file mode 100644
index 0000000..39b1af5
--- /dev/null
+++ b/src/Experimental/ContigFattener.cc
@@ -0,0 +1,1373 @@
+#include "ContigFattener.hh"
+#include "ContigUtils.hh"
+#include "AMOS_Foundation.hh"
+
+using namespace std;
+using namespace AMOS;
+
+
+ContigFattener::ContigFattener(Contig_t & contig,
+ Bank_t & read_bank,
+ bool verbose)
+ : m_contig(contig),
+ m_read_bank(read_bank),
+ m_verbose(verbose)
+{
+ // recall to be non-ambiguous consensus for fattening
+ recallCons();
+}
+
+ContigFattener::~ContigFattener()
+{
+
+}
+
+ContigSequence * ContigFattener::getContigSequence(const string & eid)
+{
+ vector<Tile_t> & tiling = m_contig.getReadTiling();
+ vector<Tile_t>::iterator ti;
+ for (ti = tiling.begin();
+ ti != tiling.end();
+ ti++)
+ {
+ if (m_read_bank.lookupEID(ti->source) == eid)
+ {
+ Read_t read;
+ m_read_bank.fetch(ti->source, read);
+ return new ContigSequence(ti, read);
+ }
+ }
+
+ return NULL;
+}
+
+void ContigFattener::extend3Read(ContigSequence * read, int distance)
+{
+ int distanceExtended = 0;
+ int trimLength = read->get3TrimLength();
+ int origUContigWidth = m_contig.getUngappedLength();
+
+ int i = read->getReadID();
+
+ if (m_verbose)
+ {
+ cerr << "Extending r" << read->getReadID()
+ << " by " << distance
+ << " of " << trimLength << endl;
+ }
+
+ if (trimLength)
+ {
+ if (read->isReverseCompliment())
+ {
+ distanceExtended = extend3Left(read, distance);
+ }
+ else
+ {
+ distanceExtended = extend3Right(read, distance);
+ }
+ }
+
+ recallCons();
+
+ recordExtension(read, distanceExtended, trimLength,
+ 0.0, 0.0, origUContigWidth);
+}
+
+// Public API
+void ContigFattener::extend3Read(const string & seqname, int distance)
+{
+ ContigSequence * read = getContigSequence(seqname);
+ if (read)
+ {
+ extend3Read(read, distance);
+ }
+ else
+ {
+ throw amosException("Specified read (" + seqname + ") not found",
+ "ContigFattener::extend3Read");
+ }
+}
+
+ContigSequenceSlice ContigFattener::getTilingSlice(int gindex)
+{
+ ContigSequenceSlice retval;
+
+ vector<Tile_t> & tiling = m_contig.getReadTiling();
+ sort(tiling.begin(), tiling.end(), TileOrderCmp());
+
+ int count;
+ vector<Tile_t>::iterator ti;
+ for (count = 0, ti = tiling.begin(); ti != tiling.end(); ti++, count++)
+ {
+ if (!(ti->offset > gindex || ti->getRightOffset() < gindex))
+ {
+ Read_t rr;
+ m_read_bank.fetch(ti->source, rr);
+
+ ContigSequence cs(ti, rr, count);
+ retval.push_back(cs);
+ }
+ }
+
+ return retval;
+}
+
+// Public API
+void ContigFattener::growContigLeft(bool requireConfirmation)
+{
+ // First try to fatten the left side
+ fattenContig(0, 500, 1, 0);
+ int confirmedDistance = 0;
+
+ // Find the read that now extends the furthest
+ int bestExtension = 0;
+ ContigSequence * best = NULL;
+ ContigSequenceSlice::iterator t;
+ ContigSequenceSlice tilingSlice = getTilingSlice(0);
+
+ for (t = tilingSlice.begin();
+ t != tilingSlice.end();
+ t++)
+ {
+ if (t->isReverseCompliment())
+ {
+ int currentExtension = t->get3TrimLength();
+ if (currentExtension > bestExtension)
+ {
+ bestExtension = currentExtension;
+ best = &(*t);
+ }
+ }
+ }
+
+ // Stretch the contig with the best candidate
+ if (best)
+ {
+ ID_t bestiid = best->getIID();
+
+ if (m_verbose)
+ {
+ cerr << "best read to left extend is r" << best->getReadID()
+ << " by " << bestExtension << "bp" << endl;
+ }
+
+ // best->offset == 0, so this extended by exactly bestExtension bp
+ extend3Read(best, -1);
+
+ // Now fatten the contig to the new beginning
+ int origSize = m_contig.getLength();
+ fattenContig(0, bestExtension+500, 1, 0);
+ bestExtension += (m_contig.getLength() - origSize); // add extra gaps
+
+
+ int confirmedOffset = m_contig.getLength();
+ int confirmedRead = -1;
+
+ vector<Tile_t> & tiling = m_contig.getReadTiling();
+ vector<Tile_t>::iterator ti;
+
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ if (ti->source != bestiid &&
+ ti->offset < confirmedOffset)
+ {
+ confirmedOffset = ti->offset;
+ confirmedRead = ti->source;
+ }
+ }
+
+ confirmedDistance = (bestExtension - confirmedOffset);
+
+ if (requireConfirmation)
+ {
+ cerr << "@TrimContigLeft=" << confirmedOffset << endl;
+ leftTrimContig(m_contig, confirmedOffset);
+
+ int count;
+ tiling = m_contig.getReadTiling();
+
+ for (count=0, ti = tiling.begin(); ti != tiling.end(); ti++, count++)
+ {
+ if (ti->source == bestiid)
+ {
+ Read_t read;
+ m_read_bank.fetch(ti->source, read);
+ best = new ContigSequence(ti, read, count);
+ dumpRange(0, bestExtension+10, best);
+ delete best;
+ break;
+ }
+ }
+ }
+ }
+
+ cerr << "@ConfirmLeftContigGrowDistance=" << confirmedDistance << endl;
+}
+
+// Public API
+void ContigFattener::growContigRight(bool requireConfirmation)
+{
+ int confirmedDistance = 0;
+
+ // First try to grow the right side
+ fattenContig(m_contig.getLength()-500, m_contig.getLength(), 0, 1);
+
+ // Find the read that now extends the furthest
+ int bestExtension = 0;
+ ContigSequence * best = NULL;
+ ContigSequenceSlice::iterator t;
+ ContigSequenceSlice tilingSlice = getTilingSlice(m_contig.getLength()-1);
+
+ for (t = tilingSlice.begin();
+ t != tilingSlice.end();
+ t++)
+ {
+ if (!t->isReverseCompliment())
+ {
+ int currentExtension = t->get3TrimLength();
+ if (currentExtension > bestExtension)
+ {
+ bestExtension = currentExtension;
+ best = &(*t);
+ }
+ }
+ }
+
+ // Stretch the contig with the best candidate
+ if (best)
+ {
+ int bestiid = best->getIID();
+ int oldSize = m_contig.getLength();
+ if (m_verbose)
+ {
+ cerr << "best read to right extend is r" << best->getReadID()
+ << " by " << bestExtension << "bp" << endl;
+ }
+
+
+ extend3Read(best, -1);
+
+ // Now fatten the contig to match out to the new end
+ fattenContig(oldSize-1, m_contig.getLength(), 0, 1);
+
+ int confirmedOffset = oldSize;
+ int confirmedRead = -1;
+
+ vector<Tile_t> & tiling = m_contig.getReadTiling();
+ vector<Tile_t>::iterator ti;
+
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ if (ti->source != bestiid &&
+ ti->getRightOffset() > confirmedOffset)
+ {
+ confirmedOffset = ti->getRightOffset();
+ confirmedRead = ti->source;
+ }
+ }
+
+ confirmedDistance = confirmedOffset - oldSize;
+
+ if (requireConfirmation)
+ {
+ int trimdistance = m_contig.getLength() - confirmedOffset;
+ cerr << "@TrimContigRight=" << trimdistance << endl;
+ rightTrimContig(m_contig, trimdistance);
+
+ int count;
+ tiling = m_contig.getReadTiling();
+
+ for (count = 0, ti = tiling.begin(); ti != tiling.end(); ti++, count++)
+ {
+ if (ti->source == bestiid)
+ {
+ Read_t read;
+ m_read_bank.fetch(ti->source, read);
+ best = new ContigSequence(ti, read, count);
+
+ dumpRange(ti->offset-10, m_contig.getLength(), best);
+
+ delete best;
+ break;
+ }
+ }
+ }
+ }
+
+ cerr << "@ConfirmRightContigGrowDistance=" << confirmedDistance << endl;
+}
+
+#include <algorithm>
+
+// Public API
+void ContigFattener::fattenContig(int fattenRangeStart, int fattenRangeEnd,
+ int doLeftExtension, int doRightExtension)
+{
+ int contigSize = m_contig.getLength() - 1;
+ int origUContigWidth = m_contig.getUngappedLength();
+
+ if (fattenRangeEnd > contigSize)
+ {
+ fattenRangeEnd = contigSize;
+ }
+
+ if (m_verbose)
+ {
+ if (doLeftExtension)
+ {
+ cerr << "Left ";
+ if (doRightExtension) { cerr << "and "; }
+ }
+
+ if (doRightExtension) { cerr << "Right "; }
+
+ cerr << "Fattening in [" << fattenRangeStart
+ << "," << fattenRangeEnd
+ << "]" << endl;
+ }
+
+ vector<Tile_t> & tiling = m_contig.getReadTiling();
+
+ sort(tiling.begin(), tiling.end(), TileOrderCmp());
+
+ int count;
+ vector<Tile_t>::iterator i;
+ for (i = tiling.begin(), count=0;
+ i != tiling.end();
+ i++, count++)
+ {
+ Read_t rr;
+ m_read_bank.fetch(i->source, rr);
+ ContigSequence * read = new ContigSequence(i, rr, count);
+
+ int fattenRead = 0;
+ int distanceExtended = 0;
+ int trimLength = read->get3TrimLength();
+
+ int count = 10;
+ float origAvg = 0.0;
+ float origTrimAvg = read->getAvgQV3Trim(count);
+
+ if (read->isReverseCompliment())
+ {
+ origAvg = read->getAvgQV(read->getOffset(), count);
+
+ fattenRead = doLeftExtension;
+ if (fattenRead && fattenRangeStart != -1)
+ {
+ int offset = read->getOffset();
+ fattenRead = fattenRangeStart <= offset && offset <= fattenRangeEnd;
+ }
+
+ if (fattenRead && trimLength)
+ {
+ distanceExtended = fatten3Left(read, -1);
+ }
+ }
+ else
+ {
+ origAvg = read->getAvgQV(read->getRightEnd(), count);
+
+ fattenRead = doRightExtension;
+ if (fattenRead && fattenRangeStart != -1)
+ {
+ int right = read->getRightEnd();
+ fattenRead = fattenRangeStart <= right && right <= fattenRangeEnd;
+ }
+
+ if (fattenRead && trimLength)
+ {
+ distanceExtended = fatten3Right(read, -1);
+ }
+ }
+
+ if (fattenRead)
+ {
+ // TODO: Fix the range when gaps are inserted outside of the fatten range.
+ // Fortunately this will only falsely increase the range to fatten
+
+ // Shift the end of the range to reflect the gaps inserted in the fatten
+ // range
+ if (fattenRangeEnd != -1)
+ {
+ int distanceToEnd = contigSize - fattenRangeEnd;
+ contigSize = m_contig.getLength()-1;
+ fattenRangeEnd = contigSize - distanceToEnd;
+ }
+
+ recordExtension(read, distanceExtended, trimLength,
+ origAvg, origTrimAvg, origUContigWidth);
+ origUContigWidth = m_contig.getUngappedLength();
+ }
+
+ delete read;
+ }
+}
+
+
+
+
+
+int ContigFattener::extend3Left(ContigSequence * read, int distance)
+{
+ int retval = 0;
+ string leftTrim = read->get3Trim();
+ if (distance == -1) { distance = leftTrim.size(); }
+
+ if (distance > (int)leftTrim.size())
+ {
+ cerr << "distance(" << distance
+ << ") > leftTrim(" << leftTrim.size() << endl;
+
+ throw amosException("distance > leftTrim.size()", "extend3Left");
+ }
+
+ int origoffset = read->getOffset();
+ if (origoffset != 0)
+ {
+ // We need to fatten this read to the left end of the contig
+ int distanceAligned = fatten3Left(read, distance);
+
+ retval += distanceAligned;
+
+ distance -= distanceAligned;
+ leftTrim.resize(leftTrim.size()-distanceAligned);
+
+ stripSequenceEdgeGaps();
+ }
+
+ if (distance)
+ {
+ int newoffset = read->getOffset();
+
+ if (newoffset != 0)
+ {
+ if (m_verbose)
+ {
+ cerr << "fattening failed to reach the end of the consensus" << endl;
+ }
+ }
+
+ if (newoffset - distance < 0)
+ {
+ // need to shift the entire contig right
+ int contigShiftDistance = distance - newoffset;
+
+ cerr << "@ContigShiftDistance=" << contigShiftDistance << endl;
+ shiftContigRight(m_contig, contigShiftDistance);
+ }
+
+ newoffset = read->getOffset(); // shifted as necessary
+
+ // Trim off the left side (3' side) that isn't wanted
+ long int eraseDistance = leftTrim.size() - distance;
+ if (eraseDistance)
+ {
+ leftTrim.erase(0, eraseDistance);
+ }
+
+ // Finally, extend the read
+ retval += read->extend3Left(leftTrim);
+
+ dumpRange(read->getOffset()-10, newoffset+10, read);
+ }
+
+ return retval;
+}
+
+int ContigFattener::extend3Right(ContigSequence * read, int distance)
+{
+ int retval = 0;
+ string rightTrim = read->get3Trim();
+ if (distance == -1) { distance = rightTrim.size(); }
+
+ if (distance > (int)rightTrim.size())
+ {
+ cerr << "distance(" << distance
+ << ") > rightTrim(" << rightTrim.size() << endl;
+
+ throw amosException("distance > rightTrim.size()", "extend3Right");
+ }
+
+
+ int origend = read->getRightEnd();
+ if (origend != m_contig.getLength()-1)
+ {
+ // We need to fatten this read to the right end of the contig
+ int distanceAligned = fatten3Right(read, distance);
+ retval += distanceAligned;
+
+ distance -= distanceAligned;
+ rightTrim.erase(0, distanceAligned);
+
+ stripSequenceEdgeGaps();
+ }
+
+ if (distance)
+ {
+ int newend = read->getRightEnd();
+
+ if (newend != m_contig.getLength()-1)
+ {
+ cerr << "fattening failed to reach the end of the consensus" << endl;
+ }
+
+ if (newend + distance >= m_contig.getLength())
+ {
+ // open space in the consensus and tiling
+ // need to grow contig
+ int contigGrowDistance = newend + distance + 1 - m_contig.getLength();
+
+ cerr << "@ContigGrowDistance=" << contigGrowDistance << endl;
+ widenContig(m_contig, contigGrowDistance);
+ }
+
+ // Finally, extend the read
+ rightTrim.resize(distance);
+ retval += read->extend3Right(rightTrim);
+
+ dumpRange(origend-10, read->getRightEnd()+10, read);
+ }
+
+ return retval;
+}
+
+void ContigFattener::recordExtension(const ContigSequence * read,
+ int distanceExtended,
+ int totalTrim,
+ float origAvg,
+ float origTrimAvg,
+ int origUContigWidth)
+{
+ bool rc = read->isReverseCompliment();
+ int offset = read->getOffset();
+ int rightEnd = read->getRightEnd();
+ int count = 10;
+
+ float avg = read->getAvgQV((rc) ? offset : rightEnd, count);
+ float trimavg = read->getAvgQV3Trim(count);
+
+ int distanceToEnd = (rc) ? offset : m_contig.getLength() - rightEnd-1;
+ int deltaUContig = m_contig.getUngappedLength() - origUContigWidth;
+
+ fprintf(stderr, "%s=%d %d %d %d %0.1f %0.1f %0.1f %0.1f\n",
+ read->getSeqname().c_str(),
+ totalTrim,
+ distanceExtended,
+ deltaUContig,
+ distanceToEnd,
+ origAvg,
+ origTrimAvg,
+ avg,
+ trimavg);
+}
+
+
+
+
+long int ContigFattener::getBasesToSkip(DeltaVector & delta,
+ DeltaVector::const_iterator & deltaiter,
+ bool & consGap,
+ unsigned int cpos,
+ unsigned int rpos,
+ const string & trimmed,
+ const string & consensus,
+ bool autoPromoteConsGaps)
+{
+ long int basesToSkip = 0;
+
+ if (deltaiter != delta.end())
+ {
+ basesToSkip = *deltaiter;
+ consGap = true;
+
+ if (basesToSkip < 0)
+ {
+ basesToSkip = -basesToSkip;
+ consGap = false;
+ }
+
+ if (!autoPromoteConsGaps) { consGap = !consGap; }
+
+ if (m_verbose)
+ {
+ if (cpos < (unsigned int) m_contig.getLength() &&
+ rpos < trimmed.size())
+ {
+ cerr << "basesToSkip: " << basesToSkip
+ << " cpos: " << cpos << " [" << consensus[cpos] << "]"
+ << " rpos: " << rpos << " [" << trimmed[rpos] << "]"
+ << " consGap: " << consGap
+ << endl;
+ }
+ }
+ }
+
+ return basesToSkip;
+}
+
+
+
+// Merge the bases in trimmedSeq with the consensus beteen cpos and lastConsPos
+// (inclusively) inserting gaps as necessary. Throw an error if the alignment
+// does go as expected. Optionally autoPromote gaps from the consensus as
+// necessary. lastConsPos must point at an actual base (not gap).
+
+void ContigFattener::mergeExtension(unsigned int & cpos,
+ unsigned int & lastConsPos,
+ unsigned int & rpos,
+ string & trimmedSeq,
+ string & consensus,
+ ContigSequence * read,
+ DeltaVector & delta,
+ bool autoPromoteConsGaps,
+ int consMovementDelta)
+{
+ int startcpos = cpos;
+
+ if (m_verbose)
+ {
+ cerr << "Delta:";
+ for (unsigned int j = 0; j < delta.size(); j++) { cerr << " " << delta[j]; }
+ cerr << endl;
+ }
+
+ bool consGap = true;
+ DeltaVector::const_iterator deltaiter = delta.begin();
+ long int basesToSkip = getBasesToSkip(delta, deltaiter, consGap,
+ cpos, rpos, trimmedSeq, consensus,
+ autoPromoteConsGaps);
+
+ // AutoPromote Consensus Gaps into the trimmedSeq, and
+ // merge the delta values from the alignment
+ while(cpos >= 0 && cpos < (unsigned int) m_contig.getLength() &&
+ cpos <= lastConsPos && rpos < trimmedSeq.size())
+ {
+
+ // cerr << "cons[" << cpos << "]=" << consensus[cpos]
+ // << " read[" << rpos << "]=" << trimmedSeq[rpos] << endl;
+
+ if (basesToSkip == 1)
+ {
+ if (consGap)
+ {
+ if (autoPromoteConsGaps && consensus[cpos] == '-')
+ {
+ // next position is a gap anyways
+ if (m_verbose) { cerr << "Gap already present at " << cpos << endl; }
+ }
+ else
+ {
+ // insert a gap
+ insertGapSlice(cpos, read);
+ consensus = m_contig.getSeqString();
+ lastConsPos++;
+ }
+ }
+ else
+ {
+ if (m_verbose) { cerr << "inserting gap into r at " << cpos << endl; }
+ trimmedSeq.insert(rpos, "-");
+
+ while (autoPromoteConsGaps && consensus[cpos] == '-')
+ {
+ if (m_verbose) { cerr << "promoting adjacent consensus gap at " << cpos << endl; }
+ trimmedSeq.insert(rpos, "-");
+ rpos++; cpos += consMovementDelta;
+ }
+ }
+
+ deltaiter++;
+ basesToSkip = getBasesToSkip(delta, deltaiter, consGap,
+ cpos+consMovementDelta,
+ rpos+1, trimmedSeq, consensus,
+ autoPromoteConsGaps);
+ }
+ else
+ {
+ if (autoPromoteConsGaps && consensus[cpos] == '-')
+ {
+ if (m_verbose) { cerr << "promoting consensus gap at " << cpos << endl; }
+ trimmedSeq.insert(rpos, "-");
+ }
+ else if (basesToSkip)
+ {
+ // Don't count gaps
+ basesToSkip--;
+ }
+ }
+
+ // Step to next position
+ cpos += consMovementDelta;
+ rpos++;
+ }
+
+ // handle special case where gaps need to be inserted at end of alignment,
+ // after the read or consensus has "ended".
+ if (basesToSkip)
+ {
+ if (m_verbose) { cerr << "Extra Bases to skip: " << basesToSkip << endl; }
+
+ while (basesToSkip == 1)
+ {
+ if (consGap)
+ {
+ // Don't use gaps that are already present since we hit the end of allow range
+ insertGapSlice(cpos, read);
+ consensus = m_contig.getSeqString();
+ lastConsPos++;
+ }
+ else
+ {
+ while (autoPromoteConsGaps && consensus[cpos] == '-')
+ {
+ if (m_verbose) { cerr << "promoting consensus gap at " << cpos << endl; }
+ trimmedSeq.insert(rpos, "-");
+
+ rpos++;
+ cpos += consMovementDelta;
+ }
+
+ if (m_verbose) { cerr << "Appending extra gap to fix alignment!" << endl; }
+ trimmedSeq.insert(rpos, "-");
+ }
+
+ deltaiter++;
+ basesToSkip = getBasesToSkip(delta, deltaiter, consGap,
+ cpos+consMovementDelta,
+ rpos+1, trimmedSeq, consensus,
+ autoPromoteConsGaps);
+ rpos++;
+ cpos += consMovementDelta;
+ }
+ }
+
+ if (m_verbose)
+ {
+ cerr << "final:"
+ << " cons[" << cpos-1 << "]=" << consensus[cpos-1]
+ << " read[" << rpos-1 << "]=" << trimmedSeq[rpos-1]
+ << " read[" << trimmedSeq.length()-1 << "]=" << trimmedSeq[trimmedSeq.length()-1]
+ << endl;
+ }
+
+ if (basesToSkip)
+ {
+ cerr << "Internal Error!!! More delta values that sequence to align!" << endl;
+ throw amosException("More delta values than sequence to align!",
+ "Contig::mergeExtension");
+ }
+
+ if (rpos != trimmedSeq.length() || cpos != lastConsPos+1)
+ {
+ char buffer[1024];
+ sprintf(buffer, "Attempt to merge alignment failed: rpos=%d rlen=%d cpos=%d lastcpos=%d",
+ rpos, trimmedSeq.length(), cpos, lastConsPos);
+ throw amosException(buffer, "Contig::mergeExtension");
+ }
+}
+
+//#define _DEBUG_VERBOSE 1
+//#define _DEBUG_ASSERT 1
+
+#include "sw_align.hh"
+
+int ContigFattener::fatten3Left(ContigSequence * read, int distance)
+{
+ DeltaVector delta;
+ long int gindex = read->getOffset()-1;
+ int i;
+ unsigned int alignmentType = OPTIMAL_BACKWARD_SEARCH;
+ int retval = 0;
+
+ if (gindex < 0)
+ {
+ // No consensus to match
+ if (m_verbose) { cerr << "No consensus to match for r" << read->getReadID() << endl; }
+ return 0;
+ }
+
+ string leftTrim = "r" + read->get3Trim();
+
+ if (distance != -1)
+ {
+ if (m_verbose) { cerr << "Trimming Left Trim to " << distance+1 << endl; }
+ reverse(leftTrim.begin(), leftTrim.end());
+ leftTrim.resize(distance+1);
+ reverse(leftTrim.begin(), leftTrim.end());
+ alignmentType = OPTIMAL_BACKWARD_SEARCH;
+ }
+
+ long int leftend = leftTrim.size()-1;
+
+ if (leftend == 0)
+ {
+ // No data to extend with
+ if (m_verbose) { cerr << "No left trim for r" << read->getReadID() << endl; }
+ return 0;
+ }
+
+ if (m_verbose)
+ {
+ cerr << "attempting left extension of r" << read->getReadID()
+ << " at " << gindex << " with " << leftend << "bp" << endl;
+
+ long int leftpos = gindex-leftend;
+ int shift = (leftpos > 10) ? 10 : leftpos;
+ dumpRange(leftpos-shift, gindex+10, read);
+
+ cerr << "trim:\t";
+ if (leftpos > 0)
+ {
+ for (i = 0; i < shift; i++) cerr << "*";
+ cerr << leftTrim << endl;;
+ }
+ else
+ {
+ cerr << leftTrim.substr(-leftpos, leftTrim.length()+leftpos) << endl;
+ }
+ }
+
+ string cons = "c" + m_contig.getUngappedSeqString(Range_t(0, gindex+1));
+ long int consend = cons.size()-1;
+ if (consend == 0)
+ {
+ // No consensus to match
+ if (m_verbose) { cerr << "No consensus to match for r" << read->getReadID() << endl; }
+ return 0;
+ }
+
+ long int leftstart = 1;
+ long int consstart = consend - leftend - 150; // allow for 150 gaps max
+ if (consstart < 1) consstart = 1;
+
+ // Compute leftend, consend
+ alignSearch(leftTrim.c_str(), leftend, leftstart,
+ cons.c_str(), consend, consstart,
+ alignmentType);
+
+ if ((leftend > 0 && consend > 0) &&
+ (alignTarget(leftTrim.c_str(), leftstart, leftend,
+ cons.c_str(), consstart, consend,
+ delta, FORCED_FORWARD_ALIGN)))
+
+ {
+ // alignment was sucessful!
+ if (m_verbose) { cerr << "leftend=" << leftend << " consend=" << consend << endl; }
+
+ // Trim the part that did not align (and leftTrim[0])
+ leftTrim.erase(0, leftstart);
+
+ string consensus = m_contig.getSeqString();
+
+ unsigned int rpos = 0;
+ unsigned int cpos = m_contig.ungap2gap(consstart-1);
+ while (consensus[gindex+1] == '-')
+ {
+ gindex++;
+ }
+
+
+ string rightEdgeGaps;
+
+ // Starting at an gapped position is trouble
+ // Promote the edge gaps before attempting to merge the extension
+ while (gindex >= 0 && consensus[gindex] == '-')
+ {
+ if (m_verbose) { cerr << "Promoting right edge consensus gap at " << cpos << endl; }
+ rightEdgeGaps += '-';
+ gindex--;
+ }
+
+ // switch to unsigned after subtracting!
+ unsigned int lastConsPos = gindex;
+
+ mergeExtension(cpos, lastConsPos, rpos, leftTrim, consensus,
+ read, delta, true, +1);
+
+ cpos--; // Return to original gindex position
+ retval = read->extend3Left(leftTrim+rightEdgeGaps);
+ dumpRange(read->getOffset()-10, cpos+10, read);
+ }
+ else
+ {
+ if (m_verbose) { cerr << "no alignment consend: " << consend << " leftend: " << leftend << endl; }
+ }
+
+ return retval;
+}
+
+int ContigFattener::fatten3Right(ContigSequence * read, int distance)
+{
+ DeltaVector delta;
+
+ long int gindex = read->getRightEnd()+1;
+ unsigned int alignmentType = OPTIMAL_FORWARD_SEARCH;
+ int retval = 0;
+
+ if (gindex >= m_contig.getLength())
+ {
+ // No consensus to match
+ if (m_verbose) { cerr << "No consensus to match for r" << read->getReadID() << endl; }
+ return 0;
+ }
+
+ string rightTrim = "r" + read->get3Trim();
+ if (distance != -1)
+ {
+ if (m_verbose) { cerr << "Trimming Right Trim to " << distance+1 << endl; }
+ rightTrim.resize(distance+1);
+ alignmentType = OPTIMAL_FORWARD_SEARCH;
+ }
+ long int rightend = rightTrim.size()-1;
+
+ if (rightend == 0 || gindex >= m_contig.getLength())
+ {
+ // No data to extend with
+ if (m_verbose) { cerr << "No right trim for r" << read->getReadID() << endl; }
+ return 0;
+ }
+
+ if (m_verbose)
+ {
+ cerr << "attempting right extension of r" << read->getReadID()
+ << " at " << gindex << " with " << rightend << "bp" << endl;
+
+ long int leftpos = gindex-10;
+ if (leftpos < 0) {leftpos = 0;}
+ dumpRange(leftpos, gindex+rightend+50, read);
+
+ cerr << "trim:\t";
+ for (int i = leftpos; i < gindex-1; i++) { cerr << "?"; }
+ cerr << rightTrim << endl;
+ }
+
+ // Strip the gaps from the consensus
+ string cons = "c" + m_contig.getUngappedSeqString(Range_t(gindex, m_contig.getLength()));
+ long int consend = cons.size()-1;
+ if (consend > rightend + 150) { consend = rightend + 150; }
+
+ if (consend == 0)
+ {
+ // No consensus to match
+ if (m_verbose) { cerr << "No consensus to match for r" << read->getReadID() << endl; }
+ return 0;
+ }
+
+ if (read->getReadID() == 357)
+ {
+ cerr << "gindex: " << gindex;
+ cerr << " contiglen: " << m_contig.getLength() << endl;
+ cerr << "cons: " << cons << endl;
+ }
+
+ // Compute rightend, consend
+ alignSearch(rightTrim.c_str(), 1, rightend,
+ cons.c_str(), 1, consend,
+ alignmentType);
+
+ if ((rightend > 0 && consend > 0) &&
+ (alignTarget(rightTrim.c_str(), 1, rightend,
+ cons.c_str(), 1, consend,
+ delta, FORCED_FORWARD_ALIGN)))
+ {
+ // alignment was sucessful!
+ if (m_verbose) { cerr << "rightend=" << rightend << " consend=" << consend << endl; }
+
+ // Erase the kludge from rightTrim[0] ('r')
+ rightTrim.erase(rightTrim.begin());
+
+ // Trim the part that did not align
+ rightTrim.resize(rightend);
+
+ unsigned int cpos = gindex;
+ unsigned int rpos = 0;
+
+ string consensus = m_contig.getSeqString();
+
+ // compute gapped position of last consensus base which aligns
+ unsigned int lastConsPos = gindex;
+ int count = 0;
+
+ // shift to first non-gap base (probably just gindex)
+ while (consensus[lastConsPos] == '-') { lastConsPos++; }
+
+ // Now find the exact coordinate of the last *base* which aligns
+ while (count < consend)
+ {
+ if (consensus[lastConsPos] != '-') { count++; }
+ lastConsPos++;
+ }
+
+ lastConsPos--; // Step back to exact coordinate of lastAlignedBase
+
+ mergeExtension(cpos, lastConsPos, rpos, rightTrim, consensus, read, delta, true, +1);
+
+ retval = read->extend3Right(rightTrim);
+ dumpRange(gindex-10, read->getRightEnd()+10, read);
+ }
+ else
+ {
+ if (m_verbose) { cerr << "no alignment consend: " << consend << " rightend: " << rightend << endl; }
+ }
+
+ return retval;
+}
+
+
+
+void ContigFattener::stripSequenceEdgeGaps()
+{
+ vector<Tile_t> & tiling = m_contig.getReadTiling();
+ vector<Tile_t>::iterator ti;
+
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ int gapcount;
+ gapcount = stripLeftGaps(ti);
+ gapcount = stripRightGaps(ti);
+ }
+}
+
+int ContigFattener::stripLeftGaps(vector<Tile_t>::iterator ti)
+{
+ int leftGaps = 0;
+ vector<Pos_t> newgaps;
+ vector<Pos_t>::iterator gi;
+
+ for (gi = ti->gaps.begin(); gi != ti->gaps.end(); gi++)
+ {
+ if (*gi == 0)
+ {
+ leftGaps++;
+ }
+ else
+ {
+ newgaps.push_back(*gi);
+ }
+ }
+
+ if (leftGaps)
+ {
+ cerr << "Stripping " << leftGaps <<
+ " leftGaps from r" << ti->source << endl;
+
+ ti->gaps = newgaps;
+ ti->offset += leftGaps;
+ }
+
+ return leftGaps;
+}
+
+int ContigFattener::stripRightGaps(vector<Tile_t>::iterator ti)
+{
+ int rightGaps = 0;
+ vector<Pos_t> newgaps;
+ vector<Pos_t>::iterator gi;
+
+ for (gi = ti->gaps.begin(); gi != ti->gaps.end(); gi++)
+ {
+ if (*gi == ti->range.getHi())
+ {
+ rightGaps++;
+ }
+ else
+ {
+ newgaps.push_back(*gi);
+ }
+ }
+
+ if (rightGaps)
+ {
+ cerr << "Stripping " << rightGaps <<
+ " rightGaps from r" << ti->source << endl;
+
+ ti->gaps = newgaps;
+ }
+
+ return rightGaps;
+}
+
+
+
+void ContigFattener::stripGapSlices()
+{
+ vector<Pos_t> allGapPositions;
+ ContigIterator_t ci(m_contig, &m_read_bank);
+
+ while (ci.advanceNext())
+ {
+ const TiledReadList_t & tiling = ci.getTilingReads();
+
+ if (!tiling.empty())
+ {
+ Pos_t gindex = ci.gindex();
+ bool allGaps = true;
+ TiledReadList_t::const_iterator ri;
+ for (ri = tiling.begin(); ri != tiling.end(); ri++)
+ {
+ char b = ri->base(gindex);
+
+ if (b != '-')
+ {
+ allGaps = false;
+ break;
+ }
+ }
+
+ if (allGaps)
+ {
+ allGapPositions.push_back(gindex);
+ }
+ }
+ }
+
+ // Remove from right to left, so coordinates will remain accurate
+ for (int i = allGapPositions.size()-1; i >= 0; i--)
+ {
+ removeGapColumn(allGapPositions[i]);
+ }
+}
+
+void ContigFattener::removeGapColumn(Pos_t gindex)
+{
+ string qual(m_contig.getQualString());
+ string seq(m_contig.getSeqString());
+
+ if (seq[gindex] != '-')
+ {
+ AMOS_THROW_ARGUMENT("Specified position is not a gap column");
+ }
+
+ seq.erase(gindex, 1);
+ qual.erase(gindex, 1);
+
+ m_contig.setSequence(seq,qual);
+
+ vector<Tile_t> & tiling = m_contig.getReadTiling();
+ vector<Tile_t>::iterator ti;
+ for (ti = tiling.begin();
+ ti != tiling.end();
+ ti++)
+ {
+ if (gindex < ti->offset)
+ {
+ // just shift the read down
+ ti->offset--;
+ }
+ else if (gindex <= ti->getRightOffset())
+ {
+ // offset <= gindex <= roffset
+ // shift the read down, erase gap
+
+ int gseqpos = gindex - ti->offset;
+
+ vector<Pos_t> newgaps;
+ vector<Pos_t>::iterator gi;
+ bool foundGap = false;
+ int gapcount = 0;
+
+ for (gi = ti->gaps.begin(); gi != ti->gaps.end(); gi++, gapcount++)
+ {
+ if (*gi + gapcount == gseqpos)
+ {
+ foundGap = true;
+ }
+ else
+ {
+ // sequence position remains the same for all gaps
+ newgaps.push_back(*gi);
+ }
+ }
+
+ if (!foundGap)
+ {
+ AMOS_THROW_ARGUMENT("Specified position is not a gap in read");
+ }
+
+ ti->gaps = newgaps;
+
+ // if gindex==offset, remove gap, but don't shift offset
+ }
+ }
+}
+
+
+void ContigFattener::printPos(long gindexstart, long gindexend)
+{
+ long maxvalue = gindexend;
+ long divide = 1;
+ int numDigits = 1;
+
+ while (maxvalue > 9)
+ {
+ divide *= 10;
+ maxvalue /= 10;
+ numDigits++;
+ }
+
+ for (; numDigits > 0; numDigits--)
+ {
+ cerr << "pos:\t";
+ for (long j = gindexstart; j <= gindexend; j++)
+ {
+ int currentValue = (j/divide) % 10;
+ cerr << currentValue;
+ }
+ cerr << endl;
+
+ divide /= 10;
+ }
+}
+
+
+
+void ContigFattener::dumpRange(long gindexstart,
+ long gindexend,
+ ContigSequence * read)
+{
+ if (!m_verbose) { return; }
+
+ if (gindexstart < 0) { gindexstart = 0; }
+ if (gindexend >= m_contig.getLength()) { gindexend = m_contig.getLength()-1; }
+
+ printPos(gindexstart, gindexend);
+
+ string cons = m_contig.getSeqString();
+
+ cerr << "cons:\t"
+ << cons.substr(gindexstart, gindexend - gindexstart +1)
+ << endl;
+
+ if (read)
+ {
+ read->dumpRange(gindexstart, gindexend);
+ }
+ else
+ {
+ vector<Tile_t> & tiling = m_contig.getReadTiling();
+ vector<Tile_t>::iterator ti;
+
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ if (!((ti->offset > gindexend) || (ti->getRightOffset() < gindexstart)))
+ {
+ Read_t rr;
+ m_read_bank.fetch(ti->source, rr);
+
+ ContigSequence r(ti, rr);
+ r.dumpRange(gindexstart, gindexend);
+ }
+ }
+ }
+}
+
+void ContigFattener::dumpAlignment()
+{
+ if (!m_verbose) { return; }
+
+ printPos(0, m_contig.getLength()-1);
+
+ string cons = m_contig.getSeqString();
+ cerr << "cons:\t" << cons << endl;
+
+ vector<Tile_t> & tiling = m_contig.getReadTiling();
+ vector<Tile_t>::iterator ti;
+
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ Read_t rr;
+ m_read_bank.fetch(ti->source, rr);
+
+ ContigSequence r(ti, rr);
+ r.dump();
+ }
+}
+
+void ContigFattener::recallCons()
+{
+ ContigIterator_t ci(m_contig, &m_read_bank);
+
+ cerr << "Recalling consensus...";
+
+ string consensus, consqual;
+
+ char cbases[] = "ACGT-";
+
+ while (ci.advanceNext())
+ {
+ char cons = ci.cons();
+ char cq = ci.cqv();
+
+ // Store the count of ACGT-
+ int scores[5] = {0,0,0,0,0};
+
+ const TiledReadList_t & tiling = ci.getTilingReads();
+
+ if (!tiling.empty())
+ {
+ TiledReadList_t::const_iterator ri;
+ for (ri = tiling.begin(); ri != tiling.end(); ri++)
+ {
+ char b = ri->base(ci.gindex());
+
+ switch(b)
+ {
+ case 'A': case 'a': scores[0] += 1; break;
+ case 'C': case 'c': scores[1] += 1; break;
+ case 'G': case 'g': scores[2] += 1; break;
+ case 'T': case 't': scores[3] += 1; break;
+ case '-': scores[4] += 1; break;
+ };
+ }
+
+ unsigned int i;
+ unsigned int max = 0; // Assume A is max
+ int maxcount = scores[max];
+ for (i = 1; i < 5; i++)
+ {
+ if (scores[i] > maxcount)
+ {
+ max = i;
+ maxcount = scores[i];
+ }
+ }
+
+ cons = cbases[max];
+
+ // Get rough cqv by doubling counts, subtracting the conflicting counts,
+ // but prefer gap misalignment to base misalignment
+ maxcount *= 2;
+
+ for (i = 0; i < 5; i++)
+ {
+ if (i != max)
+ {
+ maxcount -= (i == 4) ? scores[i] : 2*scores[i];
+ }
+ }
+ cq = maxcount;
+ }
+
+ consensus += cons;
+ consqual += 'N';
+ }
+
+ cerr << " setting... cl:" << consensus.length() << " ql: " << consqual.length();
+ m_contig.setSequence(consensus, consqual);
+ cerr << " done" << endl;
+}
+
+
+
+void ContigFattener::insertGapSlice(long gindex, ContigSequence * read)
+{
+ if (m_verbose) { cerr << "inserting gap slice at " << gindex << endl; }
+
+ m_contig.insertGapColumn(gindex);
+
+ //TODO:: read?
+ // read->adjustOffset(gindex, +1);
+}
+
diff --git a/src/Experimental/ContigFattener.hh b/src/Experimental/ContigFattener.hh
new file mode 100644
index 0000000..1b6cd72
--- /dev/null
+++ b/src/Experimental/ContigFattener.hh
@@ -0,0 +1,83 @@
+#ifndef CONTIG_FATTENER_HH
+#define CONTIG_FATTENER_HH 1
+
+#include <vector>
+#include "foundation_AMOS.hh"
+#include "ContigSequence.hh"
+
+typedef std::vector<long int> DeltaVector;
+typedef std::vector<ContigSequence> ContigSequenceSlice;
+
+class ContigFattener
+{
+public:
+ ContigFattener(AMOS::Contig_t & contig,
+ AMOS::Bank_t & read_bank,
+ bool verbose);
+
+ ~ContigFattener();
+
+ void extend3Read(const std::string & seqname, int distance);
+ void growContigLeft(bool requireConfirmation);
+ void growContigRight(bool requireConfirmation);
+
+ void fattenContig(int fattenRangeStart, int fattenRangeEnd,
+ int doLeftExtension, int doRightExtension);
+
+ int stripLeftGaps(std::vector<AMOS::Tile_t>::iterator ti);
+ int stripRightGaps(std::vector<AMOS::Tile_t>::iterator ti);
+ void stripGapSlices();
+
+private:
+
+ void removeGapColumn(AMOS::Pos_t gindex);
+
+ void extend3Read(ContigSequence * read, int distance);
+
+ ContigSequence * getContigSequence(const std::string & seqname);
+ ContigSequenceSlice getTilingSlice(int gindex);
+
+ void recordExtension(const ContigSequence * read, int distanceExtended,
+ int trimLength, float origAvg, float origTrimAvg,
+ int origUContigWidth);
+
+ int extend3Left(ContigSequence * read, int distance);
+ int extend3Right(ContigSequence * read, int distance);
+
+ int fatten3Left(ContigSequence * read, int distance);
+ int fatten3Right(ContigSequence * read, int distance);
+
+ long int getBasesToSkip(DeltaVector & delta,
+ DeltaVector::const_iterator & deltaiter,
+ bool & consGap,
+ unsigned int cpos,
+ unsigned int rpos,
+ const std::string & trimmed,
+ const std::string & consensus,
+ bool autoPromoteConsGaps);
+
+ void mergeExtension(unsigned int & cpos,
+ unsigned int & lastConsPos,
+ unsigned int & rpos,
+ std::string & trimmedSeq,
+ std::string & consensus,
+ ContigSequence * read,
+ DeltaVector & delta,
+ bool autoPromoteConsGaps,
+ int consMovementDelta);
+
+ void stripSequenceEdgeGaps();
+
+ void printPos(long gindexstart, long gindexend);
+ void dumpRange(long gindexstart, long gindexend, ContigSequence * read);
+ void dumpAlignment();
+ void recallCons();
+ int calculateCQV(long gindex, char & cons);
+ void insertGapSlice(long gindex, ContigSequence * read);
+
+ AMOS::Contig_t & m_contig;
+ AMOS::Bank_t & m_read_bank;
+ bool m_verbose;
+};
+
+#endif
diff --git a/src/Experimental/ContigSequence.cc b/src/Experimental/ContigSequence.cc
new file mode 100644
index 0000000..bc38e8f
--- /dev/null
+++ b/src/Experimental/ContigSequence.cc
@@ -0,0 +1,353 @@
+#include "ContigSequence.hh"
+#include "AMOS_Foundation.hh"
+
+using namespace AMOS;
+using namespace std;
+
+
+ContigSequence::ContigSequence(vector<Tile_t>::iterator & tile, Read_t & read, int readcount)
+ : m_tile(tile),
+ m_read(read),
+ m_readcount(readcount)
+{
+ renderSequence();
+}
+
+void ContigSequence::renderSequence()
+{
+#ifdef DEBUGRENDER
+ cerr << "range: [" << m_tile->range.begin << " " << m_tile->range.end;
+#endif
+
+ m_nuc = m_read.getSeqString(m_tile->range);
+ m_qual = m_read.getQualString(m_tile->range);
+
+#ifdef DEBUGRENDER
+ cerr << ") gaps:";
+#endif
+
+
+ for (int i = 0; i < m_tile->gaps.size(); i++)
+ {
+ int gappos = m_tile->gaps[i] + i;
+
+ m_nuc.insert(gappos, 1, '-');
+
+ char lqv = (gappos > 0) ? m_qual[gappos-1] : -1;
+ char rqv = (gappos < m_qual.size()) ? m_qual[gappos] : -1;
+
+ char gapqv = (lqv < rqv)
+ ? (lqv != -1) ? lqv : rqv
+ : (rqv != -1) ? rqv : lqv;
+
+ m_qual.insert(gappos, 1, gapqv);
+
+#ifdef DEBUGRENDER
+ cerr << " " << gappos;
+#endif
+ }
+
+#ifdef DEBUGRENDER
+ cerr << "." << endl;
+#endif
+}
+
+ContigSequence::~ContigSequence()
+{
+
+}
+
+char ContigSequence::base(long gindex)
+{
+ if (gindex < m_tile->offset || gindex > m_tile->getRightOffset())
+ {
+ cerr << "Invalid position requested: "<< gindex
+ << " in r" << getReadID() << endl;
+ throw amosException("Invalid position requested", "ContigSequence::base");
+ }
+
+ long position = gindex - m_tile->offset;
+ return m_nuc[position];
+}
+
+int ContigSequence::qv(long gindex) const
+{
+ if (gindex < m_tile->offset || gindex > m_tile->getRightOffset())
+ {
+ cerr << "Invalid position requested: "<< gindex
+ << " in r" << getReadID() << endl;
+ throw amosException("Invalid position requested", "ContigSequence::qv");
+ }
+
+ long position = gindex - m_tile->offset;
+ return m_qual[position] - MIN_QUALITY;
+}
+
+float ContigSequence::getAvgQV3Trim(int count) const
+{
+ int i = 0;
+ int sum = 0;
+ Range_t r(m_tile->range.getHi(), m_read.getLength());
+ string trimquals(m_read.getQualString(r));
+
+ for (i = 0; i < trimquals.size() && i < count; i++)
+ {
+ sum += trimquals[i] - MIN_QUALITY;
+ }
+
+ return (i) ? ((float)sum)/i : 0.0;
+}
+
+float ContigSequence::getAvgQV(long offset, int count) const
+{
+ int qvsum = 0;
+ int i;
+
+ if (isReverseCompliment())
+ {
+ for (i = 0; i < count && offset+i <= m_tile->getRightOffset(); i++)
+ { qvsum += qv(offset+i); }
+ }
+ else
+ {
+ for (i = 0; i < count && offset-i > m_tile->offset; i++)
+ { qvsum += qv(offset-i); }
+ }
+
+ return (i) ? ((float) qvsum) / i : 0.0;
+}
+
+
+void ContigSequence::swap(long a, long b)
+{
+ char baseswap = m_nuc[a];
+ m_nuc[a] = m_nuc[b];
+ m_nuc[b] = baseswap;
+
+ if (!m_qual.empty())
+ {
+ char qualswap = m_qual[a];
+ m_qual[a] = m_qual[b];
+ m_qual[b] = qualswap;
+ }
+}
+
+int ContigSequence::leftTwiddle(long gindex, int & twiddleDistance, char cons)
+{
+ int retval = 0;
+ long position = gindex - m_tile->offset;
+ if (position > 0 && position < m_nuc.length())
+ {
+ if (twiddleDistance == 0)
+ {
+ char base;
+ twiddleDistance = 1;
+ while (position-twiddleDistance >= 0 &&
+ ((base = m_nuc[position-twiddleDistance]) == '-'))
+ {
+ twiddleDistance++;
+ }
+
+ if (position-twiddleDistance >= 0)
+ {
+ if (cons != '?' && base != cons)
+ {
+ twiddleDistance = 0;
+ }
+ }
+ }
+
+ if (twiddleDistance && position - twiddleDistance >= 0)
+ {
+ swap(position-twiddleDistance, position);
+ retval = 1;
+ }
+ }
+
+ return retval;
+}
+
+int ContigSequence::rightTwiddle(long gindex, int & twiddleDistance, char cons)
+{
+ int retval = 0;
+ long position = gindex - m_tile->offset;
+
+ if ((position >= 0) && (position+1 < m_nuc.length()))
+ {
+ if (twiddleDistance == 0)
+ {
+ char base;
+ twiddleDistance = 1;
+ while (position+twiddleDistance < m_nuc.length() &&
+ ((base = m_nuc[position+twiddleDistance]) == '-'))
+ {
+ twiddleDistance++;
+ }
+
+ if (position+twiddleDistance < m_nuc.length())
+ {
+ if (cons != '?' && base != cons)
+ {
+ twiddleDistance = 0;
+ }
+ }
+ }
+
+ if (twiddleDistance && position + twiddleDistance < m_nuc.length())
+ {
+ swap(position, position+twiddleDistance);
+ retval = 1;
+ }
+ }
+
+ return retval;
+}
+
+
+void ContigSequence::dumpRange(long gindexstart, long gindexend)
+{
+ if (!(m_tile->offset > gindexend || m_tile->getRightOffset() < gindexstart))
+ {
+ cerr << "r[" << getReadID() << "]:\t";
+
+ for (int i = gindexstart; i < m_tile->offset; i++)
+ {
+ cerr << '*';
+ }
+
+ long startpos = gindexstart - m_tile->offset;
+ long endpos = gindexend - m_tile->offset;
+
+ if (startpos < 0) { startpos = 0; }
+ if (endpos >= m_nuc.length()) { endpos = m_nuc.length()-1; }
+
+ cerr << m_nuc.substr(startpos, endpos-startpos+1) << endl;
+ }
+}
+
+void ContigSequence::dump()
+{
+ cerr << "r[" << getReadID() << "]:\t";
+ for (int i = 0; i < m_tile->offset; i++)
+ {
+ cerr << '*';
+ }
+
+ cerr << m_nuc << endl;
+}
+
+int ContigSequence::get3TrimLength()
+{
+ return m_read.getLength() - m_tile->range.getHi();
+}
+
+string ContigSequence::get3Trim()
+{
+ Range_t r(m_tile->range.getHi(), m_read.getLength());
+
+ if (m_tile->range.isReverse())
+ {
+ r.swap();
+ }
+
+ return m_read.getSeqString(r);
+}
+
+int ContigSequence::extend3Left(const string & extendLeft)
+{
+ int basesExtended = 0;
+
+ if (!extendLeft.empty())
+ {
+ //cerr << "Left Extended r" << getReadID()
+ // << ": " << extendLeft << endl;
+
+ unsigned int addedBases = extendLeft.size();
+ m_tile->offset -= addedBases;
+
+ vector<Pos_t> newgaps;
+ int gapcount = 0;
+
+ for (int i = 0; i < addedBases; i++)
+ {
+ if (extendLeft[i] != '-')
+ {
+ basesExtended++;
+ }
+ else
+ {
+ int gseqpos = i;
+ int seqpos = gseqpos - gapcount;
+
+ newgaps.push_back(seqpos);
+ gapcount++;
+ }
+ }
+
+ for (int g = 0; g < m_tile->gaps.size(); g++)
+ {
+ newgaps.push_back(m_tile->gaps[g] + basesExtended);
+ }
+
+ m_tile->gaps = newgaps;
+
+ m_tile->range.begin += basesExtended;
+
+ /*
+ cerr << "Left Extension of r" << getReadID()
+ << " by " << basesExtended
+ << " (" << addedBases << ")" << endl;
+ */
+
+ renderSequence();
+ }
+
+ return basesExtended;
+}
+
+int ContigSequence::extend3Right(const string & extendRight)
+{
+ int basesExtended = 0;
+
+ if (!extendRight.empty())
+ {
+ //cerr << "extendRight sequence: " << extendRight << " in r" << getReadID()
+
+ unsigned int addedBases = extendRight.length();
+ int glen = m_tile->getGappedLength();
+ int gapcount = m_tile->gaps.size();
+
+ //cerr << "new gaps:";
+
+ for (unsigned int i = 0; i < addedBases; i++)
+ {
+ if (extendRight[i] != '-')
+ {
+ basesExtended++;
+ }
+ else
+ {
+ int gseqpos = glen + i;
+ int seqpos = gseqpos - gapcount;
+
+ //cerr << " " << seqpos;
+
+ m_tile->gaps.push_back(seqpos);
+ gapcount++;
+ }
+ }
+
+ //cerr << endl;
+
+ m_tile->range.end += basesExtended;
+
+
+ //cerr << "Right Extension of r" << getReadID()
+ // << " by " << basesExtended
+ // << " (" << addedBases << ")" << endl;
+
+ renderSequence();
+ }
+
+ return basesExtended;
+}
diff --git a/src/Experimental/ContigSequence.hh b/src/Experimental/ContigSequence.hh
new file mode 100644
index 0000000..36e20f0
--- /dev/null
+++ b/src/Experimental/ContigSequence.hh
@@ -0,0 +1,56 @@
+#ifndef CONTIGSEQUENCE_HH
+#define CONTIGSEQUENCE_HH 1
+
+#include "foundation_AMOS.hh"
+#include <vector>
+#include <ostream>
+
+class ContigSequence
+{
+public:
+ ContigSequence(std::vector<AMOS::Tile_t>::iterator & ti,
+ AMOS::Read_t & read,
+ int readcount=-1);
+
+ ~ContigSequence();
+
+ int m_readcount;
+ std::vector<AMOS::Tile_t>::iterator m_tile;
+ AMOS::Read_t m_read;
+
+ const std::string & getSeqname() const { return m_read.getEID(); }
+ long getRightEnd() const { return m_tile->getRightOffset(); }
+ long getOffset() const { return m_tile->offset; }
+ bool isReverseCompliment() const { return m_tile->range.isReverse(); }
+ int getReadID() const { return m_readcount; }
+ AMOS::ID_t getIID() const { return m_read.getIID(); }
+
+ int rightTwiddle(long gindex, int & twiddleDistance, char cons);
+ int leftTwiddle(long gindex, int & twiddleDistance, char cons);
+
+ char base(long gindex);
+ int qv(long gindex) const;
+
+ float getAvgQV(long offset, int count) const;
+ float getAvgQV3Trim(int count) const;
+
+ void dump();
+ void dumpRange(long gindexstart, long gindexend);
+
+
+ std::string get3Trim();
+ int get3TrimLength();
+
+ int extend3Right(const std::string & extendRight);
+ int extend3Left(const std::string & extendLeft);
+
+private:
+ void swap(long a, long b);
+
+ void renderSequence();
+
+ std::string m_nuc;
+ std::string m_qual;
+};
+
+#endif
diff --git a/src/Experimental/Makefile.am b/src/Experimental/Makefile.am
new file mode 100644
index 0000000..a7c7ab3
--- /dev/null
+++ b/src/Experimental/Makefile.am
@@ -0,0 +1,293 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+##-- TO BE INSTALLED
+bin_PROGRAMS = \
+ po_align \
+ fattenContig \
+ insertGapColumn \
+ manageContigs \
+ revContig \
+ rotateContig \
+ splitContig \
+ stitchContigs \
+ trimContig \
+ zipContigs \
+ barcode-graph \
+ build-persistent-bank \
+ auto-fix-contigs \
+ persistent-read-dist \
+ persistent-fix-contigs \
+ read-evolution \
+ gap-closure-reads \
+ mate-evolution \
+ analyzeHaplotypes
+
+
+dist_bin_SCRIPTS = \
+ aj_evaluateSequenceOverlaps.pl \
+ aj_joinContigs.pl \
+ aj_lowcomplexityfilter.pl \
+ aj_scaff2amos.pl \
+ aj_scaff2fasta.pl \
+ aligncestat.pl \
+ aligndist.pl \
+ alignextend.pl \
+ autoJoiner.pl \
+ blasr_alignquality.pl \
+ coords_best.pl \
+ coords_depth.pl \
+ ctg_gc.pl \
+ fasta_filter_raw.pl \
+ fastq_to_mates.pl \
+ filterfastadups.pl \
+ link2reads.pl \
+ persistent-assembly.pl \
+ persistent-fix.pl \
+ persistent-plot-breaks.pl \
+ persistent-unitig.pl \
+ splitscafffa.pl \
+ zipalign.pl
+
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/Foundation \
+ -I$(top_srcdir)/src/Contig
+
+##-- po-align
+po_align_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+po_align_SOURCES = \
+ po-align.cc
+
+
+##-- fattenContig
+fattenContig_LDADD = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+fattenContig_SOURCES = \
+ ContigSequence.hh \
+ ContigSequence.cc \
+ tigrinc.hh \
+ tigrinc.cc \
+ ContigFattener.hh \
+ ContigFattener.cc \
+ fattenContig.cc \
+ sw_align.hh \
+ sw_alignscore.hh \
+ sw_align.cc
+
+
+##-- insertGapColumn
+insertGapColumn_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+insertGapColumn_SOURCES = \
+ insertGapColumn.cc
+
+##-- manageContigs
+manageContigs_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+manageContigs_SOURCES = \
+ manageContigs.cc
+
+
+##-- revContig
+revContig_LDADD = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+revContig_SOURCES = \
+ revContig.cc
+
+
+##-- rotateContig
+rotateContig_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+rotateContig_SOURCES = \
+ rotateContig.cc
+
+
+##-- splitContig
+splitContig_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+splitContig_SOURCES = \
+ splitContig.cc
+
+##-- trimContig
+stitchContigs_LDADD = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+stitchContigs_SOURCES = \
+ stitchContigs.cc
+
+
+##-- trimContig
+trimContig_LDADD = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+trimContig_SOURCES = \
+ trimContig.cc
+
+
+##-- zipcontigs
+zipContigs_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+zipContigs_SOURCES = \
+ zipContigs.cc
+
+
+
+
+##-- barcode-graph
+barcode_graph_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+barcode_graph_SOURCES = \
+ barcode-graph.cc
+
+##-- build-persistent-bank
+build_persistent_bank_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+build_persistent_bank_SOURCES = \
+ build-persistent-bank.cc
+
+##-- auto-fix-contigs
+auto_fix_contigs_LDADD = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+auto_fix_contigs_SOURCES = \
+ auto-fix-contigs.cc \
+ PersistentUtils.hh
+
+##-- persistent-fix-contigs
+persistent_fix_contigs_LDADD = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+persistent_fix_contigs_SOURCES = \
+ persistent-fix-contigs.cc \
+ PersistentUtils.hh
+
+##-- persistent_read_dist
+persistent_read_dist_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+persistent_read_dist_SOURCES = \
+ persistent-read-dist.cc \
+ PersistentUtils.hh
+
+##-- read-evolution
+read_evolution_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+read_evolution_SOURCES = \
+ read-evolution.cc \
+ PersistentUtils.hh
+
+##-- gap-closure-reads
+gap_closure_reads_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+gap_closure_reads_SOURCES = \
+ gap-closure-reads.cc
+
+
+##-- mate-evolution
+mate_evolution_LDADD = \
+ $(top_builddir)/src/GNU/libGNU.a \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+
+mate_evolution_SOURCES = \
+ mate-evolution.cc \
+ PersistentUtils.hh
+
+##-- analyzeHaplotypes
+analyzeHaplotypes_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/Foundation \
+ -I$(top_srcdir)/src/Contig \
+ -I$(top_srcdir)/src/Slice
+
+analyzeHaplotypes_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/Slice/libSlice.a
+
+analyzeHaplotypes_SOURCES = \
+ analyzeHaplotypes.cc
+
+##-- END OF MAKEFILE --##
diff --git a/src/Experimental/Makefile.in b/src/Experimental/Makefile.in
new file mode 100644
index 0000000..f5ea433
--- /dev/null
+++ b/src/Experimental/Makefile.in
@@ -0,0 +1,1116 @@
+# 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 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@
+DIST_COMMON = $(dist_bin_SCRIPTS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = po_align$(EXEEXT) fattenContig$(EXEEXT) \
+ insertGapColumn$(EXEEXT) manageContigs$(EXEEXT) \
+ revContig$(EXEEXT) rotateContig$(EXEEXT) splitContig$(EXEEXT) \
+ stitchContigs$(EXEEXT) trimContig$(EXEEXT) zipContigs$(EXEEXT) \
+ barcode-graph$(EXEEXT) build-persistent-bank$(EXEEXT) \
+ auto-fix-contigs$(EXEEXT) persistent-read-dist$(EXEEXT) \
+ persistent-fix-contigs$(EXEEXT) read-evolution$(EXEEXT) \
+ gap-closure-reads$(EXEEXT) mate-evolution$(EXEEXT) \
+ analyzeHaplotypes$(EXEEXT)
+subdir = src/Experimental
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_analyzeHaplotypes_OBJECTS = \
+ analyzeHaplotypes-analyzeHaplotypes.$(OBJEXT)
+analyzeHaplotypes_OBJECTS = $(am_analyzeHaplotypes_OBJECTS)
+analyzeHaplotypes_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/Slice/libSlice.a
+am_auto_fix_contigs_OBJECTS = auto-fix-contigs.$(OBJEXT)
+auto_fix_contigs_OBJECTS = $(am_auto_fix_contigs_OBJECTS)
+auto_fix_contigs_DEPENDENCIES = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_barcode_graph_OBJECTS = barcode-graph.$(OBJEXT)
+barcode_graph_OBJECTS = $(am_barcode_graph_OBJECTS)
+barcode_graph_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_build_persistent_bank_OBJECTS = build-persistent-bank.$(OBJEXT)
+build_persistent_bank_OBJECTS = $(am_build_persistent_bank_OBJECTS)
+build_persistent_bank_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_fattenContig_OBJECTS = ContigSequence.$(OBJEXT) tigrinc.$(OBJEXT) \
+ ContigFattener.$(OBJEXT) fattenContig.$(OBJEXT) \
+ sw_align.$(OBJEXT)
+fattenContig_OBJECTS = $(am_fattenContig_OBJECTS)
+fattenContig_DEPENDENCIES = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_gap_closure_reads_OBJECTS = gap-closure-reads.$(OBJEXT)
+gap_closure_reads_OBJECTS = $(am_gap_closure_reads_OBJECTS)
+gap_closure_reads_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_insertGapColumn_OBJECTS = insertGapColumn.$(OBJEXT)
+insertGapColumn_OBJECTS = $(am_insertGapColumn_OBJECTS)
+insertGapColumn_DEPENDENCIES = $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_manageContigs_OBJECTS = manageContigs.$(OBJEXT)
+manageContigs_OBJECTS = $(am_manageContigs_OBJECTS)
+manageContigs_DEPENDENCIES = $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_mate_evolution_OBJECTS = mate-evolution.$(OBJEXT)
+mate_evolution_OBJECTS = $(am_mate_evolution_OBJECTS)
+mate_evolution_DEPENDENCIES = $(top_builddir)/src/GNU/libGNU.a \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_persistent_fix_contigs_OBJECTS = persistent-fix-contigs.$(OBJEXT)
+persistent_fix_contigs_OBJECTS = $(am_persistent_fix_contigs_OBJECTS)
+persistent_fix_contigs_DEPENDENCIES = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_persistent_read_dist_OBJECTS = persistent-read-dist.$(OBJEXT)
+persistent_read_dist_OBJECTS = $(am_persistent_read_dist_OBJECTS)
+persistent_read_dist_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_po_align_OBJECTS = po-align.$(OBJEXT)
+po_align_OBJECTS = $(am_po_align_OBJECTS)
+po_align_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_read_evolution_OBJECTS = read-evolution.$(OBJEXT)
+read_evolution_OBJECTS = $(am_read_evolution_OBJECTS)
+read_evolution_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_revContig_OBJECTS = revContig.$(OBJEXT)
+revContig_OBJECTS = $(am_revContig_OBJECTS)
+revContig_DEPENDENCIES = $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_rotateContig_OBJECTS = rotateContig.$(OBJEXT)
+rotateContig_OBJECTS = $(am_rotateContig_OBJECTS)
+rotateContig_DEPENDENCIES = $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_splitContig_OBJECTS = splitContig.$(OBJEXT)
+splitContig_OBJECTS = $(am_splitContig_OBJECTS)
+splitContig_DEPENDENCIES = $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+am_stitchContigs_OBJECTS = stitchContigs.$(OBJEXT)
+stitchContigs_OBJECTS = $(am_stitchContigs_OBJECTS)
+stitchContigs_DEPENDENCIES = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_trimContig_OBJECTS = trimContig.$(OBJEXT)
+trimContig_OBJECTS = $(am_trimContig_OBJECTS)
+trimContig_DEPENDENCIES = $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_zipContigs_OBJECTS = zipContigs.$(OBJEXT)
+zipContigs_OBJECTS = $(am_zipContigs_OBJECTS)
+zipContigs_DEPENDENCIES = $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+SCRIPTS = $(dist_bin_SCRIPTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(analyzeHaplotypes_SOURCES) $(auto_fix_contigs_SOURCES) \
+ $(barcode_graph_SOURCES) $(build_persistent_bank_SOURCES) \
+ $(fattenContig_SOURCES) $(gap_closure_reads_SOURCES) \
+ $(insertGapColumn_SOURCES) $(manageContigs_SOURCES) \
+ $(mate_evolution_SOURCES) $(persistent_fix_contigs_SOURCES) \
+ $(persistent_read_dist_SOURCES) $(po_align_SOURCES) \
+ $(read_evolution_SOURCES) $(revContig_SOURCES) \
+ $(rotateContig_SOURCES) $(splitContig_SOURCES) \
+ $(stitchContigs_SOURCES) $(trimContig_SOURCES) \
+ $(zipContigs_SOURCES)
+DIST_SOURCES = $(analyzeHaplotypes_SOURCES) \
+ $(auto_fix_contigs_SOURCES) $(barcode_graph_SOURCES) \
+ $(build_persistent_bank_SOURCES) $(fattenContig_SOURCES) \
+ $(gap_closure_reads_SOURCES) $(insertGapColumn_SOURCES) \
+ $(manageContigs_SOURCES) $(mate_evolution_SOURCES) \
+ $(persistent_fix_contigs_SOURCES) \
+ $(persistent_read_dist_SOURCES) $(po_align_SOURCES) \
+ $(read_evolution_SOURCES) $(revContig_SOURCES) \
+ $(rotateContig_SOURCES) $(splitContig_SOURCES) \
+ $(stitchContigs_SOURCES) $(trimContig_SOURCES) \
+ $(zipContigs_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+dist_bin_SCRIPTS = \
+ aj_evaluateSequenceOverlaps.pl \
+ aj_joinContigs.pl \
+ aj_lowcomplexityfilter.pl \
+ aj_scaff2amos.pl \
+ aj_scaff2fasta.pl \
+ aligncestat.pl \
+ aligndist.pl \
+ alignextend.pl \
+ autoJoiner.pl \
+ blasr_alignquality.pl \
+ coords_best.pl \
+ coords_depth.pl \
+ ctg_gc.pl \
+ fasta_filter_raw.pl \
+ fastq_to_mates.pl \
+ filterfastadups.pl \
+ link2reads.pl \
+ persistent-assembly.pl \
+ persistent-fix.pl \
+ persistent-plot-breaks.pl \
+ persistent-unitig.pl \
+ splitscafffa.pl \
+ zipalign.pl
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/Foundation \
+ -I$(top_srcdir)/src/Contig
+
+po_align_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+po_align_SOURCES = \
+ po-align.cc
+
+fattenContig_LDADD = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+fattenContig_SOURCES = \
+ ContigSequence.hh \
+ ContigSequence.cc \
+ tigrinc.hh \
+ tigrinc.cc \
+ ContigFattener.hh \
+ ContigFattener.cc \
+ fattenContig.cc \
+ sw_align.hh \
+ sw_alignscore.hh \
+ sw_align.cc
+
+insertGapColumn_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+insertGapColumn_SOURCES = \
+ insertGapColumn.cc
+
+manageContigs_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+manageContigs_SOURCES = \
+ manageContigs.cc
+
+revContig_LDADD = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+revContig_SOURCES = \
+ revContig.cc
+
+rotateContig_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+rotateContig_SOURCES = \
+ rotateContig.cc
+
+splitContig_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a
+
+splitContig_SOURCES = \
+ splitContig.cc
+
+stitchContigs_LDADD = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+stitchContigs_SOURCES = \
+ stitchContigs.cc
+
+trimContig_LDADD = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+trimContig_SOURCES = \
+ trimContig.cc
+
+zipContigs_LDADD = \
+ $(top_builddir)/src/Align/libAlign.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+zipContigs_SOURCES = \
+ zipContigs.cc
+
+barcode_graph_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+barcode_graph_SOURCES = \
+ barcode-graph.cc
+
+build_persistent_bank_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+build_persistent_bank_SOURCES = \
+ build-persistent-bank.cc
+
+auto_fix_contigs_LDADD = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+auto_fix_contigs_SOURCES = \
+ auto-fix-contigs.cc \
+ PersistentUtils.hh
+
+persistent_fix_contigs_LDADD = \
+ $(top_builddir)/src/Contig/libContigUtils.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+persistent_fix_contigs_SOURCES = \
+ persistent-fix-contigs.cc \
+ PersistentUtils.hh
+
+persistent_read_dist_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+persistent_read_dist_SOURCES = \
+ persistent-read-dist.cc \
+ PersistentUtils.hh
+
+read_evolution_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+read_evolution_SOURCES = \
+ read-evolution.cc \
+ PersistentUtils.hh
+
+gap_closure_reads_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+gap_closure_reads_SOURCES = \
+ gap-closure-reads.cc
+
+mate_evolution_LDADD = \
+ $(top_builddir)/src/GNU/libGNU.a \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+mate_evolution_SOURCES = \
+ mate-evolution.cc \
+ PersistentUtils.hh
+
+analyzeHaplotypes_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/Foundation \
+ -I$(top_srcdir)/src/Contig \
+ -I$(top_srcdir)/src/Slice
+
+analyzeHaplotypes_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/Slice/libSlice.a
+
+analyzeHaplotypes_SOURCES = \
+ analyzeHaplotypes.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Experimental/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Experimental/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):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+analyzeHaplotypes$(EXEEXT): $(analyzeHaplotypes_OBJECTS) $(analyzeHaplotypes_DEPENDENCIES)
+ @rm -f analyzeHaplotypes$(EXEEXT)
+ $(CXXLINK) $(analyzeHaplotypes_OBJECTS) $(analyzeHaplotypes_LDADD) $(LIBS)
+auto-fix-contigs$(EXEEXT): $(auto_fix_contigs_OBJECTS) $(auto_fix_contigs_DEPENDENCIES)
+ @rm -f auto-fix-contigs$(EXEEXT)
+ $(CXXLINK) $(auto_fix_contigs_OBJECTS) $(auto_fix_contigs_LDADD) $(LIBS)
+barcode-graph$(EXEEXT): $(barcode_graph_OBJECTS) $(barcode_graph_DEPENDENCIES)
+ @rm -f barcode-graph$(EXEEXT)
+ $(CXXLINK) $(barcode_graph_OBJECTS) $(barcode_graph_LDADD) $(LIBS)
+build-persistent-bank$(EXEEXT): $(build_persistent_bank_OBJECTS) $(build_persistent_bank_DEPENDENCIES)
+ @rm -f build-persistent-bank$(EXEEXT)
+ $(CXXLINK) $(build_persistent_bank_OBJECTS) $(build_persistent_bank_LDADD) $(LIBS)
+fattenContig$(EXEEXT): $(fattenContig_OBJECTS) $(fattenContig_DEPENDENCIES)
+ @rm -f fattenContig$(EXEEXT)
+ $(CXXLINK) $(fattenContig_OBJECTS) $(fattenContig_LDADD) $(LIBS)
+gap-closure-reads$(EXEEXT): $(gap_closure_reads_OBJECTS) $(gap_closure_reads_DEPENDENCIES)
+ @rm -f gap-closure-reads$(EXEEXT)
+ $(CXXLINK) $(gap_closure_reads_OBJECTS) $(gap_closure_reads_LDADD) $(LIBS)
+insertGapColumn$(EXEEXT): $(insertGapColumn_OBJECTS) $(insertGapColumn_DEPENDENCIES)
+ @rm -f insertGapColumn$(EXEEXT)
+ $(CXXLINK) $(insertGapColumn_OBJECTS) $(insertGapColumn_LDADD) $(LIBS)
+manageContigs$(EXEEXT): $(manageContigs_OBJECTS) $(manageContigs_DEPENDENCIES)
+ @rm -f manageContigs$(EXEEXT)
+ $(CXXLINK) $(manageContigs_OBJECTS) $(manageContigs_LDADD) $(LIBS)
+mate-evolution$(EXEEXT): $(mate_evolution_OBJECTS) $(mate_evolution_DEPENDENCIES)
+ @rm -f mate-evolution$(EXEEXT)
+ $(CXXLINK) $(mate_evolution_OBJECTS) $(mate_evolution_LDADD) $(LIBS)
+persistent-fix-contigs$(EXEEXT): $(persistent_fix_contigs_OBJECTS) $(persistent_fix_contigs_DEPENDENCIES)
+ @rm -f persistent-fix-contigs$(EXEEXT)
+ $(CXXLINK) $(persistent_fix_contigs_OBJECTS) $(persistent_fix_contigs_LDADD) $(LIBS)
+persistent-read-dist$(EXEEXT): $(persistent_read_dist_OBJECTS) $(persistent_read_dist_DEPENDENCIES)
+ @rm -f persistent-read-dist$(EXEEXT)
+ $(CXXLINK) $(persistent_read_dist_OBJECTS) $(persistent_read_dist_LDADD) $(LIBS)
+po_align$(EXEEXT): $(po_align_OBJECTS) $(po_align_DEPENDENCIES)
+ @rm -f po_align$(EXEEXT)
+ $(CXXLINK) $(po_align_OBJECTS) $(po_align_LDADD) $(LIBS)
+read-evolution$(EXEEXT): $(read_evolution_OBJECTS) $(read_evolution_DEPENDENCIES)
+ @rm -f read-evolution$(EXEEXT)
+ $(CXXLINK) $(read_evolution_OBJECTS) $(read_evolution_LDADD) $(LIBS)
+revContig$(EXEEXT): $(revContig_OBJECTS) $(revContig_DEPENDENCIES)
+ @rm -f revContig$(EXEEXT)
+ $(CXXLINK) $(revContig_OBJECTS) $(revContig_LDADD) $(LIBS)
+rotateContig$(EXEEXT): $(rotateContig_OBJECTS) $(rotateContig_DEPENDENCIES)
+ @rm -f rotateContig$(EXEEXT)
+ $(CXXLINK) $(rotateContig_OBJECTS) $(rotateContig_LDADD) $(LIBS)
+splitContig$(EXEEXT): $(splitContig_OBJECTS) $(splitContig_DEPENDENCIES)
+ @rm -f splitContig$(EXEEXT)
+ $(CXXLINK) $(splitContig_OBJECTS) $(splitContig_LDADD) $(LIBS)
+stitchContigs$(EXEEXT): $(stitchContigs_OBJECTS) $(stitchContigs_DEPENDENCIES)
+ @rm -f stitchContigs$(EXEEXT)
+ $(CXXLINK) $(stitchContigs_OBJECTS) $(stitchContigs_LDADD) $(LIBS)
+trimContig$(EXEEXT): $(trimContig_OBJECTS) $(trimContig_DEPENDENCIES)
+ @rm -f trimContig$(EXEEXT)
+ $(CXXLINK) $(trimContig_OBJECTS) $(trimContig_LDADD) $(LIBS)
+zipContigs$(EXEEXT): $(zipContigs_OBJECTS) $(zipContigs_DEPENDENCIES)
+ @rm -f zipContigs$(EXEEXT)
+ $(CXXLINK) $(zipContigs_OBJECTS) $(zipContigs_LDADD) $(LIBS)
+install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ContigFattener.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ContigSequence.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/analyzeHaplotypes-analyzeHaplotypes.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/auto-fix-contigs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/barcode-graph.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/build-persistent-bank.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fattenContig.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gap-closure-reads.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/insertGapColumn.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/manageContigs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mate-evolution.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/persistent-fix-contigs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/persistent-read-dist.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/po-align.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/read-evolution.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/revContig.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rotateContig.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/splitContig.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/stitchContigs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sw_align.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tigrinc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trimContig.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/zipContigs.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+
+analyzeHaplotypes-analyzeHaplotypes.o: analyzeHaplotypes.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(analyzeHaplotypes_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT analyzeHaplotypes-analyzeHaplotypes.o -MD -MP -MF $(DEPDIR)/analyzeHaplotypes-analyzeHaplotypes.Tpo -c -o analyzeHaplotypes-analyzeHaplotypes.o `test -f 'analyzeHaplotypes.cc' || echo '$(srcdir)/'`analyzeHaplotypes.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/analyzeHaplotypes-analyzeHaplotypes.Tpo $(DEPDIR)/analyzeHaplotypes-analyzeHaplotypes.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='analyzeHaplotypes.cc' object='analyzeHaplotypes-analyzeHaplotypes.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(analyzeHaplotypes_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o analyzeHaplotypes-analyzeHaplotypes.o `test -f 'analyzeHaplotypes.cc' || echo '$(srcdir)/'`analyzeHaplotypes.cc
+
+analyzeHaplotypes-analyzeHaplotypes.obj: analyzeHaplotypes.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(analyzeHaplotypes_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT analyzeHaplotypes-analyzeHaplotypes.obj -MD -MP -MF $(DEPDIR)/analyzeHaplotypes-analyzeHaplotypes.Tpo -c -o analyzeHaplotypes-analyzeHaplotypes.obj `if test -f 'analyzeHaplotypes.cc'; then $(CYGPATH_W) 'analyzeHaplotypes.cc'; else $(CYGPATH_W) '$(srcdir)/analyzeHaplotypes.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/analyzeHaplotypes-analyzeHaplotypes.Tpo $(DEPDIR)/analyzeHaplotypes-analyzeHaplotypes.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='analyzeHaplotypes.cc' object='analyzeHaplotypes-analyzeHaplotypes.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(analyzeHaplotypes_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o analyzeHaplotypes-analyzeHaplotypes.obj `if test -f 'analyzeHaplotypes.cc'; then $(CYGPATH_W) 'analyzeHaplotypes.cc'; else $(CYGPATH_W) '$(srcdir)/analyzeHaplotypes.cc'; fi`
+
+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 $(PROGRAMS) $(SCRIPTS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-binPROGRAMS clean-generic 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-binPROGRAMS install-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dist_binSCRIPTS \
+ 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-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-dist_binSCRIPTS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Experimental/PersistentUtils.hh b/src/Experimental/PersistentUtils.hh
new file mode 100644
index 0000000..35b52c2
--- /dev/null
+++ b/src/Experimental/PersistentUtils.hh
@@ -0,0 +1,147 @@
+#ifndef PERSISTENT_UTILS_HH
+#define PERSISTENT_UTILS_HH 1
+
+#include "foundation_AMOS.hh"
+
+using namespace AMOS;
+using namespace std;
+
+
+class ReadPosInfo
+{
+public:
+ ReadPosInfo(ID_t iid, ID_t contigiid, int offset, int gappedlen, int tileid, bool rc)
+ : m_iid(iid), m_contigiid(contigiid), m_offset(offset), m_gappedlen(gappedlen), m_tileid(tileid), m_rc(rc)
+ {}
+
+ ID_t m_iid;
+ ID_t m_contigiid;
+ int m_offset;
+ int m_gappedlen;
+ int m_tileid;
+ bool m_rc;
+
+ bool rc() const { return m_rc; }
+ ID_t iid() const { return m_iid; }
+ ID_t contig() const { return m_contigiid; }
+
+ int getRightOffset() const
+ { return m_offset + m_gappedlen - 1; }
+
+ int pos(bool use3) const
+ {
+ if (use3) { return pos3();}
+ return pos5();
+ }
+
+ int pos5() const
+ {
+ int retval = m_offset;
+ if (m_rc) { retval = getRightOffset(); }
+ return retval;
+ }
+
+ int pos3() const
+ {
+ int retval = getRightOffset();
+ if (m_rc) { retval = m_offset; }
+ return retval;
+ }
+};
+
+
+int computeDistance(Tile_t * lefttile, Tile_t * righttile)
+{
+ return righttile->offset - lefttile->offset;
+}
+
+void computeDelta(Tile_t * leftmtile, ReadPosInfo * leftptile,
+ Tile_t * rightmtile, ReadPosInfo * rightptile,
+ int & consistent, int & delta, int & mdist, int & pdist)
+{
+ bool mlrc = leftmtile->range.isReverse();
+ bool mrrc = rightmtile->range.isReverse();
+
+ bool plrc = leftptile->rc();
+ bool prrc = rightptile->rc();
+
+ bool masterinnie = mlrc ^ mrrc;
+ bool patchinnie = plrc ^ prrc;
+
+ consistent = (masterinnie == patchinnie);
+
+ mdist = computeDistance(leftmtile, rightmtile);
+ pdist = 0;
+
+ int rpos = rightptile->pos(mrrc);
+ int lpos = leftptile->pos(mlrc);
+
+ if (consistent)
+ {
+ // -A-> -B->
+ if (mlrc == plrc)
+ {
+ // -A-> -B->
+
+ if (rpos < lpos) { consistent = 0; } // -B-> -A->
+ pdist = rpos - lpos;
+ }
+ else
+ {
+ // <-B- <-A-
+ if (lpos < rpos) { consistent = 0; } // <-A- <-B-
+ pdist = lpos - rpos;
+ }
+ }
+
+ // 1000 - 0 = 1000 bp collapse
+ delta = pdist - mdist;
+}
+
+
+typedef map<ID_t, ReadPosInfo > ReadPosLookup;
+
+int get5Offset(Tile_t tile)
+{
+ if (tile.range.isReverse()) { return tile.getRightOffset(); }
+ return tile.offset;
+}
+
+void recordReadPositions(ID_t iid, vector<Tile_t> & tiling, ReadPosLookup & read2contigpos)
+{
+ sort(tiling.begin(), tiling.end(), TileOrderCmp());
+
+ int tileid;
+ vector<Tile_t>::iterator ti;
+ for (ti = tiling.begin(), tileid = 0; ti != tiling.end(); ti++, tileid++)
+ {
+ read2contigpos.insert(make_pair(ti->source,
+ ReadPosInfo(ti->source,
+ iid,
+ ti->offset,
+ ti->getGappedLength(),
+ tileid,
+ ti->range.isReverse())));
+ }
+}
+
+void recordContigPositions(Bank_t & contig_bank, ReadPosLookup & read2contigpos)
+{
+ // Record the position of every read in the patch bank
+ IDMap_t::const_iterator c;
+ const IDMap_t & patchmap = contig_bank.getIDMap();
+ for (c = patchmap.begin(); c!= patchmap.end(); c++)
+ {
+ Contig_t contig;
+ contig_bank.fetch(c->iid, contig);
+
+ recordReadPositions(contig.getIID(), contig.getReadTiling(), read2contigpos);
+ }
+}
+
+
+
+
+
+
+#endif
diff --git a/src/Experimental/aj_evaluateSequenceOverlaps.pl b/src/Experimental/aj_evaluateSequenceOverlaps.pl
new file mode 100755
index 0000000..2f9c329
--- /dev/null
+++ b/src/Experimental/aj_evaluateSequenceOverlaps.pl
@@ -0,0 +1,1146 @@
+#!/usr/bin/perl -w
+
+use strict;
+use TIGR::Foundation;
+
+my $USAGE = "Usage: aj_evaluateSequenceOverlaps.pl roo qoo out.coords\n";
+
+my $HELPTEXT = qq~
+Evaluate alignments to find the best candidate for autoJoining
+
+ $USAGE
+ roo is the reference orientation
+ qoo is the query orientation
+ out.coords contains the nucmer results
+
+ Options
+ -------
+ -gapsize <size> Expected gap size
+ -gapstdev <stdev> Standard deviation of gap size
+ -alignthresh <perc> Minimum acceptable alignment percent id
+~;
+
+my $VERSION = " Version 1.01 (Build " . (qw/$Revision$/ )[1] . ")";
+my $SIZEFASTA = "/fs/sz-user-supported/common/bin/sizeFasta";
+
+my @DEPENDS =
+(
+ "TIGR::Foundation",
+ $SIZEFASTA,
+);
+
+my $tf = new TIGR::Foundation;
+
+
+my $ALIGNTHRESH = 94.00;
+my $GAPSIZE_PARTITION = 20;
+my $MAXOVERHANG = 10000;
+my $MAXGAPSIZE = 10000;
+my $MINIDSCORE = 85.00;
+my $MINMATCHLEN = 40;
+my $MINOVERLAP = 30;
+
+my $WORKDIR = ".";
+
+my $doverbose = 0;
+my $PRINTALL = 0;
+
+my %qcontig;
+my %rcontig;
+my %qseqs;
+my %rseqs;
+
+my %rlayout;
+my %qlayout;
+my $layoutcount = 0;
+
+sub echo
+{
+ my $str = join " ", @_;
+
+ $tf->logLocal($str, 4);
+ print @_ if ($doverbose);
+}
+
+sub getSize
+{
+ my $seq = shift;
+ my $id = shift;
+
+ my $cmd = "$SIZEFASTA -i $id $seq";
+
+ $tf->logLocal("Running $cmd", 4);
+ my $out = `$cmd`;
+
+ $tf->bail("$cmd failed ($!)") if ($?);
+
+ return (split /\s+/, $out)[1];
+}
+
+sub loadSeqSizes
+{
+ my $file = shift;
+ my $retval = {};
+
+ my $cmd = "$SIZEFASTA $file";
+
+ $tf->logLocal("Running $cmd", 4);
+ my @out = `$cmd`;
+
+ $tf->bail("$cmd failed ($!)") if ($?);
+
+ foreach (@out)
+ {
+ my @vals = split;
+ $retval->{$vals[0]} = $vals[1];
+ }
+
+ return $retval;
+}
+
+sub loadLayout
+{
+ my $cref = shift;
+ my $layout = shift;
+ my $layoutfile = shift;
+
+ my $info = undef;
+
+ open LAYOUT, "< $layoutfile"
+ or $tf->bail("Can't open $layoutfile ($!)");
+
+ while (<LAYOUT>)
+ {
+ if (/^##(\S+)/)
+ {
+ $cref->{name} = $1;
+ $info = $_;
+ }
+ elsif (/^#(\S+)\(/)
+ {
+ my $seqname = $1;
+ chomp;
+
+ $layout->{$seqname} = $_;
+ }
+ }
+
+ close LAYOUT;
+
+ $tf->bail("Contig $layoutfile malformed") if !defined $info;
+
+ return $info;
+}
+
+sub getContigInfo
+{
+ my ($cref, $layout, $type, $orientation) = @_;
+
+ my $info;
+
+ if ( -r "$WORKDIR/$cref->{prefix}.layout")
+ {
+ $info = loadLayout($cref, $layout, "$WORKDIR/$cref->{prefix}.layout");
+ }
+ else
+ {
+ $info = loadLayout($cref, $layout, "$WORKDIR/$cref->{prefix}.contig");
+ }
+
+ chomp $info;
+ echo $info;
+
+ my @values = split /\s/, $info;
+ $cref->{bases} = $values[2];
+ $cref->{info} = $info;
+
+ echo " $orientation\n";
+ $orientation = ($orientation eq "BE") ? 0 : 1;
+ $cref->{oo} = $orientation;
+
+ my $len = getSize("$WORKDIR/$cref->{prefix}.fasta", $cref->{prefix});
+ $cref->{len} = $len;
+
+ my $overlapside = ($orientation) ? ($type eq "r") ? "B" : "E"
+ : ($type eq "r") ? "E" : "B";
+
+ $cref->{overlapside} = $overlapside;
+
+ $cref->{seqsizes} = loadSeqSizes("$WORKDIR/$cref->{prefix}.seq");
+}
+
+
+
+sub getReadInfo
+{
+ my ($cref, $layout, $seqname) = @_;
+ my $retval;
+
+ $retval->{seqname} = $seqname;
+ $retval->{contig} = $cref;
+
+ if ($seqname eq $cref->{name})
+ {
+ ## This alignment is with the consensus
+ $retval->{cons} = 1;
+
+ $retval->{offset} = 0;
+ $retval->{rc} = 0;
+ $retval->{len} = $cref->{len};
+ $retval->{size} = $cref->{len};
+
+ $retval->{seql} = 1;
+ $retval->{asml} = 1;
+
+ $retval->{seqr} = $cref->{len};
+ $retval->{asmr} = $cref->{len};
+
+ $retval->{seqmax} = $cref->{len};
+ }
+ else
+ {
+ $retval->{cons} = 0;
+
+ $tf->bail("Sequence $seqname not in layout")
+ if !exists $layout->{$seqname};
+
+ my $info = $layout->{$seqname};
+
+ $tf->bail("Sequence $seqname not in seq file")
+ if !exists $cref->{seqsizes}->{$seqname};
+
+ my $size = $cref->{seqsizes}->{$seqname};
+
+ my $offset = $1 if ($info =~ /^\#\S+\((\d+)\)/);
+ my $rc = ($info =~ /\[RC\]/);
+ my $len = $1 if ($info =~ /(\d+) bases/);
+
+ my ($seql, $seqr, $asml, $asmr);
+
+ if ($info =~ /{(\S+) (\S+)}/) { $seql = $1; $seqr = $2; }
+ if ($info =~ /<(\S+) (\S+)>/) { $asml = $1; $asmr = $2; }
+
+ $retval->{offset} = $offset;
+ $retval->{rc} = $rc ? "1" : "0";
+ $retval->{len} = $len;
+ $retval->{size} = $size;
+
+ $retval->{seql} = $seql;
+ $retval->{seqr} = $seqr;
+
+ $retval->{asml} = $asml;
+ $retval->{asmr} = $asmr;
+
+ $retval->{seqmax} = ($rc) ? $seql : $seqr;
+ }
+
+ ## Tedge is the projected sequence position of the overlaping contig edge
+ my $tedge;
+
+ if ($cref->{overlapside} eq "B")
+ {
+ if ($retval->{rc}) { $tedge = $retval->{asml} + $retval->{seql}; }
+ else { $tedge = $retval->{seql} - $retval->{asml}; }
+ }
+ else
+ {
+ if ($retval->{rc}) { $tedge = $retval->{seqr} - ($cref->{len} - $retval->{asmr}); }
+ else { $tedge = $retval->{seqr} + ($cref->{len} - $retval->{asmr}); }
+ }
+
+ $retval->{tedge} = $tedge;
+ $retval->{dir} = $cref->{oo} ^ $retval->{rc};
+
+ return $retval;
+}
+
+sub getReadRef
+{
+ my ($seq, $seqref, $contigref, $layout) = @_;
+
+ my %seqs = %$seqref;
+
+ my $retval;
+
+ if (exists($seqs{$seq}))
+ {
+ $retval = $seqs{$seq};
+ }
+ else
+ {
+ $retval = getReadInfo($contigref, $layout, $seq);
+ $seqref->{$seq} = $retval; ## Save it away for fast lookup
+ }
+
+ return $retval;
+}
+
+sub parseOverlap
+{
+ my ($id, $alignment) = @_;
+
+ my @values = split /\s+/, $alignment;
+
+ my $rseq = $values[12];
+ my $qseq = $values[13];
+
+ my $rlen = $values[7];
+ my $qlen = $values[8];
+
+ my $idscore = $values[10];
+ $idscore =~ s/%//g;
+
+ my $o;
+ $o->{id} = $id;
+ $o->{dist} = ($qlen < $rlen) ? $qlen : $rlen;
+ $o->{idscore} = $idscore;
+ $o->{iddist} = sprintf("%.02f", ($o->{dist} * $idscore /100));
+
+ $o->{rref} = getReadRef($rseq, \%rseqs, \%rcontig, \%rlayout);
+ $o->{rstart} = $values[1];
+ $o->{rend} = $values[2];
+ $o->{rrc} = 0; ## nucmer always aligns with reference forward
+ $o->{rmax} = $o->{rend};
+ $o->{rasml} = "?";
+ $o->{rasmr} = "?";
+
+ $o->{qref} = getReadRef($qseq, \%qseqs, \%qcontig, \%qlayout);
+ $o->{qstart} = $values[4];
+ $o->{qend} = $values[5];
+ $o->{qrc} = ($o->{qstart} > $o->{qend}) ? 1 : 0;
+ $o->{qmax} = ($o->{qrc}) ? $o->{qstart} : $o->{qend};
+ $o->{qasml} = "?";
+ $o->{qasmr} = "?";
+
+ ## rrc and qrc mark in the sequence alignment is reversed
+ ## rdir and qdir mark if the implied contig direction is reversed
+ $o->{rdir} = ($o->{rref}->{rc}); ## rrc == 0
+ $o->{qdir} = ($o->{qref}->{rc} ^ $o->{qrc});
+
+ $o->{cons} = $o->{rref}->{cons} + $o->{qref}->{cons};
+
+ my @consdisplay = ("","+","*");
+ $o->{consd} = $consdisplay[$o->{cons}];
+
+ return $o;
+}
+
+
+sub printOverlap
+{
+ my $o = shift;
+
+ my $rref = $o->{rref};
+ my $qref = $o->{qref};
+
+ my $rrc = ($rref->{rc}) ? "RC" : "";
+ my $qrc = ($qref->{rc}) ? "RC" : "";
+
+ my $roo = $rref->{contig}->{oo} ? "EB" : "BE";
+ my $qoo = $qref->{contig}->{oo} ? "EB" : "BE";
+
+ my $rcons = ($rref->{cons}) ? "#" : "";
+ my $qcons = ($qref->{cons}) ? "#" : "";
+
+ print "$o->{id}: $rref->{seqname} <-> $qref->{seqname} ".
+ "$o->{idscore}% $o->{dist}bp\n";
+
+ print "#$rcons$rref->{seqname}($rref->{offset}) [$rrc] $rref->{len}. <$rref->{asml} $rref->{asmr}> {$rref->{seql} $rref->{seqr}} ($o->{rstart} $o->{rend}) $rref->{tedge} |$o->{rasml} $o->{rasmr}|\n";
+ print "#$qcons$qref->{seqname}($qref->{offset}) [$qrc] $qref->{len}. <$qref->{asml} $qref->{asmr}> {$qref->{seql} $qref->{seqr}} ($o->{qstart} $o->{qend}) $qref->{tedge} |$o->{qasml} $o->{qasmr}|\n";
+ print "\n";
+
+ foreach my $ref ($rref, $qref)
+ {
+ my $type = $ref eq $rref ? "r" : "q";
+ my $rc = $ref->{rc};
+
+ my $unit = 50;
+
+ my $tedge = $ref->{tedge};
+
+
+ my %display = ("a" => ["(",")"],
+ "t" => [$ref->{contig}->{overlapside}, "+"]);
+
+ my %values = ("astart" => $o->{$type."start"},
+ "aend" => $o->{$type."end"});
+
+ if ($ref->{cons})
+ {
+ $values{"fstart"} = 1;
+ $values{"fend"} = $ref->{size};
+
+ $values{"tstart"} = $tedge;
+
+ $display{"f"} = ["[","]"];
+ $unit = $ref->{len} / 40;
+ }
+ else
+ {
+ ## Cap the distance to edge by about 1 readlen
+ $tedge = 2000 if ($tedge > 2000);
+ $tedge = -1000 if ($tedge < -1000);
+
+ $display{"c"} = ["{","}"];
+ $display{"s"} = ["|=","=>"];
+
+ $values{"cstart"} = $ref->{seql};
+ $values{"cend"} = $ref->{seqr};
+
+ $values{"sstart"} = 1;
+ $values{"send"} = $ref->{size};
+
+ $values{"tstart"} = $tedge;
+ }
+
+ my $pos = undef;
+
+ foreach my $key (sort {$values{$ref->{dir} ? $b : $a} <=>
+ $values{$ref->{dir} ? $a : $b}}
+ keys %values)
+ {
+ my $char = $1 if ($key =~ /^(\S)/);
+
+ if (defined $pos)
+ {
+ my $space = int(abs($values{$key} - $pos) / $unit);
+ print " "x$space;
+ }
+
+ $pos = $values{$key};
+
+ if (!defined $display{$char}->[2])
+ {
+ $display{$char}->[2] = 1;
+
+ if ($key eq "sstart") { print "|="; }
+ elsif ($key eq "send") { print "<=" }
+ else { print $display{$char}->[0]; }
+ }
+ else
+ {
+ if ($key eq "sstart") { print "=|"; }
+ elsif ($key eq "send") { print "=>" }
+ else { print $display{$char}->[1]; }
+ }
+ }
+
+ print "\n";
+ }
+}
+
+
+sub evaluateOverlap
+{
+ my ($o) = @_;
+
+ my $rref = $o->{rref};
+ my $qref = $o->{qref};
+
+ echo "Eval:";
+ my $bad = "!\n\n";
+
+ echo " id";
+ my $idscore = $o->{idscore};
+ $idscore =~ s/[^\d\.]//g;
+ if (0 && $idscore < $MINIDSCORE)
+ {
+ echo $bad; return 0;
+ }
+
+ echo " len";
+ if (0 && $o->{iddist} < $MINMATCHLEN)
+ {
+ echo $bad; return 0;
+ }
+
+ echo " dir";
+ if (($rref->{contig}->{oo} ^ $qref->{contig}->{oo}) ^
+ ($o->{rdir} ^ $o->{qdir}))
+ {
+ echo $bad; return 0;
+ }
+
+ my ($rhang, $qhang); ## Amount of hanging consensus created by alignment
+ my ($rdist, $qdist); ## Gap distance measures
+ my ($r3, $q3); ## Alignment requires 3' extension (bad)
+ my ($r5, $q5); ## Alignment requires 5' extension
+ my ($rex, $qex); ## Alignment requires contig extension
+
+ my $d = 0;
+ my $cpos = 0;
+
+ my ($rasml, $rasmr);
+ my ($qasml, $qasmr);
+
+ echo " t";
+ if (!$rref->{contig}->{oo})
+ {
+ if (!$rref->{rc})
+ {
+ echo "1";
+
+ $d = $rref->{seqr} - $o->{rend};
+ $rasmr = $rref->{asmr} - $d;
+
+ $d = $rref->{seqr} - $o->{rstart};
+ $rasml = $rref->{asmr} - $d;
+
+ $rhang = $rref->{contig}->{len} - $rasmr;
+ $rdist = -$rhang;
+
+ $r3 = ($o->{rend} - $MINOVERLAP) < $rref->{seql};
+ $r5 = ($o->{rstart} + $MINOVERLAP) > $rref->{seqr};
+ $rex = ($o->{rstart} + $MINOVERLAP) > $rref->{tedge};
+ }
+ else
+ {
+ echo "2";
+
+ $d = $o->{rstart} - $rref->{seqr};
+ $rasmr = $rref->{asmr} - $d;
+
+ $d = $o->{rend} - $rref->{seqr};
+ $rasml = $rref->{asmr} - $d;
+
+ $rhang = $rref->{contig}->{len} - $rasmr;
+ $rdist = -$rhang;
+
+ $r3 = ($o->{rend} - $MINOVERLAP) < $rref->{seqr};
+ $r5 = ($o->{rstart} + $MINOVERLAP) > $rref->{seql};
+ $rex = 0;
+ }
+ }
+ else
+ {
+ if (!$rref->{rc})
+ {
+ echo "3";
+
+ $d = $o->{rstart} - $rref->{seql};
+ $rasml = $rref->{asml} + $d;
+
+ $d = $o->{rend} - $rref->{seql};
+ $rasmr = $rref->{asml} + $d;
+
+ $rhang = $rasml;
+ $rdist = -$rhang;
+
+ $r3 = ($o->{rend} - $MINOVERLAP) < $rref->{seql};
+ $r5 = ($o->{rstart} + $MINOVERLAP) > $rref->{seqr};
+ $rex = 0;
+ }
+ else
+ {
+ echo "4";
+
+ $d = $rref->{seql} - $o->{rend};
+ $rasml = $rref->{asml} + $d;
+
+ $d = $rref->{seql} - $o->{rstart};
+ $rasmr = $rref->{asml} + $d;
+
+ $rhang = $rasml;
+ $rdist = -$rhang;
+
+ $r3 = ($o->{rend} - $MINOVERLAP) < $rref->{seqr};
+ $r5 = ($o->{rstart} + $MINOVERLAP) > $rref->{seql};
+ $rex = ($o->{rstart} + $MINOVERLAP) > $rref->{tedge};
+ }
+ }
+
+
+ if (!$qref->{contig}->{oo})
+ {
+ if (!$o->{qrc})
+ {
+ if (!$qref->{rc})
+ {
+ echo "5";
+
+ $d = $o->{qstart} - $qref->{seql};
+ $qasml = $qref->{asml} + $d;
+ $qhang = $qasml;
+
+ $d = $o->{qend} - $qref->{seql};
+ $qasmr = $qref->{asml} + $d;
+ $qdist = -$qasmr;
+
+ $q3 = ($o->{qend} - $MINOVERLAP) < $qref->{seql};
+ $q5 = ($o->{qstart} + $MINOVERLAP) > $qref->{seqr};
+ $qex = 0;
+ }
+ else
+ {
+ echo "6";
+
+ $d = $qref->{seql} - $o->{qend};
+ $qasml = $qref->{asml} + $d;
+ $qhang = $qasml;
+
+ $d = $qref->{seql} - $o->{qstart};
+ $qasmr = $qref->{asml} + $d;
+ $qdist = -$qasmr;
+
+ $q3 = ($o->{qend} - $MINOVERLAP) < $qref->{seqr};
+ $q5 = ($o->{qend} + $MINOVERLAP) > $qref->{seql};
+ $qex = ($o->{qend} + $MINOVERLAP) > $qref->{tedge};
+ }
+ }
+ else
+ {
+ if (!$qref->{rc})
+ {
+ echo "7";
+
+ $d = $o->{qend} - $qref->{seql};
+ $qasml = $qref->{asml} + $d;
+ $qhang = $qasml;
+
+ $d = $o->{qstart} - $qref->{seql};
+ $qasmr = $qref->{asml} + $d;
+ $qdist = -$qasmr;
+
+ $q3 = ($o->{qstart} - $MINOVERLAP) < $qref->{seql};
+ $q5 = ($o->{qend} + $MINOVERLAP) > $qref->{seqr};
+ $qex = 0;
+ }
+ else
+ {
+ echo "8";
+
+ $d = $qref->{seql} - $o->{qstart};
+ $qasml = $qref->{asml} + $d;
+ $qhang = $qasml;
+
+ $d = $qref->{seql} - $o->{qend};
+ $qasmr = $qref->{asml} + $d;
+ $qdist = -$qasmr;
+
+ $q3 = ($o->{qstart} - $MINOVERLAP) < $qref->{seqr};
+ $q5 = ($o->{qend} + $MINOVERLAP) > $qref->{seql};
+ $qex = ($o->{qend} + $MINOVERLAP) > $qref->{tedge};
+ }
+ }
+ }
+ else
+ {
+ if (!$o->{qrc})
+ {
+ if (!$qref->{rc})
+ {
+ echo "9";
+
+ $d = $qref->{seqr} - $o->{qend};
+ $qasmr = $qref->{asmr} - $d;
+ $qhang = $qref->{contig}->{len} - $qasmr;
+
+ $d = $qref->{seqr} - $o->{qstart};
+ $qasml = $qref->{asmr} - $d;
+ $qdist = $qasml - $qref->{contig}->{len};
+
+ $q3 = ($o->{qend} - $MINOVERLAP) < $qref->{seql};
+ $q5 = ($o->{qstart} + $MINOVERLAP) > $qref->{seqr};
+ $qex = ($o->{qstart} + $MINOVERLAP) > $qref->{tedge};
+ }
+ else
+ {
+ echo "10";
+
+ $d = $o->{qstart} - $qref->{seqr};
+ $qasmr = $qref->{asmr} - $d;
+ $qhang = $qref->{contig}->{len} - $qasmr;
+
+ $d = $o->{qend} - $qref->{seqr};
+ $qasml = $qref->{asmr} - $d;
+ $qdist = $qasml - $qref->{contig}->{len};
+
+ $q3 = ($o->{qend} - $MINOVERLAP) < $qref->{seqr};
+ $q5 = ($o->{qstart} + $MINOVERLAP) > $qref->{seql};
+ $qex = 0;
+ }
+ }
+ else
+ {
+ if (!$qref->{rc})
+ {
+ echo "11";
+
+ $d = $qref->{seqr} - $o->{qstart};
+ $qasmr = $qref->{asmr} - $d;
+ $qhang = $qref->{contig}->{len} - $qasmr;
+
+ $d = $qref->{seqr} - $o->{qend};
+ $qasml = $qref->{asmr} - $d;
+ $qdist = $qasml - $qref->{contig}->{len};
+
+ $q3 = ($o->{qstart} - $MINOVERLAP) < $qref->{seql};
+ $q5 = ($o->{qend} + $MINOVERLAP) > $qref->{seqr};
+ $qex = ($o->{qend} + $MINOVERLAP) > $qref->{tedge};
+ }
+ else
+ {
+ echo "12";
+
+ $d = $o->{qend} - $qref->{seqr};
+ $qasmr = $qref->{asmr} - $d;
+ $qhang = $qref->{contig}->{len} - $qasmr;
+
+ $d = $o->{qstart} - $qref->{seqr};
+ $qasml = $qref->{asmr} - $d;
+ $qdist = $qasml - $qref->{contig}->{len};
+
+ $q3 = ($o->{qstart} - $MINOVERLAP) < $qref->{seqr};
+ $q5 = ($o->{qend} + $MINOVERLAP) > $qref->{seql};
+ $qex = 0;
+ }
+ }
+ }
+
+ $o->{rasml} = $rasml;
+ $o->{rasmr} = $rasmr;
+ $o->{qasml} = $qasml;
+ $o->{qasmr} = $qasmr;
+
+ echo "($rhang $qhang)";
+
+ if ($rhang < 0) { $rhang = 0; }
+ if ($qhang < 0) { $qhang = 0; }
+
+ $rhang += $qhang;
+ $o->{overhang} = $rhang;
+
+ if ($rhang > $MAXOVERHANG)
+ {
+ echo $bad; return 0;
+ }
+
+ #echo " oh";
+ #if ($o->{overhang} > $o->{iddist})
+ #{
+ # echo $bad; return 0;
+ #}
+
+ my $gapsize = $rdist + $qdist;
+ echo " gap($rdist,$qdist,$gapsize)";
+ $o->{gapsize} = $gapsize;
+ if ($gapsize > $MAXGAPSIZE)
+ {
+ echo $bad; return 0;
+ }
+
+ $r3 = ($r3) ? "r" : "";
+ $q3 = ($q3) ? "q" : "";
+
+ echo " 3'($r3$q3)";
+ if ($r3 || $q3)
+ {
+ echo $bad; return 0;
+ }
+
+ ## Can't extend just the consensus
+ $r5 &= !$rref->{cons};
+ $q5 &= !$qref->{cons};
+
+ $o->{r5} = $r5;
+ $o->{q5} = $q5;
+
+
+ $r5 = ($r5) ? "r" : "";
+ $q5 = ($q5) ? "q" : "";
+
+ $rex = ($rex) ? "r" : "";
+ $qex = ($qex) ? "q" : "";
+
+ $o->{rex} = $rex;
+ $o->{qex} = $qex;
+
+ echo " 5'($r5$q5)";
+ echo " ex($rex$qex)";
+
+ echo " success.\n\n"; return 1;
+}
+
+sub filterOverlaps
+{
+ my $goodoverlaps = shift;
+ my $alloverlaps = shift;
+
+ ## Detect multiple overlaps between pairs of reads
+ for (my $i = 0; $i < scalar @$goodoverlaps; $i++)
+ {
+ my $o = $goodoverlaps->[$i];
+ next if $o->{dup};
+ next if ($o->{cons} == 2);
+
+ for (my $j = $i+1; $j < scalar @$goodoverlaps; $j++)
+ {
+ my $p = $goodoverlaps->[$j];
+
+ next if ($p->{cons} == 2);
+
+ if (($o->{rref} eq $p->{rref}) &&
+ ($o->{qref} eq $p->{qref}))
+ {
+ $o->{dup} = 1;
+ $p->{dup} = 1;
+ }
+ }
+ }
+
+ ## Detect multiple overlaps between pairs of reads
+ for (my $i = 0; $i < scalar @$goodoverlaps; $i++)
+ {
+ my $o = $goodoverlaps->[$i];
+ next if $o->{dup};
+ next if ($o->{cons} == 2);
+
+ for (my $j = 0; $j < scalar @$alloverlaps; $j++)
+ {
+ my $p = $alloverlaps->[$j];
+
+ next if ($p->{cons} == 2);
+
+ if (($o->{rref} eq $p->{rref}) &&
+ ($o->{qref} eq $p->{qref}) &&
+ ($o->{id} != $p->{id}))
+ {
+ $o->{dup} = 1;
+ $p->{dup} = 1;
+ }
+ }
+ }
+}
+
+sub groupOverlapsGapSize
+{
+ my $goodoverlaps = shift;
+
+ my $groups = undef;
+
+ foreach my $o (@$goodoverlaps)
+ {
+ my $mygroup = undef;
+
+ foreach my $group (@$groups)
+ {
+ if (abs($o->{gapsize} - $group->{gap}) < $GAPSIZE_PARTITION)
+ {
+ $mygroup = $group;
+ last;
+ }
+ }
+
+ if (!defined $mygroup)
+ {
+ ## Force $mygroup to become a hash reference
+ $mygroup->{count} = 0;
+ push @$groups, $mygroup;
+ }
+
+ push @{$mygroup->{overlaps}}, $o;
+
+ $mygroup->{count}++;
+ $mygroup->{gapsum} += $o->{gapsize};
+ $mygroup->{gap} = sprintf("%.02f", ($mygroup->{gapsum} / $mygroup->{count}));
+ }
+
+ return $groups;
+}
+
+sub hasOverlap
+{
+ my ($o, $p) = @_;
+
+ my $retval = 1;
+
+ if (($p->{rasmr} < $o->{rasml}) || ## p_r left flanks
+ ($o->{rasmr} < $p->{rasml})) ## o_r left flanks
+ {
+ $retval = 0;
+ }
+
+ if (($p->{qasmr} < $o->{qasml}) ||
+ ($o->{qasmr} < $p->{qasml}))
+ {
+ $retval = 0;
+ }
+
+ return $retval;
+}
+
+sub groupOverlapsOverlap
+{
+ my $goodoverlaps = shift;
+
+ my $groups = undef;
+
+ for (my $i=0; $i < scalar @$goodoverlaps; $i++)
+ {
+# print "i: $i\n";
+ next if !defined $goodoverlaps->[$i];
+
+ my $goverlaps = [ $goodoverlaps->[$i] ];
+ $goodoverlaps->[$i] = undef;
+
+ my $foundoverlap = 1;
+ while ($foundoverlap)
+ {
+ $foundoverlap = 0;
+
+ for (my $j=$i+1; $j<scalar @$goodoverlaps; $j++)
+ {
+ my $p = $goodoverlaps->[$j];
+ next if !defined $p;
+
+ foreach my $o (@$goverlaps)
+ {
+ if (hasOverlap($o, $p))
+ {
+ push @$goverlaps, $p;
+
+ $goodoverlaps->[$j] = undef;
+ $foundoverlap++;
+ last;
+ }
+ }
+ }
+ }
+
+ my $curgroup;
+ $curgroup->{overlaps} = $goverlaps;
+ push @$groups, $curgroup;
+ }
+
+ return $groups
+}
+
+sub evaluateGroup
+{
+ my $curgroup = shift;
+
+ my $bad = 0;
+
+ ## 60% of overlaps are dups
+ my $dupcount = grep {$_->{dup}} @{$curgroup->{overlaps}};
+ $bad ||= ($dupcount >= .60*$curgroup->{count});
+
+ ## Overlap entirely based on consensus (NUU)
+ $bad ||= !(grep {$_->{cons} != 2} @{$curgroup->{overlaps}});
+
+ ## More bases against join than supporting it
+ $bad ||= (2*$curgroup->{overhang} > $curgroup->{iddist});
+
+ ## Not enough matching bases in absolute sense.
+ $bad ||= ($curgroup->{best}->{iddist} < $MINMATCHLEN);
+
+ ## Poor match score
+ $bad ||= ($curgroup->{best}->{idscore} < $ALIGNTHRESH);
+
+ return $bad;
+}
+
+sub evaluateGroups
+{
+ my $groups = shift;
+
+ my $numgood = 0;
+ foreach my $g (@$groups)
+ {
+ my @overlaps = sort { $b->{cons} <=> $a->{cons} ||
+ $a->{overhang} <=> $b->{overhang} ||
+ $b->{iddist} <=> $a->{iddist} } @{$g->{overlaps}};
+
+
+ ## The best overlap defines the attributes for the entire group
+ my $best = $overlaps[0]; ## There is at least one member
+ $g->{best} = $best;
+ $g->{overhang} = $best->{overhang};
+ $g->{iddist} = $best->{iddist};
+ $g->{gap} = $best->{gapsize};
+ $g->{count} = scalar @overlaps;
+ $g->{idscore} = $best->{idscore};
+
+ $g->{support} = $g->{iddist} - 2*$g->{overhang};
+
+ @{$g->{overlaps}} = @overlaps;
+
+ my $bad = evaluateGroup($g);
+ $g->{bad} = $bad;
+ $numgood += !$bad;
+ }
+
+# print STDERR "Numgood: $numgood\n" if ($numgood > 1);
+}
+
+sub printExecution
+{
+ my $o = shift;
+ my $rref = $o->{rref};
+ my $qref = $o->{qref};
+
+ my $rdelta = $o->{rmax} - $rref->{seqmax};
+ my $qdelta = $o->{qmax} - $qref->{seqmax};
+
+ my $cmd = "$rref->{contig}->{prefix} $rref->{contig}->{oo} ".
+ "$qref->{contig}->{prefix} $qref->{contig}->{oo}";
+
+ if ($rdelta > 0)
+ {
+ $cmd .= " rex $rref->{seqname} $rdelta";
+ }
+
+ if ($qdelta > 0)
+ {
+ $cmd .= " qex $qref->{seqname} $qdelta";
+ }
+
+ print "@=$cmd\n";
+}
+
+sub printGroups
+{
+ my $rcontig = shift;
+ my $qcontig = shift;
+
+ my $groups = shift;
+ my $gapsize = shift;
+ my $gapstdev = shift;
+
+ return if !defined $groups;
+
+ my $r = $rcontig->{prefix};
+ my $roo = ($rcontig->{oo}) ? "EB" : "BE";
+
+ my $q = $qcontig->{prefix};
+ my $qoo = $qcontig->{oo} ? "EB" : "BE";
+
+ $doverbose = 1;
+
+ print "\@$r($roo) <-> $q($qoo) $gapsize \[$gapstdev\]\n";
+ print "\@-------------------\n";
+
+ my $num = 0;
+ foreach my $g (sort { $a->{bad} <=> $b->{bad} ||
+ $b->{support} <=> $a->{support} ||
+ $a->{overhang} <=> $b->{overhang} ||
+ $b->{iddist} <=> $a->{iddist} } @$groups)
+ {
+ my $bad = ($g->{bad}) ? "x" : "";
+ $num++;
+
+ print "\@$bad$num: Gap: $g->{gap} Id*Dist: $g->{iddist} ($g->{idscore}%) Overhang: $g->{overhang} (";
+ print join(",", map{my $cons = $_->{consd};
+ my $dup = ($_->{dup}) ? "x" : "";
+ "$dup$_->{gapsize}$cons"} @{$g->{overlaps}}), ")\n";
+
+ if (!$bad)
+ {
+ my $best = $g->{best};
+ printOverlap($best);
+ evaluateOverlap($best);
+ printExecution($best);
+
+ if (0)
+ {
+ foreach my $o (@{$g->{overlaps}})
+ {
+ printOverlap($o);
+ evaluateOverlap($o);
+ }
+ }
+ }
+ }
+
+ print "\@\n\@\n";
+}
+
+
+
+MAIN:
+{
+ my $gapsize = "";
+ my $gapstdev = "";
+
+ $tf->addDependInfo(@DEPENDS);
+ $tf->setHelpInfo($HELPTEXT);
+ $tf->setVersionInfo($VERSION);
+
+
+ # now we handle the input options
+ my $result = $tf->TIGR_GetOptions
+ (
+ 'v|verbose!', \$PRINTALL,
+ 'gapsize=s', \$gapsize,
+ 'gapstdev=s', \$gapstdev,
+ 'alignthresh=s', \$ALIGNTHRESH,
+ );
+
+ $tf->bail("Command line parsing failed") if (!$result);
+
+ my $roo = shift @ARGV;
+ my $qoo = shift @ARGV;
+ my $coords = shift @ARGV;
+
+ die $USAGE if !defined $coords;
+
+ my $id = 1;
+
+ my $goodoverlaps = undef;
+ my $alloverlaps = undef;
+ my $inalignment=0;
+
+ open COORDS, "< $coords"
+ or $tf->bail("Can't open $coords ($!)\n");
+
+ while (<COORDS>)
+ {
+ chomp;
+
+ if (!$inalignment)
+ {
+ if (/=====/) { $inalignment = 1; }
+ elsif (!exists $rcontig{prefix})
+ {
+ my ($r, $q) = split / /, $_;
+
+ $rcontig{prefix} = $1 if ($r =~ /\/(\w+)\.\w+$/);
+ $qcontig{prefix} = $1 if ($q =~ /\/(\w+)\.\w+$/);
+
+ getContigInfo(\%rcontig, \%rlayout, "r", $roo);
+ getContigInfo(\%qcontig, \%qlayout, "q", $qoo);
+ }
+ }
+ else
+ {
+ my $o = parseOverlap($id, $_);
+
+ $doverbose = 0 if $PRINTALL;
+ my $goodoverlap = evaluateOverlap($o);
+
+ if ($PRINTALL)
+ {
+ $doverbose = 1;
+ printOverlap($o);
+ evaluateOverlap($o);
+ }
+
+ push @$alloverlaps, $o;
+ push @$goodoverlaps, $o if ($goodoverlap);
+
+ $id++;
+ }
+ }
+ close COORDS;
+
+ if (defined $goodoverlaps)
+ {
+ filterOverlaps($goodoverlaps, $alloverlaps);
+
+ my $groups = groupOverlapsOverlap($goodoverlaps);
+ #my $groups = groupOverlapsGapSize($goodoverlaps);
+
+ evaluateGroups($groups);
+ printGroups(\%rcontig, \%qcontig, $groups, $gapsize, $gapstdev);
+ }
+}
diff --git a/src/Experimental/aj_joinContigs.pl b/src/Experimental/aj_joinContigs.pl
new file mode 100755
index 0000000..05f3137
--- /dev/null
+++ b/src/Experimental/aj_joinContigs.pl
@@ -0,0 +1,712 @@
+#!/usr/bin/perl -w
+
+use strict;
+use TIGR::Foundation;
+use File::Spec;
+use Cwd;
+
+my $FATTENRADIUS = 500;
+
+my $MATCHLEN = 15;
+my $CLUSTERLEN = 30;
+
+my $MATCHLEN2 = 10;
+my $CLUSTERLEN2 = 15;
+
+my $USAGE = "Usage: aj_joinContigs.pl rid roo qid qoo [rex] [qex] [OPTIONS]\n";
+
+my $HELPTEXT = qq~
+Joins contigs together with optional contig extension
+
+ $USAGE
+ rid is the reference contig id
+ roo is the orientation of the reference
+
+ qid is the query contig id
+ qoo is the orientation of the query
+
+ {r,q}id.{contig,qual,seq} must be in cwd or contained in dataprefix
+
+ [rex] specifies optional reference contig extension
+ [qex] specifies optional query contig extension
+
+ [rex] and [qex] format is:
+ [r|q]ex seqname distance
+
+ Options
+ -------
+ -[no]fatten Fatten the join region
+ [DEFAULT: -fatten]
+
+ -id <prefix> Prefix of output contig,seq,qual files
+ [DEFAULT: 'join']
+
+ -dir <dir> Directory to write results
+ [DEFAULT: 'joincontigs']
+
+ -data <prefix> Prefix to master contig,qual,seq input files
+
+ -report <file> Filename of join report
+ [DEFAULT: 'join.report']
+~;
+
+my $VERSION = " Version 1.00 (Build " . (qw/$Revision$/ )[1] . ")";
+
+my $platformbin = "/fs/sz-user-supported/Linux-x86_64/bin";
+my $commonbin = "/fs/sz-user-supported/common/bin";
+
+my $CAT = "/bin/cat";
+my $GETCOVERAGE = "$platformbin/getCoverage";
+my $AUGMENTSLICE = "$platformbin/augmentSlice";
+my $SLICE2FASTA = "$platformbin/slice2fasta";
+my $SLICE2CONTIG = "$platformbin/slice2contig";
+my $NUCMER = "$platformbin/nucmer";
+my $SHOWCOORDS = "$platformbin/show-coords";
+my $ZIPCLAP = "$platformbin/zipclap";
+my $FATTENSLICE = "$platformbin/fattenSlice";
+
+my $SIZEFASTA = "$commonbin/sizeFasta";
+my $FILTERSEQ = "$commonbin/filter_seq";
+my $FILTERCONTIG = "$commonbin/filter_contig";
+
+## TODO: Enable optimize slice
+my $OPTIMIZESLICE = "optimizeSlice";
+
+my @DEPENDS =
+(
+ "TIGR::Foundation",
+ $FILTERSEQ,
+ $FILTERCONTIG,
+ $GETCOVERAGE,
+ $AUGMENTSLICE,
+ $FATTENSLICE,
+ $SLICE2FASTA,
+ $SLICE2CONTIG,
+ $ZIPCLAP,
+ $NUCMER,
+ $SHOWCOORDS,
+ $SIZEFASTA,
+ $CAT,
+);
+
+my $tf = new TIGR::Foundation;
+my $doverbose = 1;
+my $reportsuffix = "report";
+
+sub echo
+{
+ my $str = join " ", @_;
+
+ $tf->logLocal($str, 4);
+ if ($doverbose)
+ {
+ print @_;
+ }
+}
+
+sub runCmd
+{
+ my $cmd = shift;
+ my $info = shift;
+
+ echo "$info... " if defined $info;
+
+ my $exitcode = $tf->runCommand($cmd);
+
+ if ($exitcode)
+ {
+ echo "failed! ($!)\n" if defined $info;
+ $tf->bail("Error with $cmd ($exitcode)");
+ }
+
+ echo "ok.\n" if defined $info;
+}
+
+sub getSize
+{
+ my $id = shift;
+ my $cmd = "$SIZEFASTA $id";
+
+ $tf->logLocal("Running $cmd... ", 4);
+ my $out = `$cmd`;
+
+ if ($?)
+ {
+ echo "failed!\n";
+ $tf->bail("$cmd failed ($?)") if ($?);
+ }
+
+ return (split /\s+/, $out)[1];
+}
+
+sub prepareInputs
+{
+ my $contig = shift;
+ my $origdir = shift;
+ my $data = shift;
+
+ my $id = $contig->{id};
+
+ ## Contig must be first file!
+ foreach my $suffix (qw/contig qual seq/)
+ {
+ if (! -r "$id.$suffix")
+ {
+ if (-r "$origdir/$id.$suffix")
+ {
+ symlink "$origdir/$id.$suffix", "$id.$suffix"
+ or $tf->bail("Can't symlink $origdir/$id.$suffix");
+ }
+ elsif (defined $data)
+ {
+ if (-r "$data.$suffix")
+ {
+ if ($suffix eq "contig")
+ {
+ runCmd("$FILTERCONTIG $data.contig $id > $id.contig")
+ }
+ else
+ {
+ runCmd("$FILTERSEQ $id.contig $data.$suffix > $id.$suffix");
+ }
+ }
+ else
+ {
+ $tf->bail("Can't read $data.$suffix");
+ }
+ }
+ else
+ {
+ $tf->bail("Need input for $id.$suffix");
+ }
+ }
+ }
+
+
+ my $prefix = "$id.aug";
+
+ runCmd("$GETCOVERAGE --silent $id -l -p | $AUGMENTSLICE $id - -o $prefix.slice")
+ if (! -r "$prefix.slice");
+
+ runCmd("ln -s $id.qual $prefix.qual")
+ if (! -r "$prefix.qual");
+
+ $contig->{prefix} = $prefix;
+ $contig->{slice} = "$prefix.slice";
+ $contig->{ex} = 0;
+}
+
+sub extendContig
+{
+ my $results = shift;
+ my $contig = shift;
+ my $type = shift;
+
+ my $id = $contig->{id};
+ my $prefix = "$id.extend";
+ my $report = "$prefix.$reportsuffix";
+
+ $results->{$type."exreport"} = $report;
+
+ if (! -r "$prefix.slice")
+ {
+ my $cmd = "$FATTENSLICE -r $contig->{seqname} -d $contig->{dist} $contig->{slice} -o $prefix.slice 2>$report";
+ my $info = "extending $id";
+ runCmd($cmd, $info);
+ }
+
+ runCmd("ln -s $id.qual $prefix.qual")
+ if (! -r "$prefix.qual");
+
+ if (-r $report)
+ {
+ my $seqname = $contig->{seqname};
+ open REPORT, "< $report"
+ or $tf->bail("Can't open $report ($!)");
+
+ while (<REPORT>)
+ {
+ next if (!/$seqname=/);
+ my ($tag, $values) = split /=/, $_;
+
+ my @vals = split /\s+/, $values;
+ my $consex = $vals[2];
+
+ if ($consex > $contig->{dist})
+ {
+ $tf->logError("Error: consex:$consex > dist:$contig->{dist}\n");
+ $consex = $contig->{dist};
+ }
+
+ $contig->{ex} = $consex;
+ last;
+ }
+ close REPORT;
+ }
+
+ $contig->{prefix} = $prefix;
+ $contig->{slice} = "$prefix.slice";
+}
+
+sub createFasta
+{
+ my $contig = shift;
+ my $prefix = $contig->{prefix};
+
+ runCmd("$SLICE2FASTA -i $contig->{id} $contig->{slice} -o $prefix.fasta")
+ if (! -r "$prefix.fasta");
+
+ $contig->{size} = getSize("$prefix.fasta");
+}
+
+sub max
+{
+ $_[0] > $_[1] ? $_[0] : $_[1];
+}
+
+sub min
+{
+ $_[0] < $_[1] ? $_[0] : $_[1];
+}
+
+sub findChain
+{
+ my $rcontig = shift;
+ my $qcontig = shift;
+ my $coords = shift;
+ my $results = shift;
+
+ my $roo = $rcontig->{oo};
+ my $qoo = $qcontig->{oo};
+
+ my $type;
+
+ my $str = "Finding chain roo: $roo qoo: $qoo type: ";
+ if (!$roo && !$qoo) { $type = 1; $str .= "$type rend:$rcontig->{size} qbegin:1"; }
+ elsif (!$roo && $qoo) { $type = 2; $str .= "$type rend:$rcontig->{size} qbegin:$qcontig->{size}"; }
+ elsif ( $roo && $qoo) { $type = 3; $str .= "$type rbegin:1 qend:$qcontig->{size}";}
+ elsif ( $roo && !$qoo) { $type = 4; $str .= "$type rbegin:1 qend:1";}
+ echo "$str\n";
+
+ open COORDS, "< $coords"
+ or $tf->bail("Can't open $coords ($!)");
+
+ my $inalignment = 0;
+ my $chain = 0;
+
+ my $rangebegin = -1;
+ my $rangeend = -1;
+
+ while (<COORDS>)
+ {
+ if (!$inalignment) { $inalignment = 1 if (/=========/); }
+ else
+ {
+ my @values = split /\s+/, $_;
+
+ my $rbegin = $values[1];
+ my $rend = $values[2];
+
+ my $qbegin = $values[4];
+ my $qend = $values[5];
+
+ my $rlen = $values[7];
+ my $qlen = $values[8];
+
+ my $idscore = $values[10];
+
+ my $valid = 0;
+
+ #echo "$chain: r:[$rbegin,$rend] q:[$qbegin,$qend]\n";
+
+ if ($type == 1)
+ {
+ if ($rend == $rcontig->{size} && $qbegin == 1)
+ {
+ $rangebegin = min($rbegin, $rcontig->{size}-$rcontig->{ex});
+ $rangeend = -($qcontig->{size} - max($qend, $qcontig->{ex}));
+
+ $valid = 1;
+ }
+ }
+ elsif ($type == 2)
+ {
+ if ($rend == $rcontig->{size} && $qbegin == $qcontig->{size})
+ {
+ $rangebegin = min($rbegin, $rcontig->{size}-$rcontig->{ex});
+ $rangeend = -min($qend, $qcontig->{size}-$qcontig->{ex});
+
+ $valid = 1;
+ }
+ }
+ elsif ($type == 3)
+ {
+ if ($rbegin == 1 && $qend == $qcontig->{size})
+ {
+ $rangebegin = min($qbegin, $qcontig->{size}-$qcontig->{ex});
+ $rangeend = -($rcontig->{size} - max($rend, $rcontig->{ex}));
+
+ $valid = 1;
+ }
+ }
+ elsif ($type == 4)
+ {
+ if ($rbegin == 1 && $qend == 1)
+ {
+ $rangebegin = $qcontig->{size} - max($qbegin, $qcontig->{ex});
+ $rangeend = -($rcontig->{size} - max($rend, $rcontig->{ex}));
+
+ $valid = 1;
+ }
+ }
+
+ if ($valid)
+ {
+ echo "$chain: r:[$rbegin,$rend] q:[$qbegin,$qend]\n";
+
+ $results->{rangebegin} = $rangebegin;
+ $results->{rangeend} = $rangeend;
+ $results->{chain} = $chain;
+ $results->{idscore} = $idscore;
+ $results->{rex} = $rcontig->{ex};
+ $results->{qex} = $qcontig->{ex};
+
+ $results->{extension} = $results->{rex} + $results->{qex};
+ $results->{olen} = ($rlen + $qlen) / 2;
+ $results->{gapsize} = $results->{extension} - $results->{olen};
+
+ return $chain;
+ }
+
+ $chain++;
+ }
+ }
+
+ echo "Can't find usable chain\n";
+ return -1;
+}
+
+
+
+sub alignContigs
+{
+ my $rcontig = shift;
+ my $qcontig = shift;
+ my $results = shift;
+
+ createFasta($rcontig);
+ createFasta($qcontig);
+
+ my $rprefix = $rcontig->{prefix};
+ my $qprefix = $qcontig->{prefix};
+
+ my $prefix = $results->{sliceprefix};
+ my $deltafile = "$prefix.delta";
+ my $coords = "$prefix.coords";
+
+ if (! -r $deltafile)
+ {
+ my $cmd = "$NUCMER $rprefix.fasta $qprefix.fasta --nooptimize --maxmatch -l $MATCHLEN -c $CLUSTERLEN -p $prefix 2> /dev/null";
+ runCmd($cmd, "nucmer");
+ }
+
+ runCmd("$SHOWCOORDS $deltafile > $coords")
+ if (! -r $coords);
+
+ my $chain = findChain($rcontig, $qcontig, $coords, $results);
+
+ if ($chain == -1)
+ {
+ my $cmd = "$NUCMER $rprefix.fasta $qprefix.fasta --nooptimize --maxmatch -l $MATCHLEN2 -c $CLUSTERLEN2 -p $prefix 2> /dev/null";
+ runCmd($cmd, "nucmer2");
+
+ runCmd("$SHOWCOORDS $deltafile > $coords");
+
+ $chain = findChain($rcontig, $qcontig, $coords, $results);
+
+ $tf->bail("Can't find usable chain after two attempts\n", 2)
+ if ($chain == -1);
+ }
+
+ return $chain;
+}
+
+sub joinContigs
+{
+ my $rcontig = shift;
+ my $qcontig = shift;
+ my $results = shift;
+
+ my $rid = $rcontig->{id};
+ my $qid = $qcontig->{id};
+
+ $results->{reference} = $rid;
+ $results->{query} = $qid;
+
+ my $prefix = "aj-$rid-$qid";
+ $results->{sliceprefix} = $prefix;
+
+ my $chain = alignContigs($rcontig, $qcontig, $results);
+
+ if (! -r "$prefix.slice")
+ {
+ ## Create a fasta so the size can be found, but this won't exactly be the fasta of the final contig
+ my $cmd = "$ZIPCLAP $rcontig->{slice} $qcontig->{slice} -c $chain -o $prefix --nocontig --fasta --debug 4";
+ runCmd($cmd, "zipclap");
+ }
+
+ $results->{joinlen} = getSize("$prefix.fasta");
+ $results->{joinbegin} = $results->{rangebegin};
+ $results->{joinend} = $results->{joinlen} + $results->{rangeend};
+
+ $results->{finalbegin} = $results->{joinbegin};
+ $results->{finalend} = $results->{joinend};
+
+}
+
+##TODO: Make fattenslice smarter,
+## so there won't be as much wiggle on the fatten region
+sub fattenJoin
+{
+ my $results = shift;
+
+ my $prefix = $results->{sliceprefix};
+ my $fprefix = "$prefix.fatten";
+
+ my $fattenreport = "fatten.$reportsuffix";
+ $results->{fattenreport} = $fattenreport;
+
+ $results->{finalbegin} = max($results->{joinbegin} - $FATTENRADIUS, 1);
+ $results->{finalend} = min($results->{joinend} + $FATTENRADIUS, $results->{joinlen});
+
+ if (! -r "$fprefix.slice")
+ {
+ my $cmd = "$FATTENSLICE $prefix.slice -o $fprefix.slice -U -x $results->{finalbegin} -y $results->{finalend} 2> $fattenreport";
+ runCmd($cmd, "fattenSlice");
+ }
+
+ $results->{sliceprefix} = $fprefix;
+}
+
+##TODO: Enable optimizing
+sub optimizeJoin
+{
+ my $results = shift;
+
+ my $prefix = $results->{sliceprefix};
+ my $oprefix = "$prefix.opt";
+
+ if (! -r "$oprefix.slice")
+ {
+ my $cmd = "$OPTIMIZESLICE $prefix.slice -o $oprefix.slice";
+ runCmd($cmd, "optimizeSlice");
+ }
+
+ $results->{sliceprefix} = $oprefix;
+}
+
+sub finalizeResults
+{
+ my $results = shift;
+ my $dotcov = shift;
+
+ my $prefix = $results->{joinid};
+ my $slice = $results->{sliceprefix};
+
+ runCmd("$SLICE2CONTIG $slice.slice -o $prefix.contig -i $prefix", "slice2contig")
+ if (! -r "$prefix.contig");
+
+ runCmd("$SLICE2FASTA $slice.slice -o $prefix.fasta -i $prefix")
+ if (! -r "$prefix.fasta");
+
+ my $qid = $results->{query};
+ my $rid = $results->{reference};
+
+ runCmd("$CAT $rid.qual $qid.qual > $prefix.qual")
+ if (! -r "$prefix.qual");
+
+ if (! -r "$prefix.seq")
+ {
+ open OSEQ, "> $prefix.seq"
+ or $tf->bail("Can't open $prefix.seq for writing ($!)");
+
+ my %contig;
+ open CONTIG, "< $prefix.contig"
+ or $tf->bail("Can't open $prefix.contig for reading ($!)");
+
+ while (<CONTIG>)
+ {
+ next if ((! /^#/) || (/^##/));
+
+ if (/^#(\S+)\(.*{(\d+) (\d+)}/)
+ {
+ my $seqname = $1;
+ my $clr1 = $2;
+ my $clr2 = $3;
+
+ if ($clr2 < $clr1)
+ {
+ my $t = $clr1;
+ $clr1 = $clr2;
+ $clr2 = $t;
+ }
+
+ $contig{$seqname}->{clr1} = $clr1;
+ $contig{$seqname}->{clr2} = $clr2;
+ }
+ }
+
+ close CONTIG;
+
+ foreach my $id ($rid, $qid)
+ {
+ open SEQ, "< $id.seq"
+ or $tf->bail("Can't open $id.seq for reading ($!)");
+
+ while (<SEQ>)
+ {
+ if (/>(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/)
+ {
+ if (exists $contig{$1})
+ {
+ my $clr1 = $contig{$1}->{clr1};
+ my $clr2 = $contig{$1}->{clr2};
+
+ if ($clr1 > $5) { $clr1 = $5 };
+ if ($clr2 < $6) { $clr2 = $6 };
+
+ $tf->logLocal("Extending clear range for $1", 4);
+ print OSEQ ">$1 $2 $3 $4 $clr1 $clr2\n";
+ }
+ else
+ {
+ print OSEQ $_;
+ }
+ }
+ else
+ {
+ print OSEQ $_;
+ }
+ }
+
+ close SEQ;
+ }
+
+ close OSEQ;
+ }
+
+ runCmd("$GETCOVERAGE -t $prefix --silent")
+ if ($dotcov && ! -r "$prefix.tcov");
+}
+
+sub printJoinReport
+{
+ my $results = shift;
+
+ open JOINREPORT, "> $results->{joinreport}"
+ or $tf->bail("Can't open $results->{joinreport} ($!)");
+
+ delete $results->{joinreport};
+
+ foreach my $key (sort keys %{$results})
+ {
+ print JOINREPORT "$key=$results->{$key}\n";
+ }
+
+ close JOINREPORT;
+}
+
+
+
+MAIN:
+{
+ my $dofatten = 1;
+ my $outdir = "joincontigs";
+ my $outprefix = "join";
+ my $dotcov = 0;
+
+ my $data = undef;
+ my $report = "$outprefix.$reportsuffix";
+
+ $tf->addDependInfo(@DEPENDS);
+ $tf->setHelpInfo($HELPTEXT);
+ $tf->setVersionInfo($VERSION);
+
+ # now we handle the input options
+ my $result = $tf->TIGR_GetOptions
+ (
+ 'v|verbose!', \$doverbose,
+ 'fatten!', \$dofatten,
+ 'tcov!', \$dotcov,
+ 'dir=s', \$outdir,
+ 'id=s', \$outprefix,
+ 'data=s', \$data,
+ 'report=s', \$report,
+ );
+
+ $tf->bail("Command line parsing failed") if (!$result);
+
+ my $results;
+ $results->{joinid} = $outprefix;
+ $results->{joinreport} = $report;
+
+ my $rcontig;
+ $rcontig->{id} = shift @ARGV;
+ $rcontig->{oo} = shift @ARGV;
+ $rcontig->{ex} = 0;
+
+ my $qcontig;
+ $qcontig->{id} = shift @ARGV;
+ $qcontig->{oo} = shift @ARGV;
+ $qcontig->{ex} = 0;
+
+ die $USAGE if (!defined $qcontig->{oo});
+
+ my $debug = $tf->getDebugLevel();
+ $tf->setDebugLevel(4) if (!$debug);
+
+ while (defined (my $ex = shift @ARGV))
+ {
+ my $seqname = shift @ARGV;
+ my $dist = shift @ARGV;
+
+ my $contig = undef;
+
+ if ($ex eq "rex") { $contig = $rcontig; }
+ elsif ($ex eq "qex") { $contig = $qcontig; }
+ else { die $USAGE; }
+
+ if (exists $contig->{seqname}) { die $USAGE; }
+
+ $contig->{seqname} = $seqname;
+ $contig->{dist} = $dist;
+ }
+
+ $data = File::Spec->rel2abs($data) if defined $data;
+
+ my $origdir = cwd;
+
+ mkdir $outdir if ! -r $outdir;
+ chdir $outdir;
+
+ ## origdir should just be ..
+ $origdir = File::Spec->abs2rel($origdir);
+ $data = File::Spec->abs2rel($data) if defined $data;
+
+ echo "prepare inputs for joining... ";
+ prepareInputs($rcontig, $origdir, $data);
+ prepareInputs($qcontig, $origdir, $data);
+ echo "ok.\n";
+
+ extendContig($results, $rcontig, "r") if (defined $rcontig->{seqname});
+ extendContig($results, $qcontig, "q") if (defined $qcontig->{seqname});
+
+ joinContigs($rcontig, $qcontig, $results);
+
+ fattenJoin($results) if ($dofatten);
+
+ finalizeResults($results, $dotcov);
+
+ printJoinReport($results);
+}
+
diff --git a/src/Experimental/aj_lowcomplexityfilter.pl b/src/Experimental/aj_lowcomplexityfilter.pl
new file mode 100755
index 0000000..faf89ac
--- /dev/null
+++ b/src/Experimental/aj_lowcomplexityfilter.pl
@@ -0,0 +1,73 @@
+#!/usr/bin/perl -w
+use strict;
+use TIGR::Foundation;
+
+my $USAGE = "Usage: aj_lowcomplexityfilter infile outfile\n";
+
+my $HELPTEXT = qq~
+Strip low complexity sequence from a multifasta file.
+
+ $USAGE
+~;
+
+my $VERSION = " Version 1.00 (Build " . (qw/$Revision$/ )[1] . ")";
+
+my $DUST = "dust";
+
+my @DEPENDS =
+(
+ "TIGR::Foundation",
+ "dust",
+);
+
+my $DOVERBOSE = 1;
+
+my $tf = new TIGR::Foundation;
+
+sub echo
+{
+ my $str = join " ", @_;
+
+ $tf->logLocal($str, 4);
+ print @_ if ($DOVERBOSE);
+}
+
+sub runCmd
+{
+ my $cmd = shift;
+ my $info = shift;
+
+ echo "$info... " if defined $info;
+
+ my $exitcode = $tf->runCommand($cmd);
+
+ if ($exitcode)
+ {
+ echo "failed! ($!)\n" if defined $info;
+ $tf->bail("Error with $cmd ($exitcode)");
+ }
+
+ echo "ok.\n" if defined $info;
+}
+
+
+
+
+MAIN:
+{
+ $tf->addDependInfo(@DEPENDS);
+ $tf->setHelpInfo($HELPTEXT);
+ $tf->setVersionInfo($VERSION);
+ my $result = $tf->TIGR_GetOptions();
+ $tf->bail("Command line parsing failed") if (!$result);
+
+ my $infile = shift @ARGV or die $USAGE;
+ my $outfile = shift @ARGV or die $USAGE;
+
+ runCmd("$DUST $infile > $outfile");
+
+ ## TODO: After running dust, scan the sequence, and after some number of
+ ## consequtive N's in a row, do a hard trim of the sequence. This may help
+ ## in the case where nucmer finds an alignment after the low complexity
+ ## sequence
+}
diff --git a/src/Experimental/aj_scaff2amos.pl b/src/Experimental/aj_scaff2amos.pl
new file mode 100755
index 0000000..f6849b3
--- /dev/null
+++ b/src/Experimental/aj_scaff2amos.pl
@@ -0,0 +1,69 @@
+#!/usr/bin/perl -w
+use strict;
+
+my $USAGE = "aj_scaff2amos.pl scaff bnk/CTG.map > scf.afg\n";
+
+my $scaff = shift @ARGV or die $USAGE;
+my $map = shift @ARGV or die $USAGE;
+
+open SCAFF, "< $scaff" or die "Can't open $scaff ($!)\n";
+open MAP, "< $map" or die "Can't open $map ($!)\n";
+
+my %eid2iid;
+
+while (<MAP>)
+{
+ if (/(\d+)\s+(\d+)\s+(\S+)/)
+ {
+ $eid2iid{$3} = $2;
+ }
+}
+
+my $scaffid = undef;
+my $iid = 1;
+my $offset = 0;
+
+sub endScaff
+{
+ print "}\n" if (defined $scaffid);
+}
+
+
+while (<SCAFF>)
+{
+ if (/>(\S+)/)
+ {
+ endScaff();
+
+ $scaffid = $1;
+ print "{SCF\n";
+ print "eid:$scaffid\n";
+ print "iid:$iid\n";
+ $iid++;
+ $offset = 0;
+ }
+ else
+ {
+ my @vals = split /\s+/, $_;
+ my $ceid = $vals[0];
+ my $oo = $vals[1];
+ my $len = $vals[2];
+ my $gap = int($vals[3]);
+
+ my $ciid = $eid2iid{$ceid};
+
+ print "{TLE\n";
+ if ($oo eq "BE") { print "clr:0,$len\n"; }
+ else { print "clr:$len,0\n"; }
+ print "off:$offset\n";
+ print "src:$ciid\n";
+ print "}\n";
+
+ $offset += $len;
+ $offset += $gap;
+ }
+}
+
+endScaff();
+
+
diff --git a/src/Experimental/aj_scaff2fasta.pl b/src/Experimental/aj_scaff2fasta.pl
new file mode 100755
index 0000000..9d053c1
--- /dev/null
+++ b/src/Experimental/aj_scaff2fasta.pl
@@ -0,0 +1,176 @@
+#!/usr/bin/perl
+use strict;
+use TIGR::Foundation;
+use TIGR::AsmLib;
+
+my $USAGE = "Usage: aj_scaff2fasta.pl prefix.scaff prefix.fasta -o out.scaffolds.fasta\n";
+
+my $MINGAPSIZE = 100;
+
+my $HELPTEXT = qq~
+Convert a scaff file and fasta of contigs to scaffolds.fasta with
+$MINGAPSIZE 'N' spacers. Alternatively separate contigs by the expected gap
+size.
+
+ $USAGE
+ Options
+ -------
+ -e Space contigs in scaffold by expected gap size
+
+ -min <MIN> Specify minimum gapsize when using expected gap size
+ (Gaps smaller than MIN bp get MIN Ns Default: $MINGAPSIZE)
+~;
+
+my $VERSION = " Version 1.00 (Build " . (qw/$Revision$/ )[1] . ")";
+
+my @DEPENDS =
+(
+ "TIGR::Foundation",
+);
+
+my $DOVERBOSE = 0;
+
+my $tf = new TIGR::Foundation;
+
+sub echo
+{
+ my $str = join " ", @_;
+
+ $tf->logLocal($str, 4);
+ print @_ if ($DOVERBOSE);
+}
+
+sub runCmd
+{
+ my $cmd = shift;
+ my $info = shift;
+
+ echo "$info... " if defined $info;
+
+ my $exitcode = $tf->runCommand($cmd);
+
+ if ($exitcode)
+ {
+ echo "failed! ($!)\n" if defined $info;
+ $tf->bail("Error with $cmd ($exitcode)");
+ }
+
+ echo "ok.\n" if defined $info;
+}
+
+sub printScaffold
+{
+ my $outfile = shift;
+ my $scaffid = shift;
+ my $numcontigs = shift;
+ my $sequence = shift;
+
+ printFastaSequence($outfile,
+ sprintf("%s %d bp %d contigs", $scaffid, length($sequence), $numcontigs),
+ $sequence);
+}
+
+
+MAIN:
+{
+ my $USEEXPECTED = 0;
+ my $outfile = undef;
+
+ $tf->addDependInfo(@DEPENDS);
+ $tf->setHelpInfo($HELPTEXT);
+ $tf->setVersionInfo($VERSION);
+ my $result = $tf->TIGR_GetOptions("o=s", \$outfile,
+ "min=i", \$MINGAPSIZE,
+ "e", \$USEEXPECTED);
+
+
+ $tf->bail("Command line parsing failed") if (!$result);
+
+ my $USEDEFAULTGAPSIZE = !$USEEXPECTED;
+
+ my $scaff = shift or die $USAGE;
+ my $fasta = shift or die $USAGE;
+ die $USAGE if !defined $outfile;
+
+ open SCAFF, "< $scaff" or $tf->bail("Can't open $scaff ($!)\n");
+ open FASTA, "< $fasta" or $tf->bail("Can't open $fasta ($!)\n");
+ open OUTFILE, "> $outfile" or $tf->bail("Can't open $outfile ($!)\n");
+
+ my %contigs;
+ my $contigid;
+
+ echo "Loading sequences... ";
+
+ while (<FASTA>)
+ {
+ if (/>(\S+)/)
+ {
+ $contigid = $1;
+ }
+ else
+ {
+ chomp;
+ $contigs{$contigid} .= $_;
+ }
+ }
+
+ close FASTA;
+
+ echo "ok.\n";
+
+ my $scaffid = undef;
+ my $numcontigs;
+ my $sequence;
+ my $contigcount;
+
+ echo "Printing scaffolds.fasta... ";
+
+ while (<SCAFF>)
+ {
+ if (/^>(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/)
+ {
+ printScaffold(\*OUTFILE, $scaffid, $numcontigs, $sequence)
+ if defined $scaffid;
+
+ $contigcount = 0;
+ $sequence = "";
+ $scaffid = $1;
+ $numcontigs = $2;
+ my $bases = $3;
+ my $span = $4;
+ }
+ elsif (/(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/)
+ {
+ my $contigid = $1;
+ my $oo = $2;
+ my $size = $3;
+ my $gapsize = $4;
+
+ $contigcount++;
+
+ $tf->bail("Scaffold references missing contig $contigid!\n")
+ if !exists $contigs{$contigid};
+
+ my $cons = $contigs{$contigid};
+ $cons = reverseComplement($cons) if ($oo eq "EB");
+ $sequence .= $cons;
+
+ if ($contigcount != $numcontigs)
+ {
+ my $gapcount = int($gapsize);
+ $gapcount = $MINGAPSIZE if ($gapcount < $MINGAPSIZE || $USEDEFAULTGAPSIZE);
+
+ my $gaps = "N"x$gapcount;
+ $sequence .= $gaps;
+ }
+ }
+ }
+ close SCAFF;
+
+ printScaffold(\*OUTFILE, $scaffid, $numcontigs, $sequence)
+ if defined $scaffid;
+
+ echo "ok.\n";
+
+ close OUTFILE;
+}
diff --git a/src/Experimental/aligncestat.pl b/src/Experimental/aligncestat.pl
new file mode 100755
index 0000000..4577126
--- /dev/null
+++ b/src/Experimental/aligncestat.pl
@@ -0,0 +1,133 @@
+#!/usr/bin/perl -w
+use strict;
+use Statistics::Descriptive;
+use Getopt::Long;
+
+## Paths to binaries
+my $FASTX_RC = "fastx_reverse_complement";
+my $FASTX_TRIM = "fastx_trimmer";
+my $FASTQ_RENAME = "fastq_rename";
+my $BWA = "bwa";
+my $SAMTOOLS = "samtools";
+
+## Options
+my $samfile;
+my $help = 0;
+my $numreads = 10000;
+my $RC = 0;
+my $QV_TRIM = 10;
+my $HARD_TRIM = 0;
+my $QV_ILLUMINA = 0;
+my $ADD_SUFFIX = 0;
+
+my $prefix;
+
+my $USAGE = "aligncestat.pl <options> prefix ref.fa fq1 fq2 | -samfile <samfile>\n";
+
+my $res = GetOptions("help" => \$help,
+ "sam=s" => \$samfile,
+ "reads=n" => \$numreads,
+ "rc" => \$RC,
+ "I" => \$QV_ILLUMINA,
+ "suffix" => \$ADD_SUFFIX,
+ "qv=n" => \$QV_TRIM,
+ "trim=n" => \$HARD_TRIM,
+ );
+
+if ($help || !$res)
+{
+ print $USAGE;
+ print " Align reads to a draft assembly and compute the ce statistic\n";
+ print "\n";
+ print "Required\n";
+ print " prefix : prefix for output files\n";
+ print " ref.fa : path to reference genome (must be indexed with bwa)\n";
+ print " fq1 : path to first read\n";
+ print " fq2 : path to second read\n";
+ print "\n";
+ print "Options\n";
+ print " -suffix : Add /1 and /2 suffix to reads\n";
+ print " -reads <n> : align first n reads (default: $numreads)\n";
+ print " -rc : reverse complement the reads before alignment\n";
+ print " -qv <n> : bwa quality soft quality trim (default: $QV_TRIM)\n";
+ print " -I : quality values are Illumina format\n";
+ print " -trim <n> : hard trim 3' value (default: $HARD_TRIM)\n";
+ print " -samfile <file> : Analyze previously aligned reads\n";
+
+ exit 0;
+}
+
+
+## Align Reads
+###############################################################################
+
+if (!defined $samfile)
+{
+ die $USAGE if (scalar @ARGV != 4);
+
+ $prefix = $ARGV[0];
+ my $ref = $ARGV[1];
+ my $fq1 = $ARGV[2];
+ my $fq2 = $ARGV[3];
+
+ $samfile = "$prefix.sam.s";
+
+ my $nl = $numreads * 4; ## 4 lines per reads in a fastq
+
+ my $TRIM_CMD = "";
+ $TRIM_CMD = " | $FASTX_TRIM -t $HARD_TRIM" if ($HARD_TRIM > 0);
+
+ if ($RC)
+ {
+ $TRIM_CMD .= " | $FASTX_RC -Q ";
+ if ($QV_ILLUMINA) { $TRIM_CMD .= "64"; } else { $TRIM_CMD .= "33"; }
+ }
+
+ my $TC1 = $TRIM_CMD;
+ my $TC2 = $TRIM_CMD;
+
+ if ($ADD_SUFFIX)
+ {
+ $TC1 .= " | $FASTQ_RENAME -suffix /1";
+ $TC2 .= " | $FASTQ_RENAME -suffix /2";
+ }
+
+ $QV_ILLUMINA = ($QV_ILLUMINA) ? "-I" : "";
+
+ runCmd("prepare fq1", "$prefix.1.fq", "head -$nl $fq1 $TC1 > $prefix.1.fq", 1);
+ runCmd("prepare fq2", "$prefix.2.fq", "head -$nl $fq2 $TC2 > $prefix.2.fq", 1);
+
+ runCmd("bwa index", "$ref.sa", "$BWA index $ref");
+
+ runCmd("bwa aln 1", "$prefix.1.sai", "$BWA aln $QV_ILLUMINA -q $QV_TRIM $ref $prefix.1.fq > $prefix.1.sai", 1);
+ runCmd("bwa aln 2", "$prefix.2.sai", "$BWA aln $QV_ILLUMINA -q $QV_TRIM $ref $prefix.2.fq > $prefix.2.sai", 1);
+ runCmd("bwa sampe", "$prefix.sam", "$BWA sampe -f $prefix.sam $ref $prefix.1.sai $prefix.2.sai $prefix.1.fq $prefix.2.fq", 1);
+
+ runCmd("sam -> bam", "$prefix.bam", "$SAMTOOLS view -bT $ref $prefix.sam > $prefix.bam", 1);
+ runCmd("sort bam", "$prefix.s.bam", "$SAMTOOLS sort $prefix.bam $prefix.s", 1);
+
+ print STDERR "SAM file is: $samfile\n";
+}
+else
+{
+ $prefix = $samfile;
+}
+
+
+## runCmd
+###############################################################################
+
+sub runCmd
+{
+ my $desc = $_[0];
+ my $outf = $_[1];
+ my $cmd = $_[2];
+ my $force = $_[3];
+
+ if (! -r $outf || defined $force)
+ {
+ print STDERR "$desc [$cmd]...\n";
+ my $rc = system($cmd);
+ die $rc if $rc;
+ }
+}
diff --git a/src/Experimental/aligndist.pl b/src/Experimental/aligndist.pl
new file mode 100755
index 0000000..e365e6e
--- /dev/null
+++ b/src/Experimental/aligndist.pl
@@ -0,0 +1,248 @@
+#!/usr/bin/perl -w
+use strict;
+use Statistics::Descriptive;
+use Getopt::Long;
+
+## Paths to binaries
+my $FASTX_RC = "fastx_reverse_complement";
+my $FASTX_TRIM = "fastx_trimmer";
+my $FASTQ_RENAME = "fastq_rename";
+my $BWA = "bwa";
+
+## Options
+my $samfile;
+my $showdetails = 0;
+my $showdist = 0;
+my $help = 0;
+my $numreads = 10000;
+my $RC = 0;
+my $trimmean = ".1"; ## trim 10% outliers
+my $QV_TRIM = 10;
+my $HARD_TRIM = 0;
+my $QV_ILLUMINA = 0;
+my $ADD_SUFFIX = 0;
+
+my $prefix;
+
+my $USAGE = "aligndist <options> prefix ref.fa fq1 fq2 | -samfile <samfile>\n";
+
+my $res = GetOptions("help" => \$help,
+ "sam=s" => \$samfile,
+ "reads=n" => \$numreads,
+ "dist=n" => \$showdist,
+ "details=n" => \$showdetails,
+ "rc" => \$RC,
+ "I" => \$QV_ILLUMINA,
+ "suffix" => \$ADD_SUFFIX,
+ "qv=n" => \$QV_TRIM,
+ "trim=n" => \$HARD_TRIM,
+ );
+
+if ($help || !$res)
+{
+ print $USAGE;
+ print "\n";
+ print " Compute the distance between paired end reads by individually aligning them\n";
+ print " to a reference genome or draft assembly. Aligns just the first <numreads>\n";
+ print " and compute summary statistics on the unambiguous alignments to the same\n";
+ print " contig/scaffold/chromosome. Use -samfile if reads are already aligned.\n";
+ print "\n";
+ print "Required\n";
+ print " prefix : prefix for output files\n";
+ print " ref.fa : path to reference genome (must be indexed with bwa)\n";
+ print " fq1 : path to first read\n";
+ print " fq2 : path to second read\n";
+ print "\n";
+ print "Options\n";
+ print " -suffix : Add /1 and /2 suffix to reads\n";
+ print " -reads <n> : align first n reads (default: $numreads)\n";
+ print " -dist <n> : show the distance for the first n pairs (default: $showdist)\n";
+ print " -details <n> : show details for first n pairs (default: $showdetails)\n";
+ print " -rc : reverse complement the reads before alignment\n";
+ print " -qv <n> : bwa quality soft quality trim (default: $QV_TRIM)\n";
+ print " -I : quality values are Illumina format\n";
+ print " -trim <n> : hard trim 3' value (default: $HARD_TRIM)\n";
+ print " -samfile <file> : Analyze previously aligned reads\n";
+
+ exit 0;
+}
+
+if (($showdetails > 0) && ($showdist > 0))
+{
+ die "ERROR: Can't show details and distances at the same time\n";
+}
+
+## Align Reads
+###############################################################################
+
+if (!defined $samfile)
+{
+ die $USAGE if (scalar @ARGV != 4);
+
+ $prefix = $ARGV[0];
+ my $ref = $ARGV[1];
+ my $fq1 = $ARGV[2];
+ my $fq2 = $ARGV[3];
+
+ $samfile = "$prefix.sam.s";
+
+ my $nl = $numreads * 4; ## 4 lines per reads in a fastq
+
+ my $TRIM_CMD = "";
+ $TRIM_CMD = " | $FASTX_TRIM -t $HARD_TRIM" if ($HARD_TRIM > 0);
+
+ if ($RC)
+ {
+ $TRIM_CMD .= " | $FASTX_RC -Q ";
+ if ($QV_ILLUMINA) { $TRIM_CMD .= "64"; } else { $TRIM_CMD .= "33"; }
+ }
+
+ my $TC1 = $TRIM_CMD;
+ my $TC2 = $TRIM_CMD;
+
+ if ($ADD_SUFFIX)
+ {
+ $TC1 .= " | $FASTQ_RENAME -suffix _1";
+ $TC2 .= " | $FASTQ_RENAME -suffix _2";
+ }
+ else
+ {
+ $TC1 .= " | $FASTQ_RENAME -tr '/'";
+ $TC2 .= " | $FASTQ_RENAME -tr '/'";
+ }
+
+ $QV_ILLUMINA = ($QV_ILLUMINA) ? "-I" : "";
+
+ runCmd("prepare fq1", "$prefix.1.fq", "head -$nl $fq1 $TC1 > $prefix.1.fq", 1);
+ runCmd("prepare fq2", "$prefix.2.fq", "head -$nl $fq2 $TC2 > $prefix.2.fq", 1);
+
+ runCmd("cat fq", "$prefix.fq", "cat $prefix.1.fq $prefix.2.fq > $prefix.fq", 1);
+ runCmd("bwa index", "$ref.sa", "$BWA index $ref");
+ runCmd("bwa aln", "$prefix.sai", "$BWA aln $QV_ILLUMINA -q $QV_TRIM $ref $prefix.fq > $prefix.sai", 1);
+ runCmd("bwa samse", "$prefix.sam", "$BWA samse -f $prefix.sam $ref $prefix.sai $prefix.fq", 1);
+ runCmd("sort sam", "$samfile", "grep -v '^\@' $prefix.sam | sort > $samfile", 1);
+
+ print STDERR "SAM file is: $samfile\n";
+}
+else
+{
+ $prefix = $samfile;
+}
+
+
+## Load Alignments
+###############################################################################
+
+open SAM, $samfile or die "Can't open $samfile ($!)\n";
+
+my %match;
+
+while (<SAM>)
+{
+ chomp;
+
+ my ($name, $flag, $rname, $pos, $mapq, $cigar, $rnext, $pnext, $tlen, $seq, $qual) = split /\s+/, $_;
+
+ my $base = substr($name, 0, -2); ## trim _1 or _2
+ my $idx = substr($name, -1, 1);
+
+ my $info;
+ $info->{idx} = $idx;
+ $info->{rid} = $rname;
+ $info->{p} = $pos;
+ $info->{l} = length($seq);
+ $info->{f} = $flag;
+ $info->{full} = $_;
+
+ push @{$match{$base}}, $info;
+
+ #print "$base\t$idx\t$rid\t$s\t$e\t$f\t||\t$_";
+}
+
+
+## Compute Distances
+###############################################################################
+
+my $stats = Statistics::Descriptive::Full->new();
+
+if ($showdetails > 0)
+{
+ print "#base\t|\trid\t|\ts1\te1\tf1\t|\ts2\te2\tf2\t||\td\t||\tfull1\t||\tfull2\n";
+}
+
+foreach my $base (keys %match)
+{
+ if (scalar @{$match{$base}} == 2)
+ {
+ my $i1 = $match{$base}->[0];
+ my $i2 = $match{$base}->[1];
+ my $rid = $i1->{rid};
+
+ if (($i1->{idx} ne $i2->{idx}) &&
+ ($i1->{rid} eq $i2->{rid}) &&
+ ($i1->{rid} ne '*'))
+ {
+ my $s1 = $i1->{p}; my $e1 = $s1 + $i1->{l}; my $f1 = $i1->{f}; my $full1 = $i1->{full};
+ my $s2 = $i2->{p}; my $e2 = $s2 + $i2->{l}; my $f2 = $i2->{f}; my $full2 = $i2->{full};
+
+ my $d = undef;
+
+ if (($f1 == 0) && ($f2 == 16)) { $d = $e2 - $s1; }
+ elsif (($f1 == 16) && ($f2 == 0)) { $d = $e1 - $s2; }
+
+ if (defined $d)
+ {
+ if ($showdetails != 0)
+ {
+ print "$base\t|\t$rid\t|\t$s1\t$e1\t$f1\t|\t$s2\t$e2\t$f2\t||\t$d\t||\t$full1\t||\t$full2\n";
+ $showdetails--;
+ }
+ elsif ($showdist != 0)
+ {
+ print "$d\n";
+ $showdist--;
+ }
+
+ $stats->add_data($d);
+ }
+ }
+ }
+}
+
+
+## Print Stats
+###############################################################################
+
+my $num = $stats->count();
+die "No pairs aligned\n" if ($num == 0);
+
+my $min = $stats->min();
+my $max = $stats->max();
+my $mean = sprintf("%0.01f", $stats->mean());
+my $stdev = sprintf("%0.01f", $stats->standard_deviation());
+my $median=$stats->median();
+my $trim = sprintf("%0.01f", $stats->trimmed_mean($trimmean));
+
+print STDERR "## $prefix aligned pairs=$num dist: [$min, $max] $mean +/- $stdev";
+print STDERR " median=$median";
+print STDERR " trimmean=$trim";
+print STDERR "\n";
+
+
+## runCmd
+###############################################################################
+
+sub runCmd
+{
+ my $desc = $_[0];
+ my $outf = $_[1];
+ my $cmd = $_[2];
+ my $force = $_[3];
+
+ if (! -r $outf || defined $force)
+ {
+ print STDERR "$desc [$cmd]...\n";
+ my $rc = system($cmd);
+ die $rc if $rc;
+ }
+}
diff --git a/src/Experimental/alignextend.pl b/src/Experimental/alignextend.pl
new file mode 100755
index 0000000..4e7c069
--- /dev/null
+++ b/src/Experimental/alignextend.pl
@@ -0,0 +1,325 @@
+#!/usr/bin/perl -w
+use strict;
+use Getopt::Long;
+
+$|=1;
+$ENV{LC_ALL}="C";
+
+## Paths to binaries
+my $BWA = "bwa";
+my $FASTX_RC = "fastx_reverse_complement";
+my $FASTA_FROM_BED = "fastaFromBed";
+my $FASTQ_RENAME = "fastq_rename";
+my $FASTX_TRIM = "fastx_trimmer";
+
+## Options
+my $RC = 0;
+my $READLEN = 100;
+my $MAPQ_THRESHOLD = 20;
+my $numreads = 1000000;
+
+my $HARD_TRIM = 0;
+my $QV_TRIM = 10;
+my $QV_ILLUMINA;
+my $ADD_SUFFIX = 0;
+
+my $USAGE = "alignextend [options] prefix ref.fa fq1 fq2\n";
+my $help;
+
+my $res = GetOptions("help" => \$help,
+ "reads=n" => \$numreads,
+ "suffix" => \$ADD_SUFFIX,
+ "rc" => \$RC,
+ "qv=n" => \$QV_TRIM,
+ "trim=n" => \$HARD_TRIM,
+ "len=n" => \$READLEN,
+ "mapq=n" => \$MAPQ_THRESHOLD,
+ "I" => \$QV_ILLUMINA);
+
+if ($help)
+{
+ print $USAGE;
+ print "\n";
+ print "Align (very) short reads to a draft assembly, and extend reads that map unambiguously\n";
+ print "with the sequence of the contig on the 3' end\n";
+ print "\n";
+ print "Required\n";
+ print " prefix : prefix for output files\n";
+ print " ref.fa : path to reference genome (must be indexed with bwa)\n";
+ print " fq1 : path to first read\n";
+ print " fq2 : path to second read\n";
+ print "\n";
+ print "Options\n";
+ print " -reads <n> : align first m reads (default: $numreads)\n";
+ print " -suffix : Add /1 and /2 suffix to reads\n";
+ print " -rc : reverse complement the reads before alignment\n";
+ print " -qv <n> : bwa quality soft quality trim (default: $QV_TRIM)\n";
+ print " -trim <n> : hard trim 3' value (default: $HARD_TRIM)\n";
+ print " -I : read quality values are Illumina format\n";
+ print " -len <n> : extend to this length (default: $READLEN)\n";
+ print " -mapq <n> : Only trust alignment with at least this MAPQ (default: $MAPQ_THRESHOLD)\n";
+ exit 0;
+ }
+
+
+my $prefix = $ARGV[0] or die $USAGE;
+my $ref = $ARGV[1] or die $USAGE;
+my $fq1 = $ARGV[2] or die $USAGE;
+my $fq2 = $ARGV[3] or die $USAGE;
+
+
+$QV_ILLUMINA = (defined $QV_ILLUMINA) ? "-I" : "";
+
+
+
+## runCmd
+###############################################################################
+
+sub runCmd
+{
+ my $desc = $_[0];
+ my $outf = $_[1];
+ my $cmd = $_[2];
+
+ #if (! -r $outf)
+ {
+ print "$desc: $cmd...\n";
+ my $rc = system($cmd);
+ die $rc if $rc;
+ }
+}
+
+
+## sam2bed
+###############################################################################
+
+sub sam2bed
+{
+ my $samfile = shift;
+ my $bedfile = shift;
+
+ return if -r $bedfile;
+
+ open SAM, "< $samfile" or die "Can't open $samfile ($!)\n";
+ open BED, "> $bedfile" or die "Can't open $bedfile ($!)\n";
+
+ my %scafflen;
+
+ print "Running sam2bed $samfile...\n";
+ my $rdcnt = 0;
+ my $goodrdcnt = 0;
+ my $scaffcnt = 0;
+
+ while (<SAM>)
+ {
+ chomp;
+
+ if (/^\@SQ/)
+ {
+ my ($tag, $sn, $ln) = split /\s+/, $_;
+ my ($snt,$scaffid) = split /:/, $sn;
+ my ($lnt,$scafflen) = split /:/, $ln;
+
+ $scafflen{$scaffid} = $scafflen;
+ $scaffcnt++;
+
+ next;
+ }
+ elsif (/^\@/)
+ {
+ ## other headers, pg, etc
+ next;
+ }
+
+ $rdcnt++;
+
+ my ($name, $flag, $rname, $pos, $mapq, $cigar, $rnext, $pnext, $tlen, $seq, $qual, $attr) = split /\s+/, $_;
+
+ my $base = substr($name, 0, -2); ## trim _1 or _2
+ my $iidx = substr($name, -1, 1);
+
+ next if $rname eq '*';
+ next if $mapq < $MAPQ_THRESHOLD;
+
+ my $scafflen = $scafflen{$rname};
+
+ if ($flag == 0)
+ {
+ my $startpos = $pos-1; ## BED is 0-based
+ my $endpos = $startpos + $READLEN - 1;
+
+ if ($endpos >= $scafflen) { $endpos = $scafflen-1;}
+
+ print BED "$rname\t$pos\t$endpos\t$base/$iidx\t1\t+\n"; ## Forward Strand
+ $goodrdcnt++;
+ }
+ elsif ($flag == 16)
+ {
+ my $endpos = $pos+length($seq)-1-1; ## BED is 0-based
+ my $startpos = $endpos - $READLEN+1;
+
+ if ($startpos <= 0) { $startpos = 0; }
+
+ print BED "$rname\t$startpos\t$endpos\t$base/$iidx\t1\t-\n"; ## Reverse Strand
+ $goodrdcnt++;
+ }
+ }
+
+ my $percgood = sprintf("%0.02f", 100*$goodrdcnt / $rdcnt);
+
+ print "Loaded: $scaffcnt scaffolds\n";
+ print "Printed $goodrdcnt of $rdcnt reads ($percgood%)\n";
+}
+
+
+## matchSFA
+###############################################################################
+
+sub matchSFA
+{
+ my $sfa1 = $_[0];
+ my $sfa2 = $_[1];
+ my $fq1 = $_[2];
+ my $fq2 = $_[3];
+
+ open SFA1, "< $sfa1" or die "Can't open $sfa1 ($!)\n";
+ open SFA2, "< $sfa2" or die "Can't open $sfa2 ($!)\n";
+
+ open FQ1, "> $fq1" or die "Can't open $fq1 ($!)\n";
+ open FQ2, "> $fq2" or die "Can't open $fq2 ($!)\n";
+
+ my %sfa1;
+ my %sfa2;
+
+ print "matchSFA\n";
+ print " scanning $sfa1... ";
+
+ my $cnt = 0;
+
+ while (<SFA1>)
+ {
+ chomp;
+ my ($name, $seq) = split /\t/, $_;
+
+ my $base = substr($name, 0, -2); ## trim /1 or /2
+ my $iidx = substr($name, -1, 1);
+
+ $sfa1{$base}++;
+ $cnt++;
+ }
+
+ close SFA1;
+
+ print "$cnt reads\n";
+
+ $cnt = 0;
+ my $printed = 0;
+
+ print " printing $fq2... ";
+
+ while (<SFA2>)
+ {
+ chomp;
+ my ($name, $seq) = split /\t/, $_;
+
+ my $base = substr($name, 0, -2); ## trim /1 or /2
+ my $iidx = substr($name, -1, 1);
+
+ $cnt++;
+
+ if (exists $sfa1{$base})
+ {
+ $printed++;
+ $sfa2{$base}++;
+
+ my $q;
+
+ if ($QV_ILLUMINA) { $q = 'a' x length($seq); }
+ else { $q = 'A' x length($seq); }
+
+ print FQ2 "\@$name\n$seq\n+\n$q\n";
+ }
+ }
+
+ print "printed $printed of $cnt\n";
+
+ open SFA1, "< $sfa1" or die "Can't open $sfa1 ($!)\n";
+
+ $cnt = 0;
+ $printed = 0;
+
+ print " printing $fq1... ";
+
+ while (<SFA1>)
+ {
+ chomp;
+ my ($name, $seq) = split /\t/, $_;
+
+ my $base = substr($name, 0, -2); ## trim /1 or /2
+ my $iidx = substr($name, -1, 1);
+
+ $cnt++;
+
+ if (exists $sfa2{$base})
+ {
+ $printed++;
+
+ my $q;
+
+ if ($QV_ILLUMINA) { $q = 'a' x length($seq); }
+ else { $q = 'A' x length($seq); }
+
+ print FQ1 "\@$name\n$seq\n+\n$q\n";
+ }
+ }
+
+ print "printed $printed of $cnt\n";
+}
+
+
+## Align the reads
+###############################################################################
+
+foreach my $idx (1..2)
+{
+ print "idx: $idx\n";
+
+ my $fq = ($idx == 1) ? $fq1 : $fq2;
+ my $samfile = "$prefix.$idx.sam";
+ my $bedfile = "$prefix.$idx.bed";
+
+ my $nl = $numreads * 4; ## 4 lines per reads in a fastq
+
+ my $TRIM_CMD = "";
+ $TRIM_CMD = " | $FASTX_TRIM -t $HARD_TRIM" if ($HARD_TRIM > 0);
+
+ if ($RC)
+ {
+ $TRIM_CMD .= " | $FASTX_RC -Q ";
+ if ($QV_ILLUMINA) { $TRIM_CMD .= "64"; } else { $TRIM_CMD .= "33"; }
+ }
+
+ if ($ADD_SUFFIX) { $TRIM_CMD .= " | $FASTQ_RENAME -suffix _$idx"; }
+ else { $TRIM_CMD .= " | $FASTQ_RENAME -tr '/'"; }
+
+ $QV_ILLUMINA = ($QV_ILLUMINA) ? "-I" : "";
+
+ runCmd("prepare fq", "$prefix.$idx.fq", "head -$nl $fq $TRIM_CMD > $prefix.$idx.fq");
+
+ runCmd("bwa aln", "$prefix.$idx.sai", "$BWA aln $QV_ILLUMINA -q $QV_TRIM $ref $prefix.$idx.fq > $prefix.$idx.sai");
+ runCmd("bwa samse", "$prefix.$idx.sam", "$BWA samse -f $samfile $ref $prefix.$idx.sai $prefix.$idx.fq");
+
+ sam2bed($samfile, $bedfile);
+
+ runCmd("fastaFromBed", "$prefix.$idx.sfa", "$FASTA_FROM_BED -s -name -tab -fi $ref -bed $bedfile -fo $prefix.$idx.sfa");
+ runCmd("sort sfa", "$prefix.$idx.sfa.s", "sort -k1,1 $prefix.$idx.sfa > $prefix.$idx.sfa.s");
+
+ print "\n";
+}
+
+
+## Create the matched extended pairs
+###############################################################################
+
+matchSFA("$prefix.1.sfa.s", "$prefix.2.sfa.s", "$prefix.1e.fq", "$prefix.2e.fq");
+
diff --git a/src/Experimental/analyzeHaplotypes.cc b/src/Experimental/analyzeHaplotypes.cc
new file mode 100644
index 0000000..af77168
--- /dev/null
+++ b/src/Experimental/analyzeHaplotypes.cc
@@ -0,0 +1,444 @@
+#include "foundation_AMOS.hh"
+#include <getopt.h>
+#include <map>
+#include <set>
+#include <list>
+#include <vector>
+#include <string>
+#include <queue>
+#include <functional>
+#include "amp.hh"
+
+#include <Slice.h>
+#include "ContigIterator_AMOS.hh"
+
+using namespace std;
+using namespace AMOS;
+
+
+#define endl "\n"
+
+bool TCOV = 0;
+bool SNPREPORT = 0;
+
+string BANKNAME;
+
+int SR_PRINT_SNPS = 0;
+int SR_PRINTBASE = 1;
+int SR_PRINTREAD = 0;
+int SR_PRINTLIBS = 0;
+int SR_PRINTQUAL = 0;
+
+int SR_MINAGREEINGCONFLICTS = 1;
+int SR_MINAGREEINGQV = 0;
+int SR_MINCONFLICTQV = 0;
+
+int ONE_BASED_GINDEX = 0;
+bool USEIID = 0;
+bool USEEID = 0;
+
+map<ID_t, ID_t> frg2lib;
+
+class HaplotypeDelta
+{
+public:
+ HaplotypeDelta(int offset, char base) : m_offset(offset), m_base(base) {}
+
+ int m_offset;
+ char m_base;
+};
+
+
+class HaplotypeGroup
+{
+public:
+
+ HaplotypeGroup() : m_loffset(1024*1024*1024), m_roffset(-1) {}
+
+ void addDelta(int offset, char base)
+ {
+ m_delta.push_back(HaplotypeDelta(offset, base));
+ }
+
+ bool containsRead(ID_t readiid)
+ {
+ return m_readiids.find(readiid) != m_readiids.end();
+ }
+
+ void addRead(const TiledRead_t & red)
+ {
+ if (red.m_loffset < m_loffset) { m_loffset = red.m_loffset; }
+ if (red.m_roffset > m_roffset) { m_roffset = red.m_roffset; }
+
+ m_readiids.insert(red.m_iid);
+ }
+
+ int m_loffset;
+ int m_roffset;
+
+ vector<HaplotypeDelta> m_delta;
+
+ std::set<ID_t> m_readiids;
+};
+
+int getHaplotypeGroup(vector<HaplotypeGroup> & groups, ID_t readiid)
+{
+ for (int i = 0; i < groups.size(); i++)
+ {
+ if (groups[i].containsRead(readiid))
+ {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+
+void printHelpText()
+{
+ cerr <<
+ "\n"
+ ".NAME.\n"
+ "analyzeSNPs - scans multiple alignment of reads looking for snps used for phasing the haplotypes\n"
+ "\n.USAGE.\n"
+ "analyzeSNPs -b[ank] <bank_name> [OPTIONS]\n"
+ "\n.OPTIONS.\n"
+ "-h, -help print out help message\n"
+ "-b, -bank bank where assembly is stored\n"
+
+ "SNP Report Options\n"
+ "-r Print readnames\n"
+ "-l Print libid\n"
+ "-q Print qvs\n"
+ "-M, -minsnps <val> Set Minimum number of consistent disagreeing reads to report (default:" << SR_MINAGREEINGCONFLICTS << ")\n"
+ "-C, -cumqv <val> Set Minimum conflicting cummulative qv to report (default: " << SR_MINAGREEINGQV << ")\n"
+ "-Q, -minqv <val> Set Minimum conflicting qv to report (default: " << SR_MINCONFLICTQV << ")\n\n"
+
+ "General Options\n"
+ "-e, -eid Display eids\n"
+ "-i, -iid Display iids\n"
+ "-1 Display 1-based gapped coordinates\n\n"
+ "\n.DESCRIPTION.\n"
+ "\n.KEYWORDS.\n"
+ "AMOS bank\n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"bank", 1, 0, 'b'},
+
+ {"B", 0, 0, 'B'},
+ {"r", 0, 0, 'r'},
+ {"l", 0, 0, 'l'},
+ {"q", 0, 0, 'q'},
+ {"minsnps", 1, 0, 'M'},
+ {"M", 1, 0, 'M'},
+ {"cumqv", 1, 0, 'C'},
+ {"C", 1, 0, 'C'},
+ {"minqv", 1, 0, 'Q'},
+ {"Q", 1, 0, 'Q'},
+
+ {"eid", 0, 0, 'e'},
+ {"iid", 0, 0, 'i'},
+ {"1", 0, 0, '1'},
+
+ {0, 0, 0, 0}
+ };
+
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1)
+ {
+ switch (c)
+ {
+ case 'h': printHelpText(); exit(0); break;
+ case 'b': BANKNAME = optarg; break;
+
+ case 'B': SR_PRINTBASE = 0; break;
+ case 'r': SR_PRINTREAD = 1; break;
+ case 'l': SR_PRINTLIBS = 1; break;
+ case 'q': SR_PRINTQUAL = 1; break;
+
+ case 'M': SR_MINAGREEINGCONFLICTS = atoi(optarg); break;
+ case 'C': SR_MINAGREEINGQV = atoi(optarg); break;
+ case 'Q': SR_MINCONFLICTQV = atoi(optarg); break;
+
+ case 'e': USEEID = 1; break;
+ case 'i': USEIID = 1; break;
+ case '1': ONE_BASED_GINDEX = 1; break;
+
+ case '?':
+ cerr << "Error processing options: " << argv[optind-1] << endl;
+ return false;
+ };
+ }
+
+ //cerr << "SR_MINAGREEINGCONFLICTS: " << SR_MINAGREEINGCONFLICTS << endl;
+ //cerr << "SR_MINAGREEINGQV: " << SR_MINAGREEINGQV << endl;
+ //cerr << "SR_MINCONFLICTQV: " << SR_MINCONFLICTQV << endl;
+
+ return true;
+}
+
+
+
+//----------------------------------------------
+int main(int argc, char **argv)
+{
+ if (! GetOptions(argc, argv))
+ {
+ exit(1);
+ }
+
+ // open necessary files
+ if (BANKNAME.empty())
+ {
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ BankStream_t contig_stream (Contig_t::NCODE);
+ Bank_t read_bank (Read_t::NCODE);
+
+ try
+ {
+ contig_stream.open(BANKNAME, B_READ|B_SPY);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Failed to open contig account in bank " << BANKNAME
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+
+ try
+ {
+ read_bank.open(BANKNAME, B_READ|B_SPY);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Failed to open read account in bank " << BANKNAME
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ if (SR_PRINTLIBS)
+ {
+ BankStream_t fragment_stream (Fragment_t::NCODE);
+
+ try
+ {
+ fragment_stream.open(BANKNAME, B_READ);
+ Fragment_t frg;
+
+ while (fragment_stream >> frg)
+ {
+ frg2lib.insert(make_pair(frg.getIID(), frg.getLibrary()));
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Error loading fragment-library relations: " << e << endl;
+ cerr << "Not printing libraries" << endl;
+ SR_PRINTLIBS = 0;
+ }
+ }
+
+ int bases = 0;
+ int snpcount = 0;
+ int displaycount = 0;
+ int contigcount = 0;
+
+ int ccount = contig_stream.getSize();
+
+ cerr << "Searching " << ccount << " contigs" << endl;
+
+ Contig_t ctg;
+ while (contig_stream >> ctg)
+ {
+ ContigIterator_t ci(ctg, &read_bank);
+ contigcount++;
+ ID_t iid = ctg.getIID();
+
+ vector<HaplotypeGroup> groups;
+
+ try
+ {
+ while (ci.advanceNext())
+ {
+ bases++;
+
+ bool hasSNP = ci.hasSNP();
+ if (hasSNP) { snpcount++; }
+
+ bool foundGoodSNP = false;
+
+ Column_t column(ci.getColumn());
+ vector<BaseStats_t *> freq(column.getBaseInfo());
+
+ // start at 1 to skip the consensus, only look at conflicting bases
+ for (int i = 1; !foundGoodSNP && i < freq.size(); i++)
+ {
+ foundGoodSNP = (freq[i]->m_reads.size() >= SR_MINAGREEINGCONFLICTS) &&
+ (freq[i]->m_cumqv >= SR_MINAGREEINGQV) &&
+ (freq[i]->m_maxqv >= SR_MINCONFLICTQV);
+ }
+
+ if (foundGoodSNP)
+ {
+ displaycount++;
+
+ int dcov = ci.depth();
+ int gindex = ci.gindex();
+
+ if (SR_PRINT_SNPS)
+ {
+ if (USEEID) { cout << ci.getContig().getEID() << "\t"; }
+ else { cout << ci.getContig().getIID() << "\t"; }
+
+ cout << gindex+ONE_BASED_GINDEX << "\t"
+ << ci.uindex() << "\t"
+ << ci.cons() << "\t"
+ << dcov << "\t"
+ << dcov - freq[0]->m_reads.size();
+ }
+
+ for (int i = 0; i < freq.size(); i++)
+ {
+ if (SR_PRINT_SNPS)
+ {
+ cout << "\t" << (char) toupper(freq[i]->m_base) << "(" << freq[i]->m_reads.size() << ")";
+ }
+
+ bool first = true;
+
+ map<int, int> groupcnt;
+
+ if (SR_PRINT_SNPS && SR_PRINTREAD) { cout << "\t{"; }
+
+ vector<TiledReadList_t::const_iterator>::const_iterator ri;
+ for (ri = freq[i]->m_reads.begin(); ri != freq[i]->m_reads.end(); ri++)
+ {
+ int groupid = getHaplotypeGroup(groups, (*ri)->m_iid);
+ groupcnt[groupid]++;
+
+ if (SR_PRINT_SNPS && SR_PRINTREAD)
+ {
+ if (!first) { cout << ":"; }
+ first = false;
+
+ if (USEEID) { cout << (*ri)->m_eid; } else
+ if (USEIID) { cout << (*ri)->m_iid; } else
+ { cout << (*ri)->m_readidx; }
+
+ cout << "[" << groupid << "]";
+ }
+ }
+
+ if (SR_PRINT_SNPS && SR_PRINTREAD) { cout << "}"; }
+
+ map<int,int>::iterator mi;
+ int maxid = -1;
+ int maxcnt = -1;
+
+ if (SR_PRINT_SNPS) { cout << "["; }
+
+ first = true;
+
+ for (mi = groupcnt.begin(); mi != groupcnt.end(); mi++)
+ {
+ if (SR_PRINT_SNPS)
+ {
+ if (!first) { cout << ","; } first = false;
+ cout << mi->first << ":" << mi->second;
+ }
+
+ if (((mi->first != -1) && (mi->second > maxcnt)) ||
+ ((mi->first == -1) && (maxid == -1)))
+ {
+ maxcnt = mi->second;
+ maxid = mi->first;
+ }
+ }
+
+ int MIN_GROUP_OVERLAP = 5;
+
+ if (maxid == -1 || maxcnt < MIN_GROUP_OVERLAP)
+ {
+ // create a new group
+ maxid = groups.size();
+ HaplotypeGroup newgroup;
+ groups.push_back(newgroup);
+ }
+
+ if (SR_PRINT_SNPS)
+ {
+ cout << "][[" << maxid << ":" << maxcnt << "]]";
+ }
+
+ groups[maxid].addDelta(gindex, toupper(freq[i]->m_base));
+
+ // add all the current reads to the group
+ for (ri = freq[i]->m_reads.begin(); ri != freq[i]->m_reads.end(); ri++)
+ {
+ groups[maxid].addRead(*(*ri));
+ }
+ }
+
+ if (SR_PRINT_SNPS) { cout << endl; }
+ }
+ }
+
+ for (int g = 0; g < groups.size(); g++)
+ {
+ cout << ">" << g << " [" << groups[g].m_loffset << ":" << groups[g].m_roffset << "] ";
+
+ cout << "(";
+ bool first = true;
+ for (int i = 0; i < groups[g].m_delta.size(); i++)
+ {
+ if (!first) { cout << " "; } first = false;
+ cout << groups[g].m_delta[i].m_offset << ":" << groups[g].m_delta[i].m_base;
+ }
+ cout << ") ";
+
+ first = true;
+ set<ID_t>::iterator si;
+ for (si = groups[g].m_readiids.begin(); si != groups[g].m_readiids.end(); si++)
+ {
+ if (!first) { cout << ":"; } first = false;
+ cout << *si;
+ }
+ cout << endl;
+
+ string seq = ctg.getUngappedSeqString(Range_t(groups[g].m_loffset, groups[g].m_roffset));
+
+ for (int i = 0; i < groups[g].m_delta.size(); i++)
+ {
+ seq[groups[g].m_delta[i].m_offset - groups[g].m_loffset] = tolower(groups[g].m_delta[i].m_base);
+ }
+
+ cout << seq << endl;
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR in contig iid" << iid << "\n" << e;
+ exit(1);
+ }
+ catch(...)
+ {
+ cerr << "Unknown error in contig iid" << iid << "\n";
+ exit(1);
+ }
+ }
+
+ cerr << "Searched " << bases << " positions in " << contigcount << " contigs." << endl;
+ cerr << displaycount << " positions reported of " << snpcount << " total SNPs found." << endl;
+}
+
diff --git a/src/Experimental/auto-fix-contigs.cc b/src/Experimental/auto-fix-contigs.cc
new file mode 100644
index 0000000..d0654c2
--- /dev/null
+++ b/src/Experimental/auto-fix-contigs.cc
@@ -0,0 +1,347 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+#include "ContigUtils.hh"
+#include "PersistentUtils.hh"
+#include "DataStore.hh"
+#include <sstream>
+#include "delta.hh"
+
+using namespace AMOS;
+using namespace std;
+
+int SAVERESULTS(0);
+int COLLAPSEFIX(0);
+int MARKLOCATIONS(0);
+int END_TRIM(500);
+
+int VERBOSE(0);
+
+typedef map<ID_t, CoverageStats> LibCE;
+
+
+struct AlignmentInfo_t
+{
+ int sR;
+ int eR;
+ int sQ;
+ int eQ;
+
+ bool prefix;
+ bool suffix;
+
+ AlignmentInfo_t(int _sR, int _eR, int _sQ, int _eQ, int lenR, int lenQ)
+ : sR(_sR), eR(_eR), sQ(_sQ), eQ(_eQ)
+ {
+ prefix = (sR - 1) < END_TRIM;
+ suffix = (lenR - eR) < END_TRIM;
+ }
+
+ bool qrc() { return eQ < sQ; }
+};
+
+struct AlignmentInfoCmp
+{
+ bool operator() (const AlignmentInfo_t & a, const AlignmentInfo_t & b)
+ {
+ return a.sR < b.sR;
+ }
+};
+
+pair<double, double> ceextreme(LibCE & ce, Range_t & rng, Contig_t ctg)
+{
+ double maxlo = 0, maxhi = 0;
+
+ int CERANGE = 10000;
+
+ int start = ctg.ungap2gap(rng.begin) - CERANGE;
+ int end = ctg.ungap2gap(rng.end) + CERANGE;
+
+ for (LibCE::iterator li = ce.begin(); li != ce.end(); li++)
+ {
+ for (int i = 1; i < li->second.m_curpos; i+=2)
+ {
+ int x = (int)li->second.m_coverage[i].x();
+
+ if ((start <= x) && (x <= end))
+ {
+ double ce = li->second.m_cestat[i];
+
+ if (ce > maxhi) { maxhi = ce; }
+ if (ce < maxlo) { maxlo = ce; }
+ }
+ }
+ }
+
+ return make_pair(maxlo, maxhi);
+}
+
+
+int main (int argc, char ** argv)
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ DataStore reference;
+ DataStore query;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Fixes contigs in one assembly based on alignment to contigs in another.\n"
+"The correct contig is selected based on the ce-statistic\n"
+"\n"
+" Usage: auto-fix-contigs [options] reference query delta.rq\n"
+"\n"
+" Options\n"
+" -------------------\n"
+" -s Save results to bank\n"
+" -m Just mark locations of potential events\n";
+" -v Be Verbose\n";
+"\n";
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+
+ tf->getOptions()->addOptionResult("s", &SAVERESULTS);
+ tf->getOptions()->addOptionResult("m", &MARKLOCATIONS);
+ tf->getOptions()->addOptionResult("v", &VERBOSE);
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() != 3)
+ {
+ cerr << "Usage: auto-fix-contigs [options] reference query delta" << endl;
+ return EXIT_FAILURE;
+ }
+
+ string referencebankname = argvv.front(); argvv.pop_front();
+ string querybankname = argvv.front(); argvv.pop_front();
+ string deltafile = argvv.front(); argvv.pop_front();
+
+ reference.openBank(referencebankname);
+ query.openBank(querybankname);
+
+ int mode = B_READ;
+ if (SAVERESULTS)
+ {
+ mode = B_READ|B_WRITE;
+ reference.contig_bank.close();
+ reference.contig_bank.open(referencebankname, mode);
+
+ reference.scaffold_bank.close();
+ reference.scaffold_bank.open(referencebankname, mode);
+ }
+
+ reference.feat_bank.close();
+ reference.feat_bank.open(referencebankname, B_READ|B_WRITE);
+
+ DeltaReader_t deltareader;
+ deltareader.open(deltafile);
+
+ cout << endl << "Analyzing Alignments" << endl;
+
+ while (deltareader.readNextHeadersOnly())
+ {
+ const DeltaRecord_t & record = deltareader.getRecord();
+
+ typedef vector<AlignmentInfo_t> AlignVector;
+ AlignVector aligns;
+
+ vector<DeltaAlignment_t>::const_iterator ai;
+ for (ai = record.aligns.begin();
+ ai != record.aligns.end();
+ ai++)
+ {
+ AlignmentInfo_t a(ai->sR, ai->eR, ai->sQ, ai->eQ, record.lenR, record.lenQ);
+ aligns.push_back(a);
+ }
+
+ if (aligns.size() > 1)
+ {
+ sort(aligns.begin(), aligns.end(), AlignmentInfoCmp());
+
+ cout << ">" << record.idR << "\t" << record.idQ << endl;
+
+ AlignVector::iterator cur, prev;
+
+ Contig_t refctg, qryctg;
+ vector<Insert *> refinserts, qryinserts;
+
+ LibCE refce, qryce;
+
+ reference.fetchContigEID(record.idR, refctg);
+ reference.calculateInserts(refctg.getReadTiling(), refinserts, 1, 0);
+ refce = reference.computeCEStats(refinserts);
+
+ query.fetchContigEID(record.idQ, qryctg);
+ query.calculateInserts(qryctg.getReadTiling(), qryinserts, 1, 0);
+ qryce = query.computeCEStats(qryinserts);
+
+
+ for (prev=aligns.end(), cur = aligns.begin();
+ cur != aligns.end();
+ prev=cur, cur++)
+ {
+ cout << cur->sR << "\t" << cur->eR << " | " << cur->sQ << "\t" << cur->eQ << "\t";
+
+ if (cur->prefix && cur->suffix) { cout << "[FULL] "; }
+ else if (cur->prefix) { cout << "[PREF] "; }
+ else if (cur->suffix) { cout << "[SUFF] "; }
+ else { cout << "[INTL] "; }
+
+ if (prev != aligns.end())
+ {
+ if (cur->qrc() != prev->qrc()) { cout << "Inconsistent qdir" << endl; continue; }
+
+ Range_t ref(min(prev->eR, cur->sR), max(prev->eR, cur->sR));
+ Range_t qry(prev->eQ, cur->sQ);
+
+ bool qrc = false;
+
+ if (cur->qrc()) { qry.swap(); qrc = true; }
+
+ int refdst = ref.end - ref.begin;
+ int qrydst = qry.end - qry.begin;
+ int delta = refdst - qrydst;
+
+ pair<double,double> refextreme = ceextreme(refce, ref, refctg);
+ pair<double,double> qryextreme = ceextreme(qryce, qry, qryctg);
+
+ cout << refdst << " " << qrydst << " : " << delta;
+ cout << " | " << refextreme.first << "," << refextreme.second
+ << " | " << qryextreme.first << "," << qryextreme.second;
+
+ if (refextreme.first < qryextreme.first)
+ {
+ cout << " Confirmed collapse in reference!: " << ref.begin << "," << ref.end << endl;
+
+ ReadPosLookup refpos, querypos;
+ recordReadPositions(refctg.getIID(), refctg.getReadTiling(), refpos);
+ recordReadPositions(qryctg.getIID(), qryctg.getReadTiling(), querypos);
+
+ ReadPosLookup::iterator ri, rlow, rhigh, qi, qlow, qhigh;
+ rlow = refpos.end();
+ rhigh = refpos.end();
+
+ for (ri = refpos.begin(); ri != refpos.end(); ri++)
+ {
+ if ((ri->second.getRightOffset() < ref.begin) &&
+ ((rlow == refpos.end()) || (ri->second.getRightOffset() > rlow->second.getRightOffset())))
+ {
+ qi = querypos.find(ri->first);
+ if ((qi != querypos.end()) && (qi->second.getRightOffset() < qry.begin)) { rlow = ri; qlow=qi; }
+ }
+
+ if ((ri->second.m_offset > ref.end) &&
+ ((rhigh == refpos.end()) || (ri->second.m_offset < rhigh->second.m_offset)))
+ {
+ qi = querypos.find(ri->first);
+ if ((qi != querypos.end()) && (qi->second.m_offset > qry.end)) { rhigh = ri; qhigh=qi; }
+ }
+ }
+
+ bool foundlow = false;
+ bool foundhi = false;
+ if (rlow != refpos.end())
+ {
+ foundlow = true;
+ cout << "Found rlow: " << rlow->first
+ << " [" << rlow->second.m_offset << ", " << rlow->second.getRightOffset() << "]" << endl;
+ }
+
+ if (rhigh != refpos.end())
+ {
+ foundhi = true;
+ cout << "Found rhigh: " << rhigh->first
+ << " [" << rhigh->second.m_offset << ", " << rhigh->second.getRightOffset() << "]" << endl;
+ }
+
+ if (foundlow && foundhi)
+ {
+ cout << "Found low and hi" << endl;
+ }
+ else
+ {
+ cout << "Didn't find both" << endl;
+ }
+
+ if (SAVERESULTS && foundlow && foundhi)
+ {
+ set<ID_t> masterreads, patchreads;
+ Range_t stitchRegion;
+
+ bool PERFECT_OVL = false;
+ bool SAVE_TO_NEW_REF_CONTIG = false;
+
+ stitchContigs(reference.contig_bank, reference.read_bank, reference.scaffold_bank, reference.feat_bank,
+ query.contig_bank, query.read_bank, query.feat_bank,
+ reference.read_bank.lookupEID(rlow->first),
+ reference.read_bank.lookupEID(rhigh->first),
+ masterreads, patchreads, stitchRegion,
+ refctg.getIID(), 0, qryctg.getIID(),
+ SAVE_TO_NEW_REF_CONTIG, PERFECT_OVL);
+ }
+ else
+ {
+ Feature_t feat;
+ feat.setRange(ref);
+ feat.setSource(make_pair(refctg.getIID(), Contig_t::NCODE));
+ feat.setType('F');
+
+ stringstream comment;
+ comment << "Potential Collapsed Repeat delta=" << delta;
+ comment << " patch: " << querybankname;
+ feat.setComment(comment.str());
+
+ reference.feat_bank << feat;
+ }
+
+ COLLAPSEFIX++;
+ }
+ }
+
+ cout << endl;
+ }
+
+ cout << endl;
+ }
+ }
+
+ cout << "@Summary:"
+ << " reference " << referencebankname
+ << " query " << querybankname
+ << " Corrected " << COLLAPSEFIX << " collapsed repeats" << endl;
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ return retval;
+}
diff --git a/src/Experimental/autoJoiner.pl b/src/Experimental/autoJoiner.pl
new file mode 100755
index 0000000..ab7a595
--- /dev/null
+++ b/src/Experimental/autoJoiner.pl
@@ -0,0 +1,1869 @@
+#!/usr/bin/perl -w
+
+use strict;
+use TIGR::Foundation;
+use File::Spec;
+use File::Copy;
+use File::Basename;
+use Cwd;
+
+$|++; # no buffering on STDOUT
+
+my $platformbin = "/fs/sz-user-supported/Linux-x86_64/bin";
+my $commonbin = "/fs/sz-user-supported/common/bin";
+
+my $VERSION = " Version 1.20 (Build " . (qw/$Revision$/ )[1] . ")";
+
+my $CAT = "/bin/cat";
+my $RM = "/bin/rm";
+
+my $AEEXEC = "/usr/local/common/aeexec";
+my $REMAPFEATURES = "/usr/local/common/remapFeatures";
+
+my $CONTIG2FASTA = "$commonbin/contig2fasta";
+my $SPLITFASTA = "$commonbin/splitFasta";
+my $SIZEFASTA = "$commonbin/sizeFasta";
+my $CUTFASTA = "$commonbin/cutFasta";
+my $CA2AJSCAFF = "$commonbin/ca2ajscaff";
+my $FILTERCONTIG = "$commonbin/filter_contig";
+my $FILTERSEQ = "$commonbin/filter_seq";
+my $EVALOVERLAP = "$commonbin/aj_evaluateSequenceOverlaps";
+
+my $NUCMER = "$platformbin/nucmer";
+my $SHOWCOORDS = "$platformbin/show-coords";
+my $JOINCONTIGS = "$platformbin/aj_joinContigs";
+my $LOWCOMPLEXITYFILTER = "$platformbin/aj_lowcomplexityfilter";
+my $TOAMOS = "$platformbin/toAmos";
+my $AJSCAFF2AMOS = "$platformbin/aj_scaff2amos";
+my $BANKTRANSACT = "$platformbin/bank-transact";
+
+my $BANK2CONTIG = "bank2contig";
+my $DUMPREADS = "dumpreads";
+my $BANK2SCAFF = "bank2scaff";
+my $AMOS2MATES = "amos2mates";
+my $BANKREPORT = "bank-report";
+my $LOADFEATURES = "loadFeatures";
+my $DUMPFEATURES = "dumpFeatures";
+
+
+my $SELF = $0;
+my $USAGE = "Usage: autoJoin <prefix.bnk> [OPTIONS]\n";
+
+my $tf = new TIGR::Foundation;
+
+my $DOVERBOSE = 1;
+my $DOJOIN = 0;
+my $DOVALIDATE = 0;
+my $DOAEVALIDATE = 0;
+
+my $MATCHLEN = 15;
+my $CLUSTERLEN = 30;
+my $RANGEWINDOW = 100; ## FATTENRADIUS is already ~500
+my $FSEQOVERLAP = 10000;
+my $DEFAULT_STDEV = 100;
+
+my $ALIGNTHRESHOLD = 94.0; ## Minimum alignment similiarity (%ID) for joining contigs
+
+my $MAXGAPSIZE = 1000; ## Max Gap size before giving up
+my $MINGAPSTDEV = 100.00; ## Hard floor on gap standard deviation
+my $GAPSTDTHRESH = 4; ## Max acceptable number of standard deviations
+
+my $JOINPREFIX = "aj_";
+my $JOINSUFFIX = "_joined";
+my $ALIGNMENTDIR = "alignment";
+my $RESULTSDIR = "results";
+my $JOINDIR = "joincontigs";
+my $OVERLAPREPORT = "overlap.report";
+
+
+my $HELPTEXT = qq~
+AutoJoin contigs and close sequencing gaps in an assembly through contig
+extension. The input is an AMOS bank (prefix.bnk) containing contigs and
+scaffold. Within the autoJoin work directory (-dir), there will be an alignment
+directory which contains all of the alignment information and intermediate
+files for the join process. Final results are stored in a results directory.
+
+The main result is a prefix.bnk in the results directory containing a
+new AMOS bank with the AutoJoined assembly. In addition, in the results
+directory are the prefix.{contig,qual,seq,pos} files which contain the entire
+assembly after autoJoiner. (prefix_joined contains just those contigs that
+autoJoiner sucessful on.) A report on the results of autoJoiner are stored
+in prefix.joinreport.
+
+In addition, a prefix.unjoined file is created which lists every contig id
+that autoJoiner did not perform any join actions on, prefix.feat which has
+all original features remapped plus new AUTOJOIN features, and a prefix.scaff
+file containing the updated scaffold.
+
+ $USAGE
+ prefix.bnk is the path to the AMOS bank.
+
+ Options
+ -------
+ -dir <dir> Output directory [ Default: autoJoin ]
+ -prefix <pre> Prefix for joined contig names [ Default: aj_ ]
+ -join Actually do the joins [ Default: nojoins ]
+
+ -alignment <threshold> Specify Minimum percent identity for an alignment
+ to be used for joining contigs together.
+ [ Default: 94.0 ]
+~;
+
+my $EXTRAHELP = qq~
+Within the results directory, autoEditor can be run and creates its own output
+in the autoEditor directory, and a upload directory which contains all of the
+files necessary to load the AutoJoined+AutoEdited assembly into the database
+(via aloader). In addition the prefix.sq.contigs file is present which has
+been updated for the autoEditor results.
+
+ -D <db> Assembly project (for autoEditor & validation)
+ -[no]join Toggle between eval & eval+join [ Default: -join ]
+ -[no]validate Validate the join against a 1con [ Default: -novalidate ]
+ -[no]edit Edit the resultant assembly [ Default: -noedit ]
+ -[no]aevalidate Validate against AE contigs [ Default: -noaevalidate ]
+~;
+
+my @DEPENDS =
+(
+ "TIGR::Foundation",
+ $CA2AJSCAFF,
+ $SPLITFASTA,
+ $CONTIG2FASTA,
+ $FILTERCONTIG,
+ $FILTERSEQ,
+ $NUCMER,
+ $SHOWCOORDS,
+ $SIZEFASTA,
+ $CAT,
+);
+
+sub echo
+{
+ my $str = join " ", @_;
+
+ $tf->logLocal($str, 4);
+ print @_ if ($DOVERBOSE);
+}
+
+sub runCmd
+{
+ my $cmd = shift;
+ my $info = shift;
+
+ echo "$info... " if defined $info;
+
+ my $exitcode = $tf->runCommand($cmd);
+
+ if ($exitcode)
+ {
+ echo "failed! ($!)\n" if defined $info;
+ $tf->bail("Error with $cmd ($exitcode)");
+ }
+
+ echo "ok.\n" if defined $info;
+}
+
+sub tfmkdir
+{
+ runCmd("mkdir $_[0]") if (! -r $_[0]);
+}
+
+sub tfchdir
+{
+ $tf->logLocal("chdir $_[0]",4);
+ chdir $_[0];
+}
+
+
+{
+ my $joinid = 0;
+ sub getJoinId
+ {
+ $joinid++;
+ return "$JOINPREFIX$joinid";
+ }
+}
+
+sub getSize
+{
+ my $file = shift;
+ my $cmd = "$SIZEFASTA $file";
+
+ $tf->logLocal("Running $cmd", 4);
+ my $out = `$cmd`;
+
+ if ($?)
+ {
+ echo "failed!\n";
+ $tf->bail("$cmd failed ($?)") if ($?);
+ }
+
+ return (split /\s+/, $out)[1];
+}
+
+sub getGappedSize
+{
+ my $contig = shift;
+
+ my $gsize = -1;
+
+ open CONTIG, "< $contig"
+ or $tf->bail("Can't open $contig");
+
+ while (<CONTIG>)
+ {
+ if (/^\#\#(\S+) \d+ (\d+) bases/)
+ {
+ $gsize = $2;
+ last;
+ }
+ }
+
+ close CONTIG;
+
+ $tf->bail("Invalid contig file $contig")
+ if $gsize == -1;
+
+ return $gsize;
+}
+
+
+sub tfsymlink
+{
+ $tf->bail("Can't read $_[0]")
+ if (! -r $_[0]);
+
+ symlink ($_[0], $_[1])
+ or $tf->bail("Can't symlink $_[0] to $_[1]");
+}
+
+{
+ my %features;
+
+ sub loadFeatures
+ {
+ my $featfile = shift;
+ echo " loading existing features from $featfile\n";
+
+ open FEAT, "< $featfile"
+ or $tf->bail("Can't read $featfile ($!)\n");
+
+ while (<FEAT>)
+ {
+ my $feature;
+
+ chomp;
+ my @fields = split /\s+/, $_;
+
+ my $contigid = shift @fields;
+ $feature->{type} = shift @fields;
+ $feature->{end5} = shift @fields;
+ $feature->{end5g} = $feature->{end5};
+ $feature->{end3} = shift @fields;
+ $feature->{end3g} = $feature->{end3};
+ $feature->{comment} = join(" ", @fields);
+
+ push @{$features{$contigid}}, $feature;
+ }
+
+ close FEAT;
+ }
+
+ sub printFeatures
+ {
+ my $filename = shift;
+
+ open NEWFEAT, "> $filename"
+ or $tf->bail("Can't read $filename ($!)\n");
+
+ foreach my $contigid (sort keys %features)
+ {
+ next if !defined $features{$contigid};
+ #next if !getContigInfo($contigid)->{isjoin};
+
+ foreach my $feature (@{$features{$contigid}})
+ {
+ my $end5 = $feature->{end5};
+ my $end3 = $feature->{end3};
+ my $type = $feature->{type};
+ my $comment = $feature->{comment};
+
+ print NEWFEAT "$contigid\t$type\t$end5\t$end3\t$comment\n";
+ }
+ }
+ }
+
+ sub createJoinFeature
+ {
+ my $gapinfo = shift;
+ my $joinid = $gapinfo->{autojoin}->{id};
+
+ my $left = $gapinfo->{left}->{id};
+ my $right = $gapinfo->{right}->{id};
+
+ my $gapsize = $gapinfo->{autojoin}->{gapsize};
+ my $idscore = $gapinfo->{autojoin}->{idscore};
+ my $olen = $gapinfo->{autojoin}->{olen};
+
+ my $joinfeature;
+ $joinfeature->{isjoin} = 1;
+
+ $joinfeature->{type} = "J";
+ $joinfeature->{comment} = qq~AutoJoin $left $right gapsize:$gapsize overlap:$olen bp @ $idscore%\n~;
+
+ ## TODO: These are ungapped coordinates
+ $joinfeature->{end5} = $gapinfo->{autojoin}->{begin};
+ $joinfeature->{end3} = $gapinfo->{autojoin}->{end};
+
+ return $joinfeature;
+ }
+
+ sub remapJoinedFeatures
+ {
+ my $gapinfo = shift;
+
+ my $left = $gapinfo->{left}->{id};
+ my $leftsize = $gapinfo->{left}->{size};
+ my $leftgsize = $gapinfo->{left}->{gsize};
+
+ my $right = $gapinfo->{right}->{id};
+ my $rightsize = $gapinfo->{right}->{size};
+ my $rightgsize = $gapinfo->{right}->{gsize};
+
+ my $joinid = $gapinfo->{autojoin}->{id};
+ my $joinsize = $gapinfo->{autojoin}->{size};
+ my $joingsize = $gapinfo->{autojoin}->{gsize};
+
+ if (defined $features{$left} || defined $features{$right})
+ {
+ my $jointype;
+
+ if ($gapinfo->{left}->{oo} eq "BE")
+ {
+ ## left features are the same
+ push @{$features{$joinid}}, @{$features{$left}}
+ if defined $features{$left};
+
+ if ($gapinfo->{right}->{oo} eq "BE")
+ {
+ $jointype = "I";
+
+ ## remap right features based on distance to rightmost edge
+ foreach my $f (@{$features{$right}})
+ {
+ $f->{end5} = $joinsize - ($rightsize - $f->{end5});
+ $f->{end3} = $joinsize - ($rightsize - $f->{end3});
+
+ $f->{end5g} = $joingsize - ($rightgsize - $f->{end5g});
+ $f->{end3g} = $joingsize - ($rightgsize - $f->{end3g});
+
+ push @{$features{$joinid}}, $f;
+ }
+ }
+ else
+ {
+ $jointype = "II";
+
+ ## remap right features based on distance to rightmost edge (reverse)
+
+ foreach my $f (@{$features{$right}})
+ {
+ my $swap = $f->{end5};
+
+ $f->{end5} = $joinsize - $f->{end3};
+ $f->{end3} = $joinsize - $swap;
+
+ $swap = $f->{end5g};
+
+ $f->{end5g} = $joinsize - $f->{end3g};
+ $f->{end3f} = $joinsize - $swap;
+
+ push @{$features{$joinid}}, $f;
+ }
+ }
+ }
+ else
+ {
+ ## remap left features based on distance to rightmost edge
+ foreach my $f (@{$features{$left}})
+ {
+ $f->{end5} = $joinsize - ($leftsize - $f->{end5});
+ $f->{end3} = $joinsize - ($leftsize - $f->{end3});
+
+ $f->{end5g} = $joingsize - ($leftgsize - $f->{end5g});
+ $f->{end3g} = $joingsize - ($leftgsize - $f->{end3g});
+
+ push @{$features{$joinid}}, $f;
+ }
+
+ if ($gapinfo->{right}->{oo} eq "EB")
+ {
+ $jointype = "III";
+
+ ## Right Features are the same (EB-EB)
+ push @{$features{$joinid}}, @{$features{$right}}
+ if defined $features{$right};
+ }
+ else
+ {
+ $jointype = "IV";
+
+ ##EB-BE
+ foreach my $f (@{$features{$right}})
+ {
+ my $swap = $f->{end5};
+ $f->{end5} = $rightsize - $f->{end3};
+ $f->{end3} = $rightsize - $swap;
+
+ $swap = $f->{end5g};
+ $f->{end5g} = $rightsize - $f->{end3g};
+ $f->{end3g} = $rightsize - $swap;
+
+ push @{$features{$joinid}}, $f;
+ }
+ }
+ }
+
+ delete $features{$left};
+ delete $features{$right};
+
+ echo "Remapping $left and $right features into $joinid (Type $jointype)\n";
+ }
+
+ my $joinfeature = createJoinFeature($gapinfo);
+ push @{$features{$joinid}}, $joinfeature;
+ }
+}
+
+
+
+sub prepareAssembly
+{
+ my $prefix = shift; ## dmg
+ my $bankdir = shift; ## path/to/dmg.bnk
+
+ echo "prepare assembly...\n";
+
+ runCmd("$RM -rf $RESULTSDIR", "Warning: deleting old results directory ($RESULTSDIR)")
+ if (-r $RESULTSDIR);
+
+ tfmkdir($RESULTSDIR);
+
+ runCmd("($DUMPREADS -e -r -c $bankdir > $prefix.seq) >& /dev/null", " dumpreads seq")
+ if (! -r "$prefix.seq");
+
+ runCmd("($DUMPREADS -e -q -r $bankdir > $prefix.qual) >& /dev/null", " dumpreads qual")
+ if (! -r "$prefix.qual");
+
+ foreach my $suffix (qw/seq qual/)
+ {
+ if (! -r "$prefix.$suffix.idx")
+ {
+ runCmd("$FILTERSEQ -index $prefix.$suffix",
+ " Creating $suffix idx");
+ }
+ }
+
+ runCmd("($BANK2CONTIG -e $bankdir > $prefix.contig) >& /dev/null", " bank2contig")
+ if (! -r "$prefix.contig");
+
+ runCmd("($BANK2SCAFF -e $bankdir > $prefix.scaff) >& /dev/null", " bank2scaff")
+ if (! -r "$prefix.scaff");
+
+ runCmd("($BANKREPORT -b $bankdir | $AMOS2MATES > $prefix.mates) >& /dev/null", " bank2mates")
+ if (! -r "$prefix.mates");
+
+ runCmd("($DUMPFEATURES $bankdir > $prefix.feat) >& /dev/null", " dumping original features")
+ if (! -r "$prefix.feat");
+
+ loadFeatures("$prefix.feat");
+
+ loadLayout($prefix);
+
+ if (! -r "fasta")
+ {
+ tfmkdir("fasta");
+
+ my $cmd = "$CONTIG2FASTA $prefix.contig > fasta/$prefix.fasta";
+ my $info = " contig2fasta $prefix";
+ runCmd($cmd, $info);
+
+ tfchdir("fasta");
+ runCmd("$SPLITFASTA $prefix.fasta > /dev/null");
+ tfchdir("..");
+ }
+
+ loadOrigContigSizes("fasta/$prefix.fasta");
+}
+
+{
+ my %contigstatus;
+ my %origcontiginfo;
+
+ my %gapsizes;
+
+ sub getExpectedGapSize
+ {
+ return ($gapsizes{$_[0]}->{size}, $gapsizes{$_[0]}->{stdev});
+ }
+
+ sub gapTooLarge
+ {
+ my $gapinfo = shift;
+
+ my $gapsize = $gapinfo->{expectedgap};
+ my $gapstdev = $gapinfo->{gapstdev};
+
+ if ($gapstdev < $MINGAPSTDEV) { $gapstdev = $MINGAPSTDEV; }
+
+ ## Minimum size the gap may be as indicated by links
+ my $mingapsize = $gapsize - ($gapstdev * $GAPSTDTHRESH);
+ if ($mingapsize < 0) { $mingapsize = 0; }
+
+ my $retval = ($mingapsize >= $MAXGAPSIZE);
+
+ if ($retval)
+ {
+ print "Gap too large: $mingapsize $gapsize $gapstdev\n";
+ }
+
+ return $retval;
+ }
+
+ sub loadLayout
+ {
+ my $prefix = shift;
+
+ my $suffix = "contig";
+ my $createlayout = 0;
+
+ if (! -r "$prefix.layout")
+ {
+ open LAYOUT, "> $prefix.layout"
+ or $tf->bail("Can't open $prefix.layout to create layout ($!)");
+
+ $createlayout = 1;
+ }
+ else
+ {
+ $suffix = "layout";
+ }
+
+ open CONTIG, "< $prefix.$suffix"
+ or $tf->bail("Can't open $prefix.$suffix to load layout ($!)");
+
+ while (<CONTIG>)
+ {
+ if (/^\#\#(\S+) \d+ (\d+) bases/)
+ {
+ $origcontiginfo{$1}->{gsize} = $2;
+ }
+
+ if ($createlayout)
+ {
+ print LAYOUT $_ if (/^\#/);
+ }
+ }
+
+ close CONTIG;
+ close LAYOUT if ($createlayout);
+ }
+
+ sub loadOrigContigSizes
+ {
+ my $file = shift;
+ my $cmd = "$SIZEFASTA $file";
+
+ echo " loading original contig sizes\n";
+
+ $tf->logLocal("Running $cmd", 4);
+ my @out = `$cmd`;
+
+ if ($?)
+ {
+ echo "failed!\n";
+ $tf->bail("$cmd failed ($?)") if ($?);
+ }
+
+ foreach (@out)
+ {
+ my @vals = split;
+ $origcontiginfo{$vals[0]}->{size} = $vals[1];
+ }
+ }
+
+ sub addOrigContig
+ {
+ my $id = shift;
+ my $oo = shift;
+ my $contiglen = shift;
+ my $gapsize = shift;
+ my $gapstdev = shift;
+
+ $gapsizes{$id}->{size} = $gapsize;
+ $gapsizes{$id}->{stdev} = $gapstdev;
+
+ $contigstatus{$id}->{id} = $id;
+ $contigstatus{$id}->{oo} = $oo;
+ $contigstatus{$id}->{size} = $origcontiginfo{$id}->{size};
+ $contigstatus{$id}->{gsize} = $origcontiginfo{$id}->{gsize};
+
+ $contigstatus{$id}->{comment} = "CA_CONTIG: $id"
+ if (!exists $contigstatus{$id}->{comment});
+ }
+
+ sub printUnjoinedContigs
+ {
+ my $filename = shift;
+
+ open UNJOINED, "> $filename"
+ or $tf->bail("Can't open $filename");
+
+ foreach my $id (keys %contigstatus)
+ {
+ if (!defined($contigstatus{$id}->{newid}) &&
+ !defined($contigstatus{$id}->{isjoin}))
+ {
+ print UNJOINED "$id\n";
+ }
+ }
+
+ close UNJOINED;
+ }
+
+ sub getContigInfo
+ {
+ my $id = shift;
+ my $norecurse = shift;
+
+ my $cs = $contigstatus{$id};
+
+ if (! defined $norecurse)
+ {
+ while (defined $cs && defined $cs->{newid})
+ {
+ $cs = $contigstatus{$cs->{newid}};
+ }
+ }
+
+ return $cs;
+ }
+
+ sub createJoinContigInfo
+ {
+ my $gapinfo = shift;
+
+ my $joinid = $gapinfo->{autojoin}->{id};
+
+ ## Add the joined contig to the contigstatus db
+ $contigstatus{$joinid}->{id} = $gapinfo->{autojoin}->{id};
+ $contigstatus{$joinid}->{size} = $gapinfo->{autojoin}->{size};
+ $contigstatus{$joinid}->{gsize} = $gapinfo->{autojoin}->{gsize};
+ $contigstatus{$joinid}->{prefix} = $gapinfo->{autojoin}->{prefix};
+
+ ## New contig has same orientation as left contig, right contig still has old oo
+ $contigstatus{$joinid}->{oo} = $gapinfo->{left}->{oo};
+
+ $contigstatus{$joinid}->{isjoin} = 1;
+
+ my $leftid = $gapinfo->{left}->{id};
+ my $rightid = $gapinfo->{right}->{id};
+
+ ## Remember the join chain explicitly
+ if (defined $contigstatus{$leftid}->{joinchain})
+ {
+ $contigstatus{$joinid}->{joinchain} = $contigstatus{$leftid}->{joinchain};
+ }
+ else
+ {
+ $contigstatus{$joinid}->{joinchain} = "$leftid";
+ }
+
+ $contigstatus{$joinid}->{joinchain} .= " $rightid";
+ }
+}
+
+sub nucmerSeqs
+{
+ my $info = shift;
+ my $ref = shift;
+ my $query = shift;
+ my $options = shift;
+
+ my $out = shift;
+ $out = "out" if (!defined $out);
+
+ if (! -r "$out.delta")
+ {
+ my $cmd = "$NUCMER -p $out $options $ref $query 2> /dev/null";
+ runCmd($cmd, $info);
+ }
+
+ runCmd("$SHOWCOORDS $out.delta > $out.coords")
+ if (! -r "$out.coords");
+}
+
+
+sub parseGap
+{
+ my $stats = shift;
+ my $prefix = shift;
+
+ my $left = shift;
+ my $right = shift;
+
+ $stats->{SequenceGaps}++;
+
+ my $gapinfo;
+ $gapinfo->{left} = getContigInfo($left);
+ $gapinfo->{right} = getContigInfo($right);
+ $gapinfo->{iprefix} = $prefix;
+
+ my $workdir = "alignment-$left-$right";
+ $gapinfo->{workdir} = $workdir;
+
+ my ($expectedgap, $gapstdev) = getExpectedGapSize($left);
+ $gapinfo->{expectedgap} = $expectedgap;
+ $gapinfo->{gapstdev} = $gapstdev;
+
+ $gapinfo->{autojoin}->{status} = 0;
+
+ echo "\n>$workdir $expectedgap \[$gapstdev\] $gapinfo->{left}->{id} $gapinfo->{right}->{id} $gapinfo->{left}->{oo}-$gapinfo->{right}->{oo}\n";
+
+ return $gapinfo;
+}
+
+## Create a full sequence file (fseq) which contains the consensus and the
+## full range sequence of those sequence which are within FSEQOVERLAP (10kb)
+## of the overlapping edge of the contig
+sub createFseqFile
+{
+ my $id = shift;
+ my $size = shift;
+ my $side = shift;
+
+ my $fseq = "$id.fseq";
+ my $fseqorig = "$fseq.0";
+
+ return if -r $fseq;
+
+ my %edgesequences;
+
+ my $suffix = "contig";
+ $suffix = "layout" if (-r "$id.layout");
+
+ open LAYOUT, "< $id.$suffix"
+ or $tf->bail("Couldn't open $id.$suffix ($!)");
+
+ my $savecount = 0;
+
+ while (<LAYOUT>)
+ {
+ if (/^\#(\S+)\((\d+)\)/)
+ {
+ my $seqname = $1;
+ my $offset = $2;
+ my $len = $1 if /(\d+) bases/;
+
+ my $left = $offset+0;
+ my $right = $offset+$len;
+
+ my $savesequence = 0;
+
+ if ($side eq "B")
+ {
+ $savesequence = ($left < $FSEQOVERLAP);
+ }
+ else
+ {
+ $savesequence = (($size - $right) < $FSEQOVERLAP);
+ }
+
+ $edgesequences{$seqname} = 1 if ($savesequence);
+ $savecount += $savesequence;
+ }
+ }
+ close LAYOUT;
+
+ ## It is possible that no sequences will be picked up, in the case of
+ ## a NUU on the flanking edge
+ if ($savecount)
+ {
+ open SEQ, "< $id.seq"
+ or $tf->bail("Couldn't open $id.seq ($!)");
+
+ open FSEQ, ">> $fseqorig"
+ or $tf->bail("Couldn't open $id.fseq ($!)");
+
+ my $printid = 0;
+
+ while (<SEQ>)
+ {
+ $printid = exists $edgesequences{$1} if (/>(\S+)/);
+ print FSEQ $_ if $printid;
+ }
+
+ close SEQ;
+ close FSEQ;
+
+ runCmd("$LOWCOMPLEXITYFILTER $fseqorig $fseq");
+ }
+
+ ## Copy the consensus last so we don't have to worry about running the
+ ## complexity filter on it.
+
+ runCmd("$CAT $id.fasta >> $fseq");
+}
+
+
+sub alignContigs
+{
+ my $gapinfo = shift;
+ my $ajdir = shift;
+
+ my $iprefix = $gapinfo->{iprefix};
+
+ echo "prepare contigs for alignment... ";
+
+ foreach my $type (qw/left right/)
+ {
+ my $id = $gapinfo->{$type}->{id};
+
+ if (defined $gapinfo->{$type}->{prefix})
+ {
+ my $fprefix = $gapinfo->{$type}->{prefix};
+ $fprefix = "$ajdir/$fprefix";
+
+ foreach my $suffix (qw/contig fasta seq qual/)
+ {
+ if (! -r "$id.$suffix")
+ {
+ tfsymlink("$fprefix.$suffix", "$id.$suffix");
+ }
+ }
+ }
+ else
+ {
+ if (! -r "$id.fasta")
+ {
+ my $suffix = "seq";
+ $suffix = "fasta" if (-r "$ajdir/fasta/$id.fasta");
+
+ tfsymlink("$ajdir/fasta/$id.$suffix", "$id.fasta");
+ }
+
+ runCmd("$FILTERCONTIG $ajdir/$iprefix.layout $id > $id.layout")
+ if (! -r "$id.layout");
+
+ runCmd("$FILTERSEQ $id.layout $ajdir/$iprefix.seq > $id.seq")
+ if (! -r "$id.seq");
+ }
+
+ $gapinfo->{$type}->{size} = getSize("$id.fasta")
+ if !defined $gapinfo->{$type}->{size};
+ }
+
+ createFseqFile($gapinfo->{left}->{id},
+ $gapinfo->{left}->{size},
+ $gapinfo->{left}->{oo} eq "BE" ? "E" : "B");
+
+ createFseqFile($gapinfo->{right}->{id},
+ $gapinfo->{right}->{size},
+ $gapinfo->{right}->{oo} eq "BE" ? "B" : "E");
+
+ echo "ok.\n";
+
+ nucmerSeqs("align extended contigs",
+ "$gapinfo->{left}->{id}.fseq",
+ "$gapinfo->{right}->{id}.fseq",
+ "--maxmatch -l $MATCHLEN -c $CLUSTERLEN");
+}
+
+sub hasPotentialJoin
+{
+ my $gapinfo = shift;
+ my $stats = shift;
+
+ my $retval = 0;
+
+ if (! -r $OVERLAPREPORT)
+ {
+ my $cmd = "$EVALOVERLAP $gapinfo->{left}->{oo} $gapinfo->{right}->{oo} out.coords ".
+ "-gapsize $gapinfo->{expectedgap} -gapstdev $gapinfo->{gapstdev} ".
+ "-alignthresh $ALIGNTHRESHOLD -debug 1 > $OVERLAPREPORT";
+ runCmd($cmd, "evaluate sequence overlaps");
+ }
+
+ if (-r $OVERLAPREPORT)
+ {
+ my $cmd = undef;
+
+ open EVAL, "< $OVERLAPREPORT"
+ or $tf->bail("Can't open $OVERLAPREPORT ($!)");
+
+ while (<EVAL>)
+ {
+ next if (!/^\@/);
+
+ if (/Gap/)
+ {
+ echo $_;
+ }
+ elsif ((/^\@\=/) && (!defined $cmd))
+ {
+ echo $_;
+ chomp;
+
+ $cmd = $_;
+ $cmd =~ s/^\@\=//;
+
+ $stats->{Overlap}++;
+ $gapinfo->{autojoin}->{cmd} = $cmd;
+ $retval = 1;
+ }
+ }
+
+ close EVAL;
+ }
+
+ return $retval;
+}
+
+sub loadJoinReport
+{
+ my $gapinfo = shift;
+ my $joinreport = $gapinfo->{autojoin}->{report};
+
+ open JOINREPORT, "< $joinreport"
+ or $tf->bail("Can't open joinreport $joinreport ($!)");
+
+ while (<JOINREPORT>)
+ {
+ chomp;
+ my ($tag,$value) = split /=/, $_;
+
+ if ($tag eq "finalbegin") { $gapinfo->{autojoin}->{begin} = $value; }
+ elsif ($tag eq "finalend") { $gapinfo->{autojoin}->{end} = $value; }
+ elsif ($tag eq "gapsize") { $gapinfo->{autojoin}->{gapsize} = $value; }
+ elsif ($tag eq "idscore") { $gapinfo->{autojoin}->{idscore} = $value; }
+ elsif ($tag eq "olen") { $gapinfo->{autojoin}->{olen} = $value; }
+ elsif ($tag eq "extension") { $gapinfo->{autojoin}->{extension} = $value; }
+ elsif ($tag eq "rex") { $gapinfo->{autojoin}->{rex} = $value; }
+ elsif ($tag eq "qex") { $gapinfo->{autojoin}->{qex} = $value; }
+ elsif ($tag eq "joinid") { $gapinfo->{autojoin}->{id} = $value; }
+ }
+
+ close JOINREPORT;
+
+# foreach my $t (sort keys %{$gapinfo->{autojoin}}) { print "$t=$gapinfo->{autojoin}->{$t}\n"; }
+}
+
+sub joinContigs
+{
+ my $gapinfo = shift;
+ my $stats = shift;
+ my $ajdir = shift; ## ../..
+
+ my $retval = 0;
+
+ my $joinreport = "join.report";
+ $gapinfo->{autojoin}->{report} = "$JOINDIR/$joinreport";
+
+ my $joinid = getJoinId();
+
+ if (! -r $gapinfo->{autojoin}->{report})
+ {
+ $retval = 1;
+
+ if (! -r $JOINDIR)
+ {
+ ## Specify the data prefix, but there may be files to work on in the cwd
+ $gapinfo->{autojoin}->{cmd} = "$JOINCONTIGS $gapinfo->{autojoin}->{cmd} ".
+ "-dir $JOINDIR ".
+ "-id $joinid ".
+ "-data $ajdir/$gapinfo->{iprefix} ".
+ "-report $joinreport";
+
+# echo "Joincmd: $gapinfo->{autojoin}->{cmd}\n";
+
+ ## Join not attempted previously
+ $retval = $tf->runCommand($gapinfo->{autojoin}->{cmd});
+ }
+
+ if ($retval)
+ {
+ my $reason = ($retval == 2) ? "Nucmer2" : "Unknown";
+ echo "Status: Error! ($reason)\n";
+ $stats->{Error}++;
+ }
+ }
+
+ if (!$retval)
+ {
+ $stats->{Joined}++;
+ loadJoinReport($gapinfo);
+
+ ## Joinid may be different if we are using euids
+ $joinid = $gapinfo->{autojoin}->{id};
+
+ $gapinfo->{left}->{newid} = $joinid;
+ $gapinfo->{right}->{newid} = $joinid;
+
+ $gapinfo->{autojoin}->{status} = 1;
+ $gapinfo->{autojoin}->{size} = getSize("$JOINDIR/$joinid.fasta");
+ $gapinfo->{autojoin}->{gsize} = getGappedSize("$JOINDIR/$joinid.contig");
+ $gapinfo->{autojoin}->{prefix} = "$ALIGNMENTDIR/$gapinfo->{workdir}/$JOINDIR/$joinid";
+
+ createJoinContigInfo($gapinfo);
+ }
+
+ return $retval;
+}
+
+
+
+sub countGoodAlignments
+{
+ my $coords = shift;
+ my $minsize = shift;
+ my $minpercent = shift;
+ my $percidref = shift;
+
+ $$percidref = 0 if defined $percidref;
+
+ my $good = 0;
+ my $count = 0;
+
+ open COORDS, "< $coords"
+ or $tf->bail("Can't open $coords ($!)");
+
+ my $inalignment = 0;
+
+ while (<COORDS>)
+ {
+ if (!$inalignment) { $inalignment = 1 if (/=====/); }
+ else
+ {
+ $count++;
+
+ my @val = split /\s+/, $_;
+
+ next if (($val[8] < $minsize) || ($val[10] < $minpercent));
+
+ echo $_;
+ $good++;
+
+ ## Remember the max percent id of good matches
+ $$percidref = $val[10] if (defined $percidref && $val[10] > $$percidref);
+ }
+ }
+ close COORDS;
+
+ return $good;
+}
+
+
+sub isValidJoinRegion
+{
+ my $project = shift;
+ my $gapinfo = shift;
+ my $percid = shift;
+
+ my $joinid = $gapinfo->{autojoin}->{id};
+
+ my $rangebegin = $gapinfo->{autojoin}->{begin} - $RANGEWINDOW;
+ $rangebegin = 1 if ($rangebegin <= 1);
+
+ my $rangeend = $gapinfo->{autojoin}->{end} + $RANGEWINDOW;
+ $rangeend = $gapinfo->{autojoin}->{size} if ($rangeend > $gapinfo->{autojoin}->{size});
+
+ echo "Checking extended join region...\n";
+
+ runCmd("echo '$joinid $rangebegin $rangeend' | $CUTFASTA $joinid.fasta > $joinid.join.fasta")
+ if (! -r "$joinid.join.fasta");
+
+ my $minpercent = 90;
+ my $joinsize = getSize("$joinid.join.fasta");
+
+ nucmerSeqs("nucmer cutfasta", "$project.1con", "$joinid.join.fasta",
+ "--nooptimize --maxmatch -c $CLUSTERLEN -l $MATCHLEN", "out.join");
+
+ return (countGoodAlignments("out.join.coords",
+ $joinsize,
+ $minpercent,
+ $percid));
+}
+
+
+sub countValidOrigContigs
+{
+ my $project = shift;
+ my $gapinfo = shift;
+
+ ## Lets check to see if the original contigs had a match
+ echo "Checking original contigs...\n";
+ my $goodcount = 0;
+
+ foreach my $type (qw/left right/)
+ {
+ my $id = $gapinfo->{$type}->{id};
+
+ ## Check the pre-extension fasta
+ tfsymlink("../../$id.fasta", "$id.fasta")
+ if (! -r "$id.fasta");
+
+ my $minpercent = 99;
+ my $perclen = .90;
+
+ nucmerSeqs("nucmer $id", "$project.1con", "$id.fasta",
+ "--maxmatch", "out.$id");
+
+ $goodcount++ if (countGoodAlignments("out.$id.coords",
+ $gapinfo->{$type}->{size} * $perclen,
+ $minpercent));
+ }
+
+ return $goodcount;
+}
+
+
+sub validateJoin
+{
+ my $project = shift;
+ my $gapinfo = shift;
+ my $stats = shift;
+ my $prefix = shift;
+
+ my $joinid = $gapinfo->{autojoin}->{id};
+
+ my $origsize = $gapinfo->{autojoin}->{size};
+
+ echo "Checking join...\n";
+
+ if (! -r $JOINDIR)
+ {
+ echo "No joindir!\n";
+ return 0;
+ }
+
+ tfchdir($JOINDIR);
+
+ tfmkdir("validate");
+ tfchdir("validate");
+
+ if ($DOAEVALIDATE)
+ {
+ if (! -r "$joinid.fasta")
+ {
+ if (! -r "autoEditor")
+ {
+ foreach my $suffix (qw/contig qual seq/)
+ {
+ tfsymlink("../$joinid.$suffix", "$joinid.$suffix")
+ if (! -r "$joinid.$suffix");
+ }
+
+ my $aeproject = $project;
+ $aeproject = "crypt" if ($aeproject =~ /crypt/);
+ runCmd("autoEditor $joinid -d $aeproject -o autoEditor", "autoEditor join");
+ runCmd("contig2fasta autoEditor/$joinid.contig > $joinid.fasta");
+ }
+ }
+
+ $gapinfo->{autojoin}->{size} = getSize("$joinid.fasta");
+
+ my $joinfeat = "$joinid.feat";
+
+ my $oend5 = $gapinfo->{autojoin}->{begin};
+ my $oend3 = $gapinfo->{autojoin}->{end};
+
+ if (! -r $joinfeat)
+ {
+ open JOINFEAT, "> $joinfeat"
+ or $tf->bail("Can't open $joinfeat");
+
+ print JOINFEAT "Contig Id=\"$joinid\"\n";
+ print JOINFEAT "Location End5=\"$oend5\" End5_gapped=\"$oend5\" End3=\"$oend3\" End3_gapped=\"$oend3\"\n";
+ close JOINFEAT;
+ }
+
+ runCmd("$REMAPFEATURES autoEditor/$joinid.contigEdits $joinfeat -o autoEditor/$joinid.feat")
+ if (! -r "autoEditor/$joinid.feat");
+
+ open FEAT, "< autoEditor/$joinid.feat";
+ while (<FEAT>)
+ {
+ next if ! /Location/;
+ my $end3 = $1 if (/End3=\"(\d+)\"/);
+ my $end5 = $1 if (/End5=\"(\d+)\"/);
+
+ echo "Remapping $oend5->$end5, $oend3->$end3\n";
+ $gapinfo->{autojoin}->{begin} = $end5;
+ $gapinfo->{autojoin}->{end} = $end3;
+
+ last;
+ }
+ close FEAT;
+ }
+ else
+ {
+ tfsymlink("../$joinid.fasta", "$joinid.fasta")
+ if (! -r "$joinid.fasta");
+ }
+
+ ## Link the 1con
+ if (! -r "$project.1con")
+ {
+ my $base;
+
+ # WOULD LIKE TO REMOVE THESE BACK DOORS FROM PRODUCTION CODE -- Jason Dec 2004
+ if ($project =~ /crypt(\d+)/)
+ {
+ $base = "/usr/local/db/euk/private/c_neoformans/whole_genome_sequencing/chr$1.final";
+ }
+ else
+ {
+ $base = `getdb -f 1con $project`;
+ }
+
+ symlink($base, "$project.1con");
+ }
+
+ my $retval = 1;
+ my $minpercent = 99;
+
+ nucmerSeqs("nucmer 1con", "$project.1con", "$joinid.fasta",
+ "--nooptimize --maxmatch");
+
+ my $good = countGoodAlignments("out.coords",
+ $gapinfo->{autojoin}->{size},
+ $minpercent);
+
+ if ($good == 1)
+ {
+ $stats->{Valid}++;
+ echo "Status: Valid\n";
+ }
+
+ {
+ my $percid;
+ if (isValidJoinRegion($project, $gapinfo, \$percid))
+ {
+ echo "Status: ValidJoin\n";
+ $stats->{ValidJoin}++;
+ push @{$stats->{validjoinid}}, $percid;
+ }
+ else
+ {
+ my $goodcount = countValidOrigContigs($project, $gapinfo);
+
+ if ($goodcount == 0)
+ {
+ ## Neither orig was in the 1con
+ echo "Status: Degenerate\n";
+ $stats->{Degenerate}++;
+ }
+ elsif ($goodcount == 1)
+ {
+ ## One orig was in the 1con
+ echo "Status: HalfDegenerate\n";
+ $stats->{HalfDegenerate}++;
+ }
+ elsif ($goodcount == 2)
+ {
+ ## Both flanking contigs are present, but their join was not in the 1con
+ echo "Status: Invalid!\n";
+ $stats->{Invalid}++;
+
+ $retval = 0;
+ }
+ }
+ }
+
+ tfchdir("..");
+ tfchdir("..");
+
+ $gapinfo->{autojoin}->{size} = $origsize;
+
+ return $retval;
+}
+
+
+
+
+## Scaffold Management
+{
+ my %newscaffold;
+ my $lastgap = undef;
+ my $curscaffid = undef;
+
+ sub addContigToScaffold
+ {
+ my $id = shift;
+ my $gap = shift;
+ my $gapstdev = shift;
+
+ my $contig = getContigInfo($id);
+
+ my $scaffcontig;
+ $scaffcontig->{id} = $contig->{id};
+ $scaffcontig->{oo} = $contig->{oo};
+ $scaffcontig->{size} = $contig->{size};
+ $scaffcontig->{gap} = $gap;
+ $scaffcontig->{gapstdev} = $gapstdev;
+
+ push @{$newscaffold{$curscaffid}}, $scaffcontig;
+ }
+
+
+ sub handleNewScaffold
+ {
+ my $prefix = shift;
+ my $ajdir = shift;
+ my $scaffid = shift;
+
+ if (defined $lastgap)
+ {
+ ## End the previous scaffold, remember lastgap.right info.
+ ## If lastgap was undef then this was a singleton
+
+ addJoinToResultsFile($lastgap, $ajdir, $prefix)
+ if ($lastgap->{autojoin}->{status});
+
+ ## Add lastgap.right to the scaffold (may or may not be join)
+ addContigToScaffold($lastgap->{right}->{id}, 0, 0);
+ }
+
+ if (defined $scaffid)
+ {
+ $curscaffid = $scaffid;
+ $newscaffold{$scaffid} = [];
+ }
+
+ $lastgap = undef;
+ }
+
+ sub handleGapChain
+ {
+ my $prefix = shift;
+ my $ajdir = shift;
+ my $gapinfo = shift;
+
+ if (!$gapinfo->{autojoin}->{status})
+ {
+ ## The current gap is still open, and it is safe to remember left contig info
+
+ if (defined $lastgap && $lastgap->{autojoin}->{status})
+ {
+ ## gapinfo.left contig was a join contig,
+ ## and now we know for sure that no more will be added
+ addJoinToResultsFile($lastgap, $ajdir, $prefix);
+ }
+
+ ## Add gapinfo.left to the scaffold
+ addContigToScaffold($gapinfo->{left}->{id},
+ $gapinfo->{expectedgap},
+ $gapinfo->{gapstdev});
+ }
+
+ $lastgap = $gapinfo;
+ }
+
+ ## For each contig that had a join, print which contigs went into that join,
+ ## in their original scaffold order
+ sub printJoinSummary
+ {
+ my $filename = shift;
+
+ open SUMMARY, "> $filename"
+ or $tf->bail("Can't open $filename ($!)");
+
+ foreach my $scaffid (sort {$a <=> $b} keys %newscaffold)
+ {
+ foreach my $contig (@{$newscaffold{$scaffid}})
+ {
+ my $id = $contig->{id};
+ my $info = getContigInfo($id);
+
+ if ($info->{isjoin})
+ {
+ my $chain = $info->{joinchain};
+ print SUMMARY "$id: $chain\n";
+ }
+ }
+ }
+
+ close SUMMARY;
+ }
+
+ sub printScaffold
+ {
+ my $filename = shift;
+
+ open SCAFF, "> $filename"
+ or $tf->bail("Can't open $filename ($!)");
+
+ foreach my $scaffid (sort {$a <=> $b} keys %newscaffold)
+ {
+ my $scafflen = 0;
+ my $scaffspan = 0;
+ my $numctg = 0;
+
+ ## Quick pass to compute size
+ foreach my $contig (@{$newscaffold{$scaffid}})
+ {
+ $numctg++;
+ $scafflen += $contig->{size};
+ $scaffspan += $contig->{size} + int($contig->{gap});
+ }
+
+ ## Print scaffold
+ print SCAFF ">$scaffid $numctg $scafflen $scaffspan\n";
+ foreach my $contig (@{$newscaffold{$scaffid}})
+ {
+ ## For consistency with sequencetiling (which requires integer offsets and gap sizes)
+ my $gapsize = int($contig->{gap});
+ print SCAFF "$contig->{id} $contig->{oo} $contig->{size} $gapsize $contig->{gapstdev}\n"
+ }
+ }
+
+ close SCAFF;
+ }
+}
+
+
+## Stats Management
+{
+ sub initializeStats
+ {
+ my $stats;
+
+ foreach my $key (qw/SequenceGaps Overlap Valid Invalid
+ Degenerate HalfDegenerate
+ Error ValidJoin Joined
+ DoubleExtend SingleExtend NoExtend/)
+ {
+ $stats->{$key} = 0;
+ }
+
+ $stats->{expectedgap} = [];
+ $stats->{actualgap} = [];
+ $stats->{idscore} = [];
+ $stats->{olen} = [];
+ $stats->{extension} = [];
+ $stats->{validjoinid} = [];
+
+ return $stats;
+ }
+
+ sub updateJoinStatistics
+ {
+ my $gapinfo = shift;
+ my $stats = shift;
+
+ push @{$stats->{expectedgap}}, $gapinfo->{expectedgap};
+ push @{$stats->{actualgap}}, $gapinfo->{autojoin}->{gapsize};
+ push @{$stats->{idscore}}, $gapinfo->{autojoin}->{idscore};
+ push @{$stats->{olen}}, $gapinfo->{autojoin}->{olen};
+ push @{$stats->{extension}}, $gapinfo->{autojoin}->{extension};
+
+ my $rex = ($gapinfo->{autojoin}->{rex} > 0);
+ my $qex = ($gapinfo->{autojoin}->{qex} > 0);
+
+ if ($rex && $qex) { $stats->{DoubleExtend}++; }
+ elsif ($rex || $qex) { $stats->{SingleExtend}++; }
+ else { $stats->{NoExtend}++; }
+ }
+
+
+ sub median
+ {
+ my $num = scalar @_;
+
+ return 0 if $num==0;
+
+ if ($num % 2)
+ {
+ ## Odd number of elements, just the middle
+ return sprintf("%.02f", $_[int($num/2)]);
+ }
+ else
+ {
+ ## Even number, return the average of the middles
+ return sprintf("%.02f", ($_[int(($num/2)-1)] + $_[int($num/2)]) / 2);
+ }
+ }
+
+ sub medianabsolutedeviation
+ {
+ my $median = median(@_);
+ my @absdiff = sort {$a <=> $b}
+ map {abs($_ - $median)} @_;
+
+ my $madconstant = 1.4826; ## From R
+ return sprintf("%.02f", $madconstant * median(@absdiff));
+ }
+
+ sub mean
+ {
+ my $sum = 0;
+ my $count = 0;
+
+ foreach my $i (@_) { $sum += $i; $count++; }
+ return sprintf("%.02f", ($count) ? $sum /$count : 0);
+ }
+
+ sub standarddeviation
+ {
+ my $mean = mean(@_);
+
+ my $sum = 0;
+ my $count = 0;
+
+ foreach my $i (@_)
+ {
+ $sum += (($i - $mean)**2);
+ $count++;
+ }
+
+ $sum = ($count>1) ? $sum / ($count-1) : 0;
+ $sum = sqrt($sum);
+
+ return sprintf("%.02f", $sum);
+ }
+
+ sub range
+ {
+ return "0,0" if !defined $_[0];
+ my $last = scalar(@_) -1;
+ return "$_[0],$_[$last]";
+ }
+
+ sub printArrayStats
+ {
+ my $prefix = shift;
+ my $array = shift;
+
+ my @sorted = sort {$a <=> $b} @{$array};
+
+ my $Range = range(@sorted);
+ my $Mean = mean(@sorted);
+ my $SD = standarddeviation(@sorted);
+ my $Median = median(@sorted);
+ my $Mad = medianabsolutedeviation(@sorted);
+
+ print "$prefix.Raw=", join(",", @{$array}), "\n" if $DOVALIDATE;
+ print "$prefix.Range=$Range\n";
+ print "$prefix.Mean=$Mean\n";
+ print "$prefix.SD=$SD\n";
+ print "$prefix.Median=$Median\n";
+ print "$prefix.Mad=$Mad\n";
+ }
+
+
+ sub printStats
+ {
+ my $prefix = shift;
+ my $stats = shift;
+
+ my $PercJoin = sprintf("%.03f", ($stats->{SequenceGaps}) ? $stats->{Joined}/$stats->{SequenceGaps} : 0);
+ my $PercInvalid = sprintf("%.03f", ($stats->{Joined}) ? $stats->{Invalid}/$stats->{Joined} : 0);
+
+ my $title = "autoJoin";
+ $title = "$prefix\_$title" if $DOVALIDATE;
+
+ print "[$title]\n";
+ print "NumSequenceGaps=$stats->{SequenceGaps}\n";
+ print "NumJoined=$stats->{Joined}\n";
+ print "NumDoubleExtend=$stats->{DoubleExtend}\n";
+ print "NumSingleExtend=$stats->{SingleExtend}\n";
+ print "NumNoExtend=$stats->{NoExtend}\n";
+
+ print "PercJoin=$PercJoin\n";
+
+ if ($DOVALIDATE)
+ {
+ print "NumOverlap=$stats->{Overlap}\n";
+ print "NumJoinError=$stats->{Error}\n";
+ print "PercInvalidJoin=$PercInvalid\n";
+ print "NumInvalid=$stats->{Invalid}\n";
+ print "NumVerified=$stats->{Valid}\n";
+ print "NumJoinVerified=$stats->{ValidJoin}\n";
+ print "NumDegenerate=$stats->{Degenerate}\n";
+ print "NumHalfDegenerate=$stats->{HalfDegenerate}\n";
+ }
+
+ printArrayStats("ExpectedGap", $stats->{expectedgap});
+ printArrayStats("ActualGap", $stats->{actualgap});
+
+ if ($DOVALIDATE)
+ {
+ printArrayStats("IDScore", $stats->{idscore});
+ printArrayStats("Olen", $stats->{olen});
+ printArrayStats("Extend", $stats->{extension});
+ printArrayStats("JoinID", $stats->{validjoinid});
+ }
+
+ print "\n";
+ }
+}
+
+sub addJoinToResultsFile
+{
+ my $gapinfo = shift;
+ my $ajdir = shift;
+ my $prefix = shift;
+
+ if ($gapinfo->{autojoin}->{status})
+ {
+ echo "save $gapinfo->{autojoin}->{id} results... ";
+
+ foreach my $suffix (qw/contig qual seq/)
+ {
+ runCmd("$CAT $ajdir/$gapinfo->{autojoin}->{prefix}.$suffix >> $ajdir/$RESULTSDIR/$prefix$JOINSUFFIX.$suffix");
+ }
+
+ echo "ok";
+ }
+}
+
+sub finalizeAssembly
+{
+ my $prefix = shift;
+ my $ajdir = shift;
+ my $stats = shift;
+ my $db = shift;
+
+ echo "\n\nFinalizing assembly\n";
+
+ tfchdir("$ajdir/$RESULTSDIR"); $ajdir = File::Spec->abs2rel($ajdir);
+
+ my %joinsequences;
+ my $printid = 0;
+
+ open ORIGCONTIG, "< $ajdir/$prefix.contig"
+ or $tf->bail("Can't open orig contig ($ajdir/$prefix.contig) ($!)");
+
+ open ALLCONTIG, "> $prefix.contig"
+ or $tf->bail("Can't open $prefix.contig ($!)");
+
+ echo " creating results contig file... ";
+
+ while (<ORIGCONTIG>)
+ {
+ if (/^##(\S+)\s/)
+ {
+ my $contigid = $1;
+ my $info = getContigInfo($contigid, 1);
+
+ $printid = !defined $info->{newid};
+ }
+ elsif (/^#(\S+)\(/)
+ {
+ $joinsequences{$1} = 1 if (!$printid);
+ }
+
+ print ALLCONTIG $_ if $printid;
+ }
+
+ close ORIGCONTIG;
+ close ALLCONTIG;
+
+ echo "ok.\n";
+
+ runCmd("$CAT $prefix$JOINSUFFIX.contig >> $prefix.contig", " concat contig")
+ if -r "$prefix$JOINSUFFIX.contig";
+
+ foreach my $suffix (qw/qual seq/)
+ {
+ open FASTA, "< $ajdir/$prefix.$suffix"
+ or $tf->bail("Can't open orig $suffix ($ajdir/$prefix.$suffix) ($!)");
+
+ open OUT, ">$prefix.$suffix"
+ or $tf->bail("Can't open $prefix.$suffix ($!)");
+
+ $printid = 0;
+
+ while (<FASTA>)
+ {
+ $printid = !exists $joinsequences{$1} if (/^>(\S+)/);
+ print OUT $_ if $printid;
+ }
+
+ close FASTA;
+ close OUT;
+
+ runCmd("$CAT $prefix$JOINSUFFIX.$suffix >> $prefix.$suffix", " concat $suffix")
+ if -r "$prefix$JOINSUFFIX.$suffix";
+ }
+
+ printFeatures("$prefix.feat");
+ printUnjoinedContigs("$prefix.unjoined");
+ printScaffold("$prefix.scaff");
+ printJoinSummary("$prefix.joinsummary");
+
+ ## Create AMOS Output
+ runCmd("(($TOAMOS -m ../$prefix.mates -c $prefix.contig -s $prefix.seq -q $prefix.qual -o - | $BANKTRANSACT -m - -b $prefix.bnk -c) > /dev/null) >& /dev/null", " creating bank");
+ runCmd("(($AJSCAFF2AMOS $prefix.scaff $prefix.bnk/CTG.map | $BANKTRANSACT -m - -b $prefix.bnk) > /dev/null) >& /dev/null", " loading updated scaffold");
+ runCmd("(($LOADFEATURES $prefix.bnk $prefix.feat) > /dev/null ) >& /dev/null", " loading features");
+
+ open REPORT, "> $prefix.joinreport"
+ or $tf->bail("Can't open $prefix.joinreport");
+
+ select REPORT;
+ printStats($prefix, $stats);
+
+ select STDOUT;
+ close REPORT;
+
+ echo "\n";
+ printStats($prefix, $stats);
+}
+
+
+MAIN:
+{
+ my $db = undef;
+
+ my $ajdir = "autoJoin";
+ my $curajpath;
+
+ $tf->addDependInfo(@DEPENDS);
+ $tf->setHelpInfo($HELPTEXT);
+ $tf->setVersionInfo($VERSION);
+ $tf->setLogFile(getcwd()."/autoJoin.log"); ## Don't follow chdir
+
+ # now we handle the input options
+ my $result = $tf->TIGR_GetOptions
+ (
+ 'D=s', \$db,
+ "prefix=s", \$JOINPREFIX,
+ 'o|dir=s', \$ajdir,
+ 'verbose!', \$DOVERBOSE,
+ 'validate!', \$DOVALIDATE,
+ 'join!', \$DOJOIN,
+ 'aevalidate!', \$DOAEVALIDATE,
+ 'alignment=s', \$ALIGNTHRESHOLD,
+ );
+
+ $tf->bail("Command line parsing failed") if (!$result);
+
+ if ($ALIGNTHRESHOLD < 75.00 || $ALIGNTHRESHOLD > 100.00)
+ {
+ $tf->bail("Alignment threshold must be between 75.0 and 100.0 percent");
+ }
+
+ my $bankpath = shift @ARGV; ## path/to/dmg.bnk
+ die $USAGE if !defined $bankpath;
+ $bankpath =~ s/\/$//;
+
+ my $debug = $tf->getDebugLevel();
+ $tf->setDebugLevel(4) if (!$debug);
+
+ my $prefix = basename($bankpath); ## dmg.bnk
+ $prefix =~ s/\.bnk//; ## dmg
+
+ $bankpath = File::Spec->rel2abs($bankpath);
+
+ $tf->logLocal("prefix: $prefix\n", 4);
+ $tf->logLocal("bankpath: $bankpath\n", 4);
+
+ tfmkdir($ajdir); tfchdir($ajdir); $ajdir = cwd;
+
+ prepareAssembly($prefix, $bankpath);
+
+ my $scafffile = "$prefix.scaff";
+
+ open SCAFFFILE, "< $scafffile"
+ or $tf->bail("Can't open scaff file $scafffile for reading ($!)");
+
+ tfmkdir($ALIGNMENTDIR); tfchdir($ALIGNMENTDIR);
+
+ my $stats = initializeStats();
+
+ my $leftcontig = undef;
+ my $issingleton = 0;
+
+ while (<SCAFFFILE>)
+ {
+ if (/^\>(\S+)/)
+ {
+ ## In the start of a scaffold
+
+ if ($issingleton && defined $leftcontig)
+ {
+ # The last scaffold was a singleton
+ addContigToScaffold($leftcontig, 0, 0)
+ }
+
+ handleNewScaffold($prefix, File::Spec->abs2rel($ajdir), $1);
+
+ $leftcontig = undef;
+ $issingleton = 1;
+ }
+ else
+ {
+ chomp;
+ ## Notice the gap between contigs
+
+ my @vals = split /\s+/, $_;
+
+ my $gapstdev = $DEFAULT_STDEV;
+
+ my $contigid = $vals[0];
+ my $oo = $vals[1];
+ my $contiglen = $vals[2];
+ my $gapsize = $vals[3];
+
+ $gapstdev = $vals[4] if defined $vals[4];
+
+ addOrigContig($contigid, $oo, $contiglen, $gapsize, $gapstdev);
+
+ if (!defined $leftcontig) { $leftcontig = $contigid; }
+ else
+ {
+ $issingleton = 0;
+ my $gapinfo = parseGap($stats, $prefix, $leftcontig, $contigid);
+
+ if (!gapTooLarge($gapinfo))
+ {
+ tfmkdir($gapinfo->{workdir});
+ tfchdir($gapinfo->{workdir});
+ $curajpath = File::Spec->abs2rel($ajdir);
+
+ alignContigs($gapinfo, $curajpath);
+ if (hasPotentialJoin($gapinfo, $stats) && $DOJOIN)
+ {
+ if (!joinContigs($gapinfo, $stats, $curajpath))
+ {
+ ## The join was successful
+ remapJoinedFeatures($gapinfo);
+ updateJoinStatistics($gapinfo, $stats);
+
+ if (defined $db && $DOVALIDATE)
+ {
+ validateJoin($db, $gapinfo, $stats, $prefix)
+ }
+ }
+ }
+
+ tfchdir("..");
+ }
+
+ handleGapChain($prefix, File::Spec->abs2rel($ajdir), $gapinfo);
+
+ ## The rightcontig becomes the leftcontig for the next gap
+ $leftcontig = $contigid;
+ }
+ }
+ }
+
+ ## Make sure the end of the gap file is noticed
+ addContigToScaffold($leftcontig, 0, 0)
+ if ($issingleton && defined $leftcontig);
+
+ handleNewScaffold($prefix, File::Spec->abs2rel($ajdir), undef);
+
+ finalizeAssembly($prefix, $ajdir, $stats, $db);
+}
+
diff --git a/src/Experimental/barcode-graph.cc b/src/Experimental/barcode-graph.cc
new file mode 100644
index 0000000..30c8572
--- /dev/null
+++ b/src/Experimental/barcode-graph.cc
@@ -0,0 +1,232 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+
+using namespace AMOS;
+using namespace std;
+
+int s_verbose(0);
+int MIN_CONTIG_SIZE(0);
+int DISPLAY_ALL(0);
+
+
+int main (int argc, char ** argv)
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Builds a barcode graph of multiple assemblies\n"
+"\n"
+" Usage: barcode-graph [options] bank1 ... bankn\n"
+"\n"
+" Options\n"
+" -------------------\n"
+" -v|--verbose Produce a verbose output\n"
+" -m|--min_contig_size <size> Minimum number of reads\n"
+" -d|--display_all_links Display full graph, not just max\n"
+"\n";
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+
+ tf->getOptions()->addOptionResult("v|verbose", &s_verbose, "Be verbose when reporting");
+ tf->getOptions()->addOptionResult("m|min_contig_size=i", &MIN_CONTIG_SIZE, "Minimum Number of reads");
+ tf->getOptions()->addOptionResult("d|display_all_links", &DISPLAY_ALL, "Display all graph transitions");
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() <= 1)
+ {
+ cerr << "Usage: barcode-graph [options] bank1 ... bankn" << endl;
+ return EXIT_FAILURE;
+ }
+
+ bool first = true;
+
+ typedef map<ID_t, ID_t> ReadLookup;
+ ReadLookup read2contig;
+ string lastbank;
+
+ if (s_verbose)
+ {
+ cerr << "MinContigSize: " << MIN_CONTIG_SIZE << endl;
+ }
+
+ cout << "digraph G" << endl
+ << "{" << endl
+ << "rankdir=LR" << endl;
+
+ while (!argvv.empty())
+ {
+ string bankname = argvv.front(); argvv.pop_front();
+ cerr << "Processing " << bankname << " at " << Date() << endl;
+
+ Bank_t contig_bank(Contig_t::NCODE);
+ contig_bank.open(bankname, B_READ);
+
+ //Bank_t read_bank(Read_t::NCODE);
+ //read_bank.open(bankname, B_READ);
+
+ bankname = bankname.substr(0, bankname.find_first_of("/ "));
+
+ const IDMap_t & contigmap = contig_bank.getIDMap();
+ IDMap_t::const_iterator c;
+
+ // Just print a node for each contig
+ cout << "{ rank=same;" << endl;
+ cout << bankname << endl;
+ for (c = contigmap.begin(); c!= contigmap.end(); c++)
+ {
+ Contig_t contig;
+ contig_bank.fetch(c->iid, contig);
+
+ int tilingsize = contig.getReadTiling().size();
+
+ if (tilingsize >= MIN_CONTIG_SIZE)
+ {
+ cout << "\"" << bankname << "." << c->iid << "\" "
+ << "[label=\"" << c->iid << "\\n[" << tilingsize << "r " << contig.getLength() << "bp]\"]" << endl;
+ }
+ }
+ cout << "}" << endl;
+
+ if (!first)
+ {
+ cout << lastbank << " -> " << bankname << endl;
+ // Draw an edge
+ for (c = contigmap.begin(); c!= contigmap.end(); c++)
+ {
+ Contig_t contig;
+ contig_bank.fetch(c->iid, contig);
+
+ vector<Tile_t>::const_iterator ti;
+
+ typedef map<ID_t, int> ContigStatus;
+ ContigStatus oldcontigcount;
+ ContigStatus::iterator cs;
+
+ int tilingsize = contig.getReadTiling().size();
+
+ if (tilingsize >= MIN_CONTIG_SIZE)
+ {
+ // Count where each read was in the old contig
+ for (ti = contig.getReadTiling().begin(); ti != contig.getReadTiling().end(); ti++)
+ {
+ ReadLookup::iterator r2c = read2contig.find(ti->source);
+
+ ID_t oldcontig;
+ if (r2c == read2contig.end()) { oldcontig = 0; }
+ else { oldcontig = r2c->second; }
+
+ cs = oldcontigcount.find(oldcontig);
+ if (cs == oldcontigcount.end())
+ {
+ oldcontigcount.insert(make_pair(oldcontig, 1));
+ }
+ else
+ {
+ cs->second++;
+ }
+ }
+
+ // Find the most similiar contig
+ ID_t oldmax = oldcontigcount.begin()->first;
+ int oldmaxcount = oldcontigcount.begin()->second;
+
+ if (DISPLAY_ALL)
+ {
+ for (cs = oldcontigcount.begin(); cs != oldcontigcount.end(); cs++)
+ {
+ oldmax = cs->first;
+ oldmaxcount = cs->second;
+
+ if (oldmaxcount >= MIN_CONTIG_SIZE)
+ {
+ // Print the pair
+ cout << "\"" << lastbank << "." << oldmax << "\" -> "
+ << "\"" << bankname << "." << c->iid << "\""
+ << " [label=\"" << oldmaxcount << "\"]" << endl;
+ }
+ }
+ }
+ else
+ {
+ for (cs = oldcontigcount.begin(); cs != oldcontigcount.end(); cs++)
+ {
+ if (cs->second > oldmaxcount)
+ {
+ oldmax = cs->first;
+ oldmaxcount = cs->second;
+ }
+ }
+
+ if (oldmaxcount >= MIN_CONTIG_SIZE)
+ {
+ // Print the pair
+ cout << "\"" << lastbank << "." << oldmax << "\" -> "
+ << "\"" << bankname << "." << c->iid << "\""
+ << " [label=\"" << oldmaxcount << "/" << tilingsize << "\"]" << endl;
+ }
+ }
+ }
+ }
+ }
+
+ cout << endl << endl;
+
+ first = false;
+ lastbank = bankname;
+ read2contig.clear();
+
+ for (c = contigmap.begin(); c!= contigmap.end(); c++)
+ {
+ Contig_t contig;
+ contig_bank.fetch(c->iid, contig);
+
+ vector<Tile_t>::const_iterator ti;
+
+ for (ti = contig.getReadTiling().begin(); ti != contig.getReadTiling().end(); ti++)
+ {
+ read2contig.insert(make_pair(ti->source, c->iid));
+ }
+ }
+ }
+
+ cout << "}" << endl;
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return retval;
+}
diff --git a/src/Experimental/blasr_alignquality.pl b/src/Experimental/blasr_alignquality.pl
new file mode 100755
index 0000000..0dcdeff
--- /dev/null
+++ b/src/Experimental/blasr_alignquality.pl
@@ -0,0 +1,131 @@
+#!/usr/bin/perl -w
+use strict;
+
+my %stats;
+my %dist;
+
+my $curMatch;
+my $curMis;
+my $curIns;
+my $curDel;
+my $curLen;
+
+my $qrystr;
+my $matchstr;
+my $refstr;
+
+my $inAlign = 0;
+
+my $MIN_ALIGN_LEN = 100;
+
+
+sub processDist
+{
+ return if !$inAlign;
+ $inAlign = 0;
+
+ return if $curLen < $MIN_ALIGN_LEN;
+
+ $stats{len} += $curLen;
+ $stats{m} += $curMatch;
+ $stats{s} += $curMis;
+ $stats{i} += $curIns;
+ $stats{d} += $curDel;
+
+ my @mchr = split //, $matchstr;
+ my $ml = scalar @mchr;
+
+ print "l: $curLen m: $curMatch s: $curMis i: $curIns d: $curDel\n";
+ print "$matchstr\n";
+
+ print "d: ";
+
+ my $idx = 0;
+ while (($idx < $ml) && ($mchr[$idx] eq "|")) { $idx++; }
+
+ my $d = -1;
+ $idx++;
+ while ($idx < $ml)
+ {
+ $d++;
+ if ($mchr[$idx] eq " ")
+ { print " $d"; $dist{$d}++; $d = -1; }
+ $idx++;
+ }
+
+ print "\n";
+
+ #print "$qrystr\n";
+ #print "$refstr\n";
+
+ $qrystr = "";
+ $matchstr = "";
+ $refstr = "";
+}
+
+while (<>)
+{
+ next if (/^\s*$/);
+
+ if (/nMatch: (\d+)/) { processDist(); $curMatch = $1;}
+ elsif (/nMisMatch: (\d+)/) { $curMis = $1; }
+ elsif (/nIns: (\d+)/) { $curIns = $1; }
+ elsif (/nDel: (\d+)/) { $curDel = $1; }
+ elsif (/QueryRange: (\d+) -> (\d+)/) { $curLen = $2 - $1;}
+ elsif (/TargetRange:/) { $inAlign = 1; }
+ elsif ($inAlign)
+ {
+ my $qrystrs = $_;
+ my $markers = <>;
+ my $refstrs = <>;
+ my $blank = <>;
+
+ print $qrystrs;
+ print $markers;
+ print $refstrs;
+ print $blank;
+
+ chomp $qrystrs;
+ chomp $markers;
+ chomp $refstrs;
+
+ $qrystr .= substr($qrystrs, 8);
+ $matchstr .= substr($markers, 8);
+ $refstr .= substr($refstrs, 8);
+ }
+
+ print $_ if (!$inAlign);
+}
+
+processDist();
+
+
+my $len = $stats{len};
+my $match = $stats{m};
+my $mis = $stats{s};
+my $ins = $stats{i};
+my $del = $stats{d};
+
+my $sum = $match + $mis + $ins + $del;
+
+my $mr = $match / $sum;
+my $sr = $mis / $sum;
+my $ir = $ins / $sum;
+my $dr = $del / $sum;
+
+print "len:\t$len\t$sum\n";
+print "match:\t$match\t$mr\n";
+print "mis:\t$mis\t$sr\n";
+print "ins:\t$ins\t$ir\n";
+print "del:\t$del\t$dr\n";
+
+
+print "seed len\n";
+foreach my $d (sort {$a <=> $b} keys %dist)
+{
+ my $cnt = $dist{$d};
+ print "$d\t$cnt\n";
+}
+
+
+
diff --git a/src/Experimental/build-persistent-bank.cc b/src/Experimental/build-persistent-bank.cc
new file mode 100644
index 0000000..be1abb3
--- /dev/null
+++ b/src/Experimental/build-persistent-bank.cc
@@ -0,0 +1,264 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+#include <map>
+
+using namespace AMOS;
+using namespace std;
+
+int s_verbose(0);
+int MIN_CONTIG_SIZE(0);
+int DISPLAY_ALL(0);
+
+
+int main (int argc, char ** argv)
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Builds a bank of multiple assemblies\n"
+"\n"
+" Usage: build-persistant-bank [options] bank1 ... bankn\n"
+"\n"
+" Options\n"
+" -------------------\n"
+" -v|--verbose Produce a verbose output\n"
+"\n";
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+
+ tf->getOptions()->addOptionResult("v|verbose", &s_verbose, "Be verbose when reporting");
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() <= 2)
+ {
+ cerr << "Usage: build-persistant-bank [options] newbank bank1 ... bankn" << endl;
+ return EXIT_FAILURE;
+ }
+
+ bool first = true;
+
+ typedef map<ID_t, ID_t> ReadLookup;
+ ReadLookup read2contig;
+ string lastbank;
+
+ string newbankname = argvv.front(); argvv.pop_front();
+
+ Bank_t new_read_bank(Read_t::NCODE);
+ Bank_t new_frg_bank(Fragment_t::NCODE);
+ Bank_t new_contig_bank(Contig_t::NCODE);
+ Bank_t new_scaffold_bank(Scaffold_t::NCODE);
+ Bank_t new_lib_bank(Library_t::NCODE);
+ Bank_t new_feat_bank(Feature_t::NCODE);
+
+ new_read_bank.create(newbankname);
+ new_frg_bank.create(newbankname);
+ new_contig_bank.create(newbankname);
+ new_scaffold_bank.create(newbankname);
+ new_lib_bank.create(newbankname);
+ new_feat_bank.create(newbankname);
+
+ while (!argvv.empty())
+ {
+ string bankname = argvv.front(); argvv.pop_front();
+ cerr << "Processing " << bankname << " at " << Date() << endl;
+
+ BankStream_t read_bank(Read_t::NCODE);
+ read_bank.open(bankname, B_READ);
+
+ BankStream_t frg_bank(Fragment_t::NCODE);
+ frg_bank.open(bankname, B_READ);
+
+ BankStream_t contig_bank(Contig_t::NCODE);
+ contig_bank.open(bankname, B_READ);
+
+ BankStream_t scaffold_bank(Scaffold_t::NCODE);
+ scaffold_bank.open(bankname, B_READ);
+
+ BankStream_t feat_bank(Feature_t::NCODE);
+ feat_bank.open(bankname, B_READ);
+
+
+ if (first)
+ {
+ cerr << "L";
+
+ BankStream_t lib_bank(Library_t::NCODE);
+ lib_bank.open(bankname, B_READ);
+
+ Library_t lib;
+ while (lib_bank >> lib)
+ {
+ new_lib_bank.append(lib);
+ }
+
+ first = false;
+ }
+
+ bankname = bankname.substr(0, bankname.find_first_of("/ "));
+
+
+ HASHMAP::hash_map<ID_t, ID_t> frgtranslate;
+ HASHMAP::hash_map<ID_t, ID_t> readtranslate;
+ HASHMAP::hash_map<ID_t, ID_t> contigtranslate;
+ ID_t newiid;
+
+
+ cerr << "F";
+ const IDMap_t & frgmap = frg_bank.getIDMap();
+ IDMap_t::const_iterator c;
+
+ for (c = frgmap.begin(), newiid = new_frg_bank.getMaxIID()+1;
+ c != frgmap.end();
+ c++, newiid++)
+ {
+ frgtranslate.insert(make_pair(c->iid, newiid));
+ }
+
+
+ cerr << "R";
+
+ Read_t read;
+ newiid = new_read_bank.getMaxIID()+1;
+
+ while (read_bank >> read)
+ {
+ readtranslate.insert(make_pair(read.getIID(), newiid));
+
+ read.setEID(read.getEID()+"_"+bankname);
+ read.setIID(newiid);
+ read.setFragment(frgtranslate[read.getFragment()]);
+
+ new_read_bank.append(read);
+ newiid++;
+ }
+
+
+
+ cerr << "F2";
+ Fragment_t frg;
+
+ while (frg_bank >> frg)
+ {
+ frg.setEID(frg.getEID()+"_"+bankname);
+ frg.setIID(frgtranslate[frg.getIID()]);
+
+ pair<ID_t, ID_t> mates(frg.getMatePair());
+ mates.first = readtranslate[mates.first];
+ mates.second = readtranslate[mates.second];
+ frg.setReads(mates);
+
+ new_frg_bank.append(frg);
+ }
+
+
+
+ cerr << "C";
+
+ Contig_t contig;
+ newiid = new_contig_bank.getMaxIID()+1;
+
+ while (contig_bank >> contig)
+ {
+ contigtranslate.insert(make_pair(contig.getIID(), newiid));
+
+ contig.setEID(contig.getEID()+"_"+bankname);
+ contig.setIID(newiid);
+
+ vector<Tile_t> & tiling = contig.getReadTiling();
+ vector<Tile_t>::iterator ti;
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ ti->source = readtranslate[ti->source];
+ }
+
+ new_contig_bank.append(contig);
+ newiid++;
+ }
+
+ cerr << "S";
+
+ Scaffold_t scaffold;
+ newiid = new_scaffold_bank.getMaxIID()+1;
+
+ while (scaffold_bank >> scaffold)
+ {
+ scaffold.setEID(scaffold.getEID()+"_"+bankname);
+ scaffold.setIID(newiid);
+
+ vector<Tile_t> & tiling = scaffold.getContigTiling();
+ vector<Tile_t>::iterator si;
+ for (si = tiling.begin(); si != tiling.end(); si++)
+ {
+ si->source = contigtranslate[si->source];
+ }
+
+ new_scaffold_bank.append(scaffold);
+ newiid++;
+ }
+
+ cerr << "F";
+ Feature_t feat;
+ while (feat_bank >> feat)
+ {
+ pair<ID_t, NCode_t> src = feat.getSource();
+
+ if (src.second == Contig_t::NCODE)
+ {
+ src.first = contigtranslate[src.first];
+ }
+ else if (src.second == Read_t::NCODE)
+ {
+ src.first = readtranslate[src.first];
+ }
+ else
+ {
+ cerr << "Warning: Unsupported feat type " << src.second << endl;
+ }
+
+ feat.setSource(src);
+
+ new_feat_bank.append(feat);
+ }
+
+ cerr << endl;
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return retval;
+}
diff --git a/src/Experimental/coords_best.pl b/src/Experimental/coords_best.pl
new file mode 100755
index 0000000..8fb29b9
--- /dev/null
+++ b/src/Experimental/coords_best.pl
@@ -0,0 +1,34 @@
+#!/usr/bin/perl -w
+use strict;
+
+
+my %best;
+
+while (<>)
+{
+ my @vals = split /\s+/, $_;
+
+ my $qlen = $vals[8];
+ my $percid = $vals[10];
+ my $rseq = $vals[18];
+ my $qseq = $vals[19];
+
+ my $match = $percid * $qlen / 100;
+
+ if ((!exists $best{$qseq}) || ($match > $best{$qseq}->{score}))
+ {
+ $best{$qseq}->{rseq} = $rseq;
+ $best{$qseq}->{score} = $match;
+ $best{$qseq}->{align} = $_;
+ }
+}
+
+foreach my $q (keys %best)
+{
+ my $rseq = $best{$q}->{rseq};
+ my $score = $best{$q}->{score};
+ my $align = $best{$q}->{align};
+
+ #print "$q\t$rseq\t$score\t$align";
+ print $align;
+}
diff --git a/src/Experimental/coords_depth.pl b/src/Experimental/coords_depth.pl
new file mode 100755
index 0000000..b1c1ccc
--- /dev/null
+++ b/src/Experimental/coords_depth.pl
@@ -0,0 +1,66 @@
+#!/usr/bin/perl -w
+use strict;
+
+my $PERC_ALEN=.95;
+
+my $depth;
+my $seq = "";
+
+sub printDepth
+{
+ return if !defined $seq || $seq eq "";
+
+ print "$seq\t", join(",",@$depth), "\n";
+}
+
+while (<>)
+{
+ chomp;
+ s/^\s+//;
+
+ my @fields = split /\s+/, $_;
+
+ # for (my $i = 0; $i < scalar @fields; $i++) { print "$i: $fields[$i]\n"; }
+
+ my $start = $fields[0];
+ my $end = $fields[1];
+
+ my $qstart = $fields[3];
+ my $qend = $fields[4];
+
+ my $qalen = $fields[7];
+
+ my $curlen = $fields[11];
+ my $qlen = $fields[12];
+
+ my $cur = $fields[17];
+
+ if ($seq ne $cur)
+ {
+ printDepth();
+
+ $seq = $cur;
+ $depth = undef;
+
+ for (my $i = 0; $i < $curlen; $i++)
+ {
+ $depth->[$i] = 0;
+ }
+ }
+
+ my $dir = ($qstart < $qend) ? "f" : "r";
+
+ if ((($dir eq "r") && ($start <= 5)) ||
+ (($dir eq "f") && ($curlen-$end <= 5)) ||
+ ($qalen >= $qlen*$PERC_ALEN))
+ {
+ # print "$_\n";
+
+ for (my $i = $start; $i <= $end; $i++)
+ {
+ $depth->[$i-1]++;
+ }
+ }
+}
+
+printDepth();
diff --git a/src/Experimental/ctg_gc.pl b/src/Experimental/ctg_gc.pl
new file mode 100755
index 0000000..dba136e
--- /dev/null
+++ b/src/Experimental/ctg_gc.pl
@@ -0,0 +1,54 @@
+#!/usr/bin/perl -w
+use strict;
+
+my $WINDOW = 25;
+
+sub countgc
+{
+ my $str = $_[0];
+ my $g = ($str =~ tr/gGcC//);
+
+ return $g;
+}
+
+sub processContig
+{
+ my $seq = $_[0];
+
+ return if !defined $seq;
+
+ if (length($seq) > $WINDOW*10)
+ {
+ my $gc = countgc(substr($seq, 0, $WINDOW));
+ print "E\t$gc\n";
+
+ for (my $pos = $WINDOW; $pos+1.5*$WINDOW < length($seq); $pos+=$WINDOW)
+ {
+ my $wstr = substr($seq, $pos, $WINDOW);
+ $gc = countgc($wstr);
+ print "I\t$gc\n";
+ }
+
+ $gc = countgc(substr($seq, -$WINDOW));
+ print "E\t$gc\n";
+ }
+}
+
+
+my $seq = undef;
+
+while (<>)
+{
+ if (/^>/)
+ {
+ processContig($seq);
+ $seq = "";
+ }
+ else
+ {
+ chomp;
+ $seq .= $_;
+ }
+}
+
+processContig($seq);
diff --git a/src/Experimental/fasta_filter_raw.pl b/src/Experimental/fasta_filter_raw.pl
new file mode 100755
index 0000000..b2d8018
--- /dev/null
+++ b/src/Experimental/fasta_filter_raw.pl
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+
+use TIGR::Foundation;
+use AMOS::ParseFasta;
+
+$tf = new TIGR::Foundation;
+
+if (!defined $tf){
+ die ("Bad foundation\n");
+}
+
+if ((scalar @ARGV == 0) || ($ARGV[0] eq '-h')){
+ die "Separate filtered and raw sequences\nUSAGE: $0 [fasta_file1] [fasta_file2] ... [fasta_filen] \n";
+}
+
+
+foreach my $file (@ARGV)
+{
+ open(IN, $file) || $tf->bail("Cannot open $file: $!\n");
+ $fr = new AMOS::ParseFasta(\*IN);
+
+ my $cnt_raw = 0;
+ my $cnt_filter = 0;
+
+ open(RAW, "> $file.raw") || $tf->bail("Can't open $file.raw: $!\n");
+ open(FILTER, "> $file.filter") || $tf->bail("Can't open $file.filter: $!\n");
+
+ die ("Bad reader\n")
+ if (!defined $fr);
+
+ while (($head, $body) = $fr->getRecord())
+ {
+ if ($head =~ /.*\/.*\/.*/)
+ {
+ $cnt_filter++;
+ print FILTER ">$head\n$body\n";
+ }
+ else
+ {
+ $cnt_raw++;
+ print RAW ">$head\n$body\n";
+ }
+ }
+
+ print STDERR "$file raw: $cnt_raw filter: $cnt_filter\n";
+}
+
diff --git a/src/Experimental/fastq_to_mates.pl b/src/Experimental/fastq_to_mates.pl
new file mode 100755
index 0000000..b7a77d4
--- /dev/null
+++ b/src/Experimental/fastq_to_mates.pl
@@ -0,0 +1,34 @@
+#!/usr/bin/perl -w
+use strict;
+
+# sanitize first:
+# tr ':#/' '___' < all.fa
+
+my $libraryname = "paired";
+my $mean = 200;
+my $stdev = 20;
+
+print "library\t$libraryname\t$mean\t$stdev\n";
+
+my %seen;
+my $sep = '_';
+
+while (<>)
+{
+ if (/^>(\S+)/)
+ {
+ my $readname = $1;
+ if ($readname =~ /(\S+)$sep(\d)$/)
+ {
+ my $base = $1;
+ my $v=$2;
+
+ if (!exists $seen{$base})
+ {
+ print $base.$sep."1\t".$base.$sep."2\t$libraryname\n";
+ }
+
+ $seen{$base}++;
+ }
+ }
+}
diff --git a/src/Experimental/fattenContig.cc b/src/Experimental/fattenContig.cc
new file mode 100644
index 0000000..fbeedf0
--- /dev/null
+++ b/src/Experimental/fattenContig.cc
@@ -0,0 +1,229 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+
+#include "ContigFattener.hh"
+
+using namespace AMOS;
+using namespace std;
+
+int s_leftExtension(0);
+int s_rightExtension(0);
+int s_growContig(0);
+int s_fatten(0);
+
+int s_requireConfirmation(1);
+
+int s_fattenerRangeStart(-1);
+int s_fattenerRangeEnd(-1);
+int s_ungapped(0);
+
+int s_extensionDistance(0);
+string s_readToExtend("");
+
+string s_contigeid("");
+int s_contigiid(0);
+
+int s_verbose(0);
+
+
+
+void fattenContig(Contig_t & contig, Bank_t & read_bank)
+{
+ cerr << "Fattening eid: " << contig.getEID()
+ << " iid: " << contig.getIID()
+ << endl;
+
+ ContigFattener fattener(contig, read_bank, s_verbose);
+
+ if (s_extensionDistance)
+ {
+ fattener.extend3Read(s_readToExtend, s_extensionDistance);
+ }
+
+ if (s_growContig)
+ {
+ if (s_rightExtension) { fattener.growContigRight(s_requireConfirmation); }
+ if (s_leftExtension) { fattener.growContigLeft(s_requireConfirmation); }
+ }
+
+ if (s_fatten)
+ {
+ fattener.fattenContig(s_fattenerRangeStart,
+ s_fattenerRangeEnd,
+ s_leftExtension,
+ s_rightExtension);
+ }
+}
+
+
+
+
+
+
+
+
+int main (int argc, char ** argv)
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Fattens a contig by extending reads outside of their 3' clear range.\n"
+"By default, just fattens the contig, but can also be used to grow the contig,\n"
+"or extend a specific read, or some combination of all three.\n"
+"\n"
+" Order of operations:\n"
+" 1) Extend Specified Read\n"
+" 2) Grow contig\n"
+" 3) Fatten Contig\n"
+"\n"
+" Usage: fattenContig [options] bank\n"
+"\n"
+" bank AMOS bank containing contigs to fatten\n"
+"\n"
+" Options\n"
+" -------------------\n"
+" -f|--fatten Fatten contig in optional region [DEFAULT]\n"
+" -g|--grow Grow the contig (confirmed contig extension)\n"
+" --unconfirmed Maximal extend contig without confirming read\n"
+"\n"
+" -L Grow or fatten to the left only (Default: L & R)\n"
+" -R Grow or fatten to the right only\n"
+"\n"
+" -x [Optional] Start of range to fatten\n"
+" -y [Optional] End of range to fatten\n"
+" -U|--ungapped Coordinates are ungapped\n"
+"\n"
+" -E eid Modify just contig named eid\n"
+" -I iid Modify just contig named iid\n"
+" -r <seqname> Extend Specified Read\n"
+" -d <distance> Distance to extend read (-1 = all the way to end of read)\n"
+"\n"
+" -v|--verbose Produce a verbose output\n"
+"\n";
+
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+
+ int unconfirmed = !s_requireConfirmation;
+
+ tf->getOptions()->addOptionResult("x=i", &s_fattenerRangeStart, "Specify start of range to fatten");
+ tf->getOptions()->addOptionResult("y=i", &s_fattenerRangeEnd, "Specify start of range to fatten");
+ tf->getOptions()->addOptionResult("d=i", &s_extensionDistance, "Specify distance to extend");
+ tf->getOptions()->addOptionResult("r=s", &s_readToExtend, "Specify read to extend");
+ tf->getOptions()->addOptionResult("E=s", &s_contigeid, "Specify Contig eid");
+ tf->getOptions()->addOptionResult("I=i", &s_contigiid, "Specify Contig iid");
+ tf->getOptions()->addOptionResult("R", &s_rightExtension, "Perform Right Extension while fattening or growing");
+ tf->getOptions()->addOptionResult("L", &s_leftExtension, "Perform Left Extension while fattening or growing");
+ tf->getOptions()->addOptionResult("g|grow", &s_growContig, "Grow the contig");
+ tf->getOptions()->addOptionResult("f|fatten", &s_fatten, "Fatten the contig in the optional range");
+ tf->getOptions()->addOptionResult("v|verbose", &s_verbose, "Be verbose when reporting");
+ tf->getOptions()->addOptionResult("U|ungapped", &s_ungapped, "Ranges are ungapped coordinates");
+ tf->getOptions()->addOptionResult("unconfirmed", &unconfirmed, "Do unconfirmed contig growing");
+
+
+ tf->handleStandardOptions();
+
+ s_requireConfirmation = !unconfirmed;
+
+ // Sanity check that a read and a distance are specified together
+ if ((!s_readToExtend.empty() && !s_extensionDistance) ||
+ ( s_readToExtend.empty() && s_extensionDistance))
+ {
+ throw amosException("You must specify a readname and a distance to extend together",
+ "fattenContig");
+ }
+
+ // Enable both by default
+ if (!s_leftExtension && !s_rightExtension)
+ {
+ s_leftExtension = s_rightExtension = 1;
+ }
+
+ // By default, just fatten
+ if (!s_fatten && !s_growContig && !s_extensionDistance)
+ {
+ s_fatten = 1;
+ }
+
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() != 1)
+ {
+ cerr << "Usage: fattenContig [options] bankname" << endl;
+ return EXIT_FAILURE;
+ }
+
+ string bankname = argvv.front(); argvv.pop_front();
+
+ Bank_t contig_bank(Contig_t::NCODE);
+ Bank_t read_bank(Read_t::NCODE);
+
+ cerr << "Processing " << bankname << " at " << Date() << endl;
+
+ contig_bank.open(bankname, B_READ|B_SPY);
+ read_bank.open(bankname, B_READ|B_SPY);
+ Contig_t contig;
+
+ if (!s_contigeid.empty())
+ {
+ contig_bank.fetch(s_contigeid, contig);
+ fattenContig(contig, read_bank);
+ //contig_bank.replace(contig.getEID(), contig);
+ }
+ else if (s_contigiid != AMOS::NULL_ID)
+ {
+ contig_bank.fetch(s_contigiid, contig);
+ fattenContig(contig, read_bank);
+ //contig_bank.replace(contig.getIID(), contig);
+ }
+ else
+ {
+ AMOS::IDMap_t::const_iterator ci;
+ for (ci = contig_bank.getIDMap().begin();
+ ci;
+ ci++)
+ {
+ contig_bank.fetch(ci->iid, contig);
+ fattenContig(contig, read_bank);
+ //contig_bank.replace(contig.getEID(), contig);
+ }
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return retval;
+}
diff --git a/src/Experimental/filterfastadups.pl b/src/Experimental/filterfastadups.pl
new file mode 100755
index 0000000..0cd749b
--- /dev/null
+++ b/src/Experimental/filterfastadups.pl
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+use strict;
+use FileHandle;
+
+my %reads;
+my %files;
+
+my $curfh = undef;
+my $curbase = "";
+my $doprint = 0;
+
+# >m110425_194810_00124_c100105422556400000315040006221190_s1_p0/10/34_688
+
+my $allreads = 0;
+my $printedreads = 0;
+
+while (<>)
+{
+ if (/>(\S+)/)
+ {
+ $allreads++;
+
+ if (($allreads % 100000) == 0)
+ {
+ print STDERR "$allreads\n";
+ }
+
+ my $fullname = $1;
+ my @fields = split /\//, $fullname;
+
+ my $basename = $fields[0];
+ my $readid = $fields[1];
+ my $range = $fields[2];
+ #print "$basename $readid $range\n";
+
+ if ($basename ne $curbase)
+ {
+ if (!exists $files{$basename})
+ {
+ $files{$basename} = FileHandle->new("> $basename.fa");
+ }
+
+ $curfh = $files{$basename};
+ $curbase = $basename;
+ }
+
+ $doprint = 0;
+ $reads{$basename}->{$readid}->{$range}++;
+
+ if ($reads{$basename}->{$readid}->{$range} == 1)
+ {
+ $doprint = 1;
+ $printedreads++;
+ }
+ }
+
+ if ($doprint) { print $curfh $_; }
+}
+
+my $numfiles = scalar keys %files;
+
+print STDERR "Printed $printedreads of $allreads into $numfiles files\n";
diff --git a/src/Experimental/gap-closure-reads.cc b/src/Experimental/gap-closure-reads.cc
new file mode 100644
index 0000000..d27f166
--- /dev/null
+++ b/src/Experimental/gap-closure-reads.cc
@@ -0,0 +1,333 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+
+using namespace AMOS;
+using namespace std;
+
+
+class ReadPosInfo
+{
+public:
+ ReadPosInfo(ID_t contigiid, int offset, bool rc)
+ : m_contigiid(contigiid), m_offset(offset), m_rc(rc)
+ {}
+
+ ID_t m_contigiid;
+ int m_offset;
+ bool m_rc;
+};
+
+typedef map<ID_t, ReadPosInfo> ReadPosLookup;
+ReadPosLookup curread2contigpos;
+
+
+class NeighborLink
+{
+public:
+ NeighborLink(ID_t bcontig) : m_bcontigid(bcontig) {}
+ ID_t m_bcontigid;
+
+ set<ID_t> m_areads;
+ set<ID_t> m_breads;
+ set<ID_t> m_joins;
+ map<ID_t, ID_t> m_read2contig;
+
+ void addPair(ID_t join, ID_t aread, ID_t bread)
+ {
+ m_areads.insert(aread);
+ m_read2contig.insert(make_pair(aread, join));
+
+ m_breads.insert(bread);
+ m_read2contig.insert(make_pair(bread, join));
+
+ m_joins.insert(join);
+ }
+};
+
+
+class Neighbors
+{
+public:
+ Neighbors(ID_t contigid)
+ : m_contigid(contigid)
+ {}
+
+ ID_t m_contigid;
+ map<ID_t, NeighborLink> m_links;
+
+ void addNeighbor(ID_t bcontig,
+ ID_t join,
+ ID_t aread,
+ ID_t bread)
+ {
+ map<ID_t, NeighborLink>::iterator n = m_links.find(bcontig);
+ if (n == m_links.end())
+ {
+ n = m_links.insert(make_pair(bcontig, NeighborLink(bcontig))).first;
+ }
+
+ n->second.addPair(join, aread, bread);
+ }
+};
+
+
+typedef map<ID_t, Neighbors> NeighborMap;
+NeighborMap neighbormap;
+
+void handlePair(ID_t acontig,
+ ID_t bcontig,
+ ID_t join,
+ ID_t aread,
+ ID_t bread)
+{
+ NeighborMap::iterator n = neighbormap.find(acontig);
+
+ if (n == neighbormap.end())
+ {
+ n = neighbormap.insert(make_pair(acontig, Neighbors(acontig))).first;
+ }
+
+ n->second.addNeighbor(bcontig, join, aread, bread);
+}
+
+
+int main (int argc, char ** argv)
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ int curcontigiid = 0;
+ string curcontigeid;
+
+ int startpos = -1;
+ int endpos = -1;
+
+ int USETILENUM = 0;
+ map<ID_t, int> curcontigreads;
+ int HIDEDETAILS = 0;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Find reads that are in two contigs in one assembly, but in the same\n"
+"contig in another assembly\n"
+"\n"
+" Usage: gap-closure-reads [options] curbank otherbankn\n"
+"\n"
+" Options\n"
+" -------------------\n"
+" -d Hide details\n"
+"\n";
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+ tf->getOptions()->addOptionResult("d", &HIDEDETAILS, "Be verbose when reporting");
+
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ int USETILENUM = 0;
+
+ if (argvv.size() != 2)
+ {
+ cerr << "Usage: gap-closure-reads [options] curbank otherbank" << endl;
+ return EXIT_FAILURE;
+ }
+
+ string curbankname = argvv.front(); argvv.pop_front();
+ string otherbankname = argvv.front(); argvv.pop_front();
+
+ Bank_t ccontig_bank(Contig_t::NCODE);
+ Bank_t cread_bank(Read_t::NCODE);
+
+ Bank_t ocontig_bank(Contig_t::NCODE);
+ Bank_t oread_bank(Read_t::NCODE);
+
+ ccontig_bank.open(curbankname, B_READ);
+ cread_bank.open(curbankname, B_READ);
+
+ ocontig_bank.open(otherbankname, B_READ);
+ oread_bank.open(otherbankname, B_READ);
+
+ IDMap_t::const_iterator c;
+ const IDMap_t & crm = cread_bank.getIDMap();
+ const IDMap_t & orm = oread_bank.getIDMap();
+
+ cerr << "Indexing " << curbankname << "... ";
+ const IDMap_t & ccm = ccontig_bank.getIDMap();
+ for (c = ccm.begin(); c != ccm.end(); c++)
+ {
+ Contig_t contig;
+ ccontig_bank.fetch(c->iid, contig);
+
+ curcontigreads.insert(make_pair(c->iid, contig.getReadTiling().size()));
+
+ sort(contig.getReadTiling().begin(), contig.getReadTiling().end(), TileOrderCmp());
+
+ int tilenum = 0;
+ vector<Tile_t>::iterator t;
+ for (t = contig.getReadTiling().begin(); t != contig.getReadTiling().end(); t++)
+ {
+ int val = t->offset;
+ if (USETILENUM) { val = tilenum; }
+
+ curread2contigpos.insert(make_pair(t->source, ReadPosInfo(c->iid, val, t->range.isReverse())));
+ tilenum++;
+ }
+ }
+
+ cerr << curread2contigpos.size() << " reads in contigs" << endl;
+
+ cerr << "Processing " << otherbankname << "... ";
+
+ int cmp = 0;
+ int diff = 0;
+ int areadcount = 0;
+ int same = 0;
+
+ // consider all pairs of reads contigs from the other assembly,
+ // if there is a pair that is in different assemblies, this pair
+ // could be used for stitching the contigs
+ const IDMap_t & ocm = ocontig_bank.getIDMap();
+ for (c = ocm.begin(); c != ocm.end(); c++)
+ {
+ Contig_t contig;
+ ocontig_bank.fetch(c->iid, contig);
+
+ vector<Tile_t> & tiling = contig.getReadTiling();
+
+ sort(tiling.begin(), tiling.end(), TileOrderCmp());
+
+ int tilenum = 0;
+ vector<Tile_t>::iterator t;
+ vector<Tile_t>::iterator t2;
+ for (t = tiling.begin(); t != tiling.end(); t++)
+ {
+ string aread = orm.lookupEID(t->source);
+ ID_t t1iid = crm.lookupIID(aread);
+ ReadPosLookup::iterator t1info = curread2contigpos.find(t1iid);
+ areadcount++;
+
+ if (t1info != curread2contigpos.end())
+ {
+ ID_t acontig = t1info->second.m_contigiid;
+
+ for (t2 = t+1; t2 != tiling.end(); t2++)
+ {
+ cmp++;
+ string bread = orm.lookupEID(t2->source);
+ ID_t t2iid = crm.lookupIID(bread);
+ ReadPosLookup::iterator t2info = curread2contigpos.find(t2iid);
+
+ if (t2info != curread2contigpos.end())
+ {
+ ID_t bcontig = t2info->second.m_contigiid;
+
+ if (acontig != bcontig)
+ {
+ diff++;
+
+ if (acontig < bcontig)
+ {
+ handlePair(acontig, bcontig, contig.getIID(), t1iid, t2iid);
+ }
+ else
+ {
+ handlePair(bcontig, acontig, contig.getIID(), t2iid, t1iid);
+ }
+ }
+ else
+ {
+ same++;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ cerr << areadcount << " reads in contigs." << endl;
+ cerr << "Made " << cmp << " comparisons." << endl;
+ cerr << same << " pairs were consistent." << endl;
+ cerr << diff << " pairs were new." << endl;
+
+
+ NeighborMap::iterator n;
+ for (n = neighbormap.begin(); n != neighbormap.end(); n++)
+ {
+ ID_t acontig = n->second.m_contigid;
+ string ac = ccm.lookupEID(acontig);
+
+ map<ID_t, NeighborLink>::iterator l;
+ for (l = n->second.m_links.begin(); l != n->second.m_links.end(); l++)
+ {
+ NeighborLink & nl = l->second;
+ ID_t bcontig = nl.m_bcontigid;
+ string bc = ccm.lookupEID(bcontig);
+
+ cout << ">" << ac << " [" << nl.m_areads.size() << "/"
+ << curcontigreads[acontig] << "] <-> "
+ << bc << " [" << nl.m_breads.size() << "/"
+ << curcontigreads[bcontig] << "]";
+
+ set<ID_t>::const_iterator si;
+
+ for (si = nl.m_joins.begin(); si != nl.m_joins.end(); si++)
+ {
+ cout << "\t" << ocm.lookupEID(*si);
+ }
+ cout << endl;
+
+
+ if (!HIDEDETAILS)
+ {
+
+ for (si = nl.m_areads.begin(); si != nl.m_areads.end(); si++)
+ {
+ cout << "a\t" << crm.lookupEID(*si) << "\t"
+ << ocm.lookupEID(nl.m_read2contig[*si]) << endl;
+ }
+
+ for (si = nl.m_breads.begin(); si != nl.m_breads.end(); si++)
+ {
+ cout << "b\t" << crm.lookupEID(*si) << "\t"
+ << ocm.lookupEID(nl.m_read2contig[*si]) << endl;
+ }
+ }
+ }
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return retval;
+}
diff --git a/src/Experimental/insertGapColumn.cc b/src/Experimental/insertGapColumn.cc
new file mode 100644
index 0000000..ef3a0d7
--- /dev/null
+++ b/src/Experimental/insertGapColumn.cc
@@ -0,0 +1,47 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+// inserts a gap column into a contig at a specified position
+
+using namespace AMOS;
+using namespace std;
+
+bool USE_EID = 1;
+
+int main (int argc, char ** argv)
+{
+ if (argc != 4)
+ {
+ cerr << "Usage: insertgapcontig bankname eid gindex" << endl;
+ return EXIT_FAILURE;
+ }
+
+ Bank_t contig_bank(Contig_t::NCODE);
+ string bank_name = argv[1];
+ string contigid = argv[2];
+ int gindex = atoi(argv[3]);
+
+ Contig_t contig;
+
+ cerr << "Processing " << bank_name << " at " << Date() << endl;
+
+ try
+ {
+ contig_bank.open(bank_name, B_READ|B_WRITE);
+ contig_bank.fetch(contigid, contig);
+
+ contig.insertGapColumn(gindex);
+
+ contig_bank.replace(contig.getIID(), contig);
+ contig_bank.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return EXIT_SUCCESS;
+}
diff --git a/src/Experimental/link2reads.pl b/src/Experimental/link2reads.pl
new file mode 100755
index 0000000..bc7395f
--- /dev/null
+++ b/src/Experimental/link2reads.pl
@@ -0,0 +1,147 @@
+#!/usr/bin/perl -w
+use strict;
+use POSIX;
+use FileHandle;
+
+#++> $rid1 [$rlen1] -- $bestoo $bestcnt $bestmed $bestdist $beststd -- $rid2 [$rlen2] :
+#++> scaffold89 [44907] -- RF 3 1582.00 1361.00 1118.00 -- C9969 [502] : RF 3 1582.00 1361.00 +/- 1118.00
+
+# fastaFromBed -fi ctgs.fa -bed lib.1.bed -s -name -fo lib.1.fa
+# fastaFromBed -fi ctgs.fa -bed lib.2.bed -s -name -fo lib.2.fa
+
+my $readlen = 100;
+my $libbin = 250;
+my $baserank = 10;
+my $librange = 200;
+my $numreads = 20;
+
+my $USAGE = "link2reads.pl prefix links ctg.fa\n";
+
+my $prefix = shift @ARGV or die $USAGE;
+my $linkf = shift @ARGV or die $USAGE;
+my $ctgf = shift @ARGV or die $USAGE;
+
+my %libs;
+
+die "Can't read $ctgf\n"
+ if (! -r $ctgf);
+
+open LINKF, "< $linkf"
+ or die "Can't open $linkf ($!)\n";
+
+open CONFIG, "> $prefix.scaff.config"
+ or die "Can't open $prefix.scaff.config ($!)\n";
+
+while (<LINKF>)
+{
+ chomp;
+
+ my @fields = split /\s+/, $_;
+
+ my $ctg1 = $fields[1];
+ my $len1 = $fields[2]; $len1 =~ s/^\[//; $len1 =~ s/\]$//;
+
+ my $oo = $fields[4]; my ($o1, $o2) = split //, $oo;
+ my $cnt = $fields[5];
+ my $dst = int($fields[6]);
+
+ my $ctg2 = $fields[10];
+ my $len2 = $fields[11]; $len2 =~ s/^\[//; $len2 =~ s/\]$//;
+
+ my $lib = $dst+$readlen+$readlen+$librange;
+ my $rlib = $libbin*ceil(($lib) / $libbin);
+ my $margin = int(($rlib-$lib)/2);
+
+ ## |- rl -|- lr -|-m-| |-m-|- rl -|
+ ## |-------------------- $rlib ---------------------|
+ ## |------- dst -------|
+ ## ----------------------> ------------------------->
+ ## |-----> <------|
+
+ #print "$ctg1 $len1 - $o1 $o2 $dst $rlib $lib $margin - $ctg2 $len2\n";
+
+ if (!exists $libs{$rlib})
+ {
+ $libs{$rlib}->{1} = FileHandle->new("> $prefix.lib$rlib.1.bed");
+ $libs{$rlib}->{2} = FileHandle->new("> $prefix.lib$rlib.2.bed");
+
+ my $rank = $baserank + $rlib / $libbin;
+
+ my $q1 = File::Spec->rel2abs("$prefix.lib$rlib.1.fq");
+ my $q2 = File::Spec->rel2abs("$prefix.lib$rlib.2.fq");
+
+ print CONFIG "\n";
+ print CONFIG "[LIB]\n";
+ print CONFIG "avg_ins=$rlib\n";
+ print CONFIG "asm_flag=2\n";
+ print CONFIG "reverse_seq=0\n";
+ print CONFIG "rank=$rank\n";
+ print CONFIG "q1=$q1\n";
+ print CONFIG "q2=$q2\n";
+ }
+
+ my $fh1 = $libs{$rlib}->{1};
+ my $fh2 = $libs{$rlib}->{2};
+
+ print $fh1 "#$ctg1 $len1 - $o1 $o2 $dst $rlib $lib $margin - $ctg2 $len2\n";
+ print $fh2 "#$ctg1 $len1 - $o1 $o2 $dst $rlib $lib $margin - $ctg2 $len2\n";
+
+ for (my $ridx = 0; $ridx < $numreads; $ridx++)
+ {
+ my $shift1 = int($librange - $ridx*$librange/($numreads-1));
+ my $shift2 = $librange - $shift1;
+ #print $fh1 "#s1: $shift1 $shift2\n";
+ #print $fh2 "#s2: $shift1 $shift2\n";
+
+ if ($o1 eq "F")
+ {
+ my $s = $len1 - $readlen - $margin - $shift1;
+ my $e = $len1 - $margin - $shift1;
+
+ print $fh1 "$ctg1\t$s\t$e\t$ctg1:$ctg2:$oo:$ridx/1\t$lib\t+\n";
+ }
+ else
+ {
+ my $s = 0 + $margin + $shift1;
+ my $e = $readlen + $margin + $shift1;
+
+ print $fh1 "$ctg1\t$s\t$e\t$ctg1:$ctg2:$oo:$ridx/1\t$lib\t-\n";
+ }
+
+ if ($o2 eq "F")
+ {
+ my $s = 0 + $margin + $shift2;
+ my $e = $readlen + $margin + $shift2;
+
+ print $fh2 "$ctg2\t$s\t$e\t$ctg1:$ctg2:$oo:$ridx/2\t$lib\t+\n";
+ }
+ else
+ {
+ my $s = $len2 - $readlen - $margin - $shift2;
+ my $e = $len2 - $margin - $shift2;
+
+ print $fh2 "$ctg2\t$s\t$e\t$ctg1:$ctg2:$oo:$ridx/2\t$lib\t-\n";
+ }
+ }
+}
+
+foreach my $rlib (sort {$a <=> $b} keys %libs)
+{
+# fastaFromBed -fi ctgs.fa -bed lib.1.bed -s -name -fo lib.1.fa
+ print STDERR "Converting $rlib\n";
+
+ $libs{$rlib}->{1}->close;
+ $libs{$rlib}->{2}->close;
+
+ my $cmd1 = "fastaFromBed -fi $ctgf -bed $prefix.lib$rlib.1.bed -s -name -fo $prefix.lib$rlib.1.fa";
+ system($cmd1) and die "ERROR: $cmd1 ($!)\n";
+
+ $cmd1 = "fasta_to_fastq.pl $prefix.lib$rlib.1.fa > $prefix.lib$rlib.1.fq";
+ system($cmd1) and die "ERROR: $cmd1 ($!)\n";
+
+ my $cmd2 = "fastaFromBed -fi $ctgf -bed $prefix.lib$rlib.2.bed -s -name -fo $prefix.lib$rlib.2.fa";
+ system($cmd2) and die "ERROR: $cmd2 ($!)\n";
+
+ $cmd2 = "fasta_to_fastq.pl $prefix.lib$rlib.2.fa > $prefix.lib$rlib.2.fq";
+ system($cmd2) and die "ERROR: $cmd2 ($!)\n";
+}
diff --git a/src/Experimental/manageContigs.cc b/src/Experimental/manageContigs.cc
new file mode 100644
index 0000000..dba1377
--- /dev/null
+++ b/src/Experimental/manageContigs.cc
@@ -0,0 +1,238 @@
+
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+#include "ContigUtils.hh"
+
+using namespace AMOS;
+using namespace std;
+
+
+int main (int argc, char ** argv)
+{
+
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Manage contigs by deleting contigs, deleting reads from contigs, and\n"
+"duplicating contigs\n"
+"\n"
+" Usage: manageContigs [options] contig.bnk\n"
+" -C <iid> IID of contig to copy\n"
+" -c <eid> EID of contig to copy\n"
+" -D <iid> IID of contig to delete\n"
+" -d <eid> EID of contig to delete\n"
+" -e <eidfile> EID of reads to delete\n"
+" -i <iidfile> IID of reads to delete\n"
+"\n";
+
+ int copyiid = 0;
+ int deleteiid = 0;
+ string readeids;
+ string readiids;
+
+ string copyeid;
+ string deleteeid;
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+ tf->getOptions()->addOptionResult("C=i", ©iid, "Copy iid");
+ tf->getOptions()->addOptionResult("D=i", &deleteiid, "Delete iid");
+
+ tf->getOptions()->addOptionResult("c=s", ©eid, "Copy eid");
+ tf->getOptions()->addOptionResult("d=s", &deleteeid, "Delete eid");
+
+ tf->getOptions()->addOptionResult("e=s", &readeids, "Delete eid");
+ tf->getOptions()->addOptionResult("i=s", &readiids, "Delete iid");
+
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() != 1)
+ {
+ cerr << "Usage: manageContigs [options] contig.bnk" << endl;
+ return EXIT_FAILURE;
+ }
+
+ string bankname = argvv.front(); argvv.pop_front();
+
+ Bank_t ctg_bank(Contig_t::NCODE);
+ Bank_t red_bank(Read_t::NCODE);
+
+ ctg_bank.open(bankname, B_READ | B_WRITE);
+ red_bank.open(bankname, B_READ);
+
+ if (!copyeid.empty()) { copyiid = ctg_bank.lookupIID(copyeid); }
+ if (!deleteeid.empty()) { deleteiid = ctg_bank.lookupIID(deleteeid); }
+
+ if (copyiid != 0)
+ {
+ Contig_t contig;
+ ctg_bank.fetch(copyiid, contig);
+
+ string eid(contig.getEID());
+ eid += "_copy";
+
+ contig.setIID(ctg_bank.getMaxIID()+1);
+ contig.setEID(eid);
+
+ ctg_bank.append(contig);
+ }
+ else if (deleteiid != 0)
+ {
+ ctg_bank.remove(deleteiid);
+
+ vector<ID_t> bidstodelete;
+
+ BankStream_t feat_bank(Feature_t::NCODE);
+ feat_bank.open(bankname, B_READ|B_WRITE);
+ ID_t bid = feat_bank.tellg();
+
+ Feature_t feat;
+ while (feat_bank >> feat)
+ {
+ if ((feat.getSource().first == deleteiid) &&
+ (feat.getSource().second == Contig_t::NCODE))
+ {
+ bidstodelete.push_back(bid);
+ }
+
+ bid = feat_bank.tellg();
+ }
+
+ cerr << "Removing Associated Features: ";
+
+ for (int i = 0; i < bidstodelete.size(); i++)
+ {
+ cerr << ".";
+ feat_bank.removeByBID(bidstodelete[i]);
+ }
+
+ cerr << endl;
+
+ feat_bank.close();
+
+ }
+ else if (!readeids.empty() || !readiids.empty())
+ {
+ set<ID_t> iidstoremove;
+
+ if (!readeids.empty())
+ {
+ ifstream eidfile;
+ eidfile.open(readeids.c_str());
+
+ if (!eidfile)
+ {
+ throw Exception_t("Couldn't open EID File", __LINE__, __FILE__);
+ }
+
+ string eid;
+ while (eidfile >> eid)
+ {
+ ID_t iid = red_bank.lookupIID(eid.c_str());
+ if (iid != AMOS::NULL_ID)
+ {
+ iidstoremove.insert(iid);
+ }
+ else
+ {
+ cerr << "ERROR: READ EID: \"" << eid << "\" not found in bank, skipping" << endl;
+ }
+ }
+ }
+ else
+ {
+ ifstream iidfile;
+ iidfile.open(readiids.c_str());
+
+ if (!iidfile)
+ {
+ throw Exception_t("Couldn't open IID File", __LINE__, __FILE__);
+ }
+
+ ID_t iid;
+ while (iidfile >> iid)
+ {
+ iidstoremove.insert(iid);
+ }
+ }
+
+ Contig_t contig;
+
+ AMOS::IDMap_t::const_iterator ci;
+ for (ci = ctg_bank.getIDMap().begin();
+ ci;
+ ci++)
+ {
+ ctg_bank.fetch(ci->iid, contig);
+ vector<Tile_t> & tiling = contig.getReadTiling();
+
+ sort(tiling.begin(), tiling.end(), TileOrderCmp());
+
+ int tilesize = tiling.size();
+ int tilewritepos = 0;
+ int readsdeleted = 0;
+
+ for (int i = 0; i < tilesize; i++)
+ {
+ if (iidstoremove.find(tiling[i].source) == iidstoremove.end())
+ {
+ if (i != tilewritepos)
+ {
+ tiling[tilewritepos] = tiling[i];
+ }
+
+ tilewritepos++;
+ }
+ else
+ {
+ readsdeleted++;
+ }
+ }
+
+ if (readsdeleted)
+ {
+ cout << "Deleted " << readsdeleted << " reads from contig e" << contig.getEID() << endl;
+ tiling.resize(tilewritepos);
+ ctg_bank.replace(contig.getIID(), contig);
+ }
+ }
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return retval;
+}
diff --git a/src/Experimental/mate-evolution.cc b/src/Experimental/mate-evolution.cc
new file mode 100644
index 0000000..3066eae
--- /dev/null
+++ b/src/Experimental/mate-evolution.cc
@@ -0,0 +1,313 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+#include "PersistentUtils.hh"
+#include "DataStore.hh"
+#include "Insert.hh"
+
+using namespace AMOS;
+using namespace std;
+
+int INDEXSCAFFOLDS = 0;
+int WRITEFEATURES = 0;
+int MINDELTA = 0;
+
+struct RangeDelta
+{
+ RangeDelta(Range_t r, int d) : range(r), delta(d) {}
+ Range_t range;
+ int delta;
+};
+
+struct RangeCmp
+{
+ bool operator () (const RangeDelta & a, const RangeDelta & b)
+ {
+ int ldiff = b.range.getLo() - a.range.getLo();
+
+ if (ldiff)
+ {
+ if (ldiff < 0) { return false; }
+ return true;
+ }
+
+ int rdiff = b.range.getHi() - a.range.getHi();
+ if (rdiff)
+ {
+ if (rdiff < 0) { return false; }
+ return true;
+ }
+
+ return false;
+ }
+};
+
+
+void computeAllInserts(DataStore & datastore,
+ vector<Insert *> & inserts)
+{
+ set<ID_t> seencontigs;
+ vector<Tile_t> tiling;
+
+ Contig_t contig;
+ Scaffold_t scaff;
+ int count = 0;
+
+ if (INDEXSCAFFOLDS)
+ {
+ datastore.scaffold_bank.seekg(1);
+ while (datastore.scaffold_bank >> scaff)
+ {
+ datastore.mapReadsToScaffold(scaff, tiling, 0);
+ datastore.calculateInserts(tiling, inserts, 1, 0);
+ tiling.clear();
+ count++;
+
+ vector<Tile_t>::const_iterator ci;
+ for (ci = scaff.getContigTiling().begin();
+ ci != scaff.getContigTiling().end();
+ ci++)
+ {
+ seencontigs.insert(ci->source);
+ }
+ }
+
+ cerr << "Indexed " << count << " scaffolds with " << seencontigs.size() << " contigs" << endl;
+ }
+
+ count = 0;
+ set<ID_t>::iterator si;
+
+ const IDMap_t cmap = datastore.contig_bank.getIDMap();
+ IDMap_t::const_iterator ci;
+ for (ci = cmap.begin(); ci != cmap.end(); ci++)
+ {
+ si = seencontigs.find(ci->iid);
+
+ if (si == seencontigs.end())
+ {
+ count++;
+
+ datastore.contig_bank.seekg(ci->bid);
+ datastore.contig_bank >> contig;
+ datastore.calculateInserts(contig.getReadTiling(), inserts, 1, 0);
+ }
+ }
+
+ cerr << "Indexed " << count << " contigs not in scaffolds" << endl;
+}
+
+
+ReadPosLookup read2contigpos;
+
+
+int main (int argc, char ** argv)
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ int curcontigiid = 0;
+ string curcontigeid;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Compare mate-sizes in one bank to sizes in another\n"
+"\n"
+" Usage: mate-evolution [options] curbank otherbankn\n"
+"\n"
+" Output:\n"
+" read1 read2 delta (curdist disttomean) (olddist olddisttomean) [mean sd] acontig bcontig olda oldb\n"
+"\n"
+" Options\n"
+" -------\n"
+" -d <val> Min delta to display\n"
+" -f Write features to bank\n"
+"\n";
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+
+ tf->getOptions()->addOptionResult("d=i", &MINDELTA);
+ tf->getOptions()->addOptionResult("f", &WRITEFEATURES);
+
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() != 2)
+ {
+ cerr << "Usage: mate-evolution [options] curbank otherbank" << endl;
+ return EXIT_FAILURE;
+ }
+
+ string curbankname = argvv.front(); argvv.pop_front();
+ string otherbankname = argvv.front(); argvv.pop_front();
+
+ DataStore otherstore;
+ vector<Insert *> otherinserts;
+
+ DataStore curstore;
+ vector<Insert *> curinserts;
+
+ if (otherstore.openBank(otherbankname) || curstore.openBank(curbankname))
+ {
+ cerr << "Can't open bank" << endl;
+ exit(1);
+ }
+
+ typedef HASHMAP::hash_map<ID_t, Insert *> ReadInsertMap;
+ ReadInsertMap otherread2insert;
+
+ computeAllInserts(otherstore, otherinserts);
+
+ vector<Insert *>::iterator o;
+ for (o = otherinserts.begin(); o != otherinserts.end(); o++)
+ {
+ if ((*o)->m_aid != 0) { otherread2insert.insert(make_pair((*o)->m_aid, *o)); }
+ if ((*o)->m_bid != 0) { otherread2insert.insert(make_pair((*o)->m_bid, *o)); }
+ }
+
+ computeAllInserts(curstore, curinserts);
+
+ curstore.feat_bank.close();
+
+ typedef vector<RangeDelta> RangeList;
+ typedef map<ID_t, RangeList> RangeMap;
+ RangeMap fixranges;
+ RangeMap::iterator fi;
+
+
+ for (o = curinserts.begin(); o != curinserts.end(); o++)
+ {
+ if ((*o)->m_active == 2 && (*o)->m_state != Insert::OrientationViolation)
+ {
+ int curdist = (*o)->m_actual;
+
+ ReadInsertMap::iterator other1 = otherread2insert.find((*o)->m_aid);
+ if (other1 != otherread2insert.end())
+ {
+ if (other1->second->m_active == 2 && other1->second->m_state != Insert::OrientationViolation)
+ {
+ int olddist = other1->second->m_actual;
+ int delta = olddist - curdist; //1000 - 0 = 1000 bp collapse
+
+ double sd = (*o)->m_dist.sd;
+ double mean = (*o)->m_dist.mean;
+
+ int disttomean = (int)(curdist - mean);
+ int olddisttomean = (int)(olddist - mean);
+
+ int meandelta = abs(disttomean) - abs(olddisttomean);
+
+ if (meandelta >= MINDELTA)
+ {
+ cout << otherstore.read_bank.lookupEID((*o)->m_aid) << "\t"
+ << otherstore.read_bank.lookupEID((*o)->m_bid) << "\t"
+ << meandelta << "\t" << delta
+ << "\t(" << curdist << "\t" << disttomean
+ << ")\t(" << olddist << "\t" << olddisttomean
+ << ")\t[" << mean << " +/- " << sd << "]\t"
+ << (*o)->m_acontig << "\t" << (*o)->m_bcontig << "\t"
+ << other1->second->m_acontig << "\t" << other1->second->m_bcontig
+ << endl;
+
+ if ((*o)->m_acontig == (*o)->m_bcontig)
+ {
+ fi = fixranges.find((*o)->m_acontig);
+ if (fi == fixranges.end())
+ {
+ fi = fixranges.insert(make_pair((*o)->m_acontig, vector<RangeDelta> ())).first;
+ }
+
+ fi->second.push_back(RangeDelta(Range_t((*o)->m_loffset, (*o)->m_roffset), meandelta));
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ for (fi = fixranges.begin(); fi != fixranges.end(); fi++)
+ {
+ RangeList & ranges = fi->second;
+ RangeList::iterator r1, r2;
+
+ sort(ranges.begin(), ranges.end(), RangeCmp());
+
+ cout << ">" << fi->first << " " << ranges.size() << endl;
+
+ for (r1 = ranges.begin(); r1 != ranges.end(); r1++)
+ {
+ r2 = r1+1;
+
+ int count = 1;
+ int sum = r1->delta;
+
+ cout << r1->range.getLo() << " " << r1->range.getHi() << " " << r1->delta << endl;
+
+ while ((r2 != ranges.end()) && (r2->range.getLo() < r1->range.getHi()))
+ {
+ cout << r2->range.getLo() << " " << r2->range.getHi() << " " << r2->delta << endl;
+
+ count++;
+ sum += r2->delta;
+
+ r1->range.setEnd(max(r1->range.getHi(), r2->range.getHi()));
+ ranges.erase(r2);
+ r2 = r1+1;
+ }
+
+ double delta = double(sum)/count;
+ cout << ":" << r1->range.getLo() << " " << r1->range.getHi() << " " << count << " " << delta << endl;
+
+ if (WRITEFEATURES)
+ {
+ curstore.feat_bank.open(curbankname, B_WRITE);
+ Feature_t feat;
+ feat.setRange(r1->range);
+ feat.setSource(make_pair(fi->first, Contig_t::NCODE));
+ feat.setType('f');
+
+ stringstream comment;
+ comment << "MatePair improvement count: " << count << " delta: " << delta;
+ feat.setComment(comment.str());
+
+ curstore.feat_bank << feat;
+ }
+ }
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return retval;
+}
diff --git a/src/Experimental/persistent-assembly.pl b/src/Experimental/persistent-assembly.pl
new file mode 100755
index 0000000..bcf9b2d
--- /dev/null
+++ b/src/Experimental/persistent-assembly.pl
@@ -0,0 +1,80 @@
+#!/usr/bin/perl -w
+use strict;
+
+my $USAGE = "persistant-assembly.pl prefix [start=0 [end=20 [inc=1]]]\n";
+my $RUNCA = "~/build/wgs-assembler-4.2/Linux-amd64/bin/runCA";
+my $EXEC = 1;
+
+my $uname = `uname -p`;
+die "Must run on opteron" if (!($uname =~ /x86_64/));
+
+
+my $prefix = shift @ARGV;
+my $start = shift @ARGV;
+my $end = shift @ARGV;
+my $inc = shift @ARGV;
+
+die $USAGE if !defined $prefix;
+$start = 0 if !defined $start;
+$end = 20 if !defined $end;
+$inc = 1 if !defined $inc;
+
+die "$prefix.frg is missing" if (! -r "$prefix.frg");
+
+my $AMOSDIR = "AMOS";
+my $PERSISTDIR = "persist";
+
+sub runCmd
+{
+ my $cmd = shift;
+
+ my $echo = shift;
+ print "Running: $cmd\n" if defined $echo;
+
+ if ($EXEC)
+ {
+ my $rc = system($cmd);
+ if ($rc) { die "$cmd failed!\n"; }
+ }
+}
+
+if (! -x $PERSISTDIR) { mkdir $PERSISTDIR; }
+chdir $PERSISTDIR;
+
+runCmd("ln -s ../$prefix.frg") if ! -r "$prefix.frg";
+
+for (my $i=$start; $i <= $end; $i+=$inc)
+{
+ my $eval = sprintf("%0.03f", $i/1000);
+ $eval =~ s/\.//;
+
+ print "Eval: $eval\n";
+
+ if (! -x "$eval" ||
+ ! -r "$eval/9-terminator/asm.asm" ||
+ -r "$eval/0-mercounts")
+ {
+ runCmd("$RUNCA $prefix.frg -d $eval -s noVec utgErrorRate=$eval cleanup=aggressive 2>&1 | tee -a runCA.$eval.out", 1);
+ }
+
+ chdir $eval;
+
+ mkdir "AMOS" if (! -x "AMOS");
+ chdir "AMOS";
+
+ if (! -r "$prefix.bnk")
+ {
+ runCmd("ln -s ../9-terminator/asm.frg");
+ runCmd("ln -s ../9-terminator/asm.asm");
+ runCmd("cavalidate asm", 1);
+ }
+
+ if (-r "../../../$prefix.1con" && ! -r "refalign.delta.q")
+ {
+ runCmd("nucmer ../../../$prefix.1con asm.fasta -p refalign", 1);
+ runCmd("delta-filter -q refalign.delta > refalign.delta.q", 1);
+ }
+
+ chdir "..";
+ chdir "..";
+}
diff --git a/src/Experimental/persistent-fix-contigs.cc b/src/Experimental/persistent-fix-contigs.cc
new file mode 100644
index 0000000..39c7aa4
--- /dev/null
+++ b/src/Experimental/persistent-fix-contigs.cc
@@ -0,0 +1,588 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+#include "ContigUtils.hh"
+#include "PersistentUtils.hh"
+#include <sstream>
+
+using namespace AMOS;
+using namespace std;
+
+int SAVERESULTS(0);
+int FIXCOLLAPSE(0);
+int CLOSEGAPS(0);
+int SCANALL(0);
+
+int GAPSCLOSED(0);
+int COLLAPSEFIX(0);
+int MARKLOCATIONS(0);
+
+int VERBOSE(0);
+
+Bank_t master_contig(Contig_t::NCODE);
+Bank_t master_reads(Read_t::NCODE);
+Bank_t master_scaff(Scaffold_t::NCODE);
+BankStream_t master_feat(Feature_t::NCODE);
+
+Bank_t patch_contig(Contig_t::NCODE);
+Bank_t patch_reads(Read_t::NCODE);
+Bank_t patch_scaff(Scaffold_t::NCODE);
+BankStream_t patch_feat(Feature_t::NCODE);
+
+ReadPosLookup read2contigpos;
+
+int main (int argc, char ** argv)
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ bool PERFECT_OVL = 0;
+
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Fixes contigs in one assembly based on contigs in another\n"
+"\n"
+" Usage: persistent-fix-contigs [options] master patch\n"
+"\n"
+" Options\n"
+" -------------------\n"
+" -F <val> Fix collapsed repeats if delta >= val\n"
+" -G Close gaps between contigs\n"
+" -s Save results to bank\n"
+" -S Do full scan, not just adjacent reads\n"
+" -m Just mark locations of potential events\n";
+" -v Be Verbose\n";
+"\n";
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+
+ tf->getOptions()->addOptionResult("s", &SAVERESULTS);
+ tf->getOptions()->addOptionResult("F=i", &FIXCOLLAPSE);
+ tf->getOptions()->addOptionResult("G", &CLOSEGAPS);
+ tf->getOptions()->addOptionResult("S", &SCANALL);
+ tf->getOptions()->addOptionResult("m", &MARKLOCATIONS);
+ tf->getOptions()->addOptionResult("v", &VERBOSE);
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() != 2)
+ {
+ cerr << "Usage: persistent-fix-contigs [options] master patch" << endl;
+ return EXIT_FAILURE;
+ }
+
+ if (!FIXCOLLAPSE && !CLOSEGAPS)
+ {
+ cerr << "Nothing to do, exiting." << endl;
+ return EXIT_FAILURE;
+ }
+
+ string masterbankname = argvv.front(); argvv.pop_front();
+ string patchbankname = argvv.front(); argvv.pop_front();
+
+ int mode = B_READ;
+ if (SAVERESULTS) { mode = B_READ|B_WRITE; }
+ master_contig.open(masterbankname, mode);
+ master_scaff.open(masterbankname, mode);
+ master_feat.open(masterbankname, B_READ|B_WRITE);
+ master_reads.open(masterbankname, B_READ);
+
+ patch_contig.open(patchbankname, mode);
+ patch_scaff.open(patchbankname, mode);
+ patch_feat.open(patchbankname, mode);
+ patch_reads.open(patchbankname, B_READ);
+
+ recordContigPositions(patch_contig, read2contigpos);
+
+ if (FIXCOLLAPSE)
+ {
+ // Now check the master bank to see if there are contigs
+ // with reads that were pulled apart in the patch bank
+
+ cout << "Fixing collapsed repeats (>=" << FIXCOLLAPSE << ") in " << masterbankname << " with " << patchbankname << endl;
+
+ // current
+ vector<Tile_t>::iterator m1, m2;
+
+ // best master, patch
+ vector<Tile_t>::iterator master1, master2;
+ ReadPosLookup::iterator patch1, patch2;
+ int masterdist, patchdist;
+
+ // Check every contig for potential collapse
+ const IDMap_t & contigmap = master_contig.getIDMap();
+ IDMap_t::const_iterator c;
+ for (c = contigmap.begin(); c!= contigmap.end(); c++)
+ {
+ Contig_t contig;
+ master_contig.fetch(c->iid, contig);
+ string mcons = contig.getSeqString();
+ vector<Tile_t> & tiling = contig.getReadTiling();
+
+ sort(tiling.begin(), tiling.end(), TileOrderCmp());
+ int tilingsize = tiling.size();
+
+ // do a quick pass to see if there are any large collapses
+ bool bigjump = false;
+ for (int i = 0; i+1 < tilingsize; i++)
+ {
+ ReadPosLookup::iterator p1 = read2contigpos.find(tiling[i].source);
+ if (p1 == read2contigpos.end()) { continue; } // read[i] not in any patch contig
+
+ // find the first read from the same patch contig
+ int j;
+ bool foundp2 = false;
+ ReadPosLookup::iterator p2;
+
+ for (j = i+1; j < tilingsize; j++)
+ {
+ p2 = read2contigpos.find(tiling[j].source);
+ if (p2 == read2contigpos.end()) { continue; }
+
+ foundp2 = (p2->second.m_contigiid == p1->second.m_contigiid);
+
+ if (VERBOSE) { cout << master_reads.lookupEID(tiling[i].source) << ","
+ << master_reads.lookupEID(tiling[j].source) << " "
+ << foundp2 << endl; }
+
+ if (foundp2) { break; }
+ }
+
+ if (foundp2)
+ {
+ int consistent;
+ int delta, mdist, pdist;
+
+ computeDelta(&tiling[i], &p1->second, &tiling[j], &p2->second,
+ consistent, delta, mdist, pdist);
+
+ if (!consistent)
+ {
+ if (VERBOSE) { cerr << "Inconsistent orientations detected. master: " << c->iid << " patch: " << p1->second.m_contigiid << endl; }
+
+ if (VERBOSE)
+ {
+ bool m1rc = tiling[i].range.isReverse();
+ bool m2rc = tiling[j].range.isReverse();
+
+ bool masterinnie = m1rc ^ m2rc;
+ bool patchinnie = p1->second.rc() ^ p2->second.rc();
+
+ cout << "Inconsistent orientations detected "
+ << " masterinnie:" << masterinnie << " m1rc: " << m1rc << " m2rc: " << m2rc
+ << " patchinnie: " << patchinnie << " p1rc: " << p1->second.m_rc << " p2rc: " << p2->second.m_rc << endl;
+ }
+ }
+ else
+ {
+ if (VERBOSE) { cout << tiling[i].source
+ << " " << tiling[j].source
+ << " mdist: " << mdist
+ << " pdist: " << pdist
+ << " delta: " << delta << endl; }
+
+ if (delta >= FIXCOLLAPSE)
+ {
+ bigjump = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (bigjump || SCANALL)
+ {
+ int maxdelta = 0;
+
+ for (m1 = tiling.begin(); m1 != tiling.end(); m1++)
+ {
+ ReadPosLookup::iterator p1 = read2contigpos.find(m1->source);
+ if (p1 == read2contigpos.end()) { continue; }
+
+ for (m2 = m1+1; m2 != tiling.end(); m2++)
+ {
+ ReadPosLookup::iterator p2 = read2contigpos.find(m2->source);
+ if (p2 == read2contigpos.end()) { continue; }
+
+ if (p1->second.contig() == p2->second.contig())
+ {
+ int delta, mdist, pdist;
+ int consistent;
+
+ computeDelta(&*m1, &p1->second, &*m2, &p2->second,
+ consistent, delta, mdist, pdist);
+
+ if (!consistent)
+ {
+ // cerr << "Full Scan Inconsistent orientations detected. master: " << c->iid << " patch: " << p1->second.m_contigiid << endl;
+ }
+ else
+ {
+ if (delta >= FIXCOLLAPSE && delta > maxdelta)
+ {
+ bool savedelta = true;
+
+ if (PERFECT_OVL)
+ {
+ Contig_t pcontig;
+ patch_contig.fetch(p1->second.m_contigiid, pcontig);
+ string pcons = pcontig.getSeqString();
+
+ string mc1 = mcons.substr(m1->offset, m1->getGappedLength());
+ string pc1 = pcons.substr(p1->second.m_offset, p1->second.m_gappedlen);
+
+ bool m1rc = m1->range.isReverse();
+ bool m2rc = m2->range.isReverse();
+
+ if (m1rc) { Reverse_String(mc1); }
+ if (p1->second.m_rc) { Reverse_String(pc1); }
+
+ string mc2 = mcons.substr(m2->offset, m2->getGappedLength());
+ string pc2 = pcons.substr(p2->second.m_offset, p2->second.m_gappedlen);
+
+ if (m2rc) { Reverse_String(mc2); }
+ if (p2->second.m_rc) { Reverse_String(pc2); }
+
+ if (mc1 != pc1 || mc2 != pc2)
+ {
+ cerr << "Contig " << contig.getIID() << " within dist (" << delta
+ << "), but consensus mismatch!!!" << endl;
+
+ cerr << "mc1: " << mc1 << endl;
+ cerr << "pc1: " << pc1 << endl;
+
+ cerr << endl;
+ cerr << "mc2: " << mc2 << endl;
+ cerr << "pc2: " << pc2 << endl;
+ cerr << endl;
+ cerr << endl;
+ savedelta = false;
+ }
+ }
+
+ if (savedelta)
+ {
+ maxdelta = delta;
+
+ master1 = m1; patch1 = p1;
+ master2 = m2; patch2 = p2;
+
+ masterdist = mdist;
+ patchdist = pdist;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (maxdelta >= FIXCOLLAPSE)
+ {
+ bool dostitch = true;
+
+ bool rc = 0; // (master1->range.isReverse() != patch1->second.m_rc);
+
+ if (rc) { swap(master1, master2); swap(patch1, patch2); }
+
+ string leftstitchread = master_reads.lookupEID(master1->source);
+ string rightstitchread = master_reads.lookupEID(master2->source);
+
+ cout << ">Stitch mcontig: " << contig.getIID() << " (" << contig.getReadTiling().size() << ") pcontig: " << patch1->second.m_contigiid
+ << " delta: " << maxdelta << " left: " << leftstitchread << " right: " << rightstitchread
+ << " " << rc << endl;
+
+ cout << "master1: " << master1->offset << "," << master1->getRightOffset() << (master1->range.isReverse() ? "-" : "+")
+ << "\t | patch1: " << patch1->second.m_offset << "," << patch1->second.getRightOffset() << (patch1->second.m_rc ? "-" : "+") << endl
+
+ << "master2: " << master2->offset << "," << master2->getRightOffset() << (master2->range.isReverse() ? "-" : "+")
+ << "\t | patch2: " << patch2->second.m_offset << "," << patch2->second.getRightOffset() << (patch2->second.m_rc ? "-" : "+") << endl
+
+ << "masterdist: " << masterdist << "\t | patchdist: " << patchdist << endl;
+
+ //cout << "p2pos: " << patch2->second.pos(master2->range.isReverse()) << " p1pos: " << patch1->second.pos(master1->range.isReverse()) << endl;
+
+ if (dostitch)
+ {
+ COLLAPSEFIX++;
+
+ if (SAVERESULTS)
+ {
+ if (rc) { reverseContig(master_contig, master_scaff, master_feat, contig.getIID()); }
+
+ set<ID_t> masterreads, patchreads;
+ Range_t stitchRegion;
+
+ stitchContigs(master_contig, master_reads, master_scaff, master_feat,
+ patch_contig, patch_reads, patch_feat,
+ leftstitchread, rightstitchread,
+ masterreads, patchreads, stitchRegion,
+ contig.getIID(), 0, patch1->second.m_contigiid,
+ false, PERFECT_OVL);
+ }
+ else if (MARKLOCATIONS)
+ {
+ Feature_t feat;
+ feat.setRange(Range_t(master1->offset, master2->getRightOffset()));
+ feat.setSource(make_pair(contig.getIID(), Contig_t::NCODE));
+ feat.setType('F');
+
+ stringstream comment;
+ comment << "Potential Collapsed Repeat delta=" << maxdelta;
+ comment << " patch: " << patchbankname;
+
+ feat.setComment(comment.str());
+
+ master_feat << feat;
+ }
+ }
+
+ cout << endl << endl;
+ }
+ }
+ }
+ }
+
+ if (CLOSEGAPS)
+ {
+ map <ID_t, bool> patchrc;
+ cerr << "Closing Gaps" << endl;
+
+ const IDMap_t & scaffmap = master_scaff.getIDMap();
+ IDMap_t::const_iterator s;
+ for (s = scaffmap.begin(); s != scaffmap.end(); s++)
+ {
+ Scaffold_t scaff;
+ master_scaff.fetch(s->iid, scaff);
+
+ vector<Tile_t> & ctiling = scaff.getContigTiling();
+ int l = ctiling.size();
+
+ // Check if there are potential gaps to close
+ if (l < 2) { continue; }
+
+ sort(ctiling.begin(), ctiling.end(), TileOrderCmp());
+
+ Contig_t c1, c2;
+
+ master_contig.fetch(ctiling[0].source, c1);
+
+ for (int i = 1; i < l; i++)
+ {
+ master_contig.fetch(ctiling[i].source, c2);
+
+ set<ID_t> c1contigs;
+ set<ID_t> c2contigs;
+ set<ID_t> joincontigs;
+ set<ID_t>::iterator si;
+
+ vector<Tile_t>::iterator ti;
+ for (ti = c1.getReadTiling().begin(); ti != c1.getReadTiling().end(); ti++)
+ {
+ ReadPosLookup::iterator r = read2contigpos.find(ti->source);
+
+ if (r != read2contigpos.end())
+ {
+ c1contigs.insert(r->second.m_contigiid);
+ }
+ }
+
+ for (ti = c2.getReadTiling().begin(); ti != c2.getReadTiling().end(); ti++)
+ {
+ ReadPosLookup::iterator r = read2contigpos.find(ti->source);
+ if (r != read2contigpos.end())
+ {
+ if (c1contigs.find(r->second.m_contigiid) != c1contigs.end())
+ {
+ joincontigs.insert(r->second.m_contigiid);
+ c2contigs.insert(r->second.m_contigiid);
+ }
+ }
+ }
+
+ bool madestitch = false;
+
+ if (!joincontigs.empty())
+ {
+ cout << ">Gap " << c1.getIID() << " " << c2.getIID()
+ << " " << joincontigs.size() << " patches:";
+
+ for (si = joincontigs.begin(); si != joincontigs.end(); si++)
+ {
+ cout << " " << *si;
+ }
+ cout << endl;
+
+ if (joincontigs.size() == 1)
+ {
+ ID_t joiniid = *(joincontigs.begin());
+
+ vector<Tile_t>::iterator master1, master2;
+ ReadPosLookup::iterator patch1, patch2;
+ vector<Tile_t> & c1tiling = c1.getReadTiling();
+ sort(c1tiling.begin(), c1tiling.end(), TileOrderCmp());
+ reverse(c1tiling.begin(), c1tiling.end());
+
+ for (master1 = c1tiling.begin(); master1 != c1tiling.end(); master1++)
+ {
+ patch1 = read2contigpos.find(master1->source);
+
+ if (patch1 != read2contigpos.end() && patch1->second.m_contigiid == joiniid)
+ {
+ break;
+ }
+ }
+
+ vector<Tile_t> & c2tiling = c2.getReadTiling();
+ sort(c2tiling.begin(), c2tiling.end(), TileOrderCmp());
+ for (master2 = c2tiling.begin(); master2 != c2tiling.end(); master2++)
+ {
+ patch2 = read2contigpos.find(master2->source);
+
+ if (patch2 != read2contigpos.end() && patch2->second.m_contigiid == joiniid)
+ {
+ break;
+ }
+ }
+
+ int rc = (patch1->second.m_offset > patch2->second.m_offset) ? 1 : 0;
+ int rc1 = (master1->range.isReverse() != patch1->second.m_rc);
+ int rc2 = (master2->range.isReverse() != patch2->second.m_rc);
+
+ string leftstitchread = master_reads.lookupEID(master1->source);
+ string rightstitchread = master_reads.lookupEID(master2->source);
+
+ ID_t patchiid = patch1->second.m_contigiid;
+
+ cout << ">Stitch mcontig: " << c1.getIID() << " mcontig2:" << c2.getIID() << " pcontig: " << patchiid
+ << " left: " << leftstitchread << " right: " << rightstitchread
+ << " rc:" << rc << " rc1:" << rc1 << " rc2: " << rc2 << endl;
+
+ map <ID_t, bool>::iterator prc = patchrc.find(patchiid);
+
+ if (prc != patchrc.end())
+ {
+ if (prc->second)
+ {
+ rc = !rc; rc1 = !rc1; rc2 = !rc2;
+ cout << "Patch was previously flipped: rc:" << rc << " rc1: " << rc1 << " rc2: " << rc2 << endl;
+ }
+ }
+
+ bool dostitch = true;
+
+ if ((patch1->second.m_offset + patch1->second.m_gappedlen) >
+ (patch2->second.m_offset + patch2->second.m_gappedlen))
+ {
+ cerr << "patch1 contains patch2!!!" << endl;
+ // dostitch = false;
+ }
+
+ if ((patch2->second.m_offset + patch2->second.m_gappedlen) >
+ (patch1->second.m_offset + patch1->second.m_gappedlen))
+ {
+ cerr << "patch2 contains patch1!!!" << endl;
+ // dostitch = false;
+ }
+
+ if (dostitch)
+ {
+ GAPSCLOSED++;
+
+ if (SAVERESULTS)
+ {
+ if (rc)
+ {
+ cerr << "patchrc, reversing patch, rc1, rc2" << endl;
+ reverseContig(patch_contig, patch_scaff, patch_feat, patchiid);
+ rc1 = !rc1;
+ rc2 = !rc2;
+
+ if (prc != patchrc.end())
+ {
+ prc->second = !prc->second;
+ }
+ else
+ {
+ patchrc.insert(make_pair(patchiid, true));
+ }
+ }
+
+ if (rc1) { reverseContig(master_contig, master_scaff, master_feat, c1.getIID()); }
+ if (rc2) { reverseContig(master_contig, master_scaff, master_feat, c2.getIID()); }
+
+ set<ID_t> masterreads, patchreads;
+ Range_t stitchRegion;
+
+ try
+ {
+ stitchContigs(master_contig, master_reads, master_scaff, master_feat,
+ patch_contig, patch_reads, patch_feat,
+ leftstitchread, rightstitchread,
+ masterreads, patchreads, stitchRegion,
+ c1.getIID(), c2.getIID(), patch1->second.m_contigiid,
+ false, PERFECT_OVL);
+
+ master_contig.fetch(c1.getIID(), c1);
+ madestitch = true;
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Stitch failed: " << e << endl;
+ madestitch = false;
+ }
+ }
+ }
+
+ cout << endl << endl;
+ }
+ }
+
+ if (!madestitch)
+ {
+ c1 = c2;
+ }
+ }
+ }
+ }
+
+ cout << "@Summary:"
+ << " Master " << masterbankname
+ << " Patch " << patchbankname
+ << " Closed " << GAPSCLOSED << " gaps"
+ << " Corrected " << COLLAPSEFIX << " collapsed repeats" << endl;
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ return retval;
+}
diff --git a/src/Experimental/persistent-fix.pl b/src/Experimental/persistent-fix.pl
new file mode 100755
index 0000000..0141954
--- /dev/null
+++ b/src/Experimental/persistent-fix.pl
@@ -0,0 +1,97 @@
+#!/usr/bin/perl -w
+use strict;
+
+my $run = 1;
+my $FIX = "~/build/AMOS/src/Persistant/persistent-fix-contigs";
+my $MATE = "~/build/AMOS/src/Persistant/mate-evolution";
+my $AUTO = "~/build/AMOS/src/Persistant/auto-fix-contigs";
+
+my $NUCMER = "nucmer";
+my $FILTER = "delta-filter";
+
+my $CMD = $AUTO;
+
+my $USAGE = "persistent-fix.pl file val start end [flags]\n";
+
+die $USAGE if scalar @ARGV < 4;
+
+my $file = shift @ARGV;
+my $val = shift @ARGV;
+my $start = shift @ARGV;
+my $end = shift @ARGV;
+my $flags = join " ", @ARGV;
+
+my $base = sprintf("%04d", $start);
+$base .= "/AMOS/$file.bnk";
+
+die "$base not accessible\n" if (! -x $base);
+
+my $ALLVALL = 1;
+
+
+
+sub runCMD
+{
+ my $cmd = shift;
+ my $desc = shift;
+ if (defined $desc) { print "$desc\n"; }
+ else { print "cmd: $cmd\n"; }
+
+ if ($run)
+ {
+ my $rc = system($cmd);
+ die "Command failed: $!\n" if $rc;
+ }
+}
+
+sub fix
+{
+ my $mlevel = shift;
+ my $plevel = shift;
+
+ $mlevel = sprintf("%04d", $mlevel);
+ $plevel = sprintf("%04d", $plevel);
+
+ print STDERR "#### Fixing $mlevel with $plevel\n";
+
+ if (! -r "$mlevel/AMOS/$mlevel-$plevel.delta")
+ {
+ runCMD("($NUCMER $mlevel/AMOS/$file.fasta $plevel/AMOS/$file.fasta -p $mlevel/AMOS/$mlevel-$plevel) > /dev/null", "align");
+ unlink "$mlevel/AMOS/$mlevel-$plevel.cluster";
+ }
+
+ runCMD("$FILTER -rq $mlevel/AMOS/$mlevel-$plevel.delta > $mlevel/AMOS/$mlevel-$plevel.delta.rq", "delta-filter")
+ if (! -r "$mlevel/AMOS/$mlevel-$plevel.delta.rq");
+
+ runCMD("$CMD $flags $mlevel/AMOS/$file.bnk $plevel/AMOS/$file.bnk $mlevel/AMOS/$mlevel-$plevel.delta.rq");
+
+ print "\n\n";
+}
+
+
+my $starttime = time;
+
+if ($ALLVALL)
+{
+ for (my $j = $start; $j <= $end; $j++)
+ {
+ next if ($val == $j);
+ fix($val, $j);
+ }
+}
+else
+{
+ my $inc = 1;
+ if ($end < $start) { $inc = -1; }
+
+ while ($start != $end)
+ {
+ fix($start, $start+$inc);
+ $start += $inc;
+ }
+}
+
+my $endtime = time;
+my $delta = $endtime - $starttime;
+
+print STDERR "Done in $delta s\n";
diff --git a/src/Experimental/persistent-plot-breaks.pl b/src/Experimental/persistent-plot-breaks.pl
new file mode 100755
index 0000000..7c8de08
--- /dev/null
+++ b/src/Experimental/persistent-plot-breaks.pl
@@ -0,0 +1,82 @@
+#!/usr/bin/perl -w
+use strict;
+
+my $USAGE = "plot-breaks.pl [-c] 1con listofdelta.q\n";
+
+my $CHECKFIX = 0;
+my $BREAKSCMD = "find-query-breaks.pl -B";
+my $tic = 10;
+
+
+my $onecon = shift @ARGV;
+
+if (defined $onecon && $onecon eq "-c")
+{
+ $CHECKFIX = 1;
+ $BREAKSCMD .= " -c";
+ $onecon = shift @ARGV;
+}
+
+die $USAGE if !defined $onecon;
+
+open LENS, "getlengths $onecon |"
+ or die "Can't open pipe for getlengths ($!)\n";
+
+my %refinfo;
+my $refcum = 1;
+while (<LENS>)
+{
+ my ($name, $len) = split /\s+/, $_;
+ $refinfo{$name}->{len} = $len;
+ $refinfo{$name}->{startx} = $refcum;
+ $refcum += $len + 10000;
+}
+
+my %breaks;
+
+foreach my $delta (@ARGV)
+{
+ my $num = $1 if ($delta =~ /^(\d+)/);
+ print STDERR "Processing $num ($delta)\n";
+
+
+ open BREAKS, "$BREAKSCMD $delta |"
+ or die "Can't open pipe for $BREAKSCMD ($!)\n";
+
+ my $ycoord = $num * 100;
+
+ ## Draw Horizontal Line representing genome
+ foreach my $ref (keys %refinfo)
+ {
+ my $s = $refinfo{$ref}->{startx};
+ my $e = $s + $refinfo{$ref}->{len};
+
+ print "$s\t$ycoord\t$e\t$ycoord\t100.0\n";
+ }
+
+ ## Draw a tic for every breakpoint
+ while (<BREAKS>)
+ {
+ my @vals = split /\s+/, $_;
+ my $binfo;
+
+ my $ref = $vals[0];
+ my $type = $vals[1];
+ my $loc = $vals[2];
+
+ die "\"$ref\" not found\n" if (!exists $refinfo{$ref});
+
+ my $refx = $refinfo{$ref}->{startx};
+ my $x = $loc + $refx;
+
+ my $t = $ycoord + $tic;
+ my $b = $ycoord - $tic;
+
+ my $col = 0.0;
+
+ if ($CHECKFIX) { $col = $vals[3] * 100.0; }
+ print "$x\t$t\t$x\t$b\t$col\n";
+ }
+}
+
+
diff --git a/src/Experimental/persistent-read-dist.cc b/src/Experimental/persistent-read-dist.cc
new file mode 100644
index 0000000..f8b6ce2
--- /dev/null
+++ b/src/Experimental/persistent-read-dist.cc
@@ -0,0 +1,417 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+
+#include "PersistentUtils.hh"
+
+using namespace AMOS;
+using namespace std;
+
+int MINDELTA(0);
+int PRINTDIFFERENT(0);
+int USESCAFFOLD(0);
+int USEEID(0);
+int SHOWBEST(0);
+
+
+
+
+ReadPosLookup read2contigpos;
+
+IDMap_t lastcontigmap;
+
+vector<Tile_t> getScaffoldReadTiling(Scaffold_t & scaffold,
+ Bank_t & contig_bank)
+{
+ vector<Tile_t> scaffreads;
+ vector <Tile_t>::iterator ci;
+
+ for (ci = scaffold.getContigTiling().begin();
+ ci != scaffold.getContigTiling().end();
+ ci++)
+ {
+ Contig_t contig;
+ contig_bank.fetch(ci->source, contig);
+
+ if (ci->range.isReverse())
+ {
+ contig.reverseComplement();
+ }
+
+ int clen = contig.getLength();
+
+ vector <Tile_t>::iterator ri;
+ for (ri = contig.getReadTiling().begin();
+ ri != contig.getReadTiling().end();
+ ri++)
+ {
+ Tile_t mappedTile;
+ mappedTile.source = ri->source;
+ mappedTile.gaps = ri->gaps;
+ mappedTile.range = ri->range;
+ mappedTile.offset = ci->offset + ri->offset;
+ scaffreads.push_back(mappedTile);
+ }
+ }
+
+ return scaffreads;
+}
+
+
+
+void printReadPair(Bank_t & read_bank,
+ ID_t curiid,
+ Tile_t * cur1,
+ Tile_t * cur2,
+ ReadPosInfo * other1,
+ ReadPosInfo * other2)
+{
+ int delta, mdist, pdist;
+ int consistent;
+
+ computeDelta(cur1, other1, cur2, other2,
+ consistent, delta, mdist, pdist);
+
+
+ int absdelta = abs(delta);
+
+ if (absdelta >= MINDELTA)
+ {
+ cout << curiid << "\t";
+
+ if (USEEID)
+ {
+ cout << lastcontigmap.lookupEID(other1->contig()) << "\t";
+ }
+ else
+ {
+ cout << other1->contig() << "\t";
+ }
+
+ cout << read_bank.lookupEID(cur1->source) << "\t"
+ << read_bank.lookupEID(cur2->source) << "\t"
+ << mdist << "\t"
+ << pdist << "\t"
+ << delta << "\t"
+ << consistent << endl;
+ }
+}
+
+class Neighbor_t
+{
+public:
+ Neighbor_t(ID_t contigid) : m_contigid(contigid) {}
+ ID_t m_contigid;
+ vector<ReadPosInfo *> m_reads;
+
+ void addRead(ReadPosInfo * r)
+ {
+ m_reads.push_back(r);
+ }
+};
+
+int contigcount(0);
+int neighborcount(0);
+
+
+
+void printBestReadDistance(ID_t curiid,
+ vector<Tile_t> & tiling,
+ Bank_t & read_bank)
+{
+ map<ID_t, Neighbor_t> neighbormap;
+ map<ID_t, Neighbor_t>::iterator ni;
+
+ sort(tiling.begin(), tiling.end(), TileOrderCmp());
+
+ contigcount += (tiling.size() * (tiling.size()-1))/2;
+
+ map<ID_t, Tile_t *> tilelookup;
+
+ vector<Tile_t>::iterator t1;
+ for (t1 = tiling.begin(); t1 != tiling.end(); t1++)
+ {
+ ReadPosLookup::iterator r1 = read2contigpos.find(t1->source);
+
+ if (r1 != read2contigpos.end())
+ {
+ ni = neighbormap.find(r1->second.contig());
+
+ if (ni == neighbormap.end())
+ {
+ ni = neighbormap.insert(make_pair(r1->second.contig(), Neighbor_t(r1->second.contig()))).first;
+ }
+
+ ni->second.addRead(&r1->second);
+ tilelookup.insert(make_pair(t1->source, &(*t1)));
+ }
+ }
+
+ for (ni = neighbormap.begin(); ni != neighbormap.end(); ni++)
+ {
+ int l = ni->second.m_reads.size();
+ int max = 0;
+ int maxi;
+ int maxj;
+
+ for (int i = 0; i < l; i++)
+ {
+ Tile_t * ti = tilelookup[ni->second.m_reads[i]->iid()];
+
+ for (int j = i+1; j < l; j++)
+ {
+ neighborcount++;
+
+ int delta, mdist, pdist;
+ int consistent;
+
+ computeDelta(&(*ti),
+ ni->second.m_reads[i],
+ tilelookup[ni->second.m_reads[j]->iid()],
+ ni->second.m_reads[j],
+ consistent, delta, mdist, pdist);
+
+ if (consistent && delta > max)
+ {
+ max = delta; maxi = i; maxj = j;
+ }
+ }
+ }
+
+ if (max)
+ {
+ printReadPair(read_bank, curiid,
+ tilelookup[ni->second.m_reads[maxi]->iid()],
+ tilelookup[ni->second.m_reads[maxj]->iid()],
+ ni->second.m_reads[maxi],
+ ni->second.m_reads[maxj]);
+ }
+ }
+}
+
+
+void printAllReadDistance(ID_t curiid,
+ vector<Tile_t> & tiling,
+ Bank_t & read_bank)
+{
+ vector<Tile_t>::iterator t1;
+ vector<Tile_t>::iterator t2;
+
+ int tilingsize = tiling.size();
+
+ for (t1 = tiling.begin(); t1 != tiling.end(); t1++)
+ {
+ ReadPosLookup::iterator r1 = read2contigpos.find(t1->source);
+ if (r1 == read2contigpos.end()) { continue; }
+
+ for (t2 = t1+1; t2 != tiling.end(); t2++)
+ {
+ ReadPosLookup::iterator r2 = read2contigpos.find(t2->source);
+ if (r2 == read2contigpos.end()) { continue; }
+
+ // Distance is only defined if the two reads existed in the same contig before
+ if (r1->second.contig() == r2->second.contig())
+ {
+ contigcount++;
+ printReadPair(read_bank, curiid, &(*t1), &(*t2), &r1->second, &r2->second);
+ }
+ else if (PRINTDIFFERENT)
+ {
+ int dist = computeDistance(&*t1, &*t2);
+
+ cout << curiid << "\t"
+ << "*\t"
+ << read_bank.lookupEID(t1->source) << "\t"
+ << read_bank.lookupEID(t2->source) << "\t"
+ << dist << "\t"
+ << "*\t*" << endl;
+ }
+ }
+ }
+}
+
+
+int main (int argc, char ** argv)
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Computes the read distance evolution\n"
+"\n"
+" Usage: persistent-read-dist [options] bank1 ... bankn\n"
+"\n"
+"delta = curdist - olddist (negative means collapse in current\n"
+"Output format:\n"
+">currentbank-lastbank\n"
+"curcontigiid lastcontigiid read1 read2 dist olddist delta\n"
+"\n"
+" Options\n"
+" -------------------\n"
+" -d <val> Only display abs(delta) >= val\n"
+" -p Display distances between reads not in same lastbank contig\n"
+" -s Use scaffolds when computing distances\n"
+" -e Display contigeid's instead of iids\n"
+" -b Only show the biggest different for a given cur,old pair\n"
+"\n";
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+
+ tf->getOptions()->addOptionResult("d=i", &MINDELTA, "Be verbose when reporting");
+ tf->getOptions()->addOptionResult("p", &PRINTDIFFERENT, "Be verbose when reporting");
+ tf->getOptions()->addOptionResult("s", &USESCAFFOLD, "Be verbose when reporting");
+ tf->getOptions()->addOptionResult("e", &USEEID, "Be verbose when reporting");
+ tf->getOptions()->addOptionResult("b", &SHOWBEST, "Only show best");
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() == 0)
+ {
+ cerr << "Usage: persistent-read-dist [options] bank1 ... bankn" << endl;
+ return EXIT_FAILURE;
+ }
+
+ string lastbank;
+ string bankname = argvv.front();
+ bool first = true;
+
+ cerr << "Loading read id map" << endl;
+ Bank_t read_bank(Read_t::NCODE);
+ read_bank.open(bankname, B_READ);
+
+ while (!argvv.empty())
+ {
+ bankname = argvv.front(); argvv.pop_front();
+ cerr << "Processing " << bankname << " at " << Date() << endl;
+
+ Bank_t scaffold_bank(Scaffold_t::NCODE);
+ Bank_t contig_bank(Contig_t::NCODE);
+ contig_bank.open(bankname, B_READ);
+
+ if (USESCAFFOLD)
+ {
+ scaffold_bank.open(bankname, B_READ);
+ }
+
+ bankname = bankname.substr(0, bankname.find_first_of("/ "));
+
+ if (!first)
+ {
+ cout << ">" << bankname << "-" << lastbank << endl;
+ }
+
+ lastbank = bankname;
+
+ IDMap_t::const_iterator c;
+ if (USESCAFFOLD)
+ {
+ const IDMap_t & scaffoldmap = scaffold_bank.getIDMap();
+
+ if (!first)
+ {
+ for (c = scaffoldmap.begin(); c != scaffoldmap.end(); c++)
+ {
+ Scaffold_t scaffold;
+ scaffold_bank.fetch(c->iid, scaffold);
+ vector <Tile_t> scaffreads = getScaffoldReadTiling(scaffold, contig_bank);
+
+ if (SHOWBEST)
+ {
+ printBestReadDistance(c->iid, scaffreads, read_bank);
+ }
+ else
+ {
+ printAllReadDistance(c->iid, scaffreads, read_bank);
+ }
+ }
+
+ read2contigpos.clear();
+ }
+
+ for (c = scaffoldmap.begin(); c != scaffoldmap.end(); c++)
+ {
+ Scaffold_t scaffold;
+ scaffold_bank.fetch(c->iid, scaffold);
+ vector <Tile_t> scaffreads = getScaffoldReadTiling(scaffold, contig_bank);
+ recordReadPositions(c->iid, scaffreads, read2contigpos);
+ }
+
+ lastcontigmap = scaffoldmap;
+ }
+ else
+ {
+ const IDMap_t & contigmap = contig_bank.getIDMap();
+
+ if (!first)
+ {
+ for (c = contigmap.begin(); c!= contigmap.end(); c++)
+ {
+ Contig_t contig;
+ contig_bank.fetch(c->iid, contig);
+
+ if (SHOWBEST)
+ {
+ printBestReadDistance(c->iid, contig.getReadTiling(), read_bank);
+ }
+ else
+ {
+ printAllReadDistance(c->iid, contig.getReadTiling(), read_bank);
+ }
+ }
+
+ read2contigpos.clear();
+ }
+
+ for (c = contigmap.begin(); c!= contigmap.end(); c++)
+ {
+ Contig_t contig;
+ contig_bank.fetch(c->iid, contig);
+ recordReadPositions(contig.getIID(), contig.getReadTiling(), read2contigpos);
+ }
+
+ lastcontigmap = contigmap;
+ }
+
+ first = false;
+ }
+
+ cerr << "Would have made " << contigcount << " comparisons" << endl;
+ cerr << "Actually made " << neighborcount << " comparisons" << endl;
+ cerr << "Saved: " << contigcount - neighborcount << endl;
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return retval;
+}
diff --git a/src/Experimental/persistent-unitig.pl b/src/Experimental/persistent-unitig.pl
new file mode 100755
index 0000000..bb525bc
--- /dev/null
+++ b/src/Experimental/persistent-unitig.pl
@@ -0,0 +1,81 @@
+#!/usr/bin/perl -w
+use strict;
+
+my $USAGE = "persistant-assembly.pl prefix persist.spec start=0 [end=20 [inc=1]]]\n";
+my $RUNCA = "~/build/packages/wgs-6.1/Linux-amd64/bin/runCA";
+my $EXEC = 1;
+
+my $prefix = shift @ARGV;
+my $spec = shift @ARGV;
+my $start = shift @ARGV;
+my $end = shift @ARGV;
+my $inc = shift @ARGV;
+
+die $USAGE if !defined $spec;
+$start = 0 if !defined $start;
+$end = 20 if !defined $end;
+$inc = 1 if !defined $inc;
+
+my $BASEDIR = "asm";
+my $PERSISTDIR = "persist";
+
+########################################
+
+sub runCmd
+{
+ my $cmd = shift;
+
+ my $echo = shift;
+ print "Running: $cmd\n" if defined $echo;
+
+ if ($EXEC)
+ {
+ my $rc = system($cmd);
+ if ($rc) { die "$cmd failed!\n"; }
+ }
+}
+
+########################################
+
+if (! -x $PERSISTDIR) { mkdir $PERSISTDIR; }
+chdir $PERSISTDIR;
+
+if (! -r "foo.frg") { runCmd("touch foo.frg"); }
+
+for (my $i=$start; $i <= $end; $i+=$inc)
+{
+ my $enum = sprintf("%0.03f", $i/1000);
+ my $eval = $enum;
+ $eval =~ s/\.//;
+
+ print "Eval: $eval $enum\n";
+
+ mkdir $eval if (! -x $eval);
+
+ foreach my $file ("0-mercounts",
+ "0-overlaptrim",
+ "0-overlaptrim-overlap",
+ "1-overlapper",
+ "3-overlapcorrection",
+ "$prefix.ovlStore")
+ {
+ runCmd("ln -s ../../$BASEDIR/$file $eval/$file") if (! -r "$eval/$file");
+ }
+
+ if (! -r "$eval/$prefix.gkpStore")
+ {
+ mkdir "$eval/$prefix.gkpStore";
+
+ foreach my $f (`/bin/ls ../$BASEDIR/$prefix.gkpStore/`)
+ {
+ chomp $f;
+ if ($f =~ "clr.*ECR") { print " skip: $f\n"; }
+ else { runCmd("ln -s ../../../$BASEDIR/$prefix.gkpStore/$f $eval/$prefix.gkpStore/"); }
+ }
+ }
+
+ if (! -r "$eval/4-unitigger")
+ {
+ runCmd("$RUNCA -d $eval -p asm -s ../$spec foo.frg utgErrorRate=$enum stopAfter=unitigger >& $eval.log", 1);
+ }
+}
diff --git a/src/Experimental/po-align.cc b/src/Experimental/po-align.cc
new file mode 100644
index 0000000..14f069e
--- /dev/null
+++ b/src/Experimental/po-align.cc
@@ -0,0 +1,812 @@
+// Michael Schatz
+//
+// Convert layouts to multiple-alignments (contigs)
+// using partial order graphs
+
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <string>
+#include <cstdio>
+#include <vector>
+#include <deque>
+#include <map>
+
+using namespace std;
+using namespace AMOS;
+
+#ifdef EDIT
+int MATCH = 0;
+int INDEL = 1;
+int MISMATCH = 1;
+int BASEINDEL = INDEL;
+
+#define SCORECMP(a, b) (a < b)
+
+#else
+int MATCH = 4;
+int INDEL = -1;
+int MISMATCH = -2;
+
+#define SCORECMP(a, b) (a > b)
+
+#ifdef LOCAL
+int BASEINDEL = 0;
+#else
+int BASEINDEL = INDEL;
+#endif
+
+#endif
+
+int basecmp(char s, char t)
+{
+ if (s == t) { return MATCH; }
+ return MISMATCH;
+}
+
+
+
+
+
+class PONode
+{
+public:
+ static int s_num;
+ PONode(char base): m_base(base), m_state(0), m_num(s_num++), m_offset(0), m_nextvisit(-1) {}
+
+ void addSeq(int id) { m_seqs.push_back(id); }
+ void addRight(PONode * n) { m_right.push_back(n); }
+ void addLeft(PONode * n) { m_left.push_back(n); }
+
+ void trimLeft(PONode *n)
+ {
+ vector<PONode *>::iterator vi;
+ for (vi = m_left.begin(); vi != m_left.end(); vi++)
+ {
+ if (*vi == n)
+ {
+ m_left.erase(vi);
+ return;
+ }
+ }
+ }
+
+ ostream & label(ostream & os)
+ {
+ os << "\"" << m_base << " (" << m_num << ")" << "[" << m_offset << "]" << "\\n";
+
+ vector<int>::iterator i;
+ for (i = m_seqs.begin(); i != m_seqs.end(); i++)
+ {
+ os << *i << "\\n";
+ }
+
+ os << "\"";
+ return os;
+ }
+
+ bool hasSeq(int seqid)
+ {
+ vector<int>::const_iterator si;
+ for (si = m_seqs.begin(); si != m_seqs.end(); si++)
+ {
+ if (seqid == *si)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ char m_base;
+
+ int m_state;
+ int m_num;
+ int m_offset;
+ int m_nextvisit;
+
+ vector <int> m_seqs;
+ vector <PONode *> m_left;
+ vector <PONode *> m_right;
+
+ vector <char> m_aligndir;
+ vector <int> m_alignscore;
+ vector <PONode *> m_alignbuddy;
+};
+
+int PONode::s_num(1);
+
+
+class POGraph
+{
+public:
+ POGraph() : m_aligncount(0), m_reads(0)
+ {
+ m_startnode = new PONode('*');
+ m_nodes.push_back(m_startnode);
+ }
+
+ int m_aligncount;
+ int m_reads;
+ PONode * m_startnode;
+
+ map<int, PONode *> m_readstarts;
+ map<int, ID_t> m_readcount2iid;
+ map<int, int> m_readtrim;
+
+ vector<PONode *> m_nodes;
+
+ void assignOffset()
+ {
+ deque<PONode *> fringe;
+ vector<PONode *>::iterator pi;
+
+ for (pi = m_nodes.begin(); pi != m_nodes.end(); pi++)
+ {
+ (*pi)->m_offset = -1;
+ }
+
+ m_startnode->m_offset = -1;
+ fringe.push_back(m_startnode);
+
+ // Assign a distance to every node as the max distance from start
+ while (!fringe.empty())
+ {
+ PONode * n = fringe.front();
+ fringe.pop_front();
+
+ int d = n->m_offset+1;
+ //n->label(cerr) << endl;
+
+ for (pi = n->m_right.begin(); pi != n->m_right.end(); pi++)
+ {
+ if (d > (*pi)->m_offset)
+ {
+ (*pi)->m_offset = d;
+ fringe.push_back(*pi);
+ }
+ }
+ }
+ }
+
+
+ void dumpMSA()
+ {
+ cerr << "DumpMSA" << endl;
+
+ assignOffset();
+
+ // Print the dotted msa for each read
+ for (int readcount = 0; readcount < m_reads; readcount++)
+ {
+ cerr << ">" << readcount << "\t";
+ int offset = getStartOffset(readcount);
+ cerr << offset << "\t";
+ for (int j = 0; j < offset; j++) { cerr << " "; }
+ cerr << '\'';
+
+ string aligned = getAlignedString(readcount);
+ cerr << aligned << endl;
+ }
+ }
+
+ int getStartOffset(int readcount)
+ {
+ PONode * n = m_readstarts[readcount];
+
+ int trim = m_readtrim[readcount];
+ while (trim)
+ {
+ n = n->m_right[0];
+ trim--;
+ }
+
+ return n->m_offset - trim;
+ }
+
+ string getAlignedString(int readcount)
+ {
+ string aligned;
+ PONode * cur = m_readstarts[readcount];
+
+ int trim = m_readtrim[readcount];
+
+ while (trim)
+ {
+ aligned.push_back(cur->m_base);
+ cur = cur->m_right[0];
+ trim--;
+ }
+
+ int np = cur->m_offset;
+ while (cur)
+ {
+ while (np < cur->m_offset-1)
+ {
+ aligned.push_back('-');
+ np++;
+ }
+
+ np=cur->m_offset;
+ aligned.push_back(cur->m_base);
+
+ // find the edge with the read
+ int bestdist = -1;
+ PONode * best = NULL;
+
+ vector<PONode *>::iterator pi;
+
+ for (pi = cur->m_right.begin(); pi != cur->m_right.end(); pi++)
+ {
+ if ((*pi)->hasSeq(readcount))
+ {
+ if (!best || (*pi)->m_offset < bestdist)
+ {
+ best = *pi;
+ bestdist = (*pi)->m_offset;
+ }
+ }
+ }
+
+ cur = best;
+ }
+
+ return aligned;
+ }
+
+ vector<Pos_t> getGaps(int readcount)
+ {
+ vector<Pos_t> retval;
+ string aligned = getAlignedString(readcount);
+
+ for (int i = 0; i < aligned.length(); i++)
+ {
+ if (aligned[i] == '-')
+ {
+ retval.push_back(i - retval.size());
+ }
+ }
+
+ return retval;
+ }
+
+ void dumpDot()
+ {
+ cerr << "DumpDot()" << endl;
+ cout << "digraph G" << endl;
+ cout << "{" << endl;
+ cout << " rankdir=LR;" << endl;
+
+ deque<PONode *> fringe;
+ deque<PONode *>::iterator fi;
+
+ vector<PONode *>::iterator pi;
+
+ for (pi = m_nodes.begin(); pi != m_nodes.end(); pi++)
+ {
+ (*pi)->m_state = 0;
+ }
+
+ for (pi = m_startnode->m_right.begin(); pi != m_startnode->m_right.end(); pi++)
+ {
+ fringe.push_back(*pi);
+ (*pi)->m_state = -1;
+ }
+
+ while (!fringe.empty())
+ {
+ PONode * n = fringe.front();
+ fringe.pop_front();
+
+ cout << " "; n->label(cout) << endl;
+ for (pi = n->m_right.begin(); pi != n->m_right.end(); pi++)
+ {
+ cout << " "; n->label(cout) << " -> "; (*pi)->label(cout) << endl;
+
+ if ((*pi)->m_state != -1)
+ {
+ (*pi)->m_state = -1;
+ fringe.push_back(*pi);
+ }
+ }
+ }
+
+ cout << "}" << endl;
+ }
+
+ void seed(const string & str)
+ {
+ cerr << "Seed:\t" << str << endl;
+ m_aligncount = 1;
+ int len = str.length();
+
+ PONode * last = m_startnode;
+
+ for (int i = 0; i < len; i++)
+ {
+ PONode * n = new PONode(str[i]);
+ m_nodes.push_back(n);
+ n->addSeq(m_reads);
+ n->addLeft(last);
+ last->addRight(n);
+ last = n;
+
+ if (i == 0)
+ {
+ m_readstarts[m_reads] = n;
+ }
+ }
+
+ m_reads++;
+ }
+
+
+ void printAlignRow(PONode * node)
+ {
+ fprintf(stderr, "%c[%02d]", node->m_base, node->m_num);
+
+ for (int i = 0; i < node->m_aligndir.size(); i++)
+ {
+ fprintf(stderr, " %3d%c[%02d]",
+ node->m_alignscore[i], node->m_aligndir[i], node->m_num);
+ }
+ fprintf(stderr, "\n");
+ }
+
+ void align(const string & str, int id, int offset)
+ {
+ m_readcount2iid[m_reads] = id;
+
+ if (m_reads == 0)
+ {
+ seed(str);
+ return;
+ }
+
+ int len = str.length();
+ assignOffset();
+
+ int verbose = 0;
+ //if (m_reads == 148) { verbose = 1; }
+
+ cerr << endl << endl;
+ cerr << "align:" << m_reads
+ << " iid: " << id
+ << " off: " << offset
+ << " " << str.substr(0,20) << endl;
+
+ if (verbose) { dumpMSA(); cerr << " * "; for (int i = 0; i < len; i++) { cerr << " " << str[i] << " "; } cerr << endl;}
+
+
+ deque<PONode *> fringe;
+ deque<PONode *>::iterator fi;
+ vector<PONode *>::iterator pi, ppi;
+
+ // Find nodes to start aligning at
+ offset -= 10;
+ if (offset < 0) { offset = 0; }
+
+ for (pi = m_nodes.begin(); pi != m_nodes.end(); pi++)
+ {
+ if ((*pi)->m_offset == offset-1)
+ {
+ (*pi)->m_aligndir.resize(len+1);
+ (*pi)->m_alignscore.resize(len+1);
+ (*pi)->m_alignbuddy.resize(len+1);
+
+ for (int i = 0; i <= len; i++)
+ {
+ (*pi)->m_aligndir[i] = '<';
+ (*pi)->m_alignscore[i] = i*BASEINDEL;
+ (*pi)->m_alignbuddy[i] = *pi;
+ }
+
+ (*pi)->m_aligndir[0] = '*';
+ (*pi)->m_state = m_aligncount;
+
+ if (verbose) { printAlignRow(*pi); }
+
+ for (ppi = (*pi)->m_right.begin(); ppi != (*pi)->m_right.end(); ppi++)
+ {
+ fringe.push_back(*ppi);
+ }
+ }
+ }
+
+ if (fringe.empty())
+ {
+ cerr << "No nodes at appropriate distance!!!" << endl;
+ exit(1);
+ }
+
+ // Mark nodes that will be visited in this alignment
+ int visit = 0;
+ deque<PONode *> tovisit;
+ for (fi = fringe.begin(); fi != fringe.end(); fi++) { tovisit.push_back(*fi); }
+ while (!tovisit.empty())
+ {
+ PONode * n = tovisit.front();
+ tovisit.pop_front();
+ if (n->m_nextvisit != m_aligncount)
+ {
+ n->m_nextvisit = m_aligncount;
+ visit++;
+ for (ppi = n->m_right.begin(); ppi != n->m_right.end(); ppi++)
+ {
+ tovisit.push_back(*ppi);
+ }
+ }
+ }
+ //cerr << "visit: " << visit << endl;
+
+
+
+ vector<PONode *> endnodes;
+
+ int bestscore = 0;
+ char bestdir = '^';
+ PONode * bestnode = NULL;
+
+ int bestcolscore = -100000;
+ char bestcoldir = ' ';
+ PONode * bestcolnode = NULL;
+
+ int ENDSPACEFREE = 1;
+
+ // Align bases
+ while (!fringe.empty())
+ {
+ PONode * n = fringe.front();
+ fringe.pop_front();
+
+ if (n->m_state == m_aligncount)
+ {
+ // already handled this node
+ continue;
+ }
+
+ bool allgood = true;
+ for (pi = n->m_left.begin(); pi != n->m_left.end(); pi++)
+ {
+ if (((*pi)->m_state != m_aligncount) && ((*pi)->m_nextvisit == m_aligncount))
+ {
+ allgood = false;
+ break;
+ }
+ }
+
+ if (allgood)
+ {
+ n->m_alignscore.resize(len+1);
+ n->m_alignbuddy.resize(len+1);
+ n->m_aligndir.resize(len+1);
+
+ bestscore = 0;
+ bestdir = '^';
+ bestnode = NULL;
+
+ // find the row[0] value
+ for (pi = n->m_left.begin(); pi != n->m_left.end(); pi++)
+ {
+ if ((*pi)->m_state == m_aligncount)
+ {
+ int piscore = (*pi)->m_alignscore[0] + INDEL;
+
+ if (bestnode == NULL || SCORECMP(piscore, bestscore))
+ {
+ bestscore = piscore;
+ bestnode = *pi;
+ }
+ }
+ }
+
+ n->m_alignscore[0] = bestscore;
+ n->m_alignbuddy[0] = bestnode;
+ n->m_aligndir[0] = bestdir;
+
+ if (ENDSPACEFREE)
+ {
+ n->m_alignscore[0] = 0;
+ n->m_alignbuddy[0] = NULL;
+ n->m_aligndir[0] = '*';
+ }
+
+ // For each position in the row
+ for (int i = 1; i <= len; i++)
+ {
+ // assume best is left indel row[i-1] + INDEL
+ bestnode = n;
+ bestscore = n->m_alignscore[i-1] + INDEL;
+ bestdir = '<';
+
+ // Now try all previous nodes as both indel and mismatch
+ for (pi = n->m_left.begin(); pi != n->m_left.end(); pi++)
+ {
+ if ((*pi)->m_state == m_aligncount)
+ {
+ // match
+ int m = (*pi)->m_alignscore[i-1] + basecmp(n->m_base, str[i-1]);
+ if (SCORECMP(m, bestscore))
+ {
+ bestnode = *pi; bestscore = m; bestdir = '\\';
+ }
+
+ // indel
+ m = (*pi)->m_alignscore[i] + INDEL;
+ if (SCORECMP(m, bestscore))
+ {
+ bestnode = *pi; bestscore = m; bestdir = '^';
+ }
+ }
+ }
+
+ n->m_alignscore[i] = bestscore;
+ n->m_alignbuddy[i] = bestnode;
+ n->m_aligndir[i] = bestdir;
+ }
+
+ if (verbose) { printAlignRow(n); }
+
+ // Keep track of the node with the best score in the rightmost
+ // column for end-space free where the graph is longer than
+ // the sequence.
+ if (n->m_alignscore[len] > bestcolscore)
+ {
+ bestcolscore = n->m_alignscore[len];
+ bestcoldir = n->m_aligndir[len];
+ bestcolnode = n;
+ }
+
+ // mark this node as aligned, and add its right children
+ n->m_state = m_aligncount;
+
+ if (n->m_right.empty())
+ {
+ endnodes.push_back(n);
+ }
+ else
+ {
+ for (pi = n->m_right.begin(); pi != n->m_right.end(); pi++)
+ {
+ fringe.push_back(*pi);
+ }
+ }
+ }
+ }
+
+ // Now backtrack to find the optimal alignment
+
+ //cerr << "Merge alignment" << endl;
+
+
+ // Find the best scoring alignment
+
+ PONode * cur = NULL;
+ PONode * right = NULL;
+ bestscore = -10000;
+
+ int pos = len;
+ // Explicitly check all of the end nodes for best match
+ for (pi = endnodes.begin(); pi != endnodes.end(); pi++)
+ {
+ if (pi == endnodes.begin() || (SCORECMP((*pi)->m_alignscore[pos], bestscore)))
+ {
+ cur = *pi; bestscore = (*pi)->m_alignscore[pos];
+ }
+ }
+
+ if (bestcolscore > bestscore)
+ {
+ bestscore = bestcolscore;
+ bestdir = bestcoldir;
+ cur = bestcolnode;
+ }
+
+ if (cur == NULL)
+ {
+ cerr << "WTF? No cur" << endl;
+ dumpMSA();
+ cerr << "Endnodes.size: " << endnodes.size() << endl;
+ cerr << "bestscore: " << bestscore
+ << " bestcolscore: " << bestcolscore << endl;
+ if (bestcolnode)
+ {
+ cerr << "bestcolnode: " << bestcolnode->m_num
+ << endl;
+ }
+ else
+ {
+ cerr << "bestcolnode: NULL" << endl;
+ }
+
+ return;
+ }
+
+ //while (cur != m_startnode && pos > 0)
+ while (pos > 0)
+ {
+ //cerr << '.';
+ char strbase = str[pos-1];
+
+ bestdir = cur->m_aligndir[pos];
+ PONode * left = cur->m_alignbuddy[pos];
+
+ if (verbose) { cerr << "align b:" << cur->m_base << " n:" << str[pos-1] << " " << bestdir << endl; }
+
+ if (bestdir == '\\')
+ {
+ if (cur->m_base != strbase)
+ {
+ cur = new PONode(strbase);
+ m_nodes.push_back(cur);
+ }
+
+ cur->addSeq(m_reads);
+
+ if (right)
+ {
+ cur->addRight(right);
+ right->addLeft(cur);
+ }
+
+ right = cur;
+ pos--;
+ }
+ else if (bestdir == '<')
+ {
+ PONode * n = new PONode(strbase);
+ m_nodes.push_back(n);
+ n->addSeq(m_reads);
+
+ if (right)
+ {
+ n->addRight(right);
+ right->addLeft(n);
+ }
+
+ right = n;
+
+ pos--;
+ }
+ else if (bestdir == '^')
+ {
+ // gap in read aligns to graph,
+ // nothing to do now, edge created later
+ }
+ else
+ {
+ cerr << "bestdir???: " << bestdir << endl;
+ exit(1);
+ }
+
+ cur = left;
+ }
+
+ // Might need to trim the prefix of reads
+ cur = right;
+ int trim = 0;
+ while (cur->m_right.size() == 1)
+ {
+ trim++;
+ cur->m_right[0]->trimLeft(cur);
+ cur = cur->m_right[0];
+ }
+
+ if (trim)
+ {
+ cerr << endl;
+ cerr << "###Trim: " << trim << endl;
+ }
+
+ m_readtrim[m_reads] = trim;
+
+ m_readstarts[m_reads] = right;
+ if (verbose) { cerr << "first: "; right->label(cerr) << endl; }
+
+ // this string was fully incorporated into the POA
+ m_aligncount++;
+ m_reads++;
+ }
+};
+
+
+
+int main (int argc, char ** argv)
+{
+ if (argc == 1)
+ {
+ POGraph g;
+ g.align("AAAAAAAAAA", 0, 0);
+ g.align("TAAAAAAA", 1, 0);
+ g.dumpDot();
+ g.dumpMSA();
+ return 0;
+ }
+
+ if (argc != 2)
+ {
+ cerr << "Usage: po-align bankname" << endl;
+ return 1;
+ }
+
+ string bankname = argv[1];
+ int exitcode = 0;
+
+ BankStream_t lay_bank(Layout_t::NCODE);
+ Bank_t read_bank(Read_t::NCODE);
+ Bank_t ctg_bank(Contig_t::NCODE);
+
+ try
+ {
+ lay_bank.open(bankname, B_READ);
+ read_bank.open(bankname, B_READ);
+
+ if (!ctg_bank.exists(bankname)){ctg_bank.create(bankname);}
+ ctg_bank.open(bankname, B_READ | B_WRITE);
+
+ Layout_t lay;
+ int count = 0;
+
+ while (lay_bank >> lay)
+ {
+ cerr << "Processing layout " << count << " i: " << lay.getIID() << " e:" << lay.getEID() << endl;
+ count++;
+
+ vector<Tile_t> & tiling = lay.getTiling();
+ sort(tiling.begin(), tiling.end(), TileOrderCmp());
+
+ POGraph graph;
+
+ vector<Tile_t>::iterator ti;
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ Read_t red;
+ read_bank.fetch(ti->source, red);
+
+ string seq = red.getSeqString(ti->range);
+ graph.align(seq, ti->source, ti->offset);
+ }
+
+ graph.dumpMSA();
+
+ int c = 0;
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ ti->offset = graph.getStartOffset(c);
+ ti->gaps = graph.getGaps(c);
+ c++;
+ }
+
+ Contig_t ctg;
+ ctg.setReadTiling(tiling);
+
+ int span = ctg.getSpan();
+
+ string cons;
+ string qual;
+ for (int j = 0; j < span; j++)
+ {
+ cons.push_back('X');
+ qual.push_back('X');
+ }
+
+ string eid(lay.getEID());
+ eid += "_poalign";
+
+ ctg.setSequence(cons,qual);
+ ctg.setEID(eid);
+ ctg.setIID(ctg_bank.getMaxIID()+1);
+
+ ctg_bank.append(ctg);
+ break;
+ }
+ }
+ catch (const Exception_t & e)
+ {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+
+ return exitcode;
+}
diff --git a/src/Experimental/read-evolution.cc b/src/Experimental/read-evolution.cc
new file mode 100644
index 0000000..0e72b4e
--- /dev/null
+++ b/src/Experimental/read-evolution.cc
@@ -0,0 +1,340 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+#include "PersistentUtils.hh"
+
+using namespace AMOS;
+using namespace std;
+
+
+ReadPosLookup read2contigpos;
+
+
+int main (int argc, char ** argv)
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ int curcontigiid = 0;
+ string curcontigeid;
+
+ int startpos = -1;
+ int endpos = -1;
+
+ int USETILENUM = 0;
+ int PRINTIID = 0;
+ int PRINTLEN = 0;
+
+ int GNUPLOT = 0;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Computes the read order evolution\n"
+"\n"
+" Usage: read-evolution [options] curbank otherbankn\n"
+"\n"
+" Options\n"
+" -------------------\n"
+" -c <iid> Examine reads in current contig iid\n"
+" -C <eid> Examine reads in current contig eid\n"
+"\n"
+" -x <val> Examine starting at this position\n"
+" -y <val> Examine stopping at this position\n"
+"\n"
+" -t Use tiling index instead of offset\n"
+" -i Print contig IIDs instead of EIDs\n"
+" -l Print length as well\n"
+"\n"
+" -G Print in gnuplot format\n"
+" Use: plot \"filename\" with lp\n"
+"\n";
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+
+ tf->getOptions()->addOptionResult("c=i", &curcontigiid);
+ tf->getOptions()->addOptionResult("C=s", &curcontigeid);
+
+ tf->getOptions()->addOptionResult("x=i", &startpos);
+ tf->getOptions()->addOptionResult("y=i", &endpos);
+
+ tf->getOptions()->addOptionResult("t", &USETILENUM);
+ tf->getOptions()->addOptionResult("i", &PRINTIID);
+ tf->getOptions()->addOptionResult("l", &PRINTLEN);
+
+ tf->getOptions()->addOptionResult("G", &GNUPLOT);
+
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (curcontigiid == 0 && curcontigeid.empty())
+ {
+ cerr << "You must specify a contig to examine" << endl;
+ return EXIT_FAILURE;
+ }
+
+
+ if (argvv.size() != 2)
+ {
+ cerr << "Usage: read-evolution [options] curbank otherbank" << endl;
+ return EXIT_FAILURE;
+ }
+
+ string curbankname = argvv.front(); argvv.pop_front();
+ string otherbankname = argvv.front(); argvv.pop_front();
+
+ Bank_t ocontig_bank(Contig_t::NCODE);
+ Bank_t oread_bank(Read_t::NCODE);
+
+ Bank_t ccontig_bank(Contig_t::NCODE);
+ Bank_t cread_bank(Read_t::NCODE);
+
+
+ map<ID_t, int> oldcontigreadcount;
+
+
+ ocontig_bank.open(otherbankname, B_READ);
+ oread_bank.open(otherbankname, B_READ);
+
+ ccontig_bank.open(curbankname, B_READ);
+ cread_bank.open(curbankname, B_READ);
+
+ IDMap_t::const_iterator c;
+ const IDMap_t & crm = cread_bank.getIDMap();
+ const IDMap_t & orm = oread_bank.getIDMap();
+
+ // Record the contig and position of each read in the old bank
+ const IDMap_t & ocm = ocontig_bank.getIDMap();
+ for (c = ocm.begin(); c != ocm.end(); c++)
+ {
+ Contig_t contig;
+ ocontig_bank.fetch(c->iid, contig);
+ oldcontigreadcount.insert(make_pair(contig.getIID(), contig.getReadTiling().size()));
+
+ recordReadPositions(contig.getIID(), contig.getReadTiling(), read2contigpos);
+ }
+
+ const IDMap_t & ccm = ccontig_bank.getIDMap();
+ if (!curcontigeid.empty()) { curcontigiid = ccm.lookupIID(curcontigeid); }
+
+
+ // Figure out which old contigs had reads in the current contig
+ map<ID_t, int> oldcontigsandminoffset;
+ map<ID_t, int>::iterator oco;
+
+ Contig_t contig;
+ ccontig_bank.fetch(curcontigiid, contig);
+ sort(contig.getReadTiling().begin(), contig.getReadTiling().end(), TileOrderCmp());
+ ReadPosLookup::iterator rpl;
+
+ bool check = false;
+ if (startpos == -1){check = true; }
+
+ vector<Tile_t>::iterator t;
+ for (t = contig.getReadTiling().begin(); t != contig.getReadTiling().end(); t++)
+ {
+ if (!check && t->offset > startpos)
+ {
+ check = true;
+ }
+
+ if (check && endpos != -1 && t->offset > endpos)
+ {
+ check = false;
+ }
+
+ if (check)
+ {
+ rpl = read2contigpos.find(t->source);
+
+ if (rpl !=read2contigpos.end())
+ {
+ oco = oldcontigsandminoffset.find(rpl->second.m_contigiid);
+ if (oco == oldcontigsandminoffset.end())
+ {
+ oco = oldcontigsandminoffset.insert(make_pair(rpl->second.m_contigiid, t->offset)).first;
+ }
+ }
+ }
+ }
+
+ vector<ID_t> oldcontigs;
+ vector<ID_t>::iterator old;
+
+ while (!oldcontigsandminoffset.empty())
+ {
+ map<ID_t, int>::iterator minoco = oldcontigsandminoffset.begin();
+
+ for (oco = oldcontigsandminoffset.begin();
+ oco != oldcontigsandminoffset.end();
+ oco++)
+ {
+ if (oco->second < minoco->second)
+ {
+ minoco = oco;
+ }
+ }
+
+ oldcontigs.push_back(minoco->first);
+ oldcontigsandminoffset.erase(minoco);
+ }
+
+ int oldcontigsize = oldcontigs.size();
+
+
+
+ int width = (PRINTLEN) ? 20 : 10;
+
+ if (!GNUPLOT)
+ {
+ // Print the header line of old contigs
+ if (PRINTIID)
+ {
+ printf("%-15s% *d ", "== CONTIGS == ", width, contig.getIID());
+ }
+ else
+ {
+ printf("%-15s% *s ", "== CONTIGS == ", width, contig.getEID().c_str());
+ }
+
+ for (old = oldcontigs.begin(); old != oldcontigs.end(); old++)
+ {
+ if (PRINTIID) { printf("% *d ", width, *old); }
+ else { printf("% *s ", width, ocm.lookupEID(*old).c_str()); }
+ }
+ cout << endl;
+
+ printf("%-15s% *d ", "== READS ==", width, contig.getReadTiling().size());
+ for (old = oldcontigs.begin(); old != oldcontigs.end(); old++)
+ {
+ printf("% *d ", width, oldcontigreadcount[*old]);
+ }
+ cout << endl;
+ }
+
+
+ // Print where the read are in the other assembly
+ check = false;
+ if (startpos == -1){check = true; }
+
+ for (t = contig.getReadTiling().begin(); t != contig.getReadTiling().end(); t++)
+ {
+ if (!check && t->offset >= startpos)
+ {
+ check = true;
+ }
+
+ if (check && endpos != -1 && t->offset > endpos)
+ {
+ check = false;
+ }
+
+ if (check)
+ {
+ int val = t->offset;
+
+ if (!GNUPLOT)
+ {
+ if (PRINTLEN)
+ {
+ char buffer[30];
+ sprintf(buffer, "%d,%d", val, t->getRightOffset());
+ printf("%-15s%20s%c",
+ crm.lookupEID(t->source).c_str(),
+ buffer,
+ (t->range.isReverse() ? '-' : '+'));
+ }
+ else
+ {
+ printf("%-15s%10d%c",
+ crm.lookupEID(t->source).c_str(),
+ val,
+ (t->range.isReverse() ? '-' : '+'));
+ }
+ }
+
+ rpl = read2contigpos.find(t->source);
+
+ if (rpl != read2contigpos.end())
+ {
+ for (int o = 0; o < oldcontigsize; o++)
+ {
+ if (oldcontigs[o] == rpl->second.m_contigiid)
+ {
+ int val = rpl->second.m_offset;
+
+ if (GNUPLOT)
+ {
+ cout << 0 << " " << t->offset << endl;
+ cout << (o+1)*100 << " " << rpl->second.pos(t->range.isReverse()) << endl;
+ cout << endl;
+ cout << endl;
+ }
+ else
+ {
+ if (USETILENUM) { val = rpl->second.m_tileid; }
+
+ if (PRINTLEN)
+ {
+ char buffer[30];
+ sprintf(buffer, "%d,%d", val, rpl->second.getRightOffset());
+ printf("%20s%c", buffer, (rpl->second.m_rc ? '-' : '+'));
+ }
+ else
+ {
+ printf("%10d%c", val, (rpl->second.m_rc ? '-' : '+'));
+ }
+ }
+ }
+ else
+ {
+ if (!GNUPLOT) { printf("%*s ", width, " "); }
+ }
+ }
+ }
+
+ if (!GNUPLOT) { cout << endl; }
+ }
+ }
+
+ if (GNUPLOT)
+ {
+ cout << (oldcontigsize*100)+10 << " " << 0 << endl
+ << (oldcontigsize*100)+10 << " " << 0 << endl;
+
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return retval;
+}
diff --git a/src/Experimental/revContig.cc b/src/Experimental/revContig.cc
new file mode 100644
index 0000000..bff41b1
--- /dev/null
+++ b/src/Experimental/revContig.cc
@@ -0,0 +1,61 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "ContigUtils.hh"
+
+// Reverse complement a given contig
+
+using namespace AMOS;
+using namespace std;
+
+bool USE_EID = 1;
+
+int main (int argc, char ** argv)
+{
+ if (argc != 3)
+ {
+ cerr << "Usage: revcontig bankname eid" << endl;
+ cerr << endl
+ << "Reverse complements the selected contig and associated" << endl
+ << "reads, scaffold, features info" << endl
+ << "TODO: Fix contig graph as well" << endl;
+
+ return EXIT_FAILURE;
+ }
+
+ string bank_name = argv[1];
+ string contigid = argv[2];
+
+
+ cerr << "Processing " << bank_name << " at " << Date() << endl;
+
+ try
+ {
+ Bank_t contig_bank(Contig_t::NCODE);
+ Bank_t scaffold_bank(Scaffold_t::NCODE);
+ BankStream_t feat_bank(Feature_t::NCODE);
+
+ contig_bank.open(bank_name, B_READ|B_WRITE);
+ if (scaffold_bank.exists(bank_name))
+ {
+ scaffold_bank.open(bank_name, B_READ|B_WRITE);
+ }
+
+ if (feat_bank.exists(bank_name))
+ {
+ feat_bank.open(bank_name, B_READ|B_WRITE);
+ }
+
+ ID_t contigiid = lookupIID(contig_bank, contigid);
+
+ reverseContig(contig_bank, scaffold_bank, feat_bank, contigiid);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return EXIT_SUCCESS;
+}
diff --git a/src/Experimental/rotateContig.cc b/src/Experimental/rotateContig.cc
new file mode 100644
index 0000000..2a2bd24
--- /dev/null
+++ b/src/Experimental/rotateContig.cc
@@ -0,0 +1,151 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+// Rotate a contig to a new offset
+
+using namespace AMOS;
+using namespace std;
+
+string bank_name;
+
+string contigeid;
+ID_t contigiid = 0;
+
+Pos_t gindex = 0;
+Pos_t uindex = 0;
+
+
+
+void PrintUsage(const char * name)
+{
+ cerr << "Usage: " << name << " [-g gindex | -u uindex] [-E eid | -I iid] bankname" << endl;
+}
+
+void PrintHelp(const char * name)
+{
+ PrintUsage(name);
+}
+
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hvE:I:g:u:")) != EOF) )
+ {
+ switch (ch)
+ {
+ case 'h': PrintHelp (argv[0]); exit (EXIT_SUCCESS); break;
+ case 'v': PrintBankVersion (argv[0]); exit (EXIT_SUCCESS); break;
+
+ case 'E': contigeid = optarg; break;
+ case 'I': contigiid = atoi(optarg); break;
+ case 'g': gindex = atoi(optarg); break;
+ case 'u': uindex = atoi(optarg); break;
+
+ default: errflg ++;
+ };
+ }
+
+
+ if (errflg || optind != argc - 1)
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ bank_name = argv[optind++];
+
+ if ((contigeid.empty() && contigiid == NULL_ID) ||
+ (!contigeid.empty() && contigiid != NULL_ID))
+ {
+ cerr << "Must specify one contig id" << endl;
+ exit (EXIT_FAILURE);
+ }
+
+ if ((gindex == 0 && uindex == 0) || (gindex && uindex))
+ {
+ cerr << "Must specify one rotation coordinate" << endl;
+ exit (EXIT_FAILURE);
+ }
+
+ cerr << "Rotating contig eid: " << contigeid << " iid: " << contigiid
+ << " to gindex: " << gindex << " uindex: " << uindex
+ << " in " << bank_name << endl;
+
+}
+
+
+
+int main (int argc, char ** argv)
+{
+ Bank_t contig_bank(Contig_t::NCODE);
+
+ ParseArgs(argc, argv);
+
+ Contig_t contig;
+
+ cerr << "Processing " << bank_name << " at " << Date() << endl;
+
+ try
+ {
+ contig_bank.open(bank_name, B_READ|B_WRITE);
+
+ if (!contigeid.empty()) { contig_bank.fetch(contigeid, contig); }
+ else { contig_bank.fetch(contigiid, contig); }
+
+ string cons = contig.getSeqString();
+ string cqual = contig.getQualString();
+
+ if (uindex) { gindex = contig.gap2ungap(uindex); }
+
+ if (gindex < 0 || gindex >= cons.length())
+ {
+ cerr << "Specified offset " << gindex << " is outside of valid range" << endl;
+ contig_bank.close();
+ AMOS_THROW("Offset out of range");
+ }
+
+ // adjust consensus
+ string left = cons.substr(0, gindex);
+ string lqual = cqual.substr(0, gindex);
+
+ cons = cons.substr(gindex, cons.length() - gindex);
+ cqual = cqual.substr(gindex, cqual.length() - gindex);
+
+ cons += left;
+ cqual += lqual;
+
+ // shift reads
+ vector<Tile_t> & tiling = contig.getReadTiling();
+ vector<Tile_t>::iterator ti;
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ ti->offset -= gindex;
+ while (ti->offset < 0)
+ {
+ ti->offset += cons.length();
+ }
+
+ while (ti->offset + ti->getGappedLength() - 1 >= cons.length())
+ {
+ ti->offset -= cons.length();
+ }
+ }
+
+ contig.setSequence(cons, cqual);
+
+ contig_bank.replace(contig.getIID(), contig);
+ contig_bank.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return EXIT_SUCCESS;
+}
diff --git a/src/Experimental/splitContig.cc b/src/Experimental/splitContig.cc
new file mode 100644
index 0000000..f8b22bd
--- /dev/null
+++ b/src/Experimental/splitContig.cc
@@ -0,0 +1,435 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 03/08/2004
+//!
+//! \brief Dumps a bambus .mates file from an AMOS bank
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <cassert>
+#include <unistd.h>
+#include <map>
+using namespace std;
+using namespace AMOS;
+
+
+//=============================================================== Globals ====//
+string OPT_BankName; // bank name parameter
+bool OPT_BankSpy = false; // read or read-only spy
+bool OPT_SNPAnalysis = false;
+bool OPT_Verbose = false;
+typedef map <ID_t, ID_t> IDMap;
+
+string contigeid;
+ID_t contigiid = AMOS::NULL_ID;
+
+
+
+bool hasOverlap(Pos_t rangeStart, // 0-based exact offset of range
+ Pos_t rangeEnd, // 0-based exact end of range
+ Pos_t seqOffset, // 0-bases exact offset of seq
+ Pos_t seqLen, // count of bases of seq (seqend+1)
+ Pos_t contigLen) // count of bases in contig (contigend+1)
+{
+ int retval = 1;
+
+ if (seqOffset >= (Pos_t) 0)
+ {
+ if ((seqOffset > rangeEnd) // sequence right flanks
+ || (seqOffset + seqLen-1 < rangeStart)) // sequence left flanks
+ {
+ retval = 0;
+ }
+ }
+ else
+ {
+ // Negative Offset, test left and right separately
+ retval = hasOverlap(rangeStart, rangeEnd,
+ 0, seqLen+seqOffset, contigLen) ||
+ hasOverlap(rangeStart, rangeEnd,
+ contigLen+seqOffset, -seqOffset, contigLen);
+ }
+
+ return retval;
+}
+
+
+
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+ Read_t red;
+ Fragment_t frg;
+ Library_t lib;
+
+ map <ID_t, Distribution_t> libmap;
+ map <ID_t, Pos_t> readlens;
+
+ IDMap mates;
+ IDMap readliblookup;
+ IDMap frgliblookup;
+ IDMap redctglookup;
+ IDMap ctgscflookup;
+
+ Scaffold_t scaff;
+ Contig_t contig;
+
+ BankStream_t lib_bank (Library_t::NCODE);
+ BankStream_t frg_bank (Fragment_t::NCODE);
+ BankStream_t ctg_bank (Contig_t::NCODE);
+ BankStream_t scf_bank (Scaffold_t::NCODE);
+ BankStream_t red_bank (Read_t::NCODE);
+ Bank_t read_bank(Read_t::NCODE);
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ BankMode_t bm = OPT_BankSpy ? B_SPY : B_READ;
+ red_bank . open (OPT_BankName, bm);
+ read_bank . open (OPT_BankName, bm);
+ frg_bank . open (OPT_BankName, bm);
+ lib_bank . open (OPT_BankName, bm);
+ ctg_bank . open (OPT_BankName, bm);
+ scf_bank . open (OPT_BankName, bm);
+
+
+ while ( lib_bank >> lib )
+ {
+ libmap[lib.getIID()] = lib.getDistribution();
+ }
+ cerr << "Indexed " << libmap.size() << " libraries" << endl;
+
+
+ cerr << "Indexing frgs... ";
+ while (frg_bank >> frg)
+ {
+ frgliblookup[frg.getIID()] = frg.getLibrary();
+ mates[frg.getMatePair().first] = frg.getMatePair().second;
+ mates[frg.getMatePair().second] = frg.getMatePair().first;
+ }
+ cerr << frgliblookup.size() << " fragments";
+ cerr << mates.size() << " mates" << endl;
+
+ cerr << "Indexing reds... ";
+ while (red_bank >> red)
+ {
+ IDMap::const_iterator fi = frgliblookup.find(red.getFragment());
+
+ if (fi != frgliblookup.end())
+ {
+ readliblookup[red.getIID()] = fi->second;
+ }
+
+ readlens[red.getIID()] = red.getClearRange().getLength();
+ }
+ cerr << readliblookup.size() << " reads in fragments" << endl;
+
+
+ vector<Tile_t>::const_iterator ri;
+
+ cerr << "Index contigs...";
+ int contigcount = 0;
+ while (ctg_bank >> contig)
+ {
+ for (ri = contig.getReadTiling().begin();
+ ri != contig.getReadTiling().end();
+ ri++)
+ {
+ redctglookup[ri->source] = contig.getIID();
+ }
+ }
+ cerr << redctglookup.size() << " reads in contigs" << endl;
+
+ cerr << "Index scaffolds... ";
+ while (scf_bank >> scaff)
+ {
+ for (ri = scaff.getContigTiling().begin();
+ ri != scaff.getContigTiling().end();
+ ri++)
+ {
+ ctgscflookup[ri->source] = scaff.getIID();
+ }
+ }
+ cerr << ctgscflookup.size() << " contigs in scaffolds" << endl;
+
+
+ if (contigiid == AMOS::NULL_ID)
+ {
+ contigiid = ctg_bank.lookupIID(contigeid.c_str());
+ }
+
+ if (contigiid == AMOS::NULL_ID)
+ {
+ cerr << "contigiid == AMOS::NULL_ID" << endl;
+ exit (1);
+ }
+
+ vector <Tile_t> rtiling;
+
+ ctg_bank.seekg(ctg_bank.getIDMap().lookupBID(contigiid));
+ ctg_bank >> contig;
+ rtiling = contig.getReadTiling();
+
+ cerr << "Finding mates for contig" << endl;
+
+ int count = 0;
+
+
+ map<ID_t, int> fctgfreq;
+ map<ID_t, int> rctgfreq;
+ map<ID_t, int>::iterator fi;
+ IDMap redmatectg;
+
+ IDMap::const_iterator ci;
+ IDMap::const_iterator mi;
+
+ if (OPT_Verbose)
+ {
+ cout << ">Read\tCtg\tDir" << endl;
+ }
+
+ for (ri = rtiling.begin(); ri != rtiling.end(); ri++)
+ {
+ string eid = red_bank.getIDMap().lookupEID(ri->source);
+ char dir = ri->range.isReverse() ? 'R' : 'F';
+
+ mi = mates.find(ri->source);
+ if (mi != mates.end())
+ {
+ ci = redctglookup.find(mi->second);
+
+ if (ci != redctglookup.end())
+ {
+ if (OPT_Verbose)
+ {
+ cout << eid << "\t" << ci->second << "\t" << dir << endl;
+ }
+
+ redmatectg[ri->source] = ci->second;
+
+ if (dir == 'F')
+ {
+ fi = fctgfreq.find(ci->second);
+ if (fi == fctgfreq.end()) { fi = fctgfreq.insert(make_pair(ci->second, 0)).first; }
+ }
+ else
+ {
+ fi = rctgfreq.find(ci->second);
+ if (fi == rctgfreq.end()) { fi = rctgfreq.insert(make_pair(ci->second, 0)).first; }
+ }
+
+ fi->second++;
+
+ }
+ }
+ else
+ {
+ if (OPT_Verbose)
+ {
+ cout << eid << "\t***\t" << dir << endl;
+ }
+ redmatectg[ri->source] = AMOS::NULL_ID;
+ }
+ }
+
+ if (OPT_Verbose)
+ {
+ cout << endl << endl;
+ }
+
+ cout << ">Ctg\tScaff\tFreq\tDir" << endl;
+
+ for (fi = rctgfreq.begin(); fi != rctgfreq.end(); fi++)
+ {
+ cout << fi->first << "\t"
+ << ctgscflookup[fi->first] << "\t"
+ << fi->second << "\tR" << endl;
+ }
+
+ for (fi = fctgfreq.begin(); fi != fctgfreq.end(); fi++)
+ {
+ cout << fi->first << "\t"
+ << ctgscflookup[fi->first] << "\t"
+ << fi->second << "\tF" << endl;
+ }
+
+
+ cout << endl << endl;
+
+ if (OPT_SNPAnalysis)
+ {
+ cerr << "Analyzing SNPs" << endl;
+
+ cout << ">Pos Base([CTG,FRQ])" << endl;
+
+ ContigIterator_t ctgit(contig, &read_bank);
+ while (ctgit.advanceNext())
+ {
+ if (ctgit.hasSNP())
+ {
+ Column_t column(ctgit.getColumn());
+ vector<BaseStats_t *> freq(column.getBaseInfo());
+
+ cout << ctgit.gindex();
+
+ for (int i = 0; i < freq.size(); i++)
+ {
+ map<ID_t, int> ctgfreq;
+ map<ID_t, int>::iterator cfi;
+
+ char base = toupper(freq[i]->m_base);
+
+ // Figure out which matecontigs these reads represent
+ vector<TiledReadList_t::const_iterator>::const_iterator ri;
+ for (ri = freq[i]->m_reads.begin(); ri != freq[i]->m_reads.end(); ri++)
+ {
+ ID_t matectg = redmatectg[(*ri)->m_iid];
+ cfi = ctgfreq.find(matectg);
+ if (cfi == ctgfreq.end()){cfi = ctgfreq.insert(make_pair(matectg, 0)).first; }
+ cfi->second++;
+ }
+
+ // Dump frequency of matecontigs
+ cout << "\t" << base << "(";
+ bool first = true;
+ for (cfi = ctgfreq.begin(); cfi != ctgfreq.end(); cfi++)
+ {
+ if (!first) { cout << " "; }
+ first = false;
+
+ cout << "[" << cfi->first << "," << cfi->second << "]";
+ }
+
+ cout << ")";
+ }
+
+ cout << endl;
+ }
+ }
+ }
+
+ red_bank.close();
+ frg_bank.close();
+ lib_bank.close();
+ ctg_bank.close();
+ scf_bank.close();
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hsvEIS")) != EOF) )
+ {
+ switch (ch)
+ {
+ case 'h': PrintHelp (argv[0]); exit (EXIT_SUCCESS); break;
+ case 'v': PrintBankVersion (argv[0]); exit (EXIT_SUCCESS); break;
+
+ case 's': OPT_BankSpy = true; break;
+ case 'S': OPT_SNPAnalysis = true; break;
+ case 'V': OPT_Verbose = true; break;
+ case 'E': contigeid = argv[optind++]; break;
+ case 'I': contigiid = atoi(argv[optind++]); break;
+
+ default: errflg ++;
+ }
+ }
+
+ if (errflg > 0 || optind != argc - 1)
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+
+ if (contigeid.empty() && contigiid == AMOS::NULL_ID)
+ {
+ cerr << "contig id is required" << endl;
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_BankName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "-h Display help information\n"
+ << "-s Disregard bank locks and write permissions (spy mode)\n"
+ << "-v Display the compatible bank version\n"
+ << "-E contigeid Contig eid of interest\n"
+ << "-I contigeid Contig iid of interest\n"
+ << "-S Perform SNP analysis in addition to mates\n"
+ << "-V Verbose mode\n"
+ << endl;
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr
+ << "\nUSAGE: " << s << " [options] <bank path>\n\n";
+ return;
+}
diff --git a/src/Experimental/splitscafffa.pl b/src/Experimental/splitscafffa.pl
new file mode 100755
index 0000000..ff7ae1f
--- /dev/null
+++ b/src/Experimental/splitscafffa.pl
@@ -0,0 +1,44 @@
+#!/usr/bin/perl -w
+use strict;
+
+## Split a scaffold into contigs whenever there are $NTHRESH N's in a row
+
+my $NTHRESH = 20;
+
+sub processScaff
+{
+ my $scaffid = $_[0];
+ my $seq = $_[1];
+
+ return if !defined $scaffid;
+
+ my @sections = split /N{$NTHRESH,}/, $seq;
+
+ for (my $i = 0; $i < scalar @sections; $i++)
+ {
+ print ">$scaffid\.$i\n";
+ print $sections[$i],"\n";
+ }
+}
+
+
+my $scaffid = undef;
+my $seq = undef;
+
+while (<>)
+{
+ chomp;
+
+ if (/^>(\S+)/)
+ {
+ processScaff($scaffid, $seq);
+ $scaffid = $1;
+ $seq = "";
+ }
+ else
+ {
+ $seq .= $_;
+ }
+}
+
+processScaff($scaffid, $seq);
diff --git a/src/Experimental/stitchContigs.cc b/src/Experimental/stitchContigs.cc
new file mode 100644
index 0000000..fd9688c
--- /dev/null
+++ b/src/Experimental/stitchContigs.cc
@@ -0,0 +1,230 @@
+
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+#include "ContigUtils.hh"
+
+using namespace AMOS;
+using namespace std;
+
+
+int main (int argc, char ** argv)
+{
+
+ string leftstitchread;
+ string rightstitchread;
+ int masteriid = 0;
+ int master2iid = 0;
+ int patchiid = 0;
+ int breakcontig = 0;
+ int savetonew = 0;
+
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ Bank_t master_contig(Contig_t::NCODE);
+ Bank_t master_reads(Read_t::NCODE);
+ Bank_t master_scaff(Scaffold_t::NCODE);
+ BankStream_t master_feat(Feature_t::NCODE);
+
+ Bank_t patch_contig(Contig_t::NCODE);
+ Bank_t patch_reads(Read_t::NCODE);
+ BankStream_t patch_feat(Feature_t::NCODE);
+
+ try
+ {
+ string m, m2, p;
+
+
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Replace a region of a master contig with a region of a patch contig\n"
+"\n"
+" Usage: stitchContigs [options] master.bnk patch.bnk\n"
+" -b Break master contig with patch\n"
+" -n Save results to a new contig\n\n"
+" -L <seqname> Leftmost read to start patch\n"
+" -R <seqname> Rightmost read to end patch\n\n"
+" -M <iid> IID of master contig\n"
+" -m <eid> EID of master contig\n"
+" -G <iid> IID of right master contig (when closing gaps)\n"
+" -g <eid> EID of right master contig (when closing gaps)\n"
+" -P <iid> IID of patch contig\n"
+" -p <eid> EID of patch contig\n"
+"\n";
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+ tf->getOptions()->addOptionResult("L=s", &leftstitchread, "Left");
+ tf->getOptions()->addOptionResult("R=s", &rightstitchread, "Right");
+ tf->getOptions()->addOptionResult("M=i", &masteriid, "Contig IID");
+ tf->getOptions()->addOptionResult("G=i", &master2iid, "Contig IID");
+ tf->getOptions()->addOptionResult("P=i", &patchiid, "Contig IID");
+
+ tf->getOptions()->addOptionResult("m=s", &m, "Contig EID");
+ tf->getOptions()->addOptionResult("g=s", &m2, "Contig EID");
+ tf->getOptions()->addOptionResult("p=s", &p, "Contig EID");
+
+ tf->getOptions()->addOptionResult("b", &breakcontig, "BreakContig");
+ tf->getOptions()->addOptionResult("n", &savetonew, "BreakContig");
+
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() != 2)
+ {
+ cerr << "Usage: stitchContigs [options] master.bnk patch.bnk" << endl;
+ while (argvv.size() != 0)
+ {
+ cerr << "argv: " << argvv.front() << endl;
+ argvv.pop_front();
+ }
+ return 0;
+ }
+
+ int reads = (rightstitchread.empty() ? 0 : 1) + (leftstitchread.empty() ? 0 : 1);
+ if ((reads == 0) || (reads == 1 && !breakcontig) || (reads==2 && breakcontig))
+ {
+ cerr << "You must specify both stitch reads, or 1 stitch read and -b" << endl;
+ return 1;
+ }
+
+ string masterbank = argvv.front(); argvv.pop_front();
+ string patchbank = argvv.front(); argvv.pop_front();
+
+ cerr << "Starting stitch at " << Date() << endl;
+
+ // Initialize
+
+ master_reads.open(masterbank, B_READ|B_WRITE);
+ master_contig.open(masterbank, B_READ|B_WRITE);
+ master_feat.open(masterbank, B_READ|B_WRITE);
+ master_scaff.open(masterbank, B_READ|B_WRITE);
+
+ patch_reads.open(patchbank, B_READ);
+ patch_contig.open(patchbank, B_READ);
+ patch_feat.open(patchbank, B_READ);
+
+ if (!m.empty()) { masteriid = lookupIID(master_contig, m); }
+ if (!m2.empty()) { master2iid = lookupIID(master_contig, m2); }
+ if (!p.empty()) { patchiid = lookupIID(patch_contig, p); }
+
+ set<ID_t> patchreads;
+ set<ID_t> masterreads;
+ Range_t stitchRegion;
+
+ stitchContigs(master_contig, master_reads, master_scaff, master_feat,
+ patch_contig, patch_reads, patch_feat,
+ leftstitchread, rightstitchread,
+ masterreads, patchreads,
+ stitchRegion,
+ masteriid, master2iid, patchiid,
+ savetonew, true);
+
+
+
+ cout << endl;
+ cout << "Replaced " << masterreads.size()
+ << " reads from master with " << patchreads.size()
+ << " reads from patch" << endl;
+
+ int dup = 0;
+ map<ID_t, ID_t> newpatchreads;
+ map<ID_t, ID_t>::iterator npi;
+
+ set<ID_t>::iterator pi;
+ set<ID_t>::iterator mi;
+
+ for (pi = patchreads.begin(); pi != patchreads.end(); pi++)
+ {
+ mi = masterreads.find(*pi);
+ if (mi == masterreads.end())
+ {
+ newpatchreads.insert(make_pair(*pi, 0));
+ }
+ else
+ {
+ dup++;
+ }
+ }
+
+ cout << "Duplicated patch reads: " << dup << endl;
+ cout << "New patch reads: " << newpatchreads.size() << endl;
+
+ if (!newpatchreads.empty())
+ {
+ const IDMap_t & cm = master_contig.getIDMap();
+ IDMap_t::const_iterator c;
+ for (c = cm.begin(); c != cm.end(); c++)
+ {
+ Contig_t contig;
+ master_contig.fetch(c->iid, contig);
+
+ vector<Tile_t>::iterator ti;
+
+ int patchcount = 0;
+ for (ti = contig.getReadTiling().begin(); ti != contig.getReadTiling().end(); ti++)
+ {
+ npi = newpatchreads.find(ti->source);
+
+ if (npi != newpatchreads.end())
+ {
+ npi->second = contig.getIID();
+ cout << " " << master_reads.lookupEID(ti->source) << " " << contig.getEID() << endl;
+ patchcount++;
+ }
+ }
+
+ if (patchcount)
+ {
+ cout << patchcount << " of " << contig.getReadTiling().size()
+ << " reads in contig " << contig.getEID() << " were used in patch!\n";
+ }
+ }
+
+ for (npi = newpatchreads.begin(); npi != newpatchreads.end(); npi++)
+ {
+ if (npi->second == 0)
+ {
+ cout << " " << master_reads.lookupEID(npi->first) << " NULL" << endl;
+ }
+ }
+ }
+
+ cout << endl;
+
+
+
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return retval;
+}
diff --git a/src/Experimental/sw_align.cc b/src/Experimental/sw_align.cc
new file mode 100644
index 0000000..ebaec3a
--- /dev/null
+++ b/src/Experimental/sw_align.cc
@@ -0,0 +1,632 @@
+#include "sw_align.hh"
+
+
+
+
+
+//-- Number of bases to extend past global high score before giving up
+static const int DEFAULT_BREAK_LEN = 200;
+
+//-- Characters used in creating the alignment edit matrix, DO NOT ALTER!
+static const char DELETE = 0;
+static const char INSERT = 1;
+static const char MATCH = 2;
+static const char START = 3;
+static const char NONE = 4;
+
+
+int _break_len = DEFAULT_BREAK_LEN;
+int _matrix_type = NUCLEOTIDE;
+
+
+
+
+
+//----------------------------------------- Private Function Declarations ----//
+static void generateDelta
+ (const Diagonal * Diag, long int FinishCt, long int FinishCDi,
+ long int N, vector<long int> & Delta);
+
+
+static inline Score * maxScore
+ (Score S[3]);
+
+
+static inline long int scoreMatch
+ (const Diagonal Diag, long int Dct, long int CDi,
+ const char * A, const char * B, long int N, unsigned int m_o);
+
+
+static inline void scoreEdit
+ (Score & curr, const long int del, const long int ins, const long int mat);
+
+
+
+
+
+//------------------------------------------ Private Function Definitions ----//
+bool _alignEngine
+ (const char * A0, long int Astart, long int & Aend,
+ const char * B0, long int Bstart, long int & Bend,
+ vector<long int> & Delta, unsigned int m_o)
+
+ // A0 is a sequence such that A [1...\0]
+ // B0 is a sequence such that B [1...\0]
+ // The alignment should use bases A [Astart...Aend] (inclusive)
+ // The alignment should use beses B [Bstart...Bend] (inclusive)
+ // of [Aend...Astart] etc. if BACKWARD_SEARCH
+ // Aend must never equal Astart, same goes for Bend and Bstart
+ // Delta is an integer vector, not necessarily empty
+ // m_o is the modus operandi of the function:
+ // FORWARD_ALIGN, FORWARD_SEARCH, BACKWARD_SEARCH
+ // Returns true on success (Aend & Bend reached) or false on failure
+
+{
+ Diagonal * Diag; // the list of diagonals to make up edit matrix
+
+ bool TargetReached; // the target was reached
+
+ const char * A, * B; // the sequence pointers to be used by this func
+
+ long int min_score = (-1 * LONG_MAX); // minimum possible score
+ long int high_score = min_score; // global maximum score
+ long int xhigh_score = min_score; // non-optimal high score
+
+ // max score difference
+ long int max_diff = GOOD_SCORE [getMatrixType( )] * _break_len;
+
+ long int CDi; // conceptual diagonal index (not relating to mem)
+ long int Dct, Di; // diagonal counter, actual diagonal index
+ long int PDct, PPDct; // previous diagonal and prev prev diagonal
+ long int PDi, PPDi; // previous diagonal index and prev prev diag index
+ long int Ds, PDs, PPDs; // diagonal size, prev, prev prev diagonal size
+ // where 'size' = rbound - lbound + 1
+ long int Ll = 100; // capacity of the diagonal list
+ long int Dl = 2; // current conceptual diagonal length
+ long int lbound = 0; // current diagonal left(lower) node bound index
+ long int rbound = 0; // current diagonal right(upper) node bound index
+ long int FinishCt = 0; // diagonal containing the high_score
+ long int FinishCDi = 0; // conceptual index of the high_score on FinishCt
+ long int xFinishCt = 0; // non-optimal ...
+ long int xFinishCDi = 0; // non-optimal ...
+ long int N, M, L; // maximum matrix dimensions... N rows, M columns
+
+ int Iadj, Dadj, Madj; // insert, delete and match adjust values
+
+#ifdef _DEBUG_VERBOSE
+ long int MaxL = 0; // biggest diagonal seen
+ long int TrimCt = 0; // counter of nodes trimmed
+ long int CalcCt = 0; // counter of nodes calculated
+#endif
+
+ //-- Set up character pointers for the appropriate m_o
+ if ( m_o & DIRECTION_BIT )
+ {
+ A = A0 + ( Astart - 1 );
+ B = B0 + ( Bstart - 1 );
+ N = Aend - Astart + 1;
+ M = Bend - Bstart + 1;
+ }
+ else
+ {
+ A = A0 + ( Astart + 1 );
+ B = B0 + ( Bstart + 1 );
+ N = Astart - Aend + 1;
+ M = Bstart - Bend + 1;
+ }
+
+ //-- Initialize the diagonals list
+ Diag = (Diagonal *) Safe_malloc ( Ll * sizeof(Diagonal) );
+
+ //-- Initialize position 0,0 in the matrices
+ Diag[0] . lbound = lbound;
+ Diag[0] . rbound = rbound ++;
+
+ Diag[0] . I = (Node *) Safe_malloc ( 1 * sizeof(Node) );
+ Diag[0] . I[0] . S[DELETE] . value = min_score;
+ Diag[0] . I[0] . S[INSERT] . value = min_score;
+ Diag[0] . I[0] . S[MATCH] . value = 0;
+ Diag[0] . I[0] . max = Diag[0] . I[0] . S + MATCH;
+
+ Diag[0] . I[0] . S[DELETE] . used = NONE;
+ Diag[0] . I[0] . S[INSERT] . used = NONE;
+ Diag[0] . I[0] . S[MATCH] . used = START;
+
+ L = N < M ? N : M;
+
+ //-- **START** of diagonal processing loop
+ //-- Calculate the rest of the diagonals until goal reached or score worsens
+ for ( Dct = 1;
+ Dct <= N + M && (Dct - FinishCt) <= _break_len && lbound <= rbound;
+ Dct ++ )
+ {
+ //-- If diagonals capacity exceeded, realloc
+ if ( Dct >= Ll )
+ {
+ Ll *= 2;
+ Diag = (Diagonal *) Safe_realloc
+ ( Diag, sizeof(Diagonal) * Ll );
+ }
+
+ Diag[Dct] . lbound = lbound;
+ Diag[Dct] . rbound = rbound;
+
+ //-- malloc space for the edit char and score nodes
+ Ds = rbound - lbound + 1;
+ Diag[Dct] . I = (Node *) Safe_malloc
+ ( Ds * sizeof(Node) );
+
+#ifdef _DEBUG_VERBOSE
+ //-- Keep count of trimmed and calculated nodes
+ CalcCt += Ds;
+ TrimCt += Dl - Ds;
+ if ( Ds > MaxL )
+ MaxL = Ds;
+#endif
+
+ //-- Set diagonal index adjustment values
+ if ( Dct <= N )
+ {
+ Iadj = 0;
+ Madj = -1;
+ }
+ else
+ {
+ Iadj = 1;
+ Madj = Dct == N + 1 ? 0 : 1;
+ }
+ Dadj = Iadj - 1;
+
+ //-- Set parent diagonal values
+ PDct = Dct - 1;
+ PDs = Diag[PDct] . rbound - Diag[PDct] . lbound + 1;
+ PDi = lbound + Dadj;
+ PDi = PDi - Diag[PDct] . lbound;
+
+ //-- Set grandparent diagonal values
+ PPDct = Dct - 2;
+ if ( PPDct >= 0 )
+ {
+ PPDs = Diag[PPDct] . rbound - Diag[PPDct] . lbound + 1;
+ PPDi = lbound + Madj;
+ PPDi = PPDi - Diag[PPDct] . lbound;
+ }
+ else
+ PPDi = PPDs = 0;
+
+ //-- If forced alignment, don't keep track of global max
+ if ( m_o & FORCED_BIT )
+ high_score = min_score;
+
+ //-- **START** of internal node scoring loop
+ //-- Calculate scores for every node (within bounds) for diagonal Dct
+ for ( CDi = lbound; CDi <= rbound; CDi ++ )
+ {
+ //-- Set the index (in memory) of current node and clear score
+ Di = CDi - Diag[Dct] . lbound;
+
+ //-- Calculate DELETE score
+ if ( PDi >= 0 && PDi < PDs )
+ scoreEdit
+ (Diag[Dct] . I[Di] . S[DELETE],
+ Diag[PDct] . I[PDi] . S[DELETE] . used == NONE ?
+ Diag[PDct] . I[PDi] . S[DELETE] . value :
+ Diag[PDct] . I[PDi] . S[DELETE] . value +
+ CONT_GAP_SCORE [_matrix_type],
+ Diag[PDct] . I[PDi] . S[INSERT] . used == NONE ?
+ Diag[PDct] . I[PDi] . S[INSERT] . value :
+ Diag[PDct] . I[PDi] . S[INSERT] . value +
+ OPEN_GAP_SCORE [_matrix_type],
+ Diag[PDct] . I[PDi] . S[MATCH] . used == NONE ?
+ Diag[PDct] . I[PDi] . S[MATCH] . value :
+ Diag[PDct] . I[PDi] . S[MATCH] . value +
+ OPEN_GAP_SCORE [_matrix_type]);
+ else
+ {
+ Diag[Dct] . I[Di] . S[DELETE] . value = min_score;
+ Diag[Dct] . I[Di] . S[DELETE] . used = NONE;
+ }
+
+ PDi ++;
+
+ //-- Calculate INSERT score
+ if ( PDi >= 0 && PDi < PDs )
+ scoreEdit
+ (Diag[Dct] . I[Di] . S[INSERT],
+ Diag[PDct] . I[PDi] . S[DELETE] . used == NONE ?
+ Diag[PDct] . I[PDi] . S[DELETE] . value :
+ Diag[PDct] . I[PDi] . S[DELETE] . value +
+ OPEN_GAP_SCORE [_matrix_type],
+ Diag[PDct] . I[PDi] . S[INSERT] . used == NONE ?
+ Diag[PDct] . I[PDi] . S[INSERT] . value :
+ Diag[PDct] . I[PDi] . S[INSERT] . value +
+ CONT_GAP_SCORE [_matrix_type],
+ Diag[PDct] . I[PDi] . S[MATCH] . used == NONE ?
+ Diag[PDct] . I[PDi] . S[MATCH] . value :
+ Diag[PDct] . I[PDi] . S[MATCH] . value +
+ OPEN_GAP_SCORE [_matrix_type]);
+ else
+ {
+ Diag[Dct] . I[Di] . S[INSERT] . value = min_score;
+ Diag[Dct] . I[Di] . S[INSERT] . used = NONE;
+ }
+
+ //-- Calculate MATCH/MIS-MATCH score
+ if ( PPDi >= 0 && PPDi < PPDs )
+ {
+ scoreEdit
+ (Diag[Dct] . I[Di] . S[MATCH],
+ Diag[PPDct] . I[PPDi] . S[DELETE] . value,
+ Diag[PPDct] . I[PPDi] . S[INSERT] . value,
+ Diag[PPDct] . I[PPDi] . S[MATCH] . value);
+ Diag[Dct] . I[Di] . S[MATCH] . value +=
+ scoreMatch (Diag[Dct], Dct, CDi, A, B, N, m_o);
+ }
+ else
+ {
+ Diag[Dct] . I[Di] . S[MATCH] . value = min_score;
+ Diag[Dct] . I[Di] . S[MATCH] . used = NONE;
+ }
+
+ PPDi ++;
+
+ Diag[Dct] . I[Di] . max = maxScore (Diag[Dct] . I[Di] . S);
+
+ //-- Reset high_score if new global max was found
+ if ( Diag[Dct] . I[Di] . max->value >= high_score )
+ {
+ high_score = Diag[Dct] . I[Di] . max->value;
+ FinishCt = Dct;
+ FinishCDi = CDi;
+ }
+ }
+ //-- **END** of internal node scoring loop
+
+
+ //-- Calculate max non-optimal score
+ if ( m_o & SEQEND_BIT && Dct >= L )
+ {
+ if ( L == N )
+ {
+ if ( lbound == 0 )
+ {
+ if ( Diag[Dct] . I[0] . max->value >= xhigh_score )
+ {
+ xhigh_score = Diag[Dct] . I[0] . max->value;
+ xFinishCt = Dct;
+ xFinishCDi = 0;
+ }
+ }
+ }
+ else // L == M
+ {
+ if ( rbound == M )
+ {
+ if ( Diag[Dct] . I[M-Diag[Dct].lbound] .
+ max->value >= xhigh_score )
+ {
+ xhigh_score = Diag[Dct] . I[M-Diag[Dct].lbound] .
+ max->value;
+ xFinishCt = Dct;
+ xFinishCDi = M;
+ }
+ }
+ }
+ }
+
+
+ //-- If in extender modus operandi, free soon to be greatgrandparent diag
+ if ( m_o & SEARCH_BIT && Dct > 1 )
+ free ( Diag[PPDct] . I );
+
+
+ //-- Trim hopeless diagonal nodes
+ for ( Di = 0; Di < Ds; Di ++ )
+ {
+ if ( high_score - Diag[Dct] . I[Di] . max->value > max_diff )
+ lbound ++;
+ else
+ break;
+ }
+ for ( Di = Ds - 1; Di >= 0; Di -- )
+ {
+ if ( high_score - Diag[Dct] . I[Di] . max->value > max_diff )
+ rbound --;
+ else
+ break;
+ }
+
+ //-- Grow new diagonal and reset boundaries
+ if ( Dct < N && Dct < M )
+ { Dl ++; rbound ++; }
+ else if ( Dct >= N && Dct >= M )
+ { Dl --; lbound --; }
+ else if ( Dct >= N )
+ lbound --;
+ else
+ rbound ++;
+
+ if ( lbound < 0 )
+ lbound = 0;
+ if ( rbound >= Dl )
+ rbound = Dl - 1;
+ }
+ //-- **END** of diagonal processing loop
+ Dct --;
+
+ //-- Check if the target was reached
+ // If OPTIMAL, backtrack to last high_score to maximize alignment score
+ TargetReached = false;
+ if ( Dct == N + M )
+ {
+ if ( ~m_o & OPTIMAL_BIT || m_o & SEQEND_BIT )
+ {
+ TargetReached = true;
+ FinishCt = N + M;
+ FinishCDi = 0;
+ }
+ else if ( FinishCt == Dct )
+ TargetReached = true;
+ }
+ else if ( m_o & SEQEND_BIT && xFinishCt != 0 )
+ {
+ //-- non-optimal, extend alignment to end of shortest seq if possible
+ FinishCt = xFinishCt;
+ FinishCDi = xFinishCDi;
+ }
+
+ //-- Set A/Bend to finish positions
+ long int Aadj = FinishCt <= N ? FinishCt - FinishCDi - 1 : N - FinishCDi - 1;
+ long int Badj = FinishCt <= N ? FinishCDi - 1 : FinishCt - N + FinishCDi - 1;
+ if ( ~m_o & DIRECTION_BIT )
+ {
+ Aadj *= -1;
+ Badj *= -1;
+ }
+ Aend = Astart + Aadj;
+ Bend = Bstart + Badj;
+
+
+#ifdef _DEBUG_VERBOSE
+ assert (FinishCt > 1);
+
+ //-- Ouput calculation statistics
+ if ( TargetReached )
+ fprintf(stderr,"Finish score = %ld : %ld,%ld\n",
+ Diag[FinishCt] . I[0] . max->value, N, M);
+ else
+ fprintf(stderr,"High score = %ld : %ld,%ld\n", high_score,
+ labs(Aadj) + 1, labs(Badj) + 1);
+ fprintf(stderr, "%ld nodes calculated, %ld nodes trimmed\n", CalcCt, TrimCt);
+ if ( m_o & DIRECTION_BIT )
+ fprintf(stderr, "%ld bytes used\n",
+ (long int)sizeof(Diagonal) * Dct + (long int)sizeof(Node) * CalcCt);
+ else
+ fprintf(stderr, "%ld bytes used\n",
+ ((long int)sizeof(Diagonal) + (long int)sizeof(Node) * MaxL) * 2);
+#endif
+
+
+ //-- If in forward alignment m_o, create the Delta information
+ if ( ~m_o & SEARCH_BIT )
+ generateDelta (Diag, FinishCt, FinishCDi, N, Delta);
+
+ //-- Free the scoring and edit spaces remaining
+ for ( Di = m_o & SEARCH_BIT ? Dct - 1 : 0; Di <= Dct; Di ++ )
+ free ( Diag[Di] . I );
+ free ( Diag );
+
+ return TargetReached;
+}
+
+
+
+
+static void generateDelta
+ (const Diagonal * Diag, long int FinishCt, long int FinishCDi,
+ long int N, vector<long int> & Delta)
+
+ // Diag is the list of diagonals that compose the edit matrix
+ // FinishCt is the diagonal that contains the finishing node
+ // FinishCDi is the conceptual finishing node, in FinishCt, for the align
+ // N & M are the target positions for the alignment
+ // Delta is the vector in which to store the alignment data, new data
+ // will be appended onto any existing data.
+ // NOTE: there will be no zero at the end of the data, end of data
+ // is signaled by the end of the vector
+ // Return is void
+
+{
+ //-- Function pre-conditions
+#ifdef _DEBUG_ASSERT
+ assert ( Diag != NULL );
+ assert ( FinishCt > 1 );
+#endif
+
+ long int Count; // delta counter
+ long int Dct = FinishCt; // diagonal index
+ long int CDi = FinishCDi; // conceptual node index
+ long int Di = 0; // actual node index
+ long int Pi = 0; // path index
+ long int PSize = 100; // capacity of the path space
+ char * Reverse_Path; // path space
+
+ Score curr_score;
+ char edit;
+
+ //-- malloc space for the edit path
+ Reverse_Path = (char *) Safe_malloc ( PSize * sizeof(char) );
+
+ //-- Which Score index is the maximum value in? Store in edit
+ Di = CDi - Diag[Dct] . lbound;
+ edit = Diag[Dct] . I[Di] . max - Diag[Dct] . I[Di] . S;
+
+ //-- Walk the path backwards through the edit space
+ while ( Dct >= 0 )
+ {
+ //-- remalloc path space if neccessary
+ if ( Pi >= PSize )
+ {
+ PSize *= 2;
+ Reverse_Path = (char *) Safe_realloc
+ ( Reverse_Path, sizeof(char) * PSize );
+ }
+
+ Di = CDi - Diag[Dct] . lbound;
+ curr_score = Diag[Dct] . I[Di] . S[edit];
+
+ Reverse_Path[Pi ++] = edit;
+ switch ( edit )
+ {
+ case DELETE :
+ CDi = Dct -- <= N ? CDi - 1 : CDi;
+ break;
+ case INSERT :
+ CDi = Dct -- <= N ? CDi : CDi + 1;
+ break;
+ case MATCH :
+ CDi = Dct <= N ? CDi - 1 : ( Dct == N + 1 ? CDi : CDi + 1 );
+ Dct -= 2;
+ break;
+ case START :
+ Dct = -1;
+ break;
+ default :
+ fprintf(stderr,"\nERROR: Invalid edit matrix entry,\n"
+ " please file a bug report\n");
+ exit ( EXIT_FAILURE );
+ }
+
+ edit = curr_score . used;
+ }
+
+ //-- Generate the delta information
+ Count = 1;
+ for (Pi -= 2; Pi >= 0; Pi --)
+ {
+ switch ( Reverse_Path[Pi] )
+ {
+ case DELETE :
+ Delta . push_back(-Count);
+ Count = 1;
+ break;
+ case INSERT :
+ Delta . push_back(Count);
+ Count = 1;
+ break;
+ case MATCH :
+ Count ++;
+ break;
+ case START :
+ break;
+ default :
+ fprintf(stderr,"\nERROR: Invalid path matrix entry,\n"
+ " please file a bug report\n");
+ exit ( EXIT_FAILURE );
+ }
+ }
+
+ free (Reverse_Path);
+
+ return;
+}
+
+
+
+
+static inline Score * maxScore
+ (Score S[3])
+
+ // Return a pointer to the maximum score in the score array
+
+{
+ if ( S[DELETE] . value > S[INSERT] . value )
+ {
+ if ( S[DELETE] . value > S[MATCH] . value )
+ return S + DELETE;
+ else
+ return S + MATCH;
+ }
+ else if ( S[INSERT] . value > S[MATCH] . value )
+ return S + INSERT;
+ else
+ return S + MATCH;
+}
+
+
+
+
+static inline void scoreEdit
+ (Score & curr, const long int del, const long int ins, const long int mat)
+
+ // Assign current edit a maximal score using either del, ins or mat
+
+{
+ if ( del > ins )
+ {
+ if ( del > mat )
+ {
+ curr.value = del;
+ curr.used = DELETE;
+ }
+ else
+ {
+ curr.value = mat;
+ curr.used = MATCH;
+ }
+ }
+ else if ( ins > mat )
+ {
+ curr.value = ins;
+ curr.used = INSERT;
+ }
+ else
+ {
+ curr.value = mat;
+ curr.used = MATCH;
+ }
+
+ return;
+}
+
+
+
+
+static inline long int scoreMatch
+ (const Diagonal Diag, long int Dct, long int CDi,
+ const char * A, const char * B, long int N, unsigned int m_o)
+
+ // Diag is the single diagonal that contains the node to be scored
+ // Dct is Diag's diagonal index in the edit matrix
+ // CDi is the conceptual node to be scored in Diag
+ // A and B are the alignment sequences
+ // N is the alignment target index in A
+ // m_o is the modus operandi of the alignment:
+ // FORWARD_ALIGN, FORWARD_SEARCH, BACKWARD_SEARCH
+
+{
+ static int Dir;
+ static char Ac, Bc;
+
+ //-- 1 for forward, -1 for reverse
+ Dir = m_o & DIRECTION_BIT ? 1 : -1;
+
+ //-- Locate the characters that need to be compared
+ if ( Dct <= N )
+ {
+ Ac = *( A + ( (Dct - CDi) * Dir ) );
+ Bc = *( B + ( (CDi) * Dir ) );
+ }
+ else
+ {
+ Ac = *( A + ( (N - CDi) * Dir ) );
+ Bc = *( B + ( (Dct - N + CDi) * Dir ) );
+ }
+
+ if ( ! isalpha(Ac) )
+ Ac = STOP_CHAR;
+ if ( ! isalpha(Bc) )
+ Bc = STOP_CHAR;
+
+ return MATCH_SCORE [_matrix_type] [toupper(Ac) - 'A'] [toupper(Bc) - 'A'];
+}
diff --git a/src/Experimental/sw_align.hh b/src/Experimental/sw_align.hh
new file mode 100644
index 0000000..737d080
--- /dev/null
+++ b/src/Experimental/sw_align.hh
@@ -0,0 +1,339 @@
+//------------------------------------------------------------------------------
+// Programmer: Adam M Phillippy, The Institute for Genomic Research
+// File: sw_align.hh
+// Date: 7 / 18 / 2002
+//
+// Description: Routines for DNA sequence alignment. See individual public
+// functions for a description of their applications. Designed
+// to be used by postNUC and postPRO for the extension of
+// alignments off of clusters identified by MUMmer.
+//
+//------------------------------------------------------------------------------
+
+#ifndef __SW_ALIGN_HH
+#define __SW_ALIGN_HH
+
+//-- NOTE: these debug options will significantly hamper program performance
+//#define _DEBUG_ASSERT // performs assert functions to check validity
+//#define _DEBUG_VERBOSE // outputs various alignment statistics and values
+
+
+#include "sw_alignscore.hh"
+#include "tigrinc.hh"
+#include <vector>
+using namespace std;
+
+
+
+
+
+//------------------------------------------------------------- Constants ----//
+//-- Modus operandi bit masks 00001, 00010, 00100, 01000, 10000
+
+static const unsigned int DIRECTION_BIT = 0x1;
+static const unsigned int SEARCH_BIT = 0x2;
+static const unsigned int FORCED_BIT = 0x4;
+static const unsigned int OPTIMAL_BIT = 0x8;
+static const unsigned int SEQEND_BIT = 0x10;
+
+
+//-- Modus operandi of the primary alignment functions
+
+static const unsigned int FORWARD_ALIGN = 0x1;
+static const unsigned int OPTIMAL_FORWARD_ALIGN = 0x9;
+static const unsigned int FORCED_FORWARD_ALIGN = 0x5;
+//-- Align forward until target is reached OR score worsens
+// Fully uses memory and DOES create delta information
+// If "OPTIMAL" maximize the alignment score by shrinking coverage
+// If "FORCED" ignore score and force alignment to reach its target
+
+static const unsigned int FORWARD_SEARCH = 0x3;
+static const unsigned int OPTIMAL_FORWARD_SEARCH = 0xB;
+static const unsigned int FORCED_FORWARD_SEARCH = 0x7;
+//-- Align forward until target is reached OR score worsens
+// Only uses partial memory and DOES NOT create delta information
+// If "OPTIMAL" maximize the alignment score by shrinking coverage
+// If "FORCED" ignore score and force alignment to reach its target
+
+static const unsigned int BACKWARD_SEARCH = 0x2;
+static const unsigned int OPTIMAL_BACKWARD_SEARCH = 0xA;
+static const unsigned int FORCED_BACKWARD_SEARCH = 0x6;
+//-- Align backward until target is reached OR score worsens
+// Only uses partial memory and DOES NOT create delta information
+// If "OPTIMAL" maximize the alignment score by shrinking coverage
+// If "FORCED" ignore score and force alignment to reach its target
+
+//-- Maximum number of bases (in either sequence) that the alignSearch may go
+static const long int MAX_SEARCH_LENGTH = 50000;
+
+//-- Maximum number of bases (in either sequence) that the alignTarget may go
+static const long int MAX_ALIGNMENT_LENGTH = 10000;
+
+
+
+//------------------------------------------------------ Type Definitions ----//
+struct Score
+{
+ long int value;
+ char used;
+};
+
+struct Node
+{
+ Score S[3];
+ Score * max;
+};
+
+struct Diagonal
+{
+ long int lbound, rbound; // left(lower) and right(upper) bounds
+ Node * I; // the matrix nodes
+};
+
+
+
+
+//--------------------------------------------------------------- Externs ----//
+extern int _break_len;
+extern int _matrix_type;
+
+
+
+
+
+//----------------------------------------- Private Function Declarations ----//
+bool _alignEngine
+ (const char * A0, long int Astart, long int & Aend,
+ const char * B0, long int Bstart, long int & Bend,
+ vector<long int> & Delta, unsigned int m_o);
+
+
+
+
+
+//------------------------------------------- Public Function Definitions ----//
+inline bool alignSearch
+ (const char * A0, long int Astart, long int & Aend,
+ const char * B0, long int Bstart, long int & Bend,
+ unsigned int m_o)
+
+ // PURPOSE: This function aligns the sequences A0 and B0, starting
+ // at positions Astart and Bstart, as far as possible until the
+ // cumulative score does not improve for 'break_len' bases, or Aend
+ // and Bend are reached. Aend and Bend are changed to reflect the
+ // ending position of the alignment, or if reached they stay the same.
+ // This function destroys the edit matrix as it goes along to save
+ // memory, therefore it only calculates the positions at which the
+ // alignment score falls off, it does not generate the alignment data
+ // (like as in alignTarget).
+ // INPUT: A0 and B0 are sequences such that A [1...N] and B [1...N].
+ // Usually the '\0' character is placed at the zero and end index
+ // of the arrays A and B. Astart and Bstart are the (inclusive)
+ // starting positions of the alignment. Aend and Bend are the
+ // (inclusive) target positions for the alignment. If the A / Bend
+ // positions are not reached, they are changed to the positions where
+ // the search terminated. These values are relative to the start of
+ // the sequences A and B. m_o is the modus operandi of the function,
+ // the m_o must be a Search, see beginning of file for descriptions.
+ // RETURN: This function returns 'true' if the alignment reached the
+ // target positions Aend and Bend, the function returns false if
+ // otherwise. Aend and Bend are changed to reflect the termination
+ // positions of the alignment.
+ // CONDITIONS: A0 and B0 must not be null, and have a sequence length
+ // of atleast 1. Astart, Bstart, Aend and Bend must all be greater
+ // than zero and less or equal to the lengths of A and B (depending
+ // on which sequence they reference). If it is a forward extension
+ // Aend must be greater than Astart, and if it is a backward extension
+ // Astart must be greater than Aend. Astart must not equal Aend. The
+ // same rules apply for Bstart and Bend.
+
+{
+ bool rv;
+ vector<long int> n_v;
+
+#ifdef _DEBUG_VERBOSE
+ fprintf(stderr,"Running alignment search...\n");
+ fprintf(stderr,"Astart = %ld, Atarget = %ld\n", Astart, Aend);
+ fprintf(stderr,"Bstart = %ld, Btarget = %ld\n", Bstart, Bend);
+ fprintf(stderr,"--------------------------------------\n");
+#endif
+#ifdef _DEBUG_ASSERT
+ //-- Function pre-conditions
+ assert ( A0 != NULL && B0 != NULL );
+ assert ( m_o & SEARCH_BIT );
+ long int Alen = strlen ( A0 + 1 );
+ long int Blen = strlen ( B0 + 1 );
+ assert ( Astart > 0 && Aend > 0 && Astart <= Alen && Aend <= Alen );
+ assert ( Bstart > 0 && Bend > 0 && Bstart <= Blen && Bend <= Blen );
+ if ( m_o & DIRECTION_BIT )
+ {
+ assert ( Astart <= Aend && Bstart <= Bend );
+ assert ( Aend - Astart + 1 <= MAX_SEARCH_LENGTH &&
+ Bend - Bstart + 1 <= MAX_SEARCH_LENGTH );
+ }
+ else
+ {
+ assert ( Astart >= Aend && Bstart >= Bend );
+ assert ( Astart - Aend + 1 <= MAX_SEARCH_LENGTH &&
+ Bstart - Bend + 1 <= MAX_SEARCH_LENGTH);
+ }
+#endif
+
+ rv = _alignEngine (A0, Astart, Aend, B0, Bstart, Bend, n_v, m_o);
+
+#ifdef _DEBUG_VERBOSE
+ fprintf(stderr,"--------------------------------------\n");
+ fprintf(stderr,"Astart = %ld, Aend = %ld\n", Astart, Aend);
+ fprintf(stderr,"Bstart = %ld, Bend = %ld\n", Bstart, Bend);
+ fprintf(stderr,"Returned from alignment search\n");
+#endif
+#ifdef _DEBUG_ASSERT
+ //-- Function post-conditions
+ assert ( Aend > 0 && Aend <= Alen );
+ assert ( Bend > 0 && Bend <= Blen );
+ assert ( ~m_o & FORCED_BIT || rv == true );
+#endif
+
+ return rv;
+}
+
+
+
+
+inline bool alignTarget
+ (const char * A0, long int Astart, long int & Aend,
+ const char * B0, long int Bstart, long int & Bend,
+ vector<long int> & Delta, unsigned int m_o)
+
+ // PURPOSE: This function aligns the sequences A0 and B0, starting
+ // at positions Astart and Bstart, as far as possible until the
+ // cumulative score does not improve for 'break_len' bases, or Aend
+ // and Bend are reached. Aend and Bend are changed to reflect the
+ // ending position of the alignment, or if reached they stay the same.
+ // This algorithm generates alignment data and does not destroy
+ // the edit matrix (like as in alignSearch).
+ // INPUT: A0 and B0 are sequences such that A [1...N] and B [1...N].
+ // Usually the '\0' character is placed at the zero and end index
+ // of the arrays A and B. Astart and Bstart are the (inclusive)
+ // starting positions of the alignment. Aend and Bend are the
+ // (inclusive) target positions for the alignment. If the A / Bend
+ // positions are not reached, they are changed to the positions where
+ // the search terminated. These values are relative to the start of
+ // the sequences A and B. Delta is an integer vector. It does not
+ // need to be empty, it will append the results to the end.
+ // m_o is the modus operandi of the function, the m_o must not be
+ // a search, and must be in the forward direction. See beginning of
+ // file for descriptions.
+ // RETURN: This function returns 'true' if the alignment reached the
+ // target positions Aend and Bend, the function returns false if
+ // otherwise. Aend and Bend are changed to reflect the termination
+ // positions of the alignment. The delta encoded alignment data
+ // is appended to the end of the Delta vector and terminated with
+ // a zero integer.
+ // CONDITIONS: A0 and B0 must not be null, and have a sequence length
+ // of atleast 1. Astart, Bstart, Aend and Bend must all be greater
+ // than zero and less or equal to the lengths of A and B (depending
+ // on which sequence they reference). Aend must be greater than
+ // Astart. Astart must not equal Aend. The same rules apply for
+ // Bstart and Bend.
+
+{
+ bool rv;
+
+#ifdef _DEBUG_VERBOSE
+ fprintf(stderr,"Running targeted alignment...\n");
+ fprintf(stderr,"Astart = %ld, Atarget = %ld\n", Astart, Aend);
+ fprintf(stderr,"Bstart = %ld, Btarget = %ld\n", Bstart, Bend);
+ fprintf(stderr,"--------------------------------------\n");
+#endif
+#ifdef _DEBUG_ASSERT
+ //-- Function pre-conditions
+ assert ( m_o & DIRECTION_BIT && ~m_o & SEARCH_BIT );
+ assert ( A0 != NULL && B0 != NULL );
+ long int Alen = strlen ( A0 + 1 );
+ long int Blen = strlen ( B0 + 1 );
+ assert ( Astart > 0 && Aend > 0 && Astart <= Alen && Aend <= Alen );
+ assert ( Bstart > 0 && Bend > 0 && Bstart <= Blen && Bend <= Blen );
+ assert ( Astart <= Aend && Bstart <= Bend );
+ assert ( Aend - Astart + 1 <= MAX_ALIGNMENT_LENGTH &&
+ Bend - Bstart + 1 <= MAX_ALIGNMENT_LENGTH);
+#endif
+
+ rv = _alignEngine (A0, Astart, Aend, B0, Bstart, Bend, Delta, m_o);
+
+#ifdef _DEBUG_VERBOSE
+ fprintf(stderr,"--------------------------------------\n");
+ fprintf(stderr,"Astart = %ld, Aend = %ld\n", Astart, Aend);
+ fprintf(stderr,"Bstart = %ld, Bend = %ld\n", Bstart, Bend);
+ fprintf(stderr,"Returned from targeted alignment\n");
+#endif
+#ifdef _DEBUG_ASSERT
+ //-- Function post-conditions
+ assert ( Aend > 0 && Aend <= Alen );
+ assert ( Bend > 0 && Bend <= Blen );
+ assert ( ~m_o & FORCED_BIT || rv == true );
+#endif
+
+ return rv;
+}
+
+
+
+
+inline int getBreakLen
+ ( )
+
+ // Returns the current value of _break_len
+
+{
+ return _break_len;
+}
+
+
+
+
+inline int getMatrixType
+ ( )
+
+ // Returns the current value of _matrix_type
+
+{
+ return _matrix_type;
+}
+
+
+
+
+inline void setBreakLen
+ (const int Break_Len)
+
+ // Resets the break length (see comments on DEFAULT_BREAK_LEN above)
+
+{
+ if ( Break_Len < 1 || Break_Len > MAX_ALIGNMENT_LENGTH )
+ fprintf (stderr, "WARNING: Invalid break length %d, ignoring\n", Break_Len);
+ else
+ _break_len = Break_Len;
+ return;
+}
+
+
+
+
+inline void setMatrixType
+ (const int Matrix_Type)
+
+ // Resets the _matrix_type
+
+{
+ if ( Matrix_Type < 0 || Matrix_Type > 3 )
+ fprintf (stderr,
+ "WARNING: Invalid matrix type %d, ignoring\n", Matrix_Type);
+ else
+ _matrix_type = Matrix_Type;
+ return;
+}
+
+
+
+#endif // #ifndef __SW_ALIGN_HH
diff --git a/src/Experimental/sw_alignscore.hh b/src/Experimental/sw_alignscore.hh
new file mode 100644
index 0000000..8e45b73
--- /dev/null
+++ b/src/Experimental/sw_alignscore.hh
@@ -0,0 +1,141 @@
+//------------------------------------------------------------------------------
+// Programmer: Adam M Phillippy, The Institute for Genomic Research
+// File: sw_alignscore.hh
+// Date: 8 / 08 / 2002
+//
+// Description: Scoring information for nucleotide and amino acid alignments
+//
+// Please report bugs and suggestions to <aphillip at tigr.edu>
+//------------------------------------------------------------------------------
+
+#ifndef __SW_ALIGNSCORE_HH
+#define __SW_ALIGNSCORE_HH
+
+//-- * equals O for easy hashing
+const char STOP_CHAR = 'O';
+
+//-------------------------------------------------- Scoring Matrix Types ----//
+const int NUCLEOTIDE = 0;
+const int BLOSUM45 = 1;
+const int BLOSUM62 = 2;
+const int BLOSUM80 = 3;
+
+const int GOOD_SCORE [4] = {3, 10, 8, 8};
+const int OPEN_GAP_SCORE [4] = {-10, -10, -10, -10};
+const int CONT_GAP_SCORE [4] = {-7, -1, -1, -1};
+const int MATCH_SCORE [4][26][26] =
+{{
+//A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+{ 3,-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,-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,-7, 3,-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,-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,-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,-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,-7,-7,-7, 3,-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,-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,-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,-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,-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,-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,-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,-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,-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,-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,-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,-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,-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,-7,-7,-7,-7,-7,-7,-7,-7,-7,-7,-7,-7, 3,-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,-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,-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,-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,-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,-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,-7,-7,-7,-7,-7,-7}
+},{
+//A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+{ 5,-1,-1,-2,-1,-2, 0,-2,-1, 0,-1,-1,-1,-1,-5,-1,-1,-2, 1, 0, 0, 0,-2, 0,-2,-1},
+{-1, 4,-2, 5, 1,-3,-1, 0,-3,-1, 0,-3,-2, 4,-5,-2, 0,-1, 0, 0,-1,-3,-4,-1,-2, 2},
+{-1,-2,12,-3,-3,-2,-3,-3,-3,-2,-3,-2,-2,-2,-5,-4,-3,-3,-1,-1,-2,-1,-5,-2,-3,-3},
+{-2, 5,-3, 7, 2,-4,-1, 0,-4,-1, 0,-3,-3, 2,-5,-1, 0,-1, 0,-1,-1,-3,-4,-1,-2, 1},
+{-1, 1,-3, 2, 6,-3,-2, 0,-3,-1, 1,-2,-2, 0,-5, 0, 2, 0, 0,-1,-1,-3,-3,-1,-2, 4},
+{-2,-3,-2,-4,-3, 8,-3,-2, 0,-1,-3, 1, 0,-2,-5,-3,-4,-2,-2,-1,-1, 0, 1,-1, 3,-3},
+{ 0,-1,-3,-1,-2,-3, 7,-2,-4,-1,-2,-3,-2, 0,-5,-2,-2,-2, 0,-2,-1,-3,-2,-1,-3,-2},
+{-2, 0,-3, 0, 0,-2,-2,10,-3,-1,-1,-2, 0, 1,-5,-2, 1, 0,-1,-2,-1,-3,-3,-1, 2, 0},
+{-1,-3,-3,-4,-3, 0,-4,-3, 5,-1,-3, 2, 2,-2,-5,-2,-2,-3,-2,-1,-1, 3,-2,-1, 0,-3},
+{ 0,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-5,-1,-1,-1, 0, 0,-1,-1,-2,-1,-1,-1},
+{-1, 0,-3, 0, 1,-3,-2,-1,-3,-1, 5,-3,-1, 0,-5,-1, 1, 3,-1,-1,-1,-2,-2,-1,-1, 1},
+{-1,-3,-2,-3,-2, 1,-3,-2, 2,-1,-3, 5, 2,-3,-5,-3,-2,-2,-3,-1,-1, 1,-2,-1, 0,-2},
+{-1,-2,-2,-3,-2, 0,-2, 0, 2,-1,-1, 2, 6,-2,-5,-2, 0,-1,-2,-1,-1, 1,-2,-1, 0,-1},
+{-1, 4,-2, 2, 0,-2, 0, 1,-2,-1, 0,-3,-2, 6,-5,-2, 0, 0, 1, 0,-1,-3,-4,-1,-2, 0},
+{-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5, 4,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5},
+{-1,-2,-4,-1, 0,-3,-2,-2,-2,-1,-1,-3,-2,-2,-5, 9,-1,-2,-1,-1,-1,-3,-3,-1,-3,-1},
+{-1, 0,-3, 0, 2,-4,-2, 1,-2,-1, 1,-2, 0, 0,-5,-1, 6, 1, 0,-1,-1,-3,-2,-1,-1, 4},
+{-2,-1,-3,-1, 0,-2,-2, 0,-3,-1, 3,-2,-1, 0,-5,-2, 1, 7,-1,-1,-1,-2,-2,-1,-1, 0},
+{ 1, 0,-1, 0, 0,-2, 0,-1,-2, 0,-1,-3,-2, 1,-5,-1, 0,-1, 4, 2, 0,-1,-4, 0,-2, 0},
+{ 0, 0,-1,-1,-1,-1,-2,-2,-1, 0,-1,-1,-1, 0,-5,-1,-1,-1, 2, 5, 0, 0,-3, 0,-1,-1},
+{ 0,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-5,-1,-1,-1, 0, 0,-1,-1,-2,-1,-1,-1},
+{ 0,-3,-1,-3,-3, 0,-3,-3, 3,-1,-2, 1, 1,-3,-5,-3,-3,-2,-1, 0,-1, 5,-3,-1,-1,-3},
+{-2,-4,-5,-4,-3, 1,-2,-3,-2,-2,-2,-2,-2,-4,-5,-3,-2,-2,-4,-3,-2,-3,15,-2, 3,-2},
+{ 0,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-5,-1,-1,-1, 0, 0,-1,-1,-2,-1,-1,-1},
+{-2,-2,-3,-2,-2, 3,-3, 2, 0,-1,-1, 0, 0,-2,-5,-3,-1,-1,-2,-1,-1,-1, 3,-1, 8,-2},
+{-1, 2,-3, 1, 4,-3,-2, 0,-3,-1, 1,-2,-1, 0,-5,-1, 4, 0, 0,-1,-1,-3,-2,-1,-2, 4}
+},{
+//A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+{ 4,-2, 0,-2,-1,-2, 0,-2,-1, 0,-1,-1,-1,-2,-4,-1,-1,-1, 1, 0, 0, 0,-3, 0,-2,-1},
+{-2, 4,-3, 4, 1,-3,-1, 0,-3,-1, 0,-4,-3, 3,-4,-2, 0,-1, 0,-1,-1,-3,-4,-1,-3, 1},
+{ 0,-3, 9,-3,-4,-2,-3,-3,-1,-2,-3,-1,-1,-3,-4,-3,-3,-3,-1,-1,-2,-1,-2,-2,-2,-3},
+{-2, 4,-3, 6, 2,-3,-1,-1,-3,-1,-1,-4,-3, 1,-4,-1, 0,-2, 0,-1,-1,-3,-4,-1,-3, 1},
+{-1, 1,-4, 2, 5,-3,-2, 0,-3,-1, 1,-3,-2, 0,-4,-1, 2, 0, 0,-1,-1,-2,-3,-1,-2, 4},
+{-2,-3,-2,-3,-3, 6,-3,-1, 0,-1,-3, 0, 0,-3,-4,-4,-3,-3,-2,-2,-1,-1, 1,-1, 3,-3},
+{ 0,-1,-3,-1,-2,-3, 6,-2,-4,-1,-2,-4,-3, 0,-4,-2,-2,-2, 0,-2,-1,-3,-2,-1,-3,-2},
+{-2, 0,-3,-1, 0,-1,-2, 8,-3,-1,-1,-3,-2, 1,-4,-2, 0, 0,-1,-2,-1,-3,-2,-1, 2, 0},
+{-1,-3,-1,-3,-3, 0,-4,-3, 4,-1,-3, 2, 1,-3,-4,-3,-3,-3,-2,-1,-1, 3,-3,-1,-1,-3},
+{ 0,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-4,-2,-1,-1, 0, 0,-1,-1,-2,-1,-1,-1},
+{-1, 0,-3,-1, 1,-3,-2,-1,-3,-1, 5,-2,-1, 0,-4,-1, 1, 2, 0,-1,-1,-2,-3,-1,-2, 1},
+{-1,-4,-1,-4,-3, 0,-4,-3, 2,-1,-2, 4, 2,-3,-4,-3,-2,-2,-2,-1,-1, 1,-2,-1,-1,-3},
+{-1,-3,-1,-3,-2, 0,-3,-2, 1,-1,-1, 2, 5,-2,-4,-2, 0,-1,-1,-1,-1, 1,-1,-1,-1,-1},
+{-2, 3,-3, 1, 0,-3, 0, 1,-3,-1, 0,-3,-2, 6,-4,-2, 0, 0, 1, 0,-1,-3,-4,-1,-2, 0},
+{-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,-2,-3,-1,-1,-4,-2,-2,-3,-2,-1,-3,-2,-2,-4, 7,-1,-2,-1,-1,-2,-2,-4,-2,-3,-1},
+{-1, 0,-3, 0, 2,-3,-2, 0,-3,-1, 1,-2, 0, 0,-4,-1, 5, 1, 0,-1,-1,-2,-2,-1,-1, 3},
+{-1,-1,-3,-2, 0,-3,-2, 0,-3,-1, 2,-2,-1, 0,-4,-2, 1, 5,-1,-1,-1,-3,-3,-1,-2, 0},
+{ 1, 0,-1, 0, 0,-2, 0,-1,-2, 0, 0,-2,-1, 1,-4,-1, 0,-1, 4, 1, 0,-2,-3, 0,-2, 0},
+{ 0,-1,-1,-1,-1,-2,-2,-2,-1, 0,-1,-1,-1, 0,-4,-1,-1,-1, 1, 5, 0, 0,-2, 0,-2,-1},
+{ 0,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-4,-2,-1,-1, 0, 0,-1,-1,-2,-1,-1,-1},
+{ 0,-3,-1,-3,-2,-1,-3,-3, 3,-1,-2, 1, 1,-3,-4,-2,-2,-3,-2, 0,-1, 4,-3,-1,-1,-2},
+{-3,-4,-2,-4,-3, 1,-2,-2,-3,-2,-3,-2,-1,-4,-4,-4,-2,-3,-3,-2,-2,-3,11,-2, 2,-3},
+{ 0,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-4,-2,-1,-1, 0, 0,-1,-1,-2,-1,-1,-1},
+{-2,-3,-2,-3,-2, 3,-3, 2,-1,-1,-2,-1,-1,-2,-4,-3,-1,-2,-2,-2,-1,-1, 2,-1, 7,-2},
+{-1, 1,-3, 1, 4,-3,-2, 0,-3,-1, 1,-3,-1, 0,-4,-1, 3, 0, 0,-1,-1,-2,-3,-1,-2, 4}
+},{
+//A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+{ 5,-2,-1,-2,-1,-3, 0,-2,-2,-1,-1,-2,-1,-2,-6,-1,-1,-2, 1, 0,-1, 0,-3,-1,-2,-1},
+{-2, 4,-4, 4, 1,-4,-1,-1,-4,-2,-1,-4,-3, 4,-6,-2, 0,-2, 0,-1,-2,-4,-5,-2,-3, 0},
+{-1,-4, 9,-4,-5,-3,-4,-4,-2,-3,-4,-2,-2,-3,-6,-4,-4,-4,-2,-1,-3,-1,-3,-3,-3,-4},
+{-2, 4,-4, 6, 1,-4,-2,-2,-4,-2,-1,-5,-4, 1,-6,-2,-1,-2,-1,-1,-2,-4,-6,-2,-4, 1},
+{-1, 1,-5, 1, 6,-4,-3, 0,-4,-1, 1,-4,-2,-1,-6,-2, 2,-1, 0,-1,-1,-3,-4,-1,-3, 4},
+{-3,-4,-3,-4,-4, 6,-4,-2,-1,-2,-4, 0, 0,-4,-6,-4,-4,-4,-3,-2,-2,-1, 0,-2, 3,-4},
+{ 0,-1,-4,-2,-3,-4, 6,-3,-5,-2,-2,-4,-4,-1,-6,-3,-2,-3,-1,-2,-2,-4,-4,-2,-4,-3},
+{-2,-1,-4,-2, 0,-2,-3, 8,-4,-2,-1,-3,-2, 0,-6,-3, 1, 0,-1,-2,-2,-4,-3,-2, 2, 0},
+{-2,-4,-2,-4,-4,-1,-5,-4, 5,-2,-3, 1, 1,-4,-6,-4,-3,-3,-3,-1,-2, 3,-3,-2,-2,-4},
+{-1,-2,-3,-2,-1,-2,-2,-2,-2,-1,-1,-2,-1,-1,-6,-2,-1,-1,-1,-1,-1,-1,-3,-1,-2,-1},
+{-1,-1,-4,-1, 1,-4,-2,-1,-3,-1, 5,-3,-2, 0,-6,-1, 1, 2,-1,-1,-1,-3,-4,-1,-3, 1},
+{-2,-4,-2,-5,-4, 0,-4,-3, 1,-2,-3, 4, 2,-4,-6,-3,-3,-3,-3,-2,-2, 1,-2,-2,-2,-3},
+{-1,-3,-2,-4,-2, 0,-4,-2, 1,-1,-2, 2, 6,-3,-6,-3, 0,-2,-2,-1,-1, 1,-2,-1,-2,-2},
+{-2, 4,-3, 1,-1,-4,-1, 0,-4,-1, 0,-4,-3, 6,-6,-3, 0,-1, 0, 0,-1,-4,-4,-1,-3, 0},
+{-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6, 4,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6},
+{-1,-2,-4,-2,-2,-4,-3,-3,-4,-2,-1,-3,-3,-3,-6, 8,-2,-2,-1,-2,-2,-3,-5,-2,-4,-2},
+{-1, 0,-4,-1, 2,-4,-2, 1,-3,-1, 1,-3, 0, 0,-6,-2, 6, 1, 0,-1,-1,-3,-3,-1,-2, 3},
+{-2,-2,-4,-2,-1,-4,-3, 0,-3,-1, 2,-3,-2,-1,-6,-2, 1, 6,-1,-1,-1,-3,-4,-1,-3, 0},
+{ 1, 0,-2,-1, 0,-3,-1,-1,-3,-1,-1,-3,-2, 0,-6,-1, 0,-1, 5, 1,-1,-2,-4,-1,-2, 0},
+{ 0,-1,-1,-1,-1,-2,-2,-2,-1,-1,-1,-2,-1, 0,-6,-2,-1,-1, 1, 5,-1, 0,-4,-1,-2,-1},
+{-1,-2,-3,-2,-1,-2,-2,-2,-2,-1,-1,-2,-1,-1,-6,-2,-1,-1,-1,-1,-1,-1,-3,-1,-2,-1},
+{ 0,-4,-1,-4,-3,-1,-4,-4, 3,-1,-3, 1, 1,-4,-6,-3,-3,-3,-2, 0,-1, 4,-3,-1,-2,-3},
+{-3,-5,-3,-6,-4, 0,-4,-3,-3,-3,-4,-2,-2,-4,-6,-5,-3,-4,-4,-4,-3,-3,11,-3, 2,-4},
+{-1,-2,-3,-2,-1,-2,-2,-2,-2,-1,-1,-2,-1,-1,-6,-2,-1,-1,-1,-1,-1,-1,-3,-1,-2,-1},
+{-2,-3,-3,-4,-3, 3,-4, 2,-2,-2,-3,-2,-2,-3,-6,-4,-2,-3,-2,-2,-2,-2, 2,-2, 7,-3},
+{-1, 0,-4, 1, 4,-4,-3, 0,-4,-1, 1,-3,-2, 0,-6,-2, 3, 0, 0,-1,-1,-3,-4,-1,-3, 4}
+}};
+
+#endif // #ifndef __SW_ALIGNSCORE_HH
diff --git a/src/Experimental/tigrinc.cc b/src/Experimental/tigrinc.cc
new file mode 100644
index 0000000..c4585bc
--- /dev/null
+++ b/src/Experimental/tigrinc.cc
@@ -0,0 +1,237 @@
+#include "tigrinc.hh"
+
+
+FILE * File_Open (const char * Filename, const char * Mode)
+
+/* Open Filename in Mode and return a pointer to its control
+* block. If fail, print a message and exit. */
+
+ {
+ FILE * fp;
+
+ fp = fopen (Filename, Mode);
+ if (fp == NULL)
+ {
+ fprintf (stderr, "ERROR: Could not open file %s \n", Filename);
+ exit (EXIT_FAILURE);
+ }
+
+ return fp;
+ }
+
+
+
+#if 0
+void * Safe_calloc (size_t N, size_t Len)
+
+/* Allocate and return a pointer to an array of N elements of
+* Len bytes each. All set to 0. Exit if fail. */
+
+ {
+ void * P;
+
+ P = calloc (N, Len);
+ if (P == NULL)
+ {
+ fprintf (stderr,
+ "ERROR: calloc failed, there is not enough memory\n");
+ exit (EXIT_FAILURE);
+ }
+
+ return P;
+ }
+#endif
+
+
+
+void * Safe_malloc (size_t Len)
+
+/* Allocate and return a pointer to Len bytes of memory.
+* Exit if fail. */
+
+ {
+ void * P;
+
+ P = malloc (Len);
+ if (P == NULL)
+ {
+ fprintf (stderr,
+ "ERROR: malloc failed, there is not enough memory\n");
+ exit (EXIT_FAILURE);
+ }
+
+ return P;
+ }
+
+
+
+void * Safe_realloc (void * Q, size_t Len)
+
+/* Reallocate memory for Q to Len bytes and return a
+* pointer to the new memory. Exit if fail. */
+
+ {
+ void * P;
+
+ P = realloc (Q, Len);
+ if (P == NULL)
+ {
+ fprintf (stderr,
+ "ERROR: realloc failed, there is not enough memory\n");
+ exit (EXIT_FAILURE);
+ }
+
+ return P;
+ }
+
+
+#if 0
+
+char Complement (char Ch)
+
+/* Returns the DNA complement of Ch . */
+
+ {
+ switch (tolower (Ch))
+ {
+ case 'a' :
+ return 't';
+ case 'c' :
+ return 'g';
+ case 'g' :
+ return 'c';
+ case 't' :
+ return 'a';
+ case 'r' : // a or g
+ return 'y';
+ case 'y' : // c or t
+ return 'r';
+ case 's' : // c or g
+ return 's';
+ case 'w' : // a or t
+ return 'w';
+ case 'm' : // a or c
+ return 'k';
+ case 'k' : // g or t
+ return 'm';
+ case 'b' : // c, g or t
+ return 'v';
+ case 'd' : // a, g or t
+ return 'h';
+ case 'h' : // a, c or t
+ return 'd';
+ case 'v' : // a, c or g
+ return 'b';
+ default : // anything
+ return tolower (Ch);
+ }
+ }
+
+#endif
+
+
+int Read_String (FILE * fp, char * & T, long int & Size, char Name [],
+ int Partial)
+
+/* Read next string from fp (assuming FASTA format) into T [1 ..]
+* which has Size characters. Allocate extra memory if needed
+* and adjust Size accordingly. Return TRUE if successful, FALSE
+* otherwise (e.g., EOF). Partial indicates if first line has
+* numbers indicating a subrange of characters to read.
+*/
+
+ {
+ char * P, Line [MAX_LINE];
+ long int Len, Lo, Hi;
+ int Ch, Ct;
+
+ while ((Ch = fgetc (fp)) != EOF && Ch != '>')
+ ;
+
+ if (Ch == EOF)
+ return FALSE;
+
+ fgets (Line, MAX_LINE, fp);
+ Len = strlen (Line);
+ assert (Len > 0 && Line [Len - 1] == '\n');
+ P = strtok (Line, " \t\n");
+ if (P != NULL)
+ strcpy (Name, P);
+ else
+ Name [0] = '\0';
+ Lo = 0; Hi = LONG_MAX;
+ if (Partial)
+ {
+ P = strtok (NULL, " \t\n");
+ if (P != NULL)
+ {
+ Lo = strtol (P, NULL, 10);
+ P = strtok (NULL, " \t\n");
+ if (P != NULL)
+ Hi = strtol (P, NULL, 10);
+ }
+ assert (Lo <= Hi);
+ }
+
+ Ct = 0;
+ T [0] = '\0';
+ Len = 1;
+ while ((Ch = fgetc (fp)) != EOF && Ch != '>')
+ {
+ if (isspace (Ch))
+ continue;
+
+ Ct ++;
+ if (Ct < Lo || Ct > Hi)
+ continue;
+
+ if (Len >= Size)
+ {
+ Size += INCR_SIZE;
+ T = (char *) Safe_realloc (T, Size);
+ }
+ Ch = tolower (Ch);
+
+ if (! isalpha (Ch) && Ch != '*')
+ {
+ fprintf (stderr, "Unexpected character `%c\' in string %s\n",
+ Ch, Name);
+ Ch = 'x';
+ }
+
+ T [Len ++] = Ch;
+ }
+
+ T [Len] = '\0';
+ if (Ch == '>')
+ ungetc (Ch, fp);
+
+ return TRUE;
+ }
+
+
+#if 0
+
+void Reverse_Complement
+ (char S [], long int Lo, long int Hi)
+
+// Convert substring S [Lo .. Hi] to its Watson-Crick reverse
+// complement
+
+ {
+ char Ch;
+
+ while (Lo <= Hi)
+ {
+ Ch = S [Hi];
+ S [Hi] = Complement (S [Lo]);
+ S [Lo] = Complement (Ch);
+ Lo ++;
+ Hi --;
+ }
+
+ return;
+ }
+
+
+#endif
diff --git a/src/Experimental/tigrinc.hh b/src/Experimental/tigrinc.hh
new file mode 100644
index 0000000..6f6c72c
--- /dev/null
+++ b/src/Experimental/tigrinc.hh
@@ -0,0 +1,41 @@
+#ifndef __TIGRINC_HH
+#define __TIGRINC_HH
+
+
+#include <cstdio>
+#include <cstdlib>
+#include <cmath>
+#include <cstring>
+#include <cctype>
+#include <climits>
+#include <cfloat>
+#include <ctime>
+#include <cassert>
+#include <cerrno>
+#include <unistd.h>
+
+
+#define TRUE 1
+#define FALSE 0
+#ifndef EXIT_FAILURE
+ #define EXIT_FAILURE -1
+#endif
+#ifndef EXIT_SUCCESS
+ #define EXIT_SUCCESS 0
+#endif
+
+#define INCR_SIZE 10000
+#define SMALL_INIT_SIZE 100
+#define INIT_SIZE 10000
+#define MAX_LINE 1024
+
+
+FILE * File_Open (const char *, const char *);
+//void * Safe_calloc (size_t, size_t);
+void * Safe_malloc (size_t);
+void * Safe_realloc (void *, size_t);
+//char Complement (char);
+int Read_String (FILE *, char * &, long int &, char [], int);
+//void Reverse_Complement (char S [], long int Lo, long int Hi);
+
+#endif
diff --git a/src/Experimental/trimContig.cc b/src/Experimental/trimContig.cc
new file mode 100644
index 0000000..3a009d0
--- /dev/null
+++ b/src/Experimental/trimContig.cc
@@ -0,0 +1,171 @@
+
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+#include "ContigUtils.hh"
+
+using namespace AMOS;
+using namespace std;
+
+bool trimContig(int cleancontig, int lengthtrim, int lefttrim, int righttrim, Contig_t & contig)
+{
+ bool retval = false;
+
+ if (cleancontig)
+ {
+ vector<Tile_t> & tiling = contig.getReadTiling();
+
+ if (tiling.size() > 1)
+ {
+ int leftmost = contig.getLength(), secondleft = contig.getLength();
+ int rightmost = 0, secondright = 0;
+
+ vector<Tile_t>::iterator ti;
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ int loffset = ti->offset;
+ int roffset = ti->getRightOffset();
+
+ if (loffset < leftmost) { secondleft = leftmost; leftmost = loffset; }
+ else if (loffset < secondleft) { secondleft = loffset; }
+
+ if (roffset > rightmost) { secondright = rightmost; rightmost = roffset; }
+ else if (roffset > secondright) { secondright = roffset; }
+ }
+
+ lefttrim = secondleft - leftmost;
+ righttrim = rightmost - secondright;
+ }
+ }
+
+ if (lengthtrim || righttrim || lefttrim)
+ {
+ // trim right first so we don't have to shift trim after left trim
+ if (lengthtrim) { lengthTrimContig(contig, lengthtrim); }
+ if (righttrim) { rightTrimContig(contig, righttrim); }
+ if (lefttrim) { leftTrimContig(contig, lefttrim); }
+
+ retval = true;
+ }
+
+ return retval;
+}
+
+
+int main (int argc, char ** argv)
+{
+ int lefttrim(0);
+ int righttrim(0);
+ int lengthtrim(0);
+ int contigiid(0);
+ int cleancontig(0);
+ int cleanall(0);
+ string contigeid;
+
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Trim a contig by removing a specified number of bases from either the left\n"
+"or right end of the contig. Reads that span the trim regions will either\n"
+"have their clear range adjusted or be entirely removed from the tiling as\n"
+"appropriate.\n"
+"\n"
+" Usage: trimContig [options] bnk\n"
+"\n"
+" -L <val> Trim val bases from left side\n"
+" -R <val> Trim val bases from right side\n"
+" -N <val> Right trim contig to new length\n"
+" -c Clean contigs by trimming 1x coverage at ends\n"
+" -E id EID of contig to trim\n"
+" -I id IID of contig to trim\n"
+" -C Clean all contigs\n";
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+ tf->getOptions()->addOptionResult("L=i", &lefttrim, "Left trim amount");
+ tf->getOptions()->addOptionResult("R=i", &righttrim, "Right trim amount");
+ tf->getOptions()->addOptionResult("N=i", &lengthtrim, "New Contig Length");
+ tf->getOptions()->addOptionResult("c", &cleancontig, "Clean Contig");
+ tf->getOptions()->addOptionResult("C", &cleanall, "Clean All");
+
+ tf->getOptions()->addOptionResult("I=i", &contigiid, "Contig IID");
+ tf->getOptions()->addOptionResult("E=s", &contigeid, "Contig EID");
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() != 1)
+ {
+ cerr << "Usage: trimContig [options] bankname" << endl;
+ return EXIT_FAILURE;
+ }
+
+ string bankname = argvv.front(); argvv.pop_front();
+ Bank_t contig_bank(Contig_t::NCODE);
+
+ cerr << "Processing " << bankname << " at " << Date() << endl;
+
+ contig_bank.open(bankname, B_READ|B_WRITE);
+ Contig_t contig;
+
+ if (cleanall)
+ {
+ const IDMap_t & map = contig_bank.getIDMap();
+ IDMap_t::const_iterator ci;
+ for (ci = map.begin(); ci != map.end(); ci++)
+ {
+ contig_bank.fetch(ci->iid, contig);
+ if (trimContig(1,0,0,0,contig))
+ {
+ contig_bank.replace(ci->iid, contig);
+ }
+ }
+ }
+ else
+ {
+ if (!contigeid.empty()) { contig_bank.fetch(contigeid, contig); }
+ else { contig_bank.fetch(contigiid, contig); }
+
+ if (trimContig(cleancontig, lengthtrim, lefttrim, righttrim, contig))
+ {
+ contig_bank.replace(contig.getIID(), contig);
+ }
+ }
+
+ contig_bank.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return retval;
+}
diff --git a/src/Experimental/zipContigs.cc b/src/Experimental/zipContigs.cc
new file mode 100644
index 0000000..e5d26ec
--- /dev/null
+++ b/src/Experimental/zipContigs.cc
@@ -0,0 +1,572 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+
+using namespace AMOS;
+using namespace std;
+
+int m_alignStart(0);
+string m_queryGaps("");
+string m_referenceGaps("");
+int m_promoteAlignmentGaps(1);
+int m_reverseQuery(0);
+int m_ungappedCoordinates(0);
+int m_gapCoordinateOffset(0);
+int m_referenceConsensus(0);
+
+
+typedef map<int, int> GapMap;
+GapMap m_referenceGapMap;
+GapMap m_queryGapMap;
+
+int getGapCount(bool isReference, int gpos, int upos)
+{
+ int retval = 0;
+ GapMap::iterator i;
+
+ int location = (m_ungappedCoordinates) ? upos : gpos;
+
+ if (isReference)
+ {
+ i = m_referenceGapMap.find(location);
+
+ if (i != m_referenceGapMap.end())
+ {
+ retval = i->second;
+ i->second = 0;
+ }
+ }
+ else
+ {
+ i = m_queryGapMap.find(location);
+
+ if (i != m_queryGapMap.end())
+ {
+ retval = i->second;
+ i->second = 0;
+ }
+ }
+
+ return retval;
+}
+
+void addGap(int gappos, GapMap & gapmap)
+{
+ gappos -= m_gapCoordinateOffset;
+ gappos++;
+
+ cerr << "Adding " << gappos << " (0-based) to gapmap" << endl;
+
+ GapMap::iterator gi = gapmap.find(gappos);
+
+ if (gi != gapmap.end())
+ {
+ gi->second++;
+ }
+ else
+ {
+ gapmap[gappos] = 1;
+ }
+}
+
+
+void loadGaps(const string & gaplist, GapMap & gapmap)
+{
+ // Split the gaplist on ',', load each into the gapmap
+
+ std::string::size_type index = 0;
+ std::string::size_type splitIndex;
+ int gappos;
+
+ while ((splitIndex = gaplist.find(',', index)) != gaplist.npos)
+ {
+ gappos = atoi(gaplist.substr(index, splitIndex - index).c_str());
+ addGap(gappos, gapmap);
+ index = splitIndex + 1;
+ }
+
+ gappos = atoi(gaplist.substr(index,
+ gaplist.length() - index + 1).c_str());
+ addGap(gappos, gapmap);
+}
+
+
+
+
+
+
+
+int main (int argc, char ** argv)
+{
+
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Zip together a query contig onto a reference contig. The beginning\n"
+"of the alignment is specified with -O, and gaps can be inserted into both\n"
+"contigs files using -r and -q.\n"
+"\n"
+" Usage: zipContigs [options] bnk qryeid refeid joineid\n"
+"\n"
+" bnk Name of bank to find contigs\n"
+" qryeid Eid of query (typically smaller than reference)\n"
+" refeid Eid of reference contig\n"
+" joineid Eid to assign to zipped contig\n"
+"\n"
+" Options\n"
+" ----------------\n"
+" -R Query should be reversed before merging\n"
+" -1 Coordinates of gaps are 1-based\n"
+" -U Coordinates of gaps to insert are ungapped\n"
+" -p Automatically promote preexisting gaps\n"
+" --refcons Use the consensus of the reference for merged slices\n"
+" (Uses the query consensus by default)\n"
+"\n"
+" -q <csl> Comma separated list of positions to insert gaps in the query\n"
+" -r <csl> Comma separated list of positions to insert gaps in the reference\n"
+"\n"
+" -O <offset> Specify alignment offset from query to reference\n"
+" (negative means reference left flanks query (always 0-based))\n";
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+ tf->getOptions()->addOptionResult("O|alignmentoffset=i", &m_alignStart,
+ "Specify alignment offset from query to reference\n negative means reference left flanks query (always 0-based)");
+
+ tf->getOptions()->addOptionResult("q|querygaps=s", &m_queryGaps,
+ "Specify gaps in query slices");
+
+ tf->getOptions()->addOptionResult("r|referencegaps=s", &m_referenceGaps,
+ "Specify gaps in reference slices");
+
+ tf->getOptions()->addOptionResult("p|promoteAlignmentGaps!", &m_promoteAlignmentGaps,
+ "Toggle if alignment gaps should automatically be promoted");
+
+ tf->getOptions()->addOptionResult("R|reversequery!", &m_reverseQuery,
+ "Query should be reversed before merging");
+
+ tf->getOptions()->addOptionResult("U|ungapped!", &m_ungappedCoordinates,
+ "Coordinates are all ungapped");
+
+ tf->getOptions()->addOptionResult("1", &m_gapCoordinateOffset,
+ "Coordinates of gaps are 1-based");
+
+ tf->getOptions()->addOptionResult("refcons", &m_referenceConsensus,
+ "Use the consensus of the reference for the merged slices");
+
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() != 4)
+ {
+ cerr << "Usage: zipcontigs [options] bankname refeid qryeid joineid" << endl;
+ return EXIT_FAILURE;
+ }
+
+ string bankname = argvv.front(); argvv.pop_front();
+ string qryeid = argvv.front(); argvv.pop_front();
+ string refeid = argvv.front(); argvv.pop_front();
+ string jeid = argvv.front(); argvv.pop_front();
+
+ Bank_t contig_bank(Contig_t::NCODE);
+
+ cerr << "Processing " << bankname << endl;
+
+ contig_bank.open(bankname, B_READ|B_WRITE);
+ ID_t jiid = contig_bank.getMaxIID()+1;
+
+ Contig_t rcontig, qcontig;
+
+ contig_bank.fetch(refeid, rcontig);
+ contig_bank.fetch(qryeid, qcontig);
+
+ cerr << "Ref: " << refeid << " len: " << rcontig.getLength() << endl;
+ cerr << "Qry: " << qryeid << " len: " << qcontig.getLength() << endl;
+
+ cerr << " m_alignStart(0)=" << m_alignStart << endl;
+ cerr << " m_queryGaps(\"\")=" << m_queryGaps<< endl;
+ cerr << " m_referenceGaps(\"\")=" << m_referenceGaps<< endl;
+ cerr << " m_promoteAlignmentGaps(0)=" << m_promoteAlignmentGaps<< endl;
+ cerr << " m_reverseQuery(0)=" << m_reverseQuery<< endl;
+ cerr << " m_ungappedCoordinates(0)=" << m_ungappedCoordinates<< endl;
+ cerr << " m_gapCoordinateOffset(0)=" << m_gapCoordinateOffset<< endl;
+ cerr << " m_referenceConsensus(0)=" << m_referenceConsensus<< endl;
+
+ if (!m_queryGaps.empty())
+ {
+ cerr << "Loading Query Gaps"
+ << (m_reverseQuery ? "(reversed)" : "") << endl;
+ loadGaps(m_queryGaps, m_queryGapMap);
+ }
+
+ if (!m_referenceGaps.empty())
+ {
+ cerr << "Loading Reference Gaps" << endl;
+ loadGaps(m_referenceGaps, m_referenceGapMap);
+ }
+
+
+ if (m_reverseQuery)
+ {
+ cerr << "Reversing query\n";
+ qcontig.reverseComplement();
+ }
+
+ string rcons(rcontig.getSeqString());
+ string qcons(qcontig.getSeqString());
+
+ Pos_t rgindex = 0;
+ Pos_t qgindex = 0;
+
+ if (m_alignStart < 0)
+ {
+ if (m_ungappedCoordinates)
+ {
+ m_alignStart = -rcontig.ungap2gap(-m_alignStart);
+ }
+
+ rgindex = -m_alignStart;
+ }
+ else if (m_alignStart > 0)
+ {
+ if (m_ungappedCoordinates)
+ {
+ m_alignStart = qcontig.ungap2gap(m_alignStart);
+ }
+
+ qgindex = m_alignStart;
+ }
+
+ vector <Pos_t> rinsert;
+ vector <Pos_t> qinsert;
+
+ int rlen = rcons.length();
+ int qlen = qcons.length();
+
+
+ while (rgindex < rlen && qgindex < qlen)
+ {
+ int ruindex = rcontig.gap2ungap(rgindex);
+ int quindex = qcontig.gap2ungap(qgindex);
+
+ int rgaps = getGapCount(true, rgindex, ruindex);
+ int qgaps = getGapCount(false, qgindex, quindex);
+
+ char r = rcons[rgindex];
+ char q = qcons[qgindex];
+
+ if (rgaps && qgaps)
+ {
+ cerr << "Error: gap specified at same location r:" << rgindex
+ << " q: " << qgindex << endl;
+
+ throw "err";
+ }
+
+ if (rgaps || qgaps)
+ {
+ while (rgaps)
+ {
+ if (m_promoteAlignmentGaps && q == '-' && r == '-')
+ {
+ // Let gaps zip together, doesn't help rgaps
+ rgindex++;
+ qgindex++;
+ cerr << "-";
+ }
+ else if (m_promoteAlignmentGaps && q == '-' && r != '-')
+ {
+ // extra gap to promote
+ qgindex++;
+ cerr << 'r';
+ rinsert.push_back(rgindex);
+ }
+ else if (m_promoteAlignmentGaps && r == '-' && q != '-')
+ {
+ // count this preexisting gap towards rgaps
+ rgindex++;
+ qgindex++;
+ rgaps--;
+ }
+ else
+ {
+ // ordinary gap to insert
+ cerr << 'R';
+ qgindex++;
+ rgaps--;
+ rinsert.push_back(rgindex);
+ }
+
+ q = qcons[qgindex];
+ r = rcons[rgindex];
+ }
+
+ while (qgaps)
+ {
+ if (m_promoteAlignmentGaps && q == '-' && r == '-')
+ {
+ // Let gaps zip together, doesn't help rgaps
+ rgindex++;
+ qgindex++;
+ cerr << "-";
+ }
+ else if (m_promoteAlignmentGaps && r == '-' && q != '-')
+ {
+ // extra gap to promote
+ rgindex++;
+ cerr << 'q';
+ qinsert.push_back(qgindex);
+ }
+ else if (m_promoteAlignmentGaps && q == '-' && r != '-')
+ {
+ // count this preexisting gap towards qgaps
+ rgindex++;
+ qgindex++;
+ qgaps--;
+ }
+ else
+ {
+ // ordinary gap to insert
+ cerr << 'Q';
+ rgindex++;
+ qgaps--;
+ qinsert.push_back(qgindex);
+ }
+
+ q = qcons[qgindex];
+ r = rcons[rgindex];
+ }
+ }
+ else if (r == '-' && q == '-')
+ {
+ // Let gaps zip together
+ rgindex++;
+ qgindex++;
+ cerr << "-";
+ }
+ else if (m_promoteAlignmentGaps && r == '-')
+ {
+ qinsert.push_back(qgindex);
+ rgindex++;
+ cerr << "q";
+ }
+ else if (m_promoteAlignmentGaps && q == '-')
+ {
+ rinsert.push_back(rgindex);
+ qgindex++;
+ cerr << "r";
+ }
+ else
+ {
+ rgindex++;
+ qgindex++;
+ cerr << ".";
+ }
+ }
+
+ cerr << endl;
+
+
+ // Apply Gaps
+
+ cerr << "Applying " << rinsert.size() << " reference gaps:";
+ vector <Pos_t>::reverse_iterator gi;
+ for (gi = rinsert.rbegin(); gi != rinsert.rend(); gi++)
+ {
+ cerr << " " << *gi;
+ rcontig.insertGapColumn(*gi);
+ }
+ cerr << endl;
+
+ cerr << "Applying " << qinsert.size() << " query gaps:";
+ for (gi = qinsert.rbegin(); gi != qinsert.rend(); gi++)
+ {
+ cerr << " " << *gi;
+ qcontig.insertGapColumn(*gi);
+ }
+ cerr << endl;
+
+ // Merge Tilings into rcontig
+ vector<Tile_t> & rtiling = rcontig.getReadTiling();
+ vector<Tile_t> & qtiling = qcontig.getReadTiling();
+ vector<Tile_t>::iterator ti;
+
+ if (m_alignStart > 0)
+ {
+ cerr << "Shifting reference reads by " << m_alignStart << endl;
+ for (ti = rtiling.begin(); ti != rtiling.end(); ti++)
+ {
+ ti->offset += m_alignStart;
+ }
+ }
+
+ cerr << "Merging " << qtiling.size() << " query reads" << endl;
+
+ // shift query reads if reference left flanks
+ int shift = 0;
+ if (m_alignStart < 0)
+ {
+ shift = -m_alignStart;
+ cerr << "And shift query by " << shift << endl;
+ }
+
+ for (ti = qtiling.begin(); ti != qtiling.end(); ti++)
+ {
+ ti->offset += shift;
+ rtiling.push_back(*ti);
+ }
+
+ cerr << "Concatenating consensus: ";
+
+ // Concatenate new consensus
+ rcons = rcontig.getSeqString();
+ string rqual = rcontig.getQualString();
+ rlen = rcons.length();
+ int rstart = 0;
+ int rend = rlen-1;
+
+ qcons = qcontig.getSeqString();
+ string qqual = qcontig.getQualString();
+ qlen = qcons.length();
+ int qstart = 0;
+ int qend = qlen-1;
+
+ string cons;
+ string qual;
+
+ int alignstart = abs(m_alignStart);
+ int alignend = 0;
+ int aligndist = 0;
+
+
+ // left flank
+
+ if (m_alignStart > 0)
+ {
+ // query left flank
+ cerr << "1Q(" << alignstart << ")";
+ cons = qcons.substr(0, alignstart);
+ qual = qqual.substr(0, alignstart);
+
+ qstart = alignstart;
+ rend += alignstart;
+ }
+ else if (m_alignStart < 0)
+ {
+ //reference left flank
+ cerr << "1R(" << alignstart << ")";
+ cons = rcons.substr(0, alignstart);
+ qual = rqual.substr(0, alignstart);
+
+ //cerr << "\"" << rcons.substr(0, alignstart) << "\"";
+
+ rstart = alignstart;
+ qend += alignstart;
+ }
+
+ // overlap
+
+ // {r,q}start is relative to the sequence
+ // alignstart, alignend, {r,q}end are global coordinates
+ alignend = (rend < qend) ? rend : qend;
+
+ // cerr << endl;
+ // cerr << "alignstart: " << alignstart << "alignend: " << alignend << endl;
+ // cerr << "rstart: " << rstart << " rend: " << rend << " rlen: " << rlen << endl;
+ // cerr << "qstart: " << qstart << " qend: " << qend << " qlen: " << qlen << endl;
+
+ aligndist = alignend-alignstart+1;
+
+ if (aligndist <= 0)
+ {
+ AMOS_THROW_ARGUMENT("No overlap between Contigs!");
+ }
+
+ if (m_referenceConsensus)
+ {
+ cerr << "2R(" << aligndist << ")";
+
+ cons += rcons.substr(rstart, aligndist);
+ qual += rqual.substr(rstart, aligndist);
+ }
+ else
+ {
+ cerr << "2Q(" << aligndist << ")";
+
+ cons += qcons.substr(qstart, aligndist);
+ qual += qqual.substr(qstart, aligndist);
+
+ //cerr << "\"" << qcons.substr(qstart, aligndist) << "\"";
+ }
+
+
+ // right flank
+
+ if (rend > alignend)
+ {
+ //reference right flank
+ int dist = rend - alignend;
+ cerr << "3R(" << dist << ")";
+
+ cons += rcons.substr(rlen - dist, dist);
+ qual += rqual.substr(rlen - dist, dist);
+ }
+ else if (qend > alignend)
+ {
+ // query right flank
+ int dist = qend - alignend;
+ cerr << "3Q(" << dist << ")";
+
+ //cerr << "\"" << qcons.substr(qlen-dist, dist) << "\"";
+
+ cons += qcons.substr(qlen - dist, dist);
+ qual += qqual.substr(qlen - dist, dist);
+ }
+
+ cerr << endl;
+
+ rcontig.setSequence(cons, qual);
+
+ // save to bank, rcontig gets new name
+ rcontig.setIID(jiid);
+ rcontig.setEID(jeid);
+
+ cerr << "Appending iid: " << jiid << " eid: " << jeid << endl;
+ contig_bank.append(rcontig);
+ contig_bank.close();
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ return retval;
+}
diff --git a/src/Experimental/zipalign.pl b/src/Experimental/zipalign.pl
new file mode 100755
index 0000000..1d93ef9
--- /dev/null
+++ b/src/Experimental/zipalign.pl
@@ -0,0 +1,510 @@
+#!/usr/bin/perl -w
+
+use strict;
+use TIGR::Foundation;
+
+my $USAGE = "Usage: zipclap reference query [options]\n";
+my $HELPTEXT = qq~
+Zips together a query assembly onto a reference assembly.
+
+ $USAGE
+ reference and query can be either .contig or .slice files.
+
+ Options:
+ --------
+ -c <chain> specify alignment chain to use (DEFAULT 0)
+ -r <refshift> specify reference shift (DEFAULT 0)
+ -C Assume contig to be circular when converting to contig
+
+ -[no]contig [Don't] Create a contig file of result (DEFAULT: -contig)
+ -[no]tcov [Don't] Create a tcov file of result (DEFAULT: -tcov)
+ -[no]tasm [Don't] Create a tasm file of result (DEFAULT: -notasm)
+ -[no]fasta [Don't] Create a fasta file of result (DEFAULT: -nofasta)
+ -[no]recall [Don't] Recall the zipped consensus (DEFAULT: -norecall)'
+
+ -o <prefix> Specify prefix for out files (DEFAULT: zip)
+
+ -q <filename> Override snps file query fasta filename (DEPRECATED)
+
+ -v Toggle being more verbose
+
+The reference assembly is held "in place" and the query may be reverse
+complemented or shifted until it aligns well. Alignment gaps are determined
+by the snps file (ultimately via nucmer) and ensure the assemblies are aligned
+properly. If there are multiple alignments between the two contigs, select
+the desired alignment chain with '-c' (starting at 0).
+
+Alignment information is searched in the following order so that if you
+provide a snps file, then nothing else will be searched.
+ 1) outprefix.snps
+ 2) outprefix.aligns
+ 3) outprefix.delta
+ 4) nucmer
+~;
+
+my $VERSION = "Version 1.30 (Build " . (qw/$Revision$/ )[1] . ")";
+
+#my $platformbin = "/fs/sz-user-supported/Linux-i686/bin";
+my $platformbin = "/fs/sz-user-supported/Linux-x86_64/bin";
+my $commonbin = "/fs/sz-user-supported/common/bin";
+
+my $CAT = "/bin/cat";
+
+my $FINDSNPS = "$commonbin/findSNPs";
+my $SIZEFASTA = "$commonbin/sizeFasta";
+
+my $NUCMER = "$platformbin/nucmer";
+my $SHOWALIGNS = "$platformbin/show-aligns";
+
+my $BANK2CONTIG = "$platformbin/bank2contig";
+my $BANK2FASTA = "$platformbin/bank2fasta";
+my $ZIPCONTIGS = "$platformbin/zipContigs";
+
+
+my @DEPENDS =
+(
+ "TIGR::Foundation",
+ $FINDSNPS,
+ $NUCMER,
+ $SHOWALIGNS,
+ $SIZEFASTA,
+ $CAT,
+ $BANK2CONTIG,
+ $BANK2FASTA,
+ $ZIPCONTIGS,
+);
+
+my $tf = new TIGR::Foundation;
+my $doverbose = 0;
+
+sub echo
+{
+ my $str = join " ", @_;
+
+ $tf->logLocal($str, 4);
+ print @_ if ($doverbose);
+}
+
+sub runCmd
+{
+ my $cmd = shift;
+ my $info = shift;
+
+ echo "$info... " if defined $info;
+
+ my $exitcode = $tf->runCommand($cmd);
+
+ if ($exitcode)
+ {
+ echo "failed! ($!)\n" if defined $info;
+ $tf->bail("Error with $cmd ($exitcode)");
+ }
+
+ echo "ok.\n" if defined $info;
+}
+
+sub getSize
+{
+ my $id = shift;
+ my $cmd = "$SIZEFASTA $id";
+
+ $tf->logLocal("Running $cmd... ", 4);
+
+ my $out = `$cmd`;
+
+ $tf->bail("$cmd failed ($?)") if ($?);
+ $tf->logLocal("ok.", 4);
+
+ return (split /\s+/, $out)[1];
+}
+
+sub getFastaId
+{
+ my $fasta = shift;
+
+ my $id = undef;
+
+ echo "Getting fasta id from $fasta... ";
+
+ open FASTA, "< $fasta"
+ or $tf->bail("Couldn't open $fasta ($!)");
+
+ while (<FASTA>)
+ {
+ if (/^\>(\S+)/)
+ {
+ $id = $1;
+ last;
+ }
+ }
+
+ close FASTA;
+
+ $tf->bail("Couldn't find id in $fasta")
+ if (!defined $id);
+
+ echo "$id\n";
+
+ return $id;
+}
+
+
+
+sub loadSNPs
+{
+ my $snpfile = shift;
+ my $chain = shift;
+ my $refshift = shift;
+ my $queryfasta = shift;
+ my $docircular = shift;
+
+ my $reference = shift;
+ my $query = shift;
+ my $outprefix = shift;
+
+ open SNPFILE, "< $snpfile"
+ or $tf->bail("Couldn't open $snpfile ($!)");
+
+ my $foundchain = 0;
+ my $aligndata;
+ $aligndata->{offset} = 0;
+
+ ## fasta files are guaranteed to exist by slice2fasta
+ my $qsize = getSize("$query.fasta");
+ my $rsize = getSize("$reference.fasta");
+
+ echo "Loading $snpfile\n";
+ while (<SNPFILE>)
+ {
+ chomp;
+ my @values = split /, /, $_;
+
+ my $referencepath = $values[0];
+ my $referenceid = $values[1];
+ my $querypath = $values[2];
+ my $queryid = $values[3];
+ my $snpchain = $values[4];
+
+ next if ($snpchain ne $chain);
+
+ $querypath = $queryfasta if (defined $queryfasta);
+
+ $foundchain = 1;
+
+ my $diff = "Unknown Diff";
+
+ if (!exists $aligndata->{direction})
+ {
+ my $ralignstart = $values[5] - $refshift;
+ my $ralignend = $values[6] - $refshift;
+ my $qalignstart = $values[7];
+ my $qalignend = $values[8];
+ my $qdirection = $values[9];
+
+ $aligndata->{direction} = $qdirection;
+ $aligndata->{ralignend} = $ralignend;
+
+ if ($qdirection eq "R")
+ {
+ if ($ralignstart == 1)
+ {
+ $aligndata->{offset} = $qsize - $qalignstart;
+
+ my $o = $aligndata->{offset} + 1;
+ echo "Type I. qsize $qsize qalignstart $qalignstart ";
+ $diff = "RC Query, vi $outprefix.tcov. Jump to index $o (1U)";
+
+ if (!($ralignend == $rsize || $qalignend == 1))
+ {
+ $tf->bail("Type I Alignment chain does not fully specify alignment!");
+ }
+ }
+ elsif ($qalignstart == $qsize)
+ {
+ $aligndata->{offset} = 1-$ralignstart;
+
+ echo "Type II. ralignstart $ralignstart ";
+ $diff = "xxdiff $reference.tcov $outprefix.tcov";
+
+ if (!($ralignend == $rsize || $qalignend == 1))
+ {
+ $tf->bail("Type II Alignment chain does not fully specify alignment!");
+ }
+ }
+ else
+ {
+ $tf->bail("Unusable chain specified (expected rstart=1 or qstart=qsize for reversed query)");
+ }
+ }
+ else
+ {
+ if (($qalignstart == 1) || ($ralignstart == 1))
+ {
+ $aligndata->{offset} = $qalignstart - $ralignstart;
+
+ my $o = $aligndata->{offset};
+
+ $diff = ($o<0) ? $reference : $query;
+ $diff = "xxdiff $diff.tcov $outprefix.tcov";
+
+ echo "Type III. qalignstart $qalignstart ralignstart $ralignstart ";
+
+ if (!($ralignend == $rsize || $qalignend == $qsize))
+ {
+ $tf->bail("Type III Alignment chain does not fully specify alignment!");
+ }
+ }
+ else
+ {
+ $tf->bail("Unusable chain specified (expected rstart=1 or qstart=1 for forward query)");
+ }
+ }
+
+ echo "offset $aligndata->{offset} ($diff)\n";
+ }
+
+ my $rpos = $values[10]-$refshift;
+ my $qpos = $values[11];
+ my $poly = $values[12];
+ my $ptype = $values[14];
+
+ my $polylen = length($poly);
+
+ if ($ptype eq "I")
+ {
+ echo "Insert $polylen gaps in reference at $rpos\n";
+ $aligndata->{reference}->{$rpos} += $polylen;
+ }
+ elsif ($ptype eq "D")
+ {
+ echo "Insert $polylen gaps in query at $qpos\n";
+ $aligndata->{query}->{$qpos} += $polylen;
+ }
+ else
+ {
+ ## Allow snps to zip together
+ ## Nothing to do.
+ }
+ }
+
+ $tf->bail("Can't find requested chain ($chain)\n") if (!$foundchain);
+
+ ## Strip leading and trailing gaps (if not circular)
+ if (!$docircular)
+ {
+ if (exists $aligndata->{query})
+ {
+ my %qgaps = %{$aligndata->{query}};
+
+ if ($aligndata->{direction} eq 'F')
+ {
+ if (exists $qgaps{0})
+ {
+ ## leading gaps in the forward query
+ $aligndata->{offset} -= $qgaps{0};
+ $aligndata->{query}->{0} = 0;
+ }
+
+ if (exists $qgaps{$qsize})
+ {
+ ## trailing gaps in the forward query
+ $aligndata->{query}->{$qsize} = 0;
+ }
+ }
+ else
+ {
+ if (exists $qgaps{$qsize})
+ {
+ ## leading gaps in the rc query
+ $aligndata->{offset} -= $qgaps{$qsize};
+ $aligndata->{query}->{$qsize} = 0;
+ }
+
+ if (exists $qgaps{0})
+ {
+ ## trailing gaps in the rc query
+ $aligndata->{query}->{0} = 0;
+ }
+ }
+ }
+
+ if (exists $aligndata->{reference})
+ {
+ my %rgaps = %{$aligndata->{reference}};
+
+ ## Reference is always forward
+ if (exists $rgaps{0})
+ {
+ ## leading gaps in the reference
+ $aligndata->{offset} += $rgaps{0};
+ $aligndata->{reference}->{0} = 0;
+ }
+
+ if (exists $rgaps{$aligndata->{ralignend}})
+ {
+ ## trailing gaps in reference
+ $aligndata->{reference}->{$aligndata->{ralignend}} = 0;
+ }
+ }
+ }
+
+ return $aligndata;
+}
+
+sub createGapList
+{
+ my $gaptable = shift;
+ my $gaplist = undef;
+
+ foreach my $pos (sort keys %$gaptable)
+ {
+ my $num = $gaptable->{$pos};
+
+ for (my $i = 0; $i < $num; $i++)
+ {
+ if (defined $gaplist) { $gaplist .= ","; }
+ $gaplist .= $pos;
+ }
+ }
+
+ return $gaplist;
+}
+
+
+MAIN:
+{
+ my $chain = 0;
+ my $refshift = 0;
+
+ my $docircular = 0;
+ my $docontig = 1;
+ my $dorecall = 0;
+ my $dofasta = 0;
+ my $dotasm = 0;
+
+ my $queryfasta = undef;
+
+ my $outprefix = "zip";
+
+ ## Become $outprefix.suffix
+ my $deltafile = ".delta";
+ my $alignfile = ".aligns";
+ my $snpfile = ".snps";
+
+ $tf->addDependInfo(@DEPENDS);
+ $tf->setHelpInfo($HELPTEXT);
+ $tf->setVersionInfo($VERSION);
+
+ # now we handle the input options
+ my $result = $tf->TIGR_GetOptions
+ (
+ 'c=i', \$chain,
+ 'r=i', \$refshift,
+ 'o=s', \$outprefix,
+ 'q=s', \$queryfasta,
+
+ 'C|circular!', \$docircular,
+ 'contig!', \$docontig,
+ 'fasta!', \$dofasta,
+ 'tasm!', \$dotasm,
+ 'recall!', \$dorecall,
+
+ 'v|verbose!', \$doverbose,
+ );
+
+ $tf->bail("Command line parsing failed") if (!$result);
+
+ $tf->bail("Converting circular contigs to tasm is unsupported")
+ if ($dotasm && $docircular);
+
+ my $bank = shift; die $USAGE if !defined $bank;
+ my $reference = shift; die $USAGE if !defined $reference;
+ my $query = shift; die $USAGE if !defined $query;
+
+ my $debug = $tf->getDebugLevel();
+ $tf->setDebugLevel(1) if (!$debug);
+
+ foreach my $s (\$alignfile, \$snpfile, \$deltafile)
+ {
+ $$s = $outprefix.$$s;
+ }
+
+ my %ids;
+
+ ## Strip .contig or .qual
+ foreach my $p (\$reference, \$query)
+ {
+ $ids{$$p} = $$p;
+ }
+
+ echo "Reference prefix is \"$reference\"\n";
+ echo "Query prefix is \"$query\"\n";
+
+ $tf->bail("Can't access bank $bank")
+ if (! -r "$bank");
+
+ foreach my $prefix ($reference, $query)
+ {
+ if (-r "$prefix.fasta")
+ {
+ $ids{$prefix} = getFastaId("$prefix.fasta")
+ }
+ else
+ {
+ runCmd("echo $prefix > eidlist");
+ runCmd("$BANK2FASTA -b $bank -E eidlist -e");
+ runCmd("rm eidlist");
+ }
+ }
+
+ if (! -r $snpfile)
+ {
+ if (! -r $alignfile)
+ {
+ if (! -r $deltafile)
+ {
+ runCmd("$NUCMER $reference.fasta $query.fasta --nooptimize --maxmatch -p $outprefix 2> /dev/null",
+ "nucmer $reference $query");
+ }
+
+ runCmd("$SHOWALIGNS $deltafile $ids{$reference} $ids{$query} > $alignfile");
+ }
+
+ runCmd("$FINDSNPS -flank 0 $alignfile -chain $chain > $snpfile");
+ }
+
+ my $aligndata = loadSNPs($snpfile, $chain, $refshift, $queryfasta, $docircular,
+ $reference, $query, $outprefix);
+
+ if (1)
+ {
+ my $recall = "";
+ $recall = "-c -a 3" if $dorecall; ## Recall conic
+
+ my $o = $aligndata->{offset};
+
+ ## everything from nucmer is 1-based ungapped
+ my $cmd = "$ZIPCONTIGS --refcons $bank $query $reference $outprefix";
+ $cmd .= " --debug 4 $recall -1 -U -O $o";
+ $cmd .= " -R" if ($aligndata->{direction} eq "R");
+
+ my $rgaps = createGapList($aligndata->{reference});
+ $cmd .= " -r $rgaps" if defined $rgaps;
+
+ my $qgaps = createGapList($aligndata->{query});
+ $cmd .= " -q $qgaps" if defined $qgaps;
+
+ runCmd($cmd, "zipContigs");
+ }
+
+ runCmd("echo $outprefix > eidlist");
+
+ runCmd("$BANK2CONTIG $bank -E eidlist > $outprefix.contig")
+ if ($docontig);
+
+ runCmd("$BANK2FASTA $bank -E eidlist > $outprefix.fasta")
+ if ($dofasta);
+
+ runCmd("rm eidlist");
+}
+
diff --git a/src/Foundation/AMOS_Foundation.cc b/src/Foundation/AMOS_Foundation.cc
new file mode 100644
index 0000000..377f98e
--- /dev/null
+++ b/src/Foundation/AMOS_Foundation.cc
@@ -0,0 +1,243 @@
+//! @file
+//! @brief AMOS_Foundation class implementation
+
+/** @example example-minimal.cc
+ * Demonstrates a minimal use of AMOS_Foundation.\n\n
+ * This file can be used as a template for new programs to incorporate the
+ * services provided by AMOS_Foundation.
+ */
+
+/** @example example-minimal.out
+ * Sample output from example-minimal.\n\n
+ * Notice that by adding a few lines of code to instantiate a AMOS_Foundation
+ * object, all of the standard AMOS options are handled without complicated
+ * options handling code. In addition to easy and robust command line options
+ * handling, logging services and configuration file parsing are also
+ * available for use immediately.
+ */
+
+#include "AMOS_Foundation.hh"
+
+static char const libdependicies[]=
+ "$Dependencies: getopts_long, STL::{map, vector, list}, sstream";
+
+static char const libversion[]=
+ "$Version: 2.0 $Revision$";
+
+//! Constructor: Initializes options
+/*! Initializes Options, ConfigFile, and Logger based on command line
+ * options. Used for automatic incorporation of standard AMOS options.
+ *
+ * @param version Version information for program if --version or -V is given
+ * @param helptext Short help text to display if --help of -h is given
+ * @param dependencies Dependency information for --depend
+ * @param argc Standard argument count
+ * @param argv Standard array of strings for argument values
+ */
+AMOS_Foundation::AMOS_Foundation(std::string version,
+ std::string helptext,
+ std::string dependencies,
+ int argc,
+ char ** argv)
+{
+ m_version = version;
+ m_helptext = helptext;
+ m_dependencies = dependencies;
+
+ m_doOptionHelp = true;
+
+ m_logger = NULL;
+ m_config = NULL;
+
+ m_doHelp = 0;
+ m_doAppend = 0;
+ m_doDepend = 0;
+ m_doVersion = 0;
+
+ m_filterLevels = "";
+ m_configFile = "";
+ m_logfile = "";
+
+ m_options = new Options (argc, argv);
+
+ // Add the standard options
+ m_options->addOptionResult("help|h", &m_doHelp,
+ "Get this help");
+
+ m_options->addOptionResult("version|V", &m_doVersion,
+ "Get the version info");
+
+ m_options->addOptionResult("configfile=s", &m_configFile,
+ "Set the config file");
+
+ m_options->addOptionResult("depend", &m_doDepend,
+ "Get dependency information");
+
+ m_options->addOptionResult("debug|filterlevel=s", &m_filterLevels,
+ "Set filter levels for logging " \
+ "(fl[,Category=fl[...]]");
+
+ m_options->addOptionResult("logfile=s", &m_logfile,
+ "Set logfile for logging");
+
+ m_options->addOptionResult("append", &m_doAppend,
+ "Log messages should append to old logfile");
+
+ m_options->standardOptionsComplete();
+}
+
+//! Deletes logger, config file, and options handlers
+AMOS_Foundation::~AMOS_Foundation()
+{
+ if (m_logger) delete m_logger;
+ if (m_config) delete m_config;
+ if (m_options) delete m_options;
+}
+
+void AMOS_Foundation::printHelpText()
+{
+ std::cerr << m_helptext << std::endl;
+ if (m_doOptionHelp)
+ {
+ m_options->printHelp();
+ }
+}
+
+//! Handles standard AMOS options appropriately
+void AMOS_Foundation::handleStandardOptions()
+{
+ m_options->parseOptions();
+
+ if (m_doHelp)
+ {
+ printHelpText();
+ throw ExitProgramNormally("Help Text Requested");
+ }
+ else if (m_doVersion)
+ {
+ std::cerr << m_version << std::endl;
+ throw ExitProgramNormally("Version Infortmation Requested");
+ }
+ else if (m_doDepend)
+ {
+ std::cerr << "Dependencies: " << m_dependencies << std::endl;
+ throw ExitProgramNormally("Dependency Information Requested");
+ }
+
+ if (m_configFile.length())
+ {
+ // Config was specified, load config file
+
+ m_config = new ConfigFile(m_configFile);
+ }
+
+ // Set up logfiles
+ std::string logfilename = m_options->getApplicationName() + ".log";
+ std::string errorfilename = m_options->getApplicationName() + ".error";
+
+ // See if a specific logfile was requested
+ if (m_logfile.length())
+ {
+ logfilename = m_logfile;
+
+ // Errorfile name is /path/to/logfile.error from
+ // /path/to/logfile.log
+
+ errorfilename = logfilename;
+ int dotpos = errorfilename.rfind(".log");
+ if (dotpos > 0)
+ {
+ errorfilename.erase(dotpos, errorfilename.length()-1);
+ }
+
+ errorfilename += ".error";
+ }
+
+ // Remove old log files if not in append mode
+ if (!m_doAppend)
+ {
+ if (FileSystem::doesFileExist(logfilename.c_str()))
+ {
+ unlink(logfilename.c_str());
+ }
+
+ if (FileSystem::doesFileExist(errorfilename.c_str()))
+ {
+ unlink(errorfilename.c_str());
+ }
+ }
+
+ // Check to see if logfile can be opened
+ if (!FileSystem::isCreatableFile(logfilename.c_str()))
+ {
+ // Can't create this as requested, log to /tmp
+ logfilename = "/tmp/" + m_options->getApplicationName()
+ + "." + FileSystem::getPIDString();
+ errorfilename = logfilename + ".error";
+ logfilename += ".log";
+ }
+
+ // Create the logger (which is disabled until a default filter level is set
+ m_logger = new Logger(logfilename.c_str(),
+ errorfilename.c_str(),
+ m_options->getApplicationName(),
+ m_options->getInvocation());
+
+ // --debug or --filterlevel was specified
+ if (m_filterLevels.length())
+ {
+ m_logger->setFilterLevels(m_filterLevels);
+ }
+}
+
+//! Gets version string
+std::string AMOS_Foundation::getVersion()
+{
+ return m_version;
+}
+
+//! Gets Help Text
+std::string AMOS_Foundation::getHelpText()
+{
+ return m_helptext;
+}
+
+//! Gets Command Line Option pointer
+Options * AMOS_Foundation::getOptions()
+{
+ return m_options;
+}
+
+//! Gets Configuration File pointer
+ConfigFile * AMOS_Foundation::getConfig()
+{
+ return m_config;
+}
+
+//! Gets the main log manager
+/*!
+ * @exception amosException If a log manager was not created, which means
+ * handleStandardOptions was never called
+ */
+Logger * AMOS_Foundation::getLogger()
+{
+ if (!m_logger)
+ {
+ throw amosException("Call handleStandardOptions to create the log manager",
+ "AMOS_Foundation");
+ }
+
+ return m_logger;
+}
+
+//! Gets the default log for ease of use
+LogCategory AMOS_Foundation::log()
+{
+ return getLogger()->getLog();
+}
+
+//! Disables printing help on each option
+void AMOS_Foundation::disableOptionHelp()
+{
+ m_doOptionHelp = false;
+}
diff --git a/src/Foundation/AMOS_Foundation.hh b/src/Foundation/AMOS_Foundation.hh
new file mode 100644
index 0000000..1878b13
--- /dev/null
+++ b/src/Foundation/AMOS_Foundation.hh
@@ -0,0 +1,60 @@
+//! @file
+//! @brief AMOS_Foundation class interface
+
+#ifndef AMOS_Foundation_HH
+#define AMOS_Foundation_HH 1
+
+#include <string>
+#include "Options.hh"
+#include "ConfigFile.hh"
+#include "Logger.hh"
+#include "FileSystem.hh"
+
+//! Wrapper Class to ease use of Options, Configuration Files, and Logging
+class AMOS_Foundation
+{
+public:
+ AMOS_Foundation(std::string version,
+ std::string helptext,
+ std::string dependencies,
+ int argc,
+ char ** argv);
+ ~AMOS_Foundation();
+
+ void handleStandardOptions();
+ void printHelpText();
+
+ std::string getVersion();
+ std::string getHelpText();
+
+ Options * getOptions();
+ ConfigFile * getConfig();
+ Logger * getLogger();
+
+ LogCategory log();
+
+ void disableOptionHelp();
+
+private:
+ std::string m_version;
+ std::string m_helptext;
+ std::string m_dependencies;
+
+ Options * m_options;
+ Logger * m_logger;
+ ConfigFile * m_config;
+
+ bool m_doOptionHelp;
+
+ // Command line option results
+ int m_doHelp;
+ int m_doVersion;
+ int m_doAppend;
+ int m_doDepend;
+
+ std::string m_configFile;
+ std::string m_logfile;
+ std::string m_filterLevels;
+};
+
+#endif
diff --git a/src/Foundation/CategoryInformation.cc b/src/Foundation/CategoryInformation.cc
new file mode 100644
index 0000000..394a1e1
--- /dev/null
+++ b/src/Foundation/CategoryInformation.cc
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief CategoryInformation class implementation
+
+#include "CategoryInformation.hh"
+
+//! Constuctor sets the category information
+CategoryInformation::CategoryInformation(std::string categoryName,
+ MessageLevel messageLevel,
+ MessageLevel filterLevel)
+{
+ m_categoryName = categoryName;
+
+ setMessageLevel(messageLevel);
+ setFilterLevel(filterLevel);
+}
+
+//! Empty Deconstructor
+CategoryInformation::~CategoryInformation()
+{
+
+}
+
+//! Gets the current message level
+/*!
+ * @return Current message Level
+ */
+MessageLevel CategoryInformation::getMessageLevel() const
+{
+ return m_messageLevel;
+}
+
+//! Sets the message level
+/*!
+ * @param messageLevel New Message level
+ */
+void CategoryInformation::setMessageLevel(MessageLevel messageLevel)
+{
+ if (messageLevel == MESSAGE_LEVEL_DEFAULT)
+ {
+ throw amosException("Internal Error: Can't set message level to be "\
+ "MESSAGE_LEVEL_DEFAULT for category " +
+ m_categoryName,
+ "CategoryInformation::setMessageLevel");
+
+ }
+
+ m_messageLevel = messageLevel;
+}
+
+//! Gets the current filter level
+/*!
+ * @return Current filter Level
+ */
+MessageLevel CategoryInformation::getFilterLevel() const
+{
+ return m_filterLevel;
+}
+
+//! Sets the current filter level
+/*!
+ * @param filterLevel New filter Level
+ */
+void CategoryInformation::setFilterLevel(MessageLevel filterLevel)
+{
+ if (filterLevel == MESSAGE_LEVEL_DEFAULT)
+ {
+ throw amosException("Internal Error: Can't set filter level to be "\
+ "MESSAGE_LEVEL_DEFAULT for category " +
+ m_categoryName,
+ "CategoryInformation::setFilterLevel");
+
+ }
+
+ if (filterLevel == MESSAGE_LEVEL_OFF)
+ {
+ m_categoryEnabled = false;
+ }
+ else
+ {
+ m_categoryEnabled = true;
+ }
+
+ m_filterLevel = filterLevel;
+}
+
+//! Gets the name of the category
+/*!
+ * @return Name of the category
+ */
+std::string CategoryInformation::getCategoryName() const
+{
+ return m_categoryName;
+}
+
+//! Pushes the current message level onto a stack, and sets a new messagelevel
+/*!
+ * @param messageLevel Message level to set
+ * @see popMessageLevel
+ */
+void CategoryInformation::pushMessageLevel(MessageLevel messageLevel)
+{
+ m_messageLevelStack.push_front(m_messageLevel);
+ m_messageLevel = messageLevel;
+}
+
+//! Pops a message level off of a stack and sets that to be the new messagelevel
+/*!
+ * @see pushMessageLevel
+ */
+void CategoryInformation::popMessageLevel()
+{
+ if (m_messageLevelStack.size())
+ {
+ m_messageLevel = m_messageLevelStack.front();
+ m_messageLevelStack.pop_front();
+ }
+}
+
+//! Checks if category is enabled
+bool CategoryInformation::isEnabled()
+{
+ return m_categoryEnabled;
+}
+
+//! Function to check that category is enabled and message is not filtered
+/*! A message will be logged if it's messagelevel is less than or equal to
+ * the filter level
+ *
+ * @return If message should be logged
+ */
+bool CategoryInformation::doLog(MessageLevel messageLevel) const
+{
+ return m_categoryEnabled && (messageLevel <= m_filterLevel);
+}
+
diff --git a/src/Foundation/CategoryInformation.hh b/src/Foundation/CategoryInformation.hh
new file mode 100644
index 0000000..c8bebcd
--- /dev/null
+++ b/src/Foundation/CategoryInformation.hh
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief CategoryInformation class interface
+
+#ifndef CATEGORYINFORMATION_HH
+#define CATEGORYINFORMATION_HH 1
+
+#include <string>
+#include <list>
+#include "MessageLevel.hh"
+
+class Logger;
+#include "Logger.hh"
+
+//! Hold the internal information for each category.
+/*! A "Category" would be created for each different functional section of
+ * a program. They are created and destroyed only by the log manager to store
+ * information about each category throughout the lifetime of the logger.
+ * Each category has independent fitlerLevels, messageLevels,
+ * messageLevel stacks, and can be independently turned on or off.
+ */
+class CategoryInformation
+{
+public:
+ std::string getCategoryName() const;
+
+ bool isEnabled();
+ MessageLevel getFilterLevel() const;
+ void setFilterLevel(MessageLevel filterLevel);
+
+ MessageLevel getMessageLevel() const;
+ void setMessageLevel(MessageLevel messageLevel);
+
+ void pushMessageLevel(MessageLevel messageLevel);
+ void popMessageLevel();
+
+ bool doLog(MessageLevel messagelevel) const;
+
+private:
+ // Only the log manager can create or delete category information
+ friend class Logger;
+ CategoryInformation(std::string categoryName,
+ MessageLevel messageLevel,
+ MessageLevel filterLevel);
+
+ ~CategoryInformation();
+
+ //! Determines if any messages should be logged from this category
+ bool m_categoryEnabled;
+
+ //! Current message level
+ MessageLevel m_messageLevel;
+
+ //! Current filter level
+ MessageLevel m_filterLevel;
+
+ //! Name of the category
+ std::string m_categoryName;
+
+ //! Stack of old message levels for quick changes
+ std::list<MessageLevel> m_messageLevelStack;
+};
+
+#endif
+
diff --git a/src/Foundation/ConfigFile.cc b/src/Foundation/ConfigFile.cc
new file mode 100644
index 0000000..16f269f
--- /dev/null
+++ b/src/Foundation/ConfigFile.cc
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief ConfigFile class implementation
+
+/*! @example example-configfile.cc
+ * Demonstrates configuration file handling.\n\n
+ * Various methods are called to pull information out of the configuration
+ * file.
+ */
+
+/*! @example example-configfile.ini
+ * An example configuration file.\n\n
+ * Note that sections and variables are supported, as well as allowing for
+ * runtime substitution of variable values. ConfigFile supports multiple
+ * substitutions on the same line, nested substitutions, and the ability to
+ * set default rules. Notice how in this example NIH.workdir, TIGR.workdir
+ * and TIGR.updated.workdir are all set to the same rule, but in the output
+ * the substitutions evaluate differently. This is possible because
+ * while the default rule is written in the topmost section, the
+ * rules are evaluated using the most local values of ORG and {{ORG}}_DIR
+ * relative to the child where the rule is referenced.
+ */
+
+/*! @example example-configfile.out
+ * Sample output from example-config.\n\n
+ * Notice how NIH.workdir, TIGR.workdir, and TIGR.update.workdir all have
+ * different values.
+ */
+
+#include "ConfigFile.hh"
+#include <cstring>
+
+//! Constructor
+/*! Creates a ConfigFile class. Also loads, parses, and resolves
+ * variable substitution.
+ *
+ * @param filename Filename of config file to load
+ * @exception UnableToReadError On failing FileSystem::isReadAbleFile
+ * @exception UnableToOpenError On failing ifstream::is_open
+ */
+ConfigFile::ConfigFile(const std::string & filename)
+{
+ m_filename = filename;
+ m_linenum = 1;
+
+ m_configFile.open(filename.c_str(), std::ios::in);
+
+ if (!m_configFile.is_open())
+ {
+ throw UnableToOpenError(amosException::quote(filename),
+ "ConfigFile");
+ }
+
+ try
+ {
+ parseConfig();
+ m_rootSection->resolveSubstitutions();
+ }
+ catch (ConfigFileError e)
+ {
+ m_configFile.close();
+ if (m_rootSection)
+ {
+ delete m_rootSection;
+ m_rootSection = NULL;
+ }
+
+ char buffer[16];
+ sprintf(buffer, "%d", m_linenum);
+
+ e.setRawErrorMsg(e.getErrorMsg()
+ + (std::string) " in file "
+ + amosException::quote(filename)
+ + (std::string) " on line "
+ + buffer);
+ throw e;
+ }
+
+ m_configFile.close();
+}
+
+//! Deconstructor also deletes m_rootSection
+ConfigFile::~ConfigFile()
+{
+ m_configFile.close();
+ if (m_rootSection) delete m_rootSection;
+}
+
+//! Prints the configuration from the rootSection down
+void ConfigFile::printConfiguration()
+{
+ if (m_rootSection) m_rootSection->printSection();
+}
+
+//! Reads the configuration file line by line and extracts data
+/*!
+ * @exception InvalidConfigNameError On an empty section name
+ */
+void ConfigFile::parseConfig()
+{
+ char buffer [1025];
+ m_rootSection = new ConfigSection(NULL, "ROOT");
+ ConfigSection * currentSection = m_rootSection;
+
+ while (m_configFile.getline(buffer, sizeof(buffer)))
+ {
+ // Check to see if there is any data
+ int bufferlen = strlen(buffer);
+ if (bufferlen)
+ {
+ if (bufferlen == sizeof(buffer))
+ {
+ if (buffer[bufferlen-1] != '\n')
+ {
+ throw ConfigFileLineTooLong(buffer);
+ }
+ }
+
+ switch(buffer[0])
+ {
+ case '[':
+ {
+ std::string currentSectionName =
+ ConfigSection::parseSectionName(buffer);
+ if (currentSectionName.length())
+ {
+ currentSection = m_rootSection->findSection(currentSectionName);
+
+ if (!currentSection)
+ {
+ currentSection = m_rootSection->
+ addNewSection(currentSectionName);
+
+ }
+ else
+ {
+ throw DuplicateSectionError(
+ amosException::quote(currentSectionName));
+
+ }
+ }
+ else
+ {
+ throw InvalidConfigNameError(amosException::quote(buffer),
+ "ConfigFile");
+ }
+ break;
+ }
+
+ case ';':
+ {
+ // Ignore Comments
+ break;
+ }
+
+ default:
+ {
+ currentSection->addVariable((const char *)buffer);
+ }
+ };
+ }
+ else
+ {
+ // Blank Line, Ignore
+ }
+
+ m_linenum++;
+ }
+}
+
+//! Finds a section from ROOT section
+ConfigSection * ConfigFile::findSection(std::string sectionName)
+{
+ ConfigSection * retval = NULL;
+
+ if (m_rootSection) retval = m_rootSection->findSection(sectionName);
+
+ return retval;
+}
+
+//! Returns ROOT section
+ConfigSection * ConfigFile::getRootSection()
+{
+ return m_rootSection;
+}
diff --git a/src/Foundation/ConfigFile.hh b/src/Foundation/ConfigFile.hh
new file mode 100644
index 0000000..936ed95
--- /dev/null
+++ b/src/Foundation/ConfigFile.hh
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief ConfigFile class interface
+
+#ifndef CONFIGFILE_HH
+#define CONFIGFILE_HH 1
+
+#include <iostream>
+#include <fstream>
+#include <cstdio> // for sprintf
+
+#include "ConfigSection.hh"
+#include "Exceptions.hh"
+
+//! Class to load and manage configuration files
+/*! Loads and manages a root section and subsections from a given filename.
+ * @see ConfigSection
+ */
+class ConfigFile
+{
+public:
+ ConfigFile(const std::string & filename);
+ ~ConfigFile();
+
+ void printConfiguration();
+
+ ConfigSection * findSection(std::string sectionName);
+ ConfigSection * getRootSection();
+
+private:
+ void parseConfig();
+
+ ConfigSection * m_rootSection;
+
+ std::string m_filename;
+ std::ifstream m_configFile;
+
+ int m_linenum;
+};
+
+#endif
diff --git a/src/Foundation/ConfigSection.cc b/src/Foundation/ConfigSection.cc
new file mode 100644
index 0000000..ebd2819
--- /dev/null
+++ b/src/Foundation/ConfigSection.cc
@@ -0,0 +1,588 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief ConfigSection class implementation
+
+#include "ConfigSection.hh"
+
+//! Constructor
+/*! Create new section.
+ * @param parent Pointer to parent section, or NULL
+ * @param sectionName Name of section
+ */
+ConfigSection::ConfigSection(ConfigSection * parent,
+ std::string sectionName)
+{
+ m_parent = parent;
+ m_sectionName = sectionName;
+
+ // Initialize the iterators to "NULL"
+ m_sectionListIter = m_sectionList.end();
+ m_valueMapIter = m_valueMap.end();
+}
+
+//! Destructor
+/*! Deletes all subsections as well. */
+ConfigSection::~ConfigSection()
+{
+ // Delete all of the children
+
+ while (m_sectionList.size())
+ {
+ ConfigSection * tmpSection = m_sectionList.front();
+ m_sectionList.pop_front();
+
+ delete tmpSection;
+ }
+}
+
+//! Simple Accessor to getSectionName
+/*! @return Short Name of current Section (no parent information)
+ * @see getFullSectionName()
+ */
+std::string ConfigSection::getSectionName()
+{
+ return m_sectionName;
+}
+
+
+//! Adds a section to the list of sections
+/*!
+ * @param newSection New section to add
+ */
+void ConfigSection::addSection(ConfigSection * newSection)
+{
+ m_sectionList.push_back(newSection);
+ m_sectionListIter = m_sectionList.begin(); // Redundant in most cases
+}
+
+
+//! Creates a new section, adds it to the appropriate section lists
+/*! sectionName is full name to section as in base.child.child2,
+ * and will automatically create base and base.child if needed.
+ * Trying to add an existing section will return a pointer to that section
+ *
+ * @param sectionName Name of the section to add
+ * @return Returns a pointer to the child class created
+ */
+ConfigSection * ConfigSection::addNewSection(std::string sectionName)
+{
+ // Make sure there isn't a section named this already
+ ConfigSection * retval = findSection(sectionName);
+
+ if (!retval && sectionName.length())
+ {
+ std::string basesection = getBaseSectionName(sectionName);
+
+ retval = findSection(basesection);
+ if (!retval)
+ {
+ // Couldn't find the next hop in the list, add it
+ retval = new ConfigSection(this, basesection);
+ addSection(retval);
+ }
+
+ std::string childsection = getSubSectionName(sectionName);
+ if (childsection.length())
+ {
+ // Recursively add children section
+ retval = retval->addNewSection(childsection);
+ }
+ }
+
+ return retval;
+}
+
+//! Extracts Section Name from raw string
+/*! Takes raw string (from file) and removes brackets
+ * @param sectionName Name of Section in [SECTION_NAME] format
+ * @return Name of Section in SECTION_NAME format
+ * @exception InvalidConfigNameError If there isn't at least 1
+ * character of section name
+ */
+std::string ConfigSection::parseSectionName(const char * sectionName)
+{
+ // Strip out name from inside of []
+ std::string retval = sectionName;
+ int startpos, endpos;
+
+ startpos = retval.find('[') + 1; // +1 to skip it
+ endpos = retval.find(']');
+
+ // There should be at least one character of section name
+ if ((endpos <= startpos + 1) || (startpos < 0))
+ {
+ throw InvalidConfigNameError(amosException::quote(sectionName));
+ }
+
+ retval = retval.substr(startpos, endpos-startpos);
+ stripWhitespace(retval);
+
+ return retval;
+}
+
+//! Recursively find and return proper section
+/*! @param sectionName Section Name to search relative to current section
+ * @return Pointer to matching section or NULL if not found
+ */
+ConfigSection * ConfigSection::findSection(std::string sectionName)
+{
+ ConfigSection * retval = NULL;
+
+ if (sectionName.length() == 0)
+ {
+ // No Match on 0 length string
+
+ retval = NULL;
+ }
+ else
+ {
+ std::string basesection = getBaseSectionName(sectionName);
+
+ // Check the children
+
+ std::list<ConfigSection *>::const_iterator hChildSection;
+ for (hChildSection = m_sectionList.begin();
+ hChildSection != m_sectionList.end();
+ hChildSection++)
+ {
+ std::string childname = (*hChildSection)->getSectionName();
+ if (childname == basesection)
+ {
+ // This is the right child
+
+ // First check if this child is the full section requested
+ // (avoids having to explicitly start every section path with ROOT.)
+ if (childname == sectionName)
+ {
+ retval = *hChildSection;
+ }
+ else
+ {
+ retval = (*hChildSection)->findSection(getSubSectionName(sectionName));
+ }
+ }
+ }
+ }
+
+ return retval;
+}
+
+//! Returns "base" from base[.child[.child2[...]]]
+/*!
+ * @exception InvalidConfigNameError On first character of sectionName is '.'
+ */
+std::string ConfigSection::getBaseSectionName(std::string sectionName)
+{
+ std::string retval = sectionName;
+ int dotpos = sectionName.find('.');
+
+ if (dotpos > 0)
+ {
+ retval = sectionName.substr(0,dotpos);
+ }
+ else if (dotpos == 0)
+ {
+ // First character can't be '.'
+ throw InvalidConfigNameError(amosException::quote(sectionName));
+ }
+ // else not found
+
+ return retval;
+}
+
+
+//! Strips "base." from base[.child[.child2[...]]]
+/*!
+ * @exception InvalidConfigNameError On first character of sectionName is '.'
+ */
+std::string ConfigSection::getSubSectionName(std::string sectionName)
+{
+ std::string retval = "";
+ int dotpos = sectionName.find('.');
+
+ if (dotpos > 0)
+ {
+ retval = sectionName.substr(dotpos+1, sectionName.length());
+ }
+ else if (dotpos == 0)
+ {
+ // First character can't be '.'
+ throw InvalidConfigNameError(amosException::quote(sectionName));
+ }
+ // else return ""
+
+ return retval;
+}
+
+//! Parses a string, and adds variable=value into m_valueMap
+/*! Used to extract (variable,value) pair from file. It does not do
+ * any variable substitutions, but it will strip away unneed whitespace.
+ *
+ * @param varLine Raw line to parse (directly from file)
+ * @exception InvalidConfigNameError On first character of line is '='
+ */
+void ConfigSection::addVariable(const char * varLine)
+{
+ std::string raw = varLine;
+
+ // First strip out comments
+ int commentpos = raw.find(';');
+ if (commentpos >= 0)
+ {
+ // this will try to erase beyond the end of the string, but is
+ // handled gracefully
+ raw.erase(commentpos, raw.length());
+ }
+
+ // Remove leading and trailing whitespace from line
+ stripWhitespace(raw);
+
+ // Make sure line isn't empty (or was a comment)
+ if (raw.length())
+ {
+ int equalpos = raw.find('=');
+ if (equalpos <= 0)
+ {
+ // First character can't be '='
+ // but must contain an '=
+ throw InvalidConfigNameError(amosException::quote(varLine));
+ }
+
+ // Separate variable and value pair
+ std::string var = raw.substr(0, equalpos);
+ std::string val = raw.substr(equalpos+1, raw.length() - equalpos+1);
+
+ stripWhitespace(var);
+ stripWhitespace(val);
+
+ // var is guaranteed to have a value,
+ // val is valid as an empty string ""
+ m_valueMap[var] = val;
+
+ // Reset iterator, although may be unnecessary
+ m_valueMapIter = m_valueMap.begin();
+ }
+}
+
+//! Strips leading and trailing white space from "interesting" characters
+/*! Utility Function
+ * @param val Reference to string to strip
+ */
+void ConfigSection::stripWhitespace(std::string & val)
+{
+ std::string whitespace(" \t");
+
+ if (val.length() > 0)
+ {
+ int startpos = val.find_first_not_of(whitespace);
+ int endpos = val.find_last_not_of(whitespace);
+
+ if (startpos < 0)
+ {
+ // No interesting characters, startpos < 0 iff endpos < 0
+ val = "";
+ }
+ else
+ {
+ val = val.substr(startpos, endpos-startpos+1);
+ }
+ }
+}
+
+//! Prints out full name of section by recursively prependind parent name
+/*! @return Full name of section in SECTION_NAME.SUB_SECTION format
+ * @see getSectionName()
+ */
+std::string ConfigSection::getFullSectionName()
+{
+ std::string retval;
+ if (m_parent)
+ {
+ // Only append if there is a parent to avoid showing implicit
+ // [ROOT] Section
+ retval = m_parent->getFullSectionName();
+ if (retval.length()) retval += ".";
+
+ retval += getSectionName();
+ }
+
+ return retval;
+}
+
+//! Prepends the full section name to a variable name
+/*!
+ * @param variableName Name of variable to prepend
+ * @return Full name of variable in SECTION_NAME.variableName form
+ */
+std::string ConfigSection::getFullVariableName(std::string variableName)
+{
+ std::string retval;
+ std::string sectionName = getFullSectionName();
+
+ if (sectionName.length()) retval = sectionName + ".";
+
+ retval += variableName;
+ return retval;
+}
+
+//! Dumps a section (and subsections) to an ostream
+/*! Useful for debugging.
+ * @param indentlevel Number of spaces to indent
+ * @param os Stream to output to
+ */
+void ConfigSection::printSection(int indentlevel, std::ostream & os)
+{
+ // Print Section Name
+ os << getIndent(indentlevel-1) << "|-> [" << getSectionName() << "]";
+
+ // Print Full Name
+ os << " ([" << getFullSectionName() << "])" << std::endl;
+
+
+ // Print each var,val pair
+ std::map<std::string, std::string>::const_iterator mapiter;
+ for (mapiter = m_valueMap.begin();
+ mapiter != m_valueMap.end();
+ mapiter++)
+ {
+ os << getIndent(indentlevel) << "|-> "
+ << mapiter->first << "=" << mapiter->second << std::endl;
+ }
+
+ // Print Children
+ std::list<ConfigSection *>::const_iterator hChildrenSection;
+ for (hChildrenSection = m_sectionList.begin();
+ hChildrenSection != m_sectionList.end();
+ hChildrenSection++)
+ {
+ (*hChildrenSection)->printSection(indentlevel+1, os);
+ }
+}
+
+//! Gets a string of spaces (" ") 2*indentlevel characters long
+std::string ConfigSection::getIndent(int indentlevel)
+{
+ std::string retval;
+
+ for (int i=0; i < indentlevel; i++)
+ {
+ retval += " ";
+ }
+
+ return retval;
+}
+
+
+//! Resolves the variable substitutions
+/*! Works bottom-up (postfix) so that children are resolved
+ * before the current level. This way default rules can be specified
+ * at top level with specifics at lower levels. However, substitutions
+ * will be done and redone rather than saved away even in cases
+ * where there would be no conflict in scope.
+ *
+ * @exception CircularReferenceError On a reference than includes itself
+ * @exception MalformedSubstitutionError On a substitution that closes improperly
+ */
+void ConfigSection::resolveSubstitutions()
+{
+ // Resolve the children first
+ std::list<ConfigSection *>::const_iterator hChildSection;
+ for (hChildSection = m_sectionList.begin();
+ hChildSection != m_sectionList.end();
+ hChildSection++)
+ {
+ (*hChildSection)->resolveSubstitutions();
+ }
+
+ // Foreach (var,val) of m_valueMap
+ // while there is a variable substitution in val
+ // Resolve Variable
+ // Make Replacement
+
+ std::map<std::string, std::string>::iterator mapiter;
+ int beginpos, endpos;
+
+ for (mapiter = m_valueMap.begin();
+ mapiter != m_valueMap.end();
+ mapiter++)
+ {
+ // search for variable substitution
+ // search for }} first to allow for nested substitution
+
+ while ((endpos = mapiter->second.find("}}")) >= 0)
+ {
+ // Check backwards to nearest {{
+ beginpos = mapiter->second.rfind("{{" , endpos);
+
+ // There better be a match and at least 1 character of variable name
+ if ((endpos > beginpos+2) && (beginpos >= 0))
+ {
+ std::string replace =
+ mapiter->second.substr(beginpos+2, endpos-beginpos-2);
+ std::string replaceval = resolveVariable(replace,
+ getFullVariableName(mapiter->first));
+
+ // Make sure that this isn't a circular replacement
+ if (replaceval.find("{{" + replace + "}}") != replaceval.npos)
+ {
+ std::string error = amosException::quote(mapiter->second) + " in " +
+ amosException::quote(
+ getFullVariableName(mapiter->first));
+
+ throw CircularReferenceError(error);
+ }
+
+ // Erase everything in {{...}} and then insert replacement val
+ mapiter->second.erase(beginpos, endpos-beginpos+2);
+ mapiter->second.insert(beginpos, replaceval);
+ }
+ else
+ {
+ std::string error = amosException::quote(mapiter->second) + " in " +
+ amosException::quote(
+ getFullVariableName(mapiter->first));
+
+ throw MalformedSubstitutionError(error);
+ }
+ }
+ }
+}
+
+
+//! Tries to resolve a variable from the current node up
+/*! Recursively checks current node and then parent node for a variable
+ * and then returns its value
+ *
+ * @param searchval Name of variable to search for (excludes {{...}})
+ * @return Value of variable with name searchval
+ * @exception UnresolvedSubstitution On can't find a match for a substitution
+ */
+std::string ConfigSection::resolveVariable(std::string searchval,
+ std::string searchVariable)
+{
+ std::string retval;
+
+ // Search valueMap for the desired value
+ std::map<std::string, std::string>::const_iterator searchiter;
+ searchiter = m_valueMap.find(searchval);
+
+ if (searchiter != m_valueMap.end() )
+ {
+ // Found a match
+
+ retval = searchiter->second;
+ }
+ else if (m_parent)
+ {
+ // No match, search up tree
+
+ retval = m_parent->resolveVariable(searchval, searchVariable);
+ }
+ else
+ {
+ // At root, but didn't find match
+ std::string error = amosException::quote(searchval) + " in " +
+ amosException::quote(searchVariable);
+
+ throw UnresolvedSubstitutionError(error);
+ }
+
+ return retval;
+}
+
+//! Reset the iterators to the beginning for getNextSection and getNextVariable
+/*!
+ * @see getNextSection
+ * @see getNextVariable
+ */
+void ConfigSection::resetIterators()
+{
+ m_sectionListIter = m_sectionList.begin();
+ m_valueMapIter = m_valueMap.begin();
+}
+
+//! Returns a pointer to the next section in the section list
+/*! The first time this is called, it returns the first section, after that
+ * it iterates through each section in the list.
+ *
+ * @return The next section in the list, or NULL when list has been exhausted
+ * @see resetIterators
+ */
+ConfigSection * ConfigSection::getNextSection()
+{
+ ConfigSection * retval = NULL;
+
+ if (m_sectionListIter != m_sectionList.end())
+ {
+ retval = *m_sectionListIter;
+ m_sectionListIter++;
+ }
+
+ return retval;
+}
+
+//! Returns the next variable name in the variable map
+/*! The first time it is called, it will return the name of the first variable
+ * in the map. Then it iterates until there are no more variables in the
+ * current section. Use getValue to access the value of this variable. A
+ * result of "" always means the list has been exhausted because no variable
+ * can be named "" in the map.
+ *
+ * @return The next variable name or "" when list exhausted
+ * @see resetIterators
+ * @see getValue
+ */
+std::string ConfigSection::getNextVariable()
+{
+ std::string retval = "";
+
+ if (m_valueMapIter != m_valueMap.end())
+ {
+ retval = m_valueMapIter->first;
+ m_valueMapIter++;
+ }
+
+ return retval;
+}
+
+//! Returns the value for a variable from the map at the current section
+/*! Note: Returns "" if not found which is indistinquishable from a variable
+ * having a value of "". Use hasVariable first to check for its existence.
+ *
+ * @param variableName Name of variable to get value of
+ * @see hasVariable
+ */
+std::string ConfigSection::getValue(std::string variableName)
+{
+ return m_valueMap[variableName];
+}
+
+//! Checks for the existence of a variable in section map
+/*! Only checks for existence, use getValue if this returns true to
+ * access its value.
+ *
+ * @param variableName Name of variable
+ * @return Boolean indicating presense of variable
+ * @see getValue
+ */
+bool ConfigSection::hasVariable(std::string variableName)
+{
+ bool retval = false;
+
+ std::map<std::string, std::string>::const_iterator foundPair;
+
+ foundPair = m_valueMap.find(variableName);
+
+ if (foundPair != m_valueMap.end())
+ {
+ retval = true;
+ }
+
+ return retval;
+}
diff --git a/src/Foundation/ConfigSection.hh b/src/Foundation/ConfigSection.hh
new file mode 100644
index 0000000..4e906a1
--- /dev/null
+++ b/src/Foundation/ConfigSection.hh
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief ConfigSection class interface
+
+#ifndef CONFIGSECTION_HH
+#define CONFIGSECTION_HH 1
+
+#include <map>
+#include <list>
+#include <string>
+#include <iostream>
+
+#include "Exceptions.hh"
+
+// Predeclare to avoid circular references
+class ConfigFile;
+
+//! Class to manage individual sections of a config file
+class ConfigSection
+{
+public:
+ ConfigSection(ConfigSection * parent, std::string sectionName);
+ ~ConfigSection();
+
+ ConfigSection * findSection(std::string sectionName);
+ void printSection(int indentLevel=0, std::ostream & os=std::cout);
+
+ std::string getSectionName();
+ std::string getFullSectionName();
+ std::string getFullVariableName(std::string variableName);
+
+ ConfigSection * getNextSection();
+ std::string getNextVariable();
+
+ std::string getValue(std::string variableName);
+ bool hasVariable(std::string variableName);
+
+ void resetIterators();
+
+protected:
+ ConfigSection * addNewSection(std::string sectionName);
+
+ void resolveSubstitutions();
+ void addVariable(const char * varLine);
+ static std::string parseSectionName(const char * sectionName);
+
+private:
+ void addSection(ConfigSection * newSection);
+ static void stripWhitespace(std::string & val);
+ std::string getIndent(int indentlevel);
+
+ std::string getBaseSectionName(std::string sectionName);
+ std::string getSubSectionName(std::string sectionName);
+
+ std::string resolveVariable(std::string searchval, std::string searchVariable);
+ std::list<ConfigSection *> m_sectionList;
+ std::list<ConfigSection *>::const_iterator m_sectionListIter;
+
+ std::map<std::string, std::string> m_valueMap;
+ std::map<std::string, std::string>::const_iterator m_valueMapIter;
+
+ std::string m_sectionName;
+ ConfigSection * m_parent;
+
+ // ConfigFile can load the config file without exposing the
+ // entire interface to underling application
+friend class ConfigFile;
+};
+
+
+#endif
diff --git a/src/Foundation/Exceptions.cc b/src/Foundation/Exceptions.cc
new file mode 100644
index 0000000..b223851
--- /dev/null
+++ b/src/Foundation/Exceptions.cc
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (amos). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief Implements all exception classes
+
+#include "Exceptions.hh"
+
+amosException::amosException(std::string msg, std::string module)
+{
+ m_errorMsg = "Error: " + msg;
+ m_module = module;
+}
+
+//! Gets the error message
+std::string amosException::getErrorMsg() const
+{
+ return m_errorMsg;
+}
+
+//! Gets the module name
+std::string amosException::getModule() const
+{
+ return m_module;
+}
+
+//! Sets the error message
+void amosException::setRawErrorMsg(std::string msg)
+{
+ m_errorMsg = msg;
+}
+
+void amosException::setModule(std::string module)
+{
+ m_module = module;
+}
+
+//! Static method to enclose a string in quotes "..."
+std::string amosException::quote(std::string msg)
+{
+ return (std::string) "\"" +
+ (std::string) msg +
+ (std::string) "\"";
+}
+
+//! Easy way to print exception error messages
+std::ostream & operator<< (std::ostream & os, const amosException & exception)
+{
+ os << exception.getErrorMsg()
+ << " in module "
+ << exception.getModule();
+
+ return os;
+}
+
+////////////////////////////////////////////////////////////////////////
+
+FileIOError::FileIOError(std::string msg, std::string module)
+ : amosException("IO Error: " + msg, module)
+{ }
+
+UnableToReadError::UnableToReadError(std::string msg, std::string module)
+ : FileIOError("Unable to read: " + msg, module)
+{ }
+
+UnableToOpenError::UnableToOpenError(std::string msg, std::string module)
+ : FileIOError("Unable to open: " + msg, module)
+{ }
+
+////////////////////////////////////////////////////////////////////////
+
+OptionsError::OptionsError(std::string msg, std::string module)
+ : amosException("Options: " + msg, module)
+{ }
+
+ExitProgramNormally::ExitProgramNormally(std::string msg, std::string module)
+ : OptionsError(msg, module)
+{ }
+
+InvalidOptionError::InvalidOptionError(std::string msg, std::string module)
+ : OptionsError("Invalid Option: " + msg, module)
+{ }
+
+MissingRequiredParameterError::MissingRequiredParameterError(std::string msg,
+ std::string module)
+ : OptionsError("Missing Required Parameter: " + msg, module)
+{ }
+
+////////////////////////////////////////////////////////////////////////
+
+ConfigFileError::ConfigFileError(std::string msg, std::string module)
+ : amosException("ConfigFile: " + msg, module)
+{ }
+
+CircularReferenceError::CircularReferenceError(std::string msg, std::string module)
+ : ConfigFileError("Circular Reference: " + msg, module)
+{ }
+
+DuplicateSectionError::DuplicateSectionError(std::string msg, std::string module)
+ : ConfigFileError("Duplicate Section Found: " + msg, module)
+{ }
+
+ConfigFileLineTooLong::ConfigFileLineTooLong(std::string msg, std::string module)
+ : ConfigFileError("Line Too Long To Read: " + msg, module)
+{ }
+
+MalformedSubstitutionError::MalformedSubstitutionError(std::string msg,
+ std::string module)
+ : ConfigFileError("Malformed Substitution: " + msg, module)
+{ }
+
+UnresolvedSubstitutionError::UnresolvedSubstitutionError(std::string msg,
+ std::string module)
+ : ConfigFileError("Unresolved Substitution: " + msg, module)
+{ }
+
+InvalidConfigNameError::InvalidConfigNameError(std::string msg, std::string module)
+ : ConfigFileError("Invalid Name: " + msg, module)
+{ }
+
+InvalidConfiguration::InvalidConfiguration(std::string msg, std::string module)
+ : ConfigFileError("Invalid Configuration: " + msg, module)
+{ }
diff --git a/src/Foundation/Exceptions.hh b/src/Foundation/Exceptions.hh
new file mode 100644
index 0000000..334e726
--- /dev/null
+++ b/src/Foundation/Exceptions.hh
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (amos). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief Interface for all exceptions
+
+#ifndef EXCEPTIONS_HH
+#define EXCEPTIONS_HH 1
+
+#include <string>
+#include <iostream>
+
+//! Base class for all amos Exceptions
+class amosException
+{
+public:
+ amosException(std::string msg, std::string module);
+
+ std::string getErrorMsg() const;
+ std::string getModule() const;
+ static std::string quote(std::string msg);
+
+ void setRawErrorMsg(std::string msg);
+ void setModule(std::string module);
+
+private:
+ std::string m_errorMsg;
+ std::string m_module;
+};
+
+std::ostream & operator<< (std::ostream & os, const amosException & exception);
+
+////////////////////////////////////////////////////////////////////////
+
+//! File IO Errors
+class FileIOError : public amosException
+{
+public:
+ FileIOError(std::string msg, std::string module);
+};
+
+//! Can't read data from a file
+class UnableToReadError : public FileIOError
+{
+public:
+ UnableToReadError(std::string msg, std::string module);
+};
+
+//! Can't open a file
+class UnableToOpenError : public FileIOError
+{
+public:
+ UnableToOpenError(std::string msg, std::string module);
+};
+
+////////////////////////////////////////////////////////////////////////
+
+//! Base class for errors with options
+class OptionsError : public amosException
+{
+public:
+ OptionsError(std::string msg, std::string module="Options");
+};
+
+//! Program should exit(0)
+class ExitProgramNormally : public OptionsError
+{
+public:
+ ExitProgramNormally(std::string msg = "", std::string module = "");
+};
+
+//! Invalid Option (not specified as acceptable)
+class InvalidOptionError : public OptionsError
+{
+public:
+ InvalidOptionError(std::string msg, std::string module="Options");
+};
+
+//! An option requires a value, but none was given
+class MissingRequiredParameterError : public OptionsError
+{
+public:
+ MissingRequiredParameterError(std::string msg, std::string module="Options");
+};
+
+////////////////////////////////////////////////////////////////////////
+
+//! Base class for errors in configuration files
+class ConfigFileError : public amosException
+{
+public:
+ ConfigFileError(std::string msg, std::string module="ConfigFile");
+
+};
+
+//! Errors where there are two sections by the same name
+class DuplicateSectionError : public ConfigFileError
+{
+public:
+ DuplicateSectionError(std::string msg, std::string module="ConfigFile");
+};
+
+//! Errors where a line in a config file is too long to read
+class ConfigFileLineTooLong : public ConfigFileError
+{
+public:
+ ConfigFileLineTooLong(std::string msg, std::string module="ConfigFile");
+};
+
+//! Errors where variable substitution references itself
+class CircularReferenceError : public ConfigFileError
+{
+public:
+ CircularReferenceError(std::string msg, std::string module="ConfigSection");
+};
+
+
+//! Errors where substitution is malformed
+class MalformedSubstitutionError : public ConfigFileError
+{
+public:
+ MalformedSubstitutionError(std::string msg, std::string module="ConfigSection");
+};
+
+
+//! Errors where a substitution can't be processed
+class UnresolvedSubstitutionError : public ConfigFileError
+{
+public:
+ UnresolvedSubstitutionError(std::string msg, std::string module="ConfigSection");
+};
+
+//! Some other error in how something is named
+class InvalidConfigNameError : public ConfigFileError
+{
+public:
+ InvalidConfigNameError(std::string msg, std::string module="ConfigSection");
+};
+
+//! Illegal Configuration
+class InvalidConfiguration : public ConfigFileError
+{
+public:
+ InvalidConfiguration(std::string msg, std::string module="ConfigSection");
+};
+
+#endif
diff --git a/src/Foundation/FileSystem.cc b/src/Foundation/FileSystem.cc
new file mode 100644
index 0000000..d84b550
--- /dev/null
+++ b/src/Foundation/FileSystem.cc
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (amos). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief FileSystem class implementation
+
+#include "FileSystem.hh"
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+
+#define PATH_DELIMINATOR '/'
+
+//! All methods are static so instantiating this class is not required
+FileSystem::FileSystem()
+{
+
+}
+
+bool FileSystem::doesFileExist(const char *filename)
+{
+ return !access(filename, F_OK);
+}
+
+bool FileSystem::isReadableFile(const char *filename)
+{
+ return !access(filename, R_OK);
+}
+
+bool FileSystem::isExecutableFile(const char *filename)
+{
+ return !access(filename, X_OK);
+}
+
+bool FileSystem::isWritableFile(const char *filename)
+{
+ return !access(filename, W_OK);
+}
+
+
+bool FileSystem::isCreatableFile(const char *filename)
+{
+ bool retval;
+
+ if (doesFileExist(filename))
+ {
+ retval = isWritableFile(filename);
+ }
+ else
+ {
+ // Check to see if path was given
+ const char * end_of_path = strrchr(filename, PATH_DELIMINATOR);
+
+ if (end_of_path)
+ {
+ // copy from beginning of string to end of path
+ char path_name [1024];
+ int len = 1024;
+
+ if ((end_of_path - filename) < (len-1))
+ len = end_of_path - filename;
+
+ strncpy(path_name, filename, (end_of_path - filename));
+ path_name[end_of_path-filename] = '\0';
+
+ retval = isWritableDir(path_name);
+ }
+ else
+ {
+ // No path info was given, assume "./"
+ retval = isWritableDir("./");
+ }
+ }
+
+ return retval;
+}
+
+
+// Directory calls:
+// check if it is a directory and then wrap appropriate file calls
+
+bool FileSystem::isDirectory(const char *dirname)
+{
+ bool retval = false;
+
+ if (doesFileExist(dirname))
+ {
+ struct stat buf;
+
+ if (!stat(dirname, &buf))
+ {
+ retval = S_ISDIR(buf.st_mode);
+ }
+ }
+
+ return retval;
+}
+
+bool FileSystem::isReadableDir(const char *dirname)
+{
+ return isDirectory(dirname) &&
+ isReadableFile(dirname) &&
+ isExecutableFile(dirname);
+}
+
+bool FileSystem::isWritableDir(const char *dirname)
+{
+ return isDirectory(dirname) &&
+ isWritableFile(dirname) &&
+ isExecutableFile(dirname);
+}
+
+bool FileSystem::isCreatableDir(const char *dirname)
+{
+ return isCreatableFile(dirname);
+}
+
+bool FileSystem::isCreatablePath(const char *pathname)
+{
+ return isCreatableFile(pathname);
+}
+
+
+//! Returns a pointer to a static buffer containing the absolute path of the CWD
+/*! Note: The buffer will be overwritten by each call to getAbsolutePath
+ */
+char * FileSystem::getAbsolutePath()
+{
+ static char path[1024];
+
+ getcwd(path, sizeof(path));
+
+ return path;
+}
+
+int FileSystem::getPID()
+{
+ return getpid();
+}
+
+std::string FileSystem::getPIDString()
+{
+ char buffer[64];
+ sprintf(buffer, "%d", getPID());
+
+ return (std::string) buffer;
+}
+
+//! Tries to open a file for appending, and throws an exception if it cant
+/*!
+ * @param filename Name of file to open
+ * @exception UnableToOpenError If the file can't be opened for some reason
+ * @returns Pointer to ofstream of filename or NULL if filename == ""
+ */
+std::ofstream * FileSystem::openOutputFile(const std::string & filename)
+{
+ std::ofstream * retval = NULL;
+
+ if (filename.length())
+ {
+ retval = new std::ofstream (filename.c_str(), std::ios::app);
+
+ if (!retval || !retval->is_open())
+ {
+ throw UnableToOpenError(amosException::quote(filename),
+ "Logger::openOutputFile");
+ }
+ }
+
+ return retval;
+}
+
+
+//! Tries to open a file for reading, and throws an exception if it cant
+/*! Wraps ifstream constructor.
+ *
+ * @param filename Name of file to open
+ * @exception UnableToOpenError If the file can't be opened for some reason
+ * @returns Pointer to ifstream of filename or NULL if filename == ""
+ */
+std::ifstream * FileSystem::openInputFile(const std::string & filename)
+{
+ std::ifstream * retval = NULL;
+
+ if (filename.length())
+ {
+ retval = new std::ifstream (filename.c_str());
+
+ if (!retval || !retval->is_open())
+ {
+ throw UnableToOpenError(amosException::quote(filename),
+ "Logger::openIntputFile");
+ }
+ }
+
+ return retval;
+}
diff --git a/src/Foundation/FileSystem.hh b/src/Foundation/FileSystem.hh
new file mode 100644
index 0000000..d065f09
--- /dev/null
+++ b/src/Foundation/FileSystem.hh
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief FileSystem class interface
+
+#ifndef FILESYSTEM_HH
+#define FILESYSTEM_HH 1
+
+#include <unistd.h>
+#include <stdio.h>
+
+#include <string>
+#include <fstream>
+#include "Exceptions.hh"
+
+//! Simple Wrappers for checking various attributes of the file system
+/*! All methods are static, so instantiating this class is not required
+ * (methods can be accessed via result = FileSystem::methodName())
+ */
+class FileSystem
+{
+public:
+ FileSystem();
+
+ // File functions
+ static bool doesFileExist(const char *pathname);
+ static bool isReadableFile(const char *filename);
+ static bool isExecutableFile(const char *filename);
+ static bool isWritableFile(const char *filename);
+ static bool isCreatableFile(const char *filename);
+
+ static bool isDirectory(const char *dirname);
+ static bool isReadableDir(const char *dirname);
+ static bool isWritableDir(const char *dirname);
+ static bool isCreatableDir(const char *dirname);
+ static bool isCreatablePath(const char *pathname);
+
+ static char * getAbsolutePath();
+ static int getPID();
+ static std::string getPIDString();
+
+ static std::ofstream * openOutputFile(const std::string & filename);
+ static std::ifstream * openInputFile(const std::string & filename);
+};
+
+#endif
diff --git a/src/Foundation/LogCategory.cc b/src/Foundation/LogCategory.cc
new file mode 100644
index 0000000..2aa490e
--- /dev/null
+++ b/src/Foundation/LogCategory.cc
@@ -0,0 +1,375 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief LogCategory class implementation
+
+#include "LogCategory.hh"
+
+//! Constructor asks the log manager for its category information
+LogCategory::LogCategory(Logger * logger,
+ std::string categoryName,
+ MessageLevel messageLevel,
+ MessageLevel filterLevel)
+ : std::ostream(&sb), sb(this)
+{
+ m_alreadySyncing = false;
+ m_pid = FileSystem::getPID();
+ m_logger = logger;
+ m_category = m_logger->getCategoryInformation(categoryName,
+ messageLevel,
+ filterLevel);
+}
+
+//! Constuctor saves pointers to the category information and main logger
+/*! Also, each LogCategory queries for its own pid at creation
+ */
+LogCategory::LogCategory(CategoryInformation * categoryInformation,
+ Logger * logger)
+ : std::ostream(&sb), sb(this)
+{
+ m_pid = FileSystem::getPID();
+ m_logger = logger;
+ m_category = categoryInformation;
+}
+
+//! Copy Constructor copies everything but the stream
+LogCategory::LogCategory(const LogCategory & input)
+ : std::ostream(&sb), sb(this)
+{
+ m_pid = FileSystem::getPID();
+ m_logger = input.m_logger;
+ m_category = input.m_category;
+}
+
+//! Assignment copies everything but the stream
+LogCategory & LogCategory::operator= (const LogCategory & input)
+{
+ m_pid = FileSystem::getPID();
+ m_logger = input.m_logger;
+ m_category = input.m_category;
+
+ return *this;
+}
+
+//! Deconstructor flushes the stream
+/*! CategoryInformation can only be deleted by the main logger, so it is not
+ * deleted, nor is the log manager pointer. \n
+ */
+LogCategory::~LogCategory()
+{
+ sync();
+}
+
+//! Takes the data in the buffer and logs it at current messagelevel
+/*! The deconstructor also calls sync, but if there is nothing in the
+ * buffer it wont be logged.\n\n
+ *
+ * *log << endl; // an empty line is written into the log\n
+ * *log << "a" // Not written to log until flushed by endl or deconstructor
+ * delete log; // an empty line won't be written to the log\n
+ * *log << "a"; delete log; // "a" will be flushed to the log\n
+ *
+ * @see logMsg
+ */
+void LogCategory::sync()
+{
+ if (m_alreadySyncing)
+ {
+ // Under 2.95 and 2.96, msg=str() triggers a sync, which was causing an
+ // infinite recurse. Detect this, and don't recurse.
+
+ return;
+ }
+
+ // Get the stream buffer
+ m_alreadySyncing = true;
+ std::string msg = str();
+ m_alreadySyncing = false;
+
+ // Reset the buffer
+ str("");
+
+ // Split the string at the newline, and log each substring
+ std::string::size_type startpos = 0;
+ std::string::size_type endpos = 0;
+
+ std::string::size_type len = msg.length();
+
+ while (startpos < len)
+ {
+ endpos = msg.find('\n', startpos);
+
+ if (endpos == msg.npos)
+ {
+ endpos = len + 1;
+ }
+
+ // Pass the substring to logMsg
+ const std::string & logmsg = msg.substr(startpos, (endpos - startpos));
+ logMsg(logmsg);
+
+ // Advance for next iteration
+ startpos = endpos + 1;
+ }
+}
+
+//! Creates LogMsg object and sends it to log manager for writing
+/*! Logs a new LogMsg with the message
+ *
+ * @see Logger::writeLog
+ * @param msg Message to log
+ * @param messageLevel Message Level of message
+ */
+void LogCategory::logMsg(const std::string & msg, MessageLevel messageLevel) const
+{
+ if (messageLevel == MESSAGE_LEVEL_DEFAULT)
+ {
+ messageLevel = m_category->getMessageLevel();
+ }
+
+ m_logger->writeLog(new LogMsg(msg, m_category, messageLevel, m_pid));
+}
+
+
+//! Gets a LogCategory from the main logger
+/*! @see Logger::getCategory
+ * @return A LogCategory with its category of categoryName, and levels set
+ */
+LogCategory LogCategory::getCategory(std::string categoryName,
+ MessageLevel messageLevel,
+ MessageLevel filterLevel)
+{
+ return m_logger->getCategory(categoryName, messageLevel, filterLevel);
+}
+
+//! Wrapper for m_category->getMessageLevel()
+/*! @see CategoryInformation::getMessageLevel
+ * @return Message level
+ */
+MessageLevel LogCategory::getMessageLevel() const
+{
+ return m_category->getMessageLevel();
+}
+
+//! Wrapper for m_category->setMessageLevel()
+/*! @see CategoryInformation::setMessageLevel
+ * @param messageLevel New message level
+ */
+void LogCategory::setMessageLevel(MessageLevel messageLevel)
+{
+ m_category->setMessageLevel(messageLevel);
+}
+
+//! Simple wrapper
+/*! @see LogCategory::setMessageLevel(MessageLevel)
+ * @param messageLevel New message level
+ */
+void LogCategory::setMessageLevel(int messageLevel)
+{
+ setMessageLevel((MessageLevel) messageLevel);
+}
+
+//! Wrapper for m_category->getFilterLevel()
+/*! @see CategoryInformation::getFilterLevel
+ * @return Filter level
+ */
+MessageLevel LogCategory::getFilterLevel() const
+{
+ return m_category->getFilterLevel();
+}
+
+//! Wrapper for m_category->setFilterLevel()
+/*! @see CategoryInformation::setFilterLevel
+ * @param filterLevel New filter level
+ */
+void LogCategory::setFilterLevel(MessageLevel filterLevel)
+{
+ m_category->setFilterLevel(filterLevel);
+}
+
+//! Simple Wrapper
+/*! @see LogCategory::setFilterLevel(MessageLevel)
+ * @param filterLevel New filter level
+ */
+void LogCategory::setFilterLevel(int filterLevel)
+{
+ setFilterLevel((MessageLevel) filterLevel);
+}
+
+//! Wrapper for m_category->getCategoryName()
+/*! @see CategoryInformation::getCategoryName
+ * @return Name of category
+ */
+std::string LogCategory::getCategoryName() const
+{
+ return m_category->getCategoryName();
+}
+
+//! Wrapper for m_category->pushMessageLevel()
+/*! @see CategoryInformation::pushMessageLevel
+ * @param messageLevel New message level
+ */
+void LogCategory::pushMessageLevel(MessageLevel messageLevel)
+{
+ m_category->pushMessageLevel(messageLevel);
+}
+
+//! Simple Wrapper
+/*! @see LogCategory::pushMessageLevel(MessageLevel)
+ * @param messageLevel New message level
+ */
+void LogCategory::pushMessageLevel(int messageLevel)
+{
+ m_category->pushMessageLevel((MessageLevel) messageLevel);
+}
+
+//! Wrapper for m_category->popMessageLevel()
+/*! @see CategoryInformation::popMessageLevel
+ */
+void LogCategory::popMessageLevel()
+{
+ m_category->popMessageLevel();
+}
+
+//! Wrapper for m_category->disable()
+/*! @see CategoryInformation::disable
+ */
+void LogCategory::disable()
+{
+ m_category->setFilterLevel(MESSAGE_LEVEL_OFF);
+}
+
+
+
+
+// logMsg wrappers
+
+//! Writes a message with message level at MESSAGE_LEVEL_DEBUG_HIGH
+/*!
+ * @param msg String to log
+ * @see logMsg
+ */
+void LogCategory::debug(const std::string & msg) const
+{
+ logMsg(msg, MESSAGE_LEVEL_DEBUG_HIGH);
+}
+
+//! Writes a message with message level at MESSAGE_LEVEL_DEBUG_HIGH
+/*!
+ * @param msg String to log
+ * @see logMsg
+ */
+void LogCategory::debugH(const std::string & msg) const
+{
+ logMsg(msg, MESSAGE_LEVEL_DEBUG_HIGH);
+}
+
+//! Writes a message with message level at MESSAGE_LEVEL_DEBUG_MEDIUM
+/*!
+ * @param msg String to log
+ * @see logMsg
+ */
+void LogCategory::debugM(const std::string & msg) const
+{
+ logMsg(msg, MESSAGE_LEVEL_DEBUG_MEDIUM);
+}
+
+//! Writes a message with message level at MESSAGE_LEVEL_DEBUG_LOW
+/*!
+ * @param msg String to log
+ * @see logMsg
+ */
+void LogCategory::debugL(const std::string & msg) const
+{
+ logMsg(msg, MESSAGE_LEVEL_DEBUG_LOW);
+}
+
+//! Writes a message with message level at MESSAGE_LEVEL_DEBUG_INFORMATION
+/*!
+ * @param msg String to log
+ * @see logMsg
+ */
+void LogCategory::information(const std::string & msg) const
+{
+ logMsg(msg, MESSAGE_LEVEL_DEBUG_INFORMATION);
+}
+
+//! Writes a message with message level at MESSAGE_LEVEL_DEBUG_WARNING
+/*!
+ * @param msg String to log
+ * @see logMsg
+ */
+void LogCategory::warning(const std::string & msg) const
+{
+ logMsg(msg, MESSAGE_LEVEL_DEBUG_WARNING);
+}
+
+//! Writes a message with message level at MESSAGE_LEVEL_DEBUG_ERROR
+/*!
+ * @param msg String to log
+ * @see logMsg
+ */
+void LogCategory::error(const std::string & msg) const
+{
+ logMsg(msg, MESSAGE_LEVEL_DEBUG_ERROR);
+}
+
+//! Writes a message with message level at MESSAGE_LEVEL_DEBUG_FATAL
+/*!
+ * @param msg String to log
+ * @see logMsg
+ */
+void LogCategory::fatal(const std::string & msg) const
+{
+ logMsg(msg, MESSAGE_LEVEL_DEBUG_FATAL);
+}
+
+//! Log a message at the active message level
+/*!
+ * @param msg String to log
+ * @see logMsg
+ */
+void LogCategory::log(const std::string & msg) const
+{
+ logMsg(msg, MESSAGE_LEVEL_DEFAULT);
+}
+
+/////////////////////
+
+//! Calls the stringbuf initializer, sets the category
+LogStreamBuf::LogStreamBuf(LogCategory * category)
+ : std::stringbuf(std::ios::in|std::ios::out)
+{
+ m_category = category;
+}
+
+
+//! Reports the sync to the category, and passes the sync to the stringbuf
+int LogStreamBuf::sync()
+{
+ m_category->sync();
+ return std::stringbuf::sync();
+}
+
+//! Returns the str of the stringbuf
+std::string LogCategory::str() const
+{
+ return rdbuf()->str();
+}
+
+//! Set the str of the stringbuf
+void LogCategory::str(const std::string & s)
+{
+ rdbuf()->str(s);
+}
+
+//! Returns a pointer to the associated stringbuffer
+LogStreamBuf * LogCategory::rdbuf() const
+{
+ return const_cast<LogStreamBuf *>(&sb);
+}
diff --git a/src/Foundation/LogCategory.hh b/src/Foundation/LogCategory.hh
new file mode 100644
index 0000000..cc6790e
--- /dev/null
+++ b/src/Foundation/LogCategory.hh
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief LogCategory class interface
+
+#ifndef LOGCATEGORY_HH
+#define LOGCATEGORY_HH 1
+
+#include <string>
+#include <sstream>
+#include "MessageLevel.hh"
+
+#include "Logger.hh"
+#include "CategoryInformation.hh"
+
+using namespace std;
+
+
+//! Derives from stringbuf so that sync messages can be intercepted
+class LogStreamBuf : public std::stringbuf
+{
+public:
+ LogStreamBuf(LogCategory * category);
+ int sync();
+
+private:
+ //! The associated category
+ LogCategory * m_category;
+};
+
+
+//! Provides an interface for logging to a specific category
+/*! LogCategory provides an interface to underlying CategoryInformation.
+ * LogCategory derives from ostream for insertion style logging, and
+ * creates LogMsg objects for all log messages, and sends them to the log
+ * manager.
+ */
+class LogCategory : public std::ostream
+{
+public:
+ LogCategory(const LogCategory & input);
+ LogCategory(Logger * logger,
+ std::string categoryName,
+ MessageLevel messageLevel = MESSAGE_LEVEL_DEFAULT,
+ MessageLevel filterLevel = MESSAGE_LEVEL_DEFAULT);
+
+ LogCategory(CategoryInformation * categoryInformation,
+ Logger * logger);
+ ~LogCategory();
+
+ LogCategory & operator= (const LogCategory & input);
+
+ // Get a different category from log manager
+ LogCategory getCategory(std::string categoryName,
+ MessageLevel messageLevel = MESSAGE_LEVEL_DEFAULT,
+ MessageLevel filterLevel = MESSAGE_LEVEL_DEFAULT);
+
+ // Category Data Functions
+ std::string getCategoryName() const;
+
+ MessageLevel getFilterLevel() const;
+ void setFilterLevel(MessageLevel filterLevel);
+ void setFilterLevel(int filterLevel);
+
+ MessageLevel getMessageLevel() const;
+ void setMessageLevel(MessageLevel messageLevel);
+ void setMessageLevel(int messageLevel);
+
+ void pushMessageLevel(MessageLevel messageLevel);
+ void pushMessageLevel(int messageLevel);
+ void popMessageLevel();
+
+ // Category Management
+ void disable();
+
+ // Log Messages
+ void logMsg(const std::string & msg,
+ MessageLevel messageLevel=MESSAGE_LEVEL_DEFAULT) const;
+
+ void debug (const std::string & msg) const;
+ void debugH (const std::string & msg) const;
+ void debugM (const std::string & msg) const;
+ void debugL (const std::string & msg) const;
+ void information (const std::string & msg) const;
+ void warning (const std::string & msg) const;
+ void error (const std::string & msg) const;
+ void fatal (const std::string & msg) const;
+ void log (const std::string & msg) const;
+
+private:
+ // ostream operations
+ LogStreamBuf * rdbuf() const;
+ std::string str() const;
+ void str(const std::string & s);
+ void sync();
+ bool m_alreadySyncing;
+
+ //! The current category
+ CategoryInformation * m_category;
+
+ //! The log manager
+ Logger * m_logger;
+
+ //! The pid of the program/thread that created this LogCategory
+ int m_pid;
+
+ //! The underling buffer is a friend so it can call back
+ friend class LogStreamBuf;
+ LogStreamBuf sb;
+};
+
+
+
+#endif
diff --git a/src/Foundation/LogMsg.cc b/src/Foundation/LogMsg.cc
new file mode 100644
index 0000000..9989ff5
--- /dev/null
+++ b/src/Foundation/LogMsg.cc
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief LogMsg class implementation
+
+#include "LogMsg.hh"
+
+//! Constructor sets parameters, and timestamps creation
+LogMsg::LogMsg(std::string msg,
+ CategoryInformation * category,
+ MessageLevel messageLevel,
+ int pid,
+ bool forceLog)
+{
+ m_msg = msg;
+ m_category = category;
+ m_messageLevel = messageLevel;
+ m_pid = pid;
+
+ time(&m_timeStamp);
+ m_doLog = forceLog || m_category->doLog(m_messageLevel);
+}
+
+//! Gets the category name
+std::string LogMsg::getCategory() const
+{
+ return m_category->getCategoryName();
+}
+
+//! Gets the timestamp in time_t format
+time_t LogMsg::getTimeStamp() const
+{
+ return m_timeStamp;
+}
+
+//! Gets the message level of the LogMsg
+MessageLevel LogMsg::getMessageLevel() const
+{
+ return m_messageLevel;
+}
+
+//! Gets the msg std::string
+const std::string & LogMsg::getMsg() const
+{
+ return m_msg;
+}
+
+//! Gets the pid
+int LogMsg::getPID() const
+{
+ return m_pid;
+}
+
+//! Gets the message count
+int LogMsg::getMsgCount() const
+{
+ return m_msgCount;
+}
+
+//! Sets the message count
+void LogMsg::setMsgCount(int msgCount)
+{
+ m_msgCount = msgCount;
+}
+
+
+//! Returns if message should be logged or not
+/*! m_doLog is set at creation in case category changes before message
+ * is ready. m_doLog is set based on if the category filterLevel and this
+ * message's messageLevel, but can be overwritten by using the forcelog flag
+ * at creation.
+ */
+bool LogMsg::doLog() const
+{
+ return m_doLog;
+}
+
+//! Determines if message is at MESSAGE_LEVEL_DEBUG_ERROR or lower
+/*!
+ * @return If message is fatal
+ */
+bool LogMsg::isFatal() const
+{
+ return m_messageLevel <= MESSAGE_LEVEL_DEBUG_ERROR;
+}
+
+//! Gets a string with the name of the message level
+/*! Converts known message levels into symbolic form
+ */
+std::string LogMsg::getMessageLevelStr() const
+{
+ std::string retval;
+ switch (m_messageLevel)
+ {
+ case MESSAGE_LEVEL_DEBUG_HIGH:
+ {
+ retval = "HIGH";
+ break;
+ }
+
+ case MESSAGE_LEVEL_DEBUG_MEDIUM:
+ {
+ retval = "MED";
+ break;
+ }
+
+ case MESSAGE_LEVEL_DEBUG_LOW:
+ {
+ retval = "LOW";
+ break;
+ }
+
+ case MESSAGE_LEVEL_DEBUG_INFORMATION:
+ {
+ retval = "INFO";
+ break;
+ }
+
+ case MESSAGE_LEVEL_DEBUG_WARNING:
+ {
+ retval = "WARN";
+ break;
+ }
+
+ case MESSAGE_LEVEL_DEBUG_ERROR:
+ {
+ retval = "ERROR";
+ break;
+ }
+
+ case MESSAGE_LEVEL_DEBUG_FATAL:
+ {
+ retval = "FATAL";
+ break;
+ }
+
+ default:
+ {
+ char buffer[16];
+ snprintf(buffer, sizeof(buffer), "%d", m_messageLevel);
+ retval = buffer;
+ break;
+ }
+ };
+
+ return retval;
+}
+
+
+
+//! Writes the prefix and msg to an output stream
+/*! Prefix format is:
+ * "YYYYMMDD|hhmmss|PID|CATEGORY|MESSAGE_LEVEL|COUNT: "
+ */
+std::ostream & operator<< (std::ostream & os, const LogMsg & logMsg)
+{
+ // Get the time stamp
+ time_t rawtime = logMsg.getTimeStamp();
+ tm * now = localtime(&rawtime);
+
+ // Date/time string is actually fixed at 17 chars long, but thats an
+ // unnatural boundary
+ char buffer[32];
+ strftime(buffer, sizeof(buffer), "%Y%m%d|%H%M%S|", now);
+
+ // Write the prefix
+ os << buffer
+ << logMsg.getPID() << "|"
+ << logMsg.getCategory() << "|"
+ << logMsg.getMessageLevelStr() << "|"
+ << logMsg.getMsgCount() << ": ";
+
+ // Write the actual message
+ os << logMsg.getMsg();
+
+ return os;
+}
+
+
diff --git a/src/Foundation/LogMsg.hh b/src/Foundation/LogMsg.hh
new file mode 100644
index 0000000..b7a22e1
--- /dev/null
+++ b/src/Foundation/LogMsg.hh
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief LogMsg class interface
+
+#ifndef LOGMSG_HH
+#define LOGMSG_HH 1
+
+#include <string>
+#include <time.h>
+#include "MessageLevel.hh"
+
+class Logger;
+class CategoryInformation;
+#include "CategoryInformation.hh"
+
+//! Holds information for each item to be logged
+/*! Holds the raw string, message level, category information, and other
+ * attributes of each item to send to the log.
+ */
+class LogMsg
+{
+public:
+ LogMsg(std::string msg,
+ CategoryInformation * category,
+ MessageLevel messageLevel,
+ int pid,
+ bool forceLog = false);
+
+ // Getters and Setters
+ void setMsgCount(int msgCount);
+
+ int getPID() const;
+ int getMsgCount() const;
+ time_t getTimeStamp() const;
+ MessageLevel getMessageLevel() const;
+ std::string getMessageLevelStr() const;
+ std::string getCategory() const;
+
+ const std::string & getMsg() const;
+
+ // Message Level testing
+ bool doLog() const;
+ bool isFatal() const;
+
+private:
+ //! Message to Log
+ std::string m_msg;
+
+ //! Category message is associated with
+ CategoryInformation * m_category;
+
+ //! Timestamp of message
+ time_t m_timeStamp;
+
+ //! Message level
+ MessageLevel m_messageLevel;
+
+ //! If this message should be logged (as determined at creation)
+ bool m_doLog;
+
+ //! Holds the pid of orignating thread/program
+ int m_pid;
+
+ //! Holds the global msg count of this message
+ int m_msgCount;
+};
+
+std::ostream & operator<< (std::ostream & os, const LogMsg & logMsg);
+
+#endif
diff --git a/src/Foundation/Logger.cc b/src/Foundation/Logger.cc
new file mode 100644
index 0000000..bef1829
--- /dev/null
+++ b/src/Foundation/Logger.cc
@@ -0,0 +1,705 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief Logger class implementation
+
+/** @example example-logging.cc
+ * Demonstrates logging capabilities.\n\n
+ * Log messages are written to the log from three different categories, and
+ * at various message levels using both insertion style and string messages.\n
+ *
+ * A separate log category should be used for different functional parts of
+ * the program. In this example, "MAIN" (implicitly), "A", and "B" are used.\n
+ *
+ * Different message levels should be used to note importance to the different
+ * messages, so that very important messages will be noticed, but lower
+ * priority messages can be filtered or ignored.
+ */
+
+/** @example example-logging-1.log
+ * Sample log from example-logging.\n\n
+ * In this example, --debug 7 is passed to example-logging, which
+ * sets the default filter level to MESSAGE_LEVEL_DEBUG_HIGH. This is the
+ * most verbose filter level. By default, the name of the logfile is just
+ * the name of the program followed by .log, but in this case, an explicit
+ * logfile name is given. In either case, the name of the error file will be
+ * the same as the logfile, but .log will be replaced with .error. Also by
+ * default, the old logfile is deleted, unless the option --append is used.
+ */
+
+/** @example example-logging-1.error
+ * Sample error log from example-logging.\n\n
+ * Regardless of the filter level settings, log events with a message level
+ * greater than or equal to MESSAGE_LEVEL_DEBUG_ERROR will be written to the
+ * error log as well.
+ */
+
+/** @example example-logging-2.log
+ * Sample log from example-logging.\n\n
+ * In this example, all categories are disabled by default, but category 'A'
+ * is enabled and its filter level is set to 3 (MESSAGE_LEVEL_DEBUG_WARNING).\n
+ * More categories could have been enabled by adding them to the command line
+ * option filterlevel.\n\n
+ * The syntax is fl[,CATEGORY=fl[...]] where:\n
+ * fl is the filterlevel to set (0 disables the category)\n
+ * CATEGORY is the name of the category\n
+ * [...] means that as many categories can be set as desired\n
+ */
+
+/** @example example-logging-2.error
+ * Sample error log from example-logging.\n\n
+ * This has the same contents as example-logging-1.error, because error files
+ * are independent of the filter level settings.
+ */
+
+#include "Logger.hh"
+#include <cstdlib>
+
+//! Sets default values for class
+/*! Note: Log is disabled until a filter level is set\n
+ *
+ * Creates a category named "MAIN" at defaults for message and filter levels\n
+ * default filterlevel to MESSAGE_LEVEL_DEBUG_HIGH\n
+ * default messagelevel to MESSAGE_LEVEL_DEBUG_HIGH\n
+ * \n
+ * Sets m_logEnabled to false\n\n
+ *
+ * @param logfile Path to log to
+ * @param errorfile Path to write error messages to
+ * @param programName Name of program for FINISH message
+ * @param invocation Invocation of program for START message
+ */
+Logger::Logger(const char * logfile,
+ const char * errorfile,
+ const std::string & programName,
+ const std::string & invocation)
+{
+ m_startTime = 0;
+ m_msgCount = 0;
+
+ m_logEnabled = false;
+ m_firstTimeEnabled = true;
+
+ m_errorfile = NULL;
+
+ m_pid = FileSystem::getPID();
+ m_invocation = invocation;
+ m_programName = programName;
+
+ if (logfile) addLogfile(logfile, true);
+ if (errorfile) addLogfile(errorfile, false);
+
+ // Add a new category named "MAIN" to the map as the default category
+ m_defaultCategory = getCategoryInformation("MAIN",
+ MESSAGE_LEVEL_DEBUG_HIGH,
+ MESSAGE_LEVEL_DEBUG_HIGH);
+}
+
+
+//! Deconstructor disables log, deletes categories, closes logfiles
+Logger::~Logger()
+{
+ disable();
+
+ // Delete each category
+ CategoryMapCIter i;
+
+ for (i = m_categoryMap.begin();
+ i != m_categoryMap.end();
+ i++)
+ {
+ delete i->second;
+ }
+
+ // Close Logfiles
+ while (m_logfileList.size())
+ {
+ std::ofstream * tmpfile = m_logfileList.front();
+ m_logfileList.pop_front();
+ delete tmpfile;
+ }
+
+ // Close Error file
+ if (m_errorfile)
+ {
+ delete m_errorfile;
+ }
+}
+
+//! Simple function to check if the default filter level has been set
+bool Logger::hasFilterLevel() const
+{
+ return !m_firstTimeEnabled;
+}
+
+//! Converts a string to a MessageLevel
+/*! Internal function for converting a string to a MessageLevel.
+ * Note: Filter levels specified on the command line get a 10x multiplier
+ * to the real filter level used.
+ *
+ * @param filterLevel String to convert
+ * @exception InvalidOptionError If string has characters other than '0'..'9'
+ * @exception InvalidOptionError If filterlevel is empty
+ * @return Filter level as a MessageLevel
+ */
+MessageLevel Logger::convertFilterLevel(const std::string & filterLevel) const
+{
+ if (filterLevel.length() == 0)
+ {
+ throw InvalidOptionError("Cant specify an empty filterlevel",
+ "Logger::convertFilterLevel");
+ }
+
+ std::string::size_type badIndex;
+
+ badIndex = filterLevel.find_first_not_of("0123456789");
+
+ if (badIndex != filterLevel.npos)
+ {
+ throw InvalidOptionError("Cant specify a non integer filter level in " +
+ filterLevel,
+ "Logger::convertFilterLevel");
+ }
+
+ return (MessageLevel) ((atoi(filterLevel.c_str()) * 10));
+}
+
+
+//! Splits a category=filterlevel pair and sets the filter level
+/*! If no category is provided, it is assumed that the string is entirely
+ * a filter level, and the default filter level will be set.
+ *
+ * @param filterPair String of category=filterlevel
+ * @param moreThanOnePair Flags that there is more than one pair of filter
+ * levels set, so that setDefaultFilterLevel can be
+ * forced to open the log
+ */
+void Logger::setFilterLevelPair(const std::string & filterPair,
+ bool moreThanOnePair)
+{
+ std::string filterLevelName;
+
+ std::string::size_type splitIndex;
+ int filterLevel;
+
+ // Try to split the pair on "="
+ splitIndex = filterPair.find("=");
+
+ if (splitIndex == filterPair.npos)
+ {
+ // All of filterPair is setting the default filterLevel
+ filterLevel = convertFilterLevel(filterPair);
+ setDefaultFilterLevel(filterLevel, moreThanOnePair);
+ }
+ else
+ {
+ // There is a category name given
+ std::string categoryName = filterPair.substr(0, splitIndex);
+ std::string filterLevelName = filterPair.substr(splitIndex + 1,
+ filterPair.length()-splitIndex);
+
+ filterLevel = convertFilterLevel(filterLevelName);
+ getCategory(categoryName).setFilterLevel(filterLevel);
+
+ LogCategory log = getLog();
+ log.pushMessageLevel(MESSAGE_LEVEL_DEBUG_INFORMATION);
+ log << "Set category " << categoryName
+ << " to filter level " << filterLevel << std::endl;
+ log.popMessageLevel();
+ }
+}
+
+//! Set the default filter level, and levels for multiple categories
+/*!
+ * Syntax for setting multiple filter levels is:\n
+ * fl[,CATEGORY=fl[...]]\n
+ * fl means the filterlevel as a positive integer\n
+ * CATEGORY is the name of the category\n
+ * If no CATEGORY is provided, then the filterLevel will be set as the default
+ *
+ * @param filterLevels String containing filterLevels to set
+ */
+void Logger::setFilterLevels(const std::string & filterLevels)
+{
+ // Roughly in perl:
+ // foreach $filterpair split(',', $filterLevels)
+ // {
+ // setFilterLevelPair($filterPair)
+ // }
+
+ std::string filterPair;
+
+ std::string::size_type index = 0;
+ std::string::size_type splitIndex;
+ bool moreThanOnePair = false;
+ while ((splitIndex = filterLevels.find(',', index)) != filterLevels.npos)
+ {
+ moreThanOnePair = true;
+
+ filterPair = filterLevels.substr(index, splitIndex - index);
+ setFilterLevelPair(filterPair, moreThanOnePair);
+ index = splitIndex + 1;
+ }
+
+ // setFilterLevelPair on remaining string
+ filterPair = filterLevels.substr(index, filterLevels.length() - index + 1),
+ setFilterLevelPair(filterPair, moreThanOnePair);
+}
+
+//! Sets the default filter level for new categories and category "MAIN"
+/*! Messages with a message level below the filter level are not written to
+ * the log.
+ *
+ * @param filterLevel Filter level for all future categories
+ * @param forceFirstTime Force the firsttime enabled sequence, even
+ * if the default level is set to MESSAGE_LEVEL_OFF
+ * @see CategoryInformation::setFilterLevel
+ */
+void Logger::setDefaultFilterLevel(MessageLevel filterLevel,
+ bool forceFirstTime)
+{
+ if (m_firstTimeEnabled &&
+ ((filterLevel != MESSAGE_LEVEL_OFF) || forceFirstTime))
+ {
+ enable();
+ m_firstTimeEnabled = false;
+ }
+
+ m_defaultCategory->setFilterLevel(filterLevel);
+
+ // Log what the default filter level was set to
+ LogCategory log = getLog();
+ log.pushMessageLevel(MESSAGE_LEVEL_DEBUG_INFORMATION);
+ log << "Set default filter level to " << filterLevel << std::endl;
+ log.popMessageLevel();
+}
+
+//! Simple wrapper
+void Logger::setDefaultFilterLevel(int filterLevel, bool forceFirstTime)
+{
+ setDefaultFilterLevel((MessageLevel) filterLevel, forceFirstTime);
+}
+
+//! Gets the default filter level from category "MAIN"
+/*!
+ * @return Current filter level
+ */
+MessageLevel Logger::getDefaultFilterLevel() const
+{
+ return m_defaultCategory->getFilterLevel();
+}
+
+//! Gets the default message level from category "MAIN"
+/*!
+ * @return Current message level
+ */
+MessageLevel Logger::getDefaultMessageLevel() const
+{
+ return m_defaultCategory->getMessageLevel();
+}
+
+//! Sets the default message level and for category "MAIN"
+/*!
+ * @param messageLevel New default message level
+ */
+void Logger::setDefaultMessageLevel(MessageLevel messageLevel)
+{
+ m_defaultCategory->setMessageLevel(messageLevel);
+}
+
+//! Simple wrapper
+void Logger::setDefaultMessageLevel(int messageLevel)
+{
+ setDefaultMessageLevel((MessageLevel) messageLevel);
+}
+
+
+//! Checks for the existence of a category
+/*! Since only Logger can create or delete categories, checking the map
+ * will be accurate.
+ */
+bool Logger::hasCategory(std::string category) const
+{
+ return (m_categoryMap.find(category) != m_categoryMap.end());
+}
+
+//! Gets a LogCategory for category "MAIN"
+LogCategory Logger::getLog()
+{
+ return LogCategory(m_defaultCategory, this);
+}
+
+//! Utility Function to find the CategoryInformation for a given categoryName
+/*! Returns the internal information for a category from the category map.
+ * If the category is not found, it is added to the map. Only Logger can
+ * create new CategoryInformation objects. \n\n
+ *
+ * Note: MESSAGE_LEVEL_DEFAULT means to use the existing level for existing
+ * categories or to use the default level for new categories.
+ *
+ * @param categoryName Name of category to get
+ * @param messageLevel Message level of category to get
+ * @param filterLevel FilterLevel of category to get
+ * @return CategoryInformation of categoryName
+ */
+CategoryInformation * Logger::getCategoryInformation(std::string categoryName,
+ MessageLevel messageLevel,
+ MessageLevel filterLevel)
+{
+ CategoryInformation * retval;
+
+ if (hasCategory(categoryName))
+ {
+ retval = m_categoryMap[categoryName];
+
+ if (messageLevel != MESSAGE_LEVEL_DEFAULT)
+ {
+ retval->setMessageLevel(messageLevel);
+ }
+
+ if (filterLevel != MESSAGE_LEVEL_DEFAULT)
+ {
+ retval->setFilterLevel(filterLevel);
+ }
+ }
+ else
+ {
+ if (messageLevel == MESSAGE_LEVEL_DEFAULT)
+ {
+ messageLevel = m_defaultCategory->getMessageLevel();
+ }
+
+ if (filterLevel == MESSAGE_LEVEL_DEFAULT)
+ {
+ filterLevel = m_defaultCategory->getFilterLevel();
+ }
+
+ // Create and store this new category in the main map
+ retval = new CategoryInformation(categoryName, messageLevel, filterLevel);
+ m_categoryMap[categoryName] = retval;
+ }
+
+ return retval;
+}
+
+//! Gets a LogCategory wrapping the CategoryInformation of categoryName
+/*!
+ * @see getCategoryInformation
+ */
+LogCategory Logger::getCategory(std::string categoryName,
+ MessageLevel messageLevel,
+ MessageLevel filterLevel)
+{
+ return LogCategory(getCategoryInformation(categoryName,
+ messageLevel,
+ filterLevel),
+ this);
+}
+
+//! Enables the log if it was previously disabled
+/*! Opens the log file if it is the first time the log is enabled
+ * @see disable
+ */
+void Logger::enable()
+{
+ if (!m_logEnabled)
+ {
+ if (m_firstTimeEnabled)
+ {
+ openLogFiles();
+ }
+
+ m_logEnabled = true;
+ writeOpenLogSequence(NULL);
+ }
+}
+
+//! Disables the log for all messages if it was previously enabled
+/*! Writes close log sequence to log files
+ * @see enable
+ */
+void Logger::disable()
+{
+ if (m_logEnabled)
+ {
+ writeLog(new LogMsg(getCloseLogStr(),
+ m_defaultCategory,
+ MESSAGE_LEVEL_DEBUG_INFORMATION,
+ m_pid,
+ true),
+ true, NULL);
+
+ m_logEnabled = false;
+ }
+}
+
+//! Returns if log is currently enabled
+bool Logger::isEnabled() const
+{
+ return m_logEnabled;
+}
+
+
+
+//! Determines if message should be written to the log
+/*! Determined by m_logEnabled which is set when a default filter level is set
+ *
+ * @return Boolean indicating if message should be written
+ */
+bool Logger::doLog() const
+{
+ return m_logEnabled;
+}
+
+//! Opens the errorfile
+/*!
+ * @exception UnableToOpenError
+ * @see FileSystem::openOutputFile
+ */
+void Logger::openErrorFile()
+{
+ if (m_errorfileName.length())
+ {
+ m_errorfile = FileSystem::openOutputFile(m_errorfileName);
+ }
+}
+
+
+//! Opens the log files
+/*!
+ * @exception UnableToOpenError
+ * @see FileSystem::openOutputFile
+ */
+void Logger::openLogFiles()
+{
+ StringListCIter pFilename;
+
+ for (pFilename = m_logfileNameList.begin();
+ pFilename != m_logfileNameList.end();
+ pFilename++)
+ {
+ std::ofstream * logfile = FileSystem::openOutputFile(*pFilename);
+
+ m_logfileList.push_back(logfile);
+ addOutputStream(logfile);
+ }
+}
+
+
+
+//! Add a log file to output list
+/*!
+ * @param filename File to open
+ * @param isLogFile If File is for logging (vs error only)
+ */
+void Logger::addLogfile(const char * filename, bool isLogFile)
+{
+ if (filename)
+ {
+ if (isLogFile)
+ {
+ m_logfileNameList.push_back((std::string)filename);
+ }
+ else
+ {
+ m_errorfileName = (std::string) filename;
+ }
+ }
+}
+
+
+//! Add an output stream to the list of streams to log to
+void Logger::addOutputStream(std::ostream * os)
+{
+ // Add this stream to the list of output streams
+ m_outputStreamList.push_back(os);
+
+ if (m_logEnabled)
+ {
+ // This sequence was added after the log was enabled,
+ // write open log sequence
+
+ writeOpenLogSequence(os);
+ }
+}
+
+//! Takes a message, formats it, and logs it to log and possibly error file
+/*! If it is a fatal error, also calls writeFatal().\n\n
+ * Note: Deletes logMsg when done.
+ *
+ * @param logMsg Message to log
+ * @param incrementCount If this object should increment the global msg count
+ * @param os Output stream to write to, NULL means write to all output stream
+ */
+void Logger::writeLog(LogMsg * logMsg,
+ bool incrementCount,
+ std::ostream * os)
+{
+ if (logMsg)
+ {
+ bool dolog = doLog() && logMsg->doLog();
+
+ if (dolog || logMsg->isFatal())
+ {
+ logMsg->setMsgCount(m_msgCount);
+
+ if (incrementCount)
+ {
+ m_msgCount++;
+ }
+
+ if (dolog)
+ {
+ if (os == NULL)
+ {
+ std::list<std::ostream *>::const_iterator hOutputStream;
+
+ for (hOutputStream = m_outputStreamList.begin();
+ hOutputStream != m_outputStreamList.end();
+ hOutputStream++)
+ {
+ **hOutputStream << *logMsg << std::endl << std::flush;
+ }
+ }
+ else
+ {
+ *os << *logMsg << std::endl << std::flush;
+ }
+ }
+
+ if (logMsg->isFatal())
+ {
+ writeFatal(logMsg);
+ }
+ }
+
+ delete logMsg;
+ }
+}
+
+
+//! Writes fully formated message to the error file
+/*! Messages are automatically forwarded to writeFatal from writeLog\n
+ *
+ * Note: If writeFatal is called before the log has been enabled (and
+ * consequently before the errorfile is opened) it will open the errorfile.
+ *
+ * @param logMsg Message to write
+ */
+void Logger::writeFatal(LogMsg * logMsg)
+{
+ if (logMsg)
+ {
+ if (!m_errorfile)
+ {
+ openErrorFile();
+ }
+
+ if (m_errorfile)
+ {
+ *m_errorfile << *logMsg << std::endl << std::flush;
+ }
+ }
+}
+
+
+// String Functions
+
+//! Gets the START message for log files
+std::string Logger::getOpenLogStr()
+{
+ if (m_startTime == 0);
+ {
+ // if this is the first time the log has been enabled,
+ // mark the start time
+ time(&m_startTime);
+ }
+
+ return "START: " + m_invocation;
+}
+
+//! Gets the name of the user (based on getuid) for logfile
+std::string Logger::getUsernameStr() const
+{
+ std::string username = "Unknown";
+
+ if (struct passwd * userInfo = getpwuid(getuid()))
+ {
+ username = (std::string) userInfo->pw_name;
+ }
+
+ return "Username: " + username;
+}
+
+//! Gets the name of the hostname for log file
+std::string Logger::getHostnameStr() const
+{
+ std::string hostname = "Unknown";
+ char buffer[256]; // MAXHOSTNAMELEN for solaris
+
+ if (!gethostname(buffer, sizeof(buffer)))
+ {
+ hostname = (std::string) buffer;
+ }
+
+ return "Hostname: " + hostname;
+}
+
+//! Gets FINISH message for log files
+std::string Logger::getCloseLogStr() const
+{
+ time_t endTime;
+ time(&endTime);
+
+ double elapsed = difftime(endTime, m_startTime);
+
+ int num_days = (int) (elapsed / 86400);
+ elapsed -= num_days * 86400;
+
+ int num_hours = (int) (elapsed / 3600);
+ elapsed -= num_hours * 3600;
+
+ int num_min = (int) (elapsed / 60);
+ elapsed -= num_min * 60;
+
+ int num_sec = (int) elapsed;
+
+ char buffer[16];
+ snprintf(buffer, sizeof(buffer),
+ "%03d-%02d:%02d:%02d", num_days, num_hours, num_min, num_sec);
+
+ return "FINISH: " + m_programName + ", elapsed " + buffer;
+}
+
+//! Writes the sequence of START, username, hostname
+/*! Checks if it should write the sequence before writing it
+ * @param os Output stream, or NULL for all logfiles
+ */
+void Logger::writeOpenLogSequence(std::ostream * os)
+{
+ writeLog(new LogMsg(getOpenLogStr(),
+ m_defaultCategory,
+ MESSAGE_LEVEL_DEBUG_INFORMATION,
+ m_pid,
+ true),
+ os == NULL, os);
+
+ writeLog(new LogMsg(getUsernameStr(),
+ m_defaultCategory,
+ MESSAGE_LEVEL_DEBUG_INFORMATION,
+ m_pid,
+ true),
+ os == NULL, os);
+
+ writeLog(new LogMsg(getHostnameStr(),
+ m_defaultCategory,
+ MESSAGE_LEVEL_DEBUG_INFORMATION,
+ m_pid,
+ true),
+ os == NULL, os);
+}
diff --git a/src/Foundation/Logger.hh b/src/Foundation/Logger.hh
new file mode 100644
index 0000000..36156a8
--- /dev/null
+++ b/src/Foundation/Logger.hh
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief Logger class interface
+
+#ifndef LOGGER_HH
+#define LOGGER_HH 1
+
+#include <map>
+#include <list>
+#include <string>
+#include <fstream>
+
+#include <time.h>
+#include <pwd.h>
+
+#include "FileSystem.hh"
+#include "MessageLevel.hh"
+
+class LogMsg;
+#include "LogMsg.hh"
+
+class CategoryInformation;
+#include "CategoryInformation.hh"
+
+class LogCategory;
+#include "LogCategory.hh"
+
+typedef std::list<CategoryInformation *> CategoryStack;
+typedef std::list<std::string>::const_iterator StringListCIter;
+typedef std::map<std::string, CategoryInformation *> CategoryMap;
+typedef CategoryMap::const_iterator CategoryMapCIter;
+
+
+//! Manager for logging operations, acts as a backend to write to
+/*! Manages the map of all categories, takes LogMsg and writes them to open log
+ * files, handles default filter levels and message levels
+ */
+class Logger
+{
+public:
+ Logger(const char * logfile,
+ const char * errorfile,
+ const std::string & programName,
+ const std::string & invocation);
+ ~Logger();
+
+ void addLogfile(const char * filename, bool isLogFile=true);
+ void addOutputStream(std::ostream * os);
+
+ // Defaults
+ void setFilterLevels(const std::string & filterLevels);
+ bool hasFilterLevel() const;
+
+ MessageLevel getDefaultFilterLevel() const;
+ void setDefaultFilterLevel(MessageLevel filterLevel,
+ bool forceFirstTime = false);
+ void setDefaultFilterLevel(int filterLevel,
+ bool forceFirstTime = false);
+
+ MessageLevel getDefaultMessageLevel() const;
+ void setDefaultMessageLevel(MessageLevel messageLevel);
+ void setDefaultMessageLevel(int messageLevel);
+
+
+ // Category Management
+ LogCategory getCategory(std::string categoryName,
+ MessageLevel messageLevel = MESSAGE_LEVEL_DEFAULT,
+ MessageLevel filterLevel = MESSAGE_LEVEL_DEFAULT);
+
+ CategoryInformation * getCategoryInformation(std::string categoryName,
+ MessageLevel messageLevel = MESSAGE_LEVEL_DEFAULT,
+ MessageLevel filterLevel = MESSAGE_LEVEL_DEFAULT);
+
+ LogCategory getLog();
+
+ // Logging Master Control
+ void enable();
+ void disable();
+ bool isEnabled() const;
+
+ // Main logging function
+ void writeLog(LogMsg * logMsg,
+ bool incrementCount = true,
+ std::ostream * os = NULL);
+
+private:
+ void writeFatal(LogMsg * logMsg);
+
+ MessageLevel convertFilterLevel(const std::string & filterLevel) const;
+ void setFilterLevelPair(const std::string & filterPair,
+ bool moreThanOnePair);
+
+ bool hasCategory(std::string category) const;
+ bool doLog() const;
+
+ void openErrorFile();
+ void openLogFiles();
+
+ void writeOpenLogSequence(std::ostream * os);
+ std::string getOpenLogStr();
+ std::string getUsernameStr() const;
+ std::string getHostnameStr() const;
+
+ std::string getCloseLogStr() const;
+
+ //! Boolean to determine if log is enabled
+ bool m_logEnabled;
+
+ //! Determines if this is the first time the log is enabled
+ bool m_firstTimeEnabled;
+
+ //! Information for default category for getLog
+ CategoryInformation * m_defaultCategory;
+
+ //! Maps category names to category information
+ CategoryMap m_categoryMap;
+
+ //! Counter for log messages
+ int m_msgCount;
+
+ //! PID of program/thread that created the logger
+ int m_pid;
+
+ //! List of Output Streams
+ std::list<std::ostream *> m_outputStreamList;
+
+ //! List of logfiles
+ std::list<std::ofstream *> m_logfileList;
+
+ //! List of log file names
+ std::list<std::string> m_logfileNameList;
+
+ //! Name of errorfile
+ std::string m_errorfileName;
+
+ //! Errorfile
+ std::ofstream * m_errorfile;
+
+ //! Marks when log is first enabled
+ time_t m_startTime;
+
+ //! Invocation of program
+ std::string m_invocation;
+
+ //! Name of program
+ std::string m_programName;
+};
+
+#endif
diff --git a/src/Foundation/Makefile.am b/src/Foundation/Makefile.am
new file mode 100644
index 0000000..c13fa7a
--- /dev/null
+++ b/src/Foundation/Makefile.am
@@ -0,0 +1,35 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+AM_CXXFLAGS = -I$(top_builddir)/src/GNU
+
+amoslib_LIBRARIES = \
+ libAMOSFoundation.a
+
+amosinclude_HEADERS = \
+ AMOS_Foundation.hh \
+ CategoryInformation.hh \
+ ConfigFile.hh \
+ ConfigSection.hh \
+ Exceptions.hh \
+ FileSystem.hh \
+ LogCategory.hh \
+ Logger.hh \
+ LogMsg.hh \
+ MessageLevel.hh \
+ OptionResult.hh \
+ Options.hh
+
+
+libAMOSFoundation_a_SOURCES = \
+ CategoryInformation.cc \
+ ConfigFile.cc \
+ ConfigSection.cc \
+ Exceptions.cc \
+ FileSystem.cc \
+ LogCategory.cc \
+ Logger.cc \
+ LogMsg.cc \
+ OptionResult.cc \
+ Options.cc \
+ AMOS_Foundation.cc
diff --git a/src/Foundation/Makefile.in b/src/Foundation/Makefile.in
new file mode 100644
index 0000000..4841bcd
--- /dev/null
+++ b/src/Foundation/Makefile.in
@@ -0,0 +1,644 @@
+# 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 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@
+DIST_COMMON = $(amosinclude_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+subdir = src/Foundation
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(amoslibdir)" \
+ "$(DESTDIR)$(amosincludedir)"
+LIBRARIES = $(amoslib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libAMOSFoundation_a_AR = $(AR) $(ARFLAGS)
+libAMOSFoundation_a_LIBADD =
+am_libAMOSFoundation_a_OBJECTS = CategoryInformation.$(OBJEXT) \
+ ConfigFile.$(OBJEXT) ConfigSection.$(OBJEXT) \
+ Exceptions.$(OBJEXT) FileSystem.$(OBJEXT) \
+ LogCategory.$(OBJEXT) Logger.$(OBJEXT) LogMsg.$(OBJEXT) \
+ OptionResult.$(OBJEXT) Options.$(OBJEXT) \
+ AMOS_Foundation.$(OBJEXT)
+libAMOSFoundation_a_OBJECTS = $(am_libAMOSFoundation_a_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(libAMOSFoundation_a_SOURCES)
+DIST_SOURCES = $(libAMOSFoundation_a_SOURCES)
+HEADERS = $(amosinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CXXFLAGS = -I$(top_builddir)/src/GNU
+amoslib_LIBRARIES = \
+ libAMOSFoundation.a
+
+amosinclude_HEADERS = \
+ AMOS_Foundation.hh \
+ CategoryInformation.hh \
+ ConfigFile.hh \
+ ConfigSection.hh \
+ Exceptions.hh \
+ FileSystem.hh \
+ LogCategory.hh \
+ Logger.hh \
+ LogMsg.hh \
+ MessageLevel.hh \
+ OptionResult.hh \
+ Options.hh
+
+libAMOSFoundation_a_SOURCES = \
+ CategoryInformation.cc \
+ ConfigFile.cc \
+ ConfigSection.cc \
+ Exceptions.cc \
+ FileSystem.cc \
+ LogCategory.cc \
+ Logger.cc \
+ LogMsg.cc \
+ OptionResult.cc \
+ Options.cc \
+ AMOS_Foundation.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Foundation/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Foundation/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):
+install-amoslibLIBRARIES: $(amoslib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(amoslibdir)" || $(MKDIR_P) "$(DESTDIR)$(amoslibdir)"
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(amoslibdir)'"; \
+ $(INSTALL_DATA) $$list2 "$(DESTDIR)$(amoslibdir)" || exit $$?; }
+ @$(POST_INSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ for p in $$list; do \
+ if test -f $$p; then \
+ $(am__strip_dir) \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && $(RANLIB) $$f )"; \
+ ( cd "$(DESTDIR)$(amoslibdir)" && $(RANLIB) $$f ) || exit $$?; \
+ else :; fi; \
+ done
+
+uninstall-amoslibLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && rm -f "$$files" )"; \
+ cd "$(DESTDIR)$(amoslibdir)" && rm -f $$files
+
+clean-amoslibLIBRARIES:
+ -test -z "$(amoslib_LIBRARIES)" || rm -f $(amoslib_LIBRARIES)
+libAMOSFoundation.a: $(libAMOSFoundation_a_OBJECTS) $(libAMOSFoundation_a_DEPENDENCIES)
+ -rm -f libAMOSFoundation.a
+ $(libAMOSFoundation_a_AR) libAMOSFoundation.a $(libAMOSFoundation_a_OBJECTS) $(libAMOSFoundation_a_LIBADD)
+ $(RANLIB) libAMOSFoundation.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/AMOS_Foundation.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CategoryInformation.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ConfigFile.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ConfigSection.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Exceptions.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/FileSystem.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/LogCategory.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/LogMsg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Logger.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/OptionResult.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Options.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+install-amosincludeHEADERS: $(amosinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(amosincludedir)" || $(MKDIR_P) "$(DESTDIR)$(amosincludedir)"
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(amosincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(amosincludedir)" || exit $$?; \
+ done
+
+uninstall-amosincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amosincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(amosincludedir)" && rm -f $$files
+
+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) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(amosincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-amoslibLIBRARIES clean-generic 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-amosincludeHEADERS install-amoslibLIBRARIES
+
+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:
+
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-amosincludeHEADERS uninstall-amoslibLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-amoslibLIBRARIES clean-generic ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-amosincludeHEADERS install-amoslibLIBRARIES \
+ 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-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-amosincludeHEADERS \
+ uninstall-amoslibLIBRARIES uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Foundation/MessageLevel.hh b/src/Foundation/MessageLevel.hh
new file mode 100644
index 0000000..1e204c5
--- /dev/null
+++ b/src/Foundation/MessageLevel.hh
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief Defines the enum MessageLevel
+
+#ifndef MESSAGELEVEL_HH
+#define MESSAGELEVEL_HH 1
+
+//! Message and filter levels for messages.
+/* Message levels are listed from least verbose/most critical to most verbose/
+ * least critical. There is a gap between each message level so that custom
+ * levels can be set in between the standard levels.
+ *
+ * Filter levels set on the command line get a 10x multiplier
+ *
+ * Note: If there are any additions to this list, make sure to add it
+ * to LogMsg::getMessageLevelStr() as well
+ */
+enum MessageLevel
+{
+ MESSAGE_LEVEL_DEFAULT = -1, // Flag value
+ MESSAGE_LEVEL_OFF = 0,
+ MESSAGE_LEVEL_DEBUG_FATAL = 10,
+ MESSAGE_LEVEL_DEBUG_ERROR = 20,
+ MESSAGE_LEVEL_DEBUG_WARNING = 30,
+ MESSAGE_LEVEL_DEBUG_INFORMATION = 40,
+ MESSAGE_LEVEL_DEBUG_LOW = 50,
+ MESSAGE_LEVEL_DEBUG_MEDIUM = 60,
+ MESSAGE_LEVEL_DEBUG_HIGH = 70
+};
+
+#endif
diff --git a/src/Foundation/OptionResult.cc b/src/Foundation/OptionResult.cc
new file mode 100644
index 0000000..5cc79dd
--- /dev/null
+++ b/src/Foundation/OptionResult.cc
@@ -0,0 +1,483 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief OptionResult class implementation
+
+#include "OptionResult.hh"
+#include <cstdlib>
+
+//! Sets defaults for all results
+OptionResult::OptionResult(const std::string & optionHelp)
+{
+ m_has_arg = 0;
+ m_resultSet = 0;
+ m_negationSet = 0;
+
+ m_optionHelp = optionHelp;
+}
+
+//! Empty Deconstructor
+OptionResult::~OptionResult()
+{ }
+
+//! Gets the raw value that was set
+std::string OptionResult::getRawValue() const
+{
+ return m_rawval;
+}
+
+//! Adds a name or alias to a result class
+/*! The first time this is called, it adds it as its name. If it has a
+ * negation, then it adds "no"name as well.
+ *
+ * Also resets the iterator for getNextAlias()
+ *
+ * @param name
+ * @param hasNegation
+ */
+void OptionResult::addNameOrAlias(const std::string & name, bool hasNegation)
+{
+ if (m_name == "")
+ {
+ m_name = name;
+ }
+
+ // Insert this name into the map as not being a negation
+ m_aliases[name] = false;
+
+ // If it has a negation, add it into the map as well as a negation
+ if (hasNegation)
+ {
+ m_aliases["no" + name] = true;
+ }
+
+ resetAliasIter();
+}
+
+//! Returns if a given name is a negation
+bool OptionResult::isNegation(const std::string & name)
+{
+ return m_aliases[name];
+}
+
+//! Verifies that the type of the class matches the requested type
+/*!
+ * @exception InvalidOptionError If there is a type mismatch
+ */
+void OptionResult::verifyType(char optionType)
+{
+ if (m_type != optionType)
+ {
+ throw InvalidOptionError((std::string) "Option Type mismatch: Asked for "
+ + optionType
+ + (std::string)" but gave pointer to "
+ + m_type + " in " + m_name,
+ "Options");
+ }
+}
+
+//! Gets the next alias from map using the class iterator
+std::string OptionResult::getNextAlias()
+{
+ std::string retval;
+
+ if (m_aliasesIter != m_aliases.end())
+ {
+ retval = m_aliasesIter->first;
+ m_aliasesIter++;
+ }
+
+ return retval;
+}
+
+//! Returns the main name of the object
+std::string OptionResult::getName() const
+{
+ return m_name;
+}
+
+//! Resets the object iterator for getNextAlias
+void OptionResult::resetAliasIter()
+{
+ m_aliasesIter = m_aliases.begin();
+}
+
+//! Simple getter to check if option takes an argument in positive form
+/*! Uses same syntax as getopt
+ * @see setHas_arg
+ */
+int OptionResult::has_arg()
+{
+ return m_has_arg;
+}
+
+//! Simple setter for if option takes an argument in positive form
+/*! Uses same syntax as getopt
+ * @see has_arg
+ */
+void OptionResult::setHas_arg(int has_arg)
+{
+ m_has_arg = has_arg;
+}
+
+//! Increments the proper counter for the name
+void OptionResult::incrementCount(const std::string & name)
+{
+ if (isNegation(name))
+ {
+ m_negationSet++;
+ }
+ else
+ {
+ m_resultSet++;
+ }
+}
+
+//! Validates that the option name should or should not take an argument
+/*!
+ * @exception InvalidOptionError If option was given an argument but takes none
+ * @exception InvalidOptionError If option wasnt given a required argument
+ */
+void OptionResult::validateArgumentCount(const std::string & name,
+ const std::string & val)
+{
+ if (val.length())
+ {
+ // Validate that it should have an argument
+ if (!m_has_arg || isNegation(name))
+ {
+ throw InvalidOptionError("Argument given to " + name + " but takes none",
+ "validateArgumentCount");
+ }
+ }
+ else
+ {
+ // Validate that it shouldnt have an argument
+ if (m_has_arg == 1)
+ {
+ throw InvalidOptionError("No Argument given to " + name
+ + " but requires one",
+ "validateArgumentCount");
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+//! Returns the number of times an option was set
+/*! Note: Separate counters are maintained for positive or negative options,
+ * so caller may need to call resultSet("option") and resultSet("nooption")
+ * to find out what was really specified.
+ */
+int OptionResult::resultSet(const std::string & name)
+{
+ int retval = 0;
+
+ if (m_aliases[name])
+ {
+ retval = m_negationSet;
+ }
+ else
+ {
+ retval = m_resultSet;
+ }
+
+ return retval;
+}
+
+//! Iterates through each alias and prints the option help
+/*!
+ * @param isStandardOption Standard options should not print their defaults
+ */
+void OptionResult::printHelp(bool isStandardOption)
+{
+ std::map<std::string, bool>::const_iterator i;
+
+ // Loop through all of the aliases to find the longest name
+ int maxlen = 0;
+ for (i = m_aliases.begin();
+ i != m_aliases.end();
+ i++)
+ {
+ int thislen = i->first.length();
+ if (thislen > 1) thislen++;
+
+ // If this is a negative name add strlen (" Disables")
+ if (i->second) thislen += 9;
+
+ if (thislen > maxlen) maxlen = thislen;
+ }
+
+ // print each alias and information
+ for (i = m_aliases.begin();
+ i != m_aliases.end();
+ i++)
+ {
+ std::cerr << " -";
+
+ int thislen = i->first.length();
+ if (thislen > 1)
+ {
+ // long option
+ std::cerr << "-";
+ thislen++;
+ }
+
+ if (i->second) thislen += 9;
+
+ std::cerr << i->first;
+
+ // add spaces for alignment
+ for (; thislen < maxlen; thislen++)
+ {
+ std::cerr << " ";
+ }
+
+ if (i->second)
+ {
+ std::cerr << " Disables";
+ }
+ else if (m_has_arg == 1)
+ {
+ std::cerr << " <argument>";
+ }
+ else if (m_has_arg == 2)
+ {
+ std::cerr << "[=<argument>]";
+ }
+
+ std::cerr << " " << m_optionHelp << std::endl;
+ }
+
+ if (m_has_arg && !isStandardOption)
+ {
+ writeDefault();
+ }
+}
+
+
+
+
+
+
+
+
+
+
+//! Constructor sets defaults for integer class, and constructs base class
+IntOptionResult::IntOptionResult(const std::string & optionHelp,
+ int * result)
+ : OptionResult(optionHelp)
+{
+ m_result = result;
+ m_type = 'i';
+}
+
+//! Empty deconstructor
+IntOptionResult::~IntOptionResult()
+{ }
+
+//! If a result pointer is set, prints out its value
+/*! Note: This is identical in the concrete classes, because the base
+ * class has no concept of a result pointer
+ */
+void IntOptionResult::writeDefault()
+{
+ if (m_result)
+ {
+ std::cerr << " (default=" << *m_result << ")" << std::endl;
+ }
+}
+
+//! Converts a string value into an integer value, and writes it to the result
+/*! Increments the counter for the result being set, verifies value, saves
+ * it as the raw value, and writes the integer form to the result pointer if
+ * it was set.
+ *
+ * @exception InvalidOptionError If non-numeric data is in value
+ * @see validateArgumentCount
+ */
+void IntOptionResult::setVal(const std::string & name,
+ const std::string & val)
+{
+ int retval = 0;
+ m_rawval = val;
+
+ incrementCount(name);
+
+ validateArgumentCount(name, val);
+
+ if (val.length())
+ {
+ // Validate that string is only integer characters
+ if (val.find_first_not_of("0123456789-") != val.npos)
+ {
+ throw InvalidOptionError("Non-numeric value in " + val + " for " + name,
+ "IntOptionResult::setVal");
+ }
+
+ retval = atoi(val.c_str());
+ }
+ else
+ {
+ // if this name is a negation set result to 0, otherwise 1
+ retval = !isNegation(name);
+ }
+
+ if (m_result)
+ {
+ *m_result = retval;
+ }
+}
+
+
+
+
+//! Constructor sets defaults for float class, constructs baseclass
+FloatOptionResult::FloatOptionResult(const std::string & optionHelp,
+ float * result)
+ : OptionResult(optionHelp)
+{
+ m_result = result;
+ m_type = 'f';
+}
+
+//! Empty deconstructor
+FloatOptionResult::~FloatOptionResult()
+{ }
+
+//! If a result pointer is set, prints out its value
+/*! Note: This is identical in the concrete classes, because the base
+ * class has no concept of a result pointer
+ */
+void FloatOptionResult::writeDefault()
+{
+ if (m_result)
+ {
+ std::cerr << " (default=" << *m_result << ")" << std::endl;
+ }
+}
+
+//! Converts a string value into an float value, and writes it to the result
+/*! Increments the counter for the result being set, verifies value, saves
+ * it as the raw value, and writes the float form to the result pointer if
+ * it was set.
+ *
+ * @see validateArgumentCount
+ * @exception InvalidOptionError If non-float data is in value
+ */
+void FloatOptionResult::setVal(const std::string & name,
+ const std::string & val)
+{
+ float retval = 0;
+ m_rawval = val;
+
+ incrementCount(name);
+
+ validateArgumentCount(name, val);
+
+ if (val.length())
+ {
+ // Validate that string is only float characters
+ if (val.find_first_not_of("0123456789-.") != val.npos)
+ {
+ throw InvalidOptionError("Non-float value in " + val + " for " + name,
+ "FloatOptionResult::setVal");
+ }
+
+ // Convert string to float
+ retval = atof(val.c_str());
+ }
+ else
+ {
+ // if this name is a negation set result to 0, otherwise 1
+ retval = !isNegation(name);
+ }
+
+ if (m_result)
+ {
+ *m_result = retval;
+ }
+}
+
+
+
+
+
+//! Constructor sets defaults for string class, constructs base class
+StringOptionResult::StringOptionResult(const std::string & optionHelp,
+ std::string * result)
+ : OptionResult(optionHelp)
+{
+ m_result = result;
+ m_type = 's';
+}
+
+//! Empty deconstructor
+StringOptionResult::~StringOptionResult()
+{ }
+
+//! If a result pointer is set, prints out its value
+/*! Note: This is identical in the concrete classes, because the base
+ * class has no concept of a result pointer
+ */
+void StringOptionResult::writeDefault()
+{
+ if (m_result && m_result->length())
+ {
+ std::cerr << " (default=" << *m_result << ")" << std::endl;
+ }
+}
+
+//! Writes the value to the result pointer
+/*! Saves a copy of the value as the raw value and writes the value unchanged
+ * to the result pointer.
+ *
+ * @see validateArgumentCount
+ */
+void StringOptionResult::setVal(const std::string & name,
+ const std::string & val)
+{
+ std::string retval = "";
+ m_rawval = val;
+
+ incrementCount(name);
+
+ validateArgumentCount(name, val);
+
+ if (val.length())
+ {
+ retval = val;
+ }
+ else
+ {
+ // if this name is a negation set result to "", otherwise "1"
+ if (isNegation(""))
+ {
+ retval = "";
+ }
+ else
+ {
+ retval = "1";
+ }
+ }
+
+ // Save in result
+ if (m_result)
+ {
+ *m_result = retval;
+ }
+}
+
diff --git a/src/Foundation/OptionResult.hh b/src/Foundation/OptionResult.hh
new file mode 100644
index 0000000..784754d
--- /dev/null
+++ b/src/Foundation/OptionResult.hh
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief OptionResult class interface
+
+#ifndef OPTIONRESULT_HH
+#define OPTIONRESULT_HH 1
+
+#include <string>
+#include <map>
+#include "Exceptions.hh"
+
+//! Abstract Base class for managing setting results of option data
+/*! Managed and created by the Options class
+ */
+class OptionResult
+{
+public:
+ OptionResult(const std::string & optionHelp);
+ virtual ~OptionResult();
+
+ void addNameOrAlias(const std::string & name, bool hasNegation);
+ void verifyType(char optionType);
+
+ std::string getName() const;
+ std::string getNextAlias();
+
+ void resetAliasIter();
+ bool isNegation(const std::string & name);
+
+ int has_arg();
+ void setHas_arg(int has_arg);
+
+ //! Pure virtual function for converting a value into its resultant type
+ virtual void setVal(const std::string & name,
+ const std::string & val) = 0;
+
+ int resultSet(const std::string & name);
+ std::string getRawValue() const;
+
+ void printHelp(bool isStandardOption);
+ //! Pure virtual function for write the value of the resultpointer
+ virtual void writeDefault() = 0;
+
+protected:
+ void incrementCount(const std::string & name);
+ void validateArgumentCount(const std::string & name,
+ const std::string & val);
+ //! Type of resultant
+ char m_type;
+ //! Raw value for option from command line
+ std::string m_rawval;
+
+private:
+ //! If it takes an argument or is optional
+ int m_has_arg;
+ //! Main name of option
+ std::string m_name;
+
+ //! Help for the option
+ std::string m_optionHelp;
+
+ //! Counter for number of times the (positive) result was set
+ int m_resultSet;
+ //! Counter for number of times the negative result was set
+ int m_negationSet;
+
+ //! Maps aliases (including name) to if they are positive or negative
+ std::map<std::string, bool> m_aliases;
+ //! Iterator for aliasList
+ std::map<std::string, bool>::const_iterator m_aliasesIter;
+};
+
+
+
+//! Class for managing results of Integers
+class IntOptionResult : public OptionResult
+{
+public:
+ IntOptionResult(const std::string & optionHelp,
+ int * result);
+ ~IntOptionResult();
+
+ void writeDefault();
+ void setVal(const std::string & name,
+ const std::string & val);
+
+private:
+ int * m_result;
+};
+
+
+//! Class for managing results of Floats
+class FloatOptionResult : public OptionResult
+{
+public:
+ FloatOptionResult(const std::string & optionHelp,
+ float * result);
+ ~FloatOptionResult();
+
+ void writeDefault();
+ void setVal(const std::string & name,
+ const std::string & val);
+
+private:
+ float * m_result;
+};
+
+
+//! Class for managing results of Floats
+class StringOptionResult : public OptionResult
+{
+public:
+ StringOptionResult(const std::string & optionHelp,
+ std::string * result);
+ ~StringOptionResult();
+
+ void writeDefault();
+ void setVal(const std::string & name,
+ const std::string & val);
+
+private:
+ std::string * m_result;
+};
+
+
+#endif
diff --git a/src/Foundation/Options.cc b/src/Foundation/Options.cc
new file mode 100644
index 0000000..b4c9d16
--- /dev/null
+++ b/src/Foundation/Options.cc
@@ -0,0 +1,736 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief Options class implementation
+
+/** @example example-options.cc
+ * Demonstrates commmand line options handling.\n\n
+ * Notice how the results of the command line option handling can be found
+ * automatically without explicitly asking if an option was specified, or
+ * option data can be queried by name. If automatic results are requested,
+ * the options handler will convert the raw character array from argv into the
+ * output type (int, float, or string). Automatic results also allow for
+ * default values to be automatically updated if corresponding options are
+ * provided on the command line.
+ */
+
+/** @example example-options.out
+ * Sample output from example-options.\n\n
+ * In each case, the commmand to get the option precedes the output. Data
+ * written to stderr is prefixed with (stderr).
+ */
+
+#include "Options.hh"
+#include <cstring>
+#include <cstdio>
+
+//! Constructor takes command line options in standard argc, argv format
+/*! Initializes application name, filespec, and invocation
+ */
+Options::Options(int argc, char ** argv)
+{
+ m_argc = argc;
+ m_argv = argv;
+
+ m_standardOptionsComplete = false;
+
+ m_applicationFilespec = argv[0];
+
+ // Strip leading directories for application name
+ char * lastpath = strrchr(argv[0], '/');
+ m_applicationName = lastpath ? (char *)(lastpath+1) : argv[0];
+
+ // Join together argv for invocation
+ m_invocation = argv[0];
+ for (int i=1; i<argc; i++)
+ {
+ m_invocation += " " + (std::string)argv[i];
+ }
+
+ m_optionsParsed = false;
+}
+
+
+//! Deletes OptionResults
+/*! Loops through standard option names and other other option names, because
+ * m_optionResults will have multiple names and aliases pointing to the
+ * same result
+ */
+Options::~Options()
+{
+ StringSetCIter i;
+
+ // delete results of all the standard option names
+
+ for (i = m_standardOptionNames.begin();
+ i != m_standardOptionNames.end();
+ i++)
+ {
+ OptionResult * o = m_optionResults[*i];
+ if (o)
+ {
+ delete o;
+ }
+ }
+
+ // delete results of all the other option names
+ for (i = m_optionNames.begin();
+ i != m_optionNames.end();
+ i++)
+ {
+ OptionResult * o = m_optionResults[*i];
+ if (o)
+ {
+ delete o;
+ }
+ }
+}
+
+//! Returns the application filespec (argv[0])
+std::string Options::getApplicationFilespec()
+{
+ return m_applicationFilespec;
+}
+
+//! Returns application name
+std::string Options::getApplicationName()
+{
+ return m_applicationName;
+}
+
+//! Returns invocation (application filespec with all arguments appended)
+std::string Options::getInvocation()
+{
+ return m_invocation;
+}
+
+//! Verifies an optionName isnt null, and hasn't already been added
+/*!
+ * @param alias Option name or alias to add
+ *
+ * @throws InvalidOptionError If options have already been parsed
+ * @throws InvalidOptionError If alias is null
+ * @throws InvalidOptionError If alias has already been added
+ */
+void Options::verifyName(const std::string & alias)
+{
+ if (m_optionsParsed)
+ {
+ throw InvalidOptionError((std::string) "Can't add an option after the"
+ " options have been parsed",
+ "verifyName");
+ }
+
+ if (alias.length() == 0)
+ {
+ throw InvalidOptionError("Can't add Null Option", "verifyName");
+ }
+
+ if (m_optionResults.find(alias) != m_optionResults.end())
+ {
+ throw InvalidOptionError((std::string)"Option " + alias
+ + "has already been added",
+ "verifyName");
+ }
+}
+
+//! Simple Interface for adding options (without setting result)
+/*! Builds an option result with no result pointer out of optionName and
+ * alias. Then inserts it into the map.
+ *
+ * @param optionName Name of option to add
+ * @param has_arg Flag if option takes an option in getopt_long style
+ * @param alias Optional Additional name of argument
+ * (for specifing short and long names)
+ * @param optionHelp Help string for this option
+ * @see insertOptionResult()
+ * @see verifyName()
+ */
+void Options::addOption(const char * optionName, int has_arg,
+ const char * alias,
+ const std::string & optionHelp)
+{
+ verifyName(optionName);
+
+ StringOptionResult * result = new StringOptionResult(optionHelp, NULL);
+
+ result->setHas_arg(has_arg);
+ result->addNameOrAlias(optionName, false);
+
+ if (alias)
+ {
+ verifyName(alias);
+ result->addNameOrAlias(alias, false);
+ }
+
+ insertOptionResult(result);
+}
+
+//! Adds a short option
+/*! Internal Function to insert short option
+ * @param shortOptions Short Option to add
+ * @see insertLongOption()
+ * @see insertOptionResult()
+ */
+void Options::insertShortOption(const std::string & shortOption, int has_arg)
+{
+ m_shortOptions += shortOption;
+
+ if (has_arg == 1)
+ {
+ m_shortOptions += ":";
+ }
+ else if (has_arg == 2)
+ {
+ m_shortOptions += "::";
+ }
+}
+
+//! Adds a long option to the long option list
+/*! Internal function to add a long option
+ *
+ * @param longOptionName Name of option (without leading --)
+ * @param has_arg Specifies if argument always has an argument
+ */
+void Options::insertLongOption(const std::string & longOptionName, int has_arg)
+{
+ m_longOptions[longOptionName] = has_arg;
+}
+
+//! Internal Function to flatten map of long options into an array
+/*! Be sure to free array with deleteLongOptionsArr
+ */
+struct option * Options::getLongOptionsArr()
+{
+ int numoptions = m_longOptions.size() + 1;
+ struct option * retval = new struct option [numoptions];
+
+ LongOptionsMapCIter iter;
+ int i = 0;
+
+ for (iter = m_longOptions.begin();
+ iter != m_longOptions.end();
+ iter++)
+ {
+ // Insert each long option into the array
+
+ char * optionName = new char [iter->first.length() + 1];
+ strcpy(optionName, iter->first.c_str());
+
+ retval[i].name = optionName;
+ retval[i].has_arg = iter->second;
+ retval[i].flag = 0;
+ retval[i].val = 0;
+
+ i++;
+ }
+
+ // Set the last element to be {0,0,0,0} as per getopt_long API
+ retval[i].name = NULL;
+ retval[i].has_arg = 0;
+ retval[i].flag = 0;
+ retval[i].val = 0;
+
+ return retval;
+}
+
+//! Deletes the name of each long argument, and then the entire array of
+// long options
+void Options::deleteLongOptionsArr(struct option * longOptionsArr)
+{
+ int i = 0;
+ while (longOptionsArr[i].name != NULL)
+ {
+ delete [] longOptionsArr[i].name;
+ i++;
+ }
+
+ delete [] longOptionsArr;
+}
+
+
+
+//! Wraps GNU getopt_long
+/*! Wraps calls to getopt_long and stores results in a map for easy access.
+ * The rest of the class aids this function either by setting up parameters
+ * or processing results.
+ * @exception InvalidOptionError On option on commandline but not specified
+ * as valid
+ * @exception MissingRequiredParameterError On option given but required
+ * parameter not found
+ */
+void Options::parseOptions()
+{
+ if (!m_optionsParsed)
+ {
+ m_optionsParsed = true;
+
+ // Don't allow getopt_long to print its own error messages
+ opterr = 0;
+
+ // Flatten long options into an array
+ struct option * longOptionsArr = getLongOptionsArr();
+
+ while (1)
+ {
+ std::string optionName;
+ std::string optionValue;
+
+ int option_index = 0;
+ int c = getopt_long (m_argc,
+ m_argv,
+ m_shortOptions.c_str(),
+ longOptionsArr,
+ &option_index);
+
+ if (c == EOF)
+ {
+ break;
+ }
+ else if (c == '?')
+ {
+ if (optind > 1) optind -= 1;
+
+ throw InvalidOptionError((std::string)"Option <" + m_argv[optind] + ">");
+
+ }
+ else if (c == ':')
+ {
+ throw MissingRequiredParameterError((std::string)"Option <" + (char)optopt
+ + ">");
+ }
+ else if (c == 0)
+ {
+ // Long Option
+ optionName = longOptionsArr[option_index].name;
+ }
+ else
+ {
+ // Short Option
+ optionName = c;
+ }
+
+ if (optarg)
+ {
+ optionValue = optarg;
+ }
+ else
+ {
+ optionValue = "";
+ }
+
+ OptionResult * result = m_optionResults[optionName];
+
+ if (result)
+ {
+ result->setVal(optionName, optionValue);
+ }
+ else
+ {
+ throw amosException("Internal Error: Result for non-specified option",
+ "parseOptions");
+
+ }
+ }
+
+ // Store away arguments that were not options
+ while (optind < m_argc)
+ {
+ m_otherOptionData.push_back(m_argv[optind++]);
+ }
+
+ // Initialize iterators
+ m_optionIterator = m_optionResults.begin();
+ m_otherOptionDataIterator = m_otherOptionData.begin();
+
+ // Delete the long options array
+ deleteLongOptionsArr(longOptionsArr);
+ }
+}
+
+//! Checks to see if an option is contained in options map
+/*!
+ * @param optionName Name (or alias) or option to check
+ * @return An integer count of the number of times the option was set
+ */
+int Options::hasOption(const std::string & optionName)
+{
+ if (!m_optionsParsed) parseOptions();
+
+ int retval = 0;
+ OptionsMapCIter i = m_optionResults.find(optionName);
+ if (i != m_optionResults.end())
+ {
+ retval = i->second->resultSet(optionName);
+ }
+
+ return retval;
+}
+
+
+//! Gets the argument value for an option
+/*! Note: Returns "" for options not found which is identical to options
+ * that are defined but have no value. Use hasOption first to determine
+ * if option exists.
+ *
+ * @return Value of option or "" if not found or valueless
+ */
+std::string Options::getOption(const std::string & optionName)
+{
+ std::string retval;
+
+ if (!m_optionsParsed) parseOptions();
+
+ if (OptionResult * result = m_optionResults[optionName])
+ {
+ retval = result->getRawValue();
+ }
+
+ return retval;
+}
+
+//! Iterates through the list of arguments getting one argument name at a time
+std::string Options::getNextOption()
+{
+ if (!m_optionsParsed) parseOptions();
+
+ std::string retval;
+
+ if (m_optionIterator != m_optionResults.end())
+ {
+ retval = m_optionIterator->first;
+ m_optionIterator++;
+ }
+
+ return retval;
+}
+
+//! Gets all non-option data from the command line
+StringList Options::getAllOtherData()
+{
+ if (!m_optionsParsed) parseOptions();
+
+ return m_otherOptionData;
+}
+
+//! Iterates through non-option data
+std::string Options::getNextOtherData()
+{
+ if (!m_optionsParsed) parseOptions();
+
+ std::string retval;
+
+ if (m_otherOptionDataIterator != m_otherOptionData.end())
+ {
+ retval = *m_otherOptionDataIterator;
+ m_otherOptionDataIterator++;
+ }
+
+ return retval;
+}
+
+//! Call after all of the standard options have been set
+void Options::standardOptionsComplete()
+{
+ m_standardOptionsComplete = true;
+}
+
+//! Inserts an option into the optionData Map and long and short lists
+/*!
+ * Note: For all option adding functions,\n
+ * has_arg = 0 means option takes no argument\n
+ * has_arg = 1 means options always takes an argument\n
+ * has_arg = 2 means options optionally takes an argument
+ *
+ * @see insertShortOption()
+ * @see insertLongOption()
+ */
+void Options::insertOptionResult(OptionResult * optionResult)
+{
+ std::string aliasName;
+ int has_arg = optionResult->has_arg();
+
+ if (!m_standardOptionsComplete)
+ {
+ m_standardOptionNames.insert(optionResult->getName());
+ }
+ else
+ {
+ m_optionNames.insert(optionResult->getName());
+ }
+
+ while ((aliasName = optionResult->getNextAlias()) != "")
+ {
+ // Insert into main result map
+ m_optionResults[aliasName] = optionResult;
+
+ // Add the option to the long and short option lists
+ int aliasHasArg = !optionResult->isNegation(aliasName) && has_arg;
+
+ if (aliasName.length() == 1)
+ {
+ insertShortOption(aliasName, aliasHasArg);
+ }
+ else
+ {
+ insertLongOption(aliasName, aliasHasArg);
+ }
+ }
+
+ optionResult->resetAliasIter();
+}
+
+//! Sets up an option result with an argument string in perl style
+/*! Parses optionArgument, updates optionResult, and inserts optionResult\n\n
+ * optionArgument format is: name[|alias[...]][!][{=,:}{s,f,i}]\n
+ * name: Main name for option, only required argument\n
+ * |alias[...]: The list of aliases for the option separated by '|'\n
+ * ! Creates negative options as well, ie. "option" and "nooption"\n
+ * = means requires an argument\n
+ * : means argument is optional\n
+ * s means result type is string\n
+ * f means result type is float\n
+ * i means result type is integer\n
+ *
+ * if result type is integer 0 is set for negative option,\n
+ * 1 is set for positive option and no value\n\n
+ *
+ * if result type is float 0.0 is set for negative option,\n
+ * 1.0 is set for positive option and no value\n\n
+ *
+ * if result type is string "" is set for negative option,\n
+ * "1" is set for positive option and no value\n
+ *
+ * @see verifyName()
+ * @see addOptionResult()
+ */
+void Options::parseArgument(const std::string & optionArgument,
+ OptionResult * optionResult)
+{
+ bool hasNegation = false;
+ char optionType = 'i';
+ int has_arg = 0;
+
+ std::string::size_type index, splitIndex;
+ std::string::size_type endNameIndex = optionArgument.length();
+
+ // Check to see if option takes an argument
+ if ((index = optionArgument.find_first_of(":=")) != optionArgument.npos)
+ {
+ if (index == 0)
+ {
+ throw InvalidOptionError("First character can't be : or = in argument",
+ "Options::parseArgument");
+ }
+
+ // option takes an argument
+ has_arg = 1;
+
+ if (optionArgument[index] == ':')
+ {
+ // optional argument
+ has_arg = 2;
+ }
+
+ if (index == optionArgument.length())
+ {
+ throw InvalidOptionError("No type specified for argument in option",
+ "Options::parseArgument");
+ }
+
+ optionType = optionArgument[index+1];
+ endNameIndex = index - 1;
+
+ optionResult->setHas_arg(has_arg);
+ }
+
+
+ // Check for negation
+ if ((index = optionArgument.find("!")) != optionArgument.npos)
+ {
+ if (index == 0)
+ {
+ throw InvalidOptionError("First character can't be ! in argument",
+ "Options::parseArgument");
+ }
+
+ hasNegation = true;
+ if ((index - 1) < endNameIndex)
+ {
+ endNameIndex = index - 1;
+ }
+ }
+
+
+ // At this point optionArgument[0]..optionArgument[endNameIndex] is
+ // the name and list of aliases
+ // Roughly this would be in perl
+ // foreach $name in split ("|", $optionArgument[0..endNameIndex])
+ // {
+ // verifyName($name);
+ // addNameOrAlias($name, $hasNegation);
+ // }
+
+ std::string optionAlias;
+
+ index = 0;
+ while ((splitIndex = optionArgument.find('|', index)) != optionArgument.npos)
+ {
+ // a name or alias is between index and splitindex - 1
+ optionAlias = optionArgument.substr(index, splitIndex - index);
+
+ verifyName(optionAlias);
+ optionResult->addNameOrAlias(optionAlias, hasNegation);
+
+ index = splitIndex + 1;
+ }
+
+ optionAlias = optionArgument.substr(index, endNameIndex - index + 1),
+
+ verifyName(optionAlias);
+ optionResult->addNameOrAlias(optionAlias, hasNegation);
+
+ // Call verifyType after name has been set so there can be a meaningful
+ // exception
+ optionResult->verifyType(optionType);
+
+ // optionResult is now ready to be added to main list of options
+ insertOptionResult(optionResult);
+}
+
+
+//! Creates an IntOptionResult, and calls parseArgument with it
+/*!
+ * optionArgument format is: name[|alias[...]][!][{=,:}{s,f,i}]\n
+ * name: Main name for option, only required argument\n
+ * |alias[...]: The list of aliases for the option separated by '|'\n
+ * ! Creates negative options as well, ie. "option" and "nooption"\n
+ * = means requires an argument\n
+ * : means argument is optional\n
+ * s means result type is string\n
+ * f means result type is float\n
+ * i means result type is integer\n
+ *
+ * if result type is integer 0 is set for negative option,\n
+ * 1 is set for positive option and no value\n\n
+ *
+ * if result type is float 0.0 is set for negative option,\n
+ * 1.0 is set for positive option and no value\n\n
+ *
+ * if result type is string "" is set for negative option,\n
+ * "1" is set for positive option and no value\n
+ * @exception InvalidOptionError If optionArgument is NULL
+ *
+ * @param optionArgument Perl style option string
+ * @param resultPointer Pointer to int where result should be written
+ * @param optionHelp Help string for the option
+ */
+void Options::addOptionResult(const std::string & optionArgument,
+ int * resultPointer,
+ const std::string & optionHelp)
+{
+ if (optionArgument.length())
+ {
+ IntOptionResult * optionResult = new IntOptionResult(optionHelp,
+ resultPointer);
+ parseArgument(optionArgument, optionResult);
+ }
+ else
+ {
+ throw InvalidOptionError("Passed a null optionArgument",
+ "addOptionResult");
+ }
+}
+
+//! Creates an FloatOptionResult, and calls parseArgument with it
+/*!
+ * @see addOptionResult(const char [], int *, const string &)
+ * @exception InvalidOptionError If optionArgument is NULL
+ *
+ * @param optionArgument Perl style option string
+ * @param resultPointer Pointer to float where result should be written
+ * @param optionHelp Help string for the option
+ */
+void Options::addOptionResult(const std::string & optionArgument,
+ float * resultPointer,
+ const std::string & optionHelp)
+{
+ if (optionArgument.length())
+ {
+ FloatOptionResult * optionResult = new FloatOptionResult(optionHelp,
+ resultPointer);
+ parseArgument(optionArgument, optionResult);
+ }
+ else
+ {
+ throw InvalidOptionError("Passed a null optionArgument",
+ "addOptionResult");
+ }
+}
+
+//! Creates an StringOptionResult, and calls parseArgument with it
+/*!
+ * @see addOptionResult(const char [], int *, const string &)
+ * @exception InvalidOptionError If optionArgument is NULL
+ *
+ * @param optionArgument Perl style option string
+ * @param resultPointer Pointer to float where result should be written
+ * @param optionHelp Help string for the option
+ */
+void Options::addOptionResult(const std::string & optionArgument,
+ std::string * resultPointer,
+ const std::string & optionHelp)
+{
+ if (optionArgument.length())
+ {
+ StringOptionResult * optionResult = new StringOptionResult(optionHelp,
+ resultPointer);
+ parseArgument((std::string) optionArgument, optionResult);
+ }
+ else
+ {
+ throw InvalidOptionError("Passed a null optionArgument",
+ "addOptionResult");
+ }
+}
+
+//! Print help for each alias alphabetically, starting with the standard options
+void Options::printHelp()
+{
+ StringSetCIter i;
+ OptionResult * o;
+
+ // Loop through standard options
+ for (i = m_standardOptionNames.begin();
+ i != m_standardOptionNames.end();
+ i++)
+ {
+ o = m_optionResults[*i];
+
+ if (o)
+ {
+ o->printHelp(true);
+ }
+ }
+
+ std::cerr << std::endl;
+
+ // Loop through other options
+ for (i = m_optionNames.begin();
+ i != m_optionNames.end();
+ i++)
+ {
+ o = m_optionResults[*i];
+
+ if (o)
+ {
+ o->printHelp(false);
+ }
+ }
+}
+
diff --git a/src/Foundation/Options.hh b/src/Foundation/Options.hh
new file mode 100644
index 0000000..5dc1917
--- /dev/null
+++ b/src/Foundation/Options.hh
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+//! @file
+//! @brief Options class interface
+
+#ifndef OPTIONS_HH
+#define OPTIONS_HH 1
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <list>
+#include <map>
+#include <set>
+#include <string>
+#include <getopt.h>
+
+#include "Exceptions.hh"
+#include "OptionResult.hh"
+
+//! Map type to hold (option, result *) pairs
+typedef std::map<std::string, OptionResult *> OptionsMap;
+
+//! Iterator Type for OptionsMap
+typedef OptionsMap::iterator OptionsMapIter;
+
+//! Constant Iterator Type for OptionsMap
+typedef OptionsMap::const_iterator OptionsMapCIter;
+
+
+//! Map type to hold (optionName, has_arg) pairs
+typedef std::map<std::string, int> LongOptionsMap;
+
+//! Constant Iterator for LongOptionsMap
+typedef LongOptionsMap::const_iterator LongOptionsMapCIter;
+
+
+//! List of strings
+typedef std::list<std::string> StringList;
+//! Iterator for a list of strings
+typedef StringList::const_iterator StringListCIter;
+
+//! Set of strings
+typedef std::set<std::string> StringSet;
+//! Iterator for a set of strings
+typedef StringSet::const_iterator StringSetCIter;
+
+//! Class to simplify results of getopt and getopt_long
+class Options
+{
+public:
+ Options(int argc, char ** argv);
+ ~Options();
+
+ // Simple "getters"
+ std::string getApplicationFilespec();
+ std::string getApplicationName();
+ std::string getInvocation();
+
+ // Functions for adding options
+ void addOption(const char * optionName, int has_arg,
+ const char * alias = NULL,
+ const std::string & optionHelp = "");
+
+ // For adding options with results
+ void addOptionResult(const std::string & optionArgument,
+ int * resultPointer,
+ const std::string & optionHelp = "");
+
+ void addOptionResult(const std::string & optionArgument,
+ float * resultPointer,
+ const std::string & optionHelp = "");
+
+ void addOptionResult(const std::string & optionArgument,
+ std::string * resultPointer,
+ const std::string & optionHelp = "");
+
+ // For Option results
+ int hasOption(const std::string & optionName);
+ std::string getOption(const std::string & optionName);
+ std::string getNextOption();
+
+ // Command line arguments that are not options
+ std::string getNextOtherData();
+ StringList getAllOtherData();
+
+ // Utility Functions
+ void standardOptionsComplete();
+ void printHelp();
+ void parseOptions();
+
+private:
+ void verifyName(const std::string & alias);
+ void parseArgument(const std::string & optionArgument,
+ OptionResult * optionResult);
+
+ // Insert options into appropriate lists
+ void insertOptionResult(OptionResult * optionResult);
+
+ void insertLongOption(const std::string & longOptionName, int has_arg);
+ void insertShortOption(const std::string & shortOptionName, int has_arg);
+
+ // Long Option array Utility
+ struct option * getLongOptionsArr();
+ void deleteLongOptionsArr(struct option * longOptionsArr);
+
+ // Member vars
+
+ bool m_optionsParsed;
+ bool m_standardOptionsComplete;
+
+ int m_argc;
+ char ** m_argv;
+
+ std::string m_applicationFilespec;
+ std::string m_applicationName;
+ std::string m_invocation;
+
+ std::string m_shortOptions;
+ LongOptionsMap m_longOptions;
+
+ OptionsMap m_optionResults;
+ OptionsMapCIter m_optionIterator;
+
+ StringSet m_optionNames;
+ StringSet m_standardOptionNames;
+
+ StringList m_otherOptionData;
+ StringListCIter m_otherOptionDataIterator;
+};
+
+
+
+#endif
diff --git a/src/GNU/Makefile.am b/src/GNU/Makefile.am
new file mode 100644
index 0000000..bdfdf14
--- /dev/null
+++ b/src/GNU/Makefile.am
@@ -0,0 +1,40 @@
+## Process this file with automake to produce Makefile.in.
+# Copyright (C) 2004 Free Software Foundation, Inc.
+#
+# This file is free software, distributed under the terms of the GNU
+# General Public License. As a special exception to the GNU General
+# Public License, this file may be distributed as part of a program
+# that contains a configuration script generated by Automake, under
+# the same distribution terms as the rest of that program.
+#
+# Generated by gnulib-tool.
+#
+# gnulib-tool --import --lib=libGNU getopt strtod strtol
+
+AUTOMAKE_OPTIONS = 1.8 gnits
+
+noinst_LIBRARIES = libGNU.a
+
+libGNU_a_SOURCES = gnu.c
+libGNU_a_LIBADD = @LIBOBJS@
+EXTRA_DIST =
+BUILT_SOURCES =
+SUFFIXES =
+MOSTLYCLEANFILES =
+CLEANFILES =
+DISTCLEANFILES =
+MAINTAINERCLEANFILES =
+BUILT_SOURCES += $(GETOPT_H)
+EXTRA_DIST += getopt_.h getopt_int.h
+
+# We need the following in order to create an <getopt.h> when the system
+# doesn't have one that works with the given compiler.
+all-local $(libGNU_a_OBJECTS): $(GETOPT_H)
+getopt.h: getopt_.h
+ cp $(srcdir)/getopt_.h $@
+MOSTLYCLEANFILES += getopt.h
+
+libGNU_a_SOURCES += gettext.h
+
+LIBS += $(POW_LIB)
+
diff --git a/src/GNU/Makefile.in b/src/GNU/Makefile.in
new file mode 100644
index 0000000..63975c3
--- /dev/null
+++ b/src/GNU/Makefile.in
@@ -0,0 +1,502 @@
+# 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 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@
+
+# Copyright (C) 2004 Free Software Foundation, Inc.
+#
+# This file is free software, distributed under the terms of the GNU
+# General Public License. As a special exception to the GNU General
+# Public License, this file may be distributed as part of a program
+# that contains a configuration script generated by Automake, under
+# the same distribution terms as the rest of that program.
+#
+# Generated by gnulib-tool.
+#
+# gnulib-tool --import --lib=libGNU getopt strtod strtol
+
+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@
+subdir = src/GNU
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in getopt.c \
+ getopt1.c strtod.c strtol.c
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libGNU_a_AR = $(AR) $(ARFLAGS)
+libGNU_a_DEPENDENCIES = @LIBOBJS@
+am_libGNU_a_OBJECTS = gnu.$(OBJEXT)
+libGNU_a_OBJECTS = $(am_libGNU_a_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libGNU_a_SOURCES)
+DIST_SOURCES = $(libGNU_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@ $(POW_LIB)
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = 1.8 gnits
+noinst_LIBRARIES = libGNU.a
+libGNU_a_SOURCES = gnu.c gettext.h
+libGNU_a_LIBADD = @LIBOBJS@
+EXTRA_DIST = getopt_.h getopt_int.h
+BUILT_SOURCES = $(GETOPT_H)
+SUFFIXES =
+MOSTLYCLEANFILES = getopt.h
+CLEANFILES =
+DISTCLEANFILES =
+MAINTAINERCLEANFILES =
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .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) --gnits src/GNU/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnits src/GNU/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)
+libGNU.a: $(libGNU_a_OBJECTS) $(libGNU_a_DEPENDENCIES)
+ -rm -f libGNU.a
+ $(libGNU_a_AR) libGNU.a $(libGNU_a_OBJECTS) $(libGNU_a_LIBADD)
+ $(RANLIB) libGNU.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt1.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strtod.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strtol.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gnu.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) '$<'`
+
+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: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) 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:
+ $(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:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+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)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+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)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf $(DEPDIR) ./$(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) ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES ctags distclean distclean-compile \
+ distclean-generic 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 pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am
+
+
+# We need the following in order to create an <getopt.h> when the system
+# doesn't have one that works with the given compiler.
+all-local $(libGNU_a_OBJECTS): $(GETOPT_H)
+getopt.h: getopt_.h
+ cp $(srcdir)/getopt_.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.
+.NOEXPORT:
diff --git a/src/GNU/getopt.c b/src/GNU/getopt.c
new file mode 100644
index 0000000..0440d8b
--- /dev/null
+++ b/src/GNU/getopt.c
@@ -0,0 +1,1161 @@
+/* Getopt for GNU.
+ NOTE: getopt is now part of the C library, so if you don't know what
+ "Keep this file name-space clean" means, talk to drepper at gnu.org
+ before changing it!
+ Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
+ Ditto for AIX 3.2 and <stdlib.h>. */
+#ifndef _NO_PROTO
+# define _NO_PROTO
+#endif
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
+/* This needs to come after some library #include
+ to get __GNU_LIBRARY__ defined. */
+#ifdef __GNU_LIBRARY__
+/* Don't include stdlib.h for non-GNU C libraries because some of them
+ contain conflicting prototypes for getopt. */
+# include <stdlib.h>
+# include <unistd.h>
+#endif /* GNU C library. */
+
+#include <string.h>
+
+#ifdef VMS
+# include <unixlib.h>
+#endif
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "gettext.h"
+# define _(msgid) gettext (msgid)
+#endif
+
+#if defined _LIBC && defined USE_IN_LIBIO
+# include <wchar.h>
+#endif
+
+#ifndef attribute_hidden
+# define attribute_hidden
+#endif
+
+/* This version of `getopt' appears to the caller like standard Unix `getopt'
+ but it behaves differently for the user, since it allows the user
+ to intersperse the options with the other arguments.
+
+ As `getopt' works, it permutes the elements of ARGV so that,
+ when it is done, all the options precede everything else. Thus
+ all application programs are extended to handle flexible argument order.
+
+ Setting the environment variable POSIXLY_CORRECT disables permutation.
+ Then the behavior is completely standard.
+
+ GNU application programs can use a third alternative mode in which
+ they can distinguish the relative order of options and other arguments. */
+
+#include "getopt.h"
+#include "getopt_int.h"
+
+/* For communication from `getopt' to the caller.
+ When `getopt' finds an option that takes an argument,
+ the argument value is returned here.
+ Also, when `ordering' is RETURN_IN_ORDER,
+ each non-option ARGV-element is returned here. */
+
+char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+ This is used for communication to and from the caller
+ and for communication between successive calls to `getopt'.
+
+ On entry to `getopt', zero means this is the first call; initialize.
+
+ When `getopt' returns -1, this is the index of the first of the
+ non-option elements that the caller should itself scan.
+
+ Otherwise, `optind' communicates from one call to the next
+ how much of ARGV has been scanned so far. */
+
+/* 1003.2 says this must be 1 before any call. */
+int optind = 1;
+
+/* Callers store zero here to inhibit the error message
+ for unrecognized options. */
+
+int opterr = 1;
+
+/* Set to an option character which was unrecognized.
+ This must be initialized on some systems to avoid linking in the
+ system's own getopt implementation. */
+
+int optopt = '?';
+
+/* Keep a global copy of all internal members of getopt_data. */
+
+static struct _getopt_data getopt_data;
+
+#ifndef __GNU_LIBRARY__
+
+/* Avoid depending on library functions or files
+ whose names are inconsistent. */
+
+#ifndef getenv
+extern char *getenv ();
+#endif
+
+#endif /* not __GNU_LIBRARY__ */
+#ifdef _LIBC
+/* Stored original parameters.
+ XXX This is no good solution. We should rather copy the args so
+ that we can compare them later. But we must not use malloc(3). */
+extern int __libc_argc;
+extern char **__libc_argv;
+
+/* Bash 2.0 gives us an environment variable containing flags
+ indicating ARGV elements that should not be considered arguments. */
+
+# ifdef USE_NONOPTION_FLAGS
+/* Defined in getopt_init.c */
+extern char *__getopt_nonoption_flags;
+# endif
+
+# ifdef USE_NONOPTION_FLAGS
+# define SWAP_FLAGS(ch1, ch2) \
+ if (d->__nonoption_flags_len > 0) \
+ { \
+ char __tmp = __getopt_nonoption_flags[ch1]; \
+ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
+ __getopt_nonoption_flags[ch2] = __tmp; \
+ }
+# else
+# define SWAP_FLAGS(ch1, ch2)
+# endif
+#else /* !_LIBC */
+# define SWAP_FLAGS(ch1, ch2)
+#endif /* _LIBC */
+
+/* Exchange two adjacent subsequences of ARGV.
+ One subsequence is elements [first_nonopt,last_nonopt)
+ which contains all the non-options that have been skipped so far.
+ The other is elements [last_nonopt,optind), which contains all
+ the options processed since those non-options were skipped.
+
+ `first_nonopt' and `last_nonopt' are relocated so that they describe
+ the new indices of the non-options in ARGV after they are moved. */
+
+static void
+exchange (char **argv, struct _getopt_data *d)
+{
+ int bottom = d->__first_nonopt;
+ int middle = d->__last_nonopt;
+ int top = d->optind;
+ char *tem;
+
+ /* Exchange the shorter segment with the far end of the longer segment.
+ That puts the shorter segment into the right place.
+ It leaves the longer segment in the right place overall,
+ but it consists of two parts that need to be swapped next. */
+
+#if defined _LIBC && defined USE_NONOPTION_FLAGS
+ /* First make sure the handling of the `__getopt_nonoption_flags'
+ string can work normally. Our top argument must be in the range
+ of the string. */
+ if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len)
+ {
+ /* We must extend the array. The user plays games with us and
+ presents new arguments. */
+ char *new_str = malloc (top + 1);
+ if (new_str == NULL)
+ d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0;
+ else
+ {
+ memset (__mempcpy (new_str, __getopt_nonoption_flags,
+ d->__nonoption_flags_max_len),
+ '\0', top + 1 - d->__nonoption_flags_max_len);
+ d->__nonoption_flags_max_len = top + 1;
+ __getopt_nonoption_flags = new_str;
+ }
+ }
+#endif
+
+ while (top > middle && middle > bottom)
+ {
+ if (top - middle > middle - bottom)
+ {
+ /* Bottom segment is the short one. */
+ int len = middle - bottom;
+ register int i;
+
+ /* Swap it with the top part of the top segment. */
+ for (i = 0; i < len; i++)
+ {
+ tem = argv[bottom + i];
+ argv[bottom + i] = argv[top - (middle - bottom) + i];
+ argv[top - (middle - bottom) + i] = tem;
+ SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
+ }
+ /* Exclude the moved bottom segment from further swapping. */
+ top -= len;
+ }
+ else
+ {
+ /* Top segment is the short one. */
+ int len = top - middle;
+ register int i;
+
+ /* Swap it with the bottom part of the bottom segment. */
+ for (i = 0; i < len; i++)
+ {
+ tem = argv[bottom + i];
+ argv[bottom + i] = argv[middle + i];
+ argv[middle + i] = tem;
+ SWAP_FLAGS (bottom + i, middle + i);
+ }
+ /* Exclude the moved top segment from further swapping. */
+ bottom += len;
+ }
+ }
+
+ /* Update records for the slots the non-options now occupy. */
+
+ d->__first_nonopt += (d->optind - d->__last_nonopt);
+ d->__last_nonopt = d->optind;
+}
+
+/* Initialize the internal data when the first call is made. */
+
+static const char *
+_getopt_initialize (int argc, char *const *argv, const char *optstring,
+ struct _getopt_data *d)
+{
+ /* Start processing options with ARGV-element 1 (since ARGV-element 0
+ is the program name); the sequence of previously skipped
+ non-option ARGV-elements is empty. */
+
+ d->__first_nonopt = d->__last_nonopt = d->optind;
+
+ d->__nextchar = NULL;
+
+ d->__posixly_correct = !!getenv ("POSIXLY_CORRECT");
+
+ /* Determine how to handle the ordering of options and nonoptions. */
+
+ if (optstring[0] == '-')
+ {
+ d->__ordering = RETURN_IN_ORDER;
+ ++optstring;
+ }
+ else if (optstring[0] == '+')
+ {
+ d->__ordering = REQUIRE_ORDER;
+ ++optstring;
+ }
+ else if (d->__posixly_correct)
+ d->__ordering = REQUIRE_ORDER;
+ else
+ d->__ordering = PERMUTE;
+
+#if defined _LIBC && defined USE_NONOPTION_FLAGS
+ if (!d->__posixly_correct
+ && argc == __libc_argc && argv == __libc_argv)
+ {
+ if (d->__nonoption_flags_max_len == 0)
+ {
+ if (__getopt_nonoption_flags == NULL
+ || __getopt_nonoption_flags[0] == '\0')
+ d->__nonoption_flags_max_len = -1;
+ else
+ {
+ const char *orig_str = __getopt_nonoption_flags;
+ int len = d->__nonoption_flags_max_len = strlen (orig_str);
+ if (d->__nonoption_flags_max_len < argc)
+ d->__nonoption_flags_max_len = argc;
+ __getopt_nonoption_flags =
+ (char *) malloc (d->__nonoption_flags_max_len);
+ if (__getopt_nonoption_flags == NULL)
+ d->__nonoption_flags_max_len = -1;
+ else
+ memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
+ '\0', d->__nonoption_flags_max_len - len);
+ }
+ }
+ d->__nonoption_flags_len = d->__nonoption_flags_max_len;
+ }
+ else
+ d->__nonoption_flags_len = 0;
+#endif
+
+ return optstring;
+}
+
+/* Scan elements of ARGV (whose length is ARGC) for option characters
+ given in OPTSTRING.
+
+ If an element of ARGV starts with '-', and is not exactly "-" or "--",
+ then it is an option element. The characters of this element
+ (aside from the initial '-') are option characters. If `getopt'
+ is called repeatedly, it returns successively each of the option characters
+ from each of the option elements.
+
+ If `getopt' finds another option character, it returns that character,
+ updating `optind' and `nextchar' so that the next call to `getopt' can
+ resume the scan with the following option character or ARGV-element.
+
+ If there are no more option characters, `getopt' returns -1.
+ Then `optind' is the index in ARGV of the first ARGV-element
+ that is not an option. (The ARGV-elements have been permuted
+ so that those that are not options now come last.)
+
+ OPTSTRING is a string containing the legitimate option characters.
+ If an option character is seen that is not listed in OPTSTRING,
+ return '?' after printing an error message. If you set `opterr' to
+ zero, the error message is suppressed but we still return '?'.
+
+ If a char in OPTSTRING is followed by a colon, that means it wants an arg,
+ so the following text in the same ARGV-element, or the text of the following
+ ARGV-element, is returned in `optarg'. Two colons mean an option that
+ wants an optional arg; if there is text in the current ARGV-element,
+ it is returned in `optarg', otherwise `optarg' is set to zero.
+
+ If OPTSTRING starts with `-' or `+', it requests different methods of
+ handling the non-option ARGV-elements.
+ See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
+
+ Long-named options begin with `--' instead of `-'.
+ Their names may be abbreviated as long as the abbreviation is unique
+ or is an exact match for some defined option. If they have an
+ argument, it follows the option name in the same ARGV-element, separated
+ from the option name by a `=', or else the in next ARGV-element.
+ When `getopt' finds a long-named option, it returns 0 if that option's
+ `flag' field is nonzero, the value of the option's `val' field
+ if the `flag' field is zero.
+
+ The elements of ARGV aren't really const, because we permute them.
+ But we pretend they're const in the prototype to be compatible
+ with other systems.
+
+ LONGOPTS is a vector of `struct option' terminated by an
+ element containing a name which is zero.
+
+ LONGIND returns the index in LONGOPT of the long-named option found.
+ It is only valid when a long-named option has been found by the most
+ recent call.
+
+ If LONG_ONLY is nonzero, '-' as well as '--' can introduce
+ long-named options. */
+
+int
+_getopt_internal_r (int argc, char *const *argv, const char *optstring,
+ const struct option *longopts, int *longind,
+ int long_only, struct _getopt_data *d)
+{
+ int print_errors = d->opterr;
+ if (optstring[0] == ':')
+ print_errors = 0;
+
+ if (argc < 1)
+ return -1;
+
+ d->optarg = NULL;
+
+ if (d->optind == 0 || !d->__initialized)
+ {
+ if (d->optind == 0)
+ d->optind = 1; /* Don't scan ARGV[0], the program name. */
+ optstring = _getopt_initialize (argc, argv, optstring, d);
+ d->__initialized = 1;
+ }
+
+ /* Test whether ARGV[optind] points to a non-option argument.
+ Either it does not have option syntax, or there is an environment flag
+ from the shell indicating it is not an option. The later information
+ is only used when the used in the GNU libc. */
+#if defined _LIBC && defined USE_NONOPTION_FLAGS
+# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \
+ || (d->optind < d->__nonoption_flags_len \
+ && __getopt_nonoption_flags[d->optind] == '1'))
+#else
+# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0')
+#endif
+
+ if (d->__nextchar == NULL || *d->__nextchar == '\0')
+ {
+ /* Advance to the next ARGV-element. */
+
+ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
+ moved back by the user (who may also have changed the arguments). */
+ if (d->__last_nonopt > d->optind)
+ d->__last_nonopt = d->optind;
+ if (d->__first_nonopt > d->optind)
+ d->__first_nonopt = d->optind;
+
+ if (d->__ordering == PERMUTE)
+ {
+ /* If we have just processed some options following some non-options,
+ exchange them so that the options come first. */
+
+ if (d->__first_nonopt != d->__last_nonopt
+ && d->__last_nonopt != d->optind)
+ exchange ((char **) argv, d);
+ else if (d->__last_nonopt != d->optind)
+ d->__first_nonopt = d->optind;
+
+ /* Skip any additional non-options
+ and extend the range of non-options previously skipped. */
+
+ while (d->optind < argc && NONOPTION_P)
+ d->optind++;
+ d->__last_nonopt = d->optind;
+ }
+
+ /* The special ARGV-element `--' means premature end of options.
+ Skip it like a null option,
+ then exchange with previous non-options as if it were an option,
+ then skip everything else like a non-option. */
+
+ if (d->optind != argc && !strcmp (argv[d->optind], "--"))
+ {
+ d->optind++;
+
+ if (d->__first_nonopt != d->__last_nonopt
+ && d->__last_nonopt != d->optind)
+ exchange ((char **) argv, d);
+ else if (d->__first_nonopt == d->__last_nonopt)
+ d->__first_nonopt = d->optind;
+ d->__last_nonopt = argc;
+
+ d->optind = argc;
+ }
+
+ /* If we have done all the ARGV-elements, stop the scan
+ and back over any non-options that we skipped and permuted. */
+
+ if (d->optind == argc)
+ {
+ /* Set the next-arg-index to point at the non-options
+ that we previously skipped, so the caller will digest them. */
+ if (d->__first_nonopt != d->__last_nonopt)
+ d->optind = d->__first_nonopt;
+ return -1;
+ }
+
+ /* If we have come to a non-option and did not permute it,
+ either stop the scan or describe it to the caller and pass it by. */
+
+ if (NONOPTION_P)
+ {
+ if (d->__ordering == REQUIRE_ORDER)
+ return -1;
+ d->optarg = argv[d->optind++];
+ return 1;
+ }
+
+ /* We have found another option-ARGV-element.
+ Skip the initial punctuation. */
+
+ d->__nextchar = (argv[d->optind] + 1
+ + (longopts != NULL && argv[d->optind][1] == '-'));
+ }
+
+ /* Decode the current option-ARGV-element. */
+
+ /* Check whether the ARGV-element is a long option.
+
+ If long_only and the ARGV-element has the form "-f", where f is
+ a valid short option, don't consider it an abbreviated form of
+ a long option that starts with f. Otherwise there would be no
+ way to give the -f short option.
+
+ On the other hand, if there's a long option "fubar" and
+ the ARGV-element is "-fu", do consider that an abbreviation of
+ the long option, just like "--fu", and not "-f" with arg "u".
+
+ This distinction seems to be the most useful approach. */
+
+ if (longopts != NULL
+ && (argv[d->optind][1] == '-'
+ || (long_only && (argv[d->optind][2]
+ || !strchr (optstring, argv[d->optind][1])))))
+ {
+ char *nameend;
+ const struct option *p;
+ const struct option *pfound = NULL;
+ int exact = 0;
+ int ambig = 0;
+ int indfound = -1;
+ int option_index;
+
+ for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++)
+ /* Do nothing. */ ;
+
+ /* Test all long options for either exact match
+ or abbreviated matches. */
+ for (p = longopts, option_index = 0; p->name; p++, option_index++)
+ if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
+ {
+ if ((unsigned int) (nameend - d->__nextchar)
+ == (unsigned int) strlen (p->name))
+ {
+ /* Exact match found. */
+ pfound = p;
+ indfound = option_index;
+ exact = 1;
+ break;
+ }
+ else if (pfound == NULL)
+ {
+ /* First nonexact match found. */
+ pfound = p;
+ indfound = option_index;
+ }
+ else if (long_only
+ || pfound->has_arg != p->has_arg
+ || pfound->flag != p->flag
+ || pfound->val != p->val)
+ /* Second or later nonexact match found. */
+ ambig = 1;
+ }
+
+ if (ambig && !exact)
+ {
+ if (print_errors)
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+
+ if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"),
+ argv[0], argv[d->optind]) >= 0)
+ {
+ _IO_flockfile (stderr);
+
+ int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+ ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+ _IO_funlockfile (stderr);
+
+ free (buf);
+ }
+#else
+ fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
+ argv[0], argv[d->optind]);
+#endif
+ }
+ d->__nextchar += strlen (d->__nextchar);
+ d->optind++;
+ d->optopt = 0;
+ return '?';
+ }
+
+ if (pfound != NULL)
+ {
+ option_index = indfound;
+ d->optind++;
+ if (*nameend)
+ {
+ /* Don't test has_arg with >, because some C compilers don't
+ allow it to be used on enums. */
+ if (pfound->has_arg)
+ d->optarg = nameend + 1;
+ else
+ {
+ if (print_errors)
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+ int n;
+#endif
+
+ if (argv[d->optind - 1][1] == '-')
+ {
+ /* --option */
+#if defined _LIBC && defined USE_IN_LIBIO
+ n = __asprintf (&buf, _("\
+%s: option `--%s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+#else
+ fprintf (stderr, _("\
+%s: option `--%s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+#endif
+ }
+ else
+ {
+ /* +option or -option */
+#if defined _LIBC && defined USE_IN_LIBIO
+ n = __asprintf (&buf, _("\
+%s: option `%c%s' doesn't allow an argument\n"),
+ argv[0], argv[d->optind - 1][0],
+ pfound->name);
+#else
+ fprintf (stderr, _("\
+%s: option `%c%s' doesn't allow an argument\n"),
+ argv[0], argv[d->optind - 1][0],
+ pfound->name);
+#endif
+ }
+
+#if defined _LIBC && defined USE_IN_LIBIO
+ if (n >= 0)
+ {
+ _IO_flockfile (stderr);
+
+ int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+ ((_IO_FILE *) stderr)->_flags2
+ |= _IO_FLAGS2_NOTCANCEL;
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+ _IO_funlockfile (stderr);
+
+ free (buf);
+ }
+#endif
+ }
+
+ d->__nextchar += strlen (d->__nextchar);
+
+ d->optopt = pfound->val;
+ return '?';
+ }
+ }
+ else if (pfound->has_arg == 1)
+ {
+ if (d->optind < argc)
+ d->optarg = argv[d->optind++];
+ else
+ {
+ if (print_errors)
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+
+ if (__asprintf (&buf, _("\
+%s: option `%s' requires an argument\n"),
+ argv[0], argv[d->optind - 1]) >= 0)
+ {
+ _IO_flockfile (stderr);
+
+ int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+ ((_IO_FILE *) stderr)->_flags2
+ |= _IO_FLAGS2_NOTCANCEL;
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+ _IO_funlockfile (stderr);
+
+ free (buf);
+ }
+#else
+ fprintf (stderr,
+ _("%s: option `%s' requires an argument\n"),
+ argv[0], argv[d->optind - 1]);
+#endif
+ }
+ d->__nextchar += strlen (d->__nextchar);
+ d->optopt = pfound->val;
+ return optstring[0] == ':' ? ':' : '?';
+ }
+ }
+ d->__nextchar += strlen (d->__nextchar);
+ if (longind != NULL)
+ *longind = option_index;
+ if (pfound->flag)
+ {
+ *(pfound->flag) = pfound->val;
+ return 0;
+ }
+ return pfound->val;
+ }
+
+ /* Can't find it as a long option. If this is not getopt_long_only,
+ or the option starts with '--' or is not a valid short
+ option, then it's an error.
+ Otherwise interpret it as a short option. */
+ if (!long_only || argv[d->optind][1] == '-'
+ || strchr (optstring, *d->__nextchar) == NULL)
+ {
+ if (print_errors)
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+ int n;
+#endif
+
+ if (argv[d->optind][1] == '-')
+ {
+ /* --option */
+#if defined _LIBC && defined USE_IN_LIBIO
+ n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"),
+ argv[0], d->__nextchar);
+#else
+ fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
+ argv[0], d->__nextchar);
+#endif
+ }
+ else
+ {
+ /* +option or -option */
+#if defined _LIBC && defined USE_IN_LIBIO
+ n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"),
+ argv[0], argv[d->optind][0], d->__nextchar);
+#else
+ fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
+ argv[0], argv[d->optind][0], d->__nextchar);
+#endif
+ }
+
+#if defined _LIBC && defined USE_IN_LIBIO
+ if (n >= 0)
+ {
+ _IO_flockfile (stderr);
+
+ int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+ ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+ _IO_funlockfile (stderr);
+
+ free (buf);
+ }
+#endif
+ }
+ d->__nextchar = (char *) "";
+ d->optind++;
+ d->optopt = 0;
+ return '?';
+ }
+ }
+
+ /* Look at and handle the next short option-character. */
+
+ {
+ char c = *d->__nextchar++;
+ char *temp = strchr (optstring, c);
+
+ /* Increment `optind' when we start to process its last character. */
+ if (*d->__nextchar == '\0')
+ ++d->optind;
+
+ if (temp == NULL || c == ':')
+ {
+ if (print_errors)
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+ int n;
+#endif
+
+ if (d->__posixly_correct)
+ {
+ /* 1003.2 specifies the format of this message. */
+#if defined _LIBC && defined USE_IN_LIBIO
+ n = __asprintf (&buf, _("%s: illegal option -- %c\n"),
+ argv[0], c);
+#else
+ fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
+#endif
+ }
+ else
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ n = __asprintf (&buf, _("%s: invalid option -- %c\n"),
+ argv[0], c);
+#else
+ fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
+#endif
+ }
+
+#if defined _LIBC && defined USE_IN_LIBIO
+ if (n >= 0)
+ {
+ _IO_flockfile (stderr);
+
+ int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+ ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+ _IO_funlockfile (stderr);
+
+ free (buf);
+ }
+#endif
+ }
+ d->optopt = c;
+ return '?';
+ }
+ /* Convenience. Treat POSIX -W foo same as long option --foo */
+ if (temp[0] == 'W' && temp[1] == ';')
+ {
+ char *nameend;
+ const struct option *p;
+ const struct option *pfound = NULL;
+ int exact = 0;
+ int ambig = 0;
+ int indfound = 0;
+ int option_index;
+
+ /* This is an option that requires an argument. */
+ if (*d->__nextchar != '\0')
+ {
+ d->optarg = d->__nextchar;
+ /* If we end this ARGV-element by taking the rest as an arg,
+ we must advance to the next element now. */
+ d->optind++;
+ }
+ else if (d->optind == argc)
+ {
+ if (print_errors)
+ {
+ /* 1003.2 specifies the format of this message. */
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+
+ if (__asprintf (&buf,
+ _("%s: option requires an argument -- %c\n"),
+ argv[0], c) >= 0)
+ {
+ _IO_flockfile (stderr);
+
+ int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+ ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+ _IO_funlockfile (stderr);
+
+ free (buf);
+ }
+#else
+ fprintf (stderr, _("%s: option requires an argument -- %c\n"),
+ argv[0], c);
+#endif
+ }
+ d->optopt = c;
+ if (optstring[0] == ':')
+ c = ':';
+ else
+ c = '?';
+ return c;
+ }
+ else
+ /* We already incremented `d->optind' once;
+ increment it again when taking next ARGV-elt as argument. */
+ d->optarg = argv[d->optind++];
+
+ /* optarg is now the argument, see if it's in the
+ table of longopts. */
+
+ for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '=';
+ nameend++)
+ /* Do nothing. */ ;
+
+ /* Test all long options for either exact match
+ or abbreviated matches. */
+ for (p = longopts, option_index = 0; p->name; p++, option_index++)
+ if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
+ {
+ if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name))
+ {
+ /* Exact match found. */
+ pfound = p;
+ indfound = option_index;
+ exact = 1;
+ break;
+ }
+ else if (pfound == NULL)
+ {
+ /* First nonexact match found. */
+ pfound = p;
+ indfound = option_index;
+ }
+ else
+ /* Second or later nonexact match found. */
+ ambig = 1;
+ }
+ if (ambig && !exact)
+ {
+ if (print_errors)
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+
+ if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"),
+ argv[0], argv[d->optind]) >= 0)
+ {
+ _IO_flockfile (stderr);
+
+ int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+ ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+ _IO_funlockfile (stderr);
+
+ free (buf);
+ }
+#else
+ fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
+ argv[0], argv[d->optind]);
+#endif
+ }
+ d->__nextchar += strlen (d->__nextchar);
+ d->optind++;
+ return '?';
+ }
+ if (pfound != NULL)
+ {
+ option_index = indfound;
+ if (*nameend)
+ {
+ /* Don't test has_arg with >, because some C compilers don't
+ allow it to be used on enums. */
+ if (pfound->has_arg)
+ d->optarg = nameend + 1;
+ else
+ {
+ if (print_errors)
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+
+ if (__asprintf (&buf, _("\
+%s: option `-W %s' doesn't allow an argument\n"),
+ argv[0], pfound->name) >= 0)
+ {
+ _IO_flockfile (stderr);
+
+ int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+ ((_IO_FILE *) stderr)->_flags2
+ |= _IO_FLAGS2_NOTCANCEL;
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+ _IO_funlockfile (stderr);
+
+ free (buf);
+ }
+#else
+ fprintf (stderr, _("\
+%s: option `-W %s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+#endif
+ }
+
+ d->__nextchar += strlen (d->__nextchar);
+ return '?';
+ }
+ }
+ else if (pfound->has_arg == 1)
+ {
+ if (d->optind < argc)
+ d->optarg = argv[d->optind++];
+ else
+ {
+ if (print_errors)
+ {
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+
+ if (__asprintf (&buf, _("\
+%s: option `%s' requires an argument\n"),
+ argv[0], argv[d->optind - 1]) >= 0)
+ {
+ _IO_flockfile (stderr);
+
+ int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+ ((_IO_FILE *) stderr)->_flags2
+ |= _IO_FLAGS2_NOTCANCEL;
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+ _IO_funlockfile (stderr);
+
+ free (buf);
+ }
+#else
+ fprintf (stderr,
+ _("%s: option `%s' requires an argument\n"),
+ argv[0], argv[d->optind - 1]);
+#endif
+ }
+ d->__nextchar += strlen (d->__nextchar);
+ return optstring[0] == ':' ? ':' : '?';
+ }
+ }
+ d->__nextchar += strlen (d->__nextchar);
+ if (longind != NULL)
+ *longind = option_index;
+ if (pfound->flag)
+ {
+ *(pfound->flag) = pfound->val;
+ return 0;
+ }
+ return pfound->val;
+ }
+ d->__nextchar = NULL;
+ return 'W'; /* Let the application handle it. */
+ }
+ if (temp[1] == ':')
+ {
+ if (temp[2] == ':')
+ {
+ /* This is an option that accepts an argument optionally. */
+ if (*d->__nextchar != '\0')
+ {
+ d->optarg = d->__nextchar;
+ d->optind++;
+ }
+ else
+ d->optarg = NULL;
+ d->__nextchar = NULL;
+ }
+ else
+ {
+ /* This is an option that requires an argument. */
+ if (*d->__nextchar != '\0')
+ {
+ d->optarg = d->__nextchar;
+ /* If we end this ARGV-element by taking the rest as an arg,
+ we must advance to the next element now. */
+ d->optind++;
+ }
+ else if (d->optind == argc)
+ {
+ if (print_errors)
+ {
+ /* 1003.2 specifies the format of this message. */
+#if defined _LIBC && defined USE_IN_LIBIO
+ char *buf;
+
+ if (__asprintf (&buf, _("\
+%s: option requires an argument -- %c\n"),
+ argv[0], c) >= 0)
+ {
+ _IO_flockfile (stderr);
+
+ int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+ ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
+ if (_IO_fwide (stderr, 0) > 0)
+ __fwprintf (stderr, L"%s", buf);
+ else
+ fputs (buf, stderr);
+
+ ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+ _IO_funlockfile (stderr);
+
+ free (buf);
+ }
+#else
+ fprintf (stderr,
+ _("%s: option requires an argument -- %c\n"),
+ argv[0], c);
+#endif
+ }
+ d->optopt = c;
+ if (optstring[0] == ':')
+ c = ':';
+ else
+ c = '?';
+ }
+ else
+ /* We already incremented `optind' once;
+ increment it again when taking next ARGV-elt as argument. */
+ d->optarg = argv[d->optind++];
+ d->__nextchar = NULL;
+ }
+ }
+ return c;
+ }
+}
+
+int
+_getopt_internal (int argc, char *const *argv, const char *optstring,
+ const struct option *longopts, int *longind, int long_only)
+{
+ int result;
+
+ getopt_data.optind = optind;
+ getopt_data.opterr = opterr;
+
+ result = _getopt_internal_r (argc, argv, optstring, longopts,
+ longind, long_only, &getopt_data);
+
+ optind = getopt_data.optind;
+ optarg = getopt_data.optarg;
+ optopt = getopt_data.optopt;
+
+ return result;
+}
+
+int
+getopt (int argc, char *const *argv, const char *optstring)
+{
+ return _getopt_internal (argc, argv, optstring,
+ (const struct option *) 0,
+ (int *) 0,
+ 0);
+}
+
diff --git a/src/GNU/getopt1.c b/src/GNU/getopt1.c
new file mode 100644
index 0000000..5edbb00
--- /dev/null
+++ b/src/GNU/getopt1.c
@@ -0,0 +1,79 @@
+/* getopt_long and getopt_long_only entry points for GNU getopt.
+ Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef _LIBC
+# include <getopt.h>
+#else
+# include "getopt.h"
+#endif
+#include "getopt_int.h"
+
+#include <stdio.h>
+
+/* This needs to come after some library #include
+ to get __GNU_LIBRARY__ defined. */
+#ifdef __GNU_LIBRARY__
+#include <stdlib.h>
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+int
+getopt_long (int argc, char *const *argv, const char *options,
+ const struct option *long_options, int *opt_index)
+{
+ return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
+}
+
+int
+_getopt_long_r (int argc, char *const *argv, const char *options,
+ const struct option *long_options, int *opt_index,
+ struct _getopt_data *d)
+{
+ return _getopt_internal_r (argc, argv, options, long_options, opt_index,
+ 0, d);
+}
+
+/* Like getopt_long, but '-' as well as '--' can indicate a long option.
+ If an option that starts with '-' (not '--') doesn't match a long option,
+ but does match a short option, it is parsed as a short option
+ instead. */
+
+int
+getopt_long_only (int argc, char *const *argv, const char *options,
+ const struct option *long_options, int *opt_index)
+{
+ return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
+}
+
+int
+_getopt_long_only_r (int argc, char *const *argv, const char *options,
+ const struct option *long_options, int *opt_index,
+ struct _getopt_data *d)
+{
+ return _getopt_internal_r (argc, argv, options, long_options, opt_index,
+ 1, d);
+}
+
diff --git a/src/GNU/getopt_.h b/src/GNU/getopt_.h
new file mode 100644
index 0000000..a912726
--- /dev/null
+++ b/src/GNU/getopt_.h
@@ -0,0 +1,191 @@
+/* Declarations for getopt.
+ Copyright (C) 1989,90,91,92,93,94,96,97,98,99 Free Software Foundation, Inc.
+ Copyright (C) 2003 Olly Betts (modified for better C++ compatibility)
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _GETOPT_H
+
+#ifndef __need_getopt
+# define _GETOPT_H 1
+#endif
+
+/* If __GNU_LIBRARY__ is not already defined, either we are being used
+ standalone, or this is the first header included in the source file.
+ If we are being used with glibc, we need to include <features.h>, but
+ that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
+ not defined, include <ctype.h>, which will pull in <features.h> for us
+ if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
+ doesn't flood the namespace with stuff the way some other headers do.) */
+#if !defined __GNU_LIBRARY__
+# include <ctype.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* For communication from `getopt' to the caller.
+ When `getopt' finds an option that takes an argument,
+ the argument value is returned here.
+ Also, when `ordering' is RETURN_IN_ORDER,
+ each non-option ARGV-element is returned here. */
+
+extern char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+ This is used for communication to and from the caller
+ and for communication between successive calls to `getopt'.
+
+ On entry to `getopt', zero means this is the first call; initialize.
+
+ When `getopt' returns -1, this is the index of the first of the
+ non-option elements that the caller should itself scan.
+
+ Otherwise, `optind' communicates from one call to the next
+ how much of ARGV has been scanned so far. */
+
+extern int optind;
+
+/* Callers store zero here to inhibit the error message `getopt' prints
+ for unrecognized options. */
+
+extern int opterr;
+
+/* Set to an option character which was unrecognized. */
+
+extern int optopt;
+
+#ifndef __need_getopt
+/* Describe the long-named options requested by the application.
+ The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
+ of `struct option' terminated by an element containing a name which is
+ zero.
+
+ The field `has_arg' is:
+ no_argument (or 0) if the option does not take an argument,
+ required_argument (or 1) if the option requires an argument,
+ optional_argument (or 2) if the option takes an optional argument.
+
+ If the field `flag' is not NULL, it points to a variable that is set
+ to the value given in the field `val' when the option is found, but
+ left unchanged if the option is not found.
+
+ To have a long-named option do something other than set an `int' to
+ a compiled-in constant, such as set a value from `optarg', set the
+ option's `flag' field to zero and its `val' field to a nonzero
+ value (the equivalent single-letter option character, if there is
+ one). For long options that have a zero `flag' field, `getopt'
+ returns the contents of the `val' field. */
+
+struct option
+{
+# if (defined __STDC__ && __STDC__) || defined(__cplusplus)
+ const char *name;
+# else
+ char *name;
+# endif
+ /* has_arg can't be an enum because some compilers complain about
+ type mismatches in all the code that assumes it is an int. */
+ int has_arg;
+ int *flag;
+ int val;
+};
+
+/* Names for the values of the `has_arg' field of `struct option'. */
+
+# define no_argument 0
+# define required_argument 1
+# define optional_argument 2
+#endif /* need getopt */
+
+
+/* Get definitions and prototypes for functions to process the
+ arguments in ARGV (ARGC of them, minus the program name) for
+ options given in OPTS.
+
+ Return the option character from OPTS just read. Return -1 when
+ there are no more options. For unrecognized options, or options
+ missing arguments, `optopt' is set to the option letter, and '?' is
+ returned.
+
+ The OPTS string is a list of characters which are recognized option
+ letters, optionally followed by colons, specifying that that letter
+ takes an argument, to be placed in `optarg'.
+
+ If a letter in OPTS is followed by two colons, its argument is
+ optional. This behavior is specific to the GNU `getopt'.
+
+ The argument `--' causes premature termination of argument
+ scanning, explicitly telling `getopt' that there are no more
+ options.
+
+ If OPTS begins with `--', then non-option arguments are treated as
+ arguments to the option '\0'. This behavior is specific to the GNU
+ `getopt'. */
+
+#if (defined __STDC__ && __STDC__) || defined(__cplusplus)
+# ifdef __GNU_LIBRARY__
+/* Many other libraries have conflicting prototypes for getopt, with
+ differences in the consts, in stdlib.h. To avoid compilation
+ errors, only prototype getopt for the GNU C library. */
+extern int getopt (int /*__argc*/, char *const */*__argv*/, const char *__shortopts);
+# else /* not __GNU_LIBRARY__ */
+# ifdef __cplusplus
+/* In C++ "getopt ()" means it takes no argument, which is no good.
+ Include stdlib.h first so we don't mess with any getopt prototype that
+ might be there if stdlib.h is included after this header.
+ Also stdio.h and unistd.h - Solaris also prototypes getopt there */
+# include <stdlib.h>
+# include <stdio.h>
+# include <unistd.h>
+# else
+extern int getopt ();
+# endif
+# endif /* __GNU_LIBRARY__ */
+
+# ifndef __need_getopt
+extern int getopt_long (int /*__argc*/, char *const */*__argv*/, const char *__shortopts,
+ const struct option *__longopts, int *__longind);
+extern int getopt_long_only (int /*__argc*/, char *const */*__argv*/,
+ const char *__shortopts,
+ const struct option *__longopts, int *__longind);
+
+/* Internal only. Users should not call this directly. */
+extern int _getopt_internal (int /*__argc*/, char *const */*__argv*/,
+ const char *__shortopts,
+ const struct option *__longopts, int *__longind,
+ int __long_only);
+# endif
+#else /* not __STDC__ */
+extern int getopt ();
+# ifndef __need_getopt
+extern int getopt_long ();
+extern int getopt_long_only ();
+
+extern int _getopt_internal ();
+# endif
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Make sure we later can get all the definitions and declarations. */
+#undef __need_getopt
+
+#endif /* getopt.h */
diff --git a/src/GNU/getopt_int.h b/src/GNU/getopt_int.h
new file mode 100644
index 0000000..0c5edde
--- /dev/null
+++ b/src/GNU/getopt_int.h
@@ -0,0 +1,129 @@
+/* Internal declarations for getopt.
+ Copyright (C) 1989-1994,1996-1999,2001,2003,2004
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _GETOPT_INT_H
+#define _GETOPT_INT_H 1
+
+extern int _getopt_internal (int ___argc, char *const *___argv,
+ const char *__shortopts,
+ const struct option *__longopts, int *__longind,
+ int __long_only);
+
+
+/* Reentrant versions which can handle parsing multiple argument
+ vectors at the same time. */
+
+/* Data type for reentrant functions. */
+struct _getopt_data
+{
+ /* These have exactly the same meaning as the corresponding global
+ variables, except that they are used for the reentrant
+ versions of getopt. */
+ int optind;
+ int opterr;
+ int optopt;
+ char *optarg;
+
+ /* Internal members. */
+
+ /* True if the internal members have been initialized. */
+ int __initialized;
+
+ /* The next char to be scanned in the option-element
+ in which the last option character we returned was found.
+ This allows us to pick up the scan where we left off.
+
+ If this is zero, or a null string, it means resume the scan
+ by advancing to the next ARGV-element. */
+ char *__nextchar;
+
+ /* Describe how to deal with options that follow non-option ARGV-elements.
+
+ If the caller did not specify anything,
+ the default is REQUIRE_ORDER if the environment variable
+ POSIXLY_CORRECT is defined, PERMUTE otherwise.
+
+ REQUIRE_ORDER means don't recognize them as options;
+ stop option processing when the first non-option is seen.
+ This is what Unix does.
+ This mode of operation is selected by either setting the environment
+ variable POSIXLY_CORRECT, or using `+' as the first character
+ of the list of option characters.
+
+ PERMUTE is the default. We permute the contents of ARGV as we
+ scan, so that eventually all the non-options are at the end.
+ This allows options to be given in any order, even with programs
+ that were not written to expect this.
+
+ RETURN_IN_ORDER is an option available to programs that were
+ written to expect options and other ARGV-elements in any order
+ and that care about the ordering of the two. We describe each
+ non-option ARGV-element as if it were the argument of an option
+ with character code 1. Using `-' as the first character of the
+ list of option characters selects this mode of operation.
+
+ The special argument `--' forces an end of option-scanning regardless
+ of the value of `ordering'. In the case of RETURN_IN_ORDER, only
+ `--' can cause `getopt' to return -1 with `optind' != ARGC. */
+
+ enum
+ {
+ REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+ } __ordering;
+
+ /* If the POSIXLY_CORRECT environment variable is set. */
+ int __posixly_correct;
+
+
+ /* Handle permutation of arguments. */
+
+ /* Describe the part of ARGV that contains non-options that have
+ been skipped. `first_nonopt' is the index in ARGV of the first
+ of them; `last_nonopt' is the index after the last of them. */
+
+ int __first_nonopt;
+ int __last_nonopt;
+
+#if defined _LIBC && defined USE_NONOPTION_FLAGS
+ int __nonoption_flags_max_len;
+ int __nonoption_flags_len;
+# endif
+};
+
+/* The initializer is necessary to set OPTIND and OPTERR to their
+ default values and to clear the initialization flag. */
+#define _GETOPT_DATA_INITIALIZER { 1, 1 }
+
+extern int _getopt_internal_r (int ___argc, char *const *___argv,
+ const char *__shortopts,
+ const struct option *__longopts, int *__longind,
+ int __long_only, struct _getopt_data *__data);
+
+extern int _getopt_long_r (int ___argc, char *const *___argv,
+ const char *__shortopts,
+ const struct option *__longopts, int *__longind,
+ struct _getopt_data *__data);
+
+extern int _getopt_long_only_r (int ___argc, char *const *___argv,
+ const char *__shortopts,
+ const struct option *__longopts,
+ int *__longind,
+ struct _getopt_data *__data);
+
+#endif /* getopt_int.h */
diff --git a/src/GNU/gettext.h b/src/GNU/gettext.h
new file mode 100644
index 0000000..835732e
--- /dev/null
+++ b/src/GNU/gettext.h
@@ -0,0 +1,68 @@
+/* Convenience header for conditional use of GNU <libintl.h>.
+ Copyright (C) 1995-1998, 2000-2002 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
+ the Free Software Foundation; either version 2, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _LIBGETTEXT_H
+#define _LIBGETTEXT_H 1
+
+/* NLS can be disabled through the configure --disable-nls option. */
+#if ENABLE_NLS
+
+/* Get declarations of GNU message catalog functions. */
+# include <libintl.h>
+
+#else
+
+/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
+ chokes if dcgettext is defined as a macro. So include it now, to make
+ later inclusions of <locale.h> a NOP. We don't include <libintl.h>
+ as well because people using "gettext.h" will not include <libintl.h>,
+ and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
+ is OK. */
+#if defined(__sun)
+# include <locale.h>
+#endif
+
+/* Disabled NLS.
+ The casts to 'const char *' serve the purpose of producing warnings
+ for invalid uses of the value returned from these functions.
+ On pre-ANSI systems without 'const', the config.h file is supposed to
+ contain "#define const". */
+# define gettext(Msgid) ((const char *) (Msgid))
+# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
+# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
+# define ngettext(Msgid1, Msgid2, N) \
+ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+# define dngettext(Domainname, Msgid1, Msgid2, N) \
+ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
+ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+# define textdomain(Domainname) ((const char *) (Domainname))
+# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
+# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
+
+#endif
+
+/* A pseudo function call that serves as a marker for the automated
+ extraction of messages, but does not call gettext(). The run-time
+ translation is done at a different place in the code.
+ The argument, String, should be a literal string. Concatenated strings
+ and other string expressions won't work.
+ The macro's expansion is not parenthesized, so that it is suitable as
+ initializer for static 'char[]' or 'const char[]' variables. */
+#define gettext_noop(String) String
+
+#endif /* _LIBGETTEXT_H */
diff --git a/src/GNU/gnu.c b/src/GNU/gnu.c
new file mode 100644
index 0000000..e69de29
diff --git a/src/GNU/strtod.c b/src/GNU/strtod.c
new file mode 100644
index 0000000..161f97a
--- /dev/null
+++ b/src/GNU/strtod.c
@@ -0,0 +1,189 @@
+/* Copyright (C) 1991, 1992, 1997, 1999, 2003 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
+ the Free Software Foundation; either version 2, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+
+#include <ctype.h>
+
+#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
+# define IN_CTYPE_DOMAIN(c) 1
+#else
+# define IN_CTYPE_DOMAIN(c) isascii(c)
+#endif
+
+#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
+#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
+#define TOLOWER(c) (IN_CTYPE_DOMAIN (c) ? tolower(c) : (c))
+
+#include <math.h>
+
+#include <float.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Convert NPTR to a double. If ENDPTR is not NULL, a pointer to the
+ character after the last one used in the number is put in *ENDPTR. */
+double
+strtod (const char *nptr, char **endptr)
+{
+ register const char *s;
+ short int sign;
+
+ /* The number so far. */
+ double num;
+
+ int got_dot; /* Found a decimal point. */
+ int got_digit; /* Seen any digits. */
+
+ /* The exponent of the number. */
+ long int exponent;
+
+ if (nptr == NULL)
+ {
+ errno = EINVAL;
+ goto noconv;
+ }
+
+ s = nptr;
+
+ /* Eat whitespace. */
+ while (ISSPACE (*s))
+ ++s;
+
+ /* Get the sign. */
+ sign = *s == '-' ? -1 : 1;
+ if (*s == '-' || *s == '+')
+ ++s;
+
+ num = 0.0;
+ got_dot = 0;
+ got_digit = 0;
+ exponent = 0;
+ for (;; ++s)
+ {
+ if (ISDIGIT (*s))
+ {
+ got_digit = 1;
+
+ /* Make sure that multiplication by 10 will not overflow. */
+ if (num > DBL_MAX * 0.1)
+ /* The value of the digit doesn't matter, since we have already
+ gotten as many digits as can be represented in a `double'.
+ This doesn't necessarily mean the result will overflow.
+ The exponent may reduce it to within range.
+
+ We just need to record that there was another
+ digit so that we can multiply by 10 later. */
+ ++exponent;
+ else
+ num = (num * 10.0) + (*s - '0');
+
+ /* Keep track of the number of digits after the decimal point.
+ If we just divided by 10 here, we would lose precision. */
+ if (got_dot)
+ --exponent;
+ }
+ else if (!got_dot && *s == '.')
+ /* Record that we have found the decimal point. */
+ got_dot = 1;
+ else
+ /* Any other character terminates the number. */
+ break;
+ }
+
+ if (!got_digit)
+ goto noconv;
+
+ if (TOLOWER (*s) == 'e')
+ {
+ /* Get the exponent specified after the `e' or `E'. */
+ int save = errno;
+ char *end;
+ long int exp;
+
+ errno = 0;
+ ++s;
+ exp = strtol (s, &end, 10);
+ if (errno == ERANGE)
+ {
+ /* The exponent overflowed a `long int'. It is probably a safe
+ assumption that an exponent that cannot be represented by
+ a `long int' exceeds the limits of a `double'. */
+ if (endptr != NULL)
+ *endptr = end;
+ if (exp < 0)
+ goto underflow;
+ else
+ goto overflow;
+ }
+ else if (end == s)
+ /* There was no exponent. Reset END to point to
+ the 'e' or 'E', so *ENDPTR will be set there. */
+ end = (char *) s - 1;
+ errno = save;
+ s = end;
+ exponent += exp;
+ }
+
+ if (endptr != NULL)
+ *endptr = (char *) s;
+
+ if (num == 0.0)
+ return 0.0;
+
+ /* Multiply NUM by 10 to the EXPONENT power,
+ checking for overflow and underflow. */
+
+ if (exponent < 0)
+ {
+ if (num < DBL_MIN * pow (10.0, (double) -exponent))
+ goto underflow;
+ }
+ else if (exponent > 0)
+ {
+ if (num > DBL_MAX * pow (10.0, (double) -exponent))
+ goto overflow;
+ }
+
+ num *= pow (10.0, (double) exponent);
+
+ return num * sign;
+
+overflow:
+ /* Return an overflow error. */
+ errno = ERANGE;
+ return HUGE_VAL * sign;
+
+underflow:
+ /* Return an underflow error. */
+ if (endptr != NULL)
+ *endptr = (char *) nptr;
+ errno = ERANGE;
+ return 0.0;
+
+noconv:
+ /* There was no number. */
+ if (endptr != NULL)
+ *endptr = (char *) nptr;
+ return 0.0;
+}
diff --git a/src/GNU/strtol.c b/src/GNU/strtol.c
new file mode 100644
index 0000000..e2b1589
--- /dev/null
+++ b/src/GNU/strtol.c
@@ -0,0 +1,432 @@
+/* Convert string representation of a number into an integer value.
+
+ Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003
+ Free Software Foundation, Inc.
+
+ NOTE: The canonical source of this file is maintained with the GNU C
+ Library. Bugs can be reported to bug-glibc at gnu.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
+ Free Software Foundation; either version 2, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef _LIBC
+# define USE_NUMBER_GROUPING
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+#ifndef __set_errno
+# define __set_errno(Val) errno = (Val)
+#endif
+
+#include <limits.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef USE_NUMBER_GROUPING
+# include "../locale/localeinfo.h"
+#endif
+
+/* Nonzero if we are defining `strtoul' or `strtoull', operating on
+ unsigned integers. */
+#ifndef UNSIGNED
+# define UNSIGNED 0
+# define INT LONG int
+#else
+# define INT unsigned LONG int
+#endif
+
+/* Determine the name. */
+#ifdef USE_IN_EXTENDED_LOCALE_MODEL
+# if UNSIGNED
+# ifdef USE_WIDE_CHAR
+# ifdef QUAD
+# define strtol __wcstoull_l
+# else
+# define strtol __wcstoul_l
+# endif
+# else
+# ifdef QUAD
+# define strtol __strtoull_l
+# else
+# define strtol __strtoul_l
+# endif
+# endif
+# else
+# ifdef USE_WIDE_CHAR
+# ifdef QUAD
+# define strtol __wcstoll_l
+# else
+# define strtol __wcstol_l
+# endif
+# else
+# ifdef QUAD
+# define strtol __strtoll_l
+# else
+# define strtol __strtol_l
+# endif
+# endif
+# endif
+#else
+# if UNSIGNED
+# ifdef USE_WIDE_CHAR
+# ifdef QUAD
+# define strtol wcstoull
+# else
+# define strtol wcstoul
+# endif
+# else
+# ifdef QUAD
+# define strtol strtoull
+# else
+# define strtol strtoul
+# endif
+# endif
+# else
+# ifdef USE_WIDE_CHAR
+# ifdef QUAD
+# define strtol wcstoll
+# else
+# define strtol wcstol
+# endif
+# else
+# ifdef QUAD
+# define strtol strtoll
+# endif
+# endif
+# endif
+#endif
+
+/* If QUAD is defined, we are defining `strtoll' or `strtoull',
+ operating on `long long int's. */
+#ifdef QUAD
+# define LONG long long
+# define STRTOL_LONG_MIN LONG_LONG_MIN
+# define STRTOL_LONG_MAX LONG_LONG_MAX
+# define STRTOL_ULONG_MAX ULONG_LONG_MAX
+
+/* The extra casts work around common compiler bugs,
+ e.g. Cray C 5.0.3.0 when t == time_t. */
+# ifndef TYPE_SIGNED
+# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+# endif
+# ifndef TYPE_MINIMUM
+# define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
+ ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
+ : (t) 0))
+# endif
+# ifndef TYPE_MAXIMUM
+# define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
+# endif
+
+# ifndef ULONG_LONG_MAX
+# define ULONG_LONG_MAX TYPE_MAXIMUM (unsigned long long)
+# endif
+# ifndef LONG_LONG_MAX
+# define LONG_LONG_MAX TYPE_MAXIMUM (long long int)
+# endif
+# ifndef LONG_LONG_MIN
+# define LONG_LONG_MIN TYPE_MINIMUM (long long int)
+# endif
+
+# if __GNUC__ == 2 && __GNUC_MINOR__ < 7
+ /* Work around gcc bug with using this constant. */
+ static const unsigned long long int maxquad = ULONG_LONG_MAX;
+# undef STRTOL_ULONG_MAX
+# define STRTOL_ULONG_MAX maxquad
+# endif
+#else
+# define LONG long
+# define STRTOL_LONG_MIN LONG_MIN
+# define STRTOL_LONG_MAX LONG_MAX
+# define STRTOL_ULONG_MAX ULONG_MAX
+#endif
+
+
+/* We use this code also for the extended locale handling where the
+ function gets as an additional argument the locale which has to be
+ used. To access the values we have to redefine the _NL_CURRENT
+ macro. */
+#ifdef USE_IN_EXTENDED_LOCALE_MODEL
+# undef _NL_CURRENT
+# define _NL_CURRENT(category, item) \
+ (current->values[_NL_ITEM_INDEX (item)].string)
+# define LOCALE_PARAM , loc
+# define LOCALE_PARAM_PROTO , __locale_t loc
+#else
+# define LOCALE_PARAM
+# define LOCALE_PARAM_PROTO
+#endif
+
+#if defined _LIBC || defined HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+
+#ifdef USE_WIDE_CHAR
+# include <wctype.h>
+# define L_(Ch) L##Ch
+# define UCHAR_TYPE wint_t
+# define STRING_TYPE wchar_t
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+# define ISSPACE(Ch) __iswspace_l ((Ch), loc)
+# define ISALPHA(Ch) __iswalpha_l ((Ch), loc)
+# define TOUPPER(Ch) __towupper_l ((Ch), loc)
+# else
+# define ISSPACE(Ch) iswspace (Ch)
+# define ISALPHA(Ch) iswalpha (Ch)
+# define TOUPPER(Ch) towupper (Ch)
+# endif
+#else
+# if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
+# define IN_CTYPE_DOMAIN(c) 1
+# else
+# define IN_CTYPE_DOMAIN(c) isascii(c)
+# endif
+# define L_(Ch) Ch
+# define UCHAR_TYPE unsigned char
+# define STRING_TYPE char
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+# define ISSPACE(Ch) __isspace_l ((Ch), loc)
+# define ISALPHA(Ch) __isalpha_l ((Ch), loc)
+# define TOUPPER(Ch) __toupper_l ((Ch), loc)
+# else
+# define ISSPACE(Ch) (IN_CTYPE_DOMAIN (Ch) && isspace (Ch))
+# define ISALPHA(Ch) (IN_CTYPE_DOMAIN (Ch) && isalpha (Ch))
+# define TOUPPER(Ch) (IN_CTYPE_DOMAIN (Ch) ? toupper (Ch) : (Ch))
+# endif
+#endif
+
+#define INTERNAL(X) INTERNAL1(X)
+#define INTERNAL1(X) __##X##_internal
+#define WEAKNAME(X) WEAKNAME1(X)
+
+#ifdef USE_NUMBER_GROUPING
+/* This file defines a function to check for correct grouping. */
+# include "grouping.h"
+#endif
+
+
+
+/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
+ If BASE is 0 the base is determined by the presence of a leading
+ zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
+ If BASE is < 2 or > 36, it is reset to 10.
+ If ENDPTR is not NULL, a pointer to the character after the last
+ one converted is stored in *ENDPTR. */
+
+INT
+INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
+ int base, int group LOCALE_PARAM_PROTO)
+{
+ int negative;
+ register unsigned LONG int cutoff;
+ register unsigned int cutlim;
+ register unsigned LONG int i;
+ register const STRING_TYPE *s;
+ register UCHAR_TYPE c;
+ const STRING_TYPE *save, *end;
+ int overflow;
+
+#ifdef USE_NUMBER_GROUPING
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+ struct locale_data *current = loc->__locales[LC_NUMERIC];
+# endif
+ /* The thousands character of the current locale. */
+ wchar_t thousands = L'\0';
+ /* The numeric grouping specification of the current locale,
+ in the format described in <locale.h>. */
+ const char *grouping;
+
+ if (group)
+ {
+ grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
+ if (*grouping <= 0 || *grouping == CHAR_MAX)
+ grouping = NULL;
+ else
+ {
+ /* Figure out the thousands separator character. */
+# if defined _LIBC || defined _HAVE_BTOWC
+ thousands = __btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP));
+ if (thousands == WEOF)
+ thousands = L'\0';
+# endif
+ if (thousands == L'\0')
+ grouping = NULL;
+ }
+ }
+ else
+ grouping = NULL;
+#endif
+
+ if (base < 0 || base == 1 || base > 36)
+ {
+ __set_errno (EINVAL);
+ return 0;
+ }
+
+ save = s = nptr;
+
+ /* Skip white space. */
+ while (ISSPACE (*s))
+ ++s;
+ if (*s == L_('\0'))
+ goto noconv;
+
+ /* Check for a sign. */
+ if (*s == L_('-'))
+ {
+ negative = 1;
+ ++s;
+ }
+ else if (*s == L_('+'))
+ {
+ negative = 0;
+ ++s;
+ }
+ else
+ negative = 0;
+
+ /* Recognize number prefix and if BASE is zero, figure it out ourselves. */
+ if (*s == L_('0'))
+ {
+ if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X'))
+ {
+ s += 2;
+ base = 16;
+ }
+ else if (base == 0)
+ base = 8;
+ }
+ else if (base == 0)
+ base = 10;
+
+ /* Save the pointer so we can check later if anything happened. */
+ save = s;
+
+#ifdef USE_NUMBER_GROUPING
+ if (group)
+ {
+ /* Find the end of the digit string and check its grouping. */
+ end = s;
+ for (c = *end; c != L_('\0'); c = *++end)
+ if ((wchar_t) c != thousands
+ && ((wchar_t) c < L_('0') || (wchar_t) c > L_('9'))
+ && (!ISALPHA (c) || (int) (TOUPPER (c) - L_('A') + 10) >= base))
+ break;
+ if (*s == thousands)
+ end = s;
+ else
+ end = correctly_grouped_prefix (s, end, thousands, grouping);
+ }
+ else
+#endif
+ end = NULL;
+
+ cutoff = STRTOL_ULONG_MAX / (unsigned LONG int) base;
+ cutlim = STRTOL_ULONG_MAX % (unsigned LONG int) base;
+
+ overflow = 0;
+ i = 0;
+ for (c = *s; c != L_('\0'); c = *++s)
+ {
+ if (s == end)
+ break;
+ if (c >= L_('0') && c <= L_('9'))
+ c -= L_('0');
+ else if (ISALPHA (c))
+ c = TOUPPER (c) - L_('A') + 10;
+ else
+ break;
+ if ((int) c >= base)
+ break;
+ /* Check for overflow. */
+ if (i > cutoff || (i == cutoff && c > cutlim))
+ overflow = 1;
+ else
+ {
+ i *= (unsigned LONG int) base;
+ i += c;
+ }
+ }
+
+ /* Check if anything actually happened. */
+ if (s == save)
+ goto noconv;
+
+ /* Store in ENDPTR the address of one character
+ past the last character we converted. */
+ if (endptr != NULL)
+ *endptr = (STRING_TYPE *) s;
+
+#if !UNSIGNED
+ /* Check for a value that is within the range of
+ `unsigned LONG int', but outside the range of `LONG int'. */
+ if (overflow == 0
+ && i > (negative
+ ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1
+ : (unsigned LONG int) STRTOL_LONG_MAX))
+ overflow = 1;
+#endif
+
+ if (overflow)
+ {
+ __set_errno (ERANGE);
+#if UNSIGNED
+ return STRTOL_ULONG_MAX;
+#else
+ return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX;
+#endif
+ }
+
+ /* Return the result of the appropriate sign. */
+ return negative ? -i : i;
+
+noconv:
+ /* We must handle a special case here: the base is 0 or 16 and the
+ first two characters are '0' and 'x', but the rest are no
+ hexadecimal digits. This is no error case. We return 0 and
+ ENDPTR points to the `x`. */
+ if (endptr != NULL)
+ {
+ if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X')
+ && save[-2] == L_('0'))
+ *endptr = (STRING_TYPE *) &save[-1];
+ else
+ /* There was no number to convert. */
+ *endptr = (STRING_TYPE *) nptr;
+ }
+
+ return 0L;
+}
+
+/* External user entry point. */
+
+
+INT
+#ifdef weak_function
+weak_function
+#endif
+strtol (const STRING_TYPE *nptr, STRING_TYPE **endptr,
+ int base LOCALE_PARAM_PROTO)
+{
+ return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM);
+}
diff --git a/src/Graph/CompositeNode.cc b/src/Graph/CompositeNode.cc
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/src/Graph/CompositeNode.cc
@@ -0,0 +1 @@
+
diff --git a/src/Graph/CompositeNode.hh b/src/Graph/CompositeNode.hh
new file mode 100644
index 0000000..3ddf03d
--- /dev/null
+++ b/src/Graph/CompositeNode.hh
@@ -0,0 +1,43 @@
+#ifndef CompositeNode_HH
+#define CompositeNode_HH 1
+
+#include <map>
+#include "Graph.hh"
+#include "Node.hh"
+
+using namespace std;
+
+/**
+ * The <b>CompositeNode</b> class
+ *
+ *
+ * <p>Copyright © 2004, The Institute for Genomic Research (TIGR).
+ * <br>All rights reserved.
+ *
+ * @author Dan Sommer
+ *
+ * <pre>
+ * $RCSfile$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * </pre>
+ */
+class CompositeNode : public Node {
+
+public:
+
+ Graph* graph;
+
+ CompositeNode(void* p_element) : Node(p_element) {
+ graph = new Graph();
+ }
+
+ Graph* getGraph() const { return graph; }
+ void setGraph(Graph* p_graph) { graph = p_graph; }
+
+
+
+};
+
+#endif // #ifndef CompositeNode_HH
diff --git a/src/Graph/Edge.cc b/src/Graph/Edge.cc
new file mode 100644
index 0000000..ab5ee8a
--- /dev/null
+++ b/src/Graph/Edge.cc
@@ -0,0 +1,44 @@
+/*** includes ***/
+#include "Edge.hh"
+
+using namespace std;
+
+Edge::Edge(void* p_element, bool p_directed) : element(p_element) {
+ flags = 0;
+ // flags |= p_directed;
+ hidden = false;
+ color = "black";
+}
+
+void Edge::reverse() {
+ INode* tmp = n1;
+ n1 = n2;
+ n2 = tmp;
+}
+
+void Edge::setNodes(INode *p_node1, INode *p_node2) {
+ n1 = p_node1;
+ n2 = p_node2;
+}
+
+INode** Edge::getNodes() const {
+ INode** nodes = new INode*[2];
+ nodes[0] = n1;
+ nodes[1] = n2;
+
+ return nodes;
+}
+
+INode* Edge::opposite(INode *p_node) const {
+ if(n1 == p_node) {
+ return n2;
+ } else if(n2 == p_node) {
+ return n1;
+ } else {
+ // TODO throw exception
+ return NULL;
+ }
+}
+
+
+
diff --git a/src/Graph/Edge.hh b/src/Graph/Edge.hh
new file mode 100644
index 0000000..2a92b34
--- /dev/null
+++ b/src/Graph/Edge.hh
@@ -0,0 +1,93 @@
+#ifndef __Edge_HH
+#define __Edge_HH 1
+
+#include <string>
+#include <iostream>
+#include <sstream>
+#include "INode.hh"
+#include "IEdge.hh"
+
+const unsigned long DIRECT_MASK = 0x1;
+const unsigned long WEIGHT_MASK = 0x2;
+
+/**
+ * The <b>Edge</b> class
+ *
+ *
+ * <p>Copyright © 2004, The Institute for Genomic Research (TIGR).
+ * <br>All rights reserved.
+ *
+ * @author Dan Sommer
+ *
+ * <pre>
+ * $RCSfile$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * </pre>
+ */
+class Edge : public IEdge {
+
+public:
+ /** object associated with edge */
+ void* element;
+
+ /** identitfier, position in array or locator for map */
+ int key;
+
+ bool hidden;
+
+ std::string color;
+
+ /* nodes that the edge is connected */
+ /** source if node is directed */
+ INode* n1;
+
+ /** target if node is directed */
+ INode* n2;
+
+ /** bit flags */
+ unsigned long flags;
+
+ Edge(void* p_element, bool p_directed =false);
+
+ void* getElement() const { return element; }
+ void setElement(void* p_element) { element = p_element; }
+
+ int getKey() const { return key; }
+ void setKey(int p_key) { key = p_key; }
+
+ void setColor(std::string p_color) { color = p_color; }
+ std::string getColor() const { return color; }
+
+ int getHidden() const { return hidden; }
+ void setHidden(bool p_hidden) { hidden = p_hidden; }
+
+ unsigned long getFlags() const { return flags; }
+ void setFlags(unsigned long p_flags) { flags = p_flags; }
+ bool isDirected() const { return flags & DIRECT_MASK; }
+ void setDirected(bool p_bit) { flags |= p_bit; }
+
+ bool isWeigthed() const { return flags & WEIGHT_MASK; }
+ void setWeighted(bool p_bit) { flags |= p_bit; }
+
+ void reverse();
+
+ INode* getSource() const { return n1; }
+
+ void setSource(INode *p_node) { n1 = p_node; }
+
+ INode* getTarget() const { return n2; }
+
+ void setTarget(INode *p_node) { n2 = p_node; }
+
+ void setNodes(INode *p_node1, INode *p_node2);
+
+ INode** getNodes() const;
+
+ INode* opposite(INode *p_node) const;
+
+};
+
+
+#endif // #ifndef __Edge_HH
diff --git a/src/Graph/Graph.cc b/src/Graph/Graph.cc
new file mode 100644
index 0000000..379fdfc
--- /dev/null
+++ b/src/Graph/Graph.cc
@@ -0,0 +1,291 @@
+/*** includes ***/
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <vector>
+#include <list>
+#include "Graph.hh"
+
+using namespace std;
+
+Graph::Graph(string p_name) : name(p_name) {
+ keys = 0;
+ directed = false;
+}
+
+bool Graph::isDirected() {
+ return directed;
+}
+
+
+bool Graph::contains(INode* p_node) {
+ return ! (p_node->getHidden());
+}
+
+bool Graph::contains(IEdge* p_edge) {
+ return ! (p_edge->getHidden());
+}
+
+// INode Methods
+////////////////
+// TODO: need to fix degree for subgraphes
+
+int Graph::degree(INode* p_node) const {
+ return p_node->degree();
+}
+
+int Graph::out_degree(INode* p_node) const {
+ return p_node->out_degree();
+}
+
+int Graph::in_degree(INode* p_node) const {
+ return p_node->in_degree();
+}
+
+INode* Graph::opposite(INode* p_node, IEdge* p_edge) {
+ return p_edge->opposite(p_node);
+}
+
+INode* Graph::target(IEdge* p_edge) {
+ return p_edge->getTarget();
+}
+
+INode* Graph::source(IEdge* p_edge) {
+ return p_edge->getSource();
+}
+
+list< IEdge* > Graph::incident_edges(INode* p_node) {
+ list<IEdge *> edges;
+ IEdge* edge;
+ IEdgeIterator iter = p_node->out_edges_begin();
+
+ for( ; iter != p_node->out_edges_end(); ++iter) {
+ edge = (*iter).second;
+ if(contains(edge)) {
+ edges.push_back(edge);
+ }
+ }
+
+ if(directed) {
+ iter = p_node->in_edges_begin();
+ for( ; iter != p_node->in_edges_end(); ++iter) {
+ edge = (*iter).second;
+ if(contains(edge)) {
+ edges.push_back(edge);
+ }
+ }
+ }
+
+ return edges;
+}
+
+
+list< IEdge* > Graph::out_edges(INode* p_node) const {
+ list<IEdge *> edges;
+ IEdge* edge;
+
+ if(directed) {
+ IEdgeIterator iter = p_node->out_edges_begin();
+ for( ; iter != p_node->out_edges_end(); ++iter) {
+ edge = (*iter).second;
+ edges.push_back(edge);
+ }
+ }
+
+ return edges;
+}
+
+list< IEdge* > Graph::in_edges(INode* p_node) const {
+ list<IEdge *> edges;
+ IEdge* edge;
+
+ if(directed) {
+ IEdgeIterator iter = p_node->in_edges_begin();
+ for( ; iter != p_node->in_edges_end(); ++iter) {
+ edge = (*iter).second;
+ edges.push_back(edge);
+ }
+ }
+
+ return edges;
+}
+
+list< INode* > Graph::adjacent_nodes(INode* p_node) {
+ list< INode* > nodes;
+ IEdge* edge;
+ IEdgeIterator iter = p_node->out_edges_begin();
+
+ for( ; iter != p_node->out_edges_end(); ++iter) {
+ edge = (*iter).second;
+ if(contains(edge)) {
+ nodes.push_back(opposite(p_node, edge));
+ }
+ }
+
+ if(directed) {
+ iter = p_node->in_edges_begin();
+ for( ; iter != p_node->in_edges_end(); ++iter) {
+ edge = (*iter).second;
+ if(contains(edge)) {
+ nodes.push_back(opposite(p_node, edge));
+ }
+ }
+ }
+
+ return nodes;
+}
+
+list< INode* > Graph::out_adjacent(INode* p_node) {
+ list< INode* > nodes;
+ IEdge* edge;
+ IEdgeIterator iter = p_node->out_edges_begin();
+
+ if(directed) {
+ for( ; iter != p_node->out_edges_end(); ++iter) {
+ edge = (*iter).second;
+ nodes.push_back(opposite(p_node, edge));
+ }
+ }
+
+ return nodes;
+}
+
+list< INode* > Graph::in_adjacent(INode* p_node) {
+ list< INode* > nodes;
+ // IEdge* edge;
+ IEdgeIterator iter = p_node->out_edges_begin();
+
+ if(directed) {
+ iter = p_node->in_edges_begin();
+ for( ; iter != p_node->in_edges_end(); ++iter) {
+ nodes.push_back(opposite(p_node, (*iter).second));
+ }
+ }
+
+ return nodes;
+}
+
+INode* Graph::new_node(void* p_element) {
+ return new_node(keys++, p_element);
+}
+
+INode* Graph::new_node(int p_key, void* p_element) {
+ INode* n = new Node(p_element);
+ n->setKey(p_key);
+ nodes[n->getKey()] = n;
+ return n;
+}
+
+
+// CompositeNode* Graph::reduce(IEdge* p_e) {
+// // create composite node
+// CompositeNode* cn = new CompositeNode();
+
+// // need to add nodes to composite
+// INode* source = p_e->getSource();
+// INode* target = p_e->getTarget();
+
+// //
+
+
+
+// }
+
+
+INode* Graph::get_node(int p_key) {
+ return nodes[p_key];
+}
+
+IEdge* Graph::get_edge(int p_key) {
+ return edges[p_key];
+}
+
+// IEdge Methods
+////////////////
+IEdge* Graph::new_edge(INode* p_n1, INode* p_n2, void* p_element) {
+ IEdge* e = (IEdge *) new Edge(p_element, directed);
+
+ e->setSource(p_n1);
+ e->setTarget(p_n2);
+ e->setKey(keys++);
+
+ edges[e->getKey()] = e;
+
+ p_n1->add_oedge(e);
+
+ if(directed) {
+ p_n2->add_iedge(e);
+ } else {
+ p_n2->add_oedge(e);
+ }
+
+ return e;
+}
+
+void Graph::clear_edge_flags() {
+ IEdgeIterator edgeIter = edges.begin();
+ for( ; edgeIter != edges.end(); ++edgeIter) {
+ (*edgeIter).second->setFlags(0x0);
+ }
+}
+
+void Graph::clear_flags() {
+ clear_node_flags();
+ clear_edge_flags();
+
+}
+
+void Graph::clear_node_flags() {
+ for(INodeIterator nodeIter = nodes.begin(); nodeIter != nodes.end(); ++nodeIter) {
+ (*nodeIter).second->setFlags(0x0);
+ }
+
+ clear_edge_flags();
+}
+
+/**
+ *
+ */
+void Graph::create_dot_file(const char* p_filename) {
+ ofstream dotOut(p_filename);
+
+ dotOut << " digraph " << name << " {" << endl;
+
+ dotOut << " label=\"" << name << "\";" << endl;
+ dotOut << " URL=\"" << name << ".html\";" << endl;
+
+ INode* n;
+ for(INodeIterator nodeIter = nodes.begin(); nodeIter != nodes.end(); ++nodeIter) {
+ n = (*nodeIter).second;
+ if(contains(n)) {
+ int key = (*nodeIter).first;
+ dotOut << " " << key << " [shape=house,orientation=270";
+ dotOut << ", color=\"" << n->getColor() << "\"";
+ dotOut << ",URL=\"" << key << ".html\"];" << endl;
+ }
+ }
+
+ IEdgeIterator edgeIter = edges.begin();
+ INode* n1;
+ INode* n2;
+ IEdge* e;
+
+ for( ; edgeIter != edges.end(); ++edgeIter) {
+ e = (*edgeIter).second;
+ if(contains(e)) {
+ n1 = e->getSource();
+ n2 = e->getTarget();
+
+ dotOut << " " << n1->getKey() << " -> " << n2->getKey();
+ dotOut << " [label=\"" << e->getKey() << "\"";
+ dotOut << ", color=\"" << e->getColor() << "\"";
+ dotOut << "]; " << endl;
+
+ }
+ }
+
+ cout << " end of create dot file " << endl;
+ dotOut << endl;
+ dotOut << "} " << endl;
+}
+
diff --git a/src/Graph/Graph.hh b/src/Graph/Graph.hh
new file mode 100644
index 0000000..9f69711
--- /dev/null
+++ b/src/Graph/Graph.hh
@@ -0,0 +1,119 @@
+#ifndef Graph_HH
+#define Graph_HH 1
+
+#include <string>
+#include <iostream>
+#include <sstream>
+#include <map>
+#include <list>
+#include "IGraph.hh"
+#include "Node.hh"
+//#include "CompositeNode.hh"
+#include "Edge.hh"
+
+class IEdge;
+class INode;
+
+class Edge;
+class Node;
+class CompositeNode;
+
+/**
+ * The <b>Graph</b> class
+ *
+ *
+ * <p>Copyright © 2004, The Institute for Genomic Research (TIGR).
+ * <br>All rights reserved.
+ *
+ * @author Dan Sommer
+ *
+ * <pre>
+ * $RCSfile$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * </pre>
+ */
+class Graph : public IGraph {
+
+public:
+
+ /** <code> directed </code> is the graph directed */
+ bool directed;
+
+ /** map of edges */
+ HASHMAP::hash_map< int, IEdge* > edges;
+
+ /** map of nodes */
+ HASHMAP::hash_map< int, INode* > nodes;
+
+ /** <code> name </code> of graph */
+ std::string name;
+
+ /** */
+ int keys;
+
+ Graph(std::string p_name="noname");
+
+ /**
+ * output dot file for the graph
+ */
+ void create_dot_file(const char* p_filename);
+
+ /**
+ * create new INode
+ */
+ INode* new_node(int key, void* p_element = NULL);
+ INode* new_node(void* p_element = NULL);
+ INode* get_node(int p_key);
+
+ IEdge* get_edge(int p_key);
+
+ virtual bool contains(IEdge* p_edge);
+ virtual bool contains(INode* p_node);
+
+ int num_nodes() { return nodes.size(); }
+
+ INodeIterator nodes_begin() { return nodes.begin(); }
+ INodeIterator nodes_end() { return nodes.end(); }
+
+ void clear_flags();
+ void clear_node_flags();
+ void clear_edge_flags();
+
+ int degree(INode* p_node) const;
+ int out_degree(INode* p_node) const;
+ int in_degree(INode* p_node) const;
+
+ std::list< IEdge* > incident_edges(INode* p_node);
+ std::list< IEdge* > in_edges(INode* p_node) const;
+ std::list< IEdge* > out_edges(INode* p_node) const;
+
+ INode* aNode() { return (nodes.begin())->second; }
+
+ /**
+ * create new IEdge
+ */
+ IEdge* new_edge(INode* p_n1, INode* p_n2, void* p_element = NULL);
+
+ int num_edges() { return edges.size(); }
+ IEdgeIterator edges_begin() { return edges.begin(); }
+ IEdgeIterator edges_end() { return edges.end(); }
+
+ INode* opposite(INode* p_node, IEdge* p_edge);
+ INode* source(IEdge* p_edge);
+ INode* target(IEdge* p_edge);
+
+ std::list< INode* > adjacent_nodes(INode* p_node);
+ std::list< INode* > out_adjacent(INode* p_node);
+ std::list< INode* > in_adjacent(INode* p_node);
+
+ bool isDirected();
+
+ /////
+
+ // CompositeNode* reduce(IEdge *);
+};
+
+
+#endif // #ifndef Graph_HH
diff --git a/src/Graph/IEdge.hh b/src/Graph/IEdge.hh
new file mode 100644
index 0000000..e4dad6b
--- /dev/null
+++ b/src/Graph/IEdge.hh
@@ -0,0 +1,73 @@
+#ifndef __IEdge_HH
+#define __IEdge_HH 1
+
+#include <list>
+#include <string>
+
+#include "INode.hh"
+
+class IEdge;
+class INode;
+
+/**
+ * The <b>IEdge</b> class
+ *
+ *
+ * <p>Copyright © 2004, The Institute for Genomic Research (TIGR).
+ * <br>All rights reserved.
+ *
+ * @author Dan Sommer
+ *
+ * <pre>
+ * $RCSfile$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * </pre>
+ */
+class IEdge {
+
+public:
+
+ virtual ~IEdge( ) { }
+
+ virtual void setColor(std::string p_color) = 0;
+ virtual std::string getColor() const = 0;
+
+ virtual void* getElement() const = 0;
+ virtual void setElement(void* p_element) = 0;
+
+ virtual int getKey() const = 0;
+ virtual void setKey(int p_key) = 0;
+
+ virtual unsigned long getFlags() const = 0;
+ virtual void setFlags(unsigned long p_flags) = 0;
+
+ virtual int getHidden() const = 0;
+ virtual void setHidden(bool p_hidden) = 0;
+
+ virtual bool isDirected() const = 0;
+ virtual void setDirected(bool p_bit) = 0;
+
+ virtual bool isWeigthed() const = 0;
+ virtual void setWeighted(bool p_bit) = 0;
+
+ virtual void reverse() = 0;
+
+ virtual INode* getSource() const = 0;
+
+ virtual void setSource(INode *p_node) = 0;
+
+ virtual INode* getTarget() const = 0;
+
+ virtual void setTarget(INode *p_node) = 0;
+
+ virtual void setNodes(INode *p_node1, INode *p_node2) = 0;
+
+ virtual INode** getNodes() const = 0;
+ virtual INode* opposite(INode *p_node) const = 0;
+
+};
+
+
+#endif // #ifndef __IEdge_HH
diff --git a/src/Graph/IGraph.hh b/src/Graph/IGraph.hh
new file mode 100644
index 0000000..a117d8b
--- /dev/null
+++ b/src/Graph/IGraph.hh
@@ -0,0 +1,95 @@
+#ifndef IGraph_HH
+#define IGraph_HH 1
+
+#include <list>
+#include "utility_AMOS.hh"
+#include "IEdge.hh"
+#include "INode.hh"
+
+class IEdge;
+class INode;
+
+typedef HASHMAP::hash_map< int, IEdge* >::iterator IEdgeIterator;
+typedef HASHMAP::hash_map< int, INode* >::iterator INodeIterator;
+
+
+/**
+ * The <b>IGraph</b> class
+ *
+ *
+ * <p>Copyright © 2004, The Institute for Genomic Research (TIGR).
+ * <br>All rights reserved.
+ *
+ * @author Dan Sommer
+ *
+ * <pre>
+ * $RCSfile$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * </pre>
+ */
+class IGraph {
+
+public:
+
+ virtual ~IGraph( ) { }
+
+ /**
+ * output dot file for the graph
+ */
+ virtual void create_dot_file(const char* p_filename) = 0;
+
+
+ /**
+ * create new INode
+ */
+ virtual INode* new_node(int key, void* p_element = NULL) = 0;
+ virtual INode* new_node(void* p_element = NULL) = 0;
+
+ virtual INode* get_node(int p_key) = 0;
+
+ virtual IEdge* get_edge(int p_key) = 0;
+
+ virtual int num_nodes() = 0;
+
+ virtual INodeIterator nodes_begin() = 0;
+ virtual INodeIterator nodes_end() = 0;
+
+
+ virtual int degree(INode* p_node) const = 0;
+ virtual int out_degree(INode* p_node) const = 0;
+ virtual int in_degree(INode* p_node) const = 0;
+
+ virtual std::list< IEdge* > incident_edges(INode* p_node) = 0;
+ virtual std::list< IEdge* > in_edges(INode* p_node) const = 0;
+ virtual std::list< IEdge* > out_edges(INode* p_node) const = 0;
+
+ virtual INode* aNode() = 0;
+ virtual void clear_flags() = 0;
+ virtual void clear_node_flags() = 0;
+ virtual void clear_edge_flags() = 0;
+
+ /**
+ * create new IEdge
+ */
+ virtual IEdge* new_edge(INode* p_n1, INode* p_n2, void* p_element = NULL) = 0;
+
+ virtual int num_edges() = 0;
+ virtual IEdgeIterator edges_begin() = 0;
+ virtual IEdgeIterator edges_end() = 0;
+
+ virtual INode* opposite(INode* p_node, IEdge* p_edge) = 0;
+ virtual INode* source(IEdge* p_edge) = 0;
+ virtual INode* target(IEdge* p_edge) = 0;
+
+ virtual std::list< INode* > adjacent_nodes(INode* p_node) = 0;
+ virtual std::list< INode* > out_adjacent(INode* p_node) = 0;
+ virtual std::list< INode* > in_adjacent(INode* p_node) = 0;
+
+ virtual bool isDirected() = 0;
+
+};
+
+
+#endif // #ifndef IGraph_HH
diff --git a/src/Graph/INode.hh b/src/Graph/INode.hh
new file mode 100644
index 0000000..4093b57
--- /dev/null
+++ b/src/Graph/INode.hh
@@ -0,0 +1,74 @@
+#ifndef INode_HH
+#define INode_HH 1
+
+#include <string>
+#include "utility_AMOS.hh"
+#include "IEdge.hh"
+
+
+class IEdge;
+
+typedef HASHMAP::hash_map< int, IEdge* >::iterator IEdgeIterator;
+
+/**
+ * The <b>INode</b> class is a interface
+ *
+ *
+ * <p>Copyright © 2004, The Institute for Genomic Research (TIGR).
+ * <br>All rights reserved.
+ *
+ * @author Dan Sommer
+ *
+ * <pre>
+ * $RCSfile$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * </pre>
+ */
+class INode {
+public:
+
+ virtual ~INode( ) { }
+
+ virtual void setColor(const std::string p_color) = 0;
+ virtual std::string getColor() const = 0;
+
+ virtual void* getElement() const = 0;
+ virtual void setElement(void* p_element) = 0;
+
+ virtual int getKey() const = 0;
+ virtual void setKey(int p_key) = 0;
+
+ virtual int getDepth() const = 0;
+ virtual void setDepth(int p_depth) = 0;
+
+ virtual int getParent() const = 0;
+ virtual void setParent(int p_parent) = 0;
+
+ virtual int getInterval() const = 0;
+ virtual void setInterval(int p_interval) = 0;
+
+ virtual int getHidden() const = 0;
+ virtual void setHidden(bool p_hidden) = 0;
+ virtual void setNodeHidden(bool p_hidden) = 0;
+ virtual unsigned long getFlags() const = 0;
+ virtual void setFlags(unsigned long p_flags) = 0;
+
+ virtual void add_edge(IEdge* p_edge) = 0;
+ virtual void add_oedge(IEdge* p_edge) = 0;
+ virtual void add_iedge(IEdge* p_edge) = 0;
+
+ virtual int degree() = 0;
+ virtual int out_degree() = 0;
+ virtual int in_degree() = 0;
+
+ virtual IEdgeIterator out_edges_begin() = 0;
+ virtual IEdgeIterator out_edges_end() = 0;
+
+ virtual IEdgeIterator in_edges_begin() = 0;
+ virtual IEdgeIterator in_edges_end() = 0;
+
+};
+
+#endif // #ifndef INode_HH
diff --git a/src/Graph/Makefile.am b/src/Graph/Makefile.am
new file mode 100644
index 0000000..1e49da9
--- /dev/null
+++ b/src/Graph/Makefile.am
@@ -0,0 +1,43 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+##-- TO BE TESTED
+check_PROGRAMS = Test
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = -I$(top_srcdir)/src/AMOS
+
+##-- test
+Test_LDADD = \
+ $(top_builddir)/src/Graph/libGraph.a
+
+Test_SOURCES = \
+ Test.cc
+
+
+#-- TO BE INSTALLED
+amoslib_LIBRARIES = \
+ libGraph.a
+
+amosinclude_HEADERS = \
+ INode.hh \
+ Node.hh \
+ IEdge.hh \
+ Edge.hh \
+ Graph.hh \
+ IGraph.hh \
+ SubGraph.hh \
+ CompositeNode.hh
+
+
+
+##-- libGraph.a
+libGraph_a_SOURCES = \
+ Edge.cc \
+ Graph.cc \
+ Node.cc \
+ SubGraph.cc \
+ CompositeNode.cc
+
+
+##-- END OF MAKEFILE --##
diff --git a/src/Graph/Makefile.in b/src/Graph/Makefile.in
new file mode 100644
index 0000000..02aec86
--- /dev/null
+++ b/src/Graph/Makefile.in
@@ -0,0 +1,645 @@
+# 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 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@
+DIST_COMMON = $(amosinclude_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+check_PROGRAMS = Test$(EXEEXT)
+subdir = src/Graph
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(amoslibdir)" \
+ "$(DESTDIR)$(amosincludedir)"
+LIBRARIES = $(amoslib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libGraph_a_AR = $(AR) $(ARFLAGS)
+libGraph_a_LIBADD =
+am_libGraph_a_OBJECTS = Edge.$(OBJEXT) Graph.$(OBJEXT) Node.$(OBJEXT) \
+ SubGraph.$(OBJEXT) CompositeNode.$(OBJEXT)
+libGraph_a_OBJECTS = $(am_libGraph_a_OBJECTS)
+am_Test_OBJECTS = Test.$(OBJEXT)
+Test_OBJECTS = $(am_Test_OBJECTS)
+Test_DEPENDENCIES = $(top_builddir)/src/Graph/libGraph.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(libGraph_a_SOURCES) $(Test_SOURCES)
+DIST_SOURCES = $(libGraph_a_SOURCES) $(Test_SOURCES)
+HEADERS = $(amosinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = -I$(top_srcdir)/src/AMOS
+Test_LDADD = \
+ $(top_builddir)/src/Graph/libGraph.a
+
+Test_SOURCES = \
+ Test.cc
+
+
+#-- TO BE INSTALLED
+amoslib_LIBRARIES = \
+ libGraph.a
+
+amosinclude_HEADERS = \
+ INode.hh \
+ Node.hh \
+ IEdge.hh \
+ Edge.hh \
+ Graph.hh \
+ IGraph.hh \
+ SubGraph.hh \
+ CompositeNode.hh
+
+libGraph_a_SOURCES = \
+ Edge.cc \
+ Graph.cc \
+ Node.cc \
+ SubGraph.cc \
+ CompositeNode.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Graph/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Graph/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):
+install-amoslibLIBRARIES: $(amoslib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(amoslibdir)" || $(MKDIR_P) "$(DESTDIR)$(amoslibdir)"
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(amoslibdir)'"; \
+ $(INSTALL_DATA) $$list2 "$(DESTDIR)$(amoslibdir)" || exit $$?; }
+ @$(POST_INSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ for p in $$list; do \
+ if test -f $$p; then \
+ $(am__strip_dir) \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && $(RANLIB) $$f )"; \
+ ( cd "$(DESTDIR)$(amoslibdir)" && $(RANLIB) $$f ) || exit $$?; \
+ else :; fi; \
+ done
+
+uninstall-amoslibLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && rm -f "$$files" )"; \
+ cd "$(DESTDIR)$(amoslibdir)" && rm -f $$files
+
+clean-amoslibLIBRARIES:
+ -test -z "$(amoslib_LIBRARIES)" || rm -f $(amoslib_LIBRARIES)
+libGraph.a: $(libGraph_a_OBJECTS) $(libGraph_a_DEPENDENCIES)
+ -rm -f libGraph.a
+ $(libGraph_a_AR) libGraph.a $(libGraph_a_OBJECTS) $(libGraph_a_LIBADD)
+ $(RANLIB) libGraph.a
+
+clean-checkPROGRAMS:
+ -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+Test$(EXEEXT): $(Test_OBJECTS) $(Test_DEPENDENCIES)
+ @rm -f Test$(EXEEXT)
+ $(CXXLINK) $(Test_OBJECTS) $(Test_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CompositeNode.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Edge.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Graph.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Node.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/SubGraph.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Test.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+install-amosincludeHEADERS: $(amosinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(amosincludedir)" || $(MKDIR_P) "$(DESTDIR)$(amosincludedir)"
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(amosincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(amosincludedir)" || exit $$?; \
+ done
+
+uninstall-amosincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amosincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(amosincludedir)" && rm -f $$files
+
+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
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+check: check-am
+all-am: Makefile $(LIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(amosincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-amoslibLIBRARIES clean-checkPROGRAMS clean-generic \
+ 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-amosincludeHEADERS install-amoslibLIBRARIES
+
+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:
+
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-amosincludeHEADERS uninstall-amoslibLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: check-am install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-amoslibLIBRARIES clean-checkPROGRAMS clean-generic ctags \
+ distclean distclean-compile distclean-generic distclean-tags \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-amosincludeHEADERS install-amoslibLIBRARIES \
+ 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-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-amosincludeHEADERS \
+ uninstall-amoslibLIBRARIES uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Graph/Node.cc b/src/Graph/Node.cc
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/src/Graph/Node.cc
@@ -0,0 +1 @@
+
diff --git a/src/Graph/Node.hh b/src/Graph/Node.hh
new file mode 100644
index 0000000..a083062
--- /dev/null
+++ b/src/Graph/Node.hh
@@ -0,0 +1,116 @@
+#ifndef Node_HH
+#define Node_HH 1
+
+#include <string>
+#include "INode.hh"
+#include "IEdge.hh"
+
+// Declarations need to Node
+class IEdge;
+
+/**
+ * The <b>Node</b> class
+ *
+ *
+ * <p>Copyright © 2004, The Institute for Genomic Research (TIGR).
+ * <br>All rights reserved.
+ *
+ * @author Dan Sommer
+ *
+ * <pre>
+ * $RCSfile$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * </pre>
+ */
+class Node : public INode {
+public:
+ // element reference
+ void* element;
+
+ //
+ HASHMAP::hash_map< int, IEdge* > oedges;
+ HASHMAP::hash_map< int, IEdge* > iedges;
+
+ // identitfier or position
+ int key;
+
+ bool hidden;
+
+ // interval
+ int interval;
+
+ int depth;
+
+ int parent;
+
+ std::string color;
+
+ unsigned long flags;
+
+ Node(void* p_element) : element(p_element) {
+ flags = 0;
+ depth = 0;
+ parent = -1;
+ hidden = false;
+ color = "black";
+ }
+
+ /* Setters & Getters */
+ void* getElement() const { return element; }
+ void setElement(void* p_element) { element = p_element; }
+
+ void setColor(const std::string p_color) { color = p_color; }
+ std::string getColor() const { return color; }
+
+ int getKey() const { return key; }
+ void setKey(int p_key) { key = p_key; }
+
+ int getDepth() const { return depth; }
+ void setDepth(int p_depth) { depth = p_depth; }
+
+ int getParent() const { return parent; }
+ void setParent(int p_parent) { parent = p_parent; }
+
+ int getHidden() const { return hidden; }
+
+ void setHidden(bool p_hidden) {
+ IEdge* edge;
+ hidden = p_hidden;
+ for(IEdgeIterator edges = oedges.begin(); edges != oedges.end(); edges++) {
+ edge = (*edges).second;
+ edge->setHidden(p_hidden);
+ }
+ }
+
+ void setNodeHidden(bool p_hidden) {
+ hidden = p_hidden;
+ }
+
+ int getInterval() const { return interval; }
+ void setInterval(int p_interval) { interval = p_interval; }
+
+ unsigned long getFlags() const { return flags; }
+ void setFlags(unsigned long p_flags) { flags = p_flags; }
+
+ void add_edge(IEdge* p_edge) { oedges[p_edge->getKey()] = p_edge; }
+
+ void add_oedge(IEdge* p_edge) { oedges[p_edge->getKey()] = p_edge; }
+
+ void add_iedge(IEdge* p_edge) { iedges[p_edge->getKey()] = p_edge; }
+
+
+ int degree() { return (oedges.size() + iedges.size()); }
+ int out_degree() { return oedges.size(); }
+ int in_degree() { return iedges.size(); }
+
+ IEdgeIterator out_edges_begin() { return oedges.begin(); }
+ IEdgeIterator out_edges_end() { return oedges.end(); }
+
+ IEdgeIterator in_edges_begin() { return iedges.begin(); }
+ IEdgeIterator in_edges_end() { return iedges.begin(); }
+
+};
+
+#endif // #ifndef Node_HH
diff --git a/src/Graph/SubGraph.cc b/src/Graph/SubGraph.cc
new file mode 100644
index 0000000..7e938dc
--- /dev/null
+++ b/src/Graph/SubGraph.cc
@@ -0,0 +1,42 @@
+/*** includes ***/
+#include <iostream>
+#include "SubGraph.hh"
+
+using namespace HASHMAP;
+using namespace std;
+
+SubGraph::SubGraph(IGraph& p_parent, string p_name) : Graph(p_name), parent(p_parent) {
+ directed = parent.isDirected();
+}
+
+bool SubGraph::contains(INode* p_node) {
+ hash_map< int, INode* >::iterator n = nodes.find(p_node->getKey());
+ if(n != nodes.end()) {
+ return ! (p_node->getHidden());
+ } else {
+ return false;
+ }
+}
+
+bool SubGraph::contains(IEdge* p_edge) {
+ hash_map< int, IEdge* >::iterator e = edges.find(p_edge->getKey());
+ if(e != edges.end()) {
+ return ! (p_edge->getHidden());
+ } else {
+ return false;
+ }
+}
+
+void SubGraph::add_node(INode* p_node) {
+ nodes[p_node->getKey()] = p_node;
+}
+
+void SubGraph::add_edge(IEdge* p_edge) {
+ INode* target = p_edge->getTarget();
+ INode* source = p_edge->getSource();
+ edges[p_edge->getKey()] = p_edge;
+ nodes[source->getKey()] = source;
+ nodes[target->getKey()] = target;
+}
+
+
diff --git a/src/Graph/SubGraph.hh b/src/Graph/SubGraph.hh
new file mode 100644
index 0000000..bc5ebca
--- /dev/null
+++ b/src/Graph/SubGraph.hh
@@ -0,0 +1,54 @@
+#ifndef SubGraph_HH
+#define SubGraph_HH 1
+
+#include <iostream>
+#include <sstream>
+#include <list>
+#include "IGraph.hh"
+#include "Graph.hh"
+#include "Node.hh"
+#include "Edge.hh"
+
+class IEdge;
+class INode;
+
+class Edge;
+class Node;
+
+
+/**
+ * The <b>SubGraph</b> class
+ *
+ *
+ * <p>Copyright © 2004, The Institute for Genomic Research (TIGR).
+ * <br>All rights reserved.
+ *
+ * @author Dan Sommer
+ *
+ * <pre>
+ * $RCSfile$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * </pre>
+ */
+class SubGraph : public Graph {
+
+public:
+
+ IGraph& parent;
+
+ SubGraph(IGraph& p_parent, std::string name="noname");
+
+ virtual bool contains(IEdge* p_edge);
+ virtual bool contains(INode* p_node);
+
+ virtual void add_node(INode* p_node);
+
+ // adds nodes as well
+ virtual void add_edge(IEdge* p_edge);
+
+};
+
+
+#endif // #ifndef SubGraph_HH
diff --git a/src/Graph/Test.cc b/src/Graph/Test.cc
new file mode 100644
index 0000000..36accd3
--- /dev/null
+++ b/src/Graph/Test.cc
@@ -0,0 +1,138 @@
+#include "IGraph.hh"
+#include "Graph.hh"
+#include "SubGraph.hh"
+#include "CompositeNode.hh"
+
+
+using namespace std;
+
+// void testLinearGraph() {
+// Graph* g = genLinearGraph(200);
+// g->name = "easy200";
+// NodeIterator iter = g->nodes_begin();
+// Node* n1 = (*iter++);
+// Node* n2 = (*iter);
+// cout << " number of nodes " << g->num_nodes() << endl;
+// cout << " degree of node " << n1->getKey() << " is " << g->degree(n1) << endl;
+// cout << " degree of node " << n2->getKey() << " is " << g->degree(n2) << endl;
+
+// list< Edge* > edges = g->incident_edges(n1);
+// Edge *inc_edge;
+
+// cout << " edges and nodes adjacent to node " << n1->getKey() << endl;
+
+// for(EdgeIterator iter = edges.begin(); iter != edges.end(); ++iter) {
+// inc_edge = *iter;
+// cout << " edge incident is " << inc_edge->getKey() << endl;
+// Node *adj_node = g->opposite(n1, inc_edge);
+// cout << " degree of node " << adj_node->getKey() << " is " << g->degree(adj_node) << endl;
+// }
+
+
+// list< Node* > nodes = g->adjacent_nodes(n2);
+// cout << " nodes adjacent to node " << n2->getKey() << endl;
+
+// for(NodeIterator iter = nodes.begin(); iter != nodes.end(); ++iter) {
+// cout << " degree of node " << (*iter)->getKey() << " is " << g->degree((*iter)) << endl;
+// }
+
+// g->create_dot_file("test.dot");
+// }
+
+
+// void testGraph() {
+// Graph g("Test_Graph");
+
+// Node* n1 = g.new_node();
+// Node* n2 = g.new_node();
+// Edge* e1 = g.new_edge(n2, n1);
+// Node* n3 = g.new_node();
+// Edge* e2 = g.new_edge(n3, n2);
+// Edge* e3 = g.new_edge(n1, n3);
+
+// cout << " number of nodes " << g.num_nodes() << endl;
+// cout << " degree of node " << n1->getKey() << " is " << g.degree(n1) << endl;
+// cout << " degree of node " << n2->getKey() << " is " << g.degree(n2) << endl;
+
+// list< Edge* > edges = g.incident_edges(n1);
+// Edge *inc_edge;
+
+// cout << " edges and nodes adjacent to node " << n1->getKey() << endl;
+
+// for(EdgeIterator iter = edges.begin(); iter != edges.end(); ++iter) {
+// inc_edge = *iter;
+// cout << " edge incident is " << inc_edge->getKey() << endl;
+// Node *adj_node = g.opposite(n1, inc_edge);
+// cout << " degree of node " << adj_node->getKey() << " is " << g.degree(adj_node) << endl;
+// }
+
+
+// list< Node* > nodes = g.adjacent_nodes(n2);
+// cout << " nodes adjacent to node " << n2->getKey() << endl;
+
+// for(NodeIterator iter = nodes.begin(); iter != nodes.end(); ++iter) {
+// cout << " degree of node " << (*iter)->getKey() << " is " << g.degree((*iter)) << endl;
+// }
+
+// g.create_dot_file("test.dot");
+
+// }
+
+
+/**
+ * genLinearGraph - generate a graph that is a linklist
+ * Example : 1 -> 2 -> 3 -> ...
+ */
+Graph* genLinearGraph(int p_size) {
+ Graph* g = new Graph();
+ int *c;
+ INode *n1;
+ INode *n2;
+
+ for(int i = 0; i < p_size; i++) {
+ c = new int();
+ *c = i;
+
+ n1 = g->new_node(i, (void*)c);
+
+ if(i != 0) {
+ g->new_edge(n2, n1);
+ }
+ n2 = n1;
+ }
+
+ cout << " # Nodes " << g->num_nodes() << endl;
+ cout << " # Edges " << g->num_edges() << endl;
+
+ SubGraph* sg = new SubGraph(*g);
+
+
+
+ sg->add_edge(g->get_edge(2));
+ sg->add_edge(g->get_edge(8));
+ sg->add_node(g->get_node(7));
+
+ cout << " # Nodes " << sg->num_nodes() << endl;
+ cout << " # Edges " << sg->num_edges() << endl;
+
+ sg->create_dot_file("subgraph.dot");
+ g->create_dot_file("graph.dot");
+
+ return (Graph*) sg;
+}
+/*
+void testCompositeNode(Graph* g) {
+ void* nothing;
+ // CompositeNode cn(nothing);
+
+ INode* n = g->aNode();
+ IEdge* e = *(g->incident_edges(n).begin());
+ CompositeNode* cn = g->reduce(e);
+
+ cout << " Composite Node key is " << cn->getKey() << endl;
+}
+*/
+int main() {
+ Graph* g = genLinearGraph(12);
+ // testCompositeNode(g);
+}
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..2b12816
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,77 @@
+##-- SUBDIRS TO RECURSE
+SUBDIRS =
+
+if BUILD_all
+SUBDIRS += \
+ GNU \
+ AMOS \
+ Common \
+ Foundation \
+ Graph \
+ Slice \
+ CelMsg \
+ Message \
+ Bank \
+ Align \
+ Tigger \
+ Compare \
+ Bambus \
+ Casm \
+ CtgTrim \
+ Sim \
+ Staden \
+ Contig \
+ Validation \
+ Converters \
+ Utils \
+ PerlModules \
+ PythonModules \
+ Pipeline
+
+if BUILD_QT4
+SUBDIRS += hawkeye
+endif BUILD_QT4
+
+if BUILD_Experimental
+SUBDIRS += Experimental
+endif BUILD_Experimental
+
+endif BUILD_all
+
+if BUILD_AMOScmp
+SUBDIRS += \
+ GNU \
+ AMOS \
+ Common \
+ Slice \
+ CelMsg \
+ Message \
+ Bank \
+ Align \
+ Casm \
+ Converters \
+ Utils \
+ PerlModules \
+ Pipeline
+endif BUILD_AMOScmp
+
+if BUILD_minimus
+SUBDIRS += \
+ GNU \
+ AMOS \
+ Common \
+ Graph \
+ Slice \
+ CelMsg \
+ Message \
+ Bank \
+ Align \
+ Tigger \
+ Converters \
+ Utils \
+ PerlModules \
+ Pipeline
+endif BUILD_minimus
+
+
+##-- END OF MAKEFILE --##
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..0fb243b
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,626 @@
+# 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 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@
+ at BUILD_all_TRUE@am__append_1 = \
+ at BUILD_all_TRUE@ GNU \
+ at BUILD_all_TRUE@ AMOS \
+ at BUILD_all_TRUE@ Common \
+ at BUILD_all_TRUE@ Foundation \
+ at BUILD_all_TRUE@ Graph \
+ at BUILD_all_TRUE@ Slice \
+ at BUILD_all_TRUE@ CelMsg \
+ at BUILD_all_TRUE@ Message \
+ at BUILD_all_TRUE@ Bank \
+ at BUILD_all_TRUE@ Align \
+ at BUILD_all_TRUE@ Tigger \
+ at BUILD_all_TRUE@ Compare \
+ at BUILD_all_TRUE@ Bambus \
+ at BUILD_all_TRUE@ Casm \
+ at BUILD_all_TRUE@ CtgTrim \
+ at BUILD_all_TRUE@ Sim \
+ at BUILD_all_TRUE@ Staden \
+ at BUILD_all_TRUE@ Contig \
+ at BUILD_all_TRUE@ Validation \
+ at BUILD_all_TRUE@ Converters \
+ at BUILD_all_TRUE@ Utils \
+ at BUILD_all_TRUE@ PerlModules \
+ at BUILD_all_TRUE@ PythonModules \
+ at BUILD_all_TRUE@ Pipeline
+
+ at BUILD_QT4_TRUE@@BUILD_all_TRUE at am__append_2 = hawkeye
+ at BUILD_Experimental_TRUE@@BUILD_all_TRUE at am__append_3 = Experimental
+ at BUILD_AMOScmp_TRUE@am__append_4 = \
+ at BUILD_AMOScmp_TRUE@ GNU \
+ at BUILD_AMOScmp_TRUE@ AMOS \
+ at BUILD_AMOScmp_TRUE@ Common \
+ at BUILD_AMOScmp_TRUE@ Slice \
+ at BUILD_AMOScmp_TRUE@ CelMsg \
+ at BUILD_AMOScmp_TRUE@ Message \
+ at BUILD_AMOScmp_TRUE@ Bank \
+ at BUILD_AMOScmp_TRUE@ Align \
+ at BUILD_AMOScmp_TRUE@ Casm \
+ at BUILD_AMOScmp_TRUE@ Converters \
+ at BUILD_AMOScmp_TRUE@ Utils \
+ at BUILD_AMOScmp_TRUE@ PerlModules \
+ at BUILD_AMOScmp_TRUE@ Pipeline
+
+ at BUILD_minimus_TRUE@am__append_5 = \
+ at BUILD_minimus_TRUE@ GNU \
+ at BUILD_minimus_TRUE@ AMOS \
+ at BUILD_minimus_TRUE@ Common \
+ at BUILD_minimus_TRUE@ Graph \
+ at BUILD_minimus_TRUE@ Slice \
+ at BUILD_minimus_TRUE@ CelMsg \
+ at BUILD_minimus_TRUE@ Message \
+ at BUILD_minimus_TRUE@ Bank \
+ at BUILD_minimus_TRUE@ Align \
+ at BUILD_minimus_TRUE@ Tigger \
+ at BUILD_minimus_TRUE@ Converters \
+ at BUILD_minimus_TRUE@ Utils \
+ at BUILD_minimus_TRUE@ PerlModules \
+ at BUILD_minimus_TRUE@ Pipeline
+
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = GNU AMOS Common Foundation Graph Slice CelMsg Message \
+ Bank Align Tigger Compare Bambus Casm CtgTrim Sim Staden \
+ Contig Validation Converters Utils PerlModules PythonModules \
+ Pipeline hawkeye Experimental
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUBDIRS = $(am__append_1) $(am__append_2) $(am__append_3) \
+ $(am__append_4) $(am__append_5)
+all: all-recursive
+
+.SUFFIXES:
+$(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) --foreign src/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/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):
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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: ctags-recursive $(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
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(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:
+
+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-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.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 ctags \
+ ctags-recursive distclean distclean-generic 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 \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
+ tags-recursive 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.
+.NOEXPORT:
diff --git a/src/Message/Makefile.am b/src/Message/Makefile.am
new file mode 100644
index 0000000..9177cf6
--- /dev/null
+++ b/src/Message/Makefile.am
@@ -0,0 +1,38 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+##-- TO BE INSTALLED
+bin_PROGRAMS = \
+ message-count \
+ message-extract \
+ message-validate
+
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS
+
+
+##-- message-count
+message_count_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+message_count_SOURCES = \
+ message-count.cc
+
+##-- message-extract
+message_extract_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+message_extract_SOURCES = \
+ message-extract.cc
+
+##-- message-validate
+message_validate_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+message_validate_SOURCES = \
+ message-validate.cc
+
+
+##-- END OF MAKEFILE --##
\ No newline at end of file
diff --git a/src/Message/Makefile.in b/src/Message/Makefile.in
new file mode 100644
index 0000000..10d4784
--- /dev/null
+++ b/src/Message/Makefile.in
@@ -0,0 +1,596 @@
+# 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 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@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = message-count$(EXEEXT) message-extract$(EXEEXT) \
+ message-validate$(EXEEXT)
+subdir = src/Message
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_message_count_OBJECTS = message-count.$(OBJEXT)
+message_count_OBJECTS = $(am_message_count_OBJECTS)
+message_count_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a
+am_message_extract_OBJECTS = message-extract.$(OBJEXT)
+message_extract_OBJECTS = $(am_message_extract_OBJECTS)
+message_extract_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_message_validate_OBJECTS = message-validate.$(OBJEXT)
+message_validate_OBJECTS = $(am_message_validate_OBJECTS)
+message_validate_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(message_count_SOURCES) $(message_extract_SOURCES) \
+ $(message_validate_SOURCES)
+DIST_SOURCES = $(message_count_SOURCES) $(message_extract_SOURCES) \
+ $(message_validate_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS
+
+message_count_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+message_count_SOURCES = \
+ message-count.cc
+
+message_extract_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+message_extract_SOURCES = \
+ message-extract.cc
+
+message_validate_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+message_validate_SOURCES = \
+ message-validate.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Message/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Message/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):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+message-count$(EXEEXT): $(message_count_OBJECTS) $(message_count_DEPENDENCIES)
+ @rm -f message-count$(EXEEXT)
+ $(CXXLINK) $(message_count_OBJECTS) $(message_count_LDADD) $(LIBS)
+message-extract$(EXEEXT): $(message_extract_OBJECTS) $(message_extract_DEPENDENCIES)
+ @rm -f message-extract$(EXEEXT)
+ $(CXXLINK) $(message_extract_OBJECTS) $(message_extract_LDADD) $(LIBS)
+message-validate$(EXEEXT): $(message_validate_OBJECTS) $(message_validate_DEPENDENCIES)
+ @rm -f message-validate$(EXEEXT)
+ $(CXXLINK) $(message_validate_OBJECTS) $(message_validate_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/message-count.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/message-extract.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/message-validate.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+
+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 $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-binPROGRAMS clean-generic 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-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ 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-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Message/message-count.cc b/src/Message/message-count.cc
new file mode 100644
index 0000000..073955e
--- /dev/null
+++ b/src/Message/message-count.cc
@@ -0,0 +1,187 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 02/20/2004
+//!
+//! \brief Reads an AMOS message and displays summary information
+//!
+//! message-count reads an AMOS message and displays the number of each top-
+//! level message, along with their total and average sizes.
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "messages_AMOS.hh"
+#include <string>
+#include <fstream>
+#include <cstdio>
+#include <unistd.h>
+using namespace std;
+using namespace AMOS;
+using namespace HASHMAP;
+
+
+//=============================================================== Globals ====//
+string OPT_MessageName; // message name parameter
+
+struct LongPair_t
+{
+ long int first, second;
+ LongPair_t( ) { first = second = 0; }
+};
+
+//========================================================== Fuction Decs ====//
+long int SafeIntDiv (long int a, long int b)
+{ return (long int)(b == 0 ? 0 : (double)a / (double)b); }
+
+
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ ifstream msgfile; // the message file, if applicable
+ Message_t msg; // the current message
+ NCode_t msgcode = NULL_NCODE; // current message NCode
+ streampos lastpos; // last tellg pos
+ hash_map<NCode_t, LongPair_t> sums; // message count and size sums
+ long int c1, c2;
+
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ //-- Open the message file
+ msgfile . open (OPT_MessageName . c_str( ));
+ if ( !msgfile )
+ AMOS_THROW_IO ("Could not open message file " + OPT_MessageName);
+ lastpos = msgfile . tellg( );
+
+ //-- Parse the message file
+ while ( (msgcode = msg . skip (msgfile)) != NULL_NCODE )
+ {
+ sums [msgcode] . first ++;
+ sums [msgcode] . second += msgfile . tellg( ) - lastpos;
+ lastpos = msgfile . tellg( );
+ }
+ }
+ catch (Exception_t & e) {
+
+ //-- On error, print debugging information
+ cerr << "Last message: " << Decode (msgcode) << " iid:";
+ if ( msg . exists (F_IID) )
+ cerr << msg . getField (F_IID);
+ cerr << "\nERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+ msgfile . close( );
+
+ printf ("%5s %9s %12s %12s\n", "NCODE", "COUNT", "SIZE", "AVG");
+ printf ("-----------------------------------------\n");
+ c1 = c2 = 0;
+ hash_map<NCode_t, LongPair_t>::iterator mi;
+ for ( mi = sums . begin( ); mi != sums . end( ); mi ++ )
+ {
+ printf ("%5s %9ld %12ld %12ld\n",
+ Decode (mi -> first) . c_str( ),
+ mi -> second . first,
+ mi -> second . second,
+ SafeIntDiv (mi -> second . second, mi -> second . first));
+ c1 += mi -> second . first;
+ c2 += mi -> second . second;
+ }
+ printf ("-----------------------------------------\n");
+ printf (" %9ld %12ld %12ld\n",
+ (long int)c1, (long int)c2, SafeIntDiv (c2, c1));
+
+ return EXIT_SUCCESS;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "h")) != EOF) )
+ switch (ch)
+ {
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+ default:
+ errflg ++;
+ }
+
+ if ( errflg > 0 || optind != argc - 1 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_MessageName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "-h Display help information\n"
+ << endl;
+
+ cerr
+ << "Takes an AMOS message file as input on the command line. Number of\n"
+ << "each top-level message type will be displayed, along with their total\n"
+ << "and average sizes. All messages must have balanced braces and valid\n"
+ << "headers, however their fields will not be checked for correctness.\n"
+ << endl;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr
+ << "\nUSAGE: " << s << " [options] [message path]\n"
+ << endl;
+}
diff --git a/src/Message/message-extract.cc b/src/Message/message-extract.cc
new file mode 100644
index 0000000..fc6208b
--- /dev/null
+++ b/src/Message/message-extract.cc
@@ -0,0 +1,191 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 02/25/2004
+//!
+//! \brief Reads an AMOS message and extracts the requested message types
+//!
+//! message-extract reads an AMOS message and extracts the requested top-level
+//! message types to stdout.
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "messages_AMOS.hh"
+#include "utility_AMOS.hh"
+#include <set>
+#include <fstream>
+#include <unistd.h>
+using namespace AMOS;
+using namespace std;
+
+
+//=============================================================== Globals ====//
+bool OPT_Invert = false; // invert match
+string OPT_MessageName; // message name parameter
+set<NCode_t> OPT_ExtractCodes; // extract message type set
+
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ Message_t msg; // the current message
+ ifstream msgfile; // the message file, if applicable
+ NCode_t msgcode; // current message NCode
+ streampos spos; // begin of the curr record
+ char * buff = NULL; // record buffer
+ streamsize size; // size of curr record
+ streamsize buff_size = 0; // size of curr record buffer
+ set<NCode_t>::iterator endcode; // end of the NCode set
+
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ //-- Open the message file
+ msgfile . open (OPT_MessageName . c_str( ));
+ if ( !msgfile )
+ AMOS_THROW_IO ("Could not open message file " + OPT_MessageName);
+ spos = msgfile . tellg( );
+
+ //-- Parse the message file
+ endcode = OPT_ExtractCodes . end( );
+ while ( (msgcode = msg . skip (msgfile)) != NULL_NCODE )
+ {
+ if ( (OPT_Invert ?
+ OPT_ExtractCodes . find (msgcode) == endcode :
+ OPT_ExtractCodes . find (msgcode) != endcode) )
+ {
+ size = msgfile . tellg( ) - spos;
+ if ( size > buff_size )
+ {
+ buff_size = size << 2;
+ buff = (char *) SafeRealloc (buff, buff_size);
+ }
+ msgfile . seekg (-size, ifstream::cur);
+ msgfile . read (buff, size);
+ cout . write (buff, size);
+ }
+ spos = msgfile . tellg( );
+ }
+ }
+ catch (Exception_t & e) {
+
+ //-- On error, print debugging information
+ cerr << "Last message: " << Decode (msgcode) << " iid:";
+ if ( msg . exists (F_IID) )
+ cerr << msg . getField (F_IID);
+ cerr << "\nERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+ msgfile . close( );
+
+ return EXIT_SUCCESS;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hm:v")) != EOF) )
+ switch (ch)
+ {
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+ case 'm':
+ OPT_MessageName = optarg;
+ break;
+ case 'v':
+ OPT_Invert = true;
+ break;
+ default:
+ errflg ++;
+ }
+
+ if ( OPT_MessageName . empty( ) )
+ {
+ cerr << "ERROR: The -m option is mandatory\n";
+ errflg ++;
+ }
+
+ if ( errflg > 0 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ while ( optind != argc )
+ OPT_ExtractCodes . insert (Encode (argv [optind ++]));
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "-h Display help information\n"
+ << "-m path The file path of the input message\n"
+ << "-v Invert match. Filter instead of extract given NCodes\n"
+ << endl;
+
+ cerr
+ << "Takes an AMOS message file and AMOS NCodes as input. All top-level\n"
+ << "messages matching one of the specified NCodes will be extracted and\n"
+ << "reported to stdout. All messages must have balanced braces and valid\n"
+ << "headers, however their fields will not be checked for correctness.\n"
+ << endl;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr
+ << "\nUSAGE: " << s << " [options] -m <message path> [NCodes]\n"
+ << endl;
+}
diff --git a/src/Message/message-validate.cc b/src/Message/message-validate.cc
new file mode 100644
index 0000000..588c8f7
--- /dev/null
+++ b/src/Message/message-validate.cc
@@ -0,0 +1,146 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 05/13/2004
+//!
+//! \brief Validates the format of an AMOS message.
+//!
+//! message-validate reads an AMOS message and returns 0 if the AMOS message
+//! parsed successfully or non-zero otherwise. Does not validate links.
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "messages_AMOS.hh"
+#include <string>
+#include <fstream>
+#include <unistd.h>
+using namespace AMOS;
+using namespace std;
+
+
+//=============================================================== Globals ====//
+string OPT_MessageName; // message name parameter
+
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ Message_t msg; // the current message
+ ifstream msgfile; // the message file, if applicable
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ //-- Open the message file
+ msgfile . open (OPT_MessageName . c_str( ));
+ if ( !msgfile )
+ AMOS_THROW_IO ("Could not open message file " + OPT_MessageName);
+
+ //-- Parse the message file
+ while ( msgfile . good( ) )
+ msg . read (msgfile);
+ }
+ catch (Exception_t & e) {
+
+ //-- On error, print debugging information
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ cout << "FAILURE\n";
+ return EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+ msgfile . close( );
+
+ cout << "SUCCESS\n";
+ return EXIT_SUCCESS;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "h")) != EOF) )
+ switch (ch)
+ {
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+ default:
+ errflg ++;
+ }
+
+ if ( errflg > 0 || optind != argc - 1 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_MessageName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "-h Display help information\n"
+ << endl;
+
+ cerr
+ << "Takes an AMOS message file as input on the command line. Validates\n"
+ << "the format of the AMOS message and returns 0 if the message parsed\n"
+ << "successfully, else returns non-zero and prints a description of the\n"
+ << "failure to stderr. Links are not validated.\n"
+ << endl;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr
+ << "\nUSAGE: " << s << " [options] [message path]\n"
+ << endl;
+}
diff --git a/src/PerlModules/AmosFoundation.pm b/src/PerlModules/AmosFoundation.pm
new file mode 100644
index 0000000..66743f0
--- /dev/null
+++ b/src/PerlModules/AmosFoundation.pm
@@ -0,0 +1,375 @@
+# $Id$
+#
+
+=head1 NAME
+
+AMOS::Foundation - A library of perl routines for handling command line
+parameters and logging in a uniform fashion.
+
+=head1 SYNOPSIS
+
+use AMOS::Foundation;
+
+$base = new AMOS::Foundation;
+
+=head1 DESCRIPTION
+
+AMOS::Foundation provides a set of routines useful in handling command
+line parameters and logging. These routines are meant to provide a uniform
+house-keeping mechanism for AMOS related Perl scripts.
+
+=cut
+
+package AMOS::AmosFoundation;
+
+use strict;
+use Getopt::Long;
+use POSIX;
+use IO::File;
+
+## configuration management
+our $VERSION = "1.00";
+our $VERSION_STRING = "$VERSION (Build " . (qw/$Revision$/ )[1] . ")";
+our @DEPEND = ();
+
+BEGIN {
+ use Exporter ();
+ use vars qw(@EXPORT @EXPORT_OK @ISA %EXPORT_TAGS);
+
+ require 5.006_00; # error if using Perl < v5.6.0
+
+ @ISA = qw(Exporter);
+ @EXPORT = qw(&getOptions
+ &setHelpText
+ &setUsage
+ &setVersion
+ &getVersion
+ &setLogFile
+ &setLogLevel
+ &getHelpText
+ &getUsage
+ &getLogFile
+ &getLogLevel
+ &log
+ &bail
+ &new
+ &setMihaiMode
+ $VERSION
+ $VERSION_STRING
+ @DEPEND);
+
+ %EXPORT_TAGS = ();
+ @EXPORT_OK = ();
+}
+
+use vars @EXPORT;
+use vars @EXPORT_OK;
+
+
+##############################################
+
+=over
+
+=item B<$base = new AMOS::Foundation; >
+
+Creates a new AMOS::Foundation object.
+
+=cut
+sub new
+{
+ my $self = {};
+ my $pkg = shift;
+
+ # create the object
+ bless $self, $pkg;
+
+ $self->{"helpText"} = "";
+ $self->{"Usage"} = "";
+ $self->{"logLevel"} = 0;
+ $self->{"logFile"} = "";
+ $self->{"logStream"} = new IO::File;
+ $self->{"logStream"}->open(">&STDERR") || die ("Cannot open STDERR: $!\n");
+
+ return $self;
+}
+
+
+=item B<$base->setHelpText("this is some help info");>
+
+Assigns the default text output when program is run with option -h or -help.
+
+=cut
+
+sub setHelpText
+{
+ my $self = shift;
+ if (@_) {
+ $self->{'helpText'} = shift;
+ }
+
+ return $self->{'helpText'};
+}# setHelpText
+
+=item B<$help = $base->getHelpText(); >
+
+Returns the default text output when program is run with option -h or -help.
+
+=cut
+
+sub getHelpText
+{
+ my $self = shift;
+
+ return $self->{'helpText'};
+}# getHelpText
+
+=item B<$base->setUsage("this is some help info"); >
+
+Assigns the default text output when program is run with incorrect parameters.
+
+=cut
+
+sub setUsage
+{
+ my $self = shift;
+ if (@_) {
+ $self->{'Usage'} = shift;
+ }
+
+ return $self->{'Usage'};
+}# setUsage
+
+=item B<$usage = $base->getUsageText(); >
+
+Returns the default text output when program is run with incorrect parameters.
+
+=cut
+
+sub getUsage
+{
+ my $self = shift;
+
+ return $self->{'Usage'};
+}# getUsage
+
+
+
+=item B<$base->setLogFile("file.log"); >
+
+Assigns the default location for the log file. Log messages will be appended
+to this file.
+
+=cut
+
+sub setLogFile
+{
+ my $self = shift;
+
+ if ($self->{'logFile'} ne "" && exists $self->{'logStream'}){
+ $self->{'logStream'}->close; # close any previously opened file
+ }
+
+ if (@_) {
+ $self->{'logFile'} = shift;
+ }
+
+ $self->{'logStream'}->open(">$self->{'logFile'}") ||
+ die ("Cannot open $self->{'logFile'}: $!\n");
+
+ return $self->{'logFile'};
+}# setLogFile
+
+=item B<$logfile = $base->getLogFile(); >
+
+Retrieves location of the log file.
+
+=cut
+
+sub getLogFile
+{
+ my $self = shift;
+
+ return $self->{'logFile'};
+}# getLogfile
+
+=item B<$base->setVersion("version"); >
+
+Assigns the version to be returned when program called with -V option.
+
+=cut
+
+sub setVersion
+{
+ my $self = shift;
+
+ if (@_) {
+ $self->{'Version'} = shift;
+ }
+
+ return $self->{'Version'};
+}# setVersion
+
+=item B<$version = $base->getVersion(); >
+
+Retrieves program version.
+
+=cut
+
+sub getVersion
+{
+ my $self = shift;
+
+ return $self->{'Version'};
+}# getVersion
+
+=item B<$base->setLogLevel(2); >
+
+Assigns the default log level. Only messages at this level or lower will
+be output.
+
+=cut
+
+sub setLogLevel
+{
+ my $self = shift;
+ if (@_) {
+ $self->{'logLevel'} = shift;
+ }
+
+ return $self->{'logLevel'};
+}# setLogLevel
+
+=item B<$logLevel = $base->getLogLevel(); >
+
+Retrieves the current log level.
+
+=cut
+
+sub getLogLevel
+{
+ my $self = shift;
+
+ return $self->{'logLevel'};
+}# getLogLevel
+
+=item B<$base->bail("message");>
+
+Gracefully exit
+
+=cut
+
+sub bail
+{
+ my $self = shift;
+ my $msg = shift; # message to be sent to screen
+
+ $self->log("ERROR: $msg", 0);
+
+ if ($self->{'logFile'} ne ""){
+ $self->{'logStream'}->close;
+ }
+
+ die();
+}# die
+
+=item B<$base->log("message", 5); >
+
+Log a message to the log file if the default log level is above 5.
+
+=cut
+
+sub log
+{
+ my $self = shift;
+ my $message = shift;
+ my $level = shift;
+
+ $level = 1 if (! defined $level);
+
+ if ($self->{'logLevel'} < $level) {
+ return; # only log at the appropriate level
+ }
+
+ my $date = strftime "%F %T| ", localtime;
+
+ $self->{'logStream'}->print($date . $message . "\n");
+
+ if ( defined $self->{'MihaiMode'} ) {
+ print STDERR ($date . $message . "\n");
+ }
+}# die
+
+
+=item B<$err = $base->getOptions("i=s" => \$in); >
+
+Interface to Getopt::Long that provides special processing to -h, -V, -verbose.
+
+=cut
+
+sub getOptions
+{
+ my $self = shift;
+ my @user_options = @_;
+ my $logfile;
+ my $verbose;
+ my $version;
+ my $help;
+ my @AMOS_options = (
+ "logfile=s" => \$logfile,
+ "verbose=i" => \$verbose,
+ "version|V" => \$version,
+ "help|h" => \$help,
+ );
+
+ Getopt::Long::Configure('no_ignore_case');
+ my $getopt_code = eval 'GetOptions (@user_options, @AMOS_options)';
+
+ # In case of failure output usage
+ if (! $getopt_code){
+ print STDERR $self->{'Usage'}, "\n";
+ exit(1);
+ }
+
+ if (defined $help){
+ print $self->{'helpText'}, "\n";
+ exit(0);
+ }
+
+ if (defined $version){
+ print $self->{'Version'}, "\n";
+ exit(0);
+ }
+
+ if (defined $verbose){
+ $self->{'logLevel'} = $verbose;
+ }
+
+ if (defined $logfile){
+ $self->{'logStream'}->close;
+ $self->{'logFile'} = $logfile;
+ $self->{'logStream'}->open(">$logfile") ||
+ die ("Cannot open $logfile: $!\n");
+ }
+
+ return $getopt_code;
+}
+
+=item B<$base->setMihaiMode(); >
+
+Display log messages on stderr.
+
+=cut
+
+sub setMihaiMode
+{
+ my $self = shift;
+ $self->{'MihaiMode'} = 1;
+}
+
+=back
+
+=cut
+
+END{}
+
+1;
diff --git a/src/PerlModules/AmosLib.pm b/src/PerlModules/AmosLib.pm
new file mode 100644
index 0000000..0010e91
--- /dev/null
+++ b/src/PerlModules/AmosLib.pm
@@ -0,0 +1,460 @@
+# $Id$
+#
+# File: AmosLib.pm
+# Authors: Mihai Pop
+#
+# Copyright @ 2002, The Institute for Genomic Research (TIGR).
+#
+# Routines that help processing Fasta, Amos, and Celera message files.
+#
+
+=head1 NAME
+
+AmosLib - A library of perl routines for processing AMOS and Celera message
+files and TIGR .contig, .seq, and .qual files.
+
+=head1 SYNOPSIS
+
+use AmosLib;
+
+=head1 DESCRIPTION
+
+A set of functions that help the processing of AMOS and Celera message files
+and Fasta files as well as the creation of TIGR .asm and .contig files.
+
+=cut
+
+package AMOS::AmosLib;
+
+use strict;
+
+## configuration management
+our $VERSION = "1.00";
+our $VERSION_STRING = "$VERSION (Build " . (qw/$Revision$/ )[1] . ")";
+our @DEPEND = ();
+
+BEGIN {
+ use Exporter ();
+ use vars qw(@EXPORT @EXPORT_OK @ISA %EXPORT_TAGS);
+
+ @ISA = qw(Exporter);
+ @EXPORT = qw(&getRecord
+ &parseRecord
+ &getCAId
+ &printContigRecord
+ &printSequenceRecord
+ &printFastaSequence
+ &printFastaQual
+ &reverseComplement
+ $VERSION
+ $VERSION_STRING
+ @DEPEND);
+ %EXPORT_TAGS = ();
+ @EXPORT_OK = ();
+}
+
+use vars @EXPORT;
+use vars @EXPORT_OK;
+
+
+##############################################
+
+=over
+
+=item B<my $rec = getRecord(\*STDIN);>
+
+Reads from stdin the text between "extreme" { and } .
+
+ for example:
+
+ {A
+ {B
+ }
+ }
+
+Returns the whole: {A{B}}
+
+=cut
+
+sub getRecord
+{
+ my $file = shift;
+
+ my $level = 0;
+ my $block = "";
+
+ while (<$file>){
+ if (/^\s*\{/){
+ $level++;
+ }
+ if (/^\s*\}/){
+ $level--;
+ }
+ $block .= $_;
+ if ($level == 0){
+ last;
+ }
+ }
+
+ if ($level != 0){
+ die ("end of file reached before end of block\n");
+ }
+
+ if ($block ne ""){
+ return $block;
+ } else {
+ return undef;
+ }
+}# getRecord
+
+sub print_sequence
+{
+ my $file = shift;
+ my $seqs = shift;
+
+ for (my $j = 0; $j < length($seqs); $j += 60){
+ print $file substr($seqs, $j, 60), "\n";
+ }
+}
+
+
+######################################################3
+
+=item B<my($id, $fields, $recs) = parseRecord($rec);>
+
+Parses a record and returns a triplet consisting of
+ - record type
+ - hash of fields and values
+ - array of sub-records
+
+=cut
+
+sub parseRecord
+{
+ my $record = shift;
+
+ my @lines = split('\n', $record);
+
+ my $type;
+ my %fields;
+ my @recs;
+
+ # get record type
+ $lines[0] =~ /\{(\w+)/;
+ if (! defined $1){
+ die ("Weird start of record: $record\n");
+ }
+ $type = $1;
+
+ if ($lines[$#lines] !~ /^\s*\}/){
+ die ("Weird end of record: $record\n");
+ }
+
+ my $level = 0;
+ my $fieldname;
+ for (my $i = 1; $i < $#lines; $i++){
+ if ($lines[$i] =~ /^(\w+):(.+)$/){ # simple field
+ $fields{$1} = $2;
+ } # simple field
+ if ($lines[$i] =~ /^(\w+):$/){ # complex field
+ $fieldname = $1;
+ $fields{$fieldname} = "";
+ $i++;
+ while ($i < $#lines && ($lines[$i] !~ /^\.$/)){
+ $fields{$fieldname} .= "$lines[$i]\n";
+ $i++;
+ }
+ } # complex field
+ if ($lines[$i] =~ /^\s*\{/){ # subrecord
+ my $level = 1;
+
+ my $thisrec = ++$#recs;
+
+ $recs[$thisrec] .= "$lines[$i]\n";
+ $i++;
+ while ($level > 0 && $i < $#lines){
+ if ($lines[$i] =~ /^\s*\{/){
+ $level++;
+ }
+ if ($lines[$i] =~ /^\s*\}/){
+ $level--;
+ }
+ $recs[$thisrec] .= "$lines[$i]\n";
+ if ($level == 0){
+ last;
+ } else {
+ $i++;
+ }
+ }
+ if ($level != 0){
+ die ("Error parsing sub_record in: $record\n");
+ }
+ } # subrecord
+ } # for $i...
+
+ return ($type, \%fields, \@recs);
+} # parseRecord
+
+################################################
+
+=item B<my($id) = getCAId($CAid);>
+
+Obtains the ID from a "paired" id, that is, converts (10, 1000) into 10.
+If the Id is not a pair in parantheses, it returns the input.
+Thus, getCAId('(10, 1000)') returns 10 while getCAId("abba") returns "abba".
+
+=cut
+
+sub getCAId
+{
+ my $string = shift;
+
+ if ($string =~ /\((\d+),(\d+)\)/){
+ return $1;
+ } else {
+ return $string; # just in case we have a real ID
+ }
+} # getCAId
+
+################################################
+
+=item B<printContigRecord($file, $id, $len, $nseq, $sequence, $how);>
+
+Prints contig in specified format
+Inputs are:
+ $file - output file (opened for writing)
+ $id - contig ID
+ $len - contig length
+ $nseq - number of sequences in contig (same as number of sequence records
+that will follow the contig
+ $sequence - consensus sequence for the contig
+ $how - what type of output is required:
+ contig - TIGR .contig format
+ asm - TIGR .asm format
+ fasta - multi-fasta format
+
+=cut
+
+sub printContigRecord
+{
+ my $file = shift;
+ my $id = shift;
+ my $len = shift;
+ my $nseq = shift;
+ my $sequence = shift;
+ my $how = shift;
+
+ if ($how eq "contig"){
+ print $file "\#\#$id $nseq $len bases, 00000000 checksum.\n";
+ print_sequence($file, $sequence);
+ return;
+ } # if $how eq "contig"
+ elsif ($how eq "asm"){
+ my $strip = $sequence;
+ $strip =~ s/-//g;
+# get the current date
+ my $date = `date +'%D %T'`;
+ chomp $date;
+
+ my $quality = "0x";
+ for (my $i = 0; $i < length($sequence); $i++){
+ $quality .= "06";
+ }
+
+ print $file "sequence\t$strip\n";
+ print $file "lsequence\t$sequence\n";
+ print $file "quality\t$quality\n";
+ print $file "asmbl_id\t$id\n";
+ print $file "seq_id\t\n";
+ print $file "com_name\t\n";
+ print $file "type\t\n";
+ print $file "method\tCelera Assembler\n";
+ print $file "ed_status\t\n";
+ print $file "redundancy\t\n";
+ print $file "perc_N\t\n";
+ print $file "seq\#\t$nseq\n";
+ print $file "full_cds\t\n";
+ print $file "cds_start\t\n";
+ print $file "cds_end\t\n";
+ print $file "ed_pn\t$ENV{USER}\@$ENV{HOSTNAME}\n";
+ print $file "ed_date\t$date\n";
+ print $file "comment\t\n";
+ print $file "frameshift\t\n";
+ return;
+ } # if $how eq "asm"
+ elsif ($how eq "fasta")
+ {
+ print $file ">$id $nseq $len bases\n";
+ print_sequence($file, $sequence);
+ return;
+ }
+} # printContigRecord
+
+################################################
+
+=item B<printSequenceRecord($file, $name, $seq, $offset, $rc, $seqleft, $seqright, $asml, $asmr, $type);>
+
+Prints the record for a sequence aligned to a contig
+Inputs are:
+ $file - output file opened for writing
+ $name - sequence name
+ $seq - actual sequence
+ $offset - offset in consensus
+ $rc - "RC" if sequence is reverse complemented, "" otherwise
+ $seqleft, $seqright - alignment range within sequence
+ $asml, $asmr - alignment range within consensus
+ $type - type of output:
+ contig - output is in TIGR .contig format
+ asm - output is in TIGR .asm format
+
+=cut
+
+sub printSequenceRecord
+{
+ my($file, $name, $seq, $offset, $rc,
+ $seqleft, $seqright, $asml, $asmr, $type) = @_;
+
+ if ($type eq "contig"){
+ print $file "\#$name($offset) [$rc] ",
+ length($seq),
+ " bases, 00000000 checksum. {$seqleft $seqright} <$asml $asmr>\n";
+
+ print_sequence($file, $seq);
+ }
+
+ if ($type eq "asm"){
+ print $file "\n";
+ print $file "seq_name\t$name\n";
+ print $file "asm_lend\t$asml\n";
+ print $file "asm_rend\t$asmr\n";
+ print $file "seq_lend\t$seqleft\n";
+ print $file "seq_rend\t$seqright\n";
+ print $file "best\t\n";
+ print $file "comment\t\n";
+ print $file "db\t\n";
+ print $file "offset\t$offset\n";
+ print $file "lsequence\t$seq\n";
+ }
+
+ return;
+} # printSequenceRecord
+
+################################################
+
+=item B<printFastaSequence($file, $header, $seq);>
+
+Prints sequence in Fasta format
+Inputs are:
+ $file - output file opened for writing
+ $header - Fasta header (without >)
+ $seq - sequence to be written
+
+=cut
+
+sub printFastaSequence
+{
+ my($file) = $_[0];
+ my($header) = $_[1];
+ my($seqs) = $_[2];
+
+ print $file ">$header\n";
+ print_sequence($file, $seqs);
+} # printFastaSequence
+
+################################################
+
+=item B<printFastaQual($file, $header, $qual);>
+
+Prints quality values in Fasta format.
+Inputs are:
+ $file - output file
+ $header - fasta header (without >)
+ $qual - string of quality values
+
+=cut
+
+sub printFastaQual
+{
+ my($file) = $_[0];
+ my($header) = $_[1];
+ my($quals) = $_[2];
+ my(@qv);
+
+ print $file ">$header\n";
+
+ @qv = split(' ', $quals);
+
+ for (my $j = 0; $j <= $#qv; $j += 17){
+ print $file join(" ", @qv[$j .. $j + 16]), "\n";
+ }
+} # printFastaQual
+
+
+################################################
+
+=item B<my($rev) = reverseComplement($seq);>
+
+Reverse complements a sequence.
+
+=cut
+
+sub reverseComplement {
+ my($string) = @_;
+ my($rev) = "";
+
+ my(%complement) = (
+ 'A' => 'T',
+ 'T' => 'A',
+ 'C' => 'G',
+ 'G' => 'C',
+ 'U'=> 'A',
+ 'M'=> 'K',
+ 'R'=> 'Y',
+ 'W'=> 'W',
+ 'S'=> 'S',
+ 'Y'=> 'R',
+ 'K'=> 'M',
+ 'V'=> 'B',
+ 'H'=> 'D',
+ 'D'=> 'H',
+ 'B'=> 'V',
+ 'X'=> 'N',
+ 'N'=> 'N',
+ '.'=> '.',
+ '-'=> '-',
+ 'a' => 't',
+ 't' => 'a',
+ 'c' => 'g',
+ 'g' => 'c',
+ 'u'=> 'a',
+ 'm'=> 'k',
+ 'r'=> 'y',
+ 'w'=> 'w',
+ 's'=> 's',
+ 'y'=> 'r',
+ 'k'=> 'm',
+ 'v'=> 'b',
+ 'h'=> 'd',
+ 'd'=> 'h',
+ 'b'=> 'v',
+ 'x'=> 'n',
+ 'n'=> 'n'
+ );
+
+ $string = reverse ($string);
+
+ my ($i);
+ for ($i = 0; $i < length($string); $i++){
+ substr($string, $i, 1, $complement{substr($string, $i, 1)});
+ }
+
+ return $string;
+} # reverseComplement
+
+=back
+
+=cut
+
+END{}
+
+1;
diff --git a/src/PerlModules/FASTAgrammar.pm b/src/PerlModules/FASTAgrammar.pm
new file mode 100644
index 0000000..f0ae370
--- /dev/null
+++ b/src/PerlModules/FASTAgrammar.pm
@@ -0,0 +1,361 @@
+# $Id$
+
+# Copyright @ 2002 - 2010 The Institute for Genomic Research (TIGR).
+# All rights reserved.
+#
+# This software is provided "AS IS". TIGR makes no warranties, express or
+# implied, including no representation or warranty with respect to the
+# performance of the software and derivatives or their safety,
+# effectiveness, or commercial viability. TIGR does not warrant the
+# merchantability or fitness of the software and derivatives for any
+# particular purpose, or that they may be exploited without infringing the
+# copyrights, patent rights or property rights of others.
+#
+# This software program may not be sold, leased, transferred, exported or
+# otherwise disclaimed to anyone, in whole or in part, without the prior
+# written consent of TIGR.
+
+package TIGR::FASTAgrammar;
+{
+
+=head1 NAME
+
+FASTAgrammar - module for validating FASTA format records
+
+=head1 SYNOPSIS
+
+ use TIGR::FASTAgrammar ':public';
+
+ $header = FASTA header here...
+ $data = FASTA data here...
+ $return_value = isValidFASTARecord($header, $data);
+ ...
+
+=head1 DESCRIPTION
+
+This module provides functions for verifying compliance with TIGR's FASTA
+file and record definitions.
+
+=cut
+
+ BEGIN {
+ require 5.006_00;
+ }
+
+ use strict;
+ require Exporter;
+
+ ## internal variables and identifiers
+
+ our @ISA = qw(Exporter);
+ our $REVISION = (qw$Revision$)[-1];
+ our $VERSION = '1.2';
+ our $VERSION_STRING = "$VERSION (Build $REVISION)";
+ our @DEPEND = ();
+
+
+ ## Export methods
+
+ our %EXPORT_TAGS = ( 'public' => [ qw( isValidFASTArecord
+ isValidFASTAheader
+ isValidFASTAdata
+ isValidFASTAlineLength
+ setValidFASTAlineLength ) ] ,
+ 'private' => [ qw( _headerToIdentifier
+ _isNucleotideData
+ _isPeptideData ) ] );
+
+ our @EXPORT_OK = ( @{ $EXPORT_TAGS{'public'} },
+ @{ $EXPORT_TAGS{'private'} } );
+
+
+ ## data structures
+
+ # IUPAC extended codes acceptable for sequence data
+ # see WU-BLAST format on http://tigrblast.tigr.org/html/fasta.html
+ our $NA_IUPAC_CODES = 'ATUGCMRWSYKVHDBN\.\-';
+ our $AA_IUPAC_CODES = 'ARNDBCQEZGHILKMFPSTUWXYV\*\-';
+
+ # FASTA parameters
+ our $FASTA_SEPARATOR = '^>';
+ our $UNBOUND_FASTA_SEPARATOR = '>';
+
+ # note: BLAST can accept 80 bases per line; this just emits a warning
+ our $OUTPUT_LINE_LENGTH = 60;
+ my $RECORD_LINE_LENGTH = 0;
+
+ # the TIGR FASTA header parse
+ our $FASTA_HEADER_PARSE =
+ '^>([[:graph:]]+)(?: +[ \ca[:graph:]]*$| *$)';
+ ## prototypes
+
+ sub isValidFASTArecord(@);
+ sub isValidFASTAheader($);
+ sub isValidFASTAdata($);
+ sub isValidFASTAlineLength($);
+ sub setValidFASTAlineLength($);
+ sub _isNucleotideData($);
+ sub _isPeptideData($);
+ sub _headerToIdentifier($);
+
+ ## implementation
+
+=over
+
+=item $result = isValidFASTArecord(@record_defn);
+
+This method determines if a FASTA record, C<@record_defn>, fits the TIGR
+definition for a FASTA record. C<@record_defn> is an array of lines over
+which the record is defined. The first line should be the FASTA header, and
+subsequent lines the data definition. This method checks line width,
+character composition, and header format. If the record parses correctly,
+this method returns 1. Otherwise, this method returns 0.
+
+=cut
+
+
+ sub isValidFASTArecord(@) {
+
+ my $header = shift;
+ my @data_lines = @_;
+ my $valid_flag = 0;
+ my $first_line_flag = 0;
+ my $first_len = 0;
+
+ # check conformance of header
+ $valid_flag = isValidFASTAheader($header);
+
+ # check conformance of data
+ if ( ( $valid_flag != 0 ) &&
+ ( scalar(@data_lines) > 0 ) ) {
+ my $data_scalar = join "", @data_lines;
+ $data_scalar =~ s/\n//g; # extract new lines from scalar data
+ $valid_flag = isValidFASTAdata($data_scalar);
+ }
+
+ # check conformance of line length
+ while ( ( $valid_flag != 0 ) &&
+ ( defined ( my $line = shift @data_lines ) ) ) {
+ chomp $line;
+
+ if($first_line_flag == 0) {
+ $first_len = setValidFASTAlineLength($line);
+ $first_line_flag = 1;
+ }
+
+ if(defined($first_len)) {
+ my $line_len_flag = isValidFASTAlineLength($line);
+ if ( ( $line_len_flag > 0 ) ||
+ ( ( $line_len_flag < 0 ) &&
+ ( $#data_lines != -1 ) ) ) {
+ $valid_flag = 0;
+ }
+ }
+ }
+
+ return $valid_flag;
+ }
+
+=item $result = isValidFASTAheader($header);
+
+This method determines if the FASTA header description, C<$header>, is
+a valid description. It checks for a leading carot symbol and trailing non
+white space characters. Any number of white space characters
+may be interleaved throughout the text portion of the header, with the
+exception that there may be no space between the carot and the first word.
+If the header is valid, this method returns 1. Otherwise, this method
+returns 0.
+
+=cut
+
+
+ sub isValidFASTAheader($) {
+ my $header = shift;
+ my $return_val = 0;
+ my $identifier = undef;
+
+ if ( ( defined ($header) ) &&
+ ( ($identifier) = $header =~ /$FASTA_HEADER_PARSE/ ) ) {
+
+ if((defined $identifier) && ($identifier !~ /\//)) {
+ $return_val = 1;
+ }
+ else {
+ $return_val = 0;
+ }
+ }
+ else {
+ $return_val = 0;
+ }
+ return $return_val;
+ }
+
+=item $result = isValidFASTAdata($data_def);
+
+This method takes the scalar data definition of a FASTA record, C<$data_def>.
+It tests the data and returns 1 if the data conforms to nucleotide data or if
+it conforms to peptide data or both. If the data is not recognizable or is
+undefined, it returns 0.
+
+=cut
+
+
+ sub isValidFASTAdata($) {
+ my $data_definition = shift;
+ my $return_val = undef;
+ if(($data_definition =~ /^[$NA_IUPAC_CODES]+$/i) ||
+ ($data_definition =~ /^[$AA_IUPAC_CODES]+$/i)) {
+ $return_val = 1;
+ }
+ else {
+ $return_val = 0;
+ }
+ }
+
+=item $result = isValidFASTAlineLength($line);
+
+This method returns -1 if the data line, C<$line> is less than
+the TIGR definition requirement for line length, 0 if the data
+line meets the TIGR definition requirement for line length, and
+1 if the data line is greater than the TIGR definition requirement
+for line length.
+
+=cut
+
+
+ sub isValidFASTAlineLength($) {
+ my $line = shift;
+ my $line_len = undef;
+ my $return_val = undef;
+
+ if ( defined ($line) ) {
+ chomp $line;
+ $line_len = length($line);
+ if ( $line_len > $RECORD_LINE_LENGTH ) {
+ $return_val = 1;
+ }
+ elsif ( $line_len < $RECORD_LINE_LENGTH ) {
+ $return_val = -1;
+ }
+ else {
+ $return_val = 0;
+ }
+ }
+ }
+
+=item $result = setValidFASTAlineLength($);
+
+This method takes in the first data line in the data portion of a FASTA record.
+The function returns the length of this line if it is positive. This length
+determines the line length for all the data lines following this first line.
+The function returns undefined if unsuccessful.
+
+=cut
+
+
+ sub setValidFASTAlineLength($) {
+ my $line = shift;
+ my $line_len = undef;
+ my $ret_len = undef;
+
+ if(defined ($line)) {
+ chomp $line;
+ $line_len = length($line);
+
+ if($line_len > 0) {
+ $ret_len = $line_len ;
+ }
+ }
+ $RECORD_LINE_LENGTH = $ret_len;
+ return $ret_len;
+ }
+
+# $result = _isNucleotideData($data_def);
+
+#This method takes the scalar data definition of a FASTA record, C<$data_def>.
+#It tests it for conformance to a nucleotide data type. If the data are
+#nucleotide IUPAC characters, this method returns 1. If not, this method
+#returns 0. This method returns 0 if C<$data_def> is undefined.
+
+
+ sub _isNucleotideData($) {
+ my $data_def = shift;
+ my $return_val = undef;
+
+ if ( ( defined ( $data_def ) ) &&
+ ( $data_def =~ /^[$NA_IUPAC_CODES]+$/i ) ) {
+ $return_val = 1;
+ }
+ else {
+ $return_val = 0;
+ }
+
+ return $return_val;
+ }
+
+
+# $result = _isPeptideData($data_def);
+
+#This method takes the scalar data definition of a FASTA record, C<$data_def>.
+#It tests it for conformance to a peptide data type. If the data are
+#peptide IUPAC characters, this method returns 1. If not, this method returns
+#zero. This method returns undefined if C<$data_def> is undefined.
+
+
+ sub _isPeptideData($) {
+ my $data_def = shift;
+ my $return_val = undef;
+
+ if ( ( defined ( $data_def ) ) &&
+ ( $data_def =~ /^[$AA_IUPAC_CODES]+$/i ) ) {
+ $return_val = 1;
+ }
+ else {
+ $return_val = 0;
+ }
+
+ return $return_val;
+ }
+
+# $identifier = _headerToIdentifier($header);
+
+#This function takes a FASTA header as a parameter, returning a parsed
+#identifier for the record. If the supplied header is invalid or undefined,
+#this method returns undefined.
+
+
+ sub _headerToIdentifier($) {
+ my $header = shift;
+ my $identifier = undef;
+ my $return_val = undef;
+
+ if ( ( defined ($header) ) &&
+ ( ($identifier) = $header =~ /$FASTA_HEADER_PARSE/ ) &&
+ ( defined ($identifier) ) ) {
+ if($identifier =~ /\//) {
+ $return_val = undef;
+ }
+ else {
+ $return_val = $identifier;
+ }
+ }
+ else {
+ $return_val = undef;
+ }
+
+ return $return_val;
+ }
+
+
+=back
+
+=head1 USAGE
+
+This module is not intended for developer use. Instead, use the front
+end modules C<TIGR::FASTAreader> and C<TIGR::FASTArecord>.
+
+=cut
+
+}
+
+1;
diff --git a/src/PerlModules/FASTAiterator.pm b/src/PerlModules/FASTAiterator.pm
new file mode 100644
index 0000000..8d188f6
--- /dev/null
+++ b/src/PerlModules/FASTAiterator.pm
@@ -0,0 +1,750 @@
+# $Id$
+
+# Copyright @ 2002 - 2010 The Institute for Genomic Research (TIGR).
+# All rights reserved.
+#
+# This software is provided "AS IS". TIGR makes no warranties, express or
+# implied, including no representation or warranty with respect to the
+# performance of the software and derivatives or their safety,
+# effectiveness, or commercial viability. TIGR does not warrant the
+# merchantability or fitness of the software and derivatives for any
+# particular purpose, or that they may be exploited without infringing the
+# copyrights, patent rights or property rights of others.
+#
+# This software program may not be sold, leased, transferred, exported or
+# otherwise disclaimed to anyone, in whole or in part, without the prior
+# written consent of TIGR.
+
+package TIGR::FASTAiterator;
+{
+
+=head1 NAME
+
+TIGR::FASTAiterator - TIGR::FASTAiterator class for parsing and navigating
+FASTA format files and streams. An object of this class can parse FASTA
+records from STDIN and from a pipe.
+
+=head1 SYNOPSIS
+
+ use TIGR::FASTAiterator;
+ my $obj_instance = new TIGR::FASTAiterator ($foundation_obj_ref,
+ $error_array_ref,
+ $fasta_file_name);
+
+=head1 DESCRIPTION
+
+This module iterates over a FASTA formatted file stream. It provides
+data extraction and simple analysis routines. This module utilizes
+acceptance validation of FASTA formatted files via the TIGR::FASTAgrammar
+module.
+
+=cut
+
+ BEGIN {
+ require 5.006_00;
+ }
+
+ use strict;
+ use IO::File;
+ use TIGR::Foundation;
+ use TIGR::FASTAgrammar ':public';
+ use TIGR::FASTAgrammar ':private';
+ use TIGR::FASTArecord;
+
+
+ ## internal variables and identifiers
+
+ our $REVISION = (qw$Revision$)[-1];
+ our $VERSION = '1.11';
+ our $VERSION_STRING = "$VERSION (Build $REVISION)";
+ our @DEPEND =
+ (
+ "TIGR::Foundation",
+ "TIGR::FASTAgrammar",
+ "TIGR::FASTArecord",
+ );
+
+ my $SYS_ERR = 0; # this flag specifies non-user related error
+ my $USR_ERR = 1; # this flag specifies user related error
+
+ ## external variables
+
+ my $UNBOUND_FASTA_SEPARATOR = $TIGR::FASTAgrammar::UNBOUND_FASTA_SEPARATOR;
+
+ # debugging scheme
+ #
+ # Debugging via the TIGR Foundation uses increasing log levels based on
+ # nesting. 'MAIN' starts at level 1. Every nest increments the level by
+ # 1.
+ # Subroutines always start nesting at level 2. As debugging levels
+ # increase, logging is more verbose. This makes sense as you log at
+ # greater depth (ie. deeper branching).
+ #
+ # The following definitions help emphasize the debugging in the program.
+ #
+ my $DEBUG_LEVEL_1 = 1;
+ my $DEBUG_LEVEL_2 = 2;
+ my $DEBUG_LEVEL_3 = 3;
+ my $DEBUG_LEVEL_4 = 4;
+ my $DEBUG_LEVEL_5 = 5;
+ my $DEBUG_LEVEL_6 = 6;
+ my $DEBUG_LEVEL_7 = 7;
+ my $DEBUG_LEVEL_8 = 8;
+ my $DEBUG_LEVEL_9 = 9;
+
+ ## prototypes
+
+ sub new(;$$$);
+ sub open($);
+ sub close();
+ sub hasNext();
+ sub next();
+ sub get();
+ sub _initialize();
+ sub _parse();
+ sub _nullRecordHandler($);
+ sub _errorHandler($$$);
+
+
+ ## implementation
+
+=over
+
+=item $obj_instance = new TIGR::FASTAiterator ($foundation_object,
+ $error_array_ref, $db_file);
+
+This method returns a new instance of a TIGR::FASTAiterator object. It takes
+three optional parameters: a TIGR::Foundation object (C<$foundation_object>),
+a reference to an array for logging user error messages (C<$error_array_ref>),
+and a FASTA file (C<$db_file>) or stream. The filename "-" describes stdin.
+The new instance is returned on success. If the file supplied cannot be
+opened or is invalid, this method returns undefined. This method also returns
+undefined if the parameters supplied are invalid. Errors in parsing are written
+to the array C<$error_array_ref>, the error file and the log file.
+
+=cut
+
+
+ sub new(;$$$) {
+ my $pkg = shift;
+ my @method_args = @_;
+
+ my $error_condition = 0;
+ my $self = {};
+ bless $self, $pkg;
+ $self->_initialize(); # set up internal variables;
+
+ if ( ( scalar (@method_args) > 0 ) &&
+ ( ( ref ($method_args[0]) ) =~ /foundation/i ) ) {
+ $self->{foundation} = shift @method_args;
+ $self->_errorHandler("Got TIGR::Foundation in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+ else {
+ $self->{foundation} = undef;
+ $self->_errorHandler("No TIGR::Foundation in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+
+ if ( ( scalar (@method_args) > 0 ) &&
+ ( ( ref ($method_args[0]) ) =~ /array/i ) ) {
+ $self->{error_ref} = shift @method_args;
+ $self->_errorHandler("Got Error ARRAY in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+ else {
+ $self->{error_ref} = undef;
+ $self->_errorHandler("No Error ARRAY in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+
+ if ( ( scalar (@method_args) > 0 ) &&
+ ( ! ref ($method_args[0]) ) ) {
+ my $filename = shift @method_args;
+ if(defined($filename)) {
+ $self->{db_file_name} = $filename ;
+ $self->_errorHandler("Got file name in new()", $DEBUG_LEVEL_4,
+ $SYS_ERR);
+ }
+ else {
+ $self->_errorHandler("undef passed as filename", $DEBUG_LEVEL_4,
+ $USR_ERR);
+ }
+ }
+ else {
+ $self->{db_file_name} = undef;
+ $self->_errorHandler("No file name in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+
+ # check for invocation errors
+ if ( ( scalar (@method_args) > 0 ) ) {
+ $error_condition = 1;
+ $self->_errorHandler("Too many parameters passed to new() method",
+ $DEBUG_LEVEL_3, $SYS_ERR);
+ }
+ elsif ( defined ( $self->{db_file_name} ) &&
+ ! defined ( $self->open($self->{db_file_name}) ) ) {
+ # the error message is logged via the open() routine
+ $self = undef;
+ }
+ return ( $error_condition == 0 ) ? $self : undef;
+ }
+
+
+=item $result = $obj_instance->open($file_name);
+
+This method opens a FASTA file or pipe for reading. It takes in the filename to
+be opened. If the file name is "-" the input is taken from stdin. On success,
+this method returns 1. If the file cannot be opened or parsing fails, this
+method returns undefined.
+
+=cut
+
+
+ sub open($) {
+ my $self = shift;
+ my $db_file_name = shift;
+
+ my $error_condition = 0;
+
+ # close a previously open file
+ if ( defined ($self->{db_handle}) ) {
+ $self->_errorHandler("Closing old handle in open()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ $self->close();
+ }
+ my $name = $self->{db_file_name};
+
+ if (!(
+ ( defined ( $db_file_name ) ) &&
+ ( $self->{db_file_name} = $db_file_name ) &&
+ ( defined ( $self->{db_file_name} ))
+ ) ) {
+
+ $error_condition = 1;
+ $self->_errorHandler(
+ "File name does not exist", $DEBUG_LEVEL_3, $USR_ERR);
+ }
+ elsif(!defined ( $self->{db_handle} =
+ new IO::File $self->{db_file_name})) {
+ $error_condition = 1;
+ $self->_errorHandler(
+ "Cannot open file \'$self->{db_file_name}\'", $DEBUG_LEVEL_3,
+ $USR_ERR);
+ }
+
+
+ if ( $error_condition == 1 ) {
+ $self->_initialize(); # reset object state
+ }
+
+ return ($error_condition == 1) ? undef : 1;
+ }
+
+
+=item $result = $obj_instance->close();
+
+This method closes the object file stream and resets all internal data
+structures. The result of the operation is returned. If the file stream
+is closed successfully, this object returns true (1), otherwise false
+(undefined).
+
+=cut
+
+
+ sub close() {
+ my $self = shift;
+ my $return_val = undef;
+
+ if ( defined ( $self->{db_handle} ) ) {
+ $return_val = $self->{db_handle}->close();
+ if (!$return_val) {
+ $return_val = undef;
+ $self->_errorHandler(
+ "Error closing FASTA file: $self->{db_file_name}",
+ $DEBUG_LEVEL_4, $USR_ERR);
+ }
+ }
+ $self->_initialize();
+ return $return_val;
+ }
+
+
+=item $result = $obj_instance->hasNext();
+
+This method returns true (1) if there are more elements beyond the current
+element in the filestream. If not, this method returns false (undefined).
+
+=cut
+
+ sub hasNext() {
+ my $self = shift;
+ my $next_header = $self->{rec_header};
+ $self->_errorHandler(
+ "Checking to see if the header of the next record is set",
+ $DEBUG_LEVEL_2, $SYS_ERR);
+ my $result = undef;
+ my $newline = undef;
+ my $line_number = $self->{line_number};
+ if ($line_number == 0) {
+ $self->_errorHandler(
+ "No record has been parsed",
+ $DEBUG_LEVEL_3, $SYS_ERR);
+ my $db_handle = defined ( $self->{db_handle} ) ?
+ $self->{db_handle} : undef;
+
+ if(defined $db_handle) {
+ $newline = <$db_handle>;
+ }
+ #reading the first line from a file.
+ if(defined($newline)) {
+ $line_number++;
+ $self->{line_number} = $line_number;
+ $next_header = $newline;
+ $self->_errorHandler(
+ "Assigned the header of the next record",
+ $DEBUG_LEVEL_4, $SYS_ERR);
+ $self->{rec_header} = $next_header;
+ $result = 1;
+ }
+ }
+
+ if((defined ($next_header)) && (($next_header) ne "")) {
+ $result = 1;
+ }
+ return $result;
+ }
+
+
+=item $result = $obj_instance->next();
+
+This method selects the next record in the file stream for parsing. If the
+record parses, it is returned, else the method returns undefined. If there is
+no record in the file stream, the method returns undefined.
+
+=cut
+
+ sub next() {
+ my $self = shift;
+ my $record = undef;
+ if(($self->_parse()) == 1) {
+ $self->_errorHandler(
+ "The record parsed",
+ $DEBUG_LEVEL_3, $SYS_ERR);
+ #obtaining the stored record.
+ my $recordarray_ref = $self->{recordinfo};
+
+ if( (defined $recordarray_ref) &&
+ (( ref ($recordarray_ref) ) =~ /array/i) ) {
+
+ my @recordarray = @$recordarray_ref;
+ my $array_length = 0;
+
+ if((defined $recordarray_ref) &&
+ ($array_length = @recordarray) &&
+ ($array_length > 0)) {
+
+ my $header = shift @recordarray;
+ $self->_errorHandler(
+ "Got the record header",
+ $DEBUG_LEVEL_5, $SYS_ERR);
+ my $data = undef;
+ if ( scalar(@recordarray) > 0 ) {
+ $data = join "", @recordarray;
+ $data =~ s/\n//g; # extract new lines from scalar data
+ }
+ $self->_errorHandler(
+ "Got the record data",
+ $DEBUG_LEVEL_5, $SYS_ERR);
+ $record = new TIGR::FASTArecord ($header, $data);
+
+ if(defined($record)) {
+ $self->_errorHandler(
+ "Created new record",
+ $DEBUG_LEVEL_6, $SYS_ERR);
+ }
+ }
+ }
+ }
+ return $record;
+ }
+
+
+=item $record_contents = $obj_instance->get();
+
+This method returns the current TIGR::FASTArecord object (active record). If
+the current object (active record) is undefined, this method returns undefined.
+
+=cut
+
+ sub get() {
+ my $self = shift;
+ my $record = undef;
+ #obtaining the stored record information.
+ my $recordarray_ref = $self->{recordinfo};
+ if( (defined $recordarray_ref) &&
+ (( ref ($recordarray_ref) ) =~ /array/i) ) {
+ my @recordarray = @$recordarray_ref;
+ my $array_length = 0;
+
+ if((defined $recordarray_ref) &&
+ ($array_length = @recordarray) &&
+ ($array_length > 0)) {
+
+ my $header = shift @recordarray;
+ $self->_errorHandler(
+ "Got the record header",
+ $DEBUG_LEVEL_4, $SYS_ERR);
+ my $data = undef;
+ if ( scalar(@recordarray) > 0 ) {
+ $data = join "", @recordarray;
+ $data =~ s/\n//g; # extract new lines from scalar data
+ }
+ $self->_errorHandler(
+ "Got the record data",
+ $DEBUG_LEVEL_4, $SYS_ERR);
+ $record = new TIGR::FASTArecord ($header, $data);
+ if(defined($record)) {
+ $self->_errorHandler(
+ "Created new record",
+ $DEBUG_LEVEL_5, $SYS_ERR);
+ }
+
+ }
+ }
+ return $record;
+ }
+
+
+# $obj_instance->_initialize();
+
+#This method resets the object to its initial state. Internal data structures
+#are reset. This method does not return.
+
+
+ sub _initialize() {
+ my $self = shift;
+ # look up methods for records here
+ $self->{error_cnt} = 0; # parse error tabulator
+ $self->{db_file_name} = "";
+ $self->{db_handle} = undef;
+ $self->{rec_header} = undef; # the next record header
+ $self->{recordinfo} = undef; # reference to the record contents
+ $self->{line_number} = 0; # the line number in the FASTA file.
+ }
+
+# $obj_instance->_parse();
+
+#This method parses a FASTA record from the file stream.
+#All the parsing errors for this record are recorded in
+#the logfile. If the record parses correctly, the method returns 1, else it
+#returns 0.
+
+
+ sub _parse() {
+
+ my $self = shift;
+ my $last_line_length_lt_std_flag = 0;
+ my $record_identifier = "<undefined>";
+ my $preceding_header_flag = 0;
+ my $first_data_line_length = 0;
+ my @recarray;
+ my $preceding_record_flag = 0;
+
+ my $line_number = $self->{line_number};
+
+ $self->{error_cnt} = 0;
+ my $db_handle = defined ( $self->{db_handle} ) ?
+ $self->{db_handle} : undef;
+
+ # check for FASTA header of next record
+ my $header = $self->{rec_header};
+
+ #when in the beginning and end of the filestream.
+ if(!defined ($header)) {
+ my $newline = <$db_handle>;
+ if((defined($newline)) && ($newline ne "")) {
+ $line_number++;
+ $header = $newline;
+ }
+ }
+ #parsing the header
+ if ( ( isValidFASTAheader($header) ) != 0 ) {
+ # set up the variables for parsing a new record
+ $last_line_length_lt_std_flag = 0;
+ $preceding_header_flag = 1;
+ $preceding_record_flag = 1;
+ $self->{rec_header} = undef;
+
+ # if it's a valid FASTA header, then don't need to check again
+ # extract the record IDENTIFIER
+ $record_identifier = _headerToIdentifier($header);
+ push @recarray,$header;
+ }
+ else { #the header is not valid.
+ if((defined $header) && (defined $line_number)) {
+ $self->_errorHandler("Expected: record header " .
+ "information in FASTA record header. Got: \'$header\' ".
+ "at line $line_number.", $DEBUG_LEVEL_3, $USR_ERR);
+ }
+ $preceding_record_flag = 1;
+ $self->{rec_header} = undef;
+ }
+
+ while ( ( defined ( $db_handle ) ) &&
+ ( defined ( my $line = <$db_handle> )) &&
+ (++$line_number)) {
+ chomp $line;
+
+ # check FASTA data
+ if ( ( defined ( $record_identifier ) ) &&
+ ( $record_identifier !~ /<undefined>/ ) &&
+ ( ( isValidFASTAdata($line) ) != 0 ) ) {
+
+ push @recarray,$line;
+ if($preceding_header_flag == 1) {
+ $first_data_line_length = setValidFASTAlineLength($line);
+ }
+
+ # check $last_line_length_lt_std_flag for an error on
+ # previous line
+ if(defined ($first_data_line_length)) {
+ if ( $last_line_length_lt_std_flag == 1 ) {
+ $self->{error_cnt}++;
+ $self->_errorHandler("Expected: FASTA data ".
+ "definition lines should be ".
+ "$first_data_line_length bases (characters) ".
+ "across. Only the last line of a sequence ".
+ "data definition may be less than " .
+ "$first_data_line_length bases (characters) " .
+ "across, if applicable. See line " .
+ ($line_number - 1) . '.', $DEBUG_LEVEL_6, $USR_ERR);
+ }
+ $last_line_length_lt_std_flag = 0;
+
+ # check current line for over-length problem
+ if ( length($line) > $first_data_line_length ) {
+ $self->{error_cnt}++;
+ $self->_errorHandler("Expected: FASTA data ".
+ "definition lines should be $first_data_line_length ".
+ "bases (characters) across. Only the last line of a ".
+ "sequence data definition may be less than " .
+ "$first_data_line_length bases (characters) ".
+ "across, if applicable. See line " . $line_number .
+ '.',
+ $DEBUG_LEVEL_6,$USR_ERR);
+ }
+
+ #check current line for under-length problem;
+ #report only if not
+ #the last line in the data definition
+ elsif ( length($line) < $first_data_line_length ) {
+ $last_line_length_lt_std_flag = 1;
+ }
+ }
+ $preceding_header_flag = 0;
+ }
+ elsif($line =~ /^>/) { #the next header
+ if ($preceding_record_flag == 1) { #its the next record.
+ $self->{rec_header} = $line;
+ $self->_errorHandler(
+ "Assigned the header of the next record",
+ $DEBUG_LEVEL_5, $SYS_ERR);
+ last;
+ }
+ }
+ # handle data error types
+ else {
+ $self->{error_cnt}++;
+
+ # line has a separator token in it, so it may be header
+ if ( $line =~ /$UNBOUND_FASTA_SEPARATOR/ ) {
+ $self->_errorHandler("Expected: record header " .
+ "information in FASTA record header. Got: \'$line\' ".
+ "at line $line_number.", $DEBUG_LEVEL_6, $USR_ERR);
+ $last_line_length_lt_std_flag = 0;
+ }
+ # if last data line was small, expect this to be a header too
+ elsif ( $last_line_length_lt_std_flag == 1 ) {
+ $self->_errorHandler("Expected: FASTA record header " .
+ "beginning with \'>\'. Got: \'$line\' at line ".
+ "$line_number.",$DEBUG_LEVEL_6, $USR_ERR);
+ $last_line_length_lt_std_flag = 0;
+ }
+ elsif ( ( defined ( $record_identifier ) ) &&
+ ( $record_identifier !~ /<undefined>/ ) ) {
+ $self->_errorHandler("Expected: valid FASTA data " .
+ "definition for record identifier ".
+ "\'$record_identifier\' Check sequence content at line ".
+ "$line_number for invalid bases ".
+ "(data type: invalid data).", $DEBUG_LEVEL_6, $USR_ERR);
+ }
+ else {
+ $self->_errorHandler("Expected: FASTA record header " .
+ "followed by definition of sequence. Invalid input at " .
+ "line $line_number.", $DEBUG_LEVEL_6, $USR_ERR);
+ }
+ }
+ } # end while
+
+ # check terminal case data definition
+ if ( $preceding_header_flag == 1 ) {
+ $self->_nullRecordHandler($line_number);
+ }
+ $self->{recordinfo} = \@recarray;
+ $self->{line_number} = $line_number;
+ return ( $self->{error_cnt} == 0 ) ? 1 : 0;
+ }
+
+
+# $obj_instance->_nullRecordHandler($);
+
+#This method handles the case of a null or equivalently empty record
+#encountered during parsing. It logs the appropriate message to the
+#TIGR Foundation object. The only argument is the line number.
+
+
+ sub _nullRecordHandler($) {
+ my $self = shift;
+ my $line_number = shift;
+
+ if ( ! defined ($line_number) ) {
+ $line_number = "<unknown>";
+ }
+
+ $self->{error_cnt}++;
+ if ( $self->{db_handle}->eof() == 1 ) {
+ $self->_errorHandler("Expected: FASTA record header " .
+ "followed by definition of sequence. " .
+ "Got end of file after line " .
+ ($line_number) . ".", $DEBUG_LEVEL_5, $USR_ERR);
+ }
+ else {
+ $self->_errorHandler("Expected: FASTA record header " .
+ "followed by definition of sequence " .
+ "Got FASTA header at line " .
+ ($line_number-1) . ".", $DEBUG_LEVEL_5, $USR_ERR);
+ }
+ }
+
+
+
+# $message = $obj_instance->_errorHandler($message, $tf_level,
+# $internal_log_flag);
+
+#This method handles logging to the TIGR::Foundation module and
+#internal error record reference array. The C<$message> argument is logged
+#to the appropriate service. The C<$tf_level> parameter specifies the
+#logging level for TIGR::Foundation, while the C<$internal_log_flag> parameter
+#specifies if C<$message> should be written to the internal array reference
+#specified in C<new()>. If a TIGR::Foundation instance does not exist,
+#no logging to that facility occurs. This method returns C<$message>.
+
+
+ sub _errorHandler($$$) {
+
+ my $self = shift;
+
+ my ( $message, $tf_level, $log_facility ) = @_;
+
+ if ( defined ($message) &&
+ defined ($tf_level) &&
+ defined ($log_facility) ) {
+
+ if ( defined ($self->{foundation}) ) {
+ if ( $log_facility != $USR_ERR ) { # all user errors go to .error
+ $self->{foundation}->logLocal($message, $tf_level);
+ }
+ else {
+ $self->{foundation}->logError($message);
+ }
+ }
+
+ if ( ( defined ($self->{error_ref}) ) &&
+ ( $log_facility == $USR_ERR ) ) {
+ push @{$self->{error_ref}}, $message;
+ }
+ }
+ return $message;
+ }
+
+=head1 USAGE
+
+To use this module, load the C<TIGR::FASTAiterator> package via the
+C<use> function. Then, create a new instance of the object via the
+C<new()> method, as shown below. There are several invocations possible
+for this method since all parameters to C<new()> are optional.
+
+To access records from the C<TIGR::FASTAiterator> instance, the
+C<TIGR::FASTArecord> package must be loaded via the C<use> function.
+
+An example script using this module follows. The C<TIGR::Foundation>
+module is included for completeness but does not have to be used.
+
+ #!/usr/local/bin/perl -w
+
+ # This script accepts FASTA files with the '-i' option
+ # on the command line and validates every record in the file.
+ # Parse errors for each record are collected to the
+ # '@errors_list' array and written to the .error file.
+ # This program concatenates all of the correct records together to
+ # one output file specified with the '-o' option.
+ # NOTE: The '-i' option must be specified before every input file.
+
+
+ use strict;
+ use TIGR::FASTAiterator;
+ use TIGR::FASTArecord;
+
+ MAIN:
+ {
+ my $tf_object = new TIGR::Foundation;
+ my @errors_list = ();
+ my @input_files = ();
+ my $output_file = undef;
+
+ # Capture the return code from the TIGR::Foundation method
+ my $result = $tf_object->TIGR_GetOptions('i=s' => \@input_files,
+ 'o=s' => \$output_file);
+ if ( $result != 1 ) {
+ $tf_object->bail("Invalid command line options.");
+ }
+
+ # Create a TIGR::FASTAiterator instance using TIGR::Foundation and
+ # an error message list.
+ my $fasta_iterator = new TIGR::FASTAiterator $tf_object, \@errors_list;
+
+ if ( !( defined ( $output_file ) &&
+ open OUTFILE, ">$output_file" ) ) {
+ $tf_object->bail("Cannot open output file for writing.");
+ }
+
+ foreach my $in_file ( @input_files ) {
+ $fasta_iterator->open($in_file) or
+ $tf_object->logLocal("Cannot open or read file $in_file", 2);
+
+ if ( scalar(@errors_list) > 0 ) { # are there parse errors?
+ while ( @errors_list ) { # get the messages from the list
+ my $message = shift @errors_list;
+ print STDERR $message, "\n";
+ }
+ }
+ #
+ while ( $fasta_iterator->hasNext() ) {
+ # print each record to OUTFILE
+ my $record = $fasta_iterator->next();
+
+ # print each record to OUTFILE
+ if(defined $record) {
+ print OUTFILE $record->toString();
+ }
+ }
+ }
+ }
+
+=cut
+
+}
+
+1;
diff --git a/src/PerlModules/FASTAreader.pm b/src/PerlModules/FASTAreader.pm
new file mode 100644
index 0000000..a369dd7
--- /dev/null
+++ b/src/PerlModules/FASTAreader.pm
@@ -0,0 +1,930 @@
+# $Id$
+
+# Copyright @ 2002 - 2010 The Institute for Genomic Research (TIGR).
+# All rights reserved.
+#
+# This software is provided "AS IS". TIGR makes no warranties, express or
+# implied, including no representation or warranty with respect to the
+# performance of the software and derivatives or their safety,
+# effectiveness, or commercial viability. TIGR does not warrant the
+# merchantability or fitness of the software and derivatives for any
+# particular purpose, or that they may be exploited without infringing the
+# copyrights, patent rights or property rights of others.
+#
+# This software program may not be sold, leased, transferred, exported or
+# otherwise disclaimed to anyone, in whole or in part, without the prior
+# written consent of TIGR.
+
+
+package TIGR::FASTAreader;
+{
+
+=head1 NAME
+
+TIGR::FASTAreader - TIGR::FASTAreader class for parsing and navigating
+FASTA format files.
+
+=head1 SYNOPSIS
+
+ use TIGR::FASTAreader;
+ my $obj_instance = new TIGR::FASTAreader ($foundation_obj_ref,
+ $error_array_ref, $fasta_file_name);
+
+=head1 DESCRIPTION
+
+This module iterates over a FASTA formatted database file. It provides
+data extraction and simple analysis routines. This module utilizes
+acceptance validation of FASTA formatted files via the TIGR::FASTAgrammar
+module.
+
+=cut
+
+ BEGIN {
+ require 5.006_00;
+ }
+
+ use strict;
+ use IO::File;
+ use TIGR::Foundation;
+ use TIGR::FASTAgrammar ':public';
+ use TIGR::FASTAgrammar ':private';
+ use TIGR::FASTArecord;
+
+
+ ## internal variables and identifiers
+
+ our $REVISION = (qw$Revision$)[-1];
+ our $VERSION = '1.21';
+ our $VERSION_STRING = "$VERSION (Build $REVISION)";
+ our @DEPEND = ();
+
+ my $SYS_ERR = 0; # this flag specifies non-user related error
+ my $USR_ERR = 1; # this flag specifies user related error
+
+ ## external variables
+
+ my $UNBOUND_FASTA_SEPARATOR = $TIGR::FASTAgrammar::UNBOUND_FASTA_SEPARATOR;
+
+ # debugging scheme
+ #
+ # Debugging via the TIGR Foundation uses increasing log levels based on
+ # nesting. 'MAIN' starts at level 1. Every nest increments the level by
+ # 1.
+ # Subroutines always start nesting at level 2. As debugging levels
+ # increase, logging is more verbose. This makes sense as you log at
+ # greater depth (ie. deeper branching).
+ #
+ # The following definitions help emphasize the debugging in the program.
+ #
+ my $DEBUG_LEVEL_1 = 1;
+ my $DEBUG_LEVEL_2 = 2;
+ my $DEBUG_LEVEL_3 = 3;
+ my $DEBUG_LEVEL_4 = 4;
+ my $DEBUG_LEVEL_5 = 5;
+ my $DEBUG_LEVEL_6 = 6;
+ my $DEBUG_LEVEL_7 = 7;
+ my $DEBUG_LEVEL_8 = 8;
+ my $DEBUG_LEVEL_9 = 9;
+
+ ## prototypes
+
+ sub new(;$$$);
+ sub open($;$);
+ sub close();
+ sub index();
+ sub seekIndex($);
+ sub getRecordByIdentifier($);
+ sub seekIdentifer($);
+ sub get();
+ sub next();
+ sub hasNext();
+ sub count();
+ sub path();
+ sub _initialize();
+ sub _parseDBfile();
+ sub _nullRecordHandler($$);
+ sub _errorHandler($$$);
+
+
+ ## implementation
+
+=over
+
+=item $obj_instance = new TIGR::FASTAreader ($foundation_object,
+ $error_array_ref, $db_file);
+
+This method returns a new instance of a TIGR::FASTAreader object. It takes
+three optional parameters: a TIGR::Foundation object (C<$foundation_object>),
+a reference to an array for logging user error messages (C<$error_array_ref>),
+and FASTA file (C<$db_file>). The new instance is returned on success. If
+the file supplied cannot be opened or is invalid, this method returns
+undefined. This method also returns undefined if the parameters supplied are
+invalid. Errors in parsing are written to the array at C<$error_array_ref>
+and the log file.
+
+=cut
+
+ sub new(;$$$) {
+ my $pkg = shift;
+ my @method_args = @_;
+
+ my $error_condition = 0;
+ my $self = {};
+ bless $self, $pkg;
+ $self->_initialize(); # set up internal variables;
+
+ if ( ( scalar (@method_args) > 0 ) &&
+ ( ( ref ($method_args[0]) ) =~ /foundation/i ) ) {
+ $self->{foundation} = shift @method_args;
+ $self->_errorHandler("Got TIGR::Foundation in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+ else {
+ $self->{foundation} = undef;
+ $self->_errorHandler("No TIGR::Foundation in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+
+ if ( ( scalar (@method_args) > 0 ) &&
+ ( ( ref ($method_args[0]) ) =~ /array/i ) ) {
+ $self->{error_ref} = shift @method_args;
+ $self->_errorHandler("Got Error ARRAY in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+ else {
+ $self->{error_ref} = undef;
+ $self->_errorHandler("No Error ARRAY in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+
+ if ( ( scalar (@method_args) > 0 ) &&
+ ( ! ref ($method_args[0]) ) ) {
+ my $filename = shift @method_args;
+ if(defined($filename)) {
+ $self->{db_file_name} = $filename ;
+ $self->_errorHandler("Got file name in new()", $DEBUG_LEVEL_4,
+ $SYS_ERR);
+ }
+ else {
+ $self->_errorHandler("undef passed as filename", $DEBUG_LEVEL_4,
+ $USR_ERR);
+ }
+ }
+ else {
+ $self->{db_file_name} = undef;
+ $self->_errorHandler("No file name in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+
+ # check for invocation errors
+ if ( ( scalar (@method_args) > 0 ) ) {
+ $error_condition = 1;
+ $self->_errorHandler("Too many parameters passed to new() method",
+ $DEBUG_LEVEL_3, $SYS_ERR);
+ }
+ elsif ( defined ( $self->{db_file_name} ) &&
+ ! defined ( $self->open($self->{db_file_name}, "r") ) ) {
+ # the error message is logged via the open() routine
+ $self = undef;
+ }
+ return ( $error_condition == 0 ) ? $self : undef;
+ }
+
+
+=item $result = $obj_instance->open($file_name, $flag);
+
+This method opens a FASTA file for reading. This method also parses the file
+for correctness. The file, C<$file_name>, is opened using the C<open()> flags
+specified by C<$flag>. On success, this method returns 1. If the file cannot
+be opened or parsing fails, this method returns undefined.
+
+=cut
+
+ sub open($;$) {
+ my $self = shift;
+ my $db_file_name = shift;
+ my $open_flags = shift;
+
+ my $error_condition = 0;
+
+ if ( ( ! defined ($open_flags) ) ||
+ ( $open_flags !~ /^r$/i ) ) {
+ $open_flags = "r";
+ }
+ $self->_errorHandler("Open flags = \'$open_flags\' in open()",
+ $DEBUG_LEVEL_3, $SYS_ERR);
+
+ # close a previously open file
+ if ( defined ($self->{db_handle}) ) {
+ $self->_errorHandler("Closing old handle in open()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ $self->close();
+ }
+
+ if (!(
+ ( defined ( $db_file_name ) ) &&
+ ( $self->{db_file_name} = $db_file_name ) &&
+ ( defined ( $self->{db_file_name} )) &&
+ ( defined ( $self->{db_handle} =
+ new IO::File $self->{db_file_name}, $open_flags ))
+ ) ) {
+ $error_condition = 1;
+ $self->_errorHandler(
+ "Cannot open file \'$self->{db_file_name}\'", $DEBUG_LEVEL_3,
+ $USR_ERR);
+ }
+ elsif ( ( defined ( $self->{db_file_name} ) ) &&
+ ( defined ( $self->{db_handle} ) ) &&
+ ( $self->_parseDBfile() == 0 ) ) {
+ $error_condition = 1;
+ $self->_errorHandler("Encountered errors in file " .
+ "\'$self->{db_file_name}\'.", $DEBUG_LEVEL_3, $USR_ERR);
+ }
+
+ if ( $error_condition == 1 ) {
+ $self->_initialize(); # reset object state
+ }
+
+ return ($error_condition == 1) ? undef : 1;
+ }
+
+
+=item $result = $obj_instance->close();
+
+This method closes the object file stream and resets all internal data
+structures. The result of the operation is returned. If the file stream
+is closed successfully, this object returns true (1), otherwise false
+(undefined).
+
+=cut
+
+ sub close() {
+ my $self = shift;
+ my $return_val = undef;
+
+ if ( defined ( $self->{db_handle} ) ) {
+ $return_val = $self->{db_handle}->close();
+ if (!$return_val) {
+ $return_val = undef;
+ $self->_errorHandler(
+ "Error closing FASTA file: $self->{db_file_name}",
+ $DEBUG_LEVEL_4, $USR_ERR);
+ }
+ }
+ $self->_initialize();
+ return $return_val;
+ }
+
+
+=item $record_num = $obj_instance->index();
+
+This method returns the record number of the active record. If no record has
+been selected (ie. made active), then this method returns undefined. If
+the active record pointer is before the first record, this method returns
+'-1'.
+
+=cut
+
+ sub index() {
+ my $self = shift;
+ my $return_val = undef;
+
+ if ( defined ($self->{active_record}) ) {
+ $return_val = $self->{active_record};
+ }
+ else {
+ $return_val = undef;
+ }
+ return $return_val;
+ }
+
+
+=item $result = $obj_instance->seekIndex($num);
+
+This method selects a record by record order index. The C<$num> ordered
+record is selected. If C<$num> is out of range for the database or not -1
+(indicating to seek one record before the first record), this
+function returns undefined and the active record pointer is not changed.
+Otherwise, the requested record is made active and the method returns 1.
+
+=cut
+
+ sub seekIndex($) {
+ my $self = shift;
+ my $active_num = shift;
+ my $return_val;
+
+ if ( (defined ($active_num) ) &&
+ ( ($active_num =~ /^\d+$/) ||
+ ($active_num == -1 ) ) &&
+ ($active_num < $self->count()) ) {
+ $self->_errorHandler(
+ "Setting active record num to $active_num.",
+ $DEBUG_LEVEL_3, $SYS_ERR);
+ $self->{active_record} = $active_num;
+ $return_val = 1;
+ }
+ else {
+ if ( ! defined ($active_num) ) {
+ $active_num = "<undefined>";
+ }
+ $self->_errorHandler(
+ "Cannot set active record num to $active_num, out of " .
+ $self->count(), $DEBUG_LEVEL_3, $SYS_ERR);
+ $return_val = undef;
+ }
+ return $return_val;
+ }
+
+
+=item $result = $obj_instance->next();
+
+This method selects the next record in numerical order to be the active
+record. It returns the record on success, undefined on failure. If the active
+record is equal to -1, the first record is selected.
+
+=cut
+
+ sub next() {
+ my $self = shift;
+ my $return_val = undef;
+
+ if ( defined ( $self->hasNext() ) ) {
+ $self->{active_record}++;
+ $return_val = $self->get();
+ }
+ # set undefined if no more records left or no records at all
+ else {
+ $return_val = undef;
+ }
+
+ return $return_val;
+ }
+
+
+=item $result = $obj_instance->hasNext();
+
+This method returns true (1) if there are more elements beyond the
+current element. If not, this method returns false (undefined).
+
+=cut
+
+ sub hasNext() {
+ my $self = shift;
+ my $return_val = undef;
+
+ if ( ( defined ($self->{active_record}) ) &&
+ ( $self->{active_record} >= -1 ) &&
+ ( $self->{active_record} < ( $self->count() - 1 ) )
+ ) {
+ $return_val = 1;
+ }
+ else {
+ $return_val = undef;
+ }
+ return $return_val;
+ }
+
+
+=item $result =
+ $obj_instance->getRecordByIdentifier($identifier);
+
+This method selects a record by record minimal identifier.
+If C<$identifier> does not exist in the set of records, this function
+returns undefined and the previously active record remains active. Otherwise,
+the requested record is made active and the method returns a
+C<TIGR::FASTArecord> object representation of the current(active) record.
+
+=cut
+
+ sub getRecordByIdentifier($) {
+
+ my $self = shift;
+ my $identifier = shift;
+ my $fasta_record = undef;
+ my $seek_result = undef;
+ if((defined $identifier)) {
+
+ my $seek_result = $self->seekIdentifier($identifier);
+ if( (defined ($seek_result)) && ($seek_result == 1)) {
+ $fasta_record = $self->get();
+ }
+ }
+ else {
+ $self->_errorHandler("undefined identifier passed", $DEBUG_LEVEL_3,
+ $USR_ERR);
+ }
+ return $fasta_record;
+ }
+
+
+=item $result = $obj_instance->seekIdentifier($identifier);
+
+This method selects a record by record minimal identifier.
+If C<$identifier> does not exist in the set of records, this function
+returns undefined and the previously active record remains active. Otherwise,
+the requested record is made active and the method returns 1.
+
+=cut
+
+ sub seekIdentifier($) {
+ my $self = shift;
+ my $identifier = shift;
+ my $number = undef;
+
+ if ( (defined $identifier) &&
+ (exists $self->{identifier_to_number_hash}->{$identifier}) ) {
+ $number = $self->{identifier_to_number_hash}->{$identifier};
+ $self->_errorHandler(
+ "Got record number $number for $identifier.", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+ return $self->seekIndex($number);
+ }
+
+
+=item $record_contents = $obj_instance->get();
+
+This method returns a C<TIGR::FASTArecord> object representation of the current
+(active) record. If no defined record is active, this method returns
+undefined.
+
+=cut
+
+ sub get() {
+ my $self = shift;
+ my $db_handle = defined ($self->{db_handle}) ?
+ $self->{db_handle} : undef;
+ my $header = "";
+ my $data = "";
+ my $f_obj = undef;
+ my $pos_str = undef;
+ my @pos_arr = ();
+ my $record = undef;
+
+ # open FASTA file for reading
+ if (! defined ($db_handle) ) {
+ $self->_errorHandler("db_handle not defined: " .
+ "cannot access FASTA file \'$self->{db_file_name}\'.",
+ $DEBUG_LEVEL_3);
+ }
+
+ # search and extract the FASTA record
+ if (( defined ( $self->{active_record} )) &&
+ ( $self->{active_record} > -1 ) &&
+ ( $self->{active_record} < $self->count() ) &&
+ ( defined ( $db_handle )) &&
+ ( defined ( $pos_str =
+ $self->{number_to_fp_array}->{$self->{active_record}} ))
+ ) {
+ @pos_arr = split " ", $pos_str;
+
+ # seek to the start position of the record in the file and read the
+ # record information
+ if((defined $pos_arr[0]) &&
+ (defined($db_handle->seek($pos_arr[0],SEEK_SET))) &&
+ (defined $pos_arr[1]) &&
+ (defined (read $db_handle, $record,
+ (($pos_arr[1]-$pos_arr[0])+1)))) {
+
+ ($header) = $record =~ /(>.*)\n/;
+ $record =~ s/(>.*)\n//;
+ $record =~ s/[\s\n]+//g;
+ $f_obj = new TIGR::FASTArecord $header, $record;
+ }
+ }
+ return $f_obj;
+ }
+
+
+=item $db_name = $obj_instance->path();
+
+This method returns the path to the file used for processing.
+
+=cut
+
+ sub path() {
+ my $self = shift;
+ # the existence of db_file_name is checked in new()
+ return $self->{db_file_name};
+ }
+
+
+=item $cnt = $obj_instance->count();
+
+This method returns the number of records in the database file.
+
+=cut
+
+ sub count() {
+ my $self = shift;
+ return $self->{num_records};
+ }
+
+
+# $obj_instance->_initialize();
+
+#This method resets the object to its initial state. Internal data structures
+#are reset. This method does not return.
+
+ sub _initialize() {
+ my $self = shift;
+
+ $self->{num_records} = 0; # number of recs
+
+ # look up methods for records here
+ # the active record is stored as a sequence number
+ $self->{active_record} = undef; # current working record
+ $self->{number_to_fp_array} = (); # map seq# to file loc
+ $self->{number_to_identifier_array} = (); # map seq# to identifier
+ $self->{identifier_to_number_hash} = (); # map seq identifier to seq#
+ $self->{error_cnt} = 0; # parse error tabulator
+ $self->{db_file_name} = "";
+ $self->{db_handle} = undef;
+ }
+
+
+# $obj_instance->_parseDBfile();
+
+#This method parses the FASTA database file passed via the C<open()> method.
+#It defines all of the sequence look-ups and validates every record. This
+#method finds the number of sequences and maximum sequence length. This
+#method is called from the C<open()> method. The active record is un-selected
+#by this method.
+
+ sub _parseDBfile() {
+ my $self = shift;
+ my $last_line_length_lt_std_flag = 0;
+ my $line_number = 0;
+ my $record_identifier = "<undefined>";
+ my $preceding_header_flag = 0;
+ my $first_data_line_length = undef;
+ my $empty_line_found = 0;
+ my $db_handle = defined ( $self->{db_handle} ) ?
+ $self->{db_handle} : undef;
+ #the file position where the record starts
+ my $pos1 = 0;
+ #the file position where the record ends
+ my $pos2 = undef;
+ #the start and end positions of a record separated with a space
+ my $string = "";
+ # variable to give the length of each line
+ my $line_len = undef;
+ # the sum of the length of all the lines in a file
+ my $sum_len = 0;
+ # loop through FASTA file
+ while ( ( defined ( $db_handle ) ) &&
+ ( defined ( my $line = <$db_handle> ) ) &&
+ ( ++$line_number ) ) {
+ chomp $line;
+ $line_len = length($line);
+ $sum_len += $line_len;
+ $sum_len++;
+
+ # check FASTA data
+ if ( ( defined ( $record_identifier ) ) &&
+ ( $record_identifier !~ /<undefined>/ ) &&
+ ( ( isValidFASTAdata($line) ) != 0 ) ) {
+
+ # check if previous line was empty
+ if ( $empty_line_found == 1 ) {
+ $self->{error_cnt}++;
+ $self->_errorHandler("ERROR: Empty line found at line ".
+ ($line_number - 1). " - empty lines are ".
+ "allowed only at the end of a file",
+ $DEBUG_LEVEL_5, $USR_ERR);
+ $empty_line_found = 0;
+ }
+
+ if($preceding_header_flag == 1) {
+ $first_data_line_length = setValidFASTAlineLength($line);
+ }
+
+ # check $last_line_length_lt_std_flag for an error on previous line
+ if(defined ($first_data_line_length)) {
+ if ( $last_line_length_lt_std_flag == 1 ) {
+ $self->{error_cnt}++;
+ $self->_errorHandler("Expected: FASTA data definition " .
+ "lines should be $first_data_line_length bases " .
+ "(characters) across. Only the last line of a sequence ".
+ "data definition may be less than " .
+ "$first_data_line_length bases (characters) " .
+ "across, if applicable. See line " .
+ ($line_number - 1) . '.', $DEBUG_LEVEL_5, $USR_ERR);
+ }
+ $last_line_length_lt_std_flag = 0;
+
+ # check current line for over-length problem
+ if ( $line_len > $first_data_line_length ) {
+ $self->{error_cnt}++;
+ $self->_errorHandler("Expected: FASTA data definition " .
+ "lines should be $first_data_line_length bases " .
+ "(characters) across. Only the last line of a sequence ".
+ "data definition may be less than " .
+ "$first_data_line_length bases (characters) ".
+ "across, if applicable. See line " . $line_number . '.',
+ $DEBUG_LEVEL_5,$USR_ERR);
+ }
+
+ #check current line for under-length problem; report only if not
+ #the last line in the data definition
+ elsif ( $line_len < $first_data_line_length ) {
+ $last_line_length_lt_std_flag = 1;
+ }
+ }
+ $preceding_header_flag = 0;
+ }
+ # check for FASTA header
+ elsif ( ( isValidFASTAheader($line) ) != 0 ) {
+ if ( ! defined ( $self->{active_record} ) ) {
+ $self->{active_record} = -1;
+ }
+
+ $self->{active_record}++;
+
+ if( (defined $line_number) &&
+ ($line_number > 1) ) {
+ $pos2 = (($sum_len - $line_len)-2);
+ $pos1 = $pos2+1;
+
+ if((defined $pos1) && ( defined $string)) {
+ $string .= "$pos2";
+ # store the start and end of a fasta record in a hash
+ $self->{number_to_fp_array}->{($self->{active_record})-1} =
+ $string;
+ }
+ }
+
+ if(defined $pos1) {
+ $string = "$pos1 ";
+ }
+
+ # check if previous line was a FASTA header
+ if ( $preceding_header_flag == 1 ) {
+ $self->_nullRecordHandler($self->{active_record} - 1,
+ $line_number);
+ }
+
+ # check if previous line was empty
+ if ( $empty_line_found == 1 ) {
+ $self->{error_cnt}++;
+ $self->_errorHandler("ERROR: Empty line found at line ".
+ ($line_number - 1). " - empty lines are ".
+ "allowed only at the end of a file",
+ $DEBUG_LEVEL_5, $USR_ERR);
+ $empty_line_found = 0;
+ }
+ # if it's a valid FASTA header, then don't need to check again
+ # extract the record IDENTIFIER
+ $record_identifier = _headerToIdentifier($line);
+ if ( defined (
+ $self->{identifier_to_number_hash}->{$record_identifier} ) ) {
+ $self->{error_cnt}++;
+ $self->_errorHandler("Expected: unique FASTA " .
+ "identifier. \'$record_identifier\' is a duplicate at " .
+ "line $line_number.", $DEBUG_LEVEL_5, $USR_ERR);
+ }
+ else {
+ $self->{identifier_to_number_hash}->{$record_identifier} =
+ $self->{active_record};
+ $self->{number_to_identifier_array}->{$self->{active_record}} =
+ $record_identifier;
+ }
+
+ # set up the variables for parsing a new record
+ $last_line_length_lt_std_flag = 0;
+ $preceding_header_flag = 1;
+ $self->{num_records}++;
+ }
+ # handle empty space
+ # empty space after the last record is allowed
+ elsif($line eq "") {
+ $empty_line_found = 1;
+ next;
+ }
+ # handle error data types
+ else {
+ $self->{error_cnt}++;
+ # check if previous line was empty
+ if ( $empty_line_found == 1 ) {
+ $self->{error_cnt}++;
+ $self->_errorHandler("ERROR: Empty line found at line ".
+ ($line_number - 1). " - empty lines are ".
+ "allowed only at the end of a file",
+ $DEBUG_LEVEL_5, $USR_ERR);
+ $empty_line_found = 0;
+ }
+
+ # line has a separator token in it, so it may be header
+ if ( $line =~ /$UNBOUND_FASTA_SEPARATOR/ ) {
+ $self->_errorHandler("Expected: record header " .
+ "information in FASTA record header. Got: \'$line\' at " .
+ "line $line_number.", $DEBUG_LEVEL_6, $USR_ERR);
+ $last_line_length_lt_std_flag = 0;
+ }
+ # if last data line was small, expect this to be a header too
+ elsif ( $last_line_length_lt_std_flag == 1 ) {
+ $self->_errorHandler("Expected: FASTA record header " .
+ "beginning with \'>\'. Got: \'$line\' at line ".
+ "$line_number.",$DEBUG_LEVEL_6, $USR_ERR);
+ $last_line_length_lt_std_flag = 0;
+ }
+ elsif ( ( defined ( $record_identifier ) ) &&
+ ( $record_identifier !~ /<undefined>/ ) ) {
+ $self->_errorHandler("Expected: valid FASTA data " .
+ "definition for record identifier \'$record_identifier\'. " .
+ "Check sequence content at line $line_number for invalid " .
+ "bases (data type: invalid data).", $DEBUG_LEVEL_6,
+ $USR_ERR);
+ }
+ else {
+ $self->_errorHandler("Expected: FASTA record header " .
+ "followed by definition of sequence. Invalid input at " .
+ "line $line_number.", $DEBUG_LEVEL_6, $USR_ERR);
+ }
+ }
+ } # end while
+
+ $pos2 = $sum_len;
+ if((defined $pos1) && ( defined $string)) {
+ $string .= "$pos2";
+ # store the start and end of a fasta record in a hash
+ $self->{number_to_fp_array}->{$self->{active_record}} = $string;
+ }
+
+ # check terminal case data definition
+ if ( $preceding_header_flag == 1 ) {
+ $self->_nullRecordHandler($self->{active_record}, $line_number);
+ }
+
+ $self->{active_record} = -1; # set counter to the beginning
+
+ return ( $self->{error_cnt} == 0 ) ? 1 : 0;
+ }
+
+
+# $obj_instance->_nullRecordHandler($$);
+
+#This method handles the case of a null or equivalently empty record
+#encountered during parsing. It logs the appropriate message to the
+#TIGR Foundation object. The only arguments are the record number
+#and the line number.
+
+ sub _nullRecordHandler($$) {
+ my $self = shift;
+ my $active_num = shift;
+ my $line_number = shift;
+ my $preceding_rec_line_number = undef;
+ my $record_identifier = undef;
+
+ if ( defined ( $self->{number_to_identifier_array}->
+ {$active_num} ) ) {
+ $record_identifier = $self->{number_to_identifier_array}->
+ {$active_num};
+ }
+ else {
+ $record_identifier = "<unknown>";
+ }
+
+ if(defined $line_number) {
+ if((defined $active_num) &&
+ ($active_num < ($self->{active_record}))) {
+ $preceding_rec_line_number = $line_number-1;
+ }
+ elsif((defined $active_num) &&
+ ($active_num == ($self->{active_record}))) {
+ $preceding_rec_line_number = $line_number;
+ }
+ }
+ else {
+ $preceding_rec_line_number = "<unknown>";
+ }
+
+ $self->{error_cnt}++;
+ if ( $self->{db_handle}->eof() == 1 ) {
+ $self->_errorHandler("Expected: FASTA record header " .
+ "followed by definition of sequence. Record identifier " .
+ "\'" . $record_identifier . "\' is undefined from line " .
+ $preceding_rec_line_number . ". Got end of file after line " .
+ $line_number . ".", $DEBUG_LEVEL_5, $USR_ERR);
+ }
+ else {
+ $self->_errorHandler("Expected: FASTA record header " .
+ "followed by definition of sequence. Record identifier " .
+ "\'" . $record_identifier . "\' is undefined from line " .
+ $preceding_rec_line_number . ". Got FASTA header at line " .
+ $line_number . ".", $DEBUG_LEVEL_5, $USR_ERR);
+ }
+ }
+
+
+# $message = $obj_instance->_errorHandler($message, $tf_level,
+# $internal_log_flag);
+
+#This method handles logging to the TIGR::Foundation module and
+#internal error record reference array. The C<$message> argument is logged
+#to the appropriate service. The C<$tf_level> parameter specifies the
+#logging level for TIGR::Foundation, while the C<$internal_log_flag> parameter
+#specifies if C<$message> should be written to the internal array reference
+#specified in C<new()>. If a TIGR::Foundation instance does not exist,
+#no logging to that facility occurs. This method returns C<$message>.
+
+ sub _errorHandler($$$) {
+
+ my $self = shift;
+
+ my ( $message, $tf_level, $log_facility ) = @_;
+
+ if ( defined ($message) &&
+ defined ($tf_level) &&
+ defined ($log_facility) ) {
+
+ if ( defined ($self->{foundation}) ) {
+ if ( $log_facility != $USR_ERR ) { # all user errors go to .error
+ $self->{foundation}->logLocal($message, $tf_level);
+ }
+ else {
+ $self->{foundation}->logError($message);
+ }
+ }
+
+ if ( ( defined ($self->{error_ref}) ) &&
+ ( $log_facility == $USR_ERR ) ) {
+ push @{$self->{error_ref}}, $message;
+ }
+ }
+ return $message;
+ }
+
+=head1 USAGE
+
+To use this module, load the C<TIGR::FASTAreader> package via the
+C<use> function. Then, create a new instance of the object via the
+C<new()> method, as shown below. There are several invocations possible
+for this method since all parameters to C<new()> are optional.
+To access records from the C<TIGR::FASTAreader> instance, the
+C<TIGR::FASTArecord> package must be loaded via the C<use> function.
+An example script using this module follows. The C<TIGR::Foundation>
+module is included for completeness but does not have to be used.
+
+ #!/usr/local/bin/perl -w
+
+ # This script accepts FASTA files with the '-i' option
+ # on the command line and validates every one in turn.
+ # Parse errors are collected to the '@errors_list' array.
+ # This program concatenates all of the records together to
+ # one output file specified with the '-o' option.
+ # NOTE: The '-i' option must be specified before every input file.
+ # NOTE: The 'TIGR::FASTAwriter' module is intended for writing
+ # FASTA records.
+
+ use strict;
+ use TIGR::FASTAreader;
+ use TIGR::FASTArecord;
+
+ MAIN:
+ {
+ my $tf_object = new TIGR::Foundation;
+ my @errors_list = ();
+ my @input_files = ();
+ my $output_file = undef;
+
+ # Capture the return code from the TIGR::Foundation method
+ my $result = $tf_object->TIGR_GetOptions('i=s' => \@input_files,
+ 'o=s' => \$output_file);
+ if ( $result != 1 ) {
+ $tf_object->bail("Invalid command line options.");
+ }
+
+ # Create a TIGR::FASTAreader instance using TIGR::Foundation and
+ # an error message list.
+ my $fasta_reader = new TIGR::FASTAreader $tf_object, \@errors_list;
+
+ if ( !( defined ( $output_file ) &&
+ open OUTFILE, ">$output_file" ) ) {
+ $tf_object->bail("Cannot open output file for writing.");
+ }
+
+ foreach my $in_file ( @input_files ) {
+ $fasta_reader->open($in_file) or
+ $tf_object->logLocal("Cannot open or read file $in_file", 2);
+
+ if ( scalar(@errors_list) > 0 ) { # are there parse errors?
+ while ( @errors_list ) { # get the messages from the list
+ my $message = shift @errors_list;
+ print STDERR $message, "\n";
+ }
+ }
+
+ while ( $fasta_reader->hasNext() ) {
+ # print each record to OUTFILE
+ print OUTFILE $fasta_reader->next()->toString();
+ }
+ }
+ }
+
+=cut
+
+}
+
+1;
diff --git a/src/PerlModules/FASTArecord.pm b/src/PerlModules/FASTArecord.pm
new file mode 100644
index 0000000..62ea5f6
--- /dev/null
+++ b/src/PerlModules/FASTArecord.pm
@@ -0,0 +1,479 @@
+# $Id$
+
+# Copyright @ 2002 - 2010 The Institute for Genomic Research (TIGR).
+# All rights reserved.
+#
+# This software is provided "AS IS". TIGR makes no warranties, express or
+# implied, including no representation or warranty with respect to the
+# performance of the software and derivatives or their safety,
+# effectiveness, or commercial viability. TIGR does not warrant the
+# merchantability or fitness of the software and derivatives for any
+# particular purpose, or that they may be exploited without infringing the
+# copyrights, patent rights or property rights of others.
+#
+# This software program may not be sold, leased, transferred, exported or
+# otherwise disclaimed to anyone, in whole or in part, without the prior
+# written consent of TIGR.
+
+package TIGR::FASTArecord;
+{
+
+=head1 NAME
+
+TIGR::FASTArecord - TIGR::FASTArecord class describing FASTA records
+
+=head1 SYNOPSIS
+
+ use TIGR::FASTArecord;
+ my $obj_instance = new TIGR::FASTArecord ($record_header,
+ $record_data);
+
+=head1 DESCRIPTION
+
+This module provides an object definition for a FASTA record. It verifies
+data entry on creation, and returns information queried on the record.
+
+=cut
+
+ BEGIN {
+ require 5.006_00;
+ }
+
+ use strict;
+ use TIGR::FASTAgrammar ':public';
+ use TIGR::FASTAgrammar ':private';
+
+ ## external variables
+
+ my $OUTPUT_LINE_LENGTH_REF = \$TIGR::FASTAgrammar::OUTPUT_LINE_LENGTH;
+ my $UNBOUND_FASTA_SEPARATOR = $TIGR::FASTAgrammar::UNBOUND_FASTA_SEPARATOR;
+
+ ## internal variables and identifiers
+
+ our $REVISION = (qw$Revision$)[-1];
+ our $VERSION = '1.2';
+ our $VERSION_STRING = "$VERSION (Build $REVISION)";
+ our @DEPEND = ();
+
+ ## prototypes
+
+ sub new($$);
+ sub equals($);
+ sub getHeader();
+ sub getIdentifier();
+ sub getData();
+ sub size();
+ sub toString();
+ sub reverseComplement($);
+ sub reverseComplementData();
+ sub subSequence($;$);
+ sub unGap();
+
+ ## implementation
+
+=over
+
+=item $obj_instance = new TIGR::FASTArecord ($header, $data_rec);
+
+This method returns a new instance of a TIGR::FASTArecord object. It takes
+a record header, C<$header>, and the record data, C<$data_rec> as parameters.
+The record header may optionally contain the leading header character, a
+C<<gt>> symbol. Both parameters are parsed. A new object instance is
+returned on success. If parsing fails or a record cannot be created, this
+method returns undefined.
+
+=cut
+
+
+ sub new($$) {
+ my $pkg = shift;
+ my $header = shift;
+ my $data_rec = shift;
+ my $self = undef;
+ my $identifier = undef;
+
+ if ( ( defined ($header) ) &&
+ ( $header =~ s[^($UNBOUND_FASTA_SEPARATOR){0,1}(.*)] # accept no
+ [$UNBOUND_FASTA_SEPARATOR$2] ) && # separator
+ ( defined ($data_rec) ) &&
+ ( defined($identifier = _headerToIdentifier($header)) ) &&
+ #
+ # parsable id.
+ ( isValidFASTAdata($data_rec) != 0 ) ) { # valid data?
+ $self = {};
+ bless $self, $pkg;
+
+ chomp($header);
+ chomp($data_rec);
+
+ $self->{header} = $header;
+ $self->{identifier} = $identifier;
+ $self->{data_rec} = $data_rec;
+ $self->{rec_size} = length($data_rec); # compute size
+ }
+ return $self;
+ }
+
+
+=item $result = $obj_instance->equals($fasta_obj);
+
+This method takes a I<TIGR::FASTArecord> object as a parameter. It compares
+the passed object with the calling object's internal structures to test for
+equality. If the two objects are equal, this method returns true (1).
+Otherwise, this method returns false (undefined).
+
+=cut
+
+
+ sub equals($) {
+ my $self = shift;
+ my $other_obj = shift;
+ my $return_val = undef;
+
+ if ( ( defined ($other_obj) ) &&
+ ( $self->toString() eq $other_obj->toString() )
+ ) {
+ $return_val = 1;
+ }
+ else {
+ $return_val = undef;
+ }
+
+ return $return_val;
+ }
+
+
+=item $identifier = $obj_instance->getHeader();
+
+This method returns the header string for the record.
+
+=cut
+
+
+ sub getHeader() {
+ my $self = shift;
+ my $header = $self->{header}; # should always be defined
+ if (! isValidFASTAheader($header) ) {
+ # need to prepend an $UNBOUND_FASTA_SEPARATOR
+ $header = $UNBOUND_FASTA_SEPARATOR . $header;
+ }
+ return $header;
+ }
+
+
+=item $identifier = $obj_instance->getIdentifier();
+
+This method returns the identifier string for the record.
+
+=cut
+
+
+ sub getIdentifier() {
+ my $self = shift;
+ return $self->{identifier}; # should always be defined
+ }
+
+
+=item $data_contents = $obj_instance->getData();
+
+This method returns the data contents of the record as an
+uninterrupted string.
+
+=cut
+
+
+ sub getData() {
+ my $self = shift;
+ return $self->{data_rec}; # should always be defined
+ }
+
+
+=item $size_of_rec = $obj_instance->size();
+
+This method returns the size of the data string contained by the
+record.
+
+=cut
+
+
+ sub size() {
+ my $self = shift;
+ return $self->{rec_size}; # should always be defined
+ }
+
+
+=item $str_rep = $obj_instance->toString();
+
+This method returns a string representation of the FASTA record.
+This string representation conforms to the TIGR definition of a
+FASTA record.
+
+=cut
+
+
+ sub toString() {
+ my $self = shift;
+ my $data_copy = $self->{data_rec};
+ my $str_rep = $self->getHeader() . "\n";
+ my $seg = undef;
+ my @segments = ();
+ my $last_seg = undef;
+ my $skip = undef;
+
+ while((defined($seg = substr $data_copy, 0,
+ $$OUTPUT_LINE_LENGTH_REF,'')) && ($seg ne '')) {
+ $str_rep .= $seg . "\n";
+ }
+ return $str_rep;
+ }
+
+=item $rev_compl_str = $obj_instance->reverseComplement($NA_strand);
+
+This method takes in a string which represents a Nucleotide strand and
+returns the reverse complement of the strand. If the string does not
+represent a Nucleotide strand or is undefined, the method returns undefined.
+When an empty string is passed into the method, we get an empty string on
+return.
+
+=cut
+
+
+ sub reverseComplement($) {
+ my $self = shift;
+ my $NA_strand = shift;
+ my $error_condition = 1;
+ my $rev_compl_str = undef;
+ my $validData = 0;
+
+ if((defined ($NA_strand)) &&
+ ($validData = _isNucleotideData($NA_strand)) && ($validData == 1)) {
+
+ $rev_compl_str = '';
+ # taking the complement of the sequence
+ if(!defined( $NA_strand =~ tr/AaCcTtGgUuMmRrWwSsYyKkVvHhDdBbXxNn.-/TtGgAaCcAaKkYyWwSsRrMmBbDdHhVvXxNn.-/)) {
+ $error_condition = undef;
+ }
+ # taking the reverse of the complemented sequence
+ elsif(!defined($rev_compl_str = reverse($NA_strand))) {
+ $error_condition = undef;
+ }
+ }
+ else {
+ $error_condition = undef;
+ }
+ return ( defined ( $error_condition ) ) ? $rev_compl_str : undef;
+ }
+
+
+=item $rev_compl_str = $obj_instance->reverseComplementData();
+
+This method returns the reverse complement of the FASTA record data. If the
+FASTA record data does not represent a Nucleotide strand or is undefined, the
+method returns undefined.
+
+=cut
+
+
+ sub reverseComplementData() {
+ my $self = shift;
+ my $NA_strand = $self->{data_rec};
+ my $error_condition = 1;
+ my $rev_compl_str = undef;
+ my $validData = 0;
+
+ if((defined ($NA_strand)) &&
+ ($validData = _isNucleotideData($NA_strand)) && ($validData == 1)) {
+
+ $rev_compl_str = '';
+ # taking the complement of the sequence
+ if(!defined( $NA_strand =~ tr/AaCcTtGgUuMmRrWwSsYyKkVvHhDdBbXxNn.-/TtGgAaCcAaKkYyWwSsRrMmBbDdHhVvXxNn.-/)) {
+ $error_condition = undef;
+ }
+ # taking the reverse of the complemented sequence
+ elsif(!defined($rev_compl_str = reverse($NA_strand))) {
+ $error_condition = undef;
+ }
+ }
+ else {
+ $error_condition = undef;
+ }
+ return ( defined ( $error_condition ) ) ? $rev_compl_str : undef;
+ }
+
+
+=item $data_substr = $obj_instance->subSequence($startpos, $length);
+
+This method behaves like substr(). This method takes in two numbers $startpos
+and $length and returns a substring of the record data. The $startpos for the
+first base in the data is 0. The $length is optional. The substring is
+extracted starting at $startpos characters from the front of the data string.
+If $startpos is negative, the substring starts that far from the end of the
+string instead. If $length is omitted, everything to the end of the string is
+returned. If $length is negative, the length is calculated to leave that many
+characters off the end of the string. Otherwise, $length indicates the length
+of the substring to extract. If $startpos is undefined the function returns
+undefined. If either $startpos or $length are greater than the data length, the
+method returns undefined
+
+=cut
+
+
+ sub subSequence($;$) {
+ my $self = shift;
+ my ($startpos, $length) = @_;
+ my $data_str = $self->getData();
+ my $data_substr = undef;
+ my $strlen = length($data_str);
+
+ if((defined ($data_str)) && (defined ($startpos)) &&
+ (defined ($length)) && (abs($startpos) < $strlen) &&
+ (abs($length) <= $strlen)) {
+ #both parameters are specified
+ $data_substr = substr($data_str, $startpos, $length);
+ }
+ elsif((defined ($data_str)) && (defined ($startpos)) &&
+ (!defined ($length)) && (abs($startpos) < $strlen) ) {
+ #only one parameter is specified.
+ $data_substr = substr($data_str, $startpos);
+ }
+ else {
+ #either $data_str is undefined or $startpos is undefined so do
+ #nothing.
+ }
+ return $data_substr;
+ }
+
+=item $result = $obj_instance->unGap();
+
+This method removes all the gaps('-' characters) from the record data. The
+record size is changed after the gaps are removed. The method returns 1 on
+success and undefined otherwise.
+
+=cut
+
+
+ sub unGap() {
+ my $self = shift;
+ my $data_str = $self->getData();
+ my $result = 1;
+ if((defined ($data_str)) && ($data_str =~ /[-]+/)) {
+ #removing the gaps in the data.
+ $data_str =~ s/[-]+//g;
+ $self->{data_rec} = $data_str;
+ $self->{rec_size} = length($data_str);
+
+ }
+ elsif(!defined ($data_str)) {
+ $result = undef;
+ }
+ return $result;
+ }
+
+=back
+
+
+
+=head1 USAGE
+
+To use this module, load it using the C<use> function. The object must
+be initialized with a header and a data string. An example follows.
+Please refer to the C<TIGR::FASTAreader> package usage for more examples.
+
+ #!/usr/local/bin/perl -w
+
+ use strict;
+ use TIGR::FASTArecord;
+
+ MAIN:
+ {
+
+ # set up a simple example without using the leading carot.
+ my $header1 = "ORF00001 The first ORF in the series";
+ my $data1 =
+ "MEEISTPEGGVLVPISIETEVKRAYIDYSMSVIVSRALPDVRDGLKPVHRRILYAMEEKG" .
+ "LRFSGPTRKCAKIVGDVLGSFHPHGDASVYDALVRLGQDFSLRYPVIHPQGNFGTIGGDP" .
+ "PAAYRYTEAKMARIAESMVEDIKKETVSFVPNFDDSDVEPTVLPGRFPFLLANGSSGIAV" .
+ "GMTTNMPPHNLREIAAAISAYIENPNLSIQELCDCINGPDFPTGGIIFGKNGIRQSYETG" .
+ "RGKIVVRARFTIETDSKGRDTIIFTEVPYQVNTTMLVMRIGELARAKVIEGIANVNDETS" .
+ "DRTGLRIVVELKKGTPAQVVLNHLFAKTPLQSSFNVINLALVEGRPRMLTLKDLVRYFVE" .
+ "HRVDVVTRRAHFELRKAQERIHLVRALIRALDAIDKIITLIRHSQNTELAKQRLREQFDF" .
+ "DNVQAQAIVDMQMKRLTGLEVESLRTELKDLTELISSLEELLTSPQKVLGVVKKETRDIA" .
+ "DMFGDDRRTDIVSNEIEYLDVEDFIQKEEMVILISHLGYIKRVPVSAYRNQNRGGKGSSS" .
+ "ANLAAHDFISQIFTASTHDYVMFVTSRGRAYWLKVYGIPESGRANRGSHIKSLLMVATDE" .
+ "EITAIVSLREFSNKSYVFMATARGVVKKVTTDNFVNAKTRGIIALKLSGGDTLVSAVLVQ" .
+ "DEDEVMLITRQGKALRMSGREVREMGRNSSGVIGIKLTSEDLVAGVLRVSEQRKVLIMTE" .
+ "NGYGKRVSFSEFSVHGRGTAGQKIYTQTDRKGAIIGALAVLDTDECMCITGQGKTIRVDV" .
+ "CAISVLGRGAQGVRVLDIEPSDLVVGLSCVMQG";
+
+ my $fasta_record = new TIGR::FASTArecord $header1, $data1;
+ if ( defined ( $fasta_record ) ) {
+ print STDOUT "Sequence " . $fasta_record->getIdentifier() . " is " .
+ $fasta_record->size() . " residues.\n";
+ print STDOUT $fasta_record->toString();
+ }
+ else {
+ die "Invalid FASTA record 1";
+ }
+
+ # but this header is also valid.
+ my $header2 = ">ORF00001 The first ORF in the series";
+ my $data2 =
+ "MEEISTPEGGVLVPISIETEVKRAYIDYSMSVIVSRALPDVRDGLKPVHRRILYAMEEKG" .
+ "LRFSGPTRKCAKIVGDVLGSFHPHGDASVYDALVRLGQDFSLRYPVIHPQGNFGTIGGDP" .
+ "PAAYRYTEAKMARIAESMVEDIKKETVSFVPNFDDSDVEPTVLPGRFPFLLANGSSGIAV" .
+ "GMTTNMPPHNLREIAAAISAYIENPNLSIQELCDCINGPDFPTGGIIFGKNGIRQSYETG" .
+ "RGKIVVRARFTIETDSKGRDTIIFTEVPYQVNTTMLVMRIGELARAKVIEGIANVNDETS" .
+ "DRTGLRIVVELKKGTPAQVVLNHLFAKTPLQSSFNVINLALVEGRPRMLTLKDLVRYFVE" .
+ "HRVDVVTRRAHFELRKAQERIHLVRALIRALDAIDKIITLIRHSQNTELAKQRLREQFDF" .
+ "DNVQAQAIVDMQMKRLTGLEVESLRTELKDLTELISSLEELLTSPQKVLGVVKKETRDIA" .
+ "DMFGDDRRTDIVSNEIEYLDVEDFIQKEEMVILISHLGYIKRVPVSAYRNQNRGGKGSSS" .
+ "ANLAAHDFISQIFTASTHDYVMFVTSRGRAYWLKVYGIPESGRANRGSHIKSLLMVATDE" .
+ "EITAIVSLREFSNKSYVFMATARGVVKKVTTDNFVNAKTRGIIALKLSGGDTLVSAVLVQ" .
+ "DEDEVMLITRQGKALRMSGREVREMGRNSSGVIGIKLTSEDLVAGVLRVSEQRKVLIMTE" .
+ "NGYGKRVSFSEFSVHGRGTAGQKIYTQTDRKGAIIGALAVLDTDECMCITGQGKTIRVDV" .
+ "CAISVLGRGAQGVRVLDIEPSDLVVGLSCVMQG";
+
+ my $fasta_record2 = new TIGR::FASTArecord $header2, $data2;
+ if ( defined ( $fasta_record2 ) ) {
+ print STDOUT "Sequence " . $fasta_record2->getIdentifier() . " is " .
+ $fasta_record2->size() . " residues.\n";
+ print STDOUT $fasta_record2->toString();
+ }
+ else {
+ die "Invalid FASTA record 2";
+ }
+
+ # this entry fails; note the 'J' in the second line of data (8th char.)
+ my $header3 = "ORF00001 The first ORF in the series";
+ my $data3 =
+ "MEEISTPEGGVLVPISIETEVKRAYIDYSMSVIVSRALPDVRDGLKPVHRRILYAMEEKG" .
+ "LRFSGPTJKCAKIVGDVLGSFHPHGDASVYDALVRLGQDFSLRYPVIHPQGNFGTIGGDP" .
+ "PAAYRYTEAKMARIAESMVEDIKKETVSFVPNFDDSDVEPTVLPGRFPFLLANGSSGIAV" .
+ "GMTTNMPPHNLREIAAAISAYIENPNLSIQELCDCINGPDFPTGGIIFGKNGIRQSYETG" .
+ "RGKIVVRARFTIETDSKGRDTIIFTEVPYQVNTTMLVMRIGELARAKVIEGIANVNDETS" .
+ "DRTGLRIVVELKKGTPAQVVLNHLFAKTPLQSSFNVINLALVEGRPRMLTLKDLVRYFVE" .
+ "HRVDVVTRRAHFELRKAQERIHLVRALIRALDAIDKIITLIRHSQNTELAKQRLREQFDF" .
+ "DNVQAQAIVDMQMKRLTGLEVESLRTELKDLTELISSLEELLTSPQKVLGVVKKETRDIA" .
+ "DMFGDDRRTDIVSNEIEYLDVEDFIQKEEMVILISHLGYIKRVPVSAYRNQNRGGKGSSS" .
+ "ANLAAHDFISQIFTASTHDYVMFVTSRGRAYWLKVYGIPESGRANRGSHIKSLLMVATDE" .
+ "EITAIVSLREFSNKSYVFMATARGVVKKVTTDNFVNAKTRGIIALKLSGGDTLVSAVLVQ" .
+ "DEDEVMLITRQGKALRMSGREVREMGRNSSGVIGIKLTSEDLVAGVLRVSEQRKVLIMTE" .
+ "NGYGKRVSFSEFSVHGRGTAGQKIYTQTDRKGAIIGALAVLDTDECMCITGQGKTIRVDV" .
+ "CAISVLGRGAQGVRVLDIEPSDLVVGLSCVMQG";
+
+ my $fasta_record3 = new TIGR::FASTArecord $header3, $data3;
+ if ( defined ( $fasta_record3 ) ) {
+ print STDOUT "Sequence " . $fasta_record3->getIdentifier() . " is " .
+ $fasta_record3->size() . " residues.\n";
+ print STDOUT $fasta_record3->toString();
+ }
+ else {
+ die "Invalid FASTA record 3";
+ }
+ }
+
+=cut
+
+}
+
+1;
diff --git a/src/PerlModules/FASTAwriter.pm b/src/PerlModules/FASTAwriter.pm
new file mode 100644
index 0000000..55bcb41
--- /dev/null
+++ b/src/PerlModules/FASTAwriter.pm
@@ -0,0 +1,408 @@
+# $Id$
+
+# Copyright @ 2002 - 2010 The Institute for Genomic Research (TIGR).
+# All rights reserved.
+#
+# This software is provided "AS IS". TIGR makes no warranties, express or
+# implied, including no representation or warranty with respect to the
+# performance of the software and derivatives or their safety,
+# effectiveness, or commercial viability. TIGR does not warrant the
+# merchantability or fitness of the software and derivatives for any
+# particular purpose, or that they may be exploited without infringing the
+# copyrights, patent rights or property rights of others.
+#
+# This software program may not be sold, leased, transferred, exported or
+# otherwise disclaimed to anyone, in whole or in part, without the prior
+# written consent of TIGR.
+
+package TIGR::FASTAwriter;
+{
+
+=head1 NAME
+
+TIGR::FASTAwriter - TIGR::FASTAwriter class for writing TIGR::FASTArecord
+objects to a file
+
+=head1 SYNOPSIS
+
+ use TIGR::FASTAwriter;
+ my $obj_instance = new TIGR::FASTAwriter ($tigr_foundation_obj,
+ $output_file_name);
+
+=head1 DESCRIPTION
+
+This module provides an object definition for a TIGR::FASTAwriter.
+The TIGR::FASTAwriter object accepts TIGR::FASTArecord objects for
+printing to an output file.
+
+=cut
+
+ BEGIN {
+ require 5.006_00;
+ }
+
+ use strict;
+ use IO::File;
+ use TIGR::FASTArecord;
+
+
+
+ ## internal variables and identifiers
+
+ our $REVISION = (qw$Revision$)[-1];
+ our $VERSION = '1.0';
+ our $VERSION_STRING = "$VERSION (Build $REVISION)";
+ our @DEPEND = ();
+
+ my $SYS_ERR = 0; # this flag specifies non-user related error
+ my $USR_ERR = 1; # this flag specifies user related error
+
+ #debugging scheme
+ #
+ # Debugging via the TIGR Foundation uses increasing log levels based on
+ # nesting. 'MAIN' starts at level 1. Every nest increments the level by 1.
+ # Subroutines always start nesting at level 2. As debugging levels
+ # increase, logging is more verbose. This makes sense as you log at
+ # greater depth (ie. deeper branching).
+ #
+ # The following definitions help emphasize the debugging in the program.
+ #
+ my $DEBUG_LEVEL_1 = 1;
+ my $DEBUG_LEVEL_2 = 2;
+ my $DEBUG_LEVEL_3 = 3;
+ my $DEBUG_LEVEL_4 = 4;
+ my $DEBUG_LEVEL_5 = 5;
+ my $DEBUG_LEVEL_6 = 6;
+ my $DEBUG_LEVEL_7 = 7;
+ my $DEBUG_LEVEL_8 = 8;
+ my $DEBUG_LEVEL_9 = 9;
+
+ ## prototypes
+
+ sub new(;$$$);
+ sub open($;$);
+ sub close();
+ sub write($);
+ sub _errorHandler($$$);
+
+ ## implementation
+
+=over
+
+=item $obj_instance = new TIGR::FASTAwriter ($foundation_object,
+ $error_array_ref, $output_file);
+
+This method returns a new instance of a TIGR::FASTAwriter object. It takes
+three optional parameters: a TIGR::Foundation object (C<$foundation_object>),
+a reference to an array for logging user error messages (C<$error_array_ref>),
+and an output file name, C<$output_file>, as parameters. A new object instance
+is returned on success and successful opening of a specified output
+file.
+If the file supplied cannot be opened, this method returns undefined.
+This method also returns undefined if the parameters supplied are invalid.
+Writing errors are written to the array at C<$error_array_ref> and the
+log file.
+
+=cut
+
+
+ sub new(;$$$) {
+
+ my $pkg = shift;
+ my @method_args = @_;
+
+ my $error_condition = 0;
+ my $self = {};
+ bless $self, $pkg;
+
+ if ( ( scalar (@method_args) > 0 ) &&
+ ( ( ref ($method_args[0]) ) =~ /foundation/i ) ) {
+ $self->{foundation} = shift @method_args;
+ $self->_errorHandler("Got TIGR::Foundation in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+ else {
+ $self->{foundation} = undef;
+ $self->_errorHandler("No TIGR::Foundation in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+
+ if ( ( scalar (@method_args) > 0 ) &&
+ ( ( ref ($method_args[0]) ) =~ /array/i ) ) {
+ $self->{error_ref} = shift @method_args;
+
+ $self->_errorHandler("Got Error ARRAY in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+ else {
+ $self->{error_ref} = undef;
+ $self->_errorHandler("No Error ARRAY in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+
+ if ( ( scalar (@method_args) > 0 ) &&
+ ( ! ref ($method_args[0]) ) ) {
+ my $filename = shift @method_args;
+ if(defined($filename)) {
+ $self->{db_file_name} = $filename ;
+ $self->_errorHandler("Got file name in new()", $DEBUG_LEVEL_4,
+ $SYS_ERR);
+ }
+ else {
+ $self->{db_file_name} = "" ;
+ $self->_errorHandler("undef passed as filename", $DEBUG_LEVEL_4,
+ $USR_ERR);
+ }
+ }
+ else {
+ $self->{db_file_name} = undef;
+ $self->_errorHandler("No file name in new()", $DEBUG_LEVEL_3,
+ $SYS_ERR);
+ }
+
+ # check for invocation errors
+ if ( ( scalar (@method_args) > 0 ) ) {
+ $error_condition = 1;
+ $self->_errorHandler("Too many parameters passed to new() method",
+ $DEBUG_LEVEL_3, $SYS_ERR);
+ }
+ elsif ((defined ( $self->{db_file_name} )) &&
+ (! defined ( $self->open($self->{db_file_name}, "w") ) )) {
+ # the error message is logged via the open() routine
+ $self = undef;
+ }
+
+ return ( $error_condition == 0 ) ? $self : undef;
+
+ }
+
+
+=item $result = $obj_instance->open($file_name, $flag);
+
+This method opens a FASTA file for writing or appending. The file,
+F<$file_name>, is opened using the C<open()> flags specified by C<$flag>.
+Supported flags include 'w' and 'a'. On success, this method returns 1.
+The default C<open()> method is 'w', or truncated open. If the file cannot
+be opened, this method returns undefined.
+
+=cut
+
+
+ sub open($;$) {
+ my $self = shift;
+ my $db_file_name = shift;
+ my $open_flags = shift;
+
+ my $error_condition = 0;
+
+ if ( ( ! defined ($open_flags) ) ||
+ ( ( $open_flags !~ /^w$/i ) &&
+ ( $open_flags !~ /^a$/i ) ) ) {
+ $open_flags = "w";
+ }
+
+ # close a previously open file
+ if ( defined ($self->{db_handle}) ) {
+ $self->close();
+ }
+
+ if (!(
+ ( defined ( $db_file_name ) ) &&
+ ( $self->{db_file_name} = $db_file_name ) &&
+ ( defined ( $self->{db_file_name} )) &&
+ ( defined ( $self->{db_handle} =
+ new IO::File $self->{db_file_name}, $open_flags ))
+ ) ) {
+ $error_condition = 1;
+ $self->_errorHandler(
+ "Cannot open file \'$self->{db_file_name}\'", $DEBUG_LEVEL_3,
+ $USR_ERR);
+ }
+ return ($error_condition == 1) ? undef : 1;
+ }
+
+
+=item $result = $obj_instance->close();
+
+This method closes the object file stream and resets all internal data
+structures. The result of the operation is returned. If the file stream
+is closed successfully, this object returns true (1), otherwise false
+(undefined).
+
+=cut
+
+
+ sub close() {
+ my $self = shift;
+ my $return_val = undef;
+
+ if ( defined ( $self->{db_handle} ) ) {
+ $return_val = $self->{db_handle}->close();
+ if ( ! defined ($return_val) ) {
+ $return_val = undef;
+ $self->_errorHandler(
+ "Error closing FASTA file: $self->{db_file_name}",
+ $DEBUG_LEVEL_4, $USR_ERR);
+ }
+ }
+ $self->{db_file_name} = undef;
+ $self->{db_handle} = undef;
+ return $return_val;
+ }
+
+
+=item $result = $obj_instance->write($fasta_obj);
+
+This method takes a TIGR::FASTArecord object, C<$fasta_obj>, and writes it
+to the file specified in C<new()> or C<open()>. On success, this method
+returns true (1). On error, this method returns false (undefined) and logs
+an error message.
+
+=cut
+
+
+ sub write($) {
+ my $self = shift;
+ my $fasta_obj = shift;
+ my $return_val = 1;
+
+ if ( ( defined ($fasta_obj) ) &&
+ ( ( ref($fasta_obj) ) =~ /fastarecord/i ) &&
+ ( defined ($self->{db_handle}) ) ) {
+
+ if ( $self->{db_handle}->print($fasta_obj->toString()) ) {
+ $return_val = 1;
+ }
+ else {
+
+ $return_val = undef;
+ $self->_errorHandler(
+ "Error printing to FASTA file: $self->{db_file_name}",
+ $DEBUG_LEVEL_3, $USR_ERR);
+ }
+ }
+ else {
+ $return_val = undef;
+ $self->_errorHandler(
+ "Invalid method of initialization for " .
+ "TIGR::FASTAwriter", $DEBUG_LEVEL_3, $USR_ERR);
+ }
+ return $return_val;
+ }
+
+# $message = $obj_instance->_errorHandler($message, $tf_level,
+# $internal_log_flag);
+
+#This method handles logging to the TIGR::Foundation module and
+#internal error record reference array. The C<$message> argument is logged
+#to the appropriate service. The C<$tf_level> parameter specifies the
+#logging level for TIGR::Foundation, while the C<$internal_log_flag> parameter
+#specifies if C<$message> should be written to the internal array reference
+#specified in C<new()>. If a TIGR::Foundation instance does not exist,
+#no logging to that facility occurs. This method returns C<$message>.
+
+
+
+ sub _errorHandler($$$) {
+
+ my $self = shift;
+
+ my ( $message, $tf_level, $log_facility ) = @_;
+
+ if ( defined ($message) &&
+ defined ($tf_level) &&
+ defined ($log_facility) ) {
+
+ if ( defined ($self->{foundation}) ) {
+ if ( $log_facility != $USR_ERR ) { # all user errors go to .error
+ $self->{foundation}->logLocal($message, $tf_level);
+ }
+ else {
+ $self->{foundation}->logError($message);
+ }
+ }
+
+ if ( ( defined ($self->{error_ref}) ) &&
+ ( $log_facility == $USR_ERR ) ) {
+ push @{$self->{error_ref}}, $message;
+ }
+ }
+ return $message;
+ }
+
+
+=back
+
+=head1 USAGE
+
+To use this module, load the C<TIGR::FASTArecord> and C<TIGR::FASTAwriter>
+modules with the C<use> function. Then, create a new instance of the object
+via the C<new()> method, as shown below. There are several invocations
+possible for this method since all parameters to C<new()> are optional.
+An example script using this module follows. The C<TIGR::Foundation>
+module is included for completeness but does not have to be used.
+
+ #!/usr/local/bin/perl -w
+
+ # This example uses the TIGR::FASTAwriter object to write
+ # a simple TIGR::FASTArecord object to a file specified with
+ # the '-o' option to this script.
+ # Writing errors are collected to the '@errors_list' array.
+
+ use strict;
+ use TIGR::Foundation;
+ use TIGR::FASTArecord;
+ use TIGR::FASTAwriter;
+
+ MAIN:
+ {
+ my $tf_object = new TIGR::Foundation;
+ my @errors_list = ();
+ my $output_file = undef;
+
+ my $getopts_result = undef;
+
+ $getopts_result = $tf_object->TIGR_GetOptions( "o=s" => \$output_file );
+
+ if ( $getopts_result != 1 ) {
+ $tf_object->bail("Invalid command line option.");
+ }
+
+ if ( ! defined ( $output_file ) ) {
+ $tf_object->bail("Must specify an output file with the '-o' option");
+ }
+
+ my $header = "ORF00001";
+ my $data = "ATGC";
+
+ my $fasta_record = new TIGR::FASTArecord $header, $data;
+ if ( ! defined ( $fasta_record ) ) {
+ $tf_object->bail("Cannot create TIGR::FASTArecord object");
+ }
+
+ # Create a TIGR::FASTAwriter instance using TIGR::Foundation and
+ # an error message list.
+
+ my $fasta_writer = new TIGR::FASTAwriter $tf_object, \@errors_list;
+
+ $fasta_writer->open($output_file) or
+ $tf_object->logLocal("Cannot open output file $output_file",
+ $DEBUG_LEVEL_1);
+
+ if ( scalar(@errors_list) > 0 ) { # are there parse errors?
+ while ( @errors_list ) { # get the messages from the list
+ my $message = shift @errors_list;
+ print STDERR $message, "\n";
+ }
+ }
+
+ $fasta_writer->write($fasta_record ) or
+ $tf_object->logLocal("Cannot write FASTA record to $output_file",
+ $DEBUG_LEVEL_1);
+ }
+
+=cut
+
+}
+
+1;
diff --git a/src/PerlModules/Foundation.pm b/src/PerlModules/Foundation.pm
new file mode 100644
index 0000000..1960a91
--- /dev/null
+++ b/src/PerlModules/Foundation.pm
@@ -0,0 +1,1863 @@
+# $Id$
+
+# Copyright @ 2002 - 2010 The Institute for Genomic Research (TIGR).
+# All rights reserved.
+#
+# This software is provided "AS IS". TIGR makes no warranties, express or
+# implied, including no representation or warranty with respect to the
+# performance of the software and derivatives or their safety,
+# effectiveness, or commercial viability. TIGR does not warrant the
+# merchantability or fitness of the software and derivatives for any
+# particular purpose, or that they may be exploited without infringing the
+# copyrights, patent rights or property rights of others.
+#
+# This software program may not be sold, leased, transferred, exported or
+# otherwise disclaimed to anyone, in whole or in part, without the prior
+# written consent of TIGR.
+
+package TIGR::Foundation;
+{
+
+=head1 NAME
+
+TIGR::Foundation - TIGR Foundation object
+
+=head1 SYNOPSIS
+
+ use TIGR::Foundation;
+ my $obj_instance = new TIGR::Foundation;
+
+=head1 DESCRIPTION
+
+This module defines a structure for Perl programs to utilize
+logging, version reporting, and dependency checking in a simple way.
+
+=cut
+
+ BEGIN {
+ require 5.006_00; # error if using Perl < v5.6.0
+ }
+
+ use strict;
+ use Cwd;
+ use Cwd 'chdir';
+ use Cwd 'abs_path';
+ use File::Basename;
+ use File::Spec;
+ use Getopt::Long;
+ use IO::Handle;
+ use POSIX qw(strftime);
+ use Sys::Hostname;
+
+ require Exporter;
+
+ our @ISA;
+ our @EXPORT;
+ @ISA = ('Exporter');
+ @EXPORT = qw(
+ isReadableFile
+ isWritableFile
+ isExecutableFile
+ isCreatableFile
+ isReadableDir
+ isWritableDir
+ isCreatableDir
+ isCreatablePath
+
+ getISODate
+ getSybaseDate
+ getMySQLDate
+ getFilelabelDate
+ getLogfileDate
+ );
+
+ ## internal variables and identifiers
+ our $REVISION = (qw$Revision$)[-1];
+ our $VERSION = '1.41';
+ our $VERSION_STRING = "$VERSION (Build $REVISION)";
+ our @DEPEND = (); # there are no dependencies
+
+
+ ## prototypes
+
+ # Functional Class : general
+ sub new();
+ sub getProgramInfo($);
+ sub runCommand($);
+
+ # Functional Class : depend
+ sub printDependInfo();
+ sub printDependInfoAndExit();
+ sub addDependInfo(@);
+
+ # Functional Class : version
+ sub getVersionInfo();
+ sub printVersionInfo();
+ sub printVersionInfoAndExit();
+ sub setVersionInfo($);
+ sub setVersionHandler($);
+
+ # Functional Class : help
+ sub printHelpInfo();
+ sub printHelpInfoAndExit();
+ sub setHelpInfo($);
+
+ # Functional Class : usage
+ sub printUsageInfo();
+ sub printUsageInfoAndExit();
+ sub setUsageInfo($);
+
+ # Functional Class : files
+ sub isReadableFile($);
+ sub isExecutableFile($);
+ sub isWritableFile($);
+ sub isCreatableFile($);
+ sub isReadableDir($);
+ sub isWritableDir($);
+ sub isCreatableDir($);
+ sub isCreatablePath($);
+
+ # Functional Class : temp
+ sub setTempDir($);
+ sub getTempDir();
+
+ # Functional Class : date
+ sub getISODate(;@);
+ sub getSybaseDate(;@);
+ sub getMySQLDate(;@);
+ sub getFilelabelDate(;@);
+ sub getLogfileDate(;@);
+
+ # Functional Class : logging
+ sub setDebugLevel($;$);
+ sub getDebugLevel();
+ sub setLogFile($;$);
+ sub getLogFile();
+ sub getErrorFile();
+ sub printDependInfo();
+ sub invalidateLogFILES();
+ sub cleanLogFILES();
+ sub closeLogERROR();
+ sub closeLogMSG();
+ sub openLogERROR();
+ sub openLogMSG();
+ sub logAppend($;$);
+ sub debugPush();
+ sub debugPop();
+ sub logLocal($$);
+ sub logError($;$);
+ sub bail($;$);
+
+ # Functional Class : modified methods
+ sub TIGR_GetOptions(@);
+
+ ## Implementation
+
+
+# Functional Class : general
+
+=over
+
+=item $obj_instance = new TIGR::Foundation;
+
+This function creates a new instance of the TIGR::Foundation
+object. A reference pointing to the object is returned on success. Otherwise,
+this method returns undefined.
+
+=cut
+
+
+ sub new() {
+ my $self = {};
+ my $pkg = shift;
+
+ # create the object
+ bless $self, $pkg;
+
+ # Get the program name.
+ my $pname = basename($0, () );
+ if ( (defined ($pname) ) && ($pname =~ /^(.*)$/) ) {
+ $pname = $1;
+ $self->{program_name} = $pname ;
+ }
+ if ($self->{program_name} =~ /^-$/) { # check if '-' is the input
+ $self->{program_name} = "STDIN";
+ }
+ # Get the invocation.
+ my $pcommand = join (' ', @ARGV);
+ if ( defined $pcommand ) {
+ $pcommand =~ /^(.*)$/;
+ $pcommand = $1;
+ }
+ else {
+ $pcommand = "";
+ }
+ $self->{invocation} = $pcommand ;
+
+ # The following variables are to contain information specified by
+ # the 'host' program; there are methods of setting and retrieving each.
+ @{$self->{depend_info}} = ();
+ $self->{version_handler} = undef;
+ $self->{version_info} = undef;
+ $self->{help_info} = undef;
+ $self->{usage_info} = undef;
+
+ # These are used for logging.
+ $self->{debug_level} = -1; # debug is negative, no logging
+ @{$self->{debug_store}} = (); # the backup debug level stack
+ @{$self->{debug_queue}} = (); # queue used by MSG routine
+ @{$self->{error_queue}} = (); # queue used by ERROR routine
+ $self->{max_debug_queue_size} = 100; # maximum size for queue before
+ # log entries are expired
+ @{$self->{log_files}} = # these log files are consulted
+ ("$self->{program_name}.log", # on file write error and are
+ "/tmp/$self->{program_name}.$$.log"); # modified by setLogFile
+ $self->{msg_file_open_flag} = 0; # flag to check logLocal file
+ $self->{error_file_open_flag} = 0; # flag to check logError file
+ $self->{msg_file_used} = 0; # flag to indicate if log file
+ $self->{error_file_used} = 0; # has been written to
+ $self->{msg_append_flag} = 0; # by default logs are truncated
+ $self->{error_append_flag} = 0; # by default logs are truncated
+ $self->{log_append_setting} = 0; # (truncate == 0)
+ $self->{static_log_file} = undef; # user defined log file
+
+ # These monitor program execution time.
+ $self->{start_time} = time; # program start time
+ $self->{finish_time} = undef; # program stop time
+
+ # Set where to store temporary files
+ $self->{'temp_dir'} = $self->setTempDir();
+
+ # Set a user name and a host name.
+ $self->{'host_name'} = hostname();
+ if ( ! defined ( $self->{'host_name'} ) ) {
+ $self->{'host_name'} = "NOHOSTNAME";
+ }
+ else {
+ $self->{'host_name'} =~ s/^(\.*)$/$1/; # Taint-check it.
+ }
+
+ # A __WARN__ handler is needed to keep this sane.
+ my $tmp_warn_handler = $SIG{__WARN__} || "DEFAULT";
+ $SIG{__WARN__} = sub {};
+ my @info_arr = getpwuid($<);
+ $self->{'user_name'} = $info_arr[0];
+ $self->{'home_dir'} = $info_arr[7];
+ $SIG{__WARN__} = $tmp_warn_handler;
+ if ( ! defined ( $self->{'user_name'} ) ) {
+ $self->{'user_name'} = "NOUSERNAME";
+ }
+ else {
+ $self->{'user_name'} =~ s/^(\.*)$/$1/g;# Taint check.
+ }
+ if ( ! defined ( $self->{'home_dir'} ) ) {
+ $self->{'home_dir'} = "/";
+ }
+ else {
+ $self->{'home_dir'} =~ s/^(\.*)$/$1/g; # Taint check.
+ }
+
+ $self->logLocal("START: " . $self->{'program_name'} . " " .
+ $self->{'invocation'}, 0);
+ $self->logLocal("Username: " . $self->{'user_name'}, 0);
+ $self->logLocal("Hostname: " . $self->{'host_name'}, 0);
+\
+ return $self;
+ }
+
+
+
+=item $value = $obj_instance->getProgramInfo($field_type);
+
+This function returns field values for specified field types describing
+attributes of the program. The C<$field_type> parameter must be a listed
+attribute: C<name>, C<invocation>, C<env_path>, C<abs_path>.
+The C<name> field specifies the bare name of the executable. The
+C<invocation> field specifies the command line arguments passed to the
+executable. The C<env_path> value returns the environment path to the
+working directory. The C<abs_path> value specifies the absolute path to the
+working directory. If C<env_path> is found to be inconsistent, then that
+value will return the C<abs_path> value. If an invalid C<$field_type> is
+passed, the function returns undefined.
+
+=cut
+
+
+ sub getProgramInfo($) {
+ my $self = shift;
+ my $field_type = shift;
+ my $return_value = undef;
+ if (defined $field_type) {
+ $field_type =~ /^name$/ && do {
+ $return_value = $self->{program_name};
+ };
+ $field_type =~ /^invocation$/ && do {
+ $return_value = $self->{invocation};
+ };
+ $field_type =~ /^env_path$/ && do {
+ my $return_value = "";
+ if (
+ (defined $ENV{'PWD'}) &&
+ (abs_path($ENV{'PWD'}) eq abs_path(".") ) &&
+ ($ENV{'PWD'} =~ /^(.*)$/)
+ ) {
+ $ENV{'PWD'} = $1;
+ $return_value = $ENV{'PWD'};
+ }
+ else {
+ my $tmp_val = abs_path(".");
+
+ if ( (defined ($tmp_val) ) && ($tmp_val =~ /^(.*)$/) ) {
+ $tmp_val = $1;
+ $return_value = $tmp_val;
+ }
+ }
+ return $return_value;
+ };
+
+ $field_type =~ /^abs_path$/ && do {
+ my $tmp_val = abs_path(".");
+
+ if ( (defined ($tmp_val) ) && ($tmp_val =~ /^(.*)$/) ) {
+ $tmp_val = $1;
+ $return_value = $tmp_val;
+ }
+ };
+ }
+ return $return_value;
+ }
+
+=item $exit_code = $obj_instance->runCommand($command_str);
+
+This function passes the argument C<$command_str> to /bin/sh
+for processing. The return value is the exit code of the
+C<$command_str>. If the exit code is not defined, then either the signal or
+core dump value of the execution is returned, whichever is applicable. Perl
+variables C<$?> and C<$!> are set accordingly. If C<$command_str> is not
+defined, this function returns undefined. Log messages are recorded at log
+level 4 to indicate the type of exit status and the corresponding code.
+A failure to start the program (invalid program) results in return code -1.
+
+=cut
+
+
+ sub runCommand($) {
+ my $self = shift;
+ my $command_str = shift;
+ my $exit_code = undef;
+ my $signal_num = undef;
+ my $dumped_core = undef;
+ my $return_value = undef;
+ my $current_dir = $self->getProgramInfo("abs_path");
+
+ # Return if the command string is not set.
+ if ( ! defined ( $command_str ) ) {
+ return undef;
+ }
+
+ # Substitute out the tilde and dot in the directory paths.
+ if ( defined ($ENV{PATH}) ) {
+ ( $ENV{PATH} ) = $ENV{PATH} =~ /^(.*)$/;
+ my @paths = split /:/, $ENV{PATH};
+ for (my $i = 0; $i <= $#paths; $i++) {
+ $paths[$i] =~ s/^~\/?$/$self->{'home_dir'}/g;
+ $paths[$i] =~ s/^\.\/?$/$current_dir/g;
+ }
+ $ENV{PATH} = join(":", @paths);
+ }
+
+ $command_str =~ s/^(.*)$/$1/g; # Taint checking.
+ # Run the command and parse the results.
+ system($command_str);
+ my $return_str = $?;
+ $exit_code = $? >> 8;
+ $signal_num = $? & 127;
+ $dumped_core = $? & 128;
+ if ( $return_str == -1 ) { # Check for invalid program.
+ $self->logLocal("Invalid execution of \'$command_str\'.", 4);
+ $return_value = -1;
+ }
+ elsif ( $dumped_core != 0 ) {
+ $self->logLocal("\'$command_str\' dumped core.", 4);
+ $return_value = $dumped_core;
+ }
+ elsif ( $signal_num != 0 ) {
+ $self->logLocal("\'$command_str\' signalled \'$signal_num\'.", 4);
+ $return_value = $signal_num;
+ }
+ else {
+ $self->logLocal("\'$command_str\' exited \'$exit_code\'.", 4);
+ $return_value = $exit_code;
+ }
+ return $return_value;
+ }
+
+
+# Functional Class : depend
+
+=item $obj_instance->printDependInfo();
+
+The C<printDependInfo()> function prints the dependency list created by
+C<addDependInfo()>. One item is printed per line.
+
+=cut
+
+
+ sub printDependInfo() {
+ my $self = shift;
+ foreach my $dependent (@{$self->{depend_info}}) {
+ print STDERR $dependent, "\n";
+ }
+ }
+
+
+=item $obj_instance->printDependInfoAndExit();
+
+The C<printDependInfoAndExit()> function prints the dependency list created by
+C<addDependInfo()>. One item is printed per line. The function exits with
+exit code 0.
+
+=cut
+
+
+ sub printDependInfoAndExit() {
+ my $self = shift;
+ $self->printDependInfo();
+ exit 0;
+ }
+
+
+=item $obj_instance->addDependInfo(@depend_list);
+
+The C<addDependInfo()> function adds C<@depend_list> information
+to the dependency list. If C<@depend_list> is empty, the internal
+dependency list is emptied. Contents of C<@depend_list> are not checked
+for validity (eg. they can be composed entirely of white space or
+multiple files per record). The first undefined record in C<@depend_list>
+halts reading in of dependency information.
+
+=cut
+
+
+ sub addDependInfo(@) {
+ my $self = shift;
+ my $num_elts = 0;
+ while (my $data_elt = shift @_) {
+ push (@{$self->{depend_info}}, $data_elt);
+ $num_elts++;
+ }
+ if ($num_elts == 0) {
+ @{$self->{depend_info}} = ();
+ }
+ }
+
+
+# Functional Class : version
+
+=item $version_string = $obj_instance->getVersionInfo();
+
+The C<getVersionInfo()> function returns the version information set by the
+C<setVersionInfo()> function.
+
+=cut
+
+
+ sub getVersionInfo() {
+ my $self = shift;
+ return $self->{version_info};
+ }
+
+
+=item $obj_instance->printVersionInfo();
+
+The C<printVersionInfo()> function calls the version handler, if set. If not,
+it prints the version information set by the C<setVersionInfo()> function.
+If there is no defined version information, a message is returned notifying
+the user.
+
+=cut
+
+
+ sub printVersionInfo() {
+ my $self = shift;
+ if ( defined $self->{'version_handler'} ) {
+ $self->{'version_handler'}->();
+ }
+ elsif (defined $self->getVersionInfo() ) {
+ print STDERR $self->getProgramInfo('name'), " ",
+ $self->getVersionInfo(), "\n";
+ }
+ else {
+ print STDERR $self->getProgramInfo('name'),
+ " has no defined version information\n";
+ }
+ }
+
+
+=item $obj_instance->printVersionInfoAndExit();
+
+The C<printVersionInfoAndExit()> function calls the version handler, if set.
+Otherwise, it prints prints version info set by the C<setVersionInfo()>
+function. If there is no defined version information, a message is printed
+notifying the user. This function calls exit with exit code 0.
+
+=cut
+
+
+ sub printVersionInfoAndExit() {
+ my $self = shift;
+ $self->printVersionInfo();
+ exit 0;
+ }
+
+
+=item $obj_instance->setVersionInfo($version_string);
+
+The C<setVersionInfo()> function sets the version information to be reported
+by C<getVersionInfo()>. If C<$version_string> is empty, invalid, or
+undefined, the stored version information will be undefined.
+
+=cut
+
+
+ sub setVersionInfo($) {
+ my $self = shift;
+ my $v_info = shift;
+ if ( defined ( $v_info ) && ( $v_info =~ /\S/ ) ) {
+ $self->{version_info} = $v_info;
+ }
+ else {
+ $self->{version_info} = undef;
+ }
+ }
+
+
+=item $obj_instance->setVersionHandler($function_ref);
+
+The C<setVersionHandler()> method establishes a callback function for handling
+the reporting of version information to the user. If a handler is set, then
+any information passed in via C<setVersionInfo()> is not reported. To
+remove the handler, call this method without any arguments. If a handler is
+not a proper code reference, this method returns undefined and does not set
+a handler. This method returns 1 on success.
+
+=cut
+
+
+ sub setVersionHandler($) {
+ my $self = shift;
+ my $v_handler = shift;
+ if ( defined ( $v_handler ) && ( (ref $v_handler) eq "CODE" ) ) {
+ $self->{version_handler} = $v_handler;
+ }
+ elsif ( ! defined ( $v_handler ) ) {
+ $self->{version_handler} = undef;
+ }
+ else {
+ # Bad input.
+ return undef;
+ }
+ return 1;
+ }
+
+
+# Functional Class : help
+
+=item $obj_instance->printHelpInfo();
+
+The C<printHelpInfo()> function prints the help information passed by the
+C<setHelpInfo()> function.
+
+=cut
+
+
+ sub printHelpInfo() {
+ my $self = shift;
+ if (defined $self->{help_info}) {
+ print STDERR $self->{help_info};
+ }
+ else {
+ print STDERR "No help information defined.\n";
+ }
+ }
+
+
+=item $obj_instance->printHelpInfoAndExit();
+
+The C<printHelpInfoAndExit()> function prints the help info passed by the
+C<setHelpInfo()> function. This function exits with exit code 0.
+
+=cut
+
+
+ sub printHelpInfoAndExit() {
+ my $self = shift;
+ $self->printHelpInfo();
+ exit 0;
+ }
+
+
+=item $obj_instance->setHelpInfo($help_string);
+
+The C<setHelpInfo()> function sets the help information via C<$help_string>.
+If C<$help_string> is undefined, invalid, or empty, the help information
+is undefined.
+
+=cut
+
+
+ sub setHelpInfo($) {
+ my $self = shift;
+ my $help_string = shift;
+ if ( ( defined $help_string ) && ( $help_string =~ /\S/ ) ) {
+ chomp $help_string;
+ $self->{help_info} = $help_string . "\n";
+ }
+ else {
+ $self->{help_info} = undef;
+ }
+ }
+
+
+# Functional Class : usage
+
+=item $obj_instance->printUsageInfo();
+
+The C<printUsageInfo()> function prints the usage information reported by the
+C<setUsageInfo()> function. If no usage information is defined, but help
+information is defined, help information will be printed.
+
+=cut
+
+
+ sub printUsageInfo() {
+
+ my $self = shift;
+ if ( defined $self->{usage_info} ) {
+ print STDERR $self->{usage_info};
+ }
+ elsif ( defined $self->{help_info} ) {
+ print STDERR $self->{help_info};
+ }
+ else {
+ print STDERR "No usage information defined.\n";
+ }
+ }
+
+
+=item $obj_instance->printUsageInfoAndExit();
+
+The C<printUsageInfoAndExit()> function prints the usage information the
+reported by the C<setUsageInfo()> function and exits with status 1.
+
+=cut
+
+
+ sub printUsageInfoAndExit() {
+ my $self = shift;
+ $self->printUsageInfo();
+ exit 1;
+ }
+
+
+=item $obj_instance->setUsageInfo($usage_string);
+
+The C<setUsageInfo()> function sets the usage information via C<$usage_string>.
+If C<$usage_string> is undefined, invalid, or empty, the usage information
+is undefined.
+
+=cut
+
+
+ sub setUsageInfo($) {
+ my $self = shift;
+ my $usage_string = shift;
+ if ( ( defined $usage_string ) && ( $usage_string =~ /\S/ ) ) {
+ chomp($usage_string);
+ $self->{usage_info} = $usage_string . "\n";
+ }
+ else {
+ $self->{usage_info} = undef;
+ }
+ }
+
+
+# Functional Class : files
+
+=item $valid = isReadableFile($file_name);
+
+This function accepts a single scalar parameter containing a file name.
+If the file corresponding to the file name is a readable plain file or symbolic
+link, this function returns 1. Otherwise, the function returns 0. If the file
+name passed is undefined, this function returns 0 as well.
+
+=cut
+
+
+ sub isReadableFile($) {
+ my $self = shift;
+ my $file = shift;
+ if ( ! defined ( $file ) ) { # class, not instance, invocation
+ $file = $self;
+ }
+
+ if (defined ($file) && # was a file name passed?
+ ( (-f $file) || (-l $file) ) && # is the file a file or sym. link?
+ (-r $file) # is the file readable?
+ ) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+
+=item $valid = isExecutableFile($file_name);
+
+This function accepts a single scalar parameter containing a file name.
+If the file corresponding to the file name is an executable plain file
+or symbolic link, this function returns 1. Otherwise, the function returns 0.
+If the file name passed is undefined, this function returns 0 as well.
+
+=cut
+
+
+ sub isExecutableFile($) {
+ my $self = shift;
+ my $file = shift;
+ if ( ! defined ( $file ) ) { # class invocation, not instance
+ $file = $self;
+ }
+
+ if (defined ($file) && # was a file name passed?
+ ( (-f $file) || (-l $file) ) && # is the file a file or sym. link?
+ (-x $file) # is the file executable?
+ ) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+
+=item $valid = isWritableFile($file_name);
+
+This function accepts a single scalar parameter containing a file name.
+If the file corresponding to the file name is a writable plain file
+or symbolic link, this function returns 1. Otherwise, the function returns 0.
+If the file name passed is undefined, this function returns 0 as well.
+
+=cut
+
+
+ sub isWritableFile($) {
+ my $self = shift;
+ my $file = shift;
+ if ( ! defined ( $file ) ) { # class, not instance, invocation
+ $file = $self;
+ }
+
+ if (defined ($file) && # was a file name passed?
+ ( (-f $file) || (-l $file) ) && # is the file a file or sym. link?
+ (-w $file) # is the file writable?
+ ) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+
+=item $valid = isCreatableFile($file_name);
+
+This function accepts a single scalar parameter containing a file name. If
+the file corresponding to the file name is creatable this function returns 1.
+The function checks if the location of the file is writable by the effective
+user id (EUID). If the file location does not exist or the location is not
+writable, the function returns 0. If the file name passed is undefined,
+this function returns 0 as well. Note that files with suffix F</> are not
+supported under UNIX platforms, and will return 0.
+
+=cut
+
+
+ sub isCreatableFile($) {
+ my $self = shift;
+ my $file = shift;
+ if ( ! defined ( $file ) ) {
+ $file = $self;
+ }
+ my $return_code = 0;
+ if (
+ (defined ($file) ) &&
+ (! -e $file) &&
+ ($file !~ /\/$/)
+ ) {
+ my $dirname = dirname($file);
+ # check the writability of the directory
+ $return_code = isWritableDir($dirname);
+ }
+ else {
+ # the file exists, it's not creatable
+ $return_code = 0;
+ }
+ return $return_code;
+ }
+
+
+=item $valid = isReadableDir($directory_name);
+
+This function accepts a single scalar parameter containing a directory name.
+If the name corresponding to the directory is a readable, searchable directory
+entry, this function returns 1. Otherwise, the function returns 0. If the
+name passed is undefined, this function returns 0 as well.
+
+=cut
+
+
+ sub isReadableDir($) {
+ my $self = shift;
+ my $file = shift;
+ if ( ! defined ( $file ) ) { # class invocation
+ $file = $self;
+ }
+
+ if (defined ($file) && # was a name passed?
+ (-d $file) && # is the name a directory?
+ (-r $file) && # is the directory readable?
+ (-x $file) # is the directory searchable?
+ ) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+
+=item $valid = isWritableDir($directory_name);
+
+This function accepts a single scalar parameter containing a directory name.
+If the name corresponding to the directory is a writable, searchable directory
+entry, this function returns 1. Otherwise, the function returns 0. If the
+name passed is undefined, this function returns 0 as well.
+
+=cut
+
+
+ sub isWritableDir($) {
+ my $self = shift;
+ my $file = shift;
+ if ( ! defined ( $file ) ) { # class invocation
+ $file = $self;
+ }
+
+ if (defined ($file) && # was a name passed?
+ (-d $file) && # is the name a directory?
+ (-w $file) && # is the directory writable?
+ (-x $file) # is the directory searchable?
+ ) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+
+=item $valid = isCreatableDir($directory_name);
+
+This function accepts a single scalar parameter containing a directory name.
+If the name corresponding to the directory is creatable this function returns
+1. The function checks if the immediate parent of the directory is writable by
+the effective user id (EUID). If the parent directory does not exist or the
+tree is not writable, the function returns 0. If the directory name passed is
+undefined, this function returns 0 as well.
+
+=cut
+
+
+ sub isCreatableDir($) {
+ my $self = shift;
+ my $dir = shift;
+ if ( ! defined ( $dir ) ) {
+ $dir = $self;
+ }
+ my $return_code = 0;
+
+ if (defined ($dir) ) {
+ $dir =~ s/\/$//g;
+ $return_code = isCreatableFile($dir);
+ }
+ return $return_code;
+ }
+
+
+=item $valid = isCreatablePath($path_name);
+
+This function accepts a single scalar parameter containing a path name. If
+the C<$path_name> is creatable this function returns 1. The function checks
+if the directory hierarchy of the path is creatable or writable by the
+effective user id (EUID). This function calls itself recursively until
+an existing directory node is found. If that node is writable, ie. the path
+can be created in it, then this function returns 1. Otherwise, the function
+returns 0. This function also returns zero if the C<$path_name> supplied
+is disconnected from a reachable directory tree on the file system.
+If the path already exists, this function returns 0. The C<$path_name> may
+imply either a path to a file or a directory. Path names may be relative or
+absolute paths. Any unresolvable relative paths will return 0 as well. This
+includes paths with F<..> back references to nonexistent directories.
+This function is recursive whereas C<isCreatableFile()> and
+C<isCreatableDir()> are not.
+
+=cut
+
+
+ sub isCreatablePath($) {
+ my $self = shift;
+ my $pathname = shift;
+ if ( ! defined ( $pathname ) ) { # class invocation
+ $pathname = shift;
+ }
+ my $return_code = 0;
+
+ if (defined $pathname) {
+ # strip trailing '/'
+ $pathname =~ s/(.+)\/$/$1/g;
+ my $filename = basename($pathname);
+ my $dirname = dirname($pathname);
+ if (
+ (! -e $pathname) &&
+ ($dirname ne $pathname) &&
+ ($filename ne "..")
+ ) {
+ if (-e $dirname) {
+ $return_code = isWritableDir($dirname);
+ }
+ else {
+ $return_code = isCreatablePath($dirname);
+ }
+ }
+ else {
+ $return_code = 0;
+ }
+ }
+ return $return_code;
+ }
+
+
+# Functional Class : temp
+
+=item setTempDir($path);
+
+Set in which folder to store temporary files. If no argument is
+specified, the default is to set the temporary directory to the
+system's temporary folder or to whatever the value of the
+environment variable TMPDIR is.
+
+=cut
+
+ sub setTempDir($) {
+ my $self = shift;
+ my $path = shift;
+ if (not defined $path) {
+ # Default temporary directory
+ $path = File::Spec->tmpdir();
+ }
+ $self->{'temp_dir'} = $path;
+ }
+
+=item $tmp_dir = getTempDir();
+
+Get the location of the temporary dir.
+
+=cut
+
+ sub getTempDir() {
+ my $self = shift;
+ return $self->{'temp_dir'};
+ }
+
+
+# Functional Class : date
+
+=item $date_string = getISODate($tm);
+
+This function returns the ISO 8601 datetime as a string given a time
+structure as returned by the C<time> function. If no arguments
+are supplied, this function returns the current time. If incorrect
+arguments are supplied, this function returns undefined.
+
+=cut
+
+
+ sub getISODate(;@) {
+ #checking if the function is invoked as an instance method.
+ if ( (defined(ref $_[0]) ) && ( (ref $_[0]) eq "TIGR::Foundation") ){
+ shift;
+ }
+ my @time_val = @_;
+ my $time_str = undef;
+ if (scalar(@time_val) == 0) {
+ @time_val = localtime;
+ }
+ eval {
+ $time_str = strftime "%Y-%m-%d %H:%M:%S", @time_val;
+ };
+ return $time_str;
+ }
+
+
+=item $date_string = getSybaseDate(@tm);
+
+This function returns a Sybase formatted datetime as a string given a time
+structure as returned by the C<time> function. If no arguments
+are supplied, this function returns the current time. If incorrect
+arguments are supplied, this function returns undefined. The date string
+returned is quoted according to Sybase requirements.
+
+=cut
+
+
+ sub getSybaseDate(;@) {
+ #checking if the function is invoked as an instance method.
+ if ( (defined(ref $_[0]) ) && ( (ref $_[0]) eq "TIGR::Foundation") ){
+ shift;
+ }
+ my @time_val = @_;
+ my $time_str = undef;
+ if (scalar(@time_val) == 0) {
+ @time_val = localtime;
+ }
+ eval {
+ $time_str = strftime "\'%b %d %Y %I:%M%p\'", @time_val;
+ };
+ return $time_str;
+ }
+
+
+=item $date_string = getMySQLDate(@tm);
+
+This function returns a MySQL formatted datetime as a string given a time
+structure as returned by the C<time> function. If no arguments
+are supplied, this function returns the current time. If incorrect
+arguments are supplied, this function returns undefined. The datetime string
+returned is prequoted according to MySQL requirements.
+
+=cut
+
+
+ sub getMySQLDate(;@) {
+ #checking if the function is invoked as an instance method.
+ if ( (defined(ref $_[0]) ) && ( (ref $_[0]) eq "TIGR::Foundation") ){
+ shift;
+ }
+ my @time_val = @_;
+ my $time_str = undef;
+ if (scalar(@time_val) == 0) {
+ @time_val = localtime;
+ }
+ $time_str = getISODate(@time_val);
+ if (defined $time_str) {
+ $time_str = "\'$time_str\'";
+ }
+ return $time_str;
+ }
+
+
+=item $date_string = getFilelabelDate(@tm);
+
+This function returns the date (not time) as a compressed string
+suitable for use as part of a file name. The format is YYMMDD.
+The optional parameter should be a time structure as returned by
+the C<time> function. If no arguments are supplied, the current time
+is used. If incorrect arguments are supplied, this function returns
+undefined.
+
+=cut
+
+
+ sub getFilelabelDate(;@) {
+ #checking if the function is invoked as an instance method.
+ if ( (defined(ref $_[0]) ) && ( (ref $_[0]) eq "TIGR::Foundation") ){
+ shift;
+ }
+ my @time_val = @_;
+ my $time_str = undef;
+ if (scalar(@time_val) == 0) {
+ @time_val = localtime;
+ }
+ eval {
+ $time_str = strftime "%y%m%d", @time_val;
+ };
+ return $time_str;
+ }
+
+
+=item $date_string = $obj_instance->getLogfileDate(@tm);
+
+This function returns the datetime as a formatted string
+suitable for use as a log entry header. The optional parameter
+should be a time structure as returned by the C<time> function.
+If no arguments are supplied, this function uses the current time.
+If incorrect arguments are supplied, this function sets the date/time fields
+of the log entry string to C< INVALID|XXXXXX|>.
+
+=cut
+
+
+ sub getLogfileDate(;@) {
+ #checking if the function is invoked as an instance method.
+ if ( (defined(ref $_[0]) ) && ( (ref $_[0]) eq "TIGR::Foundation") ){
+ shift;
+ }
+ my @time_val = @_;
+ my $time_str = undef;
+ my $log_form = undef;
+ if (scalar(@time_val) == 0) {
+ @time_val = localtime;
+ }
+ eval {
+ $time_str = strftime("%Y%m%d|%H%M%S|", @time_val);
+ };
+ if (!defined $time_str) {
+ $time_str = " INVALID|XXXXXX|";
+ }
+ $log_form = $time_str . sprintf("%6d| ", $$);
+ return $log_form;
+ }
+
+
+# Functional Class : logging
+
+=item $obj_instance->setDebugLevel($new_level);
+
+This function sets the level of debug reporting according to C<$new_level>.
+If C<$new_level> is less than 0, all debug reporting is turned off and
+C<getDebugLevel()> will report undefined. If C<$new_level> is not specified,
+the debug level is set to 0. For compatibility, this function will also accept
+the debug level as the second parameter. In such cases, the first parameter
+is checked only if the second parameter is invalid. By default, the debug
+level is undefined.
+
+=cut
+
+
+ sub setDebugLevel($;$) {
+ my $self = shift;
+ my $new_level = shift;
+ my $getopts_new_level = shift;
+
+ if (
+ (defined $getopts_new_level) &&
+ ($getopts_new_level =~ /^-?\d+$/)
+ ) {
+ $new_level = $getopts_new_level;
+ }
+ elsif (
+ (!defined $new_level) ||
+ ($new_level !~ /^-?\d+$/)
+ ) {
+ $new_level = 0;
+ $self->logLocal("No or invalid parameter to setDebugLevel(), " .
+ "setting debug level to 0", 3);
+ }
+
+ if ($new_level < 0) {
+ $new_level = -1;
+ }
+
+ $self->{debug_level} = $new_level;
+ my $level = $self->getDebugLevel();
+ if ( ! defined ( $level ) ) { $level = "<undefined>"; }
+ $self->logLocal("Set debug level to " . $level, 2);
+ }
+
+
+=item $level = $obj_instance->getDebugLevel();
+
+This function returns the current debug level. If the debug level has
+not been set, this method returns <undef>.
+
+=cut
+
+
+ sub getDebugLevel() {
+ my $self = shift;
+ if ( $self->{'debug_level'} == -1 ) {
+ return undef;
+ }
+ else {
+ return $self->{'debug_level'};
+ }
+ }
+
+
+=item $obj_instance->setLogFile($log_file);
+
+This function sets the log file name for use by the C<logLocal()> function.
+B<The programmer should call this function before invoking C<setDebugLevel()>>
+if the default log file is not to be used. The new log file name is the
+only parameter. Future calls to C<logLocal()> or C<bail()> log to C<$log_file>
+if it is successfully opened. If the new log file is not successfully opened,
+the function will try to open the default log file, F<program_name.log>.
+If that file cannot be opened, F</tmp/program_name.$process_id.log> will
+be used. If no parameter is passed, this method does nothing. For
+compatibility, this method accepts the second parameter as the log file. The
+first parameter is ignored in such cases. B<NOTE:> log files (including the
+default log file) with relative paths will track with program execution
+whenever a change of directory is made.
+
+=cut
+
+
+ sub setLogFile($;$) {
+ my $self = shift;
+ my $old_log_file = defined $self->{static_log_file} ?
+ $self->{static_log_file} : undef;
+ $self->{static_log_file} = shift;
+ if (scalar(@_) == 1) {
+ $self->{static_log_file} = shift;
+ }
+
+ # only consider a new log file that is definable as a file
+ if ( (defined ($self->{static_log_file}) ) &&
+ ($self->{static_log_file} !~ /^\s*$/) ) {
+ # delete an old log file entry added by "setLogFile"
+ for (my $idx = 0;
+ ($idx <= $#{$self->{log_files}}) && defined($old_log_file);
+ $idx++) {
+ if ($self->{log_files}[$idx] eq $old_log_file) {
+ splice @{$self->{log_files}}, $idx, 1;
+ $old_log_file = undef;
+ }
+ }
+ unshift @{$self->{log_files}}, $self->{static_log_file};
+
+ # initialize the log file variables and file spaces
+ $self->{msg_file_used} = 0;
+ $self->{error_file_used} = 0;
+ $self->cleanLogFILES();
+ }
+ }
+
+
+=item $log_file_name = $obj_instance->getLogFile();
+
+This function returns the name of the log file to be used for printing
+log messages. We return undefined if there are no more log files to bind.
+
+=cut
+
+
+ sub getLogFile() {
+ my $self = shift;
+ return $self->{log_files}[0];
+ }
+
+
+=item $error_file_name = $obj_instance->getErrorFile();
+
+This function returns the name of the error file to be used for printing
+error messages. The error file is derived from the log file; a F<.log>
+extension is replaced by a F<.error> extension. If there is no F<.log>
+extension, then F<.error> is appended to the log file name. We return
+undefined if there are no more log files to bind.
+
+=cut
+
+
+ sub getErrorFile() {
+ my $self = shift;
+ my $return_val = $self->getLogFile();
+ if ( defined ( $return_val ) ) {
+ $return_val =~ s/\.log$//g;
+ $return_val .= '.error';
+ }
+ return $return_val;
+ }
+
+
+ # the following private functions are used for logging
+
+
+ # push items onto the debug level stack
+ sub debugPush() {
+ my $self = shift;
+ push @{$self->{debug_store}}, $self->{debug_level};
+ $self->{debug_level} = -1;
+ }
+
+
+ # pop items from the debug level stack
+ sub debugPop() {
+ my $self = shift;
+ $self->{debug_level} = pop @{$self->{debug_store}};
+ }
+
+
+ # remove log files
+ sub removeLogERROR() {
+
+ my $self = shift;
+ $self->debugPush();
+ if (
+ (defined $self->getErrorFile() ) &&
+ (isWritableFile($self->getErrorFile() ))
+ ) {
+ unlink $self->getErrorFile() or
+ $self->logLocal("Unable to remove error file " .
+ $self->getErrorFile(), 3);
+ }
+ $self->debugPop();
+ }
+
+
+ sub removeLogMSG() {
+ my $self = shift;
+ $self->debugPush();
+
+ if (
+ (defined $self->getLogFile() ) &&
+ (isWritableFile($self->getLogFile() ))
+ ) {
+ unlink $self->getLogFile() or
+ $self->logLocal("Unable to remove error file " .
+ $self->getLogFile(), 3);
+ }
+ $self->debugPop();
+ }
+
+
+ # invalidate log files
+ sub invalidateLogFILES() {
+ my $self = shift;
+ $self->debugPush();
+ if (defined $self->getLogFile() ) {
+ $self->logLocal("Invalidating " . $self->getLogFile(), 2);
+ shift @{$self->{log_files}};
+ $self->{msg_append_flag} = $self->{error_append_flag} =
+ $self->{log_append_setting};
+ $self->{msg_file_used} = $self->{error_file_used} = 0;
+ $self->cleanLogFILES();
+ }
+ $self->debugPop();
+ }
+
+
+ # clean previous log files
+ sub cleanLogFILES() {
+ my $self = shift;
+ if ($self->{log_append_setting} == 0) {
+ if ($self->{msg_file_used} == 0) {
+ $self->removeLogMSG();
+ }
+ if ($self->{error_file_used} == 0) {
+ $self->removeLogERROR();
+ }
+ }
+ }
+
+
+ # close log files
+ sub closeLogERROR() {
+ my $self = shift;
+ my $return_code = 1; # need to return true for success, false for fail
+
+ $self->debugPush();
+ if (!close(ERRLOG) && (defined $self->getErrorFile() )) {
+ $self->logLocal("Cannot close " . $self->getErrorFile(), 3);
+ $return_code = 0;
+ }
+ else {
+ $return_code = 1;
+ }
+ $self->{error_file_open_flag} = 0;
+ $self->debugPop();
+ return $return_code;
+ }
+
+
+ sub closeLogMSG() {
+ my $self = shift;
+ my $return_code = 1; # need to return true for success, false for fail
+
+ $self->debugPush();
+ if (!close(MSGLOG) && (defined $self->getLogFile() )) {
+ $self->logLocal("Cannot close " . $self->getLogFile(), 3);
+ $return_code = 0;
+ }
+ else {
+ $return_code = 1;
+ }
+ $self->{msg_file_open_flag} = 0;
+ $self->debugPop();
+ return $return_code;
+ }
+
+
+ # open log files
+ sub openLogERROR() {
+ my $self = shift;
+ my $return_code = 1; # need to return true for success, false for fail
+
+ $self->debugPush();
+ if ( (defined $self->getErrorFile() ) &&
+ ($self->{error_file_open_flag} == 0) ) {
+ my $fileop;
+ $self->{error_file_open_flag} = 1;
+ if ($self->{error_append_flag} == 0) {
+ $fileop = '>';
+ $self->{error_append_flag} = 1;
+ }
+ else {
+ $fileop = '>>';
+ }
+ if (open(ERRLOG, $fileop . $self->getErrorFile() )) {
+ autoflush ERRLOG 1;
+ }
+ else {
+ $self->logLocal("Cannot open " . $self->getErrorFile() .
+ " for logging", 4);
+ $self->{error_file_open_flag} = 0;
+ }
+ }
+ $return_code = $self->{error_file_open_flag};
+ $self->debugPop();
+
+ # this is 1 if the file stream is open, 0 if not
+ return $return_code;
+ }
+
+
+ sub openLogMSG() {
+ my $self = shift;
+ my $return_code = 1; # need to return true for success, false for fail
+
+ $self->debugPush();
+ if ( (defined $self->getLogFile() ) &&
+ ($self->{msg_file_open_flag} == 0) ) {
+ my $fileop;
+ $self->{msg_file_open_flag} = 1;
+ if ($self->{msg_append_flag} == 0) {
+ $fileop = '>';
+ $self->{msg_append_flag} = 1;
+ }
+ else {
+ $fileop = '>>';
+ }
+
+ if (open(MSGLOG, $fileop . $self->getLogFile() )) {
+ autoflush MSGLOG 1;
+ }
+ else {
+ $self->logLocal("Cannot open " . $self->getLogFile() .
+ " for logging", 4);
+ $self->{msg_file_open_flag} = 0;
+ }
+ }
+ $return_code = $self->{msg_file_open_flag};
+ $self->debugPop();
+
+ # this is 1 if the file stream is open, 0 if not
+ return $return_code;
+ }
+
+
+=item $obj_instance->logAppend($log_append_flag);
+
+Passing C<0> signals truncation of log files while C<1> signals appending.
+By default, log files are truncated at the start of program execution or
+logging. Error files are controlled by this method as well. Any truncation
+occurs before the next write. For compatibility, this method accepts and
+prefers a second parameter argument for the log-append flag.
+
+=cut
+
+
+ sub logAppend($;$) {
+ my $self = shift;
+ my $log_append_flag = shift;
+ if (defined $_[0]) {
+ $log_append_flag = shift;
+ }
+ if (
+ (defined ($log_append_flag) ) &&
+ ( ($log_append_flag eq "0") ||
+ ($log_append_flag eq "1") )
+ ) {
+ $self->{log_append_setting} = $self->{msg_append_flag} =
+ $self->{error_append_flag} = $log_append_flag;
+ }
+ }
+
+
+=item $obj_instance->logLocal($log_message, $log_level);
+
+The C<logLocal()> function takes two arguments. The C<$log_message>
+argument specifies the message to be written to the log file. The
+C<$log_level> argument specifies the level at which C<$log_message> is printed.
+The active level of logging is set via the C<setDebugLevel()> function.
+Only messages at C<$log_level> less than or equal to the active debug
+level are logged. The default debug level is undefined (no logging). Note, a
+trailing new line, if it exists, is stripped from the log message.
+
+=cut
+
+
+ sub logLocal($$) {
+ my $self = shift;
+ my $log_message = shift;
+ my $log_level = shift;
+
+ if ( ( ! defined $log_level ) || ( $log_level =~ /\D/ ) ) {
+ $log_level = 1;
+ }
+
+ if (defined $log_message) {
+ chomp $log_message; # strip end new line, if it exists
+ $log_message = getLogfileDate() . $log_message;
+ push @{$self->{debug_queue}}, [ $log_message, $log_level ];
+ if ( $self->{'debug_level'} >= 0 ) {
+ while ( defined ( my $log_record = $self->{debug_queue}[0] ) &&
+ defined ( $self->getLogFile() ) ) {
+ ( $log_message, $log_level ) = @{$log_record};
+ if (
+ (
+ ($log_level <= $self->{'debug_level'} ) && # debug level
+ ($self->openLogMSG() ) && # check log file
+ (print MSGLOG "$log_message\n") && # print message
+ ($self->closeLogMSG() ) && # close log file
+ ($self->{msg_file_used} = 1) # log file used
+ ) ||
+ (
+ ($log_level > $self->{'debug_level'} ) # bad dbg level
+ )
+ ) {
+ # log message is successfully processed, so shift it off
+ shift @{$self->{debug_queue}};
+ }
+ else {
+ $self->debugPush();
+ $self->logLocal("Cannot log message \'$log_message\' to " .
+ $self->getLogFile() . " = " . $!, 9);
+ $self->invalidateLogFILES();
+ $self->debugPop();
+ }
+ }
+ }
+ }
+ else {
+ $self->logLocal("logLocal() called without any parameters!",3);
+ }
+
+ while ($#{$self->{debug_queue}} >= $self->{max_debug_queue_size}) {
+ # expire old entries; this needs to happen if $self->{debug_level}
+ # is undefined or there is no writable log file, otherwise the
+ # queue could exhaust RAM.
+ shift @{$self->{debug_queue}};
+ }
+ }
+
+
+=item $obj_instance->logError($log_message,$flag);
+
+The C<logError()> function takes two arguments, the second one being optional.
+The C<$log_message> argument specifies the message to be written to the error
+file. If the C<$flag> argument is defined and is non-zero, the C<$log_message>
+is also written to STDERR. The C<$log_message> is also passed to C<logLocal>.
+A message passed via logError() will always get logged to the log file
+regardles of the debug level. Note, a trailing new line, if it exists, is
+stripped from the log message.
+
+=cut
+
+
+ sub logError($;$) {
+
+ my $self = shift;
+ my $log_message = shift;
+ my $flag = shift;
+ if (defined $log_message) {
+ chomp $log_message;
+ $self->logLocal($log_message, 0);
+
+ #printing error message to STDERR if flag is non zero.
+ if ( (defined($flag) ) && ($flag ne '0') ) {
+ print STDERR "$log_message\n";
+ }
+
+ $log_message = getLogfileDate() . $log_message;
+ push(@{$self->{error_queue}}, $log_message);
+
+ while (
+ ( defined ( my $log_message = $self->{error_queue}[0]) ) &&
+ ( defined ( $self->getErrorFile() ) )
+ ) {
+ if (
+ ($self->openLogERROR() ) &&
+ (print ERRLOG "$log_message\n") &&
+ ($self->closeLogERROR() ) &&
+ ($self->{error_file_used} = 1) # that is an '='
+ ) {
+ shift @{$self->{error_queue}};
+ }
+ else {
+ $self->debugPush();
+ $self->logLocal("Cannot log message \'$log_message\' to " .
+ $self->getErrorFile() . " = $!", 6);
+ $self->invalidateLogFILES();
+ $self->debugPop();
+ }
+ }
+ }
+ else {
+ $self->logLocal("logError() called without any parameters!",3);
+ }
+
+ while ($#{$self->{error_queue}} >= $self->{max_debug_queue_size}) {
+ # expire old entries; this needs to happen if $self->{debug_level}
+ # is undefined or there is no writable log file, otherwise the
+ # queue could exhaust RAM.
+ shift @{$self->{error_queue}};
+ }
+ }
+
+
+=item $obj_instance->bail($log_message);
+
+The C<bail()> function takes a single required argument. The C<$log_message>
+argument specifies the message to be passed to C<logLocal()> and written
+to standard error. All messages passed to C<bail()> are written to the
+log and error files. The C<bail()> function calls C<exit(1)> to terminate the
+program. Optionally, a second positive integer argument can be passed as the
+exit code to use. Trailing new lines are stripped from the log message.
+
+=cut
+
+
+ sub bail($;$) {
+ my $self = shift;
+ my $log_message = shift;
+ my $exit_code = shift;
+
+ if ( ( ! defined $exit_code ) || ( $exit_code !~ /^\d+$/ ) ) {
+ $exit_code = 1;
+ }
+ if (defined $log_message) {
+ chomp $log_message; # strip end new line, if it exists
+ $self->logError($log_message);
+ print STDERR $log_message, "\n";
+ }
+ exit $exit_code;
+ }
+
+
+# Functional Class : modified methods
+
+=item $getopts_error_code = $obj_instance->TIGR_GetOptions(@getopts_arguments);
+
+This function extends C<Getopt::Long::GetOptions()>. It may be used
+as C<GetOptions()> is used. TIGR standard options are handled automatically.
+Using this method promotes proper module behavior.
+
+The following options are defined by this function:
+
+=over
+
+=item -appendlog <flag>
+
+Passing '1' to this argument turns on log file appending. Log files are
+truncated by default.
+
+=item -debug <level>
+
+Set debugging to <level>.
+
+=item -logfile <file>
+
+Set the TIGR Foundation log file to <file>. NOTE!!! Log files specified
+with relative paths will "track" the program as directories change!!!
+
+=item -version, -V
+
+Print version information and exit.
+
+=item -help, -h
+
+Print help information and exit.
+
+=item -depend
+
+Print dependency information and exit.
+
+=back
+
+B<The options defined by C<TIGR_GetOptions()> cannot be overridden or recorded>.
+C<GetOptions()> default variables, ie. those of the form C<$opt_I<optionname>>,
+are not supported. This function will return 1 on success. This method does
+not throw an exception on failure to parse command line parameters - this is
+unlike Getopt::Long.
+
+=cut
+
+
+ sub TIGR_GetOptions(@) {
+ my $self = shift;
+ my @user_options = @_;
+
+ my $appendlog_var = undef;
+ my $logfile_var = undef;
+ my $debug_var = undef;
+ my $version_var = undef;
+ my $help_var = undef;
+ my $depend_var = undef;
+
+ # these foundation options support the defaults
+ my @foundation_options = (
+ "appendlog=i" => \$appendlog_var,
+ "logfile=s" => \$logfile_var,
+ "debug=i" => \$debug_var,
+ "version|V" => \$version_var,
+ "help|h" => \$help_var,
+ "depend" => \$depend_var
+ );
+
+ Getopt::Long::Configure('no_ignore_case');
+ my $getopt_code = eval 'GetOptions (@user_options, @foundation_options)';
+
+ if ( (defined $help_var) && ($help_var =~ /^(.*)$/) ) {
+ $self->printHelpInfoAndExit();
+ }
+
+ if ( (defined $version_var) && ($version_var =~ /^(.*)$/) ) {
+ $self->printVersionInfoAndExit();
+ }
+
+ if ( (defined $depend_var) && ($depend_var =~ /^(.*)$/) ) {
+ $self->printDependInfoAndExit();
+ }
+
+ if ( (defined $appendlog_var) && ($appendlog_var =~ /^(.*)$/) ) {
+ $appendlog_var = $1;
+ $self->logAppend($appendlog_var);
+ }
+
+ if ( (defined $logfile_var) && ($logfile_var =~ /^(.*)$/) ) {
+ $logfile_var = $1;
+ $self->setLogFile($logfile_var);
+ }
+
+ if ( (defined $debug_var) && ($debug_var =~ /^(.*)$/) ) {
+ $debug_var = $1;
+ $self->setDebugLevel($debug_var);
+ }
+
+ # remove old log files, if necessary
+ for (
+ my $file_control_var = 0;
+ $file_control_var <= $#{$self->{log_files}};
+ $file_control_var++
+ ) {
+ $self->cleanLogFILES();
+ push(@{$self->{log_files}}, shift @{$self->{log_files}});
+ }
+ return $getopt_code;
+ }
+
+ DESTROY {
+ my $self = shift;
+ $self->{finish_time} = time;
+ my $time_difference = $self->{finish_time} - $self->{start_time};
+ my $num_days = int($time_difference / 86400); # there are 86400 sec/day
+ $time_difference -= $num_days * 86400;
+ my $num_hours = int($time_difference / 3600); # there are 3600 sec/hour
+ $time_difference -= $num_hours * 3600;
+ my $num_min = int($time_difference / 60); # there are 60 sec/hour
+ $time_difference -= $num_min * 60;
+ my $num_sec = $time_difference; # the left overs are seconds
+ my $time_str = sprintf "%03d-%02d:%02d:%02d", $num_days, $num_hours,
+ $num_min, $num_sec;
+ $self->logLocal("FINISH: " . $self->getProgramInfo('name') .
+ ", elapsed ".$time_str ,0);
+ }
+}
+
+=back
+
+=head1 USAGE
+
+To use this module, load the C<TIGR::Foundation> package
+via the C<use> function. Then, create a new instance of the
+object via the C<new()> method, as shown below. If applicable,
+C<START> and C<FINISH> log messages are printed when the object
+is created and destroyed, respectively. It is advisable to
+keep the instance of the object in scope for the whole program
+to achieve maximum functionality.
+
+An example script using this module follows:
+
+ use strict;
+ use TIGR::Foundation;
+
+ my $tfobject = new TIGR::Foundation;
+
+ MAIN:
+ {
+ # The following dependencies are not used in
+ # this script, but are provided as an example.
+
+ my @DEPEND = ("/usr/bin/tee", "/sbin/stty");
+
+ # The user defined $VERSION variable is usable by Perl.
+ # The auto defined $REVISION variable stores the RCS/CVS revision
+ # The user defined $VERSION_STRING reports both.
+
+ my $VERSION = '1.0';
+ my $REVISION = (qw$Revision$)[-1];
+ my $VERSION_STRING = "$VERSION (Build $REVISION)";
+
+ my $HELP_INFO = "This is my help\n";
+
+ # All of the necessary information must be passed
+ # to the foundation object instance, as below.
+
+ $tfobject->addDependInfo(@DEPEND);
+ $tfobject->setVersionInfo($VERSION_STRING);
+ $tfobject->setHelpInfo($HELP_INFO);
+
+ my $input_file;
+ my $output_file;
+
+ $tfobject->TIGR_GetOptions("input=s" => \$input_file,
+ "output=s" => \$output_file);
+
+ # GetOptions(), and subsequently TIGR_GetOptions(), leaves
+ # the variables unchanged if no corresponding command line
+ # arguments are parsed. The passed variables are checked below.
+
+ if (defined $input_file) {
+
+ # The log message is written only if debugging is turned on.
+ # By default, debugging is off. To turn on debugging, use the
+ # '-debug DEBUG_LEVEL' option on the command line.
+ # In this example, '-debug 1' would set debugging to level 1
+ # and report these log messages.
+
+ $tfobject->logLocal("My input file is $input_file", 1);
+ }
+
+ print "Hello world", "\n";
+
+ # This case is similar to the previous one above...
+ if (defined $output_file) {
+ $tfobject->logLocal("My output file is $output_file.", 1);
+ }
+ }
+
+=cut
+
+1;
diff --git a/src/PerlModules/Makefile.am b/src/PerlModules/Makefile.am
new file mode 100644
index 0000000..0e88565
--- /dev/null
+++ b/src/PerlModules/Makefile.am
@@ -0,0 +1,21 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+#-- TO BE INSTALLED
+dist_amoslib_SCRIPTS = \
+ AmosLib.pm \
+ ParseFasta.pm \
+ AmosFoundation.pm \
+ xfig.pm
+
+dist_tigrlib_SCRIPTS = \
+ FASTAgrammar.pm \
+ FASTAiterator.pm \
+ FASTAreader.pm \
+ FASTArecord.pm \
+ FASTAwriter.pm \
+ Foundation.pm
+
+
+##-- END OF MAKEFILE --##
diff --git a/src/PerlModules/Makefile.in b/src/PerlModules/Makefile.in
new file mode 100644
index 0000000..76eca0d
--- /dev/null
+++ b/src/PerlModules/Makefile.in
@@ -0,0 +1,536 @@
+# 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 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@
+DIST_COMMON = $(dist_amoslib_SCRIPTS) $(dist_tigrlib_SCRIPTS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/amos.mk
+subdir = src/PerlModules
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(tigrlibdir)"
+SCRIPTS = $(dist_amoslib_SCRIPTS) $(dist_tigrlib_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+#-- TO BE INSTALLED
+dist_amoslib_SCRIPTS = \
+ AmosLib.pm \
+ ParseFasta.pm \
+ AmosFoundation.pm \
+ xfig.pm
+
+dist_tigrlib_SCRIPTS = \
+ FASTAgrammar.pm \
+ FASTAiterator.pm \
+ FASTAreader.pm \
+ FASTArecord.pm \
+ FASTAwriter.pm \
+ Foundation.pm
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/PerlModules/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/PerlModules/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):
+install-dist_amoslibSCRIPTS: $(dist_amoslib_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(amoslibdir)" || $(MKDIR_P) "$(DESTDIR)$(amoslibdir)"
+ @list='$(dist_amoslib_SCRIPTS)'; test -n "$(amoslibdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(amoslibdir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(amoslibdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_amoslibSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_amoslib_SCRIPTS)'; test -n "$(amoslibdir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(amoslibdir)" && rm -f $$files
+install-dist_tigrlibSCRIPTS: $(dist_tigrlib_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(tigrlibdir)" || $(MKDIR_P) "$(DESTDIR)$(tigrlibdir)"
+ @list='$(dist_tigrlib_SCRIPTS)'; test -n "$(tigrlibdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(tigrlibdir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(tigrlibdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_tigrlibSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_tigrlib_SCRIPTS)'; test -n "$(tigrlibdir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(tigrlibdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(tigrlibdir)" && rm -f $$files
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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 $(SCRIPTS)
+installdirs:
+ for dir in "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(tigrlibdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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 mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_amoslibSCRIPTS \
+ install-dist_tigrlibSCRIPTS
+
+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:
+
+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 -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_amoslibSCRIPTS \
+ uninstall-dist_tigrlibSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-dist_amoslibSCRIPTS install-dist_tigrlibSCRIPTS \
+ 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 pdf \
+ pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-dist_amoslibSCRIPTS uninstall-dist_tigrlibSCRIPTS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/PerlModules/ParseFasta.pm b/src/PerlModules/ParseFasta.pm
new file mode 100644
index 0000000..c1fec39
--- /dev/null
+++ b/src/PerlModules/ParseFasta.pm
@@ -0,0 +1,163 @@
+# $Id$
+
+# ParseFasta.pm
+#
+
+package AMOS::ParseFasta;
+{
+
+=head1 NAME
+
+ParseFasta - class for reading a fasta-like formatted file
+
+The assumption is that the file contains a set of multi-line records separated
+by single-line headers starting with a specific separator (by default '>')
+
+=head1 SYNOPSIS
+
+use ParseFasta;
+my $parser = new ParseFasta(\*STDIN);
+
+while (my ($head, $data) = $parser->getRecord()){
+ ...
+}
+
+=head1 DESCRIPTION
+
+This module iterates through a fasta-like file retrieving the records in
+(header, data) pairs. When creating a new parser, the user may specify
+both the prefix (as a string) that indicates a header (record separator) line
+(default is '>'), and a line separator that is used when concatenating the
+lines in the input forming the body of each record. This separator is useful,
+for example, when parsing a .qual file where the quality values are separated
+by spaces.
+
+=cut
+
+ use strict;
+
+ # Declaration of function prototypes
+ sub new();
+ sub getRecord();
+ sub seek();
+ sub tell();
+
+=over
+
+=item $parser = new ParseFasta($file, $head, $sep) ;
+
+Creates a new parser object reading from file $file and using a specific
+header separator ($header - default '>') and a line separator
+($sep - default '')
+
+=cut
+
+sub new()
+{
+ my $pkg = shift;
+ my $file = shift;
+ my $headsep = shift;
+ my $linesep = shift;
+
+ my $self = {};
+ bless $self;
+
+ $self->{headsep} = '>';
+ $self->{headsep} = $headsep if defined $headsep;
+ $self->{linesep} = '';
+ $self->{linesep} = $linesep if defined $linesep;
+ $self->{file} = $file;
+ $self->{tell} = CORE::tell($file);
+
+ $self->{buf} = <$file>;
+ if (! defined $self->{buf}){
+ print STDERR "File appears empty\n";
+ return undef;
+ #die("File appears empty\n");
+ }
+ if ($self->{buf} !~ /^$self->{headsep}/){
+ print STDERR "File doesn't start with a header: $headsep\n";
+ return undef;
+ #die ("File doesn't start with a header: $headsep\n");
+ }
+ chomp $self->{buf};
+ #print STDERR "GOT a line $buf\n";
+ return $self;
+}
+
+=item ($head, $data) = $parser->getRecord();
+
+Reads a record into $head and $data. If no more records remain returns undef.
+
+=cut
+
+sub getRecord()
+{
+ my $self = shift;
+ my $head;
+ my $data;
+ my $file = $self->{file};
+ my $tl;
+
+ if (! defined $self->{buf} || $self->{buf} !~ /^$self->{headsep}/){ # record must start with a separator
+ return ();
+ }
+ $head = $self->{buf};
+ $head =~ s/^$self->{headsep}//;
+ $tl = CORE::tell($file);
+ $self->{buf} = <$file>;
+ chomp $self->{buf};
+ while (defined $self->{buf} && $self->{buf} !~ /^$self->{headsep}/){
+ $data .= $self->{buf} . $self->{linesep};
+ $tl = CORE::tell($file);
+ $self->{buf} = <$file>;
+ if (defined $self->{buf}){chomp $self->{buf}};
+ }
+ $self->{tell} = $tl;
+ return ($head, $data);
+}
+
+=item $parser->seek(posn);
+
+Resets the parser to a specific location (posn) in the file stream.
+
+=cut
+sub seek()
+{
+ my $self = shift;
+ my $pos = shift;
+ my $file = $self->{file};
+ my $headsep = $self->{headsep};
+
+ CORE::seek($file, $pos, 0);
+
+ $self->{tell} = CORE::tell($file);
+ $self->{buf} = <$file>;
+ if (! defined $self->{buf}){
+ print STDERR "File appears empty\n";
+ return undef;
+ #die("File appears empty\n");
+ }
+ if ($self->{buf} !~ /^$self->{headsep}/){
+ print STDERR "File doesn't start with a header: $headsep\n";
+ return undef;
+ #die ("File doesn't start with a header: $headsep\n");
+ }
+ chomp $self->{buf};
+} # seek
+
+=time $posn = $parser->tell();
+
+Reports offset of current record in the input file
+
+=cut
+sub tell()
+{
+ my $self = shift;
+
+ return $self->{tell};
+}
+
+}
+
+1;
diff --git a/src/PerlModules/xfig.pm b/src/PerlModules/xfig.pm
new file mode 100644
index 0000000..7126f60
--- /dev/null
+++ b/src/PerlModules/xfig.pm
@@ -0,0 +1,315 @@
+# File: xfig.pm
+# Author: Mihai Pop
+#
+# Routines that print out xfig output.
+#
+
+package AMOS::xfig;
+
+use strict;
+
+BEGIN {
+ use Exporter ();
+ use vars qw(@EXPORT @EXPORT_OK @ISA %EXPORT_TAGS);
+
+ @ISA = qw(Exporter);
+ @EXPORT = qw(&print_xfig_header
+ &print_solid_line
+ &print_box
+ &print_diamond
+ &print_tick
+ &print_x
+ &print_text
+ &print_horiz_text
+ &print_low_text
+ &print_circle
+ $BLACK $BLUE $GREEN $CYAN $RED
+ $MAGENTA $YELLOW $WHITE $FILL $NOFILL);
+ %EXPORT_TAGS = ();
+ @EXPORT_OK = ();
+}
+
+use vars @EXPORT;
+use vars @EXPORT_OK;
+
+# define some global variables
+$FILL = 20;
+$NOFILL = -1;
+
+$BLACK = 0;
+$BLUE = 1;
+$GREEN = 2;
+$CYAN = 3;
+$RED = 4;
+$MAGENTA = 5;
+$YELLOW = 6;
+$WHITE = 7;
+
+# print_xfig_header
+#
+# prints an xfig header to standard output
+sub print_xfig_header {
+ my($ppi) = @_;
+
+ print "\#FIG 3.2\n";
+ print "Landscape\n";
+ print "Center\n";
+ print "Inches\n";
+ print "Letter\n";
+ print "100.00\n";
+ print "Multiple\n";
+ print "-2\n";
+ print "$ppi 2\n";
+}
+
+# print_solid_line
+#
+# prints a line between the given x1, y1, x2, y2 coordinates
+sub print_solid_line {
+ my($x1, $y1, $x2, $y2) = @_;
+
+# Fields are:
+# 2 - polyline
+# 1 - polyline
+# 0 - solid
+# 1 - thickness
+# 0 - black (line)
+# 0 - black (fill)
+# 100 - depth
+# 0 - pen style
+# -1 - area fill
+# 0.000 - style val ??
+# 0 - join style
+# 0 - cap style
+# -1 - radius
+# 0 - forward arrow
+# 0 - backward arrow
+# 2 - number of points
+ print "2 1 0 1 0 0 100 0 -1 0.000 0 0 -1 0 0 2\n";
+# point coords
+ print "\t$x1 $y1 $x2 $y2\n";
+}
+
+# print_box
+#
+# prints a box centered at the given coordinates
+sub print_box {
+ my($x, $y, $color, $fill) = @_;
+
+# Fields are:
+# 2 - polyline
+# 2 - box
+# 0 - solid
+# 1 - thickness
+# 0 - black (line)
+# 0 - black (fill)
+# 100 - depth
+# 0 - pen style
+# -1 - area fill
+# 0.000 - style val ??
+# 0 - join style
+# 0 - cap style
+# -1 - radius
+# 0 - forward arrow
+# 0 - backward arrow
+# 2 - number of points
+ print "2 2 0 1 $color $color 100 0 $fill 0.000 0 0 -1 0 0 5\n";
+# point coords
+ printf ("\t%d %d %d %d %d %d %d %d %d %d\n", $x - 50, $y - 50,
+ $x - 50, $y + 50, $x + 50, $y + 50, $x + 50, $y - 50,
+ $x - 50, $y - 50);
+}
+
+# print_diamond
+#
+# prints a diamond centered at the given coordinates
+sub print_diamond {
+ my($x, $y, $color, $fill) = @_;
+
+# Fields are:
+# 2 - polyline
+# 2 - box
+# 0 - solid
+# 1 - thickness
+# 0 - black (line)
+# 0 - black (fill)
+# 100 - depth
+# 0 - pen style
+# -1 - area fill
+# 0.000 - style val ??
+# 0 - join style
+# 0 - cap style
+# -1 - radius
+# 0 - forward arrow
+# 0 - backward arrow
+# 2 - number of points
+ print "2 2 0 1 $color $color 100 0 $fill 0.000 0 0 -1 0 0 5\n";
+# point coords
+ printf ("\t%d %d %d %d %d %d %d %d %d %d\n", $x - 50, $y,
+ $x, $y + 50, $x + 50, $y, $x, $y - 50,
+ $x - 50, $y);
+}
+
+# print_tick
+#
+# prints tick mark at coordinate and with specified color and width
+sub print_tick {
+ my($x, $y, $color, $size) = @_;
+
+# Fields are:
+# 2 - polyline
+# 1 - line
+# 0 - solid
+# 1 - thickness
+# 0 - black (line)
+# 0 - black (fill)
+# 100 - depth
+# 0 - pen style
+# -1 - area fill
+# 0.000 - style val ??
+# 0 - join style
+# 0 - cap style
+# -1 - radius
+# 0 - forward arrow
+# 0 - backward arrow
+# 2 - number of points
+ print "2 1 0 1 $color 0 100 0 -1 0.000 0 0 -1 0 0 2\n";
+# point coords
+ printf ("\t%d %d %d %d\n", $x, $y - $size, $x, $y + $size);
+}
+
+# print_x
+#
+# prints an x mark at coordinate and with specified color
+sub print_x {
+ my($x, $y, $color) = @_;
+
+# Fields are:
+# 2 - polyline
+# 1 - line
+# 0 - solid
+# 1 - thickness
+# 0 - black (line)
+# 0 - black (fill)
+# 100 - depth
+# 0 - pen style
+# -1 - area fill
+# 0.000 - style val ??
+# 0 - join style
+# 0 - cap style
+# -1 - radius
+# 0 - forward arrow
+# 0 - backward arrow
+# 2 - number of points
+ print "2 1 0 1 $color 0 100 0 -1 0.000 0 0 -1 0 0 2\n";
+# point coords
+ printf ("\t%d %d %d %d\n", $x - 50, $y - 50, $x + 50, $y + 50);
+
+# next line
+ print "2 1 0 1 $color 0 100 0 -1 0.000 0 0 -1 0 0 2\n";
+ printf ("\t%d %d %d %d\n", $x + 50, $y - 50, $x - 50, $y + 50);
+}
+
+# print_text
+#
+# prints a string vertically at the given coordinates
+sub print_text {
+ my($x, $y, $string, $color) = @_;
+
+# Fields are:
+# 4 - polyline
+# 0 - left justified
+# 0 - color
+# 100 - depth
+# 0 - pen style
+# 0 - font
+# 12 - font size
+# 1.5708 - angle (radians)
+# 4 - font flags
+# h - height
+# l - length
+# x - x
+# y - y
+# string
+ print "4 0 $color 100 0 0 12 1.5708 4 135 ", 89 * length($string),
+ " ", $x + 68, " ", $y - 68, " $string\\001\n";
+}
+
+# print_text
+#
+# prints a string vertically at the given coordinates
+sub print_low_text {
+ my($x, $y, $string, $color) = @_;
+
+# Fields are:
+# 4 - polyline
+# 2 - right justified
+# 0 - color
+# 100 - depth
+# 0 - pen style
+# 0 - font
+# 12 - font size
+# 1.5708 - angle (radians)
+# 4 - font flags
+# h - height
+# l - length
+# x - x
+# y - y
+# string
+ print "4 2 $color 100 0 0 12 1.5708 4 135 ", 89 * length($string),
+ " ", $x + 68, " ", $y + 68, " $string\\001\n";
+}
+
+# print_horiz_text
+#
+# prints a string vertically at the given coordinates
+sub print_horiz_text {
+ my($x, $y, $string, $color) = @_;
+
+# Fields are:
+# 4 - polyline
+# 1 - center justified
+# 0 - color
+# 100 - depth
+# 0 - pen style
+# 0 - font
+# 12 - font size
+# 1.5708 - angle (radians)
+# 4 - font flags
+# h - height
+# l - length
+# x - x
+# y - y
+# string
+ print "4 1 $color 100 0 0 12 0 4 135 ", 89 * length($string),
+ " ", $x, " ", $y, " $string\\001\n";
+}
+
+# print_circle
+#
+# draws a circle centered at the given coordinates in the specified color
+sub print_circle {
+ my($x, $y, $color, $fill) = @_;
+
+# Fields are:
+# 1 - ellipse
+# 3 - circle
+# 0 - solid
+# 1 - thickness
+# 0 - black (line)
+# 0 - black (fill)
+# 100 - depth
+# 0 - pen style
+# -1 - area fill
+# 0.000 - style val ??
+# 1 - direction
+# 0 - angle
+# cx,cy - center coords
+# rx,ry - radius
+# sx,sy - first point
+# ex,ey - last point
+ print "1 3 0 1 $color $color 100 0 $fill 0.000 1 0.000 $x $y ",
+ "50 50 $x $y ", $x + 50, " $y\n";
+}
+
+END {}
diff --git a/src/Pipeline/AMOScmp-shortReads-alignmentTrimmed.acf b/src/Pipeline/AMOScmp-shortReads-alignmentTrimmed.acf
new file mode 100755
index 0000000..f6aed61
--- /dev/null
+++ b/src/Pipeline/AMOScmp-shortReads-alignmentTrimmed.acf
@@ -0,0 +1,87 @@
+# `AMOScmp' - The AMOS Comparative Assembler Pipeline
+
+#--------------------------------------- SCRIPT PATHS -------------------------#
+
+BINDIR=/usr/local/bin
+NUCMER=/usr/local/bin/nucmer
+DELTAFILTER=/usr/local/bin/delta-filter
+
+#--------------------------------------- USER DEFINED VALUES ------------------#
+
+MINCLUSTER = 16
+MINMATCH = 16
+MINLEN = 24
+MINOVL = 5
+MAXTRIM = 10
+MAJORITY = 50
+CONSERR = 0.06
+ALIGNWIGGLE = 2
+
+#------------------------------------------------------------------------------#
+
+TGT = $(PREFIX).afg
+REF = $(PREFIX).1con
+SEQS = $(PREFIX).seq
+CLR = $(PREFIX).clr
+CVG = $(PREFIX).0cvg
+BANK = $(PREFIX).bnk
+ALIGN = $(PREFIX).delta
+ALIGNTMP= $(ALIGN).tmp
+LAYOUT = $(PREFIX).layout
+CONFLICT= $(PREFIX).conflict
+CONTIG = $(PREFIX).contig
+FASTA = $(PREFIX).fasta
+EXCLUDE = $(PREFIX).exclude.seqs
+SCAFF = $(PREFIX).scaff
+SCAFFFASTA = $(PREFIX).scaffold.fasta
+
+#------------------------------------------------------------------------------#
+
+INPUTS = $(TGT) $(REF)
+OUTPUTS = $(CONTIG) $(FASTA) $(SCAFF) $(SCAFFFASTA)
+
+#----------------------------------------PIPELINE ------------------------------#
+
+## Building AMOS bank
+10: $(BINDIR)/bank-transact -c -z -b $(BANK) -m $(TGT)
+
+## Collecting clear range sequences
+20: $(BINDIR)/dumpreads $(BANK) > $(SEQS)
+
+## Running nucmer on all reads
+30: $(NUCMER) --maxmatch --prefix=$(PREFIX) -l $(MINMATCH) -c $(MINCLUSTER) $(REF) $(SEQS)
+
+## Filter align file
+31: $(DELTAFILTER) -l $(MINLEN) $(ALIGN) > $(ALIGNTMP)
+32: mv $(ALIGNTMP) $(ALIGN)
+
+## Getting zero coverage regions
+33: $(BINDIR)/delta2cvg -M 0 < $(ALIGN) > $(CVG)
+
+## Getting aligned read iid's and clear ranges
+34: $(BINDIR)/delta2clr -zero_cvg $(CVG) < $(ALIGN) > $(CLR)
+
+## Updating bank read clear ranges
+35: $(BINDIR)/updateClrRanges -i $(BANK) $(CLR)
+
+## Updating align file clear ranges
+36: $(BINDIR)/updateDeltaClr $(ALIGN) $(CLR) > $(ALIGNTMP)
+37: mv $(ALIGNTMP) $(ALIGN)
+
+## Running layout
+40: $(BINDIR)/casm-layout -r -t $(MAXTRIM) -o $(MINOVL) -m $(MAJORITY) -U $(LAYOUT) -C $(CONFLICT) -b $(BANK) $(ALIGN)
+
+## Running consensus
+50: $(BINDIR)/make-consensus -B -e $(CONSERR) -b $(BANK) -w $(ALIGNWIGGLE) -x $(EXCLUDE)
+
+## Outputting contigs
+60: $(BINDIR)/bank2contig $(BANK) > $(CONTIG)
+
+## Outputting contig fasta
+70: $(BINDIR)/bank2fasta -e -b $(BANK) > $(FASTA)
+
+## Outputting scaff
+80: $(BINDIR)/bank2scaff $(BANK) > $(SCAFF)
+
+## Outputting scaff fasta
+90: $(BINDIR)/bank2scaff -g $(BANK) > $(SCAFFFASTA)
diff --git a/src/Pipeline/AMOScmp-shortReads.acf b/src/Pipeline/AMOScmp-shortReads.acf
new file mode 100755
index 0000000..3d7d7bf
--- /dev/null
+++ b/src/Pipeline/AMOScmp-shortReads.acf
@@ -0,0 +1,66 @@
+# `AMOScmp' - The AMOS Comparative Assembler Pipeline
+
+#--------------------------------------- USER DEFINED VALUES ------------------#
+
+BINDIR=/usr/local/bin
+NUCMER=/usr/local/bin/nucmer
+
+#------------------------------------------------------------------------------#
+
+MINMATCH = 20
+MINCLUSTER = 20
+MINOVL = 5
+MAXTRIM = 10
+MAJORITY = 50
+ALIGNWIGGLE = 2
+CONSERR = 0.06
+
+#------------------------------------------------------------------------------#
+
+TGT = $(PREFIX).afg
+REF = $(PREFIX).1con
+SEQS = $(PREFIX).seq
+BANK = $(PREFIX).bnk
+ALIGN = $(PREFIX).delta
+LAYOUT = $(PREFIX).layout
+CONFLICT= $(PREFIX).conflict
+CONTIG = $(PREFIX).contig
+FASTA = $(PREFIX).fasta
+EXCLUDE = $(PREFIX).exclude.seqs
+SCAFF = $(PREFIX).scaff
+SCAFFFASTA = $(PREFIX).scaffold.fasta
+
+#------------------------------------------------------------------------------#
+
+INPUTS = $(TGT) $(REF)
+OUTPUTS = $(CONTIG) $(FASTA) $(SCAFF) $(SCAFFFASTA)
+
+#------------------------------------------------------------------------------#
+
+## Building AMOS bank
+10: $(BINDIR)/bank-transact -c -z -b $(BANK) -m $(TGT)
+
+## Collecting clear range sequences
+20: $(BINDIR)/dumpreads $(BANK) > $(SEQS)
+
+## Running nucmer
+30: $(NUCMER) --maxmatch --prefix=$(PREFIX) -l $(MINMATCH) -c $(MINCLUSTER) $(REF) $(SEQS)
+
+## Running layout
+40: $(BINDIR)/casm-layout -r -S -t $(MAXTRIM) -o $(MINOVL) -m $(MAJORITY) -U $(LAYOUT) -C $(CONFLICT) -b $(BANK) $(ALIGN)
+
+## Running consensus
+50: $(BINDIR)/make-consensus -B -b $(BANK) -e $(CONSERR) -w $(ALIGNWIGGLE) -x $(EXCLUDE)
+
+## Outputting contigs
+60: $(BINDIR)/bank2contig $(BANK) > $(CONTIG)
+
+## Outputting fasta
+70: $(BINDIR)/bank2fasta -b $(BANK) > $(FASTA)
+
+## Outputting scaff
+80: $(BINDIR)/bank2scaff $(BANK) > $(SCAFF)
+
+## Outputting scaff fasta
+90: $(BINDIR)/bank2scaff -g $(BANK) > $(SCAFFFASTA)
+
diff --git a/src/Pipeline/AMOScmp.acf b/src/Pipeline/AMOScmp.acf
new file mode 100644
index 0000000..7ca341c
--- /dev/null
+++ b/src/Pipeline/AMOScmp.acf
@@ -0,0 +1,42 @@
+# `AMOScmp' - The AMOS Comparative Assembler Pipeline
+
+#--------------------------------------- USER DEFINED VALUES ------------------#
+TGT = $(PREFIX).afg
+REF = $(PREFIX).1con
+#------------------------------------------------------------------------------#
+
+BINDIR = /usr/local/bin
+NUCMER = /usr/local/bin/nucmer
+
+SEQS = $(PREFIX).seq
+BANK = $(PREFIX).bnk
+ALIGN = $(PREFIX).delta
+LAYOUT = $(PREFIX).layout
+CONFLICT = $(PREFIX).conflict
+CONTIG = $(PREFIX).contig
+FASTA = $(PREFIX).fasta
+
+INPUTS = $(TGT) $(REF)
+OUTPUTS = $(CONTIG) $(FASTA)
+
+
+## Building AMOS bank
+10: $(BINDIR)/bank-transact -c -z -b $(BANK) -m $(TGT)
+
+## Collecting clear range sequences
+20: $(BINDIR)/dumpreads $(BANK) > $(SEQS)
+
+## Running nucmer
+30: $(NUCMER) --maxmatch --prefix=$(PREFIX) $(REF) $(SEQS)
+
+## Running layout
+40: $(BINDIR)/casm-layout -U $(LAYOUT) -C $(CONFLICT) -b $(BANK) $(ALIGN)
+
+## Running consensus
+50: $(BINDIR)/make-consensus -B -b $(BANK)
+
+## Outputting contigs
+60: $(BINDIR)/bank2contig $(BANK) > $(CONTIG)
+
+## Outputting fasta
+70: $(BINDIR)/bank2fasta -b $(BANK) > $(FASTA)
diff --git a/src/Pipeline/FRCurve.acf b/src/Pipeline/FRCurve.acf
new file mode 100644
index 0000000..ae465cc
--- /dev/null
+++ b/src/Pipeline/FRCurve.acf
@@ -0,0 +1,48 @@
+# The "FRCurve" pipeline
+
+#? Feature-Response Curve pipeline
+#?
+#? Usage:
+#? FRCurve [params] \
+#? -D GENOME_SIZE=<n> - Genome size (number of bps)
+#? -D BANK=<n> - AMOS bank name
+#?
+#? Description:
+#? The Feature-Response curve characterizes the sensitivity (coverage) of the sequence
+#? assembler as a function of its discrimination threshold (number of features).
+#? Given any set of features computed by the amosvalidate pipeline, the response (quality)
+#? of the assembler output is analyzed as a function of the maximum number of possible
+#? errors (features) allowed in the contigs.
+#? For more details see the wiki page at:
+#? http://sourceforge.net/apps/mediawiki/amos/index.php?title=FRCurve
+#?
+#? Output:
+#? The Feature-Response curve (FRC) is saved in file "FRC.txt", while
+#? FRCs for each feature type are saved respectively in:
+#? "FRC_coverage.txt", "FRC_polymorphism.txt", "FRC_breakpoint.txt",
+#? "FRC_kmer.txt", "FRC_matepair.txt" and "FRC_misassembly.txt"
+#?
+#? Output file format:
+#? Each file contains the FRCs in 3-columns format
+#? - column 1 = feature threshold T;
+#? - column 2 = contigs' N50 associated to the threshold T in column 1;
+#? - column 3 = cumulative size of the contigs whose number of features is <= T;
+#?
+
+BINDIR = /usr/local/bin
+
+# Genome size (number of bps)
+GENOME_SIZE = 1
+
+# Banks name
+BANK = bank.bnk
+
+#---Getting down to business---#
+
+## Running amosvalidate
+10: $(BINDIR)/amosvalidate $(BANK)
+
+## Compute Feature-Response Curve
+20: $(BINDIR)/getFRCvalues -g $(GENOME_SIZE) -b $(BANK)
+
+
diff --git a/src/Pipeline/Makefile.am b/src/Pipeline/Makefile.am
new file mode 100644
index 0000000..959391f
--- /dev/null
+++ b/src/Pipeline/Makefile.am
@@ -0,0 +1,38 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+##-- TO BE INSTALLED
+dist_bin_SCRIPTS =
+
+if BUILD_all
+dist_bin_SCRIPTS += \
+ AMOScmp.acf \
+ AMOScmp-shortReads.acf \
+ AMOScmp-shortReads-alignmentTrimmed.acf \
+ minimus.acf \
+ Minimo.acf \
+ minimus2.acf \
+ minimus2-blat.acf \
+ assembleRNAs.acf \
+ gene_asm.acf \
+ FRCurve.acf \
+ goBambus2.py
+
+endif BUILD_all
+
+if BUILD_AMOScmp
+dist_bin_SCRIPTS += AMOScmp.acf
+dist_bin_SCRIPTS += AMOScmp-shortReads.acf
+dist_bin_SCRIPTS += AMOScmp-shortReads-alignmentTrimmed.acf
+endif BUILD_AMOScmp
+
+if BUILD_minimus
+dist_bin_SCRIPTS += minimus.acf
+dist_bin_SCRIPTS += Minimo.acf
+dist_bin_SCRIPTS += minimus2.acf
+dist_bin_SCRIPTS += minimus2-blat.acf
+endif BUILD_minimus
+
+
+##-- END OF MAKEFILE --##
diff --git a/src/Pipeline/Makefile.in b/src/Pipeline/Makefile.in
new file mode 100644
index 0000000..e3f0031
--- /dev/null
+++ b/src/Pipeline/Makefile.in
@@ -0,0 +1,503 @@
+# 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 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@
+DIST_COMMON = $(am__dist_bin_SCRIPTS_DIST) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+ at BUILD_all_TRUE@am__append_1 = \
+ at BUILD_all_TRUE@ AMOScmp.acf \
+ at BUILD_all_TRUE@ AMOScmp-shortReads.acf \
+ at BUILD_all_TRUE@ AMOScmp-shortReads-alignmentTrimmed.acf \
+ at BUILD_all_TRUE@ minimus.acf \
+ at BUILD_all_TRUE@ Minimo.acf \
+ at BUILD_all_TRUE@ minimus2.acf \
+ at BUILD_all_TRUE@ minimus2-blat.acf \
+ at BUILD_all_TRUE@ assembleRNAs.acf \
+ at BUILD_all_TRUE@ gene_asm.acf \
+ at BUILD_all_TRUE@ FRCurve.acf \
+ at BUILD_all_TRUE@ goBambus2.py
+
+ at BUILD_AMOScmp_TRUE@am__append_2 = AMOScmp.acf AMOScmp-shortReads.acf \
+ at BUILD_AMOScmp_TRUE@ AMOScmp-shortReads-alignmentTrimmed.acf
+ at BUILD_minimus_TRUE@am__append_3 = minimus.acf Minimo.acf minimus2.acf \
+ at BUILD_minimus_TRUE@ minimus2-blat.acf
+subdir = src/Pipeline
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__dist_bin_SCRIPTS_DIST = AMOScmp.acf AMOScmp-shortReads.acf \
+ AMOScmp-shortReads-alignmentTrimmed.acf minimus.acf Minimo.acf \
+ minimus2.acf minimus2-blat.acf assembleRNAs.acf gene_asm.acf \
+ FRCurve.acf goBambus2.py
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(bindir)"
+SCRIPTS = $(dist_bin_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+dist_bin_SCRIPTS = $(am__append_1) $(am__append_2) $(am__append_3)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Pipeline/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Pipeline/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):
+install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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 $(SCRIPTS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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 mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+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-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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 -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-dist_binSCRIPTS 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 pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-dist_binSCRIPTS uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Pipeline/Minimo.acf b/src/Pipeline/Minimo.acf
new file mode 100644
index 0000000..c5e1d24
--- /dev/null
+++ b/src/Pipeline/Minimo.acf
@@ -0,0 +1,141 @@
+#--------------------------------------- USAGE --------------------------------#
+
+#?
+#? Minimo is a de novo assembler based on the AMOS infrastructure. Minimo uses a
+#? conservative overlap-layout-consensus algorithm to avoid mis-assemblies and
+#? can be applied to short reads. The input is a FASTA file and there are options
+#? to control the stringency of the assembly and the processing of the quality
+#? scores. By default, the results are in the AMOS format and written to the
+#? directory where the input FASTA file is located.
+#?
+#? Usage:
+#? Minimo FASTA_IN [options]
+#?
+#? Options:
+#? -D QUAL_IN=<file> Input quality score file (in Phred format)
+#? -D GOOD_QUAL=<n> Quality score to set for bases within the clear
+#? range if no quality file was given (default: 30)
+#? -D BAD_QUAL=<n> Quality score to set for bases outside clear range
+#? if no quality file was given (default: 10). If your
+#? sequences are trimmed, try the same value as GOOD_QUAL.
+#? -D MIN_LEN=<n> Minimum contig overlap length (at least 20 bp,
+#? default: 35)
+#? -D MIN_IDENT=<d> Minimum contig overlap identity percentage (between 0
+#? and 100 %, default: 98)
+#? -D ALN_WIGGLE=<d> Alignment wiggle value (from 2 for short reads to 15 for
+#? long reads, default: 2)
+#? -D FASTA_EXP=<n> Export results in FASTA format (0:no 1:yes, default: 0)
+#? -D ACE_EXP=<n> Export results in ACE format (0:no 1:yes, default: 0)
+#? -D OUT_PREFIX=<s> Prefix to use for the output file path and name
+#?
+#? Minimo v1.6. Copyright Florent Angly 2010. Under the GPL v3 open-source license.
+#?
+
+BINDIR = /usr/local/bin
+
+# --------------------------------------- ARGUMENTS AND DEFAULTS ---------------#
+
+# Expecting one mandatory argument, the FASTA filename
+EXPECT 1
+FASTA_IN = $(PREFIX)
+
+# Defaults parameters
+QUAL_IN = ""
+GOOD_QUAL = 30
+BAD_QUAL = 10
+MIN_LEN = 35
+MIN_IDENT = 98
+ALN_WIGGLE = 2
+FASTA_EXP = 0
+ACE_EXP = 0
+OUT_PREFIX = ""
+
+# Verbosity level (from 0 to ??)
+VERBOSE = 0
+
+# File directory and basename (strip FASTA filename of its extensions)
+FASTA_BASE = $(shell /bin/echo -n `dirname $(FASTA_IN\)`/`basename $(FASTA_IN\) | cut -d'.' -f1`)
+
+# Output prefix determined from user input if specified, from the fasta file otherwise
+BASE = $(shell if [ "$(OUT_PREFIX\)" != "" ]; then /bin/echo -n $(OUT_PREFIX\); else /bin/echo -n $(FASTA_BASE\); fi)
+
+# Convert percentage of identity between overlaps from % to fractional
+MAX_OVL_ERROR = $(shell /bin/echo -n `/bin/echo "scale=3; 1 - $(MIN_IDENT\) / 100" | bc`)
+
+# The error in the consensus sequence is twice the overlap error to allow
+# for independent errors from different sequences
+MAX_CONS_ERROR = $(shell /bin/echo -n `/bin/echo "scale=3; $(MAX_OVL_ERROR\) * 2" | bc`)
+
+#------------------------------------ FILENAMES ------------------------------#
+
+BANK = $(BASE).bnk
+SINGLE_LST = $(BASE).lst
+FASTA_OUT = $(BASE)-contigs.fa
+QUAL_OUT = $(BASE)-contigs.qual
+AMOS_OUT = $(BASE)-contigs.afg
+ACE_OUT = $(BASE)-contigs.ace
+
+## Printing parameters
+10: /bin/echo "Running Minimo with:\nFASTA_IN='$(FASTA_IN)'\nQUAL_IN='$(QUAL_IN)'\nGOOD_QUAL='$(GOOD_QUAL)'\nBAD_QUAL='$(BAD_QUAL)'\nMIN_LEN='$(MIN_LEN)'\nMIN_IDENT='$(MIN_IDENT)'\nMAX_OVL_ERROR='$(MAX_OVL_ERROR)'\nMAX_CONS_ERROR='$(MAX_CONS_ERROR)'\nALN_WIGGLE='$(ALN_WIGGLE)'\nFASTA_EXP='$(FASTA_EXP)'\nBASE='$(BASE)'\nFASTA_OUT='$(FASTA_OUT)'\nQUAL_OUT='$(QUAL_OUT)'\nAMOS_OUT='$(AMOS_OUT)'\nACE_OUT='$(ACE_OUT)'\nVERBOSE='$(VERBOSE)'"
+
+# Required input files
+INPUTS = $(FASTA_IN)
+
+# Temp files
+TEMPS = $(BANK) $(SINGLE_LST)
+
+# Output files
+OUTPUTS = $(FASTA_OUT) $(QUAL_OUT) $(AMOS_OUT) $(ACE_OUT)
+
+#----------------------------------- IMPORT SEQUENCES -------------------------#
+
+## Creating output directory
+20: if [ ! -d `dirname $(BASE)` ]; then mkdir `dirname $(BASE)`; fi
+
+## Warning about pre-existing AMOS bank
+30: if [ -d $(BANK) ]; then /bin/echo "Warning: overwriting existing AMOS bank $(BANK)"; fi;
+
+## Importing the FASTA and QUAL files to an AMOS bank
+40: if [ "$(QUAL_IN)" != "" ]; then $(BINDIR)/toAmos -s $(FASTA_IN) -q $(QUAL_IN) -gq $(GOOD_QUAL) -bq $(BAD_QUAL) -o - | $(BINDIR)/bank-transact -c -z -f -b $(BANK) -m -; else $(BINDIR)/toAmos -s $(FASTA_IN) -gq $(GOOD_QUAL) -bq $(BAD_QUAL) -o - | $(BINDIR)/bank-transact -c -z -f -b $(BANK) -m -; fi
+
+#----------------------------------- ASSEMBLE ---------------------------------#
+
+## Calculating overlaps between reads
+# The minimizers (approximate k-mers) considered are 20 bp long.
+# Default minimum overlap length is 40 bp.
+# Default maximum overlap error is 0.06 (6 %).
+50: $(BINDIR)/hash-overlap -B -o $(MIN_LEN) -x $(MAX_OVL_ERROR) -v $(VERBOSE) $(BANK)
+
+## Forming contigs
+60: $(BINDIR)/tigger -b $(BANK)
+
+## Determining contig consensus sequences
+# Default fraction of errors allowed in alignments 0.06 (6 %).
+# Default minimum number of bases strings in multialignment must overlap is 5 bp.
+70: $(BINDIR)/make-consensus -b -B -o $(MIN_LEN) -e $(MAX_CONS_ERROR) -w $(ALN_WIGGLE) -v $(VERBOSE) $(BANK)
+
+#----------------------------------- EXPORT SEQUENCES AND CONTIGS -------------#
+
+## Exporting results to an AMOS file
+#...all objects are exported: universal UNV, contig link CTL, contig edge CTE, fragment FRG, k-mer KMR, library LIB, matepair MTP, overlap OVL, scaffold SCF, sequence SEQ, contig CTG, read RED, distribution DST, tile TLE
+80: $(BINDIR)/bank-report -b $(BANK) > $(AMOS_OUT)
+
+## Exporting contigs to a FASTA and QUAL file
+#...using IIDs (EIDs are undefined for contigs) and contig details (num reads, coverage) on fasta header line
+90: if [ $(FASTA_EXP) -eq 1 ]; then $(BINDIR)/bank2fasta -b $(BANK) -iid -q $(QUAL_OUT) -d > $(FASTA_OUT); fi
+## Listing singletons IDs
+91: if [ $(FASTA_EXP) -eq 1 ]; then $(BINDIR)/listReadPlacedStatus -S -I $(BANK) > $(SINGLE_LST); fi
+## Exporting singletons to the FASTA file
+#...use sequence full range and use EIDs (not IIDs to avoid conflict with contigs IIDs)
+92: if [ $(FASTA_EXP) -eq 1 ]; then $(BINDIR)/dumpreads -r -e -I $(SINGLE_LST) $(BANK) >> $(FASTA_OUT); fi
+## Exporting singletons to the QUAL file
+#...use qualities full range and use EIDs (not IIDs to avoid conflict with contigs IIDs)
+93: if [ $(FASTA_EXP) -eq 1 ]; then $(BINDIR)/dumpreads -r -e -q -I $(SINGLE_LST) $(BANK) >> $(QUAL_OUT); fi
+
+## Export results to an ACE file
+100: if [ $(ACE_EXP) -eq 1 ]; then $(BINDIR)/amos2ace $(AMOS_OUT) -o $(ACE_OUT); fi
+
+#----------------------------------- CLEAN UP ---------------------------------#
+
+## Removing temporary files and folders
+110: rm -rf $(TEMPS)
diff --git a/src/Pipeline/assembleRNAs.acf b/src/Pipeline/assembleRNAs.acf
new file mode 100644
index 0000000..26f8655
--- /dev/null
+++ b/src/Pipeline/assembleRNAs.acf
@@ -0,0 +1,27 @@
+# `minimus' - The AMOS Lightweight Assembler Pipeline
+
+#--------------------------------------- USER DEFINED VALUES ------------------#
+TGT = $(strip .frg PREFIX).afg
+#------------------------------------------------------------------------------#
+PREF = $(strip .frg PREFIX)
+
+BINDIR = /usr/local/bin
+
+BANK = $(PREF).bnk
+CONTIG = $(PREF).contig
+FASTA = $(PREF).fasta
+
+## Converting to AFG
+10: $(BINDIR)/toAmos -f $(PREFIX) -o $(TGT)
+
+## Building AMOS bank
+20: $(BINDIR)/bank-transact -c -z -b $(BANK) -m $(TGT)
+
+## Assembling fragments
+30: (export AMOSBIN=$(BINDIR); $(BINDIR)/preassembleFrgs $(BANK))
+
+## Outputting contigs
+40: $(BINDIR)/bank2contig $(BANK) > $(CONTIG)
+
+## Converting to FastA file
+50: $(BINDIR)/bank2fasta -b $(BANK) > $(FASTA)
diff --git a/src/Pipeline/gene_asm.acf b/src/Pipeline/gene_asm.acf
new file mode 100755
index 0000000..f66fa97
--- /dev/null
+++ b/src/Pipeline/gene_asm.acf
@@ -0,0 +1,34 @@
+# `gene_asm' - Gene Assembler
+
+#--------------------------------------- USER DEFINED VALUES ------------------#
+PREF = $(strip .afg PREFIX)
+TGT = $(PREF).afg
+#------------------------------------------------------------------------------#
+
+BINDIR = /usr/local/bin
+
+BANK = $(PREF).bnk
+CONTIG = $(PREF).contig
+FASTA = $(PREF).fasta
+
+INPUTS = $(TGT) $(AA)
+OUTPUTS = $(CONTIG) $(FASTA)
+
+
+## Building AMOS bank
+10: $(BINDIR)/bank-transact -c -z -b $(BANK) -m $(TGT)
+
+## Running overlap
+20: $(BINDIR)/hash-overlap -B $(BANK)
+
+## Running contigger
+30: $(BINDIR)/tigger -b $(BANK)
+
+## Running consensus
+40: $(BINDIR)/make-consensus -B -b $(BANK)
+
+## Outputting contigs
+50: $(BINDIR)/bank2contig $(BANK) > $(CONTIG)
+
+## Converting to FastA file
+60: $(BINDIR)/bank2fasta -b $(BANK) > $(FASTA)
diff --git a/src/Pipeline/goBambus2.py b/src/Pipeline/goBambus2.py
new file mode 100644
index 0000000..6e2a448
--- /dev/null
+++ b/src/Pipeline/goBambus2.py
@@ -0,0 +1,391 @@
+#pipeline script for assembly + Bambus 2
+#contributed by Todd J Treangen
+
+import string, sys, os, subprocess#, spincursor
+
+RED = "\033[0;31m"
+GREEN = "\033[0;32m"
+BLUE = "\033[0;34m"
+NONE = "\033[0m"
+
+#set a path to AMOS, to local directory, or if already installed in PATH , set to ""
+AMOSDIR = ""
+LOGFILE = "bambus2.log"
+
+if __name__ == "__main__":
+ logfile = open(LOGFILE,'w')
+ #input can be CONTIGS, or READS that need assembly into CONTIGS, plus need LINK INFO
+ #IF CONTIGS, no need for minimus, but need to call tarchive2amos -c contigfile
+ #IF NO CONTIGS, use minimus as default (other also ?)
+ #NEED TO ADD IN OTHER USEFUL PARAMETERS, ADD IN PYTHON FILE TO BUILD SYSTEM
+
+ #INPUT: CONTIGS + MATES, READS + TRACE XML, OR AMOS BANK (3 options)
+ usage = "\nrun: goBambus2.py <input reads or contigs or amos bank name> <output prefix> [options]\n"
+ usage += "eg.: goBambus2.py example.contigs myoutput --all --contigs\n"
+ usage += "This script is designed to run the Bambus pipeline and takes either reads or contigs plus XML Trace Archive data as input and outputs scaffolds\n"
+ usage += "For further info please contact the Bambus 2 authors: Sergey Koren and Mihai Pop\n"
+ if len(sys.argv) < 3:
+ print usage
+ sys.exit(1)
+ if len(sys.argv) > 3:
+ options = sys.argv[2:]
+ #print "options: ", options
+ opts = ["2amos","minimus","clk","bundle","reps","orient","untangle","2fasta","printscaff"]
+ xopts = ["new","verbose","all","contigs","reads"]
+ #-2amos
+ #-minimus
+ #-clk
+ #-bundle
+ #-reps
+ #-orient
+ #-untangle
+ #-2fasta
+ #-printScaff
+ opt_dict = {}
+ xopt_dict = {}
+ for opt in opts:
+ opt_dict[opt] = [""]
+ opt_dict["orient"] = "-noreduce"
+ for opt in xopts:
+ xopt_dict[opt] = 0
+
+ if len(sys.argv) > 3:
+ for opt in opt_dict.keys():
+ opt_dict[opt] = []
+ for opt in sys.argv[3:]:
+ opt_list = opt.split(",")
+ mopt = opt_list[0]
+ mopt = mopt.replace("-", "")
+ xopt = opt_list[1:]
+
+ if mopt in opt_dict.keys():
+ if len(xopt) == 0:
+ xopt = [" "]
+ opt_dict[mopt] = xopt
+ else:
+ try:
+ xopt_dict[sopt] = xopt_dict[sopt] = 1
+ except KeyError:
+ pass
+
+ prefix = sys.argv[1].split(".")[0]
+ outprefix = sys.argv[2]
+ sequence_file = os.getcwd() + "/" + sys.argv[1]
+
+ vtext = subprocess.PIPE
+ if xopt_dict["verbose"] == 1:
+ vtext = None
+ #see if trace archive file present
+ xml_file = os.getcwd() + "/" + prefix +".xml"
+ exists_xml = True
+ if not os.path.exists(xml_file):
+ exists_xml = False
+
+ #need to run
+ amosbank = outprefix+".bnk"
+ if xopt_dict["contigs"] == 1:
+ mate_file = os.getcwd() + "/" + prefix +".mates"
+ contig_file = os.getcwd() + "/" + prefix +".contig"
+ afg_file = os.getcwd() + "/" + outprefix +".afg"
+ bank_file = os.getcwd() + "/" + outprefix +".bnk"
+ if not os.path.exists(mate_file):
+ print "mate pair info not present!"
+ sys.exit(1)
+ if not os.path.exists(contig_file):
+ print "contig info not present!"
+ sys.exit(1)
+ if not os.path.exists(afg_file) or 1:
+ p = subprocess.Popen(AMOSDIR+"toAmos -o %s.afg -s %s -m %s -c %s"%(outprefix,sys.argv[1], mate_file, contig_file), shell=True, stdin=subprocess.PIPE, stdout=vtext, stderr=logfile)
+
+ if xopt_dict["verbose"] == 1:
+ print "1) running toAmos"
+
+ else:
+ print "1) running toAmos...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+
+ else:
+ print "1) running toAmos: AMOS format AFG file already existing, will use existing file"
+
+
+ if not os.path.exists(bank_file) or 1:
+ p = subprocess.Popen(AMOSDIR+"bank-transact -cf -b %s -m %s.afg"%(amosbank,outprefix), shell=True, stdin=subprocess.PIPE, stdout=vtext, stderr=logfile)
+ if xopt_dict["verbose"] == 1:
+ print "2) running bank-transact"
+
+ else:
+ print "2) running bank-transact...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+ else:
+ print "2) running bank-transact: BANK file already exists, skipping"
+
+
+ elif xopt_dict["reads"] == 1 and (not exists_xml or xopt_dict["2amos"] ==1):
+ mate_file = os.getcwd() + "/" + prefix +".mates"
+ afg_file = os.getcwd() + "/" + outprefix +".afg"
+ bank_file = os.getcwd() + "/" + outprefix +".bnk"
+ if not os.path.exists(afg_file) and not os.path.exists(mate_file):
+ print "mate pair info not present!"
+ sys.exit(1)
+
+ if not os.path.exists(afg_file) or 0:
+ p = subprocess.Popen(AMOSDIR+"toAmos -o %s.afg -s %s -m %s"%(outprefix,sys.argv[1], mate_file), shell=True, stdin=subprocess.PIPE, stdout=vtext, stderr=logfile)
+
+ if xopt_dict["verbose"] == 1:
+ print "1) running toAmos"
+
+ else:
+ print "1) running toAmos...",
+
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+
+ else:
+ print "1) running toAmos: AMOS format AFG file already existing, will use existing file"
+
+
+ p = subprocess.Popen(AMOSDIR+"minimus %s"%(outprefix), shell=True, stdin=subprocess.PIPE, stdout=vtext, stderr=logfile)
+
+ if xopt_dict["verbose"] == 1:
+ print "2) running minimus"
+ else:
+ print "2) running minimus...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+
+
+ elif xopt_dict["reads"] == 1:
+ p = subprocess.Popen(AMOSDIR+"tarchive2amos -o %s %s"%(outprefix,sys.argv[1]), shell=True, stdin=subprocess.PIPE, stdout=vtext, stderr=logfile)
+ if xopt_dict["verbose"] == 1:
+ print "1) running tarchive2amos"
+
+ else:
+ print "1) running tarchive2amos...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+
+ p = subprocess.Popen(AMOSDIR+"minimus %s"%(outprefix), shell=True, stdin=subprocess.PIPE, stdout=vtext, stderr=logfile)
+
+ if xopt_dict["verbose"] == 1:
+ print "2) running minimus"
+ else:
+ print "2) running minimus...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+
+
+ else:
+ #assuming existing good AMOS bank
+ amosbank = sys.argv[1]
+ amosbank_file = os.getcwd() + "/" + amosbank
+
+ if not os.path.exists(amosbank_file):
+ print "AMOS bank does not exist!"
+ sys.exit(1)
+
+ if xopt_dict["all"] == 1 or len(opt_dict["clk"]) > 0:
+ p = subprocess.Popen(AMOSDIR+"clk -b %s"%(amosbank), shell=True, stdin=subprocess.PIPE, stdout=vtext, stderr=logfile)
+ if xopt_dict["verbose"] == 1:
+ print "3) running clk"
+ else:
+ print "3) running clk...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+
+ if xopt_dict["all"] == 1 or len(opt_dict["bundle"]) > 0:
+ p = subprocess.Popen(AMOSDIR+"Bundler -b %s"%(amosbank), shell=True, stdin=subprocess.PIPE, stdout=vtext, stderr=logfile)
+ if xopt_dict["verbose"] == 1:
+ print "4) running Bundler"
+ else:
+ print "4) running Bundler...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+
+ if xopt_dict["all"] == 1 or len(opt_dict["reps"]) > 0:
+ repfile = open("myreps",'w')
+ p = subprocess.Popen(AMOSDIR+"MarkRepeats -b %s"%(amosbank), shell=True, stdin=subprocess.PIPE, stdout=repfile, stderr=logfile)
+ if xopt_dict["verbose"] == 1:
+ print "5) running MarkRepeats"
+ else:
+ print "5) running MarkRepeats...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+
+ #quality control, check how many repeats file has
+ repfile.close()
+ repfile = open("myreps",'r')
+ nreps = len(repfile.readlines())
+ print "\t%s %s repeats found%s"%(BLUE,nreps,NONE)
+
+ if xopt_dict["all"] == 1 or len(opt_dict["orient"]) > 0:
+ p = subprocess.Popen(AMOSDIR+"OrientContigs -b %s -repeats myreps %s"%(amosbank, "".join(opt_dict["orient"])), shell=True, stdin=subprocess.PIPE, stdout=vtext, stderr=logfile)
+
+ if xopt_dict["verbose"] == 1:
+ print "6) running OrientContigs"
+ else:
+ print "6) running OrientContigs...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+
+ p = subprocess.Popen(AMOSDIR+"OutputResults -b %s -prefix %s %s"%(amosbank, prefix+".scaff"), shell=True, stdin=subprocess.PIPE, stdout=vtext, stderr=logfile)
+
+ if xopt_dict["verbose"] == 1:
+ print "6) running OutputResults"
+ else:
+ print "6) running OutputResults...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+
+ if xopt_dict["all"] == 1 or len(opt_dict["2fasta"]) > 0:
+ contigfile = open("%s.contigs.fasta"%(outprefix),'w')
+ p = subprocess.Popen(AMOSDIR+"bank2fasta -d -b %s"%(amosbank), shell=True, stdin=subprocess.PIPE, stdout=contigfile, stderr=logfile)
+ if xopt_dict["verbose"] == 1:
+ print "7) running bank2fasta"
+ else:
+ print "7) running bank2fasta...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+
+ contigfile.close()
+
+ contigfile = open("%s.contigs.fasta"%(outprefix),'r')
+ contigdata = contigfile.read()
+ ncontigs = contigdata.count(">")
+ print "\t%s %s contigs%s"%(BLUE,ncontigs,NONE)
+ if xopt_dict["all"] == 1 or len(opt_dict["printscaff"]) > 0:
+ scafffile = open("%s.scaffold.fasta"%(outprefix), 'w')
+ p = subprocess.Popen(AMOSDIR+"OutputScaffolds -b %s"%(amosbank), shell=True, stdin=subprocess.PIPE, stdout=scafffile, stderr=logfile)
+ if xopt_dict["verbose"] == 1:
+ print "8) running printScaff"
+ else:
+ print "8) running printScaff...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success!%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+
+ scafffile = open("%s.scaffold.linear.fasta"%(outprefix), 'w')
+ p = subprocess.Popen(AMOSDIR+"Linearize -b %s"%(amosbank), shell=True, stdin=subprocess.PIPE, stdout=vtext, stderr=logfile)
+ if xopt_dict["verbose"] == 1:
+ print "9) running Linearize"
+ else:
+ print "9) running Linearize...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success!%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+
+ p = subprocess.Popen(AMOSDIR+"OutputResults -b %s -prefix %s %s"%(amosbank, prefix+".scaff.linear"), shell=True, stdin=subprocess.PIPE, stdout=vtext, stderr=logfile)
+
+ if xopt_dict["verbose"] == 1:
+ print "10) running OutputResults"
+ else:
+ print "10) running OutputResults...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+
+ p = subprocess.Popen(AMOSDIR+"OutputScaffolds -b %s"%(amosbank), shell=True, stdin=subprocess.PIPE, stdout=scafffile, stderr=logfile)
+ if xopt_dict["verbose"] == 1:
+ print "11) running printScaff"
+ else:
+ print "11) running printScaff...",
+ sys.stdout.flush()
+ sts = os.waitpid(p.pid,0)[1]
+ if xopt_dict["verbose"] != 1:
+ if sts == 0:
+ print "\t\t%s...success!%s"%(GREEN,NONE)
+ else:
+ print "\t\t%s...failed%s"%(RED,NONE)
+ sys.exit(1)
+)
diff --git a/src/Pipeline/minimus.acf b/src/Pipeline/minimus.acf
new file mode 100644
index 0000000..8835d95
--- /dev/null
+++ b/src/Pipeline/minimus.acf
@@ -0,0 +1,34 @@
+# `minimus' - The AMOS Lightweight Assembler Pipeline
+
+#--------------------------------------- USER DEFINED VALUES ------------------#
+PREF = $(strip .afg PREFIX)
+TGT = $(PREF).afg
+#------------------------------------------------------------------------------#
+
+BINDIR = /usr/local/bin
+
+BANK = $(PREF).bnk
+CONTIG = $(PREF).contig
+FASTA = $(PREF).fasta
+
+INPUTS = $(TGT)
+OUTPUTS = $(CONTIG) $(FASTA)
+
+
+## Building AMOS bank
+10: $(BINDIR)/bank-transact -c -z -b $(BANK) -m $(TGT)
+
+## Running overlap
+20: $(BINDIR)/hash-overlap -B $(BANK)
+
+## Running contigger
+30: $(BINDIR)/tigger -b $(BANK)
+
+## Running consensus
+40: $(BINDIR)/make-consensus -B -b $(BANK)
+
+## Outputting contigs
+50: $(BINDIR)/bank2contig $(BANK) > $(CONTIG)
+
+## Converting to FastA file
+60: $(BINDIR)/bank2fasta -b $(BANK) > $(FASTA)
diff --git a/src/Pipeline/minimus2-blat.acf b/src/Pipeline/minimus2-blat.acf
new file mode 100644
index 0000000..04dc078
--- /dev/null
+++ b/src/Pipeline/minimus2-blat.acf
@@ -0,0 +1,85 @@
+#? minimus2-blat - The AMOS Pipeline for merging 2 assemblies faster using BLAT
+
+#? Usage:
+#? minimus2-blat prefix [options]
+#? Options:
+#? -D REFCOUNT=<n> Number of sequences in the 1st assembly (Required)
+#? -D OVERLAP=<n> \ # Assembly 1 vs 2 minimum overlap (Default 40bp)
+#? -D CONSERR=<f> Maximum consensus error (0..1) (Default: 0.06)
+#? -D MINID=<n> Minimum overlap percent identity for alignments (Default: 98)
+#? -D MAXTRIM=<n> Maximum sequence trimming length (Default: 20bp)
+
+#--------------------------------------- USER DEFINED VALUES ------------------#
+
+REFCOUNT= 0
+CONSERR = 0.06
+OVERLAP = 40
+MINID = 98
+MAXTRIM = 20
+WIGGLE = 15
+
+#------------------------------------------------------------------------------#
+
+TGT = $(PREFIX).afg
+BANK = $(PREFIX).bnk
+REFSEQ = $(PREFIX).ref.seq
+QRYSEQ = $(PREFIX).qry.seq
+BLATOUT = $(PREFIX).psl
+COORDS = $(PREFIX).coords
+OVLTAB = $(PREFIX).ovl
+OVLAMOS = $(PREFIX).OVL
+CONTIG = $(PREFIX).contig
+FASTA = $(PREFIX).fasta
+
+SINGLETONS = $(PREFIX).singletons
+SINGLETONSEQ = $(PREFIX).singletons.seq
+
+#------------------------------------------------------------------------------#
+
+# Declare which files are input, temporary and output files
+INPUTS = $(TGT) $(REFCOUNT)
+TEMPS = $(BLATOUT) $(COORDS) $(OVLTAB)
+OUTPUTS = $(CONTIG) $(FASTA)
+
+#------------------------------------------------------------------------------#
+
+BINDIR = /usr/local/bin
+BLAT = /usr/local/bin/blat
+
+#------------------------------------------------------------------------------#
+
+## Building AMOS bank & Dumping reads
+10: rm -fr $(BANK)
+11: $(BINDIR)/bank-transact -c -z -b $(BANK) -m $(TGT)
+12: $(BINDIR)/dumpreads $(BANK) -M $(REFCOUNT) > $(REFSEQ)
+13: $(BINDIR)/dumpreads $(BANK) -m $(REFCOUNT) > $(QRYSEQ)
+
+## Getting overlaps
+20: $(BLAT) $(REFSEQ) $(QRYSEQ) $(BLATOUT) -fastMap -noHead -minIdentity=$(MINID) -minMatch=1 -tileSize=$(OVERLAP)
+21: $(BINDIR)/blat2nucmer -i $(BLATOUT) | $(BINDIR)/nucmerAnnotate | egrep 'BEGIN|END|CONTAIN|IDENTITY' > $(COORDS)
+22: $(BINDIR)/nucmer2ovl -ignore $(MAXTRIM) -tab $(COORDS) | $(BINDIR)/sort2 > $(OVLTAB)
+
+## Converting overlaps
+23: $(BINDIR)/ovl2OVL $(OVLTAB) > $(OVLAMOS)
+
+## Loading overlaps to the bank
+24: rm -f $(BANK)/OVL.*
+25: $(BINDIR)/bank-transact -z -b $(BANK) -m $(OVLAMOS)
+
+## Running contigger
+30: rm -f $(BANK)/LAY.*
+31: $(BINDIR)/tigger -b $(BANK)
+
+## Running consensus
+40: rm -f $(BANK)/CTG.*
+41: $(BINDIR)/make-consensus -B -e $(CONSERR) -b $(BANK) -w $(WIGGLE)
+
+## Outputting contigs
+50: $(BINDIR)/bank2contig $(BANK) > $(CONTIG)
+
+## Converting to FastA file
+60: $(BINDIR)/bank2fasta -b $(BANK) > $(FASTA)
+
+## Getting singletons
+70: $(BINDIR)/listReadPlacedStatus -S -E $(BANK) > $(SINGLETONS)
+71: $(BINDIR)/dumpreads -e -E $(SINGLETONS) $(BANK) > $(SINGLETONSEQ)
diff --git a/src/Pipeline/minimus2.acf b/src/Pipeline/minimus2.acf
new file mode 100755
index 0000000..b21e79b
--- /dev/null
+++ b/src/Pipeline/minimus2.acf
@@ -0,0 +1,84 @@
+#? minimus2 - The AMOS Pipeline for merging 2 assemblies
+
+#? Usage:
+#? minimus2 prefix \
+#? -D REFCOUNT=<n> \ # Number of sequences in the 1st assembly ; (Required)
+#? -D OVERLAP=<n> \ # Assembly 1 vs 2 minimum overlap (Default 40bp)
+#? -D CONSERR=<f> \ # Maximum consensus error (0..1) (Default 0.06)
+#? -D MINID=<n> \ # Minimum overlap percent identity for alignments (Default 94)
+#? -D MAXTRIM=<n> # Maximum sequence trimming length (Default 20bp)
+
+#--------------------------------------- USER DEFINED VALUES ------------------#
+
+REFCOUNT= 0
+MINID = 94
+OVERLAP = 40
+MAXTRIM = 20
+WIGGLE = 15
+CONSERR = 0.06
+
+#------------------------------------------------------------------------------#
+
+TGT = $(PREFIX).afg
+BANK = $(PREFIX).bnk
+REFSEQ = $(PREFIX).ref.seq
+QRYSEQ = $(PREFIX).qry.seq
+ALIGN = $(PREFIX).delta
+COORDS = $(PREFIX).coords
+OVLTAB = $(PREFIX).ovl
+OVLAMOS = $(PREFIX).OVL
+CONTIG = $(PREFIX).contig
+FASTA = $(PREFIX).fasta
+
+SINGLETONS = $(PREFIX).singletons
+SINGLETONSEQ = $(PREFIX).singletons.seq
+
+#------------------------------------------------------------------------------#
+
+INPUTS = $(TGT) $(REFCOUNT)
+OUTPUTS = $(CONTIG) $(FASTA)
+
+#------------------------------------------------------------------------------#
+
+BINDIR = /usr/local/bin
+NUCMER = /usr/local/bin/nucmer
+DELTAFILTER = /usr/local/bin/delta-filter
+SHOWCOORDS = /usr/local/bin/show-coords
+
+#------------------------------------------------------------------------------#
+
+## Building AMOS bank & Dumping reads
+10: rm -fr $(BANK)
+11: $(BINDIR)/bank-transact -c -z -b $(BANK) -m $(TGT)
+12: $(BINDIR)/dumpreads $(BANK) -M $(REFCOUNT) > $(REFSEQ)
+13: $(BINDIR)/dumpreads $(BANK) -m $(REFCOUNT) > $(QRYSEQ)
+
+## Getting overlaps
+20: $(NUCMER) -maxmatch -c $(OVERLAP) $(REFSEQ) $(QRYSEQ) -p $(PREFIX)
+21: $(SHOWCOORDS) -H -c -l -o -r -I $(MINID) $(ALIGN) | $(BINDIR)/nucmerAnnotate | egrep 'BEGIN|END|CONTAIN|IDENTITY' > $(COORDS)
+22: $(BINDIR)/nucmer2ovl -ignore $(MAXTRIM) -tab $(COORDS) | $(BINDIR)/sort2 > $(OVLTAB)
+
+## Converting overlaps
+23: $(BINDIR)/ovl2OVL $(OVLTAB) > $(OVLAMOS)
+
+## Loading overlaps to the bank
+24: rm -f $(BANK)/OVL.*
+25: $(BINDIR)/bank-transact -z -b $(BANK) -m $(OVLAMOS)
+
+## Running contigger
+30: rm -f $(BANK)/LAY.*
+31: $(BINDIR)/tigger -b $(BANK)
+
+## Running consensus
+40: rm -f $(BANK)/CTG.*
+41: $(BINDIR)/make-consensus -B -e $(CONSERR) -b $(BANK) -w $(WIGGLE)
+
+## Outputting contigs
+50: $(BINDIR)/bank2contig $(BANK) > $(CONTIG)
+
+## Converting to FastA file
+60: $(BINDIR)/bank2fasta -b $(BANK) > $(FASTA)
+
+## Getting singletons
+70: $(BINDIR)/listReadPlacedStatus -S -E $(BANK) > $(SINGLETONS)
+71: $(BINDIR)/dumpreads -e -E $(SINGLETONS) $(BANK) > $(SINGLETONSEQ)
diff --git a/src/PythonModules/AMOS.py b/src/PythonModules/AMOS.py
new file mode 100644
index 0000000..dba0619
--- /dev/null
+++ b/src/PythonModules/AMOS.py
@@ -0,0 +1,127 @@
+# AMOS message reader/writer
+# Contributed by Paul Harrison
+
+import re
+
+class Error(Exception): pass
+
+class Message:
+ """ AMOS Message object
+
+ Fields:
+ type - message type code
+ fields - dictionary of fields
+ sub_messages - list of sub-messages
+
+ repr(message) converts the message back to AMOS format
+ """
+
+ def __init__(self, type):
+ self.type = type
+ self.fields = { }
+ self.sub_messages = [ ]
+
+ def __repr__(self):
+ result = '{' + self.type + '\n'
+ for key in self.fields:
+ result += key+':'
+ if '\n' in self.fields[key]:
+ result += '\n'+self.fields[key]
+ if not self.fields[key].endswith('\n'):
+ result += '\n'
+ result += '.\n'
+ else:
+ result += self.fields[key]+'\n'
+ result += ''.join([ repr(sub_message) for sub_message in self.sub_messages ]) + \
+ '}\n'
+ return result
+
+ def get_multiline(self, name):
+ """ Strip newline characters from a multi-line field. """
+ return ''.join(self.fields[name].split('\n'))
+
+ def set_multiline(self, name, data):
+ """ Set a multi-line field, inserting newlines every 60 characters. """
+ self.fields[name] = '\n'.join([
+ data[i:i+60] for i in xrange(0,len(data),60)
+ ]) + '\n'
+
+
+_START = re.compile(r'^{([A-Z][A-Z][A-Z])\n$')
+_MULTILINE_FIELD = re.compile(r'^([a-z][a-z][a-z]):\n$')
+_FIELD = re.compile(r'^([a-z][a-z][a-z]):(.*)\n$')
+
+def read_record(file, first_line=None):
+ """ Read a record from a file of AMOS messages
+
+ On success returns a Message object
+ On end of file raises EOFError
+ On syntax error raises amos.Error
+ """
+
+ if first_line is None:
+ first_line = file.readline()
+
+ if not first_line:
+ raise EOFError()
+
+ match = _START.match(first_line)
+ if not match:
+ raise Error('Bad start of message', first_line)
+
+ message = Message(match.group(1))
+
+ while True:
+ line = file.readline()
+
+ match = _MULTILINE_FIELD.match(line)
+ if match:
+ name = match.group(1)
+ message.fields[name] = ''
+ while True:
+ line = file.readline()
+ if line == '.\n': break
+ message.fields[name] += line
+ continue
+
+ match = _FIELD.match(line)
+ if match:
+ message.fields[match.group(1)] = match.group(2)
+ continue
+
+ if line == '}\n':
+ break
+
+ if line.startswith('{'):
+ message.sub_messages.append( read_record(file, line) )
+ continue
+
+ raise Error('Bad line',line)
+
+ return message
+
+def iter_records(file):
+ """ Iterate over all the records in a file """
+
+ while True:
+ try:
+ yield read_record(file)
+ except EOFError:
+ break
+
+
+if __name__ == '__main__':
+ #Example: pass a message stream from stdin to stdout
+ # print count of each message type to stderr
+
+ import sys
+
+ counts = { }
+ for record in iter_records(sys.stdin):
+ counts[record.type] = counts.get(record.type,0) + 1
+ sys.stdout.write(repr(record))
+
+ types = counts.keys()
+ types.sort()
+ for type in types:
+ print >> sys.stderr, '%s x %d' % (type, counts[type])
diff --git a/src/PythonModules/Makefile.am b/src/PythonModules/Makefile.am
new file mode 100644
index 0000000..b9b1e77
--- /dev/null
+++ b/src/PythonModules/Makefile.am
@@ -0,0 +1,7 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+#-- TO BE INSTALLED
+dist_amoslib_SCRIPTS = \
+ AMOS.py
diff --git a/src/PythonModules/Makefile.in b/src/PythonModules/Makefile.in
new file mode 100644
index 0000000..6ddf014
--- /dev/null
+++ b/src/PythonModules/Makefile.in
@@ -0,0 +1,486 @@
+# 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 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@
+DIST_COMMON = $(dist_amoslib_SCRIPTS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+subdir = src/PythonModules
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(amoslibdir)"
+SCRIPTS = $(dist_amoslib_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+#-- TO BE INSTALLED
+dist_amoslib_SCRIPTS = \
+ AMOS.py
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/PythonModules/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/PythonModules/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):
+install-dist_amoslibSCRIPTS: $(dist_amoslib_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(amoslibdir)" || $(MKDIR_P) "$(DESTDIR)$(amoslibdir)"
+ @list='$(dist_amoslib_SCRIPTS)'; test -n "$(amoslibdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(amoslibdir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(amoslibdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_amoslibSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_amoslib_SCRIPTS)'; test -n "$(amoslibdir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(amoslibdir)" && rm -f $$files
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+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 $(SCRIPTS)
+installdirs:
+ for dir in "$(DESTDIR)$(amoslibdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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 mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_amoslibSCRIPTS
+
+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:
+
+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 -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_amoslibSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-dist_amoslibSCRIPTS 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 pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-dist_amoslibSCRIPTS uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Sim/Makefile.am b/src/Sim/Makefile.am
new file mode 100644
index 0000000..2e77812
--- /dev/null
+++ b/src/Sim/Makefile.am
@@ -0,0 +1,56 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+##-- TO BE INSTALLED
+dist_bin_SCRIPTS = \
+ rerunMultiTest.pl \
+ runMultiTest.pl \
+ runTest.pl \
+ summarizeMultiTest.pl
+
+bin_PROGRAMS = \
+ pyrosim \
+ tandemCollapse
+
+if BUILD_Simulator
+ bin_PROGRAMS += shotgunSim
+endif
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_srcdir)/src/GNU \
+ -I$(top_builddir)/src/GNU
+
+##-- pyrosim
+pyrosim_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+pyrosim_SOURCES = \
+ pyrosim.cc
+
+##-- tandemCollapse
+#tandemCollapse_CPPFLAGS = \
+# $(top_builddir)/src/Common \
+# $(top_builddir)/src/AMOS \
+# $(top_builddir)/src/GNU
+tandemCollapse_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+tandemCollapse_SOURCES = \
+ tandemCollapse.cc
+
+####-- shotgunSim
+if BUILD_Simulator
+shotgunSim_LDADD = \
+ -L/fs/sz-user-supported/Linux-i686/lib \
+ -lgsl \
+ -lgslcblas
+
+shotgunSim_SOURCES = \
+ shotgunSim.cc
+endif
+
+##-- END OF MAKEFILE --##
diff --git a/src/Sim/Makefile.in b/src/Sim/Makefile.in
new file mode 100644
index 0000000..79c1726
--- /dev/null
+++ b/src/Sim/Makefile.in
@@ -0,0 +1,676 @@
+# 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 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@
+DIST_COMMON = $(dist_bin_SCRIPTS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = pyrosim$(EXEEXT) tandemCollapse$(EXEEXT) \
+ $(am__EXEEXT_1)
+ at BUILD_Simulator_TRUE@am__append_1 = shotgunSim
+subdir = src/Sim
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+ at BUILD_Simulator_TRUE@am__EXEEXT_1 = shotgunSim$(EXEEXT)
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_pyrosim_OBJECTS = pyrosim.$(OBJEXT)
+pyrosim_OBJECTS = $(am_pyrosim_OBJECTS)
+pyrosim_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am__shotgunSim_SOURCES_DIST = shotgunSim.cc
+ at BUILD_Simulator_TRUE@am_shotgunSim_OBJECTS = shotgunSim.$(OBJEXT)
+shotgunSim_OBJECTS = $(am_shotgunSim_OBJECTS)
+shotgunSim_DEPENDENCIES =
+am_tandemCollapse_OBJECTS = tandemCollapse.$(OBJEXT)
+tandemCollapse_OBJECTS = $(am_tandemCollapse_OBJECTS)
+tandemCollapse_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+SCRIPTS = $(dist_bin_SCRIPTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(pyrosim_SOURCES) $(shotgunSim_SOURCES) \
+ $(tandemCollapse_SOURCES)
+DIST_SOURCES = $(pyrosim_SOURCES) $(am__shotgunSim_SOURCES_DIST) \
+ $(tandemCollapse_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+dist_bin_SCRIPTS = \
+ rerunMultiTest.pl \
+ runMultiTest.pl \
+ runTest.pl \
+ summarizeMultiTest.pl
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_srcdir)/src/GNU \
+ -I$(top_builddir)/src/GNU
+
+pyrosim_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+pyrosim_SOURCES = \
+ pyrosim.cc
+
+
+#tandemCollapse_CPPFLAGS = \
+# $(top_builddir)/src/Common \
+# $(top_builddir)/src/AMOS \
+# $(top_builddir)/src/GNU
+tandemCollapse_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+tandemCollapse_SOURCES = \
+ tandemCollapse.cc
+
+
+####-- shotgunSim
+ at BUILD_Simulator_TRUE@shotgunSim_LDADD = \
+ at BUILD_Simulator_TRUE@ -L/fs/sz-user-supported/Linux-i686/lib \
+ at BUILD_Simulator_TRUE@ -lgsl \
+ at BUILD_Simulator_TRUE@ -lgslcblas
+
+ at BUILD_Simulator_TRUE@shotgunSim_SOURCES = \
+ at BUILD_Simulator_TRUE@ shotgunSim.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Sim/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Sim/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):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+pyrosim$(EXEEXT): $(pyrosim_OBJECTS) $(pyrosim_DEPENDENCIES)
+ @rm -f pyrosim$(EXEEXT)
+ $(CXXLINK) $(pyrosim_OBJECTS) $(pyrosim_LDADD) $(LIBS)
+shotgunSim$(EXEEXT): $(shotgunSim_OBJECTS) $(shotgunSim_DEPENDENCIES)
+ @rm -f shotgunSim$(EXEEXT)
+ $(CXXLINK) $(shotgunSim_OBJECTS) $(shotgunSim_LDADD) $(LIBS)
+tandemCollapse$(EXEEXT): $(tandemCollapse_OBJECTS) $(tandemCollapse_DEPENDENCIES)
+ @rm -f tandemCollapse$(EXEEXT)
+ $(CXXLINK) $(tandemCollapse_OBJECTS) $(tandemCollapse_LDADD) $(LIBS)
+install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pyrosim.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/shotgunSim.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tandemCollapse.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+
+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 $(PROGRAMS) $(SCRIPTS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-binPROGRAMS clean-generic 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-binPROGRAMS install-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dist_binSCRIPTS \
+ 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-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-dist_binSCRIPTS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Sim/pyrosim.cc b/src/Sim/pyrosim.cc
new file mode 100644
index 0000000..285daf0
--- /dev/null
+++ b/src/Sim/pyrosim.cc
@@ -0,0 +1,456 @@
+///////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 11/03/2005
+//!
+//! \brief Simulates a 454 pyro sequencing machine
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "inttypes_AMOS.hh"
+#include "fasta.hh"
+#include "alloc.hh"
+#include <vector>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#include <iostream>
+#include <unistd.h>
+#include <sstream>
+
+#include <set>
+#include <list>
+#include <deque>
+
+using namespace std;
+using namespace AMOS;
+
+const int MAXLINE = 1024;
+const int WIDTH = 80;
+
+
+//=============================================================== Options ====//
+FILE * OPT_Fasta = NULL;
+Size_t OPT_Rounds = 40;
+Size_t OPT_Reads = 1000;
+Size_t OPT_Homos = 15;
+int OPT_Seed = -1;
+bool OPT_OFlow = false;
+string OPT_Flow ("acgt");
+
+
+//============================================================= Constants ====//
+const char DELIM_CH = '$';
+const char NULL_CH = '\0';
+const char WILD_CH = 'n';
+
+typedef deque<char> CharDeque_t;
+typedef multiset<char> CharMultiset_t;
+
+class Flow_t : private CharDeque_t
+{
+private:
+
+ Size_t cnt;
+
+public:
+
+ friend bool Isomorphic (const Flow_t & a, const Flow_t & b);
+
+ Flow_t()
+ : CharDeque_t()
+ { reset(); }
+
+ Flow_t (const string & s)
+ : CharDeque_t (s.begin(), s.end())
+ { reset(); }
+
+ void append (char c)
+ {
+ push_back (c);
+ reset();
+ }
+
+ void clear()
+ {
+ CharDeque_t::clear();
+ reset();
+ }
+
+ Size_t count()
+ { return cnt; }
+
+ Size_t round()
+ { return cnt / size(); }
+
+ void reset()
+ { cnt = 0; }
+
+ size_type size() const
+ { return CharDeque_t::size(); }
+
+ string order() const
+ { return string (begin(), end()); }
+
+ char base() const
+ { return ( empty() ? NULL_CH : front() ); }
+
+ void rotate()
+ {
+ if ( !empty() )
+ {
+ push_back (front());
+ pop_front();
+ }
+ ++ cnt;
+ }
+};
+
+
+//========================================================== Fuction Decs ====//
+//------------------------------------------------------------ Isomorphic ----//
+bool Isomorphic (const Flow_t & a, const Flow_t & b)
+{
+ if ( a.size() == b.size() )
+ {
+ Flow_t t (b);
+ for ( t.reset(); t.round() == 0; t.rotate() )
+ if ( (CharDeque_t)a == (CharDeque_t)t )
+ return true;
+ }
+ return false;
+}
+
+
+//-------------------------------------------------------------- Matching ----//
+inline bool Matching (char a, char b)
+{
+ return ( a == b || a == WILD_CH || b == WILD_CH );
+}
+
+//------------------------------------------------------------- ValidBase ----//
+inline bool ValidBase (char a)
+{
+ return ( a == 'a' || a == 'c' || a == 'g' || a == 't' );
+}
+
+//---------------------------------------------------------- OptimizeFlow ----//
+void OptimizeFlow (const char * seq);
+
+
+//--------------------------------------------------------------- Permute ----//
+void Permute (CharMultiset_t s, Flow_t f, vector<Flow_t> & flows);
+
+
+//-------------------------------------------------------------- PickSeqs ----//
+void PickSeqs (const char * seq, vector<const char *> & frags);
+
+
+//------------------------------------------------------------- ReadInput ----//
+void ReadInput (char * & seq);
+
+
+//---------------------------------------------------------------- RunSim ----//
+void RunSim (const vector<const char *> & frags);
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv);
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s);
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s);
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ char * seq = NULL;
+ vector<const char *> frags;
+
+ ParseArgs (argc, argv);
+ srand (OPT_Seed);
+
+ ReadInput (seq);
+
+ if ( OPT_OFlow )
+ OptimizeFlow (seq);
+
+ PickSeqs (seq, frags);
+
+ RunSim (frags);
+
+ return EXIT_SUCCESS;
+}
+
+
+//---------------------------------------------------------- OptimizeFlow ----//
+void OptimizeFlow (const char * seq)
+{
+ vector<Flow_t> flows;
+ Size_t hom;
+ const char * p;
+
+ Permute (CharMultiset_t (OPT_Flow.begin(), OPT_Flow.end()), Flow_t(), flows);
+
+ for ( vector<Flow_t>::iterator i = flows.begin(); i != flows.end(); ++ i )
+ {
+ cout << i->order() << " - ";
+
+ p = seq;
+ for ( i->reset(); *p != NULL_CH; i->rotate() )
+ while ( Matching (*p, Complement (i->base())) || *p == DELIM_CH )
+ ++ p;
+
+ cout << i->count() << endl;
+ }
+}
+
+
+//--------------------------------------------------------------- Permute ----//
+void Permute (CharMultiset_t s, Flow_t f, vector<Flow_t> & flows)
+{
+ if ( s.empty() )
+ {
+ for ( vector<Flow_t>::const_iterator
+ i = flows.begin(); i != flows.end(); ++ i )
+ if ( Isomorphic (*i, f) )
+ return;
+
+ flows.push_back (f);
+ return;
+ }
+
+ for (CharMultiset_t::iterator i = s.begin(); i != s.end(); ++ i )
+ {
+ Flow_t nf (f);
+ CharMultiset_t ns (s);
+
+ nf.append (*i);
+ ns.erase (ns.find(*i));
+
+ Permute (ns, nf, flows);
+ }
+}
+
+
+//--------------------------------------------------------------- PickSeq ----//
+void PickSeqs (const char * seq, vector<const char *> & frags)
+{
+ Pos_t p;
+ Size_t i, size;
+
+ size = strlen (seq);
+
+ for ( i = 0; i < OPT_Reads; ++ i )
+ {
+ p = 0;
+
+ while ( seq[p] == DELIM_CH )
+ p = (Pos_t)((double)size * rand() / (RAND_MAX + 1.0));
+
+ frags.push_back (seq + p);
+ }
+}
+
+
+//------------------------------------------------------------- ReadInput ----//
+void ReadInput (char * & seq)
+{
+ long beg, end, size;
+ string rec, tag;
+ char * p;
+
+ beg = ftell (OPT_Fasta);
+ fseek (OPT_Fasta, 0, SEEK_END);
+ end = ftell (OPT_Fasta);
+ fseek (OPT_Fasta, 0, SEEK_SET);
+ size = (end - beg) * 2;
+
+ p = seq = (char *) SafeRealloc (seq, size);
+
+ while ( Fasta_Read (OPT_Fasta, rec, tag) )
+ {
+ if ( rec.empty() )
+ continue;
+
+ *p = DELIM_CH;
+ strcpy (++ p, rec.c_str());
+ for ( ; *p != NULL_CH; ++ p )
+ {
+ *p = tolower (*p);
+ if ( ! ValidBase (*p) && *p != WILD_CH )
+ {
+ cerr << "WARNING: Converting '" << *p
+ << "' to '" << WILD_CH << "'\n";
+ *p = WILD_CH;
+ }
+ }
+
+ Reverse_Complement (rec);
+
+ *p = DELIM_CH;
+ strcpy (++ p, rec.c_str());
+ for ( ; *p != NULL_CH; ++ p )
+ {
+ *p = tolower (*p);
+ if ( ! ValidBase (*p) && *p != WILD_CH )
+ {
+ cerr << "WARNING: Converting '" << *p
+ << "' to '" << WILD_CH << "'\n";
+ *p = WILD_CH;
+ }
+ }
+ }
+}
+
+
+//---------------------------------------------------------------- RunSim ----//
+void RunSim (const vector<const char *> & frags)
+{
+ Flow_t flow (OPT_Flow);
+ Pos_t hom, uid;
+ const char * p;
+ int cnt;
+
+ uid = 0;
+ for ( vector<const char *>::const_iterator
+ i = frags.begin(); i != frags.end(); ++ i )
+ {
+ p = *i;
+
+ printf (">%d\n", ++ uid);
+
+ int cnt = 0;
+ for ( flow.reset(); flow.round() < OPT_Rounds; flow.rotate() )
+ for ( hom = 0;
+ Matching (*p, Complement (flow.base())) && hom < OPT_Homos;
+ ++ hom )
+ {
+ if ( cnt == WIDTH )
+ {
+ putchar ('\n');
+ cnt = 0;
+ }
+ putchar (*p);
+ ++ cnt;
+ ++ p;
+ }
+
+ putchar ('\n');
+ }
+}
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "f:Fhi:p:r:s:")) != EOF) )
+ switch (ch)
+ {
+ case 'f':
+ OPT_Flow = optarg;
+ break;
+
+ case 'F':
+ OPT_OFlow = true;
+ break;
+
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'i':
+ OPT_Rounds = atoi (optarg);
+ break;
+
+ case 'p':
+ OPT_Homos = atoi (optarg);
+ break;
+
+ case 'r':
+ OPT_Reads = atol (optarg);
+ break;
+
+ case 's':
+ OPT_Seed = atoi (optarg);
+ break;
+
+ default:
+ errflg ++;
+ }
+
+ if ( optind != argc - 1 )
+ errflg ++;
+
+ for ( string::iterator i = OPT_Flow.begin(); i != OPT_Flow.end(); ++ i )
+ {
+ *i = tolower (*i);
+ if ( ! ValidBase (*i) )
+ {
+ cerr << "ERROR: Only a,c,g,t allowed in flow\n";
+ errflg ++;
+ }
+ }
+
+ if ( errflg > 0 )
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information." << endl;
+ exit (EXIT_FAILURE);
+ }
+
+ if ( (OPT_Fasta = fopen (argv[optind ++], "r")) == NULL )
+ {
+ cerr << "ERROR: Could not open FastA file " << argv[optind-1] << endl;
+ exit (EXIT_FAILURE);
+ }
+
+ if ( OPT_Seed < 0 )
+ OPT_Seed = time (NULL);
+}
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "-f string Nucleotide flow order for one round, default "
+ << OPT_Flow << endl
+ << "-F Calculate and use the optimal flow permutation for -f\n"
+ << "-h Display help information\n"
+ << "-i int Number round iterations to simulate, default "
+ << OPT_Rounds << endl
+ << "-p int Number of sequence-able homopolymer bases per flow,\n"
+ << " default "
+ << OPT_Homos << endl
+ << "-r int Number of reads to sequence, default "
+ << OPT_Reads << endl
+ << "-s uint Set random generator seed, default seed is generated\n"
+ << " by the system clock\n"
+ << endl;
+ cerr
+ << "Simulates a 454 pyro sequencing machine.\n"
+ << endl;
+ return;
+}
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr << "\nUSAGE:" << s << " [options] <fasta>\n"
+ << endl;
+ return;
+}
diff --git a/src/Sim/rerunMultiTest.pl b/src/Sim/rerunMultiTest.pl
new file mode 100755
index 0000000..13866f4
--- /dev/null
+++ b/src/Sim/rerunMultiTest.pl
@@ -0,0 +1,24 @@
+#!/usr/local/bin/perl
+
+# this reruns any .conf file that doesn't have a .qc associated with it.
+
+if (! -d "TEST") {
+ mkdir("TEST") || die("Cannot create directory TEST: $!\n");
+}
+
+opendir(DOT, ".") || die ("Cannot open current directory: $!\n");
+while (my $file = readdir(DIR)){
+ if ($file =~ /^(test_\d+).conf/){
+ my $test = $1;
+ if (! -f "$test.qc"){
+ print "Redoing $1\n";
+ system("cp $test.conf TEST");
+ chdir("TEST");
+ system("/local/asmg/work/mpop/WGA/src/Sim/runTest.pl $test.conf");
+ chdir("..");
+ system("cp TEST/$test.qc .");
+ system("cp TEST/$test.sum .");
+ system("rm -rf TEST/*");
+ }
+ }
+}
diff --git a/src/Sim/runMultiTest.pl b/src/Sim/runMultiTest.pl
new file mode 100755
index 0000000..fbc5bd6
--- /dev/null
+++ b/src/Sim/runMultiTest.pl
@@ -0,0 +1,69 @@
+#!/usr/local/bin/perl
+
+if (! -d "TEST") {
+ mkdir("TEST") || die("Cannot create directory TEST: $!\n");
+}
+open(LOG, ">>runtest.log") || die ("Cannot open runtest.log: $!\n");
+print LOG "test readlen spread small_lib large_lib fraction coverage\n";
+close(LOG);
+my $test = 1;
+#foreach $readlen (600, 700, 800, 900) {
+# foreach $spread (100, 200, 300) {
+# foreach $small (1500, 2000, 2500, 3000) {
+# foreach $large (6000, 8000, 9000, 10000) {
+# foreach $frac (25, 50, 75) {
+# foreach $readlen (800) {
+# foreach $spread (400) {
+# foreach $small (1500, 2500, 3500, 4500) {
+# foreach $large (6000, 8000, 10000) {
+# foreach $frac (0, 5, 10, 15, 20, 25, 35, 50, 75) {
+# foreach $coverage (8) {
+foreach $readlen (800) {
+ foreach $spread (400) {
+ foreach $small (3500) {
+ foreach $large (10000) {
+# foreach $frac (0, 5, 10, 15, 25) {
+ foreach $frac (10, 10, 10, 10) {
+ foreach $coverage (6) {
+ if (-f "test_$test.qc") {$test++; next;}
+ open(LOG, ">>runtest.log") || die ("Cannot open runtest.log: $!\n");
+ print LOG "$test $readlen $spread $small $large $frac $coverage\n";
+ close(LOG);
+
+ if (! -f "$test_$test.conf"){
+ open(TEST, ">test_$test.conf") || die ("Cannot open test_$test.conf: $!\n");
+ print TEST "min_read=", $readlen - $spread / 2, "\n";
+ print TEST "max_read=", $readlen + $spread / 2, "\n";
+ print TEST "\n";
+ print TEST "lib_id=small\n";
+ print TEST "lib_range=$small,", $small + 1000, "\n";
+ print TEST "lib_frac=$frac\n";
+ print TEST "\n";
+ print TEST "lib_id=large\n";
+ print TEST "lib_range=$large,", $large + 2000, "\n";
+ print TEST "lib_frac=", 100 - $frac, "\n";
+ print TEST "\n";
+# print TEST "genome_file=../n_meningitidis_mc58.1con\n";
+# print TEST "genome_size=2272351\n";
+ print TEST "genome_file=../na_arm3R_genomic_dmel_RELEASE3.FASTA\n";
+ print TEST "genome_size=27890790\n";
+ print TEST "coverage=$coverage\n";
+ print TEST "seed=", (time ^ ($$ + ($$ << 15))) % 50000,"\n";
+ close(TEST);
+ }
+ system("cp test_$test.conf TEST");
+ chdir("TEST");
+ system("/local/asmg/work/mpop/WGA/src/Sim/runTest.pl test_$test.conf");
+ chdir("..");
+ system("cp TEST/test_$test.qc .");
+ system("cp TEST/test_$test.sum .");
+ system("cp TEST/test_${test}_1_A00001.frg .");
+ system("cp TEST/test_$test.asm .");
+ system("rm -rf TEST/*");
+ $test++;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/Sim/runTest.pl b/src/Sim/runTest.pl
new file mode 100755
index 0000000..11eae9d
--- /dev/null
+++ b/src/Sim/runTest.pl
@@ -0,0 +1,335 @@
+#!/usr/local/bin/perl
+
+# this program generates Celera Assembler test data and then runs
+# the assembler on it.
+
+use TIGR::Foundation;
+use strict;
+
+my $MY_VERSION = " Version 1.0 (Build " . (qw/$Revision$/ )[1] . ")";
+my $MY_HELPTEXT = qq~
+ runTest
+~;
+
+
+########## Main
+
+my $base = new TIGR::Foundation;
+
+if (! defined $base){
+ print STDERR "Nasty error, hide!\n";
+ exit(1);
+}
+
+$base->setDebugLevel(1);
+
+$base->setHelpInfo($MY_HELPTEXT);
+$base->setVersionInfo($MY_VERSION);
+my $asRoot = "/local/asmg/bin/CA"; #$ENV{CA_ROOT};
+$base->addDependInfo($asRoot);
+$ENV{"AS_ROOT"} = $asRoot; # set environment for Celera programs
+
+my $asBin = "$ENV{CA_ROOT}/bin";
+if (! -e "bin"){
+ symlink($asBin, "bin") ||
+ $base->bail("Cannot symlink \"$asBin\" to \"./bin\": $!");
+}
+
+my $celsim = "$asRoot/bin/celsim";
+$base->addDependInfo($celsim);
+my $assembler = "$ENV{CA_ROOT}/scripts/assembler.pl";
+$base->addDependInfo($assembler);
+my $gatekeeper = "$ENV{CA_ROOT}/bin/gatekeeper";
+$base->addDependInfo($gatekeeper);
+my $populator = "$ENV{CA_ROOT}/bin/PopulateFragStore";
+$base->addDependInfo($populator);
+my $grep = "/bin/grep";
+$base->addDependInfo($grep);
+my $cata = "/local/asmg/bin/ca2ta";
+$base->addDependInfo($cata);
+my $caqc = "/usr/local/common/caqc";
+$base->addDependInfo($caqc);
+my $makeofg = "$ENV{CA_ROOT}/bin/make_OFG_from_FragStore";
+$base->addDependInfo($makeofg);
+my $meryl = "$ENV{CA_ROOT}/bin/meryl";
+$base->addDependInfo($meryl);
+my $ca2scaff = "/local/asmg/work/mpop/Tools/CA/ca2scaff.pl";
+$base->addDependInfo($ca2scaff);
+
+my $infile;
+my $justasm;
+
+my $err = $base->TIGR_GetOptions("i=s" => \$infile,
+ "justasm" => \$justasm);
+
+if ($err == 0){
+ $base->bail("Command line parsing failed. See -h option");
+}
+
+if (!defined $infile){
+ $infile = $ARGV[0];
+}
+
+if ($infile !~ /\.conf$/){
+ $base->bail("Input file must end in .conf");
+}
+$infile =~ /(.*)\.conf$/;
+my $prefix = $1;
+
+my $MIN_READ = 500;
+my $MAX_READ = 700;
+$base->logLocal("Will generate reads between $MIN_READ and $MAX_READ bases", 1);
+
+my $MATE_FAIL = 0.3;
+my $CHIMERAS = 0.01;
+$base->logLocal("Assuming mates fail rate is $MATE_FAIL and chimera rate is $CHIMERAS", 1);
+
+my $MIN_ERR = 0.0001;
+my $MAX_ERR = 0.008;
+
+$base->logLocal("Reading configuration file \"$infile\"", 1);
+open(IN, $infile) || $base->bail("Cannot open \"$infile\": $!\n");
+
+my $lib;
+my $range;
+my $frac;
+my $genome;
+my $nreads;
+my %libraries;
+my %fractions;
+my %genomes;
+my %size;
+my $seed = undef;
+while (<IN>){
+ if (/^lib_id=(\w+)/){
+ $lib = $1;
+ if (defined $libraries{$lib}){
+ $base->bail("At line $. in $infile:\n \"$lib\" library already seen");
+ }
+ next;
+ }
+ if (/^lib_range=(\d+,\d+)/){
+ $range = $1;
+ $libraries{$lib} = $range;
+ $base->logLocal("Found library \"$lib\" with range $range", 1);
+ next;
+ }
+ if (/^lib_frac=(\d+\.?\d*)/){
+ $frac = $1;
+ $fractions{$lib} = $frac;
+ $base->logLocal("Will do $frac % of library \"$lib\"", 1);
+ next;
+ }
+ if (/^genome_file=(\S+)/){
+ $genome = $1;
+ if (! -r $genome){
+ $base->bail("At line $. in $infile:\n File \"$genome\" is unreadable");
+ }
+ next;
+ }
+ if (/^min_read=(\d+)/){
+ $MIN_READ = $1;
+ next;
+ }
+ if (/^max_read=(\d+)/){
+ $MAX_READ = $1;
+ next;
+ }
+ if (/^genome_size=(\d+)/){
+ $size{$genome} = $1;
+ next;
+ }
+ if (/^coverage=(\d+)/){
+ if (! exists $size{$genome}){
+ $base->bail("you must define a genome size for genome $genome at line $. in $infile\n");
+ }
+ $genomes{$genome} = int( $1 * $size{$genome} / (($MIN_READ + $MAX_READ)/ 2));
+ next;
+ }
+ if (/^nreads=(\d+)/){
+ $nreads = $1;
+ $genomes{$genome} = $nreads;
+ $base->logLocal("Will generate $nreads reads from file \"$genome\"\n");
+ next;
+ }
+ if (/^err=([0-9]*\.?[0-9]+),([0-9]*\.?[0-9]+)/){
+ $MIN_ERR = $1;
+ $MAX_ERR = $2;
+ next;
+ }
+
+ if (/^seed=(\d+)/){
+ $seed = $1;
+ next;
+ }
+ if (/^\#/){
+ next;
+ }
+ if (/^\s*$/){
+ next;
+ }
+ $base->bail("Line $. from \"$infile\" cannot be parsed:\n $_");
+}
+
+close(IN);
+
+$base->logLocal("Using error ramp from $MIN_ERR to $MAX_ERR", 1);
+$base->logLocal("Done reading configuration", 1);
+
+my $ngen = 1;
+my @gennames;
+my $name;
+my @fragfiles;
+my $accession = 1;
+while (($genome, $nreads) = each %genomes){
+ $name = "${prefix}_" . $ngen++;
+ $gennames[++$#gennames] = $name;
+
+ REDO:
+ $base->logLocal("$name will have $nreads reads read from \"$genome\"", 1);
+ my $simfile = $name . ".sim";
+ $base->logLocal("simulation file is in \"$simfile\"", 1);
+ open(OUT, ">$simfile") || $base->bail("Cannot open \"$simfile\": $!\n");
+
+# my $seed = time ^ ($$ + ($$ << 15)) ; # straight out of perlfunc
+ if (! defined $seed) {$seed = 17131;} # Art's lucky and magic seed
+ print OUT
+qq~
+.seed
+$seed
+
+.dna
+A < $genome ;
+~;
+
+ while (($lib, $frac) = each %fractions){
+ my $libreads = int($nreads * ($frac / 100.0));
+ my ($minlib, $maxlib) = split(',', $libraries{$lib});
+
+ print OUT
+qq~
+
+.sample
+$libreads
+$MIN_READ $MAX_READ .5
+0 0 0 0
+$MIN_ERR $MAX_ERR 0.33 0.33
+$MATE_FAIL $minlib $maxlib $CHIMERAS
+~;
+ } # while ($lib, $frac)
+ close(OUT);
+
+ if (! defined $justasm){
+ $base->logLocal("Generating .frg file for \"$name\"", 1);
+ my $celsim_cmd = "$celsim -a $accession $simfile";
+ $base->logLocal("Running \"$celsim_cmd\"", 1);
+ my $errno = $base->runCommand($celsim_cmd);
+ if ($errno != 0){
+ $base->bail("Command \"$celsim_cmd\" failed with code: $errno");
+ }
+ }
+
+ my $frgname = "$name" . "_A00001" . ".frg";
+ if (! -e $frgname || -z $frgname){
+ $base->bail("Celsim appears to have failed");
+ }
+
+ my $actual = `$grep -c \'^{FRG\' $frgname`;
+ if (abs($actual - $nreads) > 10){
+ chomp $actual;
+ $base->logLocal("Celsim messed up: $actual ne $nreads", 1);
+ $base->logLocal("Trying again", 1);
+ goto REDO;
+ }
+
+ $fragfiles[++$#fragfiles] = "$frgname";
+ $base->logLocal("Generated frg file \"$frgname\"", 1);
+ open(ACC, "$grep \'^acc\' $frgname |") ||
+ $base->bail("Cannot run $grep on \"$frgname\": $!\n");
+ while (<ACC>){
+ $_ =~ /acc:(\d+)/;
+ if ($1 > $accession) {
+ $accession = $1;
+ }
+ }
+ close(ACC);
+ $accession++;
+ $base->logLocal("Setting accession to $accession", 1);
+} # while ($genome, $nreads)
+
+$base->logLocal("Doing assembly", 1);
+
+my $create_mode;
+for (my $file = 0; $file <= $#fragfiles; $file++) {
+ if ($file == 0) {
+ $create_mode = "-f";
+ } else {
+ $create_mode = "-a";
+ }
+
+ my $gateStore = $prefix . ".gkpStore";
+ my $gateCmd = "$gatekeeper -X -C -N -Q -P $create_mode $gateStore $fragfiles[$file]";
+ $base->logLocal("Running \"$gateCmd\"", 1);
+ my $errno = $base->runCommand($gateCmd);
+ if ($errno != 0){
+ $base->bail("Command \"$gateCmd\" failed with code: $errno");
+ }
+}
+
+for (my $file = 0; $file <= $#fragfiles; $file++) {
+ if ($file == 0) {
+ $create_mode = "-f";
+ }else {
+ $create_mode = "-a";
+ }
+
+ $fragfiles[$file] =~ /(.*)\.frg/;
+ my $inpfile = $1 . ".inp";
+ my $populateCmd = "$populator -c -f -o $prefix.frgStore $create_mode $inpfile";
+ $base->logLocal("Running \"$populateCmd\"", 1);
+ my $errno = $base->runCommand($populateCmd);
+ if ($errno != 0){
+ $base->bail("Command \"$populateCmd\" failed with code: $errno");
+ }
+}
+
+my $ofgCmd = "$makeofg $prefix.frgStore > $prefix.ofg";
+$base->logLocal("Running \"$ofgCmd\"", 1);
+my $errno = $base->runCommand($ofgCmd);
+if ($errno != 0){
+ $base->bail("Command \"$ofgCmd\" failed with code: $errno");
+}
+
+my $merylCmd = "$meryl -s $prefix.frgStore -m 22 -n 200 -o $prefix.nmers.fasta";$base->logLocal("Running \"$merylCmd\"", 1);
+$errno = $base->runCommand($merylCmd);
+if ($errno != 0){
+ $base->bail("Command \"$merylCmd\" failed with code: $errno");
+}
+
+my $asmCmd = "$assembler -root=$asRoot -start=402 -prefix=$prefix";
+$base->logLocal("Running \"$asmCmd\"", 1);
+$errno = $base->runCommand($asmCmd);
+if ($errno != 0){
+ $base->bail("Command \"$asmCmd\" failed with code: $errno");
+}
+
+# my $cataCmd = "$cata -justfasta $prefix.asm";
+# $base->logLocal("Running \"$cataCmd\"", 1);
+# $errno = $base->runCommand($cataCmd);
+# if ($errno != 0){
+# $base->bail("Command \"$cataCmd\" failed with code: $errno");
+# }
+
+my $caqcCmd = "$caqc $prefix.asm > $prefix.qc";
+$base->logLocal("Running \"$caqcCmd\"", 1);
+system($caqcCmd);
+
+my $ca2scaffCmd = "$ca2scaff $prefix.asm -o $prefix";
+$base->logLocal("Running \"$ca2scaffCmd\"", 1);
+$errno = $base->runCommand($ca2scaffCmd);
+if ($errno != 0){
+ $base->bail("Command \"$ca2scaffCmd\" failed with code: $errno");
+}
+
+$base->logLocal("Succesful finish!", 1);
+exit(0);
diff --git a/src/Sim/shotgunSim.cc b/src/Sim/shotgunSim.cc
new file mode 100644
index 0000000..d21e300
--- /dev/null
+++ b/src/Sim/shotgunSim.cc
@@ -0,0 +1,611 @@
+// $Id$
+
+// Shotgun sequence simulator
+//
+// Simulates a set of paired/unpaired reads at a certain coverage.
+
+// STL includes
+#include <vector>
+#include <algorithm>
+#include <map>
+#include <string>
+
+// C++ includes
+#include <fstream>
+#include <iostream>
+
+// generic C includes
+#include <ctype.h>
+#include <getopt.h>
+#include <math.h>
+#include <assert.h>
+
+// GSL includes
+#include <gsl/gsl_rng.h>
+#include <gsl/gsl_randist.h>
+
+#define endl "\n" // die endl die
+
+using namespace std;
+
+map<string, string> globals; // global variables
+
+struct Library_t {
+ string name;
+ int mean;
+ int stdev;
+ int readmean;
+ int readstdev;
+ int readmin;
+ int readmax;
+ float coverage;
+ float permates;
+} ;
+
+struct Fragment_t {
+ unsigned long left;
+ unsigned long right;
+ int libid;
+ int forwlen;
+ int revlen;
+} ;
+
+vector<Library_t> libraries;
+vector<long> fastasizes;
+long genomeSize = 0;
+bool circularGenome = false;
+bool pickStartEndTogether = false;
+vector<int> readSizes;
+
+void printHelpText()
+{
+ cout <<
+ "\n"
+ "USAGE:\n"
+ "\n"
+ "shotgunSim -C config_file file.fasta\n"
+ "\n"
+ "OPTIONS:\n"
+ "-r treat genome as circularized (allows mating around the genome)\n"
+ "-p pick the start and end at the same time instead of picking a start and then picking a length\n"
+ "-C config_file configuration file containing experiment parameters\n"
+ "-l layout.afg output layout of reads into this file\n"
+ "file.fasta fasta sequence used as template for shotgun\n"
+ "\n"
+ "CONFIG FILE FORMAT:\n"
+ "The config file consists in a series of blocks, one for each library.\n"
+ "Blocks start with a library line:\n"
+ "library <name> <mean> <stdev> <%mates>\n"
+ "\n"
+ "Even for unmated reads you need to specify a library as follows:\n"
+ "library unmated 0 0 0\n"
+ "\n"
+ "The library line is followed by information about the reads being produced:\n"
+ "reads <mean> <stdev> <min> <max>\n"
+ "\n"
+ "All parameters of the reads command must be specified.\n"
+ "The reads will have lengths sampled from a gaussian distribution\n"
+ "that is truncated to <min> <max>\n"
+ "Note that the <min> value also restricts the smallest insert that can\n"
+ "be generated by the library\n"
+ "\n"
+ "For generating read lengths that are not normally distributed,\n"
+ "you can specify a list of lengths that are reused until the requested coverage is achieved\n"
+ "read <length>\n"
+ "\n"
+ "Finally, you need to specify the coverage of reads to be generated\n"
+ "from the library:\n"
+ "coverage <coverage>\n"
+ "\n"
+ "IMPORTANT NOTE: incorrect parameters may lead to the program running\n"
+ "indefinitely\n"
+ << endl;
+} // printHelpText
+
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"C", 1, 0, 'c'},
+ {"l", 1, 0, 'l'},
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"r", 0, 0, 'r'},
+ {"p", 0, 0, 'p'},
+ {0, 0, 0, 0}
+ };
+
+ bool helpRequested = false;
+ bool confFile = false;
+ int c;
+
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1){
+ switch (c){
+ case 'c':
+ confFile = true;
+ globals["conffile"] = string(optarg);
+ break;
+ case 'l':
+ globals["layoutfile"] = string(optarg);
+ break;
+ case 'r':
+ circularGenome = true;
+ break;
+ case 'p':
+ pickStartEndTogether = true;
+ break;
+ case 'h':
+ // printHelpText();
+ helpRequested = true;
+ break;
+ case '?':
+ return false;
+ }
+ } // while each parameter
+
+ if (helpRequested){
+ printHelpText();
+ exit(0);
+ } // if help
+
+ if (optind < argc){
+ globals["input"] = string(argv[optind]);
+ }
+
+ return true;
+} // GetOptions
+
+void parseInFile(ifstream & in)
+{
+ string line;
+ long size = 0;
+ bool first = true;
+
+ while (getline(in, line)){
+ if (line[0] == '>'){ // header line
+ if (! first){
+ fastasizes.push_back(size);
+ size = 0;
+ }
+ first = false;
+ } else { // fasta record
+ size += line.length();
+ }
+ }
+ if (! first)
+ fastasizes.push_back(size);
+
+ size = 0;
+ for (int i = 0; i < fastasizes.size(); i++){
+ long tmp = fastasizes[i];
+ fastasizes[i] = size;
+ size += tmp;
+ }
+ genomeSize = size;
+}
+
+void parseConfFile(ifstream & conf)
+{
+ string line;
+ int readmean;
+ int readstdev;
+ int mean;
+ int stdev;
+ int min;
+ int max;
+ char libid[256];
+ float coverage;
+ float permates;
+ int readLen;
+
+ Library_t library;
+
+ library.mean = 0; library.stdev = 0; library.coverage = 0;
+
+ bool first = true;
+ while (getline(conf, line)){
+ if (line.length() > 1 && line[0] == '#')// skip comments
+ continue;
+ if (! first && strncmp(line.c_str(), "library", 7) == 0){
+ libraries.push_back(library);
+ library.mean = 0; library.stdev = 0; library.coverage = 0;
+ }
+ if (strncmp(line.c_str(), "library", 7) == 0)
+ first = false; // no longer first library
+
+ if (sscanf(line.c_str(), "library %s %d %d %f", libid, &mean, &stdev, &permates) == 4){
+ library.name = string(libid);
+ library.mean = mean;
+ library.stdev = stdev;
+ library.permates = permates;
+ } else if (sscanf(line.c_str(), "library %s", libid) == 1){
+ library.name = string(libid);
+ }
+ if (sscanf(line.c_str(), "reads %d %d %d %d", &mean, &stdev, &min, &max) == 4){
+ library.readmean = mean;
+ library.readstdev = stdev;
+ library.readmin = min;
+ library.readmax = max;
+ }
+ if (sscanf(line.c_str(), "read %d", &readLen) == 1) {
+ readSizes.push_back(readLen);
+ }
+ if (sscanf(line.c_str(), "coverage %f", &coverage) == 1){
+ library.coverage = coverage;
+ }
+ }
+ if (first) {
+ cerr << "config file seems empty" << endl;
+ exit(1);
+ }
+ libraries.push_back(library);
+} // parseConfFile
+
+string parseFasta(ifstream & in){
+ static string lastline = "";
+ string line = "";
+ string out = "";
+
+ // skip blank lines
+ while (!in.eof() && lastline == ""){
+ getline(in, lastline);
+ // cerr << "Got " << lastline << endl;
+ if (lastline[0] != '>'){
+ if (lastline.length() == 0) { continue; }
+ cerr << "Sequence doesn't start with >: " << lastline << endl;
+ }
+ }
+ while (getline(in, line)){
+ lastline = line;
+ if (line[0] == '>')
+ break;
+ out += line;
+ }
+ return out;
+} // parseFasta
+
+char revcompl(char c)
+{
+ switch (toupper(c)){
+ case 'A': return 'T';
+ case 'C': return 'G';
+ case 'T': return 'A';
+ case 'G': return 'C';
+ case 'U': return 'A';
+ case 'M': return 'K';
+ case 'R': return 'Y';
+ case 'W': return 'W';
+ case 'S': return 'S';
+ case 'Y': return 'R';
+ case 'K': return 'M';
+ case 'V': return 'B';
+ case 'H': return 'D';
+ case 'D': return 'H';
+ case 'B': return 'V';
+ case 'N': return 'N';
+ case 'X': return 'X';
+ case '-': return '-';
+ default: return 'N';
+ }
+} // revcompl char version
+
+string revcompl(const string & in)
+{
+ string out = in;
+ for (int i = 0; i < in.length(); i++)
+ out[in.length() - i - 1] = revcompl(in[i]);
+ return out;
+} // revcompl string version
+
+string getSubstring(string seq, int start, int length) {
+ string result;
+
+ if ((start + length) > seq.length() && circularGenome == false) {
+ // invalid length spanning origin should not happen
+ cerr << "Error: read spans the end of sequence and circular genome is not true. Should not happen!" << endl;
+ exit(1);
+ }
+
+ if (start >= seq.length()) {
+ start = start % seq.length();
+ result = seq.substr(start, length);
+ }
+ else if ((start + length) >= seq.length()) {
+ int leftover = (start + length) % seq.length();
+ result = seq.substr(start, seq.length()-start);
+ result += seq.substr(0, leftover);
+ } else {
+ result = seq.substr(start, length);
+ }
+
+ return result;
+}
+
+void printRED(string seq, int id, int frgid)
+{
+ cout << "{RED\n";
+ cout << "iid:" << id << "\n";
+ if (frgid != 0)
+ cout << "frg:" << frgid << "\n";
+ cout << "clr:0," << seq.length() << "\n";
+ cout << "seq:\n";
+ for (int i = 0; i < seq.length(); i+= 60)
+ cout << seq.substr(i, 60) << "\n";
+ cout << ".\n";
+ cout << "qlt:\n";
+ for (int i = 0; i < seq.length(); i++){
+ if (i != 0 && i % 60 == 0)
+ cout << "\n";
+ cout << "l";
+ }
+ cout << "\n";
+ cout << ".\n";
+ cout << "}\n";
+}
+
+//--------------------------------------------------------
+int main(int argc, char ** argv)
+{
+
+ if (!GetOptions(argc, argv)){
+ cerr << "Command line parsing failed, use -h option for usage info"
+ << endl;
+ //printHelpText();
+ exit(1);
+ }
+
+ if (globals.find("conffile") == globals.end()){
+ cerr << "A configuration file must be provided. see -h" << endl;
+ exit(1);
+ }
+
+ if (globals.find("input") == globals.end()){
+ cerr << "An input file must be provided. see -h" << endl;
+ exit(1);
+ }
+
+ ifstream conf(globals["conffile"].c_str());
+ if (! conf.is_open()){
+ cerr << "Could not open conffile" << globals["conffile"] << endl;
+ exit(1);
+ }
+
+ parseConfFile(conf);
+
+ ifstream in(globals["input"].c_str());
+ if (! in.is_open()){
+ cerr << "Could not open input " << globals["input"] << endl;
+ exit(1);
+ }
+
+ parseInFile(in);
+
+ vector<vector<Fragment_t> > fragments;
+ fragments.reserve(fastasizes.size());
+ fragments.resize(fastasizes.size());
+
+ // set up the random number generator
+ gsl_rng * rng = gsl_rng_alloc(gsl_rng_mt19937);
+ // gsl_rng * rng = gsl_rng_alloc(gsl_rng_rand);
+
+ for (int i = 0; i < libraries.size(); i++){
+ if (libraries[i].coverage == 0)
+ continue;
+
+ unsigned long target = (long) libraries[i].coverage * genomeSize;
+ unsigned long totLen = 0;
+ unsigned long mean, stdev;
+
+ if (libraries[i].mean == 0){
+ mean = libraries[i].readmean;
+ stdev = libraries[i].readstdev;
+ } else {
+ mean = libraries[i].mean;
+ stdev = libraries[i].stdev;
+ }
+
+ // cerr << "Library mean " << libraries[i].mean << endl;
+ // cerr << "Library stdev " << libraries[i].stdev << endl;
+ // cerr << "Library read mean " << libraries[i].readmean << endl;
+ // cerr << "Library.readstdev " << libraries[i].readstdev << endl;
+
+ while (totLen < target){
+ long start = 0;
+ unsigned long len = 0;
+ if (pickStartEndTogether == true) {
+ unsigned long numPositions = (unsigned long) round(genomeSize / mean);
+ start = (mean * gsl_rng_uniform_int(rng, numPositions)) + gsl_rng_uniform_int(rng, mean) + (long) round(gsl_ran_gaussian(rng, stdev));
+ if (start <= 0) {
+ continue;
+ }
+ len = mean + (long) round(gsl_ran_gaussian(rng, stdev));
+ if (start > genomeSize)
+ continue;
+ }
+ else if (readSizes.size() != 0) {
+ // if we were given a list of read sizes instead of a distribution use that instead
+ start = gsl_rng_uniform_int(rng, genomeSize);
+ int readIndex = gsl_rng_uniform_int(rng, readSizes.size());
+ len = readSizes[readIndex];
+ }
+ else {
+ start = gsl_rng_uniform_int(rng, genomeSize);
+ // cerr << "gaussian stdev: " << stdev << " value: " << gsl_ran_gaussian(rng, stdev) << endl;
+ len = mean + (unsigned long) round(gsl_ran_gaussian(rng, stdev));
+ }
+
+ // find molecule that contains start
+ vector<long>::iterator mol = upper_bound(fastasizes.begin(), fastasizes.end(), start);
+
+ if (len < libraries[i].readmin)
+ continue; // inserts should be bigger than the
+ // smallest read
+ if (mol == fastasizes.end()) {
+ if (len > genomeSize - start) {
+ if (len > genomeSize)
+ continue;
+
+ if (circularGenome == true) {
+ // allow reads spanning ends of sequence
+ }
+ else {
+ continue;
+ }
+ }
+ } else {
+ if (len > *mol - start) // beyond end of molecule
+ continue;
+ }
+ // cerr << "Length is " << (unsigned long) len << " , " << start + len << endl;
+
+ assert (mol != fastasizes.begin());
+ int idx = mol - fastasizes.begin() - 1; // where to insert fragment
+ Fragment_t frg;
+
+ vector<long>::iterator prev = mol - 1;
+ frg.left = start - *prev;
+ frg.right = frg.left + len;
+ frg.libid = i + 1;
+
+ // now the reads
+ if (libraries[i].mean == 0){ // unpaired read
+ frg.forwlen = len;
+ frg.revlen = 0;
+ totLen += len;
+ } else {
+ int forwlen = (int) (libraries[i].readmean
+ + gsl_ran_gaussian(rng, libraries[i].readstdev));
+ int revlen = (int) (libraries[i].readmean
+ + gsl_ran_gaussian(rng, libraries[i].readstdev));
+
+ // make sure reads are between min and max
+ while (forwlen > libraries[i].readmax || forwlen < libraries[i].readmin)
+ forwlen = (int) (libraries[i].readmean
+ + gsl_ran_gaussian(rng, libraries[i].readstdev));
+
+ while (revlen > libraries[i].readmax || revlen < libraries[i].readmin)
+ revlen = (int) (libraries[i].readmean
+ + gsl_ran_gaussian(rng, libraries[i].readstdev));
+
+
+ if (forwlen > len) forwlen = len;
+ if (revlen > len) revlen = len;
+ frg.forwlen = forwlen;
+ frg.revlen = revlen;
+ totLen += forwlen + revlen;
+ }
+ fragments[idx].push_back(frg);
+ } // while coverage not attained
+ } // for each library
+
+ // header record
+ cout << "{UNV\n";
+ cout << "com:\n";
+ cout << "generated by shotgunSim\n";
+ for (int i = 0; i < argc; i++)
+ cout << argv[i] << " ";
+ cout << "\n";
+ cout << ".\n";
+ cout << "}\n";
+ // output libraries
+ for (int i = 0; i < libraries.size(); i++){
+ if (libraries[i].coverage == 0)
+ continue;
+ if (libraries[i].mean == 0)
+ continue;
+
+ cout << "{LIB\n";
+ cout << "iid:" << i + 1 << "\n";
+ cout << "eid:" << libraries[i].name << "\n";
+ cout << "{DST\n";
+ cout << "mea:" << libraries[i].mean << "\n";
+ cout << "std:" << libraries[i].stdev << "\n";
+ cout << "}\n";
+ cout << "}\n";
+ } // for each library again
+
+ // now the fragments are all built, we just need to write out the files
+ in.clear(); // clear flags
+ in.seekg(0, ifstream::beg); // re-process input file
+
+ // if we do layouts, do them here
+ ofstream laystream;
+ if (globals.find("layoutfile") != globals.end()){
+ laystream.open(globals["layoutfile"].c_str(), ofstream::out|ofstream::trunc);
+ if (! laystream.is_open()){
+ cerr << "Could not open " << globals["layoutfile"] << endl;
+ exit(1);
+ }
+ }
+
+ int seq = 0;
+ string sequence;
+ int numseq = 0;
+ while ((sequence = parseFasta(in)) != ""){
+ if (globals.find("layoutfile") != globals.end()){ // start a layout
+ laystream << "{LAY\n";
+ laystream << "iid:" << seq + 1 << endl;
+ }
+ for (int f = 0; f < fragments[seq].size(); f++){
+ int frgid = 0;
+ // cerr << fragments[seq][f].left << " " << fragments[seq][f].right << endl;
+ // cerr << "DoingF " << fragments[seq][f].left << " " << fragments[seq][f].forwlen << endl;
+ string forw = getSubstring(sequence, fragments[seq][f].left, fragments[seq][f].forwlen);//this one always exists
+ int doRead = 0; // do both
+ double mates = gsl_rng_uniform(rng);
+ if (fragments[seq][f].revlen == 0 ||
+ libraries[fragments[seq][f].libid].permates == 1 ||
+ mates < libraries[fragments[seq][f].libid].permates)
+ doRead = 0;
+ else
+ doRead = 1;
+
+ mates = gsl_rng_uniform(rng);
+ if (mates < 0.5)
+ doRead = -doRead; // do just reverse
+
+ if (fragments[seq][f].revlen != 0) { // the whole shebang
+ // cerr << "DoingR " << fragments[seq][f].right - fragments[seq][f].revlen << " " << fragments[seq][f].revlen << endl;
+ string rev = revcompl(getSubstring(sequence, fragments[seq][f].right - fragments[seq][f].revlen, fragments[seq][f].revlen));
+ frgid = ++numseq;
+ cout << "{FRG\n";
+ cout << "iid:" << frgid << "\n";
+ cout << "lib:" << fragments[seq][f].libid << "\n";
+ cout << "typ:I\n";
+ if ( doRead == 0 )
+ cout << "rds:" << numseq + 1 << ',' << numseq + 2 << '\n';
+ cout << "}\n";
+ if (doRead <= 0) {
+ printRED(rev, ++numseq, frgid);
+ if (globals.find("layoutfile") != globals.end()){ // add read to the layout
+ laystream << "{TLE\n";
+ laystream << "src:" << numseq << endl;
+ laystream << "off:" << fragments[seq][f].right - fragments[seq][f].revlen << endl;
+ laystream << "clr:" << fragments[seq][f].revlen << ",0\n";
+ laystream << "}\n";
+ }
+ }
+ }
+ if (doRead >= 0) {
+ printRED(forw, ++numseq, frgid);
+ if (globals.find("layoutfile") != globals.end()){ // add read to the layout
+ laystream << "{TLE\n";
+ laystream << "src:" << numseq << endl;
+ laystream << "off:" << fragments[seq][f].left << endl;
+ laystream << "clr:0," << forw.length() << "\n";
+ laystream << "}\n";
+ }
+ }
+ } // for each fragment in this sequence
+
+ seq++;
+ if (globals.find("layoutfile") != globals.end())
+ laystream << "}\n";
+ }
+
+ if (globals.find("layoutfile") != globals.end())
+ laystream.close();
+
+ return(0);
+} // main
diff --git a/src/Sim/summarizeMultiTest.pl b/src/Sim/summarizeMultiTest.pl
new file mode 100755
index 0000000..93ee141
--- /dev/null
+++ b/src/Sim/summarizeMultiTest.pl
@@ -0,0 +1,35 @@
+#!/usr/local/bin/perl
+
+my @heads = ("TotalScaffolds", "TotalContigsInScaffolds", "N50ScaffoldBases", "N50ContigBases");
+
+open(OUT, ">runtest.out") || die("Cannot open runtest.out: $!\n");
+open(LOG, "runtest.log") || die("Cannot open runtest.log: $!\n");
+
+$_ = <LOG>; # skip the header line
+
+my @fields = split(' ', $_);
+print OUT join ("\t", @fields[1..6]);
+for (my $i = 0; $i <= $#heads; $i++){
+ print OUT "\t$heads[$i]";
+}
+print OUT "\n";
+
+while (<LOG>){
+ my @fields = split(' ', $_);
+ my %recs = ();
+
+
+ open(QC, "test_$fields[0].qc") || next;
+ while (<QC>){
+ chomp;
+ $_ =~ /(\S+)(=|\s+)(\S+)/;
+ $recs{$1} = $3;
+ }
+ close(QC);
+ print OUT join("\t", @fields[1..6]);
+ for (my $i = 0; $i <= $#heads; $i++){
+ print OUT "\t$recs{$heads[$i]}";
+ }
+ print OUT "\n";
+}
+close(LOG);
diff --git a/src/Sim/tandemCollapse.cc b/src/Sim/tandemCollapse.cc
new file mode 100644
index 0000000..240d1d6
--- /dev/null
+++ b/src/Sim/tandemCollapse.cc
@@ -0,0 +1,439 @@
+// $Revision$
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+// C includes
+#include <getopt.h>
+#include <ctype.h>
+
+// STL includes
+#include <vector>
+#include <map>
+#include <fstream>
+#include <queue>
+
+// AMOS includes
+#include "Layout_AMOS.hh"
+#include "Contig_AMOS.hh"
+#include "Bank_AMOS.hh"
+
+using namespace std;
+using namespace AMOS;
+using namespace HASHMAP;
+
+#define endl "\n" // die endl, die!
+
+map <string, string> globals; // global variables
+
+void printHelpText()
+{
+ cout <<
+ ".NAME." << endl <<
+ "tandemCollapse" << endl <<
+ endl <<
+ "Program for simulating the effect of tandem repeat collapses on a read layout" << endl <<
+ endl <<
+ ".USAGE." << endl <<
+ "tandemCollapse -b bank -c config" << endl <<
+ endl <<
+ ".OPTIONS." << endl <<
+ "-b bank - location of bank directory" << endl <<
+ "-c config - config file that specifies locations of tandems" << endl <<
+ "-m misassemblies.list - output location of mis-assemblies in final layout" << endl <<
+ endl <<
+ ".DESCRIPTION." << endl <<
+ "This program takes a configuration file specifying an input layout" << endl <<
+ "together with a description of a set of tandem repeats and generates " << endl <<
+ "a new layout representing a mis-assembly of the original layout through" << endl <<
+ "the collapse of the specified repeats." << endl <<
+ endl <<
+ "The format of the configuration file is:" << endl <<
+ "CTG iid 7" << endl <<
+ "ctg7 collapse " << endl <<
+ "R 200 1200 4" << endl <<
+ "R 8000 2000 2" << endl <<
+ "..." << endl <<
+ endl <<
+ "The first line indicates the source of the layout: the contig (CTG)" << endl <<
+ "or layout (LAY) identified by the corresponding iid or eid." << endl <<
+ "The second line is the eid of the layout that will be generated." << endl <<
+ "The remaining lines (prefixed by R) list information about the repeats" << endl <<
+ "Specifically: start_coord length num_copies" << endl <<
+ endl <<
+ "Note: in case repeats overlap, the behaviour of the program is unspecified" << endl <<
+ endl <<
+ ".KEYWORDS" << endl <<
+ "Simulation" << endl
+ ;
+
+} // printHelpText
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ {"b", 1, 0, 'b'},
+ {"c", 1, 0, 'c'},
+ {"m", 1, 0, 'm'},
+ {"h", 0, 0, 'h'},
+ {"help", 0, 0, 'h'},
+ {0,0,0,0}
+ };
+
+ bool helpRequested = false;
+ int c;
+
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -
+1){
+ switch (c){
+ case 'b':
+ globals["bank"] = string(optarg);
+ break;
+ case 'c':
+ globals["conffile"] = string(optarg);
+ break;
+ case 'm':
+ globals["misfile"] = string(optarg);
+ break;
+ case 'h':
+ helpRequested = true;
+ break;
+ case '?':
+ return false;
+ }
+ } // while c = getopt
+
+ if (helpRequested) {
+ printHelpText();
+ exit(0);
+ } // if help
+
+ if (optind < argc) // leftover command line params.
+ globals["input"] = string(argv[optind]);
+
+} // GetOptions
+
+
+// useful for sorting tile arrays
+struct cmpTile : public binary_function<Tile_t, Tile_t, bool> {
+ bool operator () (Tile_t x, Tile_t y)
+ {
+ if (x . offset < y . offset)
+ return true;
+ if (x . offset == y . offset && x . range . getLength () < y . range . getLength ())
+ return true;
+ return false;
+ }
+};
+
+// useful for sorting pair arrays
+template <class A, class B>
+struct ltByFirst : public binary_function<pair<A, B>, pair<A, B>, bool> {
+ bool operator () (pair<A, B> x, pair<A, B> y)
+ {
+ if (x . first < y . first)
+ return true;
+ return false;
+ }
+};
+
+// useful for sorting pair arrays
+template <class A, class B>
+struct gtByFirst : public binary_function<pair<A, B>, pair<A, B>, bool> {
+ bool operator () (pair<A, B> x, pair<A, B> y)
+ {
+ if (x . first > y . first)
+ return true;
+ return false;
+ }
+};
+
+//-------------------------------------------
+
+int main (int argc, char ** argv)
+{
+
+ if (!GetOptions(argc, argv)){
+ cerr << "Command line parsing failed, use -h option for usage info"
+ << endl;
+ //printHelpText();
+ exit(1);
+ }
+
+ if (globals.find("conffile") == globals.end()){
+ cerr << "Must provide a config file with option -c (see -h for more info)" << endl;
+ exit(1);
+ }
+
+ ifstream conf_stream(globals["conffile"].c_str());
+ if (! conf_stream.is_open()){
+ cerr << "Could not open config file " << globals["conffile"] << endl;
+ exit (1);
+ }
+
+ ofstream mis;
+ if (globals.find("misfile") != globals.end()){
+ mis.open(globals["misfile"].c_str());
+ if (! mis.is_open()){
+ cerr << "Could not open misassembly file " << globals["misfile"] << endl;
+ exit(1);
+ }
+ }
+
+ bool byIID = true;
+ bool doCTG = true;
+ ID_t iid = 0;
+ string eid = "";
+ string out_eid;
+ string tmp;
+
+ conf_stream >> tmp;
+ if (tmp == "CTG") {
+ doCTG = true;
+ cout << "Will process contig ";
+ } else if (tmp == "LAY") {
+ doCTG = false;
+ cout << "Will process layout ";
+ } else {
+ cerr << "Don't understand " << tmp << " on first line of configuration file" << endl;
+ exit(1);
+ }
+
+ conf_stream >> tmp;
+
+ if (tmp == "iid") {
+ conf_stream >> iid;
+ byIID = true;
+ cout << "with iid " << iid << endl;
+ } else if (tmp == "eid") {
+ while (isspace(conf_stream.peek())) conf_stream.get(); // skip whitespace
+ getline(conf_stream, eid);
+ byIID = false;
+ cout << "with eid " << eid << endl;
+ } else {
+ cerr << "Don't understand " << tmp << " on first line of configuration file" << endl;
+ exit(1);
+ }
+
+ while (isspace(conf_stream.peek())) conf_stream.get(); // skip to next line
+ getline(conf_stream, out_eid);
+
+ cout << "Output layout eid is <" << out_eid << ">" << endl;
+
+ vector<pair<Pos_t, Pos_t> > brkpoints; // places where repeats were collapsed: coord, rep_len
+
+ while (! conf_stream.eof()){
+ Pos_t start, len;
+ int ncopy;
+
+ conf_stream >> tmp >> start >> len >> ncopy;
+
+ if (conf_stream.eof())
+ break;
+
+ cerr << "Repeat " << start << " " << len << " " << ncopy << " implies breakpoints:" << endl;
+ if (tmp != "R"){
+ cerr << "Don't understand " << tmp << " in configuration file. Repeat line expected" << endl;
+ exit(1);
+ }
+
+ start += len;
+ for (int i = 1; i < ncopy; i++, start += len) {
+ brkpoints.push_back(pair<Pos_t, Pos_t> (start, len));
+ cerr << start << "\t" << len << endl;
+ }
+ }
+ conf_stream.close();
+
+ // done reading configuration. now it's time for the real thing.
+ //
+ // start by loading the vector of tiles from the selected contig/layout
+ // go along the tile vector until we hit a breakpoint.
+ // remove all tiles spanning the breakpoint
+ // shift down (reduce offset) of subsequent tiles by cumulative length of repeats seen up to
+ // this point
+
+ Bank_t contig_bank (Contig_t::NCODE);
+ Bank_t layout_bank (Layout_t::NCODE);
+
+ vector <Tile_t> tv; // tiles we'll use for our processing
+
+ if (!doCTG) { // just layouts
+ if (! layout_bank.exists(globals["bank"])) {
+ cerr << "Layout bank doesn't exist in " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ layout_bank.open(globals["bank"], B_READ|B_WRITE);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open layout account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ Layout_t lay;
+ if (byIID) {
+ try {
+ layout_bank.fetch(iid, lay);
+ } catch (Exception_t & e) {
+ cerr << "Could not fetch layout with iid" << iid
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ } else { // byeid
+ try {
+ layout_bank.fetch(eid, lay);
+ } catch (Exception_t & e) {
+ cerr << "Could not fetch layout with eid" << eid
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ }
+
+ tv = lay.getTiling();
+ } else {
+ if (! contig_bank.exists(globals["bank"])) {
+ cerr << "Contig bank doesn't exist in " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ contig_bank.open(globals["bank"], B_READ|B_WRITE);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open contig account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ if (! layout_bank.exists(globals["bank"])){
+ // must create it
+ try {
+ layout_bank.create(globals["bank"], B_WRITE);
+ } catch (Exception_t & e) {
+ cerr << "Failed to create layout account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ } else {
+ try {
+ layout_bank.open(globals["bank"], B_WRITE);
+ } catch (Exception_t & e) {
+ cerr << "Failed to open layout account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ } // if layout bank exists
+
+ Contig_t ctg;
+ if (byIID) {
+ try {
+ contig_bank.fetch(iid, ctg);
+ } catch (Exception_t & e) {
+ cerr << "Could not fetch contig with iid" << iid
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ } else { // byeid
+ try {
+ contig_bank.fetch(eid, ctg);
+ } catch (Exception_t & e) {
+ cerr << "Could not fetch contig with eid" << eid
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ }
+
+ tv = ctg.getReadTiling();
+
+ contig_bank.close(); // don't need this anymore
+ } // if doCtg
+
+ // sort tile vector by tile offset & breakpoints by coord
+ sort(tv.begin(), tv.end(), cmpTile());
+ sort(brkpoints.begin(), brkpoints.end(), ltByFirst<Pos_t, Pos_t> ());
+
+ priority_queue <pair<Pos_t, int>, vector<pair<Pos_t, int> >, gtByFirst<Pos_t, int> > pq; // "active" tiles
+ int nextBrk = 0; // next breakpoint to be processed
+ Pos_t adjust = 0; // shift tiles by this much
+ vector<Tile_t> new_tv; // output tiles
+
+ new_tv.reserve(tv.size()); // need at most this many tiles
+
+ int ti = 0;
+ int laststart = 0;
+ while (ti < tv.size()) {
+ if (nextBrk < brkpoints.size() && brkpoints[nextBrk].first < tv[ti].offset &&
+ ! pq.empty() && brkpoints[nextBrk].first < pq.top().first) {
+ // pq had better not be empty at this point
+ // clean up pq and move on
+ cerr << "found breakpoint @" << brkpoints[nextBrk].first << endl;;
+ while (! pq.empty())
+ pq.pop();
+
+ if (globals.find("misfile") != globals.end()){ // need to output breaks
+ if (laststart == 0 || brkpoints[nextBrk].first - brkpoints[nextBrk].second - adjust > laststart){
+ laststart = brkpoints[nextBrk].first - brkpoints[nextBrk].second - adjust;
+ mis << laststart << " " << brkpoints[nextBrk].first - adjust << endl;
+ }
+ // otherwise this was a > 2 copy repeat
+ }
+
+ adjust += brkpoints[nextBrk].second;
+ nextBrk++;
+ continue;
+ }
+ if (pq.empty() || tv[ti].offset <= pq.top().first) { // add to pq
+ cerr << "Adding to pq @" << tv[ti].offset << " " << tv[ti].source << endl;
+ pq.push(pair<Pos_t, int> (tv[ti].offset + tv[ti].getGappedLength(), ti));
+ ti++;
+ continue;
+ }
+ if (! pq.empty() && pq.top().first < tv[ti].offset) { // remove from pq
+ Tile_t nt = tv[pq.top().second];
+
+ cerr << "Removing from pq @" << pq.top().first << " " << nt.source << endl;
+
+ nt.offset -= adjust; // shift by current adjustment
+ new_tv.push_back(nt); // add to output
+ pq.pop(); // remove from queue
+ continue;
+ }
+ } // while ti < tv.size();
+
+ // now we just have to empty the queue
+ while (! pq.empty()){
+ if (nextBrk < brkpoints.size() && brkpoints[nextBrk].first < pq.top().first)
+ break; // nothing more to do here,this step would emtpy the queue anyway
+
+ Tile_t nt = tv[pq.top().second];
+
+ nt.offset -= adjust; // shift by current adjustment
+ new_tv.push_back(nt); // add to output
+ pq.pop();
+ } // while ! pq.empty()
+
+ // now we need to generate a new layout
+ Layout_t new_lay;
+ ID_t newid = layout_bank.getMaxIID() + 1;
+
+ new_lay.setTiling(new_tv);
+ new_lay.setEID(out_eid);
+ new_lay.setIID(newid);
+
+ try {
+ layout_bank.append(new_lay);
+ } catch (Exception_t & e) {
+ cerr << "Could not append new layout to bank iid=" << newid
+ << " eid=" << out_eid << " : " << endl << e << endl;
+ exit(1);
+ }
+
+ layout_bank.close();
+ if (globals.find("misfile") != globals.end())
+ mis.close();
+
+ cerr << "Done\n";
+
+ exit(0);
+} // main
diff --git a/src/Slice/Makefile.am b/src/Slice/Makefile.am
new file mode 100644
index 0000000..3d8ea9b
--- /dev/null
+++ b/src/Slice/Makefile.am
@@ -0,0 +1,27 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+##-- TO BE INSTALLED
+amoslib_LIBRARIES = \
+ libSlice.a
+
+amosinclude_HEADERS = \
+ Slice.h
+
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/AMOS
+
+
+##-- libSlice.a
+libSlice_a_SOURCES = \
+ getConsQC.c \
+ getConsQV.c \
+ newmem.c \
+ utility.c \
+ version.h
+
+
+##-- END OF MAKEFILE --##
\ No newline at end of file
diff --git a/src/Slice/Makefile.in b/src/Slice/Makefile.in
new file mode 100644
index 0000000..1e1340e
--- /dev/null
+++ b/src/Slice/Makefile.in
@@ -0,0 +1,617 @@
+# 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 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@
+DIST_COMMON = $(amosinclude_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+subdir = src/Slice
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(amoslibdir)" \
+ "$(DESTDIR)$(amosincludedir)"
+LIBRARIES = $(amoslib_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libSlice_a_AR = $(AR) $(ARFLAGS)
+libSlice_a_LIBADD =
+am_libSlice_a_OBJECTS = getConsQC.$(OBJEXT) getConsQV.$(OBJEXT) \
+ newmem.$(OBJEXT) utility.$(OBJEXT)
+libSlice_a_OBJECTS = $(am_libSlice_a_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libSlice_a_SOURCES)
+DIST_SOURCES = $(libSlice_a_SOURCES)
+HEADERS = $(amosinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+amoslib_LIBRARIES = \
+ libSlice.a
+
+amosinclude_HEADERS = \
+ Slice.h
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/AMOS
+
+libSlice_a_SOURCES = \
+ getConsQC.c \
+ getConsQV.c \
+ newmem.c \
+ utility.c \
+ version.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Slice/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Slice/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):
+install-amoslibLIBRARIES: $(amoslib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(amoslibdir)" || $(MKDIR_P) "$(DESTDIR)$(amoslibdir)"
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(amoslibdir)'"; \
+ $(INSTALL_DATA) $$list2 "$(DESTDIR)$(amoslibdir)" || exit $$?; }
+ @$(POST_INSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ for p in $$list; do \
+ if test -f $$p; then \
+ $(am__strip_dir) \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && $(RANLIB) $$f )"; \
+ ( cd "$(DESTDIR)$(amoslibdir)" && $(RANLIB) $$f ) || exit $$?; \
+ else :; fi; \
+ done
+
+uninstall-amoslibLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amoslib_LIBRARIES)'; test -n "$(amoslibdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amoslibdir)' && rm -f "$$files" )"; \
+ cd "$(DESTDIR)$(amoslibdir)" && rm -f $$files
+
+clean-amoslibLIBRARIES:
+ -test -z "$(amoslib_LIBRARIES)" || rm -f $(amoslib_LIBRARIES)
+libSlice.a: $(libSlice_a_OBJECTS) $(libSlice_a_DEPENDENCIES)
+ -rm -f libSlice.a
+ $(libSlice_a_AR) libSlice.a $(libSlice_a_OBJECTS) $(libSlice_a_LIBADD)
+ $(RANLIB) libSlice.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/getConsQC.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/getConsQV.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/newmem.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/utility.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) '$<'`
+install-amosincludeHEADERS: $(amosinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(amosincludedir)" || $(MKDIR_P) "$(DESTDIR)$(amosincludedir)"
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(amosincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(amosincludedir)" || exit $$?; \
+ done
+
+uninstall-amosincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(amosinclude_HEADERS)'; test -n "$(amosincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(amosincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(amosincludedir)" && rm -f $$files
+
+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) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(amoslibdir)" "$(DESTDIR)$(amosincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-amoslibLIBRARIES clean-generic 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-amosincludeHEADERS install-amoslibLIBRARIES
+
+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:
+
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-amosincludeHEADERS uninstall-amoslibLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+ clean-amoslibLIBRARIES clean-generic ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-amosincludeHEADERS install-amoslibLIBRARIES \
+ 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-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-amosincludeHEADERS \
+ uninstall-amoslibLIBRARIES uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Slice/Slice.h b/src/Slice/Slice.h
new file mode 100644
index 0000000..9769b03
--- /dev/null
+++ b/src/Slice/Slice.h
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+/*! @file
+ * @brief Defines interface for libSlice.
+ *
+ * Library of functions for determining quality values and classes on slices.
+ * Include this file to use all publicly available methods and data
+ * structures.
+ */
+
+#ifndef SLICE_H
+#define SLICE_H 1
+
+/*! @defgroup cinterface C Interface
+ * The C interface contains the algorithms for the calculations on raw slices.
+ *
+ * @{
+ */
+
+//! What is considered high quality by ABI
+/*! Default threshold used when highQualityThreshold is 0.
+ */
+#define HIGH_QUALITY_THRESHOLD 30
+
+//! Quality Value to return when floating point underflows occur.
+/*! Effectively, the maximum quality value that can ever occur. Quality Values
+ * upto ~3000 can occur, so this has been set at 4000 to indicate that it is
+ * higher than all the rest, but there is no way calculate the value exactly
+ * without higher precision floats.
+ */
+#define MAX_QUALITY_VALUE 4000
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//! Structure for specifing slice information
+struct libSlice_Slice
+{
+ //! Null terminated list of bases in {'A', 'C', 'T', 'G', ...}
+ char * bc;
+
+ //! Null terminated list of quality values in [0..99]
+ char * qv;
+
+ //! Null terminated list of reverse complements in {0,1}
+ char * rc;
+
+ //! Existing consensus
+ char c;
+
+ //! Depth of coverage
+ /*! Note: dcov == strlen(bc) == strlen (qv) == strlen(rc) */
+ unsigned short dcov;
+};
+typedef struct libSlice_Slice libSlice_Slice;
+
+//! Bit flag for 'A' in ambiguity code
+#define AMBIGUITY_FLAGBIT_A 0x1
+
+//! Bit flag for 'C' in ambiguity code
+#define AMBIGUITY_FLAGBIT_C 0x2
+
+//! Bit flag for 'G' in ambiguity code
+#define AMBIGUITY_FLAGBIT_G 0x4
+
+//! Bit flag for 'T' in ambiguity code
+#define AMBIGUITY_FLAGBIT_T 0x8
+
+//! Bit flag for '-' in ambiguity code
+#define AMBIGUITY_FLAGBIT_GAP 0x10
+
+//! Holds the quality value of the onsensus and each of the 5 components
+struct libSlice_Consensus
+{
+ //! Quality Value that 'A' is the consensus
+ unsigned int qvA;
+ //! Quality Value that 'C' is the consensus
+ unsigned int qvC;
+ //! Quality Value that 'G' is the consensus
+ unsigned int qvG;
+ //! Quality Value that 'T' is the consensus
+ unsigned int qvT;
+ //! Quality Value that '-' (gap) is the consensus
+ unsigned int qvGap;
+
+ //! Quality Value of the consensus
+ unsigned int qvConsensus;
+ //! Consensus value
+ char consensus;
+
+ //! Flags indicating which of the 5 bases should be included
+ char ambiguityFlags;
+
+ long double cpA, cpC, cpG, cpT, cpGap;
+};
+
+typedef struct libSlice_Consensus libSlice_Consensus;
+
+
+//! Holds a table of the distribution of bases
+struct libSlice_BaseDistribution
+{
+ //! Global frequency of 'A' as consensus
+ double freqA;
+ //! Global frequency of 'C' as consensus
+ double freqC;
+ //! Global frequency of 'G' as consensus
+ double freqG;
+ //! Global frequency of 'T' as consensus
+ double freqT;
+ //! Global frequency of '-' as consensus
+ double freqGap;
+};
+typedef struct libSlice_BaseDistribution libSlice_BaseDistribution;
+
+#define MAX_SCORING_MODEL 4
+
+
+/*! @name Slice Consensus Calculations
+ * Functions for calculating the consensus and qv of a single slice
+ */
+//@{
+
+// Set if empty slices should be recalled (to gap) or not
+void libSlice_setRecallEmpty(int recallEmpty);
+
+// Calculate consensus base and quality values faster
+int libSlice_ConsensusLight (const unsigned qvSum [5],
+ int nof_ambiguities,
+ char * consensus,
+ unsigned * cns_qv);
+
+// Internal function: Calculates the consensus and consensus quality
+// values for a single slice
+int libSlice_getConsensusParam(const libSlice_Slice * s,
+ libSlice_Consensus * result,
+ const libSlice_BaseDistribution * dist,
+ int highQualityThreshold,
+ int doAmbiguity);
+
+// Updates the ambiguity flags using the conic model and scoring matrix
+int libSlice_updateAmbiguityConic(const libSlice_Slice * s,
+ libSlice_Consensus * consensus,
+ int highQaulity,
+ int scoringModel);
+
+
+// Update the ambiguity flags with all high quality reads
+int libSlice_updateAmbiguity(const libSlice_Slice * s,
+ libSlice_Consensus * consensus,
+ int highQualityThreshold);
+
+// Wrapper to calculate the consensus and consensus quality values
+// for a range of slices without using ambiguity codes
+int libSlice_getConsensus(const libSlice_Slice * s,
+ libSlice_Consensus * results,
+ const libSlice_BaseDistribution * dist,
+ int highQualityThreshold);
+
+// Wrapper to calculate the consensus and consensus quality values
+// for a range of slices with using ambiguity codes
+int libSlice_getConsensusWithAmbiguity(const libSlice_Slice * s,
+ libSlice_Consensus * results,
+ const libSlice_BaseDistribution * dist,
+ int highQualityThreshold);
+//@}
+
+/*! @name SliceRange Consensus Calculations
+ * Functions for calculating the consensus and qv of a range of slices
+ */
+//@{
+
+// Internal function: Calculates the consensus and consensus quality
+// values for an array of slices
+int libSlice_getConsensusRangeParam(const libSlice_Slice s[],
+ libSlice_Consensus results[],
+ int len,
+ const libSlice_BaseDistribution * dist,
+ int highQualityThreshold,
+ int doAmbiguity);
+
+// Calculates the consensus of an array of slice with no ambiguity codes
+int libSlice_getConsensusRange(const libSlice_Slice s[],
+ libSlice_Consensus results[],
+ int len,
+ const libSlice_BaseDistribution * dist,
+ int highQualityThreshold);
+
+// Calculates the consensus of an array of slice with ambiguity codes
+int libSlice_getConsensusRangeWithAmbiguity(const libSlice_Slice s[],
+ libSlice_Consensus results[],
+ int len,
+ const libSlice_BaseDistribution * dist,
+ int highQualityThreshold);
+
+//@}
+
+/*! @name Quality Class Calculations
+ * Functions for calculating the quality class of slices
+ */
+//@{
+
+// Calculates the consensus quality class for a single slice
+char libSlice_getConsQC(const libSlice_Slice * s, int highQualityThreshold);
+
+// Calculates consensus quality classes for a range of slices
+char * libSlice_getConsQCRange(const libSlice_Slice s[],
+ int len,
+ int highQualityThreshold);
+
+//@}
+
+/*! @name Ambiguity Code Calculations
+ * Functions for calculating ambiguity Codes
+ */
+//@{
+
+// Calculate IUPAC ambiguity code based on error probabilities
+char libSlice_getAmbiguityCode(long double cpA,
+ long double cpC,
+ long double cpG,
+ long double cpT,
+ long double cpGap,
+ int highQualityThreshold,
+ int baseCount);
+
+// Calculate error probabilities with a threshold into ambiguity flags
+char libSlice_calculateAmbiguityFlags(long double cpA,
+ long double cpC,
+ long double cpG,
+ long double cpT,
+ long double cpGap,
+ int highQualityThreshold,
+ int baseCount);
+
+
+// Converts a character with 5 bit flags into IUPAC Ambiguity Code
+char libSlice_convertAmbiguityFlags(char ambiguityFlags);
+
+//@}
+
+
+/*! @name Utility Functions
+ * Other useful functions
+ */
+//@{
+
+// Get the complement of a base or ambiguity code
+char libSlice_getCompliment(char base);
+
+// Get a version string
+const char * libSlice_getVersion();
+
+
+
+//! Error Checking malloc
+/*! Returns char * to a new block of memory, or prints an error if it couldnt
+ * malloc the memory.\n\n
+ *
+ * A slight modification of Paul Hardy's code from alnseq
+ * @param number Number of blocks to allocate
+ * @param size Size of each block to allocate
+ * @return Block of new memory number*size bytes big
+ * @exception Exits(-1) If it can't malloc memory
+ */
+void * libSlice_newmem(int number, int size);
+
+//@}
+
+//! @}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/Slice/getConsQC.c b/src/Slice/getConsQC.c
new file mode 100644
index 0000000..f0c27fc
--- /dev/null
+++ b/src/Slice/getConsQC.c
@@ -0,0 +1,434 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+/*! @file
+ * @brief getConsQC and getConsQCRange Implementation
+ * \n
+ *
+ * C code adaptation of Martin Shumway's consensus class script from cutAsm.
+ * Return values range from 0 to 23. A return value of 0 indicates an error
+ * has occured calculating the quality class. Quality classes 1-23
+ * correspond to the quality classes used in TIGR Assembler.
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <math.h>
+#include <stdlib.h>
+
+#include "Slice.h"
+
+
+// Bit Flags
+// Quality in both directions
+#define QUALITY_OTHER_STRAND 0x1
+
+// No conflicts with existing consensus
+#define NO_CONFLICT 0x2
+
+// Quality in at least one direction
+#define QUALITY_STRAND 0x4
+
+// Low quality read in other direction
+#define NON_QUALITY_OTHER_STRAND 0x8
+
+// More than one in quality direction
+#define QUALITY_SAME_STRAND 0x10
+
+// Non quality read in high or 2 low reads
+#define NON_QUALITY_SAME_STRAND 0x20
+
+// Conflict with low quality read
+#define NON_QUALITY_CONFLICT 0x40
+
+// Only one read
+#define SINGLE_COVERAGE 0x80
+
+// Low quality read in same direction
+#define NON_QUALITY_STRAND 0x100
+
+// High quality conflict
+#define QUALITY_CONFLICT 0x200
+
+// Ambigious existing consensus
+#define AMBIGUITY 0x400
+
+// for (NON_QUALITY_SAME_STRAND || QUALITY_SAME_STRAND)
+#define ANY_SAME_STRAND 0x800
+
+// Consensus is a gap
+#define GAP_CONSENSUS 0x1000
+
+// Depth of Coverage == 0
+#define DEPTHZERO 0x2000
+
+#define FORWARD 0
+#define REVERSE 1
+
+// Quality classes
+#define QUALITY_CLASS_0 0
+#define QUALITY_CLASS_1 1
+#define QUALITY_CLASS_2 2
+#define QUALITY_CLASS_3 3
+#define QUALITY_CLASS_4 4
+#define QUALITY_CLASS_5 5
+#define QUALITY_CLASS_6 6
+#define QUALITY_CLASS_7 7
+#define QUALITY_CLASS_8 8
+#define QUALITY_CLASS_9 9
+#define QUALITY_CLASS_10 10
+#define QUALITY_CLASS_11 11
+#define QUALITY_CLASS_12 12
+#define QUALITY_CLASS_13 13
+#define QUALITY_CLASS_14 14
+#define QUALITY_CLASS_15 15
+#define QUALITY_CLASS_16 16
+#define QUALITY_CLASS_17 17
+#define QUALITY_CLASS_18 18
+#define QUALITY_CLASS_19 19
+#define QUALITY_CLASS_20 20
+#define QUALITY_CLASS_21 21
+#define QUALITY_CLASS_22 22
+#define QUALITY_CLASS_23 23
+
+#define QUALITY_CLASS_ERROR 0
+
+
+/*! @internal
+ * Convert a bit field coded integer into associated quality class
+ */
+char QUALITY_CLASS(int x)
+{
+ // Set the AND_SAME_STRAND bit if either of the same values are true
+ if ((x & NON_QUALITY_SAME_STRAND) || (x & QUALITY_SAME_STRAND))
+ {
+ x += ANY_SAME_STRAND;
+ }
+
+ if (x & DEPTHZERO)
+ {
+ return QUALITY_CLASS_0;
+ }
+ else if ((x & GAP_CONSENSUS) &&
+ (x & NO_CONFLICT))
+ {
+ return QUALITY_CLASS_21;
+ }
+ else if ((x & NO_CONFLICT) &&
+ (x & QUALITY_OTHER_STRAND))
+ {
+ return QUALITY_CLASS_1;
+ }
+ else if ((x & NO_CONFLICT) &&
+ (x & QUALITY_STRAND) &&
+ (x & NON_QUALITY_OTHER_STRAND))
+ {
+ return QUALITY_CLASS_2;
+ }
+ else if ((x & NO_CONFLICT) &&
+ (x & QUALITY_STRAND) &&
+ (x & ANY_SAME_STRAND))
+ {
+ return QUALITY_CLASS_3;
+ }
+ else if ((x & NO_CONFLICT) &&
+ (x & NON_QUALITY_OTHER_STRAND))
+ {
+ return QUALITY_CLASS_4;
+ }
+ else if ((x & NO_CONFLICT) &&
+ (x & NON_QUALITY_SAME_STRAND))
+ {
+ return QUALITY_CLASS_5;
+ }
+ else if ((x & NON_QUALITY_CONFLICT) &&
+ (x & QUALITY_OTHER_STRAND))
+ {
+ return QUALITY_CLASS_6;
+ }
+ else if ((x & NON_QUALITY_CONFLICT) &&
+ (x & QUALITY_STRAND) &&
+ (x & NON_QUALITY_OTHER_STRAND))
+ {
+ return QUALITY_CLASS_7;
+ }
+ else if ((x & NON_QUALITY_CONFLICT) &&
+ (x & QUALITY_STRAND) &&
+ (x & ANY_SAME_STRAND))
+ {
+ return QUALITY_CLASS_8;
+ }
+ else if ((x & NO_CONFLICT) &&
+ (x & QUALITY_STRAND) &&
+ (x & SINGLE_COVERAGE))
+ {
+ return QUALITY_CLASS_9;
+ }
+ else if ((x & NON_QUALITY_CONFLICT) &&
+ (x & NON_QUALITY_OTHER_STRAND))
+ {
+ return QUALITY_CLASS_10;
+ }
+ else if ((x & NO_CONFLICT) &&
+ (x & NON_QUALITY_STRAND) &&
+ (x & SINGLE_COVERAGE))
+ {
+ return QUALITY_CLASS_11;
+ }
+ else if ((x & NON_QUALITY_CONFLICT) &&
+ (x & NON_QUALITY_SAME_STRAND))
+ {
+ return QUALITY_CLASS_12;
+ }
+ else if ((x & NON_QUALITY_CONFLICT) &&
+ (x & QUALITY_STRAND) &&
+ (x & SINGLE_COVERAGE))
+ {
+ return QUALITY_CLASS_13;
+ }
+ else if ((x & NON_QUALITY_CONFLICT) &&
+ (x & NON_QUALITY_STRAND) &&
+ (x & SINGLE_COVERAGE))
+ {
+ return QUALITY_CLASS_14;
+ }
+ else if ((x & QUALITY_CONFLICT) &&
+ (x & QUALITY_OTHER_STRAND))
+ {
+ return QUALITY_CLASS_15;
+ }
+ else if ((x & QUALITY_CONFLICT) &&
+ (x & QUALITY_STRAND) &&
+ (x & NON_QUALITY_OTHER_STRAND))
+ {
+ return QUALITY_CLASS_16;
+ }
+ else if ((x & QUALITY_CONFLICT) &&
+ (x & QUALITY_STRAND) &&
+ (x & ANY_SAME_STRAND))
+ {
+ return QUALITY_CLASS_17;
+ }
+ else if ((x & QUALITY_CONFLICT) &&
+ (x & NON_QUALITY_OTHER_STRAND))
+ {
+ return QUALITY_CLASS_18;
+ }
+ else if ((x & QUALITY_CONFLICT) &&
+ (x & NON_QUALITY_SAME_STRAND))
+ {
+ return QUALITY_CLASS_19;
+ }
+ else if ((x & QUALITY_CONFLICT) &&
+ (x & QUALITY_STRAND) &&
+ (x & SINGLE_COVERAGE))
+ {
+ return QUALITY_CLASS_20;
+ }
+ else if ((x & AMBIGUITY) &&
+ (x & SINGLE_COVERAGE))
+ {
+ return QUALITY_CLASS_21;
+ }
+ else if (x & AMBIGUITY)
+ {
+ return QUALITY_CLASS_22;
+ }
+ else if ((x & QUALITY_CONFLICT) &&
+ (x & NON_QUALITY_STRAND) &&
+ (x & SINGLE_COVERAGE))
+ {
+ return QUALITY_CLASS_23;
+ }
+ else if ((x & (QUALITY_STRAND | NON_QUALITY_STRAND)) == 0)
+ {
+ // No reads in agreement with the consensus
+ return QUALITY_CLASS_23;
+ }
+
+ return QUALITY_CLASS_ERROR;
+}
+
+
+//! Calculates the quality class for a single slice
+/*! Quality classes 1-23 are the same as the quality class definitions
+ * from TIGR Assembler. A return value of 0 indicates that an error has occured
+ * in calculating the quality class.
+ *
+ * @param s Slice to evaluate
+ * @param highQualityThreshold Threshold for defining highQuality
+ * @return Quality class of slice
+ */
+char libSlice_getConsQC(const libSlice_Slice *s, int highQualityThreshold)
+{
+ // Initialize Counters index 0 = Forward strand, 1 = Reverse strand
+ int HQStrand[2] = {0,0};
+ int LQStrand[2] = {0,0};
+ int HQStrandDisagree[2] = {0,0};
+ int LQStrandDisagree[2] = {0,0};
+
+ // Counters
+ int nonHomogCount = 0; // number of bases in conflict with consensus
+ int homogCount = 0; // number of bases in agreement
+
+ char existing_consensus = s->c;
+ int class = 0;
+
+ // Initialize Flags
+ int gap_consensus = 0;
+ int single_coverage = 0;
+ int no_conflict = 1;
+
+ int quality_strand = 0;
+ int quality_same_strand = 0;
+ int quality_other_strand = 0;
+ int quality_conflict = 0;
+ int non_quality_strand = 0;
+ int non_quality_same_strand = 0;
+ int non_quality_other_strand = 0;
+ int non_quality_conflict = 0;
+ int ambiguity = 0;
+ int depthzero = 0;
+ int i;
+
+ if (highQualityThreshold == 0)
+ {
+ highQualityThreshold = HIGH_QUALITY_THRESHOLD;
+ }
+
+ depthzero = (s->dcov == 0);
+
+ // Loop through each base call to compute counts of high/low quality
+ for(i = 0; i < s->dcov; i++)
+ {
+ int rc = s->rc[i];
+ int qual = s->qv[i]; // base call quality value
+ char basecall = toupper(s->bc[i]); // base call value
+
+ if (basecall == existing_consensus)
+ {
+ homogCount++;
+ if (qual >= highQualityThreshold)
+ {
+ HQStrand[rc]++;
+ }
+ else
+ {
+ LQStrand[rc]++;
+ }
+ }
+ else
+ {
+ nonHomogCount++;
+ no_conflict = 0;
+
+ if (qual >= highQualityThreshold)
+ {
+ HQStrandDisagree[rc]++;
+ }
+ else
+ {
+ LQStrandDisagree[rc]++;
+ }
+ }
+ }
+
+ if (homogCount == 1)
+ {
+ single_coverage = 1;
+ }
+
+ // Compute additional properties for quality classes.
+ if (existing_consensus == 'A' || existing_consensus == 'T' ||
+ existing_consensus == 'G' || existing_consensus == 'C' ||
+ existing_consensus == '-')
+ {
+ gap_consensus = (existing_consensus == '-');
+
+ quality_strand = HQStrand[FORWARD] || HQStrand[REVERSE];
+ quality_other_strand = HQStrand[FORWARD] && HQStrand[REVERSE];
+
+ quality_same_strand = HQStrand[FORWARD] > 1 || HQStrand[REVERSE] > 1;
+
+ quality_conflict = HQStrandDisagree[FORWARD]||HQStrandDisagree[REVERSE];
+
+ non_quality_conflict = LQStrandDisagree[FORWARD]||LQStrandDisagree[REVERSE];
+
+ if (quality_strand)
+ {
+ int strand = HQStrand[FORWARD] < HQStrand[REVERSE];
+ int other_strand = !strand;
+
+ non_quality_strand = LQStrand[strand] > 0;
+ non_quality_same_strand = LQStrand[strand] > 0;
+ non_quality_other_strand = LQStrand[other_strand] > 0;
+ }
+ else
+ {
+ non_quality_strand = LQStrand[FORWARD] || LQStrand[REVERSE];
+ non_quality_other_strand = LQStrand[FORWARD] && LQStrand[REVERSE];
+
+ non_quality_same_strand = LQStrand[FORWARD] > 1 || LQStrand[REVERSE] > 1;
+ }
+ }
+ else
+ {
+ ambiguity = 1;
+ }
+
+ if (quality_conflict)
+ {
+ // This ensures that the two are mutually exclusive, with preference
+ // towards quality_conflict.
+ non_quality_conflict = 0;
+ }
+
+
+ // Compute the quality class
+ class += (no_conflict * NO_CONFLICT);
+ class += (quality_strand * QUALITY_STRAND);
+ class += (quality_same_strand * QUALITY_SAME_STRAND);
+ class += (quality_other_strand * QUALITY_OTHER_STRAND);
+ class += (quality_conflict * QUALITY_CONFLICT);
+ class += (non_quality_strand * NON_QUALITY_STRAND);
+ class += (non_quality_same_strand * NON_QUALITY_SAME_STRAND);
+ class += (non_quality_other_strand * NON_QUALITY_OTHER_STRAND);
+ class += (non_quality_conflict * NON_QUALITY_CONFLICT);
+ class += (single_coverage * SINGLE_COVERAGE);
+ class += (ambiguity * AMBIGUITY);
+ class += (gap_consensus * GAP_CONSENSUS);
+ class += (depthzero * DEPTHZERO);
+
+ return QUALITY_CLASS(class);
+}
+
+
+//! Calculates the quality classes for a range of slices
+/*!
+ * @param s Array of slices to evaluate quality classes
+ * @param len Length of array
+ * @param highQualityThreshold Threshold to use for highQuality
+ * @return Pointer to Null terminated list of quality classes
+ * (one for each slice)
+ *
+ * @see getConsQC
+ */
+char * libSlice_getConsQCRange(const libSlice_Slice s[],
+ int len,
+ int highQualityThreshold)
+{
+ int i;
+ char *cqc = libSlice_newmem(len+1,sizeof(char));
+ cqc[len] = '\0';
+
+ for(i = 0; i < len; i++)
+ {
+ cqc[i] = libSlice_getConsQC(&s[i], highQualityThreshold);
+ }
+
+ return cqc;
+}
diff --git a/src/Slice/getConsQV.c b/src/Slice/getConsQV.c
new file mode 100644
index 0000000..ffafa2d
--- /dev/null
+++ b/src/Slice/getConsQV.c
@@ -0,0 +1,1356 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+/*! @file
+ * @brief Implementation of functions which calculate consensus and consensus
+ * quality values.
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <math.h>
+#include <stdlib.h>
+#include <float.h>
+
+#include "Slice.h"
+
+//! Quality assigned to a gap when it is input as having 0 quality
+#define GAP_QUALITY_VALUE 20
+
+//! Quality value to assign to gap in an empty slice
+#define GAP_QUALITY_VALUE_EMPTY_SLICE 1
+
+//! Quality assigned to an ambiguity during input
+#define AMBIGUITY_QUALITY_VALUE_IN 20
+
+//! Quality value to assign to an ambiguity during output
+#define AMBIGUITY_QUALITY_VALUE_OUT 1
+
+//! The default distribution of bases for distributing qv probabilities
+libSlice_BaseDistribution standardDistribution = {.20, .20, .20, .20, .20};
+
+#define CONIC_SIMPLE_SCORING_COUNT 10
+#define CONIC_SIMPLE_SCORING -2
+#define CONIC_ALL_AMBIGUITY -1
+#define CONIC_NO_ADJUSTMENT 0
+
+#define MAX_SCORING_COUNT 5
+
+
+
+/*
+ * scoringMatrix[0]-LQ
+ * 0...secondQV
+ * .
+ * .
+ * .
+ * maxQV
+ *
+ * scoringMatrix[0]-HQ
+ * 0...secondQV
+ * .
+ * .
+ * .
+ * maxQV
+ *
+ * scoringMatrix[1]-LQ
+ * 0...secondQV
+ * .
+ * .
+ * .
+ * maxQV
+ *
+ * .
+ * .
+ * .
+ */
+
+int scoringMatrix[MAX_SCORING_MODEL][2][MAX_SCORING_COUNT][MAX_SCORING_COUNT] =
+{
+ {
+ // 0-LQ
+ {
+ {0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0},
+ },
+
+ // 0-HQ
+ {
+ {0, 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-LQ
+ {
+ {0, 0, 0, 0, 0},
+ {0, -1, -1, -1, -1},
+ {0, -1, -1, -1, -1},
+ {0, -1, -1, -1, -1},
+ {0, -1, -1, -1, -1},
+ },
+
+ // 1-HQ
+ {
+ {0, 0, 0, 0, 0},
+ {0, -1, -1, -1, -1},
+ {0, -1, -1, -1, -1},
+ {0, -1, -1, -1, -1},
+ {0, -1, -1, -1, -1},
+ },
+ },
+
+
+ {
+ // 2-LQ
+ {
+ {0, 0, 0, 0, 0},
+ {0, -2, -2, -2, -2},
+ {0, -2, -2, -2, -2},
+ {0, -2, -2, -2, -2},
+ {0, -2, -2, -2, -2},
+ },
+
+ // 2-HQ
+ {
+ {0, 0, 0, 0, 0},
+ {0, -2, -2, -2, -2},
+ {0, -2, -2, -2, -2},
+ {0, -2, -2, -2, -2},
+ {0, -2, -2, -2, -2},
+ },
+ },
+
+ {
+ // 3-LQ
+ {
+ {0, 0, 0, 0, 0},
+ {0, 16, 12, 8, 4},
+ {0, 15, 11, 7, 3},
+ {0, 14, 10, 6, 2},
+ {0, 13, 9, 5, 1},
+ },
+
+ // 3-HQ
+ {
+ {0, 0, 0, 0, 0},
+ {0, 16, 12, 8, 4},
+ {0, 15, 11, 7, 3},
+ {0, 14, 10, 6, 2},
+ {0, 13, 9, 5, 1},
+ },
+ },
+};
+
+
+
+/*! @internal
+ * Convert probabilities into the equivalent quality value.
+ *
+ * Note: If pr is exactly 0 or <0, returns MAX_QUALITY_VALUE.
+ */
+inline int prToQV(long double pr)
+{
+ if (pr == 0.0L || pr < 0)
+ {
+ //fprintf (stderr, "floating point underflow in prToQV\n");
+ return MAX_QUALITY_VALUE;
+ }
+
+ return floor(0.5 - 10.0 * log10(pr));
+}
+
+/*! @internal
+ * Assigns a base a positive probability and divides the remaining probabilty.
+ * The remaining probability is distributed according to their frequency.
+ */
+inline void distributeQV(int qv,
+ long double * base,
+ long double * error1, double frequency1,
+ long double * error2, double frequency2,
+ long double * error3, double frequency3,
+ long double * error4, double frequency4)
+{
+ if (qv)
+ {
+ long double ep = pow(0.1, (double) qv/10.0);
+ long double sum = frequency1 + frequency2 + frequency3 + frequency4;
+
+ // error probability 1-Pr(x_ij=A | s_i=A)
+ *base = 1-ep;
+
+ // Divide the remaining probability among the other possibilities
+ // based on their global frequency
+
+ *error1 = ep * frequency1/sum;
+ *error2 = ep * frequency2/sum;
+ *error3 = ep * frequency3/sum;
+ *error4 = ep * frequency4/sum;
+ }
+}
+
+/*! @name Ambiguity Code Calculations
+ * Functions for calculating ambiguity codes
+ */
+
+//@{
+
+//! Calculates ambiguity flags from Churchill and Waterman procedure
+/*! The procedure has been modified to take as a parameter the maximum number
+ * of bases that can be represented by the ambiguity code. This way if only
+ * A's and C's were seen in the read a baseCount of 2 can be passed and
+ * the ambiguity code will only be one of A,C, or (A || C) = M even if the
+ * QV of M does not reach the quality threshold. Set this value to 5
+ * to be compatible with the Churchill and Waterman procedure.
+ *
+ * Returns a character of which the 5 lowest bits are used to flag the
+ * inclusion of A,C,G,T,-.
+ *
+ * @param cpA Error probability of 'A'
+ * @param cpC Error probability of 'C'
+ * @param cpG Error probability of 'G'
+ * @param cpT Error probability of 'T'
+ * @param cpGap Error probability of '-'
+ * @param highQualityThreshold QV Value considered high quality
+ * @param baseCount Maximum number of bases represented by ambiguity code
+ *
+ * @retval Ambiguity flags packed into a single character
+ */
+char libSlice_calculateAmbiguityFlags(long double cpA,
+ long double cpC,
+ long double cpG,
+ long double cpT,
+ long double cpGap,
+ int highQualityThreshold,
+ int baseCount)
+{
+ int codeSize = 0;
+ char ambiguityFlags = 0;
+ long double probSum = 0;
+ long double baseProb [5] = {cpA, cpC, cpG, cpT, cpGap};
+
+ long double cpAmbiguity;
+
+ if (highQualityThreshold == 0)
+ {
+ highQualityThreshold = HIGH_QUALITY_THRESHOLD;
+ }
+
+ if (baseCount < 1 || baseCount > 5) baseCount = 5;
+
+ /*
+ fprintf(stdout,
+ "cpA=%Le, cpC=%Le, cpG=%Le, cpT=%Le, cpGap=%Le, hq=%d\n",
+ cpA, cpC, cpG, cpT, cpGap, highQualityThreshold);
+ */
+
+ // Find the minimum set of bases such that the sum of the probabilities
+ // exceeds the threshold and the size of the code is at most baseCount bases
+ do
+ {
+ int i;
+ int min = 0; // Assume position 0 is best
+
+ // Find the base with the lowest error probability
+ for (i = 1; i < 5; i++)
+ {
+ if (baseProb[i] < baseProb[min]) min = i;
+ }
+
+ // Add this base to the running sum of probability of success
+ probSum += (1.0 - baseProb[min]);
+ baseProb[min] = 2.0; // Guaranteed not to be included in next pass
+ codeSize++;
+
+ switch (min)
+ {
+ case 0: ambiguityFlags |= AMBIGUITY_FLAGBIT_A; break;
+ case 1: ambiguityFlags |= AMBIGUITY_FLAGBIT_C; break;
+ case 2: ambiguityFlags |= AMBIGUITY_FLAGBIT_G; break;
+ case 3: ambiguityFlags |= AMBIGUITY_FLAGBIT_T; break;
+ case 4: ambiguityFlags |= AMBIGUITY_FLAGBIT_GAP; break;
+ };
+
+ if (probSum == 1.0)
+ {
+ // A QV as low as 200 can be problematic because 1-baseProb[min] converts
+ // a probability close to 0 to one close to 1, and it takes more bits to
+ // represent a number close to 1.
+ //
+ // Fortunately, at that level, the consensus should not be ambiguous
+
+ //fprintf(stdout, "floating point underflow detected in calcAmbFlags\n");
+ break;
+ }
+
+ cpAmbiguity = 1.0-probSum;
+ }
+ while ((prToQV(cpAmbiguity) < highQualityThreshold) &&
+ (codeSize < baseCount));
+
+ return ambiguityFlags;
+}
+
+//! Calculates extended ambiguity code bases from ambiguity flags
+/*! Use the five ambiguity flags to find an ambiguity code. Extended
+ * ambiguity codes are encoded in lowercase, ie. "A*" = 'a'.
+ *
+ * @param ambiguityFlags Output from calculateAmbiguityFlags
+ * @retval Extended Ambiguity Code
+ */
+char libSlice_convertAmbiguityFlags(char ambiguityFlags)
+{
+ int addA = (ambiguityFlags & AMBIGUITY_FLAGBIT_A);
+ int addC = (ambiguityFlags & AMBIGUITY_FLAGBIT_C);
+ int addG = (ambiguityFlags & AMBIGUITY_FLAGBIT_G);
+ int addT = (ambiguityFlags & AMBIGUITY_FLAGBIT_T);
+ int addGap = (ambiguityFlags & AMBIGUITY_FLAGBIT_GAP);
+
+ char consensus = '?';
+
+ // Pick IUPAC code
+
+ if (addA && addC && addG && addT) consensus = 'N';
+ else if (addA && addC && addG) consensus = 'V';
+ else if (addA && addC && addT) consensus = 'H';
+ else if (addA && addG && addT) consensus = 'D';
+ else if (addC && addG && addT) consensus = 'B';
+ else if (addA && addT) consensus = 'W';
+ else if (addA && addC) consensus = 'M';
+ else if (addA && addG) consensus = 'R';
+ else if (addC && addG) consensus = 'S';
+ else if (addC && addT) consensus = 'Y';
+ else if (addG && addT) consensus = 'K';
+ else if (addA) consensus = 'A';
+ else if (addC) consensus = 'C';
+ else if (addG) consensus = 'G';
+ else if (addT) consensus = 'T';
+ else if (addGap) consensus = '-';
+
+ // Encode extended ambiguity codes as well
+ if ((consensus != '-') && addGap)
+ {
+ consensus = tolower(consensus);
+ }
+
+ return consensus;
+}
+
+
+//! Return IUPAC Ambiguity Code in one operation
+/*! Uses calculateAmbiguityFlags and convertAmbiguityFlags to generate
+ * an IUPAC ambiguity code from 5 error probabilities.
+ *
+ * @param cpA Error probability of 'A'
+ * @param cpC Error probability of 'C'
+ * @param cpG Error probability of 'G'
+ * @param cpT Error probability of 'T'
+ * @param cpGap Error probability of '-'
+ * @param highQualityThreshold QV Value considered high quality
+ * @param baseCount Maximum number of bases represented by ambiguity code
+ *
+ * @retval IUPAC Ambiguity Code
+ *
+ * @see calculateAmbiguityFlags
+ * @see convertAmbiguityFlags
+ */
+char libSlice_getAmbiguityCode(long double cpA,
+ long double cpC,
+ long double cpG,
+ long double cpT,
+ long double cpGap,
+ int highQualityThreshold,
+ int baseCount)
+{
+ char ambiguityFlags = libSlice_calculateAmbiguityFlags(cpA, cpC, cpG, cpT,
+ cpGap,
+ highQualityThreshold,
+ baseCount);
+ return libSlice_convertAmbiguityFlags(ambiguityFlags);
+}
+
+//@}
+
+/*! @name Slice Consensus Calculations
+ * Functions for calculating the consensus and qv of a single slice
+ */
+//@{
+
+// Not thread safe, but protects the API
+int m_recallEmpty = 0;
+
+//! Toggles if empty slices should be recalled as gap
+/*! If this is set to true, slices will be recalled as gap. Otherwise,
+ * empty slices will be left alone. The probabilities and cqv will be
+ * incorrect in either case, but it's pretty meaningless on an empty slice.
+ */
+void libSlice_setRecallEmpty(int recallEmpty)
+{
+ m_recallEmpty = recallEmpty;
+}
+
+
+//! Lightweight calculation of consensus base and its quality value
+/*! Calculate consensus base and its quality value using simple heuristics
+ * similar to libSlice_getConsensusParam. Ambiguities in the input reads AND
+ * in the output consensus are processed. However, to simplify, all types of
+ * ambiguities are treated as an 'N'
+ *
+ * @param qvSum Sum of quality values for each character ACGT-, resp.
+ * @param nof_ambiguities Number of ambiguous residues in the slice
+ * @param consensus Set to consensus character (A,C,G,T,N,or-)
+ * @param cns_qv Set to quality value of consensus
+ * @return errorCode 0 on success.
+ */
+int libSlice_ConsensusLight (const unsigned qvSum [5],
+ int nof_ambiguities,
+ char * consensus,
+ unsigned * cns_qv)
+{
+ const char * ALPHABET = "ACGT-"; // N is used too
+ unsigned qv [5] = {0}; // sum of quality scores for ACGT- resp.
+ int baseCount = 0; // number of bases seen in read
+ int identical_qvs = 0; // bases (ACGT) present in the slice all have same qv?
+ unsigned alt_qv, max_qv = 0, max2_qv = 0, qv_total = 0;
+ int retval = 0;
+ int i, mx_i;
+
+ for (i = 0; i < 5; i ++)
+ {
+ qv [i] = qvSum [i]; // copy original array
+ if (i < 4)
+ {
+ // N counts as A+C+G+T
+ qv [i] += nof_ambiguities * AMBIGUITY_QUALITY_VALUE_IN;
+ }
+ if (qv [i] > 0)
+ {
+ qv_total += qv [i];
+ baseCount ++;
+ if (max_qv < qv [i])
+ {
+ max_qv = qv [i];
+ mx_i = i;
+ identical_qvs = 0;
+ }
+ else if (max_qv == qv [i] && i > 0 && i < 4 )
+ {
+ identical_qvs = 1;
+ }
+ }
+ }
+
+ // Determine consensus base
+ if (qv_total == 0)
+ {
+ // An empty slice is a gap
+ max_qv = qv_total = qv [4] = GAP_QUALITY_VALUE_EMPTY_SLICE;
+ baseCount = 1;
+ mx_i = 4;
+ (* consensus) = ALPHABET [mx_i];
+ }
+ else if (identical_qvs)
+ {
+ // Equal quality values is some sort of ambiguity (N to simplify)
+ max_qv = qv_total = AMBIGUITY_QUALITY_VALUE_OUT;
+ baseCount = 1;
+ (* consensus) = 'n';
+ }
+ else
+ {
+ // Consensus base is the one with the highest quality value
+ (* consensus) = ALPHABET [mx_i];
+ }
+
+ // Calculate consensus quality value
+ if (baseCount == 1)
+ ; // nothing to do; max_qv has correct value
+ else if (baseCount == 2)
+ { // only two possibilities
+ max2_qv = qv_total - max_qv;
+ max_qv -= max2_qv; // tentative quality is difference between max and 2nd max
+ alt_qv = (int) (0.5 - 10.0 * log10 (1.0 * max2_qv / qv_total));
+ // alternate is just in case difference is *REALLY* small
+ if (max_qv < alt_qv)
+ max_qv = alt_qv;
+ }
+ else
+ {
+ double qvx [3], logp [3], pr1, sum;
+
+ // Get 2nd max qv
+ for (i = 0; i < 5; i ++)
+ if (i != mx_i && max2_qv < qv [i])
+ max2_qv = qv [i];
+
+ if (qv_total - max_qv - max2_qv < max2_qv)
+ qvx [2] = (qv_total - max_qv - max2_qv);
+ else
+ qvx [2] = max2_qv;
+ qvx [0] = max_qv / 10.0;
+ qvx [1] = max2_qv / 10.0;
+ qvx [2] /= 10.0;
+
+ for (i = 0; i < 3; i ++)
+ {
+ logp [i] = (300.0 < qvx [i] ? 0.0 : - log10 (1.0 - pow (0.1, qvx [i])));
+ logp [i] -= qvx [i]; // omitting constant term of sum of all qvx's
+ // which is irrelevant after scaling
+ if (0 < i)
+ logp [i] -= (logp [0] - 1.0); // scale to avoid underflow
+ }
+
+ logp [0] = 1.0; // scaled value
+
+ sum = pr1 = 0.1; // = pow (10.0, - logp [0]);
+ sum += (300.0 < logp [1] ? 0.0 : pow (10.0, - logp [1]));
+ sum += (300.0 < logp [2] ? 0.0 : pow (10.0, - logp [2]));
+
+ max_qv = prToQV (1.0 - (pr1 / sum));
+ }
+
+ if (max_qv < MAX_QUALITY_VALUE)
+ (* cns_qv) = max_qv;
+ else
+ (* cns_qv) = MAX_QUALITY_VALUE;
+
+ return retval;
+}
+
+
+
+//! Calculates the consensus quality value for a single slice
+/*! Calculates the consensus and consensus quality values for a slice using
+ * Bayes formula and the procedure from Churchill, G.A. and Waterman, M.S.
+ * "The accuracy of DNA sequences: Estimating sequence quality."
+ * Genomics 14, pp. 89-98 (1992).
+ *
+ * Note: If dist is NULL, assumes a normal distribution of {.2,.2,.2,.2,.2} for
+ * {A,C,G,T,-}.
+ *
+ * Note: It is the callers responsibility to free the result.
+ *
+ * @param s Pointer to a slice.
+ * @param result Pointer for storing results.
+ * @param dist Table of distribution of the bases.
+ * @param highQualityThreshold Threshold for ambiguity codes.
+ * @param doAmbiguity Flag to calculate ambiguity codes.
+ * @return errorCode 0 on sucess.
+ */
+int libSlice_getConsensusParam(const libSlice_Slice *s,
+ libSlice_Consensus * result,
+ const libSlice_BaseDistribution * dist,
+ int highQualityThreshold,
+ int doAmbiguity)
+{
+ int retval = 0;
+
+ // quality value multiplicities
+ unsigned int qvMultA = 0;
+ unsigned int qvMultC = 0;
+ unsigned int qvMultG = 0;
+ unsigned int qvMultT = 0;
+ unsigned int qvMultGap = 0;
+
+#define USE_OLD_WAY 0
+ // Old way computes probabilities directly but can result in underflow
+ // New way converts everything to logs and scales. Results can be very
+ // slightly different. Old-way code is left here to help explain the
+ // calculation
+
+#if USE_OLD_WAY
+ // consensus quality value parameters
+ // current consensus base: s_i, the column of base calls above it: x_ij
+ long double pr_A_A = 1.0; // Pr(x_ij=A | s_i=A)
+ long double pr_C_A = 1.0; // Pr(x_ij=C | s_i=A)
+ long double pr_G_A = 1.0; // Pr(x_ij=G | s_i=A)
+ long double pr_T_A = 1.0; // Pr(x_ij=T | s_i=A)
+ long double pr_GAP_A = 1.0;
+
+ long double pr_A_C = 1.0;
+ long double pr_C_C = 1.0;
+ long double pr_G_C = 1.0;
+ long double pr_T_C = 1.0;
+ long double pr_GAP_C = 1.0;
+
+ long double pr_A_G = 1.0;
+ long double pr_C_G = 1.0;
+ long double pr_G_G = 1.0;
+ long double pr_T_G = 1.0;
+ long double pr_GAP_G = 1.0;
+
+ long double pr_A_T = 1.0;
+ long double pr_C_T = 1.0;
+ long double pr_G_T = 1.0;
+ long double pr_T_T = 1.0;
+ long double pr_GAP_T = 1.0;
+
+ long double pr_A_GAP = 1.0;
+ long double pr_C_GAP = 1.0;
+ long double pr_G_GAP = 1.0;
+ long double pr_T_GAP = 1.0;
+ long double pr_GAP_GAP = 1.0;
+
+ long double pA, pC, pG, pT, pGap, sum;
+ unsigned int qvA, qvC, qvG, qvT, qvGap;
+#endif
+
+ long double cpA, cpC, cpG, cpT, cpGap, cpConsensus;
+ char consensus; // calculated consensus
+ int baseCount = 0; // number of bases seen in read
+ unsigned int cqv = 0; // calculated consensus quality value
+
+ if (!result || !s)
+ {
+ // Result can't be NULL
+ return -1;
+ }
+
+ if (highQualityThreshold < 0)
+ {
+ doAmbiguity = 0;
+ }
+
+ if (!s->dcov && !m_recallEmpty)
+ {
+ (result)->qvA = 0;
+ (result)->qvC = 0;
+ (result)->qvG = 0;
+ (result)->qvT = 0;
+ (result)->qvGap = 0;
+
+ (result)->cpA = 0.2;
+ (result)->cpC = 0.2;
+ (result)->cpG = 0.2;
+ (result)->cpT = 0.2;
+ (result)->cpGap = 0.2;
+
+ (result)->qvConsensus = 0;
+ (result)->ambiguityFlags = 0;
+
+ // Just set the consensensus to be the old consensus
+ (result)->consensus = s->c;
+
+ return retval;
+ }
+
+ if (s->dcov)
+ {
+ // Loop through the bases and sum the qv for each component
+
+ int j;
+ for(j = 0; j < s->dcov; j++)
+ {
+ char a = toupper(s->bc[j]);
+ switch(a)
+ {
+ case 'A': qvMultA += s->qv[j]; break;
+ case 'C': qvMultC += s->qv[j]; break;
+ case 'G': qvMultG += s->qv[j]; break;
+ case 'T': qvMultT += s->qv[j]; break;
+ case '-':
+ // If the gap has a qv use that, otherwise use the default
+ qvMultGap += s->qv[j] ? s->qv[j] : GAP_QUALITY_VALUE;
+ break;
+
+ // default:
+ // fprintf(stderr, "Bad input=%c\n", a);
+ // Ambiguity codes cannot be processed
+ }
+ }
+ }
+ else
+ {
+ // An empty slice is a gap (by definition)
+ qvMultGap = GAP_QUALITY_VALUE_EMPTY_SLICE;
+ }
+
+
+ if (qvMultA) baseCount++;
+ if (qvMultC) baseCount++;
+ if (qvMultG) baseCount++;
+ if (qvMultT) baseCount++;
+ if (qvMultGap) baseCount++;
+
+ if (!dist) dist = &standardDistribution;
+
+#if USE_OLD_WAY
+ distributeQV(qvMultA,
+ &pr_A_A,
+ &pr_A_C, dist->freqC,
+ &pr_A_G, dist->freqG,
+ &pr_A_T, dist->freqT,
+ &pr_A_GAP, dist->freqGap);
+
+ distributeQV(qvMultC,
+ &pr_C_C,
+ &pr_C_A, dist->freqA,
+ &pr_C_G, dist->freqG,
+ &pr_C_T, dist->freqT,
+ &pr_C_GAP, dist->freqGap);
+
+ distributeQV(qvMultG,
+ &pr_G_G,
+ &pr_G_A, dist->freqA,
+ &pr_G_C, dist->freqC,
+ &pr_G_T, dist->freqT,
+ &pr_G_GAP, dist->freqGap);
+
+ distributeQV(qvMultT,
+ &pr_T_T,
+ &pr_T_A, dist->freqA,
+ &pr_T_C, dist->freqC,
+ &pr_T_G, dist->freqG,
+ &pr_T_GAP, dist->freqGap);
+
+ distributeQV(qvMultGap,
+ &pr_GAP_GAP,
+ &pr_GAP_A, dist->freqA,
+ &pr_GAP_C, dist->freqC,
+ &pr_GAP_G, dist->freqG,
+ &pr_GAP_T, dist->freqT);
+
+ // Calculate raw values
+ pA = pr_A_A * pr_C_A * pr_G_A * pr_T_A * pr_GAP_A;
+ pC = pr_A_C * pr_C_C * pr_G_C * pr_T_C * pr_GAP_C;
+ pG = pr_A_G * pr_C_G * pr_G_G * pr_T_G * pr_GAP_G;
+ pT = pr_A_T * pr_C_T * pr_G_T * pr_T_T * pr_GAP_T;
+ pGap = pr_A_GAP * pr_C_GAP * pr_G_GAP * pr_T_GAP * pr_GAP_GAP;
+
+ sum = pA + pC + pG + pT + pGap;
+
+
+ /*
+ fprintf(stderr,
+ "sum=%Lg, pA=%Lg, pC=%Lg, pG=%Lg, pT=%Lg, pGap=%Lg\n",
+ sum, pA, pC, pG, pT, pGap);
+ fprintf(stderr, " pr_A_A=%Lg pr_C_A=%Lg pr_G_A=%Lg pr_T_A=%Lg pr_GAP_A=%Lg\n",
+ pr_A_A, pr_C_A, pr_G_A, pr_T_A, pr_GAP_A);
+ fprintf(stderr, " pr_A_C=%Lg pr_C_C=%Lg pr_G_C=%Lg pr_T_C=%Lg pr_GAP_C=%Lg\n",
+ pr_A_C, pr_C_C, pr_G_C, pr_T_C, pr_GAP_C);
+ fprintf(stderr, " pr_A_G=%Lg pr_C_G=%Lg pr_G_G=%Lg pr_T_G=%Lg pr_GAP_G=%Lg\n",
+ pr_A_G, pr_C_G, pr_G_G, pr_T_G, pr_GAP_G);
+ fprintf(stderr, " pr_A_T=%Lg pr_C_T=%Lg pr_G_T=%Lg pr_T_T=%Lg pr_GAP_T=%Lg\n",
+ pr_A_T, pr_C_T, pr_G_T, pr_T_T, pr_GAP_T);
+ fprintf(stderr, " pr_A_GAP=%Lg pr_C_GAP=%Lg pr_G_GAP=%Lg pr_T_GAP=%Lg pr_GAP_GAP=%Lg\n",
+ pr_A_GAP, pr_C_GAP, pr_G_GAP, pr_T_GAP, pr_GAP_GAP);
+ */
+
+
+ // Normalize values and computer error probabilities
+ // Note: Error probability is the sum of the probability of the other bases
+
+ if (sum != 0.0)
+ {
+ cpA = (0.0 + pC + pG + pT + pGap) / sum;
+ cpC = (pA + 0.0 + pG + pT + pGap) / sum;
+ cpG = (pA + pC + 0.0 + pT + pGap) / sum;
+ cpT = (pA + pC + pG + 0.0 + pGap) / sum;
+ cpGap = (pA + pC + pG + pT + 0.0) / sum;
+ }
+ else
+ cpA = cpC = cpG = cpT = cpGap = 0.2; // old way on underflow
+
+ // Note: cpA + cpC + cpG + cpG + cpT + cpGap == 1
+ //**ALD This isn't true. It is true that pA + pC + pG + pT + pGap = 1
+
+ /*
+ fprintf(stderr,
+ "sum=%Le, cpA=%Le, cpC=%Le, cpG=%Le, cpT=%Le, cpGap=%Le\n",
+ sum, cpA, cpC, cpG, cpT, cpGap);
+ */
+
+
+ // Convert error probabilities into quality values
+ qvA = prToQV(cpA);
+ qvC = prToQV(cpC);
+ qvG = prToQV(cpG);
+ qvT = prToQV(cpT);
+ qvGap = prToQV(cpGap);
+
+ // The consensus quality value is the maximum of the quality
+ // values for each base. The base that has the lowest probability of
+ // error is the unambiguous consensus of the slice.
+
+ // Find the absolute winner
+ consensus = 'A'; cqv = qvA; cpConsensus = cpA;
+
+ // Allow a small margin to handle floating point weirdness
+ if ((cpC - cpConsensus) < -0.000000001)
+ {
+ consensus = 'C'; cqv = qvC; cpConsensus = cpC;
+ }
+
+ if ((cpG - cpConsensus) < -0.000000001)
+ {
+ consensus = 'G'; cqv = qvG; cpConsensus = cpG;
+ }
+
+ if ((cpT - cpConsensus) < -0.000000001)
+ {
+ consensus = 'T'; cqv = qvT; cpConsensus = cpT;
+ }
+
+ if ((cpGap-cpConsensus) < -0.000000001)
+ {
+ consensus = '-'; cqv=qvGap; cpConsensus = cpGap;
+ }
+
+ /*
+ fprintf(stderr, "cp: A %s -\n", (cpA==cpGap)?"==":"!=");
+ fprintf(stderr, "qv: A %s -\n", (qvA==qvGap)?"==":"!=");
+
+ fprintf(stderr, "%Lf\n", cpGap - cpA);
+ */
+
+ (result)->qvA = qvA;
+ (result)->qvC = qvC;
+ (result)->qvG = qvG;
+ (result)->qvT = qvT;
+ (result)->qvGap = qvGap;
+
+ (result)->cpA = cpA;
+ (result)->cpC = cpC;
+ (result)->cpG = cpG;
+ (result)->cpT = cpT;
+ (result)->cpGap = cpGap;
+
+#else // start new way
+ // Before sum could be zero because of underflow, in that case
+ // it set all cp's arbitrarily to 0.2 and the result was always a consensus
+ // base of A
+
+ const char * ALPHABET = "ACGT-";
+ double dist_a [5], dist_not [5], pos_log_pr [5], qv [5], pr [5], cp [5];
+ double min, dist_sum, ds, sum;
+ const double ln10x = log (10) / 10.0;
+ unsigned int iqv [5];
+ int i, j, cns_i;
+
+ // put dist values into an array to make it easier to manipulate them
+ dist_a [0] = dist -> freqA;
+ dist_a [1] = dist -> freqC;
+ dist_a [2] = dist -> freqG;
+ dist_a [3] = dist -> freqT;
+ dist_a [4] = dist -> freqGap;
+
+ // convert quality values to negative logs of probabilities
+ qv [0] = 0.10 * qvMultA;
+ qv [1] = 0.10 * qvMultC;
+ qv [2] = 0.10 * qvMultG;
+ qv [3] = 0.10 * qvMultT;
+ qv [4] = 0.10 * qvMultGap;
+
+ // set dist_not [i] to the sum of negative logs of frequencies of
+ // characters that are not i contributing the the probability of
+ // character i, i.e., the frequency/sum terms in distributeQV
+ dist_sum = 0.0;
+ for (i = 0; i < 5; i ++)
+ dist_sum += dist_a [i];
+ for (i = 0; i < 5; i ++)
+ {
+ ds = dist_sum - dist_a [i];
+
+ dist_not [i] = 0.0;
+ for (j = 0; j < 5; j ++)
+ if (i != j && qv [j] != 0.0)
+ dist_not [i] += - log10 (dist_a [j] / ds);
+ }
+
+ min = DBL_MAX; // used to scale the results
+ for (i = 0; i < 5; i ++)
+ {
+ if (qv [i] < 0.001)
+ pos_log_pr [i] = 0.0;
+ else if (300.0 < qv [i])
+ pos_log_pr [i] = 0.0;
+ else
+ pos_log_pr [i] = - log10 (1.0 - pow (0.1, qv [i]));
+ pos_log_pr [i] += - qv [i] + dist_not [i];
+ // the real value includes a term which is the sum of all the quality values
+ // except qv [i] but since that sum is the same for all terms it can be
+ // omitted since it will wash out in the scaling anyway
+
+ if (pos_log_pr [i] < min)
+ {
+ min = pos_log_pr [i];
+ cns_i = i; // the minimum neg log probability character is the consensus
+ }
+ }
+
+ sum = 0.0;
+ for (i = 0; i < 5; i ++)
+ {
+ pos_log_pr [i] -= min - 1; // -1 to guarantee that all values are positive
+ pr [i] = (300.0 < pos_log_pr [i] ? 0.0 : pow (10.0, - pos_log_pr [i]));
+ // convert back to probabilities from neg logs
+ sum += pr [i];
+ }
+ for (i = 0; i < 5; i ++)
+ pr [i] /= sum;
+
+ for (i = 0; i < 5; i ++)
+ {
+ cp [i] = 1.0 - pr [i];
+ iqv [i] = prToQV (cp [i]);
+ }
+
+ // The consensus quality value is the maximum of the quality
+ // values for each base. The base that has the lowest probability of
+ // error is the unambiguous consensus of the slice.
+
+ // The winner is cns_i
+ consensus = ALPHABET [cns_i];
+ cqv = iqv [cns_i];
+ cpConsensus = cp [cns_i];
+
+ (result)->qvA = iqv [0];
+ (result)->qvC = iqv [1];
+ (result)->qvG = iqv [2];
+ (result)->qvT = iqv [3];
+ (result)->qvGap = iqv [4];
+
+ cpA = (result)->cpA = cp [0];
+ cpC = (result)->cpC = cp [1];
+ cpG = (result)->cpG = cp [2];
+ cpT = (result)->cpT = cp [3];
+ cpGap = (result)->cpGap = cp [4];
+#endif
+
+ (result)->qvConsensus = cqv;
+
+ (result)->ambiguityFlags =
+ libSlice_calculateAmbiguityFlags(cpA, cpC, cpG, cpT, cpGap,
+ highQualityThreshold,
+ baseCount);
+
+ if (doAmbiguity)
+ {
+ consensus = libSlice_convertAmbiguityFlags((result)->ambiguityFlags);
+ }
+
+ (result)->consensus = consensus;
+
+ return retval;
+}
+
+//! Updates the ambiguity flags using the conic model and scoring matrix
+int libSlice_updateAmbiguityConic(const libSlice_Slice * s,
+ libSlice_Consensus * consensus,
+ int highQuality,
+ int scoringModel)
+{
+ int retval = 0;
+
+ if (highQuality == 0) { highQuality = HIGH_QUALITY_THRESHOLD; }
+
+ if (!s || !consensus)
+ {
+ retval = -1;
+ }
+ else if (s->dcov == 0)
+ {
+ if (m_recallEmpty)
+ {
+ // Zero Coverage, assign gap
+ consensus->ambiguityFlags |= AMBIGUITY_FLAGBIT_GAP;
+ }
+ }
+ else
+ {
+ int i;
+ char ambiguityFlags = consensus->ambiguityFlags;
+
+ unsigned int qvArr[5] = {0,0,0,0,0};
+ unsigned int countArr[5] = {0,0,0,0,0};
+ unsigned int hqCountArr[5] = {0,0,0,0,0};
+
+ unsigned int maxQV = 0;
+ unsigned int secondQV = -1;
+
+ unsigned int maxCount = 0;
+ unsigned int secondCount = -1;
+
+ int scoringThreshold = CONIC_SIMPLE_SCORING;
+ int base;
+
+ // Figure out base counts and sum quality values
+ for (i = 0; i < s->dcov; i++)
+ {
+ char a = toupper(s->bc[i]);
+ switch(a)
+ {
+ case 'A': base = 0; break;
+ case 'C': base = 1; break;
+ case 'G': base = 2; break;
+ case 'T': base = 3; break;
+ case '-': base = 4; break;
+
+ default:
+ // fprintf(stderr, "Bad input=%c\n", a);
+ // Ambiguity codes cannot be processed
+ base = -1;
+ };
+
+ if (base != -1)
+ {
+ // Use 20 for gap qv by default
+ qvArr[base] += ((base==4) && s->qv[i]==0) ? 20 : s->qv[i];
+
+ countArr[base]++;
+ if (s->qv[i] >= highQuality) { hqCountArr[base]++; }
+ }
+ }
+
+ // Find the two bases with the highest qv and top two highest counts
+ // Start at 1 by assuming 0 is max
+ for (i = 1; i < 5; i++)
+ {
+ if (qvArr[i] > qvArr[maxQV])
+ {
+ secondQV = maxQV;
+ maxQV = i;
+ }
+ else if (secondQV == -1 || qvArr[i] > qvArr[secondQV])
+ {
+ secondQV = i;
+ }
+
+ if (countArr[i] > countArr[maxQV])
+ {
+ secondCount = maxCount;
+ maxCount = i;
+ }
+ else if (secondCount == -1 || countArr[i] > countArr[secondQV])
+ {
+ secondCount = i;
+ }
+ }
+
+ // If the counts are within the scoring matrix, look up the threshold
+ if ((scoringModel < MAX_SCORING_MODEL) &&
+ (countArr[maxQV] < MAX_SCORING_COUNT) &&
+ (countArr[secondQV] < MAX_SCORING_COUNT))
+ {
+ scoringThreshold = scoringMatrix[scoringModel][0]
+ [countArr[maxQV]]
+ [countArr[secondQV]];
+ }
+
+ if (scoringThreshold == CONIC_SIMPLE_SCORING)
+ {
+ double ambiguityAngle = 36.8698977;
+ double effectiveAngle = ((ambiguityAngle / 2) <= 45)
+ ? ((double)ambiguityAngle)/2 : 45;
+
+ double lowerRadians = (M_PI/(double) 180) * (45.0 - effectiveAngle);
+ double upperRadians = (M_PI/(double) 180) * (45.0 + effectiveAngle);
+
+ double lowerlimit = tan(lowerRadians);
+ double upperlimit = tan(upperRadians);
+
+ int component = 0;
+
+ ambiguityFlags = 0;
+
+ for (component = 0; component < 5; component++)
+ {
+ // Initialize this to be effectively infinite in case qvArr[maxQV] == 0
+ // but set to be zero if qvArr[component] == 0
+ double tangent = (qvArr[maxQV]) ?
+ ((double) qvArr[component]) / qvArr[maxQV] :
+ qvArr[component] * 10000000.0;
+
+ // Everything is compared to the max, except itself
+ if (component == maxQV) { continue; }
+
+ /*
+ fprintf(stderr, "CSS: ll = %0.5f, uu=%0.5f, tan=%0.5f\n",
+ lowerlimit, upperlimit, tangent);
+
+ */
+
+ if (tangent < lowerlimit)
+ {
+ // Consensus in non-ambiguous for maxQV
+ // Normal case
+
+ ambiguityFlags |= (1 << maxQV);
+ }
+ else if (tangent < upperlimit)
+ {
+ // Consensus is ambiguous between maxQV and component
+ ambiguityFlags |= (1 << maxQV);
+ ambiguityFlags |= (1 << component);
+ }
+ else
+ {
+ // Consensus is non-ambiguous for component
+ // This should never be the case
+ ambiguityFlags |= (1 << component);
+ }
+ }
+ }
+ else if (scoringThreshold == CONIC_ALL_AMBIGUITY)
+ {
+ // Add as ambiguity if there is any qv at all
+ if (qvArr[maxQV]) { ambiguityFlags |= (1 << maxQV); }
+ if (qvArr[secondQV]) { ambiguityFlags |= (1 << secondQV); }
+ //fprintf(stderr, "CAA: All Ambiguity\n");
+ }
+ else if (scoringThreshold == CONIC_NO_ADJUSTMENT)
+ {
+ // Make no adjustment to the ambiguity code
+ /*
+ fprintf(stderr, "CNA: No adjustment c(max)=%d, c(second)=%d\n",
+ countArr[maxQV], countArr[secondQV]);
+ */
+ }
+ else
+ {
+ // Check if qvArr[secondQV] is within scoringThreshold order's
+ // of magnitute from qvArr[maxQV];
+
+ unsigned int difference = qvArr[maxQV] - qvArr[secondQV];
+ unsigned int ordersOfMagnitute = difference / 10;
+
+ /*
+ fprintf(stderr, "COOM: c=%d, q=%d, c=%d, q=%d oom=%d, threshold=%d\n",
+ countArr[maxQV], qvArr[maxQV],
+ countArr[secondQV], qvArr[secondQV],
+ ordersOfMagnitute, scoringThreshold);
+ */
+
+ if (abs(ordersOfMagnitute) <= scoringThreshold)
+ {
+ // It is ambiguous
+ ambiguityFlags |= (1 << maxQV);
+ ambiguityFlags |= (1 << secondQV);
+ }
+ else if (ordersOfMagnitute > 0)
+ {
+ // maxqv is non-ambiguous winner
+ ambiguityFlags |= (1 << maxQV);
+ }
+ else
+ {
+ // secondqv is non-ambiguous winner
+ ambiguityFlags |= (1 << secondQV);
+ }
+ }
+
+ // Set the new ambiguity flags
+ consensus->ambiguityFlags = ambiguityFlags;
+ }
+
+ return retval;
+}
+
+
+//! Updates the ambiguity flags to include all high quality reads
+/*! This is an addition step to support the Annotation UC. Annotation
+ * does not utilize the tiling, and only has the consensus available. By
+ * adding all high quality conflicts, the resultant consensus will represent
+ * all like bases for the slice.
+ *
+ * @param s input slice
+ * @param consensus libSlice_Consensus to update (only ambiguityFlags)
+ * @param highQuality Level to consider as high quality
+ * @retval 0 on sucess, consensus->ambiguityFlags updated.
+ */
+int libSlice_updateAmbiguity(const libSlice_Slice * s,
+ libSlice_Consensus * consensus,
+ int highQuality)
+{
+ int retval = 0;
+
+ if (!s || !consensus)
+ {
+ retval = -1;
+ }
+ else
+ {
+ char ambiguityFlags = 0;
+
+ // Get the original flags
+ int addA = ((consensus->ambiguityFlags & AMBIGUITY_FLAGBIT_A) != 0);
+ int addC = ((consensus->ambiguityFlags & AMBIGUITY_FLAGBIT_C) != 0);
+ int addG = ((consensus->ambiguityFlags & AMBIGUITY_FLAGBIT_G) != 0);
+ int addT = ((consensus->ambiguityFlags & AMBIGUITY_FLAGBIT_T) != 0);
+ int addGap = ((consensus->ambiguityFlags & AMBIGUITY_FLAGBIT_GAP) != 0);
+
+ int j;
+
+ if (highQuality == 0)
+ {
+ highQuality = HIGH_QUALITY_THRESHOLD;
+ }
+
+ // Add high quality conflicts
+ for(j = 0; j < s->dcov; j++)
+ {
+ char qv = (s->bc[j] == '-' && s->qv[j] == 0) ?
+ GAP_QUALITY_VALUE : s->qv[j];
+
+ if (qv >= highQuality)
+ {
+ char a = toupper(s->bc[j]);
+ switch(a)
+ {
+ case 'A': addA = 1; break;
+ case 'C': addC = 1; break;
+ case 'G': addG = 1; break;
+ case 'T': addT = 1; break;
+ case '-': addGap = 1; break;
+
+ // default:
+ // fprintf(stderr, "Bad input=%c\n", a);
+ // Ambiguity codes cannot be processed
+ }
+ }
+ }
+
+ if (addA) ambiguityFlags += AMBIGUITY_FLAGBIT_A;
+ if (addC) ambiguityFlags += AMBIGUITY_FLAGBIT_C;
+ if (addG) ambiguityFlags += AMBIGUITY_FLAGBIT_G;
+ if (addT) ambiguityFlags += AMBIGUITY_FLAGBIT_T;
+ if (addGap) ambiguityFlags += AMBIGUITY_FLAGBIT_GAP;
+
+ // Set the new ambiguity flags
+ consensus->ambiguityFlags = ambiguityFlags;
+ }
+
+ return retval;
+}
+
+//! Calculates the consensus of a slice with NO ambiguity codes
+/*!
+ * @param s Pointer to a slice.
+ * @param result Pointer for storing results.
+ * @param dist Table of distribution of the bases.
+ * @param highQualityThreshold Threshold for ambiguity codes.
+ * @return errorCode 0 on sucess.
+ *
+ * @see _getConsensus
+ */
+int libSlice_getConsensus(const libSlice_Slice *s,
+ libSlice_Consensus * result,
+ const libSlice_BaseDistribution * dist,
+ int highQualityThreshold)
+{
+ return libSlice_getConsensusParam(s, result, dist, highQualityThreshold, 0);
+}
+
+//! Calculates the consensus of a slice with ambiguity codes
+/*!
+ * @param s Pointer to a slice.
+ * @param result Pointer for storing results.
+ * @param dist Table of distribution of the bases.
+ * @param highQualityThreshold Threshold for ambiguity codes.
+ * @return errorCode 0 on sucess.
+ *
+ * @see _getConsensus
+ */
+int libSlice_getConsensusWithAmbiguity(const libSlice_Slice *s,
+ libSlice_Consensus * result,
+ const libSlice_BaseDistribution * dist,
+ int highQualityThreshold)
+{
+ return libSlice_getConsensusParam(s, result, dist, highQualityThreshold, 1);
+}
+
+//@}
+
+
+/*! @name SliceRange Calculations
+ * Functions for calculating the consensus and qv of a range of slices
+ */
+//@{
+
+//! Calculates the Consensus Quality Values for a range of slices
+/*!
+ * @param s Array of slices
+ * @param results Array of results
+ * @param len Length of slices (and results)
+ * @param dist Table of distribution of the bases
+ * @param highQualityThreshold Threshold for ambiguity codes.
+ * @param doAmbiguity Flag to calculate ambiguity codes
+ * @return errorCode, 0 on sucess
+ *
+ * @see _getConsensus
+ */
+int libSlice_getConsensusRangeParam(const libSlice_Slice s [],
+ libSlice_Consensus results [],
+ int len,
+ const libSlice_BaseDistribution * dist,
+ int highQualityThreshold,
+ int doAmbiguity)
+{
+ int retval = 0;
+ int i;
+
+ for(i = 0; i < len; i++)
+ {
+ retval += libSlice_getConsensusParam(&s[i], &results[i], dist,
+ highQualityThreshold, doAmbiguity);
+ }
+
+ return retval;
+}
+
+//! Calculates the consensus of an array of slice with no ambiguity codes
+/*!
+ * @param s Array of slices
+ * @param results Array of results
+ * @param len Length of slices (and results)
+ * @param dist Table of distribution of the bases
+ * @param highQualityThreshold Threshold for ambiguity codes.
+ * @return errorCode, 0 on sucess
+ *
+ * @see _getConsensusRange
+ */
+int libSlice_getConsensusRange(const libSlice_Slice s [],
+ libSlice_Consensus results [],
+ int len,
+ const libSlice_BaseDistribution * dist,
+ int highQualityThreshold)
+{
+ return libSlice_getConsensusRangeParam(s, results, len, dist,
+ highQualityThreshold, 0);
+}
+
+
+//! Calculates the consensus of an array of slice with ambiguity codes
+/*!
+ * @param s Array of slices
+ * @param results Array of results
+ * @param len Length of slices (and results)
+ * @param dist Table of distribution of the bases
+ * @param highQualityThreshold Threshold for ambiguity codes.
+ * @return errorCode, 0 on sucess
+ *
+ * @see _getConsensusRange
+ */
+int libSlice_getConsensusRangeWithAmbiguity(const libSlice_Slice s [],
+ libSlice_Consensus results [],
+ int len,
+ const libSlice_BaseDistribution * dist,
+ int highQualityThreshold)
+{
+ return libSlice_getConsensusRangeParam(s, results, len, dist,
+ highQualityThreshold, 1);
+}
+
+//@}
+
diff --git a/src/Slice/newmem.c b/src/Slice/newmem.c
new file mode 100644
index 0000000..27a9c3c
--- /dev/null
+++ b/src/Slice/newmem.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+/*! @file
+ * @brief newmem Implementation
+ * A slight modification of Paul Hardy's code from alnseq
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <math.h>
+#include <stdlib.h>
+
+#include "Slice.h"
+
+//! Error Checking malloc
+/*! Returns char * to a new block of memory, or prints an error if it couldnt
+ * malloc the memory.\n\n
+ *
+ * @param number Number of blocks to allocate
+ * @param size Size of each block to allocate
+ * @return Block of new memory number*size bytes big
+ * @exception Exits(-1) If it can't malloc memory
+ */
+void * libSlice_newmem(int number, int size)
+{
+ void *memp;
+
+ memp=malloc(number*size);
+ if (memp==NULL)
+ {
+ fprintf(stderr,"%s line %d: Memory Full! %d requested.\n",
+ __FILE__,__LINE__, number*size);
+ exit(-1);
+ }
+
+ return(memp);
+}
+
+
+//! Error checking malloc with explicit filename and linenumber
+/*!
+ * @param number Number of blocks to allocate
+ * @param size Size of each block to allocate
+ * @param file Filename of allocating call
+ * @param line Line number of allocating call
+ * @return Block of new memory number*size bytes big
+ * @exception Exits(-1) If it can't malloc memory
+ */
+
+void * libSlice_newmem2(int number, int size, char *file, int line)
+{
+ void *memp;
+
+ memp=malloc(number*size);
+ if (memp==NULL)
+ {
+ fprintf(stderr,"%s line %d: Memory Full! %d requested.\n",
+ file,line, number*size);
+ exit(-1);
+ }
+
+ return(memp);
+}
diff --git a/src/Slice/utility.c b/src/Slice/utility.c
new file mode 100644
index 0000000..8d3dd23
--- /dev/null
+++ b/src/Slice/utility.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+// $Id$
+
+/*! @file
+ * @brief Utility Functions on slices
+ */
+
+#include <ctype.h>
+#include "Slice.h"
+#include "version.h"
+#include "string.h" // for strncpy
+
+//! Get the compliment to a base or ambiguity code
+/*!
+ * @param base Ambiguity Code/Base to get compliment
+ * @return Compliment of the base (case is preserved)
+ */
+char libSlice_getCompliment(char base)
+{
+ char retval = base;
+ int islow = islower(base);
+
+ switch (toupper(base))
+ {
+ case 'A': retval = 'T'; break;
+ case 'T': retval = 'A'; break;
+ case 'C': retval = 'G'; break;
+ case 'G': retval = 'C'; break;
+
+ case 'M': retval = 'K'; break;
+ case 'R': retval = 'Y'; break;
+ case 'W': retval = 'W'; break;
+ case 'S': retval = 'S'; break;
+ case 'Y': retval = 'R'; break;
+ case 'K': retval = 'M'; break;
+
+ case 'V': retval = 'B'; break;
+ case 'H': retval = 'D'; break;
+ case 'D': retval = 'H'; break;
+ case 'B': retval = 'V'; break;
+
+ case 'N': retval = 'N'; break;
+ };
+
+ if (islow)
+ {
+ retval = tolower(retval);
+ }
+
+ return retval;
+}
+
+#include <stdio.h>
+
+//! Gets a string representing the version of the library
+/*! Creates a string like: "libSlice Version 1.01 (Build: 1.11)"
+ *
+ * Note: The value is a pointer to a static buffer, so the value
+ * should not be freed.
+ */
+const char * libSlice_getVersion()
+{
+ static char buffer[256];
+ memset(buffer, 0, sizeof(buffer));
+
+ strcpy(buffer, gVersionStr);
+ strcat(buffer, " (Build: ");
+ strcat(buffer, gRevisionStr+11);
+ buffer[strlen(buffer)-2] = ')';
+ buffer[strlen(buffer)-1] = 0;
+
+ return buffer;
+}
diff --git a/src/Slice/version.h b/src/Slice/version.h
new file mode 100644
index 0000000..fd4a495
--- /dev/null
+++ b/src/Slice/version.h
@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) 2003, The Institute for Genomic Research (TIGR). All
+ * rights reserved.
+ */
+
+/*
+ * This file is automagically updated by 'make update-version'
+ */
+
+static const char gVersionStr[] = "libSlice Version 1.10";
+static const char gRevisionStr[] = "$Revision$";
diff --git a/src/Staden/Makefile.am b/src/Staden/Makefile.am
new file mode 100644
index 0000000..cc92d0b
--- /dev/null
+++ b/src/Staden/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = \
+ read \
+ progs
+
+##-- END OF MAKEFILE --##
\ No newline at end of file
diff --git a/src/Staden/Makefile.in b/src/Staden/Makefile.in
new file mode 100644
index 0000000..fc18c12
--- /dev/null
+++ b/src/Staden/Makefile.in
@@ -0,0 +1,566 @@
+# 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 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@
+subdir = src/Staden
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUBDIRS = \
+ read \
+ progs
+
+all: all-recursive
+
+.SUFFIXES:
+$(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) --foreign src/Staden/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Staden/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):
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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: ctags-recursive $(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
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(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:
+
+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-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.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 ctags \
+ ctags-recursive distclean distclean-generic 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 \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
+ tags-recursive 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.
+.NOEXPORT:
diff --git a/src/Staden/progs/Makefile.am b/src/Staden/progs/Makefile.am
new file mode 100644
index 0000000..576b25c
--- /dev/null
+++ b/src/Staden/progs/Makefile.am
@@ -0,0 +1,39 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+bin_PROGRAMS = \
+ trace_comment \
+ trace_comments \
+ trace_convert \
+ trace_seq \
+ trace_scf_dump
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Staden/read
+
+trace_comment_LDADD = \
+ $(top_builddir)/src/Staden/read/libread.a
+trace_comment_SOURCES = \
+ trace_comment.c
+
+trace_comments_LDADD = \
+ $(top_builddir)/src/Staden/read/libread.a
+trace_comments_SOURCES = \
+ trace_comments.c
+
+trace_convert_LDADD = \
+ $(top_builddir)/src/Staden/read/libread.a
+trace_convert_SOURCES = \
+ trace_convert.c
+
+trace_seq_LDADD = \
+ $(top_builddir)/src/Staden/read/libread.a
+trace_seq_SOURCES = \
+ trace_seq.c
+
+trace_scf_dump_LDADD = \
+ $(top_builddir)/src/Staden/read/libread.a
+trace_scf_dump_SOURCES = \
+ trace_scf_dump.c
+
+##-- END OF MAKEFILE --##
diff --git a/src/Staden/progs/Makefile.in b/src/Staden/progs/Makefile.in
new file mode 100644
index 0000000..c7c8892
--- /dev/null
+++ b/src/Staden/progs/Makefile.in
@@ -0,0 +1,625 @@
+# 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 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@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = trace_comment$(EXEEXT) trace_comments$(EXEEXT) \
+ trace_convert$(EXEEXT) trace_seq$(EXEEXT) \
+ trace_scf_dump$(EXEEXT)
+subdir = src/Staden/progs
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_trace_comment_OBJECTS = trace_comment.$(OBJEXT)
+trace_comment_OBJECTS = $(am_trace_comment_OBJECTS)
+trace_comment_DEPENDENCIES = \
+ $(top_builddir)/src/Staden/read/libread.a
+am_trace_comments_OBJECTS = trace_comments.$(OBJEXT)
+trace_comments_OBJECTS = $(am_trace_comments_OBJECTS)
+trace_comments_DEPENDENCIES = \
+ $(top_builddir)/src/Staden/read/libread.a
+am_trace_convert_OBJECTS = trace_convert.$(OBJEXT)
+trace_convert_OBJECTS = $(am_trace_convert_OBJECTS)
+trace_convert_DEPENDENCIES = \
+ $(top_builddir)/src/Staden/read/libread.a
+am_trace_scf_dump_OBJECTS = trace_scf_dump.$(OBJEXT)
+trace_scf_dump_OBJECTS = $(am_trace_scf_dump_OBJECTS)
+trace_scf_dump_DEPENDENCIES = \
+ $(top_builddir)/src/Staden/read/libread.a
+am_trace_seq_OBJECTS = trace_seq.$(OBJEXT)
+trace_seq_OBJECTS = $(am_trace_seq_OBJECTS)
+trace_seq_DEPENDENCIES = $(top_builddir)/src/Staden/read/libread.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(trace_comment_SOURCES) $(trace_comments_SOURCES) \
+ $(trace_convert_SOURCES) $(trace_scf_dump_SOURCES) \
+ $(trace_seq_SOURCES)
+DIST_SOURCES = $(trace_comment_SOURCES) $(trace_comments_SOURCES) \
+ $(trace_convert_SOURCES) $(trace_scf_dump_SOURCES) \
+ $(trace_seq_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Staden/read
+
+trace_comment_LDADD = \
+ $(top_builddir)/src/Staden/read/libread.a
+
+trace_comment_SOURCES = \
+ trace_comment.c
+
+trace_comments_LDADD = \
+ $(top_builddir)/src/Staden/read/libread.a
+
+trace_comments_SOURCES = \
+ trace_comments.c
+
+trace_convert_LDADD = \
+ $(top_builddir)/src/Staden/read/libread.a
+
+trace_convert_SOURCES = \
+ trace_convert.c
+
+trace_seq_LDADD = \
+ $(top_builddir)/src/Staden/read/libread.a
+
+trace_seq_SOURCES = \
+ trace_seq.c
+
+trace_scf_dump_LDADD = \
+ $(top_builddir)/src/Staden/read/libread.a
+
+trace_scf_dump_SOURCES = \
+ trace_scf_dump.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Staden/progs/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Staden/progs/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):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+trace_comment$(EXEEXT): $(trace_comment_OBJECTS) $(trace_comment_DEPENDENCIES)
+ @rm -f trace_comment$(EXEEXT)
+ $(LINK) $(trace_comment_OBJECTS) $(trace_comment_LDADD) $(LIBS)
+trace_comments$(EXEEXT): $(trace_comments_OBJECTS) $(trace_comments_DEPENDENCIES)
+ @rm -f trace_comments$(EXEEXT)
+ $(LINK) $(trace_comments_OBJECTS) $(trace_comments_LDADD) $(LIBS)
+trace_convert$(EXEEXT): $(trace_convert_OBJECTS) $(trace_convert_DEPENDENCIES)
+ @rm -f trace_convert$(EXEEXT)
+ $(LINK) $(trace_convert_OBJECTS) $(trace_convert_LDADD) $(LIBS)
+trace_scf_dump$(EXEEXT): $(trace_scf_dump_OBJECTS) $(trace_scf_dump_DEPENDENCIES)
+ @rm -f trace_scf_dump$(EXEEXT)
+ $(LINK) $(trace_scf_dump_OBJECTS) $(trace_scf_dump_LDADD) $(LIBS)
+trace_seq$(EXEEXT): $(trace_seq_OBJECTS) $(trace_seq_DEPENDENCIES)
+ @rm -f trace_seq$(EXEEXT)
+ $(LINK) $(trace_seq_OBJECTS) $(trace_seq_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trace_comment.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trace_comments.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trace_convert.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trace_scf_dump.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trace_seq.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) '$<'`
+
+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 $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-binPROGRAMS clean-generic 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-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ 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-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Staden/progs/trace_comment.c b/src/Staden/progs/trace_comment.c
new file mode 100644
index 0000000..0b3b846
--- /dev/null
+++ b/src/Staden/progs/trace_comment.c
@@ -0,0 +1,151 @@
+/*
+ * Fetches all or several specific comment(s) from a trace file TEXT section.
+ *
+ * Usage:
+ * get_comment [options] [field ...] < infile
+ *
+ * Options:
+ * -c Suppresses display of field-ID
+ * -h Help
+ *
+ * Return codes:
+ * 0 Success
+ * 1 At least one field was not found
+ * 2 Failed to read file, or usage message displayed
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "Read.h"
+
+/* Nasty Microsoft bits */
+#ifdef _MSC_VER
+# define DLL_IMPORT __declspec(dllimport)
+#else
+# define DLL_IMPORT
+#endif
+
+extern DLL_IMPORT char *optarg;
+extern DLL_IMPORT int optind;
+
+void usage(void) {
+ puts("Usage:");
+ puts(" get_comment [options] [field ...] < infile");
+ puts("\nOptions:");
+ puts(" -c Suppresses display of field-ID");
+ puts(" -h Help");
+ puts("\nReturn codes:");
+ puts(" 0 Success");
+ puts(" 1 At least one field was not found");
+ puts(" 2 Failed to read file, or usage message displayed");
+ exit(2);
+}
+
+int main(int argc, char **argv) {
+ Read *r;
+ char *ident, *value;
+ int ident_len, value_len;
+ enum state_t {
+ NAME, EQUALS, VALUE, NL
+ } state;
+ size_t len;
+ int i, j, found;
+ int suppress = 0;
+ int *found_args = NULL;
+
+ /* Parse arguments */
+ for (argc--, argv++; argc > 0; argc--, argv++) {
+ if (**argv != '-')
+ break;
+
+ if (strcmp(*argv, "-c") == 0) {
+ suppress = 1;
+
+ } else {
+ usage();
+ }
+ }
+
+ /* Read the file */
+ read_sections(READ_COMMENTS);
+ if (NULL == (r = fread_reading(stdin, "(stdin)", TT_ANY))) {
+ fprintf(stderr, "failed to read trace from stdin\n");
+ return 2;
+ }
+
+ if (!r->info)
+ return 1;
+
+ if (argc == 0) {
+ /* Display all of them */
+ puts(r->info);
+
+ } else {
+ /* Display only the ones listed on the command line */
+
+ found_args = (int *)calloc(argc, sizeof(int));
+
+ len = strlen(r->info);
+ state = NAME;
+ ident = r->info;
+ found = 0;
+ for (i = 0; i <= len; i++) {
+ switch (state) {
+ case NAME:
+ if (r->info[i] == '=') {
+ state = EQUALS;
+ ident_len = &r->info[i] - ident;
+ value_len = 0;
+ }
+ break;
+
+ case EQUALS:
+ for (j = 0; j < argc; j++) {
+ if (strncmp(ident, argv[j], ident_len) == 0) {
+ found = 1;
+ found_args[j] = 1;
+ }
+ }
+ state = VALUE;
+ value = &r->info[i];
+
+ /* DELIBERATE FLOW THROUGH */
+
+ case VALUE:
+ if (r->info[i] == '\n' || r->info[i] == 0) {
+ value_len = &r->info[i] - value;
+ state = NL;
+ }
+ break;
+
+ case NL:
+ if (found) {
+ if (suppress) {
+ printf("%.*s\n",
+ value_len, value);
+ } else {
+ printf("%.*s=%.*s\n",
+ ident_len, ident, value_len, value);
+ }
+ }
+ state = NAME;
+ ident = &r->info[i];
+ found = 0;
+ break;
+ }
+ }
+ }
+
+ read_deallocate(r);
+
+ if (found_args) {
+ for (j = 0; j < argc; j++) {
+ if (found_args[j] == 0)
+ return 1;
+ }
+ }
+
+ return 0;
+}
diff --git a/src/Staden/progs/trace_comments.c b/src/Staden/progs/trace_comments.c
new file mode 100644
index 0000000..f6ba982
--- /dev/null
+++ b/src/Staden/progs/trace_comments.c
@@ -0,0 +1,173 @@
+/**************************************************************************
+ *
+ * get_comments
+ *
+ * Copyright (C) 2003 JCVSF Joint Technology Center
+ * All rights reserved.
+ *
+ * Fetches all comments from a set of trace files in a source directory.
+ * Writes output to standard out.
+ * Each field is written as:
+ * <filename>.<fieldname>=<fieldvalue>
+ *
+ * Usage:
+ * get_comments dir
+ *
+ * Options:
+ * -h Help
+ *
+ * Return codes:
+ * 0 Success
+ * 2 Failed to read file, or usage message displayed
+ **************************************************************************/
+
+static char filenamercsid[] = "$Id$";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+
+#include "Read.h"
+
+/* Nasty Microsoft bits */
+#ifdef _MSC_VER
+# define DLL_IMPORT __declspec(dllimport)
+#else
+# define DLL_IMPORT
+#endif
+
+extern DLL_IMPORT char *optarg;
+extern DLL_IMPORT int optind;
+
+void usage(void) {
+ puts("Usage:");
+ puts(" get_comment dir");
+ puts("\nOptions:");
+ puts(" -h Help");
+ puts("\nReturn codes:");
+ puts(" 0 Success");
+ puts(" 1 Failure to allocate memory");
+ puts(" 2 Failed to read file, or usage message displayed");
+ exit(2);
+}
+
+
+/* GetFileList
+ Creates an array of filenames from all of the files found in directory <path>
+*/
+int GetFileList(char ***FileList, char *path){
+ struct dirent *direntp;
+ char **filelist;
+ char *filename;
+ DIR *dp;
+ int num_files = 0;
+ int count = 0;
+ char *str;
+
+ dp = opendir(path);
+
+ // fprintf(stderr,"* GetFileLIst %s\n", path);
+ if(dp){
+ while((direntp = readdir(dp)) != NULL){
+ if(!strcmp(direntp->d_name,".") || !strcmp(direntp->d_name,".."))
+ continue;
+ num_files++;
+ }
+ rewinddir(dp);
+
+ (*FileList) = filelist = (char **)calloc(num_files, (size_t)(sizeof(char *)));
+ if(*FileList == (char **)NULL) return(1);
+
+ while((direntp = readdir(dp)) != NULL){
+ if(!strcmp(direntp->d_name,".") || !strcmp(direntp->d_name,".."))
+ continue;
+ filelist[count++] = filename = (char *)malloc(FILENAME_MAX);
+ if(!filename) return(1);
+ strcpy(filename, direntp->d_name);
+ }
+ }
+ // fprintf(stderr, "returning %d files\n", num_files);
+
+ return(num_files);
+}
+
+int main(int argc, char **argv) {
+ Read *r = NULL;
+ char *directory = NULL;
+ char *ident, *value;
+ int ident_len, value_len;
+ int i, j, found;
+ int *found_args = NULL;
+ char **FileList = NULL;
+ char trace_filename[FILENAME_MAX]="";
+ int num_traces, trace_iter, files_read = 0;
+ char *str;
+
+ if(argc != 2)
+ usage();
+
+ directory = argv[1];
+
+ // Get a list of all chromatogram files in the directory
+ num_traces = GetFileList(&FileList, directory);
+ if(num_traces == 0){
+ fprintf(stderr,"* Path %d yielded 0 files...exiting\n", num_traces);
+ exit(2);
+ }
+
+
+ /* step through all the sequences */
+ for (trace_iter = 0; trace_iter < num_traces; trace_iter++){
+
+ if(r){
+ read_deallocate(r);
+ }
+ //Get the file name from the iterator.
+ sprintf(trace_filename, "%s/%s",directory, FileList[trace_iter]);
+
+ /* Read the file */
+ read_sections(READ_COMMENTS);
+ if (NULL == (r = read_reading(trace_filename, TT_ANY))) {
+ continue; // don't worry about it
+ }
+ files_read++;
+
+ if (!r->info)
+ return 1;
+
+ for(str = strtok(r->info,"\n"); str != NULL; str = strtok(NULL,"\n")){
+ char *name;
+ char *value;
+ int items = 0;
+ char *start,*end;
+
+ name = str;
+ value = strchr(name,'=');
+ *value = '\0'; // skip over the '='
+ value++;
+
+ if(!strcmp(name,"RUND")){
+ start = value;
+ end = strstr(value," - ");
+ *end = '\0'; // terminate the start string
+ end += 3; // skip over the " - "
+ fprintf(stdout,"%s.RUND=start=%s,end=%s\n", FileList[trace_iter], start,end);
+ }else if(! strcmp(name,"DATE")){
+ start = value;
+ end = strstr(value," to ");
+ *end = '\0'; // terminate the start string
+ end += 4; // skip over the " to "
+ fprintf(stdout,"%s.DATE=start=%s,end=%s\n", FileList[trace_iter],start,end);
+ }else{
+ fprintf(stdout,"%s.%s=%s\n", FileList[trace_iter],name, value);
+ }
+
+ }
+
+ }
+ return (files_read == 0); // is zero, unless we read nothing.
+}
diff --git a/src/Staden/progs/trace_convert.c b/src/Staden/progs/trace_convert.c
new file mode 100644
index 0000000..71354cf
--- /dev/null
+++ b/src/Staden/progs/trace_convert.c
@@ -0,0 +1,613 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h> // SAK
+#include "Read.h"
+#include "traceType.h"
+#include "seqIOABI.h"
+
+static char fileIdentifier[] = "$Id$";
+
+struct opts {
+ char *name;
+ char *fofn;
+ char *passed;
+ char *failed;
+ char *error; // SAK
+ int in_format;
+ int out_format;
+ int scale;
+ int sub_background;
+ int normalise;
+ int compress_mode;
+ int dots;
+};
+
+/*
+ * Scales trace values from 0 to scale, but only if they are larger.
+ */
+void rescale_trace(Read *r, int scale) {
+ double s;
+ int i;
+
+ if (r->maxTraceVal <= scale)
+ return;
+
+ s = ((double)scale)/r->maxTraceVal;
+
+ for (i = 0; i < r->NPoints; i++) {
+ r->traceA[i] = r->traceA[i] * s + 0.5;
+ r->traceC[i] = r->traceC[i] * s + 0.5;
+ r->traceG[i] = r->traceG[i] * s + 0.5;
+ r->traceT[i] = r->traceT[i] * s + 0.5;
+ }
+
+ r->maxTraceVal = scale;
+}
+
+#if 0
+/* OLD method, treats all channels together and assumes the same baseline for
+ * each
+ */
+/*
+ * Here we just take the minimum trace value and subtract this from all others.
+ * The assumption is that the signal will always be 'base line' on at least
+ * one of the four channels.
+ */
+void subtract_background(Read *r) {
+ int i, min;
+ for (i = 0; i < r->NPoints; i++) {
+ min = 999999;
+ if (r->traceA[i] < min) min = r->traceA[i];
+ if (r->traceC[i] < min) min = r->traceC[i];
+ if (r->traceG[i] < min) min = r->traceG[i];
+ if (r->traceT[i] < min) min = r->traceT[i];
+ r->traceA[i] -= min;
+ r->traceC[i] -= min;
+ r->traceG[i] -= min;
+ r->traceT[i] -= min;
+ }
+}
+#endif
+
+static void subtract_background_ch(TRACE *channel, int nchannel) {
+ int i, j, bg;
+ int win_len = 501, win_len2 = win_len/2;
+ TRACE *copy;
+
+ if (NULL == (copy = (TRACE *)malloc(sizeof(*copy) * nchannel)))
+ return;
+
+ if (nchannel < win_len)
+ win_len = nchannel;
+
+ /* Take lowest background over win_len and subtract it */
+ for (i = 0; i < nchannel; i++) {
+ /* Could optimise this considerably */
+ bg = INT_MAX;
+ for (j = -win_len2; j < win_len2; j++) {
+ if (i+j < 0) continue;
+ if (i+j >= nchannel) break;
+
+ if (channel[i + j] < bg)
+ bg = channel[i + j];
+ }
+
+ copy[i] = channel[i] - bg;
+ }
+
+ memcpy(channel, copy, nchannel * sizeof(*copy));
+ free(copy);
+}
+
+/*
+ * Find the average background level of a trace, and subtract this from the
+ * peak heights.
+ */
+void subtract_background(Read *r) {
+ subtract_background_ch(r->traceA, r->NPoints);
+ subtract_background_ch(r->traceC, r->NPoints);
+ subtract_background_ch(r->traceG, r->NPoints);
+ subtract_background_ch(r->traceT, r->NPoints);
+}
+
+int int_compar(const void *a, const void *b) {
+ return *(const TRACE *)a - *(const TRACE *)b;
+}
+
+int find_bg(TRACE *data, int ndata) {
+ int i, bg;
+ TRACE *copy = (TRACE *)malloc(ndata * sizeof(TRACE));
+
+ /* Sort the trace samples by amplitude */
+ memcpy(copy, data, ndata * sizeof(TRACE));
+ qsort(copy, ndata, sizeof(TRACE), int_compar);
+
+ /* Find the first non-zero value */
+ for (i = 0; i < ndata && !copy[i]; i++)
+ ;
+
+ /*
+ * Now take a slie 0.05 through the remainder of the array and set this
+ * as our background.
+ */
+ bg = copy[(int)((ndata - i) * 0.05 + i)];
+
+ free(copy);
+ return bg;
+}
+
+void trace_freq(TRACE *data, int ndata) {
+ int i, bg;
+ bg = find_bg(data, ndata);
+
+#define MAX(a,b) ((a)>(b)?(a):(b))
+ for (i = 0; i < ndata; i++) {
+ data[i] = MAX(data[i] - bg, 0);
+ }
+}
+
+/*
+ * Separates out the dyes using a deconvolution matrix.
+ * The order of elements in the matrix is C A G T.
+ * A test matrix for the 373. Taken from the BASS distribution.
+ */
+double matrix[5][4] = {
+ 0.002439782, -0.0015053751, 0.00011857301, 2.8906948e-06,
+ -0.00075353298, 0.0032971052, -0.006198165, 0.00014828549,
+ 0.00020249287, -0.0017620348, 0.010530438, -0.0020235507,
+ -0.001144423, -4.857673e-06, -0.0018845701, 0.00395431,
+ -0.12451385, 0.368916, -2.928292, -3.3142638
+};
+void separate_dyes(Read *r, double M[][4]) {
+ int i, j;
+
+ for (i = 0; i < r->NPoints; i++) {
+ int C, A, G, T;
+ double sep[4];
+
+ C = r->traceC[i];
+ A = r->traceA[i];
+ G = r->traceG[i];
+ T = r->traceT[i];
+
+ for (j = 0; j < 4; j++)
+ sep[j] = C*M[0][j] + A*M[1][j] + G*M[2][j] + T*M[3][j] + M[4][j];
+
+ for (j = 0; j < 4; j++)
+ sep[j] += 10;
+
+ /* hack!
+ sep[0] += 0.1;
+ sep[1] += -0.4;
+ sep[2] += 2.9;
+ sep[3] += 3.2;
+ */
+
+ r->traceC[i] = sep[0] < 0 ? 0 : 1000 * sep[0];
+ r->traceA[i] = sep[1] < 0 ? 0 : 1000 * sep[1];
+ r->traceG[i] = sep[2] < 0 ? 0 : 1000 * sep[2];
+ r->traceT[i] = sep[3] < 0 ? 0 : 1000 * sep[3];
+ }
+}
+
+/*
+ * Find the maximum height of traces at the called bases. Use this to clip any
+ * other bases.
+ */
+void reset_max_called_height(Read *r) {
+ int i, max = 0;
+
+ /* Find max */
+ for (i=0; i < r->NBases; i++) {
+ switch(r->base[i]) {
+ case 'a':
+ case 'A':
+ if (r->traceA[r->basePos[i]] > max)
+ max = r->traceA[r->basePos[i]];
+ break;
+
+ case 'c':
+ case 'C':
+ if (r->traceC[r->basePos[i]] > max)
+ max = r->traceC[r->basePos[i]];
+ break;
+
+ case 'g':
+ case 'G':
+ if (r->traceG[r->basePos[i]] > max)
+ max = r->traceG[r->basePos[i]];
+ break;
+
+ case 't':
+ case 'T':
+ if (r->traceT[r->basePos[i]] > max)
+ max = r->traceT[r->basePos[i]];
+ break;
+ }
+ }
+
+ /* Clip to max */
+ for (i = 0; i < r->NPoints; i++) {
+ if (r->traceA[i] > max)
+ r->traceA[i] = max;
+ if (r->traceC[i] > max)
+ r->traceC[i] = max;
+ if (r->traceG[i] > max)
+ r->traceG[i] = max;
+ if (r->traceT[i] > max)
+ r->traceT[i] = max;
+ }
+ if (r->maxTraceVal > max)
+ r->maxTraceVal = max;
+}
+
+void rescale_heights(Read *r) {
+ int win_len = 1000;
+ int total = 0;
+ int max, max2;
+ int i, j, k, l;
+ double max_val = 0, rescale;
+ TRACE *tx[4];
+ int mtv;
+
+ tx[0] = r->traceA;
+ tx[1] = r->traceC;
+ tx[2] = r->traceG;
+ tx[3] = r->traceT;
+
+ if (r->NPoints < 2*win_len + 1)
+ return;
+
+ for (k = 0; k < 2; k++) {
+ max2 = win_len * r->maxTraceVal;
+
+ for (i = 0; i < win_len; i++) {
+ max = 0;
+ for (l = 0; l < 4; l++)
+ if (tx[l][i] > max) max = tx[l][i];
+ total += max;
+ }
+
+ for (j = 0; i < r->NPoints; i++, j++) {
+ max = 0;
+ for (l = 0; l < 4; l++)
+ if (tx[l][j] > max) max = tx[l][j];
+ total -= max;
+
+ max = 0;
+ for (l = 0; l < 4; l++)
+ if (tx[l][i] > max) max = tx[l][i];
+ total += max;
+
+ for (l = 0; l < 4; l++) {
+ if (k == 0) {
+ if (tx[l][j] * ((double)max2 / total) > max_val)
+ max_val = tx[l][j] * ((double)max2 / total);
+ } else {
+ tx[l][j] *= (double)max2 / total * rescale;
+ }
+ }
+ }
+
+ for (; j < r->NPoints; j++) {
+ for (l = 0; l < 4; l++) {
+ if (k == 0) {
+ if (tx[l][j] * ((double)max2 / total) > max_val)
+ max_val = tx[l][j] * ((double)max2 / total);
+ } else {
+ tx[l][j] *= (double)max2 / total * rescale;
+ }
+ }
+
+ }
+
+ if (max_val > 65535) {
+ rescale = 65535 / max_val;
+ mtv = 65535;
+ } else {
+ rescale = 1.0;
+ mtv = max_val;
+ }
+ }
+
+ r->maxTraceVal = mtv;
+}
+
+int convert(FILE *infp, FILE *outfp, char *infname, char *outfname,
+ struct opts *opts) {
+ Read *r;
+
+ if (NULL == (r = fread_reading(infp, infname, opts->in_format))) {
+ fprintf(stderr, "failed to read file %s\n", infname);
+ return 1;
+ }
+
+ if (opts->sub_background) {
+ /*
+ trace_freq(r->traceA, r->NPoints);
+ trace_freq(r->traceC, r->NPoints);
+ trace_freq(r->traceG, r->NPoints);
+ trace_freq(r->traceT, r->NPoints);
+ */
+ subtract_background(r);
+ /*
+ separate_dyes(r, matrix);
+ trace_freq(r->traceA, r->NPoints);
+ trace_freq(r->traceC, r->NPoints);
+ trace_freq(r->traceG, r->NPoints);
+ trace_freq(r->traceT, r->NPoints);
+ */
+ reset_max_called_height(r);
+ }
+
+ if (opts->normalise) {
+ rescale_heights(r);
+ }
+
+ if (opts->scale) {
+ rescale_trace(r, opts->scale);
+ }
+
+ if (opts->name)
+ r->ident = strdup(opts->name);
+ else if (0 == strcmp(outfname, "(stdout)"))
+ r->ident = strdup(infname);
+ else
+ r->ident = strdup(outfname);
+
+ if (opts->compress_mode != -1)
+ set_compression_method(opts->compress_mode);
+
+ if (0 != (fwrite_reading(outfp, r, opts->out_format))) {
+ fprintf(stderr, "failed to write file %s\n", outfname);
+ read_deallocate(r);
+ return 1;
+ }
+
+ read_deallocate(r);
+ return 0;
+}
+
+
+void usage(void) {
+ puts("Usage: convert_trace [options] [informat outformat] < in > out");
+ puts("Or convert_trace [options] -fofn file_of_filenames");
+ puts("\nOptions are:");
+ puts("\t-in_format format Format for input (defaults to any");
+ puts("\t-out_format format Format for output (default ztr)");
+ puts("\t-fofn file_of_filenames Get \"Input Output\" names from a fofn");
+ puts("\t-passed fofn Output fofn of passed names");
+ puts("\t-error errorfn Redirect stderr to file stderrfn (default is stderr)");
+ puts("\t-failed fofn Output fofn of failed names");
+ puts("\t-name id ID line for experiment file output");
+ puts("\t-subtract_background Subtracts the trace background");
+ puts("\t-normalise Normalises peak heights");
+ puts("\t-scale range Downscales peaks to 0-range");
+ puts("\t-compress mode Compress file output (not if stdout)");
+ puts("\t-abi_data counts ABI DATA lanes to copy: eg 9,10,11,12");
+ puts("\t-- Explicitly state end of options");
+ exit(1);
+}
+
+int main(int argc, char **argv) {
+ struct opts opts;
+
+ opts.in_format = TT_ANY;
+ opts.out_format = TT_ZTR;
+ opts.scale = 0;
+ opts.sub_background = 0;
+ opts.normalise = 0;
+ opts.name = NULL;
+ opts.compress_mode = -1;
+ opts.dots = 0;
+ opts.fofn = NULL;
+ opts.passed = NULL;
+ opts.failed = NULL;
+ opts.error = NULL;
+
+ for (argc--, argv++; argc > 0; argc--, argv++) {
+ if (**argv != '-')
+ break;
+
+ if (strcmp(*argv, "-scale") == 0) {
+ opts.scale = atoi(*++argv);
+ argc--;
+
+ } else if (strcmp(*argv, "-fofn") == 0) {
+ opts.fofn = *++argv;
+ argc--;
+
+ } else if (strcmp(*argv, "-passed") == 0) {
+ opts.passed = *++argv;
+ argc--;
+
+ } else if (strcmp(*argv, "-failed") == 0) {
+ opts.failed = *++argv;
+ argc--;
+
+ } else if (strcmp(*argv, "-error") == 0) {
+ opts.error = *++argv;
+ fprintf(stderr,"* Detected error argument %s\n", opts.error);
+ argc--;
+
+ } else if (strcmp(*argv, "-subtract_background") == 0) {
+ opts.sub_background = 1;
+
+ } else if (strcmp(*argv, "-normalise") == 0) {
+ opts.normalise = 1;
+
+ } else if (strcmp(*argv, "-dots") == 0) {
+ opts.dots = 1;
+
+ } else if (strcmp(*argv, "-in_format") == 0) {
+ argv++;
+ argc--;
+ if (TT_UNK == (opts.in_format = trace_type_str2int(*argv)))
+ opts.in_format = atoi(*argv);
+
+ } else if (strcmp(*argv, "-name") == 0) {
+ opts.name = *++argv;
+ argc--;
+
+ } else if (strcmp(*argv, "-out_format") == 0) {
+ argv++;
+ argc--;
+ if (TT_UNK == (opts.out_format = trace_type_str2int(*argv)))
+ opts.out_format = atoi(*argv);
+
+ } else if (strcasecmp(*argv, "-compress") == 0) {
+ opts.compress_mode = compress_str2int(*++argv);
+ argc--;
+
+ } else if (strcmp(*argv, "-abi_data") == 0) {
+ int c1, c2, c3, c4;
+ argc--;
+ if (4 == sscanf(*++argv, "%d,%d,%d,%d", &c1, &c2, &c3, &c4)) {
+ abi_set_data_counts(c1, c2, c3, c4);
+ } else {
+ usage();
+ }
+
+ } else if (strcmp(*argv, "--") == 0) {
+ break;
+
+ } else {
+ usage();
+ }
+ }
+
+ if (argc == 2) {
+ /* Old syntax, for backwards compatibility */
+
+ if (TT_UNK == (opts.in_format = trace_type_str2int(argv[0])))
+ opts.in_format = atoi(argv[0]);
+ if (TT_UNK == (opts.out_format = trace_type_str2int(argv[1])))
+ opts.out_format = atoi(argv[1]);
+ } else if (argc != 0) {
+ usage();
+ }
+
+
+ // Added by SAK: Allow redirection of error output to file, due to problems with Java exec
+ if( NULL != opts.error){
+ int fd;
+
+ fprintf(stderr,"* Redirecting stderr to %s\n", opts.error);
+
+ close(2); // close fd with stderr
+ fd = creat(opts.error, -1 );
+ if(fd == -1){
+ exit(-1);
+ }
+ }
+ if (!opts.fofn) {
+ return convert(stdin, stdout, "(stdin)", "(stdout)", &opts);
+ } else {
+ FILE *fpin, *fpout;
+ FILE *fppassed = NULL, *fpfailed = NULL;
+ char *infname, *outfname;
+ int ret, ret_all = 0;
+ char line[8192], line2[8192];
+
+ FILE *fofn_fp;
+
+ if (NULL == (fofn_fp = fopen(opts.fofn, "r"))) {
+ perror(opts.fofn);
+ return -1;
+ }
+
+ if (opts.passed && NULL == (fppassed = fopen(opts.passed, "w"))) {
+ perror(opts.passed);
+ return -1;
+ }
+
+ if (opts.failed && NULL == (fpfailed = fopen(opts.failed, "w"))) {
+ perror(opts.failed);
+ return -1;
+ }
+
+ while (fgets(line, 8192, fofn_fp) != NULL) {
+ int i, j, len;
+ time_t ret_time; // SAK
+ /* Find input and output name, escaping spaces as needed */
+ len = strlen(line);
+ outfname = NULL;
+ for (i = j = 0; i < len; i++) {
+ if (line[i] == '\\' && i != len-1) {
+ line2[j++] = line[++i];
+ } else if (line[i] == ' ') {
+ line2[j++] = 0;
+ outfname = &line2[j];
+ } else if (line[i] != '\n') {
+ line2[j++] = line[i];
+ }
+ }
+ line2[j] = 0;
+ infname = line2;
+
+ /* Open input and output files */
+ if (NULL == (fpin = fopen(infname, "rb"))) {
+ char buf[2048];
+ sprintf(buf, "ERROR %s", infname);
+ perror(buf);
+ if (opts.dots) {
+ fputc('!', stdout);
+ fflush(stdout);
+ }
+ if (fpfailed)
+ fprintf(fpfailed, "%s\n", infname);
+ continue;
+ }
+
+ if (outfname) {
+ if (NULL == (fpout = fopen(outfname, "wb+"))) {
+ char buf[2048];
+ sprintf(buf, "ERROR %s", outfname);
+ perror(buf);
+ fclose(fpin);
+ if (opts.dots) {
+ fputc('!', stdout);
+ fflush(stdout);
+ }
+ if (fpfailed)
+ fprintf(fpfailed, "%s\n", infname);
+ continue;
+ }
+ } else {
+ outfname = "(stdout)";
+ fpout = stdout;
+ }
+
+ /* Convert */
+ ret = convert(fpin, fpout, infname, outfname, &opts);
+ ret_time = time(NULL); // SAK
+ ret_all |= ret;
+ if (opts.dots) {
+ fputc(ret ? '!' : '.', stdout);
+ fflush(stdout);
+ }
+ if (ret) {
+ if (fpfailed)
+ fprintf(fpfailed, "%s %s", infname, ctime(&ret_time)); // SAK
+ } else {
+ if (fppassed)
+ fprintf(fppassed, "%s %s", infname, ctime(&ret_time)); // SAK
+ }
+
+ /* Tidy up */
+ fclose(fpin);
+ if (fpout != stdout)
+ fclose(fpout);
+ }
+
+ if(ret_all)
+ fprintf(stderr,"* ret_all = %d\n", ret_all);
+
+ fclose(fofn_fp);
+
+ return ret_all;
+ }
+
+ return 0;
+}
diff --git a/src/Staden/progs/trace_scf_dump.c b/src/Staden/progs/trace_scf_dump.c
new file mode 100644
index 0000000..ac534b2
--- /dev/null
+++ b/src/Staden/progs/trace_scf_dump.c
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#include <stdio.h>
+#include "scf.h"
+
+int main(int argc, char **argv) {
+ Scf *scf;
+ int i;
+
+ if (argc != 2) {
+ fprintf(stderr, "Usage: scf_dump scf_filename\n");
+ return 1;
+ }
+
+ scf = read_scf(argv[1]);
+
+ if (scf == NULL) {
+ fprintf(stderr, "read_scf failed\n");
+ return 1;
+ }
+
+ printf("[Header]\n");
+ printf("%d\t# magic_number\n", scf->header.magic_number);
+ printf("%d\t\t# samples\n", scf->header.samples);
+ printf("%d\t\t# samples_offset\n", scf->header.samples_offset);
+ printf("%d\t\t# bases\n", scf->header.bases);
+ printf("%d\t\t# bases_left_clip\n", scf->header.bases_left_clip);
+ printf("%d\t\t# bases_right_clip\n", scf->header.bases_right_clip);
+ printf("%d\t\t# bases_offset\n", scf->header.bases_offset);
+ printf("%d\t\t# comments_size\n", scf->header.comments_size);
+ printf("%d\t\t# comments_offset\n", scf->header.comments_offset);
+ printf("%.4s\t\t# version\n", scf->header.version);
+ printf("%d\t\t# sample_size\n", scf->header.sample_size);
+ printf("%d\t\t# code_set\n", scf->header.code_set);
+ printf("%d\t\t# private_size\n", scf->header.private_size);
+ printf("%d\t\t# private_offset\n", scf->header.private_offset);
+ printf("%d\t\t# spare[0]\n", scf->header.spare[0]);
+ printf("%d\t\t# spare[1]\n", scf->header.spare[1]);
+ printf("%d\t\t# spare[2]\n", scf->header.spare[2]);
+ printf("%d\t\t# spare[3]\n", scf->header.spare[3]);
+ printf("%d\t\t# spare[4]\n", scf->header.spare[4]);
+ printf("%d\t\t# spare[5]\n", scf->header.spare[5]);
+ printf("%d\t\t# spare[6]\n", scf->header.spare[6]);
+ printf("%d\t\t# spare[7]\n", scf->header.spare[7]);
+ printf("%d\t\t# spare[8]\n", scf->header.spare[8]);
+ printf("%d\t\t# spare[9]\n", scf->header.spare[9]);
+ printf("%d\t\t# spare[10]\n", scf->header.spare[10]);
+ printf("%d\t\t# spare[11]\n", scf->header.spare[11]);
+ printf("%d\t\t# spare[12]\n", scf->header.spare[12]);
+ printf("%d\t\t# spare[13]\n", scf->header.spare[13]);
+ printf("%d\t\t# spare[14]\n", scf->header.spare[14]);
+ printf("%d\t\t# spare[15]\n", scf->header.spare[15]);
+ printf("%d\t\t# spare[16]\n", scf->header.spare[16]);
+ printf("%d\t\t# spare[17]\n", scf->header.spare[17]);
+
+ puts("\n[Bases]");
+ for (i = 0; i < scf->header.bases; i++) {
+ printf("%c %05d %03d %03d %03d %03d %03d %03d %03d #%3d\n",
+ scf->bases[i].base,
+ scf->bases[i].peak_index,
+ scf->bases[i].prob_A,
+ scf->bases[i].prob_C,
+ scf->bases[i].prob_G,
+ scf->bases[i].prob_T,
+ scf->bases[i].spare[0],
+ scf->bases[i].spare[1],
+ scf->bases[i].spare[2],
+ i);
+ }
+
+ puts("\n[A_Trace]");
+ if (scf->header.sample_size == 1) {
+ for (i = 0; i < scf->header.samples; i++)
+ printf("%d\t#%5d\n", scf->samples.samples1[i].sample_A, i);
+ } else {
+ for (i = 0; i < scf->header.samples; i++)
+ printf("%d\t#%5d\n", scf->samples.samples2[i].sample_A, i);
+ }
+
+ puts("\n[C_Trace]");
+ if (scf->header.sample_size == 1) {
+ for (i = 0; i < scf->header.samples; i++)
+ printf("%d\t#%5d\n", scf->samples.samples1[i].sample_C, i);
+ } else {
+ for (i = 0; i < scf->header.samples; i++)
+ printf("%d\t#%5d\n", scf->samples.samples2[i].sample_C, i);
+ }
+
+ puts("\n[G_Trace]");
+ if (scf->header.sample_size == 1) {
+ for (i = 0; i < scf->header.samples; i++)
+ printf("%d\t#%5d\n", scf->samples.samples1[i].sample_G, i);
+ } else {
+ for (i = 0; i < scf->header.samples; i++)
+ printf("%d\t#%5d\n", scf->samples.samples2[i].sample_G, i);
+ }
+
+ puts("\n[T_Trace]");
+ if (scf->header.sample_size == 1) {
+ for (i = 0; i < scf->header.samples; i++)
+ printf("%d\t#%5d\n", scf->samples.samples1[i].sample_T, i);
+ } else {
+ for (i = 0; i < scf->header.samples; i++)
+ printf("%d\t#%5d\n", scf->samples.samples2[i].sample_T, i);
+ }
+
+ puts("\n[Comments]");
+ printf("%.*s\n", (int)scf->header.comments_size, scf->comments);
+
+ scf_deallocate(scf);
+
+ return 0;
+}
diff --git a/src/Staden/progs/trace_seq.c b/src/Staden/progs/trace_seq.c
new file mode 100644
index 0000000..9b6b054
--- /dev/null
+++ b/src/Staden/progs/trace_seq.c
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) Medical Research Council 1994-1999. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include "Read.h"
+#include "traceType.h"
+#include "expFileIO.h"
+#include "open_trace_file.h"
+
+extern char *optarg;
+extern int optind;
+
+#define LINE_LENGTH 60
+
+static int do_trans(FILE *infp, char *in_file, FILE *outfp, int format,
+ int good_only, int clip_cosmid, int fasta_out) {
+ Read *r;
+ char *tmp_base;
+
+ read_sections(READ_BASES);
+ if (NULL == (r = fread_reading(infp, in_file, format))) {
+ fprintf(stderr, "Failed to read file '%s'\n", in_file);
+ return 1;
+ }
+
+ tmp_base = r->base;
+
+#ifdef IOLIB_EXP
+ if (good_only && r->orig_trace_format == TT_EXP) {
+ int left=0, right=r->NBases + 1, val, lval, rval;
+ Exp_info *e = (Exp_info *)r->orig_trace;
+
+ if (0 == exp_get_int(e, EFLT_SL, &val))
+ if (val > left)
+ left = val;
+ if (0 == exp_get_int(e, EFLT_QL, &val))
+ if (val > left)
+ left = val;
+
+ if (0 == exp_get_int(e, EFLT_SR, &val))
+ if (val < right)
+ right = val;
+ if (0 == exp_get_int(e, EFLT_QR, &val))
+ if (val < right)
+ right = val;
+
+ /* This is horrid - see gap seqInfo.c file for explaination */
+ if (clip_cosmid) {
+ int got_cosmid;
+
+ if (0 == exp_get_rng(e, EFLT_CS, &lval, &rval)) {
+ got_cosmid = 1;
+ } else if (0 == exp_get_int(e, EFLT_CL, &lval) &&
+ 0 == exp_get_int(e, EFLT_CR, &rval)) {
+ got_cosmid = 1;
+ } else {
+ got_cosmid = 0;
+ }
+
+ if (got_cosmid) {
+ if (lval <= left && rval <= left) ;
+ else if (lval <= left+1 && rval < right) left = rval;
+ else if (lval <= left+1 && rval >= right) right = left+1;
+ else if (lval < right && rval < right) right = lval;
+ else if (lval < right && rval >= right) right = lval;
+ }
+ }
+
+ r->base += left;
+ r->NBases = right - left - 1;
+ } else
+#endif /* IOLIB_EXP */
+ if (good_only) {
+ r->base += r->leftCutoff;
+ r->NBases = r->rightCutoff - r->leftCutoff - 1;
+ }
+
+ if (fasta_out) {
+ char *p = strrchr(in_file, '/');
+ int i;
+
+ /* Add header */
+ if (NULL == p)
+ p = in_file;
+ else
+ p++;
+ fprintf(outfp, ">%s\n", p);
+
+ /* Replace - with N */
+ for (i = 0; i < r->NBases; i++) {
+ if (r->base[i] == '-')
+ r->base[i] = 'N';
+ }
+ }
+ fwrite_pln(outfp, r);
+
+ r->base = tmp_base;
+ read_deallocate(r);
+
+ return 0;
+}
+
+static void usage(void) {
+ fprintf(stderr, "Usage: extract_seq [-r] [-(abi|alf|scf|exp|pln)]\n"
+ " [-good_only] [-clip_cosmid] [-fasta_out]\n"
+ " [-output output_name] [input_name] ...\n");
+ exit(1);
+}
+
+int main(int argc, char **argv) {
+ int from_stdin = 1;
+ FILE *infp = stdin;
+ FILE *outfp = stdout;
+ int format = TT_ANY;
+ int redirect = 1;
+ int good_only = 0;
+ int clip_cosmid = 0;
+ int fasta_out = 0;
+ int ret = 0;
+
+ for (argc--, argv++; argc > 0; argc--, argv++) {
+ if (strcmp(*argv, "-r") == 0) {
+ redirect = 0;
+ } else if (strcasecmp(*argv, "-abi") == 0) {
+ format = TT_ABI;
+ } else if (strcasecmp(*argv, "-alf") == 0) {
+ format = TT_ALF;
+ } else if (strcasecmp(*argv, "-scf") == 0) {
+ format = TT_SCF;
+ } else if (strcasecmp(*argv, "-exp") == 0) {
+ format = TT_EXP;
+ } else if (strcasecmp(*argv, "-pln") == 0) {
+ format = TT_PLN;
+ } else if (strcasecmp(*argv, "-good_only") == 0) {
+ good_only = 1;
+ } else if (strcasecmp(*argv, "-clip_cosmid") == 0) {
+ clip_cosmid = 1;
+ } else if (strcasecmp(*argv, "-fasta_out") == 0) {
+ fasta_out = 1;
+ } else if (strcasecmp(*argv, "-output") == 0) {
+ if (NULL == (outfp = fopen(*++argv, "wb"))) {
+ perror(*argv);
+ return 1;
+ }
+ argc--;
+ } else if (**argv != '-') {
+ from_stdin = 0;
+ break;
+ } else {
+ usage();
+ }
+ }
+
+ read_experiment_redirect(redirect);
+
+ if (!from_stdin) {
+ for (;argc > 0; argc--, argv++) {
+ if (NULL == (infp = open_trace_file(*argv, NULL))) {
+ perror(*argv);
+ ret = 1;
+ } else {
+ ret |= do_trans(infp, *argv, outfp, format, good_only,
+ clip_cosmid, fasta_out);
+ fclose(infp);
+ }
+ }
+ } else {
+ ret = do_trans(infp, "<stdin>", outfp, format, good_only, clip_cosmid,
+ fasta_out);
+ }
+
+ return ret;
+}
+
diff --git a/src/Staden/read/Makefile.am b/src/Staden/read/Makefile.am
new file mode 100644
index 0000000..5f4b88b
--- /dev/null
+++ b/src/Staden/read/Makefile.am
@@ -0,0 +1,68 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+noinst_LIBRARIES = \
+ libread.a
+
+noinst_HEADERS = \
+ Read.h \
+ abi.h \
+ alf.h \
+ array.h \
+ calc_crc.h \
+ compress.h \
+ compression.h \
+ error.h \
+ expFileIO.h \
+ fpoint.h \
+ mach-io.h \
+ misc.h \
+ open_trace_file.h \
+ os.h \
+ plain.h \
+ scf.h \
+ scf_extras.h \
+ seqIOABI.h \
+ seqIOCTF.h \
+ tar_format.h \
+ traceType.h \
+ translate.h \
+ xalloc.h \
+ ztr.h
+
+libread_a_SOURCES = \
+ Read.c \
+ array.c \
+ compress.c \
+ ctfCompress.c \
+ error.c \
+ expFileIO.c \
+ files.c \
+ find.c \
+ fpoint.c \
+ mach-io.c \
+ misc_scf.c \
+ open_trace_file.c \
+ read_alloc.c \
+ read_scf.c \
+ scf_extras.c \
+ seqIOABI.c \
+ seqIOALF.c \
+ seqIOCTF.c \
+ seqIOPlain.c \
+ strings.c \
+ traceType.c \
+ translate.c \
+ write_scf.c \
+ xalloc.c
+
+if BUILD_LIBZ
+ libread_a_SOURCES += \
+ compression.c \
+ ztr.c \
+ ztr_translate.c
+endif
+
+
+
+##-- END OF MAKEFILE --##
\ No newline at end of file
diff --git a/src/Staden/read/Makefile.in b/src/Staden/read/Makefile.in
new file mode 100644
index 0000000..2cffe26
--- /dev/null
+++ b/src/Staden/read/Makefile.in
@@ -0,0 +1,601 @@
+# 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 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@
+DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+ at BUILD_LIBZ_TRUE@am__append_1 = \
+ at BUILD_LIBZ_TRUE@ compression.c \
+ at BUILD_LIBZ_TRUE@ ztr.c \
+ at BUILD_LIBZ_TRUE@ ztr_translate.c
+
+subdir = src/Staden/read
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libread_a_AR = $(AR) $(ARFLAGS)
+libread_a_LIBADD =
+am__libread_a_SOURCES_DIST = Read.c array.c compress.c ctfCompress.c \
+ error.c expFileIO.c files.c find.c fpoint.c mach-io.c \
+ misc_scf.c open_trace_file.c read_alloc.c read_scf.c \
+ scf_extras.c seqIOABI.c seqIOALF.c seqIOCTF.c seqIOPlain.c \
+ strings.c traceType.c translate.c write_scf.c xalloc.c \
+ compression.c ztr.c ztr_translate.c
+ at BUILD_LIBZ_TRUE@am__objects_1 = compression.$(OBJEXT) ztr.$(OBJEXT) \
+ at BUILD_LIBZ_TRUE@ ztr_translate.$(OBJEXT)
+am_libread_a_OBJECTS = Read.$(OBJEXT) array.$(OBJEXT) \
+ compress.$(OBJEXT) ctfCompress.$(OBJEXT) error.$(OBJEXT) \
+ expFileIO.$(OBJEXT) files.$(OBJEXT) find.$(OBJEXT) \
+ fpoint.$(OBJEXT) mach-io.$(OBJEXT) misc_scf.$(OBJEXT) \
+ open_trace_file.$(OBJEXT) read_alloc.$(OBJEXT) \
+ read_scf.$(OBJEXT) scf_extras.$(OBJEXT) seqIOABI.$(OBJEXT) \
+ seqIOALF.$(OBJEXT) seqIOCTF.$(OBJEXT) seqIOPlain.$(OBJEXT) \
+ strings.$(OBJEXT) traceType.$(OBJEXT) translate.$(OBJEXT) \
+ write_scf.$(OBJEXT) xalloc.$(OBJEXT) $(am__objects_1)
+libread_a_OBJECTS = $(am_libread_a_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libread_a_SOURCES)
+DIST_SOURCES = $(am__libread_a_SOURCES_DIST)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+noinst_LIBRARIES = \
+ libread.a
+
+noinst_HEADERS = \
+ Read.h \
+ abi.h \
+ alf.h \
+ array.h \
+ calc_crc.h \
+ compress.h \
+ compression.h \
+ error.h \
+ expFileIO.h \
+ fpoint.h \
+ mach-io.h \
+ misc.h \
+ open_trace_file.h \
+ os.h \
+ plain.h \
+ scf.h \
+ scf_extras.h \
+ seqIOABI.h \
+ seqIOCTF.h \
+ tar_format.h \
+ traceType.h \
+ translate.h \
+ xalloc.h \
+ ztr.h
+
+libread_a_SOURCES = Read.c array.c compress.c ctfCompress.c error.c \
+ expFileIO.c files.c find.c fpoint.c mach-io.c misc_scf.c \
+ open_trace_file.c read_alloc.c read_scf.c scf_extras.c \
+ seqIOABI.c seqIOALF.c seqIOCTF.c seqIOPlain.c strings.c \
+ traceType.c translate.c write_scf.c xalloc.c $(am__append_1)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Staden/read/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Staden/read/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)
+libread.a: $(libread_a_OBJECTS) $(libread_a_DEPENDENCIES)
+ -rm -f libread.a
+ $(libread_a_AR) libread.a $(libread_a_OBJECTS) $(libread_a_LIBADD)
+ $(RANLIB) libread.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Read.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/array.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/compress.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/compression.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ctfCompress.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/expFileIO.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/files.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/find.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fpoint.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mach-io.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/misc_scf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_trace_file.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/read_alloc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/read_scf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/scf_extras.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seqIOABI.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seqIOALF.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seqIOCTF.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seqIOPlain.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/strings.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/traceType.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/translate.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/write_scf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xalloc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ztr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ztr_translate.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) '$<'`
+
+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) $(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:
+ $(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:
+
+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-noinstLIBRARIES 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:
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES ctags distclean distclean-compile \
+ distclean-generic 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-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-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Staden/read/README b/src/Staden/read/README
new file mode 100644
index 0000000..679c4e7
--- /dev/null
+++ b/src/Staden/read/README
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+ The Read I/O library
+ ====================
+
+This library provides a programmatic interface to the Read structure. The Read
+structure is a standardised interface to the SCF, ABI, ALF, plain, and
+Experiment file formats. With Experiment files, the Read structure read is the
+one referenced by the LT and LN experiment lines. For the plain (PLN) format,
+most information will, obviously, be missing from the structure returned.
+
+The library is a superset of the SCF, ABI, ALF and EXP libraries, and hence
+only the read and io-utils libraries needs to be linked with.
+
+The following functions are provided:
+
+Read *read_read(char *fn, int format)
+int write_seq(char *fn, Read *read, int format)
+Read *read_allocate(int num_points, int num_bases)
+void read_deallocate(Read *read)
+Read *scf2read(Scf *scf)
+Scf *read2scf(Read *read)
+
+
+Usage
+-----
+
+The requirements for utilising this I/O library are:
+
+a) #include <Read.h>
+ You may need to adjust your include path to find this file using the -I
+ option to the compiler.
+
+b) Link with "-lread -lio-utils".
+ You may need to adjust your library path using the -L option to the
+ compiler. See the documents for the io-utils library too.
+
+Routines returning pointers return NULL for failure, or a valid pointer for
+success. Routines returning integer return 0 for success, and -1 for failure.
+
+
+A Detailed Description
+----------------------
+
+/*
+ * Read a sequence from a file "fn" of format "format". If "format" is 0
+ * (TT_ANY), we automatically determine the correct format. Otherwise format
+ * should be one of TT_SCF, TT_ABI, TT_ALF, TT_PLN or TT_EXP.
+ *
+ * Returns:
+ * Read * for success
+ * NULLRead for failure
+ */
+Read *read_read(char *fn, int format)
+
+
+/*
+ * Write a sequence to a file "fn" of format "format". If "format" is 0,
+ * we choose our favourite - SCF.
+ *
+ * Returns:
+ * 0 for success
+ * -1 for failure
+ */
+int write_seq(char *fn, Read *read, int format)
+
+
+/*
+ * Allocate a new sequence, with the given sizes.
+ * Returns:
+ * "Read *" for success
+ * "NULLRead" for failure
+ */
+Read *read_allocate(int num_points, int num_bases)
+
+
+/*
+ * Free memory allocated to a sequence by read_allocate().
+ */
+void read_deallocate(Read *read)
+
+
+/*
+ * Translates an Scf structure into a Read structure.
+ * The Scf structure is left unchanged.
+ *
+ * Returns:
+ * A pointer to an allocated Read structure upon success.
+ * NULLRead upon failure.
+ */
+Read *scf2read(Scf *scf)
+
+
+/*
+ * Translates a Read structure into a Scf structure.
+ * The Read structure is left unchanged.
+ *
+ * Returns:
+ * A pointer to an allocated Scf structure upon success.
+ * NULL upon failure.
+ */
+Scf *read2scf(Read *read)
diff --git a/src/Staden/read/Read.c b/src/Staden/read/Read.c
new file mode 100644
index 0000000..298307e
--- /dev/null
+++ b/src/Staden/read/Read.c
@@ -0,0 +1,472 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * File: Read.c
+ * Purpose: Performs read/write IO on the Read data stucture.
+ * Last update: 01/09/94
+ */
+
+
+/*
+ The Read data type is designed so that it can hold a varying degree
+ of information about sequences, yet have a single set of calls
+ to access the data.
+
+ There are plenty of assumptions around that both the number of
+ bases and the number of points will fit into an int_2, a short.
+
+*/
+
+/* ---- Includes ---- */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h> /* Only need on windows for _O_BINARY */
+
+#include "Read.h"
+
+#ifdef IOLIB_ABI
+# include "abi.h"
+#endif
+#ifdef IOLIB_SCF
+# include "scf.h"
+#endif
+#ifdef IOLIB_ALF
+# include "alf.h"
+#endif
+#ifdef IOLIB_PLN
+# include "plain.h"
+#endif
+#ifdef IOLIB_ZTR
+# include "ztr.h"
+#endif
+#ifdef IOLIB_CTF
+# include "seqIOCTF.h"
+#endif
+#ifdef IOLIB_EXP
+# include "expFileIO.h"
+#endif
+#ifdef USE_BIOLIMS
+# include "spBiolims.h"
+#endif
+
+#include "xalloc.h"
+#include "translate.h"
+#include "traceType.h"
+#include "misc.h"
+#include "open_trace_file.h"
+
+/*
+ * Read a sequence from a file "fnin" of format "format". If "format" is 0
+ * (ANY_FORMAT), we automatically determine the correct format.
+ * Returns:
+ * Read * for success
+ * NULLRead for failure
+ */
+Read *read_reading(char *fn, int format) {
+ Read *read;
+ FILE *fp;
+
+#ifdef USE_BIOLIMS
+ if( !strncmp(fn,BIOLIMS_TAG,strlen(BIOLIMS_TAG))){
+ return spReadBiolimsReading(fn);
+ }
+#endif
+
+ if (NULL == (fp = open_trace_file(fn, NULL))) {
+ errout("'%s': couldn't open\n", fn);
+ return NULL;
+ }
+
+ read = fread_reading(fp, fn, format);
+ fclose(fp);
+
+ return read;
+}
+
+/*
+ * Write a sequence to a file "fn" of format "format". If "format" is 0,
+ * we choose our favourite - SCF.
+ *
+ * Returns:
+ * 0 for success
+ * -1 for failure
+ */
+int write_reading(char *fn, Read *read, int format) {
+ Scf *scf;
+ int ret;
+
+ switch (format) {
+ default:
+ /* Defaults to SCF type */
+
+#ifdef IOLIB_SCF
+ case TT_SCF:
+ scf = read2scf(read);
+ ret = write_scf(scf, fn);
+ scf_deallocate(scf);
+ break;
+#endif
+
+#ifdef IOLIB_CTF
+ case TT_CTF: {
+ FILE *fp = fopen(fn, "wb");
+ if (!fp)
+ return -1;
+ ret = fwrite_ctf(fp, read);
+ fclose(fp);
+ break;
+ }
+#endif
+
+#ifdef IOLIB_ZTR
+ case TT_ZTR:
+ case TT_ZTR2: {
+ ztr_t *ztr;
+ FILE *fp = fopen(fn, "wb");
+ if (!fp)
+ return -1;
+ ztr = read2ztr(read);
+ compress_ztr(ztr, 2);
+ ret = fwrite_ztr(fp, ztr);
+ delete_ztr(ztr);
+ fclose(fp);
+ break;
+ }
+ case TT_ZTR1: {
+ ztr_t *ztr;
+ FILE *fp = fopen(fn, "wb");
+ if (!fp)
+ return -1;
+ ztr = read2ztr(read);
+ compress_ztr(ztr, 1);
+ ret = fwrite_ztr(fp, ztr);
+ delete_ztr(ztr);
+ fclose(fp);
+ break;
+ }
+ case TT_ZTR3: {
+ ztr_t *ztr;
+ FILE *fp = fopen(fn, "wb");
+ if (!fp)
+ return -1;
+ ztr = read2ztr(read);
+ compress_ztr(ztr, 3);
+ ret = fwrite_ztr(fp, ztr);
+ delete_ztr(ztr);
+ fclose(fp);
+ break;
+ }
+#endif
+
+#ifdef IOLIB_ABI
+ case TT_ABI:
+ ret = write_abi(fn, read);
+ break;
+#endif
+
+#ifdef IOLIB_ALF
+ case TT_ALF:
+ ret = write_alf(fn, read);
+ break;
+#endif
+
+#ifdef IOLIB_EXP
+ case TT_EXP: {
+ Exp_info *e = read2exp(read, fn);
+
+ if (NULL == e) {
+ fprintf(stderr, "Failed to create experiment file.\n");
+ return -1;
+ } else {
+ FILE *fp;
+
+ if (NULL == (fp = fopen(fn, "w"))) {
+ fprintf(stderr, "Couldn't open file '%s'\n", fn);
+ return -1;
+ }
+
+ exp_print_file(fp, e);
+ fclose(fp);
+ exp_destroy_info(e);
+
+ ret = 0;
+ }
+
+ break;
+ }
+#endif
+
+#ifdef IOLIB_PLN
+ case TT_PLN:
+ ret = write_pln(fn, read);
+ break;
+#endif
+ }
+
+ if (ret == 0)
+ compress_file(fn);
+
+ return ret;
+}
+
+/*
+ * Read a sequence from a FILE *fp of format "format". If "format" is 0
+ * (ANY_FORMAT), we automatically determine the correct format.
+ * We still pass a filename 'fn' although this isn't used other than for
+ * filling in the read->trace_name field.
+ *
+ * NB this function should NOT be used when Biolims support is required
+ * (as biolims readings are not stored in a file)
+ *
+ * Returns:
+ * Read * for success
+ * NULLRead for failure
+ */
+Read *fread_reading(FILE *fp, char *fn, int format) {
+ Read *read;
+ FILE *newfp;
+
+ if (!fn)
+ fn = "(unknown)";
+
+ newfp = freopen_compressed(fp, NULL);
+ if (newfp != fp) {
+ fp = newfp;
+ } else {
+ newfp = NULL;
+ }
+
+#ifdef _WIN32
+ /*
+ * jkb 16/05/00 comment below
+ *
+ * On windows "prog < file.abi" will work wrongly (compared to
+ * "prog file.abi") because windows is rather stupid. It treats ascii
+ * and binary streams differently, it considers stdin to be ascii unless
+ * told otherwise, and it can only be told otherwise by using non-ansi
+ * windows-specific function calls.
+ */
+ if (format != TT_EXP && format != TT_PLN)
+ _setmode(_fileno(fp), _O_BINARY);
+#endif
+
+ if (format == TT_ANY) {
+ format = fdetermine_trace_type(fp);
+ rewind(fp);
+ }
+
+ switch (format) {
+ case TT_UNK:
+ case TT_ERR:
+ errout("File '%s' has unknown trace type\n", fn);
+ read = NULLRead;
+ break;
+
+#ifdef IOLIB_SCF
+ case TT_SCF: {
+ Scf *scf;
+ scf = fread_scf(fp);
+
+ if (scf) {
+ read = scf2read(scf);
+ scf_deallocate(scf);
+ } else
+ read = NULLRead;
+
+ break;
+ }
+#endif
+
+#ifdef IOLIB_CTF
+ case TT_CTF:
+ read = fread_ctf(fp);
+ break;
+#endif
+
+#ifdef IOLIB_ZTR
+ case TT_ZTR:
+ case TT_ZTR1:
+ case TT_ZTR2:
+ case TT_ZTR3: {
+ ztr_t *ztr;
+
+ if ((ztr = fread_ztr(fp))) {
+ uncompress_ztr(ztr);
+ read = ztr2read(ztr);
+ delete_ztr(ztr);
+ } else {
+ read = NULLRead;
+ }
+ break;
+ }
+#endif
+
+#ifdef IOLIB_ABI
+ case TT_ABI:
+ read = fread_abi(fp);
+ break;
+#endif
+
+#ifdef IOLIB_ALF
+ case TT_ALF:
+ read = fread_alf(fp);
+ break;
+#endif
+
+#ifdef IOLIB_EXP
+ case TT_EXP: {
+ /* FIXME: we shouldn't redirect like this */
+ Exp_info *e = exp_fread_info(fp);
+
+ read = e ? exp2read(e,fn) : NULLRead;
+ break;
+ }
+#endif
+
+#ifdef IOLIB_PLN
+ case TT_PLN:
+ read = fread_pln(fp);
+ break;
+#endif
+
+ default:
+ errout("Unknown format %d specified to read_reading()\n", format);
+ read = NULLRead;
+ }
+
+ if (read != NULLRead && (read->trace_name = (char *)xmalloc(strlen(fn)+1)))
+ strcpy(read->trace_name, fn);
+
+ if (newfp) fclose(newfp);
+
+ return read;
+}
+
+/*
+ * Write a sequence to a FILE *fp of format "format". If "format" is 0,
+ * we choose our favourite - SCF.
+ *
+ * Returns:
+ * 0 for success
+ * -1 for failure
+ */
+int fwrite_reading(FILE *fp, Read *read, int format) {
+ int r = -1;
+
+#ifdef _WIN32
+ /*
+ * jkb 09/06/00 comment below
+ *
+ * On windows "prog > file.scf" will work wrongly (compared to
+ * "prog file.scf") because windows is rather stupid. It treats ascii
+ * and binary streams differently, it considers stdout to be ascii unless
+ * told otherwise, and it can only be told otherwise by using non-ansi
+ * windows-specific function calls.
+ */
+ if (format != TT_EXP && format != TT_PLN)
+ _setmode(_fileno(fp), _O_BINARY);
+#endif
+
+ switch (format) {
+ default:
+ /* Defaults to SCF type */
+
+#ifdef IOLIB_SCF
+ case TT_SCF: {
+ Scf *scf;
+ scf = read2scf(read);
+ r = fwrite_scf(scf, fp);
+ scf_deallocate(scf);
+ break;
+ }
+#endif
+
+#ifdef IOLIB_CTF
+ case TT_CTF:
+ r = fwrite_ctf(fp, read);
+ break;
+#endif
+
+#ifdef IOLIB_ZTR
+ case TT_ZTR:
+ case TT_ZTR2: {
+ ztr_t *ztr;
+ ztr = read2ztr(read);
+ compress_ztr(ztr, 2);
+ r = fwrite_ztr(fp, ztr);
+ delete_ztr(ztr);
+ break;
+ }
+ case TT_ZTR1: {
+ ztr_t *ztr;
+ ztr = read2ztr(read);
+ compress_ztr(ztr, 1);
+ r = fwrite_ztr(fp, ztr);
+ delete_ztr(ztr);
+ break;
+ }
+ case TT_ZTR3: {
+ ztr_t *ztr;
+ ztr = read2ztr(read);
+ compress_ztr(ztr, 3);
+ r = fwrite_ztr(fp, ztr);
+ delete_ztr(ztr);
+ break;
+ }
+#endif
+
+#ifdef IOLIB_ABI
+ case TT_ABI:
+ /*return fwrite_abi(fp, read); */
+ break;
+#endif
+
+#ifdef IOLIB_ALF
+ case TT_ALF:
+ /* return fwrite_alf(fp, read); */
+ break;
+#endif
+
+#ifdef IOLIB_EXP
+ case TT_EXP: {
+ Exp_info *e = read2exp(read, read->ident ? read->ident : "unknown");
+
+ if (NULL == e) {
+ fprintf(stderr, "Failed to create experiment file.\n");
+ r = -1;
+ } else {
+ exp_print_file(fp, e);
+ exp_destroy_info(e);
+ r = 0;
+ }
+ break;
+ }
+#endif
+
+#ifdef IOLIB_PLN
+ case TT_PLN:
+ r = fwrite_pln(fp, read);
+ break;
+#endif
+ }
+
+ if (r == 0) {
+ fcompress_file(fp);
+ }
+
+ return r;
+}
diff --git a/src/Staden/read/Read.h b/src/Staden/read/Read.h
new file mode 100644
index 0000000..de242bd
--- /dev/null
+++ b/src/Staden/read/Read.h
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _Read_h_
+#define _Read_h_
+
+/*
+ * Title: Read
+ *
+ * File: Read.h
+ * Purpose: Read data type
+ * Last update: June 14 1994
+ */
+
+/*
+ * This module encodes the `Read' sequence data structure.
+ *
+ * A `Read' contains information about bases and traces which are laid
+ * out along a single dimension of points. The number of points in a
+ * paricular sequence is given by `getNPoints', and these are numbered
+ * 0..getNPoints-1. At each point there are four trace readings, one
+ * for each base.
+ *
+ * The number of bases is `getNBases' which are numbered 0..N-1.
+ * Bases are represented by `char's. Every base is located at a
+ * particular point.
+ *
+ * The behaviour of these routines is undefined if given NULLRead or
+ * an undefined sequence.
+ */
+
+#include "os.h"
+#include "scf.h"
+
+#define IOLIB_ABI
+#define IOLIB_SCF
+#define IOLIB_ALF
+#define IOLIB_PLN
+#define IOLIB_CTF
+#define IOLIB_EXP
+
+/* Only add ZTR support if we've got ZLIB installed */
+#ifdef HAVE_LIBZ
+# define IOLIB_ZTR
+#endif
+
+/*
+ *-----------------------------------------------------------------------------
+ * Macros
+ *-----------------------------------------------------------------------------
+ */
+
+#define NULLRead ((Read *)NULL)
+
+/* Trace file formats */
+#define TT_ERR -1
+#define TT_UNK 0
+#define TT_SCF 1
+#define TT_ABI 2
+#define TT_ALF 3
+#define TT_PLN 4
+#define TT_EXP 5
+#define TT_CTF 6
+#define TT_ZTR 7
+#define TT_ZTR1 8
+#define TT_ZTR2 9
+#define TT_ZTR3 10
+#define TT_BIO 11
+#define TT_ANY TT_UNK
+
+#define READ_BASES (1<<0)
+#define READ_SAMPLES (1<<1)
+#define READ_COMMENTS (1<<2)
+#define READ_ALL (READ_BASES | READ_SAMPLES | READ_COMMENTS)
+
+/*
+ *-----------------------------------------------------------------------------
+ * Structures and typedefs
+ *-----------------------------------------------------------------------------
+ */
+
+typedef uint_2 TRACE; /* for trace heights */
+
+typedef struct
+{
+ int format; /* Trace file format */
+ char *trace_name; /* Trace file name */
+
+ int NPoints; /* No. of points of data */
+ int NBases; /* No. of bases */
+
+ /* Traces */
+ TRACE *traceA; /* Array of length `NPoints' */
+ TRACE *traceC; /* Array of length `NPoints' */
+ TRACE *traceG; /* Array of length `NPoints' */
+ TRACE *traceT; /* Array of length `NPoints' */
+ TRACE maxTraceVal; /* The maximal value in any trace */
+
+ /* Bases */
+ char *base; /* Array of length `NBases' */
+ uint_2 *basePos; /* Array of length `NBases' */
+
+ /* Cutoffs */
+ int leftCutoff; /* Number of unwanted bases */
+ int rightCutoff; /* First unwanted base at right end */
+
+ /* Miscellaneous Sequence Information */
+ char *info; /* misc seq info, eg comments */
+
+ /* Probability information */
+ char *prob_A; /* Array of length 'NBases' */
+ char *prob_C; /* Array of length 'NBases' */
+ char *prob_G; /* Array of length 'NBases' */
+ char *prob_T; /* Array of length 'NBases' */
+
+ /* The original input format data, or NULL if inapplicable */
+ int orig_trace_format;
+ void (*orig_trace_free)(void *ptr);
+ void *orig_trace;
+
+ char *ident; /* Seq id, NULL for unknown. Malloced data.
+ Owned and freed by io_lib. */
+} Read;
+
+
+/*
+ *-----------------------------------------------------------------------------
+ * Function prototypes
+ *-----------------------------------------------------------------------------
+ */
+
+
+/* ----- Main I/O routines ----- */
+
+/*
+ * Read a sequence from a file "fn" of format "format". If "format" is 0
+ * (TT_ANY), we automatically determine the correct format.
+ *
+ * Returns:
+ * Read * for success
+ * NULLRead for failure
+ */
+Read *read_reading(char *fn, int format);
+Read *fread_reading(FILE *fp, char *fn, int format);
+
+
+/*
+ * Write a sequence to a file "fn" of format "format". If "format" is 0,
+ * we choose our favourite - SCF.
+ *
+ * Returns:
+ * 0 for success
+ * -1 for failure
+ */
+int write_reading(char *fn, Read *read, int format);
+int fwrite_reading(FILE *fp, Read *read, int format);
+
+
+/* ----- Utility routines ----- */
+
+/*
+ * Allocate a new sequence, with the given sizes.
+ * Returns:
+ * "Read *" for success
+ * "NULLRead" for failure
+ */
+Read *read_allocate(int num_points, int num_bases);
+
+
+/*
+ * Free memory allocated to a sequence by read_allocate().
+ */
+void read_deallocate(Read *read);
+
+/*
+ * Duplicates the read structure and optionally gives it a new filename.
+ * The following fields are not duplicated:
+ *
+ * int orig_trace_format;
+ * void (*orig_trace_free)(void *ptr);
+ * void *orig_trace;
+ * char *ident;
+ *
+ * Returns:
+ * "Read *" for success
+ * "NULLRead" for failure
+ */
+Read* read_dup( Read* src, const char* new_name );
+
+/* unix specific file deletion routine */
+
+int remove_file(char *fn);
+
+Read *read_abi(char *fn);
+Read *fread_abi(FILE *fp);
+int write_abi(char *fn, Read *read);
+int fwrite_abi(FILE *fp, Read *read);
+
+int write_alf(char *fn, Read *read);
+int fwrite_alf(FILE *fp, Read *read);
+Read *read_alf(char *fn);
+Read *fread_alf(FILE *fp);
+
+int write_pln(char *fn, Read *read);
+int fwrite_pln(FILE *fp, Read *read);
+Read *read_pln(char *fn);
+Read *fread_pln(FILE *fp);
+
+Read *read_ctf(char *fn);
+Read *fread_ctf(FILE *fp);
+int write_ctf(char *fn, Read *read);
+int fwrite_ctf(FILE *fp, Read *read);
+
+int read_sections(int sec);
+
+#include "translate.h"
+#include "compress.h"
+
+#endif /* _Read_h_ */
diff --git a/src/Staden/read/abi.h b/src/Staden/read/abi.h
new file mode 100644
index 0000000..8808e3d
--- /dev/null
+++ b/src/Staden/read/abi.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _seqIOABI_h
+#define _seqIOABI_h
+
+
+/*
+ * Title: seqIOABI
+ *
+ * File: seqIOABI.h
+ *Purpose: IO of ABI sequences
+ * Last update: Mon May 28 1990
+ */
+
+
+
+
+/* ---- Imports ---- */
+
+
+#include "Read.h"
+
+
+/* ---- Exports ---- */
+
+
+/*
+ * Read the ABI format sequence with name `fn' into a Read structure.
+ * All printing characters (as defined by ANSII C `isprint')
+ * are accepted, but `N's are translated to `-'s. In this respect we
+ * are adhering (more or less) to the CSET_DEFAULT uncertainty code set.
+ *
+ * Returns:
+ * Read * - Success, the Read structure read.
+ * NULLRead - Failure.
+ */
+extern Read *read_abi(char *fn);
+extern Read *fread_abi(FILE *fp);
+
+#endif /*_seqIOABI_h*/
diff --git a/src/Staden/read/alf.h b/src/Staden/read/alf.h
new file mode 100644
index 0000000..cac45fe
--- /dev/null
+++ b/src/Staden/read/alf.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _seqIOALF_h
+#define _seqIOALF_h
+
+
+/*
+ * Title: seqIOALF
+ *
+ * File: seqIOALF.h
+ * Purpose: IO of ABI sequences
+ * Last update: Fri 9th September 1994
+ */
+
+
+
+
+/* ---- Imports ---- */
+
+
+#include "Read.h"
+
+
+/* ---- Exports ---- */
+
+
+/*
+ * Read the ALF format sequence with name `fn' into a Read structure.
+ * All printing characters (as defined by ANSII C `isprint')
+ * are accepted, but `N's are translated to `-'s.
+ *
+ * Returns:
+ * Read * - Success, the Read structure read.
+ * NULLRead - Failure.
+ */
+extern Read *read_alf(char *fn);
+extern Read *fread_alf(FILE *fp);
+
+#endif /*_seqIOALF_h*/
diff --git a/src/Staden/read/array.c b/src/Staden/read/array.c
new file mode 100644
index 0000000..eecfc8f
--- /dev/null
+++ b/src/Staden/read/array.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * File: array.c
+ * Version:
+ *
+ * Description:
+ *
+ * Created:
+ * Updated:
+ *
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <limits.h> /* IMPORT: INT_MAX */
+
+#include "array.h"
+#include "xalloc.h"
+
+
+/*
+ * For error reporting
+ */
+int ArrayError;
+
+
+char *ArrayErrorString(int err)
+{
+ switch(err) {
+ case ARRAY_NO_ERROR: return "No error";
+ case ARRAY_FULL: return "Array full";
+ case ARRAY_INVALID_ARGUMENTS: return "Invalid arguments";
+ case ARRAY_OUT_OF_MEMORY: return "Out of memory";
+ default: return "Unknown error";
+ }
+}
+
+
+
+Array ArrayCreate(size_t size, int dim)
+/*
+ * create a new array
+ */
+{
+ Array a;
+
+ if ( (a = (Array) xmalloc(sizeof(ArrayStruct)) ) == NULL ) {
+ ArrayError = ARRAY_OUT_OF_MEMORY;
+ } else {
+ a->size = size;
+ a->dim = dim?dim:1;
+ a->max = 0;
+ if ( (a->base = (void *)xmalloc(a->size * a->dim)) == NULL ) {
+ ArrayError = ARRAY_OUT_OF_MEMORY;
+ xfree(a);
+ a = NULL;
+ }
+ }
+
+ return a;
+
+}
+
+
+
+int ArrayExtend(Array a, int dim)
+/*
+ * extend array
+ */
+{
+ void *newbase;
+
+ if (a == NULL) return ArrayError = ARRAY_INVALID_ARGUMENTS;
+ if (dim < a->dim) return ArrayError = ARRAY_NO_ERROR;
+
+ while (dim >= a->dim) {
+ if (2 * a->dim >= INT_MAX)
+ return ArrayError = ARRAY_FULL;
+ else
+ a->dim *= 2;
+ }
+
+ if ( (newbase = (void *)xrealloc(a->base, a->size * a->dim)) == NULL )
+ return ArrayError = ARRAY_OUT_OF_MEMORY;
+ else
+ a->base = newbase;
+
+ return ArrayError = ARRAY_NO_ERROR;
+}
+
+
+
+
+void *ArrayRef(Array a, int i)
+{
+ if (a==NULL) {
+ ArrayError = ARRAY_INVALID_ARGUMENTS;
+ return NULL;
+ }
+
+ if (i >= a->max) {
+ if (i >= a->dim) {
+ if (ArrayExtend(a,i+1)) {
+ /* ArrayExtend sets ArrayError */
+ return NULL;
+ }
+ }
+ a->max = i+1;
+ }
+
+ return (void *) arrp(char,a,i*a->size);
+}
+
+
+
+int ArrayDestroy(Array a)
+/*
+ * destroy array
+ */
+{
+ if (a==NULL) return ArrayError = ARRAY_INVALID_ARGUMENTS;
+
+ if (a->base != NULL) xfree(a->base);
+ a->base= NULL;
+ xfree(a);
+
+ return ArrayError = ARRAY_NO_ERROR;
+
+
+}
+
+
diff --git a/src/Staden/read/array.h b/src/Staden/read/array.h
new file mode 100644
index 0000000..c0b5f08
--- /dev/null
+++ b/src/Staden/read/array.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * File: array.h
+ * Version:
+ *
+ * Description:
+ *
+ * Created:
+ * Updated:
+ *
+ */
+
+#ifndef _ARRAY_H_
+#define _ARRAY_H_
+
+/* 12/1/99 johnt - use stddef.h not sys/types.h for size_t */
+#include <stddef.h> /* IMPORT: size_t */
+
+typedef struct {
+ int size; /* element size */
+ int dim; /* allocated number of elements */
+ int max; /* elements accessed */
+ void *base; /* base address of array */
+} ArrayStruct, *Array;
+
+
+
+extern Array ArrayCreate(size_t size, int dim);
+
+extern int ArrayExtend(Array a, int dim);
+
+extern void *ArrayRef(Array a, int i);
+
+extern int ArrayDestroy(Array a);
+
+#define ArrayMax(a) ( (a)->max )
+
+#define ArrayBase(t,a) ( (t *)((a)->base) )
+
+/*
+#define arr(t,a,n) \
+ (*(t*)((a)->base + (a)->size*(n)))
+
+#define arrp(t,a,n) \
+ ((t*)((a)->base + (a)->size*(n)))
+*/
+
+
+
+
+#define arr(t,a,n) \
+ ((t*)((a)->base))[n]
+
+#define ARR(t,a,n) \
+ (*((t*)ArrayRef((a),(n))))
+
+#define arrp(t,a,n) \
+ &((t*)((a)->base))[n]
+#define ARRP(t,a,n) \
+ ((t*)ArrayRef(a,n))
+
+#define ARRAY_NO_ERROR 0
+#define ARRAY_FULL -1
+#define ARRAY_INVALID_ARGUMENTS -2
+#define ARRAY_OUT_OF_MEMORY -3
+
+extern int ArrayError;
+
+extern char *ArrayErrorString(int error);
+
+
+#endif /*_ARRAY_H_*/
diff --git a/src/Staden/read/calc_crc.h b/src/Staden/read/calc_crc.h
new file mode 100644
index 0000000..5f30202
--- /dev/null
+++ b/src/Staden/read/calc_crc.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _CALC_CRC_H_
+#define _CALC_CRC_H_
+
+uint4 calc_crc(char *data, int len);
+
+#endif /* _CALC_CRC_H_ */
diff --git a/src/Staden/read/compress.c b/src/Staden/read/compress.c
new file mode 100644
index 0000000..f335520
--- /dev/null
+++ b/src/Staden/read/compress.c
@@ -0,0 +1,620 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * Handles compression and decompression.
+ * Two functions are available. One compresses files, and the other opens
+ * (read only) a compressed file and returns a FILE pointer.
+ * Neither of these two are likely to work under Windows or MacOS.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "os.h" /* for ftruncate() under WINNT */
+
+#include "compress.h"
+
+/* SGIs do not define tempnam unless we also define _XOPEN4 && _NO_ANSIMODE */
+extern char *tempnam(const char *, const char *);
+
+#ifdef USE_CORBA
+#include "stcorba.h"
+#endif
+
+#ifdef HAVE_LIBZ
+#include "zlib.h"
+#endif
+
+#ifndef MAC
+#define BS 8192
+
+/*
+ * This contains the last used compression method.
+ */
+static int compression_used = 0;
+
+typedef struct {
+ unsigned char magic[3];
+ long int offset;
+ char *compress;
+ char *uncompress;
+ char *extension;
+} Magics;
+
+/*
+ * The list of magic numbers. The attempted order for compression is the
+ * order of entries in this file.
+ *
+ * NB: bzip gives very good (better than gzip) results, is sometimes faster for
+ * compression, but unfortunately much slower (4x?) for decompression. Most
+ * people won't have it anyway.
+ *
+ * szip is definitely the best in compression ratios, and is faster than bzip.
+ * However it's still slower than gzip. For comparable ratios, but much faster,
+ * see the ztr format.
+ *
+ * ">progname" implies that the program outputs the compressed data to stdout
+ * instead of renaming the input file to input.compressed_extension.
+ */
+static Magics magics[] = {
+ {{'B', 'Z', '0'}, 0, "bzip", "bzip -d <", ".bz"},
+ {{'\037','\213', '\0'}, 0, "gzip", "gzip -d <", ".gz"},
+ {{'\037','\235', '\0'}, 0, "compress", "uncompress <",".Z"},
+ {{'\037','\036', '\0'}, 0, "pack", "pcat", ".z"},
+ {{'B', 'Z', 'h'}, 0, "bzip2", "bzip2 -d <", ".bz2"},
+ {{'S', 'Z', '\n'}, 0, ">szip", "szip -d <", ".sz"},
+};
+
+void set_compression_method(int method) {
+ compression_used = method;
+}
+
+int get_compression_method(void) {
+ return compression_used;
+}
+
+/*
+ * Converts compress mode strings (eg "gzip") to numbers.
+ */
+int compress_str2int(char *mode) {
+ if (strcmp(mode, "bzip") == 0)
+ return COMP_METHOD_BZIP;
+ else if (strcmp(mode, "bzip2") == 0)
+ return COMP_METHOD_BZIP2;
+ else if (strcmp(mode, "gzip") == 0)
+ return COMP_METHOD_GZIP;
+ else if (strcmp(mode, "compress") == 0)
+ return COMP_METHOD_COMPRESS;
+ else if (strcmp(mode, "pack") == 0)
+ return COMP_METHOD_PACK;
+ else if (strcmp(mode, "szip") == 0)
+ return COMP_METHOD_SZIP;
+ else return 0;
+}
+
+/*
+ * Converts compress mode strings (eg "gzip") to numbers.
+ */
+char *compress_int2str(int mode) {
+ switch (mode) {
+ case COMP_METHOD_BZIP: return "bzip";
+ case COMP_METHOD_GZIP: return "gzip";
+ case COMP_METHOD_BZIP2: return "bzip2";
+ case COMP_METHOD_COMPRESS: return "compress";
+ case COMP_METHOD_PACK: return "pack";
+ case COMP_METHOD_SZIP: return "szip";
+ }
+ return "none";
+}
+
+/*
+ * Compress a file using the method set in the compression_used value
+ * (set by set_compression_method and fopen_compressed).
+ *
+ * If compression succeeds, we rename the file back its original name.
+ *
+ * When compression_used is 0 no compression is done.
+ */
+int compress_file(char *file) {
+ int ret;
+ char buf[2048];
+ struct stat statbuf;
+
+ /* Do nothing unless requested */
+ if (compression_used == 0)
+ return 0;
+
+#ifdef HAVE_LIBZ
+ /*
+ * If zlib is used then we use it to implement gzip internally, thus
+ * saving starting up a separate process. This is substantially faster.
+ */
+ if (compression_used == 2) {
+ FILE *fp;
+ gzFile gzfp;
+ int len;
+ char data[8192];
+
+ if (NULL == (fp = fopen(file, "rb+"))) {
+ return 1;
+ }
+
+ sprintf(buf, "%s%s", file, magics[compression_used-1].extension);
+ /* fprintf(stderr, "Using Zlib to %s %s to %s\n",magics[compression_used-1].compress, file, buf); */
+ if (NULL == (gzfp = gzopen(buf, "wb+"))) {
+ fprintf(stderr, "error gzopen'ing %s\n", buf);
+ fclose(fp);
+ remove(buf);
+ return 1;
+ }
+
+ while ((len = fread(data, 1, 8192, fp)) > 0) {
+ gzwrite(gzfp, data, len);
+ }
+
+ fclose(fp);
+ gzclose(gzfp);
+
+ /*fprintf(stderr, "%s'ed %s\n", magics[compression_used-1].compress, file);*/
+ /* need to unlink the original file so the compressed file is renamed */
+ unlink(file);
+ } else {
+#endif
+
+ /* Execute the compression program */
+#ifdef _WIN32
+ /*
+ * 15/2/99 johnt - don't have /dev/null on windows NT,
+ * can't multi redirect on Win95
+ */
+ if (magics[compression_used-1].compress[0] == '>')
+ sprintf(buf, "%s %s > %s%s",
+ magics[compression_used-1].compress+1, file,
+ file, magics[compression_used-1].extension);
+ else
+ sprintf(buf, "%s %s >nul",
+ magics[compression_used-1].compress, file);
+#else
+ if (magics[compression_used-1].compress[0] == '>')
+ sprintf(buf, "%s %s 1>%s%s 2>/dev/null",
+ magics[compression_used-1].compress+1, file,
+ file, magics[compression_used-1].extension);
+ else
+ sprintf(buf, "%s %s 1>/dev/null 2>/dev/null",
+ magics[compression_used-1].compress, file);
+#endif
+
+ if ((ret = system(buf)) != 0) {
+ if (ret == -1)
+ perror(buf);
+ else
+ fprintf(stderr, "%s: compression failed\n", file);
+ return 1;
+ }
+
+#ifdef HAVE_LIBZ
+ }
+#endif
+
+ if (magics[compression_used-1].compress[0] == '>') {
+ unlink(file);
+ }
+
+ /* Rename the file back */
+ if (-1 == stat(file, &statbuf) && errno == ENOENT) {
+ sprintf(buf, "%s%s", file, magics[compression_used-1].extension);
+ rename(buf, file);
+ }
+
+ return 0;
+}
+
+/*
+ * Compress a file using the method set in the compression_used value
+ * (set by set_compression_method and fopen_compressed).
+ *
+ * If compression succeeds, we rename the file back its original name.
+ *
+ * When compression_used is 0 no compression is done.
+ */
+int fcompress_file(FILE *fp) {
+ char buf[BS];
+ char *fname;
+ FILE *newfp;
+ int len;
+
+ /* Do nothing unless requested */
+ if (compression_used == 0)
+ return 0;
+
+ /* It's also impossible if it's stdout as we can't rewind */
+ if (fp == stdout)
+ return 0;
+
+ /* Copy the file pointer to a temporary file */
+ /* Use tempnam() to force the use of TMP environment variable on Windows */
+ if (NULL == (fname=tempnam(NULL, NULL)))
+ return 0;
+ if (NULL == (newfp = fopen(fname, "wb+"))){
+ remove(fname);
+ free(fname);
+ return 0;
+ }
+ fflush(fp);
+ rewind(fp);
+ do {
+ len = fread(buf, 1, BS, fp);
+ if (len > 0)
+ fwrite(buf, 1, len, newfp);
+ } while (!feof(fp));
+ fflush(newfp);
+ fclose(newfp);
+
+ /* Compress it */
+ if (compress_file(fname)) {
+ remove(fname);
+ free(fname);
+ return 0;
+ }
+
+ /* Copy it back */
+ if (NULL == (newfp = fopen(fname, "rb"))){
+ remove(fname);
+ free(fname);
+ return 0;
+ }
+
+ rewind(fp);
+ do {
+ int len = fread(buf, 1, BS, newfp);
+ if (len > 0)
+ fwrite(buf, 1, len, fp);
+ } while (!feof(newfp));
+ ftruncate(fileno(fp), ftell(fp));
+
+ remove(fname);
+ free(fname);
+ fclose(newfp);
+
+ return 0;
+}
+
+
+/*
+ * Returns a file pointer of an uncompressed copy of 'file'.
+ * 'file' need not exist if 'file'.ext (eg file.gz)
+ * exists and can be uncompressed.
+ *
+ * If ofp is non NULL then the original file pointer will also be returned
+ * (opened for update) to allow writing back to the original file. In cases
+ * of uncompressed data this is the same as the returned file pointer.
+ */
+FILE *fopen_compressed(char *file, FILE **ofp) {
+#ifdef USE_CORBA
+ int corba = 0;
+#endif
+ int num_magics = sizeof(magics) / sizeof(*magics);
+ int i, ret, fd, tryit, do_del = 1;
+ char buf[2048], fext[1024];
+ unsigned char mg[3];
+ char *fname, *fptr;
+ FILE *fp;
+
+ if (NULL == (fname = tempnam(NULL, NULL)))
+ return NULL;
+
+ /*
+ * Try opening the file and reading the magic number.
+ * If this doesn't work, then don't worry - the filename may be
+ * the original name which has been renamed due to compression.
+ * (eg file.gz).
+ */
+/* 24/03/98 johnt - added corba support */
+#ifdef USE_CORBA
+ if (! strncmp(CORBATAG,file,strlen(CORBATAG)) ){
+ tryit=0;
+ corba = 1;
+ fd=corba_open(file+strlen(CORBATAG),&fptr);
+
+ if (fd != -1) {
+ if (3 != read(fd, mg, 3)){
+ remove(fname);
+ free(fname);
+ close(fd);
+ return NULL;
+ }
+ }
+ else{
+ return NULL;
+ }
+ } else {
+#endif
+ tryit = 1;
+ fd = open(file, O_RDONLY);
+
+ if (fd != -1) {
+ if (3 != read(fd, mg, 3)) {
+ close(fd);
+ } else {
+ tryit = 0;
+ fptr = file;
+ }
+ }
+#ifdef USE_CORBA
+ }
+#endif
+ for (i = 0; i < num_magics; i++) {
+ /* If necessary, try opening the file as 'file'.extension */
+ if (tryit) {
+ sprintf(fext, "%s%s", file, magics[i].extension);
+ fptr = fext;
+ if (-1 == (fd = open(fext, O_RDONLY)))
+ continue;
+
+ if (3 != read(fd, mg, 3)) {
+ close(fd);
+ continue;
+ }
+ }
+
+ /* Check the magic numbers */
+ if (mg[0] == magics[i].magic[0] && mg[1] == magics[i].magic[1] &&
+ (magics[i].magic[2] ? (mg[2] == magics[i].magic[2]) : 1)) {
+
+#ifdef HAVE_LIBZ
+ if (i == 1) {
+ int len;
+ char data[8192];
+ gzFile gzfp;
+ /*fprintf(stderr, "Using Zlib to %s %s\n",magics[i].uncompress, fptr); */
+ lseek(fd, 0, 0 /* SEEK_CURR */);
+ if (NULL == (gzfp = gzdopen(fd, "rb"))) {
+ close(fd);
+ return NULL;
+ }
+ gzrewind(gzfp);
+
+ if (NULL == (fp = fopen(fname, "wb+"))) {
+ remove(fname);
+ free(fname);
+ gzclose(gzfp);
+ close(fd);
+ return NULL;
+ }
+
+ while ((len = gzread(gzfp, data, 8192)) > 0) {
+ fwrite(data, 1, len, fp);
+ }
+
+ gzclose(gzfp);
+ fclose(fp);
+
+ compression_used = i+1;
+ break;
+ } else {
+#endif
+
+#ifdef _WIN32 /* 15/2/99 johnt - don't have /dev/null on windows NT, can't multi redirect on Win 95 */
+ sprintf(buf, "%s %s >%s",
+ magics[i].uncompress, fptr, fname);
+#else
+ sprintf(buf, "%s %s 1>%s 2>/dev/null",
+ magics[i].uncompress, fptr, fname);
+#endif
+ if ((ret = system(buf)) == 0) {
+ compression_used = i+1;
+ break;
+ }
+
+#ifdef HAVE_LIBZ
+ }
+#endif
+
+ }
+
+ if (tryit && fd != -1)
+ close(fd);
+ }
+
+ if (fd != -1) close(fd);
+
+ if (i == num_magics) {
+ /*
+ * It's only an error if the file couldn't be found. If it
+ * exists then we'll assume that it doesn't need uncompressing.
+ */
+ if (tryit) {
+ remove(fname);
+ free(fname);
+ return NULL;
+ } else {
+ do_del = 0;
+ compression_used = 0;
+ remove(fname);
+ free(fname);
+ fname = fptr;
+ }
+ }
+
+ /*
+ * We've now got the temporary file. Open it and unlink it.
+ * We can also keep the original fp open for those who need to
+ * write back to it.
+ */
+/* 24/3/99 johnt - added corba support */
+#ifdef USE_CORBA
+ if( corba ){
+ /* corba possibly has TWO temporary files
+ 1 created by corba_open, and 1 created by the decompression
+ */
+ if (NULL == (fp = fopen(fname, "r+b")))
+ if (NULL == (fp = fopen(fname, "rb"))){
+ remove(fname);
+ free(fname);
+ unlink(fptr);
+ return NULL;
+ }
+ if (ofp) {
+ if (compression_used)
+ *ofp = fopen(fptr, "r+b");
+ else
+ *ofp = fp;
+ }
+ unlink(fptr); /* corba temp file will be held until ofp/fp closed */
+ } else {
+#endif
+ if (NULL == (fp = fopen(fname, "r+b"))){
+ if (NULL == (fp = fopen(fname, "rb"))){
+ remove(fname);
+ free(fname);
+ return NULL;
+ }
+ }
+
+ if (ofp) {
+ if (compression_used)
+ *ofp = fopen(tryit ? fext : file, "r+b");
+ else
+ *ofp = fp;
+ }
+#ifdef USE_CORBA
+ }
+#endif
+
+ if (do_del) {
+ remove(fname);
+ free(fname);
+ }
+ return fp;
+}
+
+/*
+ * Returns a file pointer of an uncompressed copy of 'fp'.
+ *
+ * If ofp is non NULL then the original file pointer will also be returned
+ * (opened for update) to allow writing back to the original file. In cases
+ * of uncompressed data this is the same as the returned file pointer.
+ */
+FILE *freopen_compressed(FILE *fp, FILE **ofp) {
+ int num_magics = sizeof(magics) / sizeof(*magics);
+ char *fname;
+ char buf[BS];
+ unsigned char mg[3];
+ FILE *newfp;
+ int i;
+
+ /* Test that it's compressed with 1 byte of magic (can't ungetc more) */
+ mg[0] = fgetc(fp);
+ ungetc(mg[0], fp);
+ for (i = 0; i < num_magics; i++) {
+ if (mg[0] == magics[i].magic[0]) {
+ break;
+ }
+ }
+ if (i == num_magics) {
+ return fp;
+ }
+
+ fname=tempnam(NULL, NULL);
+
+ /* Copy the file to newfp */
+ newfp = fopen(fname, "wb+");
+ if (NULL == newfp){
+ remove(fname);
+ free(fname);
+ return fp;
+ }
+
+ do {
+ int len = fread(buf, 1, BS, fp);
+ if (len > 0)
+ fwrite(buf, 1, len, newfp);
+ } while (!feof(fp));
+ fflush(newfp);
+ rewind(newfp);
+ rewind(fp);
+
+ /* Test that it's compressed with full magic number */
+ fread(mg, 1, 2, newfp);
+ rewind(newfp);
+ for (i = 0; i < num_magics; i++) {
+ if (mg[0] == magics[i].magic[0] && mg[1] == magics[i].magic[1]) {
+ break;
+ }
+ }
+ if (i == num_magics) {
+ /* Uncompressed, just return fp */
+ remove(fname);
+ free(fname);
+ fclose(newfp);
+ return fp;
+ }
+
+#ifdef NOTDEF
+ /* It's compressed, so we use fopen_compressed on fname */
+ fp = fopen_compressed(fname, ofp);
+ remove(fname);
+ if (newfp != NULL) {
+ return fp;
+ } else {
+ return newfp;
+ }
+#else
+/* 24/03/99 johnt - After much consideration - this is what we think the
+ above code is supposed to do ! */
+ fclose(newfp);
+ fp = fopen_compressed(fname,ofp);
+ remove(fname); /* ofp will hold this open if we still need it */
+ free(fname);
+ return fp;
+#endif
+}
+
+#else /* MAC */
+
+/* Dummy routines for MAC where compression isn't supported */
+
+void set_compression_method(int method) {}
+int get_compression_method(void) { return 0; }
+int compress_file(char *file) { return 0; }
+int fcompress_file(FILE *fp) { return 0; }
+
+FILE *fopen_compressed(char *file, FILE **ofp) {
+ FILE *fp;
+
+ if (NULL == (fp = fopen(file, "rb+")))
+ if (NULL == (fp = fopen(file, "rb")))
+ return NULL;
+
+ if (ofp)
+ *ofp = fp;
+
+ return fp;
+}
+
+FILE *freopen_compressed(FILE *fp, FILE **ofp) {
+ if (ofp)
+ *ofp = fp;
+
+ return fp;
+}
+
+#endif /* MAC */
diff --git a/src/Staden/read/compress.h b/src/Staden/read/compress.h
new file mode 100644
index 0000000..8007bb9
--- /dev/null
+++ b/src/Staden/read/compress.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _COMPRESS_H
+#define _COMPRESS_H
+
+#include <stdio.h>
+
+/*
+ * Compress a file using the method set in the compression_used value
+ * (set by set_compression_method and fopen_compressed).
+ *
+ * If compression succeeds, we rename the file back its original name.
+ *
+ * When compression_used is 0 no compression is done.
+ */
+int compress_file(char *file);
+int fcompress_file(FILE *fp);
+
+/*
+ * Returns a file pointer of an uncompressed copy of 'file'.
+ * 'file' need not exist if 'file'.ext (eg file.gz)
+ * exists and can be uncompressed.
+ *
+ * If ofp is non NULL then the original file pointer will also be returned
+ * (opened for update) to allow writing back to the original file. In cases
+ * of uncompressed data this is the same as the returned file pointer.
+ */
+FILE *fopen_compressed(char *file, FILE **ofp);
+
+/*
+ * Returns a file pointer of an uncompressed copy of 'fp'.
+ *
+ * If ofp is non NULL then the original file pointer will also be returned
+ * (opened for update) to allow writing back to the original file. In cases
+ * of uncompressed data this is the same as the returned file pointer.
+ */
+FILE *freopen_compressed(FILE *fp, FILE **ofp);
+
+/*
+ * Sets the desired compression method. The below macros relate to entries
+ * in the compression magic numbers table.
+ */
+void set_compression_method(int method);
+int get_compression_method(void);
+
+/*
+ * Converts compress mode strings (eg "gzip") to numbers.
+ */
+int compress_str2int(char *mode);
+
+#define COMP_METHOD_NONE 0
+#define COMP_METHOD_BZIP 1
+#define COMP_METHOD_GZIP 2
+#define COMP_METHOD_COMPRESS 3
+#define COMP_METHOD_PACK 4
+#define COMP_METHOD_BZIP2 5
+#define COMP_METHOD_SZIP 6
+
+#endif /* _COMPRESS_H */
diff --git a/src/Staden/read/compression.c b/src/Staden/read/compression.c
new file mode 100644
index 0000000..d6ebd0c
--- /dev/null
+++ b/src/Staden/read/compression.c
@@ -0,0 +1,1633 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <zlib.h>
+#include <assert.h>
+#include <math.h>
+
+#ifndef M_PI
+# define M_PI 3.14159265358979323846
+#endif
+
+#include "os.h"
+#include "compression.h"
+#include "ztr.h"
+#include "xalloc.h"
+
+#ifndef NDEBUG
+# define NDEBUG
+#endif
+
+/*
+ * ---------------------------------------------------------------------------
+ * ZTR_FORM_ZLIB
+ * ---------------------------------------------------------------------------
+ */
+
+/*
+ * Some comments on zlib usage.
+ *
+ * - Ideally for trace data, after decorrelation, we should use Z_FILTERED.
+ * Empirical studies show that this gives the best compression ratio, but
+ * it is slow (about the same speed as normal gzip). MUCH faster is huffman
+ * only, and it doesn't give radically different compression ratios.
+ *
+ * - When compressing using Z_HUFFMAN_ONLY we used compression level
+ * '1' as this invokes the deflate_fast() algorithm. It makes no
+ * difference to the compression level, but it seems to be quicker still.
+ *
+ */
+
+/*
+ * zlib_huff()
+ *
+ * Compresses data using huffman encoding, as implemented by zlib.
+ *
+ * Arguments:
+ * uncomp Uncompressed input data
+ * uncomp_len Length of uncomp data
+ * comp_len Output: length of compressed data
+ *
+ * Returns:
+ * Compressed data if successful
+ * NULL if not successful
+ */
+char *zlib_huff(char *uncomp, int uncomp_len, int strategy, int *comp_len) {
+ z_stream zstr;
+ int err;
+ int comp_len_tmp = uncomp_len * 1.001 + 12; /* Maximum expansion size */
+ char *comp = (char *)xmalloc(comp_len_tmp+5);
+ int c_len;
+
+ /* Initialise zlib */
+ zstr.zalloc = (alloc_func)0;
+ zstr.zfree = (free_func)0;
+ zstr.opaque = (voidpf)0;
+
+ if ((err = deflateInit2(&zstr, 1, Z_DEFLATED, 15, 8, strategy)) != Z_OK) {
+ fprintf(stderr, "zlib errror in deflateInit2(): %d\n", err);
+ return NULL;
+ }
+
+ /* Set up input and output buffers */
+ zstr.next_in = (unsigned char *)uncomp;
+ zstr.avail_in = uncomp_len;
+ zstr.next_out = (unsigned char *)comp+5;
+ zstr.avail_out = comp_len_tmp;
+
+ /* Do the compression */
+ if ((err = deflate(&zstr, Z_FINISH)) != Z_STREAM_END) {
+ fprintf(stderr, "zlib errror in deflate(): %d\n", err);
+ return NULL;
+ }
+
+ /* Tidy up */
+ deflateEnd(&zstr);
+
+ c_len = zstr.total_out;
+
+ /* Return */
+ comp[0] = ZTR_FORM_ZLIB;
+ comp[1] = (uncomp_len >> 0) & 0xff;
+ comp[2] = (uncomp_len >> 8) & 0xff;
+ comp[3] = (uncomp_len >> 16) & 0xff;
+ comp[4] = (uncomp_len >> 24) & 0xff;
+
+ if (comp_len)
+ *comp_len = c_len+5;
+
+ return comp;
+}
+
+/*
+ * zlib_dehuff()
+ *
+ * Uncompresses data using huffman encoding, as implemented by zlib.
+ *
+ * Arguments:
+ * comp Compressed input data
+ * comp_len Length of comp data
+ * uncomp_len Output: length of uncompressed data
+ *
+ * Returns:
+ * Uncompressed data if successful
+ * NULL if not successful
+ */
+char *zlib_dehuff(char *comp, int comp_len, int *uncomp_len) {
+ z_stream zstr;
+ int err;
+ char *uncomp;
+ int ulen;
+
+ /* Allocate */
+ ulen =
+ ((unsigned char)comp[1] << 0) +
+ ((unsigned char)comp[2] << 8) +
+ ((unsigned char)comp[3] << 16) +
+ ((unsigned char)comp[4] << 24);
+ uncomp = (char *)xmalloc(ulen);
+
+ /* Initialise zlib */
+ zstr.zalloc = (alloc_func)0;
+ zstr.zfree = (free_func)0;
+ zstr.opaque = (voidpf)0;
+
+ if ((err = inflateInit(&zstr)) != Z_OK) {
+ fprintf(stderr, "zlib errror in inflateInit(): %d\n", err);
+ return NULL;
+ }
+
+ /* Set up input and output buffers */
+ zstr.next_in = (unsigned char *)comp+5;
+ zstr.avail_in = comp_len-5;
+ zstr.next_out = (unsigned char *)uncomp;
+ zstr.avail_out = ulen;
+
+ /* Do the decompression */
+ if ((err = inflate(&zstr, Z_FINISH)) != Z_STREAM_END) {
+ fprintf(stderr, "zlib errror in deflate(): %d\n", err);
+ return NULL;
+ }
+
+ /* Tidy up */
+ inflateEnd(&zstr);
+
+ if (uncomp_len)
+ *uncomp_len = ulen;
+
+ return uncomp;
+}
+
+
+/*
+ * ---------------------------------------------------------------------------
+ * ZTR_FORM_RLE
+ * ---------------------------------------------------------------------------
+ */
+
+/*
+ * Run length encoding.
+ *
+ * Any run of 3 or more identical characters (up to 255 in a row) are replaced
+ * by "255" followed by the number of characters followed by the character
+ * value itself.
+ * Any single 255 values are escaped using 255 255.
+ *
+ * Arguments:
+ * uncomp Input data
+ * uncomp_len Length of input data 'uncomp'
+ * guard Guard byte - used to encode "N" copies of data
+ * comp_len Output: length of compressed data
+ *
+ * Returns:
+ * Compressed data if successful
+ * NULL if not successful
+ */
+char *rle(char *uncomp, int uncomp_len, int guard, int *comp_len) {
+ int i, j, k, c_len = 0;
+ char *comp = xmalloc(2 * uncomp_len + 6);
+ char *out = comp + 6;
+
+ /* A guard of -1 implies to search for the least frequent symbol */
+ if (guard == -1) {
+ int cnt[256];
+ int bestcnt = uncomp_len + 1;
+
+ for (i = 0; i < 256; i++)
+ cnt[i] = 0;
+
+ for (i = 0; i < uncomp_len; i++) {
+ cnt[(unsigned char)uncomp[i]]++;
+ }
+
+ for (i = 0; i < 256; i++) {
+ if (cnt[i] < bestcnt) {
+ bestcnt = cnt[i];
+ guard = i;
+ }
+ }
+ }
+
+ for (j = i = 0; i < uncomp_len; i=k) {
+ /*
+ * Detect blocks of up identical bytes up to 255 bytes long.
+ */
+ for (k = i; k < uncomp_len && uncomp[i] == uncomp[k]; k++)
+ if (k-i == 255)
+ break;
+
+ /* 1, 2 or 3 bytes are best stored "as is" */
+ if (k-i < 4) {
+ do {
+ /*
+ * If we find 'guard' in our sequence, escape it by
+ * outputting 'guard' <zero>. (We know that we'll never
+ * write out zero copies of a token in our rle compression
+ * algorithm.)
+ */
+ if ((unsigned char)(uncomp[i]) == guard) {
+ out[c_len++] = guard;
+ out[c_len++] = 0;
+ } else {
+ out[c_len++] = uncomp[i];
+ }
+ i++;
+ } while (k >= i+1);
+ } else {
+ /* More than 3 bytes: store as ('guard', length, byte value) */
+ out[c_len++] = guard;
+ out[c_len++] = k-i;
+ out[c_len++] = uncomp[i];
+ }
+ }
+
+ /* Return */
+ comp[0] = ZTR_FORM_RLE;
+ comp[1] = (uncomp_len >> 0) & 0xff;
+ comp[2] = (uncomp_len >> 8) & 0xff;
+ comp[3] = (uncomp_len >> 16) & 0xff;
+ comp[4] = (uncomp_len >> 24) & 0xff;
+ comp[5] = guard;
+
+ if (comp_len)
+ *comp_len = c_len+6;
+
+ return comp;
+}
+
+/*
+ * Reverses run length encoding.
+ *
+ * Arguments:
+ * comp Compressed input data
+ * comp_len Length of comp data
+ * uncomp_len Output: length of uncompressed data
+ *
+ * Returns:
+ * Uncompressed data if successful
+ * NULL if not successful
+ */
+char *unrle(char *comp, int comp_len, int *uncomp_len) {
+ int in_i, out_i, i, val, count, out_len;
+ char *uncomp;
+ unsigned char *in = (unsigned char *)comp+6;
+ char *out;
+ int guard = (unsigned char)comp[5];
+
+ /* Allocate */
+ out_len =
+ ((unsigned char)comp[1] << 0) +
+ ((unsigned char)comp[2] << 8) +
+ ((unsigned char)comp[3] << 16) +
+ ((unsigned char)comp[4] << 24);
+ out = uncomp = (char *)xmalloc(out_len);
+
+ for (in_i = out_i = 0; out_i < out_len; in_i++) {
+ if (in[in_i] != guard) {
+ /* When not 'guard' it's easy - just output this token */
+ assert(out_i >= 0 && out_i < out_len);
+ out[out_i++] = in[in_i];
+
+ } else {
+ /*
+ * Found an 'guard' token. If next token is zero, then
+ * we were simply escaping a real 'guard' token in the input
+ * data, otherwise output a string of bytes.
+ */
+ count = in[++in_i];
+ if (count != 0) {
+ val = in[++in_i];
+ for (i = 0; i < count; i++) {
+ assert(out_i >= 0 && out_i < out_len);
+ out[out_i++] = val;
+ }
+ } else {
+ assert(out_i >= 0 && out_i < out_len);
+ out[out_i++] = guard;
+ }
+ }
+ }
+
+ if (uncomp_len)
+ *uncomp_len = out_len;
+
+ return uncomp;
+}
+
+/*
+ * ---------------------------------------------------------------------------
+ * ZTR_FORM_DELTA1
+ * ---------------------------------------------------------------------------
+ */
+
+/*
+ * This replaces 'samples' with successive differences between samples.
+ * These implementations support 'level's of 1, 2 and 3.
+ *
+ * NB: This is analogous to our SCF delta_samples1 (etc) function, except that
+ * this function about 40% faster.
+ *
+ * Implementation details taken from Jean Thierry-Mieg's CTF code.
+ */
+
+/*
+ * decorrelate1()
+ *
+ * Produce successive deltas from a 1-byte array.
+ *
+ * Arguments:
+ * uncomp Uncompressed data
+ * uncomp_len Length of uncompressed data
+ * level Differencing level (must be 1, 2 or 3)
+ * comp_len Return: where to store new compressed length
+ *
+ * Returns:
+ * Success: A decorrelated buffer (malloced)
+ * Failure: NULL
+ */
+char *decorrelate1(char *x_uncomp,
+ int uncomp_len,
+ int level,
+ int *comp_len) {
+ int i, z;
+ int u1 = 0, u2 = 0, u3 = 0;
+ char *comp = (char *)xmalloc(uncomp_len + 2);
+ unsigned char *u_uncomp = (unsigned char *)x_uncomp;
+
+ if (!comp)
+ return NULL;
+
+ comp+=2;
+ switch (level) {
+ case 1:
+ for (i = 0; i < uncomp_len; i++) {
+ z = u1;
+ u1 = u_uncomp[i];
+ comp[i] = u_uncomp[i] - z;
+ }
+ break;
+
+ case 2:
+ for (i = 0; i < uncomp_len; i++) {
+ z = 2*u1 - u2;
+ u2 = u1;
+ u1 = u_uncomp[i];
+ comp[i] = u_uncomp[i] - z;
+ }
+ break;
+
+ case 3:
+ for (i = 0; i < uncomp_len; i++) {
+ z = 3*u1 - 3*u2 + u3;
+ u3 = u2;
+ u2 = u1;
+ u1 = u_uncomp[i];
+ comp[i] = u_uncomp[i] - z;
+ }
+ break;
+
+ default:
+ return NULL;
+ }
+ comp-=2;
+ comp[0] = ZTR_FORM_DELTA1;
+ comp[1] = level;
+
+ *comp_len = uncomp_len+2;
+
+ return comp;
+}
+
+#define ABS(a) ((a) > 0 ? (a) : -(a))
+
+/* ZTR_FORM_DDELTA1 - experimental */
+char *decorrelate1dyn(char *x_uncomp,
+ int uncomp_len,
+ int *comp_len) {
+ int i, j, z[4];
+ int u1 = 0, u2 = 0, u3 = 0;
+ char *comp = (char *)xmalloc(uncomp_len + 2);
+ unsigned char *u_uncomp = (unsigned char *)x_uncomp;
+ int level = 3; /* default level */
+ int last_level = level;
+ int best;
+
+ if (!comp)
+ return NULL;
+
+ comp+=2;
+ for (i = 0; i < uncomp_len; i++) {
+ z[1] = u1;
+ z[2] = 2*u1 - u2;
+ z[3] = 3*u1 - 3*u2 + u3;
+ comp[i] = u_uncomp[i] - z[last_level];
+ best = 10000;
+ for (j = 1; j < 3; j++) {
+ if (ABS(u_uncomp[i] - z[j]) < best) {
+ best = ABS(u_uncomp[i] - z[j]);
+ last_level = j;
+ }
+ }
+ u3 = u2;
+ u2 = u1;
+ u1 = u_uncomp[i];
+ }
+ comp-=2;
+ comp[0] = ZTR_FORM_DDELTA1;
+ comp[1] = level;
+
+ *comp_len = uncomp_len+2;
+
+ return comp;
+}
+
+/*
+ * recorrelate1()
+ *
+ * The reverse of decorrelate1()
+ *
+ * Arguments:
+ * comp Compressed input data
+ * comp_len Length of comp data
+ * uncomp_len Output: length of uncompressed data
+ *
+ * Returns:
+ * Success: uncompressed data
+ * Failure: NULL
+ */
+char *recorrelate1(char *x_comp,
+ int comp_len,
+ int *uncomp_len) {
+ int i, z;
+ int u1 = 0, u2 = 0, u3 = 0;
+ int level = x_comp[1];
+ char *uncomp;
+
+ uncomp = (char *)xmalloc(comp_len-2);
+ if (!uncomp)
+ return NULL;
+
+ x_comp+=2;
+ comp_len-=2;
+ *uncomp_len = comp_len;
+
+ switch (level) {
+ case 1:
+ for (i = 0; i < comp_len; i++) {
+ z = u1;
+ u1 = uncomp[i] = x_comp[i] + z;
+ }
+ break;
+
+ case 2:
+ for (i = 0; i < comp_len; i++) {
+ z = 2*u1 - u2;
+ u2 = u1;
+ u1 = uncomp[i] = x_comp[i] + z;
+ }
+ break;
+
+ case 3:
+ for (i = 0; i < comp_len; i++) {
+ z = 3*u1 - 3*u2 + u3;
+ u3 = u2;
+ u2 = u1;
+ u1 = uncomp[i] = x_comp[i] + z;
+ }
+ break;
+ }
+
+ return uncomp;
+}
+
+/*
+ * ---------------------------------------------------------------------------
+ * ZTR_FORM_DELTA2
+ * ---------------------------------------------------------------------------
+ */
+
+/*
+ * decorrelate2()
+ *
+ * Produce successive deltas from a 2-byte array (big endian)
+ *
+ * Arguments:
+ * uncomp Uncompressed data
+ * uncomp_len Length of uncompressed data
+ * level Differencing level (must be 1, 2 or 3)
+ * comp_len Return: where to store new compressed length
+ *
+ * Returns:
+ * Success: A decorrelated buffer (malloced)
+ * Failure: NULL
+ */
+char *decorrelate2(char *x_uncomp,
+ int uncomp_len,
+ int level,
+ int *comp_len) {
+ int i, z, delta;
+ int u1 = 0, u2 = 0, u3 = 0;
+ char *comp = (char *)xmalloc(uncomp_len + 2);
+ unsigned char *u_uncomp = (unsigned char *)x_uncomp;
+
+ if (!comp)
+ return NULL;
+
+ comp+=2;
+ switch (level) {
+ case 1:
+ for (i = 0; i < uncomp_len; i+=2) {
+ z = u1;
+ u1 = (u_uncomp[i] << 8) + u_uncomp[i+1];
+ delta = u1 - z;
+ comp[i ] = (delta >> 8) & 0xff;
+ comp[i+1] = (delta >> 0) & 0xff;
+ }
+ break;
+
+ case 2:
+ for (i = 0; i < uncomp_len; i+=2) {
+ z = 2*u1 - u2;
+ u2 = u1;
+ u1 = (u_uncomp[i] << 8) + u_uncomp[i+1];
+ delta = u1 - z;
+ comp[i ] = (delta >> 8) & 0xff;
+ comp[i+1] = (delta >> 0) & 0xff;
+ }
+ break;
+
+ case 3:
+ for (i = 0; i < uncomp_len; i+=2) {
+ z = 3*u1 - 3*u2 + u3;
+ u3 = u2;
+ u2 = u1;
+ u1 = (u_uncomp[i] << 8) + u_uncomp[i+1];
+ delta = u1 - z;
+ comp[i ] = (delta >> 8) & 0xff;
+ comp[i+1] = (delta >> 0) & 0xff;
+ }
+ break;
+
+ default:
+ return NULL;
+ }
+ comp-=2;
+ comp[0] = ZTR_FORM_DELTA2;
+ comp[1] = level;
+
+ *comp_len = uncomp_len+2;
+
+ return comp;
+}
+
+char *decorrelate2dyn(char *x_uncomp,
+ int uncomp_len,
+ int *comp_len) {
+ int i, j, z[4];
+ int u1 = 0, u2 = 0, u3 = 0;
+ char *comp = (char *)xmalloc(uncomp_len + 2);
+ unsigned char *u_uncomp = (unsigned char *)x_uncomp;
+ int level = 2; /* minimum level */
+ int last_level = level;
+ int best;
+
+ if (!comp)
+ return NULL;
+
+ comp+=2;
+ for (i = 0; i < uncomp_len; i+=2) {
+ z[0] = 0;
+ z[1] = u1;
+ z[2] = 2*u1 - u2;
+ z[3] = 3*u1 - 3*u2 + u3;
+ u3 = u2;
+ u2 = u1;
+ u1 = (u_uncomp[i]<<8) + u_uncomp[i+1];
+ comp[i ] = ((u1 - z[last_level]) >> 8) & 0xff;
+ comp[i+1] = ((u1 - z[last_level]) >> 0) & 0xff;
+ best = 10000;
+ for (j = level; j < 4; j++) {
+ if (ABS(u1 - z[j]) < best) {
+ best = ABS(u1 - z[j]);
+ last_level = j;
+ }
+ }
+ }
+ comp-=2;
+ comp[0] = ZTR_FORM_DDELTA2;
+ comp[1] = level;
+
+ *comp_len = uncomp_len+2;
+
+ return comp;
+}
+
+/*
+ * recorrelate2()
+ *
+ * The reverse of decorrelate2()
+ *
+ * Arguments:
+ * comp Compressed input data
+ * comp_len Length of comp data
+ * uncomp_len Output: length of uncompressed data
+ *
+ * Returns:
+ * Success: uncompressed data
+ * Failure: NULL
+ */
+char *recorrelate2(char *x_comp,
+ int comp_len,
+ int *uncomp_len) {
+ int i, z;
+ int u1 = 0, u2 = 0, u3 = 0;
+ int level = x_comp[1];
+ char *uncomp;
+ unsigned char *u_comp = (unsigned char *)x_comp;
+
+ uncomp = (char *)xmalloc(comp_len-2);
+ if (!uncomp)
+ return NULL;
+
+ u_comp+=2;
+ comp_len-=2;
+ *uncomp_len = comp_len;
+
+ switch (level) {
+ case 1:
+ for (i = 0; i < comp_len; i+=2) {
+ z = u1;
+ u1 = ((u_comp[i] << 8) | u_comp[i+1]) + z;
+ uncomp[i ] = (u1 >> 8) & 0xff;
+ uncomp[i+1] = (u1 >> 0) & 0xff;
+ }
+ break;
+
+ case 2:
+ for (i = 0; i < comp_len; i+=2) {
+ z = 2*u1 - u2;
+ u2 = u1;
+ u1 = ((u_comp[i] << 8) | u_comp[i+1]) + z;
+ uncomp[i ] = (u1 >> 8) & 0xff;
+ uncomp[i+1] = (u1 >> 0) & 0xff;
+ }
+ break;
+
+ case 3:
+ for (i = 0; i < comp_len; i+=2) {
+ z = 3*u1 - 3*u2 + u3;
+ u3 = u2;
+ u2 = u1;
+ u1 = ((u_comp[i] << 8) | u_comp[i+1]) + z;
+ uncomp[i ] = (u1 >> 8) & 0xff;
+ uncomp[i+1] = (u1 >> 0) & 0xff;
+ }
+ break;
+ }
+
+ return uncomp;
+}
+
+/*
+ * ---------------------------------------------------------------------------
+ * ZTR_FORM_DELTA4
+ * ---------------------------------------------------------------------------
+ */
+
+/*
+ * decorrelate4()
+ *
+ * Produce successive deltas from a 4-byte array (big endian)
+ *
+ * Arguments:
+ * uncomp Uncompressed data
+ * uncomp_len Length of uncompressed data
+ * level Differencing level (must be 1, 2 or 3)
+ * comp_len Return: where to store new compressed length
+ *
+ * Returns:
+ * Success: A decorrelated buffer (malloced)
+ * Failure: NULL
+ */
+char *decorrelate4(char *x_uncomp,
+ int uncomp_len,
+ int level,
+ int *comp_len) {
+ int i, z, delta;
+ int u1 = 0, u2 = 0, u3 = 0;
+ char *comp = (char *)xmalloc(uncomp_len + 4);
+ unsigned char *u_uncomp = (unsigned char *)x_uncomp;
+
+ if (!comp)
+ return NULL;
+
+ comp+=4;
+ switch (level) {
+ case 1:
+ for (i = 0; i < uncomp_len; i+=4) {
+ z = u1;
+ u1 =(u_uncomp[i ] << 24) +
+ (u_uncomp[i+1] << 16) +
+ (u_uncomp[i+2] << 8) +
+ (u_uncomp[i+3] << 0);
+ delta = u1 - z;
+ comp[i ] = (delta >> 24) & 0xff;
+ comp[i+1] = (delta >> 16) & 0xff;
+ comp[i+2] = (delta >> 8) & 0xff;
+ comp[i+3] = (delta >> 0) & 0xff;
+ }
+ break;
+
+ case 2:
+ for (i = 0; i < uncomp_len; i+=4) {
+ z = 2*u1 - u2;
+ u2 = u1;
+ u1 =(u_uncomp[i ] << 24) +
+ (u_uncomp[i+1] << 16) +
+ (u_uncomp[i+2] << 8) +
+ (u_uncomp[i+3] << 0);
+ delta = u1 - z;
+ comp[i ] = (delta >> 24) & 0xff;
+ comp[i+1] = (delta >> 16) & 0xff;
+ comp[i+2] = (delta >> 8) & 0xff;
+ comp[i+3] = (delta >> 0) & 0xff;
+ }
+ break;
+
+ case 3:
+ for (i = 0; i < uncomp_len; i+=4) {
+ z = 3*u1 - 3*u2 + u3;
+ u3 = u2;
+ u2 = u1;
+ u1 =(u_uncomp[i ] << 24) +
+ (u_uncomp[i+1] << 16) +
+ (u_uncomp[i+2] << 8) +
+ (u_uncomp[i+3] << 0);
+ delta = u1 - z;
+ comp[i ] = (delta >> 24) & 0xff;
+ comp[i+1] = (delta >> 16) & 0xff;
+ comp[i+2] = (delta >> 8) & 0xff;
+ comp[i+3] = (delta >> 0) & 0xff;
+ }
+ break;
+
+ default:
+ return NULL;
+ }
+ comp-=4;
+ comp[0] = ZTR_FORM_DELTA4;
+ comp[1] = level;
+ comp[2] = 0; /* dummy - to align on 4-byte boundary */
+ comp[3] = 0; /* dummy - to align on 4-byte boundary */
+
+ *comp_len = uncomp_len+4;
+
+ return comp;
+}
+
+/*
+ * recorrelate4()
+ *
+ * The reverse of decorrelate4()
+ *
+ * Arguments:
+ * comp Compressed input data
+ * comp_len Length of comp data
+ * uncomp_len Output: length of uncompressed data
+ *
+ * Returns:
+ * Success: uncompressed data
+ * Failure: NULL
+ */
+char *recorrelate4(char *x_comp,
+ int comp_len,
+ int *uncomp_len) {
+ int i, z;
+ int u1 = 0, u2 = 0, u3 = 0;
+ int level = x_comp[1];
+ char *uncomp;
+ unsigned char *u_comp = (unsigned char *)x_comp;
+
+ uncomp = (char *)xmalloc(comp_len-4);
+ if (!uncomp)
+ return NULL;
+
+ u_comp+=4;
+ comp_len-=4;
+ *uncomp_len = comp_len;
+
+ switch (level) {
+ case 1:
+ for (i = 0; i < comp_len; i+=4) {
+ z = u1;
+ u1 = z +
+ ((u_comp[i ] << 24) |
+ (u_comp[i+1] << 16) |
+ (u_comp[i+2] << 8) |
+ u_comp[i+3]);
+ uncomp[i ] = (u1 >> 24) & 0xff;
+ uncomp[i+1] = (u1 >> 16) & 0xff;
+ uncomp[i+2] = (u1 >> 8) & 0xff;
+ uncomp[i+3] = (u1 >> 0) & 0xff;
+ }
+ break;
+
+ case 2:
+ for (i = 0; i < comp_len; i+=4) {
+ z = 2*u1 - u2;
+ u2 = u1;
+ u1 = z +
+ ((u_comp[i ] << 24) |
+ (u_comp[i+1] << 16) |
+ (u_comp[i+2] << 8) |
+ u_comp[i+3]);
+ uncomp[i ] = (u1 >> 24) & 0xff;
+ uncomp[i+1] = (u1 >> 16) & 0xff;
+ uncomp[i+2] = (u1 >> 8) & 0xff;
+ uncomp[i+3] = (u1 >> 0) & 0xff;
+ }
+ break;
+
+ case 3:
+ for (i = 0; i < comp_len; i+=4) {
+ z = 3*u1 - 3*u2 + u3;
+ u3 = u2;
+ u2 = u1;
+ u1 = z +
+ ((u_comp[i ] << 24) |
+ (u_comp[i+1] << 16) |
+ (u_comp[i+2] << 8) |
+ u_comp[i+3]);
+ uncomp[i ] = (u1 >> 24) & 0xff;
+ uncomp[i+1] = (u1 >> 16) & 0xff;
+ uncomp[i+2] = (u1 >> 8) & 0xff;
+ uncomp[i+3] = (u1 >> 0) & 0xff;
+ }
+ break;
+ }
+
+ return uncomp;
+}
+
+
+/*
+ * ---------------------------------------------------------------------------
+ * ZTR_FORM_16TO8
+ * ---------------------------------------------------------------------------
+ */
+
+/*
+ * shrink_16to8()
+ *
+ * Stores an array of 16-bit (big endian) array elements in an 8-bit array.
+ * We assume that most 16-bit elements encode numbers that fit in an 8-bit
+ * value. When not possible, we store a marker followed by the 16-bit value
+ * stored as multiple 8-bit values.
+ *
+ * uncomp Uncompressed data
+ * uncomp_len Length of uncompressed data (in bytes)
+ * comp_len Return: where to store new compressed length
+ *
+ * Returns:
+ * Success: An 8-bit array (malloced)
+ * Failure: NULL
+ */
+char *shrink_16to8(char *x_uncomp, int uncomp_len, int level, int *comp_len) {
+ char *comp;
+ int i, j, i16;
+ signed char *s_uncomp = (signed char *)x_uncomp;
+
+ /* Allocation - worst case is 3 * (uncomp_len/2) + 1 */
+ if (NULL == (comp = (char *)xmalloc(3 * (uncomp_len/2) + 1)))
+ return NULL;
+
+ comp[0] = ZTR_FORM_16TO8;
+ for (i = 0, j = 1; i < uncomp_len; i+=2) {
+ i16 = (s_uncomp[i] << 8) | (unsigned char)s_uncomp[i+1];
+ if (i16 >= -127 && i16 <= 127) {
+ comp[j++] = i16;
+ } else {
+ comp[j++] = -128;
+ comp[j++] = s_uncomp[i];
+ comp[j++] = s_uncomp[i+1];
+ }
+ }
+
+ /* Reclaim unneeded memory */
+ comp = xrealloc(comp, j);
+
+ *comp_len = j;
+ return comp;
+}
+
+
+/*
+ * expand_8to16()
+ *
+ * The opposite of the shrink_16to8() function.
+ *
+ * comp Compressed input data
+ * comp_len Length of comp data (in bytes)
+ * uncomp_len Output: length of uncompressed data (in bytes)
+ *
+ * Returns:
+ * Success: Uncompressed data (char *)
+ * Failure: NULL
+ */
+char *expand_8to16(char *x_comp, int comp_len, int *uncomp_len) {
+ int i, j;
+ char *uncomp;
+ signed char *s_comp = (signed char *)x_comp;
+
+ /* Allocation - worst case is twice comp_len */
+ if (NULL == (uncomp = (char *)xmalloc(comp_len*2)))
+ return NULL;
+
+#if 0
+ for (i = 0, j = 1; j < comp_len; i+=2) {
+ if (s_comp[j] != -128) {
+ uncomp[i ] = s_comp[j] < 0 ? -1 : 0;
+ uncomp[i+1] = s_comp[j++];
+ } else {
+ j++;
+ uncomp[i ] = s_comp[j++];
+ uncomp[i+1] = s_comp[j++];
+ }
+ }
+#endif
+
+ for (i = 0, j = 1; j < comp_len; i+=2) {
+ if (s_comp[j] >= 0) {
+ uncomp[i ] = 0;
+ uncomp[i+1] = s_comp[j++];
+ } else {
+ if (s_comp[j] != -128) {
+ uncomp[i+1] = s_comp[j++];
+ uncomp[i ] = -1;
+ } else {
+ j++;
+ uncomp[i ] = s_comp[j++];
+ uncomp[i+1] = s_comp[j++];
+ }
+ }
+ }
+
+ /* Reclaim unneeded memory */
+ uncomp = xrealloc(uncomp, i);
+
+ *uncomp_len = i;
+ return uncomp;
+}
+
+/*
+ * ---------------------------------------------------------------------------
+ * ZTR_FORM_32TO8
+ * ---------------------------------------------------------------------------
+ */
+
+/*
+ * shrink_32to8()
+ *
+ * Stores an array of 32-bit (big endian) array elements in an 8-bit array.
+ * We assume that most 32-bit elements encode numbers that fit in an 8-bit
+ * value. When not possible, we store a marker followed by the 32-bit value
+ * stored as multiple 8-bit values.
+ *
+ * uncomp Uncompressed data
+ * uncomp_len Length of uncompressed data (in bytes)
+ * comp_len Return: where to store new compressed length
+ *
+ * Returns:
+ * Success: An 8-bit array (malloced)
+ * Failure: NULL
+ */
+char *shrink_32to8(char *x_uncomp, int uncomp_len, int level, int *comp_len) {
+ char *comp;
+ int i, j, i32;
+ signed char *s_uncomp = (signed char *)x_uncomp;
+
+ /* Allocation - worst case is 5 * (uncomp_len/4) + 1 */
+ if (NULL == (comp = (char *)xmalloc(5 * (uncomp_len/4) + 1)))
+ return NULL;
+
+ comp[0] = ZTR_FORM_32TO8;
+ for (i = 0, j = 1; i < uncomp_len; i+=4) {
+ i32 = (s_uncomp[i] << 24) |
+ (s_uncomp[i+1] << 16) |
+ (s_uncomp[i+2] << 8) |
+ (unsigned char)s_uncomp[i+3];
+ if (i32 >= -127 && i32 <= 127) {
+ comp[j++] = i32;
+ } else {
+ comp[j++] = -128;
+ comp[j++] = s_uncomp[i];
+ comp[j++] = s_uncomp[i+1];
+ comp[j++] = s_uncomp[i+2];
+ comp[j++] = s_uncomp[i+3];
+ }
+ }
+
+ /* Reclaim unneeded memory */
+ comp = xrealloc(comp, j);
+
+ *comp_len = j;
+ return comp;
+}
+
+/*
+ * expand_8to32()
+ *
+ * The opposite of the shrink_32to8() function.
+ *
+ * comp Compressed input data
+ * comp_len Length of comp data (in bytes)
+ * uncomp_len Output: length of uncompressed data (in bytes)
+ *
+ * Returns:
+ * Success: Uncompressed data (char *)
+ * Failure: NULL
+ */
+char *expand_8to32(char *comp, int comp_len, int *uncomp_len) {
+ int i, j;
+ char *uncomp;
+ signed char *s_comp = (signed char *)comp;
+
+ /* Allocation - worst case is four times comp_len */
+ if (NULL == (uncomp = (char *)xmalloc(comp_len*4)))
+ return NULL;
+
+ for (i = 0, j = 1; j < comp_len; i+=4) {
+ if (s_comp[j] != -128) {
+ uncomp[i ] = s_comp[j] < 0 ? -1 : 0;
+ uncomp[i+1] = s_comp[j] < 0 ? -1 : 0;
+ uncomp[i+2] = s_comp[j] < 0 ? -1 : 0;
+ uncomp[i+3] = s_comp[j++];
+ } else {
+ j++;
+ uncomp[i ] = s_comp[j++];
+ uncomp[i+1] = s_comp[j++];
+ uncomp[i+2] = s_comp[j++];
+ uncomp[i+3] = s_comp[j++];
+ }
+ }
+
+ /* Reclaim unneeded memory */
+ uncomp = xrealloc(uncomp, i);
+
+ *uncomp_len = i;
+ return uncomp;
+}
+
+/*
+ * ---------------------------------------------------------------------------
+ * ZTR_FORM_FOLLOW1
+ * ---------------------------------------------------------------------------
+ */
+static int follow_tab[256][256];
+char *follow1(char *x_uncomp,
+ int uncomp_len,
+ int level,
+ int *comp_len) {
+ char *comp = (char *)xmalloc(uncomp_len + 256 + 1);
+ unsigned char *u_uncomp = (unsigned char *)x_uncomp;
+ signed char *s_uncomp = ((signed char *)x_uncomp);
+ int i, j;
+ char next[256];
+ int count[256];
+
+ if (!comp)
+ return NULL;
+
+ /* Count di-freqs */
+ memset(follow_tab, 0, 256*256*sizeof(int));
+#if 0
+ for (i = 0; i < uncomp_len-1; i++)
+ follow_tab[u_uncomp[i]][u_uncomp[i+1]]++;
+
+ /* Pick the most frequent next byte from the preceeding byte */
+ for (i = 0; i < 256; i++) {
+ int bestval, bestind;
+
+ bestval = bestind = 0;
+ for (j = 0; j < 256; j++) {
+ if (follow_tab[i][j] > bestval) {
+ bestval = follow_tab[i][j];
+ bestind = j;
+ }
+ }
+ next[i] = bestind;
+ }
+#endif
+ memset(next, 0, 256*sizeof(*next));
+ memset(count, 0, 256*sizeof(*count));
+ /* Pick the most frequent next byte from the preceeding byte */
+ for (i = 0; i < uncomp_len-1; ) {
+ int cur = u_uncomp[i];
+ int nxt = u_uncomp[++i];
+ int folcnt = ++follow_tab[cur][nxt];
+ if (folcnt > count[cur]) {
+ count[cur] = folcnt;
+ next[cur] = nxt;
+ }
+ }
+
+ j = 0;
+ comp[j++] = ZTR_FORM_FOLLOW1;
+
+ /* Output 'next' array */
+ for (i = 0; i < 256; i++, j++)
+ comp[j] = next[i];
+
+ /* Output new 'uncomp' as next['uncomp'] */
+ comp[j++] = u_uncomp[0];
+ for (i = 1; i < uncomp_len; i++, j++) {
+ comp[j] = next[u_uncomp[i-1]] - s_uncomp[i];
+ }
+ *comp_len = j;
+
+ return comp;
+}
+
+char *unfollow1(char *x_comp,
+ int comp_len,
+ int *uncomp_len) {
+ unsigned char *u_uncomp;
+ int i, j;
+ char next[256];
+ unsigned char *u_comp = (unsigned char *)x_comp;
+ signed char *s_comp = (signed char *)x_comp;
+
+ u_uncomp = (unsigned char *)xmalloc(comp_len-256-1);
+ if (!u_uncomp)
+ return NULL;
+
+ /* Load next[] array */
+ j = 1;
+ for (i = 0; i < 256; i++, j++)
+ next[i] = u_comp[j];
+
+ /* Replace comp[x] with next[comp[x-1]] - comp[x]*/
+ u_uncomp[0] = u_comp[j++];
+
+ comp_len -= 257;
+ s_comp += 257;
+ for (i = 1; i < comp_len; i++) {
+ u_uncomp[i] = next[u_uncomp[i-1]] - s_comp[i];
+ }
+
+ *uncomp_len = i;
+
+ return (char *)u_uncomp;
+}
+
+
+/*
+ * ---------------------------------------------------------------------------
+ * ZTR_FORM_CHEB445
+ * ---------------------------------------------------------------------------
+ */
+
+#if 0
+/*
+ * Compresses using chebyshev polynomials to predict the next peak.
+ * Based on around 96 modern ABI files it compresses by around 5% (varied
+ * between 3.9 and 6.6).
+ */
+
+/*
+ * For now this has been disabled in favour of the integer version below
+ * as we cannot guarantee all systems to have the same floating point
+ * roundings, especially with the final conversion to integer.
+ * (Also, for some unknown reason, the integer version produces smaller
+ * files.)
+ */
+
+char *cheb445comp(char *uncomp, int uncomp_len, int *data_len)
+{
+ int i, k, l, z;
+ int datap;
+ float frac[5];
+ float fz[25];
+ signed short *d16 = (signed short *)uncomp;
+ int nwords = uncomp_len / 2;
+ short *dptr = d16;
+ signed short *data = (signed short *)malloc((nwords+1)*sizeof(short));
+
+ data[0] = le_int2(ZTR_FORM_CHEB445);
+ /* Check for boundary cases */
+ if (nwords <= 4) {
+ switch (nwords) {
+ case 4:
+ data[4] = be_int2(be_int2(d16[3])-be_int2(d16[2]));
+ case 3:
+ data[3] = be_int2(be_int2(d16[2])-be_int2(d16[1]));
+ case 2:
+ data[2] = be_int2(be_int2(d16[1])-be_int2(d16[0]));
+ case 1:
+ data[1] = be_int2(d16[0]);
+ }
+ *data_len = nwords*2;
+ return (char *)data;
+ }
+
+ /* First 4 values are just direct deltas */
+ data[1] = be_int2(d16[0]);
+ data[2] = be_int2(be_int2(d16[1])-be_int2(d16[0]));
+ data[3] = be_int2(be_int2(d16[2])-be_int2(d16[1]));
+ data[4] = be_int2(be_int2(d16[3])-be_int2(d16[2]));
+ datap = 5;
+
+ /* Initialise - speeds up loop */
+ for (k = 0; k < 5; k++) {
+ float kx = cos(M_PI*(k+0.5)/5)*1.5;
+ frac[k] = (kx + 1.5) - (int)(kx + 1.5);
+ }
+ for (z = l = 0; l < 5; l++) {
+ for (k = 0; k < 5; k++, z++) {
+ fz[z] = 0.4 * cos(l * M_PI*(k+0.5)/5);
+ }
+ }
+
+ /* Loop */
+ for (i = 0; i < nwords-4; i++) {
+ float dd, y = 10/3.0;
+ float f[5], coef[5];
+ signed short diff;
+ int p;
+
+ f[0] = be_int2(dptr[2])*frac[4] + be_int2(dptr[3])*frac[0];
+ f[1] = be_int2(dptr[2])*frac[3] + be_int2(dptr[3])*frac[1];
+ f[2] = be_int2(dptr[1])*frac[2] + be_int2(dptr[2])*frac[2];
+ f[3] = be_int2(dptr[0])*frac[1] + be_int2(dptr[1])*frac[3];
+ f[4] = be_int2(dptr[0])*frac[0] + be_int2(dptr[1])*frac[4];
+
+ for (z = l = 0; l < 5; l++, z+=5)
+ coef[l] = f[0] * fz[z+0] +
+ f[1] * fz[z+1] +
+ f[2] * fz[z+2] +
+ f[3] * fz[z+3] +
+ f[4] * fz[z+4];
+
+ dd = y*coef[3]+coef[2];
+ p = 0.5 + 5/3.0*(y*dd-coef[3]+coef[1])-dd+coef[0]/2.0;
+
+ if (p < 0) p = 0;
+ diff = be_int2(dptr[4]) - p;
+ data[datap++] = be_int2(diff);
+
+ dptr++;
+ }
+
+ *data_len = datap*2;
+
+ return (char *)data;
+}
+
+char *cheb445uncomp(char *comp, int comp_len, int *uncomp_len)
+{
+ int i, k, l, z;
+ float frac[5];
+ float fz[25];
+ signed short *d16 = (signed short *)comp;
+ int nwords = comp_len / 2;
+ signed short *data = (signed short *)xmalloc(comp_len);
+ short *dptr = data, *dptr2 = d16;
+
+ /* Check for boundary cases */
+ if (nwords <= 3) {
+ switch (nwords) {
+ case 3:
+ data[0] = be_int2(d16[1]);
+ data[1] = be_int2(be_int2(d16[2])+be_int2(data[0]));
+ data[2] = be_int2(be_int2(d16[3])+be_int2(data[1]));
+ break;
+ case 2:
+ data[0] = be_int2(d16[1]);
+ data[1] = be_int2(be_int2(d16[2])+be_int2(data[0]));
+ break;
+ case 1:
+ data[0] = be_int2(d16[1]);
+ break;
+ }
+ *uncomp_len = (nwords-1)*2;
+ return (char *)data;
+ }
+
+ /* First 3 values are just direct deltas */
+ data[0] = be_int2(d16[1]);
+ data[1] = be_int2(be_int2(d16[2])+be_int2(data[0]));
+ data[2] = be_int2(be_int2(d16[3])+be_int2(data[1]));
+ data[3] = be_int2(be_int2(d16[4])+be_int2(data[2]));
+ dptr2 += 5;
+
+ /* Initialise - speeds up loop */
+ for (k = 0; k < 5; k++) {
+ float kx = cos(M_PI*(k+0.5)/5)*1.5;
+ frac[k] = (kx + 1.5) - (int)(kx + 1.5);
+ }
+ for (z = l = 0; l < 5; l++) {
+ for (k = 0; k < 5; k++, z++) {
+ fz[z] = 0.4 * cos(l * M_PI*(k+0.5)/5);
+ }
+ }
+
+ /* Loop */
+ for (i = 0; i < nwords-3; i++) {
+ float dd, y = 10/3.0;
+ float f[5], coef[5];
+ signed short diff;
+ int p;
+
+ f[0] = be_int2(dptr[2])*frac[4] + be_int2(dptr[3])*frac[0];
+ f[1] = be_int2(dptr[2])*frac[3] + be_int2(dptr[3])*frac[1];
+ f[2] = be_int2(dptr[1])*frac[2] + be_int2(dptr[2])*frac[2];
+ f[3] = be_int2(dptr[0])*frac[1] + be_int2(dptr[1])*frac[3];
+ f[4] = be_int2(dptr[0])*frac[0] + be_int2(dptr[1])*frac[4];
+
+ for (z = l = 0; l < 5; l++, z+=5)
+ coef[l] = f[0] * fz[z+0] +
+ f[1] * fz[z+1] +
+ f[2] * fz[z+2] +
+ f[3] * fz[z+3] +
+ f[4] * fz[z+4];
+
+ dd = y*coef[3]+coef[2];
+ p = 0.5 + 5/3.0*(y*dd-coef[3]+coef[1])-dd+coef[0]/2.0;
+
+ if (p < 0) p = 0;
+ diff = be_int2(*dptr2) + p;
+ dptr[4] = be_int2(diff);
+
+ dptr++;
+ dptr2++;
+ }
+
+ *uncomp_len = (nwords-1)*2;
+ return (char *)data;
+}
+#endif
+
+/*
+ * ---------------------------------------------------------------------------
+ * ZTR_FORM_ICHEB
+ * ---------------------------------------------------------------------------
+ */
+
+/*
+ * Integer versions of the chebyshev polynomial compressor. This uses
+ * the polynomials to predict the next peak from the preceeding 3.
+ * Tested on 100 ABI-3700, Megabace and Licor files it compressed by
+ * around 7-8%. (Oddly this is slightly more than the floating point
+ * version.)
+ *
+ * These require 32-bit integers and have code to make sure that arithmetic
+ * does not overflow this.
+ */
+#define CH1 150
+#define CH2 105
+char *ichebcomp(char *uncomp, int uncomp_len, int *data_len)
+{
+ int i, l, z;
+ int datap;
+ int frac[5] = {139,57,75,93,11};
+ int fz[20] = {42, 42, 42, 42, 42,
+ 39, 24, 0,-24,-39,
+ 33,-12,-42,-12, 33,
+ 24,-39, 0, 39,-24};
+ int dfac;
+ signed short *d16 = (signed short *)uncomp;
+ int nwords = uncomp_len / 2;
+ short *dptr = d16;
+ signed short *data = (signed short *)malloc((nwords+1)*sizeof(short));
+
+ data[0] = le_int2(ZTR_FORM_ICHEB);
+ /* Check for boundary cases */
+ if (nwords <= 4) {
+ switch (nwords) {
+ case 4:
+ data[4] = be_int2(be_int2(d16[3])-be_int2(d16[2]));
+ case 3:
+ data[3] = be_int2(be_int2(d16[2])-be_int2(d16[1]));
+ case 2:
+ data[2] = be_int2(be_int2(d16[1])-be_int2(d16[0]));
+ case 1:
+ data[1] = be_int2(d16[0]);
+ }
+ *data_len = nwords*2;
+ return (char *)data;
+ }
+
+ /* First 4 values are just direct deltas */
+ data[1] = be_int2(d16[0]);
+ data[2] = be_int2(be_int2(d16[1])-be_int2(d16[0]));
+ data[3] = be_int2(be_int2(d16[2])-be_int2(d16[1]));
+ data[4] = be_int2(be_int2(d16[3])-be_int2(d16[2]));
+ datap = 5;
+
+ /* Loop */
+ for (i = 4; i < nwords; i++) {
+ int dd, f[5];
+ signed int coef[4];
+ signed short diff;
+ int p;
+
+ /*
+ * FIXME: As an alternative to the range checking below, if we
+ * scale dptr[X] such that it's never higher than 2800 then
+ * the 32-bit arithmetic will never overflow. Practically speaking,
+ * all observed ABI and Megabace files have vales up to 1600 only.
+ */
+
+ /*
+ * frac[N] is always paired with frac[4-N], summing to 1.0 - or
+ * 150 when scaled.
+ * Hence f[0] has range 0 to 65536*150.
+ */
+ f[0] = ((unsigned short)be_int2(dptr[2]))*frac[4] +
+ ((unsigned short)be_int2(dptr[3]))*frac[0];
+ f[1] = ((unsigned short)be_int2(dptr[2]))*frac[3] +
+ ((unsigned short)be_int2(dptr[3]))*frac[1];
+ f[2] = ((unsigned short)be_int2(dptr[1]))*frac[2] +
+ ((unsigned short)be_int2(dptr[2]))*frac[2];
+ f[3] = ((unsigned short)be_int2(dptr[0]))*frac[1] +
+ ((unsigned short)be_int2(dptr[1]))*frac[3];
+ f[4] = ((unsigned short)be_int2(dptr[0]))*frac[0] +
+ ((unsigned short)be_int2(dptr[1]))*frac[4];
+
+ /*
+ * fz[z+0..5] sums to no more than 210 (5*42) and no less than 0.
+ * Therefore coef[l] has range 0 to 65536*150*210, which (just)
+ * fits in 31-bits, plus 1 for the sign.
+ */
+ for (z = l = 0; l < 4; l++, z+=5)
+ coef[l] = (f[0] * fz[z+0] +
+ f[1] * fz[z+1] +
+ f[2] * fz[z+2] +
+ f[3] * fz[z+3] +
+ f[4] * fz[z+4]);
+
+ /*
+ * computing p requires at most a temporary variable of
+ * 24.1 * coef, but coef may be a full 32-bit integer.
+ * If coef is sufficiently close to cause an integer overflow then
+ * we scale it down.
+ */
+ {
+ int max = 0;
+
+ for (l = 0; l < 4; l++) {
+ if (max < ABS(coef[l]))
+ max = ABS(coef[l]);
+ }
+
+
+ if (max > 1<<26) {
+ dfac = max / (1<<26) + 1;
+ for (l = 0; l < 4; l++)
+ coef[l] /= dfac;
+ } else {
+ dfac = 1;
+ }
+ }
+
+ dd = (coef[3]/3)*10+coef[2];
+ p = ((((dd/3)*10-coef[3]+coef[1])/3)*5-dd+coef[0]/2)/(CH1*CH2);
+ p *= dfac;
+
+ if (p < 0) p = 0;
+ diff = be_int2(dptr[4]) - p;
+ data[datap++] = be_int2(diff);
+
+ dptr++;
+ }
+
+ *data_len = datap*2;
+
+ return (char *)data;
+}
+
+char *ichebuncomp(char *comp, int comp_len, int *uncomp_len)
+{
+ int i, l, z;
+ int frac[5] = {139,57,75,93,11};
+ int fz[20] = {42, 42, 42, 42, 42,
+ 39, 24, 0,-24,-39,
+ 33,-12,-42,-12, 33,
+ 24,-39, 0, 39,-24};
+ signed short *d16 = (signed short *)comp;
+ int nwords = comp_len / 2 - 1;
+ signed short *data = (signed short *)xmalloc(comp_len);
+ short *dptr = data, *dptr2 = d16;
+ int dfac;
+
+ /* Check for boundary cases */
+ if (nwords <= 4) {
+ switch (nwords) {
+ case 4:
+ data[0] = be_int2(d16[1]);
+ data[1] = be_int2(be_int2(d16[2])+be_int2(data[0]));
+ data[2] = be_int2(be_int2(d16[3])+be_int2(data[1]));
+ data[3] = be_int2(be_int2(d16[4])+be_int2(data[2]));
+ break;
+ case 3:
+ data[0] = be_int2(d16[1]);
+ data[1] = be_int2(be_int2(d16[2])+be_int2(data[0]));
+ data[2] = be_int2(be_int2(d16[3])+be_int2(data[1]));
+ break;
+ case 2:
+ data[0] = be_int2(d16[1]);
+ data[1] = be_int2(be_int2(d16[2])+be_int2(data[0]));
+ break;
+ case 1:
+ data[0] = be_int2(d16[1]);
+ break;
+ }
+ *uncomp_len = nwords*2;
+ return (char *)data;
+ }
+
+ /* First 4 values are just direct deltas */
+ data[0] = be_int2(d16[1]);
+ data[1] = be_int2(be_int2(d16[2])+be_int2(data[0]));
+ data[2] = be_int2(be_int2(d16[3])+be_int2(data[1]));
+ data[3] = be_int2(be_int2(d16[4])+be_int2(data[2]));
+ dptr2 += 5;
+
+ /* Loop */
+ for (i = 4; i < nwords; i++) {
+ int dd, coef[5], f[5];
+ signed short diff;
+ int p;
+
+ f[0] = ((unsigned short)be_int2(dptr[2]))*frac[4] +
+ ((unsigned short)be_int2(dptr[3]))*frac[0];
+ f[1] = ((unsigned short)be_int2(dptr[2]))*frac[3] +
+ ((unsigned short)be_int2(dptr[3]))*frac[1];
+ f[2] = ((unsigned short)be_int2(dptr[1]))*frac[2] +
+ ((unsigned short)be_int2(dptr[2]))*frac[2];
+ f[3] = ((unsigned short)be_int2(dptr[0]))*frac[1] +
+ ((unsigned short)be_int2(dptr[1]))*frac[3];
+ f[4] = ((unsigned short)be_int2(dptr[0]))*frac[0] +
+ ((unsigned short)be_int2(dptr[1]))*frac[4];
+
+ for (z = l = 0; l < 4; l++, z+=5)
+ coef[l] = f[0] * fz[z+0] +
+ f[1] * fz[z+1] +
+ f[2] * fz[z+2] +
+ f[3] * fz[z+3] +
+ f[4] * fz[z+4];
+
+ /*
+ * computing p requires at most a temporary variable of
+ * 24.1 * coef, but coef may be a full 32-bit integer.
+ * If coef is sufficiently close to cause an integer overflow then
+ * we scale it down.
+ */
+ {
+ int max = 0;
+
+ for (l = 0; l < 4; l++) {
+ if (max < ABS(coef[l]))
+ max = ABS(coef[l]);
+ }
+
+
+ if (max > 1<<26) {
+ dfac = max / (1<<26) + 1;
+ for (l = 0; l < 4; l++)
+ coef[l] /= dfac;
+ } else {
+ dfac = 1;
+ }
+ }
+
+ dd = (coef[3]/3)*10+coef[2];
+ p = ((((dd/3)*10-coef[3]+coef[1])/3)*5-dd+coef[0]/2)/(CH1*CH2);
+ p *= dfac;
+
+ if (p < 0) p = 0;
+ diff = be_int2(*dptr2) + p;
+ dptr[4] = be_int2(diff);
+
+ dptr++;
+ dptr2++;
+ }
+
+ *uncomp_len = nwords*2;
+ return (char *)data;
+}
diff --git a/src/Staden/read/compression.h b/src/Staden/read/compression.h
new file mode 100644
index 0000000..b1f16f8
--- /dev/null
+++ b/src/Staden/read/compression.h
@@ -0,0 +1,271 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _COMPRESSION_H_
+#define _COMPRESSION_H_
+
+#include "os.h"
+#include "zlib.h"
+
+/*
+ * zlib_huff()
+ *
+ * Compresses data using huffman encoding, as implemented by zlib.
+ *
+ * Arguments:
+ * uncomp Uncompressed input data
+ * uncomp_len Length of uncomp data
+ * comp_len Output: length of compressed data
+ *
+ * Returns:
+ * Compressed data if successful
+ * NULL if not successful
+ */
+char *zlib_huff(char *uncomp, int uncomp_len, int strategy, int *comp_len);
+
+/*
+ * zlib_dehuff()
+ *
+ * Uncompresses data using huffman encoding, as implemented by zlib.
+ *
+ * Arguments:
+ * comp Compressed input data
+ * comp_len Length of comp data
+ * uncomp_len Output: length of uncompressed data
+ *
+ * Returns:
+ * Uncompressed data if successful
+ * NULL if not successful
+ */
+char *zlib_dehuff(char *comp, int comp_len, int *uncomp_len);
+
+/*
+ * Run length encoding.
+ *
+ * Any run of 3 or more identical characters (up to 255 in a row) are replaced
+ * by "255" followed by the number of characters followed by the character
+ * value itself.
+ * Any single 255 values are escaped using 255 255.
+ *
+ * Arguments:
+ * uncomp Input data
+ * uncomp_len Length of input data 'uncomp'
+ * guard Guard byte - used to encode "N" copies of data
+ * comp_len Output: length of compressed data
+ *
+ * Returns:
+ * Compressed data if successful
+ * NULL if not successful
+ */
+char *rle(char *uncomp, int uncomp_len, int guard, int *comp_len);
+
+/*
+ * Reverses run length encoding.
+ *
+ * Arguments:
+ * comp Compressed input data
+ * comp_len Length of comp data
+ * uncomp_len Output: length of uncompressed data
+ *
+ * Returns:
+ * Uncompressed data if successful
+ * NULL if not successful
+ */
+char *unrle(char *comp, int comp_len, int *uncomp_len);
+
+/*
+ * decorrelate1()
+ *
+ * Produce successive deltas from a 1-byte array.
+ *
+ * Arguments:
+ * uncomp Uncompressed data
+ * uncomp_len Length of uncompressed data
+ * level Differencing level (must be 1, 2 or 3)
+ * comp_len Return: where to store new compressed length
+ *
+ * Returns:
+ * Success: A decorrelated buffer (malloced)
+ * Failure: NULL
+ */
+char *decorrelate1(char *uncomp, int uncomp_len, int level, int *comp_len);
+char *decorrelate1dyn(char *s_uncomp, int uncomp_len, int *comp_len);
+
+/*
+ * recorrelate1()
+ *
+ * The reverse of decorrelate1()
+ *
+ * Arguments:
+ * comp Compressed input data
+ * comp_len Length of comp data
+ * uncomp_len Output: length of uncompressed data
+ *
+ * Returns:
+ * Success: uncompressed data
+ * Failure: NULL
+ */
+char *recorrelate1(char *comp, int comp_len, int *uncomp_len);
+
+/*
+ * decorrelate2()
+ *
+ * Produce successive deltas from a 2-byte array (big endian)
+ *
+ * Arguments:
+ * uncomp Uncompressed data
+ * uncomp_len Length of uncompressed data
+ * level Differencing level (must be 1, 2 or 3)
+ * comp_len Return: where to store new compressed length
+ *
+ * Returns:
+ * Success: A decorrelated buffer (malloced)
+ * Failure: NULL
+ */
+char *decorrelate2(char *uncomp, int uncomp_len, int level, int *comp_len);
+char *decorrelate2dyn(char *s_uncomp, int uncomp_len, int *comp_len);
+
+/*
+ * recorrelate2()
+ *
+ * The reverse of decorrelate2()
+ *
+ * Arguments:
+ * comp Compressed input data
+ * comp_len Length of comp data
+ * uncomp_len Output: length of uncompressed data
+ *
+ * Returns:
+ * Success: uncompressed data
+ * Failure: NULL
+ */
+char *recorrelate2(char *comp, int comp_len, int *uncomp_len);
+
+/*
+ * decorrelate4()
+ *
+ * Produce successive deltas from a 4-byte array (big endian)
+ *
+ * Arguments:
+ * uncomp Uncompressed data
+ * uncomp_len Length of uncompressed data
+ * level Differencing level (must be 1, 2 or 3)
+ * comp_len Return: where to store new compressed length
+ *
+ * Returns:
+ * Success: A decorrelated buffer (malloced)
+ * Failure: NULL
+ */
+char *decorrelate4(char *uncomp, int uncomp_len, int level, int *comp_len);
+
+/*
+ * recorrelate4()
+ *
+ * The reverse of decorrelate4()
+ *
+ * Arguments:
+ * comp Compressed input data
+ * comp_len Length of comp data
+ * uncomp_len Output: length of uncompressed data
+ *
+ * Returns:
+ * Success: uncompressed data
+ * Failure: NULL
+ */
+char *recorrelate4(char *comp, int comp_len, int *uncomp_len);
+
+/*
+ * shrink_16to8()
+ *
+ * Stores an array of 16-bit (big endian) array elements in an 8-bit array.
+ * We assume that most 16-bit elements encode numbers that fit in an 8-bit
+ * value. When not possible, we store a marker followed by the 16-bit value
+ * stored as multiple 8-bit values.
+ *
+ * uncomp Uncompressed data
+ * uncomp_len Length of uncompressed data (in bytes)
+ * comp_len Return: where to store new compressed length
+ *
+ * Returns:
+ * Success: An 8-bit array (malloced)
+ * Failure: NULL
+ */
+char *shrink_16to8(char *uncomp, int uncomp_len, int level, int *comp_len);
+
+/*
+ * expand_8to16()
+ *
+ * The opposite of the shrink_16to8() function.
+ *
+ * comp Compressed input data
+ * comp_len Length of comp data (in bytes)
+ * uncomp_len Output: length of uncompressed data (in bytes)
+ *
+ * Returns:
+ * Success: Uncompressed data (char *)
+ * Failure: NULL
+ */
+char *expand_8to16(char *comp, int comp_len, int *uncomp_len);
+
+/*
+ * shrink_32to8()
+ *
+ * Stores an array of 32-bit (big endian) array elements in an 8-bit array.
+ * We assume that most 32-bit elements encode numbers that fit in an 8-bit
+ * value. When not possible, we store a marker followed by the 32-bit value
+ * stored as multiple 8-bit values.
+ *
+ * uncomp Uncompressed data
+ * uncomp_len Length of uncompressed data (in bytes)
+ * comp_len Return: where to store new compressed length
+ *
+ * Returns:
+ * Success: An 8-bit array (malloced)
+ * Failure: NULL
+ */
+char *shrink_32to8(char *uncomp, int uncomp_len, int level, int *comp_len);
+
+/*
+ * expand_8to32()
+ *
+ * The opposite of the shrink_32to8() function.
+ *
+ * comp Compressed input data
+ * comp_len Length of comp data (in bytes)
+ * uncomp_len Output: length of uncompressed data (in bytes)
+ *
+ * Returns:
+ * Success: Uncompressed data (char *)
+ * Failure: NULL
+ */
+char *expand_8to32(char *comp, int comp_len, int *uncomp_len);
+
+char *follow1(char *s_uncomp,
+ int uncomp_len,
+ int level,
+ int *comp_len);
+
+char *unfollow1(char *s_comp,
+ int comp_len,
+ int *uncomp_len);
+
+char *ichebcomp(char *uncomp,
+ int uncomp_len,
+ int *data_len);
+
+char *ichebuncomp(char *comp,
+ int comp_len,
+ int *uncomp_len);
+
+#endif /* _COMPRESSION_H_ */
diff --git a/src/Staden/read/ctfCompress.c b/src/Staden/read/ctfCompress.c
new file mode 100644
index 0000000..453022b
--- /dev/null
+++ b/src/Staden/read/ctfCompress.c
@@ -0,0 +1,1452 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/* File: ctftrace.c
+ %W% %G%
+*/
+
+#include <stdlib.h>
+#include <string.h>
+
+#define ACEDB4
+
+#define A_ 1
+#define T_ 2
+#define G_ 4
+#define C_ 8
+
+/*#include "regular.h"
+#include "keyset.h"
+#include "dna.h"
+*/
+#include "array.h"
+#include "Read.h"
+
+/*
+ * #defines to modify this file to compile easily as part of the Staden
+ * Package io_lib.
+ */
+#define freeSeq(_s) (read_deallocate(_s), (_s) = 0)
+#define seqMax(_seq) ((_seq)->NPoints )
+#define seqMaxBase(_seq) ((_seq)->NBases)
+
+#define xmalloc malloc
+#define xcalloc calloc
+#define xrealloc realloc
+#define xfree free
+
+#define arrayCreate(s,t) ArrayCreate(sizeof(t),(s))
+#define array(a,n,t) ARR(t,a,n)
+#define arrayMax ArrayMax
+#define arrayDestroy ArrayDestroy
+#undef arrp
+#define arrp(a,n,t) \
+ &((t*)((a)->base))[n]
+#define arrayReCreate(a,n,t) arrayCreate(n,t)
+#define arrayExists(a) ((a)->base != NULL)
+
+#define BOOL int
+#define mysize_t size_t
+#define FALSE 0
+#define TRUE 1
+
+
+#define MAGIC 523747
+#define PREDICTIONMODE 3 /* predictor degree */
+#define COMPRESSIONMODE 3 /* compressor version */
+
+char *ctfType = 0 ;
+
+/**********************************************************/
+/**********************************************************/
+
+static int ctfTracePeakValue ( Read *seq)
+{
+ int i, ii, max = 0 ;
+ TRACE *bp[4], *u ;
+
+ bp[0] = seq->traceA ;
+ bp[1] = seq->traceC ;
+ bp[2] = seq->traceG ;
+ bp[3] = seq->traceT ;
+
+ ii = 4 ;
+ while (ii--)
+ {
+ u = bp[ii] - 1 ;
+ i = seqMax(seq) ;
+ while (u++, i--)
+ if (*u > max) max = *u ;
+ }
+
+ seq->maxTraceVal = max ;
+ return max ;
+}
+
+/**********************************************************/
+/* get/store in sex independant way */
+static int ctfGetInt (unsigned char *cp)
+{
+ int n = 0, i = 4 ;
+
+ while (i--)
+ { n <<= 8 ; n |= *cp++ ; }
+ return n ;
+}
+
+/**********/
+
+static void ctfStoreInt (unsigned char *cp, int n)
+{
+ int i = 4 ;
+
+ cp += 4 ;
+ while (cp--, i--)
+ { *cp = n & 0xff ; n >>= 8 ; }
+}
+
+/**********************************************************/
+/**********************************************************/
+/* Method zero
+ store the shorts as a pair of char
+*/
+static Array ctfCompress0 (Array a)
+{
+ int i = arrayMax (a) ;
+ Array b = arrayCreate (2 * i, unsigned char) ; /* always true */
+ unsigned char *cp, *cp0 ;
+ short *sp, z ;
+
+ array (b, 2*i - 1 , unsigned char) = 0 ; /* make room */
+ cp = cp0 = arrp (b , 0, unsigned char) ;
+ sp = arrp (a, 0, short) ;
+
+ while (i--)
+ {
+ z = *sp++ ;
+ *cp++ = (z >> 8) & 0xff ;
+ *cp++ = z & 0xff ;
+ }
+ arrayMax(b) = cp - cp0 ;
+ return b ;
+}
+
+/**********************************************************/
+
+static Array ctfDecompress0 (int dataMax, int shMax,
+ unsigned char *cp)
+{
+ int i = shMax ;
+ Array b = 0 ;
+ short *sp ;
+
+ if (dataMax != 2 * shMax)
+ return 0 ;
+
+ b = arrayCreate (shMax, short) ;
+ array (b, shMax - 1, short) = 0 ; /* make room */
+ sp = arrp (b, 0, short) ;
+
+ while (i--)
+ {
+ *sp++ = ((*cp)<< 8) | (*(cp + 1)) ;
+ cp += 2 ;
+ }
+ return b ;
+}
+
+/**********************************************************/
+/**********************************************************/
+/* Method one
+ converts short s to unsigned char cc:
+ if s in range -126, +126, cc = s + 128
+ else transmit 0xFF then value on 2 bytes
+*/
+static Array ctfCompress1 (Array a)
+{
+ int i = arrayMax (a), j ;
+ Array b = arrayCreate (3 *i, char) ; /* unreliable size, use arrayp */
+ short *sp, z ;
+
+ array (b, 3*i - 1 , unsigned char) = 0 ; /* make room */
+ j = 0 ;
+ sp = arrp (a, 0, short) ;
+
+ while (i--)
+ {
+ z = *sp++ + 128 ;
+ while (z >= 254) { z -= 252 ; array (b , j++, unsigned char) = 254 ;}
+ while (z <= 1) { z += 252 ; array (b , j++, unsigned char) = 1 ; }
+ array (b , j++, unsigned char) = z ;
+ }
+ arrayMax (b) = j ;
+ return b ;
+}
+
+/**********************************************************/
+
+static Array ctfDecompress1 (int dataMax, int shMax,
+ unsigned char *cp)
+{
+ int i = dataMax, dz = 0 ;
+ short *sp, *spMax ;
+ Array b = arrayCreate (shMax, short) ;
+
+ array (b, shMax - 1, short) = 0 ; /* make room */
+ sp = arrp (b, 0, short) ;
+ spMax = sp + shMax ;
+
+ cp-- ;
+ while (cp++, i-- && sp < spMax)
+ switch (*cp)
+ {
+ case 1: dz -= 252 ; break ;
+ case 254: dz += 252 ; break ;
+ default: *sp++ = dz + *cp - 128 ; dz = 0 ; break ;
+ }
+ if (i != -1 || sp != spMax)
+ arrayDestroy (b) ;
+ return b ;
+}
+
+/**********************************************************/
+/**********************************************************/
+/* Method two
+ convert strings of zeroes as single chars
+ small values as 7 bit codes
+ rest as shorts in next 2 bytes
+*/
+
+static Array ctfCompress2 (Array a)
+{
+ int n0, n1, n2, n3, n4 ;
+ int i = arrayMax (a), j = 0 ;
+ Array b = arrayCreate (3 *i, char) ; /* worst case */
+ unsigned char *cp, *cp0 ;
+ short *sp, z ;
+
+ array (b, 3*i - 1 , unsigned char) = 0 ; /* make room */
+ cp = cp0 = arrp (b , 0, unsigned char) ;
+ sp = arrp (a, 0, short) ;
+
+ n0 = n1 = n2 = n3 = n4 = 0 ;
+ while (i--)
+ {
+ z = *sp++ ;
+ if (!z) /* string of zeroes */
+ {
+ j =1 ;
+ while (i > 0 && j < 126 && !(*sp)) { j++ ; sp++; i-- ; } ;
+ *cp++ = (j & 0x7f) ; /* bit 1 = 0 */
+ n0 += j ; n1++ ;
+ }
+ else if ( z < 63 && z > - 63)
+ {
+ j = z + 63 ; /* range 1 ... 125 */
+ *cp++ = 0x80 | (j & 0x7f) ;
+ n2++ ;
+ }
+ else if ( z < 128 && z > -129)
+ {
+ j = z + 128 ; /* range 0 ... 255 */
+ *cp++ = 0x80 | 126 ;
+ *cp++ = j & 0xff ;
+ n3++ ;
+ }
+ else
+ {
+ j = z ;
+ *cp++ = 0x80 | 127 ;
+ *cp++ = (j >> 8) & 0xff ;
+ *cp++ = j & 0xff ;
+ n4++ ;
+ }
+ }
+ arrayMax(b) = cp - cp0 ;
+ printf ("compress2 : %d zeros in %d bytes, %d < 7 , %d byte, %d short total %d char for %d shrt\n",
+ n0, n1, n2, n3, n4, arrayMax(b), arrayMax(a)) ;
+ return b ;
+}
+/*
+compress2 :
+ 12338 zeros in 3328 bytes, 14616 < 7 , 23 byte, 3 short
+ total 17999 char for 26980 shrt
+*/
+
+/**********************************************************/
+
+static Array ctfDecompress2 (int dataMax, int shMax,
+ unsigned char *cp)
+{
+ int i = dataMax, mode, arg ;
+ unsigned char cc, cc1, cc2 ;
+ short *sp, *spMax ;
+ Array b = arrayCreate (shMax, short) ;
+
+ array (b, shMax - 1, short) = 0 ; /* make room */
+ sp = arrp (b, 0, short) ;
+ spMax = sp + shMax ;
+
+ while (i-- && sp < spMax)
+ {
+ cc = *cp++ ;
+ mode = cc & 0x80 ; arg = cc & 0x7f ;
+ switch (mode)
+ {
+ case 0: /* initial zero = string of zero */
+ while (arg-- && sp < spMax) *sp++ = 0 ;
+ break ;
+ case 0x80:
+ switch (arg)
+ {
+ case 127: /* next 2 bytes is a short */
+ i -= 2 ;
+ cc1 = *cp++ ; cc2 = *cp++ ;
+ *sp++ = (cc1 << 8) | cc2 ;
+ break ;
+ case 126: /* next byte is a byte */
+ i-- ;
+ cc1 = *cp++ ;
+ *sp++ = cc1 - 128 ;
+ break ;
+ default: /* 7 bytes is sufficient */
+ *sp++ = arg - 63 ;
+ break ;
+ }
+ }
+ }
+ if (i != -1 || sp != spMax)
+ arrayDestroy (b) ;
+ return b ;
+}
+
+/**********************************************************/
+/**********************************************************/
+/* Method two
+ convert strings of zeroes as single chars
+ small values as 7 bit codes
+ rest as shorts in next 2 bytes
+*/
+
+/**********************************************************/
+/* create a code for the 125 most frequent words */
+static void ctfCompress3Init (Array *aap, int **lp, int **mp, int *maxCodep)
+{
+ short *sp ; int i, j, k, n ;
+ static int lng[128], mark[128], maxCode = 0 ;
+ static Array aa = 0 ;
+
+
+ *aap = aa ; *lp = lng ; *mp = mark ; *maxCodep = maxCode ;
+ if (aa) return ;
+ *aap = aa = arrayCreate (512, short) ;
+ array (aa, 511, short) = 0 ; /* make room */
+ sp = arrp (aa, 0, short) ;
+ j = 0 ;
+
+ i = 0 ; /* empty word */
+ mark[i] = j ; n = 0 ; j += lng[i] ;
+
+ /* single values up to +- 8 */
+ for (k = 1 ; i < 126 && k < 12 ; k++)
+ {
+ i++ ;
+ mark[i] = j ; *sp++ = k ;
+ lng [i] = 1 ; j++ ;
+ i++ ;
+ mark[i] = j ; *sp++ = -k ;
+ lng [i] = 1 ; j++ ;
+ }
+ /* double values up to 50 */
+ for (k = 1 ; i < 126 && k < 6 ; k++)
+ {
+ i++ ;
+ mark[i] = j ; *sp++ = k ; *sp++ = 0 ;
+ lng [i] = 2 ; j += 2 ;
+ i++ ;
+ mark[i] = j ; *sp++ = -k ; *sp++ = 0 ;
+ lng [i] = 2 ; j += 2 ;
+ }
+ /* double values up to 51 */
+ for (k = 1 ; i < 126 && k < 6 ; k++)
+ {
+ i++ ;
+ mark[i] = j ; *sp++ = k ; *sp++ = 1 ;
+ lng [i] = 2 ; j += 2 ;
+ i++ ;
+ mark[i] = j ; *sp++ = -k ; *sp++ = 1 ;
+ lng [i] = 2 ; j += 2 ;
+ }
+ /* double values up to 5-1 */
+ for (k = 1 ; i < 126 && k < 6 ; k++)
+ {
+ i++ ;
+ mark[i] = j ; *sp++ = k ; *sp++ = -1 ;
+ lng [i] = 2 ; j += 2 ;
+ i++ ;
+ mark[i] = j ; *sp++ = -k ; *sp++ = -1 ;
+ lng [i] = 2 ; j += 2 ;
+ }
+ /* double values up to 15 */
+ for (k = 1 ; i < 126 && k < 6 ; k++)
+ {
+ i++ ;
+ mark[i] = j ; *sp++ = 1 ; *sp++ = k ;
+ lng [i] = 2 ; j += 2 ;
+ i++ ;
+ mark[i] = j ; *sp++ = 1 ; *sp++ = -k ;
+ lng [i] = 2 ; j += 2 ;
+ }
+ /* double values up to -15 */
+ for (k = 1 ; i < 126 && k < 6 ; k++)
+ {
+ i++ ;
+ mark[i] = j ; *sp++ = -1 ; *sp++ = k ;
+ lng [i] = 2 ; j += 2 ;
+ i++ ;
+ mark[i] = j ; *sp++ = -1 ; *sp++ = -k ;
+ lng [i] = 2 ; j += 2 ;
+ }
+ /* triple values up to 111 */
+
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 0 ; *sp++ = 1 ;
+ lng [i] = 3 ; j += 3 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 0 ; *sp++ = -1 ;
+ lng [i] = 3 ; j += 3 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 1 ; *sp++ = 1 ;
+ lng [i] = 3 ; j += 3 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 1 ; *sp++ = -1 ;
+ lng [i] = 3 ; j += 3 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = -1 ; *sp++ = 1 ;
+ lng [i] = 3 ; j += 3 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = -1 ; *sp++ = 1 ;
+ lng [i] = 3 ; j += 3 ;
+
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 0 ; *sp++ = 1 ;
+ lng [i] = 3 ; j += 3 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 0 ; *sp++ = -1 ;
+ lng [i] = 3 ; j += 3 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 1 ; *sp++ = 1 ;
+ lng [i] = 3 ; j += 3 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 1 ; *sp++ = -1 ;
+ lng [i] = 3 ; j += 3 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = -1 ; *sp++ = 1 ;
+ lng [i] = 3 ; j += 3 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = -1 ; *sp++ = 1 ;
+ lng [i] = 3 ; j += 3 ;
+
+ /* quadruple values up to 1111 */
+
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 0 ; *sp++ = 0 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 0 ; *sp++ = 1 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 0 ; *sp++ = -1 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 1 ; *sp++ = 0 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 1 ; *sp++ = 1 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 1 ; *sp++ = -1 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = -1 ; *sp++ = 0 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = -1 ; *sp++ = 1 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = -1 ; *sp++ = -1 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 0 ; *sp++ = 0 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 0 ; *sp++ = 1 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 0 ; *sp++ = -1 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 1 ; *sp++ = 0 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 1 ; *sp++ = 1 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 1 ; *sp++ = -1 ; *sp++ =- 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = -1 ; *sp++ = 0 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = -1 ; *sp++ = 1 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = -1 ; *sp++ = -1 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 0 ; *sp++ = 0 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 0 ; *sp++ = 1 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 0 ; *sp++ = -1 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 1 ; *sp++ = 0 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 1 ; *sp++ = 1 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 1 ; *sp++ = -1 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = -1 ; *sp++ = 0 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = -1 ; *sp++ = 1 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = -1 ; *sp++ = -1 ; *sp++ = 1 ;
+ lng [i] = 4 ; j += 4 ;
+
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 0 ; *sp++ = 0 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 0 ; *sp++ = 1 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 0 ; *sp++ = -1 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 1 ; *sp++ = 0 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 1 ; *sp++ = 1 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 1 ; *sp++ = -1 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = -1 ; *sp++ = 0 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = -1 ; *sp++ = 1 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = -1 ; *sp++ = -1 ; *sp++ = -1 ;
+ lng [i] = 4 ; j += 4 ;
+
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 0 ; *sp++ = 0 ; *sp++ = 0 ; *sp++ = 1 ;
+ lng [i] = 5 ; j += 5 ;
+ i++ ; mark[i] = j ; *sp++ = 1 ; *sp++ = 0 ; *sp++ = 0 ; *sp++ = 0 ; *sp++ = -1 ;
+ lng [i] = 5 ; j += 5 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 0 ; *sp++ = 0 ; *sp++ = 0 ; *sp++ = 1 ;
+ lng [i] = 5 ; j += 5 ;
+ i++ ; mark[i] = j ; *sp++ = -1 ; *sp++ = 0 ; *sp++ = 0 ; *sp++ = 0 ; *sp++ = -1 ;
+ lng [i] = 5 ; j += 5 ;
+
+ if (i >= 126)
+ { fprintf (stderr, "FATAL ERROR, ctfCompress3Init i=%d > 126", i) ;
+ exit (1) ;
+ }
+ if (j > 511)
+ {
+ fprintf (stderr, "FATAL ERROR, ctfCompress3Init j=%d > 511", j) ;
+ exit (1) ;
+ }
+ *maxCodep = maxCode = i ;
+}
+
+/**********************************************************/
+
+static Array ctfCompress3 (Array a)
+{
+ int n0, n1, n10, n2, n3, n4 ;
+ int i = arrayMax (a), j = 0, n ;
+ Array b = arrayCreate (3 *i, char) ; /* worst case */
+ unsigned char *cp, *cp0 ;
+ short *sp, *sp1, *wp, z ;
+ int w, *lng, *mark, maxCode ;
+ Array aa = 0 ;
+ BOOL debug = FALSE ;
+
+ ctfCompress3Init (&aa, &lng, &mark, &maxCode) ;
+
+ array (b, 3*i - 1 , unsigned char) = 0 ; /* make room */
+ cp = cp0 = arrp (b , 0, unsigned char) ;
+ sp = arrp (a, 0, short) ;
+
+ n0 = n1 = n10 = n2 = n3 = n4 = 0 ;
+ while (i--)
+ {
+ z = *sp++ ;
+ if (!z) /* string of zeroes */
+ {
+ j =1 ;
+ while (i > 0 && j < 126 && !(*sp)) { j++ ; sp++; i-- ; } ;
+ *cp++ = j & 0x7f ; /* bit 1 = 0 */
+ n0 += j ; n1++ ;
+ continue ;
+ }
+ /* search for code word */
+ for (w = maxCode ; w > 1 ; w--) /* w-- favors long code words */
+ {
+ n = lng[w] ; wp = arrp (aa, mark[w], short) ; sp1 = sp - 1 ;
+ while (n-- && *wp++ == *sp1++) ;
+ if (n == -1) break ;
+ }
+ if (w > 1 && lng[w] < i) /* code word found */
+ {
+ n2++ ; n10 += lng[w] ; *cp++ = 0x80 | (w & 0x7f) ;
+ sp += lng[w] - 1 ; i -= lng[w] - 1 ;
+ if (lng[w] <= 0)
+ {
+ fprintf (stderr, "FATAL ERROR in ctfCompress3 bad coding lng[w]") ;
+ exit (1) ;
+ }
+ }
+ else if ( z < 128 && z > -129) /* transmit byte */
+ {
+ j = z + 128 ; /* range 0 ... 255 */
+ *cp++ = 0x80 | 126 ;
+ *cp++ = j & 0xff ;
+ n3++ ;
+ }
+ else /* transmit short */
+ {
+ j = z ;
+ *cp++ = 0x80 | 127 ;
+ *cp++ = (j >> 8) & 0xff ;
+ *cp++ = j & 0xff ;
+ n4++ ;
+ }
+ }
+ arrayMax(b) = cp - cp0 ;
+ if (debug)
+ printf (" // compress3:\n// %d zeros in %d bytes, %d values coded in %d byte, %d bytes, %d short. \n// Total %d char for %d shrt\n",
+ n0, n1, n10, n2, n3, n4, arrayMax(b), arrayMax(a)) ;
+ if (arrayMax(a) != n0 + n10 + n3 + n4)
+ {
+ fprintf (stderr, "FATAL ERROR in ctfCompress3, codind error in compress 3") ;
+ exit (1) ;
+ }
+ return b ;
+}
+/*
+compress3 :
+//found 10829 zeros in 1865 bytes, 16524 values coded in 9114 byte, 183 bytes, 0 short.
+// Total 11162 char for 27536 shrt
+*/
+
+/**********************************************************/
+
+static Array ctfDecompress3 (int dataMax, int shMax,
+ unsigned char *cp)
+{
+ int i = dataMax, mode, arg, n ;
+ unsigned char cc, cc1, cc2 ;
+ short *sp, *spMax, *wp ;
+ Array b = arrayCreate (shMax, short) ;
+ int *lng, *mark, maxCode ;
+ Array aa = 0 ;
+ int n0, n1, n10, n2, n3, n4 ;
+ BOOL debug = FALSE ;
+
+ ctfCompress3Init (&aa, &lng, &mark, &maxCode) ;
+
+ array (b, shMax - 1, short) = 0 ; /* make room */
+ sp = arrp (b, 0, short) ;
+ spMax = sp + shMax ;
+ n0 = n1 = n10 = n2 = n3 = n4 = 0 ;
+
+ while (i-- && sp < spMax)
+ {
+ cc = *cp++ ;
+ mode = cc & 0x80 ; arg = cc & 0x7f ;
+ switch (mode)
+ {
+ case 0: /* initial zero = string of zero */
+ if (arg <= 0) /* should not happen */
+ {
+ fprintf (stderr,"bad decompress3") ;
+ goto abort ;
+ }
+ n1++ ; n0 += arg ;
+ while (arg-- && sp < spMax) *sp++ = 0 ;
+ break ;
+ case 0x80:
+ switch (arg)
+ {
+ case 127: /* next 2 bytes is a short */
+ i -= 2 ; /* I need 3 bytes to code a short */
+ cc1 = *cp++ ; cc2 = *cp++ ;
+ *sp++ = (cc1 << 8) | cc2 ;
+ n4++ ;
+ break ;
+ case 126: /* next byte is a byte */
+ i-- ; /* I need 2 bytes to code a char */
+ cc1 = *cp++ ;
+ *sp++ = cc1 - 128 ;
+ n3++ ;
+ break ;
+ default: /* 7 bytes is a code */
+ n = lng[arg] ;
+ n2++ ; n10 += n ;
+ wp = arrp (aa, mark[arg], short) ;
+ while (n-- && sp < spMax) *sp++ = *wp++ ;
+ break ;
+ }
+ }
+ }
+ if (debug)
+ printf (" // compress3:\n//found %d zeros in %d bytes, %d values coded in %d byte, %d bytes, %d short. \n// Total %d char for %d shrt\n",
+ n0, n1, n10, n2, n3, n4, n1 + n2 + n3 + n4, n0 + n10 + n3 + n4) ;
+
+ if (i != -1 || sp != spMax)
+ goto abort ;
+ return b ;
+
+abort:
+ arrayDestroy (b) ;
+ return 0 ;
+}
+
+/**********************************************************/
+/**********************************************************/
+
+static Array ctfDecompress (int compressionMode,
+ int dataMax, int traceMax,
+ unsigned char **cpp)
+{
+ Array a = 0 ;
+
+ switch (compressionMode)
+ {
+ case 0:
+ a = ctfDecompress0 (dataMax, 4*traceMax, *cpp) ;
+ break ;
+ case 1:
+ a = ctfDecompress1 (dataMax, 4*traceMax, *cpp) ;
+ break ;
+ case 2:
+ a = ctfDecompress2 (dataMax, 4*traceMax, *cpp) ;
+ break ;
+ case 3:
+ a = ctfDecompress3 (dataMax, 4*traceMax, *cpp) ;
+ break ;
+ default: /* unknown compression mode */
+ break ;
+ }
+
+ *cpp += dataMax ;
+ return a ;
+}
+
+/**********************************************************/
+
+static Array ctfCompress (int compressionMode, Array a)
+{
+ switch (compressionMode)
+ {
+ case 0:
+ return ctfCompress0 (a) ;
+ case 1:
+ return ctfCompress1 (a) ;
+ case 2:
+ return ctfCompress2 (a) ;
+ case 3:
+ return ctfCompress3 (a) ;
+ default:
+ fprintf (stderr,"FATAL ERROR in ctfCompress, Non existing compression mode") ;
+ exit (1) ;
+ return 0 ; /* for compiler happiness */
+ }
+}
+
+/**********************************************************/
+/**********************************************************/
+/* called by saucisse fill, a system to test the efficiency of the system */
+
+Array ctfDecorrelate (Read *read, int predictionMode)
+{
+ int j, j1, u1, u2, u3, u4 ;
+ short *zp, z = 0 ;
+ TRACE *tt[4], *sp ;
+ int traceMax = read->NPoints ;
+ Array a = arrayCreate (4 * traceMax, short) ;
+
+ if (predictionMode == -1)
+ predictionMode = PREDICTIONMODE ;
+
+ tt[0] = read->traceA ;
+ tt[1] = read->traceG ;
+ tt[2] = read->traceC ;
+ tt[3] = read->traceT ;
+
+ array (a, 4 * traceMax - 1 , short) = 0 ; /* make room */
+ zp = arrp (a, 0, short) ;
+ for (j1 = 0 ; j1 < 4 ; j1++)
+ {
+ sp = tt[j1] ;
+
+ u1 = u2 = u3 = u4 = 0 ;
+ for (j=0 ; j < traceMax ; zp++, sp++, j++)
+ {
+ switch (predictionMode)
+ {
+ case 1: z = u1 ; break ; /* predict flat, transmit derivative */
+ case 2: z = 2*u1 - u2 ; break ; /* predict line trans dd2 */
+ case 3: z = 3*u1 - 3*u2 + u3 ; break ; /* predict parabole */
+ case 4: z = 4*u1 - 6*u2 + 4*u3 - u4; break ; /* overpredict ! */
+ case 0:
+ default: z = 0 ; break ; /* predict zero, transmit value */
+ }
+ u4 = u3 ; u3 = u2 ; u2 = u1 ; u1 = *sp ;
+ *zp = u1 - z ;
+ }
+ }
+ return a ;
+}
+
+/**********************************************************/
+
+static BOOL ctfRecorrelate (Read *read, int predictionMode, Array a)
+{
+ int j, j1, u1, u2, u3, u4, z = 0 ;
+ short *zp ;
+ TRACE *sp, *tt[4] ;
+ int traceMax = read->NPoints ;
+
+ if (!a || arrayMax(a) != 4 * traceMax)
+ return FALSE ;
+
+ for (j1 = 0 ; j1 < 4 ; j1++) tt[j1] = 0 ; /* to allow harmless abort */
+ zp = arrp (a, 0, short) ;
+ for (j1 = 0 ; j1 < 4 ; j1++)
+ {
+ /* staden's allocation system */
+ sp = tt[j1] = (TRACE *) malloc(traceMax * sizeof (TRACE)) ;
+ memset (sp, 0, traceMax * sizeof (TRACE)) ;
+ u1 = u2 = u3 = u4 = 0 ;
+ for (j=0 ; j < traceMax ; zp++, sp++, j++)
+ {
+ switch (predictionMode)
+ {
+ case 1: z = u1 ; break ; /* predict flat, transmit derivative */
+ case 2: z = 2*u1 - u2 ; break ; /* predict line trans dd2 */
+ case 3: z = 3*u1 - 3*u2 + u3 ; break ; /* predict parabole */
+ case 4: z = 4*u1 - 6*u2 + 4*u3 - u4; break ; /* overpredict ! */
+ case 0:
+ default: z = 0 ; break ; /* predict zero, transmit value */
+ }
+ u4 = u3 ; u3 = u2 ; u2 = u1 ; u1 = *sp = z + *zp ;
+ }
+ }
+ read->traceA = tt[0];
+ read->traceG = tt[1];
+ read->traceC = tt[2];
+ read->traceT = tt[3];
+
+ return TRUE ;
+}
+
+/**********************************************************/
+/**********************************************************/
+/* returns 0: no probability available
+ 1: single base proba or equal proba on all bases,
+ in this case, fill mixProba
+ 2: independant proba for the various bases
+ */
+
+static int ctfProbInfoLevel (Read *read, unsigned char *mixProb)
+{
+ int i, a, t, g, c, n, probInfoLevel = 0 ;
+
+ n = read->NBases ;
+ probInfoLevel = 0 ; i = 0 ;
+ if (read->prob_A && read->prob_C && read->prob_G && read->prob_T)
+ while (probInfoLevel < 4 && n--)
+ {
+ i = 0 ; a = t = g = c = 0 ;
+ if ((a = read->prob_A [n])) { mixProb[n] = read->prob_A [n] ; i++ ; }
+ if ((c = read->prob_C [n])) { mixProb[n] = read->prob_C [n] ; i++ ; }
+ if ((g = read->prob_G [n])) { mixProb[n] = read->prob_G [n] ; i++ ; }
+ if ((t = read->prob_T [n])) { mixProb[n] = read->prob_T [n] ; i++ ; }
+
+ switch (i)
+ {
+ case 0: break ;
+ case 1: probInfoLevel = 1 ; break ;
+ case 4: if (a == c && a == g && a == t) { probInfoLevel = 1 ; break ; }
+ /* else fall to default */
+ default: probInfoLevel = 4 ; break ;
+ }
+ /*
+ if (p++ < 12 ) fprintf (stderr, "probInfoLevel %d %d %d %d %d \n",
+ probInfoLevel, a, c, g, t) ;
+ */
+ }
+ /* fprintf (stderr, "probInfoLevel %d\n", probInfoLevel) ; */
+ return probInfoLevel ;
+}
+
+/**********************************************************/
+
+static Array ctfPackTraces (Read *read)
+{
+ TRACE *tt[4] ;
+ signed int x, dx;
+ int section, sectionLength ;
+ int i, n, dataMax, probInfoLevel,
+ traceMax = read->NPoints, baseMax = read->NBases,
+ safe0 = 0, safe = 50 ;
+ Array a = 0 , a1 = 0, a2 = 0 ;
+ unsigned char *cp, *b ;
+ unsigned short *bp ;
+ unsigned char * mixProb = 0 ;
+ unsigned char *cq ;
+ Array bb = 0 ;
+ TRACE *ap, *bbp ;
+
+ ctfTracePeakValue (read) ; /* sets read-> maxTraceVal */
+ mixProb = (unsigned char *) malloc (read->NBases) ;
+
+ tt[0] = read->traceA ;
+ tt[1] = read->traceG ;
+ tt[2] = read->traceC ;
+ tt[3] = read->traceT ;
+ probInfoLevel = ctfProbInfoLevel (read, mixProb) ;
+
+lao: /* the idea is that i will never have to loop */
+ safe = 12 * traceMax + 2 * baseMax + probInfoLevel * baseMax + safe0 * traceMax + 64 ;
+ if (a) arrayDestroy (a) ;
+ a = arrayCreate (safe, unsigned char) ;
+ array (a, safe + 150, unsigned char) = 0 ; /* make room */
+ cp = arrp (a, 0, unsigned char) ;
+
+
+ ctfStoreInt (cp, MAGIC) ; cp += 4 ; safe -= 4 ;
+
+ /* SECTION 11 bases */
+ if (!ctfType || strchr(ctfType, '1'))
+ {
+ section = 11 ;
+ sectionLength = baseMax + 8 ;
+ n = baseMax ;
+ ctfStoreInt (cp, section) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, sectionLength) ; cp += 4 ; safe -= 4 ;
+
+ ctfStoreInt (cp, baseMax) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, MAGIC) ; cp += 4 ; safe -= 4 ;
+
+ n = baseMax ; safe -= n ;
+ b = (unsigned char *)read->base ;
+ memcpy (cp, b, n) ; cp += n ;
+
+ ctfStoreInt (cp, MAGIC) ; cp += 4 ; safe -= 4 ;
+ }
+
+ /* SECTION 12 base positions, upgrades old section 1 */
+ if (!ctfType || strchr(ctfType, '1'))
+ {
+ section = 12 ;
+ sectionLength = baseMax + 8 ;
+ n = baseMax ; x = 0 ;
+ bp = read->basePos ;
+ while (n--)
+ {
+ dx = *bp++ - x + 32 ;
+ if (dx < 0 || dx > 255)
+ { sectionLength += 2 ; safe -= 2 ; }
+ }
+ ctfStoreInt (cp, section) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, sectionLength) ; cp += 4 ; safe -= 4 ;
+
+ ctfStoreInt (cp, baseMax) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, MAGIC) ; cp += 4 ; safe -= 4 ;
+
+ n = baseMax ; safe -= n ;
+ x = 0 ;
+ bp = read->basePos ;
+
+ while (n--)
+ {
+ dx = *bp++ - x + 32 ;
+ /* these will smoothe away after a few steps */
+ if (dx < 0)
+ {
+ *cp++ = 254 ; dx = -dx ;
+ *cp++ = (dx >> 8) & 0xff;
+ *cp++ = (dx >> 0) & 0xff;
+ }
+ else if (dx < 254)
+ *cp++ = dx;
+ else /* dx >= 254 */
+ {
+ *cp++ = 255 ;
+ *cp++ = (dx >> 8) & 0xff;
+ *cp++ = (dx >> 0) & 0xff;
+ }
+ x += dx - 32;
+ }
+
+ ctfStoreInt (cp, MAGIC) ; cp += 4 ; safe -= 4 ;
+ }
+
+ /* SECTION 2 the traces */
+ if (!ctfType || strchr(ctfType, '2'))
+ {
+ a1 = ctfDecorrelate (read, PREDICTIONMODE) ;
+ a2 = ctfCompress (COMPRESSIONMODE, a1) ;
+ dataMax = arrayMax (a2) ;
+
+ if (1) /* debugging */
+ {
+ cq = arrp (a2, 0, unsigned char) ;
+ bb = ctfDecompress (COMPRESSIONMODE, dataMax, traceMax, &cq) ;
+ i = 4*traceMax ;
+
+ ap = arrp (a1, 0, TRACE) ;
+ bbp = arrp (bb, 0, TRACE) ;
+ while (i--)
+ if (*ap++ != *bbp++)
+ {
+ fprintf (stderr,
+ "FATAL ERROR bad compress decompress at i = %d\n", i) ;
+ exit (1) ;
+ }
+ arrayDestroy (bb) ;
+ }
+
+ section = 2 ;
+ sectionLength = 16 + dataMax ;
+ ctfStoreInt (cp, section) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, sectionLength) ; cp += 4 ; safe -= 4 ;
+
+ ctfStoreInt (cp, PREDICTIONMODE) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, COMPRESSIONMODE) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, traceMax) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, dataMax) ; cp += 4 ; safe -= 4 ;
+
+ ctfStoreInt (cp, MAGIC) ; cp += 4 ; safe -= 4 ;
+
+ if (safe > dataMax)
+ memcpy (cp, arrp(a2, 0, unsigned char), (mysize_t) dataMax) ;
+ cp += dataMax ; safe -= dataMax ;
+ arrayDestroy (a1) ;
+ arrayDestroy (a2) ;
+ if (safe < 0)
+ { safe0++ ; goto lao ; }
+
+ /* end section */
+ if (safe < 12)
+ { safe0++ ; goto lao ; }
+ ctfStoreInt (cp, MAGIC) ; cp += 4 ; safe -= 4 ;
+ }
+
+
+ /* SECTION 3 miscelaneous info */
+ if (!ctfType || strchr(ctfType, '3'))
+ {
+ section = 3 ;
+
+ if (read->info)
+ n = strlen(read->info) ;
+ else
+ n = 0 ;
+ if (!read->rightCutoff)
+ read->rightCutoff = read->NBases + 1 ;
+
+ sectionLength = 20 + n ;
+ ctfStoreInt (cp, section) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, sectionLength) ; cp += 4 ; safe -= 4 ;
+
+ ctfStoreInt (cp, read->leftCutoff) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, read->rightCutoff) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, read->orig_trace_format) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, read->maxTraceVal) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, n) ; cp += 4 ; safe -= 4 ;
+ if (n > 0 && safe > n)
+ { strncpy ((char *)cp, read->info, n) ; cp += n ; } ;
+ safe -= n ;
+ /* end section */
+ if (safe < 12)
+ { safe0++ ; goto lao ; }
+ ctfStoreInt (cp, MAGIC) ; cp += 4 ; safe -= 4 ;
+ }
+
+ /* SECTION 4 Probability information */
+ if (!ctfType || strchr(ctfType, '4'))
+ {
+ switch (probInfoLevel)
+ {
+ case 4:
+ section = 4 ;
+ sectionLength = 4 * baseMax + 4 ; n = baseMax ;
+ ctfStoreInt (cp, section) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, sectionLength) ; cp += 4 ; safe -= 4 ;
+
+ ctfStoreInt (cp, baseMax) ; cp += 4 ; safe -= 4 ;
+ if (safe > n) { memcpy (cp, read->prob_A, n) ; cp += n ;}
+ safe -= n ;
+ if (safe > n) { memcpy (cp, read->prob_C, n) ; cp += n ; }
+ safe -= n ;
+ if (safe > n) { memcpy (cp, read->prob_G, n) ; cp += n ; }
+ safe -= n ;
+ if (safe > n) { memcpy (cp, read->prob_T, n) ; cp += n ; }
+ safe -= n ;
+ if (safe < 12)
+ { safe0++ ; goto lao ; }
+
+ ctfStoreInt (cp, MAGIC) ; cp += 4 ; safe -= 4 ;
+ break ;
+ case 1:
+ section = 5 ;
+ sectionLength = baseMax + 4 ; n = baseMax ;
+ ctfStoreInt (cp, section) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, sectionLength) ; cp += 4 ; safe -= 4 ;
+
+ ctfStoreInt (cp, baseMax) ; cp += 4 ; safe -= 4 ;
+ if (safe > n) { memcpy (cp, mixProb, n) ; cp += n ; safe -= n ; }
+ if (safe < 12)
+ { safe0++ ; goto lao ; }
+
+ ctfStoreInt (cp, MAGIC) ; cp += 4 ; safe -= 4 ;
+ break ;
+ }
+ }
+
+ /* SECTION 999 the end */
+ if (TRUE)
+ {
+ section = 999 ;
+ sectionLength = 0 ;
+ ctfStoreInt (cp, section) ; cp += 4 ; safe -= 4 ;
+ ctfStoreInt (cp, sectionLength) ; cp += 4 ; safe -= 4 ;
+
+ ctfStoreInt (cp, MAGIC) ; cp += 4 ; safe -= 4 ;
+
+ if (safe < 0)
+ { safe0++ ; goto lao ; }
+ }
+
+ arrayMax (a) = cp - arrp (a, 0, unsigned char) ;
+
+ free (mixProb) ;
+ return a ;
+}
+
+/**********************************************************/
+
+static void ctfUnmixProb (Read *read, int n, unsigned char *mixProb)
+{
+ unsigned char *cp, *cq, *ca, *cg, *ct, *cc ;
+
+ ca = (unsigned char *)(read->prob_A = (char *) malloc (n)) ;
+ cc = (unsigned char *)(read->prob_C = (char *) malloc (n)) ;
+ cg = (unsigned char *)(read->prob_G = (char *) malloc (n)) ;
+ ct = (unsigned char *)(read->prob_T = (char *) malloc (n)) ;
+ cp = (unsigned char *)read->base ;
+ cq = mixProb ;
+ while (n--)
+ switch (*cp++)
+ {
+ case 'A': case 'a':
+ *ca++ = *cq++ ; *cc++ = *cg++ = *ct++ = 0 ;
+ break ;
+ case 'C': case 'c':
+ *cc++ = *cq++ ; *cg++ = *ct++ = *ca++ = 0 ;
+ break ;
+ case 'G': case 'g':
+ *cg++ = *cq++ ; *ct++ = *ca++ = *cc++ = 0 ;
+ break ;
+ case 'T': case 't':
+ *ct++ = *cq++ ; *ca++ = *cc++ = *cg++ = 0 ;
+ break ;
+ default:
+ *ca++ = *cc++ = *cg++ = *ct++ = *cq++ ;
+ break ;
+ }
+}
+
+/**********************************************************/
+
+#define CHECKMAGIC \
+magic = ctfGetInt (cp) ; \
+cp += 4 ; nn -= 4 ; \
+if (magic != MAGIC) \
+{ \
+ fprintf (stderr, "Error reading compressed trace file, sorry\n") ; \
+ goto abort ; \
+}
+
+
+static BOOL ctfUnPackTraces (Read *read, Array a)
+{
+ int compressionMode, predictionMode, magic ;
+ int section, sectionLength ;
+ int n, nn, traceMax, baseMax, dataMax, nMixProb = 0 ;
+ signed int x, dx;
+ Array decompressedData = 0 ;
+ unsigned char *cp, *b ;
+ unsigned short *bp ;
+ unsigned char *ucp, *mixProb = 0 ;
+
+ if (!arrayExists (a))
+ return FALSE ;
+
+ cp = arrp (a, 0, unsigned char) ; nn = arrayMax (a) ;
+
+ while (TRUE)
+ {
+ CHECKMAGIC ;
+ section = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ sectionLength = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ switch (section)
+ {
+ case 999: /* end of record */
+ goto done ;
+ case 1: /* read the bases and positions, problem if negative dx */
+ baseMax = read->NBases = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ CHECKMAGIC ;
+
+ n = baseMax ; nn -= 2 * n ;
+
+ read->base = (char *)malloc (baseMax) ; /* staden's alloc */
+ b = (unsigned char *)read->base;
+ bp = read->basePos = (unsigned short *) malloc (baseMax * sizeof (unsigned short)) ;
+
+ x = 0 ;
+
+ while (n--)
+ { x += *cp++ ;
+ *bp++ = x ;
+ switch ((*cp++) & 0xf)
+ {
+ case A_: *b++ = 'A' ; break ;
+ case T_: *b++ = 'T' ; break ;
+ case G_: *b++ = 'G' ; break ;
+ case C_: *b++ = 'C' ; break ;
+ default: *b++ = 'N' ; break ;
+ }
+ }
+ break ;
+
+ case 11: /* read the basecall, fullproof method */
+ baseMax = read->NBases = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ CHECKMAGIC ;
+
+ n = baseMax ; nn -= n ;
+ b = (unsigned char *)(read->base = (char *)malloc (baseMax)) ;
+ memcpy (b, cp, n) ;
+ cp += n ;
+ break ;
+
+ case 12: /* read the baspos, fullproof method */
+ baseMax = read->NBases = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ CHECKMAGIC ;
+
+ n = baseMax ; nn -= n ;
+
+ bp = read->basePos = (unsigned short *) malloc (baseMax * sizeof (unsigned short)) ;
+
+ x = 0 ;
+ while (n--)
+ {
+ dx = (unsigned char) *cp++;
+ if (dx == 254)
+ {
+ dx = (cp[0] << 8) | cp[1];
+ cp += 2; nn -= 2 ;
+ dx = -dx ;
+ }
+ else if (dx == 255)
+ {
+ dx = (cp[0] << 8) | cp[1];
+ cp += 2; nn -= 2 ;
+ }
+ dx -= 32 ;
+ x += dx;
+ *bp++ = x ;
+ }
+ break ;
+
+ case 2: /* read the traces */
+ predictionMode = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ compressionMode = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ traceMax = read->NPoints = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ dataMax = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ CHECKMAGIC ;
+ decompressedData = ctfDecompress (compressionMode, dataMax, traceMax, &cp) ;
+ if (!ctfRecorrelate (read, predictionMode, decompressedData))
+ goto abort ;
+ arrayDestroy (decompressedData) ;
+ break ;
+
+ case 3: /* read miscelaneous info */
+ read->leftCutoff = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ read->rightCutoff = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ read->orig_trace_format = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ read->maxTraceVal = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ n = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ if (n > 0)
+ {
+ read->info = (char *) malloc (n+1) ;
+ strncpy (read->info, (char *)cp, n) ; cp += n ; nn -= n ;
+ read->info[n] = 0 ; /* zero terminate the string */
+ }
+ break ;
+
+ case 4: /* Probability information */
+ n = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ read->prob_A = (char *) malloc (n) ;
+ read->prob_C = (char *) malloc (n) ;
+ read->prob_G = (char *) malloc (n) ;
+ read->prob_T = (char *) malloc (n) ;
+ memcpy (read->prob_A, cp, n) ; cp += n ; nn -= n ;
+ memcpy (read->prob_C, cp, n) ; cp += n ; nn -= n ;
+ memcpy (read->prob_G, cp, n) ; cp += n ; nn -= n ;
+ memcpy (read->prob_T, cp, n) ; cp += n ; nn -= n ;
+ break ;
+
+ case 5: /* Mixed Probability information */
+ n = ctfGetInt (cp) ; cp += 4 ; nn -= 4 ;
+ mixProb = (unsigned char*) malloc (n) ; nMixProb = n ;
+ ucp = cp ; /* to please memcpy */
+ memcpy (mixProb, ucp, n) ; cp += n ; nn -= n ;
+ break ;
+
+ case 6:
+ /* The original input format data, used in staden's
+ int orig_trace_format;
+ void *orig_trace;
+
+ i do not yet support that because i am not sure it is used
+ so i
+ */
+
+ /* fallthru to default */
+
+ default: /* not yet defined stuff */
+ cp += sectionLength ;
+ break ;
+ }
+ }
+
+ done:
+ if (mixProb)
+ {
+ if (read->NBases == nMixProb)
+ ctfUnmixProb (read, nMixProb, mixProb) ;
+ else
+ fprintf (stderr, "mixProb problem, read->NBases = %d nMixProb = %d",
+ read->NBases, nMixProb ) ;
+ }
+ if (!read->rightCutoff)
+ read->rightCutoff = read->NBases + 1 ;
+
+
+ if (mixProb) free (mixProb) ;
+ CHECKMAGIC ; /* terminal CHECK */
+ return TRUE ;
+
+ abort:
+ arrayDestroy (decompressedData) ;
+
+ freeSeq (read) ;
+ return FALSE ;
+}
+
+/**********************************************************/
+/**********************************************************/
+/**********************************************************/
+
+static BOOL ctfWriteTrace (FILE *ff, Array a)
+{
+ int n ; char *cp ;
+
+ n = arrayMax (a) ; cp = arrp (a, 0, char) ;
+ fwrite (cp, n, 1, ff) ;
+ return TRUE ;
+}
+
+/**********************************************************/
+
+static Array ctfReadTrace (FILE *fil)
+{
+ unsigned int i = 0, nr, nb = 100000, size = 1 ;
+ unsigned char *cp ;
+ Array a = arrayCreate (nb, unsigned char) ;
+
+ do
+ {
+ array(a,(++i)*nb,unsigned char) = 0 ; /* to create space */
+ cp = arrp(a,nb*(i-1),unsigned char) ; /* possible relocation */
+ }
+ while ((nr = fread (cp, size, nb, fil)) == nb) ;
+
+ arrayMax(a) -= nb - nr; /* artificial space removed */
+
+ if(!arrayMax(a))
+ arrayDestroy(a) ;
+
+ return a ;
+}
+
+/**********************************************************/
+/**********************************************************/
+/***** interaction with staden 's makeSCF ***************/
+/**********************************************************/
+
+int ctfFWrite (FILE *ff, Read *read)
+{
+ int result = -1 ; /* assume error */
+
+ if (read && read->NBases && read->NPoints && ff)
+ {
+ Array a = ctfPackTraces (read);
+
+ ctfWriteTrace (ff, a) ;
+ arrayDestroy (a) ;
+
+ result = 0 ; /* success */
+ }
+
+ return result ;
+} /* ctfFWrite */
+
+/**********************************************************/
+
+Read *ctfFRead (FILE *ff)
+{
+ Read * read = 0 ;
+ int NBases = 0 ;
+ Array a = 0 ;
+
+ if ((a = ctfReadTrace (ff)) &&
+ (read = (Read *) malloc (sizeof(Read))))
+ {
+ memset (read, 0, sizeof(Read)) ;
+ if (ctfUnPackTraces (read, a))
+ {
+ read->format = TT_CTF ;
+ NBases = read->NBases ;
+
+ if (!read->prob_A)
+ {
+ read->prob_A = (char *) malloc (NBases) ;
+ if (!read->prob_C) read->prob_C = (char *) malloc (NBases) ;
+ if (!read->prob_G) read->prob_G = (char *) malloc (NBases) ;
+ if (!read->prob_T) read->prob_T = (char *) malloc (NBases) ;
+ memset (read->prob_A, 0, NBases) ;
+ memset (read->prob_C, 0, NBases) ;
+ memset (read->prob_G, 0, NBases) ;
+ memset (read->prob_T, 0, NBases) ;
+ }
+
+ read->orig_trace = 0x0 ;
+ }
+ else
+ read = 0 ;
+ }
+
+ arrayDestroy (a) ;
+ return read ;
+} /* ctfFRead */
+
+/* Examples
+ run -s -any /users/mieg/CTFtest/tt/a.scf -ctfout a.scf.ctf
+ run -s -any /users/mieg/CTFtest/tt/a.scf.ctf -output a.scf.ctf.scf
+ */
+
+/**********************************************************/
+/**********************************************************/
+
diff --git a/src/Staden/read/error.c b/src/Staden/read/error.c
new file mode 100644
index 0000000..96cbf70
--- /dev/null
+++ b/src/Staden/read/error.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <stdarg.h>
+
+/*
+ * Usage:
+ *
+ * errout(format, args...);
+ */
+void errout(char *fmt, ...) {
+ va_list args;
+
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+
+ va_end(args);
+}
+
+/*
+ * memmove() does not exist on SunOS 4.x, despite being an ANSI library call.
+ *
+ * void *memmove(void *to, const void *from, size_t len) {
+ * bcopy(from, to, len);
+ * return to;
+ * }
+ */
diff --git a/src/Staden/read/error.h b/src/Staden/read/error.h
new file mode 100644
index 0000000..f8708c3
--- /dev/null
+++ b/src/Staden/read/error.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+extern void error(char *fmt, ...);
+extern void errout(char *fmt, ...);
+
+#endif /*_GAP_ERROR_H_*/
diff --git a/src/Staden/read/expFileIO.c b/src/Staden/read/expFileIO.c
new file mode 100644
index 0000000..36638a1
--- /dev/null
+++ b/src/Staden/read/expFileIO.c
@@ -0,0 +1,1184 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * File: expFileIO.c
+ * Version:
+ *
+ * Description: Routines for reading and writing to experiment files.
+ *
+ * 1. Opening experiment files
+ * 2. Reading information from an experiment file
+ * 3. Appending to experiment files
+ * 4. Closing an opened experiment file
+ *
+ * Created:
+ * Updated:
+ *
+ */
+
+/*
+ * Tag format:
+ *
+ * 0 10
+ * |----.----|-
+ * TG TYPE S position..length
+ * TG One or more comment lines starting at character position 10
+ * TG Each line represents a line of tag.
+ * TG Extra indentation is simply added to the comment.
+ *
+ * Where S is the strand, either "+", "-", or "=" (both).
+ * Eg:
+ *
+ * TG COMM = 100..110
+ * TG This comment contains
+ * TG several lines.
+ *
+ * So the above is a COMMent tag on both strands from bases 100 to 110
+ * inclusive containing the annotation
+ * "This comment contains\n several lines.\n"
+ *
+ * This is written using exp_put_str giving the multi line string:
+ * "COMM = 100..110\nThis comment contains\n several lines."
+ *
+ * (ie the indentation is added by the experiment file format, not by the
+ * calling routines. Similarly this indentation is stripped out again when
+ * reading back.)
+ */
+
+
+#include <stdio.h>
+#include <string.h> /* IMPORT: strdup (hopefully!) */
+#include <ctype.h>
+
+/* 6/1/99 johnt - includes needed for Visual C++ */
+#ifdef _MSC_VER
+# include <io.h>
+# include <fcntl.h>
+#endif
+
+#include "expFileIO.h"
+#include "xalloc.h"
+#include "misc.h"
+
+/* Fixup for broken SunOS 4.x systems */
+#ifndef FOPEN_MAX
+#define FOPEN_MAX 20
+#endif
+
+/*************************************************************
+ * Line types for experiment file
+ *************************************************************/
+
+char eflt_feature_ids[MAXIMUM_EFLTS][MAXIMUM_EFLT_LENGTH+1] = {
+ "CF", /* 0 cloning vector sequence file */
+ "CN", /* 1 clone name */
+ "CS", /* 2 cloning vector sequence present in sequence */
+ "CV", /* 3 cloning vector type */
+ "DR", /* 4 direction of read */
+ "DT", /* 5 date of experiment */
+ "EN", /* 6 experiment name */
+ "EX", /* 7 experimental notes */
+ "FM", /* 8 sequencing vector fragmentation method */
+ "LN", /* 9 local format trace file name */
+ "LT", /* 10 local format trace file type */
+ "MC", /* 11 machine on which experiment ran */
+ "MN", /* 12 machine generated trace file name */
+ "MT", /* 13 machine generated trace file type */
+ "OP", /* 14 operator */
+ "PN", /* 15 primer name */
+ "QR", /* 16 poor quality sequence present at right (3') end */
+ "SC", /* 17 sequencing vector cloning site */
+ "SF", /* 18 sequencing vector sequence file */
+ "SI", /* 19 sequencing vector insertion length */
+ "SL", /* 20 sequencing vector present at left (5') end */
+ "SP", /* 21 sequencing vector primer site (relative to cloning site) */
+ "SQ", /* 22 sequence */
+ "SR", /* 23 sequencing vector present at right (3') end */
+ "ST", /* 24 strands */
+ "SV", /* 25 sequencing vector type */
+ "TN", /* 26 template name */
+ "QL", /* 27 poor quality sequence present at left (5') end */
+ "PS", /* 28 processing status */
+ "CC", /* 29 comments */
+ "SS", /* 30 sequence to screen against */
+ /* added 27-May-93 */
+ "TG", /* 31 gel tag line */
+ "ID", /* 32 identifier */
+ /* added 24-Sep-93 */
+ "AQ", /* 33 average quality measure */
+ /* added 15-Oct-93 */
+ "PR", /* 34 primer type */
+ "LI", /* 35 subclone library (mtd) */
+ "LE", /* 36 subclone library entry (well) */
+ /* added 19-Apr-94 */
+ "TC", /* 37 contig tag line */
+ "AC", /* 38 accession number */
+ /* added 11-Nov-94 */
+ "BC", /* 39 base calling software */
+ "ON", /* 40 original base numbers (positions) */
+ "AV", /* 41 accuracy (quality) values */
+ "PC", /* 42 position in contig */
+ "SE", /* 43 sense, whether it is complemented */
+ /* added 5-4-95 */
+ "CL", /* 44 cloning vector left end*/
+ "CR", /* 45 cloning vector right end*/
+ "AP", /* 46 assembly position */
+ "CH", /* 47 special chemistry used (eg taq) */
+ "PD", /* 48 primer data - the sequence of a primer */
+ "WT", /* 49 wild type trace */
+ "NT", /* 50 note */
+ "GD", /* 51 Gap4 database file */
+ "WL", /* 52 wildtype trace left clip point */
+ "WR" /* 53 wildtype trace right clip point */
+};
+
+
+
+
+/*************************************************************
+ * Output/update lines
+ *************************************************************/
+
+int exp_print_line_(FILE *fp, char *eflt, char *entry)
+/*
+ * Output an experiment file line
+ */
+{
+ return fprintf(fp,
+ "%-5s%s\n",
+ eflt,
+ entry
+ ) < 0;
+}
+
+int exp_print_line(FILE *fp, Exp_info *e, int eflt, int i)
+/*
+ * Output an experiment file line
+ */
+{
+ return exp_print_line_(fp,
+ eflt_feature_ids[eflt],
+ arr(char *,e->entries[eflt],i)
+ );
+}
+
+/*
+ * Outputs a multi-line experiment file line.
+ * Continuation lines are automatically added by adding 5 characters of extra
+ * indentation at the start of each continuation.
+ *
+ * returns -1 for failure, 0 for success.
+ */
+int exp_print_mline(FILE *fp, Exp_info *e, int eflt, int i) {
+ char *p, *c;
+
+ p = arr(char *, e->entries[eflt], i);
+
+ /* first line */
+ if (c = strchr(p, '\n'))
+ *c = '\0';
+ if (-1 == exp_print_line_(fp, eflt_feature_ids[eflt], p))
+ return -1;
+
+ while (c) {
+ *c = '\n';
+ p = c+1;
+
+ if (c = strchr(p, '\n')) {
+ *c = '\0';
+ }
+
+ if (-1 == fprintf(fp, "%-10s%s\n", eflt_feature_ids[eflt], p))
+ return -1;
+ }
+
+ return 0;
+}
+
+
+int exp_print_seq(FILE *fp, Exp_info *e, int eflt, int i)
+/*
+ * Output an experiment file multi line
+ */
+{
+ int j, l;
+ char *seq;
+ if (fprintf(fp,"%-5s",eflt_feature_ids[eflt])<0) return 1;
+
+ l = strlen(seq = arr(char *,e->entries[eflt],i));
+ for(j=0;j<l;j++) {
+ if (j%60==0) if ( fprintf(fp,"\n ") < 0 ) return 1;
+ if (j%10==0) if ( fprintf(fp," ") < 0 ) return 1;
+ if ( fprintf(fp,"%c",seq[j]) < 0 ) return 1;
+ }
+ if ( fprintf(fp,"\n//\n") < 0 ) return 1;
+
+ return 0;
+}
+
+int exp_get_feature_index(char *e)
+{
+ int i;
+
+ for (i = 0; i < MAXIMUM_EFLTS; i++)
+ if(strcmp(eflt_feature_ids[i],e)==0) return i;
+
+ return -1;
+}
+
+
+/*************************************************************
+ * Utility routines
+ *************************************************************/
+
+/*
+ * Creates a string of 'range format' from the start and end points.
+ * The string (of form start..end) is also returned.
+ */
+char *exp_create_range(char *str, int start, int end) {
+ sprintf(str, "%d..%d", start, end);
+ return str;
+}
+
+/*
+ * Extracts the start and end points from a range string.
+ * Returns 0 for success and -1 for failure.
+ */
+int exp_extract_range(char *str, int *start, int *end) {
+ return sscanf(str, "%d..%d", start, end) != 2;
+}
+
+Exp_info *exp_create_info(void)
+/*
+ * Allocate space for new experiment file information
+ */
+{
+ Exp_info *new;
+ int i;
+
+ new = (Exp_info *)xmalloc(sizeof(Exp_info));
+ if (new != NULL) {
+ for(i=0; i< MAXIMUM_EFLTS ; i++) {
+ new->Nentries[i] = 0;
+ new->entries[i] = ArrayCreate(sizeof(char *), 1/*one entry*/);
+ }
+ new->fp = NULL;
+ }
+
+ return new;
+}
+
+
+void exp_destroy_info(Exp_info *e)
+/*
+ * Destroy experiment file information
+ */
+{
+ int i;
+ int j;
+ if (e != NULL_Exp_info) {
+ for (i = 0; i < MAXIMUM_EFLTS; i++) {
+ Array a = e->entries[i];
+ for(j=0;j<e->Nentries[i];j++)
+ if (arr(char *,a,j) != NULL) xfree(arr(char *,a,j));
+ ArrayDestroy(a);
+ }
+ if (e->fp != NULL) fclose(e->fp);
+ xfree(e);
+ }
+}
+
+
+
+
+
+
+static char *exp_read_sequence(FILE *fp)
+/*
+ * Read from file a sequence, discarding all white space til a // is encountered
+ */
+{
+ char *seq;
+ int seql;
+ char line[EXP_FILE_LINE_LENGTH+1];
+ char *l;
+
+ seql = 0;
+ seq = (char *)xmalloc(seql+1);
+ if (NULL == seq)
+ return NULL;
+ seq[0] = '\0';
+
+ l = fgets(line,EXP_FILE_LINE_LENGTH,fp);
+ while (l!= NULL && strncmp(l,"//",2)) {
+ char *a, *b;
+ for(a=b=line;*a;a++)
+ if (! isspace(*a)) *b++=*a;
+ *b = '\0';
+ seql = seql + b-line;
+ seq = (char *)xrealloc(seq,seql+1);
+ if (NULL == seq)
+ return NULL;
+ strcat(seq,line);
+ l = fgets(line,EXP_FILE_LINE_LENGTH,fp);
+ }
+
+ return seq;
+}
+
+
+/*
+ * Converts the opos[] array into a char array.
+ * In doing so this shrinks the data size by using a .. notation.
+ * No check is made that buf is large enough. It is recommended that buf is
+ * allocated to 5*len which covers the worst case (for sequences less that
+ * 9999 bases long).
+ *
+ * Note that on older systems sprintf may return the first argument rather
+ * than the number of characters written.
+ * For this reason we have to do the counting ourselves.
+ */
+char *opos2str(int2 *opos, int len, char *buf) {
+ int i, st, f, dir = 0;
+ char *r = buf, *rs = buf;
+
+ f = opos[st = 0];
+ for (i = 1; i < len; f=opos[i++]) {
+ if (dir == 0)
+ if (opos[i] == f+1)
+ dir=1;
+ else if (opos[i] == f-1)
+ dir=-1;
+
+ if (dir && opos[i] != f + dir) {
+ if (st != i-1)
+ sprintf(buf, "%d..%d ", opos[st], opos[i-1]);
+ else
+ sprintf(buf, "%d ", opos[st]);
+ st = i;
+ dir = 0;
+
+ buf += strlen(buf);
+
+ } else if (dir == 0) {
+ sprintf(buf, "%d ", f);
+
+ st = i;
+ buf += strlen(buf);
+ }
+
+ if (buf - rs > 60) {
+ *buf++ = '\n';
+ *buf = '\0';
+ rs = buf - 6;
+ }
+ }
+
+ if (st != i-1)
+ sprintf(buf, "%d..%d", opos[st], opos[i-1]);
+ else
+ sprintf(buf, "%d", opos[st]);
+
+ return r;
+}
+
+
+/*
+ * Expands from the character string .. notation to the opos[] array, up to
+ * a maximum of len elements in opos[].
+ *
+ * Returns the length of the opos array.
+ */
+int str2opos(int2 *opos, int len, char *buf) {
+ int i, n1, n2, st, en, m, j = 0;
+
+ while (*buf) {
+ m = sscanf(buf, "%d%n..%d%n", &st, &n1, &en, &n2);
+
+ if (m == 1) {
+ opos[j++] = st;
+ buf += n1;
+ if (j >= len)
+ break;
+ } else if (m == 2) {
+ if (en >= st)
+ for (i = st; i <= en && j < len; i++)
+ opos[j++] = i;
+ else
+ for (i = st; i >= en && j < len; i--)
+ opos[j++] = i;
+ buf += n2;
+ if (j >= len)
+ break;
+ } else {
+ buf++;
+ }
+ }
+
+ return j;
+}
+
+
+/*
+ * Converts the accuracy value string (AV) to the confidence array up to
+ * a maximum of len elements in conf[].
+ *
+ * The AV string is of format:
+ * "x y z ..." where x, y and z are confidence values for the first three
+ * called bases. Or:
+ * "a,b,c,d e,f,g,h i,j,k,l ..." where the 4-tuples represent the four
+ * confidence values for each base.
+ *
+ * Returns: number of confidence values read, or -1 for error.
+ */
+int str2conf(int1 *conf, int len, char *buf) {
+ int val1, ind = 0, pos;
+
+ while (*buf && sscanf(buf, "%d%n", &val1, &pos) == 1 && ind < len) {
+ if (buf[pos] == ',') {
+ fprintf(stderr, "4-tuple system is currently unsupported\n");
+ return -1;
+ }
+
+ conf[ind++] = val1;
+ buf += pos;
+ }
+
+ return ind;
+}
+
+/*
+ * Converts the confidence array to the accuracy value string (AV).
+ *
+ * Note no memory overrun checks are performed on buf. It is recommended
+ * that it is allocated to 4*len (worst case of "100 " for each base).
+ *
+ * Returns the buf argument.
+ */
+char *conf2str(int1 *conf, int len, char *buf) {
+ int i;
+ char *ret = buf, *rs = buf;
+
+ for (i = 0; i < len; i++) {
+ sprintf(buf, "%d ", conf[i]);
+ buf += strlen(buf);
+
+ if (buf - rs > 60) {
+ *buf++ = '\n';
+ *buf = '\0';
+ rs = buf - 6;
+ }
+ }
+
+ return ret;
+}
+
+/*************************************************************
+ * Main C interface routines
+ *************************************************************/
+
+
+/*
+ * Closes an experiment file (if open), but does not free it.
+ */
+void exp_close(Exp_info *e) {
+ if (e->fp) {
+ fclose(e->fp);
+ e->fp = NULL;
+ }
+}
+
+
+Exp_info *exp_read_info(char *file)
+/*
+ * Read in an experiment file and return handle
+ */
+{
+ Exp_info *e;
+ FILE *fp;
+
+ /*
+ * open for read
+ */
+ if ((fp = fopen(file,"r"))==NULL) {
+ return NULL_Exp_info;
+ }
+
+ e = exp_fread_info(fp);
+ fclose(fp);
+
+ if (NULL_Exp_info == e) {
+ return NULL_Exp_info;
+ }
+
+ /*
+ * reopen for appending
+ */
+ e->fp = fopen(file,"a");
+
+ return e;
+
+}
+
+
+/*
+ * Read in an experiment file and return handle
+ */
+Exp_info *exp_fread_info(FILE *fp)
+{
+ Exp_info *e;
+ char line[EXP_FILE_LINE_LENGTH+1];
+ char *aline;
+ int alloced_length = EXP_FILE_LINE_LENGTH+1;
+ int apos, len;
+
+ e = exp_create_info();
+
+#ifdef _WIN32
+ /* 6/1/99 johnt - need to ensure text mode to translate \r\n to \n */
+ _setmode(fileno(fp),_O_TEXT);
+#endif
+
+ /*
+ * open for read, set this temporarily in this function. Should be NULL
+ * when exiting as this isn't our file pointer to own, but the destroy
+ * function does attempt to automatically close it.
+ */
+ e->fp = fp;
+
+ if (NULL == (aline = (char *)xmalloc(alloced_length)))
+ return NULL;
+
+ if (e != NULL_Exp_info) {
+ int at_end = 0;
+
+ for(;;) {
+ char *c;
+ int entry;
+
+ /* Read into aline, joining and allocating as necessary */
+ apos = 0;
+ do {
+ if (fgets(line,EXP_FILE_LINE_LENGTH,e->fp) == NULL) {
+ at_end = 1;
+ break;
+ }
+
+ len = strlen(line);
+ if (apos + len >= alloced_length) {
+ alloced_length *= 2;
+ if (NULL == (aline = (char *)xrealloc(aline,
+ alloced_length))) {
+ e->fp = NULL;
+ return NULL;
+ }
+ }
+
+ strcpy(aline+apos, line);
+ apos += len;
+ } while (line[len-1] != '\n');
+
+ if (at_end)
+ break;
+
+ /*
+ * zero terminate first argument
+ * set c to point to second argument
+ *
+ * FIXME: c should point to character 6 always. Indentation is
+ * important when considering continuation lines.
+ */
+ for (c=aline;*c && !isspace(*c); c++) ;
+ if (*c) {
+ *c++ = '\0';
+ for (;*c && isspace(*c); c++) ;
+ }
+
+ entry = exp_get_feature_index(aline);
+ if (entry >= 0) {
+ /*
+ * Tag lines may be split over multiple lines. If we have no
+ * tag type then we append to the existing tag.
+ */
+ if ((int)(c-aline) >= 10/* continuation lines */
+ && (entry == EFLT_TG || entry == EFLT_TC ||
+ entry == EFLT_ON || entry == EFLT_AV ||
+ entry == EFLT_NT)) {
+ char *en;
+ size_t l1, l2;
+
+ /*
+ * Extend our current line by the appropriate amount
+ */
+ en = exp_get_entry(e,entry);
+ l1 = strlen(en);
+ l2 = strlen(&aline[10]);
+
+ if (NULL == (en = exp_get_entry(e, entry) =
+ (char *)xrealloc(en, l1 + l2 + 1))) {
+ e->fp = NULL;
+ return NULL;
+ }
+
+
+ /*
+ * Append the new line (without the \n char)
+ */
+ en[l1] = '\n';
+ aline[l2+9] = '\0';
+ strcpy(&en[l1+1], &aline[10]);
+ } else {
+ /*
+ * Increment number of entries for line type entry
+ * This will force exp_get_entry() to return pointer to
+ * next free element in array
+ */
+ (void)ArrayRef(e->entries[entry],e->Nentries[entry]++);
+
+ if (entry == EFLT_SQ)
+ exp_get_entry(e,entry) = exp_read_sequence(e->fp);
+ else {
+ char *eoln = strchr(c,'\n');
+ int i;
+
+ if (eoln!=NULL) *eoln='\0';
+
+ if (entry == EFLT_LT)
+ for (i=3; isspace(c[i]) && i >= 0; c[i--]='\0');
+
+ exp_get_entry(e,entry) = (char *)strdup(c);
+ }
+ }
+ }
+ }
+ }
+
+ e->fp = NULL;
+ xfree(aline);
+
+ return e;
+}
+
+static int exp_check_eid_read(Exp_info *e,int id)
+/*
+ * Check these are a valid combination and that
+ * an entry exists for read
+ */
+{
+ return (
+ e == NULL ||
+ id < 0 ||
+ id >= MAXIMUM_EFLTS ||
+ e->Nentries[id] == 0 ||
+ eflt_feature_ids[id][0]=='\0'
+ );
+}
+
+static int exp_check_eid_write(Exp_info *e,int id)
+/*
+ * Check these are a valid combination and that
+ * an entry exists for write
+ */
+{
+ return (e == NULL ||
+ id < 0 ||
+ id >= MAXIMUM_EFLTS ||
+ e->fp == NULL ||
+ eflt_feature_ids[id][0]=='\0');
+}
+
+
+
+
+
+
+int exp_get_int(Exp_info *e, int id, int *val)
+/*
+ * Get the integer for entry id
+ * returns:
+ * 0 - success
+ * 1 - no entry
+ */
+{
+ if ( exp_check_eid_read(e,id) ) return 1;
+ *val = atoi(exp_get_entry(e,id));
+ return 0;
+}
+
+
+int exp_get_rng(Exp_info *e, int id, int *from, int *to)
+/*
+ * Get the integer pair for entry id
+ * returns:
+ * 0 - success
+ * 1 - no entry
+ */
+{
+ if ( exp_check_eid_read(e,id) ) return 1;
+ (void)exp_extract_range(exp_get_entry(e,id), from, to);
+
+ return 0;
+}
+
+
+
+int exp_get_str(Exp_info *e, int id, char *s, f_implicit s_l)
+/*
+ * Get the string for entry id
+ * returns:
+ * 0 - success
+ * 1 - no entry
+ */
+{
+ if ( exp_check_eid_read(e,id) ) return 1;
+ strncpy(s,exp_get_entry(e,id),s_l);
+
+ return 0;
+}
+
+
+static int exp_append_str(Exp_info *e, int id, char *s, int len)
+/*
+ * Append the string to experiment file for entry id
+ * returns:
+ * 0 - success
+ * 1 - no update
+ */
+{
+ (void)ArrayRef(e->entries[id],e->Nentries[id]++);
+ exp_get_entry(e,id) = (char *)xmalloc(len+1);
+ strncpy(exp_get_entry(e,id), s, len);
+ exp_get_entry(e,id)[len] = '\0';
+
+ if ( id == EFLT_SQ )
+ return exp_print_seq(e->fp,e,id,e->Nentries[id]-1);
+ else if (id == EFLT_TG || id == EFLT_TC ||
+ id == EFLT_ON || id == EFLT_AV ||
+ id == EFLT_NT)
+ return exp_print_mline(e->fp,e,id,e->Nentries[id]-1);
+ else
+ return exp_print_line(e->fp,e,id,e->Nentries[id]-1);
+}
+
+
+int exp_put_int(Exp_info *e, int id, int *val)
+/*
+ * Append the integer for entry id to the experiment file
+ * returns:
+ * 0 - success
+ * 1 - no update
+ */
+{
+ char buf[EXP_FILE_LINE_LENGTH];
+ if ( exp_check_eid_write(e,id) ) return 1;
+ sprintf(buf,"%d",*val);
+ return exp_append_str(e,id,buf,strlen(buf));
+}
+
+
+int exp_put_rng(Exp_info *e, int id, int *from, int *to)
+/*
+ * Append the integer pair for entry id to the experiment file
+ * returns:
+ * 0 - success
+ * 1 - no update
+ */
+{
+ char buf[EXP_FILE_LINE_LENGTH];
+ if ( exp_check_eid_write(e,id) ) return 1;
+
+ (void )exp_create_range(buf, *from, *to);
+
+ return exp_append_str(e,id,buf,strlen(buf));
+}
+
+
+
+int exp_put_str(Exp_info *e, int id, char *s, f_implicit s_l)
+/*
+ * Append the string for entry id to the experiment file
+ * returns:
+ * 0 - success
+ * 1 - no update
+ */
+{
+ if ( exp_check_eid_write(e,id) ) return 1;
+ return exp_append_str(e,id,s,s_l);
+}
+
+
+/*************************************************************
+ * FORTRAN INTERFACE
+ *************************************************************/
+
+
+
+static int init_done = 0;
+static int NHandles = 0;
+static Exp_info **Handles = NULL;
+
+static int initialise(void)
+{
+ int i;
+
+ if (init_done) return 0;
+ init_done++;
+
+ NHandles = FOPEN_MAX;
+
+ if ( (Handles = (Exp_info **)xmalloc(sizeof(Exp_info *) * NHandles)) == NULL) {
+ NHandles = 0;
+ return 1;
+ }
+
+ for (i=0; i<NHandles; i++) Handles[i] = NULL;
+
+ return 0;
+}
+
+
+static int get_free_handle(void)
+/*
+ * find a free entry in the Exp array
+ * returns -1 if there is none
+ */
+{
+ int i;
+
+ (void) initialise();
+
+ if (!NHandles) return -1; /* no slots! */
+ for (i=0; i<NHandles && Handles[i]!=NULL; i++) ;
+ return (i==NHandles)?-1:i;
+}
+
+
+static int check_handle(f_int *handle)
+{
+ return (handle == NULL ||
+ (int) (*handle) <= 0 ||
+ (int) (*handle) > NHandles);
+}
+
+
+
+f_int expopn_(char *fn, f_implicit fn_l)
+/*
+ * FORTRAN interface to exp_open_file()
+ */
+{
+ char cfn[1025];
+ int handle;
+
+ if ( (handle = get_free_handle()) >= 0 ) {
+ f2cstr(fn,fn_l,cfn,1024);
+ Handles[handle] = exp_read_info(cfn);
+ }
+
+ return (f_int) (handle+1);
+}
+
+
+
+f_proc_ret expkil_(f_int *handle)
+/*
+ * FORTRAN interface to exp_destroy_info
+ */
+{
+ Exp_info *e;
+ if ( check_handle(handle) ) f_proc_return();
+ e = (Exp_info *) Handles[(int)(*handle)-1];
+
+ exp_destroy_info(e);
+
+ Handles[(int)(*handle)-1] = NULL;
+ *handle = 0;
+
+ f_proc_return();
+}
+
+f_int expri_(f_int *handle, f_int *id, f_int *val)
+/*
+ * FORTRAN interface to exp_get_int
+ */
+{
+ Exp_info *e;
+ if ( check_handle(handle) ) return 1;
+ e = (Exp_info *) Handles[(int)(*handle)-1];
+
+ return exp_get_int(e, (int)*id, (int *)val);
+}
+
+
+f_int exprr_(f_int *handle, f_int *id, f_int *from, f_int *to)
+/*
+ * FORTRAN interface to exp_get_rng
+ */
+{
+ Exp_info *e;
+ if ( check_handle(handle) ) return 1;
+ e = (Exp_info *) Handles[(int)(*handle)-1];
+
+ return exp_get_rng(e,(int)*id,(int *)from,(int *)to);
+
+}
+
+/* ARGSUSED */
+f_int exprsa_(f_int *handle, f_int *id, char *s, f_int *max_len, f_implicit s_l)
+/*
+ * FORTRAN interface to exp_get_str workalike
+ * NOTE: for use with FORTRAN CHARACTER arrays instead CHARACTER strings
+ */
+{
+ Exp_info *e;
+ if ( check_handle(handle) ) return 1;
+ e = (Exp_info *) Handles[(int)(*handle)-1];
+
+ if ( exp_check_eid_read(e,*id) ) return 1;
+ c2fstr(exp_get_entry(e,*id),(int)*max_len,s,(int)*max_len);
+ return 0;
+}
+
+
+f_int exprs_(f_int *handle, f_int *id, char *s, f_implicit s_l)
+/*
+ * FORTRAN interface to exp_get_str workalike
+ * NOTE: for use with FORTRAN CHARACTER strings instead CHARACTER arrays
+ */
+{
+ Exp_info *e;
+ if ( check_handle(handle) ) return 1;
+ e = (Exp_info *) Handles[(int)(*handle)-1];
+
+ if ( exp_check_eid_read(e,*id) ) return 1;
+ c2fstr(exp_get_entry(e,*id),s_l,s,s_l);
+ return 0;
+}
+
+
+f_int expwi_(f_int *handle, f_int *id, f_int *val)
+/*
+ * FORTRAN interface to exp_put_int
+ */
+{
+ Exp_info *e;
+ if ( check_handle(handle) ) return 1;
+ e = (Exp_info *) Handles[(int)(*handle)-1];
+
+ return exp_put_int(e, (int)*id, (int *)val);
+}
+
+
+f_int expwr_(f_int *handle, f_int *id, f_int *from, f_int *to)
+/*
+ * FORTRAN interface to exp_put_rng
+ */
+{
+ Exp_info *e;
+ if ( check_handle(handle) ) return 1;
+ e = (Exp_info *) Handles[(int)(*handle)-1];
+
+ return exp_put_rng(e, (int)*id, (int *)from, (int *)to);
+}
+
+
+/* ARGSUSED */
+f_int expwsa_(f_int *handle, f_int *id, char *s, f_int *max_len, f_implicit s_l)
+/*
+ * FORTRAN interface to exp_put_str workalike
+ * NOTE: for use with FORTRAN CHARACTER arrays instead CHARACTER strings
+ */
+{
+ Exp_info *e;
+ char buf[EXP_FILE_LINE_LENGTH];
+ if ( check_handle(handle) ) return 1;
+ e = (Exp_info *) Handles[(int)(*handle)-1];
+
+
+ if ( exp_check_eid_write(e,*id) ) return 1;
+ /* don't allow multi-line entries to be written */
+ if (*id == EFLT_SQ ) return 1;
+ f2cstr(s,(int)*max_len,buf,sizeof(buf));
+ return exp_append_str(e,*id,buf,strlen(buf));
+
+}
+
+f_int expws_(f_int *handle, f_int *id, char *s, f_implicit s_l)
+/*
+ * FORTRAN interface to exp_put_str workalike
+ * NOTE: for use with FORTRAN CHARACTER strings instead CHARACTER arrays
+ */
+{
+ char buf[EXP_FILE_LINE_LENGTH];
+ Exp_info *e;
+ if ( check_handle(handle) ) return 1;
+ e = (Exp_info *) Handles[(int)(*handle)-1];
+
+
+ if ( exp_check_eid_write(e,*id) ) return 1;
+ /* don't allow multi-line entries to be written */
+ if (*id == EFLT_SQ ) return 1;
+ f2cstr(s,s_l,buf,sizeof(buf));
+ return exp_append_str(e,*id,buf,s_l);
+}
+
+/*
+ * FORTRAN interface to exp_create_range()
+ */
+void expcr_(char *str, f_int *start, f_int *end, f_implicit str_l) {
+ exp_create_range(str, *start, *end);
+ c2fstr(str, str_l, str, str_l);
+
+ f_proc_return();
+}
+
+/*
+ * FORTRAN interface to exp_extract_range()
+ */
+/* ARGSUSED */
+f_int exper_(char *str, f_int *start, f_int *end, f_implicit str_l) {
+ return exp_extract_range(str, (int *)start, (int *)end);
+}
+
+
+
+
+/*************************************************************
+ * Go for it!
+ *************************************************************/
+
+static void print_line(FILE *fp, Exp_info *e, int eflt, int all)
+{
+ if (all) {
+ int i;
+ for(i=0;i<e->Nentries[eflt];i++) exp_print_line(fp,e,eflt,i);
+ } else if (e->Nentries[eflt] > 0) {
+ exp_print_line(fp,e,eflt,e->Nentries[eflt]-1);
+ }
+}
+
+
+static void print_mline(FILE *fp, Exp_info *e, int eflt, int all)
+{
+ if (all) {
+ int i;
+ for(i=0;i<e->Nentries[eflt];i++) exp_print_mline(fp,e,eflt,i);
+ } else if (e->Nentries[eflt] > 0) {
+ exp_print_mline(fp,e,eflt,e->Nentries[eflt]-1);
+ }
+}
+
+
+
+static void print_seq(FILE *fp, Exp_info *e, int eflt)
+{
+ if (e->Nentries[eflt] > 0)
+ exp_print_seq(fp,e,eflt,e->Nentries[eflt]-1);
+}
+
+
+
+
+void exp_print_file(FILE *fp, Exp_info *e)
+{
+ print_line(fp,e,EFLT_ID, 0);
+ print_line(fp,e,EFLT_AC, 0);
+ print_line(fp,e,EFLT_EN, 0);
+
+ print_line(fp,e,EFLT_CC, 1);
+ print_line(fp,e,EFLT_EX, 1);
+ print_line(fp,e,EFLT_PS, 1);
+
+ print_line(fp,e,EFLT_LN, 0);
+ print_line(fp,e,EFLT_LT, 0);
+
+ print_line(fp,e,EFLT_CF, 0);
+ print_line(fp,e,EFLT_CV, 0);
+ print_line(fp,e,EFLT_CS, 0);
+ print_line(fp,e,EFLT_CL, 0);
+ print_line(fp,e,EFLT_CR, 0);
+
+ print_line(fp,e,EFLT_SF, 0);
+ print_line(fp,e,EFLT_SV, 0);
+ print_line(fp,e,EFLT_SI, 0);
+ print_line(fp,e,EFLT_SC, 0);
+ print_line(fp,e,EFLT_SP, 0);
+ print_line(fp,e,EFLT_PD, 0);
+ print_line(fp,e,EFLT_FM, 0);
+ print_line(fp,e,EFLT_SL, 0);
+ print_line(fp,e,EFLT_SR, 0);
+
+ print_line(fp,e,EFLT_QL, 0);
+ print_line(fp,e,EFLT_QR, 0);
+
+ print_mline(fp,e,EFLT_TG,1);
+ print_mline(fp,e,EFLT_TC,1);
+ print_mline(fp,e,EFLT_NT,1);
+
+ print_line(fp,e,EFLT_CN, 0);
+ print_line(fp,e,EFLT_TN, 0);
+ print_line(fp,e,EFLT_PN, 0);
+ print_line(fp,e,EFLT_PR, 0);
+ print_line(fp,e,EFLT_LI, 0);
+ print_line(fp,e,EFLT_LE, 0);
+ print_line(fp,e,EFLT_CH, 0);
+
+ print_mline(fp,e,EFLT_ON,0);
+ print_line(fp,e,EFLT_AQ, 0);
+ print_mline(fp,e,EFLT_AV,0);
+
+ print_line(fp,e,EFLT_DR, 0);
+ print_line(fp,e,EFLT_SE, 0);
+ print_line(fp,e,EFLT_PC, 0);
+ print_line(fp,e,EFLT_AP, 0);
+ print_line(fp,e,EFLT_ST, 0);
+
+ print_line(fp,e,EFLT_DT, 0);
+ print_line(fp,e,EFLT_MC, 0);
+ print_line(fp,e,EFLT_MN, 0);
+ print_line(fp,e,EFLT_MT, 0);
+ print_line(fp,e,EFLT_OP, 1);
+ print_line(fp,e,EFLT_BC, 0);
+ print_line(fp,e,EFLT_SS, 0);
+
+ print_line(fp,e,EFLT_WT, 0);
+ print_line(fp,e,EFLT_WL, 0);
+ print_line(fp,e,EFLT_WR, 0);
+
+ print_seq (fp,e,EFLT_SQ);
+}
+
+
+/*
+ * Allocate an set a new experiment file entry
+ */
+char *exp_set_entry(Exp_info *e, int eflt, char *str) {
+ char *s;
+ size_t l;
+
+ if (NULL == ArrayRef(e->entries[eflt], e->Nentries[eflt]))
+ return NULL;
+ else
+ e->Nentries[eflt]++;
+
+ l = strlen(str);
+ if (NULL == (s = exp_get_entry(e, eflt) = (char *)xmalloc(l+1))) {
+ e->Nentries[eflt]--;
+ return NULL;
+ }
+ strcpy(s, str);
+
+ return s;
+}
diff --git a/src/Staden/read/expFileIO.h b/src/Staden/read/expFileIO.h
new file mode 100644
index 0000000..e045a82
--- /dev/null
+++ b/src/Staden/read/expFileIO.h
@@ -0,0 +1,327 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * File: expFileIO.h
+ * Version:
+ *
+ * Description:
+ *
+ * Created:
+ * Updated:
+ *
+ */
+
+#ifndef _EXPFILEIO_H_
+#define _EXPFILEIO_H_
+
+#include <stdio.h>
+
+#include "array.h"
+#include "os.h"
+
+/*
+ * Definitions
+ */
+#define MAXIMUM_EFLT_LENGTH 4
+#define MAXIMUM_EFLTS 60
+#define EFLT_FILE_LINE_LENGTH 128
+#define EXP_FILE_LINE_LENGTH 128
+
+typedef Array Exp_entries;
+
+typedef struct {
+ Array entries[MAXIMUM_EFLTS]; /* array of array of entries */
+ int Nentries[MAXIMUM_EFLTS];
+ FILE *fp;
+} Exp_info;
+
+#define NULL_Exp_info ( (Exp_info *) NULL )
+
+
+
+#define exp_Nentries(E,I) ((E)->Nentries[I]) /* get last entry for line I */
+
+#define exp_get_entry(E,I) (arr(char *,(E)->entries[I],(E)->Nentries[I] - 1)) /* get last entry for line I */
+
+/*
+ * Allocate an set a new experiment file entry
+ */
+extern char *exp_set_entry(Exp_info *e, int eflt, char *str);
+
+
+
+/*************************************************************
+ * Experiment file line types
+ *************************************************************/
+
+extern char eflt_feature_ids[MAXIMUM_EFLTS][MAXIMUM_EFLT_LENGTH+1];
+
+#define EFLT_CF 0
+#define EFLT_CN 1
+#define EFLT_CS 2
+#define EFLT_CV 3
+#define EFLT_DR 4
+#define EFLT_DT 5
+#define EFLT_EN 6
+#define EFLT_EX 7
+#define EFLT_FM 8
+#define EFLT_LN 9
+#define EFLT_LT 10
+#define EFLT_MC 11
+#define EFLT_MN 12
+#define EFLT_MT 13
+#define EFLT_OP 14
+#define EFLT_PN 15
+#define EFLT_QR 16
+#define EFLT_SC 17
+#define EFLT_SF 18
+#define EFLT_SI 19
+#define EFLT_SL 20
+#define EFLT_SP 21
+#define EFLT_SQ 22
+#define EFLT_SR 23
+#define EFLT_ST 24
+#define EFLT_SV 25
+#define EFLT_TN 26
+#define EFLT_QL 27
+#define EFLT_PS 28
+#define EFLT_CC 29
+#define EFLT_SS 30
+#define EFLT_TG 31
+#define EFLT_ID 32
+#define EFLT_AQ 33
+#define EFLT_PR 34
+#define EFLT_LI 35
+#define EFLT_LE 36
+#define EFLT_TC 37
+#define EFLT_AC 38
+#define EFLT_BC 39
+#define EFLT_ON 40
+#define EFLT_AV 41
+#define EFLT_PC 42
+#define EFLT_SE 43
+#define EFLT_CL 44
+#define EFLT_CR 45
+#define EFLT_AP 46
+#define EFLT_CH 47
+#define EFLT_PD 48
+#define EFLT_WT 49
+#define EFLT_NT 50
+#define EFLT_GD 51
+#define EFLT_WL 52
+#define EFLT_WR 53
+
+
+/*************************************************************************************/
+
+
+/*
+ * Creates a string of 'range format' from the start and end points.
+ * The string (of form start..end) is also returned.
+ */
+extern char *exp_create_range(char *str, int start, int end);
+
+/*
+ * Extracts the start and end points from a range string.
+ * Returns 0 for success and -1 for failure.
+ */
+extern int exp_extract_range(char *str, int *start, int *end);
+
+extern int exp_print_line(FILE *fp, Exp_info *e, int eflt, int i);
+/*
+ * Output an experiment file line
+ */
+
+extern int exp_print_seq(FILE *fp, Exp_info *e, int eflt, int i);
+/*
+ * Output an experiment file multi line
+ */
+
+
+
+extern int exp_get_feature_index(char *e);
+
+extern void exp_destroy_info(Exp_info *e);
+/*
+ * Destroy experiment file information
+ */
+
+
+
+extern Exp_info *exp_create_info(void);
+/*
+ * Allocate space for new experiment file information
+ */
+
+
+
+
+
+
+
+extern Exp_info *exp_fread_info(FILE *fp);
+extern Exp_info *exp_read_info(char *file);
+/*
+ * Read in an experiment file and return handle
+ */
+
+
+char *opos2str(int2 *opos, int len, char *buf);
+int str2opos(int2 *opos, int len, char *buf);
+char *conf2str(int1 *conf, int len, char *buf);
+int str2conf(int1 *conf, int len, char *buf);
+
+extern int exp_get_int(Exp_info *e, int id, int *val);
+/*
+ * Get the integer for entry id
+ * returns:
+ * 0 - success
+ * 1 - no entry
+ */
+
+
+extern int exp_get_rng(Exp_info *e, int id, int *from, int *to);
+/*
+ * Get the integer pair for entry id
+ * returns:
+ * 0 - success
+ * 1 - no entry
+ */
+
+
+extern int exp_get_str(Exp_info *e, int id, char *s, f_implicit s_l);
+/*
+ * Get the string for entry id
+ * returns:
+ * 0 - success
+ * 1 - no entry
+ */
+
+
+extern int exp_put_int(Exp_info *e, int id, int *val);
+/*
+ * Append the integer for entry id to the experiment file
+ * returns:
+ * 0 - success
+ * 1 - no update
+ */
+
+
+extern int exp_put_rng(Exp_info *e, int id, int *from, int *to);
+/*
+ * Append the integer pair for entry id to the experiment file
+ * returns:
+ * 0 - success
+ * 1 - no update
+ */
+
+
+
+extern int exp_put_str(Exp_info *e, int id, char *s, f_implicit s_l);
+/*
+ * Append the string for entry id to the experiment file
+ * returns:
+ * 0 - success
+ * 1 - no update
+ */
+
+
+extern void exp_close(Exp_info *e);
+/*
+ * Closes an experiment file (if open), but does not free it.
+ */
+
+/*
+ * FORTRAN INTERFACE
+ */
+
+
+
+extern f_int expopn_(char *fn, f_implicit fn_l);
+/*
+ * FORTRAN interface to exp_open_file()
+ */
+
+extern f_proc_ret expkil_(f_int *le);
+/*
+ * FORTRAN interface to exp_destroy_info
+ */
+
+extern f_int expri_(f_int *le, f_int *id, f_int *val);
+/*
+ * FORTRAN interface to exp_get_int
+ */
+
+
+extern f_int exprr_(f_int *le, f_int *id, f_int *from, f_int *to);
+/*
+ * FORTRAN interface to exp_get_rng
+ */
+
+
+extern f_int exprsa_(f_int *le, f_int *id, char *s, f_int *max_len, f_implicit s_l);
+/*
+ * FORTRAN interface to exp_get_str workalike
+ * NOTE: for use with FORTRAN CHARACTER arrays instead CHARACTER strings
+ */
+
+extern f_int exprs_(f_int *le, f_int *id, char *s, f_implicit s_l);
+/*
+ * FORTRAN interface to exp_get_str workalike
+ * NOTE: for use with FORTRAN CHARACTER strings instead CHARACTER arrays
+ */
+
+extern f_int expwi_(f_int *le, f_int *id, f_int *val);
+/*
+ * FORTRAN interface to exp_put_int
+ */
+
+
+extern f_int expwr_(f_int *le, f_int *id, f_int *from, f_int *to);
+/*
+ * FORTRAN interface to exp_put_rng
+ */
+
+
+
+extern f_int expwsa_(f_int *le, f_int *id, char *s, f_int *max_len, f_implicit s_l);
+/*
+ * FORTRAN interface to exp_put_str workalike
+ * NOTE: for use with FORTRAN CHARACTER arrays instead CHARACTER strings
+ */
+
+
+
+extern f_int expws_(f_int *le, f_int *id, char *s, f_implicit s_l);
+/*
+ * FORTRAN interface to exp_put_str workalike
+ * NOTE: for use with FORTRAN CHARACTER strings instead CHARACTER arrays
+ */
+
+
+extern void exp_print_file(FILE *fp, Exp_info *e);
+
+/*
+ * FORTRAN interface to exp_create_range()
+ */
+extern void expcr_(char *str, f_int *start, f_int *end, f_implicit str_l);
+
+/*
+ * FORTRAN interface to exp_extract_range()
+ */
+extern f_int exper_(char *str, f_int *start, f_int *end, f_implicit str_l);
+
+#endif /* _EXPFILEIO_H_ */
+
diff --git a/src/Staden/read/files.c b/src/Staden/read/files.c
new file mode 100644
index 0000000..ad32138
--- /dev/null
+++ b/src/Staden/read/files.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#include "misc.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Alliant's Concentrix <sys/stat.h> is hugely deficient */
+/* Define things we require in this program */
+/* Methinks S_IFMT and S_IFDIR aren't defined in POSIX */
+#ifndef S_ISDIR
+#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
+#endif /*!S_ISDIR*/
+#ifndef S_ISREG
+#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
+#endif /*!S_ISREG*/
+
+int is_directory(char * fn)
+{
+ struct stat buf;
+ if ( stat(fn,&buf) ) return 0;
+ return S_ISDIR(buf.st_mode);
+}
+
+int is_file(char * fn)
+{
+ struct stat buf;
+ if ( stat(fn,&buf) ) return 0;
+ return S_ISREG(buf.st_mode);
+}
+
+int file_exists(char * fn)
+{
+ struct stat buf;
+ return ( stat(fn,&buf) == 0);
+}
+
+int compressed_file_exists(char *fname)
+{
+ struct stat buf;
+ char fn[2048];
+
+ if (stat(fname, &buf) == 0) return 1;
+
+ sprintf(fn, "%s.gz", fname);
+ if (stat(fn, &buf) == 0) return 1;
+
+ sprintf(fn, "%s.bz", fname);
+ if (stat(fn, &buf) == 0) return 1;
+
+ sprintf(fn, "%s.bz2", fname);
+ if (stat(fn, &buf) == 0) return 1;
+
+ sprintf(fn, "%s.Z", fname);
+ if (stat(fn, &buf) == 0) return 1;
+
+ sprintf(fn, "%s.z", fname);
+ if (stat(fn, &buf) == 0) return 1;
+
+ return 0;
+}
+
+int file_size(char * fn)
+{
+ struct stat buf;
+ if ( stat(fn,&buf) != 0) return 0;
+ return buf.st_size;
+}
+
+/*
+ * ---------------------------------------------------------------------------
+ * File of filename management
+ */
+
+FILE *open_fofn(char *files) {
+ return fopen(files, "r");
+}
+
+char *read_fofn(FILE *fp) {
+ char line[256];
+ static char name[256];
+
+ while (fgets(line, 254, fp)) {
+ if (1 == sscanf(line, "%s", name))
+ return name;
+ }
+
+ return NULL;
+}
+
+void close_fofn(FILE *fp) {
+ fclose(fp);
+}
diff --git a/src/Staden/read/find.c b/src/Staden/read/find.c
new file mode 100644
index 0000000..ba51a04
--- /dev/null
+++ b/src/Staden/read/find.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#include "misc.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* 19/3/99 johnt - added Corba support */
+#ifdef USE_CORBA
+#include "stcorba.h"
+#endif
+
+#ifdef USE_BIOLIMS
+#include "spBiolims.h"
+#endif
+
+char *myfind(char *file, char* searchpath, int (*found) (char *) )
+{
+ static char wholePath[1024];
+ char *path;
+ char *f;
+
+ f = NULL;
+ if (found(file)) {
+ strcpy(wholePath,file);
+ f = wholePath;
+ } else if (searchpath != NULL) {
+ char *paths;
+ char *next;
+
+ paths = (char *) malloc(strlen(searchpath)+1);
+ strcpy(paths,searchpath);
+
+ path = paths;
+ next = strchr(path,':');
+ while( next && (*(next+1) == ':' )){
+ /* 26/03/99 johnt - allow : to be entered into path by using :: */
+ memmove(next,next+1,strlen(next+1)+1); /* shuffle up data [including \0]*/
+ next = strchr(next+1,':');
+ }
+ if(next)
+ *next = '\0';
+
+ while (path!= NULL) {
+
+#ifdef USE_CORBA
+ /* 19/03/99 johnt - if it is a corba path - look there */
+ if( !strncmp( CORBATAG,path,strlen(CORBATAG))){
+ if(corba_found(wholePath,path+strlen(CORBATAG),file)){
+ f = wholePath;
+ break;
+ }
+ }
+ else
+#endif
+#ifdef USE_BIOLIMS
+ if( !strncmp( BIOLIMS_TAG,path,strlen(BIOLIMS_TAG))){
+ if(biolims_found(wholePath,path+strlen(BIOLIMS_TAG),file)){
+ f = wholePath;
+ break;
+ }
+ }
+ else
+#endif
+ {
+ (void) strcpy(wholePath,path);
+ (void) strcat(wholePath,"/");
+ (void) strcat(wholePath,file);
+ if (found(wholePath)) {
+ f = wholePath;
+ break;
+ }
+ }
+ path = next;
+ if( path ){
+ path++;
+ next = strchr(path,':');
+ while( next && (*(next+1) == ':' )){
+ /* 26/03/99 johnt - allow : to be entered into path by using :: */
+ memmove(next,next+1,strlen(next+1)+1); /* shuffle up data */
+ next = strchr(next+1,':');
+ }
+ if(next)
+ *next='\0';
+ }
+ }
+ free(paths);
+ }
+
+ return f;
+}
diff --git a/src/Staden/read/fpoint.c b/src/Staden/read/fpoint.c
new file mode 100644
index 0000000..d3c1671
--- /dev/null
+++ b/src/Staden/read/fpoint.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*#include <math.h>*/
+extern double log ( double x ) ;
+extern double exp ( double x ) ;
+#define IEEE
+
+float int_to_float(int in)
+/*
+** interpret the integer in as a
+** floating point number in IEEE format
+*/
+{
+ /*
+ Assume `in' is stored as a float according to the
+ ANSI IEEE 754-1985 standard. See the tables below:
+
+ s = sign ( 1 bit)
+ e = biased exponent (8 bits)
+ f = fraction (23 bits)
+
+ floating point number = (-1)^s 2^(e-127) 1.f
+
+ Bits Name Content
+ 31 Sign 1 iff number is negative
+ 23-30 Exponent Eight-Bit exponent, biased by 127
+ 0-22 Fraction 23-bit fraction component of normalised significant.
+ The "one" bit is "hidden"
+
+ If IEEE floating point format is supported on your machine...
+ ensure there is a #define IEEE somewhere.
+ */
+
+#ifdef IEEE
+ union {
+ int i;
+ float f;
+ } cvt;
+ cvt.i = in;
+ return cvt.f;
+#else
+ int fraction;
+ int exponent;
+ int sign;
+
+ fraction = in & ( (1<<23)-1 );
+ exponent = (in >> 23) & ( (1<<8)-1 );
+ sign = (in >> 31);
+
+ return
+ (float) (
+ (sign?-1.0:1.0) *
+ exp ( log ( (double) 2.0) * (double) (exponent - 127 - 23) ) *
+ (double) ((1<<23)+fraction)) ;
+#endif
+}
diff --git a/src/Staden/read/fpoint.h b/src/Staden/read/fpoint.h
new file mode 100644
index 0000000..7fe9767
--- /dev/null
+++ b/src/Staden/read/fpoint.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _fpoint_h
+#define _fpoint_h
+
+extern float int_to_float(int in);
+
+#endif /* _fpoint_h */
diff --git a/src/Staden/read/mach-io.c b/src/Staden/read/mach-io.c
new file mode 100644
index 0000000..e7f5255
--- /dev/null
+++ b/src/Staden/read/mach-io.c
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * Machine independant io:
+ * For reading and writing to big-endian and little-endian files
+ *
+ * Routines available:
+ * be_write_int_1()
+ * be_write_int_2()
+ * be_write_int_4()
+ * be_read_int_1()
+ * be_read_int_2()
+ * be_read_int_4()
+ * le_write_int_1()
+ * le_write_int_2()
+ * le_write_int_4()
+ * le_read_int_1()
+ * le_read_int_2()
+ * le_read_int_4()
+ *
+ * All routine return:
+ * 0 - an error has occurred during io operation
+ * 1 - value suggessfully read or written
+ */
+
+#include <stdio.h>
+#include "mach-io.h"
+
+
+
+
+/**********************************************************************/
+/* IO for big-endian files */
+/**********************************************************************/
+
+/*
+ * Write a big-endian int_1
+ */
+int be_write_int_1(FILE *fp, uint_1 *i1)
+{
+ if (fwrite(i1, sizeof(uint_1), 1, fp) != 1) return (0);
+ return (1);
+}
+
+
+/*
+* Write a big-endian int_2
+*/
+int be_write_int_2(FILE *fp, uint_2 *i2)
+{
+ uint_2 i = be_int2(*i2);
+
+ if (fwrite(&i, 2, 1, fp) != 1) return (0);
+ return (1);
+}
+
+/*
+ * Write a big-endian int_4
+ */
+int be_write_int_4(FILE *fp, uint_4 *i4)
+{
+ uint_4 i = be_int4(*i4);
+
+ if (fwrite(&i, 4, 1, fp) != 1) return (0);
+
+ return (1);
+}
+
+
+/*
+ * Read a big-endian int_1
+ */
+int be_read_int_1(FILE *fp, uint_1 *i1)
+{
+ if (fread(i1, sizeof(uint_1), 1, fp) != 1) return (0);
+ return (1);
+}
+
+
+/*
+ * Read a big-endian int_2
+ */
+int be_read_int_2(FILE *fp, uint_2 *i2)
+{
+ uint_2 i;
+
+ if (fread(&i, 2, 1, fp) != 1) return (0);
+ *i2 = be_int2(i);
+
+ return (1);
+}
+
+
+/*
+ * Read a big-endian int_4
+ */
+int be_read_int_4(FILE *fp, uint_4 *i4)
+{
+ uint_4 i;
+
+ if (fread(&i, 4, 1, fp) != 1) return (0);
+ *i4 = be_int4(i);
+
+ return (1);
+}
+
+
+
+
+
+/**********************************************************************/
+/* IO for little-endian files */
+/**********************************************************************/
+
+/*
+ * Write a little-endian int_1
+ */
+int le_write_int_1(FILE *fp, uint_1 *i1)
+{
+ if (fwrite(i1, sizeof(uint_1), 1, fp) != 1) return (0);
+ return (1);
+}
+
+
+/*
+ * Write a little-endian int_2
+ */
+int le_write_int_2(FILE *fp, uint_2 *i2)
+{
+ uint_2 i = le_int2(*i2);
+
+ if (fwrite(&i, 2, 1, fp) != 1) return (0);
+
+ return (1);
+}
+
+
+/*
+ * Write a little-endian int_4
+ */
+int le_write_int_4(FILE *fp, uint_4 *i4)
+{
+ uint_4 i = le_int4(*i4);
+
+ if (fwrite(&i, 4, 1, fp) != 1) return (0);
+
+ return (1);
+}
+
+
+/*
+ * Read a little-endian int_1
+ */
+int le_read_int_1(FILE *fp, uint_1 *i1)
+{
+ if (fread(i1, sizeof(uint_1), 1, fp) != 1) return (0);
+ return (1);
+}
+
+
+/*
+ * Read a little-endian int_2
+ */
+int le_read_int_2(FILE *fp, uint_2 *i2)
+{
+ uint_2 i;
+
+ if (fread(&i, 2, 1, fp) != 1) return (0);
+ *i2 = le_int2(i);
+
+ return (1);
+}
+
+/*
+ * Read a little-endian int_4
+ */
+int le_read_int_4(FILE *fp, uint_4 *i4)
+{
+ uint_4 i;
+
+ if (fread(&i, 4, 1, fp) != 1) return (0);
+ *i4 = le_int4(i);
+
+ return (1);
+}
diff --git a/src/Staden/read/mach-io.h b/src/Staden/read/mach-io.h
new file mode 100644
index 0000000..1290b05
--- /dev/null
+++ b/src/Staden/read/mach-io.h
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _mach_io_h
+#define _mach_io_h
+/*
+ * Machine independant io
+ * For reading and writing to big-endian and little-endian files
+ *
+ * Routines available:
+ * be_write_int_1()
+ * be_write_int_2()
+ * be_write_int_4()
+ * be_read_int_1()
+ * be_read_int_2()
+ * be_read_int_4()
+ * le_write_int_1()
+ * le_write_int_2()
+ * le_write_int_4()
+ * le_read_int_1()
+ * le_read_int_2()
+ * le_read_int_4()
+ *
+ * All routine return:
+ * 0 - an error has occurred during io operation
+ * 1 - value successfully read or written
+ */
+
+#include <stdio.h>
+#include "os.h"
+
+/**********************************************************************/
+/* IO for big-endian files */
+/**********************************************************************/
+
+/*
+ * Write a big-endian int_1
+ */
+extern int be_write_int_1(FILE *fp, uint_1 *i1);
+
+/*
+ * Write a big-endian int_2
+ */
+extern int be_write_int_2(FILE *fp, uint_2 *i2);
+
+/*
+ * Write a big-endian int_4
+ */
+extern int be_write_int_4(FILE *fp, uint_4 *i4);
+
+/*
+ * Read a big-endian int_1
+ */
+extern int be_read_int_1(FILE *fp, uint_1 *i1);
+
+/*
+ * Read a big-endian int_2
+ */
+extern int be_read_int_2(FILE *fp, uint_2 *i2);
+
+/*
+ * Read a big-endian int_4
+ */
+extern int be_read_int_4(FILE *fp, uint_4 *i4);
+
+/**********************************************************************/
+/* IO for little-endian files */
+/**********************************************************************/
+
+/*
+ * Write a little-endian int_1
+ */
+extern int le_write_int_1(FILE *fp, uint_1 *i1);
+
+/*
+ * Write a little-endian int_2
+ */
+extern int le_write_int_2(FILE *fp, uint_2 *i2);
+
+/*
+ * Write a little-endian int_4
+ */
+extern int le_write_int_4(FILE *fp, uint_4 *i4);
+
+/*
+ * Read a little-endian int_1
+ */
+extern int le_read_int_1(FILE *fp, uint_1 *i1);
+
+/*
+ * Read a little-endian int_2
+ */
+extern int le_read_int_2(FILE *fp, uint_2 *i2);
+
+/*
+ * Read a little-endian int_4
+ */
+extern int le_read_int_4(FILE *fp, uint_4 *i4);
+
+
+#endif /* _mach_io_h */
diff --git a/src/Staden/read/misc.h b/src/Staden/read/misc.h
new file mode 100644
index 0000000..84ec4f4
--- /dev/null
+++ b/src/Staden/read/misc.h
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _misc_h
+#define _misc_h
+
+#include <stdio.h>
+#include <stdarg.h> /* varargs needed for v*printf() prototypes */
+#include <sys/types.h>
+
+#include "os.h"
+#include "xalloc.h"
+
+extern int is_directory(char * fn);
+extern int is_file(char * fn);
+extern int file_exists(char * fn);
+extern int compressed_file_exists(char *fname);
+extern int file_size(char * fn);
+extern FILE *open_fofn(char *files);
+extern char *read_fofn(FILE *fp);
+extern void close_fofn(FILE *fp);
+extern int fstrlen(char *f, int max_f);
+extern void f2cstr(char *f, int max_f, char *c, int max_c);
+extern void c2fstr(char *c, int max_c, char *f, int max_f);
+extern char *mystrtok(char *s, char *ct);
+extern char *myfind(char *file, char* searchpath, int (*found) (char *) );
+extern void crash (char* format,...);
+extern void str_tolower (char *s);
+extern void str_toupper (char *s);
+extern char *fn_tail (char *s);
+extern void fn_tolower (char *s);
+extern void fn_toupper (char *s);
+extern void shell_call(char *command, char *output, int len);
+extern char *date_str(void);
+#ifdef NOSTRDUP
+extern char *strdup(const char *s);
+#endif
+#ifdef NOSTRSTR
+extern char *strstr(char *cs, char *ct);
+#endif
+
+#ifdef NOMEMMOVE
+#define memmove(d,s,l) bcopy(s,d,l)
+#endif
+extern int myusleep(unsigned int useconds);
+
+extern void errout(char *fmt, ...);
+extern void messout(char *fmt, ...);
+
+/*
+ * Useful macros
+ */
+#define findfile(F,S) myfind((F),(S),file_exists)
+/*is_file fails for symbolic links*/
+/*#define findfile(F,S) myfind((F),(S),is_file)*/
+
+#if defined(min)
+#undef min
+#undef max
+#endif
+
+#define min(A,B) ( ( (A) < (B) ) ? (A) : (B) )
+#define max(A,B) ( ( (A) > (B) ) ? (A) : (B) )
+#define sgn(A) ( (A) ? ( ( (A) < 0 ) ? -1 : 1 ) : 0 )
+
+#ifdef MIN
+#undef MIN
+#endif
+#define MIN(A,B) ( ( (A) < (B) ) ? (A) : (B) )
+#ifdef MAX
+#undef MAX
+#endif
+#define MAX(A,B) ( ( (A) > (B) ) ? (A) : (B) )
+#define SGN(A) ( (A) ? ( ( (A) < 0 ) ? -1 : 1 ) : 0 )
+#define ABS(A) ( (A) < 0 ? -(A) : (A) )
+
+/* Number of elements in array */
+#define Number(A) ( sizeof(A) / sizeof((A)[0]) )
+
+/*
+ * Things taken from the new gap text_output.h. They'll be used globally
+ * across all the programs in the end.
+ */
+
+/*
+ * Usage: verror(priority, format, args...);
+ * NB: don't pass more than 8K per call
+ */
+#define ERR_WARN 0
+#define ERR_FATAL 1
+void verror(int priority, char *name, char *fmt, ...);
+
+/*
+ * Usage: vmessage(format, args...);
+ * NB: don't pass more than 8K per call
+ */
+void vmessage(char *fmt, ...);
+
+/*
+ * Adds a new header to the text output window.
+ */
+void vfuncheader(char *fmt, ...);
+
+/*
+ * As vfuncheader, but only outputting when necessary.
+ */
+void vfuncgroup(int group, char *fmt, ...);
+
+#endif /*_misc_h*/
diff --git a/src/Staden/read/misc_scf.c b/src/Staden/read/misc_scf.c
new file mode 100644
index 0000000..8e5575d
--- /dev/null
+++ b/src/Staden/read/misc_scf.c
@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ Title: misc_scf.c
+
+ Purpose: misc handling of Standard Chromatogram Format sequences
+ Last update: August 18 1994
+
+ Change log:
+ 18 Aug 1994 Creation from bits of {read,write}scf.c and new code.
+
+*/
+static char fileIdentifier[] = "$Id$";
+
+#include <stdio.h>
+#include <string.h>
+
+#include "scf.h"
+#include "mach-io.h"
+#include "xalloc.h"
+
+float scf_version_str2float(char version[])
+{
+ char v[5];
+ strncpy(v,version,4);v[4]='\0';
+ if (strspn(v,"0123456789. ")!=4) return 0.0;
+ return (float)atof(v);
+}
+
+char *scf_version_float2str(float f)
+{
+ static char v[5];
+
+ sprintf(v, "%1.2f", f);
+ return v;
+}
+
+
+/*
+ * Allocates memory for the scf elements based upon arguments passed.
+ * Returns;
+ * Scf * - Success. The scf structure and it's samples, bases,
+ * and comments fields have been allocated.
+ * NULL - Failure.
+ */
+Scf *scf_allocate(int num_samples, int sample_size, int num_bases,
+ int comment_size, int private_size) {
+ Scf *scf;
+
+ scf = (Scf *)xcalloc(1, sizeof(Scf));
+ if (NULL == scf)
+ return NULL;
+
+ /* bases - +1 as a safety guard for when num_bases==0 */
+ scf->bases = (Bases *)xcalloc(sizeof(Bases), num_bases+1);
+ if (NULL == scf->bases)
+ return NULL;
+
+ /* samples */
+ scf->header.sample_size = sample_size;
+ if (scf->header.sample_size == 1) {
+ scf->samples.samples1 = (Samples1 *)xmalloc(num_samples *
+ sizeof(Samples1) + 1);
+ } else {
+ scf->samples.samples2 = (Samples2 *)xmalloc(num_samples *
+ sizeof(Samples2) + 1);
+ }
+ if (NULL == scf->samples.samples1) {
+ xfree(scf->bases);
+ xfree(scf);
+ return NULL;
+ }
+
+ /* comments */
+ if (comment_size) {
+ scf->comments = (Comments *)xmalloc(sizeof(Comments) *
+ (comment_size + 1));
+ if (NULL == scf->comments) {
+ xfree(scf->bases);
+ xfree(scf->samples.samples1);
+ xfree(scf);
+ return NULL;
+ }
+ } else
+ scf->comments = NULL;
+
+ /* private data */
+ if (private_size) {
+ scf->private_data = (char *)xmalloc(private_size);
+ if (NULL == scf->private_data) {
+ xfree(scf->bases);
+ xfree(scf->samples.samples1);
+ if (scf->comments) xfree(scf->comments);
+ xfree(scf);
+ return NULL;
+ }
+ } else
+ scf->private_data = NULL;
+
+ return scf;
+}
+
+void scf_deallocate(Scf *scf) {
+ xfree(scf->bases);
+ xfree(scf->samples.samples1);
+ if (scf->comments)
+ xfree(scf->comments);
+ if (scf->private_data)
+ xfree(scf->private_data);
+ xfree(scf);
+}
+
+
+int is_scf(char *fn)
+/*
+ * Check to see if file with name `fn' is in SCF format
+ *
+ * Returns:
+ * 1 - is SCF format
+ * 0 - not SCF format
+ *-1 - failure
+ */
+{
+ FILE *fp;
+ uint_4 magic;
+ int ok;
+
+ if ( (fp=fopen(fn,"rb")) == NULL) {
+ ok = -1;
+ } else {
+ if ( be_read_int_4(fp, &magic) != 1 ) {
+ ok = 0;
+ } else {
+ ok = (magic==SCF_MAGIC);
+ }
+ fclose(fp);
+ }
+
+ return ok;
+}
+
+void scf_delta_samples1 ( int1 samples[], int num_samples, int job) {
+
+ /* If job == DELTA_IT:
+ change a series of sample points to a series of delta delta values:
+ ie change them first: delta = current_value - previous_value
+ then delta_delta = delta - previous_delta
+
+ else
+ do the reverse
+ */
+
+ int i;
+
+ if ( DELTA_IT == job ) {
+#ifdef CLEAR_BUT_SLOW
+ int1 p_delta, p_sample;
+
+ p_delta = 0;
+ for (i=0;i<num_samples;i++) {
+ p_sample = samples[i];
+ samples[i] = samples[i] - p_delta;
+ p_delta = p_sample;
+ }
+ p_delta = 0;
+ for (i=0;i<num_samples;i++) {
+ p_sample = samples[i];
+ samples[i] = samples[i] - p_delta;
+ p_delta = p_sample;
+ }
+#else
+ for (i = num_samples-1 ; i > 1; i--) {
+ samples[i] = samples[i] - 2*samples[i-1] + samples[i-2];
+ }
+ samples[1] = samples[1] - 2*samples[0];
+#endif
+
+ } else {
+
+#ifdef CLEAR_BUT_SLOW
+ int1 p_sample;
+
+ p_sample = 0;
+ for (i=0;i<num_samples;i++) {
+ samples[i] = samples[i] + p_sample;
+ p_sample = samples[i];
+ }
+ p_sample = 0;
+ for (i=0;i<num_samples;i++) {
+ samples[i] = samples[i] + p_sample;
+ p_sample = samples[i];
+ }
+#else
+ int1 p_sample1, p_sample2;
+
+ p_sample1 = p_sample2 = 0;
+ for (i = 0; i < num_samples; i++) {
+ p_sample1 = p_sample1 + samples[i];
+ samples[i] = p_sample1 + p_sample2;
+ p_sample2 = samples[i];
+ }
+#endif
+ }
+}
+
+void scf_delta_samples2 ( uint_2 samples[], int num_samples, int job) {
+
+ /* If job == DELTA_IT:
+ change a series of sample points to a series of delta delta values:
+ ie change them first: delta = current_value - previous_value
+ then delta_delta = delta - previous_delta
+
+ else
+ do the reverse
+ */
+
+ register int i;
+
+ if ( DELTA_IT == job ) {
+#ifdef CLEAR_BUT_SLOW
+ register uint_2 p_delta, p_sample;
+
+ p_delta = 0;
+ for (i=0;i<num_samples;i++) {
+ p_sample = samples[i];
+ samples[i] = samples[i] - p_delta;
+ p_delta = p_sample;
+ }
+ p_delta = 0;
+ for (i=0;i<num_samples;i++) {
+ p_sample = samples[i];
+ samples[i] = samples[i] - p_delta;
+ p_delta = p_sample;
+ }
+#else
+ for (i = num_samples-1 ; i > 1; i--) {
+ samples[i] = samples[i] - 2*samples[i-1] + samples[i-2];
+ }
+ samples[1] = samples[1] - 2*samples[0];
+#endif
+
+ } else {
+
+#ifdef CLEAR_BUT_SLOW
+ register uint_2 p_sample;
+
+ p_sample = 0;
+ for (i=0;i<num_samples;i++) {
+ samples[i] = samples[i] + p_sample;
+ p_sample = samples[i];
+ }
+ p_sample = 0;
+ for (i=0;i<num_samples;i++) {
+ samples[i] = samples[i] + p_sample;
+ p_sample = samples[i];
+ }
+#else
+ uint_2 p_sample1, p_sample2;
+
+ p_sample1 = p_sample2 = 0;
+ for (i = 0; i < num_samples; i++) {
+ p_sample1 = p_sample1 + samples[i];
+ samples[i] = p_sample1 + p_sample2;
+ p_sample2 = samples[i];
+ }
+#endif
+ }
+}
+
diff --git a/src/Staden/read/open_trace_file.c b/src/Staden/read/open_trace_file.c
new file mode 100644
index 0000000..2a44779
--- /dev/null
+++ b/src/Staden/read/open_trace_file.c
@@ -0,0 +1,467 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <limits.h>
+#include <sys/types.h>
+#include <dirent.h>
+
+#ifndef PATH_MAX
+# define PATH_MAX 1024
+#endif
+
+#include "open_trace_file.h"
+#include "misc.h"
+#include "tar_format.h"
+#include "compress.h"
+
+static char fileIdentifier[] = "$Id$";
+/*
+ * Supported compression extensions. See the magics array in compress.c for
+ * the full structure.
+ *
+ * #### MHH, Oct. 1, 2003: Added .ztr, and changed order (most likely extensions first).
+ $Log$
+ Revision 1.3 2005/07/23 02:07:06 mschatz
+ Add scf to list of known extensions
+
+ Revision 1.2 2005/07/23 01:31:18 mschatz
+ Fix trace bug, size bug
+
+ Revision 1.1 2005/05/05 16:44:18 aphillip
+ added Staden trace IO package
+
+ Revision 1.4 2004/02/20 22:24:31 mholmes
+ Fixes bug found by Saul Kravitz (failed to open a .ab1 file when full filename speccified).
+
+ Revision 1.4 2004/02/10 20:31:41 skravitz
+ 02/09/04
+ Saul,
+
+ Here's the modified file for the Staden I/O library. I changed the find_file_dir function in open_trace_file.c. It will now find the file if it matches the filename passed in, or if it matches the filename followed by an underbar and additional arbitrary characters.
+
+ For example, if this is the specified path and filename:
+
+ /local/chromo/Chromatograms/GMX/ABISSed/BMY/BMYL/BMYLU/BMYLU04TN
+
+ it will find a file in that directory matching one of these patterns:
+
+ BMYLU04TN
+ BMYLU04TN.<extension>
+ BMYLU04TN_<whatever>
+ BMYLU04TN_<whatever>.<extension>
+
+ where "whatever" can be anything, and "extension" is one of the recognized extensions (.gz, .ztr, etc.).
+
+ I tested this using some renamed files with chrome_server (Cloe) and autoEditor, and also with the extract_seq program of the Staden package.
+
+ Let me know if you have any questions.
+
+
+ Mike
+
+ Revision 1.3 2003/10/02 16:01:36 skravitz
+ Id tag
+
+ Revision 1.2 2003/10/02 16:01:00 skravitz
+ Committed Mike Holmes' changes so that ztr extensions are searched
+
+ */
+static char *magics[] = {"", ".ztr", ".gz", ".bz", ".Z", ".z", ".bz2", ".sz", ".scf", ".ab1"};
+
+/*
+ * Initially produce a new search path where all "::"s are replaced with
+ * a single ":". This is because on windows we need to include colons in
+ * the search path, but colon is also our component separator.
+ *
+ * We explicitly add a "./" to the start of the search path
+ *
+ * Returns: A new search path with items separated by nul chars. Two nul
+ * chars in a row represent the end of the tokenised path.
+ * Returns NULL for a failure.
+ *
+ * The returned data has been malloced. It is up to the caller to free this
+ * memory.
+ */
+static char *tokenise_search_path(char *searchpath) {
+ char *newsearch;
+ unsigned int i, j;
+ size_t len;
+
+ if (!searchpath)
+ searchpath="";
+
+ newsearch = (char *)malloc((len = strlen(searchpath))+5);
+ if (!newsearch)
+ return NULL;
+
+ newsearch[0] = '.';
+ newsearch[1] = '/';
+ newsearch[2] = '\0';
+
+ for (i = 0, j = 3; i < len; i++) {
+ if (i < len-1 && searchpath[i] == ':' && searchpath[i+1] == ':') {
+ newsearch[j++] = ':';
+ i++;
+ continue;
+ }
+
+ if (searchpath[i] == ':') {
+ /* Skip blank path components */
+ if (j && newsearch[j-1] != 0)
+ newsearch[j++] = 0;
+ } else {
+ newsearch[j++] = searchpath[i];
+ }
+ }
+
+ newsearch[j++] = 0;
+ newsearch[j++] = 0;
+
+ return newsearch;
+}
+
+/*
+ * Searches for file in the tar pointed to by tarname. If it finds it, it
+ * copies it out and returns a file pointer to the temporary file,
+ * otherwise we return NULL.
+ *
+ * If 'tarname'.index exists we will use this as a fast lookup method,
+ * otherwise we just do a sequential search through the tar.
+ *
+ * Offset specifies a starting search position. Set this to zero if you want
+ * to search through the entire tar file, otherwise set it to the byte offset
+ * into the file of the tar header block for the desired file to extract.
+ * (Note that the tar index file overrides this value.)
+ *
+ * Returns FILE pointer if found
+ * NULL if not.
+ */
+FILE *find_file_tar(char *file, char *tarname, size_t offset) {
+ int num_magics = sizeof(magics) / sizeof(*magics);
+ char path[PATH_MAX+101];
+ FILE *fp;
+ tar_block blk;
+ int size;
+ int name_len = strlen(file);
+
+ /* Maximum name length for a tar file */
+ if (name_len > 100)
+ return NULL;
+
+ /* Search the index file */
+ sprintf(path, "%s.index", tarname);
+ if (file_exists(path)) {
+ FILE *fpind = fopen(path, "r");
+ char *cp;
+ int tmp_off;
+ int found = 0;
+
+ if (fpind) {
+ while (fgets(path, PATH_MAX+100, fpind)) {
+ if (cp = strchr(path, '\n'))
+ *cp = 0;
+ tmp_off = strtol(path, &cp, 10);
+ while (isspace(*cp))
+ cp++;
+ if (strncmp(cp, file, name_len) == 0) {
+ int i;
+ for (i = 0; i < num_magics; i++) {
+ if (strcmp(&cp[name_len], magics[i]) == 0) {
+ offset = tmp_off;
+ found = 1;
+ break;
+ }
+ }
+ if (found)
+ break;
+ }
+ }
+ fclose(fpind);
+
+ /* Not in index */
+ if (!found)
+ return NULL;
+ }
+ }
+
+ if (NULL == (fp = fopen(tarname, "rb")))
+ return NULL;
+
+ /*
+ * Search through the tar file (starting from index position) looking
+ * for our filename. If there was no index then we start from position 0.
+ */
+ fseek(fp, offset, SEEK_SET);
+ while(fread(&blk, sizeof(blk), 1, fp) == 1) {
+ if (!blk.header.name[0])
+ break;
+
+ /* start with the same name... */
+ if (strncmp(blk.header.name, file, name_len) == 0) {
+ int len;
+ char data[8192];
+ FILE *fpout;
+ char *fname;
+ int i;
+
+ /* ... but does it end with a known compression extension? */
+ for (i = 0; i < num_magics; i++) {
+ if (strcmp(&blk.header.name[name_len], magics[i]) == 0) {
+ break;
+ }
+ }
+ /* ... apparently not? continue then */
+ if (i == num_magics)
+ continue;
+
+ /* Found it - copy out the data to a temporary file */
+ fname = tempnam(NULL, NULL);
+ if (NULL == (fpout = fopen(fname, "wb+"))) {
+ remove(fname);
+ free(fname);
+ fclose(fp);
+ return NULL;
+ }
+ remove(fname);
+ free(fname);
+
+ size = strtol(blk.header.size, NULL, 8);
+ while ((len = fread(data, 1, size > 8192 ? 8192 : size, fp)) > 0) {
+ fwrite(data, 1, len, fpout);
+ size -= len;
+ }
+
+ fclose(fp);
+ fseek(fpout, 0, SEEK_SET);
+ return fpout;
+ }
+
+ size = strtol(blk.header.size, NULL, 8);
+ fseek(fp, TBLOCK*((size+TBLOCK-1)/TBLOCK), SEEK_CUR);
+ }
+
+ fclose(fp);
+ return NULL;
+}
+
+/*
+ * Searches for file in the directory 'dirname'. If it finds it, it opens
+ * it. This also searches for compressed versions of the file in dirname
+ * too.
+ *
+ * This function will find and open files of these forms:
+ *
+ * FILENAME<suffix>
+ * FILENAME_<whatever><suffix>
+ *
+ * Where FILENAME is the value of the file parameter passed in. The ability
+ * to open a file whose name is extended by an underbar followed by arbitrary
+ * text is a TIGR requirement.
+ *
+ * The list of suffixes is specified in the global magics array. This
+ * list includes the empty string (i.e. no suffix), as well as various
+ * suffixes beginning with ".", such as ".gz".
+ *
+ * Returns FILE pointer if found
+ * NULL if not
+ *
+ * #### MHH, Feb. 3, 2004: This function rewritten to support the new file
+ * naming convention FILNAME_<whatever><suffix> adopted by the JTC.
+ *
+ */
+static FILE *find_file_dir(char *file, char *dirname) {
+ char path[PATH_MAX+1];
+ char fullpath[PATH_MAX + 1];
+ size_t len;
+ int num_magics = sizeof(magics) / sizeof(*magics);
+ int i;
+ struct dirent *dp;
+ DIR *dfd;
+ char fname[MAXNAMLEN + 1], filename[MAXNAMLEN + 1], *sptr;
+
+ /* combine dirname and file parameters into a single full file path */
+ /* (Note: the file parameter itself may contain path information too) */
+ len = strlen(dirname);
+ if (len == 0 || strcmp(dirname, "./") == 0)
+ strcpy(fullpath, file);
+ else {
+ if (dirname[len - 1] == '/')
+ sprintf(fullpath, "%s%s", dirname, file);
+ else
+ sprintf(fullpath, "%s/%s", dirname, file);
+ }
+
+ /* see if the file exists under that exact name (with no additional extension) */
+ if (file_exists(fullpath)) {
+ /* yes, try to open it, and return the resulting file pointer */
+ return fopen_compressed(fullpath, NULL);
+ }
+
+ /* now separate the full path into path and filename components */
+ sptr = strrchr(fullpath, '/');
+ if (sptr != NULL) {
+ /* get the path information */
+ len = (size_t)(sptr - fullpath);
+ strncpy(path, fullpath, len);
+ path[len] = '\0';
+
+ /* special case for "./" */
+ if (!strcmp(path, "."))
+ strcpy(path, "./");
+
+ /* filename is everything following the final '/' */
+ strcpy(filename, sptr + 1);
+ }
+ else {
+ /* there is no path information */
+ strcpy(path, "./");
+ strcpy(filename, fullpath);
+ }
+
+ /* save length of file name that must be matched */
+ len = strlen(filename);
+
+ /* open the directory */
+ if ((dfd = opendir(path)) == NULL) {
+ /* error -- can't open directory path */
+ return NULL;
+ }
+
+ /* read directory entries until we find a match */
+ strcpy(fname, "");
+ while (strlen(fname) == 0 && (dp = readdir(dfd)) != NULL) {
+ /* does name from directory match the caller's name in the first len characters? */
+ if ((strncmp(filename, dp->d_name, len)) == 0) {
+ /* yes -- file name must be an exact match, or followed by "_" or "." */
+ if (strlen(dp->d_name) == len) {
+ /* exact match -- point to string terminator for search of magics array */
+ sptr = dp->d_name + len;
+ }
+ else if (dp->d_name[len] == '_' || dp->d_name[len] == '.') {
+ /* find the last "." (if any) in full file name after the required match */
+ sptr = strrchr(dp->d_name + len, '.');
+ if (sptr == NULL) {
+ /* no ".", point to string terminator */
+ sptr = dp->d_name + strlen(dp->d_name);
+ }
+ }
+ else {
+ /* this file is not a candidate */
+ continue;
+ }
+
+ /* see if the extension matches something we recognize */
+ for (i = 0; i < num_magics; i++) {
+ if (!strcmp(sptr, magics[i])) {
+ /* found a matching extension */
+ strcpy(fname, dp->d_name);
+ break;
+ }
+ }
+ }
+ }
+
+ /* close the directory */
+ closedir(dfd);
+
+ /* did we find a matching file? */
+ if (strlen(fname) > 0) {
+ /* yes, build the complete path */
+ if (!strcmp(path, "./"))
+ strcpy(fullpath, fname);
+ else
+ sprintf(fullpath, "%s/%s", path, fname);
+
+ fprintf(stderr, "open_trace_file fullpath: %s\n", fullpath);
+
+ /* open the file and return its file pointer */
+ return fopen_compressed(fullpath, NULL);
+ }
+
+ /* no match found */
+ return NULL;
+}
+
+/*
+ * ------------------------------------------------------------------------
+ * Public functions below.
+ */
+
+/*
+ * Opens a trace file named 'file'. This is initially looked for as a
+ * pathname relative to a file named "relative_to". This may (for
+ * example) be the name of an experiment file referencing the trace
+ * file. In this case by passing relative_to as the experiment file
+ * filename the trace file will be picked up in the same directory as
+ * the experiment file. Relative_to may be supplied as NULL.
+ *
+ * 'file' is looked for at relative_to, then the current directory, and then
+ * all of the locations listed in RAWDATA (which is a colon separated list).
+ *
+ * Returns a FILE pointer when found.
+ * NULL otherwise.
+ */
+FILE *open_trace_file(char *file, char *relative_to) {
+ char *newsearch;
+ char *ele;
+ FILE *fp;
+
+ /* Look in the same location as the incoming 'relative_to' filename */
+ if (relative_to) {
+ char *cp;
+ char relative_path[PATH_MAX+1];
+ strcpy(relative_path, relative_to);
+ if (cp = strrchr(relative_path, '/'))
+ *cp = 0;
+ if (fp = find_file_dir(file, relative_path))
+ return fp;
+ }
+
+ /* Not found it yet? use RAWDATA then */
+ if (NULL == (newsearch = tokenise_search_path(getenv("RAWDATA"))))
+ return NULL;
+
+ /*
+ * Step through the search path testing out each component.
+ * We now look through each path element treating some prefixes as
+ * special, otherwise we treat the element as a directory.
+ */
+ for (ele = newsearch; *ele; ele += strlen(ele)+1) {
+ if (0 == strncmp(ele, "TAR=", 4)) {
+ if (fp = find_file_tar(file, ele+4, 0)) {
+ free(newsearch);
+ return fp;
+ }
+ } else {
+ if (fp = find_file_dir(file, ele)) {
+ free(newsearch);
+ return fp;
+ }
+ }
+ }
+
+ free(newsearch);
+
+ return NULL;
+}
+
+int find_trace_file(void) {
+ puts("Called find_trace_file");
+ return 0;
+}
diff --git a/src/Staden/read/open_trace_file.h b/src/Staden/read/open_trace_file.h
new file mode 100644
index 0000000..39318c8
--- /dev/null
+++ b/src/Staden/read/open_trace_file.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _OPEN_TRACE_FILE_H_
+#define _OPEN_TRACE_FILE_H_
+
+/*
+ * Opens a trace file named 'file'. This is initially looked for as a
+ * pathname relative to a file named "relative_to". This may (for
+ * example) be the name of an experiment file referencing the trace
+ * file. In this case by passing relative_to as the experiment file
+ * filename the trace file will be picked up in the same directory as
+ * the experiment file. Relative_to may be supplied as NULL.
+ *
+ * 'file' is looked for at relative_to, then the current directory, and then
+ * all of the locations listed in RAWDATA (which is a colon separated list).
+ *
+ * Returns a FILE pointer when found.
+ * NULL otherwise.
+ */
+FILE *open_trace_file(char *file, char *relative_to);
+
+
+/*
+ * Searches for file in the tar pointed to by tarname. If it finds it, it
+ * copies it out and returns a file pointer to the temporary file,
+ * otherwise we return NULL.
+ *
+ * If 'tarname'.index exists we will use this as a fast lookup method,
+ * otherwise we just do a sequential search through the tar.
+ *
+ * Offset specifies a starting search position. Set this to zero if you want
+ * to search through the entire tar file, otherwise set it to the byte offset
+ * into the file of the tar header block for the desired file to extract.
+ * (Note that the tar index file overrides this value.)
+ *
+ * Returns FILE pointer if found
+ * NULL if not.
+ */
+FILE *find_file_tar(char *file, char *tarname, size_t offset);
+
+#endif /* _OPEN_TRACE_FILE_H_ */
diff --git a/src/Staden/read/os.h b/src/Staden/read/os.h
new file mode 100644
index 0000000..93668d1
--- /dev/null
+++ b/src/Staden/read/os.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _OS_H_
+#define _OS_H_
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <inttypes.h>
+#include <limits.h>
+
+
+/* Integer sizes */
+typedef unsigned char uint1;
+typedef signed char int1;
+typedef uint16_t uint2;
+typedef int16_t int2;
+typedef uint32_t uint4;
+typedef int32_t int4;
+
+/* For backwards compatibility */
+typedef int1 int_1;
+typedef uint1 uint_1;
+typedef int2 int_2;
+typedef uint2 uint_2;
+typedef int4 int_4;
+typedef uint4 uint_4;
+
+/* Fortran types */
+typedef int4 f_int;
+typedef int4 f_implicit;
+typedef void f_proc_ret; /* FORTRAN procedure return value */
+
+/* For backwards compatibility */
+typedef int4 int_f; /* f_int */
+typedef int4 int_fl; /* f_implicit */
+#define f_proc_return() return /* (f_proc_ret) 0 */
+
+#define MAXINT4 (INT_MAX)
+#define MAXINT2 (SHRT_MAX)
+
+#define False 0
+#define True 1
+
+/*
+ * Our new swap runs at the same speed on Ultrix, but substantially faster
+ * (300% for swap_int4, ~50% for swap_int2) on an Alpha (due to the lack of
+ * decent 'char' support).
+ *
+ * They also have the ability to swap in situ (src == dst). Newer code now
+ * relies on this so don't change back!
+ */
+#define swap_int4(src, dst) \
+ dst = ((src & 0x000000ff) << 24) + \
+ ((src & 0x0000ff00) << 8) + \
+ ((src & 0x00ff0000) >> 8) + \
+ ((src & 0xff000000) >> 24)
+
+#define swap_int2(src, dst) \
+ dst = ((src & 0x00ff) << 8) + \
+ ((src & 0xff00) >> 8)
+
+/*
+ * Slightly updated swap_int? routines that return results rather than
+ * swapping from source to destination.
+ */
+#define iswap_int4(x) \
+ (((x & 0x000000ff) << 24) + \
+ ((x & 0x0000ff00) << 8) + \
+ ((x & 0x00ff0000) >> 8) + \
+ ((x & 0xff000000) >> 24))
+
+#define iswap_int2(x) \
+ (((x & 0x00ff) << 8) + \
+ ((x & 0xff00) >> 8))
+
+/*
+ * Macros to specify that data read in is of a particular endianness.
+ * The macros here swap to the appropriate order for the particular machine
+ * running the macro and return the new answer. These may also be used when
+ * writing to a file to specify that we wish to write in (eg) big endian
+ * format.
+ *
+ * This leads to efficient code as most of the time these macros are
+ * trivial.
+ */
+#ifdef WORDS_BIGENDIAN
+# define be_int4(x) (x)
+# define be_int2(x) (x)
+# define be_int1(x) (x)
+# define le_int4(x) iswap_int4((x))
+# define le_int2(x) iswap_int2((x))
+# define le_int1(x) (x)
+#else
+# define SP_LITTLE_ENDIAN 1
+# define be_int4(x) iswap_int4((x))
+# define be_int2(x) iswap_int2((x))
+# define be_int1(x) (x)
+# define le_int4(x) (x)
+# define le_int2(x) (x)
+# define le_int1(x) (x)
+#endif
+
+#endif /* _OS_H_ */
diff --git a/src/Staden/read/plain.h b/src/Staden/read/plain.h
new file mode 100644
index 0000000..88dce74
--- /dev/null
+++ b/src/Staden/read/plain.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _seqIOPlain_h
+#define _seqIOPlain_h
+
+
+/*
+ * Title: seqIOPlain
+ *
+ * File: seqIOPlain.h
+ * Purpose: IO of plain sequences
+ * Last update: Fri 9th September 1994
+ */
+
+
+
+
+/* ---- Imports ---- */
+
+
+#include "Read.h"
+
+
+/* ---- Exports ---- */
+
+
+/*
+ * Read the plain format sequence with name `fn' into a Read structure.
+ * All printing characters (as defined by ANSII C `isprint')
+ * are accepted, but `N's are translated to `-'s.
+ *
+ * Returns:
+ * Read * - Success, the Read structure read.
+ * NULLRead - Failure.
+ */
+extern Read *read_pln(char *fn);
+extern Read *fread_pln(FILE *fp);
+
+#endif /*_seqIOPlain_h*/
diff --git a/src/Staden/read/read_alloc.c b/src/Staden/read/read_alloc.c
new file mode 100644
index 0000000..0fe3354
--- /dev/null
+++ b/src/Staden/read/read_alloc.c
@@ -0,0 +1,271 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * File: read_alloc.c
+ * Purpose: Performs the allocation/freeing of Read structures
+ * Last update: 01/09/94
+ */
+
+
+/*
+ The Read data type is designed so that it can hold a varying degree
+ of information about sequences, yet have a single set of calls
+ to access the data.
+
+ There are plenty of assumptions around that both the number of
+ bases and the number of points will fit into an int_2, a short.
+
+*/
+
+/* ---- Includes ---- */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include "misc.h"
+#include "Read.h"
+
+/*
+ * Allocate a new sequence, with the given sizes.
+ * Returns:
+ * "Read *" for success
+ * "NULLRead" for failure
+ */
+Read *read_allocate(int num_points, int num_bases) {
+ Read *seq = NULLRead;
+
+ int sections = read_sections(0);
+ int padding = 1;
+ int length_of_bases;
+ int length_of_traces;
+
+ /* Allocate the body of the sequence */
+ if ((seq = (Read *)xmalloc(sizeof(Read))) == NULL)
+ return(NULLRead);
+
+ seq->NPoints = num_points;
+ seq->NBases = num_bases;
+
+ /*
+ * Initialise the body, all pointers are set to NULL so we can
+ * happily call `read_deallocate()`.
+ */
+ seq->leftCutoff = 0;
+ seq->rightCutoff = 0;
+ seq->maxTraceVal = 0;
+
+ seq->traceC = NULL;
+ seq->traceA = NULL;
+ seq->traceG = NULL;
+ seq->traceT = NULL;
+
+ seq->base = NULL;
+ seq->basePos = NULL;
+
+ seq->info = NULL;
+ seq->format = TT_ANY;
+ seq->trace_name = NULL;
+
+ seq->prob_A = NULL;
+ seq->prob_C = NULL;
+ seq->prob_G = NULL;
+ seq->prob_T = NULL;
+
+ seq->orig_trace_format = TT_ANY;
+ seq->orig_trace = NULL;
+ seq->orig_trace_free = NULL;
+
+ seq->ident = NULL;
+
+ /* Allocate space for the bases - 1 extra for the ->base field so
+ * that we can treat it as a NULL terminated string.
+ */
+ length_of_bases = num_bases + padding;
+ if (sections & READ_BASES &&
+ (((seq->base = (char *)xmalloc(num_bases+1)) == NULL) ||
+ ((seq->basePos = (uint_2 *)xcalloc(length_of_bases,sizeof(uint_2))) == NULL) ||
+ ((seq->prob_A = (char *)xcalloc(length_of_bases,sizeof(char))) == NULL) ||
+ ((seq->prob_C = (char *)xcalloc(length_of_bases,sizeof(char))) == NULL) ||
+ ((seq->prob_G = (char *)xcalloc(length_of_bases,sizeof(char))) == NULL) ||
+ ((seq->prob_T = (char *)xcalloc(length_of_bases,sizeof(char))) == NULL))
+ )
+ {
+ read_deallocate(seq);
+ return NULLRead;
+ }
+
+ length_of_traces = num_points + padding;
+ if (sections & READ_SAMPLES &&
+ (((seq->traceC =(TRACE *)xcalloc(length_of_traces, sizeof(uint_2))) == NULL)||
+ ((seq->traceA =(TRACE *)xcalloc(length_of_traces, sizeof(uint_2))) == NULL)||
+ ((seq->traceG =(TRACE *)xcalloc(length_of_traces, sizeof(uint_2))) == NULL)||
+ ((seq->traceT =(TRACE *)xcalloc(length_of_traces, sizeof(uint_2))) == NULL))
+ )
+ {
+ read_deallocate(seq);
+ return NULLRead;
+ }
+
+ return seq;
+}
+
+
+/*
+ * Free memory allocated to a sequence by read_allocate().
+ */
+void read_deallocate(Read *read)
+{
+ if (read == NULLRead)
+ return;
+
+ if (read->traceC != NULL) xfree(read->traceC);
+ if (read->traceA != NULL) xfree(read->traceA);
+ if (read->traceG != NULL) xfree(read->traceG);
+ if (read->traceT != NULL) xfree(read->traceT);
+
+ if (read->base != NULL) xfree(read->base);
+ if (read->basePos != NULL) xfree(read->basePos);
+
+ if (read->info != NULL) xfree(read->info);
+
+ if (read->prob_A != NULL) xfree(read->prob_A);
+ if (read->prob_C != NULL) xfree(read->prob_C);
+ if (read->prob_G != NULL) xfree(read->prob_G);
+ if (read->prob_T != NULL) xfree(read->prob_T);
+
+ if (read->trace_name != NULL) xfree(read->trace_name);
+
+ if (read->orig_trace != NULL) {
+ if (read->orig_trace_free)
+ read->orig_trace_free(read->orig_trace);
+ else
+ xfree(read->orig_trace);
+ }
+
+ if (read->ident != NULL)
+ xfree(read->ident);
+
+ xfree(read);
+
+}
+
+
+
+
+/*
+ * Duplicates the read structure and optionally gives it a new filename.
+ * The following fields are not duplicated:
+ *
+ * int orig_trace_format;
+ * void (*orig_trace_free)(void *ptr);
+ * void *orig_trace;
+ * char *ident;
+ *
+ * Returns:
+ * "Read *" for success
+ * "NULLRead" for failure
+ */
+Read* read_dup( Read* src, const char* new_name )
+{
+ int n;
+ Read* dst;
+ assert(src);
+ while(1)
+ {
+ /* Allocate storage and initialise */
+ dst = read_allocate( src->NPoints, src->NBases );
+ if( dst == NULLRead )
+ return 0;
+ dst->info = 0;
+ dst->trace_name = 0;
+
+
+ /* Copy over possibly new name */
+ if( new_name )
+ n = strlen(new_name);
+ else if( src->trace_name )
+ n = strlen(src->trace_name);
+ else
+ n = 0;
+ if( n > 0 )
+ {
+ dst->trace_name = (char*) xmalloc(n+1);
+ if( !dst->trace_name )
+ break;
+ if(new_name)
+ strcpy( dst->trace_name, new_name );
+ else
+ strcpy( dst->trace_name, src->trace_name );
+ }
+
+
+ /* Copy over info */
+ if( src->info )
+ {
+ dst->info = (char*) xmalloc( strlen(src->info)+1 );
+ if( !dst->info )
+ break;
+ }
+
+
+ /* Copy single fields */
+ dst->format = src->format;
+ dst->maxTraceVal = src->maxTraceVal;
+ dst->leftCutoff = src->leftCutoff;
+ dst->rightCutoff = src->rightCutoff;
+
+
+ /* Copy NPoints fields if they exist */
+ if( src->traceA )
+ {
+ for( n=0; n<src->NPoints; n++ )
+ {
+ dst->traceA[n] = src->traceA[n];
+ dst->traceC[n] = src->traceC[n];
+ dst->traceG[n] = src->traceG[n];
+ dst->traceT[n] = src->traceT[n];
+ }
+ }
+
+
+ /* Copy NBases fields if they exist */
+ if( src->base )
+ {
+ for( n=0; n<src->NBases; n++ )
+ {
+ dst->base[n] = src->base[n];
+ dst->basePos[n] = src->basePos[n];
+ if( src->prob_A )
+ {
+ dst->prob_A[n] = src->prob_A[n];
+ dst->prob_C[n] = src->prob_C[n];
+ dst->prob_G[n] = src->prob_G[n];
+ dst->prob_T[n] = src->prob_T[n];
+ }
+ }
+ }
+
+
+ /* Success */
+ return dst;
+ }
+
+
+ /* Failure */
+ read_deallocate(dst);
+ return NULLRead;
+}
diff --git a/src/Staden/read/read_scf.c b/src/Staden/read/read_scf.c
new file mode 100644
index 0000000..998e407
--- /dev/null
+++ b/src/Staden/read/read_scf.c
@@ -0,0 +1,462 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ Title: read_scf.c
+
+ Purpose: read IO of Standard Chromatogram Format sequences
+ Last update: August 18 1994
+
+ Change log:
+ 4 Feb 1992, Now draft proposal version 2
+ 20 Feb 1992, Grab info from comment lines
+ 19 Aug 1992, If SCF file has clip information, don't clip automatically
+ 10 Nov 1992 SCF comments now stored in seq data structure
+ 18 Aug 1994 Renamed from ReadIOSCF.c; now purely SCF IO (no Seq structs)
+
+*/
+static char fileIdentifier[] = "$Id$";
+
+/* ---- Imports ---- */
+
+#include <ctype.h>
+#include <stdio.h> /* IMPORT: fopen, fclose, fseek, ftell, fgetc,
+ EOF */
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include "scf.h" /* SCF structures */
+#include "mach-io.h"
+#include "xalloc.h"
+#include "compress.h"
+#include "Read.h"
+
+/* SunOS4 has it's definitions in unistd, which we won't include for compat. */
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+#endif
+
+/* ---- Exported functions ---- */
+
+int read_scf_header(FILE *fp, Header *h)
+{
+ int i;
+
+ if (be_read_int_4(fp,&h->magic_number)==False) return -1;
+
+ if (h->magic_number != SCF_MAGIC)
+ return -1;
+
+ if (be_read_int_4(fp,&h->samples)==False) return -1;
+ if (be_read_int_4(fp,&h->samples_offset)==False) return -1;
+ if (be_read_int_4(fp,&h->bases)==False) return -1;
+ if (be_read_int_4(fp,&h->bases_left_clip)==False) return -1;
+ if (be_read_int_4(fp,&h->bases_right_clip)==False) return -1;
+ if (be_read_int_4(fp,&h->bases_offset)==False) return -1;
+ if (be_read_int_4(fp,&h->comments_size)==False) return -1;
+ if (be_read_int_4(fp,&h->comments_offset)==False) return -1;
+ if (fread(&h->version[0],sizeof(h->version),1,fp)!=1) return -1;
+ if (be_read_int_4(fp,&h->sample_size)==False) return -1;
+ if (be_read_int_4(fp,&h->code_set)==False) return -1;
+ if (be_read_int_4(fp,&h->private_size)==False) return -1;
+ if (be_read_int_4(fp,&h->private_offset)==False) return -1;
+ for (i=0;i<18;i++)
+ if (be_read_int_4(fp,&h->spare[i])==False) return -1;
+
+ return 0;
+}
+
+
+int read_scf_sample1(FILE *fp, Samples1 *s)
+{
+ uint_1 buf[4];
+
+ if (4 != fread(buf, 1, 4, fp)) return -1;
+ s->sample_A = buf[0];
+ s->sample_C = buf[1];
+ s->sample_G = buf[2];
+ s->sample_T = buf[3];
+
+/*
+ if (1 != fread(s, 4, 1, fp)) return -1;
+*/
+
+ return 0;
+}
+
+
+int read_scf_sample2(FILE *fp, Samples2 *s)
+{
+ uint_2 buf[4];
+
+ if (4 != fread(buf, 2, 4, fp)) return -1;
+ s->sample_A = be_int2(buf[0]);
+ s->sample_C = be_int2(buf[1]);
+ s->sample_G = be_int2(buf[2]);
+ s->sample_T = be_int2(buf[3]);
+
+ return 0;
+}
+
+int read_scf_samples1(FILE *fp, Samples1 *s, size_t num_samples) {
+ size_t i;
+
+ for (i = 0; i < num_samples; i++) {
+ if (-1 == read_scf_sample1(fp, &(s[i])))
+ return -1;
+ }
+
+ return 0;
+}
+
+
+int read_scf_samples2(FILE *fp, Samples2 *s, size_t num_samples) {
+ size_t i;
+
+ for (i = 0; i < num_samples; i++) {
+ if (-1 == read_scf_sample2(fp, &(s[i])))
+ return -1;
+ }
+
+ return 0;
+}
+
+
+int read_scf_samples32(FILE *fp, Samples2 *s, size_t num_samples) {
+ size_t i;
+ uint2 *samples_out;
+
+ /* version to read delta delta data in 2 bytes */
+
+ if ( ! (samples_out = (uint2 *)xmalloc((num_samples+1) *
+ sizeof(uint2)))) {
+ return -1;
+ }
+
+
+ if (num_samples != fread(samples_out, 2, num_samples, fp)) return -1;
+#ifdef SP_LITTLE_ENDIAN
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = be_int2(samples_out[i]);
+ }
+#endif
+ scf_delta_samples2 ( samples_out, num_samples, 0);
+ for (i = 0; i < num_samples; i++) {
+ (&s[i])->sample_A = samples_out[i];
+ }
+
+ if (num_samples != fread(samples_out, 2, num_samples, fp)) return -1;
+#ifdef SP_LITTLE_ENDIAN
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = be_int2(samples_out[i]);
+ }
+#endif
+ scf_delta_samples2 ( samples_out, num_samples, 0);
+ for (i = 0; i < num_samples; i++) {
+ (&s[i])->sample_C = samples_out[i];
+ }
+
+ if (num_samples != fread(samples_out, 2, num_samples, fp)) return -1;
+#ifdef SP_LITTLE_ENDIAN
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = be_int2(samples_out[i]);
+ }
+#endif
+ scf_delta_samples2 ( samples_out, num_samples, 0);
+ for (i = 0; i < num_samples; i++) {
+ (&s[i])->sample_G = samples_out[i];
+ }
+
+ if (num_samples != fread(samples_out, 2, num_samples, fp)) return -1;
+#ifdef SP_LITTLE_ENDIAN
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = be_int2(samples_out[i]);
+ }
+#endif
+ scf_delta_samples2 ( samples_out, num_samples, 0);
+ for (i = 0; i < num_samples; i++) {
+ (&s[i])->sample_T = samples_out[i];
+ }
+ xfree(samples_out);
+ return 0;
+}
+
+int read_scf_samples31(FILE *fp, Samples1 *s, size_t num_samples) {
+ size_t i;
+ int1 *samples_out;
+
+ /* version to read delta delta data in 1 byte */
+
+ if ( ! (samples_out = (int1 *)xmalloc((num_samples+1) *
+ sizeof(int1)))) {
+ return -1;
+ }
+
+ if (num_samples != fread(samples_out, 1, num_samples, fp)) return -1;
+ scf_delta_samples1 ( samples_out, num_samples, 0);
+ for (i = 0; i < num_samples; i++) {
+ (&s[i])->sample_A = samples_out[i];
+ }
+
+ if (num_samples != fread(samples_out, 1, num_samples, fp)) return -1;
+ scf_delta_samples1 ( samples_out, num_samples, 0);
+ for (i = 0; i < num_samples; i++) {
+ (&s[i])->sample_C = samples_out[i];
+ }
+
+ if (num_samples != fread(samples_out, 1, num_samples, fp)) return -1;
+ scf_delta_samples1 ( samples_out, num_samples, 0);
+ for (i = 0; i < num_samples; i++) {
+ (&s[i])->sample_G = samples_out[i];
+ }
+
+ if (num_samples != fread(samples_out, 1, num_samples, fp)) return -1;
+ scf_delta_samples1 ( samples_out, num_samples, 0);
+ for (i = 0; i < num_samples; i++) {
+ (&s[i])->sample_T = samples_out[i];
+ }
+
+ xfree(samples_out);
+ return 0;
+}
+
+int read_scf_base(FILE *fp, Bases *b)
+{
+ uint_1 buf[12];
+
+ if (1 != fread(buf, 12, 1, fp)) return -1;
+ b->peak_index = be_int4(((uint_4 *)buf)[0]);
+ b->prob_A = buf[4];
+ b->prob_C = buf[5];
+ b->prob_G = buf[6];
+ b->prob_T = buf[7];
+ b->base = buf[8];
+ b->spare[0] = buf[9];
+ b->spare[1] = buf[10];
+ b->spare[2] = buf[11];
+
+ return 0;
+}
+
+
+int read_scf_bases(FILE *fp, Bases *b, size_t num_bases) {
+ size_t i;
+
+ for (i = 0; i < num_bases; i++) {
+ if (-1 == read_scf_base(fp, &(b[i])))
+ return -1;
+ }
+
+ return 0;
+}
+
+int read_scf_bases3(FILE *fp, Bases *b, size_t num_bases)
+{
+ size_t i;
+ uint_4 *buf4;
+ uint_1 *buf1;
+
+ if (NULL == (buf4 = (uint_4 *)xmalloc(1 + 4 * num_bases)))
+ return -1;
+
+ if (NULL == (buf1 = (uint_1 *)xmalloc(1 + 8 * num_bases))) {
+ xfree(buf4);
+ return -1;
+ }
+
+ if (num_bases != fread(buf4, 4, num_bases, fp)) return -1;
+ for (i=0; i < num_bases; i++)
+ (&b[i])->peak_index = be_int4(buf4[i]);
+
+ if (8 * num_bases != fread(buf1, 1, 8 * num_bases, fp)) return -1;
+
+ for (i=0; i < num_bases; i++) {
+ (&b[i])->prob_A = buf1[i];
+ (&b[i])->prob_C = buf1[i+num_bases];
+ (&b[i])->prob_G = buf1[i+2*num_bases];
+ (&b[i])->prob_T = buf1[i+3*num_bases];
+ (&b[i])->base = buf1[i+4*num_bases];
+ (&b[i])->spare[0] = buf1[i+5*num_bases];
+ (&b[i])->spare[1] = buf1[i+6*num_bases];
+ (&b[i])->spare[2] = buf1[i+7*num_bases];
+ }
+
+ xfree(buf4);
+ xfree(buf1);
+
+ return 0;
+}
+
+
+
+int read_scf_comment(FILE *fp, Comments *c, size_t s)
+{
+ if (fread(c, 1, s, fp) != s) return -1;
+
+ return 0;
+}
+
+
+/*
+ * Read the SCF format sequence from FILE *fp into a 'scf' structure.
+ * A NULL result indicates failure.
+ */
+Scf *fread_scf(FILE *fp) {
+ Scf *scf;
+ Header h;
+ int err;
+ float scf_version;
+ int sections = read_sections(0);
+
+ /* Read header */
+ if (read_scf_header(fp, &h) == -1) {
+ return NULL;
+ }
+
+ /* Allocate memory */
+ if (NULL == (scf = scf_allocate(h.samples, h.sample_size,
+ h.bases, h.comments_size,
+ h.private_size)))
+ return NULL;
+
+ /* fake things for older style SCF -- SD */
+ if (h.sample_size != 1 && h.sample_size != 2) h.sample_size = 1;
+
+ scf_version = scf_version_str2float(h.version);
+
+ memcpy(&scf->header, &h, sizeof(Header));
+
+ if (sections & READ_SAMPLES) {
+ /* Read samples */
+ if (fseek(fp, (off_t)h.samples_offset, 0 /* SEEK_SET */) != 0) {
+ scf_deallocate(scf);
+ return NULL;
+ }
+
+ if ( 2.9 > scf_version ) {
+
+ if (h.sample_size == 1) {
+ err= read_scf_samples1(fp, scf->samples.samples1, h.samples);
+ }
+ else {
+ err= read_scf_samples2(fp, scf->samples.samples2, h.samples);
+ }
+ }
+ else {
+
+ if (h.sample_size == 1) {
+ err= read_scf_samples31(fp, scf->samples.samples1, h.samples);
+ }
+ else {
+ err= read_scf_samples32(fp, scf->samples.samples2, h.samples);
+ }
+ }
+ if (-1 == err) {
+ scf_deallocate(scf);
+ return NULL;
+ }
+ }
+
+ if (sections & READ_BASES) {
+ /* Read bases */
+ if (fseek(fp, (off_t)h.bases_offset, 0 /* SEEK_SET */) != 0) {
+ scf_deallocate(scf);
+ return NULL;
+ }
+
+ if ( 2.9 > scf_version ) {
+
+ if (-1 == read_scf_bases(fp, scf->bases, h.bases)) {
+ scf_deallocate(scf);
+ return NULL;
+ }
+ }
+ else {
+
+ if (-1 == read_scf_bases3(fp, scf->bases, h.bases)) {
+ scf_deallocate(scf);
+ return NULL;
+ }
+ }
+ }
+
+ if (sections & READ_COMMENTS) {
+ /* Read comments */
+ if (scf->comments) {
+ if (fseek(fp,(off_t)(h.comments_offset), 0) != 0
+ || -1 == read_scf_comment(fp, scf->comments,
+ h.comments_size)) {
+ /*
+ * Was: "scf_deallocate(scf); return NULL;".
+ * We now simply clear the comments and gracefully continue.
+ */
+ fprintf(stderr, "Warning: SCF file had invalid comment field\n");
+ xfree(scf->comments);
+ scf->comments = NULL;
+ } else {
+ scf->comments[h.comments_size] = '\0';
+ }
+ }
+ // Tack on the NPTS and NBAS fields to the comments, if they weren't there in the original
+ if(!scf->comments || !strstr(scf->comments,"NPTS=")){ // SAK
+ char line[1024]="", comment[1024] = "";
+ int comment_len = 0;
+ // Add the number of chromatogram points
+ sprintf(line, "NPTS=%d\n", scf->header.samples);
+ strcat(comment, line);
+ // Add the number of called bases
+ sprintf(line, "NBAS=%d\n", scf->header.bases);
+ strcat(comment, line);
+
+ comment_len = strlen(scf->comments) + strlen(comment) + 2;
+ scf->comments = xrealloc(scf->comments, comment_len);
+ scf->header.comments_size = comment_len;
+ strcat(scf->comments, comment);
+ }
+ }
+
+ /* Read private data */
+ if (h.private_size) {
+ if (-1 == fseek(fp, (off_t)(h.private_offset), 0) ||
+ h.private_size != fread(scf->private_data, 1, h.private_size, fp)){
+ scf_deallocate(scf);
+ return NULL;
+ }
+ }
+
+ return scf;
+}
+
+/*
+ * Read the SCF format sequence with name `fn' into a 'scf' structure.
+ * A NULL result indicates failure.
+ */
+Scf *read_scf(char *fn) {
+ Scf *scf;
+
+ FILE *fp;
+
+ /* Open fn for reading in binary mode */
+
+ if (NULL == (fp = fopen_compressed(fn, NULL)))
+ return NULL;
+
+ scf = fread_scf(fp);
+ fclose(fp);
+
+ return scf;
+}
diff --git a/src/Staden/read/scf.h b/src/Staden/read/scf.h
new file mode 100644
index 0000000..375a493
--- /dev/null
+++ b/src/Staden/read/scf.h
@@ -0,0 +1,435 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * File: scf.h
+ * Version: 3.00
+ *
+ * Description: file structure definitions for SCF file
+ *
+ * Created: 19 November 1992
+ *
+ */
+
+#ifndef _SCF_H_
+#define _SCF_H_
+
+#include <stdio.h>
+#include <sys/types.h>
+#include "os.h"
+
+/*
+ *-----------------------------------------------------------------------------
+ * Macros
+ *-----------------------------------------------------------------------------
+ */
+
+/* The SCF magic number */
+#define SCF_MAGIC (((((uint_4)'.'<<8)+(uint_4)'s'<<8)+(uint_4)'c'<<8)+(uint_4)'f')
+
+/* prior to this was a different format */
+#define SCF_VERSION_OLDEST 2.00
+#define SCF_VERSION_OLD 2.02
+
+/* The current SCF format level */
+#define SCF_VERSION 3.00
+
+/* Uncertainty code sets supported */
+#define CSET_DEFAULT 0 /* {A,C,G,T,-} */
+#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} */
+#define CSET_IBI 5 /* IBI/Pustell */
+#define CSET_DNASTAR 6 /* DNA* */
+#define CSET_DNASIS 7
+#define CSET_PCGENE 8 /* IG/PC-Gene */
+#define CSET_GENIE 9 /* MicroGenie */
+
+/* define samples to delta_delta values */
+#define DELTA_IT 1
+
+/* What components to read */
+#define READ_BASES (1<<0)
+#define READ_SAMPLES (1<<1)
+#define READ_COMMENTS (1<<2)
+#define READ_ALL (READ_BASES | READ_SAMPLES | READ_COMMENTS)
+
+/*
+ *-----------------------------------------------------------------------------
+ * Structures and typedefs
+ *-----------------------------------------------------------------------------
+ */
+
+/*
+ * Type definition for the Header structure
+ */
+typedef struct {
+ uint_4 magic_number; /* SCF_MAGIC */
+ uint_4 samples; /* Number of elements in Samples matrix */
+ uint_4 samples_offset; /* Byte offset from start of file */
+ uint_4 bases; /* Number of bases in Bases matrix */
+ uint_4 bases_left_clip; /* OBSOLETE: No. bases in left clip (vector) */
+ uint_4 bases_right_clip; /* OBSOLETE: No. bases in right clip (qual) */
+ uint_4 bases_offset; /* Byte offset from start of file */
+ uint_4 comments_size; /* Number of bytes in Comment section */
+ uint_4 comments_offset; /* Byte offset from start of file */
+ char version[4]; /* "version.revision" */
+ uint_4 sample_size; /* precision of samples (in bytes) */
+ uint_4 code_set; /* uncertainty codes used */
+ uint_4 private_size; /* size of private data, 0 if none */
+ uint_4 private_offset; /* Byte offset from start of file */
+ uint_4 spare[18]; /* Unused */
+} Header;
+
+/*
+ * Header.sample_size == 1.
+ */
+typedef struct {
+ uint_1 sample_A; /* Sample for A trace */
+ uint_1 sample_C; /* Sample for C trace */
+ uint_1 sample_G; /* Sample for G trace */
+ uint_1 sample_T; /* Sample for T trace */
+} Samples1;
+
+/*
+ * Header.sample_size == 2.
+ */
+typedef struct {
+ uint_2 sample_A; /* Sample for A trace */
+ uint_2 sample_C; /* Sample for C trace */
+ uint_2 sample_G; /* Sample for G trace */
+ uint_2 sample_T; /* Sample for T trace */
+} Samples2;
+
+/*
+ * Type definition for the sequence data
+ */
+typedef struct {
+ uint_4 peak_index; /* Index into Samples matrix for base position */
+ uint_1 prob_A; /* Probability of it being an A */
+ uint_1 prob_C; /* Probability of it being an C */
+ uint_1 prob_G; /* Probability of it being an G */
+ uint_1 prob_T; /* Probability of it being an T */
+ char base; /* Base called */
+ uint_1 spare[3]; /* Spare */
+} Bases;
+
+
+/*
+ * Type definition for the comments
+ */
+typedef char Comments; /* Zero terminated list of \n separated entries */
+
+
+/*
+ * All of the above structs in a single scf format.
+ */
+typedef struct {
+ Header header;
+ union Samples {
+ Samples1 *samples1;
+ Samples2 *samples2;
+ } samples;
+ Bases *bases;
+ Comments *comments;
+ char *private_data;
+} Scf;
+
+/*
+ *-----------------------------------------------------------------------------
+ * Function prototypes
+ *-----------------------------------------------------------------------------
+ */
+
+/*
+ * Reading SCF Files
+ * -----------------
+ */
+
+/*
+ * Read the Header struct.
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int read_scf_header(FILE *fp, Header *h);
+
+/*
+ * Read a single 8bit sample
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int read_scf_sample1(FILE *fp, Samples1 *s);
+
+/*
+ * Read several 8bit samples
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int read_scf_samples1(FILE *fp, Samples1 *s, size_t num_samples);
+
+/*
+ * Read several 8bit samples in delta_delta format
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int read_scf_samples31(FILE *fp, Samples1 *s, size_t num_samples);
+
+/*
+ * Read a single 16bit sample
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int read_scf_sample2(FILE *fp, Samples2 *s);
+
+/*
+ * Read several 16bit samples
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int read_scf_samples2(FILE *fp, Samples2 *s, size_t num_samples);
+
+/*
+ * Read several 16bit samples in delta_delta format
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int read_scf_samples32(FILE *fp, Samples2 *s, size_t num_samples);
+
+/*
+ * Read a single Bases structure
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int read_scf_base(FILE *fp, Bases *b);
+
+/*
+ * Read several Bases structures consecutively
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int read_scf_bases(FILE *fp, Bases *b, size_t num_bases);
+
+/*
+ * Read Bases, peak_indexes and probs
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int read_scf_bases3(FILE *fp, Bases *b, size_t num_bases);
+
+/*
+ * Read the SCF Comments.
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int read_scf_comment(FILE *fp, Comments *c, size_t l);
+
+/*
+ * Reads a whole SCF file into a Scf structure. This memory for this
+ * structure is allocated by this routine. To free this memory use
+ * scf_deallocate().
+ * Returns:
+ * Scf * - Success, the Scf structure read.
+ * NULL - Failure.
+ * On failure NULL is returned, otherwise the Scf struct.
+ */
+Scf *read_scf(char *fn);
+Scf *fread_scf(FILE *fp);
+
+
+/*
+ * Writing SCF Files
+ * -----------------
+ */
+
+/*
+ * Write the Header struct.
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int write_scf_header(FILE *fp, Header *h);
+
+/*
+ * Write a single 8bit sample
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int write_scf_sample1(FILE *fp, Samples1 *s);
+
+/*
+ * Write several 8bit samples
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int write_scf_samples1(FILE *fp, Samples1 *s, size_t num_samples);
+
+/*
+ * Write several 8bit samples in delta_delta format
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int write_scf_samples31(FILE *fp, Samples1 *s, size_t num_samples);
+
+/*
+ * Write 16bit samples
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int write_scf_sample2(FILE *fp, Samples2 *s);
+
+/*
+ * Write several 16bit samples
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int write_scf_samples2(FILE *fp, Samples2 *s, size_t num_samples);
+
+/*
+ * Write several 16bit samples in delta_delta format
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int write_scf_samples32(FILE *fp, Samples2 *s, size_t num_samples);
+
+/*
+ * Write the Bases structure
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int write_scf_base(FILE *fp, Bases *b);
+
+/*
+ * Write the several Bases structures consecutively
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int write_scf_bases(FILE *fp, Bases *b, size_t num_bases);
+
+/*
+ * Write the bases, then peak indexes, then probs
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int write_scf_bases3(FILE *fp, Bases *b, size_t num_bases);
+
+/*
+ * Write the SCF Comments.
+ * Returns:
+ * 0 - success
+ * -1 - failure
+ */
+int write_scf_comment(FILE *fp, Comments *c, size_t l);
+
+
+/*
+ * Writes a whole Scf structure to filename "fn".
+ * This initialises several fields in the Header struct for you. These are:
+ * samples_offset
+ * bases_offset
+ * comments_offset
+ * magic_number
+ *
+ * All other fields are assumed to be correctly set.
+ *
+ * Returns:
+ * 0 for success
+ * -1 for failure
+ */
+int write_scf(Scf *scf, char *fn);
+int fwrite_scf(Scf *scf, FILE *fp);
+
+/*
+ * Request which (major) version of scf to use when writing.
+ * Defaults to the latest. Currently suitable fields are
+ * 2 and 3.
+ *
+ * Returns 0 for success, -1 for failure.
+ */
+int set_scf_version(int version);
+
+
+/*
+ * Miscellaneous SCF utilities
+ * ---------------------------
+ */
+
+/*
+ * Converts an SCF version string (eg "2.00") to a float
+ */
+float scf_version_str2float(char version[]);
+
+/*
+ * Converts an SCF version float (eg 2.00) to a string
+ * Returns:
+ * A statically allocated 5 character string.
+ */
+char *scf_version_float2str(float f);
+
+/*
+ * Allocates memory for the scf elements based upon arguments passed.
+ * Returns;
+ * Scf * - Success. The scf structure and it's samples, bases,
+ * and comments fields have been allocated.
+ * NULL - Failure.
+ */
+Scf *scf_allocate(int num_samples, int sample_size, int num_bases,
+ int comment_size, int private_size);
+
+/*
+ * Frees memory allocated by scf_allocate.
+ */
+void scf_deallocate(Scf *scf);
+
+/*
+ * Checks to see if the file with name "fn" is in SCF format.
+ * Returns:
+ * 1 - is in SCF format
+ * 0 - is not in SCF format
+ * -1 - failure
+ */
+int is_scf(char *fn);
+
+/*
+ * Change sample points to delta_delta values for uint1
+ */
+void scf_delta_samples1 ( int1 samples[], int num_samples, int job);
+
+/*
+ * Change sample points to delta_delta values for uint2
+ */
+void scf_delta_samples2 ( uint2 samples[], int num_samples, int job);
+
+#endif /*_SCF_H_*/
+
diff --git a/src/Staden/read/scf_extras.c b/src/Staden/read/scf_extras.c
new file mode 100644
index 0000000..67902a8
--- /dev/null
+++ b/src/Staden/read/scf_extras.c
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * This file contains the necessary code for reading the quality values from
+ * an SCF file. It supports both V2 and V3 SCF formats.
+ * It's done in an efficient manner by extracting only the relevant SCF
+ * components.
+ * This file is derived from the Gap4 source file scf_extras.c.
+ */
+
+#include <stdlib.h>
+
+#include "compress.h"
+#include "misc.h"
+#include "scf.h"
+#include "expFileIO.h"
+#include "traceType.h"
+#include "open_trace_file.h"
+
+/*
+ * ---------------------------------------------------------------------------
+ * Loads confidence values from the trace file and averages them.
+ * 'opos' is optional - if not known then set to NULL.
+ *
+ * Returns 0 for success
+ * -1 for failure
+ */
+int get_read_conf(Exp_info *e, int length, int2 *opos, int1 *conf) {
+ int ttype, i;
+ Header h;
+ FILE *fp;
+ uint_1 *prob_A, *prob_C, *prob_G, *prob_T;
+ char *seq;
+ float scf_version;
+
+ /* Sanity check */
+ if (!(exp_Nentries(e,EFLT_LT) && exp_Nentries(e,EFLT_LN)))
+ return -1;
+
+ /* Find and load trace file */
+ ttype = trace_type_str2int(exp_get_entry(e, EFLT_LT));
+
+ if (ttype != TT_SCF &&
+ ttype != TT_CTF &&
+ ttype != TT_ZTR)
+ return -1;
+
+ /*
+ * We only support direct reading accuracy values from SCF files.
+ * Otherwise we have to take a slower approach.
+ */
+ if (ttype != TT_SCF) {
+ Read *r;
+ int sec = read_sections(0);
+ read_sections(READ_BASES);
+
+ if (NULL == (r = read_reading(exp_get_entry(e,EFLT_LN), TT_ANY))) {
+ read_sections(sec);
+ return -1;
+ }
+
+ prob_A = (int1 *)xmalloc(r->NBases);
+ prob_C = (int1 *)xmalloc(r->NBases);
+ prob_G = (int1 *)xmalloc(r->NBases);
+ prob_T = (int1 *)xmalloc(r->NBases);
+ seq = (char *)xmalloc(r->NBases);
+
+ memcpy(prob_A, r->prob_A, r->NBases);
+ memcpy(prob_C, r->prob_C, r->NBases);
+ memcpy(prob_G, r->prob_G, r->NBases);
+ memcpy(prob_T, r->prob_T, r->NBases);
+ memcpy(seq, r->base, r->NBases);
+
+ read_deallocate(r);
+ read_sections(sec);
+
+ } else {
+ /* For SCF files we read directly - the above code would also do. */
+
+ if (NULL == (fp = open_trace_file(exp_get_entry(e,EFLT_LN), NULL)))
+ return -1;
+
+ /* Read the SCF header */
+ if (-1 == read_scf_header(fp, &h))
+ return -1;
+ scf_version = scf_version_str2float(h.version);
+
+ /* Alloc memory */
+ prob_A = (uint_1 *)xmalloc(h.bases * sizeof(*prob_A));
+ prob_C = (uint_1 *)xmalloc(h.bases * sizeof(*prob_A));
+ prob_G = (uint_1 *)xmalloc(h.bases * sizeof(*prob_A));
+ prob_T = (uint_1 *)xmalloc(h.bases * sizeof(*prob_A));
+ seq = (char *)xmalloc(h.bases * sizeof(*seq));
+ if (NULL == prob_A ||
+ NULL == prob_C ||
+ NULL == prob_G ||
+ NULL == prob_T ||
+ NULL == seq)
+ return -1;
+
+ /* Load base scores */
+ if (scf_version >= 3.0) {
+ /*
+ * Version 3 base format:
+ * num_bases * 4byte peak index
+ * num_bases * prob_A
+ * num_bases * prob_C
+ * num_bases * prob_G
+ * num_bases * prob_T
+ * num_bases * base
+ * num_bases * spare (x3)
+ */
+ fseek(fp, (off_t)h.bases_offset + 4 * h.bases, SEEK_SET);
+ if (h.bases != fread(prob_A, 1, h.bases, fp))
+ return -1;
+ if (h.bases != fread(prob_C, 1, h.bases, fp))
+ return -1;
+ if (h.bases != fread(prob_G, 1, h.bases, fp))
+ return -1;
+ if (h.bases != fread(prob_T, 1, h.bases, fp))
+ return -1;
+ if (h.bases != fread(seq, 1, h.bases, fp))
+ return -1;
+ } else {
+ int i;
+ uint_1 buf[12];
+
+ /*
+ * Version 2 base format
+ * num_bases * base_struct, where base_struct is 12 bytes:
+ * 0-3 peak_index
+ * 4-7 prob_A/C/G/T
+ * 8 base
+ * 9- spare
+ */
+ fseek(fp, (off_t)h.bases_offset, SEEK_SET);
+
+ for (i = 0; (unsigned)i < h.bases; i++) {
+ if (1 != fread(buf, 12, 1, fp))
+ return -1;
+ prob_A[i] = buf[4];
+ prob_C[i] = buf[5];
+ prob_G[i] = buf[6];
+ prob_T[i] = buf[7];
+ seq[i] = buf[8];
+ }
+ }
+
+ fclose(fp);
+ }
+
+ /* Determine confidence values */
+ if (opos) {
+ for (i=0; i<length; i++) {
+ if (opos[i] == 0) {
+ /* Inserted base, change to 0% */
+ conf[i] = 0;
+ } else {
+ switch(seq[opos[i]-1]) {
+ case 'a':
+ case 'A':
+ conf[i] = prob_A[opos[i]-1];
+ break;
+ case 'c':
+ case 'C':
+ conf[i] = prob_C[opos[i]-1];
+ break;
+ case 'g':
+ case 'G':
+ conf[i] = prob_G[opos[i]-1];
+ break;
+ case 't':
+ case 'T':
+ conf[i] = prob_T[opos[i]-1];
+ break;
+ default:
+ conf[i] = 2;
+ }
+ }
+ }
+ } else {
+ int mlength = MIN((unsigned)length, h.bases);
+
+ for (i=0; i < mlength; i++) {
+ switch(seq[i]) {
+ case 'a':
+ case 'A':
+ conf[i] = prob_A[i];
+ break;
+ case 'c':
+ case 'C':
+ conf[i] = prob_C[i];
+ break;
+ case 'g':
+ case 'G':
+ conf[i] = prob_G[i];
+ break;
+ case 't':
+ case 'T':
+ conf[i] = prob_T[i];
+ break;
+ case 'n':
+ case 'N':
+ case '-':
+ conf[i] = (prob_A[i] + prob_C[i] + prob_G[i] + prob_T[i]) / 4;
+ break;
+ default:
+ conf[i] = 2;
+ }
+ }
+ for (; i < length; i++)
+ conf[i] = 2;
+ }
+
+ xfree(prob_A);
+ xfree(prob_C);
+ xfree(prob_G);
+ xfree(prob_T);
+ xfree(seq);
+
+ return 0;
+}
diff --git a/src/Staden/read/scf_extras.h b/src/Staden/read/scf_extras.h
new file mode 100644
index 0000000..499465a
--- /dev/null
+++ b/src/Staden/read/scf_extras.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _SCFBITS_H_
+#define _SCFBITS_H_
+
+#include "expFileIO.h"
+
+int get_read_conf(Exp_info *e, int length, int2 *opos, int1 *conf);
+
+#endif /* _SCFBITS_H_ */
diff --git a/src/Staden/read/seqIOABI.c b/src/Staden/read/seqIOABI.c
new file mode 100644
index 0000000..24d54e7
--- /dev/null
+++ b/src/Staden/read/seqIOABI.c
@@ -0,0 +1,1084 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * Title: seqIOABI
+ *
+ * File: seqIOABI.c
+ * Purpose: Reading (not writing) of ABI sequences
+ * Last update: Fri Sep 02, 1994
+ *
+ * Change log:
+ * 27/11/90 SD writeSeqABI() outputs header to sequence file:
+ * format: ;{noOfBases}{leftCutOff}{basesWritten}{type}{tracefile}
+ * eg: ; 867 45 383ABI a09b7.s1RES
+ * 28.11.90 SD put undesirables under STLOUIS compilation flag
+ * 11.12.90 SD new static function tail to find file name in path name
+ * 02.01.91 SD Merged with St.L version
+ * 15.01.91 SD New include added (opp.h)
+ * 30.07.91 SD Those ole FWO_ field blues
+ * 17.09.91 LFW changed STLOUIS compilation flag to SAVE_EDITS
+ * and AUTO_CLIP
+ * 25.10.91 SD Machine independant I/O...removed BIGENDIAN flag
+ * 21.07.92 LFW Added finding of primer position
+ * 11.11.92 LFW added section to actually check that the trace it
+ * is trying to open is an ALF file using traceType sub
+ * 10.11.92 SD FWO_ and S/N% interpretation. Comments for information
+ * window.
+ * 05-Jul-93 SD Added code to check base positions are in order and adjust
+ * them if they are not
+ * 02.09.94 JKB Change to use Read instead of Seq library.
+ */
+
+
+/*
+ * In the absense of any better format to store our ABI data in we use
+ * the Read structure. Hence this module should be considered part of the
+ * Read libary.
+ *
+ * This library also requires use of the mach-io code for the endian
+ * independent machine IO.
+ *
+ * The ABI results file is controlled by an index found towards
+ * the end --- this is pointed to by a longword found at `IndexPO'.
+ * The index consists of a number of entries, each of which is
+ * four character label followed by 6 long words. The first of these
+ * long words holds a simple count (starting at 1) for those cases
+ * where there are multiple entries with the same label. Entries should
+ * be found by label (and count), rather than their index position,
+ * because entries can be ommited or new ones added. This happens when
+ * ABI changes the version of their software and also depending
+ * on whether the data was analysed or unalaysed. We do, however,
+ * make assumptions about the relative order of entries.
+ *
+ * Ideally we would have a separate module which provides a number
+ * of functions to extract the data we are interested in, keeping
+ * the ABI format well wrapped up and out of harms way.
+ *
+ * Note that we are relying on the endian-ness of the machine being
+ * appropriate so we can just read long words in as integers. This
+ * should be recoded to deal with running on different endians.
+ */
+
+
+static char fileIdentifier[] = "$Id$";
+
+/* ---- Imports ---- */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <time.h>
+
+#include "seqIOABI.h"
+#include "Read.h"
+#include "abi.h"
+#include "fpoint.h" /* IMPORT: int_to_float */
+#include "mach-io.h"
+#include "xalloc.h"
+#include "misc.h"
+
+/* ---- Constants ---- */
+
+#define BasesPerLine 50 /* For output formatting */
+
+#define baseIndex(B) ((B)=='C'?0:(B)=='A'?1:(B)=='G'?2:3)
+
+static int header_fudge = 0;
+
+/* DATA block numbers for traces, in order of FWO_ */
+static int DataCount[4] = {9, 10, 11, 12};
+
+
+/* Jason Miller 5/3/05M
+ * Move replace_nl from bottom to top of file
+ * just to avoid forward reference under Linux gcc.
+ **/
+void replace_nl(char *string) {
+ char *cp;
+
+ for (cp = string; *cp; cp++) {
+ if (*cp == '\n') *cp = ' ';
+ }
+}
+
+
+
+
+int dump_labels(FILE *fp, off_t indexO) {
+ off_t entryNum = -1;
+ uint_4 entryLabel, entryLw1;
+ uint_2 elementtype; /* type number as defined above */
+ uint_2 elementsize; /* size of the type in bytes */
+ uint_4 numelements; /* number of elements in data */
+ uint_4 datasize; /* total data size in bytes */
+ uint_4 dataoffset; /* offset of data in file */
+
+ do {
+ char l[6];
+ entryNum++;
+
+ if (fseek(fp, header_fudge+indexO+(entryNum*IndexEntryLength), 0) != 0)
+ return 0;
+
+ if (!be_read_int_4(fp, &entryLabel))
+ return 0;
+ if (!be_read_int_4(fp, &entryLw1))
+ return 0;
+ if (!be_read_int_2(fp, &elementtype))
+ return 0;
+ if (!be_read_int_2(fp, &elementsize))
+ return 0;
+ if (!be_read_int_4(fp, &numelements))
+ return 0;
+ if (!be_read_int_4(fp, &datasize))
+ return 0;
+ if (!be_read_int_4(fp, &dataoffset))
+ return 0;
+
+ { // THis is very ugly and indirect, but...it works SAK
+ int_4 swapped_label = LABEL((char *)&entryLabel); // swap the byte order
+ memcpy(l, &swapped_label, 4);
+ l[4] = '\0';
+ }
+ if (entryLabel) {
+ unsigned char c1, c2, c3, c4;
+
+ c1 = (entryLabel >> 24) & 0xff;
+ c2 = (entryLabel >> 16) & 0xff;
+ c3 = (entryLabel >> 8) & 0xff;
+ c4 = (entryLabel >> 0) & 0xff;
+
+ if (!isprint(c1))
+ break;
+
+ fprintf(stderr, "%s %c%c%c%c %d type:%d size:%d num:%d offset:%d\n", l, c1, c2, c3, c4, entryLw1, elementtype, elementsize, numelements, datasize,dataoffset);
+ {
+ char buffer[elementsize*numelements + 1];
+ switch(elementtype){
+ case 18:
+ if (-1 != getABIString(fp, indexO, entryLabel, entryLw1, buffer)) {
+ replace_nl(buffer);
+ fprintf(stderr, "%s=%s\n", l, buffer);
+ }
+ break;
+ case 19:
+ if (-1 != getABICString(fp, indexO, entryLabel, entryLw1, buffer)) {
+ replace_nl(buffer);
+ fprintf(stderr, "%s=%s\n", l, buffer);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ } while (entryLabel);
+
+ return 0;
+}
+
+/*
+ * From the ABI results file connected to `fp' whose index starts
+ * at byte offset `indexO', return in `val' the `lw'th long word
+ * from the `count'th entry labelled `label'.
+ * The result is 0 for failure, or index offset for success.
+ */
+int getABIIndexEntryLW(FILE *fp, off_t indexO,
+ uint_4 label, uint_4 count, int lw,
+ uint_4 *val) {
+ off_t entryNum=-1;
+ int i;
+ uint_4 entryLabel, entryLw1;
+
+ do {
+ entryNum++;
+
+ if (fseek(fp, header_fudge+indexO+(entryNum*IndexEntryLength), 0) != 0)
+ return 0;
+
+ if (!be_read_int_4(fp, &entryLabel))
+ return 0;
+
+ if (!be_read_int_4(fp, &entryLw1))
+ return 0;
+ } while (!(entryLabel == label && entryLw1 == count));
+
+ for(i=2; i<=lw; i++)
+ if (!be_read_int_4(fp, val))
+ return 0;
+
+ return indexO+(entryNum*IndexEntryLength);
+}
+
+
+/*
+ * Gets the offset of the ABI index.
+ * Returns -1 for failure, 0 for success.
+ */
+int getABIIndexOffset(FILE *fp, uint_4 *indexO) {
+ uint_4 magic;
+
+ /*
+ * Initialise header_fudge.
+ *
+ * This is usually zero, but maybe we've transfered a file in MacBinary
+ * format in which case we'll have an extra 128 bytes to add to all
+ * our fseeks.
+ */
+ rewind(fp);
+ be_read_int_4(fp, &magic);
+ header_fudge = (magic == ABI_MAGIC ? 0 : 128);
+
+
+ if ((fseek(fp, header_fudge + IndexPO, 0) != 0) ||
+ (!be_read_int_4(fp, indexO)))
+ return -1;
+ else
+ return 0;
+}
+
+/*
+ * Get an "ABI String". These strings are either pointed to by the index
+ * offset, or held in the offset itself when the string is <= 4 characters.
+ * The first byte of the string determines its length.
+ * 'string' is a buffer 256 characters long.
+ *
+ * Returns -1 for failure, string length for success.
+ */
+int getABIString(FILE *fp, off_t indexO, uint_4 label, uint_4 count,
+ char *string) {
+ uint_4 off;
+ uint_4 len;
+
+ if (off = getABIIndexEntryLW(fp, indexO, label, count, 4, &len)) {
+ uint_1 len2;
+
+ if (!len)
+ return 0;
+
+ /* Determine offset */
+ if (len <= 4)
+ off += 20;
+ else
+ getABIIndexEntryLW(fp, indexO, label, count, 5, &off);
+
+ /* Read length byte */
+ fseek(fp, header_fudge + off, 0);
+ be_read_int_1(fp, &len2);
+
+ /* Read data (max 255 bytes) */
+ fread(string, len2, 1, fp);
+ string[len2] = 0;
+
+ return len2;
+ } else
+ return -1;
+}
+
+/*
+ * Get an "ABI CString". These strings are either pointed to by the index
+ * offset, or held in the offset itself when the string is <= 4 characters.
+ * 'string' is a buffer 256 characters long.
+ *
+ * Returns -1 for failure, string length for success.
+ */
+int getABICString(FILE *fp, off_t indexO, uint_4 label, uint_4 count,
+ char *string) {
+ uint_4 off;
+ uint_4 len;
+
+ if (off = getABIIndexEntryLW(fp, indexO, label, count, 4, &len)) {
+ uint_1 len2;
+
+ if (!len)
+ return 0;
+
+ /* Determine offset */
+ if (len <= 4)
+ off += 20;
+ else
+ getABIIndexEntryLW(fp, indexO, label, count, 5, &off);
+
+ fseek(fp, header_fudge + off, 0);
+ /* Read data (max 255 bytes) */
+ fread(string, len+2, 1, fp);
+ return strlen(string);
+ } else
+ return -1;
+}
+
+/*
+ * Get an "ABI Int_1". This is raw 1-byte integer data pointed to by the
+ * offset, or held in the offset itself when the data is <= 4 characters.
+ *
+ * If indexO is 0 then we do not search for (or indeed use) label and count,
+ * but simply assume that we are already at the correct offset and read from
+ * here. (NB: This negates the length <= 4 check.)
+ *
+ * Returns -1 for failure, length desired for success (it'll only fill out
+ * up to max_data_len elements, but it gives an indication of whether there
+ * was more to come).
+ */
+int getABIint1(FILE *fp, off_t indexO, uint_4 label, uint_4 count,
+ uint_1 *data, int max_data_len) {
+ uint_4 off;
+ uint_4 len, len2;
+
+ if (indexO) {
+ if (!(off = getABIIndexEntryLW(fp, indexO, label, count, 4, &len)))
+ return -1;
+
+ if (!len)
+ return 0;
+
+ /* Determine offset */
+ if (len <= 4)
+ off += 20;
+ else
+ getABIIndexEntryLW(fp, indexO, label, count, 5, &off);
+
+ len2 = MIN((uint_4)max_data_len, len);
+
+ fseek(fp, header_fudge + off, 0);
+ } else {
+ len = len2 = max_data_len;
+ }
+
+ fread(data, len2, 1, fp);
+
+ return len;
+}
+
+/*
+ * Get an "ABI Int_2". This is raw 2-byte integer data pointed to by the
+ * offset, or held in the offset itself when the data is <= 4 characters.
+ *
+ * Returns -1 for failure, length desired for success (it'll only fill out
+ * up to max_data_len elements, but it gives an indication of whether there
+ * was more to come).
+ */
+int getABIint2(FILE *fp, off_t indexO, uint_4 label, uint_4 count,
+ uint_2 *data, int max_data_len) {
+ int len, l2;
+ int i;
+
+ len = getABIint1(fp, indexO, label, count, (uint_1 *)data, max_data_len*2);
+ if (-1 == len)
+ return -1;
+
+ len /= 2;
+ // fprintf(stderr,"* Read %d int2 values\n", len);
+ l2 = MIN(len, max_data_len);
+ for (i = 0; i < l2; i++) {
+ data[i] = be_int2(data[i]);
+ }
+
+ return len;
+}
+
+/*
+ * Get an "ABI Int_4". This is raw 4-byte integer data pointed to by the
+ * offset, or held in the offset itself when the data is <= 4 characters.
+ *
+ * Returns -1 for failure, length desired for success (it'll only fill out
+ * up to max_data_len elements, but it gives an indication of whether there
+ * was more to come).
+ */
+int getABIint4(FILE *fp, off_t indexO, uint_4 label, uint_4 count,
+ uint_4 *data, int max_data_len) {
+ int len, l2;
+ int i;
+
+ len = getABIint1(fp, indexO, label, count, (uint_1 *)data, max_data_len*4);
+ if (-1 == len)
+ return -1;
+
+ len /= 4;
+ l2 = MIN(len, max_data_len);
+ for (i = 0; i < l2; i++) {
+ data[i] = be_int4(data[i]);
+ }
+
+ return len;
+}
+
+/*
+ * Change the DATA counts for fetching traces
+ */
+void abi_set_data_counts(int f, int w, int o, int _) {
+ DataCount[0] = f;
+ DataCount[1] = w;
+ DataCount[2] = o;
+ DataCount[3] = _;
+}
+
+/*
+ * Put the DATA counts back to their defaults.
+ */
+void abi_reset_data_counts(void) {
+ DataCount[0] = 9;
+ DataCount[1] = 10;
+ DataCount[2] = 11;
+ DataCount[3] = 12;
+}
+
+/*
+ * Read the ABI format sequence from FILE *fp into a Read structure.
+ * All printing characters (as defined by ANSII C `isprint')
+ * are accepted, but `N's are translated to `-'s. In this respect we
+ * are adhering (more or less) to the CSET_DEFAULT uncertainty code set.
+ *
+ * Returns:
+ * Read * - Success, the Read structure read.
+ * NULLRead - Failure.
+ */
+Read *fread_abi(FILE *fp) {
+ Read *read = NULLRead;
+ int i;
+ float fspacing; /* average base spacing */
+ char colorOrder[5]; /* Content of fwo_ field */
+ uint_4 numPoints, numBases;
+ uint_4 numQVs; /* SAK */
+ uint_4 signalO;
+ int no_bases = 0;
+ int sections = read_sections(0);
+
+ uint_4 fwo_; /* base -> lane mapping */
+ uint_4 indexO; /* File offset where the index is */
+ uint_4 baseO; /* File offset where the bases are stored */
+ uint_4 quality0; /* File offset where the QVs are stored SAK */
+ uint_4 dataCO; /* File offset where the C trace is stored */
+ uint_4 dataAO; /* File offset where the A trace is stored */
+ uint_4 dataGO; /* File offset where the G trace is stored */
+ uint_4 dataTO; /* File offset where the T trace is stored */
+ uint_4 offset; /* Generic offset */
+ uint_4 offset2; /* Generic offset */
+ uint_4 offset3; /* Generic offset */
+ uint_4 offset4; /* Generic offset */
+ uint_4 tagCount; /* Count parameter for reading PBAS and PLOC tags */
+
+
+
+ /* Get the index offset */
+ if (-1 == getABIIndexOffset(fp, &indexO))
+ goto bail_out;
+
+ ///dumplabels
+ // dump_labels(fp, indexO);
+
+ /* Get the number of points */
+ if (!getABIIndexEntryLW(fp,(off_t)indexO,DataEntryLabel,DataCount[0],
+ 3,&numPoints)){
+
+ if (!getABIIndexEntryLW(fp,(off_t)indexO,DataEntryLabel,DataCount[0],3,&numPoints)){
+ goto bail_out;
+ }
+ }
+
+ /* Get the number of bases */
+ /* #### MHH -- Try PBAS,2 first, then PBAS,1 */
+ no_bases = 1;
+ numBases = 0;
+ for (tagCount = 2; tagCount >= 1; tagCount--)
+ {
+ if (getABIIndexEntryLW(fp,(off_t)indexO,BaseEntryLabel,tagCount,3,&numBases)) {
+ no_bases = 0;
+ break;
+ }
+ }
+
+
+ /* Allocate the sequence */
+ if (NULLRead == (read = read_allocate(numPoints, numBases)))
+ goto bail_out;
+
+ // fprintf(stderr,"* Nbases = %d NPoints = %d\n", numBases, numPoints);
+
+ // This is duplicated in comments, since we want to capture it
+ if (!getABIIndexEntryLW(fp,(off_t)indexO,FWO_Label,1,5,&fwo_)) {
+ /* Guess at CAGT */
+ fwo_ = 0x43414754;
+ }
+ { // THis is very ugly and indirect, but...it works SAK
+ int_4 swapped_fwo_ = LABEL((char *)&fwo_); // swap the byte order
+ memcpy(colorOrder, &swapped_fwo_, 4);
+ colorOrder[4] = '\0';
+ }
+
+
+ /*
+ * The order of the DATA fields is determined by the field FWO_
+ * Juggle around with data pointers to get it right
+ */
+ if (sections & READ_SAMPLES) {
+ uint_4 *dataxO[4];
+
+ dataxO[0] = &dataCO;
+ dataxO[1] = &dataAO;
+ dataxO[2] = &dataGO;
+ dataxO[3] = &dataTO;
+
+ /*Get the positions of the four traces */
+ if (!(getABIIndexEntryLW(fp, (off_t)indexO, DataEntryLabel,
+ DataCount[0], 5,
+ dataxO[baseIndex((char)(fwo_>>24&255))]) &&
+ getABIIndexEntryLW(fp, (off_t)indexO, DataEntryLabel,
+ DataCount[1], 5,
+ dataxO[baseIndex((char)(fwo_>>16&255))]) &&
+ getABIIndexEntryLW(fp, (off_t)indexO, DataEntryLabel,
+ DataCount[2], 5,
+ dataxO[baseIndex((char)(fwo_>>8&255))]) &&
+ getABIIndexEntryLW(fp, (off_t)indexO, DataEntryLabel,
+ DataCount[3], 5,
+ dataxO[baseIndex((char)(fwo_&255))]))) {
+ goto bail_out;
+ }
+ }
+
+ /*************************************************************
+ * Read the traces and bases information
+ *************************************************************/
+
+ if (sections & READ_SAMPLES) {
+ /* Read in the C trace */
+ if (fseek(fp, header_fudge + (off_t)dataCO, 0) == -1) goto bail_out;
+ if(getABIint2(fp, 0, 0, 0, read->traceC, read->NPoints) <= 0) goto bail_out;
+
+ /* Read in the A trace */
+ if (fseek(fp, header_fudge + (off_t)dataAO, 0) == -1) goto bail_out;
+ if(getABIint2(fp, 0, 0, 0, read->traceA, read->NPoints) <= 0) goto bail_out;
+
+ /* Read in the G trace */
+ if (fseek(fp, header_fudge + (off_t)dataGO, 0) == -1) goto bail_out;
+ if(getABIint2(fp, 0, 0, 0, read->traceG, read->NPoints) <= 0) goto bail_out;
+
+ /* Read in the T trace */
+ if (fseek(fp, header_fudge + (off_t)dataTO, 0) == -1) goto bail_out;
+ if(getABIint2(fp, 0, 0, 0, read->traceT, read->NPoints) <= 0) goto bail_out;
+
+ /* Compute highest trace peak */
+ for (i=0; i < read->NPoints; i++) {
+ if (read->maxTraceVal < read->traceA[i])
+ read->maxTraceVal = read->traceA[i];
+ if (read->maxTraceVal < read->traceC[i])
+ read->maxTraceVal = read->traceC[i];
+ if (read->maxTraceVal < read->traceG[i])
+ read->maxTraceVal = read->traceG[i];
+ if (read->maxTraceVal < read->traceT[i])
+ read->maxTraceVal = read->traceT[i];
+ }
+ }
+
+ if(no_bases)
+ fprintf(stderr,"* no_bases: numBases = %d\n", numBases);
+
+ if (no_bases || !(sections & READ_BASES))
+ goto skip_bases;
+
+ /* Read in the bases */
+ /* #### MHH -- Changed 4th parameter to tagCount */
+ if (!(getABIIndexEntryLW(fp, (off_t)indexO, BaseEntryLabel, tagCount, 5, &baseO)
+ && (fseek(fp, header_fudge + (off_t)baseO, 0) == 0) ))
+ goto bail_out;
+
+ for (i = 0; i < (read->NBases); i++) {
+ int ch;
+
+ if ((ch = fgetc(fp)) == EOF)
+ goto bail_out;
+
+ /* #### MHH -- don't turn 'N' into '-' */
+ /* read->base[i] = (ch == 'N') ? '-' : (char)ch; */
+ read->base[i] = (char)ch;
+
+ /* Initialize the error probabilities. This may be overridden later */
+ read->prob_A[i] = 0;
+ read->prob_C[i] = 0;
+ read->prob_G[i] = 0;
+ read->prob_T[i] = 0;
+ }
+ read->base[i] = 0;
+
+ /* Read in the quality values */
+
+ /* Read in the base positions */
+ /* #### MHH -- Changed 4th parameter to tagCount */
+ if (-1 == getABIint2(fp, indexO, BasePosEntryLabel, tagCount, read->basePos,
+ read->NBases))
+ goto bail_out;
+
+ // GetQualityValues, if they exist
+ {
+ if (-1 != getABIint1(fp, indexO, PCONLabel, 1, (uint_1 *)read->prob_A, read->NBases)){
+ int i;
+ for (i = 0; i < read->NBases; i++){
+ switch(tolower(read->base[i])){
+ case 'a':
+ break;
+ case 'c':
+ read->prob_C[i] = read->prob_A[i];
+ read->prob_A[i] = (char)0;
+ break;
+ case 't':
+ read->prob_T[i] = read->prob_A[i];
+ read->prob_A[i] = (char)0;
+ break;
+ case 'g':
+ read->prob_G[i] = read->prob_A[i];
+ read->prob_A[i] = (char)0;
+ break;
+ case 'n': // set them all to zero
+ default:
+ read->prob_A[i] = (char)0;
+ }
+ }
+ }
+ }
+
+#ifdef FIX_CORRUPT_TRACES
+/* The code inside this ifdef does not really fix the problem, it just hides it, and */
+/* introduces weird behavior in client programs (like chrome_server) -- MHH. */
+ /*
+ * Check for corrupted traces where the bases are positioned on sample
+ * coordinates which do not exist. Witnessed on some MegaBACE files.
+ */
+ if (read->basePos[read->NBases-1] > read->NPoints) {
+ int n = read->basePos[read->NBases-1]+1;
+ read->traceA = (TRACE *)xrealloc(read->traceA, n * sizeof(TRACE));
+ read->traceC = (TRACE *)xrealloc(read->traceC, n * sizeof(TRACE));
+ read->traceG = (TRACE *)xrealloc(read->traceG, n * sizeof(TRACE));
+ read->traceT = (TRACE *)xrealloc(read->traceT, n * sizeof(TRACE));
+
+ if (read->traceA == NULL || read->traceC == NULL ||
+ read->traceC == NULL || read->traceG == NULL)
+ goto bail_out;
+
+ for (i = read->NPoints; i < n; i++) {
+ read->traceA[i] = 0;
+ read->traceC[i] = 0;
+ read->traceG[i] = 0;
+ read->traceT[i] = 0;
+ }
+ read->NPoints = n;
+ }
+#endif
+
+ skip_bases:
+
+
+ /*************************************************************
+ * Gather useful information - the comments field
+ *************************************************************/
+ if (sections & READ_COMMENTS) {
+ char buffer[257];
+ char comment[8192], line[8192];
+ char commstr[256], *commstrp;
+ int clen;
+ int_4 spacing;
+ int_4 startPoint; // SAK
+ int_4 noise; // SAK
+ uint_2 i2;
+ uint_4 i4;
+
+ *comment = '\0';
+
+ /* The ABI comments */
+ clen = getABIString(fp, indexO, CMNTLabel, 1, commstr);
+ if (clen != -1) {
+ char *p;
+
+ commstr[clen] = 0;
+ commstrp = commstr;
+
+ do {
+ char line[300];
+
+ if (p = strchr(commstrp, '\n'))
+ *p++ = 0;
+
+ sprintf(line, "COMM=%s\n", commstrp);
+ strcat(comment, line);
+ } while(commstrp = p);
+ }
+
+
+ /* Get Sample Name Offset */
+ if (-1 != getABIString(fp, indexO, SMPLLabel, 1, buffer)) {
+ replace_nl(buffer);
+ sprintf(line, "NAME=%s\n", buffer);
+ strcat(comment, line);
+ }
+
+ /* LANE */
+ if (-1 != getABIint2(fp, indexO, LANELabel, 1, &i2, 1)) {
+ sprintf(line, "LANE=%d\n", i2);
+ strcat(comment, line);
+ }
+#if 0
+ /* LsrP */
+ if (-1 != getABIint4(fp, indexO, LaserpowerLabel, 1, &i4, 1)) {
+ sprintf(line, "LsrP=%d\n", i4);
+ strcat(comment, line);
+ }
+ /* Tmpr */
+ if (-1 != getABIint4(fp, indexO, TmprLabel, 1, &i4, 1)) {
+ sprintf(line, "Tmpr=%d\n", i4);
+ strcat(comment, line);
+ }
+ /* EPVt */
+ if (-1 != getABIint4(fp, indexO, EPVtLabel, 1, &i4, 1)) {
+ sprintf(line, "EPVt=%d\n", i4);
+ strcat(comment, line);
+ }
+#endif
+ // Add the ColorOrder
+ sprintf(line, "FWO_=%s\n", colorOrder);
+ strcat(comment, line);
+ // Add the number of chromatogram points
+ sprintf(line, "NPTS=%d\n", numPoints);
+ strcat(comment, line);
+ // Add the number of chromatogram points
+ sprintf(line, "NBAS=%d\n", numBases);
+ strcat(comment, line);
+
+ /* Get Signal Strength Offset */
+ if (getABIIndexEntryLW(fp, (off_t)indexO, SignalEntryLabel, 1, 5,
+ &signalO)) {
+ int_2 C,A,G,T;
+ int_2 *base[4];
+ base[0] = &C;
+ base[1] = &A;
+ base[2] = &G;
+ base[3] = &T;
+
+ if (fseek(fp, header_fudge + (off_t)signalO, 0) != -1 &&
+ be_read_int_2(fp, (uint_2 *)
+ base[baseIndex((char)(fwo_>>24&255))]) &&
+ be_read_int_2(fp, (uint_2 *)
+ base[baseIndex((char)(fwo_>>16&255))]) &&
+ be_read_int_2(fp, (uint_2 *)
+ base[baseIndex((char)(fwo_>>8&255))]) &&
+ be_read_int_2(fp, (uint_2 *)
+ base[baseIndex((char)(fwo_&255))])) {
+ sprintf(line, "SIGN=A=%d,C=%d,G=%d,T=%d\n",
+ A, C, G, T);
+ strcat(comment, line);
+ }
+ }
+
+ /* Get the spacing.. it's a float but don't worry yet */
+ if (-1 != getABIint4(fp, indexO, SpacingEntryLabel, 1,
+ (uint_4 *)&spacing, 1)) {
+ fspacing = int_to_float(spacing);
+ sprintf(line, "SPAC=%-6.2f\n", fspacing);
+ strcat(comment, line);
+ } else {
+ if (read->NBases)
+ fspacing = (float) read->NPoints / (float) read->NBases;
+ else
+ fspacing = 0;
+ }
+
+
+ /* Get primer position */
+ if (getABIIndexEntryLW(fp, (off_t)indexO, PPOSLabel, 1, 5,
+ (uint_4 *)&i4)) {
+ /* ppos stores in MBShort of pointer */
+ sprintf(line, "PRIM=%d\n", (i4>>16));
+ strcat(comment, line);
+ }
+
+ /* RUND/RUNT */
+ if (getABIIndexEntryLW(fp, (off_t)indexO, RUNDLabel, 1, 5, &offset) &&
+ getABIIndexEntryLW(fp, (off_t)indexO, RUNDLabel, 2, 5, &offset2) &&
+ getABIIndexEntryLW(fp, (off_t)indexO, RUNTLabel, 1, 5, &offset3) &&
+ getABIIndexEntryLW(fp, (off_t)indexO, RUNTLabel, 2, 5, &offset4)) {
+ char buffer[1025];
+ char buffer_s[1025];
+ char buffer_e[1025];
+ struct tm t;
+ time_t tsec;
+ uint_4 rund_s, rund_e, runt_s, runt_e;
+
+ rund_s = offset;
+ rund_e = offset2;
+ runt_s = offset3;
+ runt_e = offset4;
+
+ sprintf(buffer, "%04d%02d%02d.%02d%02d%02d - %04d%02d%02d.%02d%02d%02d",
+ rund_s >> 16, (rund_s >> 8) & 0xff, rund_s & 0xff,
+ runt_s >> 24, (runt_s >> 16) & 0xff, (runt_s >> 8) & 0xff,
+ rund_e >> 16, (rund_e >> 8) & 0xff, rund_e & 0xff,
+ runt_e >> 24, (runt_e >> 16) & 0xff, (runt_e >> 8) & 0xff);
+
+ memset(&t, 0, sizeof(t));
+ t.tm_mday = rund_s & 0xff;
+ t.tm_mon = ((rund_s >> 8) & 0xff) - 1;
+ t.tm_year = (rund_s >> 16) - 1900;
+ t.tm_hour = runt_s >> 24;
+ t.tm_min = (runt_s >> 16) & 0xff;
+ t.tm_sec = (runt_s >> 8) & 0xff;
+ t.tm_isdst = -1;
+ /*
+ * Convert struct tm to time_t. We ignore the time_t value, but
+ * the conversion process will update the tm_wday element of
+ * struct tm.
+ */
+ tsec = mktime(&t);
+ strftime(buffer_s, 1024, "%a %d %b %H:%M:%S %Y", &t);
+
+ t.tm_mday = rund_e & 0xff;
+ t.tm_mon = ((rund_e >> 8) & 0xff) - 1;
+ t.tm_year = (rund_e >> 16) - 1900;
+ t.tm_hour = runt_e >> 24;
+ t.tm_min = (runt_e >> 16) & 0xff;
+ t.tm_sec = (runt_e >> 8) & 0xff;
+ t.tm_isdst = -1;
+ /*
+ * Convert struct tm to time_t. We ignore the time_t value, but
+ * the conversion process will update the tm_wday element of
+ * struct tm.
+ */
+ tsec = mktime(&t);
+ strftime(buffer_e, 1024, "%a %d %b %H:%M:%S %Y", &t);
+
+ sprintf(line, "DATE=%s to %s\nRUND=%s\n",
+ buffer_s, buffer_e, buffer);
+ strcat(comment, line);
+ }
+
+
+ /* Get Dye Primer Offset */
+ if (-1 != getABIString(fp, indexO, PDMFLabel, 1, buffer)) {
+ replace_nl(buffer);
+ sprintf(line, "DYEP=%s\n", buffer);
+ strcat(comment, line);
+ }
+
+ /* Get Machine Name Offset */
+ if (-1 != getABIString(fp, indexO, MCHNLabel, 1, buffer)) {
+ replace_nl(buffer);
+ sprintf(line, "MCHN=%s\n", buffer);
+ strcat(comment, line);
+ }
+
+ /* Machine model */
+ if (-1 != getABICString(fp, indexO, MODLLabel, 1, buffer)) { // added C SAK
+ replace_nl(buffer);
+ sprintf(line, "MODL=%s\n", buffer);
+ strcat(comment, line);
+ }
+
+ /* Matrix file */
+ if (-1 != getABIString(fp, indexO, MTXFLabel, 1, buffer)) {
+ replace_nl(buffer);
+ sprintf(line, "MTXF=%s\n", buffer);
+ strcat(comment, line);
+ }
+
+ /* Base calling version */
+ if (-1 != getABIString(fp, indexO, SPACLabel, 2, buffer)) {
+ replace_nl(buffer);
+ sprintf(line, "BCAL=%s\n", buffer);
+ strcat(comment, line);
+ }
+
+ /* Software versions */
+ if (-1 != getABIString(fp, indexO, SVERLabel, 1, buffer)) {
+ replace_nl(buffer);
+ sprintf(line, "VER1=%s\n", buffer);
+ strcat(comment, line);
+ }
+ if (-1 != getABIString(fp, indexO, SVERLabel, 2, buffer)) {
+ replace_nl(buffer);
+ sprintf(line, "VER2=%s\n", buffer);
+ strcat(comment, line);
+ }
+
+
+ /* Get Protocol Name Offset */
+ if (-1 != getABIString(fp, indexO, ProtocolNameLabel, 2, buffer)) {
+ replace_nl(buffer);
+ sprintf(line, "PRON=%s\n", buffer);
+ strcat(comment, line);
+ }
+
+ /* Get Protocol Version Offset */
+ if (-1 != getABICString(fp, indexO, ProtocolVersionLabel, 1, buffer)) {
+ replace_nl(buffer);
+ sprintf(line, "PROV=%s\n", buffer);
+ strcat(comment, line);
+ }
+
+ /* Get Run Name Offset SAK */
+ if (-1 != getABICString(fp, indexO, RunNameLabel, 1, buffer)) {
+ sprintf(line, "RUNN=%s\n", buffer);
+ strcat(comment, line);
+ }
+
+ /* Get TUBE SAK */
+ if (-1 != getABIString(fp, indexO, TubeLabel, 1, buffer)) {
+ sprintf(line, "TUBE=%s\n", buffer);
+ strcat(comment, line);
+ }
+
+ /* Get the start point.. SAK */
+ /* ASTP */
+ if (-1 != getABIint2(fp, indexO, ASPTLabel, 1, &i2, 1)) {
+ sprintf(line, "ASPT=%d\n", i2);
+ strcat(comment, line);
+ }
+
+
+
+ /* Get NOIS Offset SAK */
+ if (getABIIndexEntryLW(fp, (off_t)indexO, NOISLabel, 1,5,
+ &signalO)) {
+ float C,A,G,T;
+ float *base[4];
+ base[0] = &C;
+ base[1] = &A;
+ base[2] = &G;
+ base[3] = &T;
+
+ if (fseek(fp, header_fudge + (off_t)signalO, 0) != -1 &&
+ be_read_int_4(fp, (int_4 *)
+ base[baseIndex((char)(fwo_>>24&255))]) &&
+ be_read_int_4(fp, (int_4 *)
+ base[baseIndex((char)(fwo_>>16&255))]) &&
+ be_read_int_4(fp, (int_4 *)
+ base[baseIndex((char)(fwo_>>8&255))]) &&
+ be_read_int_4(fp, (int_4 *)
+ base[baseIndex((char)(fwo_&255))])) {
+ sprintf(line, "NOIS=A=%f,C=%f,G=%f,T=%f\n",
+ A, C, G, T);
+ strcat(comment, line);
+ }
+ }
+
+ /* dumplicate string and set info */
+ {
+ char *s = (char *)xmalloc(strlen(comment)+1);
+ strcpy(s,comment);
+ read->info = s;
+ }
+ }
+
+
+
+ /*************************************************************
+ * Check base positions are in order
+ *************************************************************/
+ if (sections & READ_SAMPLES) {
+ float pos;
+ int start;
+
+
+#ifdef DO_FIX_POSITIONS_ORDER
+ /* The code inside this ifdef was going into infinite loops under certain conditions. Code ifdefed by Mike Holmes SAK */
+ for (i = 1; i < read->NBases; ) {
+ if (read->basePos[i] < read->basePos[i-1]) {
+ // fprintf(stderr,"fread_abi(): Base positions are not in order(%d(%d) < %d(%d)) . Fixing\n",
+ // i, read->basePos[i], i-1, read->basePos[i-1]);
+
+ /* pass 1 - find end of region */
+ start = i - 1;
+ pos = (float) read->basePos[i-1] + fspacing;
+ for(;i < read->NBases && (int)read->basePos[i] < pos;i++) {
+ pos += fspacing;
+ }
+
+ /* calculate average base spacing */
+ if (i < read->NBases )
+ fspacing = ((float) read->basePos[i] -
+ (float) read->basePos[start]) /
+ (float)(i - start);
+
+ /* pass 2 - adjust */
+ i = start + 1;
+ pos = (float) read->basePos[i-1] + fspacing;
+ for(;i < read->NBases && (int)read->basePos[i] < pos;i++) {
+ read->basePos[i] = (int) pos;
+ pos += fspacing;
+ }
+
+ } else {
+ i++;
+ }
+ }
+#endif
+ }
+
+
+ /* SUCCESS */
+
+ read->format = TT_ABI;
+ return(read);
+
+ /* FAILURE */
+ bail_out:
+ if (read)
+ read_deallocate(read);
+
+ return NULLRead;
+}
+
+
+/*
+ * Read the ABI format sequence from file 'fn' into a Read structure.
+ * All printing characters (as defined by ANSII C `isprint')
+ * are accepted, but `N's are translated to `-'s. In this respect we
+ * are adhering (more or less) to the CSET_DEFAULT uncertainty code set.
+ *
+ * Returns:
+ * Read * - Success, the Read structure read.
+ * NULLRead - Failure.
+ */
+Read *read_abi(char *fn) {
+ Read *read;
+ FILE *fp;
+
+ /* Open file */
+ if ((fp = fopen(fn, "rb")) == NULL)
+ return NULLRead;
+
+ read = fread_abi(fp);
+ fclose(fp);
+
+ if (read && (read->trace_name = (char *)xmalloc(strlen(fn)+1)))
+ strcpy(read->trace_name, fn);
+
+ return read;
+}
+
+/*
+ * Write to an ABI file - unsupported.
+ */
+/* ARGSUSED */
+int write_abi(char *fn, Read *read) {
+ fprintf(stderr, "ABI write support is unavailable\n");
+ return -1;
+}
+
+/*
+ * Write to an ABI file - unsupported.
+ */
+/* ARGSUSED */
+int fwrite_abi(FILE *fp, Read *read) {
+ fprintf(stderr, "ABI write support is unavailable\n");
+ return -1;
+}
+
diff --git a/src/Staden/read/seqIOABI.h b/src/Staden/read/seqIOABI.h
new file mode 100644
index 0000000..b3cc7fb
--- /dev/null
+++ b/src/Staden/read/seqIOABI.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _seqIOABI_h_
+#define _seqIOABI_h_
+
+#include <sys/types.h> /* off_t */
+#include "os.h"
+
+/*
+ * The ABI magic number - "ABIF"
+ */
+#define ABI_MAGIC ((int_4) ((((('A'<<8)+'B')<<8)+'I')<<8)+'F')
+
+/*
+ * The index is located towards the end of the ABI trace file.
+ * It's location is given by a longword at a fixed place.
+ */
+#define IndexPO ((off_t)26)
+
+#define IndexEntryLength 28
+
+/*
+ * Here are some labels we will be looking for, four chars packed
+ * into an int_4
+ */
+#define LABEL(a) ((int_4) ((((((a)[0]<<8)+(a)[1])<<8)+(a)[2])<<8)+(a)[3])
+#define DataEntryLabel LABEL("DATA")
+#define BaseEntryLabel LABEL("PBAS")
+#define BasePosEntryLabel LABEL("PLOC")
+#define SpacingEntryLabel LABEL("SPAC")
+#define SignalEntryLabel LABEL("S/N%")
+#define FWO_Label LABEL("FWO_")
+#define MCHNLabel LABEL("MCHN")
+#define PDMFLabel LABEL("PDMF")
+#define SMPLLabel LABEL("SMPL")
+#define PPOSLabel LABEL("PPOS")
+#define CMNTLabel LABEL("CMNT")
+#define GelNameLabel LABEL("GELN")
+#define LANELabel LABEL("LANE")
+#define RUNDLabel LABEL("RUND")
+#define RUNTLabel LABEL("RUNT")
+#define MTXFLabel LABEL("MTXF")
+#define SPACLabel LABEL("SPAC")
+#define SVERLabel LABEL("SVER")
+#define MODLLabel LABEL("MODL")
+/*
+ * Added by SAK to support JTC
+ *
+ */
+/* Start Point */
+#define ASPTLabel LABEL("ASPt")
+/* Start Point */
+#define NOISLabel LABEL("NOIS")
+/* Run Name */
+#define RunNameLabel LABEL("RunN")
+/* Protocol Name */
+#define ProtocolNameLabel LABEL("APFN")
+/* Protocol Version */
+#define ProtocolVersionLabel LABEL("APXV")
+/* Quality/Confidence Values */
+#define PCONLabel LABEL("PCON")
+/* TUBE (Well) */
+#define TubeLabel LABEL("TUBE")
+/* Laser Power (LsrP) */
+#define LaserpowerLabel LABEL("LsrP")
+/* ElectroPhersis Voltage (EPVt) */
+#define EPVtLabel LABEL("EPVt")
+/* Temperature (Tmpr) */
+#define TmprLabel LABEL("Tmpr")
+
+ /* Record #s in support of TIGR/JTC
+ These are different than the standard Staden values of 1.
+ According to Mike HOlmes, this should return the same values from the raw sequence files, but historical TIGR data
+ stored trace tuner data in record #1, so this will enable backward compatiblity.
+ */
+#define BaseEntryRecord (2)
+#define BasePosEntryRecord (2)
+#define PConRecord (1)
+/*
+ * From the ABI results file connected to `fp' whose index starts
+ * at byte offset `indexO', return in `val' the `lw'th long word
+ * from the `count'th entry labelled `label'.
+ * The result is 0 for failure, or index offset for success.
+ */
+int getABIIndexEntryLW(FILE *fp, off_t indexO,
+ uint_4 label, uint_4 count, int lw,
+ uint_4 *val);
+
+/*
+ * Gets the offset of the ABI index.
+ * Returns -1 for failure, 0 for success.
+ */
+int getABIIndexOffset(FILE *fp, uint_4 *indexO);
+
+/*
+ * Get an "ABI String". These strings are either pointed to by the index
+ * offset, or held in the offset itself when the string is <= 4 characters.
+ * The first byte of the string determines its length.
+ * 'string' is a buffer 256 characters long.
+ *
+ * Returns -1 for failure, string length for success.
+ */
+int getABIString(FILE *fp, off_t indexO, uint_4 label, uint_4 count,
+ char *string);
+
+/* Same, except for C string */
+int getABICString(FILE *fp, off_t indexO, uint_4 label, uint_4 count, char *string);
+
+int dump_labels(FILE *fp, off_t indexO);
+
+/*
+ * Change the DATA counts for fetching traces
+ */
+void abi_set_data_counts(int f, int w, int o, int _);
+
+/*
+ * Put the DATA counts back to their defaults.
+ */
+void abi_reset_data_counts(void);
+
+#endif /* _seqIOABI_h_ */
diff --git a/src/Staden/read/seqIOALF.c b/src/Staden/read/seqIOALF.c
new file mode 100644
index 0000000..a1104fe
--- /dev/null
+++ b/src/Staden/read/seqIOALF.c
@@ -0,0 +1,425 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * Title: seqIOALF
+ *
+ * File: seqIOALF.c
+ * Purpose: IO of ALF sequences
+ * Last update: 9th September 1994
+ */
+
+/*
+ * Change Log :-
+ * 14.01.91 SD
+ * when complimenting the sequence with an odd number of bases,
+ * the middle base position was not adjusted.
+ * 15.01.91 SD Put StLouis stuff on compilation flag
+ * 15.01.91 SD New include file (opp.h)
+ * 02.08.91 SD Changes the mapping of uncertainty codes so that we
+ * now only generate A C G T and -
+ * Previously... bug in interpreting ALF integer fields.
+ * We now treat them as unsigned.
+ * 17.09.91 LFW changed STLOUIS compilation flag to SAVE_EDITS
+ * and AUTO_CLIP
+ * 25.10.91 SD Machine independant I/O...removed BIGENDIAN flag
+ * 25.11.91 SD There was a hard limit (of 1024) for allocation of
+ * space for number of bases, yet program would
+ * read in more if there were any, causing nasties to happen.
+ *
+ * 11.11.92 LFW added section to actually check that the trace it
+ * is trying to open is an ALF file using traceType sub
+ *
+ * 10.11.92 SD SCF comments now stored in seq data structure
+ * 09.09.94 JKB Update to use Read instead of Seq library.
+ * 04.03.98 JKB Look for "Raw data" when "Processed data" is not found.
+ */
+
+/* RMD I made substantial changes to this file 12/28/90 so as to
+ * read sequence data more freely (necessary when reading data from
+ * multiple trace files).
+ * The affected area is indicated by comments starting RMD, like
+ * this one.
+ */
+
+/* This file was adapted by LFW from seqIOABI.c.
+ * The ALF results file is a concatenation of many files with an
+ * index structure at the beginning, consisting of a 512 byte
+ * block that we ignore, followed by 128 byte blocks describing
+ * each file. All files, including the header region, are rounded
+ * up to a multiple of 512 bytes long.
+ * The getIndexEntry routines identify the 128 byte index component
+ * of interest by matching 4 chars of its ASCII label, then extract
+ * the field of choice from that entry.
+ *
+ * Note that the SUN and PC are of opposite endian-ness, so that
+ * we have to provide special routines to read words and longwords
+ * from the results file. Luckily the floating point numbers are
+ * written out in ASCII.
+ */
+
+
+/* ---- Imports ---- */
+
+
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "Read.h"
+#include "mach-io.h"
+#include "xalloc.h"
+
+/* ---- Constants ---- */
+
+#define BasesPerLine 50 /* For output formatting */
+
+#define IndexEntryLength ((off_t)128)
+
+
+/*
+ * Here are some labels we will be looking for, four chars packed
+ * into a long word.
+ */
+#define EntryLabel ((uint_4) ((((('A'<<8)+'L')<<8)+'F')<<8)+' ')
+#define BaseEntryLabel ((uint_4) ((((('S'<<8)+'e')<<8)+'q')<<8)+'u')
+#define DataEntryLabel ((uint_4) ((((('P'<<8)+'r')<<8)+'o')<<8)+'c')
+#define RawDataEntryLabel ((uint_4) ((((('R'<<8)+'a')<<8)+'w')<<8)+' ')
+
+/* RMD make enough space for bases - hard limit */
+#define BASELIMIT 4096
+
+
+/* ---- Internal functions ---- */
+
+/*
+ * From the ALF results file connected to `fp' whose index starts
+ * at byte offset `indexO', return in `val' the `lw'th long word
+ * from the entry labelled `label'.
+ * The result is 0 for failure, 1 for success.
+ */
+static int getIndexEntryLW(FILE *fp, off_t indexO,
+ uint_4 label, int lw,
+ uint_4 *val) {
+ off_t entryNum=-1;
+ int i;
+ uint_4 entryLabel;
+
+ do {
+ entryNum++;
+ if (fseek(fp, indexO+(entryNum*IndexEntryLength), 0) != 0)
+ return 0;
+
+ if (!be_read_int_4(fp, &entryLabel))
+ return 0;
+ } while (!(entryLabel == label));
+
+ for(i=2; i<lw; i++)
+ if (!be_read_int_4(fp, val))
+ return 0;
+
+
+ /* when i = lw read in the 4 bytes backwards */
+ if (!le_read_int_4(fp,val))
+ return 0;
+
+ return 1;
+}
+
+/*
+ * From the ALF results file connected to `fp' whose index starts
+ * at byte offset `indexO', return in `val' the `lw'th word (int2)
+ * from the entry labelled `label'.
+ * The result is 0 for failure, 1 for success.
+ */
+static int getIndexEntryW(FILE *fp, off_t indexO,
+ uint_4 label, int lw,
+ uint_2 *val) {
+ off_t entryNum=-1;
+ int i;
+ uint_4 entryLabel;
+ uint_4 jval;
+
+ do {
+ entryNum++;
+ if (fseek(fp, indexO+(entryNum*IndexEntryLength), 0) != 0)
+ return 0;
+
+ if (!be_read_int_4(fp, &entryLabel))
+ return 0;
+ } while (!(entryLabel == label));
+
+
+ for(i=2; i<lw; i++)
+ if (!be_read_int_4(fp, &jval))
+ return 0;
+
+ if (!le_read_int_2(fp, val))
+ return 0;
+
+ return 1;
+}
+
+
+/* ---- Exports ---- */
+
+
+/*
+ * Read the ALF format sequence from FILE *fp into a Read structure.
+ * All printing characters (as defined by ANSII C `isprint')
+ * are accepted, but `N's are translated to `-'s. In this respect we
+ * are adhering (more or less) to the CSET_DEFAULT uncertainty code set.
+ *
+ * Returns:
+ * Read * - Success, the Read structure read.
+ * NULLRead - Failure.
+ */
+Read *fread_alf(FILE *fp) {
+ Read *read = NULLRead;
+ int i;
+ uint_4 numPoints;
+ int sections = read_sections(0);
+
+ uint_4 data_size;
+ uint_4 dataO;
+ uint_4 header_size=396; /* size of the header of the processed data
+ section */
+ uint_2 actBaseDataSize; /* actual number of bytes of data of information
+ containing the base and basePos information */
+ int num_points; /* keeps track of the actual number of points,
+ rather than the early guess of numPoints */
+
+ off_t indexO; /* File offset where the index is */
+ uint_4 baseO; /* File offset where the bases are stored */
+
+
+ /*
+ * RMD lots of changes below here until end of data reading section
+ * Some are cosmetic.
+ * getIndexEntry calls in front of where they were needed, and made
+ * There is a substantive change to the inner loop of the sequence
+ * reading section. This now uses fscanf - much less rigid than the
+ * previous scheme. Note that it reads bp as a float. This is because
+ * it is a float in multiple trace data files! (bizarre Pharmacia
+ * programming!).
+ */
+
+
+ /*************************************************************
+ * Read the various file offsets
+ *************************************************************/
+
+ /* indexO is the offset of the index.
+ * Or I could look for the first label, starting 'ALF'
+ * if I used 512 then none of the entries are on long
+ * word boundaries
+ */
+ indexO = 522;
+
+ /* offset in file of first base of sequence */
+ if (! (getIndexEntryLW(fp,indexO,BaseEntryLabel,12,&baseO)) )
+ goto bail_out;
+
+ /* actual size of region containing this data */
+ if (! (getIndexEntryW(fp,indexO,BaseEntryLabel,10,&actBaseDataSize)) )
+ goto bail_out;
+
+ /* Look for Processed data first. If we fail to find it, then look for
+ * the Raw data (same format).
+ */
+
+ /* offset in file to start of processed data segment - there
+ * is then a header of size header_size (currently 396)
+ */
+ if (! (getIndexEntryLW(fp,indexO,DataEntryLabel,12,&dataO)) ) {
+ if (! (getIndexEntryLW(fp,indexO,RawDataEntryLabel,12,&dataO)) )
+ goto bail_out;
+
+ /* actual size of region containing this data */
+ if (! (getIndexEntryLW(fp,indexO,RawDataEntryLabel,10,&data_size)) )
+ goto bail_out;
+ } else {
+ /* actual size of region containing this data */
+ if (! (getIndexEntryLW(fp,indexO,DataEntryLabel,10,&data_size)) )
+ goto bail_out;
+ }
+
+ /* Because each trace value is stored in a 2 byte
+ * integer, thus to store A C G T information
+ * it takes 8 bytes. So subtract off the header and
+ * divide by 8
+ */
+ numPoints = (int)((data_size - header_size)/ 8);
+
+ /* Allocate the sequence */
+ if (NULLRead == (read = read_allocate(numPoints, BASELIMIT)))
+ goto bail_out;
+
+ /*************************************************************
+ * Read the bases information
+ *************************************************************/
+ if (sections & READ_BASES) {
+ /* new locals introduced by LFW and/or RMD for the ALF */
+ int numBases; /* number of nucleotides read in */
+ float bp;
+ char ch;
+ signed int last_bp = 0;
+
+ if (!(fseek(fp, (off_t)baseO, 0) == 0))
+ goto bail_out;
+
+ for (numBases = 0; (unsigned)ftell(fp) < baseO+(unsigned short)actBaseDataSize
+ && numBases<BASELIMIT;) {
+ char line[200];
+
+ fgets(line, (int)sizeof(line), fp);
+ sscanf(line, "%c %*d %f", &ch, &bp);
+
+ /* we convert ch to Staden format here */
+ switch (ch) {
+ case 'A':
+ case 'C':
+ case 'G':
+ case 'T':
+ break;
+ default:
+ ch = '-';
+/*
+ if (isupper(ch))
+ ch = '-';
+ else
+ ch = '\0';
+*/
+ }
+
+ if (ch) {
+ read->base[numBases] = ch;
+ read->prob_A[numBases] = 0;
+ read->prob_C[numBases] = 0;
+ read->prob_G[numBases] = 0;
+ read->prob_T[numBases] = 0;
+ if (bp < last_bp)
+ bp = last_bp;
+ read->basePos[numBases] = bp;
+ ++numBases;
+ }
+ }
+ read->base[numBases] = 0;
+
+ read->NBases = numBases;
+ }
+
+ /*************************************************************
+ * Read the trace information
+ *************************************************************/
+
+ if (sections & READ_SAMPLES) {
+
+ /*
+ * Traces are stored as 2 byte integers in records in the order of
+ * A C G T A C G T ...
+ */
+
+ if (fseek(fp, (off_t)(dataO+header_size), 0) != 0)
+ goto bail_out;
+
+ num_points = 0;
+
+ for (i=0; i < read->NPoints; i++) {
+ if (!le_read_int_2(fp, &(read->traceA[i])))
+ goto bail_out;
+ if (read->maxTraceVal < read->traceA[i])
+ read->maxTraceVal = read->traceA[i];
+
+ if (!le_read_int_2(fp, &(read->traceC[i])))
+ goto bail_out;
+ if (read->maxTraceVal < read->traceC[i])
+ read->maxTraceVal = read->traceC[i];
+
+ if (!le_read_int_2(fp, &(read->traceG[i])))
+ goto bail_out;
+ if (read->maxTraceVal < read->traceG[i])
+ read->maxTraceVal = read->traceG[i];
+
+ if (!le_read_int_2(fp, &(read->traceT[i])))
+ goto bail_out;
+ if (read->maxTraceVal < read->traceT[i])
+ read->maxTraceVal = read->traceT[i];
+
+ if (read->traceA[i]==0 && read->traceT[i]==0 &&
+ read->traceC[i]==0 && read->traceG[i]==0 &&
+ i > (numPoints-64))
+ break;
+
+ num_points++;
+ }
+ }
+
+ /* SUCCESS */
+
+ read->format = TT_ALF;
+ return(read);
+
+ /* FAILURE */
+ bail_out:
+ if (read)
+ read_deallocate(read);
+
+ return NULLRead;
+}
+
+/*
+ * Read the ALF format sequence with name `fn' into a Read structure.
+ * All printing characters (as defined by ANSII C `isprint')
+ * are accepted, but `N's are translated to `-'s. In this respect we
+ * are adhering (more or less) to the CSET_DEFAULT uncertainty code set.
+ *
+ * Returns:
+ * Read * - Success, the Read structure read.
+ * NULLRead - Failure.
+ */
+Read *read_alf(char *fn) {
+ FILE *fp;
+ Read *read;
+
+ /* Open file */
+ if ((fp = fopen(fn, "rb")) == NULL)
+ return NULLRead;
+
+ read = fread_alf(fp);
+ fclose(fp);
+
+ if (read && (read->trace_name = (char *)xmalloc(strlen(fn)+1)))
+ strcpy(read->trace_name, fn);
+
+ return read;
+}
+
+/*
+ * Write to an ALF file - unsupported.
+ */
+/* ARGSUSED */
+int write_alf(char *fn, Read *read) {
+ fprintf(stderr, "ALF write support is unavailable\n");
+ return -1;
+}
+
+/*
+ * Write to an ALF file - unsupported.
+ */
+/* ARGSUSED */
+int fwrite_alf(FILE *fp, Read *read) {
+ fprintf(stderr, "ALF write support is unavailable\n");
+ return -1;
+}
diff --git a/src/Staden/read/seqIOCTF.c b/src/Staden/read/seqIOCTF.c
new file mode 100644
index 0000000..65d1ff6
--- /dev/null
+++ b/src/Staden/read/seqIOCTF.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * Title: seqIOCTF
+ *
+ * File: seqIOCTF.c
+ * Purpose: Reading/writing of CTF sequences
+ * Last update: March 2000
+ *
+ * Change log:
+ * Created mieg, march 2000, importing code from wabi/ctftrace.c
+ */
+
+
+/* ---- Imports ---- */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+
+#include "Read.h"
+#include "seqIOCTF.h"
+#include "abi.h"
+#include "mach-io.h"
+#include "xalloc.h"
+
+/* ---- Constants ---- */
+
+/*
+ * Read the CTF format sequence from FILE *fp into a Read structure.
+
+ * Returns:
+ * Read * - Success, the Read structure read.
+ * NULLRead - Failure.
+ */
+Read *fread_ctf (FILE *fp) {
+ Read *read = ctfFRead (fp) ;
+
+ return read ;
+}
+
+/*
+ * Read the CTF format sequence from file 'fn' into a Read structure.
+ */
+
+Read *read_ctf (char *fn) {
+ Read *read;
+ FILE *fp;
+
+ /* Open file */
+ if ((fp = fopen(fn, "rb")) == NULL)
+ return NULLRead;
+
+ read = fread_ctf(fp);
+ fclose(fp);
+
+ if (read && (read->trace_name = (char *)xmalloc(strlen(fn)+1)))
+ strcpy(read->trace_name, fn);
+
+ return read;
+}
+
+
+/*
+ * Write to an CTF file - unsupported.
+ */
+/* ARGSUSED */
+int fwrite_ctf (FILE *fp, Read *read) {
+ return ctfFWrite (fp, read) ;
+}
+
+/*
+ * Write to an CTF file
+ */
+/* ARGSUSED */
+int write_ctf(char *fn, Read *read) {
+ FILE *fp;
+
+ /* Open file */
+ if ((fp = fopen(fn, "wb")) == NULL)
+ return -1 ;
+
+ fwrite_ctf (fp, read) ;
+ fclose(fp);
+
+ return 0 ;
+}
+
diff --git a/src/Staden/read/seqIOCTF.h b/src/Staden/read/seqIOCTF.h
new file mode 100644
index 0000000..811423d
--- /dev/null
+++ b/src/Staden/read/seqIOCTF.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _seqIOCTF_h_
+#define _seqIOCTF_h_
+
+Read *ctfFRead (FILE *ff) ;
+int ctfFWrite (FILE *ff, Read *read) ;
+
+#endif /* _seqIOCTF_h_ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Staden/read/seqIOPlain.c b/src/Staden/read/seqIOPlain.c
new file mode 100644
index 0000000..2b87757
--- /dev/null
+++ b/src/Staden/read/seqIOPlain.c
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ Title: seqIOPlain
+
+ File: seqIOPlain.c
+ Purpose: IO of plain sequences
+ Last update: Tuesday Jan 15 1991
+
+ Change log:
+
+ 28.11.90 SD put undesirables under STLOUIS compilation flag
+ 15.01.91 SD new include file (opp.h)
+ 17.09.91 LFW changed STLOUIS compilation flag to SAVE_EDITS
+ and AUTO_CLIP
+ 08.09.94 JKB Plain files now also uses the ';<' and ';>' lines.
+ 09.09.94 JKB Update to use Read instead of Seq library.
+ */
+
+
+#define LINE_LENGTH 60
+
+/*
+ * This module should be regarded as part of `read' since it is
+ * privy to the internal structure of `Read'.
+ *
+ * This library also requires use of the mach-io code for the endian
+ * independent machine IO.
+ *
+ * Any references to the writing or reading of edited sequences,
+ * or to the bottom strand were added by lfw
+ */
+
+
+
+
+/* ---- Imports ---- */
+
+#include <stdio.h> /* IMPORT: fopen, fclose, fseek, ftell, fgetc */
+#include <ctype.h> /* IMPORT: isprint */
+#include <string.h>
+
+#include "misc.h"
+#include "plain.h"
+#include "Read.h"
+#include "xalloc.h"
+#include "traceType.h"
+
+/* ---- Constants ---- */
+
+#define BasesPerLine 50 /* For output formatting */
+
+
+/* ---- Exports ---- */
+
+
+/*
+ * Read the plain format sequence from FILE *fp into a Read structure.
+ * All printing characters (as defined by ANSII C `isprint')
+ * are accepted, but `N's are translated to `-'s.
+ *
+ * Returns:
+ * Read * - Success, the Read structure read.
+ * NULLRead - Failure.
+ */
+Read *fread_pln(FILE *fp) {
+ Read *read = NULLRead;
+ off_t fileLen;
+ int ch;
+ char *leftc, *rightc, *leftcp, *rightcp;
+ int first = 1;
+
+ /*
+ * Find the length of the file.
+ * Use this as an overestimate of the length of the sequence.
+ */
+ fseek(fp, (off_t) 0, 2);
+ if ((fileLen = ftell(fp)) > MAXINT2)
+ goto bail_out;
+
+ fseek(fp, (off_t) 0, 0);
+
+ /* Allocate the sequence */
+ if (NULLRead == (read = read_allocate(0, fileLen)))
+ goto bail_out;
+
+ if (NULL == (leftc = (char *)xmalloc(fileLen)))
+ goto bail_out;
+
+ if (NULL == (rightc = (char *)xmalloc(fileLen)))
+ goto bail_out;
+
+ leftcp = leftc;
+ rightcp = rightc;
+
+ /* Read in the bases */
+
+ read->NBases = 0;
+ read->format = TT_PLN;
+
+ while ((ch = fgetc(fp)) != EOF) {
+ if (ch==';') {
+ /*
+ * ;< is left cutoff,
+ * ;> is right cutoff.
+ * Any other ';'s we can treat as a comments.
+ */
+ ch = fgetc(fp);
+
+ if (first == 1 && ch != '<' && ch != '>') {
+ int d;
+ char type[5], name[17], line[1024];
+
+ line[0] = ch;
+ fgets(&line[1], 1022, fp);
+
+ if (5 == sscanf(line, "%6d%6d%6d%4c%s",
+ &d, &d, &d, type, name)) {
+ char * p;
+
+ if (p = strchr(type, ' '))
+ *p = 0;
+
+ read->format = trace_type_str2int(type);
+ read->trace_name = (char *)xmalloc(strlen(name)+1);
+ if (read->trace_name)
+ strcpy(read->trace_name, name);
+ }
+ }
+
+ else if (ch == '<') {
+ ch = fgetc(fp);
+ while (ch != '\n') {
+ *leftcp++ = ch;
+ ch = fgetc(fp);
+ }
+ } else if (ch == '>') {
+ ch = fgetc(fp);
+ while (ch != '\n') {
+ *rightcp++ = ch;
+ ch = fgetc(fp);
+ }
+ } else {
+ while(ch != '\n' && ch != EOF)
+ ch = fgetc(fp);
+ }
+ } else if (isprint(ch) && !isspace(ch)) {
+ read->base[read->NBases++] = ((ch)=='N') ? '-' : (ch);
+ }
+
+ first = 0;
+ }
+
+ *leftcp = *rightcp = 0;
+
+ read->leftCutoff = strlen(leftc);
+ read->rightCutoff = read->leftCutoff + read->NBases + 1;
+ memmove(&read->base[read->leftCutoff], read->base, read->NBases);
+ memmove(read->base, leftc, read->leftCutoff);
+ memmove(&read->base[read->leftCutoff + read->NBases],
+ rightc, strlen(rightc));
+
+ read->NBases += read->leftCutoff + strlen(rightc);
+ read->base[read->NBases] = 0;
+
+ xfree(leftc);
+ xfree(rightc);
+
+ /* SUCCESS */
+ return(read);
+
+ /* FAILURE */
+ bail_out:
+ if (read)
+ read_deallocate(read);
+
+ return NULLRead;
+}
+
+/*
+ * Read the plain format sequence with name `fn' into a Read structure.
+ * All printing characters (as defined by ANSII C `isprint')
+ * are accepted, but `N's are translated to `-'s.
+ *
+ * Returns:
+ * Read * - Success, the Read structure read.
+ * NULLRead - Failure.
+ */
+Read *read_pln(char *fn) {
+ FILE *fp;
+ Read *read;
+
+ /* Open file */
+ if ((fp = fopen(fn, "r")) == NULL)
+ return NULLRead;
+
+ read = fread_pln(fp);
+ fclose(fp);
+
+ if (read && read->trace_name == NULL &&
+ (read->trace_name = (char *)xmalloc(strlen(fn)+1)))
+ strcpy(read->trace_name, fn);
+
+ return read;
+}
+
+
+/*
+ * Write to a Plain file
+ */
+int fwrite_pln(FILE *fp, Read *read) {
+ int i, err = 0;
+
+ for (i = 0; i < read->NBases; i += LINE_LENGTH)
+ if (-1 == fprintf(fp, "%.*s\n",
+ read->NBases - i > LINE_LENGTH
+ ? LINE_LENGTH : read->NBases - i,
+ &read->base[i]))
+ err = 1;
+
+ return err ? -1 : 0;
+}
+
+int write_pln(char *fn, Read *read) {
+ FILE *fp;
+
+ if ((fp = fopen(fn,"w")) == NULL)
+ return -1;
+
+ if (fwrite_pln(fp, read)) {
+ fclose(fp);
+ return -1;
+ }
+
+ fclose(fp);
+ return 0;
+}
diff --git a/src/Staden/read/strings.c b/src/Staden/read/strings.c
new file mode 100644
index 0000000..3f3d65a
--- /dev/null
+++ b/src/Staden/read/strings.c
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#include "misc.h"
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <sys/types.h>
+
+int fstrlen(char *f, int max_f)
+{
+ for (; max_f > 0 && (isspace(f[max_f-1]) || f[max_f-1]=='\0'); max_f--);
+ return max_f;
+}
+
+
+
+
+
+void f2cstr(char *f, int max_f, char *c, int max_c)
+{
+ int i;
+
+ i = min(fstrlen(f,max_f),max_c);
+ strncpy(c,f,i);
+ c[i]='\0';
+}
+
+
+void c2fstr(char *c, int max_c, char *f, int max_f)
+{
+ int i;
+ i = min((int)strlen(c),max_f);
+ strncpy(f,c,i);
+ for( ; i<max_f; i++) f[i]=' ';
+
+}
+
+
+
+
+char *mystrtok(char *s, char *ct)
+/*
+** When strtok isn't good enough
+*/
+{
+ char *this;
+ static char *look;
+ static int last;
+
+ if (s == NULL) {
+ if (last) return NULL;
+ } else {
+ look = s;
+ last = 0;
+ }
+ this = look;
+
+ for ( ; *look && strchr(ct,*look)==NULL; look++ ) ;
+ last = (! *look);
+ *look++ = '\0';
+
+ return this;
+}
+
+
+void str_tolower (char *s)
+/*
+** Convert string to lower case
+*/
+{
+ if (!s) return;
+ for ( ; *s ; s++ )
+ if (isupper(*s))
+ *s = tolower(*s);
+}
+
+void str_toupper (char *s)
+/*
+** Convert string to upper case
+*/
+{
+ if (!s) return;
+ for ( ; *s ; s++ )
+ if (islower(*s))
+ *s = toupper(*s);
+}
+
+#ifdef NOSTRSTR
+/*
+** My routines for nice sun ones.
+*/
+char *strstr(char *cs, char *ct)
+/*
+** ANSI C has the function strstr().
+**
+** strstr() returns a pointer to the first occurrence of the
+** pattern string s2 in s1. For example, if s1 is "string
+** thing" and s2 is "ing", strstr() returns "ing thing". If s2
+** does not occur in s1, strstr() returns NULL.
+**
+** It's not always implemented. Here's my cludge:
+*/
+{
+ int i;
+ int len_ct;
+ int end;
+ len_ct = strlen(ct);
+ end = strlen(cs) - len_ct;
+ for (i=0;i<=end;i++)
+ if (strncmp(&cs[i],ct,len_ct)==0)
+ return &cs[i];
+
+ return NULL;
+}
+#endif
+
+#ifdef NOSTRDUP
+char *strdup(const char *str)
+/*
+** SunOS has a nice strdup() function.
+**
+** strdup() returns a pointer to a new string which is a dupli-
+** cate of the string pointed to by s1. The space for the new
+** string is obtained using malloc(3V). If the new string can-
+** not be created, a NULL pointer is returned.
+**
+** Other ANSI C libraries don't have this. Here is my kludge:
+*/
+{
+ char *newstr;
+ int i = strlen(str);
+
+ if ((newstr = (char *)malloc((unsigned int)(i+1))) == NULL)
+ return NULL;
+
+ for (; i>=0; i--)
+ newstr[i] = str[i];
+
+ return newstr;
+}
+#endif
+
+#ifdef NOSTRCASECMP
+int strcasecmp(const char *s1, const char *s2) {
+ while (tolower(*s1) == tolower(*s2)) {
+ /* If at the end of the string, then they're equal */
+ if (0 == *s1)
+ return 0;
+ s1++;
+ s2++;
+ }
+
+ /* One ended before the other, so return 1 or -1 */
+ return (*(unsigned char *)s1) < (*(unsigned char *)s2) ? -1 : 1;
+}
+#endif
diff --git a/src/Staden/read/tar_format.h b/src/Staden/read/tar_format.h
new file mode 100644
index 0000000..345bb61
--- /dev/null
+++ b/src/Staden/read/tar_format.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _TAR_FORMAT_H
+#define _TAR_FORMAT_H
+
+/*
+ * Our own tar block defines - we cannot rely on UNIX to provide these for us
+ * as the sun tar.h is minimal and Alliant's does not even exist.
+ */
+#define TBLOCK 512
+#define NAMSIZ 100
+
+/* Values used in typeflag field. */
+#define REGTYPE '0' /* Regular File */
+#define AREGTYPE '\0' /* Regular File */
+#define LNKTYPE '1' /* Hard Link */
+#define SYMTYPE '2' /* Symbolic Link */
+#define CHRTYPE '3' /* Character Special File */
+#define BLKTYPE '4' /* Block Special File */
+#define DIRTYPE '5' /* Directory */
+#define FIFOTYPE '6' /* FIFO */
+#define CONTTYPE '7' /* Reserved */
+
+/*
+ * There will usually be more data than this in a tar header - but we don't
+ * need to concern ourselves with it.
+ */
+typedef union hblock {
+ char data[TBLOCK];
+ struct header {
+ char name[NAMSIZ];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char chksum[8];
+ char typeflag;
+ char linkname[NAMSIZ];
+ char magic[6];
+ char version[2];
+ char uname[32];
+ char gname[32];
+ char devmajor[8];
+ char devminor[8];
+ char prefix[155];
+ } header;
+} tar_block;
+
+#endif
diff --git a/src/Staden/read/traceType.c b/src/Staden/read/traceType.c
new file mode 100644
index 0000000..140a375
--- /dev/null
+++ b/src/Staden/read/traceType.c
@@ -0,0 +1,229 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ Title: traceType
+
+ File: traceType.c
+ Purpose: determining trace format
+
+ Last update: 01/09/94
+
+ Change log : Update for use with the Read library.
+*/
+
+/* ---- Imports ---- */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "traceType.h"
+#include "Read.h"
+#include "open_trace_file.h"
+
+#ifdef USE_BIOLIMS
+#include "spBiolims.h"
+#endif
+
+#ifndef isascii
+#define isascii(c) ((c) >= 0 && (c) <= 0x7f)
+#endif
+
+/* ---- Privates ---- */
+static struct {
+ int type;
+ int offset;
+ char *string;
+} magics[] = {
+ { TT_SCF, 0, ".scf" } ,
+ { TT_CTF, 1, "\007\375\343\000" } , /* mieg */
+ { TT_ZTR, 0, "\256ZTR\r\n\032\n" } ,
+ { TT_ABI, 0, "ABIF" } ,
+ { TT_ABI, 128, "ABIF" } ,
+ { TT_ALF, 518, "ALF " } ,
+ { TT_SCF, 0, "\234\330\300\000" }, /* Amersham variant */
+ { TT_EXP, 0, "ID " } ,
+ { TT_ALF, 0, "ALF " } , /* Added by newer alfsplit programs */
+ { TT_ALF, 0, "\021G\021G" } , /* Pharmacia's alfsplit equiv */
+ { TT_ALF, 1546,"X-axis" } /* Good guestimation if all else fails */
+};
+
+#define Number(A) ( sizeof(A) / sizeof((A)[0]) )
+
+/* ---- exported ---- */
+
+/* unix specific file deletion routine */
+int remove_file(char *fn) { return unlink(fn); }
+
+
+/*
+ * Determine the trace type for FILE * 'fp'.
+ *
+ * NB - This function should NOT be used when biolims support is required
+ * (as biolims doesn't use files !)
+ *
+ * Returns:
+ * TT_SCF, TT_CTF, TT_ZTR, TT_ABI, TT_ALF, or TT_PLN for success.
+ * TT_UNK for unknown type.
+ * TT_ERR for error.
+ */
+int fdetermine_trace_type(FILE *fp)
+{
+ unsigned int i;
+ size_t len;
+ char buf[512];
+ int ps;
+ int acgt;
+ int c;
+
+ /* check magics */
+ for (i = 0 ; i < Number(magics) ; i++) {
+ if (fseek(fp,magics[i].offset,0) == 0) {
+ len = strlen(magics[i].string);
+ if (fread(buf,1,len,fp)==len) {
+ if (strncmp(buf,magics[i].string,len)==0) {
+ return magics[i].type;
+ }
+ }
+ }
+ }
+ fseek(fp, 0, 0);
+
+ /* determine if this is a text file */
+ len = 0; ps = 0; acgt = 0;
+ for (i = 0; i < 512; i++) {
+ if ( ( c = fgetc(fp) ) == EOF ) break;
+ switch(c) {
+ case 'a': case 'c': case 'g': case 't':
+ case 'A': case 'C': case 'G': case 'T':
+ /*YUK! need the next line?*/
+ case 'n': case 'N': case '-':
+ acgt++;
+ default:
+ len++;
+ if ( (isprint(c) && isascii(c)) || isspace(c) ) ps++;
+ }
+ }
+ /*YUK! 75% of characters printable means text*/
+ if ( 100 * ps > 75 * len ) {
+ /*YUK! 75% of printables ACGTN means plain*/
+ if (100 * acgt > 75 * ps) {
+ return TT_PLN;
+ }
+ }
+
+ /* YUK! short files are not traces? */
+ if (len<512) {
+ return TT_UNK;
+ }
+
+ return TT_UNK;
+}
+
+/*
+ * Determine the trace type for file 'fn'.
+ *
+ * Returns:
+ * TT_SCF, TT_CTF, TT_ZTR, TT_ABI, TT_ALF, TT_BIO, or TT_PLN for success.
+ * TT_UNK for unknown type.
+ * TT_ERR for error.
+ */
+int determine_trace_type(char *fn)
+{
+ FILE *fp;
+ int r;
+
+#ifdef USE_BIOLIMS
+ if(IS_BIOLIMS_PATH(fn))
+ return TT_BIO;
+#endif
+
+ if ( (fp = open_trace_file(fn, NULL)) == NULL ) return TT_ERR;
+
+ r = fdetermine_trace_type(fp);
+ fclose(fp);
+
+ return r;
+}
+
+/*
+ * Converts a trace type string to an integer.
+ */
+int trace_type_str2int(char *str) {
+ if (strcmp(str, "SCF") == 0 || strcmp(str, "scf") == 0)
+ return TT_SCF;
+ else if (strcmp(str, "CTF") == 0 || strcmp(str, "ctf") == 0)
+ return TT_CTF; /* mieg */
+ else if (strcmp(str, "ZTR") == 0 || strcmp(str, "ztr") == 0)
+ return TT_ZTR;
+ else if (strcmp(str, "ZTR1") == 0 || strcmp(str, "ztr1") == 0)
+ return TT_ZTR1;
+ else if (strcmp(str, "ZTR2") == 0 || strcmp(str, "ztr2") == 0)
+ return TT_ZTR2;
+ else if (strcmp(str, "ZTR3") == 0 || strcmp(str, "ztr3") == 0)
+ return TT_ZTR3;
+ else if (strcmp(str, "ABI") == 0 || strcmp(str, "abi") == 0)
+ return TT_ABI;
+ else if (strcmp(str, "ALF") == 0 || strcmp(str, "alf") == 0)
+ return TT_ALF;
+ else if (strcmp(str, "PLN") == 0 || strcmp(str, "pln") == 0)
+ return TT_PLN;
+ else if (strcmp(str, "EXP") == 0 || strcmp(str, "exp") == 0)
+ return TT_EXP;
+ else if (strcmp(str, "BIO") == 0 || strcmp(str, "bio") == 0)
+ return TT_BIO;
+ else
+ return TT_UNK;
+}
+
+/*
+ * Converts a trace type integer to a string.
+ */
+char *trace_type_int2str(int type) {
+ char *t;
+
+ switch(type) {
+ case TT_SCF: t = "SCF"; break;
+ case TT_CTF: t = "CTF"; break; /* mieg */
+ case TT_ZTR: t = "ZTR";break;
+ case TT_ZTR1: t = "ZTR1";break;
+ case TT_ZTR2: t = "ZTR2";break;
+ case TT_ZTR3: t = "ZTR3";break;
+ case TT_ABI: t = "ABI"; break;
+ case TT_ALF: t = "ALF"; break;
+ case TT_PLN: t = "PLN"; break;
+ case TT_EXP: t = "EXP"; break;
+ case TT_BIO: t = "BIO"; break;
+ default:
+ case TT_UNK: t = "UNK"; break;
+ }
+
+ return t;
+}
+
+/*
+ * Returns a statically declared string containing a 3 character
+ * identifier for the trace type of this file.
+ * "ERR" represents error, and "UNK" for unknown.
+ * Successful values are "SCF", "ABI", "ALF", "PLN", "CTF", "ZTR" and "BIO".
+ */
+char *trace_type_str(char *traceName)
+{
+ int t;
+
+ if ((t = determine_trace_type(traceName)) == TT_ERR)
+ return "ERR";
+ else
+ return trace_type_int2str(t);
+}
diff --git a/src/Staden/read/traceType.h b/src/Staden/read/traceType.h
new file mode 100644
index 0000000..c2fe2f1
--- /dev/null
+++ b/src/Staden/read/traceType.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _traceType_h
+#define _traceType_h
+
+/*
+ * Title: traceType.h
+ *
+ * File: traceType.h
+ * Purpose: determining traceType of traces
+ * Last update: Tue Jan 15 1991
+ *
+ * Change log :-
+ */
+
+/* ---- Imports ---- */
+
+#include <stdio.h> /* IMPORT: fopen, fclose, fseek, ftell, fgetc */
+#include <ctype.h>
+#include <string.h> /* IMPORT: isprint*/
+
+#include "Read.h" /* IMPORT: TT_xxx defines */
+
+
+/*
+ * Determine the trace type for file 'fn'.
+ *
+ * Returns:
+ * TT_SCF, TT_ABI, TT_ALF, or TT_PLN for success.
+ * TT_UNK for unknown type.
+ * TT_ERR for error.
+ */
+extern int determine_trace_type(char *fn);
+
+/*
+ * Determine the trace type for FILE * 'fp'.
+ *
+ * Returns:
+ * TT_SCF, TT_ABI, TT_ALF, or TT_PLN for success.
+ * TT_UNK for unknown type.
+ * TT_ERR for error.
+ */
+extern int fdetermine_trace_type(FILE *fp);
+
+/*
+ * Returns a statically declared string containing a 3 character
+ * identifier for this trace type.
+ * "ERR" represents error, and "UNK" for unknown.
+ * Successful values are "SCF", "ABI", "ALF" and "PLN".
+ */
+extern char *trace_type_str(char *traceName);
+
+/*
+ * Converts a trace type string to an integer.
+ */
+extern int trace_type_str2int(char *str);
+
+/*
+ * Converts a trace type integer to a string.
+ */
+char *trace_type_int2str(int type);
+
+
+#endif /*_traceType_h*/
diff --git a/src/Staden/read/translate.c b/src/Staden/read/translate.c
new file mode 100644
index 0000000..f76b153
--- /dev/null
+++ b/src/Staden/read/translate.c
@@ -0,0 +1,887 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * File: translate.c
+ * Purpose: Translates between different reading structures.
+ * Last update: 01/09/94
+ */
+
+#include <stdio.h>
+#include "misc.h"
+#include "scf.h"
+#include "Read.h"
+#include "expFileIO.h"
+#include "traceType.h"
+#include "translate.h"
+#include "open_trace_file.h"
+#ifdef USE_BIOLIMS
+#include "spBiolims.h"
+#endif
+
+static int topos(Read *r, int ind);
+
+#ifdef IOLIB_SCF
+/*
+ * Translates an Scf structure into a Read structure.
+ * The Scf structure is left unchanged.
+ *
+ * Returns:
+ * A pointer to an allocated Read structure upon success.
+ * NULLRead upon failure.
+ */
+Read *scf2read(Scf *scf) {
+ Read *read;
+ register int i, i_end;
+ TRACE max_val = 0;
+ int sections = read_sections(0);
+ int nsamples = 0;
+ int nbases = 0;
+
+ /* allocate */
+ if (sections & READ_SAMPLES)
+ nsamples = scf->header.samples;
+ if (sections & READ_BASES)
+ nbases = scf->header.bases;
+ read = read_allocate(nsamples, nbases);
+
+ if (NULLRead == read)
+ return NULLRead;
+
+ if (sections & READ_SAMPLES) {
+ /* copy the samples */
+ i_end = scf->header.samples;
+ read->NPoints = i_end;
+
+ if (scf->header.sample_size == 1) {
+ for (i = 0; i < i_end; i++) {
+ read->traceA[i] = scf->samples.samples1[i].sample_A;
+ read->traceC[i] = scf->samples.samples1[i].sample_C;
+ read->traceG[i] = scf->samples.samples1[i].sample_G;
+ read->traceT[i] = scf->samples.samples1[i].sample_T;
+
+ if (read->traceA[i] > max_val) max_val = read->traceA[i];
+ if (read->traceC[i] > max_val) max_val = read->traceC[i];
+ if (read->traceG[i] > max_val) max_val = read->traceG[i];
+ if (read->traceT[i] > max_val) max_val = read->traceT[i];
+ }
+ } else { /* sample_size == 2 */
+ for (i = 0; i < i_end; i++) {
+ read->traceA[i] = scf->samples.samples2[i].sample_A;
+ read->traceC[i] = scf->samples.samples2[i].sample_C;
+ read->traceG[i] = scf->samples.samples2[i].sample_G;
+ read->traceT[i] = scf->samples.samples2[i].sample_T;
+
+ if (read->traceA[i] > max_val) max_val = read->traceA[i];
+ if (read->traceC[i] > max_val) max_val = read->traceC[i];
+ if (read->traceG[i] > max_val) max_val = read->traceG[i];
+ if (read->traceT[i] > max_val) max_val = read->traceT[i];
+ }
+ }
+
+ read->maxTraceVal = max_val;
+ }
+
+ if (sections & READ_BASES) {
+ /* copy the bases */
+ i_end = scf->header.bases;
+ read->NBases = i_end;
+
+ for (i = 0; i < i_end; i++) {
+ read->basePos[i] = scf->bases[i].peak_index;
+ read->prob_A[i] = scf->bases[i].prob_A;
+ read->prob_C[i] = scf->bases[i].prob_C;
+ read->prob_G[i] = scf->bases[i].prob_G;
+ read->prob_T[i] = scf->bases[i].prob_T;
+ read->base[i] = scf->bases[i].base;
+ }
+ read->base[i] = 0;
+ }
+
+ if (sections & READ_COMMENTS) {
+ /* allocate and copy the comments */
+ if (scf->header.comments_size > 0 && scf->comments) {
+ read->info = (char *)xmalloc(scf->header.comments_size+1);
+ if (NULL == read->info) {
+ read_deallocate(read);
+ return NULLRead;
+ }
+
+ memcpy(read->info, scf->comments, scf->header.comments_size);
+ read->info[scf->header.comments_size] = '\0';
+ }
+ }
+
+ /* other bits and pieces */
+ read->leftCutoff = scf->header.bases_left_clip;
+ read->rightCutoff = read->NBases - scf->header.bases_right_clip + 1;
+ read->format = TT_SCF;
+
+ return read;
+}
+
+/*
+ * Translates a Read structure into a Scf structure.
+ * The Read structure is left unchanged.
+ *
+ * Returns:
+ * A pointer to an allocated Scf structure upon success.
+ * NULL upon failure.
+ */
+Scf *read2scf(Read *read) {
+ Scf *scf;
+ register int i, i_end;
+ int sample_size;
+
+ /* allocate */
+ sample_size = read->maxTraceVal >= 0x100 ? 2 : 1;
+ scf = scf_allocate(read->NPoints, sample_size, read->NBases, 0, 0);
+ if (NULL == scf)
+ return NULL;
+
+ /* copy the samples */
+ i_end = read->NPoints;
+ scf->header.samples = i_end;
+
+ if (sample_size == 1) {
+ scf->header.sample_size = 1;
+ for (i = 0; i < i_end; i++) {
+ scf->samples.samples1[i].sample_A = read->traceA[i];
+ scf->samples.samples1[i].sample_C = read->traceC[i];
+ scf->samples.samples1[i].sample_G = read->traceG[i];
+ scf->samples.samples1[i].sample_T = read->traceT[i];
+ }
+ } else {
+ scf->header.sample_size = 2;
+ for (i = 0; i < i_end; i++) {
+ scf->samples.samples2[i].sample_A = read->traceA[i];
+ scf->samples.samples2[i].sample_C = read->traceC[i];
+ scf->samples.samples2[i].sample_G = read->traceG[i];
+ scf->samples.samples2[i].sample_T = read->traceT[i];
+ }
+ }
+
+ /* copy the bases */
+ i_end = read->NBases;
+ scf->header.bases = i_end;
+
+ for (i = 0; i < i_end; i++) {
+ scf->bases[i].peak_index = read->basePos ? read->basePos[i] : i;
+ scf->bases[i].prob_A = read->prob_A ? read->prob_A[i] : 0;
+ scf->bases[i].prob_C = read->prob_A ? read->prob_C[i] : 0;
+ scf->bases[i].prob_G = read->prob_A ? read->prob_G[i] : 0;
+ scf->bases[i].prob_T = read->prob_A ? read->prob_T[i] : 0;
+ scf->bases[i].base = read->base ? read->base[i] : '-';
+ }
+
+ /* allocate and copy the comments */
+ if (read->info) {
+ scf->header.comments_size = strlen(read->info) + 1;
+ scf->comments = (char *)xmalloc(scf->header.comments_size);
+ if (NULL == scf->comments) {
+ scf_deallocate(scf);
+ return NULL;
+ }
+
+ memcpy(scf->comments, read->info, scf->header.comments_size - 1);
+
+ /* just to make sure */
+ scf->comments[scf->header.comments_size-1] = '\0';
+ }
+
+ /* other bits and pieces */
+ scf->header.bases_left_clip = read->leftCutoff;
+ scf->header.bases_right_clip = read->NBases - read->rightCutoff + 1;
+ scf->header.code_set = CSET_DEFAULT;
+ memcpy(scf->header.version, scf_version_float2str(SCF_VERSION), 4);
+
+ return scf;
+}
+#endif /* IOLIB_SCF */
+
+
+#ifdef IOLIB_EXP
+
+#define extend(e, entry, len) \
+do { \
+ (void)ArrayRef(e->entries[entry],e->Nentries[entry]++); \
+ if (NULL == (exp_get_entry(e, entry) = (char *)xmalloc(len))) \
+ return NULL; \
+} while (0)
+
+/*
+ * Translates a Read structure and an Experiment file.
+ * The Read structure is left unchanged.
+ *
+ * Returns:
+ * A pointer to an allocated Exp_info structure upon success.
+ * NULL upon failure.
+ */
+Exp_info *read2exp(Read *read, char *EN) {
+ Exp_info *e;
+ char *t = trace_type_int2str(read->format), *p;
+ int l = strlen(EN)+1;
+ char *sq;
+ int i;
+ static char valid_bases[256];
+ static int valid_setup = 0;
+
+ if (!valid_setup) {
+ for (i = 0; i < 256; i++)
+ valid_bases[i] = '-';
+ /* IUBC codes */
+ for (sq = "acgturymkswbdhvnACGTURYMKSWBDHVN"; *sq; sq++)
+ valid_bases[(unsigned)*sq] = *sq;
+ valid_setup = 1;
+ }
+
+ if (NULL == (e = exp_create_info()))
+ return NULL;
+
+ /* Copy original exp file if present */
+ if (read->orig_trace && read->orig_trace_format == TT_EXP) {
+ int i, j, k;
+ Exp_info *re = (Exp_info *)read->orig_trace;
+
+ for (i = 0; i < MAXIMUM_EFLTS; i++) {
+ if (EFLT_SQ == i ||
+ EFLT_QL == i ||
+ EFLT_QR == i)
+ continue;
+
+ if (0 == (k = exp_Nentries(re, i)))
+ continue;
+
+ e->Nentries[i] = k;
+ ArrayRef(e->entries[i], e->Nentries[i]);
+ for (j = 0; j < k; j++) {
+ arr(char *, e->entries[i], j) =
+ strdup(arr(char *, re->entries[i], j));
+ }
+ }
+
+ /* Otherwise create our EN, ID, LN and LT lines */
+ } else {
+ /* Entry name and ID lines */
+ if (p = strrchr(EN, '/'))
+ EN = p+1;
+ extend(e, EFLT_EN, l);
+ sprintf(exp_get_entry(e, EFLT_EN), "%s", EN);
+ extend(e, EFLT_ID, l);
+ sprintf(exp_get_entry(e, EFLT_ID), "%s", EN);
+
+ /* Trace file & type */
+ if (read->trace_name) {
+ char *cp;
+ if (cp = strrchr(read->trace_name, '/'))
+ cp++;
+ else
+ cp = read->trace_name;
+ extend(e, EFLT_LN, strlen(cp)+1);
+ strcpy(exp_get_entry(e, EFLT_LN), cp);
+ }
+
+ if (read->format != TT_ANY) {
+ extend(e, EFLT_LT, strlen(t)+1);
+ strcpy(exp_get_entry(e, EFLT_LT), t);
+ }
+ }
+
+ /* Output SQ, QL and QR lines */
+
+ /* Cutoffs */
+ if (read->leftCutoff) {
+ extend(e, EFLT_QL, 15);
+ sprintf(exp_get_entry(e, EFLT_QL), "%d", read->leftCutoff);
+ }
+
+ if (read->rightCutoff) {
+ extend(e, EFLT_QR, 15);
+ sprintf(exp_get_entry(e, EFLT_QR), "%d", read->rightCutoff);
+ }
+
+ /* Bases */
+ extend(e, EFLT_SQ, read->NBases+1);
+ sq = exp_get_entry(e, EFLT_SQ);
+ for (i = 0; i < read->NBases; i++) {
+ sq[i] = valid_bases[(unsigned)read->base[i]];
+ }
+ sq[i] = 0;
+
+#ifdef USE_BIOLIMS
+ /*
+ * Johnt:
+ * - Added tags below to allow for biolims update
+ * - This is all a very big bodge to allow BioLIMS
+ * attributes to be passed through the Read structure
+ * to the Experiment file
+ * - Any changes to this should also be mirrored in ../biolims/Exp.cpp
+ */
+ {
+ int1 *qa; /* quality array */
+ int i;
+ char tmp[1024];
+ char *line; /* current line from info */
+ char *end; /* end of current line */
+
+ /* AV only supports a single prob value for now */
+ qa = (int1 *)malloc((read->NBases+1)*sizeof(int1));
+
+ /* need max 4 bytes per value - see conf2str */
+ extend(e,EFLT_AV,(read->NBases+1)*4);
+
+ /* merge into single quality array */
+ for(i=0;i<read->NBases;i++){
+ switch(read->base[i]){
+ case 'a':
+ case 'A':
+ qa[i] = read->prob_A[i];
+ break;
+ case 'c':
+ case 'C':
+ qa[i] = read->prob_C[i];
+ break;
+ case 'g':
+ case 'G':
+ qa[i] = read->prob_G[i];
+ break;
+ case 't':
+ case 'T':
+ qa[i] = read->prob_T[i];
+ break;
+ default:
+ qa[i] = 0;
+ }
+ }
+ conf2str(qa,read->NBases,exp_get_entry(e, EFLT_AV));
+ free(qa);
+
+ /* Parse the read notes for everything else */
+ if( read->info) {
+ for(line=read->info;end=strchr(line,'\n');line=end+1){
+ *end='\0'; /* * put back */
+
+ /* look for known tags */
+ if(!strncmp(line,EXP_CHEM,EXP_TAGLEN)){
+ /* CH */
+ int chem=0;
+ extend(e, EFLT_CH, 15);
+ if( !strcmp(CH_types[1],line+EXP_TAGLEN))
+ chem=1;
+ sprintf(exp_get_entry(e, EFLT_CH), "%d",chem );
+
+ } else if(!strncmp(line,EXP_PRMR,EXP_TAGLEN)){
+ /* PR */
+ int primer=0;
+ extend(e,EFLT_PR,15);
+ for(primer=1;primer<nPR_types;primer++)
+ if(!strcmp(PR_types[i],line+EXP_TAGLEN))
+ break;
+ if(primer>=nPR_types)
+ primer=1;
+ sprintf(exp_get_entry(e, EFLT_PR), "%d",primer);
+
+ } else if(!strncmp(line,EXP_VECT,EXP_TAGLEN)){
+ /* SV */
+ extend(e,EFLT_SV,strlen(line)-EXP_TAGLEN+1);
+ strcpy(exp_get_entry(e, EFLT_SV),line+EXP_TAGLEN);
+
+ } else if(!strncmp(line,EXP_CLOV,EXP_TAGLEN)){
+ /* CV */
+ extend(e,EFLT_CV,strlen(line)-EXP_TAGLEN+1);
+ strcpy(exp_get_entry(e, EFLT_CV),line+EXP_TAGLEN);
+
+ } else if(!strncmp(line,EXP_CLON,EXP_TAGLEN)){
+ /* CN */
+ extend(e,EFLT_CN,strlen(line)-EXP_TAGLEN+1);
+ strcpy(exp_get_entry(e, EFLT_CN),line+EXP_TAGLEN);
+
+ } else if(!strncmp(line,EXP_FEAT,EXP_TAGLEN)){
+ /* FEAT=start stop key\r\rcomment */
+ /* key and comment have \n encoded as \r */
+ int start,stop,i;
+ char *key; /* biolims feature key */
+ char *comment; /* biolims feature comment */
+ line+=EXP_TAGLEN;
+ start=atoi(line);
+ line=strchr(line,' ')+1;
+ stop=atoi(line);
+ key=strchr(line,' ')+1;
+ comment=strstr(key,"\r\r");
+ *comment='\0'; /* * put back */
+ comment+=2;
+ /* replace \r with \n in key and comment */
+ for(i=0;key[i];i++)
+ if(key[i]=='\r') key[i]='\n';
+ for(i=0;comment[i];i++)
+ if(comment[i]=='\r') comment[i]='\n';
+ /* could possibly be one of a number of EXP tags excoded
+ as a BioLIMS feature */
+ if(!strncmp(key,featCLON,STADEN_FKEY_LEN)){
+ /* CS */
+ extend(e, EFLT_CS, 32);
+ exp_create_range(exp_get_entry(e, EFLT_CS),start,stop);
+ } else if(!strncmp(key,featVECI,STADEN_FKEY_LEN)){
+ /* SI */
+ extend(e, EFLT_SI, 32);
+ exp_create_range(exp_get_entry(e, EFLT_SI),start,stop);
+ } else if(!strncmp(key,featTEMP,STADEN_FKEY_LEN)){
+ /* TN */
+ extend(e, EFLT_TN, strlen(comment)+1);
+ strcpy(exp_get_entry(e, EFLT_TN),comment);
+ } else if(!strncmp(key,featSTRD,STADEN_FKEY_LEN)){
+ /* ST */
+ extend(e, EFLT_ST, strlen(comment)+1);
+ strcpy(exp_get_entry(e, EFLT_ST),comment);
+ } else if( !strncmp(key,featVECT,STADEN_FKEY_LEN)){
+ /* SL and SR */
+ extend(e,EFLT_SL,15);
+ extend(e,EFLT_SR,15);
+ sprintf(exp_get_entry(e, EFLT_SL),"%d",start);
+ sprintf(exp_get_entry(e, EFLT_SR),"%d",stop);
+ } else if( !strncmp(key,featGELR,STADEN_FKEY_LEN)){
+ /* TG */
+ char tag[5]; /* staden note tag (always 4 chars) */
+ char strand=*comment; /* first char of comment */
+ /* key has format STADEN_GELR:XXXX -
+ where XXXX is staden note tag */
+ strncpy(tag,key+STADEN_FKEY_LEN+1,4);
+ tag[4]='\0';
+ comment+=2; /* skip over strand */
+ sprintf(tmp,"%s %c %d..%d\n%s",
+ key,strand,start,stop,comment);
+ extend(e,EFLT_TG,strlen(tmp)+1);
+ strcpy(exp_get_entry(e, EFLT_TG),tmp);
+
+ } else if( !strncmp(key,featCONS,STADEN_FKEY_LEN)){
+ /* TC */
+ char tag[5]; /* staden note tag (always 4 chars) */
+ /* comment has the format Srstart-rend\ncomment
+ S is a single character strand indicator
+ rstart and rend are the real start and end of the
+ tag
+ */
+ char strand=*comment; /* first char of comment */
+ char *rangestart = comment+2; /*skip over strand*/
+ char *rangeend;
+ char *emptystring="";
+
+ /* key has format STADEN_CONS:XXXX -
+ where XXXX is staden note tag */
+ strncpy(tag,key+STADEN_FKEY_LEN+1,4);
+ tag[4]='\0';
+ /* the REAL range might actually be outside the bases,
+ so this is recorded in the first line of
+ the comment. This is merged with the
+ feature range to allow for complimenting */
+ comment=strchr(rangestart,'\n');
+ if( comment )
+ *(comment++)='\0'; /* *** put back */
+ else
+ comment=emptystring;
+
+ /* now special processing of bounds */
+ rangeend=strchr(rangestart,'-');
+ if( rangeend ){
+ long rstart,rend;
+ *(rangeend++)='\0'; /* *** put back */
+ rstart=atol(rangestart);
+ rend=atol(rangeend);
+ *(rangeend-1)='-';
+
+ /* if start is the same as rstart, just
+ need to extend the stop bounds to the
+ real end If not there has been some
+ complimenting happening so need to
+ extend the start bounds, as its now
+ backwards. */
+ if( start==rstart)
+ stop=start+rend-rstart;
+ else
+ start=stop-rend+rstart;
+ } else {
+ /* don't have a range so just use the
+ feature size */
+ }
+
+ sprintf(tmp,"%s %c %d..%d\n%s",
+ key,strand,start,stop,comment);
+ extend(e,EFLT_TC,strlen(tmp)+1);
+ strcpy(exp_get_entry(e, EFLT_TC),tmp);
+ if( comment!=emptystring)
+ *(comment-1)='\n';
+
+ } else {
+ /* TG */
+ /* a biolims feature, encode this with tag
+ BIOL, and the Biolims Feature key in
+ the first line of the comment*/
+ sprintf(tmp,"%s = %d..%d\n%s%s\n%s",/* use strand = */
+ tagBIOL,start,stop,featKey,key,comment);
+ extend(e,EFLT_TG,strlen(tmp)+1);
+ strcpy(exp_get_entry(e, EFLT_TG),tmp);
+ }
+ *(comment-2)='\r';
+ }
+ /* else unused value */
+
+ *end='\n';
+ }
+ }
+ }
+#else /* USE_BIOLIMS */
+ /* Confidence values */
+ if (read->prob_A && read->prob_C && read->prob_G && read->prob_T &&
+ read->NBases > 0) {
+ /* We have some, but are they non zero values? */
+ for (i = 0; i < read->NBases; i++) {
+ if (read->prob_A[i] || read->prob_C[i] ||
+ read->prob_G[i] || read->prob_T[i])
+ break;
+ }
+ if (i != read->NBases) {
+ int1 *conf = (int1 *)xmalloc(read->NBases);
+ char *cstr = (char *)xmalloc(read->NBases * 4 + 2);
+
+ for (i = 0; i < read->NBases; i++) {
+ switch (read->base[i]) {
+ case 'a':
+ case 'A':
+ conf[i] = read->prob_A[i];
+ break;
+ case 'c':
+ case 'C':
+ conf[i] = read->prob_C[i];
+ break;
+ case 'g':
+ case 'G':
+ conf[i] = read->prob_G[i];
+ break;
+ case 't':
+ case 'T':
+ conf[i] = read->prob_T[i];
+ break;
+ default:
+ conf[i] = (read->prob_A[i] + read->prob_C[i] +
+ read->prob_G[i] + read->prob_T[i]) / 4;
+ }
+ }
+
+ conf2str(conf, read->NBases, cstr);
+ extend(e, EFLT_AV, strlen(cstr)+1);
+ sprintf(exp_get_entry(e, EFLT_AV), "%s", cstr);
+ xfree(conf);
+ xfree(cstr);
+ }
+ }
+#endif /* if USE_BIOLIMS else ... */
+
+ return e;
+}
+
+
+/*
+ * Controls the use of the SQ and ON lines when loading an experiment file.
+ * The default (value&1 == 1) is to load these into the Read structure.
+ * With value&1 == 0 we load the sequence directly from the trace file
+ * (LT line).
+ * value&2 controls whether to use the SL/SR fields when setting the cutoff.
+ * value&2 == 0 implies to do so, and value&2 == 2 implies to not.
+ *
+ * The default use is to use the SQ and ON lines. Returns the old value.
+ */
+static int use_experiment_sequence = 1;
+int read_experiment_redirect(int value) {
+ int old = use_experiment_sequence;
+
+ use_experiment_sequence = value;
+ return old;
+}
+
+
+/*
+ * Translates an experiment file to a Read structure.
+ * The Exp_info structure is left unchanged.
+ *
+ * Returns:
+ * A pointer to an allocated Read structure upon success.
+ * NULLRead upon failure.
+ */
+Read *exp2read(Exp_info *e, char *fn) {
+ Read *r;
+ int q, s, ttype, err = 0;
+ char *str;
+ int use_exp = use_experiment_sequence;
+ FILE *fp;
+
+ if (!exp_Nentries(e, EFLT_LN)) {
+ err = 1;
+ } else {
+ /* Read the trace component of the experiment file */
+ ttype = exp_Nentries(e,EFLT_LT)
+ ? trace_type_str2int(exp_get_entry(e, EFLT_LT)) : TT_ANY;
+
+ if (fp = open_trace_file(exp_get_entry(e, EFLT_LN), fn)) {
+ if (NULLRead == (r = fread_reading(fp, NULL, ttype)))
+ err = 1;
+ } else {
+ err = 1;
+ }
+ }
+
+ if (err) {
+ use_exp = 1;
+ r = read_allocate(0, 1);
+ }
+
+ /* Set the left cutoff (QL / SL) */
+ q=-1;
+ if (exp_Nentries(e, EFLT_QL))
+ q = atoi(exp_get_entry(e, EFLT_QL));
+ if ((use_exp&2) != 2) {
+ s=-1;
+ if (exp_Nentries(e, EFLT_SL))
+ s = atoi(exp_get_entry(e, EFLT_SL));
+ if (q != -1 || s != -1)
+ r->leftCutoff = MAX(q, s);
+ } else {
+ r->leftCutoff = q != -1 ? q : 0;
+ }
+
+ /* Set the right cutoff (QR / SR) */
+ q = INT_MAX;
+ if (exp_Nentries(e, EFLT_QR))
+ q = atoi(exp_get_entry(e, EFLT_QR));
+ if ((use_exp&2) != 2) {
+ s = INT_MAX;
+ if (exp_Nentries(e, EFLT_SR))
+ s = atoi(exp_get_entry(e, EFLT_SR));
+ if (q != INT_MAX || s != INT_MAX)
+ r->rightCutoff = MIN(q, s);
+ } else {
+ r->rightCutoff = q != INT_MAX ? q : 0;
+ }
+
+ if (r->rightCutoff && r->rightCutoff <= r->leftCutoff)
+ r->rightCutoff = r->leftCutoff+1;
+
+ /* Bases and base positions, if desired */
+ if (use_exp&1) {
+ if (exp_Nentries(e, EFLT_SQ) && (str = exp_get_entry(e, EFLT_SQ))) {
+ int slen = strlen(str);
+
+ if (NULL == (r->base = (char *)xrealloc(r->base, slen+1)))
+ return NULLRead;
+ if (NULL == (r->prob_A = (char *)xrealloc(r->prob_A, slen+1)))
+ return NULLRead;
+ if (NULL == (r->prob_C = (char *)xrealloc(r->prob_C, slen+1)))
+ return NULLRead;
+ if (NULL == (r->prob_G = (char *)xrealloc(r->prob_G, slen+1)))
+ return NULLRead;
+ if (NULL == (r->prob_T = (char *)xrealloc(r->prob_T, slen+1)))
+ return NULLRead;
+ if (NULL == (r->basePos = (uint_2 *)xrealloc(r->basePos, slen*2)))
+ return NULLRead;
+
+ /* Clear them */
+ memset(r->prob_A, 0, slen);
+ memset(r->prob_C, 0, slen);
+ memset(r->prob_G, 0, slen);
+ memset(r->prob_T, 0, slen);
+
+ strcpy(r->base, str);
+ r->NBases = slen;
+
+ /* Copy AV values into prob_* arrays */
+ if (exp_Nentries(e, EFLT_AV) &&
+ (str = exp_get_entry(e, EFLT_AV))) {
+ int1 *conf = (int1 *)xmalloc((slen+1)*sizeof(*conf));
+ int i;
+
+ str2conf(conf, slen, str);
+ for (i = 0; i < slen ; i++) {
+ switch(r->base[i]) {
+ case 'a':
+ case 'A':
+ r->prob_A[i] = conf[i];
+ r->prob_C[i] = 0;
+ r->prob_G[i] = 0;
+ r->prob_T[i] = 0;
+ break;
+ case 'c':
+ case 'C':
+ r->prob_A[i] = 0;
+ r->prob_C[i] = conf[i];
+ r->prob_G[i] = 0;
+ r->prob_T[i] = 0;
+ break;
+ case 'g':
+ case 'G':
+ r->prob_A[i] = 0;
+ r->prob_C[i] = 0;
+ r->prob_G[i] = conf[i];
+ r->prob_T[i] = 0;
+ break;
+ case 't':
+ case 'T':
+ r->prob_A[i] = 0;
+ r->prob_C[i] = 0;
+ r->prob_G[i] = 0;
+ r->prob_T[i] = conf[i];
+ break;
+ default:
+ r->prob_A[i] = conf[i];
+ r->prob_C[i] = conf[i];
+ r->prob_G[i] = conf[i];
+ r->prob_T[i] = conf[i];
+ break;
+ }
+ }
+
+ xfree(conf);
+ } else {
+ memset(r->prob_A, 0, slen * sizeof(r->prob_A[0]));
+ memset(r->prob_C, 0, slen * sizeof(r->prob_C[0]));
+ memset(r->prob_G, 0, slen * sizeof(r->prob_G[0]));
+ memset(r->prob_T, 0, slen * sizeof(r->prob_T[0]));
+ }
+
+ /* Check for original positions information */
+ if (exp_Nentries(e, EFLT_ON) &&
+ (str = exp_get_entry(e, EFLT_ON))) {
+ int_2 *opos;
+
+ if (opos = (int_2 *)xcalloc(slen, 2)) {
+ str2opos(opos, slen, str);
+
+ read_update_opos(r, opos, slen, r->basePos,
+ NULL, NULL, NULL, NULL);
+ }
+ }
+ }
+ }
+
+ r->format = TT_EXP;
+ r->orig_trace = e;
+ r->orig_trace_format = TT_EXP;
+ r->orig_trace_free = (void (*)(void *))exp_destroy_info;
+
+ return r;
+}
+#endif /* IOLIB_EXP */
+
+/*
+ * Given an original positions array, update the 'basePos' and confidence
+ * arrays to reflect the new sample numbers (effectively the "X coordinates").
+ * The arrays to update (basePos, prob_[ACGT]) are assumed to have already
+ * been allocated to the size r->NBases. The opos array is assumed to be
+ * of size 'slen'.
+ *
+ * Specifying any of the arrays to be updated as NULL simply ignores
+ * any updates required.
+ *
+ * The updates are computed using 'r' and 'opos' ('slen' bases) and written
+ * to the update arrays. It's possible to send over the real arrays
+ * (r->basePos).
+ */
+void read_update_opos(Read *r, int_2 *opos, int slen, uint_2 *basePos,
+ char *prob_A, char *prob_C, char *prob_G, char *prob_T) {
+ uint_2 *bp = r->basePos;
+ int i, diff;
+ int olen = r->NBases;
+
+ diff = 1;
+ for (i=0; i < slen; i++) {
+ int d;
+
+ /* Insertion */
+ if (opos[i] == 0) {
+ continue;
+ }
+
+ /* Deletion */
+ if ((d = opos[i] - (i+diff)) && (olen - (i+d)) > 0) {
+ if (basePos) memmove(&basePos[i], &basePos[i+d], (olen-(i+d))*2);
+ if (prob_A) memmove(&prob_A[i], &prob_A[i+d], olen-(i+d));
+ if (prob_C) memmove(&prob_C[i], &prob_C[i+d], olen-(i+d));
+ if (prob_G) memmove(&prob_G[i], &prob_G[i+d], olen-(i+d));
+ if (prob_T) memmove(&prob_T[i], &prob_T[i+d], olen-(i+d));
+ diff += d;
+ }
+ }
+ for (i = 0; i < slen; i++) {
+ if (opos[i] == 0) {
+ if (basePos) basePos[i] = 0;
+ if (prob_A) prob_A[i] = 0;
+ if (prob_C) prob_C[i] = 0;
+ if (prob_G) prob_G[i] = 0;
+ if (prob_T) prob_T[i] = 0;
+ }
+ }
+
+ r->basePos = basePos;
+ for (i = 0; i < slen; i++) {
+ if (basePos) basePos[i] = topos(r, i);
+ }
+ r->basePos = bp;
+}
+
+
+/*
+ * Find the position of an edited base
+ */
+static int topos(Read *r, int ind) {
+ int back, forw;
+ int backp, forwp;
+
+ if (ind < 0)
+ return 0;
+ if (ind >= r->NBases)
+ ind = r->NBases-1;
+
+ /* The simple case */
+ if (r->basePos[ind])
+ return r->basePos[ind];
+
+ /* Scan in both directions for last non zero position */
+ for (back = ind-1; back >= 0 && r->basePos[back] == 0; back--)
+ ;
+ if (back < 0)
+ back = 0;
+
+ for (forw = ind+1; forw < r->NBases && r->basePos[forw] == 0; forw++)
+ ;
+
+ if (r->basePos[forw])
+ forwp = r->basePos[forw];
+ else
+ forwp = r->NPoints;
+
+ if (r->basePos[back])
+ backp = r->basePos[back];
+ else
+ backp = forwp / 4;
+
+ /* Interpolate */
+ return (forwp - backp) * (ind - back) / (forw - back) + backp;
+}
+
+int read_sections(int new_sec) {
+ static int sections = READ_ALL;
+
+ if (new_sec)
+ sections = new_sec;
+
+ return sections;
+}
diff --git a/src/Staden/read/translate.h b/src/Staden/read/translate.h
new file mode 100644
index 0000000..899d0be
--- /dev/null
+++ b/src/Staden/read/translate.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _TRANSLATE_H_
+#define _TRANSLATE_H_
+
+#include "scf.h"
+#include "Read.h"
+#include "expFileIO.h"
+
+/*
+ * Translates an Scf structure into a Read structure.
+ * The Scf structure is left unchanged.
+ *
+ * Returns:
+ * A pointer to an allocated Read structure upon success.
+ * NULLRead upon failure.
+ */
+Read *scf2read(Scf *scf);
+
+/*
+ * Translates a Read structure into a Scf structure.
+ * The Read structure is left unchanged.
+ *
+ * Returns:
+ * A pointer to an allocated Scf structure upon success.
+ * NULL upon failure.
+ */
+Scf *read2scf(Read *read);
+
+/*
+ * Translates a Read structure and an Experiment file.
+ * The Read structure is left unchanged.
+ *
+ * Returns:
+ * A pointer to an allocated Exp_info structure upon success.
+ * NULL upon failure (FIXME: need to free memory here)
+ */
+Exp_info *read2exp(Read *read, char *EN);
+
+/*
+ * Controls the use of the SQ and ON lines when loading an experiment file.
+ * The default (value&1 == 1) is to load these into the Read structure.
+ * With value&1 == 0 we load the sequence directly from the trace file
+ * (LT line).
+ * value&2 controls whether to use the SL/SR fields when setting the cutoff.
+ * value&2 == 0 implies to do so, and value&2 == 2 implies to not.
+ *
+ * Returns:
+ * The old value.
+ */
+int read_experiment_redirect(int value);
+
+/*
+ * Given an original positions array, update the 'basePos' and confidence
+ * arrays to reflect the new sample numbers (effectively the "X coordinates").
+ * The arrays to update (basePos, prob_[ACGT]) are assumed to have already
+ * been allocated to the size r->NBases. The opos array is assumed to be
+ * of size 'slen'.
+ *
+ * Specifying any of the arrays to be updated as NULL simply ignores
+ * any updates required.
+ *
+ * The updates are computed using 'r' and 'opos' ('slen' bases) and written
+ * to the update arrays. It's possible to send over the real arrays
+ * (r->basePos).
+ */
+void read_update_opos(Read *read, int_2 *opos, int slen, uint_2 *basePos,
+ char *prob_A, char *prob_C, char *prob_G, char *prob_T);
+
+/*
+ * Translates an experiment file to a Read structure.
+ * The Exp_Info structure is left unchanged.
+ *
+ * Returns:
+ * A pointer to an allocated Read structure upon success.
+ * NULLRead upon failure.
+ */
+Read *exp2read(Exp_info *e, char *fn);
+
+#endif
diff --git a/src/Staden/read/write_scf.c b/src/Staden/read/write_scf.c
new file mode 100644
index 0000000..b00dd06
--- /dev/null
+++ b/src/Staden/read/write_scf.c
@@ -0,0 +1,461 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ Title: write_scf.c
+
+ Purpose: Output of Standard Chromatogram Format sequences
+ Last update: August 18 1994
+
+ Change log:
+ 4 Feb 1992, Now draft proposal version 2
+ 23 Nov 92, SCF 2.0 + LaDeana's changes
+ 11 Aug 93, Version 2.01 containing confidence values
+ 18 Aug 1994 Renamed from writeSCF.c; now purely SCF IO (no Seq structs)
+
+ Oct 95 major rewrite to make files more easily compressed.
+ gzip now gets files to around 40% of original
+ Version raised to 3.00
+ * We store in order:
+ * Header
+ * Samples
+ * Bases
+ * Comments
+ * Private
+
+ Two main types of change:
+ 1: write data in lane order instead of all lanes together
+ eg write Sample values for A, then Sample values for C, etc.
+
+ 2: where appropriate write delta delta values instead of complete ones.
+ ie write the differences in the differences between successive values
+
+*/
+
+
+static char fileIdentifier[] = "$Id$";
+
+static int scf_version = 3;
+
+/* ---- Imports ---- */
+
+
+#include <ctype.h>
+#include <stdio.h> /* IMPORT: fopen, fclose, fseek, ftell, fgetc,
+ EOF */
+#include <string.h>
+#include "scf.h" /* IMPORT: scf structures */
+#include "mach-io.h" /* IMPORT: be_write_int_1, be_write_int_2, be_write_int_4 */
+#include "xalloc.h"
+
+/* ---- Exports ---- */
+
+
+int write_scf_header(FILE *fp, Header *h)
+{
+ int i;
+
+ if (be_write_int_4(fp,&h->magic_number)==False) return -1;
+ if (be_write_int_4(fp,&h->samples)==False) return -1;
+ if (be_write_int_4(fp,&h->samples_offset)==False) return -1;
+ if (be_write_int_4(fp,&h->bases)==False) return -1;
+ if (be_write_int_4(fp,&h->bases_left_clip)==False) return -1;
+ if (be_write_int_4(fp,&h->bases_right_clip)==False) return -1;
+ if (be_write_int_4(fp,&h->bases_offset)==False) return -1;
+ if (be_write_int_4(fp,&h->comments_size)==False) return -1;
+ if (be_write_int_4(fp,&h->comments_offset)==False) return -1;
+ if (fwrite(h->version,sizeof(h->version),1,fp)!=1) return -1;
+ if (be_write_int_4(fp,&h->sample_size)==False) return -1;
+ if (be_write_int_4(fp,&h->code_set)==False) return -1;
+ if (be_write_int_4(fp,&h->private_size)==False) return -1;
+ if (be_write_int_4(fp,&h->private_offset)==False) return -1;
+ for (i=0;i<18;i++)
+ if (be_write_int_4(fp,&h->spare[i])==False) return -1;
+
+ return 0;
+}
+
+
+int write_scf_sample1(FILE *fp, Samples1 *s)
+{
+ uint_1 buf[4];
+
+ buf[0] = s->sample_A;
+ buf[1] = s->sample_C;
+ buf[2] = s->sample_G;
+ buf[3] = s->sample_T;
+ if (4 != fwrite(buf, 1, 4, fp)) return -1;
+
+ return 0;
+}
+
+
+int write_scf_sample2(FILE *fp, Samples2 *s)
+{
+ uint_2 buf[4];
+
+ buf[0] = be_int2(s->sample_A);
+ buf[1] = be_int2(s->sample_C);
+ buf[2] = be_int2(s->sample_G);
+ buf[3] = be_int2(s->sample_T);
+ if (4 != fwrite(buf, 2, 4, fp)) return -1;
+
+ return 0;
+}
+
+
+int write_scf_samples1(FILE *fp, Samples1 *s, size_t num_samples) {
+ size_t i;
+
+ for (i = 0; i < num_samples; i++) {
+ if (-1 == write_scf_sample1(fp, &(s[i])))
+ return -1;
+ }
+
+ return 0;
+}
+
+
+int write_scf_samples2(FILE *fp, Samples2 *s, size_t num_samples) {
+ size_t i;
+
+ for (i = 0; i < num_samples; i++) {
+ if (-1 == write_scf_sample2(fp, &(s[i])))
+ return -1;
+ }
+
+ return 0;
+}
+
+
+int write_scf_samples31(FILE *fp, Samples1 *s, size_t num_samples) {
+ size_t i;
+ int1 *samples_out;
+
+ if (!num_samples)
+ return 0;
+
+ if ( ! (samples_out = (int1 *)xmalloc(num_samples *
+ sizeof(int1)))) {
+ return -1;
+ }
+
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = (&s[i])->sample_A;
+ }
+ scf_delta_samples1 ( samples_out, num_samples, 1);
+ if (num_samples != fwrite(samples_out, 1, num_samples, fp)) {
+ xfree(samples_out);
+ return -1;
+ }
+
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = (&s[i])->sample_C;
+ }
+ scf_delta_samples1 ( samples_out, num_samples, 1);
+ if (num_samples != fwrite(samples_out, 1, num_samples, fp)) {
+ xfree(samples_out);
+ return -1;
+ }
+
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = (&s[i])->sample_G;
+ }
+ scf_delta_samples1 ( samples_out, num_samples, 1);
+ if (num_samples != fwrite(samples_out, 1, num_samples, fp)) {
+ xfree(samples_out);
+ return -1;
+ }
+
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = (&s[i])->sample_T;
+ }
+ scf_delta_samples1 ( samples_out, num_samples, 1);
+ if (num_samples != fwrite(samples_out, 1, num_samples, fp)) {
+ xfree(samples_out);
+ return -1;
+ }
+
+ xfree(samples_out);
+ return 0;
+}
+
+int write_scf_samples32(FILE *fp, Samples2 *s, size_t num_samples) {
+ size_t i;
+ uint2 *samples_out;
+
+ if (!num_samples)
+ return 0;
+
+ if ( ! (samples_out = (uint2 *)xmalloc(num_samples * sizeof(uint2)))) {
+ return -1;
+ }
+
+
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = (&s[i])->sample_A;
+ }
+ scf_delta_samples2 ( samples_out, num_samples, 1);
+#ifdef SP_LITTLE_ENDIAN
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = be_int2(samples_out[i]);
+ }
+#endif
+ if (num_samples != fwrite(samples_out, 2, num_samples, fp)) return -1;
+
+
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = (&s[i])->sample_C;
+ }
+ scf_delta_samples2 ( samples_out, num_samples, 1);
+#ifdef SP_LITTLE_ENDIAN
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = be_int2(samples_out[i]);
+ }
+#endif
+ if (num_samples != fwrite(samples_out, 2, num_samples, fp)) return -1;
+
+
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = (&s[i])->sample_G;
+ }
+ scf_delta_samples2 ( samples_out, num_samples, 1);
+#ifdef SP_LITTLE_ENDIAN
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = be_int2(samples_out[i]);
+ }
+#endif
+ if (num_samples != fwrite(samples_out, 2, num_samples, fp)) return -1;
+
+
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = (&s[i])->sample_T;
+ }
+ scf_delta_samples2 ( samples_out, num_samples, 1);
+#ifdef SP_LITTLE_ENDIAN
+ for (i = 0; i < num_samples; i++) {
+ samples_out[i] = be_int2(samples_out[i]);
+ }
+#endif
+ if (num_samples != fwrite(samples_out, 2, num_samples, fp)) return -1;
+
+
+ xfree(samples_out);
+ return 0;
+}
+
+
+int write_scf_base(FILE *fp, Bases *b)
+{
+ uint_1 buf[12];
+
+ ((uint_4 *)buf)[0] = be_int4(b->peak_index);
+ buf[4] = b->prob_A;
+ buf[5] = b->prob_C;
+ buf[6] = b->prob_G;
+ buf[7] = b->prob_T;
+ buf[8] = b->base;
+ buf[9] = b->spare[0];
+ buf[10] = b->spare[1];
+ buf[11] = b->spare[2];
+
+ if (12 != fwrite(buf, 1, 12, fp)) return -1;
+
+ return 0;
+}
+
+
+int write_scf_bases(FILE *fp, Bases *b, size_t num_bases)
+{
+ size_t i;
+
+ for (i = 0; i < num_bases; i++) {
+ if (-1 == write_scf_base(fp, &(b[i])))
+ return -1;
+ }
+
+ return 0;
+}
+
+int write_scf_bases3(FILE *fp, Bases *b, size_t num_bases)
+{
+ size_t i;
+ uint_4 *buf4;
+ uint_1 *buf1;
+
+ if (NULL == (buf4 = (uint_4 *)xmalloc(1 + 4 * num_bases)))
+ return -1;
+
+ if (NULL == (buf1 = (uint_1 *)xmalloc(1 + 8 * num_bases))) {
+ xfree(buf4);
+ return -1;
+ }
+
+ for (i = 0; i < num_bases; i++) {
+ buf4[i] = be_int4((&b[i])->peak_index);
+ }
+ fwrite(buf4, 4, num_bases, fp);
+
+ for (i=0; i < num_bases; i++) {
+ buf1[i ] = (&b[i])->prob_A;
+ buf1[i+ num_bases] = (&b[i])->prob_C;
+ buf1[i+2*num_bases] = (&b[i])->prob_G;
+ buf1[i+3*num_bases] = (&b[i])->prob_T;
+ buf1[i+4*num_bases] = (&b[i])->base;
+ buf1[i+5*num_bases] = (&b[i])->spare[0];
+ buf1[i+6*num_bases] = (&b[i])->spare[1];
+ buf1[i+7*num_bases] = (&b[i])->spare[2];
+ }
+ if (8 * num_bases != (fwrite(buf1, 1, 8 * num_bases, fp))) {
+ xfree(buf1);
+ xfree(buf4);
+ return -1;
+ }
+
+ xfree(buf1);
+ xfree(buf4);
+ return 0;
+}
+
+
+int write_scf_comment(FILE *fp, Comments *c, size_t s)
+{
+ if (fwrite(c, 1, s, fp) != s) return -1;
+
+ return 0;
+}
+
+
+
+/*
+ * Request which (major) version of scf to use when writing.
+ * Defaults to the latest. Currently suitable fields are
+ * 2 and 3.
+ *
+ * Returns 0 for success, -1 for failure.
+ */
+int set_scf_version(int version) {
+ if (version != 2 && version != 3)
+ return -1;
+
+ scf_version = version;
+ return 0;
+}
+
+/*
+ * Write Seq out as a .scf file to the 'fp' FILE *
+ */
+int fwrite_scf(Scf *scf, FILE *fp) {
+ uint_4 size;
+ int err;
+
+ /*
+ * Init header offsets.
+ *
+ * We store in order:
+ * Header
+ * Samples
+ * Bases
+ * Comments
+ * Private
+ */
+ scf->header.samples_offset = (uint_4)sizeof(Header);
+ size = scf->header.samples * (scf->header.sample_size == 1 ?
+ sizeof(Samples1) : sizeof(Samples2));
+ scf->header.bases_offset = (uint_4)(scf->header.samples_offset +
+ size);
+ size = scf->header.bases * sizeof(Bases);
+ scf->header.comments_offset = (uint_4)(scf->header.bases_offset + size);
+
+ size = scf->header.comments_size;
+ scf->header.private_offset = (uint_4)(scf->header.comments_offset + size);
+
+ /* Init a few other things, such as the magic number */
+ scf->header.magic_number = SCF_MAGIC;
+
+ if (scf_version == 3) {
+ memcpy(scf->header.version, scf_version_float2str(SCF_VERSION), 4);
+ } else {
+ memcpy(scf->header.version, scf_version_float2str(SCF_VERSION_OLD), 4);
+ }
+
+ /* Write header */
+ if (write_scf_header(fp, &scf->header) == -1)
+ return -1;
+
+ if (scf_version == 3) {
+ /* Write Samples */
+ if (scf->header.sample_size == 1)
+ err = write_scf_samples31(fp, scf->samples.samples1,
+ scf->header.samples);
+ else
+ err = write_scf_samples32(fp, scf->samples.samples2,
+ scf->header.samples);
+ if (-1 == err)
+ return -1;
+
+ /* Write Bases */
+ if (-1 == write_scf_bases3(fp, scf->bases, scf->header.bases))
+ return -1;
+
+ } else {
+ /* Write Samples */
+ if (scf->header.sample_size == 1)
+ err = write_scf_samples1(fp, scf->samples.samples1,
+ scf->header.samples);
+ else
+ err = write_scf_samples2(fp, scf->samples.samples2,
+ scf->header.samples);
+ if (-1 == err)
+ return -1;
+
+ /* Write Bases */
+ if (-1 == write_scf_bases(fp, scf->bases, scf->header.bases))
+ return -1;
+ }
+
+ /* Write Comments */
+ if (-1 == write_scf_comment(fp, scf->comments,
+ scf->header.comments_size))
+ return -1;
+
+ /* Write private data */
+ if (scf->header.private_size) {
+ if (scf->header.private_size != fwrite(scf->private_data, 1,
+ scf->header.private_size, fp))
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+ * Write Seq out as a .scf file to file 'fn'.
+ */
+int write_scf(Scf *scf, char *fn)
+{
+ FILE *fp;
+
+ /* Open for for write in binary mode */
+ if ((fp = fopen(fn,"wb")) == NULL)
+ return -1;
+
+ if (fwrite_scf(scf, fp)) {
+ fclose(fp);
+ return -1;
+ }
+
+ fclose(fp);
+ return 0;
+}
diff --git a/src/Staden/read/xalloc.c b/src/Staden/read/xalloc.c
new file mode 100644
index 0000000..8cd876b
--- /dev/null
+++ b/src/Staden/read/xalloc.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+/*
+ * Our own memory alloc routines that output error messages as appropriate
+ * for us. Could also be done as macros, but hopefully there are no tight
+ * using malloc many times so efficiency shouldn't be a problem.
+ *
+ * This also allows for dropping in a debugging malloc as we're intercepting
+ * all alloc & free commands.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include "error.h"
+
+void *xmalloc(size_t size) {
+ void *c = malloc(size);
+
+ if (NULL == c) {
+ errout("Not enough memory.\n");
+ return NULL;
+ }
+
+ return c;
+}
+
+void *xrealloc(void *ptr, size_t size) {
+ void *c;
+
+ /*
+ * realloc _should_ allocate memory for us when ptr is NULL.
+ * Unfortunately this is not the case with the non-ANSI conformant
+ * C library provided with SunOS4.1
+ */
+ if (ptr)
+ c = realloc(ptr, size);
+ else
+ c = malloc(size);
+
+ if (NULL == c) {
+ errout("Not enough memory.\n");
+ return NULL;
+ }
+
+ return c;
+}
+
+void *xcalloc(size_t num, size_t size) {
+ void *c = calloc(num, size);
+
+ if (NULL == c) {
+ errout("Not enough memory.\n");
+ return NULL;
+ }
+
+ return c;
+}
+
+void xfree(void *ptr) {
+ free(ptr);
+}
diff --git a/src/Staden/read/xalloc.h b/src/Staden/read/xalloc.h
new file mode 100644
index 0000000..c5042e0
--- /dev/null
+++ b/src/Staden/read/xalloc.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _MY_MALLOC_H_
+#define _MY_MALLOC_H_
+
+#include <stdlib.h>
+
+extern void *xmalloc(size_t size);
+extern void *xrealloc(void *ptr, size_t size);
+extern void *xcalloc(size_t num, size_t size);
+extern void xfree(void *ptr);
+#endif
diff --git a/src/Staden/read/ztr.c b/src/Staden/read/ztr.c
new file mode 100644
index 0000000..02c0e38
--- /dev/null
+++ b/src/Staden/read/ztr.c
@@ -0,0 +1,771 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+/* #include <fcntl.h> */
+
+#include "xalloc.h"
+#include "Read.h"
+#include "ztr.h"
+#include "compression.h"
+
+/*
+ * ---------------------------------------------------------------------------
+ * Internal prototypes for forward references.
+ * ---------------------------------------------------------------------------
+ */
+int uncompress_chunk(ztr_chunk_t *chunk);
+
+/*
+ * ---------------------------------------------------------------------------
+ * Trace writing functions.
+ * These consist of several encoding functions, all with the same prototype,
+ * and a single fwrite_ztr function to wrap it all up.
+ * ---------------------------------------------------------------------------
+ */
+
+/*
+ * ztr_write_header
+ *
+ * Writes a ZTR file header.
+ *
+ * Arguments:
+ * fp A FILE pointer
+ * h A pointer to the header to write
+ *
+ * Returns:
+ * Success: 0
+ * Failure: -1
+ */
+int ztr_write_header(FILE *fp, ztr_header_t *h) {
+ if (1 != fwrite(h, sizeof(*h), 1, fp))
+ return -1;
+
+ return 0;
+}
+
+/*
+ * ztr_write_chunk
+ *
+ * Writes a ZTR chunk including chunk header and data
+ *
+ * Arguments:
+ * fp A FILE pointer
+ * chunk A pointer to the chunk to write
+ *
+ * Returns:
+ * Success: 0
+ * Failure: -1
+ */
+int ztr_write_chunk(FILE *fp, ztr_chunk_t *chunk) {
+ int4 bei4;
+
+ /*
+ {
+ char str[5];
+ fprintf(stderr, "Write chunk %.4s %08x length %d\n",
+ ZTR_BE2STR(chunk->type, str), chunk->type, chunk->dlength);
+ }
+ */
+
+
+ /* type */
+ bei4 = be_int4(chunk->type);
+ if (1 != fwrite(&bei4, 4, 1, fp))
+ return -1;
+
+ /* metadata length */
+ bei4 = be_int4(chunk->mdlength);
+ if (1 != fwrite(&bei4, 4, 1, fp))
+ return -1;
+
+ /* metadata */
+ if (chunk->mdlength)
+ if (chunk->mdlength != fwrite(chunk->mdata, 1, chunk->mdlength, fp))
+ return -1;
+
+ /* data length */
+ bei4 = be_int4(chunk->dlength);
+ if (1 != fwrite(&bei4, 4, 1, fp))
+ return -1;
+
+ /* data */
+ if (chunk->dlength != fwrite(chunk->data, 1, chunk->dlength, fp))
+ return -1;
+
+ return 0;
+}
+
+/*
+ * fwrite_ztr
+ *
+ * Writes a ZTR file held in the ztr_t structure.
+ * It is assumed that all the correct lengths, magic numbers, etc in the
+ * ztr_t struct have already been initialised correctly.
+ *
+ * FIXME: Add a 'method' argument which encodes formats? Perhaps store this
+ * in the ztr struct?
+ *
+ * Arguments:
+ * fp A writable FILE pointer
+ * ztr A pointer to the ztr_t struct to write.
+ *
+ * Returns:
+ * Success: 0
+ * Failure: -1
+ */
+int fwrite_ztr(FILE *fp, ztr_t *ztr) {
+ int i;
+
+ /* Write the header record */
+ if (-1 == ztr_write_header(fp, &ztr->header))
+ return -1;
+
+ /* Write the chunks */
+ for (i = 0; i < ztr->nchunks; i++) {
+ if (-1 == ztr_write_chunk(fp, &ztr->chunk[i]))
+ return -1;
+#if 0
+ {
+ int fd;
+ char fname[1024];
+ sprintf(fname, "chunk.%d", i);
+ fd = open(fname, O_RDWR|O_CREAT|O_TRUNC, 0666);
+ write(fd, ztr->chunk[i].data, ztr->chunk[i].dlength);
+ close(fd);
+ }
+#endif
+ }
+
+ return 0;
+}
+
+/*
+ * ---------------------------------------------------------------------------
+ * Trace reading functions.
+ * These consist of several decoding functions, all with the same prototype,
+ * and a single fread_ztr function to wrap it all up.
+ * ---------------------------------------------------------------------------
+ */
+
+/*
+ * ztr_read_header
+ *
+ * Reads a ZTR file header.
+ *
+ * Arguments:
+ * fp A FILE pointer
+ * h Where to write the header to
+ *
+ * Returns:
+ * Success: 0
+ * Failure: -1
+ */
+int ztr_read_header(FILE *fp, ztr_header_t *h) {
+ if (1 != fread(h, sizeof(*h), 1, fp))
+ return -1;
+
+ return 0;
+}
+
+/*
+ * ztr_read_chunk_hdr
+ *
+ * Reads a ZTR chunk header and metadata, but not the main data segment.
+ *
+ * Arguments:
+ * fp A FILE pointer
+ *
+ * Returns:
+ * Success: a chunk pointer (malloced)
+ * Failure: NULL
+ */
+ztr_chunk_t *ztr_read_chunk_hdr(FILE *fp) {
+ int4 bei4;
+ ztr_chunk_t *chunk;
+
+ if (NULL == (chunk = (ztr_chunk_t *)xmalloc(sizeof(*chunk))))
+ return NULL;
+
+ /* type */
+ if (1 != fread(&bei4, 4, 1, fp)) {
+ xfree(chunk);
+ return NULL;
+ }
+ chunk->type = be_int4(bei4);
+
+ /* metadata length */
+ if (1 != fread(&bei4, 4, 1, fp)) {
+ xfree(chunk);
+ return NULL;
+ }
+ chunk->mdlength = be_int4(bei4);
+
+ /* metadata */
+ if (chunk->mdlength) {
+ if (NULL == (chunk->mdata = (char *)xmalloc(chunk->mdlength)))
+ return NULL;
+ if (chunk->mdlength != fread(chunk->mdata, 1, chunk->mdlength, fp)) {
+ xfree(chunk->mdata);
+ xfree(chunk);
+ return NULL;
+ }
+ } else {
+ chunk->mdata = NULL;
+ }
+
+ /* data length */
+ if (1 != fread(&bei4, 4, 1, fp)) {
+ xfree(chunk->mdata);
+ xfree(chunk);
+ return NULL;
+ }
+ chunk->dlength = be_int4(bei4);
+
+ return chunk;
+}
+
+void ztr_process_text(ztr_t *ztr) {
+ int i;
+ ztr_chunk_t **text_chunks = NULL;
+ int ntext_chunks = 0;
+ ztr_text_t *zt = NULL;
+ int nzt = 0;
+ int nalloc = 0;
+
+ if (ztr->text_segments)
+ /* Already done */
+ return;
+
+ text_chunks = ztr_find_chunks(ztr, ZTR_TYPE_TEXT, &ntext_chunks);
+ if (!text_chunks)
+ return;
+
+ for (i = 0; i < ntext_chunks; i++) {
+ char *data;
+ uint4 length;
+ char *ident, *value;
+
+ /* Make sure it's not compressed */
+ uncompress_chunk(text_chunks[i]);
+
+ data = text_chunks[i]->data;
+ length = text_chunks[i]->dlength;
+
+ if (!length)
+ continue;
+
+ /* Skip RAW header byte */
+ data++;
+ length--;
+
+ while (*(ident = data)) {
+ data += strlen(ident)+1;
+ value = data;
+ if (value)
+ data += strlen(value)+1;
+
+ if (nzt + 1 > nalloc) {
+ nalloc += 10;
+ zt = (ztr_text_t *)xrealloc(zt, nalloc * sizeof(*zt));
+ }
+ zt[nzt].ident = ident;
+ zt[nzt].value = value;
+ nzt++;
+ }
+ }
+
+ ztr->text_segments = zt;
+ ztr->ntext_segments = nzt;
+
+ /*
+ for (i = 0; i < ztr->ntext_segments; i++) {
+ fprintf(stderr, "'%s' = '%s'\n",
+ ztr->text_segments[i].ident,
+ ztr->text_segments[i].value);
+ }
+ */
+
+ xfree(text_chunks);
+}
+
+
+/*
+ * fread_ztr
+ *
+ * Reads a ZTR file from 'fp'. This checks for the correct magic number and
+ * major version number, but not minor version number.
+ *
+ * FIXME: Add automatic uncompression?
+ *
+ * Arguments:
+ * fp A readable FILE pointer
+ *
+ * Returns:
+ * Success: Pointer to a ztr_t structure (malloced)
+ * Failure: NULL
+ */
+ztr_t *fread_ztr(FILE *fp) {
+ ztr_t *ztr;
+ ztr_chunk_t *chunk;
+ int sections = read_sections(0);
+
+ /* Allocate */
+ if (NULL == (ztr = new_ztr()))
+ return NULL;
+
+ /* Read the header */
+ if (-1 == ztr_read_header(fp, &ztr->header))
+ return NULL;
+
+ /* Check magic number and version */
+ if (memcmp(ztr->header.magic, ZTR_MAGIC, 8) != 0)
+ return NULL;
+
+ if (ztr->header.version_major != ZTR_VERSION_MAJOR)
+ return NULL;
+
+ /* Load chunks */
+ while (chunk = ztr_read_chunk_hdr(fp)) {
+ char str[5];
+
+ /*
+ fprintf(stderr, "Read chunk %.4s %08x length %d\n",
+ ZTR_BE2STR(chunk->type, str), chunk->type, chunk->dlength);
+ */
+ switch(chunk->type) {
+ case ZTR_TYPE_HEADER:
+ /* End of file */
+ return ztr;
+
+ case ZTR_TYPE_SAMP:
+ case ZTR_TYPE_SMP4:
+ if (! (sections & READ_SAMPLES)) {
+ fseek(fp, chunk->dlength, SEEK_CUR);
+ xfree(chunk);
+ continue;
+ }
+ break;
+
+
+ case ZTR_TYPE_BASE:
+ case ZTR_TYPE_BPOS:
+ case ZTR_TYPE_CNF4:
+ case ZTR_TYPE_CNF1:
+ case ZTR_TYPE_CSID:
+ if (! (sections & READ_BASES)) {
+ fseek(fp, chunk->dlength, SEEK_CUR);
+ xfree(chunk);
+ continue;
+ }
+ break;
+
+ case ZTR_TYPE_TEXT:
+ if (! (sections & READ_COMMENTS)) {
+ fseek(fp, chunk->dlength, SEEK_CUR);
+ xfree(chunk);
+ continue;
+ }
+ break;
+
+ case ZTR_TYPE_CLIP:
+ break;
+
+ default:
+ fprintf(stderr, "Unknown chunk type '%s': skipping\n",
+ ZTR_BE2STR(chunk->type,str));
+ fseek(fp, chunk->dlength, SEEK_CUR);
+ xfree(chunk);
+ continue;
+ }
+
+ chunk->data = (char *)xmalloc(chunk->dlength);
+ if (chunk->dlength != fread(chunk->data, 1, chunk->dlength, fp))
+ return NULL;
+
+ ztr->nchunks++;
+ ztr->chunk = (ztr_chunk_t *)xrealloc(ztr->chunk, ztr->nchunks *
+ sizeof(ztr_chunk_t));
+ memcpy(&ztr->chunk[ztr->nchunks-1], chunk, sizeof(*chunk));
+ xfree(chunk);
+ }
+
+ return ztr;
+}
+
+/*
+ * ---------------------------------------------------------------------------
+ * Other utility functions
+ * ---------------------------------------------------------------------------
+ */
+/*
+ * new_ztr
+ *
+ * Allocates and initialises a ztr_t structure
+ *
+ * Returns:
+ * ztr_t pointer on success
+ * NULL on failure
+ */
+ztr_t *new_ztr(void) {
+ ztr_t *ztr;
+ /* Allocate */
+ if (NULL == (ztr = (ztr_t *)xmalloc(sizeof(*ztr))))
+ return NULL;
+
+ ztr->chunk = NULL;
+ ztr->nchunks = 0;
+ ztr->text_segments = NULL;
+ ztr->ntext_segments = 0;
+ ztr->delta_level = 3;
+
+ return ztr;
+}
+
+void delete_ztr(ztr_t *ztr) {
+ int i;
+
+ if (!ztr)
+ return;
+
+ if (ztr->chunk) {
+ for (i = 0; i < ztr->nchunks; i++) {
+ if (ztr->chunk[i].data)
+ xfree(ztr->chunk[i].data);
+ }
+ xfree(ztr->chunk);
+ }
+
+ if (ztr->text_segments)
+ xfree(ztr->text_segments);
+
+ xfree(ztr);
+}
+
+/*
+ * ztr_find_chunks
+ *
+ * Searches for chunks of a specific type.
+ *
+ * Returns:
+ * Array of ztr_chunk_t pointers (into the ztr struct). This is
+ * allocated by malloc and it is the callers duty to free this.
+ * NULL if none found.
+ */
+ztr_chunk_t **ztr_find_chunks(ztr_t *ztr, uint4 type, int *nchunks_p) {
+ ztr_chunk_t **chunks = NULL;
+ int nchunks = 0;
+ int i;
+
+ for (i = 0; i < ztr->nchunks; i++) {
+ if (ztr->chunk[i].type == type) {
+ chunks = (ztr_chunk_t **)xrealloc(chunks, (nchunks + 1) *
+ sizeof(*chunks));
+ chunks[nchunks++] = &ztr->chunk[i];
+ }
+ }
+ *nchunks_p = nchunks;
+ return chunks;
+}
+
+/*
+ * Compresses an individual chunk using a specific format. The format is one
+ * of the 'format' fields listed in the spec; one of the ZTR_FORM_ macros.
+ */
+int compress_chunk(ztr_chunk_t *chunk, int format, int option) {
+ char *new_data = NULL;
+ int new_len;
+
+ switch (format) {
+ case ZTR_FORM_RAW:
+ return 0;
+
+ case ZTR_FORM_RLE:
+ new_data = rle(chunk->data, chunk->dlength, option, &new_len);
+ break;
+
+ case ZTR_FORM_ZLIB:
+ new_data = zlib_huff(chunk->data, chunk->dlength, option, &new_len);
+ break;
+
+ case ZTR_FORM_DELTA1:
+ new_data = decorrelate1(chunk->data, chunk->dlength, option, &new_len);
+ break;
+
+ case ZTR_FORM_DDELTA1:
+ new_data = decorrelate1dyn(chunk->data, chunk->dlength, &new_len);
+ break;
+
+ case ZTR_FORM_DELTA2:
+ new_data = decorrelate2(chunk->data, chunk->dlength, option, &new_len);
+ break;
+
+ case ZTR_FORM_DDELTA2:
+ new_data = decorrelate2dyn(chunk->data, chunk->dlength, &new_len);
+ break;
+
+ case ZTR_FORM_DELTA4:
+ new_data = decorrelate4(chunk->data, chunk->dlength, option, &new_len);
+ break;
+
+ case ZTR_FORM_16TO8:
+ new_data = shrink_16to8(chunk->data, chunk->dlength, option, &new_len);
+ break;
+
+ case ZTR_FORM_32TO8:
+ new_data = shrink_32to8(chunk->data, chunk->dlength, option, &new_len);
+ break;
+
+ case ZTR_FORM_FOLLOW1:
+ new_data = follow1(chunk->data, chunk->dlength, option, &new_len);
+ break;
+
+ case ZTR_FORM_ICHEB:
+ new_data = ichebcomp(chunk->data, chunk->dlength, &new_len);
+ break;
+ }
+
+ if (!new_data) {
+ fprintf(stderr, "!!ERROR!!\n");
+ return -1;
+ }
+
+ // fprintf(stderr, "Format %d => %d to %d\n", format, chunk->dlength, new_len);
+
+ chunk->dlength = new_len;
+ xfree(chunk->data);
+ chunk->data = new_data;
+
+ return 0;
+}
+
+/*
+ * Uncompresses an individual chunk from all levels of compression.
+ */
+int uncompress_chunk(ztr_chunk_t *chunk) {
+ char *new_data = NULL;
+ int new_len;
+
+ while (chunk->dlength > 0 && chunk->data[0] != ZTR_FORM_RAW) {
+ switch (chunk->data[0]) {
+ case ZTR_FORM_RLE:
+ new_data = unrle(chunk->data, chunk->dlength, &new_len);
+ break;
+
+ case ZTR_FORM_ZLIB:
+ new_data = zlib_dehuff(chunk->data, chunk->dlength, &new_len);
+ break;
+
+ case ZTR_FORM_DELTA1:
+ new_data = recorrelate1(chunk->data, chunk->dlength, &new_len);
+ break;
+
+ case ZTR_FORM_DELTA2:
+ new_data = recorrelate2(chunk->data, chunk->dlength, &new_len);
+ break;
+
+ case ZTR_FORM_DELTA4:
+ new_data = recorrelate4(chunk->data, chunk->dlength, &new_len);
+ break;
+
+ case ZTR_FORM_16TO8:
+ new_data = expand_8to16(chunk->data, chunk->dlength, &new_len);
+ break;
+
+ case ZTR_FORM_32TO8:
+ new_data = expand_8to32(chunk->data, chunk->dlength, &new_len);
+ break;
+
+ case ZTR_FORM_FOLLOW1:
+ new_data = unfollow1(chunk->data, chunk->dlength, &new_len);
+ break;
+
+ case ZTR_FORM_ICHEB:
+ new_data = ichebuncomp(chunk->data, chunk->dlength, &new_len);
+ break;
+
+ default:
+ return -1;
+ }
+
+ if (!new_data)
+ return -1;
+
+ /*
+ fprintf(stderr, "format %d => %d to %d\n",
+ chunk->data[0], chunk->dlength, new_len);
+ */
+ chunk->dlength = new_len;
+ xfree(chunk->data);
+ chunk->data = new_data;
+ }
+
+ return 0;
+}
+
+#if 0
+/*
+ * Shannon showed that for storage in base 'b' with alphabet symbols 'a' having
+ * a probability of ocurring in any context of 'Pa' we should encode
+ * symbol 'a' to have a storage width of -logb(Pa).
+ *
+ * Eg. b = 26, P(e) = .22. => width .4647277.
+ *
+ * We use this to calculate the entropy of a signal by summing over all letters
+ * in the signal. In this case, our storage has base 256.
+ */
+#define EBASE 256
+double entropy(unsigned char *data, int len) {
+ double E[EBASE];
+ double P[EBASE];
+ double e;
+ int i;
+
+ for (i = 0; i < EBASE; i++)
+ P[i] = 0;
+
+ for (i = 0; i < len; i++)
+ P[data[i]]++;
+
+ for (i = 0; i < EBASE; i++) {
+ if (P[i]) {
+ P[i] /= len;
+ E[i] = -(log(P[i])/log(EBASE));
+ } else {
+ E[i] = 0;
+ }
+ }
+
+ for (e = i = 0; i < len; i++)
+ e += E[data[i]];
+
+ return e;
+}
+#endif
+
+/*
+ * Compresses a ztr (in memory).
+ * Level is 0, 1, 2 or 3 (no compression, delta, delta + zlib,
+ * chebyshev + zlib).
+ */
+int compress_ztr(ztr_t *ztr, int level) {
+ int i;
+
+ if (0 == level)
+ return 0;
+
+ for (i = 0; i < ztr->nchunks; i++) {
+
+ /*
+ {
+ char str[5];
+ fprintf(stderr, "---- %.4s ---- level %d from %d to ",
+ ZTR_BE2STR(ztr->chunk[i].type,str),level);
+ }
+ */
+
+ switch(ztr->chunk[i].type) {
+ case ZTR_TYPE_SAMP:
+ case ZTR_TYPE_SMP4:
+ if (level <= 2) {
+ /*
+ * Experiments show that typically a double delta does
+ * better than a single delta for 8-bit data, and the other
+ * way around for 16-bit data
+ */
+ compress_chunk(&ztr->chunk[i], ZTR_FORM_DELTA2,
+ ztr->delta_level);
+ } else {
+ compress_chunk(&ztr->chunk[i], ZTR_FORM_ICHEB, 0);
+ }
+
+ compress_chunk(&ztr->chunk[i], ZTR_FORM_16TO8, 0);
+ if (level > 1) {
+ compress_chunk(&ztr->chunk[i], ZTR_FORM_FOLLOW1,0);
+ /*
+ compress_chunk(&ztr->chunk[i],
+ ZTR_FORM_ZLIB, Z_HUFFMAN_ONLY);
+ */
+ compress_chunk(&ztr->chunk[i], ZTR_FORM_RLE, 150);
+ compress_chunk(&ztr->chunk[i],
+ ZTR_FORM_ZLIB, Z_HUFFMAN_ONLY);
+ }
+
+ break;
+
+ case ZTR_TYPE_BASE:
+ if (level > 1) {
+ compress_chunk(&ztr->chunk[i],
+ ZTR_FORM_ZLIB, Z_HUFFMAN_ONLY);
+ }
+ break;
+
+ case ZTR_TYPE_CNF1:
+ case ZTR_TYPE_CNF4:
+ case ZTR_TYPE_CSID:
+ compress_chunk(&ztr->chunk[i], ZTR_FORM_DELTA1, 1);
+ compress_chunk(&ztr->chunk[i], ZTR_FORM_RLE, 77);
+ if (level > 1) {
+ compress_chunk(&ztr->chunk[i],
+ ZTR_FORM_ZLIB, Z_HUFFMAN_ONLY);
+ }
+ break;
+
+ case ZTR_TYPE_BPOS:
+ compress_chunk(&ztr->chunk[i], ZTR_FORM_DELTA4, 1);
+ compress_chunk(&ztr->chunk[i], ZTR_FORM_32TO8, 0);
+ if (level > 1) {
+ compress_chunk(&ztr->chunk[i],
+ ZTR_FORM_ZLIB, Z_HUFFMAN_ONLY);
+ }
+ break;
+
+ case ZTR_TYPE_TEXT:
+ if (level > 1) {
+ compress_chunk(&ztr->chunk[i],
+ ZTR_FORM_ZLIB, Z_HUFFMAN_ONLY);
+ }
+ break;
+ }
+
+ /*
+ fprintf(stderr, "Comp length %d\n", ztr->chunk[i].dlength);
+ */
+ }
+
+ return 0;
+}
+
+/*
+ * Uncompresses a ztr (in memory).
+ */
+int uncompress_ztr(ztr_t *ztr) {
+ int i;
+
+ for (i = 0; i < ztr->nchunks; i++) {
+ /*
+ {
+ char str[5];
+ fprintf(stderr, "---- %.4s ----\n",
+ ZTR_BE2STR(ztr->chunk[i].type,str));
+ }
+ */
+ uncompress_chunk(&ztr->chunk[i]);
+ }
+
+ return 0;
+}
diff --git a/src/Staden/read/ztr.h b/src/Staden/read/ztr.h
new file mode 100644
index 0000000..adbadc3
--- /dev/null
+++ b/src/Staden/read/ztr.h
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#ifndef _ZTR_H
+#define _ZTR_H
+
+#include "Read.h"
+
+/* The header */
+typedef struct {
+ unsigned char magic[8]; /* 0xae5a54520d0a1a0a (be) */
+ unsigned char version_major; /* ZTR_VERSION_MAJOR */
+ unsigned char version_minor; /* ZTR_VERSION_MINOR */
+} ztr_header_t;
+
+/* The ZTR magic numbers */
+#define ZTR_MAGIC "\256ZTR\r\n\032\n"
+#define ZTR_VERSION_MAJOR 1
+#define ZTR_VERSION_MINOR 2
+
+/*
+ * CHUNKS
+ *
+ * Chunks consist of a block length followed by the type, format and data.
+ */
+
+typedef struct {
+ uint4 type; /* chunk type (be) */
+ uint4 mdlength; /* length of meta data field (be) */
+ char *mdata; /* meta data */
+ uint4 dlength; /* length of data field (be) */
+ char *data; /* a format byte and the data itself */
+} ztr_chunk_t;
+
+/* Format types */
+#define ZTR_FORM_RAW 0
+#define ZTR_FORM_RLE 1
+#define ZTR_FORM_ZLIB 2
+#define ZTR_FORM_DELTA1 64
+#define ZTR_FORM_DELTA2 65
+#define ZTR_FORM_DELTA4 66
+#define ZTR_FORM_DDELTA1 67
+#define ZTR_FORM_DDELTA2 68
+#define ZTR_FORM_DDELTA4 69
+#define ZTR_FORM_16TO8 70
+#define ZTR_FORM_32TO8 71
+#define ZTR_FORM_FOLLOW1 72
+#define ZTR_FORM_CHEB445 73
+#define ZTR_FORM_ICHEB 74
+
+/* Converts a C string to a big-endian 4-byte int */
+#define ZTR_STR2BE(str) (((str)[0] << 24) + \
+ ((str)[1] << 16) + \
+ ((str)[2] << 8) + \
+ ((str)[3] << 0))
+
+/* Converts a big-endian 4-byte int to a C string */
+#define ZTR_BE2STR(i,str) (((str)[0]=((i)>>24)&0xff),\
+ ((str)[1]=((i)>>16)&0xff),\
+ ((str)[2]=((i)>> 8)&0xff),\
+ ((str)[3]=((i)>> 0)&0xff),\
+ (str)[4]='\0',str)\
+
+#define ZTR_TYPE_HEADER 0xae5a5452 /* M-. Z T R */
+
+#define ZTR_TYPE_SAMP 0x53414d50
+#define ZTR_TYPE_SMP4 0x534d5034
+#define ZTR_TYPE_BASE 0x42415345
+#define ZTR_TYPE_BPOS 0x42504f53
+#define ZTR_TYPE_CNF4 0x434e4634
+#define ZTR_TYPE_CNF1 0x434e4631
+#define ZTR_TYPE_CSID 0x43534944
+#define ZTR_TYPE_TEXT 0x54455854
+#define ZTR_TYPE_CLIP 0x434c4950
+#define ZTR_TYPE_COMM 0x434f4d4d
+#define ZTR_TYPE_CR32 0x43523332
+
+/* A text segment consists of identifier and value */
+typedef struct {
+ char *ident; /* Pointer to identifier */
+ char *value; /* Pointer to value */
+} ztr_text_t;
+
+/* The main ZTR structure, which holds the entire file contents */
+typedef struct {
+ /* General bits to do with the ZTR file format */
+ ztr_header_t header; /* File Header */
+ ztr_chunk_t *chunk; /* Array of chunks */
+ int nchunks; /* Number of chunks */
+
+ /* Specifics to do with the standard chunk types */
+ ztr_text_t *text_segments;
+ int ntext_segments;
+
+ /* 'Hint' for delta of SAMP and SMP4 */
+ int delta_level;
+} ztr_t;
+
+int fwrite_ztr(FILE *fp, ztr_t *ztr);
+ztr_t *fread_ztr(FILE *fp);
+Read *ztr2read(ztr_t *ztr);
+ztr_t *read2ztr(Read *r);
+int compress_ztr(ztr_t *ztr, int level);
+int uncompress_ztr(ztr_t *ztr);
+ztr_t *new_ztr(void);
+void delete_ztr(ztr_t *ztr);
+ztr_chunk_t **ztr_find_chunks(ztr_t *ztr, uint4 type, int *nchunks_p);
+void ztr_process_text(ztr_t *ztr);
+
+#endif /* _ZTR_H */
diff --git a/src/Staden/read/ztr_translate.c b/src/Staden/read/ztr_translate.c
new file mode 100644
index 0000000..1a1fca2
--- /dev/null
+++ b/src/Staden/read/ztr_translate.c
@@ -0,0 +1,890 @@
+/*
+ * Copyright (c) Medical Research Council 1994. All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * this copyright and notice appears in all copies.
+ *
+ * This file was written by James Bonfield, Simon Dear, Rodger Staden,
+ * as part of the Staden Package at the MRC Laboratory of Molecular
+ * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
+ *
+ * MRC disclaims all warranties with regard to this software.
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "xalloc.h"
+#include "Read.h"
+#include "ztr.h"
+
+/* Return the A,C,G,T samples */
+char *ztr_encode_samples_4(Read *r, int *nbytes, char **mdata, int *mdbytes) {
+ char *bytes;
+ int i, j, t;
+
+ if (!r->NPoints)
+ return NULL;
+
+ *mdata = NULL;
+ *mdbytes = 0;
+
+ bytes = (char *)xmalloc(r->NPoints * sizeof(TRACE)*4 + 2);
+ for (i = 0, j = 2; i < r->NPoints; i++) {
+ t = r->traceA[i];
+ bytes[j++] = (t >> 8) & 0xff;
+ bytes[j++] = (t >> 0) & 0xff;
+ }
+ for (i = 0; i < r->NPoints; i++) {
+ t = r->traceC[i];
+ bytes[j++] = (t >> 8) & 0xff;
+ bytes[j++] = (t >> 0) & 0xff;
+ }
+ for (i = 0; i < r->NPoints; i++) {
+ t = r->traceG[i];
+ bytes[j++] = (t >> 8) & 0xff;
+ bytes[j++] = (t >> 0) & 0xff;
+ }
+ for (i = 0; i < r->NPoints; i++) {
+ t = r->traceT[i];
+ bytes[j++] = (t >> 8) & 0xff;
+ bytes[j++] = (t >> 0) & 0xff;
+ }
+ *nbytes = 4 * r->NPoints * sizeof(TRACE) + 2;
+
+ bytes[0] = ZTR_FORM_RAW;
+ bytes[1] = 0;
+ return bytes;
+}
+
+void ztr_decode_samples_4(Read *r, char *s_bytes, int nbytes) {
+ int i, j;
+ int maxTraceVal = 0;
+ TRACE sample;
+ unsigned char *bytes = (unsigned char *)s_bytes;
+
+ bytes+=2;
+ nbytes-=2;
+
+ /* Store in the Read structure */
+ r->NPoints = nbytes/8;
+ if (r->traceA) xfree(r->traceA);
+ if (r->traceC) xfree(r->traceC);
+ if (r->traceG) xfree(r->traceG);
+ if (r->traceT) xfree(r->traceT);
+ r->traceA = (TRACE *)xmalloc(r->NPoints * sizeof(TRACE));
+ r->traceC = (TRACE *)xmalloc(r->NPoints * sizeof(TRACE));
+ r->traceG = (TRACE *)xmalloc(r->NPoints * sizeof(TRACE));
+ r->traceT = (TRACE *)xmalloc(r->NPoints * sizeof(TRACE));
+
+ for (i = j = 0; i < r->NPoints; i++, j+=2) {
+ sample = (bytes[j] << 8) | bytes[j+1];
+ r->traceA[i] = sample;
+ if (maxTraceVal < sample)
+ maxTraceVal = sample;
+ }
+ for (i = 0; i < r->NPoints; i++, j+=2) {
+ sample = (bytes[j] << 8) | bytes[j+1];
+ r->traceC[i] = sample;
+ if (maxTraceVal < sample)
+ maxTraceVal = sample;
+ }
+ for (i = 0; i < r->NPoints; i++, j+=2) {
+ sample = (bytes[j] << 8) | bytes[j+1];
+ r->traceG[i] = sample;
+ if (maxTraceVal < sample)
+ maxTraceVal = sample;
+ }
+ for (i = 0; i < r->NPoints; i++, j+=2) {
+ sample = (bytes[j] << 8) | bytes[j+1];
+ r->traceT[i] = sample;
+ if (maxTraceVal < sample)
+ maxTraceVal = sample;
+ }
+
+ r->maxTraceVal = maxTraceVal;
+}
+
+/* Return the [A,C,G,T] samples */
+char *ztr_encode_samples_common(char ident[4], Read *r, TRACE *data,
+ int *nbytes, char **mdata, int *mdbytes) {
+ char *bytes;
+ int i, j, t;
+
+ if (!r->NPoints)
+ return NULL;
+
+ *mdata = (char *)malloc(4);
+ *mdbytes = 4;
+ (*mdata)[0] = ident[0];
+ (*mdata)[1] = ident[1];
+ (*mdata)[2] = ident[2];
+ (*mdata)[3] = ident[3];
+
+ bytes = (char *)xmalloc(r->NPoints * sizeof(TRACE) + 2);
+ for (i = 0, j = 2; i < r->NPoints; i++) {
+ t = data[i];
+ bytes[j++] = (t >> 8) & 0xff;
+ bytes[j++] = (t >> 0) & 0xff;
+ }
+ *nbytes = r->NPoints * sizeof(TRACE) + 2;
+
+ bytes[0] = ZTR_FORM_RAW;
+ bytes[1] = 0;
+ return bytes;
+}
+
+char *ztr_encode_samples_A(Read *r, int *nbytes, char **mdata, int *mdbytes) {
+ return ztr_encode_samples_common("A\0\0", r, r->traceA,
+ nbytes, mdata, mdbytes);
+}
+
+char *ztr_encode_samples_C(Read *r, int *nbytes, char **mdata, int *mdbytes) {
+ return ztr_encode_samples_common("C\0\0", r, r->traceC,
+ nbytes, mdata, mdbytes);
+}
+
+char *ztr_encode_samples_G(Read *r, int *nbytes, char **mdata, int *mdbytes) {
+ return ztr_encode_samples_common("G\0\0", r, r->traceG,
+ nbytes, mdata, mdbytes);
+}
+
+char *ztr_encode_samples_T(Read *r, int *nbytes, char **mdata, int *mdbytes) {
+ return ztr_encode_samples_common("T\0\0", r, r->traceT,
+ nbytes, mdata, mdbytes);
+}
+
+void ztr_decode_samples(Read *r,
+ char *mdata, int mdlen,
+ char *data, int dlen) {
+ int i, j;
+ int maxTraceVal = 0;
+ TRACE sample;
+ unsigned char *bytes = (unsigned char *)data;
+ TRACE **lane, *lanex;
+
+ if (!mdata)
+ return;
+
+ switch(mdata[0]) {
+ case 'A':
+ lane = &r->traceA;
+ break;
+ case 'C':
+ lane = &r->traceC;
+ break;
+ case 'G':
+ lane = &r->traceG;
+ break;
+ case 'T':
+ lane = &r->traceT;
+ break;
+ default:
+ return;
+ }
+
+ bytes+=2;
+ dlen-=2;
+
+ /* Store in the Read structure */
+ r->NPoints = dlen/2;
+ if (*lane)
+ xfree(*lane);
+ lanex = *lane = (TRACE *)xmalloc(r->NPoints * sizeof(TRACE));
+
+ for (i = j = 0; i < r->NPoints; i++, j+=2) {
+ sample = (bytes[j] << 8) | bytes[j+1];
+ lanex[i] = sample;
+ if (maxTraceVal < sample)
+ maxTraceVal = sample;
+ }
+
+ if (r->maxTraceVal < maxTraceVal)
+ r->maxTraceVal = maxTraceVal;
+}
+
+/* Encode the the base calls */
+char *ztr_encode_bases(Read *r, int *nbytes, char **mdata, int *mdbytes) {
+ char *bytes;
+
+ if (!r->NBases)
+ return NULL;
+
+ *mdata = NULL;
+ *mdbytes = 0;
+
+ bytes = (char *)xmalloc(r->NBases + 1);
+ memcpy(bytes+1, r->base, r->NBases);
+ *nbytes = r->NBases+1;
+
+ bytes[0] = ZTR_FORM_RAW;
+ return bytes;
+}
+
+void ztr_decode_bases(Read *r, char *bytes, int nbytes) {
+ nbytes--;
+ bytes++;
+
+ r->NBases = nbytes;
+ if (r->base) xfree(r->base);
+ r->base = (char *)xmalloc(r->NBases+1);
+ memcpy(r->base, bytes, r->NBases);
+ r->base[r->NBases] = 0;
+
+ /* Incase there isn't a clip chunk */
+ r->leftCutoff = 0;
+ r->rightCutoff = r->NBases+1;
+}
+
+/* Encode the base positions as 4 byte values */
+char *ztr_encode_positions(Read *r, int *nbytes, char **mdata, int *mdbytes) {
+ char *bytes;
+ int i, j;
+
+ if (!r->NPoints || !r->basePos || !r->NBases)
+ return NULL;
+
+ *mdata = NULL;
+ *mdbytes = 0;
+
+ bytes = (char *)xmalloc(r->NBases * 4 + 4);
+ for (j = 4, i = 0; i < r->NBases; i++) {
+ bytes[j++] = (r->basePos[i] >> 24) & 0xff;
+ bytes[j++] = (r->basePos[i] >> 16) & 0xff;
+ bytes[j++] = (r->basePos[i] >> 8) & 0xff;
+ bytes[j++] = (r->basePos[i] >> 0) & 0xff;
+ }
+
+ bytes[0] = ZTR_FORM_RAW;
+ bytes[1] = 0; /* Dummy */
+ bytes[2] = 0; /* Dummy */
+ bytes[3] = 0; /* Dummy */
+
+ *nbytes = j;
+ return (char *)bytes;
+}
+
+void ztr_decode_positions(Read *r, char *s_bytes, int nbytes) {
+ int i, j;
+ unsigned char *bytes = (unsigned char *)s_bytes;
+
+ bytes+=4;
+ nbytes-=4;
+
+ r->NBases = nbytes/4;
+ if (r->basePos) xfree(r->basePos);
+ r->basePos = (uint_2 *)xmalloc(r->NBases * sizeof(*r->basePos));
+
+ for (i = j = 0; j < nbytes; i++, j += 4) {
+ r->basePos[i] =
+ (bytes[j+0] << 24) +
+ (bytes[j+1] << 16) +
+ (bytes[j+2] << 8) +
+ (bytes[j+3] << 0);
+ }
+}
+
+/* Encode the main base confidence (called base) */
+char *ztr_encode_confidence_1(Read *r, int *nbytes, char **mdata, int *mdbytes)
+{
+ char *bytes;
+ int i;
+
+ /* Check that we have any confidence values first */
+ if (!r->prob_A || !r->prob_C || !r->prob_G || !r->prob_T)
+ return NULL;
+
+ *mdata = NULL;
+ *mdbytes = 0;
+
+ /* Check that they're not all zero - will "normally" be quick */
+ for (i = 0; i < r->NBases; i++) {
+ if (r->prob_A[i]) break;
+ if (r->prob_C[i]) break;
+ if (r->prob_G[i]) break;
+ if (r->prob_T[i]) break;
+ }
+ if (i == r->NBases)
+ return NULL;
+
+ /* Memory allocation */
+ if (NULL == (bytes = xmalloc(r->NBases * sizeof(*bytes) + 1)))
+ return NULL;
+
+ /*
+ * Encode probs for called bases.
+ * Unknown base => average of prob_A, prob_C, prob_G and prob_T.
+ */
+ bytes++;
+ for (i = 0; i < r->NBases; i++) {
+ switch (r->base[i]) {
+ case 'A':
+ case 'a':
+ bytes[i] = r->prob_A[i];
+ break;
+ case 'C':
+ case 'c':
+ bytes[i] = r->prob_C[i];
+ break;
+ case 'G':
+ case 'g':
+ bytes[i] = r->prob_G[i];
+ break;
+ case 'T':
+ case 't':
+ bytes[i] = r->prob_T[i];
+ break;
+ default:
+ bytes[i] = (r->prob_A[i] + r->prob_C[i] +
+ r->prob_G[i] + r->prob_T[i]) / 4;
+ break;
+ }
+ }
+ bytes--;
+
+ *nbytes = r->NBases + 1;
+
+ bytes[0] = ZTR_FORM_RAW;
+ return bytes;
+}
+
+int ztr_decode_confidence_1(Read *r, char *bytes, int nbytes) {
+ int i;
+
+ bytes++;
+ nbytes--;
+
+ /* Unpack confidence values; depends on base calls */
+ if (!r->base)
+ return -1;
+
+ if (r->prob_A) xfree(r->prob_A);
+ if (r->prob_C) xfree(r->prob_C);
+ if (r->prob_G) xfree(r->prob_G);
+ if (r->prob_T) xfree(r->prob_T);
+ r->prob_A = (char *)xmalloc(r->NBases * sizeof(*r->prob_A));
+ r->prob_C = (char *)xmalloc(r->NBases * sizeof(*r->prob_C));
+ r->prob_G = (char *)xmalloc(r->NBases * sizeof(*r->prob_G));
+ r->prob_T = (char *)xmalloc(r->NBases * sizeof(*r->prob_T));
+
+ for (i = 0; i < r->NBases; i++) {
+ switch (r->base[i]) {
+ case 'A':
+ case 'a':
+ r->prob_A[i] = bytes[i];
+ r->prob_C[i] = 0;
+ r->prob_G[i] = 0;
+ r->prob_T[i] = 0;
+ break;
+ case 'C':
+ case 'c':
+ r->prob_A[i] = 0;
+ r->prob_C[i] = bytes[i];
+ r->prob_G[i] = 0;
+ r->prob_T[i] = 0;
+ break;
+ case 'G':
+ case 'g':
+ r->prob_A[i] = 0;
+ r->prob_C[i] = 0;
+ r->prob_G[i] = bytes[i];
+ r->prob_T[i] = 0;
+ break;
+ case 'T':
+ case 't':
+ r->prob_A[i] = 0;
+ r->prob_C[i] = 0;
+ r->prob_G[i] = 0;
+ r->prob_T[i] = bytes[i];
+ break;
+ default:
+ r->prob_A[i] = bytes[i];
+ r->prob_C[i] = bytes[i];
+ r->prob_G[i] = bytes[i];
+ r->prob_T[i] = bytes[i];
+ }
+ }
+
+ return 0;
+}
+
+/* Encode the four main base confidences */
+char *ztr_encode_confidence_4(Read *r, int *nbytes, char **mdata, int *mdbytes)
+{
+ char *bytes;
+ int i, j;
+
+ /* Check that we have any confidence values first */
+ if (!r->prob_A || !r->prob_C || !r->prob_G || !r->prob_T)
+ return NULL;
+
+ *mdata = NULL;
+ *mdbytes = 0;
+
+ /* Check that they're not all zero - will "normally" be quick */
+ for (i = 0; i < r->NBases; i++) {
+ if (r->prob_A[i]) break;
+ if (r->prob_C[i]) break;
+ if (r->prob_G[i]) break;
+ if (r->prob_T[i]) break;
+ }
+ if (i == r->NBases)
+ return NULL;
+
+ /* Memory allocation */
+ if (NULL == (bytes = xmalloc(4 * r->NBases * sizeof(*bytes) + 1)))
+ return NULL;
+
+ /*
+ * Encode probs for called bases first
+ * Unknown base = 'T'.
+ */
+ j = r->NBases;
+ bytes++;
+ for (i = 0; i < r->NBases; i++) {
+ switch (r->base[i]) {
+ case 'A':
+ case 'a':
+ bytes[i ] = r->prob_A[i];
+ bytes[j++] = r->prob_C[i];
+ bytes[j++] = r->prob_G[i];
+ bytes[j++] = r->prob_T[i];
+ break;
+ case 'C':
+ case 'c':
+ bytes[j++] = r->prob_A[i];
+ bytes[i ] = r->prob_C[i];
+ bytes[j++] = r->prob_G[i];
+ bytes[j++] = r->prob_T[i];
+ break;
+ case 'G':
+ case 'g':
+ bytes[j++] = r->prob_A[i];
+ bytes[j++] = r->prob_C[i];
+ bytes[i ] = r->prob_G[i];
+ bytes[j++] = r->prob_T[i];
+ break;
+ default:
+ bytes[j++] = r->prob_A[i];
+ bytes[j++] = r->prob_C[i];
+ bytes[j++] = r->prob_G[i];
+ bytes[i ] = r->prob_T[i];
+ break;
+ }
+ }
+ bytes--;
+
+ *nbytes = r->NBases * 4 + 1;
+
+ bytes[0] = ZTR_FORM_RAW;
+ return bytes;
+}
+
+int ztr_decode_confidence_4(Read *r, char *bytes, int nbytes) {
+ int i, j;
+
+ bytes++;
+ nbytes--;
+
+ /* Unpack confidence values; depends on base calls */
+ if (!r->base)
+ return -1;
+
+ if (r->prob_A) xfree(r->prob_A);
+ if (r->prob_C) xfree(r->prob_C);
+ if (r->prob_G) xfree(r->prob_G);
+ if (r->prob_T) xfree(r->prob_T);
+ r->prob_A = (char *)xmalloc(r->NBases * sizeof(*r->prob_A));
+ r->prob_C = (char *)xmalloc(r->NBases * sizeof(*r->prob_C));
+ r->prob_G = (char *)xmalloc(r->NBases * sizeof(*r->prob_G));
+ r->prob_T = (char *)xmalloc(r->NBases * sizeof(*r->prob_T));
+
+ j = r->NBases;
+ for (i = 0; i < r->NBases; i++) {
+ switch (r->base[i]) {
+ case 'A':
+ case 'a':
+ r->prob_A[i] = bytes[i];
+ r->prob_C[i] = bytes[j++];
+ r->prob_G[i] = bytes[j++];
+ r->prob_T[i] = bytes[j++];
+ break;
+ case 'C':
+ case 'c':
+ r->prob_A[i] = bytes[j++];
+ r->prob_C[i] = bytes[i];
+ r->prob_G[i] = bytes[j++];
+ r->prob_T[i] = bytes[j++];
+ break;
+ case 'G':
+ case 'g':
+ r->prob_A[i] = bytes[j++];
+ r->prob_C[i] = bytes[j++];
+ r->prob_G[i] = bytes[i];
+ r->prob_T[i] = bytes[j++];
+ break;
+ default:
+ r->prob_A[i] = bytes[j++];
+ r->prob_C[i] = bytes[j++];
+ r->prob_G[i] = bytes[j++];
+ r->prob_T[i] = bytes[i];
+ break;
+ }
+ }
+
+ return 0;
+}
+
+/* Encode the textual comments */
+char *ztr_encode_text(Read *r, int *nbytes, char **mdata, int *mdbytes) {
+ char *bytes;
+ int len, alen;
+ int ident;
+ int i, j;
+
+ if (!r->info)
+ return NULL;
+
+ *mdata = NULL;
+ *mdbytes = 0;
+
+ /*
+ * traditional Read comments are a single char * of ident=value lines.
+ * The length of ident=valueXident=valueX (X = newline) if the same
+ * as ident0value0ident0value0 (0 = \0), although ztr has
+ * a double \0 as terminator.
+ */
+ len = strlen(r->info);
+
+ /* Allocate */
+ alen = len + 3;
+ bytes = xmalloc(alen);
+
+ /* Copy */
+ j = 0;
+ bytes[j++] = ZTR_FORM_RAW;
+ ident = 1;
+ for (i = 0; i < len; i++) {
+ switch (r->info[i]) {
+ case '=':
+ if (ident) {
+ ident = 0;
+ bytes[j++] = 0;
+ } else {
+ bytes[j++] = '=';
+ }
+ break;
+
+ case '\n':
+ if (ident) {
+ /* Invalid Read info, but we'll carry on anyway. */
+ if (j && bytes[j-1] != 0)
+ bytes[j++] = 0;
+ else
+ break;
+ }
+ bytes[j++] = 0;
+ ident = 1;
+ break;
+
+ default:
+ bytes[j++] = r->info[i];
+ }
+
+ if (j + 3 > alen) {
+ /* This can happen if we have Read idents without values */
+ alen += 100;
+ bytes = xrealloc(bytes, alen);
+ }
+ }
+ if (j && bytes[j-1] != 0)
+ bytes[j++] = 0; /* Must end in two nuls */
+ bytes[j++] = 0;
+ *nbytes = j;
+
+ return bytes;
+}
+
+void ztr_decode_text(Read *r, ztr_t *ztr) {
+ int i;
+ int nbytes = 0;
+ char *iptr;
+
+ /* Find length */
+ for (i = 0; i < ztr->ntext_segments; i++) {
+ if (ztr->text_segments[i].ident)
+ nbytes += strlen(ztr->text_segments[i].ident);
+ if (ztr->text_segments[i].value)
+ nbytes += strlen(ztr->text_segments[i].value);
+ nbytes += 2;
+ }
+
+ /* Allocate */
+ if (r->info) xfree(r->info);
+ r->info = (char *)xmalloc(nbytes+1);
+
+ /* Convert */
+ iptr = r->info;
+ for (i = 0; i < ztr->ntext_segments; i++) {
+ if (ztr->text_segments[i].ident && ztr->text_segments[i].value) {
+ int added = sprintf(iptr, "%s=%s\n",
+ ztr->text_segments[i].ident,
+ ztr->text_segments[i].value);
+ iptr += added;
+ }
+ }
+ *iptr = 0;
+
+}
+
+/* Encode the clip points */
+char *ztr_encode_clips(Read *r, int *nbytes, char **mdata, int *mdbytes) {
+ char *bytes;
+
+ if (!r->NBases)
+ return NULL;
+
+ if (r->leftCutoff == 0 && r->rightCutoff > r->NBases)
+ return NULL;
+
+ *mdata = NULL;
+ *mdbytes = 0;
+
+ /* Allocate */
+ *nbytes = 9;
+ bytes = xmalloc(9);
+
+ /* Store */
+ bytes[1] = (r->leftCutoff >> 24) & 0xff;
+ bytes[2] = (r->leftCutoff >> 16) & 0xff;
+ bytes[3] = (r->leftCutoff >> 8) & 0xff;
+ bytes[4] = (r->leftCutoff >> 0) & 0xff;
+ bytes[5] = (r->rightCutoff >> 24) & 0xff;
+ bytes[6] = (r->rightCutoff >> 16) & 0xff;
+ bytes[7] = (r->rightCutoff >> 8) & 0xff;
+ bytes[8] = (r->rightCutoff >> 0) & 0xff;
+
+ bytes[0] = ZTR_FORM_RAW;
+ return bytes;
+}
+
+void ztr_decode_clips(Read *r, char *bytes, int nbytes) {
+ r->leftCutoff =
+ (((unsigned char)bytes[1]) << 24) +
+ (((unsigned char)bytes[2]) << 16) +
+ (((unsigned char)bytes[3]) << 8) +
+ (((unsigned char)bytes[4]) << 0);
+
+ r->rightCutoff =
+ (((unsigned char)bytes[5]) << 24) +
+ (((unsigned char)bytes[6]) << 16) +
+ (((unsigned char)bytes[7]) << 8) +
+ (((unsigned char)bytes[8]) << 0);
+}
+
+/*
+ * read2ztr
+ *
+ * Converts an io_lib "Read" structure to a ztr_t structure.
+ *
+ * Arguments:
+ * r A pointer to the "Read" structure to convert from
+ *
+ * Returns:
+ * Success: A pointer to the ztr_t struct.
+ * Failure: NULL
+ */
+ztr_t *read2ztr(Read *r) {
+ ztr_t *ztr;
+ int i, j, nbytes, mdbytes;
+ char *bytes;
+ char *mdata;
+
+#define DO_SMP4
+ int chunk_type[] = {
+#ifdef DO_SMP4
+ ZTR_TYPE_SMP4,
+#else
+ ZTR_TYPE_SAMP,
+ ZTR_TYPE_SAMP,
+ ZTR_TYPE_SAMP,
+ ZTR_TYPE_SAMP,
+#endif
+ ZTR_TYPE_BASE,
+ ZTR_TYPE_BPOS,
+ ZTR_TYPE_CNF4,
+ ZTR_TYPE_TEXT,
+ ZTR_TYPE_CLIP
+ };
+
+ char *(*chunk_func[])(Read *r, int *nbytes, char **mdata, int *mdbytes) = {
+#ifdef DO_SMP4
+ ztr_encode_samples_4,
+#else
+ ztr_encode_samples_A,
+ ztr_encode_samples_C,
+ ztr_encode_samples_G,
+ ztr_encode_samples_T,
+#endif
+ ztr_encode_bases,
+ ztr_encode_positions,
+ ztr_encode_confidence_4,
+ ztr_encode_text,
+ ztr_encode_clips
+ };
+
+ if (NULL == (ztr = new_ztr()))
+ return NULL;
+
+ /* Create a header record */
+ memcpy(ztr->header.magic, ZTR_MAGIC, 8);
+ ztr->header.version_major = ZTR_VERSION_MAJOR;
+ ztr->header.version_minor = ZTR_VERSION_MINOR;
+
+ /* Alloc chunks */
+ ztr->nchunks = sizeof(chunk_type)/sizeof(*chunk_type);
+ ztr->chunk = (ztr_chunk_t *)xmalloc(ztr->nchunks *
+ sizeof(ztr_chunk_t));
+ if (NULL == ztr->chunk)
+ return NULL;
+
+ /* Create the chunks */
+ for (j = i = 0; i < ztr->nchunks; i++) {
+ /* char str[5]; */
+
+ bytes = chunk_func[i](r, &nbytes, &mdata, &mdbytes);
+ if (!bytes)
+ continue;
+
+ /*
+ fprintf(stderr, "block %.4s length %d\n",
+ ZTR_BE2STR(chunk_type[i], str), nbytes);
+ */
+ ztr->chunk[j].type = chunk_type[i];
+ ztr->chunk[j].mdlength = mdbytes;
+ ztr->chunk[j].mdata = mdata;
+ ztr->chunk[j].dlength = nbytes;
+ ztr->chunk[j].data = bytes;
+
+ j++;
+ }
+ ztr->nchunks = j;
+
+ /*
+ * Experiments show that typically a double delta does
+ * better than a single delta for 8-bit data, and the other
+ * way around for 16-bit data
+ */
+ ztr->delta_level = r->maxTraceVal < 256 ? 2 : 3;
+
+ return ztr;
+}
+
+/*
+ * ztr2read
+ *
+ * Converts an ztr_t structure to an io_lib "Read" structure.
+ *
+ * Arguments:
+ * ztr A pointer to the ztr structure to convert from
+ *
+ * Returns:
+ * Success: A pointer to the Read struct.
+ * Failure: NULL
+ */
+Read *ztr2read(ztr_t *ztr) {
+ Read *r;
+ int i;
+ int done_conf = 0;
+ int nbases = 0;
+ int npoints = 0;
+ /* Allocate */
+ r = read_allocate(0, 0);
+
+ if (NULLRead == r)
+ return NULLRead;
+
+ /* Proces text chunks - makes conversion easier */
+ ztr_process_text(ztr);
+ ztr_decode_text(r, ztr);
+
+ /* Iterate around each known chunk type turning into the Read elements */
+ for (i = 0; i < ztr->nchunks; i++) {
+ int dlen = ztr->chunk[i].dlength;
+ char *data = ztr->chunk[i].data;
+ int mdlen = ztr->chunk[i].dlength;
+ char *mdata = ztr->chunk[i].mdata;
+
+ switch (ztr->chunk[i].type) {
+ case ZTR_TYPE_SMP4:
+ ztr_decode_samples_4(r, data, dlen);
+ npoints = dlen;
+ break;
+
+ case ZTR_TYPE_SAMP:
+ ztr_decode_samples(r, mdata, mdlen, data, dlen);
+ npoints = dlen;
+ break;
+
+ case ZTR_TYPE_BASE:
+ ztr_decode_bases(r, data, dlen);
+ nbases = dlen;
+ break;
+
+ case ZTR_TYPE_BPOS:
+ ztr_decode_positions(r, data, dlen);
+ break;
+
+ case ZTR_TYPE_CNF4:
+ ztr_decode_confidence_4(r, data, dlen);
+ done_conf++;
+ break;
+
+ case ZTR_TYPE_CNF1:
+ ztr_decode_confidence_1(r, data, dlen);
+ done_conf++;
+ break;
+
+ case ZTR_TYPE_TEXT:
+ /* Skip - already did this; see ztr_process_text */
+ break;
+
+ case ZTR_TYPE_CLIP:
+ ztr_decode_clips(r, data, dlen);
+ break;
+ }
+ }
+
+ /* Handle the case when we have no confidence values */
+ if (!done_conf && r->NBases > 0) {
+ r->prob_A = (char *)xrealloc(r->prob_A, r->NBases);
+ r->prob_C = (char *)xrealloc(r->prob_C, r->NBases);
+ r->prob_G = (char *)xrealloc(r->prob_G, r->NBases);
+ r->prob_T = (char *)xrealloc(r->prob_T, r->NBases);
+ memset(r->prob_A, 0, r->NBases);
+ memset(r->prob_C, 0, r->NBases);
+ memset(r->prob_G, 0, r->NBases);
+ memset(r->prob_T, 0, r->NBases);
+ }
+
+ if(!r->info || !strstr(r->info,"NPTS=")){ // SAK
+ char line[1024]="", comment[1024] = "";
+ int comment_len = 0;
+ if(npoints > 0 && nbases > 0){
+ // Add the number of chromatogram points
+ sprintf(line, "NPTS=%d\n", npoints);
+ strcat(comment, line);
+ // Add the number of called bases
+ sprintf(line, "NBAS=%d\n", nbases);
+ strcat(comment, line);
+ comment_len = strlen(r->info) + strlen(comment) + 2;
+ r->info = xrealloc(r->info, comment_len);
+ strcat(r->info, comment);
+ }
+ }
+
+ r->format = TT_ZTR;
+
+ return r;
+}
diff --git a/src/Tigger/Contig.hh b/src/Tigger/Contig.hh
new file mode 100644
index 0000000..d2f409e
--- /dev/null
+++ b/src/Tigger/Contig.hh
@@ -0,0 +1,31 @@
+#ifndef CONTIG_HH
+#define CONTIG_HH 1
+
+#include "SubGraph.hh"
+
+/**
+ * The <b>Contig</b> class
+ *
+ *
+ * <p>Copyright © 2004, The Institute for Genomic Research (TIGR).
+ * <br>All rights reserved.
+ *
+ * @author Dan Sommer
+ *
+ * <pre>
+ * $RCSfile$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * </pre>
+ */
+class Contig {
+
+public:
+
+ SubGraph* sg;
+ int start_node;
+
+};
+
+#endif // #ifndef CONTIG_HH
diff --git a/src/Tigger/Makefile.am b/src/Tigger/Makefile.am
new file mode 100644
index 0000000..7b23c32
--- /dev/null
+++ b/src/Tigger/Makefile.am
@@ -0,0 +1,29 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+##-- TO BE INSTALLED
+bin_PROGRAMS = tigger
+
+##-- TO BE TESTED
+check_PROGRAMS = iotest
+
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = -I$(top_srcdir)/src/AMOS -I$(top_srcdir)/src/Graph
+
+
+##-- tigger
+tigger_LDADD = \
+ $(top_builddir)/src/Graph/libGraph.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+tigger_SOURCES = Unitigger.cc Unitigger.hh Overlap.hh Read.hh TiggerIO.cc Contig.hh
+
+##-- test
+iotest_LDADD = \
+ $(top_builddir)/src/Graph/libGraph.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+iotest_SOURCES = Unitigger.cc Unitigger.hh Overlap.hh Read.hh TiggerIO.cc Contig.hh
+
+
+##-- END OF MAKEFILE --##
diff --git a/src/Tigger/Makefile.in b/src/Tigger/Makefile.in
new file mode 100644
index 0000000..fb0cbb9
--- /dev/null
+++ b/src/Tigger/Makefile.in
@@ -0,0 +1,585 @@
+# 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 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@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = tigger$(EXEEXT)
+check_PROGRAMS = iotest$(EXEEXT)
+subdir = src/Tigger
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_iotest_OBJECTS = Unitigger.$(OBJEXT) TiggerIO.$(OBJEXT)
+iotest_OBJECTS = $(am_iotest_OBJECTS)
+iotest_DEPENDENCIES = $(top_builddir)/src/Graph/libGraph.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_tigger_OBJECTS = Unitigger.$(OBJEXT) TiggerIO.$(OBJEXT)
+tigger_OBJECTS = $(am_tigger_OBJECTS)
+tigger_DEPENDENCIES = $(top_builddir)/src/Graph/libGraph.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(iotest_SOURCES) $(tigger_SOURCES)
+DIST_SOURCES = $(iotest_SOURCES) $(tigger_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = -I$(top_srcdir)/src/AMOS -I$(top_srcdir)/src/Graph
+tigger_LDADD = \
+ $(top_builddir)/src/Graph/libGraph.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+tigger_SOURCES = Unitigger.cc Unitigger.hh Overlap.hh Read.hh TiggerIO.cc Contig.hh
+iotest_LDADD = \
+ $(top_builddir)/src/Graph/libGraph.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+iotest_SOURCES = Unitigger.cc Unitigger.hh Overlap.hh Read.hh TiggerIO.cc Contig.hh
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Tigger/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Tigger/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):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+clean-checkPROGRAMS:
+ -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+iotest$(EXEEXT): $(iotest_OBJECTS) $(iotest_DEPENDENCIES)
+ @rm -f iotest$(EXEEXT)
+ $(CXXLINK) $(iotest_OBJECTS) $(iotest_LDADD) $(LIBS)
+tigger$(EXEEXT): $(tigger_OBJECTS) $(tigger_DEPENDENCIES)
+ @rm -f tigger$(EXEEXT)
+ $(CXXLINK) $(tigger_OBJECTS) $(tigger_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TiggerIO.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Unitigger.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+
+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
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ 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-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: check-am install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-checkPROGRAMS clean-generic ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS 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-compile mostlyclean-generic pdf pdf-am \
+ ps ps-am tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Tigger/Overlap.hh b/src/Tigger/Overlap.hh
new file mode 100644
index 0000000..3a92795
--- /dev/null
+++ b/src/Tigger/Overlap.hh
@@ -0,0 +1,62 @@
+#ifndef Overlap_HH
+#define Overlap_HH 1
+
+#include <iostream>
+
+/**
+ * The <b>Overlap</b> class
+ *
+ *
+ * <p>Copyright © 2004, The Institute for Genomic Research (TIGR).
+ * <br>All rights reserved.
+ *
+ * @author Dan Sommer
+ *
+ * <pre>
+ * $RCSfile$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * </pre>
+ */
+class Overlap {
+
+public:
+
+ int ridA; // A
+ int ridB; // B
+ bool asuffix;
+ bool bsuffix;
+ char ori; // I or N
+ char type; // C, R, P, or S
+ int ahang, bhang;
+
+ void flip() {
+ bool tsuffix = asuffix;
+ int ridT = ridA;
+
+ ridA = ridB;
+ asuffix = bsuffix;
+
+ ridB = ridT;
+ bsuffix = tsuffix;
+
+ if((type == 'C') && (ori == 'I')) {
+ int thang = ahang;
+ ahang = bhang;
+ bhang = thang;
+ } else {
+ bhang = -bhang;
+ ahang = -ahang;
+ }
+ }
+
+ void print() {
+ std::cout << " read A " << ridA << " overlaps B " << ridB << " ori " << ori << std::endl;
+ std::cout << " type " << type << " ahang " << ahang << " bhang " << bhang << std::endl;
+ }
+
+
+};
+
+#endif // #ifndef Overlap_HH
diff --git a/src/Tigger/Read.hh b/src/Tigger/Read.hh
new file mode 100644
index 0000000..3afb8a6
--- /dev/null
+++ b/src/Tigger/Read.hh
@@ -0,0 +1,40 @@
+#ifndef Read_HH
+#define Read_HH 1
+
+#include "foundation_AMOS.hh"
+#include <iostream>
+
+/**
+ * The <b>Read</b> class
+ *
+ *
+ * <p>Copyright © 2004, The Institute for Genomic Research (TIGR).
+ * <br>All rights reserved.
+ *
+ * @author Dan Sommer
+ *
+ * <pre>
+ * $RCSfile$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * </pre>
+ */
+class Read {
+public:
+ int id;
+ int len; // of clear range
+ int start; // in layout or contig
+ int end; // in layout or contig
+ AMOS::Range_t range;
+
+ Read(int p_id, int p_len, int p_start = -1, int p_end = -1)
+ : id(p_id), len(p_len), start(p_start), end(p_end) { }
+
+ void print() {
+ std::cout << " read " << id << " len " << len << " LAY (" << start << ", " << end << ")" << std::endl;
+ }
+
+};
+
+#endif // #ifndef Read_HH
diff --git a/src/Tigger/TiggerIO.cc b/src/Tigger/TiggerIO.cc
new file mode 100644
index 0000000..2e381f5
--- /dev/null
+++ b/src/Tigger/TiggerIO.cc
@@ -0,0 +1,245 @@
+#ifndef TiggerIO_HH
+#define TiggerIO_HH 1
+
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <unistd.h>
+#include "Read.hh"
+#include "Overlap.hh"
+#include "Unitigger.hh"
+
+
+using namespace std;
+using namespace AMOS;
+
+static bool AMOS_mode = false;
+static string bankdir;
+
+static bool UMD_mode = false;
+static bool GRAPH = false;
+static string read_file;
+static string overlap_file;
+static string contig_file;
+
+static bool VERBOSE = false;
+static bool SINGLE = false;
+
+Unitigger tigger;
+
+
+void get_amos_reads(const string p_bankdir) {
+ Read_t amos_read;
+ Message_t msg;
+ BankStream_t bank(Read_t::NCODE);
+ int readCount = 0;
+
+ try {
+ if(bank.exists(p_bankdir)) {
+ cout << " Pulling reads from bank " << p_bankdir << endl;
+ bank.open(p_bankdir, B_READ);
+
+ if(bank.empty()) {
+ cerr << p_bankdir << " bank is empty" << endl;
+ return;
+ }
+
+ while(bank >> amos_read) {
+ tigger.add_read(amos_read);
+ readCount++;
+ }
+
+ bank.close();
+ cout << "Pulled " << readCount << " reads from bank " << endl;
+ } else {
+ cerr << " AMOS Read Bank " << p_bankdir << " does not exist " << endl;
+ }
+ } catch (Exception_t &e) {
+ cerr << "Exception: " << e << endl;
+ }
+}
+
+void get_amos_overlaps(const string p_bankdir) {
+ Overlap_t amos_overlap;
+ Message_t msg;
+ BankStream_t bank(Overlap_t::NCODE);
+ int overlapCount = 0;
+
+ try {
+ if(bank.exists(p_bankdir)) {
+ cout << " Pulling overlaps from bank " << p_bankdir << endl;
+ bank.open(p_bankdir, B_READ);
+ if(bank.empty()) {
+ cout << " bank is empty" << endl;
+ return;
+ }
+
+ while(bank >> amos_overlap) {
+// if(VERBOSE) {
+// amos_overlap.writeMessage(msg);
+// msg.write(cout);
+// }
+
+ tigger.add_overlap(amos_overlap);
+ overlapCount++;
+ }
+
+ bank.close();
+ cout << "Pulled " << overlapCount << " overlaps from bank " << endl;
+ } else {
+ cerr << " AMOS Overlap Bank " << p_bankdir << " does not exist " << endl;
+ }
+ } catch (Exception_t &e) {
+ cerr << "Exception: " << e << endl;
+ }
+}
+
+////////////////////////////// read in UMD overlap ////////////
+void get_umd_overlaps(const char* p_file) {
+ ifstream olaps(p_file);
+ if(!olaps) cerr << "cannot open overlaps file" << endl;
+ int alen, blen;
+ int alin_score, errors;
+ float percent;
+
+ Overlap* olap = new Overlap();
+
+ while(olaps >> olap->ridA >> olap->ridB >> olap->ori >> olap->ahang \
+ >> olap->bhang >> alen >> blen >> alin_score >> errors >> percent) {
+ tigger.add_overlap(olap);
+ olap = new Overlap();
+ }
+
+}
+
+///////////////// read in UMD reads ///////////////
+void get_umd_reads(const char* p_file) {
+ ifstream reads(p_file);
+ if(!reads) cerr << "cannot open reads file" << endl;
+
+ int rid;
+ int len;
+ Read* read;
+
+ while(reads >> rid >> len) {
+ read = new Read(rid, len);
+ tigger.add_read(read);
+ }
+}
+
+
+static void parse_command_line(int argc, char* argv[]) {
+ bool errflg = false;
+ int ch;
+ bool rflg = false;
+ bool lflg = false;
+
+ optarg = NULL;
+
+ while (!errflg && ((ch = getopt(argc, argv, "r:l:b:hgvs")) != EOF)) {
+ switch (ch) {
+ case 's' :
+ SINGLE = true;
+ break;
+
+ case 'b' :
+ AMOS_mode = true;
+ bankdir = optarg;
+ break;
+
+ case 'r' :
+ rflg = true;
+ UMD_mode = true;
+ read_file = optarg;
+ break;
+
+ case 'l' :
+ lflg = true;
+ UMD_mode = true;
+ overlap_file = optarg;
+ break;
+
+ case 'h' :
+ errflg = true;
+ break;
+
+ case 'g' :
+ GRAPH = true;
+ break;
+
+ case 'v':
+ VERBOSE = true;
+ break;
+
+ case '?' :
+ cerr << "Unrecognized option - " << optopt << endl;
+
+ default :
+ errflg = true;
+ }
+ }
+
+ if(AMOS_mode && (rflg || lflg)) {
+ cerr << " Can't use AMOS and UMD together " << endl;
+ errflg = true;
+ }
+
+ if((rflg && !lflg) || (!rflg && lflg)) {
+ cerr << " Need to provide both a read file and a overlap file " << endl;
+ errflg = true;
+ }
+
+ if(!AMOS_mode && !UMD_mode) {
+ cerr << " Need to provide either an AMOS bank or UMD files " << endl;
+ errflg = true;
+ }
+
+ if(errflg) {
+ cerr << " Usage: tigger -b <AMOS Bank> -r <UMD reads> -l <UMD overlaps> " << endl;
+ exit(EXIT_FAILURE);
+ }
+
+ return;
+}
+
+
+int main(int argc, char** argv) {
+ parse_command_line(argc, argv);
+
+ tigger.VERBOSE = VERBOSE;
+ tigger.SINGLE = SINGLE;
+
+ if(AMOS_mode) {
+
+ if(VERBOSE) {
+ cout << " AMOS mode " << endl;
+ cout << " use bank: " << bankdir << endl;
+ }
+
+ get_amos_reads(bankdir);
+ get_amos_overlaps(bankdir);
+ tigger.calc_contigs();
+ tigger.output_amos_contigs(bankdir);
+
+ } else if(UMD_mode) {
+
+ cout << " UMD mode " << endl;
+ cout << "\t get reads from: " << read_file << endl;
+ cout << "\t get overlaps from: " << overlap_file << endl;
+
+ get_umd_reads(read_file.c_str());
+ get_umd_overlaps(overlap_file.c_str());
+ tigger.calc_contigs();
+
+ } else {
+
+ cout << " Error with inputs, no mode was set" << endl;
+ }
+
+ if(GRAPH) {
+ tigger.graph->create_dot_file("fullgraph.dot");
+ tigger.output_contig_graphs();
+ }
+
+}
+
+#endif // #ifndef TiggerIO_HH
diff --git a/src/Tigger/Unitigger.cc b/src/Tigger/Unitigger.cc
new file mode 100644
index 0000000..f017aeb
--- /dev/null
+++ b/src/Tigger/Unitigger.cc
@@ -0,0 +1,917 @@
+/*** includes ***/
+#include "Unitigger.hh"
+
+#include <iostream>
+#include <fstream>
+#include <cstdlib>
+#include <stdio.h>
+
+using namespace std;
+using namespace AMOS;
+
+typedef list< INode* >::iterator nodeListIter;
+typedef list< IEdge* >::iterator edgeListIter;
+
+Unitigger::Unitigger() {
+ graph = new Graph();
+
+ VERBOSE = false;
+
+ colors.push_back("green");
+ colors.push_back("red");
+ colors.push_back("orange");
+ colors.push_back("yellow");
+ colors.push_back("dodgerblue");
+ colors.push_back("purple");
+}
+
+
+void Unitigger::error(const char* m, const char* c) {
+ cerr << m << ' ' << c << endl;
+ exit(1);
+}
+
+
+void Unitigger::add_overlap(Overlap* p_olap) {
+
+ // convert AMOS adjacency info to Gene's from paper
+ // determine overlap dovetail type
+ if((p_olap->ahang >= 0) && (p_olap->bhang <= 0)) {
+ p_olap->type = 'C';
+ p_olap->asuffix = false;
+ p_olap->bsuffix = false;
+
+ } else if((p_olap->ahang <= 0) && (p_olap->bhang >= 0)) {
+ p_olap->type = 'C';
+ p_olap->asuffix = false;
+ p_olap->bsuffix = false;
+ p_olap->flip();
+
+ } else if(p_olap->ori == 'N') {
+
+ if(p_olap->ahang >= 0) {
+ p_olap->type = 'R';
+ p_olap->asuffix = true;
+ p_olap->bsuffix = false;
+
+ } else { // ahang is negative
+ p_olap->type = 'R';
+ p_olap->asuffix = false;
+ p_olap->bsuffix = true;
+ p_olap->flip();
+
+ }
+ } else { // ori == 'I'
+
+ if(p_olap->ahang >= 0) { // suffix
+ p_olap->type = 'S';
+ p_olap->asuffix = true;
+ p_olap->bsuffix = true;
+
+ } else { // ahang is negative, prefix
+ p_olap->type = 'P';
+ p_olap->asuffix = false;
+ p_olap->bsuffix = false;
+
+ }
+ }
+
+ if(VERBOSE) {
+ cout << " Added overlap:" << endl;
+ p_olap->print();
+ }
+
+ INode* n1 = graph->get_node(p_olap->ridA);
+ INode* n2 = graph->get_node(p_olap->ridB);
+
+ graph->new_edge(n1, n2, p_olap);
+}
+
+
+void Unitigger::add_overlap(Overlap_t p_olap) {
+
+ Overlap* olap = new Overlap();
+ pair <ID_t, ID_t> reads = p_olap.getReads();
+
+ if(reads.first == reads.second) {
+ cerr << "WARNING: Not adding overlap between read " << reads.first << " and itself " << endl;
+ return;
+ }
+
+ olap->ridA = reads.first;
+ olap->ridB = reads.second;
+ olap->ori = p_olap.getAdjacency();
+ olap->ahang = p_olap.getAhang();
+ olap->bhang = p_olap.getBhang();
+
+ add_overlap(olap);
+}
+
+
+void Unitigger::add_read(Read_t p_read) {
+
+ Range_t range = p_read.getClearRange();
+
+ Read* read = new Read(p_read.getIID(), range.getLength());
+ read->range = range;
+ if(VERBOSE) read->print();
+
+ INode* n = graph->new_node(read->id, read);
+ n->setInterval(read->len);
+}
+
+
+void Unitigger::add_read(Read* p_read) {
+
+ INode* n = graph->new_node(p_read->id, p_read);
+ n->setInterval(p_read->len);
+}
+
+
+void Unitigger::output_umd_contigs(IGraph* g, INode* p_node) {
+ Read* read = (Read*) p_node->getElement();
+ if(VERBOSE) cout << read->id << ' ' << read->start << ' ' << read->end << endl;
+ p_node->setFlags(0x1);
+
+ list< INode* > nodes = g->adjacent_nodes(p_node);
+ INode* node;
+
+ for(nodeListIter iter = nodes.begin(); iter != nodes.end(); ++iter) {
+ node = (*iter);
+ if(node->getFlags() != 0x1) {
+ // output_contigs(g, node);
+ }
+ }
+}
+
+void Unitigger::output_amos_contigs(const string p_bankdir) {
+ Message_t msg;
+ BankStream_t bank(Layout_t::NCODE);
+
+ try {
+ if(!bank.exists(p_bankdir)) {
+ bank.create(p_bankdir);
+ } else {
+ bank.open(p_bankdir);
+ }
+ cout << " Writing layouts to bank " << p_bankdir << endl;
+ } catch (Exception_t &e) {
+ cerr << "Exception while writing layouts : " << e << endl;
+ exit(127);
+ }
+
+ vector< Contig* >::iterator contig_iter = contigs.begin();
+ for( ; contig_iter != contigs.end(); ++contig_iter) {
+ Contig* ctg = (*contig_iter);
+ Tile_t tile;
+ Layout_t amos_ctg;
+ vector<Tile_t> tiles;
+
+ // loop over every node in subgraph
+ for(INodeIterator nodeIter = ctg->sg->nodes_begin(); nodeIter != ctg->sg->nodes_end(); ++nodeIter) {
+ INode* node = (*nodeIter).second;
+ Read* read_tile = (Read*) node->getElement();
+
+ tile.source = read_tile->id;
+
+ if(read_tile->start < read_tile->end) {
+
+ tile.offset = read_tile->start;
+ tile.range = read_tile->range;
+
+ } else {
+
+ tile.range = read_tile->range;
+ tile.range.swap();
+ tile.offset = read_tile->end;
+
+ }
+
+ if(VERBOSE) {
+ cout << " -> " << read_tile->id << " len " << read_tile->len;
+ cout << " (" << read_tile->start << "," << read_tile->end << ") ";
+ }
+
+ tiles.push_back(tile);
+ }
+
+ if(tiles.size() > 1) {
+ amos_ctg.setTiling(tiles);
+
+ bank << amos_ctg;
+ }
+ }
+
+ bank.close();
+}
+
+
+// void Unitigger::output_amos_layout(const string p_bankdir) {
+// Message_t msg;
+// BankStream_t bank(Layout_t::NCODE);
+
+// try {
+// if(!bank.exists(p_bankdir)) {
+// bank.create(p_bankdir);
+// } else {
+// bank.open(p_bankdir);
+// }
+// cout << " Writing layouts to bank " << p_bankdir << endl;
+// } catch (Exception_t &e) {
+// cerr << "Exception while writing layouts : " << e << endl;
+// exit(127);
+// }
+
+// vector< Contig* >::iterator contig_iter = contigs.begin();
+// for( ; contig_iter != contigs.end(); ++contig_iter) {
+// Contig* ctg = (*contig_iter);
+// Tile_t tile;
+// Layout_t layout;
+// vector<Tile_t> tiles;
+
+// // loop over every node in subgraph
+// for(INodeIterator nodeIter = ctg->sg->nodes_begin(); nodeIter != ctg->sg->nodes_end(); ++nodeIter) {
+// INode* node = (*nodeIter).second;
+// Read* read_tile = (Read*) node->getElement();
+
+// tile.source = read_tile->id;
+
+// if(read_tile->start < read_tile->end) {
+
+// tile.offset = read_tile->start;
+// tile.range = read_tile->range;
+
+// } else {
+
+// tile.range = read_tile->range;
+// tile.range.swap();
+// tile.offset = read_tile->end;
+
+// }
+
+// if(VERBOSE) {
+// cout << " -> " << read_tile->id << " len " << read_tile->len;
+// cout << " (" << read_tile->start << "," << read_tile->end << ") ";
+// }
+
+// tiles.push_back(tile);
+// }
+
+// if(tiles.size() > 1) {
+// layout.setTiling(tiles);
+
+// bank << layout;
+// }
+// }
+
+// bank.close();
+// }
+
+
+void Unitigger::hide_containment(IGraph* g) {
+ IEdge* edge;
+ Overlap* olap;
+ Read* read;
+ INode* node;
+
+ // loop over all edges to find containment overlaps
+ for(IEdgeIterator edges = g->edges_begin(); edges != g->edges_end(); ++edges) {
+ edge = (*edges).second;
+ olap = (Overlap *)edge->getElement();
+
+ if(olap->type == 'C') {
+ node = edge->getTarget();
+ read = (Read*) node->getElement();
+ if(read->id != olap->ridB) {
+ cerr << " Error overlap B id " << olap->ridB << " doesn't match read id " << read->id << endl;
+ }
+
+ // only add the node once to the containment queue
+ if(!node->getHidden()) {
+ // cout << " add node to containment " << node->getKey() << endl;
+ containment.push(edge);
+ }
+ node->setHidden(true);
+ }
+ }
+
+ cout << " total contained reads hidden " << containment.size() << endl;
+}
+
+
+void Unitigger::add_containment() {
+ IEdge* edge;
+ INode* con_node;
+ INode* node;
+ Overlap* ovl;
+ int count = 0;
+
+
+ while(!containment.empty()) {
+ int size = containment.size();
+ int pass_count = 0;
+
+ cout << "this pass containment size is " << size << endl;
+
+ for(int i = size; i > 0; i--) {
+ edge = containment.front();
+ containment.pop();
+ ovl = (Overlap*) edge->getElement();
+ con_node = edge->getTarget();
+
+ if(con_node->getKey() == ovl->ridA) {
+ node = con_node;
+ con_node = edge->getSource();
+ } else {
+ node = edge->getSource();
+ }
+
+ vector< Contig* >::iterator contig_iter = contigs.begin();
+ bool added = false;
+
+ // cout << " start looking for contig that contains read " << node->getKey() << endl;
+ //
+ // TODO : for a large number of contigs,
+ // finding the right contig can be very, very slow
+ for( ; contig_iter != contigs.end(); ++contig_iter) {
+ Contig* c = (*contig_iter);
+ if(c->sg->contains(node)) {
+ pass_count++;
+ c->sg->add_edge(edge);
+ con_node->setNodeHidden(false);
+ edge->setHidden(false);
+ edge->setColor("purple");
+ con_node->setColor("purple");
+ added = true;
+ break;
+ }
+ }
+
+ // TODO: fix if read contains self
+ if(!added) {
+ //cout << " not added " << con_node->getKey() << " " << node->getKey() << endl;
+ containment.push(edge);
+ }
+ } // for containment size
+
+ cout << pass_count << " containment reads added back on this pass " << endl;
+ count += pass_count;
+ cout << " sub-total contained reads unhidden " << count << endl;
+
+ if(containment.size() == size) { // we didn't remove any nodes BAD
+ cout << " containment loop found " << endl;
+ // cout << " queue contains: " << endl;
+ // cout << " [ read1, read2, overlap ]" << endl;
+ while(!containment.empty()) {
+ IEdge* e2 = containment.front();
+ containment.pop();
+ int read1 = edge->getTarget()->getKey();
+ int read2 = edge->getSource()->getKey();
+ // cout << "[ " << read1 << ", " << read2 << ", " << e2->getKey() << " ]" << endl;
+ }
+ }
+
+ }
+ cout << " total contained reads unhidden " << count << endl;
+}
+
+// TODO: refactor
+// TODO: better handle two distinct overlaps between reads
+void Unitigger::hide_transitive_overlaps(IGraph* g) {
+ queue< INode* > q; // queue of gray nodes
+ queue< INode* > children;
+ map< int, IEdge* > parents; // parent mapping
+ queue< IEdge* > trans; // trans edges that were found
+
+ graph->clear_flags();
+
+ // loop over all nodes
+ for(INodeIterator nodeIter = g->nodes_begin(); nodeIter != g->nodes_end(); ++nodeIter) {
+ INode* root_node = (*nodeIter).second;
+ int depth = 1;
+
+ // look for one that isn't hidden and hasn't been visited by BFS
+ // use as root for BFS
+ if((! root_node->getHidden()) && root_node->getDepth() == 0) {
+ root_node->setDepth(depth);
+ root_node->setFlags(1);
+ q.push(root_node);
+
+ INode* cur_node;
+ INode* child;
+ IEdge* cur_edge;
+ list < IEdge* > inc_edges;
+
+ while(!q.empty()) {
+ cur_node = q.front();
+ q.pop();
+ depth = cur_node->getDepth();
+ cur_node->setFlags(2); // black
+
+ // go over each child and mark/queue
+ inc_edges = g->incident_edges(cur_node);
+ for(edgeListIter iter = inc_edges.begin(); iter != inc_edges.end(); ++iter) {
+ cur_edge = (*iter);
+ child = cur_edge->opposite(cur_node);
+
+ if(child == NULL) {
+ cout << " ERROR null node in graph " << endl;
+ exit(1);
+ }
+
+ if(child->getFlags() == 0) { // hasn't been visited
+ child->setDepth(depth + 1);
+ child->setFlags(1); // gray
+ parents[child->getKey()] = cur_edge;
+ q.push(child); // push onto gray queue
+
+ child->setParent(cur_node->getKey());
+ children.push(child); // this nodes children
+ // cout << " " << child->getKey();
+
+
+ } else if(child->getFlags() == 1) {
+ if(child->getParent() == -1) {
+ child->setParent(cur_node->getKey());
+ children.push(child);
+ // cout << " " << child->getKey();
+ } else {
+ // cout << " " << child->getKey() << "(dup)";
+ }
+
+ parents[child->getKey()] = cur_edge;
+
+ } else { // flags should be 2/black
+ // cout << " " << child->getKey() << "(done)";
+
+ }
+ }
+
+
+ // look for transitive edges
+ //cout << endl << " start looking for 3 cycles for children of node " << cur_node->getKey() << endl;
+ while(! children.empty()) {
+ IEdge* grand_edge;
+ INode* grand_node = children.front();
+ children.pop();
+ INode* node2;
+
+ list< IEdge* > grand = g->incident_edges(grand_node);
+ for(edgeListIter iter = grand.begin(); iter != grand.end(); ++iter) {
+ grand_edge = (*iter);
+ node2 = grand_edge->opposite(grand_node);
+
+ if(node2->getFlags() != 2) {
+ // check for transitive link
+ if(node2->getParent() == grand_node->getParent()) {
+ int pkey = grand_node->getParent();
+ int gkey = grand_node->getKey();
+ int nkey = node2->getKey();
+ bool suffix1;
+ bool suffix2;
+
+ if(VERBOSE) {
+ cout << " found transitive link between ";
+ cout << pkey << " ";
+ cout << gkey << " " << nkey << endl;
+ }
+
+ Overlap* o1 = (Overlap *)grand_edge->getElement();
+ Overlap* o2 = (Overlap *)parents[grand_node->getKey()]->getElement();
+ Overlap* o3 = (Overlap *)parents[node2->getKey()]->getElement();
+
+ if(o2->ridA == pkey) {
+ suffix1 = o2->asuffix;
+ } else if(o2->ridB == pkey) {
+ suffix1 = o2->bsuffix;
+ }
+
+ if(o3->ridA == pkey) {
+ suffix2 = o3->asuffix;
+ } else if(o3->ridB == pkey) {
+ suffix2 = o3->bsuffix;
+ }
+
+ if(suffix1 != suffix2) {
+ trans.push(grand_edge);
+ }
+
+ if(o1->ridA == gkey) {
+ suffix1 = o1->asuffix;
+ } else if(o1->ridB == gkey) {
+ suffix1 = o1->bsuffix;
+ }
+
+ if(o2->ridA == gkey) {
+ suffix2 = o2->asuffix;
+ } else if(o2->ridB == gkey) {
+ suffix2 = o2->bsuffix;
+ }
+
+ if(suffix1 != suffix2) {
+ trans.push(parents[node2->getKey()]);
+ }
+
+
+ if(o1->ridA == nkey) {
+ suffix1 = o1->asuffix;
+ } else if(o1->ridB == nkey) {
+ suffix1 = o1->bsuffix;
+ }
+
+ if(o3->ridA == nkey) {
+ suffix2 = o3->asuffix;
+ } else if(o3->ridB == nkey) {
+ suffix2 = o3->bsuffix;
+ }
+
+ if(suffix1 != suffix2) {
+ trans.push(parents[grand_node->getKey()]);
+ }
+
+
+ }
+ } // end transitive check for node2
+
+ }
+ grand_node->setParent(-1);
+ }
+ }
+
+ int count = 0;
+ // hide transitive edges
+ while(! trans.empty()) {
+ if(! trans.front()->getHidden()) {
+ count++;
+ }
+ trans.front()->setHidden(true);
+ trans.pop();
+ }
+
+ }
+
+ }
+
+
+ g->clear_flags();
+}
+
+
+bool Unitigger::isSuffix(Read* read, Overlap* ovl) {
+ if(read->id == ovl->ridA) return ovl->asuffix;
+ if(read->id == ovl->ridB) return ovl->bsuffix;
+ // TODO: should through exception?
+ return false;
+}
+
+
+void Unitigger::find_chunks() {
+ INode* node;
+ int count = 0;
+
+ graph->clear_flags();
+
+ for(INodeIterator nodes = graph->nodes_begin(); nodes != graph->nodes_end(); ++nodes) {
+ node = (*nodes).second;
+ if((node->getFlags() != 1) && (! node->getHidden())) {
+ contigs.push_back(walk(node));
+ }
+ }
+
+ cout << " number of contigs " << contigs.size() << endl;
+}
+
+//
+// 1. add edge and node to subgraph if valid
+// 2. return null if no more edges
+//
+IEdge* Unitigger::walk_edge(IEdge* e, INode* n, Contig* ctg) {
+ SubGraph* sg = ctg->sg;
+ Read* read = (Read*) n->getElement();
+ Overlap* in_ovl = (Overlap*) e->getElement();
+ bool needSuffix = isSuffix(read, in_ovl);
+ IEdge* path;
+ int imatch = 0;
+ int omatch = 0;
+ bool cur = e->getHidden();
+
+ e->setHidden(true);
+
+ // loop through all edges, checking if we can walk
+ // from this node
+ list< IEdge* > edges = graph->incident_edges(n);
+ for(edgeListIter iter = edges.begin(); iter != edges.end(); ++iter) {
+ IEdge* oedge = (*iter);
+ Overlap* out_ovl = (Overlap*) oedge->getElement();
+
+ if(needSuffix != isSuffix(read, out_ovl)) {
+ omatch++;
+ path = oedge;
+ } else {
+ imatch++;
+ }
+
+ }
+
+ e->setHidden(cur);
+
+ if(imatch == 0) {
+ sg->add_edge(e);
+ e->setFlags(1);
+ n->setFlags(1);
+ ctg->start_node = n->getKey();
+ }
+
+ if((omatch == 1) && (imatch == 0)) {
+ return path;
+ } else {
+ return NULL;
+ }
+}
+
+
+Contig* Unitigger::walk(INode* p_node) {
+ Contig* ctg = new Contig();
+ ctg->sg = new SubGraph(*graph, "Contig");
+ ctg->start_node = p_node->getKey();
+ IEdge* edge;
+ IEdge* prefix;
+ IEdge* suffix;
+ Overlap* ovl;
+ Read* read = (Read*) p_node->getElement();
+ int smatch = 0;
+ int pmatch = 0;
+
+
+ // loop through all edges, checking if we can walk
+ // from this node
+ list< IEdge* > edges = graph->incident_edges(p_node);
+ for(edgeListIter iter = edges.begin(); iter != edges.end(); ++iter) {
+ edge = (*iter);
+ ovl = (Overlap*) edge->getElement();
+
+ if(isSuffix(read, ovl)) {
+ smatch++;
+ suffix = edge;
+ } else {
+ pmatch++;
+ prefix = edge;
+ }
+
+ }
+
+ ctg->sg->add_node(p_node);
+ p_node->setFlags(1);
+
+ INode* node2;
+ if(pmatch == 1) { // we can walk off the prefix overlap
+ node2 = p_node;
+ edge = prefix;
+
+ while(edge != NULL) {
+ node2 = edge->opposite(node2);
+ if(node2 != p_node) {
+ // cout << " walk edge " << edge->getKey() << " with node " << node2->getKey() << endl;
+ edge = walk_edge(edge, node2, ctg);
+ } else {
+ edge = NULL;
+ smatch = 0;
+ }
+ }
+ }
+
+
+ if(smatch == 1) { // we can walk off the suffix overlap
+ node2 = p_node; // start node
+ edge = suffix; // start at suffix edge
+
+ while(edge != NULL) {
+ node2 = edge->opposite(node2);
+ if(node2 != p_node) {
+ // cout << " walk edge " << edge->getKey() << " with node " << node2->getKey() << endl;
+ edge = walk_edge(edge, node2, ctg);
+ } else {
+ edge = NULL;
+ }
+ }
+ }
+
+ return ctg;
+}
+
+
+void Unitigger::layout_contig(Contig* ctg) {
+ INode* first_node = ctg->sg->get_node(ctg->start_node);
+ Read* read = (Read*) first_node->getElement();
+ IEdge* edge;
+ Overlap* ovl;
+ int count = 0;
+ queue< INode* > q;
+
+ read->start = 0;
+ read->end = read->len;
+
+ ctg->sg->clear_flags();
+
+ list< IEdge* > edges = ctg->sg->incident_edges(first_node);
+
+ // loop over edges
+ // find no containment edge
+ // there should be only one or there is a problem
+ // check overlap on edge
+ for(edgeListIter iter = edges.begin(); iter != edges.end(); ++iter) {
+ edge = (*iter);
+ ovl = (Overlap*) edge->getElement();
+
+ if(ovl->type != 'C') {
+ count++;
+ if(isSuffix(read, ovl)) {
+ read->start = 0;
+ read->end = (read->len);
+ } else {
+ read->start = (read->len);
+ read->end = 0;
+ }
+ }
+
+ }
+
+ if(count > 1) {
+ cerr << " *******Error: First read had more than one non-containment overlap for layout " << endl;
+ }
+
+ // now that the first read is set
+ // go through whole contig
+
+ INode* cur_node;
+ IEdge* cur_edge;
+ q.push(first_node);
+
+ while(!q.empty()) {
+ cur_node = q.front();
+ q.pop();
+ cur_node->setFlags(2); // black
+
+ // go over each child and mark/queue
+ list< IEdge* > inc_edges = ctg->sg->incident_edges(cur_node);
+ for(edgeListIter iter = inc_edges.begin(); iter != inc_edges.end(); ++iter) {
+ cur_edge = (*iter);
+ INode* child = cur_edge->opposite(cur_node);
+ if(child->getFlags() == 0) { // hasn't been visited
+ child->setFlags(1); // gray
+ q.push(child);
+ layout_read(cur_edge, child);
+ }
+ }
+ }
+
+}
+
+
+// need start node and sub-graph
+void Unitigger::layout_read(IEdge* p_edge, INode* p_node) {
+ Overlap* olap = (Overlap*) p_edge->getElement();
+ // read that should be set
+ Read* lay_read = (Read*) p_node->getElement();
+ // read to layout
+ Read* set_read = (Read*) p_edge->opposite(p_node)->getElement();
+
+ if(VERBOSE) {
+ cout << " layout read " << lay_read->id << " against " << set_read->id << endl;
+ set_read->print();
+ olap->print();
+ }
+
+ int ahang = olap->ahang;
+ int len = lay_read->len;
+
+ if(set_read->id == olap->ridA) { // need to layout B given A
+ if(set_read->start > set_read->end) { // invert coordinates
+ ahang = - ahang;
+ len = - len;
+ }
+
+ if(olap->type == 'C') {
+
+ if(olap->ori == 'N') {
+
+ lay_read->start = set_read->start + ahang;
+ lay_read->end = lay_read->start + len;
+
+ } else { // innie
+
+ lay_read->end = set_read->start + ahang;
+ lay_read->start = lay_read->end + len;
+ }
+
+
+ } else if(olap->type == 'R') {
+
+ lay_read->start = set_read->start + ahang;
+ lay_read->end = lay_read->start + len;
+
+ } else if((olap->type == 'P') || (olap->type == 'S')) {
+
+ lay_read->end = set_read->start + ahang;
+ lay_read->start = lay_read->end + len;
+ }
+
+ } else { // need to layout A given B
+ if((olap->ori == 'N') && (set_read->start > set_read->end)) { // invert coordinates
+ ahang = - ahang;
+ len = - len;
+ } else if ((olap->ori == 'I') && (set_read->end > set_read->start)) { // invert coordinates
+ ahang = - ahang;
+ len = - len;
+ }
+
+ if(olap->type == 'C') {
+
+ if(olap->ori == 'N') {
+ lay_read->start = set_read->start - ahang;
+ lay_read->end = lay_read->start + len;
+ } else { // innie
+ lay_read->start = set_read->end - ahang;
+ lay_read->start = lay_read->end + len;
+ }
+
+ } else if(olap->type == 'R') {
+
+ lay_read->start = set_read->start - ahang;
+ lay_read->end = lay_read->start + len;
+
+ } else if((olap->type == 'P') || (olap->type == 'S')) {
+
+ lay_read->start = set_read->end - ahang;
+ lay_read->end = lay_read->start + len;
+ }
+ }
+
+ if(lay_read->start < 0) {
+ //cout << " negative start read " << lay_read->start << endl;
+ lay_read->end -= lay_read->start;
+ lay_read->start = 0;
+ } else if(lay_read->end < 0) {
+ // cout << " negative end read " << lay_read->end << endl;
+ lay_read->start -= lay_read->end;
+ lay_read->end = 0;
+ }
+
+
+ // check start
+ if((lay_read->start < 0) || (lay_read->end < 0)) {
+ cerr << " ***** layout read error: negative coordinates for " << lay_read->id << endl;
+ }
+
+ if(VERBOSE) {
+ cout << " done " << lay_read->start << ", " << lay_read->end << endl;
+ lay_read->print();
+ }
+
+}
+
+void Unitigger::output_contig_graphs() {
+ char buffer[30];
+
+ vector< Contig* >::iterator contig_iter = contigs.begin();
+ for(int i = 0; contig_iter != contigs.end(); ++contig_iter) {
+ Contig* c = (*contig_iter);
+ sprintf(buffer, "Contig-%d.dot", i++);
+ if(c->sg->num_nodes() > 1) {
+ c->sg->create_dot_file(buffer);
+ }
+ }
+}
+
+
+void Unitigger::calc_contigs() {
+
+ //
+ // Step 1. handle containment edges
+ //
+ hide_containment((IGraph*) graph);
+
+ //
+ // Step 2. transitive edges
+ //
+ hide_transitive_overlaps((IGraph*) graph);
+
+
+ //
+ // Step 3. Chunking
+ //
+ find_chunks();
+
+ add_containment();
+
+ //
+ // Step 4. Layout
+ //
+ vector< Contig* >::iterator contig_iter = contigs.begin();
+ contig_iter = contigs.begin();
+ for( ; contig_iter != contigs.end(); ++contig_iter) {
+ layout_contig((*contig_iter));
+ }
+
+}
+
diff --git a/src/Tigger/Unitigger.hh b/src/Tigger/Unitigger.hh
new file mode 100644
index 0000000..3f54202
--- /dev/null
+++ b/src/Tigger/Unitigger.hh
@@ -0,0 +1,80 @@
+#ifndef Unitigger_HH
+#define Unitigger_HH 1
+
+#include "foundation_AMOS.hh"
+#include <vector>
+#include <queue>
+#include "IGraph.hh"
+#include "Graph.hh"
+#include "SubGraph.hh"
+#include "Read.hh"
+#include "Overlap.hh"
+#include "Contig.hh"
+
+/**
+ * The <b>Unitigger</b> class
+ *
+ *
+ * <p>Copyright © 2004, The Institute for Genomic Research (TIGR).
+ * <br>All rights reserved.
+ *
+ * @author Dan Sommer
+ *
+ * <pre>
+ * $RCSfile$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * </pre>
+ */
+class Unitigger {
+
+public:
+
+ /** <code> g </code> overlap graph */
+ Graph* graph;
+
+ std::vector<std::string> colors;
+ std::vector< Contig* > contigs;
+ std::queue< IEdge* > containment;
+ // HASHMAP::hash_map< int, IEdge* >
+ bool VERBOSE;
+ bool SINGLE;
+
+ void error(const char* m, const char* c = "");
+
+ void add_read(Read* p_read);
+ void add_read(AMOS::Read_t p_read);
+
+ void add_overlap(Overlap* p_olap);
+ void add_overlap(AMOS::Overlap_t p_olap);
+
+ void layout_contig(Contig* contig);
+ void layout_read(IEdge* p_edge, INode* p_node);
+
+ void output_umd_contigs(IGraph* g, INode* p_node);
+ void output_amos_contigs(const std::string p_bankdir);
+
+ void hide_transitive_overlaps(IGraph *g);
+
+ void hide_containment(IGraph* g);
+ void add_containment();
+
+ void calc_contigs();
+
+ void find_chunks();
+
+ void output_contig_graphs();
+
+ Contig* walk(INode* p_node);
+ IEdge* walk_edge(IEdge* e, INode* n, Contig* ctg);
+
+ bool isSuffix(Read* read, Overlap* ovl);
+
+
+ Unitigger();
+ //~Unitiggger();
+};
+
+
+#endif // #ifndef Unitigger_HH
diff --git a/src/Utils/Makefile.am b/src/Utils/Makefile.am
new file mode 100644
index 0000000..f62c2d9
--- /dev/null
+++ b/src/Utils/Makefile.am
@@ -0,0 +1,122 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+
+##-- TO BE INSTALLED
+bin_PROGRAMS = \
+ trimByOvl \
+ runAmos \
+ analyzeSNPs \
+ recallConsensus \
+ cvgStat \
+ tagsum-reduce
+
+
+dist_bin_SCRIPTS = \
+ benchmark_qual.pl \
+ benchmark_seq.pl \
+ ctgovl.pl \
+ filter_contig.pl \
+ filterfrg.pl \
+ filter_seq.pl \
+ listcontigreads.sh \
+ cvgChop.pl \
+ getN50.pl \
+ getlengths.pl \
+ gccontent.pl \
+ preTA.pl \
+ pullTArchive.pl \
+ runTA.pl \
+ preassembleFrgs.pl \
+ ktrimfrg.pl \
+ translate-fasta.pl \
+ delta2cvg.pl \
+ delta2clr.pl \
+ updateDeltaClr.pl \
+ nucmerAnnotate.pl \
+ nucmer2ovl.pl \
+ sort2.pl \
+ ovl2OVL.pl \
+ fasta_select_len.pl \
+ fasta_to_fastq.pl \
+ fastqqc.pl \
+ fastq_to_fasta_fast.pl \
+ fixfastq.pl \
+ fastq_rename.pl \
+ stats.pl \
+ revFasta.pl
+
+# runAmos.pl
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/AMOS
+
+##-- analyzeSNPs
+analyzeSNPs_CPPFLAGS = \
+ -I$(top_srcdir)/src/GNU \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/Slice
+
+analyzeSNPs_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/Slice/libSlice.a
+
+analyzeSNPs_SOURCES = \
+ analyzeSNPs.cc
+
+##-- recallConsensus
+recallConsensus_CPPFLAGS = \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/GNU \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/Slice
+
+recallConsensus_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/Slice/libSlice.a
+
+recallConsensus_SOURCES = \
+ recallConsensus.cc
+
+
+##-- trimByOvl
+trimByOvl_CPPFLAGS = \
+ -I$(top_srcdir)/src/AMOS
+trimByOvl_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+trimByOvl_SOURCES = \
+ trimByOvl.cc
+
+##-- cvgStat
+cvgStat_CPPFLAGS = \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/AMOS
+cvgStat_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+cvgStat_SOURCES = \
+ cvgStat.cc
+
+##-- tagsum-reduce
+tagsum_reduce_SOURCES = \
+ tagsum-reduce.cc
+
+##-- runAmos
+## note: this references top_builddir because getopt.h is built if needed
+runAmos_CPPFLAGS = \
+ -I$(top_builddir)/src/GNU
+ ## because some system headers will be built if necessary
+runAmos_LDADD = \
+ $(top_builddir)/src/GNU/libGNU.a
+runAmos_SOURCES = \
+ runAmos.cc
+
+
+##-- END OF MAKEFILE --##
diff --git a/src/Utils/Makefile.in b/src/Utils/Makefile.in
new file mode 100644
index 0000000..5666489
--- /dev/null
+++ b/src/Utils/Makefile.in
@@ -0,0 +1,833 @@
+# 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 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@
+DIST_COMMON = $(dist_bin_SCRIPTS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = trimByOvl$(EXEEXT) runAmos$(EXEEXT) \
+ analyzeSNPs$(EXEEXT) recallConsensus$(EXEEXT) cvgStat$(EXEEXT) \
+ tagsum-reduce$(EXEEXT)
+subdir = src/Utils
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_analyzeSNPs_OBJECTS = analyzeSNPs-analyzeSNPs.$(OBJEXT)
+analyzeSNPs_OBJECTS = $(am_analyzeSNPs_OBJECTS)
+analyzeSNPs_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/Slice/libSlice.a
+am_cvgStat_OBJECTS = cvgStat-cvgStat.$(OBJEXT)
+cvgStat_OBJECTS = $(am_cvgStat_OBJECTS)
+cvgStat_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a
+am_recallConsensus_OBJECTS = \
+ recallConsensus-recallConsensus.$(OBJEXT)
+recallConsensus_OBJECTS = $(am_recallConsensus_OBJECTS)
+recallConsensus_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/Slice/libSlice.a
+am_runAmos_OBJECTS = runAmos-runAmos.$(OBJEXT)
+runAmos_OBJECTS = $(am_runAmos_OBJECTS)
+runAmos_DEPENDENCIES = $(top_builddir)/src/GNU/libGNU.a
+am_tagsum_reduce_OBJECTS = tagsum-reduce.$(OBJEXT)
+tagsum_reduce_OBJECTS = $(am_tagsum_reduce_OBJECTS)
+tagsum_reduce_LDADD = $(LDADD)
+am_trimByOvl_OBJECTS = trimByOvl-trimByOvl.$(OBJEXT)
+trimByOvl_OBJECTS = $(am_trimByOvl_OBJECTS)
+trimByOvl_DEPENDENCIES = $(top_builddir)/src/AMOS/libAMOS.a
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+SCRIPTS = $(dist_bin_SCRIPTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(analyzeSNPs_SOURCES) $(cvgStat_SOURCES) \
+ $(recallConsensus_SOURCES) $(runAmos_SOURCES) \
+ $(tagsum_reduce_SOURCES) $(trimByOvl_SOURCES)
+DIST_SOURCES = $(analyzeSNPs_SOURCES) $(cvgStat_SOURCES) \
+ $(recallConsensus_SOURCES) $(runAmos_SOURCES) \
+ $(tagsum_reduce_SOURCES) $(trimByOvl_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+dist_bin_SCRIPTS = \
+ benchmark_qual.pl \
+ benchmark_seq.pl \
+ ctgovl.pl \
+ filter_contig.pl \
+ filterfrg.pl \
+ filter_seq.pl \
+ listcontigreads.sh \
+ cvgChop.pl \
+ getN50.pl \
+ getlengths.pl \
+ gccontent.pl \
+ preTA.pl \
+ pullTArchive.pl \
+ runTA.pl \
+ preassembleFrgs.pl \
+ ktrimfrg.pl \
+ translate-fasta.pl \
+ delta2cvg.pl \
+ delta2clr.pl \
+ updateDeltaClr.pl \
+ nucmerAnnotate.pl \
+ nucmer2ovl.pl \
+ sort2.pl \
+ ovl2OVL.pl \
+ fasta_select_len.pl \
+ fasta_to_fastq.pl \
+ fastqqc.pl \
+ fastq_to_fasta_fast.pl \
+ fixfastq.pl \
+ fastq_rename.pl \
+ stats.pl \
+ revFasta.pl
+
+
+# runAmos.pl
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/AMOS
+
+analyzeSNPs_CPPFLAGS = \
+ -I$(top_srcdir)/src/GNU \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/Slice
+
+analyzeSNPs_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/Slice/libSlice.a
+
+analyzeSNPs_SOURCES = \
+ analyzeSNPs.cc
+
+recallConsensus_CPPFLAGS = \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/GNU \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/Slice
+
+recallConsensus_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/Slice/libSlice.a
+
+recallConsensus_SOURCES = \
+ recallConsensus.cc
+
+trimByOvl_CPPFLAGS = \
+ -I$(top_srcdir)/src/AMOS
+
+trimByOvl_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+trimByOvl_SOURCES = \
+ trimByOvl.cc
+
+cvgStat_CPPFLAGS = \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/AMOS
+
+cvgStat_LDADD = \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+cvgStat_SOURCES = \
+ cvgStat.cc
+
+tagsum_reduce_SOURCES = \
+ tagsum-reduce.cc
+
+runAmos_CPPFLAGS = \
+ -I$(top_builddir)/src/GNU
+
+runAmos_LDADD = \
+ $(top_builddir)/src/GNU/libGNU.a
+
+runAmos_SOURCES = \
+ runAmos.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Utils/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Utils/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):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+analyzeSNPs$(EXEEXT): $(analyzeSNPs_OBJECTS) $(analyzeSNPs_DEPENDENCIES)
+ @rm -f analyzeSNPs$(EXEEXT)
+ $(CXXLINK) $(analyzeSNPs_OBJECTS) $(analyzeSNPs_LDADD) $(LIBS)
+cvgStat$(EXEEXT): $(cvgStat_OBJECTS) $(cvgStat_DEPENDENCIES)
+ @rm -f cvgStat$(EXEEXT)
+ $(CXXLINK) $(cvgStat_OBJECTS) $(cvgStat_LDADD) $(LIBS)
+recallConsensus$(EXEEXT): $(recallConsensus_OBJECTS) $(recallConsensus_DEPENDENCIES)
+ @rm -f recallConsensus$(EXEEXT)
+ $(CXXLINK) $(recallConsensus_OBJECTS) $(recallConsensus_LDADD) $(LIBS)
+runAmos$(EXEEXT): $(runAmos_OBJECTS) $(runAmos_DEPENDENCIES)
+ @rm -f runAmos$(EXEEXT)
+ $(CXXLINK) $(runAmos_OBJECTS) $(runAmos_LDADD) $(LIBS)
+tagsum-reduce$(EXEEXT): $(tagsum_reduce_OBJECTS) $(tagsum_reduce_DEPENDENCIES)
+ @rm -f tagsum-reduce$(EXEEXT)
+ $(CXXLINK) $(tagsum_reduce_OBJECTS) $(tagsum_reduce_LDADD) $(LIBS)
+trimByOvl$(EXEEXT): $(trimByOvl_OBJECTS) $(trimByOvl_DEPENDENCIES)
+ @rm -f trimByOvl$(EXEEXT)
+ $(CXXLINK) $(trimByOvl_OBJECTS) $(trimByOvl_LDADD) $(LIBS)
+install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/analyzeSNPs-analyzeSNPs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvgStat-cvgStat.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/recallConsensus-recallConsensus.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/runAmos-runAmos.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tagsum-reduce.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trimByOvl-trimByOvl.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+
+analyzeSNPs-analyzeSNPs.o: analyzeSNPs.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(analyzeSNPs_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT analyzeSNPs-analyzeSNPs.o -MD -MP -MF $(DEPDIR)/analyzeSNPs-analyzeSNPs.Tpo -c -o analyzeSNPs-analyzeSNPs.o `test -f 'analyzeSNPs.cc' || echo '$(srcdir)/'`analyzeSNPs.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/analyzeSNPs-analyzeSNPs.Tpo $(DEPDIR)/analyzeSNPs-analyzeSNPs.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='analyzeSNPs.cc' object='analyzeSNPs-analyzeSNPs.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(analyzeSNPs_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o analyzeSNPs-analyzeSNPs.o `test -f 'analyzeSNPs.cc' || echo '$(srcdir)/'`analyzeSNPs.cc
+
+analyzeSNPs-analyzeSNPs.obj: analyzeSNPs.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(analyzeSNPs_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT analyzeSNPs-analyzeSNPs.obj -MD -MP -MF $(DEPDIR)/analyzeSNPs-analyzeSNPs.Tpo -c -o analyzeSNPs-analyzeSNPs.obj `if test -f 'analyzeSNPs.cc'; then $(CYGPATH_W) 'analyzeSNPs.cc'; else $(CYGPATH_W) '$(srcdir)/analyzeSNPs.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/analyzeSNPs-analyzeSNPs.Tpo $(DEPDIR)/analyzeSNPs-analyzeSNPs.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='analyzeSNPs.cc' object='analyzeSNPs-analyzeSNPs.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(analyzeSNPs_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o analyzeSNPs-analyzeSNPs.obj `if test -f 'analyzeSNPs.cc'; then $(CYGPATH_W) 'analyzeSNPs.cc'; else $(CYGPATH_W) '$(srcdir)/analyzeSNPs.cc'; fi`
+
+cvgStat-cvgStat.o: cvgStat.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cvgStat_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cvgStat-cvgStat.o -MD -MP -MF $(DEPDIR)/cvgStat-cvgStat.Tpo -c -o cvgStat-cvgStat.o `test -f 'cvgStat.cc' || echo '$(srcdir)/'`cvgStat.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/cvgStat-cvgStat.Tpo $(DEPDIR)/cvgStat-cvgStat.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='cvgStat.cc' object='cvgStat-cvgStat.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cvgStat_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cvgStat-cvgStat.o `test -f 'cvgStat.cc' || echo '$(srcdir)/'`cvgStat.cc
+
+cvgStat-cvgStat.obj: cvgStat.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cvgStat_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT cvgStat-cvgStat.obj -MD -MP -MF $(DEPDIR)/cvgStat-cvgStat.Tpo -c -o cvgStat-cvgStat.obj `if test -f 'cvgStat.cc'; then $(CYGPATH_W) 'cvgStat.cc'; else $(CYGPATH_W) '$(srcdir)/cvgStat.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/cvgStat-cvgStat.Tpo $(DEPDIR)/cvgStat-cvgStat.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='cvgStat.cc' object='cvgStat-cvgStat.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cvgStat_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o cvgStat-cvgStat.obj `if test -f 'cvgStat.cc'; then $(CYGPATH_W) 'cvgStat.cc'; else $(CYGPATH_W) '$(srcdir)/cvgStat.cc'; fi`
+
+recallConsensus-recallConsensus.o: recallConsensus.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(recallConsensus_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT recallConsensus-recallConsensus.o -MD -MP -MF $(DEPDIR)/recallConsensus-recallConsensus.Tpo -c -o recallConsensus-recallConsensus.o `test -f 'recallConsensus.cc' || echo '$(srcdir)/'`recallConsensus.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/recallConsensus-recallConsensus.Tpo $(DEPDIR)/recallConsensus-recallConsensus.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='recallConsensus.cc' object='recallConsensus-recallConsensus.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(recallConsensus_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o recallConsensus-recallConsensus.o `test -f 'recallConsensus.cc' || echo '$(srcdir)/'`recallConsensus.cc
+
+recallConsensus-recallConsensus.obj: recallConsensus.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(recallConsensus_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT recallConsensus-recallConsensus.obj -MD -MP -MF $(DEPDIR)/recallConsensus-recallConsensus.Tpo -c -o recallConsensus-recallConsensus.obj `if test -f 'recallConsensus.cc'; then $(CYGPATH_W) 'recallConsensus.cc'; else $(CYGPATH_W) '$(srcdir)/recallConsensus.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/recallConsensus-recallConsensus.Tpo $(DEPDIR)/recallConsensus-recallConsensus.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='recallConsensus.cc' object='recallConsensus-recallConsensus.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(recallConsensus_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o recallConsensus-recallConsensus.obj `if test -f 'recallConsensus.cc'; then $(CYGPATH_W) 'recallConsensus.cc'; else $(CYGPATH_W) '$(srcdir)/recallConsensus.cc'; fi`
+
+runAmos-runAmos.o: runAmos.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(runAmos_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT runAmos-runAmos.o -MD -MP -MF $(DEPDIR)/runAmos-runAmos.Tpo -c -o runAmos-runAmos.o `test -f 'runAmos.cc' || echo '$(srcdir)/'`runAmos.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/runAmos-runAmos.Tpo $(DEPDIR)/runAmos-runAmos.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runAmos.cc' object='runAmos-runAmos.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(runAmos_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o runAmos-runAmos.o `test -f 'runAmos.cc' || echo '$(srcdir)/'`runAmos.cc
+
+runAmos-runAmos.obj: runAmos.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(runAmos_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT runAmos-runAmos.obj -MD -MP -MF $(DEPDIR)/runAmos-runAmos.Tpo -c -o runAmos-runAmos.obj `if test -f 'runAmos.cc'; then $(CYGPATH_W) 'runAmos.cc'; else $(CYGPATH_W) '$(srcdir)/runAmos.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/runAmos-runAmos.Tpo $(DEPDIR)/runAmos-runAmos.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='runAmos.cc' object='runAmos-runAmos.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(runAmos_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o runAmos-runAmos.obj `if test -f 'runAmos.cc'; then $(CYGPATH_W) 'runAmos.cc'; else $(CYGPATH_W) '$(srcdir)/runAmos.cc'; fi`
+
+trimByOvl-trimByOvl.o: trimByOvl.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(trimByOvl_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT trimByOvl-trimByOvl.o -MD -MP -MF $(DEPDIR)/trimByOvl-trimByOvl.Tpo -c -o trimByOvl-trimByOvl.o `test -f 'trimByOvl.cc' || echo '$(srcdir)/'`trimByOvl.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/trimByOvl-trimByOvl.Tpo $(DEPDIR)/trimByOvl-trimByOvl.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='trimByOvl.cc' object='trimByOvl-trimByOvl.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(trimByOvl_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o trimByOvl-trimByOvl.o `test -f 'trimByOvl.cc' || echo '$(srcdir)/'`trimByOvl.cc
+
+trimByOvl-trimByOvl.obj: trimByOvl.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(trimByOvl_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT trimByOvl-trimByOvl.obj -MD -MP -MF $(DEPDIR)/trimByOvl-trimByOvl.Tpo -c -o trimByOvl-trimByOvl.obj `if test -f 'trimByOvl.cc'; then $(CYGPATH_W) 'trimByOvl.cc'; else $(CYGPATH_W) '$(srcdir)/trimByOvl.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/trimByOvl-trimByOvl.Tpo $(DEPDIR)/trimByOvl-trimByOvl.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='trimByOvl.cc' object='trimByOvl-trimByOvl.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(trimByOvl_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o trimByOvl-trimByOvl.obj `if test -f 'trimByOvl.cc'; then $(CYGPATH_W) 'trimByOvl.cc'; else $(CYGPATH_W) '$(srcdir)/trimByOvl.cc'; fi`
+
+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 $(PROGRAMS) $(SCRIPTS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-binPROGRAMS clean-generic 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-binPROGRAMS install-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dist_binSCRIPTS \
+ 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-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-dist_binSCRIPTS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Utils/analyzeSNPs.cc b/src/Utils/analyzeSNPs.cc
new file mode 100644
index 0000000..9391103
--- /dev/null
+++ b/src/Utils/analyzeSNPs.cc
@@ -0,0 +1,435 @@
+#include "foundation_AMOS.hh"
+#include <getopt.h>
+#include <map>
+#include <list>
+#include <vector>
+#include <string>
+#include <queue>
+#include <functional>
+#include "amp.hh"
+
+#include <Slice.h>
+#include "ContigIterator_AMOS.hh"
+
+using namespace std;
+using namespace AMOS;
+
+
+#define endl "\n"
+
+bool TCOV = 0;
+bool SNPREPORT = 0;
+bool PRINTALL = 0;
+
+string BANKNAME;
+
+int SR_PRINTHEADER = 1;
+int SR_PRINTBASE = 1;
+int SR_PRINTREAD = 0;
+int SR_PRINTLIBS = 0;
+int SR_PRINTQUAL = 0;
+int SR_SKIPMAJOR = 0;
+
+int SR_MINAGREEINGCONFLICTS = 1;
+int SR_MINAGREEINGQV = 0;
+int SR_MINCONFLICTQV = 0;
+
+int ONE_BASED_GINDEX = 0;
+bool USEIID = 0;
+bool USEEID = 0;
+
+map<ID_t, ID_t> frg2lib;
+
+
+void printHelpText()
+{
+ cerr <<
+ "\n"
+ ".NAME.\n"
+ "analyzeSNPs - scans multiple alignment of reads looking for snps\n"
+ "\n.USAGE.\n"
+ "analyzeSNPs -b[ank] <bank_name> [OPTIONS]\n"
+ "\n.OPTIONS.\n"
+ "-h, -help print out help message\n"
+ "-b, -bank bank where assembly is stored\n"
+
+ "-T, -tcov print snp positions in TCOV format (DEFAULT)\n"
+ "-S, -report print a report on the snps\n"
+ "-a, -all print all positions (not just SNP positions)\n\n"
+
+ "SNP Report Options\n"
+ "-H Skip header\n"
+ "-B Skip printing bases\n"
+ "-r Print readnames\n"
+ "-l Print libid\n"
+ "-q Print qvs\n"
+ "-K Don't print reads in majority\n"
+ "-M, -minsnps <val> Set Minimum number of consistent disagreeing reads to report (default: " << SR_MINAGREEINGCONFLICTS << ")\n"
+ "-C, -cumqv <val> Set Minimum conflicting cummulative qv to report (default: " << SR_MINAGREEINGQV << ")\n"
+ "-Q, -minqv <val> Set Minimum conflicting qv to report (default: " << SR_MINCONFLICTQV << ")\n\n"
+
+ "General Options\n"
+ "-e, -eid Display eids\n"
+ "-i, -iid Display iids\n"
+ "-1 Display 1-based gapped coordinates\n\n"
+ "\n.DESCRIPTION.\n"
+ "\n.KEYWORDS.\n"
+ "AMOS bank\n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"bank", 1, 0, 'b'},
+
+ {"tcov", 0, 0, 'T'},
+ {"T", 0, 0, 'T'},
+ {"report", 0, 0, 'S'},
+ {"S", 0, 0, 'S'},
+ {"all", 0, 0, 'a'},
+
+ {"H", 0, 0, 'H'},
+ {"B", 0, 0, 'B'},
+ {"r", 0, 0, 'r'},
+ {"l", 0, 0, 'l'},
+ {"q", 0, 0, 'q'},
+ {"K", 0, 0, 'K'},
+ {"minsnps", 1, 0, 'M'},
+ {"M", 1, 0, 'M'},
+ {"cumqv", 1, 0, 'C'},
+ {"C", 1, 0, 'C'},
+ {"minqv", 1, 0, 'Q'},
+ {"Q", 1, 0, 'Q'},
+
+ {"eid", 0, 0, 'e'},
+ {"iid", 0, 0, 'i'},
+ {"1", 0, 0, '1'},
+
+ {0, 0, 0, 0}
+ };
+
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1)
+ {
+ switch (c)
+ {
+ case 'h': printHelpText(); exit(0); break;
+ case 'b': BANKNAME = optarg; break;
+
+ case 'T': TCOV = 1; break;
+ case 'S': SNPREPORT = 1; break;
+ case 'a': PRINTALL = 1; break;
+
+ case 'H': SR_PRINTHEADER = 0; break;
+ case 'B': SR_PRINTBASE = 0; break;
+ case 'r': SR_PRINTREAD = 1; break;
+ case 'l': SR_PRINTLIBS = 1; break;
+ case 'q': SR_PRINTQUAL = 1; break;
+ case 'K': SR_SKIPMAJOR = 1; break;
+
+ case 'M': SR_MINAGREEINGCONFLICTS = atoi(optarg); break;
+ case 'C': SR_MINAGREEINGQV = atoi(optarg); break;
+ case 'Q': SR_MINCONFLICTQV = atoi(optarg); break;
+
+ case 'e': USEEID = 1; break;
+ case 'i': USEIID = 1; break;
+ case '1': ONE_BASED_GINDEX = 1; break;
+
+ case '?':
+ cerr << "Error processing options: " << argv[optind-1] << endl;
+ return false;
+ };
+ }
+
+ if (!SNPREPORT) { TCOV = 1; }
+
+ //cerr << "SR_MINAGREEINGCONFLICTS: " << SR_MINAGREEINGCONFLICTS << endl;
+ //cerr << "SR_MINAGREEINGQV: " << SR_MINAGREEINGQV << endl;
+ //cerr << "SR_MINCONFLICTQV: " << SR_MINCONFLICTQV << endl;
+
+ return true;
+}
+
+int printTCOV(ContigIterator_t ci)
+{
+ libSlice_Slice slice;
+ libSlice_Consensus consensusResults;
+
+ int gindex = ci.gindex();
+
+ char cons = ci.cons();
+ ostringstream quals;
+ ostringstream reads;
+
+ const TiledReadList_t & tiling = ci.getTilingReads();
+
+ slice.dcov = tiling.size();
+ slice.bc = new char [slice.dcov+1];
+
+ if (slice.dcov)
+ {
+ int cur;
+ slice.qv = new char [slice.dcov];
+ slice.rc = new char [slice.dcov];
+ slice.c = cons;
+
+ TiledReadList_t::const_iterator ri;
+ for (ri = tiling.begin(), cur = 0; cur < slice.dcov; ri++, cur++)
+ {
+ char b = ri->base(gindex);
+ char q = ri->qv(gindex);
+ char r = ri->m_isRC;
+
+ slice.bc[cur] = b;
+ slice.qv[cur] = q;
+ slice.rc[cur] = r;
+
+ if (cur) { quals << ":"; reads << ":"; }
+
+ quals << (int) q;
+
+ if (USEEID) { reads << ri->m_eid; } else
+ if (USEIID) { reads << ri->m_iid; } else
+ { reads << ri->m_readidx; }
+ }
+
+ slice.bc[cur] = '\0';
+
+ libSlice_getConsensusParam(&slice, &consensusResults, NULL, 0, 0);
+
+ delete slice.qv;
+ delete slice.rc;
+ }
+
+ if (USEEID) {cout << ci.getContig().getEID() << " "; }
+ else {cout << ci.getContig().getIID() << " "; }
+
+ cout << gindex+ONE_BASED_GINDEX << " "
+ << ci.uindex() << " "
+ << ci.cons();
+
+ if (slice.dcov)
+ {
+ cout << " " << consensusResults.qvConsensus;
+ cout << " " << slice.bc << " " << quals.str() << " " << reads.str();
+ }
+
+ cout << endl;
+ delete slice.bc;
+
+ return 1;
+}
+
+
+void printSNPReportHeader()
+{
+ cout << "AsmblID\tGPos\tUPos\tConsensus\tdcov\tconflicts";
+
+ if (SR_PRINTBASE) { cout << "\t(Base)"; }
+ if (SR_PRINTREAD) { cout << "\t{Reads}"; }
+ if (SR_PRINTLIBS) { cout << "\t<Libs>"; }
+ if (SR_PRINTQUAL) { cout << "\t[Quals]"; }
+
+ cout << endl;
+}
+
+
+int printSNPReport(ContigIterator_t ci, vector<BaseStats_t*> & freq)
+{
+ int dcov = ci.depth();
+ int gindex = ci.gindex();
+
+ if (USEEID) { cout << ci.getContig().getEID() << "\t"; }
+ else { cout << ci.getContig().getIID() << "\t"; }
+
+ cout << gindex+ONE_BASED_GINDEX << "\t"
+ << ci.uindex() << "\t"
+ << ci.cons() << "\t"
+ << dcov << "\t"
+ << dcov - freq[0]->m_reads.size();
+
+ int i = 0;
+ if (SR_SKIPMAJOR) { i = 1; }
+
+ for (; i < freq.size(); i++)
+ {
+ char base = toupper(freq[i]->m_base);
+
+ ostringstream reads;
+ ostringstream quals;
+ ostringstream libs;
+
+ bool first = true;
+ vector<TiledReadList_t::const_iterator>::const_iterator ri;
+ for (ri = freq[i]->m_reads.begin(); ri != freq[i]->m_reads.end(); ri++)
+ {
+ if (!first) { reads << ":"; quals << ":"; libs << ":"; }
+ first = false;
+
+ if (SR_PRINTLIBS) { libs << frg2lib[(*ri)->m_fragid]; }
+ if (SR_PRINTQUAL) { quals << (int) (*ri)->qv(gindex); }
+ if (SR_PRINTREAD)
+ {
+ if (USEEID) { reads << (*ri)->m_eid; } else
+ if (USEIID) { reads << (*ri)->m_iid; } else
+ { reads << (*ri)->m_readidx; }
+ }
+ }
+
+ if (SR_PRINTBASE) { cout << "\t" << base << "(" << freq[i]->m_reads.size() << ")"; }
+ if (SR_PRINTREAD) { cout << "\t{" << reads.str() << "}"; }
+ if (SR_PRINTLIBS) { cout << "\t<" << libs.str() << ">"; }
+ if (SR_PRINTQUAL) { cout << "\t[" << quals.str() << "]"; }
+ }
+
+ cout << endl;
+
+ return 1;
+}
+
+
+
+
+
+//----------------------------------------------
+int main(int argc, char **argv)
+{
+ if (! GetOptions(argc, argv))
+ {
+ exit(1);
+ }
+
+ // open necessary files
+ if (BANKNAME.empty())
+ {
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ BankStream_t contig_stream (Contig_t::NCODE);
+ Bank_t read_bank (Read_t::NCODE);
+
+ try
+ {
+ contig_stream.open(BANKNAME, B_READ|B_SPY);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Failed to open contig account in bank " << BANKNAME
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+
+ try
+ {
+ read_bank.open(BANKNAME, B_READ|B_SPY);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Failed to open read account in bank " << BANKNAME
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ if (SR_PRINTLIBS)
+ {
+ BankStream_t fragment_stream (Fragment_t::NCODE);
+
+ try
+ {
+ fragment_stream.open(BANKNAME, B_READ);
+ Fragment_t frg;
+
+ while (fragment_stream >> frg)
+ {
+ frg2lib.insert(make_pair(frg.getIID(), frg.getLibrary()));
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Error loading fragment-library relations: " << e << endl;
+ cerr << "Not printing libraries" << endl;
+ SR_PRINTLIBS = 0;
+ }
+ }
+
+ if (SNPREPORT && SR_PRINTHEADER) { printSNPReportHeader(); }
+
+ int bases = 0;
+ int snpcount = 0;
+ int displaycount = 0;
+ int contigcount = 0;
+
+ int ccount = contig_stream.getSize();
+
+ cerr << "Searching " << ccount << " contigs";
+
+ ProgressDots_t dots(ccount, 50);
+
+ Contig_t ctg;
+ while (contig_stream >> ctg)
+ {
+ ContigIterator_t ci(ctg, &read_bank);
+ contigcount++;
+ ID_t iid = ctg.getIID();
+
+ try
+ {
+ dots.update(contigcount);
+
+ while (ci.advanceNext())
+ {
+ bases++;
+
+ bool hasSNP = ci.hasSNP();
+ if (hasSNP) { snpcount++; }
+
+ bool foundGoodSNP = false;
+
+ Column_t column(ci.getColumn());
+ vector<BaseStats_t *> freq(column.getBaseInfo());
+
+ // start at 1 to skip the consensus, only look at conflicting bases
+ for (int i = 1; !foundGoodSNP && i < freq.size(); i++)
+ {
+ foundGoodSNP = (freq[i]->m_reads.size() >= SR_MINAGREEINGCONFLICTS) &&
+ (freq[i]->m_cumqv >= SR_MINAGREEINGQV) &&
+ (freq[i]->m_maxqv >= SR_MINCONFLICTQV);
+ }
+
+ if ((foundGoodSNP || PRINTALL))
+ {
+ if (TCOV)
+ {
+ displaycount += printTCOV(ci);
+ }
+ else
+ {
+ displaycount += printSNPReport(ci, freq);
+ }
+ }
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR in contig iid" << iid << "\n" << e;
+ exit(1);
+ }
+ catch(...)
+ {
+ cerr << "Unknown error in contig iid" << iid << "\n";
+ exit(1);
+ }
+ }
+
+ dots.end();
+
+ cerr << endl
+ << displaycount << " positions reported of " << snpcount << " total SNPs found." << endl;
+ cerr << "Searched " << bases << " positions in " << contigcount << " contigs." << endl;
+}
+
diff --git a/src/Utils/benchmark_qual.pl b/src/Utils/benchmark_qual.pl
new file mode 100755
index 0000000..147f77e
--- /dev/null
+++ b/src/Utils/benchmark_qual.pl
@@ -0,0 +1,44 @@
+#!/usr/bin/perl -w
+#-- Dirty script to pull out desired quality score tables
+
+if ( scalar(@ARGV) != 1 || $ARGV[0] eq '-h' ) {
+ die "Script to pull out desired quality score tables\nUSAGE: $0 <quality file> < <seq name list>\n";
+}
+$qualfile = $ARGV[0];
+
+open (QUAL_INPUT, "<$qualfile")
+ or die "ERROR: couldn't open qual file $!\n";
+
+%tag_hash = ( );
+while ( <QUAL_INPUT> ) {
+ if ( /^>/ ) {
+ ($tag) = /^>(\S+)/;
+ $tag_hash{$tag} = tell QUAL_INPUT;
+ }
+}
+
+while ( <STDIN> ) {
+ $tag = $_;
+ chomp $tag;
+
+ $seek = $tag_hash{$tag};
+ if ( !defined($seek) ) {
+ die "ERROR: could not find sequence for $tag\n";
+ }
+
+ seek QUAL_INPUT, $seek, 0;
+ print ">$tag\n";
+
+ while ( <QUAL_INPUT> ) {
+ $line = $_;
+
+ if ( $line =~ /^>/ ) {
+ last;
+ } else {
+ print $line;
+ }
+ }
+}
+
+close (QUAL_INPUT)
+ or die "ERROR: couldn't close qual file $!\n";
diff --git a/src/Utils/benchmark_seq.pl b/src/Utils/benchmark_seq.pl
new file mode 100755
index 0000000..600460e
--- /dev/null
+++ b/src/Utils/benchmark_seq.pl
@@ -0,0 +1,167 @@
+#!/usr/local/bin/perl -w
+#- Dirty script to pull out and format sequences for web release
+
+use strict;
+use TIGR::Foundation;
+use TIGR::FASTAreader;
+use TIGR::FASTArecord;
+
+my $tigr = undef;
+my $err = undef;
+
+my $fastafilename = undef;
+my $libfilename = undef;
+my $listfilename = undef;
+
+my $fasta_reader = undef;
+my @list = ( );
+
+$tigr = new TIGR::Foundation;
+if ( !defined ($tigr) ) {
+ print (STDERR "ERROR: TIGR::Foundation could not be initialized");
+ exit (1);
+}
+
+if ( scalar(@ARGV) != 3 || $ARGV[0] eq '-h' ) {
+ print (STDERR "Pull out and format sequences\nUSAGE: $0 <taglist> <lib map> <fasta>\n");
+ exit (1);
+}
+
+$listfilename = $ARGV[0];
+$libfilename = $ARGV[1];
+$fastafilename = $ARGV[2];
+
+
+open (LIST_INPUT, "<$listfilename")
+ or die "ERROR: Could not open $listfilename $!\n";
+while ( <LIST_INPUT> ) {
+ chomp $_;
+
+ if ( !/^\S+\s[+-]$/ && !/^\S+$/ ) {
+ print (STDERR "ERROR: Could not parse $listfilename\n");
+ print (STDERR " \"$_\"\n");
+ exit (1);
+ }
+ push @list, $_;
+}
+close (LIST_INPUT)
+ or die "ERROR: Could not close $listfilename $!\n";
+
+my %libhash;
+my %version_hash = (
+ "B" => 2,
+ "C" => 3,
+ "D" => 4,
+ "E" => 5,
+ "F" => 6,
+ "G" => 7,
+ );
+
+my $lib_id;
+my $lib_uid;
+my $version;
+my $clone_id;
+my $clearl;
+my $clearr;
+my $dir;
+
+open (MAP_INPUT, "<$libfilename")
+ or die "ERROR: Could not open $libfilename $!\n";
+while ( <MAP_INPUT> ) {
+ ($lib_id, $lib_uid) = split;
+ $libhash{$lib_id} = $lib_uid;
+}
+close (MAP_INPUT)
+ or die "ERROR: Could not close $libfilename $!\n";
+
+$fasta_reader = new TIGR::FASTAreader $tigr;
+$fasta_reader->open($fastafilename)
+ or die "ERROR: Could not open $fastafilename $!\n";
+
+my $line = undef;
+foreach $line (@list) {
+ my $fasta_record = undef;
+ my $identifier = undef;
+
+ ($identifier) = $line =~ /^(\S+)/;
+
+ $fasta_record = $fasta_reader->getRecordByIdentifier($identifier);
+
+ if ( !defined ($fasta_record) ) {
+ print (STDERR "ERROR: Could not find \"$identifier\"\n");
+ exit (1);
+ }
+
+ my $sequence = undef;
+ $sequence = $fasta_record->getData( );
+
+ if ( !defined ($sequence) ) {
+ print (STDERR "ERROR: Sequence for \"$identifier\" is not valid\n");
+ exit (1);
+ }
+
+ $lib_id = undef;
+ $lib_uid = undef;
+ $version = undef;
+ $clone_id = undef;
+ $clearl = undef;
+ $clearr = undef;
+ $dir = undef;
+
+ if ( length($identifier) < 7 ) {
+ die "ERROR: invalid identifier $identifier\n";
+ }
+ $lib_id = substr($identifier, 0, 4);
+ $lib_uid = $libhash{$lib_id};
+ if ( !defined($lib_uid) ) {
+ print STDERR "WARNING: unknown library $lib_id, ignoring sequence\n";
+ next;
+ }
+ $clone_id = substr($identifier, 0, 7);
+ if ( $identifier =~ /([FRNS])([B-G]?)$/ ) {
+ ($dir, $version) = $identifier =~ /([FRNS])([B-G]?)$/;
+ if ( defined($dir) && $dir ne "" ) {
+ if ( $dir eq "N" ) {
+ $dir = "F";
+ } elsif ( $dir eq "S" ) {
+ $dir = "R";
+ }
+ } else {
+ die "ERROR: missing direction\n";
+ }
+ if ( defined($version) && $version ne "" ) {
+ $version = $version_hash{$version};
+ } else {
+ $version = "1";
+ }
+ } else {
+ $dir = "W";
+ $version = "1";
+ }
+ my $header = $fasta_record->getHeader( );
+ ($clearl, $clearr) = $header =~ /(\S+)\s+(\S+)$/;
+ if ( !($clearl =~ /^\d+$/) || !($clearr =~ /^\d+$/) ||
+ $clearl < 0 || $clearr < 0 ) {
+ die "ERROR: invalid clear range ($clearl) ($clearr)\n";
+ }
+
+ if ( !defined($lib_uid) || !defined($dir) ||
+ !defined($version) || !defined($clone_id) ||
+ !defined($clearl) || !defined($clearr) ) {
+ die "ERROR: missing header data\n" .
+ ">$identifier\t$lib_uid\t$clone_id\t$dir$version\t$clearl\t$clearr\n";
+ }
+
+ print
+ ">$identifier\t$lib_uid\t$clone_id\t$dir$version\t$clearl\t$clearr\n";
+ my $seg = undef;
+ while ( (defined ($seg = substr $sequence, 0, 60,'')) &&
+ ($seg ne '')) {
+ print "$seg\n";
+ }
+}
+
+$fasta_reader->close( )
+ or die "ERROR: Could not close $fastafilename $!\n";
+
+#-- end of script
diff --git a/src/Utils/ctgovl.pl b/src/Utils/ctgovl.pl
new file mode 100755
index 0000000..34ad185
--- /dev/null
+++ b/src/Utils/ctgovl.pl
@@ -0,0 +1,270 @@
+#!/usr/local/bin/perl
+
+use POSIX qw(strftime);
+use TIGR::Foundation;
+use AMOS::AmosLib;
+
+my $VERSION = '$Revision$';
+my $HELPTEXT = "ctgovl -o <ovlfile> (-c <ctgfile> | -a <asmfile>) [-x <xmlfile>]";
+
+my $base = new TIGR::Foundation;
+
+if (! defined $base){
+ die("Walk, do not run, to the nearest Exit!\n");
+}
+
+$base->setHelpInfo($HELPTEXT);
+$base->setVersionInfo($VERSION);
+
+
+
+my $ctgfile;
+my $ovlfile;
+my $frgfile;
+my $xmlfile;
+my $uidmap;
+
+my $err = $base->TIGR_GetOptions("c=s" => \$ctgfile,
+ "o=s" => \$ovlfile,
+ "a=s" => \$asmfile,
+ "x=s" => \$xmlfile,
+ "map=s" => \$uidmap);
+
+my $contig;
+my %readctg;
+my %readlen;
+my $contiglen = 0;
+my %contiglen;
+my %uid2iid;
+my $linkid = 1;
+
+if (defined $uidmap){
+ open(UID, $uidmap) || $base->bail("Cannot open $uidmap: $!\n");
+ while (<UID>){
+ chomp;
+ my ($name, $id) = split(' ', $_);
+ $uid2iid{$name} = $id;
+ }
+ close(UID);
+}
+
+if (defined $asmfile){
+ print STDERR "Doing $asmfile\n";
+ open(ASM, $asmfile) || $base->bail("Cannot open $asmfile: $!\n");
+
+ while ($record = getRecord(\*ASM)){
+ my ($type, $fields, $recs) = parseRecord($record);
+ if ($type eq "AFG"){
+ my $ids = $$fields{acc};
+ $ids =~ /\((\d+),(\d+)\)/;
+ $uid2iid{$1} = $2;
+ }
+ if ($type eq "CCO"){
+ my $contig = getCAId($$fields{acc});
+ $contiglen{$contig} = $$fields{len};
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+ if ($sid eq "MPS"){
+ my ($asml, $asmr) = split(',', $$sfs{"pos"});
+ $readctg{$uid2iid{$$sfs{"mid"}}} = "$contig,$asml,$asmr";
+ }
+ }
+ }
+ }
+ close(ASM);
+}
+
+
+if (defined $ctgfile){
+ open(CTG, "$ctgfile") || die ("Cannot open $ctgfile: $!\n");
+
+ while (<CTG>){
+ chomp;
+ if (/^C (\d+)/){
+ if ($contiglen != 0){
+ $contiglen{$contig} = $contiglen;
+ }
+ $contig = $1;
+ $contiglen = 0;
+ next;
+ }
+ if (/\#\#(\S+) (\d+) (\d+)/){
+ $contig = $1;
+ $contiglen{$contig} = $3;
+ }
+ if (/(\d+) (\d+) (\d+)/){
+ if ($contiglen < $2) {$contiglen = $2;}
+ if ($contiglen < $3) {$contiglen = $3;}
+ $readctg{$1} .= "$contig,$2,$3 ";
+ if (! exists $readlen{$1}){
+ $readlen{$1} = abs($2 - $3);
+ } else {
+ if ($readlen{$1} != abs($2 - $3)){
+ print STDERR "Already saw read $1 (", abs($2 - $3), ") but with length $readlen{$1}\n";
+ }
+ }
+ }
+ if (/\#(\S+)\((\d+)\).*\{(\d+) (\d+)\} <(\d+) (\d+)>/){
+ my $id = $uid2iid{$1};
+ $readctg{$id} .= "$contig,";
+ if ($3 < $4){
+ $readctg{$id} .= "$5,$6 ";
+ } else {
+ $readctg{$id} .= "$6,$5 ";
+ }
+ }
+ }
+
+ if ($contiglen != 0){
+ $contiglen{$contig} = $contiglen;
+ }
+
+ close(CTG);
+}
+
+if (defined $xmlfile){
+ open(XML, ">$xmlfile") || $base->bail("Cannot open $xmlfile: $!\n");
+ print XML "<?xml version = \"1.0\" ?>\n";
+ print XML "<EVIDENCE ID = \"olap2ovl\"\n";
+ print XML " DATE = \"" . (strftime "%a %b %e %H:%M:%S %Y", gmtime) . "\"\n";
+ print XML " PROJECT = \"$ovlfile\"\n";
+ print XML " PARAMETERS = \"". join(" ", @ARGV) . "\">\n";
+
+ while (my ($ctg, $len) = each %contiglen){
+ print XML " <CONTIG ID = \"contig_$ctg\" NAME = \"$ctg\" LEN = \"$len\"/>\n";
+ }
+}
+
+open(OVL, "$ovlfile") || die ("Cannot open $ovlfile: $!\n");
+
+while (<OVL>){
+ chomp;
+
+ if (/\s*(\d+)\s*(\d+) ([IN])\s*(-?\d+)\s*(-?\d+)/){
+ my $rdA = $1;
+ my $rdB = $2;
+ my $ori = $3;
+ my $Ahang = $4;
+ my $Bhang = $5;
+
+ if (! exists $readctg{$rdA} || ! exists $readctg{$rdB}){
+ # no need to worry.
+ next;
+ }
+ my @ctgA = split(' ', $readctg{$rdA});
+ my @ctgB = split(' ', $readctg{$rdB});
+
+ for (my $i = 0; $i <= $#ctgA; $i++){
+ for (my $j = 0; $j <= $#ctgB; $j++){
+ my ($ctgA, $la, $ra) = split(',', $ctgA[$i]);
+ my ($ctgB, $lb, $rb) = split(',', $ctgB[$j]);
+ if ($ctgA == $ctgB){
+ next; # no need to look at these
+ }
+ $pair{"$ctgA $ctgB"} .= "$rdA,$rdB,$ori,$Ahang,$Bhang,$la,$ra,$lb,$rb ";
+ }
+ }
+ }
+}
+close(OVL);
+
+my %seenpair;
+while (my ($pair, $evidence) = each %pair){
+ my ($ctgA, $ctgB) = split(' ', $pair);
+ my $ohangA;
+ my $ohangB;
+
+ my @evs = split(' ', $pair{$pair});
+
+ print "$ctgA($contiglen{$ctgA}) $ctgB($contiglen{$ctgB})\n";
+ for (my $i = 0; $i <= $#evs; $i++){
+ print "\t$evs[$i] \t";
+ my @fields = split(',', $evs[$i]);
+
+ my $da;
+ my $db = $fields[3];
+ my $dc;
+ my $dap;
+ my $dbp = $fields[4];
+ my $dcp;
+
+# here's the situation
+#
+# ctgA =======================================
+# da'
+# and the read da -------->db'
+# second read db <------- dc'
+# dc
+# ctgB ==============================
+#
+#
+# ohangA is da + db - dc where da is offset in first contig, db is the overhang
+# for the beginning of the read, and dc is the offset in the second contig
+#
+# Similarly ohangB is db' + dc' - da'
+
+ my $aori; my $bori;
+
+ if ($fields[5] < $fields[6]){
+ print "> ";
+ $aori = ">";
+ $da = $fields[5];
+ $dap = $contiglen{$ctgA} - $fields[6];
+ } else {
+ print "< ";
+ $aori = "<";
+ $da = $contiglen{$ctgA} - $fields[5];
+ $dap = $fields[6];
+ }
+ if ($fields[7] < $fields[8]) {
+ $bori = (($fields[2] eq "N") ? ">" : "<");
+ print "$bori ";
+ $dc = (($fields[2] eq "N") ? $fields[7] : $contiglen{$ctgB} - $fields[8]);
+ $dcp = (($fields[2] eq "N") ? $contiglen{$ctgB} - $fields[8] : $fields[7]);
+ } else {
+ $bori = (($fields[2] eq "N") ? "<" : ">");
+ print "$bori ";
+ $dc = (($fields[2] eq "N") ? $contiglen{$ctgB} - $fields[7] : $fields[8]);
+ $dcp = (($fields[2] eq "N") ? $fields[8] : $contiglen{$ctgB} - $fields[7]);
+ }
+
+ $ohangA = $da + $db - $dc;
+ $ohangB = $dbp + $dcp - $dap;
+
+ if ($aori eq $bori){
+ $type = "N";
+ } else {
+ $type = "I";
+ }
+ print " ";
+
+ if ($aori eq "<") {
+ $aori = ">";
+ if ($bori eq ">") {$bori = "<";} else {$bori = ">"}
+ my $tmp = $ohangA;
+ $ohangA = -$ohangB;
+ $ohangB = -$tmp;
+ }
+ print "$aori $bori $ohangA $ohangB\n";
+
+ }
+
+ if (defined $xmlfile && ! exists $seenpair{"$ctgA $ctgB"} && ! exists $seenpair{"$ctgB $ctgA"}){
+ my $lnksize = $contiglen{$ctgA} - $ohangA;
+ my $oriB = ($bori eq ">") ? "BE" : "EB";
+ print XML " <OVL ID = \"ovl_$linkid\">\n";
+ print XML " <CONTIG ID = \"contig_$ctgA\" ORI = \"BE\" HANG=\"$ohangA\"/>\n";
+ print XML " <CONTIG ID = \"contig_$ctgB\" ORI = \"$oriB\" HANG=\"$ohangB\"/>\n";
+ print XML " </OVL>\n";
+ $linkid++;
+ $seenpair{"$ctgA $ctgB"} = 1;
+ }
+ print "\n";
+}
+
+if (defined $xmlfile){
+ print XML "</EVIDENCE>\n";
+ close(XML);
+}
+
+exit(0);
diff --git a/src/Utils/cvgChop.pl b/src/Utils/cvgChop.pl
new file mode 100755
index 0000000..54761c4
--- /dev/null
+++ b/src/Utils/cvgChop.pl
@@ -0,0 +1,407 @@
+#!/usr/local/bin/perl
+
+use AMOS::AmosLib;
+use TIGR::Foundation;
+use POSIX;
+use strict;
+
+my $VERSION = '$Revision$ ';
+my $HELPTEXT = q~
+cvgchop (-a <asm_file> | -c <contig_file>) [-sum] [-map] [-cvg <min_cvg>]
+ [-byscf] [-split]
+
+-sum - summarize the coverages
+-map - build map of coverage areas
+-cvg <min_cvg> - create multi-fasta file of regions
+ in genome with > <min_cvg> coverage. (Default: 2)
+-byscf - the contigs are reported in the order and orientation implied by
+ the scaffolds. Option requires -a.
+-split - splits the contigs into chunks that have > 0 coverage over all length
+
+If no option or just -cvg is passed to the program the output file will be
+named <asm_file>.<min_cvg>x or <contig_file>.<min_cvg>x depending on the
+type of input.
+
+If -sum or -map is passed, the output will be reported to STDOUT.
+~;
+
+my $base = new TIGR::Foundation;
+
+if (! defined $base){
+ die("Crazy error\n");
+}
+$base->setHelpInfo($HELPTEXT);
+$base->setVersionInfo($VERSION);
+
+my $MIN_CVG = 2;
+my $asmfile;
+my $contigfile;
+my $summary;
+my $map;
+my $frgfile;
+my $byscaff;
+my $dosplit;
+my $err = $base->TIGR_GetOptions("a=s" => \$asmfile,
+ "f=s" => \$frgfile,
+ "c=s" => \$contigfile,
+ "sum" => \$summary,
+ "map" => \$map,
+ "byscf" => \$byscaff,
+ "cvg=i" => \$MIN_CVG,
+ "split" => \$dosplit);
+
+
+if ($err == 0){
+ $base->bail("Command line processing failed. See -h option");
+}
+
+if (defined $asmfile && defined $contigfile){
+ $base->bail("You can only use one of -a and -c options");
+}
+
+if (! defined $asmfile && ! defined $contigfile) {
+ $base->bail("You must define either -a or -c option");
+}
+
+if (defined $byscaff && ! defined $asmfile){
+ $base->bail("You must use -a with -byscf");
+}
+
+my $opts = 0;
+if (defined $summary) {$opts++};
+if (defined $map) {$opts++};
+if ($MIN_CVG != 2) {$opts++};
+
+if ($opts > 1){
+ $base->bail("You can use at most one of -sum, -map, and -cvg options");
+}
+
+select STDERR; $| = 1;
+select STDOUT;
+
+my $outfname;
+
+if (defined $contigfile){
+ $outfname = $contigfile . ".$MIN_CVG" . "x";
+} else {
+ $outfname = $asmfile . ".$MIN_CVG" . "x";
+}
+
+if (! $summary && ! $map){
+ open(OUT, ">$outfname") || die ("Cannot open \"$outfname\": $!\n");
+}
+
+if ((defined $frgfile && ! defined $asmfile) ||
+ (defined $frgfile && defined $contigfile)){
+ $base->bail("You can use the -f option with -a alone");
+}
+
+my $contiglen = 0;
+my $incontig = 0;
+my %eventcoord;
+my $thiscontig;
+my $seq;
+my $chunk; # chunk in contig
+
+if (defined $contigfile){
+ open(CTG, "$contigfile") || die ("Cannot open \"$contigfile\": $!\n");
+ while (<CTG>){
+ if (/^\#\#/){
+
+ }
+ if (/^\#\#(\S+) \d+ (\d+)/){
+ my $tmp = $1;
+ my $tmp2 = $2;
+ $chunk = 1;
+
+ if (defined $thiscontig){
+ $seq =~ s/-//g;
+ if ($seq ne "") {$contiglen = length($seq);}
+ process_contig($thiscontig);
+ }
+
+ $contiglen = $tmp2;
+ $thiscontig = $tmp;
+ %eventcoord = ();
+ $seq = "";
+ $incontig = 1;
+
+ next;
+ }
+ if (/\#.*<(\d+) (\d+)>/){
+ my $first = $1 - 1; my $last = $2; # convert to 0 based coordinates
+
+ if ($incontig == 1){
+ $seq =~ s/-//g;
+ $incontig = 0;
+ }
+
+ while (exists $eventcoord{$first}){
+ $first += 0.001;
+ }
+ while (exists $eventcoord{$last}){
+ $last += 0.001;
+ }
+
+ $eventcoord{$first} = "B";
+ $eventcoord{$last} = "E";
+
+ next;
+ }
+ if ($incontig == 1){
+ chomp;
+ $seq .= $_;
+ }
+ }
+
+ if (defined $thiscontig) {
+ $seq =~ s/-//g;
+ if ($seq ne "") {$contiglen = length($seq);}
+ process_contig($thiscontig);
+ }
+ close(CTG);
+}
+
+my %seqnames;
+
+if (defined $frgfile){
+ open(FRG, "$frgfile") || $base->bail("Cannot open $frgfile: $!\n");
+ while (my $record = getRecord(\*FRG)){
+ my ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec eq "FRG"){
+ my $nm = $$fields{src};
+ my @lines = split('\n', $nm);
+ $nm = join(' ', @lines);
+ if ($nm eq "" || $nm =~ /^\s*$/){
+ $nm = $$fields{acc};
+ }
+ $seqnames{$$fields{acc}} = $nm;
+ }
+ }
+ close(FRG);
+}
+
+my $rec;
+my $fields;
+my $recs;
+
+if (defined $asmfile){
+ open(ASM, "$asmfile") || $base->bail("Cannot open $asmfile: $!\n");
+
+ my %contigidx;
+ my %scaffctg;
+ my @scaffolds;
+ if (defined $byscaff){
+ while (my $record = ((my $seekpos = tell ASM), getRecord(\*ASM))){
+ ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec eq "CCO"){
+ $contigidx{getCAId($$fields{acc})} = $seekpos;
+ }
+ if ($rec eq "SCF"){
+ my $id = getCAId($$fields{acc});
+ push(@scaffolds, $id);
+
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+ if ($sid eq "CTP"){
+ if ($$sfs{ori} eq "N" ||
+ $$sfs{ori} eq "I"){
+ $scaffctg{$id} .= "$$sfs{ct1},BE ";
+ } else {
+ $scaffctg{$id} .= "$$sfs{ct2},EB ";
+ }
+ if ($$sfs{ct1} != $$sfs{ct2} &&
+ $i == $#$recs){
+ if ($$sfs{ori} eq "N" ||
+ $$sfs{ori} eq "O"){
+ $scaffctg{$id} .= "$$sfs{ct2},BE ";
+ } else {
+ $scaffctg{$id} .= "$$sfs{ct2},EB ";
+ }
+ } # just for the last CTP record
+ } # if sid eq CTP
+ } # for each subrec
+ } # if rec eq SCF
+ } # while ASM
+ for (my $scf = 0; $scf <= $#scaffolds; $scf++){
+ my @contigs = split(' ', $scaffctg{$scaffolds[$scf]});
+ for (my $cc = 0 ; $cc <= $#contigs; $cc++){
+ my ($cid, $cori) = split(',', $contigs[$cc]);
+ seek ASM, $contigidx{$cid}, 0; #seek set
+ my $record = getRecord(\*ASM);
+ if (! defined $record){
+ $base->bail("Cannot find record for contig $cid\n");
+ }
+ ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec ne "CCO" || getCAId($$fields{acc}) != $cid){
+ $base->bail("Incorrect record retrieved for contig $cid:\n$record\n");
+ }
+ if ($cori eq "BE"){
+ doCCO(0, "$scaffolds[$scf]_${cori}_");
+ } else {
+ doCCO(1, "$scaffolds[$scf]_${cori}_");
+ }
+ }
+ }
+ } else { # if byscaff
+ while (my $record = getRecord(\*ASM)){
+ ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec eq "CCO"){
+ doCCO(0, ""); # forward contig
+ } # if CCO
+ } # while record
+ } # if not byscaff
+ close(ASM);
+} # if defined $asmfile
+
+if (! $summary){
+ close(OUT);
+}
+
+exit(0);
+
+########################################################################
+
+#print STDERR "done\n";
+sub doCCO {
+ my $orient = shift;
+ my $scaffold = shift;
+ my $id = getCAId($$fields{acc});
+
+ my $len = $$fields{len};
+ $contiglen = $len;
+ my $lseq = $$fields{cns};
+ my @fields = split('\n', $lseq);
+ $lseq = join('', @fields);
+ $seq = $lseq;
+ $seq =~ s/-//g;
+
+ my @offsets = ();
+ $#offsets = length($lseq);
+ my $coord = 0;
+ for (my $i = 0; $i < length($lseq); $i++){
+ if (substr($lseq, $i, 1) ne "-"){
+ $coord++;
+ } else {
+ $contiglen--;
+ }
+ $offsets[$i] = $coord;
+ }
+
+ %eventcoord = ();
+
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+
+ if ($sid eq "MPS"){
+ my $rid = getCAId($$sfs{mid});
+ my $asms = $$sfs{pos};
+ $asms =~ /(\d+),(\d+)/;
+
+ my $asml;
+ my $asmr;
+ if ($1 > $2){
+ $asml = $2;
+ $asmr = $1;
+ } else {
+ $asml = $1;
+ $asmr = $2;
+ }
+
+ $asml = $offsets[$asml - 1];
+ $asmr = $offsets[$asmr - 1];
+
+ if ($orient == 1){
+ my $tmpr = $contiglen - $asml;
+ my $tmpl = $contiglen - $asmr;
+ $asml = $tmpl;
+ $asmr = $tmpr;
+ }
+ while (exists $eventcoord{$asml}){
+ $asml += 0.001;
+ }
+ while (exists $eventcoord{$asmr}){
+ $asmr += 0.001;
+ }
+
+ $eventcoord{$asml} = "B";
+ $eventcoord{$asmr} = "E";
+ }
+ } # for each rec
+
+ process_contig("$scaffold" . "$id");
+} # doCCO
+
+sub process_contig {
+ my $ctg = shift;
+ if ($map){
+ print ">$ctg\n";
+ }
+
+ my $cvg = 0;
+ my $start = 0;
+ my $ss = 0;
+ my $se = 0;
+ my $end = 0;
+ my $piece = 0;
+ my $coverages = 0;
+ my $maxcvg = 0;
+ foreach my $coord (sort {$a <=> $b} keys (%eventcoord)){
+ if ($eventcoord{$coord} eq "B"){
+ if ($summary){
+ $coverages += $cvg * ($coord - $ss);
+ $ss = $coord;
+ }
+ if ($map) {
+ if (POSIX::floor($coord) != POSIX::floor($ss)) {
+ printf ("%d %d %d\n", POSIX::floor($ss), POSIX::floor($coord), int($cvg));
+ }
+ $ss = $coord;
+ }
+ $cvg++;
+ if ($start == 0 && $cvg >= $MIN_CVG){
+ $start = $coord;
+ }
+ } # if beginning
+
+ if ($eventcoord{$coord} eq "E"){
+ if ($summary){
+ $coverages += $cvg * ($coord - $ss);
+ if ($maxcvg == 0 || $cvg > $maxcvg){
+ $maxcvg = $cvg;
+ }
+ $ss = $coord;
+ }
+ if ($map){
+ if (POSIX::floor($coord) != POSIX::floor($ss)){
+ printf ("%d %d %d\n", POSIX::floor($ss), POSIX::floor($coord), int($cvg));
+ }
+ $ss = $coord;
+ }
+ $cvg--;
+ if ($start != 0 && $cvg < $MIN_CVG){
+ $end = $coord;
+
+ if (! $summary && ! $map){
+ $piece++;
+ printFastaSequence(\*OUT,
+ "${ctg}_${piece} $start $end",
+ substr($seq, $start, $end - $start));
+ }
+ $start = $end = 0;
+ }
+ } # if end
+ } # foreach
+
+ if ($ss < $contiglen && $map){
+ printf ("%d %d %d\n", POSIX::floor($ss), $contiglen, int($cvg));
+ }
+ if ($summary){
+ print "$ctg $contiglen ", ($coverages / $contiglen), " ", $maxcvg, "\n";
+ }
+} # process_contig
+
+
+
+
+
diff --git a/src/Utils/cvgStat.cc b/src/Utils/cvgStat.cc
new file mode 100644
index 0000000..bf1740c
--- /dev/null
+++ b/src/Utils/cvgStat.cc
@@ -0,0 +1,527 @@
+// $Revision$
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+// C includes
+#include <getopt.h>
+
+// STL includes
+#include <map>
+#include <string>
+#include <vector>
+
+// AMOS includes
+#include "Contig_AMOS.hh"
+#include "BankStream_AMOS.hh"
+#include "Bank_AMOS.hh"
+#include "Layout_AMOS.hh"
+#include "Fragment_AMOS.hh"
+#include "Library_AMOS.hh"
+#include "Index_AMOS.hh"
+
+using namespace std;
+using namespace AMOS;
+using namespace HASHMAP;
+
+#define endl "\n" // die endl, die!
+
+map<string, string> globals; // global variables
+
+
+void printHelpText()
+{
+ cout <<
+ "cvgStat -b bank [-lay|-ctg] [-red|-frg]> file.cvg\n"
+ "\n"
+ "-b bank - name of bank to be used\n"
+ "-lay - computes coverage of layout messages\n"
+ "-ctg - computes coverage of contig messages (default)\n"
+ "-scaff - computes coverage of scaffolds\n"
+ "-red - computes read coverage (default)\n"
+ "-frg - computes fragment/clone coverage\n"
+ "-rdfrg - computes difference between fragment and read coverages\n"
+ "-iid - headers are iids\n"
+ "-eid - headers are eids\n"
+ << endl;
+} // printHelpText
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"b", 1, 0, 'b'},
+ {"lay", 0, 0, 'l'},
+ {"ctg", 0, 0, 'c'},
+ {"scaff", 0, 0, 's'},
+ {"red", 0, 0, 'r'},
+ {"frg", 0, 0, 'f'},
+ {"rdfrg", 0, 0, 'd'},
+ {"iid", 0, 0, 'i'},
+ {"eid", 0, 0, 'e'},
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {0, 0, 0, 0}
+ };
+
+ bool helpRequested = false;
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1){
+ switch (c){
+ case 'b':
+ globals["bank"] = string(optarg);
+ break;
+ case 'l':
+ globals["layouts"] = "true";
+ break;
+ case 'c':
+ globals["contigs"] = "true";
+ break;
+ case 'r':
+ globals["reads"] = "true";
+ break;
+ case 'f':
+ globals["fragments"] = "true";
+ break;
+ case 'd':
+ globals["frgnoread"] = "true";
+ globals["fragments"] = "true";
+ break;
+ case 'i':
+ globals["byiid"] = "true";
+ break;
+ case 'e':
+ globals["byeid"] = "true";
+ break;
+ case 's':
+ globals["scaff"] = "true";
+ break;
+ case 'h':
+ // printHelpText();
+ helpRequested = true;
+ break;
+ case '?':
+ return false;
+ }
+ } // while each parameter
+
+ if (helpRequested){
+ printHelpText();
+ exit(0);
+ } // if help
+
+ if (optind < argc){
+ globals["input"] = string(argv[optind]);
+ }
+
+ return true;
+} // GetOptions
+
+
+
+//--------------------------------------------------------
+int main(int argc, char ** argv)
+{
+ bool doLay = false;
+ bool doCtg = true;
+ bool doRed = true;
+ bool doFrg = false;
+ bool doScaff = false;
+
+ if (!GetOptions(argc, argv)){
+ cerr << "Command line parsing failed, use -h option for usage info"
+ << endl;
+ //printHelpText();
+ exit(1);
+ }
+
+ if (globals.find("layouts") != globals.end()) {
+ doLay = true;
+ doCtg = false;
+ doScaff = false;
+ }
+ if (globals.find("contigs") != globals.end()) {
+ doCtg = true;
+ doLay = false;
+ doScaff = false;
+ }
+ if (globals.find("fragments") != globals.end()) {
+ doFrg = true;
+ doRed = false;
+ }
+ if (globals.find("reads") != globals.end()) {
+ doRed = true;
+ doFrg = false;
+ }
+ if (globals.find("scaff") != globals.end()) {
+ doCtg = false;
+ doLay = false;
+ doScaff = true;
+ }
+
+ BankStream_t contig_stream (Contig_t::NCODE);
+ Bank_t contig_bank (Contig_t::NCODE);
+ BankStream_t scaffold_stream (Scaffold_t::NCODE);
+ BankStream_t layout_stream (Layout_t::NCODE);
+ Bank_t fragment_bank (Fragment_t::NCODE);
+ BankStream_t library_stream (Library_t::NCODE);
+
+ if (globals.find("bank") == globals.end()){
+ cerr << "A bank must be specified with option -b" << endl;
+ exit(1);
+ }
+
+ if (doCtg) {
+ try {
+ if (! contig_stream.exists(globals["bank"])){
+ cerr << "Cannot find a contig account in bank: " << globals["bank"] << endl;
+ exit(1);
+ }
+ contig_stream.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open contig account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ } // if doCtg
+
+ if (doLay) {
+ try {
+ if (! layout_stream.exists(globals["bank"])){
+ cerr << "Cannot find a layout account in bank: " << globals["bank"] << endl;
+ exit(1);
+ }
+ layout_stream.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open layout account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ } // if doLay
+
+
+ if (doScaff) {
+ try {
+ if (! scaffold_stream.exists(globals["bank"])) {
+ cerr << "Cannot find a scaffold account in bank: " << globals["bank"] << endl;
+ exit(1);
+ }
+ scaffold_stream.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open scaffold account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ try {
+ if (! contig_bank.exists(globals["bank"])) {
+ cerr << "Cannot find a contig account in bank: " << globals["bank"] << endl;
+ exit(1);
+ }
+ contig_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open contig account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ } // if doScaff
+
+ map <ID_t, Distribution_t> lib2dist; // map from libid to distribution
+ Index_t rd2mate; // mate pair index
+ Index_t rd2lib; // read to library index
+
+ if (doFrg) {
+ try {
+ if (! fragment_bank.exists(globals["bank"])){
+ cerr << "Cannot find a fragment account in bank: " << globals["bank"] << endl;
+ exit(1);
+ }
+ fragment_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open fragment account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ try {
+ if (! library_stream.exists(globals["bank"])){
+ cerr << "Cannot find a library account in bank: " << globals["bank"] << endl;
+ exit(1);
+ }
+ library_stream.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open library account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ // populate a libid 2 distribution map
+ Library_t lib;
+ while (library_stream >> lib)
+ lib2dist[lib.getIID()] = lib.getDistribution();
+
+ library_stream.close();
+
+ // build mate pair index
+ try {
+ rd2mate.buildReadMate(globals["bank"]);
+ rd2lib.buildReadLibrary(globals["bank"]);
+ } catch (const Exception_t & e) {
+ cerr << "ERROR: " << e.what() << endl
+ << " could not collect mate pair info\n";
+ exit(1);
+ }
+ } // if doFrg
+
+ // go through the bank one contig at a time
+ while (true) {
+ vector<Tile_t> tv; // vector of tiles
+ Pos_t len = 0; // length of layout or contig
+
+ if (doLay) {
+ Layout_t lay;
+
+ layout_stream >> lay;
+
+ if (layout_stream.eof()) // emptied bank
+ break;
+
+ if (lay.getEID() != "" && globals.find("byiid") == globals.end()){
+ cout << ">" << lay.getEID() << " LAY iid:" << lay.getIID() << endl;
+ } else if (lay.getIID() != 0 && globals.find("byeid") == globals.end()){
+ cout << ">" << lay.getIID() << " LAY eid:" << lay.getEID() << endl;
+ } else
+ continue; // no id, no output
+
+ tv = lay.getTiling();
+ }
+
+ if (doCtg) {
+ Contig_t ctg;
+
+ contig_stream >> ctg;
+
+ if (contig_stream.eof()) // emptied bank
+ break;
+
+ if (ctg.getEID() != "" && globals.find("byiid") == globals.end()){
+ cout << ">" << ctg.getEID() << " CTG iid:" << ctg.getIID() << endl;
+ } else if (ctg.getIID() != 0 && globals.find("byeid") == globals.end()){
+ cout << ">" << ctg.getIID() << " CTG eid:" << ctg.getEID() << endl;
+ } else
+ continue; // no id, no output
+
+ tv = ctg.getReadTiling();
+ len = ctg.getLength();
+ }
+
+ if (doScaff) {
+ Scaffold_t scf;
+
+ scaffold_stream >> scf;
+
+ if (scaffold_stream.eof()) // emptied bank
+ break;
+
+ len = scf.getSpan();
+
+ if (scf.getEID() != "" && globals.find("byiid") == globals.end()){
+ cout << ">" << scf.getEID() << " SCF iid:" << scf.getIID() << endl;
+ } else if (scf.getIID() != 0 && globals.find("byeid") == globals.end()){
+ cout << ">" << scf.getIID() << " SCF eid:" << scf.getEID() << endl;
+ } else
+ continue; // no id, no output
+
+ for (vector<Tile_t>::iterator ti = scf.getContigTiling().begin();
+ ti != scf.getContigTiling().end(); ti++) { // for each contig
+ Tile_t tle;
+ Contig_t ctg;
+
+ try {
+ contig_bank.fetch(ti->source, ctg);
+ } catch (Exception_t & e)
+ {
+ cerr << "Can't find contig " << ti->source << " in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ for (vector<Tile_t>::iterator cti = ctg.getReadTiling().begin();
+ cti != ctg.getReadTiling().end(); cti++) {
+ tle = *cti;
+ if (ti->range.isReverse()) {
+ tle.range.swap();
+ tle.offset = ti->offset + ctg.getLength()
+ - tle.offset - tle.getGappedLength();
+ } else { // forward tile
+ tle.offset += ti->offset;
+ }
+ tv.push_back(tle);
+ } // for each tile in contig
+ } // for each contig
+ } // if doScaff
+
+ // now we just have a tiling of reads.
+ // need to convert it to pairs of coords on the contig/layout
+ vector<Pos_t> starts;
+ vector<Pos_t> ends;
+ starts.reserve(tv.size()); // we'll need at most as many spaces as tiles
+ ends.reserve(tv.size());
+
+ if (doFrg) { // this will take some work to convert from mates to a tile
+ hash_map<ID_t, Range_t, hash<ID_t>, equal_to<ID_t> > rd2tile;
+ for (vector<Tile_t>::iterator ti = tv.begin(); ti != tv.end(); ti++) {
+ Range_t rng = ti->range;
+
+ // offset is always leftmost point
+ // adjust range for gaps
+ if (ti->range.begin < ti->range.end) {
+ rng.begin = ti->offset;
+ rng.end = ti->getGappedLength() + ti->offset;
+ } else {
+ rng.end = ti->offset;
+ rng.begin = ti->getGappedLength() + ti->offset;
+ }
+
+ rd2tile[ti->source] = rng;
+ }
+
+ // second pass through tiles, this time for real
+ for (vector<Tile_t>::iterator ti = tv.begin(); ti != tv.end(); ti++) {
+ // cerr << "REad " << ti->source << " has mate " << rd2mate.lookup(ti->source) << endl;
+ // cerr << "At coords " << rd2tile[ti->source].begin << ", " << rd2tile[ti->source].end << endl;
+ if (rd2mate.lookup(ti->source) != NULL_ID &&
+ rd2mate.lookup(ti->source) < ti->source) { // only do this for mate with lowest iid
+ if (rd2lib.lookup(ti->source) == NULL_ID) {
+ cerr << "No library for read with IID: " << ti->source << endl;
+ exit(1);
+ }
+
+ Distribution_t dist = lib2dist[rd2lib.lookup(ti->source)];
+ ID_t mate = rd2mate.lookup(ti->source);
+ Range_t rngA = rd2tile[ti->source];
+
+ if (rd2tile.find(mate) == rd2tile.end()) // skip fragment
+ continue;
+
+ Range_t rngB = rd2tile[mate];
+
+ // cerr << "Got " << rngA.begin << ", " << rngA.end << ": " << rngB.begin << ", " << rngB.end << endl;
+
+ int oriA = (rngA.begin < rngA.end) ? 1 : -1;
+ int oriB = (rngB.begin < rngB.end) ? 1 : -1;
+
+ if (oriA == oriB) { // not a valid mate
+ // cerr << "ORI\n";
+ continue;
+ }
+
+ if (oriA == 1 && (rngB.begin < rngA.begin || rngB.end < rngA.begin)) {
+ // cerr << "OUTIE B before A\n";
+ continue; // if A is forward, B must occur after it
+ }
+
+ if (oriB == 1 && (rngA.begin < rngB.begin || rngA.end < rngB.end)) {
+ // cerr << "OUTIE A before B\n";
+ continue; // if B is forward, A must occur after it
+ }
+
+ // otherwise this is a happy-ish mate
+ // calculate location of fragment in contig
+ int min = (oriA == 1) ? rngA.begin : rngB.begin;
+ int max = (oriA == 1) ? rngB.begin : rngA.begin;
+
+ int unreadmin = (oriA == 1) ? rngA.end : rngB.end;
+ int unreadmax = (oriA == 1) ? rngB.end : rngA.end;
+
+ if (unreadmin > unreadmax){
+ int tmp = unreadmin;
+ unreadmin = unreadmax;
+ unreadmax = tmp;
+ }
+
+ // cerr << "Min = " << min << " Max = " << max << endl;
+ assert (min < max);
+
+ if (abs(max - min - dist.mean) > 3 * dist.sd) {
+ // cerr << "too short/long\n";
+ continue; // mate too short or too long
+ }
+
+ // add to list of intervals
+ if (globals.find("frgnoread") != globals.end()){
+ starts.push_back(unreadmin);
+ ends.push_back(unreadmax);
+ } else {
+ starts.push_back(min);
+ ends.push_back(max);
+ }
+ } // if good matepair
+ } // for each tile
+ } else { // just the reads....easy
+ for (vector<Tile_t>::iterator ti = tv.begin(); ti != tv.end(); ti++) {
+ starts.push_back(ti->offset);
+ ends.push_back(ti->offset + ti->getGappedLength());
+ if (len < ti->offset + ti->getGappedLength())
+ len = ti->offset + ti->getGappedLength(); // adjust length if too short (e.g. layout)
+ }
+ }// if doFrg
+
+ // here we actually compute the coverage and we're done!
+ sort(starts.begin(), starts.end(), less<Pos_t>());
+ sort(ends.begin(), ends.end(), less<Pos_t>());
+
+ vector<Pos_t>::iterator si, ei; // iterators in start and end arrays
+ si = starts.begin(); ei = ends.begin();
+ int cvg = 0; // cumulative coverage stat
+ Pos_t last = 0; // last change in coverage
+
+ while (si != starts.end() && ei != ends.end()){
+ if (*si <= *ei) { // hit a start
+ //if (*si != 0 || si != starts.begin())
+ if (*si != last)
+ cout << last << "\t" << *si << "\t" << cvg << endl;
+ cvg++;
+ last = *si;
+ si++;
+ } else { // hit an end
+ if (*ei != last)
+ cout << last << "\t" << *ei << "\t" << cvg << endl;
+ cvg--;
+ last = *ei;
+ ei++;
+ }
+ }
+
+ assert (si == starts.end()); // if tile is correct we have finished the starts
+
+ while (ei != ends.end()) {
+ if (*ei != last)
+ cout << last << "\t" << *ei << "\t" << cvg << endl;
+ cvg--;
+ last = *ei;
+ ei++;
+ }
+
+ if (last < len) // 0x coverage at end of contig
+ cout << last << "\t" << len << "\t" << 0 << endl;
+
+ } // while true
+
+ // clean up
+ if (doCtg)
+ contig_stream.close();
+ if (doLay)
+ layout_stream.close();
+ if (doFrg) {
+ fragment_bank.close();
+ library_stream.close();
+ }
+ exit(0);
+} // main
diff --git a/src/Utils/delta2clr.pl b/src/Utils/delta2clr.pl
new file mode 100755
index 0000000..3be2f58
--- /dev/null
+++ b/src/Utils/delta2clr.pl
@@ -0,0 +1,146 @@
+#!/usr/bin/perl
+
+
+use strict;
+use warnings;
+
+# TIGR Modules
+use TIGR::Foundation;
+
+my $tigr_tf = new TIGR::Foundation;
+my $PRG = $tigr_tf->getProgramInfo('name');
+my $REV="1.0";
+my @DEPENDS=("TIGR::Foundation");
+
+# help info
+my $HELPTEXT = qq~
+Program that computes read clear ranges based on alignment coordinates
+
+Usage: $PRG < delta_file [options]
+
+ INPUT:
+ Mummer delta file
+
+ options:
+
+ -zero_cvg file - File that contain zero coverage regions;
+ reads ending in these regions won't get trimmed
+
+ -h|help - Print this help and exit;
+ -V|version - Print the version and exit;
+ -depend - Print the program and database dependency list;
+ -debug <level> - Set the debug <level> (0, non-debug by default);
+
+ OUTPUT:
+ Delta at the console
+~;
+
+my $MOREHELP = qq~
+Return Codes: 0 - on success, 1 - on failure.
+~;
+
+###############################################################################
+#
+# Main program
+#
+###############################################################################
+
+MAIN:
+{
+ my %options;
+ my $is_zero_cvg=0;
+
+ # Configure TIGR Foundation
+ $tigr_tf->setHelpInfo($HELPTEXT.$MOREHELP);
+ $tigr_tf->setUsageInfo($HELPTEXT);
+ $tigr_tf->setVersionInfo($REV);
+ $tigr_tf->addDependInfo(@DEPENDS);
+
+ # validate input parameters
+ my $result = $tigr_tf->TIGR_GetOptions(
+ "zero_cvg=s" => \$options{zero_cvg}
+ );
+
+ $tigr_tf->printUsageInfoAndExit() unless($result);
+
+ ########################################################################
+
+ # read zero coverage coordinates
+ my %zero_cvg;
+ if(defined($options{zero_cvg}))
+ {
+ open(IN,$options{zero_cvg}) or die $!;
+ while(<IN>)
+ {
+ my @f=split;
+ next unless(@f);
+ $zero_cvg{$f[0]}{$f[1]}=1;
+ $zero_cvg{$f[0]}{$f[2]}=1;
+ }
+ close(IN);
+ }
+
+ ########################################################################
+
+ my ($ref,$id,$read_len);
+ my (%min,%max);
+
+ # read the alignmnet delta file
+ while(<>)
+ {
+ #>1 gnl|ti|185591439 3256683 909
+ #3252989 3253871 16 909 19 19 0
+ #-44
+ #5
+ #0
+ #=> 3256683 16 909
+
+ #>gi|116048575|ref|NC_008463.1| 52 6537648 33
+ #287894 287914 21 1 0 0 0
+ #0
+ #1554749 1554781 1 33 1 1 0
+ #0
+ #4001147 4001167 1 21 0 0 0
+ #0
+ #4842167 4842192 6 31 0 0 0
+ #0
+ #=> 52 1 33
+
+ my @f=split;
+
+ if(/^>/)
+ {
+ $ref=$f[0]; $ref=~s/>//;
+ $id=$f[1];
+ $read_len=$f[3];
+ }
+ elsif(scalar(@f)==7)
+ {
+ if($zero_cvg{$ref}{$f[0]})
+ {
+ if($f[2]<$f[3]) { $f[2]=1; }
+ else { $f[2]=$read_len; }
+ }
+
+ if($zero_cvg{$ref}{$f[1]})
+ {
+ if($f[2]<$f[3]) { $f[3]=$read_len; }
+ else { $f[3]=1; }
+ }
+
+ ($f[2],$f[3])=($f[3],$f[2]) if($f[2]>$f[3]);
+ $f[2]--;
+
+ $min{$id}=$f[2] if(!defined($min{$id}) or $f[2]<$min{$id});
+ $max{$id}=$f[3] if(!defined($max{$id}) or $f[3]>$max{$id});
+ }
+ }
+
+ foreach $id (keys %min)
+ {
+ print join " ",($id,$min{$id},$max{$id});
+ print "\n"
+ }
+
+ exit 0;
+}
diff --git a/src/Utils/delta2cvg.pl b/src/Utils/delta2cvg.pl
new file mode 100755
index 0000000..36ed7a6
--- /dev/null
+++ b/src/Utils/delta2cvg.pl
@@ -0,0 +1,129 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+# TIGR Modules
+use TIGR::Foundation;
+
+my $tigr_tf = new TIGR::Foundation;
+my $PRG = $tigr_tf->getProgramInfo('name');
+my $REV="1.0";
+my @DEPENDS=("TIGR::Foundation");
+
+# help info
+my $HELPTEXT = qq~
+Program that computes alignment coverage from a Mummer delta file
+
+Usage: $PRG < delta_file [options]
+
+ INPUT:
+ delta_file
+
+ #>Streptococcus_suis 2_14_26_F3 2007491 46
+ #1282180 1282217 39 2 0 0 0
+ #0
+ #>Streptococcus_suis 2_14_233_F3 2007491 46
+ #1082721 1082752 33 2 0 0 0
+ #0
+
+
+ options:
+ -m <n> - Min coverage to display
+ -M <n> - Max coverage to display
+ -merge - Merge coverage intervals
+
+ -h|help - Print this help and exit;
+ -V|version - Print the version and exit;
+ -depend - Print the program and database dependency list;
+ -debug <level> - Set the debug <level> (0, non-debug by default);
+
+ OUTPUT:
+ Example:
+ J28690Ab07.q1k 1 9 0
+ J28690Ab07.q1k 9 112 1
+ J28690Ab07.q1k 112 951 2
+ ....
+~;
+
+my $MOREHELP = qq~
+Return Codes: 0 - on success, 1 - on failure.
+~;
+
+###############################################################################
+#
+# Main program
+#
+###############################################################################
+
+MAIN:
+{
+ # Configure TIGR Foundation
+ $tigr_tf->setHelpInfo($HELPTEXT.$MOREHELP);
+ $tigr_tf->setUsageInfo($HELPTEXT);
+ $tigr_tf->setVersionInfo($REV);
+ $tigr_tf->addDependInfo(@DEPENDS);
+
+ # validate input parameters
+ my %options;
+ my %count;
+ my $ref;
+
+ my $result = $tigr_tf->TIGR_GetOptions(
+ "m=s" => \$options{m},
+ "M=s" => \$options{M},
+ "merge" => \$options{merge}
+ );
+ $tigr_tf->printUsageInfoAndExit() if (!$result);
+
+ ############################################################
+ # parse input file
+ while(<>)
+ {
+ #>Streptococcus_suis 2_14_26_F3 2007491 46
+ #1282180 1282217 39 2 0 0 0
+ #0
+ #>Streptococcus_suis 2_14_233_F3 2007491 46
+ #1082721 1082752 33 2 0 0 0
+ #0
+
+ my @f=split;
+
+ if(/^\// or /^NUCMER/) {}
+ elsif(/^>/)
+ {
+ $f[0]=~s/>//;
+
+ $ref=$f[0];
+
+ $count{$ref}{1}+=0;
+ $count{$ref}{$f[2]}+=0;
+ }
+ elsif(scalar(@f)==7)
+ {
+ $count{$ref}{$f[0]}++;
+ $count{$ref}{$f[1]}--;
+ }
+ }
+
+ #####################################################################
+
+ foreach my $ref (keys %count)
+ {
+ my @keys=sort {$a <=> $b} keys %{$count{$ref}};
+ my $n=scalar(@keys);
+
+ foreach my $i (1..$n-1)
+ {
+ $count{$ref}{$keys[$i]}+=$count{$ref}{$keys[$i-1]};
+
+ next if(defined($options{m}) and $count{$ref}{$keys[$i-1]}<$options{m});
+ next if(defined($options{M}) and $count{$ref}{$keys[$i-1]}>$options{M});
+
+ print join "\t",($ref,$keys[$i-1],$keys[$i],$keys[$i]-$keys[$i-1],$count{$ref}{$keys[$i-1]});
+ print "\n";
+ }
+ }
+
+ exit 0;
+}
diff --git a/src/Utils/fasta_select_len.pl b/src/Utils/fasta_select_len.pl
new file mode 100755
index 0000000..7a0a758
--- /dev/null
+++ b/src/Utils/fasta_select_len.pl
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+
+use TIGR::Foundation;
+use AMOS::ParseFasta;
+
+$tf = new TIGR::Foundation;
+
+if (!defined $tf){
+ die ("Bad foundation\n");
+}
+
+if ((scalar @ARGV == 0) || ($ARGV[0] eq '-h') || ($ARGV[0] =~ /\D/)) {
+ die "Select sequences at least the specified length\nUSAGE: $0 min_len [fasta_file1] [fasta_file2] ... [fasta_filen] \n";
+}
+
+my $MIN_LEN = shift @ARGV;
+
+sub report
+{
+ my $fr = shift;
+
+ die ("Bad reader\n")
+ if (!defined $fr);
+
+ while (($head, $body) = $fr->getRecord())
+ {
+ if (length($body) >= $MIN_LEN)
+ {
+ print ">$head\n$body\n";
+ }
+ }
+}
+
+
+if (scalar @ARGV == 0)
+{
+ $fr = new AMOS::ParseFasta(\*STDIN);
+ report($fr);
+}
+else
+{
+ foreach my $file (@ARGV)
+ {
+ open(IN, $file) || $tf->bail("Cannot open $file: $!\n");
+ $fr = new AMOS::ParseFasta(\*IN);
+ report($fr);
+ }
+}
+
diff --git a/src/Utils/fasta_to_fastq.pl b/src/Utils/fasta_to_fastq.pl
new file mode 100755
index 0000000..ab46179
--- /dev/null
+++ b/src/Utils/fasta_to_fastq.pl
@@ -0,0 +1,54 @@
+#!/usr/bin/perl -w
+use strict;
+use Getopt::Long;
+
+my $QV = "^";
+
+my $USAGE = "fasta_to_fastq [options] reads.fa > reads.fq";
+my $help;
+
+my $res = GetOptions("help" => \$help,
+ "qv=n" => \$QV);
+
+if ($help || !$res)
+{
+ print $USAGE;
+ print "\n";
+ print "Convert fasta sequences to fastq, assigning fake quality values for the bases\n";
+ print "Options\n";
+ print " -qv <q> : Assign this as the fake quality values (default: \'$QV\')\n";
+ exit 0;
+}
+
+my $header = undef;
+my $seq = undef;
+
+sub printFastq
+{
+ return if !defined $header;
+
+ print "\@$header\n";
+ print "$seq\n";
+ print "+\n";
+ print $QV x length($seq);
+ print "\n";
+}
+
+while (<>)
+{
+ chomp;
+
+ if (/>(\S+)/)
+ {
+ printFastq();
+
+ $header = $1;
+ $seq = "";
+ }
+ else
+ {
+ $seq .= $_;
+ }
+}
+
+printFastq();
diff --git a/src/Utils/fastq_rename.pl b/src/Utils/fastq_rename.pl
new file mode 100755
index 0000000..af6d449
--- /dev/null
+++ b/src/Utils/fastq_rename.pl
@@ -0,0 +1,63 @@
+#!/usr/bin/perl -w
+use strict;
+use Getopt::Long;
+
+## Options
+my $RENUM;
+my $PREFIX = "";
+my $SUFFIX = "";
+my $TR_INPUT;
+my $TR_OUTPUT = "_";
+
+my $USAGE = "fastq_rename [options] orig.fq > new.fq\n";
+
+my $help = 0;
+
+my $res = GetOptions("help" => \$help,
+ "renum" => \$RENUM,
+ "prefix=s" => \$PREFIX,
+ "suffix=s" => \$SUFFIX,
+ "tr=s" => \$TR_INPUT,
+ "tr_out=s" => \$TR_OUTPUT,
+ );
+
+if ($help || !$res)
+{
+ print $USAGE;
+ print " Rename the reads in a fastq file to become <prefix> [number or name] <suffix>\n";
+ print " If not renumbering, use -tr to replace characters with -trc in name\n";
+ print "\n";
+ print "Options:\n";
+ print " -prefix <str> : add prefix to each readname\n";
+ print " -renum : replace the readname as a sequential number 1,2,...,E,F,10,11...\n";
+ print " -tr <str> : replace these characters in the readname\n";
+ print " -trc <str> : when replacing, replace with this (default: $TR_OUTPUT)\n";
+ print " -suffix <str> : add suffix to each readname\n";
+ exit 0;
+}
+
+my $c = 0;
+while (<>)
+{
+ $c++;
+
+ die "ERROR: Malformed fastq format, expected '\@' saw $_"
+ if (substr($_, 0, 1) ne "\@");
+
+ if ($RENUM)
+ {
+ printf "\@$PREFIX%X$SUFFIX\n", $c;
+ }
+ else
+ {
+ chomp;
+
+ $_ = substr($_,1); ## skip the leading '@'
+ $_ =~ s/$TR_INPUT/$TR_OUTPUT/g if (defined $TR_INPUT);
+ print "\@$PREFIX$_$SUFFIX\n";
+ }
+
+ my $seq = <>; print $seq;
+ my $h2 = <>; print "+\n";
+ my $qv = <>; print $qv;
+}
diff --git a/src/Utils/fastq_to_fasta_fast.pl b/src/Utils/fastq_to_fasta_fast.pl
new file mode 100755
index 0000000..b0dfbe9
--- /dev/null
+++ b/src/Utils/fastq_to_fasta_fast.pl
@@ -0,0 +1,16 @@
+#!/usr/bin/perl
+
+## Warning no santity checking, just blindly outputs the name and sequence
+
+while (<>)
+{
+ my $h1 = $_;
+ my $s = <>;
+ my $h2 = <>;
+ my $q = <>;
+
+ die "ERROR: expected '@' but saw $h1" if substr($h1, 0, 1) != '@';
+
+ print ">", substr($h1,1);
+ print $s;
+}
diff --git a/src/Utils/fastqqc.pl b/src/Utils/fastqqc.pl
new file mode 100755
index 0000000..70756ed
--- /dev/null
+++ b/src/Utils/fastqqc.pl
@@ -0,0 +1,233 @@
+#!/usr/bin/perl -w
+# Calculate and print "average" quality values for each position in a
+# Solexa FASTQ file.
+
+use strict;
+use Getopt::Long;
+
+my $USAGE = "fastqqc.pl [-c numreads] [-r readlen] [-tsv] fq\n";
+
+my $readlen = 75;
+my $cutoff = undef;
+my $printqvstats = 0;
+my $dotsv = 0;
+
+my $result = GetOptions(
+ "c=s" => \$cutoff,
+ "r=s" => \$readlen,
+ "qv" => \$printqvstats,
+ "tsv" => \$dotsv,
+);
+
+
+my $filename = shift @ARGV or die $USAGE;
+open(FQ, $filename) || die "Could not open .fq";
+
+print STDERR "Analyzing $cutoff reads\n" if defined $cutoff;
+
+## Initialize
+#####################################################################
+
+my $reads = 0;
+my $bpsum = 0;
+
+my @mins;
+my @maxs;
+my @tots;
+
+my @nsPerRead;
+my @posCnts;
+
+for (my $i = 0; $i < $readlen; $i++)
+{
+ $mins[$i] = 255;
+ $maxs[$i] = 0;
+ $tots[$i] = 0;
+
+ $nsPerRead[$i] = 0;
+
+ $posCnts[$i]->[0] = 0; ## A
+ $posCnts[$i]->[1] = 0; ## C
+ $posCnts[$i]->[2] = 0; ## G
+ $posCnts[$i]->[3] = 0; ## T
+ $posCnts[$i]->[4] = 0; ## N
+}
+
+
+## Scan the reads
+#####################################################################
+
+my $i = 0;
+while(<FQ>)
+{
+ $i++;
+
+ if (($i % 4) == 1)
+ {
+ die "ERROR Line $i: Expected @ but saw \"$_\"" if !/^@/;
+ }
+ elsif (($i % 4) == 3)
+ {
+ die "ERROR Line $i Expected + but saw \"$_\"" if !/^\+/;
+ }
+ elsif(($i % 4) == 2)
+ {
+ chomp;
+
+ # Sequence line
+ $_ = uc($_);
+ $bpsum += length($_);
+
+ my $ns = 0;
+
+ for(my $i = 0; $i < length($_) && $i < $readlen; $i++)
+ {
+ my $c = substr($_, $i, 1);
+
+ if ($c eq 'A') { $posCnts[$i]->[0]++; }
+ elsif ($c eq 'C') { $posCnts[$i]->[1]++; }
+ elsif ($c eq 'G') { $posCnts[$i]->[2]++; }
+ elsif ($c eq 'T') { $posCnts[$i]->[3]++; }
+ else { $posCnts[$i]->[4]++; $ns++; }
+ }
+
+ $nsPerRead[$ns]++;
+ }
+ else
+ {
+ # Quality line
+ for(my $i = 0; $i < length($_) && $i < $readlen; $i++)
+ {
+ my $oi = (ord(substr($_, $i, 1)));
+ $tots[$i] += $oi;
+
+ if($oi < $mins[$i]) { $mins[$i] = $oi; }
+ if($oi > $maxs[$i]) { $maxs[$i] = $oi; }
+ }
+
+ $reads++;
+ }
+
+ last if (defined $cutoff) && ($reads >= $cutoff);
+}
+
+my $bp = sprintf("%0.2f", $bpsum/$reads);
+print "Analyzed $reads $bp bp reads\n" if !$dotsv;
+
+
+## QV statistics
+#####################################################################
+
+if ($printqvstats)
+{
+ # Print averages
+ print "Average:\n";
+ my $istr = "";
+ my $i33str = "";
+ my $i64str = "";
+ for(my $i = 0; $i < $readlen; $i++) {
+ last if $tots[$i] == 0;
+ my $q = $tots[$i] * 1.0 / $reads;
+ my $rq = int($q + 0.5);
+ print chr($rq);
+ $istr .= "$rq ";
+ $i33str .= ($rq-33)." ";
+ $i64str .= ($rq-64)." ";
+ }
+ print "\n$istr\n\n$i33str\n\n$i64str\n";
+ print "\n";
+
+ # Print mins
+ print "Min:\n";
+ $istr = "";
+ $i33str = "";
+ $i64str = "";
+ for(my $i = 0; $i < $readlen; $i++) {
+ print chr($mins[$i]);
+ my $rq = $mins[$i];
+ $istr .= "$rq ";
+ $i33str .= ($rq-33)." ";
+ $i64str .= ($rq-64)." ";
+ }
+ print "\n$istr\n\n$i33str\n\n$i64str\n";
+ print "\n";
+
+ # Print maxs
+ print "Max:\n";
+ $istr = "";
+ $i33str = "";
+ $i64str = "";
+ for(my $i = 0; $i < $readlen; $i++) {
+ print chr($maxs[$i]);
+ my $rq = $maxs[$i];
+ $istr .= "$rq ";
+ $i33str .= ($rq-33)." ";
+ $i64str .= ($rq-64)." ";
+ }
+ print "\n$istr\n$i33str\n$i64str\n";
+ print "\n";
+}
+
+
+
+
+## Base Composition
+#####################################################################
+
+if ($dotsv)
+{
+ print "pos\t\%A\t\%C\t\%G\t\%T\t\%N\tQ\tN\n";
+}
+else
+{
+ print "pos\t\%A \t\%C \t\%G \t\%T \t\%N \t Q\n";
+}
+
+if ($dotsv)
+{
+ for(my $i = 0; $i < $readlen; $i++)
+ {
+ printf "%d\t", $i;
+
+ for (my $k = 0; $k < 5; $k++)
+ {
+ printf "%.1f\t", 100*$posCnts[$i]->[$k]/$reads;
+ }
+
+ my $q = $tots[$i] * 1.0 / $reads;
+ my $rq = int($q + 0.5) - 64;
+ printf "%d\t%d\n", $rq, $nsPerRead[$i];
+ }
+}
+else
+{
+ for(my $i = 0; $i < $readlen; $i++)
+ {
+ printf "%4d\t", $i+1;
+
+ for (my $k = 0; $k < 5; $k++)
+ {
+ printf "%02.1f\t", 100*$posCnts[$i]->[$k]/$reads;
+ }
+
+ my $q = $tots[$i] * 1.0 / $reads;
+ my $rq = int($q + 0.5) - 64;
+ printf "%2d\n", $rq;
+ }
+}
+
+
+## Ns per read
+#####################################################################
+
+if (!$dotsv)
+{
+ print "Ns per read:\n";
+ for (my $k = 0; $k < $readlen; $k++)
+ {
+ if ($nsPerRead[$k])
+ {
+ printf "% 4d:%d\n", $k, $nsPerRead[$k];
+ }
+ }
+}
diff --git a/src/Utils/filter_contig.pl b/src/Utils/filter_contig.pl
new file mode 100755
index 0000000..6c0de82
--- /dev/null
+++ b/src/Utils/filter_contig.pl
@@ -0,0 +1,52 @@
+#!/usr/bin/perl -w
+use strict;
+use TIGR::Foundation;
+
+my $USAGE = "Usage: filter_contig contigfile id\n";
+
+my $HELPTEXT = qq~
+Extract a specified contig id from a contig or layout file
+
+ $USAGE
+~;
+
+my $VERSION = " Version 1.00 (Build " . (qw/$Revision$/ )[1] . ")";
+
+my @DEPENDS =
+(
+ "TIGR::Foundation",
+);
+
+my $tf = new TIGR::Foundation;
+$tf->addDependInfo(@DEPENDS);
+$tf->setHelpInfo($HELPTEXT);
+$tf->setVersionInfo($VERSION);
+my $result = $tf->TIGR_GetOptions();
+
+$tf->bail("Command line parsing failed") if (!$result);
+
+my $contigname = shift @ARGV;
+my $contig_id = shift @ARGV;
+
+die $USAGE if (!defined $contigname || !defined $contig_id);
+
+my $doprint = 0;
+
+open CONTIG, "< $contigname"
+ or $tf->bail("Could't open $contigname ($!)");
+
+while (<CONTIG>)
+{
+ if (/\#\#(\S+)/)
+ {
+ last if ($doprint); # already extracted the requested id
+
+ $doprint = ($1 eq $contig_id);
+ }
+
+ print $_ if $doprint;
+}
+
+close CONTIG;
+
+$tf->bail("Id $contig_id not found") if !$doprint;
diff --git a/src/Utils/filter_seq.pl b/src/Utils/filter_seq.pl
new file mode 100755
index 0000000..42461cc
--- /dev/null
+++ b/src/Utils/filter_seq.pl
@@ -0,0 +1,150 @@
+#!/usr/bin/perl -w
+use strict;
+use TIGR::Foundation;
+use FileHandle;
+
+my $USAGE = "Usage: filter_seq good.{seq,qual,contig} copy.{seq,qual}\n";
+
+my $HELPTEXT = qq~
+Extract specified fasta records from a master file. If available, use
+the index file copy.suffix.idx to allow random access. Create the index file
+by running 'filter_seq copy.suffix -index'.
+
+ $USAGE
+
+ Options
+ -------
+ -index Create an index file of the copy file
+~;
+
+my $VERSION = " Version 1.00 (Build " . (qw/$Revision$/ )[1] . ")";
+
+my @DEPENDS =
+(
+ "TIGR::Foundation",
+);
+
+my $createindex = 0;
+
+my $tf = new TIGR::Foundation;
+$tf->addDependInfo(@DEPENDS);
+$tf->setHelpInfo($HELPTEXT);
+$tf->setVersionInfo($VERSION);
+my $result = $tf->TIGR_GetOptions('index', \$createindex);
+$tf->bail("Command line parsing failed") if (!$result);
+
+my $good = shift @ARGV || die $USAGE;
+
+if ($createindex)
+{
+ my $orig = new FileHandle "$good", "<"
+ or $tf->bail("Can't open $good ($!)");
+
+ open IDX, "> $good.idx"
+ or $tf->bail("Can't open $good.idx ($!)");
+
+ while (!$orig->eof())
+ {
+ my $pos = $orig->tell();
+ my $line = $orig->getline();
+
+ if ($line =~ /^\>(\S+)/)
+ {
+ print IDX "$1 $pos\n";
+ }
+ }
+
+ close IDX;
+}
+else
+{
+ my $copy = shift @ARGV || die $USAGE;
+
+ my %sequencelist;
+
+ ## Find the seqnames from the good list
+ open GOOD, "< $good"
+ or $tf->bail("Could't open $good ($!)");
+
+ while (<GOOD>)
+ {
+ if (/^\#(\S+)\(/ || /^\>(\S+)/)
+ {
+ $sequencelist{$1} = 1;
+ }
+ }
+ close GOOD;
+
+ if (-r "$copy.idx")
+ {
+ ## Create the index as: grep -b '>' tvg2.qual | tr -d ':' | tr '>' ' ' | awk '{print $2" "$1}' > tvg2.qual.idx
+ my %offsettable;
+
+ open IDX, "< $copy.idx"
+ or $tf->bail("Couldnt open $copy.idx ($!)");
+
+ while (<IDX>)
+ {
+ my @val = split / /, $_;
+
+ $offsettable{$val[0]} = $val[1]
+ if (exists $sequencelist{$val[0]});
+ }
+ close IDX;
+
+
+ my $copy = new FileHandle "$copy", "r"
+ or $tf->bail("Couldnt open $copy ($!)");
+
+ foreach my $seqname (keys %sequencelist)
+ {
+ if (exists $offsettable{$seqname})
+ {
+ $sequencelist{$seqname} = 0;
+
+ $copy->seek($offsettable{$seqname}, 0);
+
+ ## Print the headerline for sure
+ my $line = $copy->getline();
+ print $line;
+
+ ## loop until next record
+ $line = $copy->getline();
+ while ($line !~ /^>/)
+ {
+ print $line;
+ last if $copy->eof();
+ $line = $copy->getline();
+ }
+ }
+ }
+ }
+ else
+ {
+ ## Pull the sequences out of the copy file
+ my $printid = 0;
+
+ open COPY, "< $copy"
+ or $tf->bail("Couldnt open $copy ($!)");
+
+ while (<COPY>)
+ {
+ if (/^\>(\S+)/)
+ {
+ $printid = $sequencelist{$1};
+ $sequencelist{$1} = 0;
+ }
+
+ print $_ if $printid;
+ }
+
+ close COPY;
+ }
+
+ ## Make sure we found each id
+ foreach my $seqname (keys %sequencelist)
+ {
+ $tf->logError("$seqname in $good but not in $copy")
+ if ($sequencelist{$seqname});
+ }
+}
diff --git a/src/Utils/filterfrg.pl b/src/Utils/filterfrg.pl
new file mode 100755
index 0000000..890e98d
--- /dev/null
+++ b/src/Utils/filterfrg.pl
@@ -0,0 +1,69 @@
+#!/usr/bin/perl
+
+use AMOS::AmosLib;
+
+$frgfile = $ARGV[0];
+$listfile = $ARGV[1];
+$incl = $ARGV[2];
+
+if (! defined $incl){
+ print STDERR "Will include the sequences in $listfile\n";
+ $include = 1;
+} else {
+ print STDERR "Will exclude the sequences in $listfile\n";
+ $include = 0;
+}
+
+open(LIST, $listfile) || die ("Cannot open \"$listfile\"\n");
+while (<LIST>){
+ chomp;
+ $in{$_} = 1;
+}
+close(LIST);
+
+open(FRG, $frgfile) || die ("Cannot open $frgfile\n");
+
+my $isAMOS = 1;
+
+my %srcid;
+while ($record = getRecord(\*FRG)){
+ my ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec eq 'BAT'){
+ $isAMOS = 0;
+ }
+ if ($isAMOS == 0){
+ my $src = $$fields{src};
+ @src = split('\n', $src);
+ $src = join('', @src);
+ $srcid{$$fields{acc}} = $src;
+ if ($rec eq "FRG"){
+ if ($include && (exists $in{$$fields{acc}} || exists $in{$src})){
+ print $record;
+ } elsif (! $include && ! (exists $in{$$fields{acc}} || exists $in{$src})){
+ print $record;
+ }
+ if (! $include && (exists $in{$$fields{acc}} || exists $in{$src})){
+ print STDERR "excluding $$fields{acc}($src)\n";
+ }
+ next;
+ }
+ if ($rec eq "LKG"){
+ if ($include){
+ if ((exists $in{$$fields{fg1}} || exists $in{$srcid{$$fields{fg1}}})
+ && (exists $in{$$fields{fg2}} || exists $in{$srcid{$$fields{fg2}}})){
+ print $record;
+ }
+ } else {
+ if (! (exists $in{$$fields{fg1}} || exists $in{$srcid{$$fields{fg1}}})
+ && ! (exists $in{$$fields{fg2}} || exists $in{$srcid{$$fields{fg2}}})){
+ print $record;
+ }
+ }
+ next;
+ }
+ } elsif ($isAMOS == 1){
+
+ }
+ print $record;
+}
+
diff --git a/src/Utils/fixfastq.pl b/src/Utils/fixfastq.pl
new file mode 100755
index 0000000..676ac95
--- /dev/null
+++ b/src/Utils/fixfastq.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+
+my $USAGE = "fixfastq in.fq > out.fq\n";
+
+if ((scalar @ARGV > 0) && ($ARGV[0] eq "-h"))
+{
+ print $USAGE;
+ print " Chop the sequence or quality string to be the minimum of the two.\n";
+ print " Also replace any ambiguity codes in the reads with N\n";
+ exit 0;
+}
+
+my $trims = 0;
+my $trimq = 0;
+
+my $trimsb = 0;
+my $trimqb = 0;
+
+while (<>)
+{
+ print $_;
+ my $s = <>; chomp $s;
+ my $h2 = <>; chomp $h2;
+ my $q = <>; chomp $q;
+
+ ## clean up ambiguity codes
+ $s =~ s/[^ACGTacgtN]/N/g;
+
+ ## trim sequences or quality strings
+
+ my $sl = length($s);
+ my $ql = length($q);
+
+ if ($sl < $ql)
+ {
+ $trimq++;
+ $trimqb += $ql-$sl;
+ $q = substr($q,0,$sl);
+ }
+ elsif ($ql < $sl)
+ {
+ $trims++;
+ $trimsb += $sl-$ql;
+ $s = substr($s,0,$ql);
+ }
+
+ print "$s\n$h2\n$q\n";
+}
+
+print STDERR "trimseq: $trims $trimsb bp trimq: $trimq $trimqb bp\n";
diff --git a/src/Utils/gccontent.pl b/src/Utils/gccontent.pl
new file mode 100755
index 0000000..4b08773
--- /dev/null
+++ b/src/Utils/gccontent.pl
@@ -0,0 +1,46 @@
+#!/usr/bin/perl -w
+use strict;
+
+sub printGC
+{
+ my $seqname = shift;
+ return if !defined $seqname;
+
+ my $l = shift;
+ my $g = shift;
+ my $a = shift;
+
+ my $ratio = sprintf("%.02f", ($g+$a) ? ($g*100 / ($g + $a)) : 0);
+
+ print "$seqname $l $ratio\n";
+}
+
+my $seqname = undef;
+
+my $g = 0;
+my $a = 0;
+my $l = 0;
+
+while (<>)
+{
+ if (/^>(\S+)/)
+ {
+ printGC($seqname, $l, $g, $a);
+
+ $seqname = $1;
+
+ $l = 0;
+ $g = 0;
+ $a = 0;
+ }
+ else
+ {
+ chomp;
+
+ $l += length($_);
+ $g += tr/gGcC//;
+ $a += tr/aAtT//;
+ }
+}
+
+printGC($seqname, $l, $g, $a);
diff --git a/src/Utils/getN50.pl b/src/Utils/getN50.pl
new file mode 100755
index 0000000..ae288a0
--- /dev/null
+++ b/src/Utils/getN50.pl
@@ -0,0 +1,65 @@
+#!/usr/local/bin/perl
+
+use TIGR::Foundation;
+use AMOS::ParseFasta;
+
+$usage = "Calculate contig statistics: number, average length and N50\nUSAGE: $0 <fasta> [genome size]\n";
+
+if ( $ARGV[0] eq '-h' ) {
+ die $usage;
+}
+
+if ( scalar(@ARGV) != 1 ) {
+ if ( scalar(@ARGV) != 2 ) {
+ die $usage;
+ } else {
+ $genomesize = $ARGV[1];
+ }
+} else {
+ $genomesize = 0;
+}
+
+$tf = new TIGR::Foundation;
+
+if (!defined $tf){
+ die ("Bad foundation\n");
+}
+
+open(IN, $ARGV[0]) || $tf->bail("Cannot open $ARGV[0]: $!\n");
+$fr = new AMOS::ParseFasta(\*IN);
+
+if (!defined $fr){
+ die ("Bad reader\n");
+}
+
+ at lens = ();
+while (($head, $body) = $fr->getRecord()){
+ push @lens, length($body);
+}
+
+ at lens = sort { $b <=> $a } @lens;
+
+if ( $genomesize <= 0 ) {
+ $genomesize = 0;
+ foreach $len (@lens) {
+ $genomesize += $len;
+ }
+}
+
+$sum = 0;
+$n50 = 0;
+foreach $len (@lens) {
+ $sum += $len;
+
+ if ( $sum > $genomesize / 2 && $n50 == 0 ) {
+ $n50 = $len;
+ }
+}
+
+print "NUM ";
+print scalar(@lens);
+print "\nAVG ";
+print $sum / scalar(@lens);
+print "\nN50 ";
+print $n50;
+print "\n";
diff --git a/src/Utils/getlengths.pl b/src/Utils/getlengths.pl
new file mode 100755
index 0000000..9ecc33e
--- /dev/null
+++ b/src/Utils/getlengths.pl
@@ -0,0 +1,45 @@
+#!/usr/local/bin/perl
+
+use TIGR::Foundation;
+use AMOS::ParseFasta;
+
+$tf = new TIGR::Foundation;
+
+if (!defined $tf){
+ die ("Bad foundation\n");
+}
+
+if ($ARGV[0] eq '-h') {
+ die "Report the length of the sequences in a FASTA file. If no file is provided, standard input is used\nUSAGE: $0 [fasta_file1] [fasta_file2] ... [fasta_filen] \n";
+}
+
+sub report
+{
+ my $fr = shift;
+
+ die ("Bad reader\n")
+ if (!defined $fr);
+
+ while (($head, $body) = $fr->getRecord()){
+ $head =~ /(\S+)/;
+ $id = $1;
+ print "$id ", length($body), "\n";
+ }
+}
+
+
+if (scalar @ARGV == 0)
+{
+ $fr = new AMOS::ParseFasta(\*STDIN);
+ report($fr);
+}
+else
+{
+ foreach my $file (@ARGV)
+ {
+ open(IN, $file) || $tf->bail("Cannot open $file: $!\n");
+ $fr = new AMOS::ParseFasta(\*IN);
+ report($fr);
+ }
+}
+
diff --git a/src/Utils/ktrimfrg.pl b/src/Utils/ktrimfrg.pl
new file mode 100755
index 0000000..e00bf5c
--- /dev/null
+++ b/src/Utils/ktrimfrg.pl
@@ -0,0 +1,274 @@
+#!/usr/bin/perl
+
+use File::Spec;
+
+$MAXSEQ = 2048;
+$MINSEQ = 64;
+$MINVEC = 100;
+
+use AMOS::AmosLib;
+use AMOS::AmosFoundation;
+
+my $base = new AMOS::AmosFoundation;
+
+if (! defined $base){
+ die ("Couldn't instantiate AMOS::AmosFoundation!!\n");
+}
+
+$base->setUsage("Usage: trimfrg.pl file.frg file.nmers [file.clip]\n");
+$HELPTEXT = q~
+ ktrimfrg.pl file.frg file.nmers [file.clip]
+~;
+
+# invocation:
+# trimfrg.pl file.frg file.nmers [file.clip]
+
+$frgfile = $ARGV[0];
+my $splicename = $ARGV[1];
+my $clipname = $ARGV[2];
+
+my %clipleft; my %clipright;
+
+if (defined $clipname) {
+ open(CLIP, "$clipname") || die ("Cannot open $clipname: $!\n");
+ while (<CLIP>){
+ chomp;
+ my ($seqname, $clipl, $clipr) = split(/\s+/, $_);
+ $clipleft{$seqname} = $clipl - 1;
+ $clipright{$seqname} = $clipr;
+ }
+ close(CLIP);
+}
+
+my @splice;
+open(SP, $splicename) || die ("Cannot open $splicename: $!\n");
+while (<SP>){
+ chomp;
+ push(@splice, $_);
+}
+close(SP);
+
+my $tmpdir = $base->getTempDir();
+my $tmpfile = File::Spec->catfile($tmpdir, "tmp.".$$.".ktrim");
+
+my $isCA = undef;
+
+open(FRG, $frgfile) || die ("Cannot open $frgfile\n");
+while ($record = getRecord(\*FRG)){
+ my ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec eq "BAT"){
+ $isCA = 1;
+ }
+ if ($rec eq "UNV"){ # AMOS
+ open(TMP, ">$tmpfile") || $base->bail("Cannot open $tmpfile: $!\n");
+ }
+ if (defined $isCA){
+ if ($rec eq "FRG"){
+ my $seq = $$fields{seq};
+ my @lines = split('\n', $seq);
+ $seq = join('', @lines);
+ $seq = uc($seq);
+ my $seqname;
+ @lines = split('\n', $$fields{src});
+ $seqname = join('', @lines);
+
+ my ($l, $r) = split(',', $$fields{clr});
+
+ print STDERR "ORIG: $$fields{acc} $l $r\n";
+
+ if (exists $clipleft{$seqname}){
+ print STDERR "LUCY: $$fields{acc} $clipleft{$seqname} $clipright{$seqname}\n";
+ my $oldl = $l; my $oldr = $r;
+ $l = $clipleft{$seqname} if ($l < $clipleft{$seqname});
+ $r = $clipright{$seqname}; # if ($r > $clipright{$seqname});
+ print STDERR "sequence $$fields{acc} was trimmed by lucy from $oldl,$oldr to $l,$r\n" unless ($l == $oldl && $r == $oldr);
+ } elsif (defined $clipname){
+ print STDERR "sequence $$fields{acc} was rejected by lucy\n";
+ next;
+ }
+
+ foreach $splice (@splice) {
+ $splice = uc($splice);
+ my $ind = index($seq, $splice);
+ my $lastind = -1;
+ while ($ind > 0 && $ind < $MINVEC){
+ $lastind = $ind;
+ $ind = index($seq, $splice, $ind + 1);
+ }
+
+ if ($lastind > 0){
+ if ($l < $lastind + length($splice)){
+ print STDERR "trimming sequence $$fields{acc} due to vector ", $lastind + length($splice) - $l + 1, "\n";
+ $l = $lastind + length($splice) + 1;
+ }
+ }
+ } # for each splice
+
+ if ($r - $l < $MINSEQ) {
+ print STDERR "skipping short sequence $$fields{acc}\n";
+ next;
+ }
+
+ my $qual = $$fields{qlt};
+ @lines = split('\n', $qual);
+ $qual = join('', @lines);
+
+# change Ns to As
+ my @seq = split('', $seq);
+ my @qual = split('', $qual);
+ for (my $i = 0; $i <= $#seq; $i++){
+ if ($seq[$i] eq "N"){
+ $seq[$i] = "A";
+ $qual[$i] = "6";
+ }
+ }
+
+ my $seq = join('', @seq);
+ my $qual = join('', @qual);
+
+ print "{FRG\n";
+ print "act:$$fields{act}\n";
+ print "acc:$$fields{acc}\n";
+ print "typ:$$fields{typ}\n";
+ print "src:\n$$fields{src}.\n";
+ print "etm:$$fields{etm}\n";
+ print "seq:\n";
+ for (my $i = 0; $i <= $#seq; $i+=60){
+ print substr($seq, $i, ($#seq - $i > 60)? 60: ($#seq - $i + 1)), "\n";
+ }
+ print ".\n";
+ print "qlt:\n";
+ for (my $i = 0; $i <= $#qual; $i+=60){
+ print substr($qual, $i, ($#qual - $i > 60)? 60: ($#qual - $i + 1)), "\n";
+ }
+ print ".\n";
+ print "clr:$l,$r\n";
+ print "}\n";
+
+ $seen{$$fields{acc}} = 1;
+ next;
+ } # if rec eq FRG
+ if ($rec eq "LKG"){
+ if (exists $seen{$$fields{fg1}} && exists $seen{$$fields{fg2}}){
+ print $record;
+ }
+ next;
+ }
+ } else { # AMOS record
+ if ($rec eq "RED"){
+ my $seq = $$fields{seq};
+ my @lines = split('\n', $seq);
+ $seq = join('', @lines);
+ $seq = uc($seq);
+ my $seqname = $$fields{eid};
+
+ my ($l, $r) = split(',', $$fields{clr});
+
+ print STDERR "ORIG: $$fields{eid} $l $r\n";
+
+ if (exists $clipleft{$seqname}){
+ print STDERR "LUCY: $$fields{eid} $clipleft{$seqname} $clipright{$seqname}\n";
+ my $oldl = $l; my $oldr = $r;
+ $l = $clipleft{$seqname} if ($l < $clipleft{$seqname});
+ $r = $clipright{$seqname}; # if ($r > $clipright{$seqname});
+ print STDERR "sequence $$fields{eid} was trimmed by lucy from $oldl,$oldr to $l,$r\n" unless ($l == $oldl && $r == $oldr);
+ } elsif (defined $clipname){
+ print STDERR "sequence $$fields{acc} was rejected by lucy\n";
+ next;
+ }
+
+ foreach $splice (@splice) {
+ $splice = uc($splice);
+ my $ind = index($seq, $splice);
+ my $lastind = -1;
+ while ($ind > 0 && $ind < $MINVEC){
+ $lastind = $ind;
+ $ind = index($seq, $splice, $ind + 1);
+ }
+
+ if ($lastind > 0){
+ if ($l < $lastind + length($splice)){
+ print STDERR "trimming sequence $$fields{acc} due to vector ", $lastind + length($splice) - $l + 1, "\n";
+ $l = $lastind + length($splice) + 1;
+ }
+ }
+ } # for each splice
+
+ if ($r - $l < $MINSEQ) {
+ print STDERR "skipping short sequence $$fields{eid}\n";
+ next;
+ }
+
+ my $qual = $$fields{qlt};
+ @lines = split('\n', $qual);
+ $qual = join('', @lines);
+
+# change Ns to As
+ my @seq = split('', $seq);
+ my @qual = split('', $qual);
+ for (my $i = 0; $i <= $#seq; $i++){
+ if ($seq[$i] eq "N"){
+ $seq[$i] = "A";
+ $qual[$i] = "6";
+ }
+ }
+
+ my $seq = join('', @seq);
+ my $qual = join('', @qual);
+
+ print TMP "{RED\n";
+ print TMP "iid:$$fields{iid}\n";
+ print TMP "eid:$$fields{eid}\n";
+ print TMP "seq:\n";
+ for (my $i = 0; $i <= $#seq; $i+=60){
+ print TMP substr($seq, $i, ($#seq - $i > 60)? 60: ($#seq - $i + 1)), "\n";
+ }
+ print TMP ".\n";
+ print TMP "qlt:\n";
+ for (my $i = 0; $i <= $#qual; $i+=60){
+ print TMP substr($qual, $i, ($#qual - $i > 60)? 60: ($#qual - $i + 1)), "\n";
+ }
+ print TMP ".\n";
+ print TMP "frg:$$fields{frg}\n";
+ print TMP "clr:$l,$r\n";
+ print TMP "}\n";
+ }
+ $seen{$$fields{iid}} = 1;
+ } # if AMOS file
+ if (defined $isCA){
+ print $record;
+ }
+}
+
+if (! defined $isCA){
+ close(TMP);
+
+ seek FRG, 0, 0; # rewind FRG
+ while ($record = getRecord(\*FRG)){
+ my ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec eq "FRG"){
+ my ($rda, $rdb) = split(',', $$fields{rds});
+ print "{FRG\n";
+ print "iid:$$fields{iid}\n";
+ print "eid:$$fields{eid}\n";
+ print "lib:$$fields{lib}\n";
+ print "typ:$$fields{typ}\n";
+ if (exists $seen{$rda} && exists $seen{$rdb}){ # no mates
+ print "rds:$$fields{rds}\n";
+ }
+ print "}\n";
+ next;
+ }
+ if ($rec eq "RED"){next;}
+ print $record;
+ }
+ open(TMP, $tmpfile) || $base->bail("Cannot open $tmpfile: $!\n");
+ while (<TMP>){
+ print;
+ }
+ close(TMP);
+ unlink($tmpfile) || $base->bail("Cannot remove $tmpfile: $!\n");
+} # if not CA
+
+close(FRG);
+exit(0);
diff --git a/src/Utils/listcontigreads.sh b/src/Utils/listcontigreads.sh
new file mode 100755
index 0000000..aa8cf7b
--- /dev/null
+++ b/src/Utils/listcontigreads.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+grep '#' $1 | grep -v '##' | cut -f1 -d')' | tr -d '#' | tr '(' ' ' | sort -nk2 | awk '{print $1}'
diff --git a/src/Utils/nucmer2ovl.pl b/src/Utils/nucmer2ovl.pl
new file mode 100755
index 0000000..a5fb6bf
--- /dev/null
+++ b/src/Utils/nucmer2ovl.pl
@@ -0,0 +1,214 @@
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+
+# TIGR Modules
+use TIGR::Foundation;
+
+my $tigr_tf = new TIGR::Foundation;
+my $PRG = $tigr_tf->getProgramInfo('name');
+my $REV="1.0";
+my @DEPENDS=("TIGR::Foundation");
+# help info
+my $HELPTEXT = qq~
+Program that converts nucmer overlaps to an overlap file (either AMOS or TAB format)
+
+Usage: $PRG file [options]
+
+ INPUT:
+ show-coords output file
+
+ OUTPUT:
+ ovl file (AMOS or TAB)
+
+ options:
+
+ -tab - Output format (Default: AMOS)
+ -ignore <n> - Maximum length of the end sequence unaligned (Default: 20 bp)
+
+ -h|help - Print this help and exit;
+ -V|version - Print the version and exit;
+ -depend - Print the program and database dependency list;
+ -debug <level> - Set the debug <level> (0, non-debug by default);
+
+~;
+my $MOREHELP = qq~
+Return Codes: 0 - on success, 1 - on failure.
+~;
+
+###############################################################################
+#
+# Main program
+#
+###############################################################################
+MAIN:
+{
+ my %options;
+ my %h;
+
+ $options{ignore}=20;
+
+ # Configure TIGR Foundation
+ $tigr_tf->setHelpInfo($HELPTEXT.$MOREHELP);
+ $tigr_tf->setUsageInfo($HELPTEXT);
+ $tigr_tf->setVersionInfo($REV);
+ $tigr_tf->addDependInfo(@DEPENDS);
+
+ # validate input parameters
+ my $result = $tigr_tf->TIGR_GetOptions(
+ "tab" => \$options{tab},
+ "ignore=s" => \$options{ignore}
+ );
+ $tigr_tf->printUsageInfoAndExit() if (!$result);
+
+ # parse input
+ while(<>)
+ {
+ # 0 1 2 3 4 5 6 7 8 9 10 11 12
+
+ # NORMAL
+ # ---------->
+ # --------->
+ #3,4,N,6721-1,897-49: $f[17],$f[18],N,$f[0]-1,$f[12]-$f[4]
+ # 6721 6769 | 1 49 | 49 49 | 100.00 | 6769 897 | 0.72 5.46 | 3 4 [END]
+
+ # CONTAINS
+ # ---------------------->
+ # --------->
+ #15,17,N,13194-1,13528-15369:$f[17],$f[18],N,$f[0]-1,$f[1]-$f[11]
+ # 13194 13528 | 1 335 | 335 335 | 99.40 | 15369 335 | 2.18 100.00 | 15 17 [CONTAINS]
+
+ # INNIE
+ # ---------->
+ # <---------
+ #1,2,I,16303-1,169-1: $f[17],$f[18],I,$f[0]-1,$f[4]-1
+ # 16303 16876 | 742 169 | 574 574 | 100.00 | 16876 742 | 3.40 77.36 | 1 2 [END]
+
+ # OUTIE
+ # --------->
+ # <-------
+ #2,3,I,165-6769,165-742: $f[17],$f[18],I,$f[3]-$f[12],$f[1]-$f[11]
+ # 1 165 | 165 1 | 165 165 | 100.00 | 742 6769 | 22.24 2.44 | 2 3 [BEGIN]
+
+ # CONTAINS
+ # -------------->
+ # <------
+
+ my @f=split;
+ next unless(@f);
+ next if(scalar(@f)<13);
+ next if($f[0]!~/^\d+$/);
+
+ my $n=scalar(@f);
+ if($f[$n-1]=~/\[/)
+ {
+ pop @f;
+ $n--;
+ }
+
+ my ($a_id,$a_start,$a_end,$a_len)=@f[$n-2,0,1,11];
+ my ($b_id,$b_start,$b_end,$b_len)=@f[$n-1,3,4,12];
+ my ($dir,$switched,$a_hang,$b_hang);
+
+ next if($a_id eq $b_id);
+ next if($h{$a_id}{$b_id} or $h{$b_id}{$a_id});
+
+ # SAME DIR
+ if($b_start<$b_end)
+ {
+ # switch if
+ # ----------->
+ # --------->
+ if($a_start<$b_start)
+ {
+ ($a_id,$a_start,$a_end,$a_len,$b_id,$b_start,$b_end,$b_len)=($b_id,$b_start,$b_end,$b_len,$a_id,$a_start,$a_end,$a_len);
+ $switched=1;
+ }
+
+ # CONTAINS
+ if($b_start<$options{ignore} and ($b_len-$b_end)<$options{ignore})
+ {
+ $a_hang=$a_start-1;
+ $b_hang=$a_end-$a_len;
+ $dir="N";
+ }
+ # NORMAL
+ elsif(($a_len-$a_end)<$options{ignore} and $b_start<$options{ignore})
+ {
+ $a_hang=$a_start-1;
+ $b_hang=$b_len-$b_end;
+ $dir="N";
+ }
+ }
+ # OPPOSITE DIR
+ else
+ {
+ ($b_start,$b_end)=($b_end,$b_start);
+ if($a_start<$b_start)
+ {
+ ($a_id,$a_start,$a_end,$a_len,$b_id,$b_start,$b_end,$b_len)=($b_id,$b_start,$b_end,$b_len,$a_id,$a_start,$a_end,$a_len);
+ $switched=1;
+ }
+
+ # CONTAINS
+ if($b_start<$options{ignore} and ($b_len-$b_end)<$options{ignore})
+ {
+ $a_hang=$a_start-1;
+ $b_hang=$a_end-$a_len;
+ $dir="I";
+ }
+ # OUTIE
+ elsif($a_start<$options{ignore} and $b_start<$options{ignore})
+ {
+ $a_hang=$b_end-$b_len;
+ $b_hang=$a_end-$a_len;
+ $dir="I";
+ }
+ # INNIE
+ elsif(($a_len-$a_end)<$options{ignore} and ($b_len-$b_end)<$options{ignore})
+ {
+ $a_hang=$a_start-1;
+ $b_hang=$b_start-1;
+ $dir="I";
+ }
+ }
+
+ if($dir)
+ {
+ $h{$a_id}{$b_id}=1;
+
+ if($switched)
+ {
+ ($a_id,$b_id)=($b_id,$a_id);
+
+ if($dir eq "N") { ($a_hang,$b_hang)=(-$a_hang,-$b_hang); }
+ else { ($a_hang,$b_hang)=($b_hang,$a_hang); }
+ }
+
+ if($options{tab})
+ {
+ print join "\t",($a_id,$b_id,$dir,$a_hang,$b_hang,$f[6],$f[9]);
+ print "\n";
+ }
+ else
+ {
+ print join "\n",("{OVL",
+ "adj:$dir",
+ "rds:$a_id,$b_id",
+ "scr:0",
+ "ahg:$a_hang",
+ "bhg:$b_hang",
+ "}");
+ print "\n";
+ }
+ }
+ else
+ {
+ # warn "IGNORE: $_";
+ }
+
+ }
+
+
+ exit 0;
+}
diff --git a/src/Utils/nucmerAnnotate.pl b/src/Utils/nucmerAnnotate.pl
new file mode 100755
index 0000000..730e7cb
--- /dev/null
+++ b/src/Utils/nucmerAnnotate.pl
@@ -0,0 +1,109 @@
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+
+# TIGR Modules
+use TIGR::Foundation;
+
+my $tigr_tf = new TIGR::Foundation;
+my $PRG = $tigr_tf->getProgramInfo('name');
+my $REV="1.0";
+my @DEPENDS=("TIGR::Foundation");
+# help info
+my $HELPTEXT = qq~
+Program that parses a coords file and re-annotates sequence alignments
+
+Usage: $PRG coords_file [options]
+
+ INPUT:
+ show-coords coords file
+
+ OUTPUT:
+ show-coords coords file
+
+ options:
+ -ignore <n> - Maximum length of the end sequence unaligned (Default: 20 bp)
+ -all - Display all alignments (Default: only the annotated ones)
+ -loose - Looser annotation
+ -noid - Filter out identity alignments (sequences with the same id)
+
+ -h|help - Print this help and exit;
+ -V|version - Print the version and exit;
+ -depend - Print the program and database dependency list;
+ -debug <level> - Set the debug <level> (0, non-debug by default);
+
+~;
+my $MOREHELP = qq~
+Return Codes: 0 - on success, 1 - on failure.
+~;
+
+###############################################################################
+#
+# Main program
+#
+###############################################################################
+MAIN:
+{
+ my %options;
+ my $ignore=20;
+ my $all;
+ my $loose;
+ my $noid;
+
+ # Configure TIGR Foundation
+ $tigr_tf->setHelpInfo($HELPTEXT.$MOREHELP);
+ $tigr_tf->setUsageInfo($HELPTEXT);
+ $tigr_tf->setVersionInfo($REV);
+ $tigr_tf->addDependInfo(@DEPENDS);
+
+ # validate input parameters
+ my $result = $tigr_tf->TIGR_GetOptions(
+ "ignore=s" => \$ignore,
+ "all" => \$all,
+ "loose" => \$loose,
+ "noid" => \$noid
+ );
+ $tigr_tf->printUsageInfoAndExit() if (!$result);
+
+ # parse input
+ while(<>)
+ {
+ # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
+ # 6721 6769 | 1 49 | 49 49 | 100.00 | 6769 897 | 0.72 5.46 | 3 4 [END]
+
+ my @f=split;
+ next if(scalar(@f)<13);
+ next if($f[0]!~/^\d+$/);
+
+ my $n=scalar(@f);
+ if($f[$n-1]=~/\[/)
+ {
+ pop @f;
+ $n--;
+ }
+ $f[$n]="";
+
+ next if($noid and $f[$n-2] eq $f[$n-1] and $f[11]==$f[12]);
+
+ my $rev;
+ ($f[3],$f[4],$rev)=($f[4],$f[3],1) if($f[3]>$f[4]);
+
+ if($f[0]<=$ignore and $f[11]-$f[1]<=$ignore and $f[3]<=$ignore and $f[12]-$f[4]<=$ignore) { $f[$n]="[IDENTITY]" }
+ elsif($f[0]<=$ignore and $f[11]-$f[1]<=$ignore) { $f[$n]="[CONTAINED]" }
+ elsif($f[3]<=$ignore and $f[12]-$f[4]<=$ignore) { $f[$n]="[CONTAINS]" }
+ elsif(($f[3]<=$ignore or $f[12]-$f[4]<=$ignore) and $f[0]<=$ignore) { $f[$n]="[BEGIN]" }
+ elsif(($f[3]<=$ignore or $f[12]-$f[4]<=$ignore) and $f[11]-$f[1]<=$ignore) { $f[$n]="[END]" }
+ elsif($f[3]<=$ignore and $loose) { $f[$n]="[BEGIN]" }
+ elsif($f[12]-$f[4]<=$ignore and $loose) { $f[$n]="[END]" }
+
+ ($f[3],$f[4])=($f[4],$f[3]) if($rev);
+
+ if($f[$n] or $all)
+ {
+ print join "\t", at f;
+ print "\n";
+ }
+ }
+
+ exit 0;
+}
diff --git a/src/Utils/ovl2OVL.pl b/src/Utils/ovl2OVL.pl
new file mode 100755
index 0000000..39d65e6
--- /dev/null
+++ b/src/Utils/ovl2OVL.pl
@@ -0,0 +1,78 @@
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+
+# TIGR Modules
+use TIGR::Foundation;
+
+my $tigr_tf = new TIGR::Foundation;
+my $PRG = $tigr_tf->getProgramInfo('name');
+my $REV="1.0";
+my @DEPENDS=("TIGR::Foundation");
+# help info
+my $HELPTEXT = qq~
+Program that converts an overlap TAB delimited file to AMOS format
+
+Usage: $PRG file [options]
+
+ INPUT:
+ overlap TAB delimited file
+
+ OUTPUT:
+ overlap AMOS file
+
+ options:
+
+ -h|help - Print this help and exit;
+ -V|version - Print the version and exit;
+ -depend - Print the program and database dependency list;
+ -debug <level> - Set the debug <level> (0, non-debug by default);
+
+~;
+my $MOREHELP = qq~
+Return Codes: 0 - on success, 1 - on failure.
+~;
+
+###############################################################################
+#
+# Main program
+#
+###############################################################################
+MAIN:
+{
+ my %options;
+
+ # Configure TIGR Foundation
+ $tigr_tf->setHelpInfo($HELPTEXT.$MOREHELP);
+ $tigr_tf->setUsageInfo($HELPTEXT);
+ $tigr_tf->setVersionInfo($REV);
+ $tigr_tf->addDependInfo(@DEPENDS);
+
+ # validate input parameters
+ my $result = $tigr_tf->TIGR_GetOptions();
+ $tigr_tf->printUsageInfoAndExit() if (!$result);
+
+ # parse input
+ while(<>)
+ {
+ my @f=split;
+ next unless(@f);
+
+ die "ERROR: $_" if(scalar(@f)<5);
+ my ($a_id,$b_id,$dir,$a_hang,$b_hang)=@f;
+
+ print join "\n",("{OVL",
+ "adj:$dir",
+ "rds:$a_id,$b_id",
+ "scr:0",
+ "ahg:$a_hang",
+ "bhg:$b_hang",
+ "}");
+
+ print "\n";
+
+ }
+
+
+ exit 0;
+}
diff --git a/src/Utils/preTA.pl b/src/Utils/preTA.pl
new file mode 100755
index 0000000..679e378
--- /dev/null
+++ b/src/Utils/preTA.pl
@@ -0,0 +1,317 @@
+#!/usr/local/bin/perl
+
+# $Id$
+#
+# Runs phred and the trimming software similarly to "phredPhrap".
+#
+# Copyright @ 2002, The Institute for Genomic Research (TIGR). All
+# rights reserved.
+
+# This software is provided "AS IS". TIGR makes no warranties, express
+# or implied, including no representation or warranty with respect to
+# the performance of the software and derivatives or their safety,
+# effectiveness, or commercial viability. TIGR does not warrant the
+# merchantability or fitness of the software and derivatives for any
+# particular purpose, or that they may be exploited without infringing
+# the copyrights, patent rights or property rights of others. TIGR shall
+# not be liable for any claim, demand or action for any loss, harm,
+# illness or other damage or injury arising from access to or use of the
+# software or associated information, including without limitation any
+# direct, indirect, incidental, exemplary, special or consequential
+# damages.
+
+# This software program may not be sold, leased, transferred, exported
+# or otherwise disclaimed to anyone, in whole or in part, without the
+# prior written consent of TIGR.
+
+use strict;
+use File::Spec;
+use TIGR::Foundation;
+use TIGR::FASTAiterator;
+use TIGR::FASTArecord;
+
+my $base = new TIGR::Foundation;
+if (! defined $base){
+ die("Wierd problem!\n");
+}
+
+my $VERSION = '1.0 $Revision$ ';
+
+# default permissions
+my $PERM = 0777;
+
+# min sequence length
+my $SHORT = 40;
+
+# first some programs
+my $PHRED = "/usr/local/bin/phred";
+my $LUCY = "/usr/local/bin/lucy";
+my $PHD2FASTA = "/usr/local/bin/phd2fasta";
+
+# then the directories
+my $VEC_DIR = "vector_dir";
+my $CHROMO_DIR = "chromat_dir";
+my $PHD_DIR = "phd_dir";
+
+# lucy parameters
+my $LUCYPARM = "-error 0.025 0.02 -window 50 0.03 -bracket 10 0.02";
+
+
+my $HELP_INFO = q~
+ preTA.pl [-v vector_dir] [-c chromat_dir] [-p phd_dir] [-l lucy_parms]
+
+ lucy params must be enclosed in quotes
+ ~;
+
+$base->setHelpInfo($HELP_INFO);
+
+my $err = $base->TIGR_GetOptions("v=s" => \$VEC_DIR,
+ "c=s" => \$CHROMO_DIR,
+ "p=s" => \$PHD_DIR,
+ "l=s" => \$LUCYPARM
+ );
+
+
+if (! -d $CHROMO_DIR){
+ $base->bail("Cannot open chromatogram directory \"$CHROMO_DIR\"");
+}
+
+if (! -d $VEC_DIR){
+ $base->logError("Cannot open vector directory \"$CHROMO_DIR\"", 1);
+ $VEC_DIR = undef;
+}
+
+if (! -d $PHD_DIR){
+ mkdir($PHD_DIR, $PERM) ||
+ $base->bail("Cannot create phd directory \"$PHD_DIR\"");
+}
+
+# step 0, generate temp file name
+my $tmpdir = $base->getTempDir();
+my $tmp = $$ . time();
+my $tmp_phd = File::Spec->catfile($tmpdir, "$tmp.phd_dir");
+mkdir ($tmp_phd, $PERM) ||
+ $base->bail("Cannot create temporary phd directory \"$tmp_phd\"");
+
+# step 1, run phred
+my $phred_cmd = "$PHRED -id $CHROMO_DIR -pd $tmp_phd";
+print STDERR "Running $phred_cmd\n";
+
+my $exit_val = system($phred_cmd);
+if ($exit_val != 0){
+ $base->bail("Phred appears to have died\n");
+}
+
+# step 2, create .seq and .qual files
+my $tmp_seq = File::Spec->catfile($tmpdir, "$tmp.seq" );
+my $tmp_qual = File::Spec->catfile($tmpdir, "$tmp.qual");
+my $phd2fasta_cmd = "$PHD2FASTA -id $tmp_phd -os $tmp_seq -oq $tmp_qual";
+print STDERR "Running $phd2fasta_cmd\n";
+
+$exit_val = system($phd2fasta_cmd);
+if ($exit_val != 0){
+ $base->bail("Phd2fasta appears to have died\n");
+}
+
+# step 3, run a first step of trimming
+my %end5; # list of clear ranges
+my %end3;
+my %thisset;
+my $firstTrim = 1; # we are at the first trimming stage
+
+my $tmp_lucy_seq = File::Spec->catfile($tmpdir, "$tmp.lucy.seq" );
+my $tmp_lucy_qual = File::Spec->catfile($tmpdir, "$tmp.lucy.qual");
+my $lucy_cmd = "$LUCY $LUCYPARM -output $tmp_lucy_seq $tmp_lucy_qual $tmp_seq $tmp_qual";
+
+my @readErr;
+my $fr = new TIGR::FASTAiterator($base, \@readErr);
+my $inseqs;
+if (! defined $VEC_DIR){
+ print STDERR "Running $lucy_cmd\n";
+
+ $exit_val = system($lucy_cmd);
+ if ($exit_val != 0){
+ $base->bail("Lucy appears to have died\n");
+ }
+
+ $inseqs = 0;
+# $fr = new TIGR::FASTAiterator($base, \@readErr, $tmp_lucy_seq);
+ if (! $fr->open($tmp_lucy_seq)){
+ while (my $err = pop(@readErr)){
+ $base->logError($err);
+ }
+ $base->bail("Could not read sequence file \"$tmp_lucy_seq\"");
+ }
+
+ while ($fr->hasNext){
+ my $rec = $fr->next();
+ $inseqs++;
+
+ my $head = $rec->getHeader();
+ $head =~ /^>(\S+) \d+ \d+ \d+ (\d+) (\d+)/;
+ $end5{$1} = $2;
+ $end3{$1} = $3;
+ # print STDERR "$head\n";
+ }
+
+ $fr->close();
+
+ print STDERR "successfully read $inseqs sequences\n";
+ $firstTrim = 0;
+}
+
+# step 4, run lucy on each vector file
+if (defined $VEC_DIR){
+ print STDERR "Will trim vector according to files in \"$VEC_DIR\"\n";
+
+ opendir(VEC, $VEC_DIR) ||
+ $base->bail("Cannot open vector dir \"$VEC_DIR\": $!");
+
+ while ($_ = readdir(VEC)){
+# print STDERR "$_\n";
+ if (/^\.$/){
+ next;
+ }
+ if (/^\.\.$/){
+ next;
+ }
+ if (-f "$VEC_DIR/$_" && $_ !~ /\.splice$/){
+ print STDERR "Trimming according to vector $_\n";
+ my $fname = "$VEC_DIR/$_";
+ my $spname;
+
+ $ENV{VECTOR_FILE} = $fname;
+ delete $ENV{SPLICE_FILE};
+ if (-f "$fname.splice"){
+ $spname = "$fname.splice";
+ $ENV{SPLICE_FILE} = $spname;
+ }
+ print STDERR "Running $lucy_cmd with vector \"$fname\" and splice \"$spname\"\n";
+ %thisset = (); # clear up the space
+
+ $exit_val = system($lucy_cmd);
+ if ($exit_val != 0){
+ $base->bail("Lucy appears to have died\n");
+ }
+
+ if (! $fr->open($tmp_lucy_seq)){
+ while (my $err = pop(@readErr)){
+ $base->logError($err);
+ }
+ $base->bail("Could not read sequence file \"$tmp_lucy_seq\"");
+ }
+
+ $inseqs = 0;
+ while ($fr->hasNext){
+ my $rec = $fr->next();
+ $inseqs++;
+
+ my $head = $rec->getHeader();
+ $head =~ /^>(\S+) \d+ \d+ \d+ (\d+) (\d+)/;
+ $thisset{$1} = 1; # mark the sequence as seen
+ if ($firstTrim == 0 && ! exists $end5{$1}){
+ $base->logLocal("Skipping sequence $1", 1);
+ next; # skip previously killed sequences
+ }
+ if ($firstTrim == 1 || $2 > $end5{$1}){
+ $end5{$1} = $2;
+ }
+ if ($firstTrim == 1 || $3 < $end3{$1}){
+ $end3{$1} = $3;
+ }
+ }
+
+ $fr->close();
+ print STDERR "successfully read $inseqs sequences\n";
+ $firstTrim = 0;
+ # now we remove sequences that do not appear in the current
+ # trimmed file
+ while (my ($s, $e) = each %end5){
+ if (! exists $thisset{$s}){
+ delete $end5{$s};
+ delete $end3{$s};
+ $base->logLocal("Skipping sequence $s", 1);
+ }
+ }
+
+ } # if $VEC_DIR/vecfile ....
+ } # while <VEC>
+
+
+ closedir(VEC);
+
+} else { # if $VEC_DIR
+ print STDERR "No vector files provided. Will skip vector trimming\n";
+}
+
+# step 5, get rid of all the lucy files
+my @temps = ($tmp_seq, $tmp_qual, $tmp_lucy_seq, $tmp_lucy_qual);
+for (my $i = 0; $i <= $#temps; $i++){
+ unlink($temps[$i]) ||
+ $base->logError("Cannot remove \"$temps[$i]\": $!", 1);
+}
+
+# step 6, move over the phd files from the temp dir to the real dir,
+# trimming everything outside of the clear range
+print STDERR "Moving results to the output\n";
+opendir(PHD, "$tmp_phd") ||
+ $base->bail("Cannot open temp dir \"$tmp_phd\": $!");
+
+while ($_ = readdir(PHD)){
+ if (/\.phd\.1$/){
+ my $fname = "$tmp_phd/$_";
+ my $ofname = "$PHD_DIR/$_";
+ $_ =~ /(.*)\.phd\.1$/;
+ my $seqname = $1;
+
+ if (! exists $end5{$seqname}) { # no clear range - trash sequence
+ $base->logLocal("Sequence $seqname was removed by lucy", 1);
+ next;
+ }
+ if ($end3{$seqname} - $end5{$seqname} + 1 < $SHORT){
+ $base->logLocal("Sequence $seqname was too short", 1);
+ next; # trash short sequence
+ }
+
+ open(IN, "$fname") ||
+ $base->bail("Cannot open \"$fname\": $!");
+ open(OUT, ">$ofname") ||
+ $base->bail("Cannot open \"$ofname\": $!");
+ my $inSeq = 0;
+ my $pos = 0;
+ while (<IN>){
+ if (/^TRIM: (\d+) (\d+) (\S+)$/){
+ print OUT "TRIM: $end5{$seqname} $end3{$seqname} $3\n";
+ next;
+ }
+ if (/^BEGIN_DNA/){
+ print OUT;
+ $inSeq = 1;
+ next;
+ }
+ if (/^END_DNA/){
+ print OUT;
+ $inSeq = 0;
+ next;
+ }
+ if ($inSeq){
+ $pos++;
+ if ($pos >= $end5{$seqname} && $pos <= $end3{$seqname}){
+ print OUT;
+ }
+ next;
+ }
+ print OUT;
+ } # while <IN>
+ close(IN);
+ close(OUT);
+ } # if phd
+} # while <PHD>
+
+closedir(PHD);
+
+# step 7, remove phd_dir
+print STDERR "Cleaning up\n";
+system("rm -rf $tmp_phd");
+
+exit(0);
diff --git a/src/Utils/preassembleFrgs.pl b/src/Utils/preassembleFrgs.pl
new file mode 100755
index 0000000..2379129
--- /dev/null
+++ b/src/Utils/preassembleFrgs.pl
@@ -0,0 +1,90 @@
+#!/usr/bin/perl
+
+## this program retrieves a collection of reads from the bank
+## identifies those that belong to the same fragment, then builds
+## layouts (using nucmer).
+
+use lib "/usr/local/lib";
+use AMOS::AmosLib;
+use AMOS::AmosFoundation;
+
+my $END = 10; # end wobble allowed
+
+my $base = new AMOS::AmosFoundation;
+if (! defined $base){
+ die ("Foundation cannot be created. Walk, do not run, to the nearest exit!\n");
+}
+
+my $VERSION = '$Revision$ ';
+$base->setVersion($VERSION);
+
+my $HELPTEXT = q~
+Usage: preassembleFrgs.pl [-poly] -b <bank>
+ ~;
+
+$base->setHelpText($HELPTEXT);
+
+my $dopoly = undef;
+my $bank = undef;
+
+my $err = $base->GetOptions(
+ "poly" => \$dopoly,
+ "b=s" => \$bank
+ );
+
+if (! $err){
+ $base->bail("Error processing command line!");
+}
+
+my $temp = "TEMP";
+
+my $amospath = $ENV{AMOSBIN};
+
+my $report = (defined $amospath) ? "$amospath/bank-report" : "bank-report";
+my $overlap = (defined $amospath) ? "$amospath/hash-overlap" : "hash-overlap";
+my $tigger = (defined $amospath) ? "$amospath/tigger" : "tigger";
+my $consensus;
+if (defined $dopoly) {
+ $consensus = (defined $amospath) ? "$amospath/make-consensus_poly" : "make-consensus_poly";
+} else {
+ $consensus = (defined $amospath) ? "$amospath/make-consensus" : "make-consensus";
+}
+
+my %frgrds;
+my %rdidx;
+my %clears;
+
+open(TMP, "$report -b $bank RED |") || die ("Cannot report bank: $!\n");
+
+while (my $record = getRecord(\*TMP)){
+ my ($rec, $fields, $recs) = parseRecord($record);
+ if ($rec eq "RED"){
+ my $id = $$fields{iid};
+ my $frg = $$fields{frg};
+ if (! defined $frg) {next;} # only want reads in fragments
+ $frgrds{$frg} .= "$id ";
+ } # RED records
+} # for each input record
+
+close(TMP);
+
+while (my ($frg, $seqs) = each %frgrds){
+ my @seqs = split(" ", $seqs);
+ if ($#seqs < 1){ next;} # fragments with at least two reads
+
+ open(TMPSEQ, ">$temp.list") || die ("Cannot open $temp.list: $!\n");
+
+ for ($i = 0; $i <= $#seqs; $i++){
+ print TMPSEQ $seqs[$i], "\n";
+ }
+
+ close(TMPSEQ);
+
+ system ("$overlap -B $bank -I $temp.list");
+
+} # for each fragment
+
+print STDERR "Running $tigger -b $bank\n";
+system("$tigger -b $bank");
+print STDERR "Running $consensus -B -b $bank\n";
+system("$consensus -B -b $bank");
diff --git a/src/Utils/pullTArchive.pl b/src/Utils/pullTArchive.pl
new file mode 100755
index 0000000..1adc7f5
--- /dev/null
+++ b/src/Utils/pullTArchive.pl
@@ -0,0 +1,132 @@
+#!/usr/local/bin/perl
+
+use DBI;
+use POSIX;
+
+my $query = qq~
+ select s.seq_name, b.sequence, b.quality, f.end5, f.end3,
+ l.cat#, l.min_clone_len, l.max_clone_len, l.med_clone_len
+ from sequence s, bases b, feature f, track..library l
+ where
+ s.trash = null
+ and s.latest_bases_id = b.id
+ and f.seq_name = s.seq_name
+ and f.feat_type = "CLR"
+ and f.end3 - f.end5 >= 64
+ and l.lib_id = substring(s.seq_name, 1, 4)
+ ~;
+
+
+open(SEQ, ">$ARGV[0].seq") || die ("Cannot open $ARGV[0].seq: $!\n");
+open(QUAL, ">$ARGV[0].qual") || die ("Cannot open $ARGV[0].qual: $!\n");
+open(XML, ">$ARGV[0].xml") || die ("Cannot open $ARGV[0].xml: $!\n");
+print XML "<?xml version=\"1.0\"?>\n";
+print XML "<trace_volume>\n";
+
+$dbh = DBI->connect("dbi:Sybase:server=SYBTIGR;packetSize=8092", "access", "access");
+if (! defined $dbh) {
+ die ("Cannot connect to server\n");
+}
+
+$dbh->do("use $ARGV[0]");
+$dbh->do("set textsize 12288");
+
+my @regex;
+my @dir;
+my @type;
+my $query_dirs = "select name, direction, read_type from primer_dir where read_type = \"RANDOM\"";
+
+my $qh = $dbh->prepare($query_dirs) || die ("Cannot prepare $query_dirs\n");
+$qh->execute() || die ("Cannot execute $query_dirs\n");
+
+while (my @row = $qh->fetchrow()){
+ my $reg = $row[0];
+ $reg =~ s/_%/..*/;
+ push(@regex, $reg);
+ push(@dir, $row[1]);
+ push(@type, $row[2]);
+}
+
+
+my $qh = $dbh->prepare($query) || die ("Cannot prepare $query");
+$qh->execute() || die ("Cannot execute $query");
+
+while (my @row = $qh->fetchrow())
+{
+ $nrows++;
+ print SEQ ">$row[0] $row[6] $row[7] $row[8] $row[3] $row[4]\n" ;
+ print XML " <trace>\n";
+ print XML " <trace_name>$row[0]</trace_name>\n";
+ my $tem = substr($row[0], 0, 7);
+ my $primer = substr($row[0], 7);
+ my $seq_type;
+ my $seq_end;
+
+ for (my $i = 0; $i <= $#regex; $i++){
+ if ($primer =~ /^${regex[$i]}$/){
+ $seq_end = $dir[$i];
+ $seq_type = "paired_production";
+ }
+ }
+
+ if (! defined $seq_type){
+ $seq_end = "N";
+ $seq_type = "closure";
+ }
+
+ print XML " <template_id>$tem</template_id>\n";
+ print XML " <trace_end>$seq_end</trace_end>\n";
+ print XML " <library_id>$row[5]</library_id>\n";
+
+ my $insize = int(($row[6] + $row[7]) / 2);
+ my $insd = int(($row[7] - $row[6]) / 6);
+
+ print XML " <insert_size>$insize</insert_size>\n";
+ print XML " <insert_stdev>$insd</insert_stdev>\n";
+ print XML " <type>$seq_type</type>\n";
+ print XML " </trace>\n";
+ my $line=1;
+
+ my $line_len = length($row[1]);
+ my $line_num = floor($line_len/60);
+
+ my @seq_segs = unpack("A60" x $line_num, $row[1]);
+ my $exclude = 60*$line_num;
+ my $last_seg = unpack("x$exclude A*", $row[1]);
+
+ if((defined $last_seg) && ($last_seg ne "")) {
+ push @seq_segs, $last_seg;
+ }
+
+ my $qual_str = join("\n", @seq_segs);
+ print SEQ "$qual_str\n";
+
+ my $qual_len = length($row[2]);
+ if ($qual_len == (4 * $line_len)) {
+ my @hvals = map hex, (unpack("A4" x $line_len, $row[2]));
+ my $hval = undef;
+
+ my $i = 0;
+ for($i = 0 ; $i < scalar(@hvals) ; $i++) {
+ $hval = $hvals[$i];
+ if($hval > 60 || $hval < 0) {
+ my $pos = $i*4;
+ print STDERR "Warning: Bad quality value ($hval) for sequence $row[0] at position $pos (from 0).\n";
+ $hval = 0;
+ }
+ $hvals[$i] = sprintf("%02d", $hval);
+ }
+ print QUAL ">$row[0]\n";
+
+ for (my $j = 0; $j <= $#hvals; $j += 17) {
+ print QUAL join(" ", @hvals[$j .. $j + 16]), "\n";
+ }
+ }
+ $count_total_seqs++;
+}
+
+close(SEQ);
+close(QUAL);
+print XML "</trace_volume>\n";
+close(XML);
+exit(0);
diff --git a/src/Utils/recallConsensus.cc b/src/Utils/recallConsensus.cc
new file mode 100644
index 0000000..cb9e7c3
--- /dev/null
+++ b/src/Utils/recallConsensus.cc
@@ -0,0 +1,275 @@
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "foundation_AMOS.hh"
+#include <getopt.h>
+#include <map>
+#include <list>
+#include <vector>
+#include <string>
+#include <queue>
+#include <functional>
+#include "amp.hh"
+
+#include <Slice.h>
+#include "ContigIterator_AMOS.hh"
+
+using namespace std;
+using namespace AMOS;
+
+
+#define endl "\n"
+
+string BANKNAME;
+int USEIID = 0;
+int USEEID = 1;
+int ONE_BASED_GINDEX = 0;
+int VERBOSE = 0;
+int AMBIGUITY = 0;
+
+void printHelpText()
+{
+ cerr <<
+ "\n"
+ ".NAME.\n"
+ "recallConsensus - Recalls the consensus of contigs\n"
+ "\n.USAGE.\n"
+ "recallConsensus -b[ank] <bank_name> [OPTIONS]\n"
+ "\n.OPTIONS.\n"
+ "-h, -help Print out help message\n"
+ "-b, -bank Bank where assembly is stored\n"
+ "-v, -verbose Be verbose\n"
+ "-a, -ambiguity Use Ambiguity Codes\n\n"
+
+ "\n.DESCRIPTION.\n"
+ "\n.KEYWORDS.\n"
+ "AMOS bank\n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"bank", 1, 0, 'b'},
+ {"verbose", 0, 0, 'v'},
+ {"ambiguity", 0, 0, 'a'},
+
+ {0, 0, 0, 0}
+ };
+
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1)
+ {
+ switch (c)
+ {
+ case 'h': printHelpText(); exit(0); break;
+ case 'b': BANKNAME = optarg; break;
+ case 'v': VERBOSE = 1; break;
+ case 'a': AMBIGUITY = 1; break;
+
+ case '?':
+ cerr << "Error processing options: " << argv[optind-1] << endl;
+ return false;
+ };
+ }
+
+ return true;
+}
+
+char getAmbiguityFlags(char b)
+{
+ char flags;
+ b = toupper(b);
+
+ switch (b)
+ {
+ case 'A': flags = AMBIGUITY_FLAGBIT_A; break;
+ case 'C': flags = AMBIGUITY_FLAGBIT_C; break;
+ case 'G': flags = AMBIGUITY_FLAGBIT_G; break;
+ case 'T': flags = AMBIGUITY_FLAGBIT_T; break;
+
+ case 'W': flags = AMBIGUITY_FLAGBIT_A | AMBIGUITY_FLAGBIT_T; break;
+ case 'M': flags = AMBIGUITY_FLAGBIT_A | AMBIGUITY_FLAGBIT_C; break;
+ case 'R': flags = AMBIGUITY_FLAGBIT_A | AMBIGUITY_FLAGBIT_G; break;
+ case 'S': flags = AMBIGUITY_FLAGBIT_C | AMBIGUITY_FLAGBIT_G; break;
+ case 'Y': flags = AMBIGUITY_FLAGBIT_C | AMBIGUITY_FLAGBIT_T; break;
+ case 'K': flags = AMBIGUITY_FLAGBIT_G | AMBIGUITY_FLAGBIT_T; break;
+
+ case 'V': flags = AMBIGUITY_FLAGBIT_A | AMBIGUITY_FLAGBIT_C | AMBIGUITY_FLAGBIT_G; break;
+ case 'H': flags = AMBIGUITY_FLAGBIT_A | AMBIGUITY_FLAGBIT_C | AMBIGUITY_FLAGBIT_T; break;
+ case 'D': flags = AMBIGUITY_FLAGBIT_A | AMBIGUITY_FLAGBIT_G | AMBIGUITY_FLAGBIT_T; break;
+ case 'B': flags = AMBIGUITY_FLAGBIT_C | AMBIGUITY_FLAGBIT_G | AMBIGUITY_FLAGBIT_T; break;
+
+ case '-': flags = AMBIGUITY_FLAGBIT_GAP; break;
+
+ default:
+ flags = AMBIGUITY_FLAGBIT_A | AMBIGUITY_FLAGBIT_C | AMBIGUITY_FLAGBIT_G | AMBIGUITY_FLAGBIT_T;
+ };
+
+ return flags;
+}
+
+pair<char,char> recallSlice(ContigIterator_t ci)
+{
+ int gindex = ci.gindex();
+
+ char cons = ci.cons();
+ int cqv = ci.cqv();
+
+ const TiledReadList_t & tiling = ci.getTilingReads();
+
+ if (!tiling.empty())
+ {
+ libSlice_Slice slice;
+ libSlice_Consensus result;
+ slice.dcov = tiling.size();
+
+ int cur = 0;
+
+ slice.bc = new char [slice.dcov*5+1];
+ slice.qv = new char [slice.dcov*5];
+ slice.rc = new char [slice.dcov*5];
+ slice.c = cons;
+
+ TiledReadList_t::const_iterator ri;
+ for (ri = tiling.begin(); ri != tiling.end(); ri++)
+ {
+ char b = ri->base(gindex);
+ char q = ri->qv(gindex);
+ char r = ri->m_isRC;
+
+ char flags = getAmbiguityFlags(b);
+
+ if (flags & AMBIGUITY_FLAGBIT_A) { slice.bc[cur] = 'A'; slice.qv[cur] = q; slice.rc[cur] = r; cur++; }
+ if (flags & AMBIGUITY_FLAGBIT_C) { slice.bc[cur] = 'C'; slice.qv[cur] = q; slice.rc[cur] = r; cur++; }
+ if (flags & AMBIGUITY_FLAGBIT_G) { slice.bc[cur] = 'G'; slice.qv[cur] = q; slice.rc[cur] = r; cur++; }
+ if (flags & AMBIGUITY_FLAGBIT_T) { slice.bc[cur] = 'T'; slice.qv[cur] = q; slice.rc[cur] = r; cur++; }
+ if (flags & AMBIGUITY_FLAGBIT_GAP) { slice.bc[cur] = '-'; slice.qv[cur] = q; slice.rc[cur] = r; cur++; }
+ }
+
+ slice.bc[cur] = '\0';
+ slice.dcov = cur;
+
+ if (AMBIGUITY)
+ {
+ libSlice_getConsensusParam(&slice, &result, NULL, 0, 1);
+ libSlice_updateAmbiguityConic(&slice, &result, 0, 0);
+ cons = libSlice_convertAmbiguityFlags(result.ambiguityFlags);
+ cqv = result.qvConsensus;
+ }
+ else
+ {
+ libSlice_getConsensusParam(&slice, &result, NULL, 0, 0);
+ cons = result.consensus;
+ cqv = result.qvConsensus;
+ }
+
+ delete slice.qv; slice.qv=NULL;
+ delete slice.rc; slice.rc=NULL;
+ delete slice.bc; slice.bc=NULL;
+ }
+
+ cqv /= tiling.size();
+ cqv += MIN_QUALITY;
+
+ if (cqv > MAX_QUALITY) { cqv = MAX_QUALITY; }
+
+ return make_pair(cons, cqv);
+}
+
+
+
+//----------------------------------------------
+int main(int argc, char **argv)
+{
+ if (! GetOptions(argc, argv))
+ {
+ exit(1);
+ }
+
+ // open necessary files
+ if (BANKNAME.empty())
+ {
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ Bank_t contig_bank (Contig_t::NCODE);
+ Bank_t read_bank (Read_t::NCODE);
+
+ try
+ {
+ read_bank.open(BANKNAME, B_READ);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Failed to open read account in bank " << BANKNAME
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ try
+ {
+ contig_bank.open(BANKNAME, B_READ | B_WRITE);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Failed to open contig account in bank " << BANKNAME
+ << ": " << endl << e << endl;
+ read_bank.close();
+ exit(1);
+ }
+
+ try
+ {
+ int bases = 0;
+ int contigcount = 0;
+
+ int ccount = contig_bank.getSize();
+
+ cerr << "Recalling " << ccount << " contigs";
+
+ ProgressDots_t dots(ccount, 50);
+
+ Contig_t ctg;
+ AMOS::IDMap_t::const_iterator bi;
+ for (bi = contig_bank.getIDMap().begin();
+ bi;
+ bi++)
+ {
+ contig_bank.fetch(bi->iid, ctg);
+ ContigIterator_t ci(ctg, &read_bank);
+
+ string cons;
+ string cqual;
+
+ while (ci.advanceNext())
+ {
+ pair<char, char> c = recallSlice(ci);
+ cons.push_back(c.first);
+ cqual.push_back(c.second);
+ bases++;
+ }
+
+ ctg.setSequence(cons.c_str(), cqual.c_str());
+ contig_bank.replace(bi->iid, ctg);
+
+ contigcount++;
+ dots.update(contigcount);
+ }
+
+ dots.end();
+ cerr << endl;
+ cerr << "Recalled " << bases << " positions in " << contigcount << " contigs." << endl;
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Error recalling consensus: " << endl << e << endl;
+ exit(1);
+ }
+
+
+}
+
diff --git a/src/Utils/revFasta.pl b/src/Utils/revFasta.pl
new file mode 100755
index 0000000..7d6aeaf
--- /dev/null
+++ b/src/Utils/revFasta.pl
@@ -0,0 +1,93 @@
+#!/usr/bin/perl
+# $Id: revFasta.pl,v 1.2 2004/01/21 14:33:16 shumwaym Exp $
+#
+# revFasta - Reverse complement the fasta file or specified record.
+#
+# Written by - Martin Shumway
+#
+my $HELPTEXT = qq~
+Reverse complement the fasta file or specified record in a multifasta file.
+
+ revFasta <fasta file> [options]
+ options:
+ -i <id> Reverse complement the specified id only
+
+~;
+#
+# (C) Copyright 2001-2003 The Institute for Genomic Research (TIGR)
+# All rights reserved.
+#
+#
+
+# =============================== Pragmas and imports ======================
+use strict;
+use TIGR::Foundation;
+use TIGR::FASTAreader;
+use TIGR::FASTArecord;
+
+# Normally used only in testing
+# use warnings;
+
+# ================================ Globals ====================================
+
+my $MY_VERSION = " Version 1.0 (Build " . (qw/$Revision: 1.2 $/ )[1] . ")";
+my @MY_DEPENDS =
+(
+ "TIGR::Foundation",
+ "TIGR::FASTAreader",
+ "TIGR::FASTArecord",
+);
+
+# Reference to TF object
+my $tf = new TIGR::Foundation;
+
+# ================================= Procedures ===================================
+MAIN:
+{
+ # == Program Setup ==
+ $tf->addDependInfo(@MY_DEPENDS);
+ $tf->setHelpInfo($HELPTEXT);
+ $tf->setVersionInfo($MY_VERSION);
+ $tf->setUsageInfo($HELPTEXT);
+
+ # Handle the input options
+ my $id = undef;
+ my $result = $tf->TIGR_GetOptions
+ (
+ "i=s", \$id,
+ );
+ $tf->bail("Command line parsing failed") if ($result == 0);
+ $tf->printUsageInfoAndExit() if ($#ARGV != 0);
+ my $fastafile = $ARGV[0] if (defined $ARGV[0]);
+ $tf->bail("Could not open \'$fastafile\' ($!)") if (! -r $fastafile);
+
+ # == Gather Inputs ==
+ $tf->logLocal("Reading fasta records from $fastafile", 9);
+ my @errors = ();
+ my $fr = new TIGR::FASTAreader($tf, \@errors, $fastafile);
+ $tf->bail("Error creating FASTA Reader object") if (! defined $fr);
+ if ($#errors >= 0)
+ {
+ for my $e (@errors)
+ {
+ logerr("$e\n");
+ }
+ $tf->bail("Invalid FASTA on input from $fastafile");
+ }
+
+ # == Write outputs ==
+ $tf->logLocal("Writing output...", 9);
+ while ( $fr->hasNext() )
+ {
+ my $r = $fr->next();
+ my $a = $r->getIdentifier();
+ my $h = $r->getHeader();
+ next if (defined $id && $a ne $id);
+ $tf->logLocal("Found contig $a", 9);
+ my $data = $r->reverseComplementData();
+ my $rr = new TIGR::FASTArecord($h, $data);
+ print $rr->toString();
+ }
+
+ exit 0;
+}
diff --git a/src/Utils/runAmos.cc b/src/Utils/runAmos.cc
new file mode 100644
index 0000000..2a7d261
--- /dev/null
+++ b/src/Utils/runAmos.cc
@@ -0,0 +1,792 @@
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <getopt.h>
+#include <fstream>
+#include <map>
+#include <set>
+#include <vector>
+#include <sstream>
+#include <string>
+#include <stdio.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <iostream>
+#include <cstdlib>
+
+#define MAX_STRING 256 // length of various char*s in file
+
+
+using namespace std;
+
+map<string, string> globals; // global variables
+map<string, string> variables; // conf file variables
+vector<string> cmdLnVars; // command line variables (numbered)
+ofstream logFile;
+string logFileName;
+string confFile;
+time_t allstart; // when program started
+
+bool ECHOMODE = 0;
+
+
+string elapsed(time_t time)
+{
+ int days;
+ int hours;
+ int mins;
+ int secs;
+ int tmp = time;
+ ostringstream out;
+
+ days = tmp / 86400;
+ tmp -= days * 86400;
+ hours = tmp / 3600;
+ tmp -= hours * 3600;
+ mins = tmp / 60;
+ tmp -= mins * 60;
+ secs = tmp;
+
+ out << days << "d " << hours << "h " << mins << "m " << secs << "s" << endl;
+
+ return out.str();
+} // elapsed
+
+
+void finish(int status)
+{
+ if (logFile.is_open())
+ logFile << "!!! END - Elapsed time: " << elapsed(time(NULL) - allstart) << endl;
+
+ exit(status);
+} // finish
+
+
+string timeStr()
+{
+ char tm[MAX_STRING+1];
+ time_t t = time(NULL);
+
+ strftime(tm, MAX_STRING, "%F %T ", localtime(&t));
+
+ return "!!! " + string(tm);
+} // timeStr
+
+
+set<string> splitBlank(string s)
+{
+ string tmp = s;
+ char elem[MAX_STRING+1];
+ int pos;
+ set<string> out;
+
+ while (sscanf(tmp.c_str(), " %s%n", elem, &pos) >= 1){ // found a string
+ out.insert(elem);
+ tmp = tmp.substr(pos);
+ }
+
+ return out;
+} // splitBlank
+
+
+void checkFiles()
+{
+ cerr << "First step: checking input files" << endl;
+ logFile << timeStr() << "First step: checking input files" << endl;
+
+ if (variables.find("INPUTS") == variables.end()){
+ logFile << timeStr() << "variable INPUTS must be set in order to use -ocd" << endl;
+ cerr << "variable INPUTS must be set in order to use -ocd" << endl;
+ finish(1);
+ }
+
+ set<string> inputs = splitBlank(variables["INPUTS"]);
+ int numerr = 0;
+ for (set<string>::iterator i = inputs.begin() ; i != inputs.end(); i++){
+ cerr << "checking " << i->c_str() << endl;
+ if (access(i->c_str(), R_OK|F_OK) == -1){
+ logFile << timeStr() << "file " << i->c_str()
+ << " specified in the INPUTS variable cannot be read" << endl;
+ numerr++;
+ }
+ }
+
+ if (numerr != 0){
+ logFile << timeStr()
+ << "one or more files specified in INPUTS cannot be read" << endl;
+ cerr << "one or more files specified in INPUTS cannot be read" << endl;
+ finish(1);
+ }
+}
+
+
+void cleanFiles()
+{
+
+ cerr << "Last step: erasing temp files" << endl;
+ logFile << timeStr() << "Last step: erasing temp file" << endl;
+
+ if (variables.find("TEMPS") != variables.end()){ // the easy way
+ set<string> temps = splitBlank(variables["TEMPS"]);
+
+ logFile << timeStr()
+ << "will clean file listed in variable TEMPS" << endl;
+
+ for (set<string>::iterator t = temps.begin(); t != temps.end(); t++){
+ logFile << timeStr() << "removing " << *t << endl;
+ if (unlink((*t).c_str()) < 0){
+ logFile << timeStr() << "cannot remove file: " << *t << endl;
+ continue;
+ }
+ }
+ return;
+ }
+
+ logFile << timeStr()
+ << "variable TEMPS is not set - no cleaning done" << endl;
+}
+
+string doCommandStr(string);
+
+string substVars(string & in)
+{
+ string out = "";
+ string var;
+ int i = 0;
+ char vname[MAX_STRING+1];
+ char suff[MAX_STRING+1];
+ int noscan;
+
+ while (i < in.length()){
+ if (in[i] != '$')
+ out += in[i];
+ else {
+ if (in[i + 1] == '('){
+ i += 2;
+ var = "";
+ while (i < in.length() && in[i] != ')'){
+ if (in[i] == '\\' )
+ i++;
+ var += in[i++];
+ }
+ if (var.find_first_not_of("0123456789") == var.npos){
+ // string is a number
+ int n = strtol(var.c_str(), NULL, 10);
+ if (n >= cmdLnVars.size()){
+ cerr << "Cannot find command line parameter " << n << endl;
+ if (logFile.is_open())
+ logFile << timeStr() << "Cannot find command line parameter "
+ << n << endl;
+ finish(1);
+ }
+ out += cmdLnVars[n];
+ } else if (sscanf(var.c_str(), "%s %n", vname, &noscan) == 1 && string(vname) == "shell") { // shell command
+ string v = var.substr(noscan);
+ out += doCommandStr(v);
+ } else if (sscanf(var.c_str(), "strip %s %s", suff, vname) == 2){
+ if (variables.find(string(vname)) == variables.end()){
+ cerr << "Cannot substitute variable " << var << endl;
+ if (logFile.is_open())
+ logFile << timeStr() << "Cannot substitute variable "
+ << var << endl;
+ finish(1);
+ }
+ string v = variables[string(vname)];
+ string s = string(suff);
+ if (s.size() < v.size() && v.substr(v.size() - s.size()) == s){ // if suffix in string
+ v = v.substr(0, v.size() - s.size());
+ }
+ out += v;
+ } else {
+ if (variables.find(var) == variables.end()){
+ cerr << "Cannot substitute variable " << var << endl;
+ if (logFile.is_open())
+ logFile << timeStr() << "Cannot substitute variable "
+ << var << endl;
+ finish(1);
+ }
+ out += variables[var];
+ }
+ } else { // if not a $() string
+ out += in[i];
+ }
+ }
+ i++;
+ }
+ return out;
+} // substVars
+
+
+void processDefn(string def)
+{
+ int i = 0;
+ string name = "";
+ string value = "";
+ while (i < def.length() && def[i] != '=')
+ if (def[i] != ' ' && def[i] != '\t')
+ name += def[i++];
+ else
+ i++;
+
+ i++; //skip the equal sign
+
+ while (i < def.length() && (def[i] == ' ' || def[i] == '\t'))
+ i++; // skip white space
+
+ while (i < def.length())
+ value += def[i++];
+
+ if (variables.find(name) != variables.end())
+ return; // do nothing if variable already defined
+
+ variables[name] = substVars(value);
+}// processDefn
+
+
+void printHelpText()
+{
+ cout <<
+ "\n"
+ "USAGE:\n"
+ "\n"
+ "runAmos -C config_file [-D VAR=value] [-s start] [-e end] [-clean] [-ocd] prefix\n"
+ "\n"
+ "if the config file is not specified we use environment variable AMOSCONF\n"
+ "if a start step is specified (-s) starts with that command\n"
+ "if an end step is specified (-e) ends with the command prior to the number\n"
+ "if -E is specified, echo the commands to run, but don't actually run\n"
+ "if -clean is specified, all files listed in the TEMPS var get removed\n"
+ "if -ocd is specified checks that all files in the INPUTS variable exist\n"
+ "-D option allows variables to be defined outside of the conf file.\n"
+ " multiple such options are allowed\n"
+ "\n"
+ "e.g. runAmos -s 1 -e 5 will run steps 1, 2, 3, and 4.\n"
+
+ "Special variable PREFIX gets set to the prefix specified in the command line\n"
+ "Lines starting with # are comments\n"
+ "Lines starting with ## get displayed when next command is run\n"
+ "Lines starting with #? get displayed when both -h and -C are provided\n"
+ "\n"
+ "Example config file:\n"
+ "\n"
+ "PATH = /usr/local/bin # can also be set with -D command line option\n"
+ "PERL = $(PATH)/perl\n"
+ "\n"
+ "1: $(PERL) $(PREFIX).pl\n"
+ "2:\n"
+ "$(PERL) $(PREFIX)-1.pl\n"
+ "$(PERL) $(PREFIX)-2.pl\n"
+ << endl;
+} // printHelpText
+
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"conf", 1, 0, 'c'},
+ {"C", 1, 0, 'c'},
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"start", 1, 0, 's'},
+ {"s", 1, 0, 's'},
+ {"end", 1, 0, 'e'},
+ {"e", 1, 0, 'e'},
+ {"clean", 0, 0, 'x'},
+ {"ocd", 0, 0, 'o'},
+ {"D", 1, 0, 'D'},
+ {"E", 0, 0, 'E'},
+ {0, 0, 0, 0}
+ };
+
+ bool helpRequested = false;
+ bool confFile = false;
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1){
+ switch (c){
+ case 'c':
+ confFile = true;
+ globals["conffile"] = string(optarg);
+ break;
+ case 'h':
+ // printHelpText();
+ helpRequested = true;
+ break;
+ case 's':
+ globals["start"] = string(optarg);
+ break;
+ case 'e':
+ globals["end"] = string(optarg);
+ break;
+ case 'x':
+ globals["clean"] = "";
+ break;
+ case 'o':
+ globals["ocd"] = "";
+ break;
+ case 'D':
+ processDefn(string(optarg));
+ break;
+ case 'E':
+ ECHOMODE = 1;
+ break;
+ case '?':
+ return false;
+ }
+ } // while each parameter
+
+ if (helpRequested && confFile){
+ ifstream conf(globals["conffile"].c_str());
+ if (! conf.is_open()){
+ cerr << "Could not open config file " << confFile << endl;
+ finish(1);
+ }
+
+ string line;
+ while (getline(conf, line))
+ if (line.length() > 1 && line[0] == '#' && line[1] == '?') //help
+ cout << line.substr(2) << endl;;
+
+ exit(0);
+ } // if help and conf
+
+ if (helpRequested){
+ printHelpText();
+ exit(0);
+ } // if help
+
+ if (optind < argc){
+ variables["PREFIX"] = string(argv[optind]);
+ for (;optind < argc; optind++)
+ cmdLnVars.push_back(string(argv[optind]));
+ }
+
+ return true;
+} // GetOptions
+
+
+// returns the stdout of the command
+string doCommandStr(string command)
+{
+ ostringstream out;
+
+ command = substVars(command);
+
+ logFile << timeStr() << "Running: " << command << endl;
+
+ int fd[2];
+
+ if (pipe(fd) < 0){
+ logFile << timeStr() << "Failed to create pipe" << endl;
+ finish(1);
+ }
+
+ int status;
+
+ pid_t process = fork();
+
+ if (process == -1){
+ logFile << timeStr() << "Could not fork!" << endl;
+ finish(1);
+ }
+
+ if (process == 0){ // child
+ close(fd[0]); // don't need to read
+
+ if (dup2(fd[1], fileno(stdout)) == -1){// redirect stdout
+ logFile << timeStr() << "Could not redirect stdout" << endl;
+ finish(1);
+ }
+ execlp("/bin/sh", "/bin/sh", "-c", command.c_str(), NULL);
+
+ logFile << timeStr() << "Could not exec command: " << command << endl;
+ finish(1);
+ } else {
+ close(fd[1]);
+ char buf[MAX_STRING+1];
+ int nread;
+ while ((nread = read(fd[0], buf, MAX_STRING)) > 0){
+ buf[nread] = 0;
+ // printf("got %s\n", buf);
+ out.write(buf, nread);
+ }
+ if (nread == -1)
+ logFile << timeStr() << "Could not read from pipe" << endl;
+
+ // logFile << "waiting " << endl;
+
+ close(fd[0]);
+ waitpid(process, & status, 0);
+ }
+
+#ifdef WCOREDUMP
+ if (WCOREDUMP(status)){
+ logFile << timeStr() << "Command: " << command << " exited with a coredump"
+ << endl;
+ cerr << "Command: " << command << " exited with a coredump" << endl;
+ finish(1);
+ }
+#endif
+
+ if (WIFEXITED(status) == 0){
+ logFile << timeStr() << "Command: " << command << " failed: likely through abort() or coredump" << endl;
+ cerr << "Command: " << command << " failed: likely through abort() or coredump" << endl;
+ finish(1);
+ }
+
+ // here we assume that WIFEXITED(status) is non null(should have been caught)
+
+ if (WEXITSTATUS(status) != 0){
+ logFile << timeStr() << "Command: " << command << " exited with status: "
+ << WEXITSTATUS(status) << endl;
+ cerr << "Command: " << command << " exited with status: " << WEXITSTATUS(status) << endl;
+ finish(1);
+ }
+
+ string outstr = out.str();
+ for (int s = 0; s < outstr.size(); s++)
+ if (outstr[s] == '\n')
+ outstr[s] = ' ';
+
+ return outstr;
+} // doCommandStr
+
+void doCommand(string command)
+{
+ command = substVars(command);
+
+ logFile << timeStr() << "Running: " << command << endl;
+
+ if (ECHOMODE) { return; }
+
+ int fd[2];
+
+ if (pipe(fd) < 0){
+ logFile << timeStr() << "Failed to create pipe" << endl;
+ finish(1);
+ }
+
+ int status;
+
+ pid_t process = fork();
+
+ if (process == -1){
+ logFile << timeStr() << "Could not fork!" << endl;
+ finish(1);
+ }
+
+ if (process == 0){ // child
+ close(fd[0]); // don't need to read
+
+ if (dup2(fd[1], fileno(stdout)) == -1){// redirect stdout
+ logFile << timeStr() << "Could not redirect stdout" << endl;
+ finish(1);
+ }
+
+ if (dup2(fd[1], fileno(stderr)) == -1){ // redirect stderr
+ logFile << timeStr() << "Could not redirect stderr" << endl;
+ finish(1);
+ }
+
+ execlp("/bin/sh", "/bin/sh", "-c", command.c_str(), NULL);
+
+ logFile << timeStr() << "Could not exec command: " << command << endl;
+ finish(1);
+ } else {
+ close(fd[1]);
+ char buf[MAX_STRING+1];
+ int nread;
+ while ((nread = read(fd[0], buf, MAX_STRING)) > 0){
+ buf[nread] = 0;
+ // printf("got %s\n", buf);
+ logFile.write(buf, nread);
+ }
+ if (nread == -1)
+ logFile << timeStr() << "Could not read from pipe" << endl;
+
+ // logFile << "waiting " << endl;
+
+ close(fd[0]);
+ waitpid(process, & status, 0);
+ }
+
+#ifdef WCOREDUMP
+ if (WCOREDUMP(status)){
+ logFile << timeStr() << "Command: " << command << " exited with a coredump"
+ << endl;
+ cerr << "Command: " << command << " exited with a coredump" << endl;
+ finish(1);
+ }
+#endif
+
+ if (WIFEXITED(status) == 0){
+ logFile << timeStr() << "Command: " << command << " failed: likely through abort() or coredump" << endl;
+ cerr << "Command: " << command << " failed: likely through abort() or coredump" << endl;
+ finish(1);
+ }
+
+ // here we assume that WIFEXITED(status) is non null(should have been caught)
+
+ if (WEXITSTATUS(status) != 0){
+ logFile << timeStr() << "Command: " << command << " exited with status: "
+ << WEXITSTATUS(status) << endl;
+ cerr << "Command: " << command << " exited with status: " << WEXITSTATUS(status) << endl;
+ finish(1);
+ }
+} // doCommand
+
+
+
+//--------------------------------------------------------
+int main(int argc, char ** argv)
+{
+
+ if (!GetOptions(argc, argv)){
+ cerr << "Command line parsing failed, use -h option for usage info"
+ << endl;
+ //printHelpText();
+ finish(1);
+ }
+
+ char * amosConf;
+ if (globals.find("conffile") == globals.end()){
+ amosConf = getenv("AMOSCONF");
+ if (amosConf == NULL){
+ cerr << "A configuration file must be passed either through command line\n"
+ "option -C or through environment variable AMOSCONF" << endl;
+ finish(1);
+ }
+ confFile = string(amosConf);
+ } else
+ confFile = globals["conffile"];
+
+
+ vector<pair<string, int> > steps; //steps that will be executed
+ vector<string> commands; // commands that will be executed
+
+ ifstream conf(confFile.c_str());
+ if (! conf.is_open()){
+ cerr << "Could not open config file " << confFile << endl;
+ finish(1);
+ }
+
+ if (variables.find("PREFIX") != variables.end()){
+ logFile.open((variables["PREFIX"] + ".runAmos.log").c_str(), ios::out | ios::app);
+ logFileName = variables["PREFIX"] + ".runAmos.log";
+ } else {
+ logFile.open("runAmos.log", ios::out | ios::app);
+ logFileName = "runAmos.log";
+ }
+
+ if (!logFile.is_open()){
+ cerr << "Cannot open logfile!" << endl;
+ finish(1);
+ } else {
+ cout << "The log file is: " << logFileName << endl;
+ }
+
+ logFile.setf(ios::unitbuf); // make sure buffer flushes on endls
+
+ if (globals.find("start") != globals.end() &&
+ globals.find("end") != globals.end()){
+
+ if (strtol(globals["start"].c_str(), NULL, 10) >
+ strtol(globals["end"].c_str(), NULL, 10)){
+ logFile << timeStr() << "Start must be less than end\n" << endl;
+ finish(1);
+ }
+ }
+
+ string line;
+ int lineno = 0;
+ string message;
+ bool multiline = false;
+ bool continuation = false;
+ string outline = "";
+ int currstep = -1;
+ int step;
+ int noscan;// where scanf stops
+ time_t start;
+ bool noop = false;
+
+ allstart = time(NULL);
+
+
+ char * temp;
+ string user;
+ string host;
+
+ temp = getenv("USER");
+ if (temp == NULL)
+ user = "UNKNOWN";
+ else
+ user = string(temp);
+
+ temp = getenv("HOSTNAME");
+ if (temp == NULL)
+ host = "UNKNOWN";
+ else
+ host = string(temp);
+
+ logFile << timeStr() << "Started by " << user << "@" << host << " on "
+ << ctime(&allstart) << endl;
+
+ // before running make sure everything is kosher
+ if (globals.find("ocd") != globals.end()){
+ globals.erase("ocd");
+ checkFiles();
+ }
+
+ while (getline(conf, line)){
+ lineno++;
+ if (line.length() > 1 && line[0] == '#' && line[1] == '#'){ // message - will be saved
+ message = line.substr(2);
+ continue;
+ }
+ if (line.length() > 0 && line[0] == '#')
+ continue; // comment
+
+ bool space = true;
+ for (int i = 0; i < line.length(); i++)
+ if (! isspace(line[i])){
+ space = false;
+ break;
+ }
+
+ if (space)
+ continue; // skip empty lines
+
+ int numvars;
+ if (sscanf(line.c_str(), "EXPECT %d", &numvars) == 1){
+ // cout << "Expecting " << numvars << endl;
+ if (cmdLnVars.size() < numvars){
+ cerr << "Expecting " << numvars
+ << " parameters. Try -h for usage info" <<endl;
+ finish(1);
+ }
+ continue;
+ }
+
+ if (multiline){ // part of a multi-line command
+ if (line.length() == 1 && line[0] == '.'){ // end multiline
+ multiline = false;
+ noop = false;
+ if (continuation){
+ doCommand(outline);
+ }
+ continuation = false;
+ outline = "";
+ logFile << timeStr() << "Done! Elapsed time:"
+ << elapsed(time(NULL) - start) << endl;
+ continue;
+ }
+
+ if (! noop){
+ if (line.substr(line.size() - 1) == "\\"){ // is continuation line
+ outline += line.substr(0, line.size() - 1);
+ continuation = true;
+ } else if (continuation){
+ outline += line;
+ doCommand(outline);
+ outline = "";
+ continuation = false;
+ } else
+ doCommand(line);
+ }
+
+ continue;
+ } // multiline command
+
+ if (sscanf(line.c_str(), "%d : %n", &step, &noscan) >= 1 ) {// numbered command
+ if (step <= currstep){
+ logFile << timeStr() << "Steps appear out of order at line " << lineno
+ << " in " << confFile << endl;
+ cerr << "Steps appear out of order at line " << lineno
+ << " in " << confFile << endl;
+ finish(1);
+ } else
+ currstep = step;
+
+
+ if (globals.find("start") != globals.end() &&
+ strtol(globals["start"].c_str(), NULL, 10) > currstep)
+ noop = true;
+ if (globals.find("end") != globals.end() &&
+ strtol(globals["end"].c_str(), NULL, 10) < currstep)
+ noop = true;
+
+ if (! noop) {
+ ostringstream msg;
+ msg << "step " << step;
+ if (message.length() != 0){
+ msg << ": " << message;
+ message = "";
+ }
+ // steps.push_back(pair<string, int> (msg.str(), commands.size()));
+ cout << "Doing " << msg.str() << endl;
+ logFile << timeStr() << "Doing " << msg.str() << endl;
+ }
+
+ if (line.substr(noscan).length() == 0) {// multiline command
+ multiline = true;
+ start = time(NULL);
+ continue;
+ } else {
+ if (! noop){
+ // commands.push_back(line.substr(noscan));
+ start = time(NULL);
+ doCommand(line.substr(noscan));
+ logFile << timeStr() << "Done! Elapsed time:"
+ << elapsed(time(NULL) - start) << endl;
+ }
+ noop = false;
+ }
+
+ continue;
+ } // numbered commands
+
+ char varname[MAX_STRING+1];
+ char c;
+ if (sscanf(line.c_str(), "%[a-zA-Z0-9_-] %c %n", varname, &c, &noscan) >= 2 && c == '='){
+ // cout << line << " is variable definition \n";
+ processDefn(line); // variable definition
+ continue;
+ }
+
+ logFile << timeStr() << "Cannot parse line " << lineno << " in "
+ << confFile << ":" << endl << line << endl;
+ cerr << "Cannot parse line " << lineno << " in "
+ << confFile << endl;
+ finish(1);
+ } // while each line in configuration file
+
+
+// for (int vi = 0; vi < steps.size(); vi++){
+// int lastcmd;
+// start = time(NULL);
+// cout << "Doing " << steps[vi].first << endl;
+// logFile << timeStr() << "Doing " << steps[vi].first << endl;
+// if (vi == steps.size() - 1)
+// lastcmd = commands.size();
+// else
+// lastcmd = steps[vi + 1].second;
+
+// for (int ci = steps[vi].second; ci < lastcmd; ci++)
+// doCommand(commands[ci]);
+
+// logFile << timeStr() << "Done! Elapsed time:"
+// << elapsed(time(NULL) - start) << endl;
+// }
+
+ if (globals.find("clean") != globals.end())
+ cleanFiles();
+
+ // successful end
+ finish(0);
+}// main
diff --git a/src/Utils/runTA.pl b/src/Utils/runTA.pl
new file mode 100755
index 0000000..cac758e
--- /dev/null
+++ b/src/Utils/runTA.pl
@@ -0,0 +1,145 @@
+#!/usr/local/bin/perl
+
+# $Id$
+#
+# Runs TIGR Assembler.
+#
+# Copyright @ 2002, The Institute for Genomic Research (TIGR). All
+# rights reserved.
+
+# This software is provided "AS IS". TIGR makes no warranties, express
+# or implied, including no representation or warranty with respect to
+# the performance of the software and derivatives or their safety,
+# effectiveness, or commercial viability. TIGR does not warrant the
+# merchantability or fitness of the software and derivatives for any
+# particular purpose, or that they may be exploited without infringing
+# the copyrights, patent rights or property rights of others. TIGR shall
+# not be liable for any claim, demand or action for any loss, harm,
+# illness or other damage or injury arising from access to or use of the
+# software or associated information, including without limitation any
+# direct, indirect, incidental, exemplary, special or consequential
+# damages.
+
+# This software program may not be sold, leased, transferred, exported
+# or otherwise disclaimed to anyone, in whole or in part, without the
+# prior written consent of TIGR.
+
+use strict;
+use TIGR::Foundation;
+
+my $base = new TIGR::Foundation;
+if (! defined $base){
+ die("Wierd problem!\n");
+}
+
+my $VERSION = '1.0 $Revision$ ';
+
+# location of TIGR Assembler
+my $TA = "/usr/local/bin/TIGR_Assembler";
+
+# Default parameters
+my %params = (
+ "g" => 8,
+ "l" => 40,
+ "e" => 15,
+ "p" => 97.5
+ );
+
+my $HELP_INFO = qq~
+ runTA [options] [-C contig_file] [-q qual_file] seq_file.
+
+ Quality file is optional.
+ Contig file is only required when jumpstarting.
+ For information about the other options, please run:
+ '$TA -h'
+ ~;
+
+$base->setHelpInfo($HELP_INFO);
+
+my $err = $base->TIGR_GetOptions(
+ 'C=s' => \&appOptions, # contig file
+ 'e=s' => \&appOptions, # end
+ 'k=i' => \&appOptions, # max match len
+ 'g=i' => \&appOptions, # maxerr 32
+ 'l=i' => \&appOptions, # minlen
+ 'p=f'=> \&appOptions, # min pct
+ 'q=s'=> \&appOptions, # qual file
+ 's!'=> \&appOptions, # use singletons
+ 'Y=i'=> \&appOptions, # safe file size
+ 'a=s'=> \&appOptions, # alignment_directory
+ 'A=s'=> \&appOptions, # ace_output_file
+ 'b=i'=> \&appOptions, # buffer size
+ 'c=s'=> \&appOptions, # coverage_filename
+ 'd'=> \&appOptions, # -
+ 'D=s'=> \&appOptions, # phd_dir
+ 'E=i'=> \&appOptions, # phd_dir
+ 'f=s'=> \&appOptions, # fasta_file
+ 'F=s'=> \&appOptions, # repeat_file
+ 'G=s'=> \&appOptions, # grouper file
+ 'J=s'=> \&appOptions, # dump_file
+ 'L'=> \&appOptions, # -
+ 'n=s'=> \&appOptions, # asm_prefix
+ 'N'=> \&appOptions, # -
+ 'o=s'=> \&appOptions, # score file
+ 'P'=> \&appOptions, # -
+ 'r=i'=> \&appOptions, # resort number
+ 'R'=> \&appOptions, # -
+ 'S=i'=> \&appOptions, # max_span_len
+ 't'=> \&appOptions, # -
+ 'T'=> \&appOptions, # -
+ 'u'=> \&appOptions, # -
+ 'w=i'=> \&appOptions, # number of threads
+ 'x'=> \&appOptions, # -
+ 'X'=> \&appOptions, # -
+ 'y=i'=> \&appOptions, # repeat_num_cutoff
+ 'z=i'=> \&appOptions, # num_conflicts
+ 'Z'=> \&appOptions # -
+ );
+
+my $seqFile = $ARGV[0];
+$seqFile =~ /(\S+)\.seq/;
+
+my $prefix;
+if (! defined $1){
+ $prefix = $seqFile;
+} else {
+ $prefix = $1;
+}
+
+
+my $AlignFile = "$prefix.align"; $params{"a"} = $AlignFile;
+my $OutFile = "$prefix.asm";
+my $FastaFile = "$prefix.fasta"; $params{"f"} = $FastaFile;
+my $SCRATCH = "$prefix.scratch";
+
+if (! defined $seqFile){
+ $base->bail("You must provide a sequence file");
+}
+
+if (! -f $seqFile){
+ $base->bail("Cannot read sequence file");
+}
+
+my $TA_cmd = "$TA";
+while (my ($parm, $val) = each %params){
+ if (defined $val){
+ $TA_cmd .= " -$parm $val";
+ } else {
+ $TA_cmd .= " -$parm";
+ }
+}
+
+$TA_cmd .= " $SCRATCH";
+
+open(STDIN, $ARGV[0]) || $base->bail("Cannot open $ARGV[0]: $!");
+print STDERR "Running $TA_cmd\n";
+open(STDERR, ">$prefix.stderr") || $base->bail("Cannot open $prefix.stderr: $!");
+open(STDOUT, ">$OutFile") || $base->bail("Cannot open output \"$OutFile\": $!");
+exec($TA_cmd) || $base->bail("Could not execute TIGR Assembler\n");
+
+exit(0);
+
+sub appOptions
+{
+ $params{$_[0]} = $_[1];
+}
diff --git a/src/Utils/sort2.pl b/src/Utils/sort2.pl
new file mode 100755
index 0000000..0d52bd2
--- /dev/null
+++ b/src/Utils/sort2.pl
@@ -0,0 +1,88 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+
+# TIGR Modules
+use TIGR::Foundation;
+
+my $tigr_tf = new TIGR::Foundation;
+my $PRG = $tigr_tf->getProgramInfo('name');
+my $REV="1.0";
+my @DEPENDS=("TIGR::Foundation");
+
+# help info
+my $HELPTEXT = qq~
+Program that sorts numerically a TAB file according to 2 columns
+
+Usage: $PRG file [options]
+
+ INPUT:
+ TAB delimited file; The sorting columns (start from 0) must have numeric values
+
+ options:
+
+ -i <n> - First column to sort after (Default 0)
+ -j <n> - Second column to sort after (Default 1)
+
+ -h|help - Print this help and exit;
+ -V|version - Print the version and exit;
+ -depend - Print the program and database dependency list;
+ -debug <level> - Set the debug <level> (0, non-debug by default);
+
+ OUTPUT:
+~;
+
+my $MOREHELP = qq~
+Return Codes: 0 - on success, 1 - on failure.
+~;
+
+
+###############################################################################
+#
+# Main program
+#
+###############################################################################
+
+MAIN:
+{
+ my $i=0;
+ my $j=1;
+ my %h;
+
+ # Configure TIGR Foundation
+ $tigr_tf->setHelpInfo($HELPTEXT.$MOREHELP);
+ $tigr_tf->setUsageInfo($HELPTEXT);
+ $tigr_tf->setVersionInfo($REV);
+ $tigr_tf->addDependInfo(@DEPENDS);
+
+ # validate input parameters
+ my $result = $tigr_tf->TIGR_GetOptions(
+ "i=i" => \$i,
+ "j=i" => \$j
+ );
+ $tigr_tf->printUsageInfoAndExit() if (!$result);
+
+ #parse input file
+ while(<>)
+ {
+ my @f=split;
+ next unless(@f);
+
+ my @fi=split //,$f[$i];
+ my @fj=split //,$f[$j];
+
+ while(scalar(@fi)<7) { unshift @fi,0; }
+ while(scalar(@fj)<7) { unshift @fj,0; }
+
+ my $key=join "",(@fi, at fj);
+ $h{$key}=$_;
+ }
+
+ foreach my $key (sort {$a<=>$b} keys %h)
+ {
+ print $h{$key};
+ }
+
+ exit 0;
+}
diff --git a/src/Utils/stats.pl b/src/Utils/stats.pl
new file mode 100755
index 0000000..04d5fca
--- /dev/null
+++ b/src/Utils/stats.pl
@@ -0,0 +1,266 @@
+#!/usr/bin/perl -w
+use strict;
+use Getopt::Long;
+use Statistics::Descriptive;
+
+my $genomelen = undef;
+my $bigcutoffs = undef;
+my $computemedian = undef;
+my $trimmean = undef;
+my $hist = undef;
+my $cdf = undef;
+my $percentiles = undef;
+my $fields = undef;
+
+my $helpflag = 0;
+my $result = GetOptions(
+ "h" => \$helpflag,
+ "n50=s" => \$genomelen,
+ "big=s" => \$bigcutoffs,
+ "median" => \$computemedian,
+ "trimmean=s" => \$trimmean,
+ "hist=s" => \$hist,
+ "cdf=s" => \$cdf,
+ "percentiles=s" => \$percentiles,
+ "fields=s" => \$fields,
+);
+
+
+if ($helpflag)
+{
+ die "stats.pl [-f f1,f2,fn] [-n50 int] [-big s1,s2,sn] [-median] [-trimmean frac] [-hist buckets] [-cdf t1,t2,t3] [-percentiles p1,p2,p3]\n";
+}
+
+my @stats;
+my @f2s;
+
+my %bigstats;
+
+if (defined $fields)
+{
+ foreach my $f (split /,/, $fields)
+ {
+ push @f2s, ($f-1); ## accept 1 based fields, convert to 0-based internally
+ }
+}
+
+if (defined $bigcutoffs)
+{
+ foreach my $s (split /,/, $bigcutoffs)
+ {
+ $bigstats{$s}->{sum} = 0;
+ $bigstats{$s}->{cnt} = 0;
+ }
+}
+
+while (<>)
+{
+ chomp;
+ my @vals = split /\s+/;
+
+ if (defined $fields)
+ {
+ for(my $i = 0; $i < scalar @f2s; $i++)
+ {
+ if (!defined $stats[$i])
+ {
+ $stats[$i] = Statistics::Descriptive::Full->new();
+ }
+
+ $stats[$i]->add_data($vals[$f2s[$i]]);
+ }
+ }
+ else
+ {
+ for (my $i = 0; $i < scalar @vals; $i++)
+ {
+ if (!defined $stats[$i])
+ {
+ $stats[$i] = Statistics::Descriptive::Full->new();
+ }
+
+ $stats[$i]->add_data($vals[$i]);
+ }
+ }
+}
+
+for (my $i = 0; $i < scalar @stats; $i++)
+{
+ my $num = $stats[$i]->count();
+ my $min = $stats[$i]->min();
+ my $max = $stats[$i]->max();
+ my $mean = sprintf("%0.01f", $stats[$i]->mean());
+ my $stdev = sprintf("%0.01f", $stats[$i]->standard_deviation());
+
+ my $idx = $i+1;
+
+ if (defined $fields)
+ {
+ $idx = $f2s[$i]+1;
+ }
+
+ print "$idx: n=$num [$min, $max] $mean +/- $stdev";
+
+ if (defined $computemedian)
+ {
+ my $median=$stats[$i]->median();
+ print " median=$median";
+ }
+
+ if (defined $trimmean)
+ {
+ my $trim = sprintf("%0.01f", $stats[$i]->trimmed_mean($trimmean));
+ print " trimmean=$trim";
+ }
+
+ my @arr = sort {$b <=> $a} $stats[$i]->get_data();
+
+ my $n50target = $stats[$i]->sum()/2;
+
+ if (defined $genomelen)
+ {
+ $n50target = $genomelen / 2;
+ }
+
+ my $sum = 0;
+ my $sumsq = 0;
+ my $n50 = undef;
+ my $n50cnt = undef;
+ my $j = 0;
+
+ my $numbig = 0;
+ my $sumbig = 0;
+ foreach my $s (@arr)
+ {
+ #if ($j < 5) { print " $s"; }
+ $j++;
+
+ $sumsq += ($s * $s);
+ $sum += $s;
+
+ if (($sum >= $n50target) && (!defined $n50))
+ {
+ $n50 = $s;
+ $n50cnt = $j;
+ }
+
+ if (defined $bigcutoffs)
+ {
+ foreach my $c (keys %bigstats)
+ {
+ if ($s >= $c)
+ {
+ $bigstats{$c}->{sum} += $s;
+ $bigstats{$c}->{cnt}++;
+ }
+ }
+ }
+ }
+
+ print " sum=",$stats[$i]->sum();
+ print " n50=$n50 n50cnt=$n50cnt";
+
+ if (defined $genomelen)
+ {
+ my $f = sprintf("%0.02f", $sumsq / $genomelen);
+ print " f=$f";
+
+ my $cov = sprintf("%0.02f", $stats[$i]->sum() / $genomelen);
+ print " cov=$cov";
+ }
+ else
+ {
+ my $f = sprintf("%0.02f", $sumsq / $stats[$i]->sum());
+ print " f=$f";
+ }
+
+ if (defined $bigcutoffs)
+ {
+ foreach my $t (sort {$a <=> $b} keys %bigstats)
+ {
+ my $s = $bigstats{$t}->{sum};
+ my $c = $bigstats{$t}->{cnt};
+
+ if (defined $genomelen)
+ {
+ my $cov = sprintf("%0.02f", $s / $genomelen);
+ print " #>$t=$c s>$t=$s c>$t=$cov";
+ }
+ else
+ {
+ print " #>$t=$c s>$t=$s";
+ }
+ }
+ }
+
+ print "\n";
+
+ if (defined $hist)
+ {
+ my %f = $stats[$i]->frequency_distribution($hist);
+ my $num = $stats[$i]->count();
+
+ print "Histogram with $hist bins of $num elements\n";
+
+ my @cutoffs = sort {$a <=> $b} keys %f;
+
+ for(my $j = 0; $j < scalar @cutoffs; $j++)
+ {
+ my $cutoff = $cutoffs[$j];
+ my $freq = $f{$cutoff};
+ my $perc = sprintf("%0.01f", 100*$freq/$num);
+ print "$j\t$cutoff\t$freq\t$perc\n";
+ }
+
+ print "\n";
+ }
+
+ if (defined $cdf)
+ {
+ my @breakpoints = sort {$a <=> $b} split /,/,$cdf;
+ my $num = $stats[$i]->count();
+
+ my $numbreakpoints = scalar @breakpoints;
+
+ print "CDF\n";
+
+ my $cnt = 0;
+ my $threshold = shift @breakpoints;
+ foreach my $val (sort {$a <=> $b} $stats[$i]->get_data())
+ {
+ if ($val > $threshold)
+ {
+ my $perc = sprintf("%0.01f", 100*$cnt/$num);
+ print "$threshold\t$cnt\t$perc\n";
+
+ if (scalar @breakpoints)
+ {
+ $threshold = shift @breakpoints;
+ }
+ else
+ {
+ $threshold = $stats[$i]->max();
+ }
+ }
+
+ $cnt++;
+ }
+
+ my $perc = sprintf("%0.01f", 100*$cnt/$num);
+ print "$threshold\t$cnt\t$perc\n";
+ print "\n";
+ }
+
+ if (defined $percentiles)
+ {
+ my @percentiles = sort {$a <=> $b} split /,/, $percentiles;
+
+ print "Percentiles\n";
+
+ foreach my $p (@percentiles)
+ {
+ my ($x,$index) = $stats[$i]->percentile($p);
+ print "$p\%\t$x\t$index\n";
+ }
+ }
+}
diff --git a/src/Utils/tagsum-reduce.cc b/src/Utils/tagsum-reduce.cc
new file mode 100644
index 0000000..84fb55f
--- /dev/null
+++ b/src/Utils/tagsum-reduce.cc
@@ -0,0 +1,33 @@
+#include <string>
+#include <iostream>
+using namespace std;
+
+int main (int argc, char * argv [])
+{
+ string mykmer, kmer;
+ unsigned long long int mycount, count;
+
+ // read initial line
+ cin >> mykmer;
+ cin >> mycount;
+
+ while(cin >> kmer) {
+ cin >> count;
+
+ // if same as last, increment count
+ if(kmer == mykmer) {
+ mycount += count;
+
+ // else print last, initialize new
+ } else {
+ cout << mykmer << "\t" << mycount << endl;
+ mykmer = kmer;
+ mycount = count;
+ }
+ }
+
+ // print last
+ cout << mykmer << "\t" << mycount << endl;
+
+ return 0;
+}
diff --git a/src/Utils/translate-fasta.pl b/src/Utils/translate-fasta.pl
new file mode 100755
index 0000000..12b39cf
--- /dev/null
+++ b/src/Utils/translate-fasta.pl
@@ -0,0 +1,83 @@
+#!/usr/bin/perl -w
+use strict;
+
+my $USAGE = "Translate the sequences in a FASTA file between the optional given positions\nUSAGE: $0 <fasta_file> [startpos stoppos]\n";
+
+my %codon =
+(
+ "TTT" => "F", "TTC" => "F", "TTA" => "L", "TTG" => "L",
+ "TCT" => "S", "TCC" => "S", "TCA" => "S", "TCG" => "S",
+ "TAT" => "Y", "TAC" => "Y", "TAA" => "*", "TAG" => "*",
+ "TGT" => "C", "TGC" => "C", "TGA" => "*", "TGG" => "W",
+ "CTT" => "L", "CTC" => "L", "CTA" => "L", "CTG" => "L",
+ "CCT" => "P", "CCC" => "P", "CCA" => "P", "CCG" => "P",
+ "CAT" => "H", "CAC" => "H", "CAA" => "Q", "CAG" => "Q",
+ "CGT" => "R", "CGC" => "R", "CGA" => "R", "CGG" => "R",
+ "ATT" => "I", "ATC" => "I", "ATA" => "I", "ATG" => "M",
+ "ACT" => "T", "ACC" => "T", "ACA" => "T", "ACG" => "T",
+ "AAT" => "N", "AAC" => "N", "AAA" => "K", "AAG" => "K",
+ "AGT" => "S", "AGC" => "S", "AGA" => "R", "AGG" => "R",
+ "GTT" => "V", "GTC" => "V", "GTA" => "V", "GTG" => "V",
+ "GCT" => "A", "GCC" => "A", "GCA" => "A", "GCG" => "A",
+ "GAT" => "D", "GAC" => "D", "GAA" => "E", "GAG" => "E",
+ "GGT" => "G", "GGC" => "G", "GGA" => "G", "GGG" => "G",
+);
+
+
+sub printTranslate
+{
+ my $seq = shift;
+ my $start = shift;
+ my $end = shift;
+
+ return if !defined $seq;
+
+ $start = 1 if !defined $start;
+ $end = length($seq) if !defined $end;
+
+
+ $start--;
+
+ my $s = substr($seq, $start, $end-$start);
+ my $l = length ($s);
+
+ my $aaseq;
+
+ for (my $i = 0; $i+2 < $l; $i+=3)
+ {
+ my $aa = $codon{uc(substr($s, $i, 3))};
+ $aaseq .= $aa;
+ }
+
+ my $aalen = length($aaseq);
+
+ for (my $i = 0; $i < $aalen; $i += 60)
+ {
+ print substr($aaseq, $i, 60), "\n";
+ }
+}
+
+
+
+my $file = shift @ARGV or die $USAGE;
+my $start = shift @ARGV;
+my $end = shift @ARGV;
+
+open FASTA, "< $file" or die "Can't open $file for reading ($!)\n";
+
+
+my $seq;
+while (<FASTA>)
+{
+ if (/\>/) { printTranslate($seq, $start, $end); print $_; }
+ else
+ {
+ chomp;
+ $seq .= $_;
+ }
+}
+
+printTranslate($seq, $start, $end);
+
+
+
diff --git a/src/Utils/trimByOvl.cc b/src/Utils/trimByOvl.cc
new file mode 100644
index 0000000..27d0469
--- /dev/null
+++ b/src/Utils/trimByOvl.cc
@@ -0,0 +1,289 @@
+// $Id$
+
+// trimByOvl.cc - uses the overlaps between reads to decide trimming
+// coordinates
+
+//#include <Overlap_AMOS.hh>
+#include "datatypes_AMOS.hh"
+#include <iostream>
+#include <fstream>
+#include <map>
+#include <vector>
+#include <stdio.h>
+#include <algorithm>
+#include <stdlib.h>
+
+using namespace std;
+using namespace AMOS;
+
+#undef howmany // on the alphas with gcc3.3.2 this causes problems ???
+
+#define MAXOVL 10 // max overlap between ranges
+
+struct olap_t {
+ // long idA, idB;
+ Range_t rangeA, rangeB;
+ bool forw;
+ // int lenA, lenB;
+ float perror;
+};
+
+struct position_t {
+ Pos_t x;
+ bool start; // true - start of range, false - end of range
+ position_t (Pos_t xx, bool ss) : x(xx), start(ss) {};
+};
+
+struct cmpOlapByA : public binary_function<olap_t, olap_t, bool> {
+ bool operator()(olap_t x, olap_t y)
+ {
+ if (x.rangeA.begin < y.rangeA.begin)
+ return true;
+ if (x.rangeA.begin > y.rangeA.begin)
+ return false;
+ if (x.rangeA.end < y.rangeA.end)
+ return true;
+ return false;
+ }
+};
+
+struct cmpPos : public binary_function<position_t, position_t, bool> {
+ bool operator () (position_t x, position_t y)
+ {
+ if (x.x < y.x)
+ return true;
+ if (x.x == y.x && x.start && !y.start)
+ return true; // beginnings come before ends
+ return false;
+ }
+};
+
+int main(int argc, char **argv)
+{
+
+ if (argc < 2 || argc > 3){
+ cerr << "Usage: trimByOvl file.ovl [n]" << endl;
+ cerr << "n - number of fragments" << endl;
+ exit(1);
+ }
+
+
+ // main assumption here is that the incoming ids are a contiguous set of
+ // integers starting at 0 (or 1)
+ vector<vector<olap_t> > olapmap;
+ vector<long int> how_many(0);
+
+ if (argc == 3){
+ olapmap.reserve(strtol(argv[2], NULL, 10) + 1);
+ olapmap.resize(strtol(argv[2], NULL, 10) + 1);
+ how_many.reserve(strtol(argv[2], NULL, 10) + 1);
+ how_many.resize(strtol(argv[2], NULL, 10) + 1, 0);
+ }
+
+ ifstream inFile(argv[1]);
+
+ if (inFile == (ifstream *) NULL){
+ cerr << "Cannot open input file: " << argv[1] << endl;
+ exit(1);
+ }
+
+ char outfilename[256];
+ sprintf(outfilename, "%s.guess", argv[1]);
+
+ ofstream outFile(outfilename);
+
+ if (!outFile.is_open()){
+ cerr << "Could not open output file: " << outfilename << endl;
+ exit(1);
+ }
+
+ long whichLine = 0;
+ string inputLine;
+
+ cerr << "counting overlaps" << endl;
+ while (getline(inFile, inputLine)){
+ whichLine++;
+
+ if (whichLine % 10000 == 0)
+ cerr << whichLine << "\r";
+
+ long idA, idB;
+ char dir;
+ int startA, startB, endA, endB, lenA, lenB;
+ float perror;
+ olap_t overlap;
+
+ if (sscanf(inputLine.c_str(), "%ld %ld %c %d %d %d %d %d %d %f",
+ &idA, &idB, &dir, &startA, &endA, &lenA,
+ &startB, &endB, &lenB, &perror) != 10){
+ cerr << "Cannot parse line " << whichLine << " in the input:" << endl << inputLine << endl;
+ continue;
+ }
+
+ how_many[idA]++;
+ how_many[idB]++;
+ }
+
+
+ cerr << "Reserving memory" << endl;
+ for (int i = 0; i < how_many.size(); i++){
+ olapmap[i].reserve(how_many[i]);
+ // olapmap[i].resize(how_many[i]);
+ }
+
+
+ cerr << "Rereading the file " << endl;
+
+
+ inFile.clear();
+ inFile.seekg(0, ios::beg);
+ whichLine = 0;
+
+ while (getline(inFile, inputLine)){
+ whichLine++;
+
+ // cerr << "whichLine" << endl;
+ // cerr << "Line is " << inputLine << endl;
+
+ if (whichLine % 10000 == 0)
+ cerr << whichLine << "\r";
+
+ long idA, idB;
+ char dir;
+ int startA, startB, endA, endB, lenA, lenB;
+ float perror;
+ olap_t overlap;
+
+ if (sscanf(inputLine.c_str(), "%ld %ld %c %d %d %d %d %d %d %f",
+ &idA, &idB, &dir, &startA, &endA, &lenA,
+ &startB, &endB, &lenB, &perror) != 10){
+ cerr << "Cannot parse line " << whichLine << " in the input:" << endl << inputLine << endl;
+ continue;
+ }
+
+ if (startA == endA || startB == endB){
+ cerr << "Line " << whichLine << " in the input seems incorrect: " << endl << inputLine <<endl;
+ continue;
+ }
+ overlap.perror = perror;
+ overlap.forw = (dir == 'f');
+ overlap.rangeA = Range_t(startA, endA);
+ overlap.rangeB = Range_t(startB, endB);
+
+ if (idA >= olapmap.capacity())
+ olapmap.resize(idA + 1);
+
+ // cerr << "Adding to " << idA << " " << overlap.rangeA.getBegin() << ", " << overlap.rangeA.getEnd() <<endl;
+
+ olapmap[idA].push_back(overlap);
+
+ if (startB < endB){
+ overlap.rangeA = Range_t(startB, endB);
+ overlap.rangeB = Range_t(startA, endA);
+ } else {
+ overlap.rangeA = Range_t(endB, startB);
+ overlap.rangeB = Range_t(endA, startA);
+ }
+ overlap.perror = perror;
+ overlap.forw = (dir == 'f');
+
+ if (idB >= olapmap.capacity())
+ olapmap.resize(idB + 1);
+
+ // cerr << "Adding to " << idB << " " << overlap.rangeA.getBegin() << ", " << overlap.rangeA.getEnd() <<endl;
+ olapmap[idB].push_back(overlap);
+ }
+
+ if (whichLine == 0){
+ cerr << "didn't read any lines" << endl;
+ exit(1);
+ }
+
+ inFile.close();
+
+ cerr << "Trimming the reads" << endl;
+
+ for (int i = 0; i < olapmap.size(); i++){
+ if (i % 10000 == 0)
+ cerr << i << "\r";
+
+ vector<position_t> allpos;
+ vector<position_t> shortpos;
+
+ for (vector<olap_t>::iterator j = olapmap[i].begin(); j != olapmap[i].end(); j++){
+ // cerr << "Adding " << j->rangeA.getBegin() << ", " <<
+ // j->rangeA.getEnd() << endl;
+ allpos.push_back(position_t(j->rangeA.getBegin(), true));
+ allpos.push_back(position_t(j->rangeA.getEnd(), false));
+ shortpos.push_back(position_t((j->rangeA.getBegin() + MAXOVL), true));
+ shortpos.push_back(position_t(j->rangeA.getEnd(), false));
+ }
+
+ sort(allpos.begin(), allpos.end(), cmpPos());
+ sort(shortpos.begin(), shortpos.end(), cmpPos());
+
+ if (allpos.size() != shortpos.size())
+ cerr << "Allpos and shortpos for " << i << " have different sizes " <<
+ allpos.size() << " != " << shortpos.size() << endl;
+
+
+ cout << "cov " << i << " ";
+ // cerr << "cov " << i << " ";
+
+ outFile << i << " ";
+ int cov = 0;
+ int lastend = 0;
+ for (int j = 0; j < allpos.size(); j++){
+ if (j > 0)
+ cout << "(" << allpos[j - 1].x << "," << allpos[j].x << ")="
+ << cov << " ";
+ if (allpos[j].start) { // beginning of a range
+ // cerr << j << " " << allpos[j].x << " start ";
+ if (cov == 0)
+ outFile << allpos[j].x << " ";
+ cov++;
+ } else { // end of range
+ // cerr << j << " " << allpos[j].x << " end ";
+ cov--;
+ if (cov == 0){
+ outFile << allpos[j].x;
+ if (allpos[j].x - lastend < 10)
+ outFile << " B" << allpos[j].x - lastend << " ";
+ else
+ outFile << " b ";
+ }
+ lastend = allpos[j].x;
+ }
+ }
+
+ // cerr << endl;
+ cout << endl;
+
+ cout << "chi " << i << " ";
+ // cerr << "chi " << i << " ";
+ //outFile << "chi " << i << " ";
+ cov = 0;
+ for (int j = 0; j < shortpos.size(); j++){
+ if (j > 0)
+ cout << "(" << shortpos[j - 1].x << "," << shortpos[j].x << ")="
+ << cov << " ";
+ if (shortpos[j].start) { // beginning of a range
+ // cerr << j << " " << allpos[j].x << " start ";
+ if (cov == 0)
+ cout << ((j > 0) ? shortpos[j - 1].x : shortpos[j].x)<< " ";
+ cov++;
+ } else { // end of range
+ // cerr << j << " " << allpos[j].x << " end ";
+ cov--;
+ if (cov == 0)
+ cout << shortpos[j].x << " B ";
+ }
+ }
+ // cerr << endl;
+ cout << endl;
+ outFile << endl;
+
+ } // while each overlap for this read
+ outFile.close();
+ exit(0);
+}
diff --git a/src/Utils/updateDeltaClr.pl b/src/Utils/updateDeltaClr.pl
new file mode 100755
index 0000000..7a02fa9
--- /dev/null
+++ b/src/Utils/updateDeltaClr.pl
@@ -0,0 +1,119 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+
+# TIGR Modules
+use TIGR::Foundation;
+
+my $tigr_tf = new TIGR::Foundation;
+my $PRG = $tigr_tf->getProgramInfo('name');
+my $REV="1.0";
+my @DEPENDS=("TIGR::Foundation");
+
+# help info
+my $HELPTEXT = qq~
+Program that updates a delta file with new query clear ranges
+
+Usage: $PRG delta_file clr_file [options]
+
+ INPUT:
+ options:
+
+ -h|help - Print this help and exit;
+ -V|version - Print the version and exit;
+ -depend - Print the program and database dependency list;
+ -debug <level> - Set the debug <level> (0, non-debug by default);
+
+ OUTPUT:
+ Delta at the console
+~;
+
+my $MOREHELP = qq~
+Return Codes: 0 - on success, 1 - on failure.
+~;
+
+###############################################################################
+#
+# Main program
+#
+###############################################################################
+
+MAIN:
+{
+ my %options;
+ my (%five,%three,$id);
+
+ # Configure TIGR Foundation
+ $tigr_tf->setHelpInfo($HELPTEXT.$MOREHELP);
+ $tigr_tf->setUsageInfo($HELPTEXT);
+ $tigr_tf->setVersionInfo($REV);
+ $tigr_tf->addDependInfo(@DEPENDS);
+
+ # validate input parameters
+ my $result = $tigr_tf->TIGR_GetOptions();
+
+ $tigr_tf->printUsageInfoAndExit() unless($result);
+
+ ########################################################################
+
+ open(IN,$ARGV[1]) or die $!;
+ while(<IN>)
+ {
+ my @f=split;
+ next unless(@f);
+
+ $five{$f[0]}=$f[1];
+ $three{$f[0]}=$f[2];
+ }
+ close(IN);
+
+ ########################################################################
+
+ open(IN,$ARGV[0]) or die $!;
+ while(<IN>)
+ {
+ #>NC_008463.1_1_9608 10005 9608 33
+ #4749 4778 4 33 1 1 0
+ #0
+
+ #10005 3 33
+
+ #>NC_008463.1_1_9608 10005 9608 30
+ #4749 4778 1 30 1 1 0
+ #0
+
+ my @f=split;
+
+ if(/^>/)
+ {
+ $id=$f[1];
+
+ if($three{$id})
+ {
+ $f[3]=$three{$id}-$five{$id};
+
+ die "ERROR: $_" if($f[3]<0);
+ }
+ }
+ elsif(scalar(@f)==7)
+ {
+ if($five{$id})
+ {
+ $f[2]-=$five{$id};
+ $f[3]-=$five{$id};
+
+ die "ERROR: $_" if($f[2]<0);
+ die "ERROR: $_" if($f[3]<0);
+ }
+ }
+
+ print join " ", at f;
+ print "\n";
+ }
+ close(IN);
+
+ ########################################################################
+
+ exit 0;
+}
diff --git a/src/Validation/Makefile.am b/src/Validation/Makefile.am
new file mode 100644
index 0000000..9ad5cb8
--- /dev/null
+++ b/src/Validation/Makefile.am
@@ -0,0 +1,169 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+##-- TO BE INSTALLED
+bin_PROGRAMS = \
+ asmQC2 \
+ asmQC \
+ astats \
+ analyze-read-depth \
+ find-duplicate-reads \
+ cestat-cov \
+ insert-sizes \
+ listSingletonMates \
+ library-histogram \
+ list-linked-contigs \
+ scaffoldRange2Ungapped \
+ read-cov-plot \
+ getFRCvalues
+
+
+dist_bin_SCRIPTS = \
+ coords2cam.pl \
+ fixlib.pl \
+ postCAqc.pl \
+ tiling2cam.pl \
+ cavalidate.acf \
+ amosvalidate.acf \
+ findTcovSnp.pl \
+ clusterSnps.pl \
+ listSurrogates.pl \
+ suspiciousfeat2region.pl \
+ find-query-breaks.pl
+
+
+##-- GLOBAL INCLUDE
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/Foundation \
+ -I$(top_srcdir)/src/Contig
+
+##-- analyze-read-depth
+analyze_read_depth_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+analyze_read_depth_SOURCES = \
+ analyze-read-depth.cc
+
+##-- read-cov-plot
+read_cov_plot_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+read_cov_plot_SOURCES = \
+ read-cov-plot.cc
+
+##-- asmQC
+asmQC_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+asmQC_SOURCES = \
+ asmQC.cc
+
+##-- asmQC2
+asmQC2_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+asmQC2_SOURCES = \
+ asmQC2.cc
+
+
+astats_SOURCES = \
+ astats.cc
+
+astats_LDADD = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+
+##-- find-duplicate-reads
+find_duplicate_reads_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU
+find_duplicate_reads_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+find_duplicate_reads_SOURCES = \
+ find-duplicate-reads.cc
+
+
+###-- shotgunSim
+#shotgunSim_LDADD = \
+# -lgsl \
+# -lgslcblas
+#
+#shotgunSim_SOURCES = \
+# shotgunSim.cc
+
+
+cestat_cov_SOURCES = \
+ cestat-cov.cc
+
+cestat_cov_LDADD = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+insert_sizes_SOURCES = \
+ insert-sizes.cc
+
+insert_sizes_LDADD = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+listSingletonMates_SOURCES = \
+ listSingletonMates.cc
+
+listSingletonMates_LDADD = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+library_histogram_SOURCES = \
+ library-histogram.cc
+
+library_histogram_LDADD = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+list_linked_contigs_SOURCES = \
+ list-linked-contigs.cc
+
+list_linked_contigs_LDADD = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+
+# scaffoldRange2Ungapped
+scaffoldRange2Ungapped_SOURCES = \
+ scaffoldRange2Ungapped.cc
+
+scaffoldRange2Ungapped_LDADD = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+##-- getFRCvalues
+getFRCvalues_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+getFRCvalues_SOURCES = \
+ getFRCvalues.hh \
+ getFRCvalues.cc
diff --git a/src/Validation/Makefile.in b/src/Validation/Makefile.in
new file mode 100644
index 0000000..2e42c26
--- /dev/null
+++ b/src/Validation/Makefile.in
@@ -0,0 +1,905 @@
+# 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 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@
+DIST_COMMON = $(dist_bin_SCRIPTS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = asmQC2$(EXEEXT) asmQC$(EXEEXT) astats$(EXEEXT) \
+ analyze-read-depth$(EXEEXT) find-duplicate-reads$(EXEEXT) \
+ cestat-cov$(EXEEXT) insert-sizes$(EXEEXT) \
+ listSingletonMates$(EXEEXT) library-histogram$(EXEEXT) \
+ list-linked-contigs$(EXEEXT) scaffoldRange2Ungapped$(EXEEXT) \
+ read-cov-plot$(EXEEXT) getFRCvalues$(EXEEXT)
+subdir = src/Validation
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_analyze_read_depth_OBJECTS = analyze-read-depth.$(OBJEXT)
+analyze_read_depth_OBJECTS = $(am_analyze_read_depth_OBJECTS)
+analyze_read_depth_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_asmQC_OBJECTS = asmQC.$(OBJEXT)
+asmQC_OBJECTS = $(am_asmQC_OBJECTS)
+asmQC_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_asmQC2_OBJECTS = asmQC2.$(OBJEXT)
+asmQC2_OBJECTS = $(am_asmQC2_OBJECTS)
+asmQC2_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_astats_OBJECTS = astats.$(OBJEXT)
+astats_OBJECTS = $(am_astats_OBJECTS)
+astats_DEPENDENCIES = $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_cestat_cov_OBJECTS = cestat-cov.$(OBJEXT)
+cestat_cov_OBJECTS = $(am_cestat_cov_OBJECTS)
+cestat_cov_DEPENDENCIES = $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_find_duplicate_reads_OBJECTS = \
+ find_duplicate_reads-find-duplicate-reads.$(OBJEXT)
+find_duplicate_reads_OBJECTS = $(am_find_duplicate_reads_OBJECTS)
+find_duplicate_reads_DEPENDENCIES = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_getFRCvalues_OBJECTS = getFRCvalues.$(OBJEXT)
+getFRCvalues_OBJECTS = $(am_getFRCvalues_OBJECTS)
+getFRCvalues_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_insert_sizes_OBJECTS = insert-sizes.$(OBJEXT)
+insert_sizes_OBJECTS = $(am_insert_sizes_OBJECTS)
+insert_sizes_DEPENDENCIES = $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_library_histogram_OBJECTS = library-histogram.$(OBJEXT)
+library_histogram_OBJECTS = $(am_library_histogram_OBJECTS)
+library_histogram_DEPENDENCIES = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_list_linked_contigs_OBJECTS = list-linked-contigs.$(OBJEXT)
+list_linked_contigs_OBJECTS = $(am_list_linked_contigs_OBJECTS)
+list_linked_contigs_DEPENDENCIES = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_listSingletonMates_OBJECTS = listSingletonMates.$(OBJEXT)
+listSingletonMates_OBJECTS = $(am_listSingletonMates_OBJECTS)
+listSingletonMates_DEPENDENCIES = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am_read_cov_plot_OBJECTS = read-cov-plot.$(OBJEXT)
+read_cov_plot_OBJECTS = $(am_read_cov_plot_OBJECTS)
+read_cov_plot_DEPENDENCIES = $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+am_scaffoldRange2Ungapped_OBJECTS = scaffoldRange2Ungapped.$(OBJEXT)
+scaffoldRange2Ungapped_OBJECTS = $(am_scaffoldRange2Ungapped_OBJECTS)
+scaffoldRange2Ungapped_DEPENDENCIES = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+SCRIPTS = $(dist_bin_SCRIPTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(analyze_read_depth_SOURCES) $(asmQC_SOURCES) \
+ $(asmQC2_SOURCES) $(astats_SOURCES) $(cestat_cov_SOURCES) \
+ $(find_duplicate_reads_SOURCES) $(getFRCvalues_SOURCES) \
+ $(insert_sizes_SOURCES) $(library_histogram_SOURCES) \
+ $(list_linked_contigs_SOURCES) $(listSingletonMates_SOURCES) \
+ $(read_cov_plot_SOURCES) $(scaffoldRange2Ungapped_SOURCES)
+DIST_SOURCES = $(analyze_read_depth_SOURCES) $(asmQC_SOURCES) \
+ $(asmQC2_SOURCES) $(astats_SOURCES) $(cestat_cov_SOURCES) \
+ $(find_duplicate_reads_SOURCES) $(getFRCvalues_SOURCES) \
+ $(insert_sizes_SOURCES) $(library_histogram_SOURCES) \
+ $(list_linked_contigs_SOURCES) $(listSingletonMates_SOURCES) \
+ $(read_cov_plot_SOURCES) $(scaffoldRange2Ungapped_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+dist_bin_SCRIPTS = \
+ coords2cam.pl \
+ fixlib.pl \
+ postCAqc.pl \
+ tiling2cam.pl \
+ cavalidate.acf \
+ amosvalidate.acf \
+ findTcovSnp.pl \
+ clusterSnps.pl \
+ listSurrogates.pl \
+ suspiciousfeat2region.pl \
+ find-query-breaks.pl
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU \
+ -I$(top_srcdir)/src/Foundation \
+ -I$(top_srcdir)/src/Contig
+
+analyze_read_depth_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+analyze_read_depth_SOURCES = \
+ analyze-read-depth.cc
+
+read_cov_plot_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Foundation/libAMOSFoundation.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+read_cov_plot_SOURCES = \
+ read-cov-plot.cc
+
+asmQC_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+asmQC_SOURCES = \
+ asmQC.cc
+
+asmQC2_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+asmQC2_SOURCES = \
+ asmQC2.cc
+
+astats_SOURCES = \
+ astats.cc
+
+astats_LDADD = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+find_duplicate_reads_CPPFLAGS = \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_builddir)/src/GNU
+
+find_duplicate_reads_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/GNU/libGNU.a
+
+find_duplicate_reads_SOURCES = \
+ find-duplicate-reads.cc
+
+
+###-- shotgunSim
+#shotgunSim_LDADD = \
+# -lgsl \
+# -lgslcblas
+#
+#shotgunSim_SOURCES = \
+# shotgunSim.cc
+cestat_cov_SOURCES = \
+ cestat-cov.cc
+
+cestat_cov_LDADD = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+insert_sizes_SOURCES = \
+ insert-sizes.cc
+
+insert_sizes_LDADD = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+listSingletonMates_SOURCES = \
+ listSingletonMates.cc
+
+listSingletonMates_LDADD = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+library_histogram_SOURCES = \
+ library-histogram.cc
+
+library_histogram_LDADD = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+list_linked_contigs_SOURCES = \
+ list-linked-contigs.cc
+
+list_linked_contigs_LDADD = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+
+# scaffoldRange2Ungapped
+scaffoldRange2Ungapped_SOURCES = \
+ scaffoldRange2Ungapped.cc
+
+scaffoldRange2Ungapped_LDADD = \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+getFRCvalues_LDADD = \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a
+
+getFRCvalues_SOURCES = \
+ getFRCvalues.hh \
+ getFRCvalues.cc
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/Validation/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Validation/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):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+analyze-read-depth$(EXEEXT): $(analyze_read_depth_OBJECTS) $(analyze_read_depth_DEPENDENCIES)
+ @rm -f analyze-read-depth$(EXEEXT)
+ $(CXXLINK) $(analyze_read_depth_OBJECTS) $(analyze_read_depth_LDADD) $(LIBS)
+asmQC$(EXEEXT): $(asmQC_OBJECTS) $(asmQC_DEPENDENCIES)
+ @rm -f asmQC$(EXEEXT)
+ $(CXXLINK) $(asmQC_OBJECTS) $(asmQC_LDADD) $(LIBS)
+asmQC2$(EXEEXT): $(asmQC2_OBJECTS) $(asmQC2_DEPENDENCIES)
+ @rm -f asmQC2$(EXEEXT)
+ $(CXXLINK) $(asmQC2_OBJECTS) $(asmQC2_LDADD) $(LIBS)
+astats$(EXEEXT): $(astats_OBJECTS) $(astats_DEPENDENCIES)
+ @rm -f astats$(EXEEXT)
+ $(CXXLINK) $(astats_OBJECTS) $(astats_LDADD) $(LIBS)
+cestat-cov$(EXEEXT): $(cestat_cov_OBJECTS) $(cestat_cov_DEPENDENCIES)
+ @rm -f cestat-cov$(EXEEXT)
+ $(CXXLINK) $(cestat_cov_OBJECTS) $(cestat_cov_LDADD) $(LIBS)
+find-duplicate-reads$(EXEEXT): $(find_duplicate_reads_OBJECTS) $(find_duplicate_reads_DEPENDENCIES)
+ @rm -f find-duplicate-reads$(EXEEXT)
+ $(CXXLINK) $(find_duplicate_reads_OBJECTS) $(find_duplicate_reads_LDADD) $(LIBS)
+getFRCvalues$(EXEEXT): $(getFRCvalues_OBJECTS) $(getFRCvalues_DEPENDENCIES)
+ @rm -f getFRCvalues$(EXEEXT)
+ $(CXXLINK) $(getFRCvalues_OBJECTS) $(getFRCvalues_LDADD) $(LIBS)
+insert-sizes$(EXEEXT): $(insert_sizes_OBJECTS) $(insert_sizes_DEPENDENCIES)
+ @rm -f insert-sizes$(EXEEXT)
+ $(CXXLINK) $(insert_sizes_OBJECTS) $(insert_sizes_LDADD) $(LIBS)
+library-histogram$(EXEEXT): $(library_histogram_OBJECTS) $(library_histogram_DEPENDENCIES)
+ @rm -f library-histogram$(EXEEXT)
+ $(CXXLINK) $(library_histogram_OBJECTS) $(library_histogram_LDADD) $(LIBS)
+list-linked-contigs$(EXEEXT): $(list_linked_contigs_OBJECTS) $(list_linked_contigs_DEPENDENCIES)
+ @rm -f list-linked-contigs$(EXEEXT)
+ $(CXXLINK) $(list_linked_contigs_OBJECTS) $(list_linked_contigs_LDADD) $(LIBS)
+listSingletonMates$(EXEEXT): $(listSingletonMates_OBJECTS) $(listSingletonMates_DEPENDENCIES)
+ @rm -f listSingletonMates$(EXEEXT)
+ $(CXXLINK) $(listSingletonMates_OBJECTS) $(listSingletonMates_LDADD) $(LIBS)
+read-cov-plot$(EXEEXT): $(read_cov_plot_OBJECTS) $(read_cov_plot_DEPENDENCIES)
+ @rm -f read-cov-plot$(EXEEXT)
+ $(CXXLINK) $(read_cov_plot_OBJECTS) $(read_cov_plot_LDADD) $(LIBS)
+scaffoldRange2Ungapped$(EXEEXT): $(scaffoldRange2Ungapped_OBJECTS) $(scaffoldRange2Ungapped_DEPENDENCIES)
+ @rm -f scaffoldRange2Ungapped$(EXEEXT)
+ $(CXXLINK) $(scaffoldRange2Ungapped_OBJECTS) $(scaffoldRange2Ungapped_LDADD) $(LIBS)
+install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/analyze-read-depth.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/asmQC.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/asmQC2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/astats.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cestat-cov.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/find_duplicate_reads-find-duplicate-reads.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/getFRCvalues.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/insert-sizes.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/library-histogram.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/list-linked-contigs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/listSingletonMates.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/read-cov-plot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/scaffoldRange2Ungapped.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+
+find_duplicate_reads-find-duplicate-reads.o: find-duplicate-reads.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(find_duplicate_reads_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT find_duplicate_reads-find-duplicate-reads.o -MD -MP -MF $(DEPDIR)/find_duplicate_reads-find-duplicate-reads.Tpo -c -o find_duplicate_reads-find-duplicate-reads.o `test -f 'find-duplicate-reads.cc' || echo '$(srcdir)/'`find-duplicate-reads.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/find_duplicate_reads-find-duplicate-reads.Tpo $(DEPDIR)/find_duplicate_reads-find-duplicate-reads.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='find-duplicate-reads.cc' object='find_duplicate_reads-find-duplicate-reads.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(find_duplicate_reads_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o find_duplicate_reads-find-duplicate-reads.o `test -f 'find-duplicate-reads.cc' || echo '$(srcdir)/'`find-duplicate-reads.cc
+
+find_duplicate_reads-find-duplicate-reads.obj: find-duplicate-reads.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(find_duplicate_reads_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT find_duplicate_reads-find-duplicate-reads.obj -MD -MP -MF $(DEPDIR)/find_duplicate_reads-find-duplicate-reads.Tpo -c -o find_duplicate_reads-find-duplicate-reads.obj `if test -f 'find-duplicate-reads.cc'; then $(CYGPATH_W) 'find-duplicate-reads.cc'; else $(CYGPATH_W) '$(srcdir)/find-duplicate-reads.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/find_duplicate_reads-find-duplicate-reads.Tpo $(DEPDIR)/find_duplicate_reads-find-duplicate-reads.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='find-duplicate-reads.cc' object='find_duplicate_reads-find-duplicate-reads.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(find_duplicate_reads_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o find_duplicate_reads-find-duplicate-reads.obj `if test -f 'find-duplicate-reads.cc'; then $(CYGPATH_W) 'find-duplicate-reads.cc'; else $(CYGPATH_W) '$(srcdir)/find-duplicate-reads.cc'; fi`
+
+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 $(PROGRAMS) $(SCRIPTS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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:
+ $(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:
+
+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-binPROGRAMS clean-generic 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-binPROGRAMS install-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-dist_binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: install-am install-exec-am install-strip uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dist_binSCRIPTS \
+ 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-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-dist_binSCRIPTS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+# 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/Validation/amosvalidate.acf b/src/Validation/amosvalidate.acf
new file mode 100755
index 0000000..b2f9e24
--- /dev/null
+++ b/src/Validation/amosvalidate.acf
@@ -0,0 +1,68 @@
+## Validate an assembly in AMOS bank format
+
+#?
+#? Amosvalidate is a pipeline to automatically detect mis-assemblies. It takes
+#? an AMOS bank as input and calculates a battery of known and novel assembly
+#? quality metrics such as matepair happiness, correlated SNP detection, read
+#? coverage, singleton breakpoint analysis and kmer composition. The output can
+#? be visualized with Hawkeye.
+#?
+#? Usage:
+#? amosvalidate AMOS_BANK [options]
+#?
+#? Options:
+#? -D CLEAR_RANGE=<n> Use the clear range of the reads? (0:no 1:yes,
+#? default: 1)
+#?
+
+BINDIR = /fs/sz-user-supported/Linux-x86_64/bin
+NUCMER = /fs/sz-user-supported/Linux-x86_64/bin/nucmer
+
+# One mandatory argument is expected
+EXPECT 1
+
+PREF = $(strip .bnk PREFIX)
+BANK = $(PREF).bnk
+INPUTS = $(BANK)
+
+# Default parameters
+CLEAR_RANGE = 1
+
+## Creating FastA
+100: $(BINDIR)/bank2fasta -b $(BANK) > $(PREF).fasta
+
+## Analyzing mate-pairs
+300: $(BINDIR)/asmQC -b $(BANK) -scaff -recompute -update -numsd 2
+310: $(BINDIR)/asmQC -b $(BANK) -scaff -recompute -update -numsd 2
+320: $(BINDIR)/asmQC -b $(BANK) -scaff -feat -numsd 3 -shortcvg -1 -longcvg -1
+330: $(BINDIR)/cestat-cov -i -f 4 $(BANK) > $(PREF).ce.feat
+340: $(BINDIR)/loadFeatures -i $(BANK) $(PREF).ce.feat
+
+## Analyzing SNPs
+400: $(BINDIR)/analyzeSNPs -i -b $(BANK) -S -cumqv 40 -minsnps 2 -r -H > $(PREF).snps
+410: $(BINDIR)/clusterSnps $(PREF).snps > $(PREF).snp.feat
+420: $(BINDIR)/loadFeatures -i $(BANK) $(PREF).snp.feat
+
+## Analyzing read coverage
+500: $(BINDIR)/analyze-read-depth -i $(BANK) -c 1000 -x 3 > $(PREF).depth.feat
+510: $(BINDIR)/loadFeatures -i $(BANK) $(PREF).depth.feat
+
+## Align singleton reads
+600: $(BINDIR)/listReadPlacedStatus -S -E $(BANK) > $(PREF).singletons
+CR_CMD = $(shell if [ $(CLEAR_RANGE\) -eq 0 ]; then /bin/echo -n '-r'; fi)
+610: $(BINDIR)/dumpreads $(CR_CMD) -E $(PREF).singletons $(BANK) > $(PREF).singletons.seq
+620: $(NUCMER) --prefix=$(PREF) $(PREF).fasta $(PREF).singletons.seq
+
+## Analyzing singleton alignment breakpoints
+700: $(BINDIR)/casm-breaks -b $(BANK) -t 100 -c 2 -F $(PREF).break.fea $(PREF).delta
+710: $(BINDIR)/bank-transact -b $(BANK) -m $(PREF).break.fea
+
+## Analyzing kmer-coverage
+800: $(BINDIR)/count-kmers -n $(BANK) -m 22 > $(PREF).22.n22mers
+810: $(BINDIR)/kmer-cov -A -F -L 1000 $(PREF).22.n22mers < $(PREF).fasta > $(PREF).nkmer.feat
+820: $(BINDIR)/loadFeatures -u -i $(BANK) $(PREF).nkmer.feat
+
+## Combine features
+1000: $(BINDIR)/dumpFeatures -i $(BANK) | sort -k1 -nk3 > $(PREF).all.feat
+1010: $(BINDIR)/suspiciousfeat2region $(PREF).all.feat > $(PREF).suspicious.feat
+1020: $(BINDIR)/loadFeatures -i $(BANK) $(PREF).suspicious.feat
diff --git a/src/Validation/analyze-read-depth.cc b/src/Validation/analyze-read-depth.cc
new file mode 100644
index 0000000..85b7d4a
--- /dev/null
+++ b/src/Validation/analyze-read-depth.cc
@@ -0,0 +1,306 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+#include "Feature_AMOS.hh"
+
+using namespace AMOS;
+using namespace std;
+
+int s_verbose(0);
+int clusterdist(0);
+int PRINTIID(0);
+int DEPTHONLY(0);
+int MINCONTIGLEN(0);
+float thresholdx = 3.0;
+string CONTIGIIDS;
+
+double uconslen(0);
+double ureadlen(0);
+int PRINTRAW(0);
+int USEUNGAPPED(0);
+
+void handlecontig(Contig_t & contig,
+ int & contigs,
+ double & conslen,
+ double & readlen,
+ int & readcount)
+{
+ int clen = contig.getLength();
+
+ if (USEUNGAPPED)
+ {
+ clen = contig.getUngappedLength();
+ }
+
+ if (clen >= MINCONTIGLEN)
+ {
+ contigs++;
+
+ int clen = contig.getLength();
+ int uclen = contig.getUngappedLength();
+
+ conslen += clen;
+ uconslen += uclen;
+
+ double rl = 0.0;
+ double url = 0.0;
+ int rc = 0;
+
+ vector<Tile_t> & tiling = contig.getReadTiling();
+ vector<Tile_t>::const_iterator ti;
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ rl += ti->getGappedLength();
+ url += ti->range.getLength();
+ rc++;
+ }
+
+ readlen += rl;
+ ureadlen += url;
+ readcount += rc;
+
+ if (PRINTRAW)
+ {
+ cout << contig.getIID() << "\t"
+ << rc << "\t"
+ << clen << "\t"
+ << uclen << "\t"
+ << (rl/clen) << "\t"
+ << (url/uclen) << endl;
+ }
+ }
+}
+
+
+int main (int argc, char ** argv)
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Analyze the depth of coverage along contigs and flag regions\n"
+"that are significantly deeper than the average depth of coverage\n"
+"By default, flag regions that are more than 3-times the average\n"
+"depth. Optionally, cluster regions that are within <dist> bp\n"
+"\n"
+"Output is suitable for loadFeatures:\n"
+"contigeid D end5 end3 maxdepth\n"
+"\n"
+"In raw mode (-r) output is:\n"
+"contigiid numreads glen uglen gcov ugcov\n"
+"\n"
+" Usage: analyze-read-depth [options] bank\n"
+"\n"
+" Options\n"
+" -------------------\n"
+" -v|--verbose Produce a verbose output\n"
+" -x <val> Flag regions val x times the global average depth\n"
+" -c <dist> Cluster regions within <dist> bp\n"
+" -I <file> Only use list of contigs iids in file for computing average\n"
+" -i Print contig IIDs instead of EIDs\n"
+" -d Just compute the depth. This returns a line with 4 values:\n"
+" the minimum contig length considered, number of contigs\n"
+" sum of contig lengths and the average contig depth\n"
+" -l <len> Only use contigs >= len for computing average\n"
+" -r Print the depth for each contig\n"
+" -u Use ungapped length for reports\n";
+"\n";
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+
+ tf->getOptions()->addOptionResult("v|verbose", &s_verbose);
+ tf->getOptions()->addOptionResult("x=f", &thresholdx);
+ tf->getOptions()->addOptionResult("c=i", &clusterdist);
+ tf->getOptions()->addOptionResult("I=s", &CONTIGIIDS);
+ tf->getOptions()->addOptionResult("i", &PRINTIID);
+ tf->getOptions()->addOptionResult("d", &DEPTHONLY);
+ tf->getOptions()->addOptionResult("l=i", &MINCONTIGLEN);
+ tf->getOptions()->addOptionResult("r", &PRINTRAW);
+ tf->getOptions()->addOptionResult("u", &USEUNGAPPED);
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() != 1)
+ {
+ cerr << "Usage: analyze-read-depth [options] bank" << endl;
+ return EXIT_FAILURE;
+ }
+
+ bool first = true;
+
+ while (!argvv.empty())
+ {
+ string bankname = argvv.front(); argvv.pop_front();
+ cerr << "Processing " << bankname << " at " << Date() << endl;
+
+ Bank_t contig_bank(Contig_t::NCODE);
+ contig_bank.open(bankname, B_READ);
+
+ bankname = bankname.substr(0, bankname.find_first_of("/ "));
+
+ const IDMap_t & contigmap = contig_bank.getIDMap();
+ IDMap_t::const_iterator c;
+
+ // compute global average
+ double conslen=0;
+ double readlen=0;
+ int contigs=0;
+ int readcount=0;
+
+ Contig_t contig;
+
+ if (!CONTIGIIDS.empty())
+ {
+ int id;
+ ifstream file;
+ file.open(CONTIGIIDS.c_str());
+
+ while (file >> id)
+ {
+ contig_bank.fetch(id, contig);
+ handlecontig(contig, contigs, conslen, readlen, readcount);
+ }
+ }
+ else
+ {
+ for (c = contigmap.begin(); c!= contigmap.end(); c++)
+ {
+ contig_bank.fetch(c->iid, contig);
+ handlecontig(contig, contigs, conslen, readlen, readcount);
+ }
+ }
+
+ double avgdepth = readlen / conslen;
+ double uavgdepth = ureadlen / uconslen;
+ double threshdepth = avgdepth * thresholdx;
+
+ cerr << "Processed contigs >= " << MINCONTIGLEN << "bp." << endl;
+ cerr << "Processed reads: " << readcount << " contigs: " << contigs << endl;
+ cerr << "Global average contig depth: " << avgdepth << " [" << readlen << "/" << conslen << "]" << endl;
+ cerr << "Global ungapped average contig depth: " << uavgdepth << " [" << ureadlen << "/" << uconslen << "]" << endl;
+
+ if (DEPTHONLY)
+ {
+ if (USEUNGAPPED) { fprintf(stdout, ">%d\t% 6d% 10.0f% 8.1f\n", MINCONTIGLEN, contigs, uconslen, uavgdepth); }
+ else { fprintf(stdout, ">%d\t% 6d% 10.0f% 8.1f\n", MINCONTIGLEN, contigs, conslen, avgdepth); }
+ }
+ else
+ {
+ cerr << "Flagging regions above: " << threshdepth << endl;
+
+ for (c = contigmap.begin(); c!=contigmap.end(); c++)
+ {
+ Contig_t contig;
+ contig_bank.fetch(c->iid, contig);
+
+ vector<Tile_t> & tiling = contig.getReadTiling();
+ vector<Tile_t>::const_iterator ti;
+ sort(tiling.begin(), tiling.end(), TileOrderCmp());
+
+ multiset<int> endpoints;
+ multiset<int>::iterator ep, ep2;
+
+ bool cluster = false;
+ int start;
+ int end = -clusterdist - 10;
+ int maxdepth = 0;
+ int conslen = contig.getLength();
+
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ int offset = ti->offset;
+ int roffset = ti->getRightOffset();
+
+ ep = endpoints.begin();
+ while ((ep != endpoints.end()) && (*ep < offset))
+ {
+ ep2 = ep;
+ ep++;
+ endpoints.erase(ep2);
+ }
+
+ endpoints.insert(roffset);
+ int dcov = endpoints.size();
+
+ if (dcov > threshdepth)
+ {
+ if (!cluster)
+ {
+ start = offset;
+ cluster = true;
+ }
+
+ end = roffset;
+
+ if (dcov > maxdepth) { maxdepth = dcov; }
+ }
+ else
+ {
+ if (cluster && (offset > end + clusterdist))
+ {
+ if (PRINTIID)
+ {
+ cout << c->iid << "\t" << Feature_t::COVERAGE << "\t" << start << "\t" << end << "\tHIGH_READ_COVERAGE " << maxdepth << endl;
+ }
+ else
+ {
+ cout << c->eid << "\t" << Feature_t::COVERAGE << "\t" << start << "\t" << end << "\tHIGH_READ_COVERAGE " << maxdepth << endl;
+ }
+ maxdepth = 0;
+
+ cluster = false;
+ }
+ }
+ }
+
+ if (cluster)
+ {
+ if (PRINTIID)
+ {
+ cout << c->iid << "\t" << Feature_t::COVERAGE << "\t" << start << "\t" << conslen << "\tHIGH_READ_COVERAGE " << maxdepth << endl;
+ }
+ else
+ {
+ cout << c->eid << "\t" << Feature_t::COVERAGE << "\t" << start << "\t" << conslen << "\tHIGH_READ_COVERAGE " << maxdepth << endl;
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return retval;
+}
diff --git a/src/Validation/asmQC.cc b/src/Validation/asmQC.cc
new file mode 100644
index 0000000..d6a28f5
--- /dev/null
+++ b/src/Validation/asmQC.cc
@@ -0,0 +1,1852 @@
+// $Id$
+
+// This program reads a set of contigs from a bank then reports
+// regions where mate-pair information indicates a problem
+
+#include "foundation_AMOS.hh"
+
+#include <getopt.h>
+#include <map>
+#include <set>
+#include <list>
+#include <vector>
+#include <string>
+#include <math.h>
+#include <functional>
+#include <stdlib.h>
+
+using namespace std;
+using namespace AMOS;
+using namespace HASHMAP;
+
+typedef double DoubleSD_t;
+
+#define endl "\n"
+
+#define MIN_CE_OBS 4 // minimum number of clones required to report anomalous CE numbers
+#define MAX_DEVIATION 8 // clones longer/shorter than this many standard deviations from mean are ignored in CE computation
+
+
+enum MateStatus {MP_GOOD, MP_SHORT, MP_LONG, MP_NORMAL, MP_OUTIE, MP_SINGMATE,
+ MP_LINKING, MP_SPANNING};
+
+class AnnotatedFragment: public Fragment_t
+{
+public:
+ MateStatus status;
+ Pos_t size; // computed fragment size
+ ID_t contig1, contig2;
+ ID_t scaff1, scaff2;
+ AnnotatedFragment() : Fragment_t() {
+ status = MP_GOOD;
+ size = 0;
+ contig1 = 0; contig2 = 0; scaff1 = 0; scaff2 = 0;
+ }
+};
+
+
+map<string, string> globals; // global variables
+
+void printHelpText()
+{
+ cerr <<
+ "\n"
+ ".NAME.\n"
+ "asmQC - computes several mate-pair based statistics of an assembly, including\n"
+ " compression-expansion (CE)\n"
+ "\n"
+ ".USAGE.\n"
+ "asmQC -b[ank] <bank_name> [options]\n"
+ "\n"
+ ".OPTIONS.\n"
+ "-h, -help print out help message\n"
+ "-b, -bank bank where assembly is stored\n"
+ "-scaff take into account scaffolds when reporting results\n"
+ "-feat write contig features into the bank\n"
+ "-recompute recompute library sizes\n"
+ "-update update bank with recomputed library sizes\n"
+ "-perinsert <file> output per-insert information in <file>\n"
+ "-minobs <n> minimum number of good mate-pairs required to recompute\n"
+ " library sizes\n"
+ "-numsd <n> mate-pairs within <n> standard deviations of the mean library\n"
+ " size are considered good. <n> can be fractional\n"
+ "-goodcvg <n> report regions with good mate coverage less than <n>\n"
+ "-cestat report regions with unusual CE stat (more than <numsd> \n"
+ " standard errors from mean). cestat implies -recompute and \n"
+ " invalidates -shortcvg and -longcvg\n"
+ "-shortcvg <n> report regions with short mate coverage greater than <n>\n"
+ "-longcvg <n> report regions with long mate coverage greater than <n>\n"
+ "-samecvg <n> report regions with coverage by mates with same orientation\n"
+ " greater than <n>\n"
+ "-outiecvg <n> report regions with outie coverage greater than <n>\n"
+ "-linking <n> report regions with linking read coverage greater than <n>\n"
+ "-singlemate <n> report regions with singleton mate coverage > than <n>\n"
+ "-meachange <n> libraries whose mean changed by less than <n> will be \n"
+ " considered unchanged\n"
+ "-sdchange <n> libraries whose stdev. changed by less than <n> will be \n"
+ " considered unchanged\n"
+ "-ceplot <file> file to output CE statistic plot to\n"
+ "-debug output status for each mate-pair to STDERR\n"
+ "\n"
+ ".DESCRIPTION.\n"
+ "\n"
+ ".KEYWORDS.\n"
+ "AMOS bank, Validation, Mate pairs\n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"scaff", 0, 0, 'B'},
+ {"minobs", 1, 0, 'm'},
+ {"singlemate", 1, 0, 'M'},
+ {"goodcvg", 1, 0, 'g'},
+ {"cestat", 0, 0, 'G'},
+ {"shortcvg", 1, 0, 's'},
+ {"numsd", 1, 0, 'S'},
+ {"longcvg", 1, 0, 'l'},
+ {"linking", 1, 0, 'L'},
+ {"samecvg", 1, 0, 'n'},
+ {"outiecvg", 1, 0, 'o'},
+ {"recompute", 0, 0, 'r'},
+ {"update", 0, 0, 'u'},
+ {"feat", 0, 0, 'f'},
+ {"debug", 0, 0, 'd'},
+ {"perinsert", 1, 0, 'p'},
+ {"ceplot" , 1, 0, 'P'},
+ {"meachange", 1, 0, 'c'},
+ {"sdchange", 1, 0, 'C'},
+ {0, 0, 0, 0}
+ };
+
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ exit(0);
+ break;
+ case 'b':
+ globals["bank"] = string(optarg);
+ break;
+ case 'B':
+ globals["scaff"] = string("true");
+ break;
+ case 'm':
+ globals["minobs"] = string(optarg);
+ break;
+ case 'M':
+ globals["singlemate"] = string(optarg);
+ break;
+ case 's':
+ globals["shortcvg"] = string(optarg);
+ break;
+ case 'S':
+ globals["numsd"] = string(optarg);
+ break;
+ case 'g':
+ globals["goodcvg"] = string(optarg);
+ break;
+ case 'G':
+ globals["cestat"] = string("true");
+ break;
+ case 'l':
+ globals["longcvg"] = string(optarg);
+ break;
+ case 'L':
+ globals["linking"] = string(optarg);
+ break;
+ case 'n':
+ globals["normalcvg"] = string(optarg);
+ break;
+ case 'o':
+ globals["outiecvg"] = string(optarg);
+ break;
+ case 'r':
+ globals["recompute"] = string("true");
+ break;
+ case 'u':
+ globals["update"] = string("true");
+ break;
+ case 'f':
+ globals["feat"] = string("true");
+ break;
+ case 'd':
+ globals["debug"] = string("true");
+ break;
+ case 'p':
+ globals["perinsert"] = string(optarg);
+ break;
+ case 'P':
+ globals["ceplot"] = string(optarg);
+ break;
+ case 'c':
+ globals["meachange"] = string(optarg);
+ break;
+ case 'C':
+ globals["sdchange"] = string(optarg);
+ break;
+ case '?':
+ return false;
+ }
+ }
+
+ return true;
+} // GetOptions
+
+
+// returns the distance between the reads implied by the ranges within
+// the contig of length Len. Returns 0 if the reads are improperly
+// oriented or if they are too close to the end of the contig (closer than End)
+int mateLen (AnnotatedFragment & m, Range_t & a, Range_t & b, int Len, int End)
+{
+ int oriA;
+ int oriB;
+
+ if (a.getBegin() < a.getEnd())
+ oriA = 1;
+ else
+ oriA = -1;
+
+ if (b.getBegin() < b.getEnd())
+ oriB = 1;
+ else
+ oriB = -1;
+
+ if (oriA == oriB){ // A --> B -->
+ m.status = MP_NORMAL;
+ return 0;
+ }
+
+ if (oriA == 1 && a.getBegin() > b.getBegin()){ // B <-- --> A
+ m.status = MP_OUTIE;
+ return 0;
+ }
+
+ if (oriA == -1 && a.getBegin() < b.getBegin()){ // A <-- --> B
+ m.status = MP_OUTIE;
+ return 0;
+ }
+
+ if (oriA == 1 && (b.getEnd() < a.getBegin() || a.getEnd() > b.getBegin())) {
+ // B <-------
+ // A ------->
+ m.status = MP_OUTIE;
+ return 0;
+ }
+
+ if (oriA == -1 && (a.getEnd() < b.getBegin() || b.getEnd() > a.getBegin())) {
+ // A <-------
+ // B ------->
+ m.status = MP_OUTIE;
+ return 0;
+ }
+
+ // now everything is kosher A --> <-- B or B --> <-- A
+ if ((oriA == 1 && (Len - a.getBegin() < End))||
+ (oriA == -1 && (a.getBegin() < End)) ||
+ (oriB == 1 && (Len - b.getBegin() < End)) ||
+ (oriB == -1 && (b.getBegin() < End))){
+ return 0; // mate-pair too close to end to count
+ }
+
+ m.size = abs(a.getBegin() - b.getBegin());
+ return m.size;
+}// mateLen
+
+
+// computes mean and standard deviation for a set of observations
+// observations outside of 5 standard deviations are excluded
+pair<Pos_t, DoubleSD_t> getSz(list<Pos_t> & sizes)
+{
+ int numObs = sizes.size();
+ if (numObs == 0) return pair<Pos_t, DoubleSD_t> (0, 0);
+ // this should probably be an assert...
+
+ Pos_t mean = 0;
+ for (list<Pos_t>::iterator li = sizes.begin(); li != sizes.end(); li++){
+ mean += *li;
+ }
+ mean = (Pos_t) rint (mean * 1.0 / numObs);
+
+ DoubleSD_t stdev = 0;
+ for (list<Pos_t>::iterator li = sizes.begin(); li != sizes.end(); li++){
+ stdev += (*li - mean) * (*li - mean);
+ }
+ stdev = (DoubleSD_t) rint(sqrt(stdev * 1.0 / (numObs - 1)));
+
+ Pos_t origm = mean;
+ DoubleSD_t origs = stdev;
+
+ // recompute mean and stdev for just sizes within 5SD of mean
+
+ mean = 0;
+ for (list<Pos_t>::iterator li = sizes.begin(); li != sizes.end(); li++){
+ if (abs(*li - origm) < MAX_DEVIATION * origs)
+ mean += *li;
+ else
+ numObs--;
+ }
+
+ if (numObs == 0) return pair<Pos_t, DoubleSD_t> (0, 0);
+ // this should also be an assert
+
+ mean = (Pos_t) rint (mean * 1.0 / numObs);
+
+ stdev = 0;
+ for (list<Pos_t>::iterator li = sizes.begin(); li != sizes.end(); li++){
+ if (abs(*li - origm) < MAX_DEVIATION * origs)
+ stdev += (*li - mean) * (*li - mean);
+ }
+
+ stdev = (DoubleSD_t) rint(sqrt(stdev * 1.0 / (numObs - 1)));
+
+ return pair<Pos_t, DoubleSD_t>(mean, stdev);
+}
+
+// get regions that are below or above a specified coverage
+void getCvg(list<list<AnnotatedFragment>::iterator>::iterator begin,
+ list<list<AnnotatedFragment>::iterator>::iterator end,
+ hash_map<ID_t, Range_t, hash<ID_t>, equal_to<ID_t> > & posmap,
+ MateStatus status,
+ ID_t id,
+ list<pair<Pos_t, Pos_t> > & interest,
+ Pos_t ctglen, int coverage, bool above)
+{
+ vector<Pos_t> starts, ends;
+ list<pair<Pos_t, Pos_t> > ranges;
+ interest.clear();
+
+ if (coverage < 0)
+ return;
+
+ for (list<list<AnnotatedFragment>::iterator>::iterator mi = begin; mi != end; mi++){
+ if ((*mi)->status == status){
+ Pos_t left, right;
+
+ if (status == MP_GOOD){
+ left = posmap[((*mi)->getMatePair()).first].getEnd(); // use end of reads
+ right = posmap[((*mi)->getMatePair()).second].getEnd();
+ } else if (status == MP_LONG || status == MP_SHORT) {
+ left = posmap[((*mi)->getMatePair()).first].getBegin(); // use beginning of reads
+ right = posmap[((*mi)->getMatePair()).second].getBegin();
+ } else if (status == MP_NORMAL || status == MP_OUTIE) {
+ left = posmap[((*mi)->getMatePair()).first].getBegin();
+ right = posmap[((*mi)->getMatePair()).first].getEnd();
+ left = posmap[((*mi)->getMatePair()).second].getBegin();
+ right = posmap[((*mi)->getMatePair()).second].getEnd();
+ } else if (status == MP_SINGMATE) {
+ if ((*mi)->contig1 != 0) {
+ left = posmap[((*mi)->getMatePair()).first].getBegin();
+ right = posmap[((*mi)->getMatePair()).first].getEnd();
+ } else {
+ left = posmap[((*mi)->getMatePair()).second].getBegin();
+ right = posmap[((*mi)->getMatePair()).second].getEnd();
+ }
+ } else if (status == MP_SPANNING){ // check contig ids
+ if ((*mi)->contig1 == id) {
+ left = posmap[((*mi)->getMatePair()).first].getBegin();
+ right = posmap[((*mi)->getMatePair()).first].getEnd();
+ } else {
+ left = posmap[((*mi)->getMatePair()).second].getBegin();
+ right = posmap[((*mi)->getMatePair()).second].getEnd();
+ }
+ } else if (status = MP_LINKING) { // check scaffold ids
+ if ((*mi)->scaff1 == id) {
+ left = posmap[((*mi)->getMatePair()).first].getBegin();
+ right = posmap[((*mi)->getMatePair()).first].getEnd();
+ } else if ((*mi)->scaff2 == id ) {
+ left = posmap[((*mi)->getMatePair()).second].getBegin();
+ right = posmap[((*mi)->getMatePair()).second].getEnd();
+ } else if ((*mi)->scaff1 == 0 && (*mi)->contig1 == id) {
+ left = posmap[((*mi)->getMatePair()).first].getBegin();
+ right = posmap[((*mi)->getMatePair()).first].getEnd();
+ } else if ((*mi)->scaff2 == 0 && (*mi)->contig2 == id) {
+ left = posmap[((*mi)->getMatePair()).second].getBegin();
+ right = posmap[((*mi)->getMatePair()).second].getEnd();
+ } else {
+ cerr << "One of the IDs should match\n";
+ assert(0);
+ }
+ }
+
+ if (left < right)
+ ranges.push_back(pair<Pos_t, Pos_t>(left, right));
+ else
+ ranges.push_back(pair<Pos_t, Pos_t>(right, left));
+ }
+ }
+
+ if (ranges.size() == 0 && above) return;
+// if (coverage < 0) return;
+ if (ranges.size() == 0) {
+ // all contig is below needed coverage
+ interest.push_back(pair<Pos_t, Pos_t>(0, ctglen));
+ return;
+ }
+
+
+ for (list<pair<Pos_t, Pos_t> >::iterator li = ranges.begin();
+ li != ranges.end(); li++){
+ // cout << "Adding " << li->first << ", " << li->second << endl;
+ starts.push_back(li->first);
+ ends.push_back(li->second);
+ }
+
+ sort(starts.begin(), starts.end(), less<Pos_t>());
+ sort(ends.begin(), ends.end(), less<Pos_t>());
+
+ vector<Pos_t>::iterator si, ei;
+
+ si = starts.begin(); ei = ends.begin();
+ int cvg = 0;
+ Pos_t s = 0, e = ctglen;
+ while (si != starts.end() && ei != ends.end()){
+ if (*si <= *ei){
+ if (! above && cvg == coverage){
+ e = *si;
+ interest.push_back(pair<Pos_t, Pos_t>(s, e));
+ }
+ cvg++;
+ if (above && cvg == coverage)
+ s = *si;
+ si++;
+ } else {
+ if (above && cvg == coverage) {
+ e = *ei;
+ interest.push_back(pair<Pos_t, Pos_t>(s, e));
+ }
+ cvg--;
+ if (! above && cvg == coverage)
+ s = *ei;
+ ei++;
+ }
+ }
+
+ assert(si == starts.end());
+ while (ei != ends.end()){
+ if (above && cvg == coverage){
+ e = *ei;
+ interest.push_back(pair<Pos_t, Pos_t>(s, e));
+ }
+ cvg--;
+ if (! above && cvg == coverage)
+ s = *ei;
+ ei++;
+ }
+ if (! above && s != ctglen)
+ interest.push_back(pair<Pos_t, Pos_t>(s, ctglen));
+
+ return;
+} // getCvg
+
+
+// computes mean and standard deviation of array of tiles
+void getMeanSD(vector<pair<Pos_t, Pos_t> >::iterator beg, vector<pair<Pos_t, Pos_t> >::iterator end,
+ Size_t &mea, DoubleSD_t &sd)
+{
+ int n = 0;
+ Size_t sum = 0;
+ DoubleSD_t var = 0;
+
+ for (vector<pair<Pos_t, Pos_t> >::iterator vi = beg; vi != end; vi++){
+ n++;
+ // cout << "Adding " << vi->second - vi->first << " " << vi->first << ", " << vi->second << endl;
+ sum += vi->second - vi->first;
+ }
+ if (n == 0) { return;}
+ mea = sum / n;
+ // cout << "N " << n << endl;
+ // cout << "Mean " << mea << endl;
+ for (vector<pair<Pos_t, Pos_t> >::iterator vi = beg; vi != end; vi++)
+ var += (vi->second - vi->first - mea) * (vi->second - vi->first - mea);
+
+ // cout << "Var " << var << endl;
+ if (n > 1) {
+ sd = var / (n - 1);
+ sd = (DoubleSD_t) sqrt((double)sd);
+ } else {
+ sd = 0;
+ }
+ // cout << "SD " << sd << endl;
+}
+
+// compares two pairs by first item (less than)
+struct LessByFirst : public binary_function<pair<Pos_t, Pos_t>, pair<Pos_t, Pos_t>, bool> {
+ bool operator () (pair<Pos_t, Pos_t> x, pair<Pos_t, Pos_t> y)
+ {
+ return (x.first < y.first);
+ }
+};
+
+// compares two pairs by second item (greater than)
+struct GtBySecond : public binary_function<pair<Pos_t, Pos_t>, pair<Pos_t, Pos_t>, bool> {
+ bool operator () (pair<Pos_t, Pos_t> x, pair<Pos_t, Pos_t> y)
+ {
+ return (x.second > y.second);
+ }
+};
+
+// computes regions with anomalous C/E stat
+void getCEstat(list<list<AnnotatedFragment>::iterator>::iterator begin,
+ list<list<AnnotatedFragment>::iterator>::iterator end,
+ hash_map<ID_t, Range_t, hash<ID_t>, equal_to<ID_t> > & posmap,
+ ID_t libid, pair<Size_t, DoubleSD_t> & libifo, float num_sd,
+ list<pair<Pos_t, Pos_t> > & interest,
+ list<bool> & stretch,
+ ofstream & ceplotFile)
+{
+ vector<pair<Pos_t, Pos_t> > starts, ends;
+ Pos_t pos, st;
+ Size_t mea; // sum of sizes of inserts
+ DoubleSD_t sderr; // standard error for inserts
+ Size_t mean; // global mean size of library
+ DoubleSD_t stdev; // global standard deviation
+ bool over = false; // is error on the longer or shorter side
+ bool inbad = false; // are we in a bad regions
+
+ interest.clear();
+ stretch.clear();
+
+ // get parameters for global distribution
+ mean = libifo.first;
+ stdev = libifo.second;
+ cout << "in CESTAT libid=" << libid << " mea=" << mean << " stdev=" << stdev << endl;
+
+ for (list<list<AnnotatedFragment>::iterator>::iterator mi = begin; mi != end; mi++){
+ Pos_t left, right;
+
+ if ((*mi)->getLibrary() != libid) // only do the selected library
+ continue;
+
+
+ if ((*mi)->status == MP_GOOD || (*mi)->status == MP_LONG || (*mi)->status == MP_SHORT){
+ cout << "Got insert " << (((*mi)->getMatePair()).first) << endl;
+
+ left = posmap[((*mi)->getMatePair()).first].getBegin(); // use end of reads
+ right = posmap[((*mi)->getMatePair()).second].getBegin();
+ cout << left << ", " << right << endl;
+ if (abs (mean - (*mi)->size) > MAX_DEVIATION * stdev){ // skip inserts that are too long or too short
+ cout << "too far" << mean << " - " << (*mi)->size << " vs " << MAX_DEVIATION * stdev << endl;;
+ continue;
+ }
+ if (left < right)
+ starts.push_back(pair<Pos_t, Pos_t>(left, right));
+ else
+ starts.push_back(pair<Pos_t, Pos_t>(right, left));
+ }
+ }// for each mate
+
+ if (starts.size() < 3){
+ return;
+ }
+
+ cout << "got " << starts.size() << " elements\n";
+
+ int inends = 0;
+ sort(starts.begin(), starts.end(), LessByFirst());
+ for (vector<pair<Pos_t, Pos_t> >::iterator si = starts.begin(); si != starts.end(); si++){
+ if (ends.size() == 0 || si->first <= ends[0].second) { // reached beginning of range
+ cout << "got begin " << ++inends << endl;
+ cout << si->first << ", " << si->second << endl;
+ ends.push_back(*si);
+ push_heap(ends.begin(), ends.end(), GtBySecond());
+ pos = si->first;
+ } else { // reached end of range
+ cout << "got end " << --inends << endl;
+ pos = ends[0].second;
+ pop_heap(ends.begin(), ends.end(), GtBySecond());
+ ends.pop_back();
+ }
+ getMeanSD(ends.begin(), ends.end(), mea, sderr);
+
+ if (globals.find("ceplot") != globals.end()){
+ ceplotFile << pos << "\t" << ((stdev != 0) ? (mea - mean) * sqrt((double)ends.size()) / stdev : 0 ) << "\t" << ends.size() << endl;
+ }
+
+ if (ends.size() > MIN_CE_OBS && abs(mea - mean) > num_sd * stdev / sqrt((double)ends.size())){ // too far off
+ // cerr << "CE " << libid << " pos= " << pos << " skew= " << (mea - mean) * sqrt((double)ends.size()) / sderr << " nobs= " << ends.size() << endl;
+ if (mea > mean) {
+ if (inbad && over == false){ // switched type of bad region
+ interest.push_back(pair<Pos_t, Pos_t> (st, pos));
+ stretch.push_back(over);
+ st = pos;
+ }
+ over = true;
+ } else {
+ if (inbad && over == true){ // switched type of bad region
+ interest.push_back(pair<Pos_t, Pos_t> (st, pos));
+ stretch.push_back(over);
+ st = pos;
+ }
+ over = false;
+ }
+ if (! inbad){ // if not already in a bad region, we are now
+ inbad = true;
+ st = pos; // start of bad region is current position
+ }
+ } else if (inbad) { // bad region ended
+ inbad = false;
+ interest.push_back(pair<Pos_t, Pos_t> (st, pos));
+ stretch.push_back(over);
+ }
+ } // for each start
+
+ cout << "Done with starts" << endl;
+ while (ends.size() > 0){
+ pos = ends[0].second;
+ pop_heap(ends.begin(), ends.end(), GtBySecond());
+ ends.pop_back();
+ if (ends.size()== 0){
+ cout << "Done with ends\n";
+ break;
+ }
+
+ getMeanSD(ends.begin(), ends.end(), mea, sderr);
+
+ if (globals.find("ceplot") != globals.end()){
+ ceplotFile << pos << "\t" << ((stdev != 0) ? (mea - mean) * sqrt((double)ends.size()) / stdev : 0 ) << "\t" << ends.size() << endl;
+ }
+
+ if (ends.size() > MIN_CE_OBS && abs(mea - mean) > num_sd * stdev / sqrt((double)ends.size())){ // too far off
+ cerr << "CE " << libid << " pos= " << pos << " skew= " << (mea - mean) * sqrt((double)ends.size()) / stdev << " nobs= " << ends.size() << endl;
+ if (mea > mean) {
+ if (inbad && over == false){ // switched type of bad region
+ interest.push_back(pair<Pos_t, Pos_t> (st, pos));
+ stretch.push_back(over);
+ st = pos;
+ }
+ over = true;
+ } else {
+ if (inbad && over == true){ // switched type of bad region
+ interest.push_back(pair<Pos_t, Pos_t> (st, pos));
+ stretch.push_back(over);
+ st = pos;
+ }
+ over = false;
+ }
+ if (! inbad){ // if not already in a bad region, we are now
+ inbad = true;
+ st = pos; // start of bad region is current position
+ }
+ } else if (inbad) { // bad region ended
+ inbad = false;
+ interest.push_back(pair<Pos_t, Pos_t> (st, pos));
+ stretch.push_back(over);
+ }
+ } // for each end
+} // getCEstat
+
+
+
+//********************************************
+//**** MAIN **********************************
+//********************************************
+int main(int argc, char **argv)
+{
+ if (! GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ // set up some global variables
+ int MIN_OBS = 100; // min. num. of observations required to change lib size
+ float NUM_SD = 3.00; // num. of standard deviations within which mate is good
+ int MIN_GOOD_CVG = 0; // good mate coverages below this will be reported
+ int MAX_SHORT_CVG = 2; // short mate coverages over this will be reported
+ int MAX_LONG_CVG = 2; // long mate coverages over this will be reported
+ int MAX_NORMAL_CVG = 3; // normal orientation read coverages > will be reptd.
+ int MAX_OUTIE_CVG = 3; // outie orientation read coverages > will be reptd.
+ int MAX_LINKING_CVG = 3; // linking mate coverage > will be reported
+ int MAX_SINGLEMATE_CVG = 3; // single mate coverage > will be reported
+ int MEA_CHANGE = 50; // libraries that change by less are considered unchanged
+ int SD_CHANGE = 10; // libraries that change by less are considered unchanged
+
+ bool recompute = false; // recompute library sizes
+ bool update = false; // update library sizes in bank
+ bool feats = false; // add features to bank
+ bool debug = false; // write debugging info to STDERR
+ bool perinsert = false; // do per-insert output
+ bool byscaff = false; // results reported by scaffold
+ bool cestat = false; // do C/E statistics
+
+ cout << "Invocation: ";
+ for (int i = 0; i < argc; i++){
+ cout << argv[i] << " ";
+ }
+ cout << endl << endl;
+
+ if (globals.find("debug") != globals.end()){
+ debug = true;
+ cout << "Debugging mode: additional information written to STDERR" << endl;
+ }
+
+ if (globals.find("meanchange") != globals.end())
+ MEA_CHANGE = strtol(globals["meanchange"].c_str(), NULL, 10);
+
+ if (globals.find("sdchange") != globals.end())
+ SD_CHANGE = strtol(globals["sdchange"].c_str(), NULL, 10);
+
+
+ if (globals.find("update") != globals.end()){
+ update = true;
+ cout << "Will update libraries in bank" << endl;
+ } else
+ cout << "Will not update libraries in bank" << endl;
+
+ if (globals.find("feat") != globals.end()){
+ feats = true;
+ cout << "Will write features in bank" << endl;
+ } else
+ cout << "Will not write features in bank" << endl;
+
+
+ if (globals.find("numsd") != globals.end())
+ NUM_SD = (float)strtod(globals["numsd"].c_str(), NULL);
+ cout << "Mates within " << NUM_SD
+ << " standard deviations from mean considered good" << endl;
+
+ if (globals.find("goodcvg") != globals.end())
+ MIN_GOOD_CVG = strtol(globals["goodcvg"].c_str(), NULL, 10);
+ cout << "Reporting regions with less than " << MIN_GOOD_CVG
+ << " good mate coverage" << endl;
+
+ if (globals.find("cestat") != globals.end()){
+ cout << "Reporting regions with anomalous C/E stat: over " << NUM_SD
+ << " standard errors from mean" << endl;
+ // globals["recompute"] = string("true");
+ globals.erase("shortcvg");
+ globals.erase("longcvg");
+ cestat = true;
+ }
+
+ if (globals.find("recompute") != globals.end()){
+ recompute = true;
+ cout << "Will recompute library sizes" << endl;
+ cout << "Libraries whose mean changes by less than " << MEA_CHANGE
+ << "\nand whose std. dev. changes by less than " << SD_CHANGE
+ << " are considered to not have changed" << endl;
+ } else
+ cout << "Will not recompute library sizes" << endl;
+
+ if (recompute){
+ if (globals.find("minobs") != globals.end())
+ MIN_OBS = strtol(globals["minobs"].c_str(), NULL, 10);
+ cout << "Minimum number of observations required to change library size: "
+ << MIN_OBS << endl;
+ }
+
+ if (globals.find("shortcvg") != globals.end())
+ MAX_SHORT_CVG = strtol(globals["shortcvg"].c_str(), NULL, 10);
+ cout << "Reporting regions with more than " << MAX_SHORT_CVG
+ << " short mate coverage" << endl;
+
+ if (globals.find("longcvg") != globals.end())
+ MAX_LONG_CVG = strtol(globals["longcvg"].c_str(), NULL, 10);
+ cout << "Reporting regions with more than " << MAX_LONG_CVG
+ << " long mate coverage" << endl;
+
+ if (globals.find("normalcvg") != globals.end())
+ MAX_NORMAL_CVG = strtol(globals["normalcvg"].c_str(), NULL, 10);
+ cout << "Reporting regions with more than " << MAX_NORMAL_CVG
+ << " coverage by mates oriented the same way" << endl;
+
+ if (globals.find("outiecvg") != globals.end())
+ MAX_OUTIE_CVG = strtol(globals["outiecvg"].c_str(), NULL, 10);
+ cout << "Reporting regions with more than " << MAX_OUTIE_CVG
+ << " coverage by outie mates" << endl;
+
+ if (globals.find("outiecvg") != globals.end())
+ MAX_OUTIE_CVG = strtol(globals["outiecvg"].c_str(), NULL, 10);
+ cout << "Reporting regions with more than " << MAX_OUTIE_CVG
+ << " coverage by outie mates" << endl;
+
+ if (globals.find("linking") != globals.end())
+ MAX_LINKING_CVG = strtol(globals["linking"].c_str(), NULL, 10);
+ cout << "Reporting regions with more than " << MAX_LINKING_CVG
+ << " coverage by linking mates" << endl;
+
+ if (globals.find("singlemate") != globals.end())
+ MAX_SINGLEMATE_CVG = strtol(globals["singlemate"].c_str(), NULL, 10);
+ cout << "Reporting regions with more than " << MAX_SINGLEMATE_CVG
+ << " coverage by singleton mates" << endl;
+
+ cout << endl;
+ if (globals.find("perinsert") != globals.end()){
+ perinsert = true;
+ cout << "Per-insert information reported in file: "
+ << globals["perinsert"] << endl;
+ }
+ cout << endl;
+
+ if (globals.find("scaff") != globals.end()){
+ byscaff = true;
+ cout << "Reporting results by scaffold. In this mode linking clones connect different scaffolds." << endl;
+ }
+ cout << endl;
+
+ // open necessary files
+ if (globals.find("bank") == globals.end()){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ // prepare banks we'll need
+
+ Bank_t library_bank (Library_t::NCODE);
+ if (! library_bank.exists(globals["bank"])){
+ cerr << "No library account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ if (update)
+ library_bank.open(globals["bank"], B_READ|B_WRITE);
+ else
+ library_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open library account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ BankStream_t contig_stream (Contig_t::NCODE);
+ if (! contig_stream.exists(globals["bank"])){
+ cerr << "No contig account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ contig_stream.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open contig account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ Bank_t read_bank (Read_t::NCODE);
+ if (! read_bank.exists(globals["bank"])){
+ cerr << "No read account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ read_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open read account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ BankStream_t frag_bank (Fragment_t::NCODE);
+ if (! frag_bank.exists(globals["bank"])){
+ cerr << "No frag account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ frag_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open frag account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ BankStream_t feat_stream (Feature_t::NCODE);
+ if (feats)
+ {
+ try {
+ if (! feat_stream.exists(globals["bank"])){
+ feat_stream.create(globals["bank"], B_READ|B_WRITE);
+ } else {
+ feat_stream.open(globals["bank"], B_READ|B_WRITE);
+ }
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open feat account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ }
+
+ BankStream_t scaff_stream (Scaffold_t::NCODE);
+ if (byscaff){
+ try {
+ if (! scaff_stream.exists(globals["bank"])){
+ cerr << "No scaffold account found in bank " << globals["bank"] << endl
+ << "ignoring -scaff option" << endl;
+ byscaff = false;
+ } else {
+ scaff_stream.open(globals["bank"], B_READ);
+ }
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open scaffold account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ }
+
+
+ ofstream insertFile;
+ if (perinsert){
+ insertFile.open(globals["perinsert"].c_str(), ofstream::out);
+ if (! insertFile.is_open()){
+ cerr << "Failed to open insert file " << globals["perinsert"] << endl;
+ exit(1);
+ }
+ }
+
+ // C/E statistic plot to be written to this file
+ ofstream ceplotFile;
+ if (globals.find("ceplot") != globals.end()){
+ ceplotFile.open(globals["ceplot"].c_str(), ofstream::out);
+ if (! ceplotFile.is_open()){
+ cerr << "Failed to open ceplot file " << globals["ceplot"] << endl;
+ exit(1);
+ }
+ }
+
+ //**********************************************
+ // LOAD SCAFFOLD INFO
+ // ctg2scaff <- scaffold IID for each contig
+ // ctg2posn <- position of contig in scaffold
+ // scaffspan <- span of scaffold
+ Scaffold_t scaff;
+
+ hash_map<ID_t, ID_t, hash<ID_t>, equal_to<ID_t> > ctg2scaff; // map from contig to scaffold
+ hash_map<ID_t, Range_t, hash<ID_t>, equal_to<ID_t> > ctg2posn; // position in scaffold
+ hash_map<ID_t, Size_t, hash<ID_t>, equal_to<ID_t> > scaffspan; // span of scaffold
+ hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > scaffname; // name of scaffold
+
+ set<ID_t> scfIDs;
+
+ if (byscaff){
+ while (scaff_stream >> scaff){
+ scaffspan[scaff.getIID()] = scaff.getSpan();
+ scfIDs.insert(scaff.getIID());
+ scaffname[scaff.getIID()] = scaff.getEID();
+ // cerr << "Span of " << scaff.getIID() << " is " << scaff.getSpan() << endl;
+ for (vector<Tile_t>::iterator ti = scaff.getContigTiling().begin();
+ ti != scaff.getContigTiling().end(); ti++){
+ ctg2scaff[ti->source] = scaff.getIID();
+
+ Pos_t f, l; // coords of beginning/end of contig
+ if (ti->range.getEnd() < ti->range.getBegin()) { // reverse
+ f = ti->offset + ti->range.getBegin() - ti->range.getEnd();
+ l = ti->offset;
+ } else {
+ f = ti->offset;
+ l = ti->offset + ti->range.getEnd() - ti->range.getBegin();
+ }
+ ctg2posn[ti->source] = Range_t(f, l);
+ } // for each tile
+ } // while scaff_stream
+ } // if (byscaff)
+
+
+ //********************************************
+ // LOAD CONTIG INFO
+ // rd2ctg <- contig IID for each read
+ // rd2scfid <- scaffold IID for each read
+ // rd2posn <- coordinates of reads in contigs
+ // rd2scaff <- coordinates of reads in scaffolds
+ // ctglen <- length of contigs
+ // ctgname <- EIDs of contigs
+ Contig_t ctg;
+
+ hash_map<ID_t, ID_t, hash<ID_t>, equal_to<ID_t> > rd2ctg; // map from read to contig
+ hash_map<ID_t, ID_t, hash<ID_t>, equal_to<ID_t> > rd2scfid; // map from read to scaffold
+ hash_map<ID_t, Range_t, hash<ID_t>, equal_to<ID_t> > rd2posn; // position in contig
+ hash_map<ID_t, Range_t, hash<ID_t>, equal_to<ID_t> > rd2scaff; // position in scaffold
+ hash_map<ID_t, Size_t, hash<ID_t>, equal_to<ID_t> > ctglen; // length of contig
+ hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > ctgname; // name of contig
+
+ set<ID_t> ctgIDs;
+ while (contig_stream >> ctg)
+ for (vector<Tile_t>::iterator ti = ctg.getReadTiling().begin();
+ ti != ctg.getReadTiling().end(); ti++){
+ rd2ctg[ti->source] = ctg.getIID();
+ ctgIDs.insert(ctg.getIID());
+ Pos_t f, l; // coords of beginning/end of read
+ if (ti->range.getEnd() < ti->range.getBegin()) { // reverse
+ f = ti->offset + ti->range.getBegin() - ti->range.getEnd() +
+ ti->gaps.size();
+ l = ti->offset;
+ } else {
+ f = ti->offset;
+ l = ti->offset + ti->range.getEnd() - ti->range.getBegin() +
+ ti->gaps.size();
+ }
+
+ rd2posn[ti->source] =
+ Range_t(f, l);
+
+ // cerr << "Coords in contig " << ctg.getIID() << " for read " << ti->source << " = " << f << ", " << l << endl;
+
+ if (byscaff) { // coordinates are based on scaffold
+ rd2scfid[ti->source] = ctg2scaff[ctg.getIID()];
+ if ( rd2posn[ti->source].isReverse() && ctg2posn[ctg.getIID()].isReverse()){ // both reverse
+ rd2scaff[ti->source] = Range_t(ctg2posn[ctg.getIID()].getBegin() - f, ctg2posn[ctg.getIID()].getBegin() - l);
+ } else if (! rd2posn[ti->source].isReverse() && ctg2posn[ctg.getIID()].isReverse()){ // contig reverse
+ rd2scaff[ti->source] = Range_t(ctg2posn[ctg.getIID()].getBegin() - f, ctg2posn[ctg.getIID()].getBegin() - l);
+ } else if ( rd2posn[ti->source].isReverse() && ! ctg2posn[ctg.getIID()].isReverse()){ // read reverse
+ rd2scaff[ti->source] = Range_t(ctg2posn[ctg.getIID()].getBegin() + f, ctg2posn[ctg.getIID()].getBegin() + l);
+ } else if (! rd2posn[ti->source].isReverse() && ! ctg2posn[ctg.getIID()].isReverse()){ // both forward
+ rd2scaff[ti->source] = Range_t(ctg2posn[ctg.getIID()].getBegin() + f, ctg2posn[ctg.getIID()].getBegin() + l);
+ }
+ // cerr << "Coords in scaffold " << ctg2scaff[ctg.getIID()] << " for read " << ti->source << " = " << rd2posn[ti->source].getBegin() << ", "
+ // << rd2posn[ti->source].getEnd() << endl;
+ // cerr << "Contig coords for contig " << ctg.getIID() << " = " << ctg2posn[ctg.getIID()].getBegin() << ", " << ctg2posn[ctg.getIID()].getEnd() << endl;
+ }
+
+ ctglen[ctg.getIID()] = ctg.getLength();
+ ctgname[ctg.getIID()] = ctg.getEID();
+ } // for each tile
+ // for each contig
+
+ contig_stream.close();
+
+
+ //*********************************************
+ // LOAD FRAGMENT AND READ INFORMATION
+ // rd2name <- EID of read
+ // mtl <- list of all mate pairs
+ // lib2frag <- list of fragments in library
+ // ctg2frag <- list of fragments in contig
+ // scf2frag <- list of fragments in scaffold
+ AnnotatedFragment frag;
+ pair<ID_t, ID_t> mtp;
+ list<AnnotatedFragment> mtl;
+ Read_t rd1, rd2;
+ set<ID_t> libIDs;
+ hash_map<ID_t, ID_t, hash<ID_t>, equal_to<ID_t> > rd2frg;
+ hash_map<ID_t, list<list<AnnotatedFragment>::iterator>, hash<ID_t>, equal_to<ID_t> > lib2frag;
+ hash_map<ID_t, list<list<AnnotatedFragment>::iterator>, hash<ID_t>, equal_to<ID_t> > ctg2frag;
+ hash_map<ID_t, list<list<AnnotatedFragment>::iterator>, hash<ID_t>, equal_to<ID_t> > scf2frag;
+ hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > rd2name;
+
+ while (frag_bank >> frag){
+
+ frag.status = MP_GOOD;
+ mtp = frag.getMatePair();
+
+ if (mtp.first != 0)
+ read_bank.fetch(mtp.first, rd1); // get the read
+ if (mtp.second != 0)
+ read_bank.fetch(mtp.second, rd2);
+
+ if (mtp.first == 0 || mtp.second == 0) {
+ if (perinsert)
+ insertFile << "UNMATED: "
+ << ((mtp.first != 0) ? mtp.first : mtp.second)
+ << "(" << ((mtp.first != 0) ? rd1.getEID() : rd2.getEID())
+ << ")" << endl;
+ continue;
+ }
+
+ if (frag.getType() != Fragment_t::INSERT) {// we only handle end reads
+ if (perinsert)
+ insertFile << "NOT END MATES: "
+ << mtp.first
+ << "(" << rd1.getEID() << ") "
+ << mtp.second
+ << "(" << rd2.getEID() << ") "
+ << "\n";
+ continue;
+ }
+
+
+ rd2name[mtp.first] = rd1.getEID();
+ rd2name[mtp.second] = rd2.getEID();
+ libIDs.insert(frag.getLibrary());
+
+
+ list<AnnotatedFragment>::iterator ti;
+ if (rd2ctg[mtp.first] == rd2ctg[mtp.second]){
+ // mate-pair between reads within the same contig
+ frag.contig1 = rd2ctg[mtp.first];
+ frag.contig2 = rd2ctg[mtp.first];
+ if (rd2scfid[mtp.first] != 0){
+ frag.scaff1 = rd2scfid[mtp.first];
+ frag.scaff2 = rd2scfid[mtp.first];
+ } else {
+ frag.scaff1 = frag.scaff2 = 0;
+ }
+ ti = mtl.insert(mtl.end(), frag);
+
+ lib2frag[frag.getLibrary()].push_back(ti);
+ ctg2frag[rd2ctg[mtp.first]].push_back(ti);
+ if (rd2scfid[mtp.first] != 0)
+ scf2frag[rd2scfid[mtp.first]].push_back(ti);
+ } else {
+ if (rd2ctg[mtp.first] == 0 ||
+ rd2ctg[mtp.second] == 0) { // mate should be in some contig
+ frag.status = MP_SINGMATE;
+ frag.contig1 = rd2ctg[mtp.first];
+ frag.contig2 = rd2ctg[mtp.second];
+ frag.scaff1 = rd2scfid[mtp.first];
+ frag.scaff2 = rd2scfid[mtp.second];
+ ti = mtl.insert(mtl.end(), frag);
+ lib2frag[frag.getLibrary()].push_back(ti);
+ ctg2frag[rd2ctg[mtp.first]].push_back(ti);
+ if (rd2scfid[mtp.first] != 0) scf2frag[rd2scfid[mtp.first]].push_back(ti);
+ if (rd2scfid[mtp.second] != 0) scf2frag[rd2scfid[mtp.second]].push_back(ti);
+ if (perinsert)
+ insertFile << "SINGLETON_MATE: "
+ << mtp.first
+ << "(" << rd2name[mtp.first] << ") "
+ << mtp.second
+ << "(" << rd2name[mtp.second] << ") "
+ << " in separate contigs: "
+ << rd2ctg[mtp.first] << ", "
+ << rd2ctg[mtp.second]
+ << "\n";
+ } else {
+ if (byscaff && ((rd2scfid[mtp.first] != rd2scfid[mtp.second]) || rd2scfid[mtp.first] == 0))
+ frag.status = MP_LINKING; // links two different scaffolds. 0 - indicates contig is not in a scaffold
+ else
+ frag.status = MP_SPANNING; // spans gap between contigs
+ frag.contig1 = rd2ctg[mtp.first];
+ frag.contig2 = rd2ctg[mtp.second];
+ frag.scaff1 = rd2scfid[mtp.first];
+ frag.scaff2 = rd2scfid[mtp.second];
+ ti = mtl.insert(mtl.end(), frag);
+ lib2frag[frag.getLibrary()].push_back(ti);
+ ctg2frag[rd2ctg[mtp.first]].push_back(ti);
+ ctg2frag[rd2ctg[mtp.second]].push_back(ti);
+ if (rd2scfid[mtp.first] != 0)
+ scf2frag[rd2scfid[mtp.first]].push_back(ti);
+ if (rd2scfid[mtp.first] != 0 && rd2scfid[mtp.second] != 0
+ && rd2scfid[mtp.first] != rd2scfid[mtp.second])
+ scf2frag[rd2scfid[mtp.second]].push_back(ti);
+
+ if (perinsert) {
+ if (frag.status == MP_SPANNING)
+ insertFile << "SPANNING: "
+ << mtp.first
+ << "(" << rd2name[mtp.first] << ") "
+ << mtp.second
+ << "(" << rd2name[mtp.second] << ") "
+ << " in separate contigs: "
+ << rd2ctg[mtp.first] << ", "
+ << rd2ctg[mtp.second]
+ << "\n";
+ else // LINKING
+ insertFile << "LINKING: "
+ << mtp.first
+ << "(" << rd2name[mtp.first] << ") "
+ << mtp.second
+ << "(" << rd2name[mtp.second] << ") "
+ << " in separate scaffolds: "
+ << rd2scfid[mtp.first] << ", "
+ << rd2scfid[mtp.second]
+ << "\n";
+ }
+ }
+ }
+ } // for each fragment
+
+ //**********************************************************
+ // GET LIBRARY INFO
+ //
+ // lib2name <- EID of library
+ // lib2size <- mean, stdev pair
+ hash_map<ID_t, pair<Pos_t, DoubleSD_t>, hash<ID_t>, equal_to<ID_t> > lib2size;
+ hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > lib2name;
+ Library_t lib;
+ for (set<ID_t>::iterator li = libIDs.begin(); li != libIDs.end(); li++){
+ library_bank.fetch(*li, lib);
+ lib2name[*li] = lib.getEID();
+ lib2size[*li] = pair<Pos_t, DoubleSD_t> (lib.getDistribution().mean,
+ lib.getDistribution().sd);
+ }
+
+ // now we're ready to figure out new library sizes
+ hash_map<ID_t, pair<Pos_t, DoubleSD_t>, hash<ID_t>, equal_to<ID_t> > NewLib2size;
+
+ for (set<ID_t>::iterator li = libIDs.begin(); li != libIDs.end(); li++){
+ // for each library
+ list<Pos_t> sizes;
+ pair<Pos_t, DoubleSD_t> libsize = lib2size[*li];
+
+ for (list<list<AnnotatedFragment>::iterator>::iterator
+ mi = lib2frag[*li].begin(); mi != lib2frag[*li].end(); mi++){
+ // for each mate pair
+ if ((*mi)->status == MP_GOOD) {
+ Pos_t sz = mateLen(**mi, rd2posn[(*mi)->getMatePair().first],
+ rd2posn[(*mi)->getMatePair().second],
+ ctglen[rd2ctg[(*mi)->getMatePair().first]],
+ libsize.first + 3 * libsize.second);
+
+ if (recompute && sz != 0) {
+ sizes.push_back(sz);
+ }
+ }
+
+ // rerun mateLen if necessary for scaffolds
+ // this step should assign MP_OUTIE and MP_NORMAL tags to mates
+ // spanning contig boundaries. These are not used to recompute
+ // library sizes
+ if (byscaff && (*mi)->status == MP_SPANNING){
+ mateLen(**mi, rd2scaff[(*mi)->getMatePair().first],
+ rd2scaff[(*mi)->getMatePair().second],
+ scaffspan[rd2scfid[(*mi)->getMatePair().first]], 0);
+ } // if byscaff
+ }
+
+ // compute new sizes
+ pair<Pos_t, DoubleSD_t> newSize;
+ if (! recompute || sizes.size() < MIN_OBS ){
+ newSize = libsize;
+ } else {
+ newSize = getSz(sizes);
+ if ((abs (((int) newSize.first) - ((int) libsize.first)) > MEA_CHANGE) ||
+ (abs (((int) newSize.second) - ((int) libsize.second)) > SD_CHANGE) ){ // if new size significantly different
+ cout << "Library " << lib2name[*li] << " recomputed as mean = "
+ << newSize.first << " SD = " << newSize.second << endl;
+ if (update){
+ Library_t newlib;
+ Distribution_t dist;
+ dist.mean = newSize.first;
+ dist.sd = newSize.second;
+ newlib.setIID(*li);
+ newlib.setEID(lib2name[*li]);
+ newlib.setDistribution(dist);
+ try {
+ library_bank.replace(*li, newlib);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Failed to replace library " << *li << "("
+ << lib2name[*li] << ") in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+ } // if updating library in bank
+ } else {
+ cout << "Size of library " << lib2name[*li]
+ << " has not changed enough: MEA= " << newSize.first
+ << " SD= " << newSize.second << " versus MEA= "
+ << libsize.first << " SD= " << libsize.second << endl;
+ }// if size actually changed
+ }
+ NewLib2size[*li] = newSize;
+
+ // recheck mate lengths and set status
+ for (list<list<AnnotatedFragment>::iterator>::iterator
+ mi = lib2frag[*li].begin(); mi != lib2frag[*li].end(); mi++){
+ // for each mate pair
+ // turn off end check
+ if ((*mi)->status != MP_GOOD && (*mi)->status != MP_SPANNING){
+ if (perinsert){
+ if ((*mi)->status == MP_OUTIE)
+ insertFile << "OUTIE: ";
+ if ((*mi)->status == MP_NORMAL)
+ insertFile << "SAME: ";
+
+ insertFile << ((*mi)->getMatePair()).first
+ << "(" << rd2name[((*mi)->getMatePair()).first] << ") "
+ << ((*mi)->getMatePair()).second
+ << "(" << rd2name[((*mi)->getMatePair()).second]
+ << ") LIBRARY: "
+ << *li << "(" << lib2name[*li] << ")"
+ << "\n";
+ }
+ continue; // only interested in mates not already tagged
+ }
+
+ if ((*mi)->status == MP_SPANNING && ! byscaff)
+ continue; // only in scaffolds do we measure spanning clones
+
+ Pos_t sz;
+ if ((*mi)->status == MP_SPANNING) {
+ (*mi)->status = MP_GOOD; // in scaffolds spanning is good
+ sz = mateLen(**mi, rd2scaff[(*mi)->getMatePair().first],
+ rd2scaff[(*mi)->getMatePair().second],
+ scaffspan[rd2scfid[(*mi)->getMatePair().first]], 0);
+ } else
+ sz = mateLen(**mi, rd2posn[((*mi)->getMatePair()).first],
+ rd2posn[((*mi)->getMatePair()).second],
+ ctglen[rd2ctg[((*mi)->getMatePair()).first]], 0);
+
+ if (sz == 0 && ! byscaff){
+ cerr << "Zero size? " << ((*mi)->getMatePair()).first << " (" << rd2posn[((*mi)->getMatePair()).first].getBegin() << ", "
+ << rd2posn[((*mi)->getMatePair()).first].getEnd() << ") - "
+ << ((*mi)->getMatePair()).second << " (" << rd2posn[((*mi)->getMatePair()).second].getBegin() << ", "
+ << rd2posn[((*mi)->getMatePair()).second].getEnd() << ") " << ctglen[rd2ctg[((*mi)->getMatePair()).first]] << "\n";
+ } else if (sz == 0 && byscaff){
+ cerr << "Zero size? " << ((*mi)->getMatePair()).first << " (" << rd2scaff[((*mi)->getMatePair()).first].getBegin() << ", "
+ << rd2scaff[((*mi)->getMatePair()).first].getEnd() << ") - "
+ << ((*mi)->getMatePair()).second << " (" << rd2scaff[((*mi)->getMatePair()).second].getBegin() << ", "
+ << rd2scaff[((*mi)->getMatePair()).second].getEnd() << ") " << scaffspan[rd2scfid[((*mi)->getMatePair()).first]] << "\n";
+ cerr << "Scaffold " << rd2scfid[((*mi)->getMatePair()).first] << " contig " << rd2ctg[((*mi)->getMatePair()).first] << endl;
+ cerr << "Scaffold " << rd2scfid[((*mi)->getMatePair()).second] << " contig " << rd2ctg[((*mi)->getMatePair()).second] << endl;
+ cerr << (*mi)->status << endl;
+ }
+ assert (sz != 0); // sz == 0 implies mis-orientation. shouldn't have made it this far
+
+ if (abs(sz - newSize.first) > newSize.second * NUM_SD) {
+ // farther than NUM_SD standard deviations from the mean
+ if (sz < newSize.first){
+ (*mi)->status = MP_SHORT; // too short
+ if (perinsert)
+ insertFile << "SHORT "
+ << ((*mi)->getMatePair()).first
+ << "(" << rd2name[((*mi)->getMatePair()).first] << ") "
+ << ((*mi)->getMatePair()).second
+ << "(" << rd2name[((*mi)->getMatePair()).second] << ") "
+ << "SIZE: " << sz << " EXPECTED: " << newSize.first
+ << "(" << newSize.second << ") LIBRARY: "
+ << *li << "(" << lib2name[*li] << ")"
+ << "\n";
+
+ } else {
+ (*mi)->status = MP_LONG; // too long
+ if (perinsert)
+ insertFile << "LONG "
+ << ((*mi)->getMatePair()).first
+ << "(" << rd2name[((*mi)->getMatePair()).first] << ") "
+ << ((*mi)->getMatePair()).second
+ << "(" << rd2name[((*mi)->getMatePair()).second] << ") "
+ << "SIZE: " << sz << " EXPECTED: " << newSize.first
+ << "(" << newSize.second << ") LIBRARY: "
+ << *li << "(" << lib2name[*li] << ")"
+ << "\n";
+ }
+ } else // long or short
+ if (perinsert)
+ insertFile << "GOOD "
+ << ((*mi)->getMatePair()).first
+ << "(" << rd2name[((*mi)->getMatePair()).first] << ") "
+ << ((*mi)->getMatePair()).second
+ << "(" << rd2name[((*mi)->getMatePair()).second] << ") "
+ << "SIZE: " << sz << " EXPECTED: " << newSize.first
+ << "(" << newSize.second << ") LIBRARY: "
+ << *li << "(" << lib2name[*li] << ")"
+ << "\n";
+ } // for each mate pair
+ }// for each library
+
+ if (recompute)
+ cout << endl;
+
+
+ //*****************************************************************************
+ // Now all the tough work is done. It remains to report on all the problems
+ // we've encountered.
+ //
+ // First we'll handle scaffolds, then the contigs that don't belong to scaffolds
+ //*****************************************************************************
+
+ for (set<ID_t>::iterator ctg = ctgIDs.begin(); ctg != ctgIDs.end(); ctg++) {
+
+ list<pair<Pos_t, Pos_t> > ranges; // ranges we are interested in
+ list<pair<Pos_t, Pos_t> > interest;
+
+ if (byscaff && ctg2scaff[*ctg] != 0)
+ continue; // contig in scaffold. Skip since it's been handled in the scaffold section
+
+ cout << ">Contig_" << *ctg << " " << ctgname[*ctg] << " "
+ << ctglen[*ctg] << " bases" << endl;
+
+ cerr << ">Contig_" << *ctg << " " << ctgname[*ctg] << " "
+ << ctglen[*ctg] << " bases" << endl;
+
+ getCvg(ctg2frag[*ctg].begin(), ctg2frag[*ctg].end(), rd2posn, MP_GOOD, *ctg, interest, ctglen[*ctg], MIN_GOOD_CVG, false);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MIN_GOOD_CVG << "X"
+ << ((MIN_GOOD_CVG != 0) ? " or less": "") << " clone coverage"
+ <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("LOW_GOOD_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*ctg, Contig_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+
+
+ if (cestat) {
+ // calculate C/E statistics
+ for (set<ID_t>::iterator li = libIDs.begin(); li != libIDs.end(); li++){
+ pair<Pos_t, DoubleSD_t> libsize = NewLib2size[*li];
+ list<bool> stretch;
+
+ if (globals.find("ceplot") != globals.end())
+ ceplotFile << ">c" << *ctg << " " << ctgname[*ctg] << " l" << *li << " " << lib2name[*li] << endl;
+
+ getCEstat(ctg2frag[*ctg].begin(), ctg2frag[*ctg].end(), rd2posn, *li, libsize, NUM_SD, interest, stretch, ceplotFile);
+
+ // report interesting ranges
+ if (interest.size() > 0){
+ cout << "In library " << *li << endl;
+
+ list<bool>::iterator si = stretch.begin();
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++, si++){
+ cout << ii->first << "\t" << ii->second;
+ if (*si)
+ cout << " STRETCH in lib " << *li << "(" << lib2name[*li] << ")" << endl;
+ else
+ cout << " COMPRESS in lib " << *li << "(" << lib2name[*li] << ")" << endl;
+ if (feats){
+ Feature_t f;
+ ostringstream comment;
+
+ if (*si)
+ comment << "CE_STRETCH LIB=" << *li << "(" << lib2name[*li] << ")";
+ else
+ comment << "CE_COMPRESS LIB=" << *li << "(" << lib2name[*li] << ")";
+
+ f.setComment(comment.str());
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*ctg, Contig_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+ } // for each lib
+ } // if cestat
+
+ if (! cestat){
+ // find coverage by short mates
+
+ getCvg(ctg2frag[*ctg].begin(), ctg2frag[*ctg].end(), rd2posn, MP_SHORT, *ctg, interest, ctglen[*ctg], MAX_SHORT_CVG, true);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MAX_SHORT_CVG << "X or more short mate coverage"
+ <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("HIGH_SHORT_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*ctg, Contig_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+ }
+
+
+ if (! cestat) {
+ // find coverage by long mates
+
+ getCvg(ctg2frag[*ctg].begin(), ctg2frag[*ctg].end(), rd2posn, MP_LONG, *ctg, interest, ctglen[*ctg], MAX_LONG_CVG, true);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MAX_LONG_CVG << "X or more long mate coverage"
+ <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("HIGH_LONG_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*ctg, Contig_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+ }
+
+ // find coverage by normal reads
+
+ getCvg(ctg2frag[*ctg].begin(), ctg2frag[*ctg].end(), rd2posn, MP_NORMAL, *ctg, interest, ctglen[*ctg], MAX_NORMAL_CVG, true);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MAX_NORMAL_CVG
+ << "X or more same-orientation coverage" <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("HIGH_NORMAL_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*ctg, Contig_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+
+ getCvg(ctg2frag[*ctg].begin(), ctg2frag[*ctg].end(), rd2posn, MP_OUTIE, *ctg, interest, ctglen[*ctg], MAX_OUTIE_CVG, true);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MAX_OUTIE_CVG << "X or more outie coverage"
+ <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("HIGH_OUTIE_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*ctg, Contig_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+
+ // find coverage by linking reads
+ getCvg(ctg2frag[*ctg].begin(), ctg2frag[*ctg].end(), rd2posn, MP_LINKING, *ctg, interest, ctglen[*ctg], MAX_LINKING_CVG, true);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MAX_LINKING_CVG << "X or more linking coverage"
+ <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("HIGH_LINKING_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*ctg, Contig_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+
+ // find coverage by spanning reads
+ getCvg(ctg2frag[*ctg].begin(), ctg2frag[*ctg].end(), rd2posn, MP_SPANNING, *ctg, interest, ctglen[*ctg], MAX_LINKING_CVG, true);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MAX_LINKING_CVG << "X or more linking coverage"
+ <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("HIGH_SPANNING_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*ctg, Contig_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+
+ // find coverage by single mate reads
+
+ getCvg(ctg2frag[*ctg].begin(), ctg2frag[*ctg].end(), rd2posn, MP_SINGMATE, *ctg, interest, ctglen[*ctg], MAX_SINGLEMATE_CVG, true);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MAX_SINGLEMATE_CVG << "X or more singleton mate coverage"
+ <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("HIGH_SINGLEMATE_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*ctg, Contig_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+ } // for each contig
+
+
+ for (set<ID_t>::iterator scf = scfIDs.begin(); scf != scfIDs.end(); scf++) {
+
+ list<pair<Pos_t, Pos_t> > ranges; // ranges we are interested in
+ list<pair<Pos_t, Pos_t> > interest;
+
+ cout << ">Scaffold_" << *scf << " " << scaffspan[*scf] << " bases" << endl;
+ cerr << ">Scaffold_" << *scf << " " << scaffspan[*scf] << " bases" << endl;
+
+ getCvg(scf2frag[*scf].begin(), scf2frag[*scf].end(), rd2scaff, MP_GOOD, *scf, interest, scaffspan[*scf], MIN_GOOD_CVG, false);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MIN_GOOD_CVG << "X"
+ << ((MIN_GOOD_CVG != 0) ? " or less": "") << " clone coverage"
+ <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("LOW_GOOD_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*scf, Scaffold_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+
+ if (cestat) {
+ // calculate C/E statistics
+ for (set<ID_t>::iterator li = libIDs.begin(); li != libIDs.end(); li++){
+ pair<Pos_t, DoubleSD_t> libsize = NewLib2size[*li];
+ list<bool> stretch;
+
+ if (globals.find("ceplot") != globals.end())
+ ceplotFile << ">s" << *scf << " " << scaffname[*scf] << " l" << *li << " " << lib2name[*li] << endl;
+
+ getCEstat(scf2frag[*scf].begin(), scf2frag[*scf].end(), rd2scaff, *li, libsize, NUM_SD, interest, stretch, ceplotFile);
+
+ // report interesting ranges
+ if (interest.size() > 0){
+ cout << "In library " << *li << endl;
+
+ list<bool>::iterator si = stretch.begin();
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++, si++){
+ cout << ii->first << "\t" << ii->second;
+ if (*si)
+ cout << " STRETCH in lib " << *li << "(" << lib2name[*li] << ")" << endl;
+ else
+ cout << " COMPRESS in lib " << *li << "(" << lib2name[*li] << ")" << endl;
+ if (feats){
+ Feature_t f;
+ ostringstream comment;
+
+ if (*si)
+ comment << "CE_STRETCH LIB=" << *li << "(" << lib2name[*li] << ")";
+ else
+ comment << "CE_COMPRESS LIB=" << *li << "(" << lib2name[*li] << ")";
+
+ f.setComment(comment.str());
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*scf, Scaffold_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+ } // for each lib
+ } // if cestat
+
+
+ if (! cestat){
+ // find coverage by short mates
+
+ getCvg(scf2frag[*scf].begin(), scf2frag[*scf].end(), rd2scaff, MP_SHORT, *scf, interest, scaffspan[*scf], MAX_SHORT_CVG, true);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MAX_SHORT_CVG << "X or more short mate coverage"
+ <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("HIGH_SHORT_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*scf, Scaffold_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+ }
+
+
+ if (! cestat){
+ // find coverage by long mates
+
+ getCvg(scf2frag[*scf].begin(), scf2frag[*scf].end(), rd2scaff, MP_LONG, *scf, interest, scaffspan[*scf], MAX_LONG_CVG, true);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MAX_LONG_CVG << "X or more long mate coverage"
+ <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("HIGH_LONG_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*scf, Scaffold_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+ }
+
+ // find coverage by normal reads
+
+ getCvg(scf2frag[*scf].begin(), scf2frag[*scf].end(), rd2scaff, MP_NORMAL, *scf, interest, scaffspan[*scf], MAX_NORMAL_CVG, true);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MAX_NORMAL_CVG
+ << "X or more same-orientation coverage" <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("HIGH_NORMAL_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*scf, Scaffold_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+
+ getCvg(scf2frag[*scf].begin(), scf2frag[*scf].end(), rd2scaff, MP_OUTIE, *scf, interest, scaffspan[*scf], MAX_OUTIE_CVG, true);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MAX_OUTIE_CVG << "X or more outie coverage"
+ <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("HIGH_OUTIE_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*scf, Scaffold_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+
+ // find coverage by linking reads
+ getCvg(scf2frag[*scf].begin(), scf2frag[*scf].end(), rd2scaff, MP_LINKING, *scf, interest, scaffspan[*scf], MAX_LINKING_CVG, true);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MAX_LINKING_CVG << "X or more linking coverage"
+ <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("HIGH_LINKING_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*scf, Scaffold_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+
+ // find coverage by single mate reads
+ getCvg(scf2frag[*scf].begin(), scf2frag[*scf].end(), rd2scaff, MP_SINGMATE, *scf, interest, scaffspan[*scf], MAX_SINGLEMATE_CVG, true);
+
+ // report interesting ranges
+
+ if (interest.size() > 0){
+ cout << "Regions of " << MAX_SINGLEMATE_CVG << "X or more singleton mate coverage"
+ <<endl;
+
+ for (list<pair<Pos_t, Pos_t> >::iterator ii = interest.begin();
+ ii != interest.end(); ii++){
+ cout << ii->first << "\t" << ii->second << endl;
+ if (feats){
+ Feature_t f;
+ f.setComment("HIGH_SINGLEMATE_CVG");
+ f.setRange(Range_t(ii->first, ii->second));
+ f.setSource(make_pair(*scf, Scaffold_t::NCODE));
+ f.setType(Feature_t::MATEPAIR);
+ feat_stream << f;
+ }
+ }
+ cout << endl;
+ }
+ } // for each scaffold
+
+
+
+ frag_bank.close();
+ read_bank.close();
+ library_bank.close();
+ feat_stream.close();
+ if (perinsert)
+ insertFile.close();
+ if (globals.find("ceplot") != globals.end())
+ ceplotFile.close();
+
+ return(0);
+} // main
+
diff --git a/src/Validation/asmQC2.cc b/src/Validation/asmQC2.cc
new file mode 100644
index 0000000..b8d28f4
--- /dev/null
+++ b/src/Validation/asmQC2.cc
@@ -0,0 +1,777 @@
+// $Id$
+
+// This program reads a set of contigs from a bank then reports
+// regions where mate-pair information indicates a problem
+
+#include "foundation_AMOS.hh"
+
+#include <getopt.h>
+#include <map>
+#include <set>
+#include <list>
+#include <vector>
+#include <string>
+#include <math.h>
+#include <functional>
+#include <stdlib.h>
+
+using namespace std;
+using namespace AMOS;
+using namespace HASHMAP;
+
+#define endl "\n"
+
+enum MateStatus {MP_GOOD, MP_SHORT, MP_LONG, MP_NORMAL, MP_OUTIE, MP_SINGMATE,
+ MP_LINKING};
+
+class AnnotatedFragment: public Fragment_t
+{
+public:
+ MateStatus status;
+ Pos_t deviation; // how far it deviates from mean
+ float rank; // rank in sorted library list
+ Pos_t size;
+ AnnotatedFragment() : Fragment_t() {
+ status = MP_GOOD;
+ deviation = 0;
+ rank = 0;
+ }
+};
+
+struct RankedRange {
+ Pos_t left, right;
+ float range;
+};
+
+struct cmpFrag :
+ public binary_function<list<AnnotatedFragment>::iterator, list<AnnotatedFragment>::iterator, bool>
+{
+ bool operator () (list<AnnotatedFragment>::iterator a, list<AnnotatedFragment>::iterator b)
+ {
+ return a->size < b->size;
+ }
+};
+
+struct pairCmp :
+ public binary_function<pair<Pos_t, float>, pair<Pos_t, float>, bool>
+{
+ bool operator () (pair<Pos_t, float> a, pair<Pos_t, float> b)
+ {
+ return a.first < b.first;
+ }
+};
+
+map<string, string> globals; // global variables
+
+void printHelpText()
+{
+ cerr <<
+ "\n"
+ ".NAME.\n"
+ "asmQC - computes several mate-pair based statistics on an assembly\n"
+ "\n.USAGE.\n"
+ "asmQC -b[ank] <bank_name>\n"
+ "\n.OPTIONS.\n"
+ "-h, -help print out help message\n"
+ "-b, -bank bank where assembly is stored\n"
+ "-feat write contig features into the bank\n"
+ "-recompute recompute library sizes\n"
+ "-update update bank with recomputed library sizes\n"
+ "-minobs <n> minimum number of good mate-pairs required to recompute\n"
+ " library sizes\n"
+ "-numsd <n> mate-pairs within <n> standard deviations of the mean\n"
+ " library size are considered good. <n> can be fractional\n"
+ "-goodcvg <n> report regions with good mate coverage less than <n>\n"
+ "-shortcvg <n> report regions with short mate coverage greater than <n>\n"
+ "-longcvg <n> report regions with long mate coverage greater than <n>\n"
+ "-samecvg <n> report regions with coverage by mates with same orientation\n"
+ " greater than <n>\n"
+ "-outiecvg <n> report regions with outie coverage greater than <n>\n"
+ "-linking <n> report regions with linking read coverage greater than <n>\n"
+ "-singlemate <n> report regions with singleton mate coverage > than <n>\n"
+ "-meachange <n> libraries whose mean changed by less than <n> will be considered unchanged\n"
+ "-sdchange <n> libraries whose stdev. changed by less than <n> will be considered unchanged\n"
+ "-debug output status for each mate-pair to STDERR\n"
+ "\n.DESCRIPTION.\n"
+ "\n.KEYWORDS.\n"
+ "AMOS bank, Validation, Mate pairs\n"
+ << endl;
+}
+
+bool GetOptions(int argc, char ** argv)
+{
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"minobs", 1, 0, 'm'},
+ {"numsd", 1, 0, 'S'},
+ {"goodcvg", 1, 0, 'g'},
+ {"shortcvg", 1, 0, 's'},
+ {"longcvg", 1, 0, 'l'},
+ {"samecvg", 1, 0, 'n'},
+ {"outiecvg", 1, 0, 'o'},
+ {"linking", 1, 0, 'L'},
+ {"singlemate", 1, 0, 'M'},
+ {"recompute", 0, 0, 'r'},
+ {"update", 0, 0, 'u'},
+ {"feat", 0, 0, 'f'},
+ {"debug", 0, 0, 'd'},
+ {"meachange", 1, 0, 'c'},
+ {"sdchange", 1, 0, 'C'},
+ {0, 0, 0, 0}
+ };
+
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index))!= -
+ 1){
+ switch (c){
+ case 'h':
+ printHelpText();
+ exit(0);
+ break;
+ case 'b':
+ globals["bank"] = string(optarg);
+ break;
+ case 'm':
+ globals["minobs"] = string(optarg);
+ break;
+ case 'S':
+ globals["numsd"] = string(optarg);
+ break;
+ case 'g':
+ globals["goodcvg"] = string(optarg);
+ break;
+ case 's':
+ globals["shortcvg"] = string(optarg);
+ break;
+ case 'l':
+ globals["longcvg"] = string(optarg);
+ break;
+ case 'n':
+ globals["normalcvg"] = string(optarg);
+ break;
+ case 'o':
+ globals["outiecvg"] = string(optarg);
+ break;
+ case 'L':
+ globals["linking"] = string(optarg);
+ break;
+ case 'M':
+ globals["singlemate"] = string(optarg);
+ break;
+ case 'r':
+ globals["recompute"] = string("true");
+ break;
+ case 'u':
+ globals["update"] = string("true");
+ break;
+ case 'f':
+ globals["feat"] = string("true");
+ break;
+ case 'd':
+ globals["debug"] = string("true");
+ break;
+ case 'c':
+ globals["meachange"] = string(optarg);
+ break;
+ case 'C':
+ globals["sdchange"] = string(optarg);
+ break;
+ case '?':
+ return false;
+ }
+ }
+
+ return true;
+} // GetOptions
+
+
+// returns the distance between the reads implied by the ranges within
+// the contig of length Len. Returns 0 if the reads are improperly
+// oriented or if they are too close to the end of the contig (closer than End)
+int mateLen (AnnotatedFragment & m, Range_t & a, Range_t & b, int Len, int End)
+{
+ int oriA;
+ int oriB;
+
+ if (a.getBegin() < a.getEnd())
+ oriA = 1;
+ else
+ oriA = -1;
+
+ if (b.getBegin() < b.getEnd())
+ oriB = 1;
+ else
+ oriB = -1;
+
+ if (oriA == oriB){ // A --> B -->
+ m.status = MP_NORMAL;
+ return 0;
+ }
+
+ if (oriA == 1 && a.getBegin() > b.getBegin()){ // B <-- --> A
+ m.status = MP_OUTIE;
+ return 0;
+ }
+
+ if (oriA == -1 && a.getBegin() < b.getBegin()){ // A <-- --> B
+ m.status = MP_OUTIE;
+ return 0;
+ }
+
+ if (oriA == 1 && (b.getEnd() < a.getBegin() || a.getEnd() > b.getBegin())) {
+ // B <-------
+ // A ------->
+ m.status = MP_OUTIE;
+ return 0;
+ }
+
+ if (oriA == -1 && (a.getEnd() < b.getBegin() || b.getEnd() > a.getBegin())) {
+ // A <-------
+ // B ------->
+ m.status = MP_OUTIE;
+ return 0;
+ }
+
+ // now everything is kosher A --> <-- B or B --> <-- A
+ if ((oriA == 1 && (Len - a.getBegin() < End))||
+ (oriA == -1 && (a.getBegin() < End)) ||
+ (oriB == 1 && (Len - b.getBegin() < End)) ||
+ (oriB == -1 && (b.getBegin() < End))){
+ return 0; // mate-pair too close to end to count
+ }
+
+ return abs(a.getBegin() - b.getBegin());
+}// mateLen
+
+// zscore for the Mann-Whitney test
+float zscore (int nlib, float librank, int cov, float covrank){
+ int na = nlib - cov;
+ int nb = cov;
+
+ float aranksum = librank - covrank;
+ float branksum = covrank;
+
+ float meana = na * (nlib + 1) / 2;
+ float meanb = nb * (nlib + 1) / 2;
+
+ float stdev = sqrt((float)na * nb * (nlib + 1) / 12);
+
+ float zscore = (branksum - meanb > 0) ? (branksum - meanb + 0.5) : (branksum -meanb - 0.5);
+
+ zscore /= stdev;
+
+ return zscore;
+} //zscore
+
+//----------------------------------------------
+int main(int argc, char **argv)
+{
+ if (! GetOptions(argc, argv)){
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ // set up some global variables
+ int MIN_OBS = 100; // min. num. of observations required to change lib size
+ float NUM_SD = 3.00; // num. of standard deviations within which mate is good
+ int MIN_GOOD_CVG = 0; // good mate coverages below this will be reported
+ int MAX_SHORT_CVG = 2; // short mate coverages over this will be reported
+ int MAX_LONG_CVG = 2; // long mate coverages over this will be reported
+ int MAX_NORMAL_CVG = 3; // normal orientation read coverages > will be reptd.
+ int MAX_OUTIE_CVG = 3; // outie orientation read coverages > will be reptd.
+ int MAX_LINKING_CVG = 3; // linking mate coverage > will be reported
+ int MAX_SINGLEMATE_CVG = 3; // single mate coverage > will be reported
+ int MEA_CHANGE = 50;// libraries that change by less are considered unchanged
+ int SD_CHANGE = 10;// libraries that change by less are considered unchanged
+
+ bool recompute = false; // recompute library sizes
+ bool update = false; // update library sizes in bank
+ bool feats = false; // add features to bank
+ bool debug = false; // write debugging info to STDERR
+
+ if (globals.find("debug") != globals.end()){
+ debug = true;
+ cout << "Debugging mode: additional information written to STDERR" << endl;
+ }
+
+ if (globals.find("meanchange") != globals.end())
+ MEA_CHANGE = strtol(globals["meanchange"].c_str(), NULL, 10);
+
+ if (globals.find("sdchange") != globals.end())
+ SD_CHANGE = strtol(globals["sdchange"].c_str(), NULL, 10);
+
+ if (globals.find("recompute") != globals.end()){
+ recompute = true;
+ cout << "Will recompute library sizes" << endl;
+ cout << "Libraries whose mean changes by less than " << MEA_CHANGE
+ << "\nand whose std. dev. changes by less than " << SD_CHANGE
+ << " are considered to not have changed" << endl;
+ } else
+ cout << "Will not recompute library sizes" << endl;
+
+ if (globals.find("update") != globals.end()){
+ update = true;
+ cout << "Will update libraries in bank" << endl;
+ } else
+ cout << "Will not update libraries in bank" << endl;
+
+ if (globals.find("feat") != globals.end()){
+ feats = true;
+ cout << "Will write features in bank" << endl;
+ } else
+ cout << "Will not write features in bank" << endl;
+
+ if (recompute){
+ if (globals.find("minobs") != globals.end())
+ MIN_OBS = strtol(globals["minobs"].c_str(), NULL, 10);
+ cout << "Minimum number of observations required to change library size: "
+ << MIN_OBS << endl;
+ }
+
+ if (globals.find("numsd") != globals.end())
+ NUM_SD = (float)strtod(globals["numsd"].c_str(), NULL);
+ cout << "Mates within " << NUM_SD
+ << " standard deviations from mean considered good" << endl;
+
+ if (globals.find("goodcvg") != globals.end())
+ MIN_GOOD_CVG = strtol(globals["goodcvg"].c_str(), NULL, 10);
+ cout << "Reporting regions with less than " << MIN_GOOD_CVG
+ << " good mate coverage" << endl;
+
+ if (globals.find("shortcvg") != globals.end())
+ MAX_SHORT_CVG = strtol(globals["shortcvg"].c_str(), NULL, 10);
+ cout << "Reporting regions with more than " << MAX_SHORT_CVG
+ << " short mate coverage" << endl;
+
+ if (globals.find("longcvg") != globals.end())
+ MAX_LONG_CVG = strtol(globals["longcvg"].c_str(), NULL, 10);
+ cout << "Reporting regions with more than " << MAX_LONG_CVG
+ << " long mate coverage" << endl;
+
+ if (globals.find("normalcvg") != globals.end())
+ MAX_NORMAL_CVG = strtol(globals["normalcvg"].c_str(), NULL, 10);
+ cout << "Reporting regions with more than " << MAX_NORMAL_CVG
+ << " coverage by mates oriented the same way" << endl;
+
+ if (globals.find("outiecvg") != globals.end())
+ MAX_OUTIE_CVG = strtol(globals["outiecvg"].c_str(), NULL, 10);
+ cout << "Reporting regions with more than " << MAX_OUTIE_CVG
+ << " coverage by outie mates" << endl;
+
+ if (globals.find("outiecvg") != globals.end())
+ MAX_OUTIE_CVG = strtol(globals["outiecvg"].c_str(), NULL, 10);
+ cout << "Reporting regions with more than " << MAX_OUTIE_CVG
+ << " coverage by outie mates" << endl;
+
+ if (globals.find("linking") != globals.end())
+ MAX_LINKING_CVG = strtol(globals["linking"].c_str(), NULL, 10);
+ cout << "Reporting regions with more than " << MAX_LINKING_CVG
+ << " coverage by linking mates" << endl;
+
+ if (globals.find("singlemate") != globals.end())
+ MAX_SINGLEMATE_CVG = strtol(globals["singlemate"].c_str(), NULL, 10);
+ cout << "Reporting regions with more than " << MAX_SINGLEMATE_CVG
+ << " coverage by singleton mates" << endl;
+
+ cout << endl;
+
+ // open necessary files
+ if (globals.find("bank") == globals.end()){ // no bank was specified
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ // prepare banks we'll need
+
+ Bank_t library_bank (Library_t::NCODE);
+ if (! library_bank.exists(globals["bank"])){
+ cerr << "No library account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ if (update)
+ library_bank.open(globals["bank"], B_READ|B_WRITE);
+ else
+ library_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open library account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ Bank_t contig_bank (Contig_t::NCODE);
+ BankStream_t contig_stream (Contig_t::NCODE);
+ if (! contig_bank.exists(globals["bank"])){
+ cerr << "No contig account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ contig_stream.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open contig account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ Bank_t read_bank (Read_t::NCODE);
+ if (! read_bank.exists(globals["bank"])){
+ cerr << "No read account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ read_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open read account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ BankStream_t frag_bank (Fragment_t::NCODE);
+ if (! frag_bank.exists(globals["bank"])){
+ cerr << "No frag account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try {
+ frag_bank.open(globals["bank"], B_READ);
+ } catch (Exception_t & e)
+ {
+ cerr << "Failed to open frag account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+
+ // Stream through the contigs and retrieve map of read positions within ctgs.
+ Contig_t ctg;
+
+ hash_map<ID_t, ID_t, hash<ID_t>, equal_to<ID_t> > rd2ctg; // map from read to contig
+ hash_map<ID_t, Range_t, hash<ID_t>, equal_to<ID_t> > rd2posn; // position in contig
+ hash_map<ID_t, Size_t, hash<ID_t>, equal_to<ID_t> > ctglen; // length of contig
+ hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > ctgname; // name of contig
+
+ set<ID_t> ctgIDs;
+ while (contig_stream >> ctg)
+ for (vector<Tile_t>::iterator ti = ctg.getReadTiling().begin();
+ ti != ctg.getReadTiling().end(); ti++){
+ rd2ctg[ti->source] = ctg.getIID();
+ ctgIDs.insert(ctg.getIID());
+ Pos_t f, l; // coords of beginning/end of read
+ if (ti->range.getEnd() < ti->range.getBegin()) { // reverse
+ f = ti->offset + ti->range.getBegin() - ti->range.getEnd() +
+ ti->gaps.size();
+ l = ti->offset;
+ } else {
+ f = ti->offset;
+ l = ti->offset + ti->range.getEnd() - ti->range.getBegin() +
+ ti->gaps.size();
+ }
+ rd2posn[ti->source] =
+ Range_t(f, l);
+
+ ctglen[ctg.getIID()] = ctg.getLength();
+ ctgname[ctg.getIID()] = ctg.getEID();
+ }
+
+ contig_stream.close();
+
+ AnnotatedFragment frag;
+ pair<ID_t, ID_t> mtp;
+ list<AnnotatedFragment> mtl;
+ Read_t rd1, rd2;
+ set<ID_t> libIDs;
+ hash_map<ID_t, ID_t, hash<ID_t>, equal_to<ID_t> > rd2lib;
+ hash_map<ID_t, ID_t, hash<ID_t>, equal_to<ID_t> > rd2frg;
+ hash_map<ID_t, list<list<AnnotatedFragment>::iterator>, hash<ID_t>, equal_to<ID_t> > lib2frag;
+ hash_map<ID_t, list<list<AnnotatedFragment>::iterator>, hash<ID_t>, equal_to<ID_t> > ctg2frag;
+ hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > rd2name;
+
+ while (frag_bank >> frag){
+ frag.status = MP_GOOD;
+ mtp = frag.getMatePair();
+
+ if (mtp.first != 0)
+ read_bank.fetch(mtp.first, rd1); // get the read
+ if (mtp.second != 0)
+ read_bank.fetch(mtp.second, rd2);
+
+ if (mtp.first == 0 || mtp.second == 0) {
+// if (perinsert)
+// insertFile << "UNMATED: "
+// << ((mtp.first != 0) ? mtp.first : mtp.second)
+// << "(" << ((mtp.first != 0) ? rd1.getEID() : rd2.getEID())
+// << ") " << endl;
+ continue;
+ }
+
+ if (frag.getType() != Fragment_t::INSERT) {// we only handle end reads
+ // cerr << "Type is " << frag.getType() << endl;
+ // if (perinsert)
+// insertFile << "NOT END MATES: "
+// << mtp.first
+// << "(" << rd1.getEID() << ") "
+// << mtp.second
+// << "(" << rd2.getEID() << ") "
+// << "\n";
+ continue;
+ }
+
+
+ rd2name[mtp.first] = rd1.getEID();
+ rd2name[mtp.second] = rd2.getEID();
+ // rd2frg[mtp.first] = frag.getIID();
+ // rd2frg[mtp.second] = frag.getIID();
+ rd2lib[mtp.first] = frag.getLibrary();
+ rd2lib[mtp.second] = frag.getLibrary();
+ libIDs.insert(frag.getLibrary());
+
+ if (frag.getType() != Fragment_t::INSERT) {// we only handle end reads
+ // cerr << "Type is " << frag.getType() << endl;
+ continue;
+ }
+
+ list<AnnotatedFragment>::iterator ti;
+ if (rd2ctg[mtp.first] == rd2ctg[mtp.second]){
+ // mate-pair between reads within the same contig
+
+ // ctgIDs.insert(rd2ctg[mtp.first]);
+ ti = mtl.insert(mtl.end(), frag);
+
+ lib2frag[frag.getLibrary()].push_back(ti);
+ ctg2frag[rd2ctg[mtp.first]].push_back(ti);
+ } else {
+ if (rd2ctg[mtp.first] == 0 ||
+ rd2ctg[mtp.second] == 0) { // mate should be in contig
+ frag.status = MP_SINGMATE;
+ ti = mtl.insert(mtl.end(), frag);
+ lib2frag[frag.getLibrary()].push_back(ti);
+ ctg2frag[rd2ctg[mtp.first]].push_back(ti);
+ } else {
+ frag.status = MP_LINKING;
+ ti = mtl.insert(mtl.end(), frag);
+ lib2frag[frag.getLibrary()].push_back(ti);
+ ctg2frag[rd2ctg[mtp.first]].push_back(ti);
+ }
+ }
+ }
+
+ // now we get the library information for each library
+ hash_map<ID_t, pair<Pos_t, SD_t>, hash<ID_t>, equal_to<ID_t> > lib2size;
+ hash_map<ID_t, string, hash<ID_t>, equal_to<ID_t> > lib2name;
+ hash_map<ID_t, pair<int, float>, hash<ID_t>, equal_to<ID_t> > lib2rank;
+ Library_t lib;
+ for (set<ID_t>::iterator li = libIDs.begin(); li != libIDs.end(); li++){
+ library_bank.fetch(*li, lib);
+ lib2name[*li] = lib.getEID();
+ lib2size[*li] = pair<Pos_t, SD_t> (lib.getDistribution().mean,
+ lib.getDistribution().sd);
+ lib2rank[*li] = pair<int, float>(0, 0.0);
+ }
+
+ // now we're ready to figure out new library sizes
+ hash_map<ID_t, pair<Pos_t, SD_t>, hash<ID_t>, equal_to<ID_t> > NewLib2size;
+
+ for (set<ID_t>::iterator li = libIDs.begin(); li != libIDs.end(); li++){
+ // for each library
+ vector<list<AnnotatedFragment>::iterator> sizes;
+ pair<Pos_t, SD_t> libsize = lib2size[*li];
+
+ for (list<list<AnnotatedFragment>::iterator>::iterator
+ mi = lib2frag[*li].begin(); mi != lib2frag[*li].end(); mi++){
+ if ((*mi)->status != MP_GOOD)
+ continue;
+ // for each mate pair
+ Pos_t sz = mateLen(**mi, rd2posn[(*mi)->getMatePair().first],
+ rd2posn[(*mi)->getMatePair().second],
+ ctglen[rd2ctg[(*mi)->getMatePair().first]],
+ libsize.first + 3 * libsize.second);
+
+ (*mi)->size = sz;
+
+ sizes.push_back(*mi);
+ } // if recomputing library sizes
+
+ // sort mates within library and assign ranks
+ sort(sizes.begin(), sizes.end(), cmpFrag());
+ int lastidx = 0;
+ Pos_t lastsize = sizes[0]->size;
+ float rank;
+ for (int i = 1; i < sizes.size(); i++){
+ if (sizes[i]->size != lastsize){
+ rank = 1.0 * (i + lastidx - 1) / 2.0;
+ for (int j = lastidx; j < i; j++)
+ sizes[j]->rank = rank;
+ lastidx = i;
+ lastsize = sizes[i]->size;
+ }
+ }
+ rank = 1.0 * (sizes.size() + lastidx - 1) / 2.0;
+ for (int j = lastidx; j < sizes.size(); j++)
+ sizes[j]->rank = rank;
+
+ float ranksum = 1.0 * sizes.size() * (sizes.size() + 1) / 2.0;
+ lib2rank[*li] = pair<int, float> (sizes.size(), ranksum);
+ } // for each library
+
+ for (set<ID_t>::iterator ctg = ctgIDs.begin(); ctg != ctgIDs.end(); ctg++) {
+
+ list<pair<Pos_t, Pos_t> > ranges; // ranges we are interested in
+ list<pair<Pos_t, Pos_t> > interest;
+
+ cout << ">Contig_" << *ctg << " " << ctgname[*ctg] << " "
+ << ctglen[*ctg] << " bases" << endl;
+
+ Contig_t newcontig;
+
+ hash_map<ID_t, list<list<AnnotatedFragment>::iterator>, hash<ID_t>, equal_to<ID_t> > byLib;
+
+
+ // Group good mate pairs by library
+ for (list<list<AnnotatedFragment>::iterator>::iterator
+ mi = ctg2frag[*ctg].begin(); mi != ctg2frag[*ctg].end(); mi++){
+
+ if ((*mi)->status == MP_GOOD)
+ byLib[(*mi)->getLibrary()].push_back(*mi);
+ }
+
+
+ // Process them by library
+ for (hash_map<ID_t, list<list<AnnotatedFragment>::iterator>, hash<ID_t>, equal_to<ID_t> >::iterator bl = byLib.begin(); bl != byLib.end(); bl++){
+
+ vector<pair<Pos_t, float> > lefts, rights;
+
+ cout << "#Lib " << bl->first << endl;
+
+ for (list<list<AnnotatedFragment>::iterator>::iterator
+ mi = bl->second.begin(); mi != bl->second.end(); mi++){
+
+ if ((*mi)->status == MP_GOOD){
+ Pos_t left, right;
+ float rank = (*mi)->rank;
+ left = rd2posn[((*mi)->getMatePair()).first].getBegin();
+ right = rd2posn[((*mi)->getMatePair()).second].getBegin();
+
+ if (left < right) {
+ lefts.push_back(pair<Pos_t, float>(left, rank));
+ rights.push_back(pair<Pos_t, float>(right, rank));
+ } else {
+ lefts.push_back(pair<Pos_t, float>(right, rank));
+ rights.push_back(pair<Pos_t, float>(left, rank));
+ }
+ } // if good mate
+ } // for each mate
+ sort(lefts.begin(), lefts.end(), pairCmp());
+ sort(rights.begin(), rights.end(), pairCmp());
+
+ vector<pair<Pos_t, float> >::iterator si, ei;
+
+ si = lefts.begin(); ei = rights.begin();
+ int cvg = 0;
+ Pos_t s = 0, e = ctglen[*ctg];
+ float ranksum = 0;
+ float lastbadZ = 0.0;
+ bool inbad = false;
+
+ while (si != lefts.end() && ei != rights.end()){
+ if (si->first <= ei->first){
+ // beginning of interval
+ cvg++;
+ ranksum += si->second;
+ if (cvg > 5){ // below 5 it doesn't make sense
+ float z = zscore(lib2rank[bl->first].first,
+ lib2rank[bl->first].second, cvg, ranksum);
+ if (fabs(z) >= 2){
+ if (! inbad){
+ s = si->first;
+ inbad = true;
+ lastbadZ = z;
+ } else {
+ if (fabs(z) > fabs(lastbadZ)){
+ lastbadZ = z;
+ }
+ }
+ } else if (fabs(z) < 2 && inbad){
+ cout << s << " BAD Z=" << lastbadZ << " " << si->first << endl;
+ inbad = false;
+ }
+ } else if (inbad){
+ cout << s << " BAD Z=" << lastbadZ << " " << si->first << endl;
+ inbad = false;
+ }
+ si++;
+ } else {
+ // end of interval
+ cvg--;
+ ranksum -= ei->second;
+ if (cvg > 5) {
+ float z = zscore(lib2rank[bl->first].first,
+ lib2rank[bl->first].second, cvg, ranksum);
+ if (fabs(z) >= 2){
+ if (! inbad){
+ s = ei->first;
+ lastbadZ = z;
+ inbad = true;
+ } else {
+ if (fabs(z) > fabs(lastbadZ)){
+ lastbadZ = z;
+ }
+ }
+ } else if (fabs(z) < 2 && inbad){
+ cout << s << " BAD Z=" << lastbadZ << " " << ei->first << endl;
+ inbad = false;
+ }
+ } else if (inbad) {
+ cout << s << " BAD Z=" << lastbadZ << " " << ei->first << endl;
+ inbad = false;
+ }
+ ei++;
+ }
+ }
+
+ assert(si == lefts.end());
+
+ while (ei != rights.end()){
+ cvg--;
+ ranksum -= ei->second;
+ if (cvg > 5) {
+ float z = zscore(lib2rank[bl->first].first,
+ lib2rank[bl->first].second, cvg, ranksum);
+ if (fabs(z) >= 2){
+ if (! inbad){
+ s = ei->first;
+ inbad = true;
+ lastbadZ = z;
+ } else {
+ if (fabs(z) > fabs(lastbadZ)){
+ lastbadZ = z;
+ }
+ }
+ } else if (fabs(z) < 2 && inbad){
+ cout << s << " BAD Z=" << lastbadZ << " " << ei->first << endl;
+ inbad = false;
+ }
+ } else if (inbad) {
+ cout << s << " BAD Z=" << lastbadZ << " " << ei->first << endl;
+ inbad = false;
+ }
+
+ ei++;
+ }
+ // } // for each mate in library in contig
+ } // for each library in contig
+ } // for each contig
+
+ frag_bank.close();
+ read_bank.close();
+ library_bank.close();
+
+ return(0);
+} // main
+
diff --git a/src/Validation/astats.cc b/src/Validation/astats.cc
new file mode 100644
index 0000000..e79b81c
--- /dev/null
+++ b/src/Validation/astats.cc
@@ -0,0 +1,383 @@
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <cassert>
+#include <unistd.h>
+#include <map>
+#include <cmath>
+
+#include "DataStore.hh"
+#include "Insert.hh"
+#include "InsertStats.hh"
+#include <stdio.h>
+#include "amp.hh"
+
+using namespace std;
+using namespace AMOS;
+DataStore * m_datastore;
+
+
+
+//=============================================================== Globals ====//
+string OPT_BankName; // bank name parameter
+bool OPT_BankSpy = false; // read or read-only spy
+bool OPT_Verbose = false;
+
+void ParseArgs (int argc, char ** argv);
+void PrintHelp (const char * s);
+void PrintUsage (const char * s);
+
+
+string tableString;
+
+#define DIV(a,b) (b?(double(a)/b):0.0)
+
+
+static void statsAddRow(string tag, string value)
+{
+ tableString += "<tr><td>" + tag + "</td><td>" + value + "</td></tr>\n";
+}
+
+static void statsAddHeader(string header)
+{
+ string s = "<b>" + header + "</b>";
+ statsAddRow(s, " ");
+}
+
+
+static void statsAddRow(string tag, int value)
+{
+ char buffer[1024];
+ sprintf(buffer, "%d", value);
+ statsAddRow(tag, buffer);
+}
+
+static void statsAddRow(string tag, double value)
+{
+ char buffer[1024];
+ sprintf(buffer, "%.02f", value);
+ statsAddRow(tag, buffer);
+}
+
+
+
+void computeStatistics()
+{
+ EventTime_t timer;
+ if (OPT_Verbose) { cerr << "Loading AssemblyStats..."; }
+
+ tableString = "<html>\n<head></head>\n<body><table>\n";
+
+ if (m_datastore->scaffold_bank.isOpen())
+ {
+ vector<int> bases;
+ vector<int> spans;
+ vector<int> contigs;
+ int totalcontigs = 0;
+ int totalbases = 0;
+ int totalspan = 0;
+ int numscaffolds = 0;
+
+ int largescaffolds = 0;
+ int largescaffoldspan = 0;
+ int largescaffoldThreshold = 2000;
+
+ AMOS::Scaffold_t scf;
+
+ m_datastore->scaffold_bank.seekg(1);
+ while (m_datastore->scaffold_bank >> scf)
+ {
+ int s = scf.getSpan();
+ int b = 0;
+ vector<Tile_t>::const_iterator ci;
+ const vector<Tile_t> & ctiling = scf.getContigTiling();
+ for (ci = ctiling.begin();
+ ci != ctiling.end();
+ ci++)
+ {
+ b+=ci->getGappedLength();
+ }
+
+ totalcontigs += ctiling.size();
+ totalbases += b;
+ totalspan += s;
+
+ contigs.push_back(ctiling.size());
+ spans.push_back(s);
+ bases.push_back(b);
+
+ numscaffolds++;
+
+ if (s >= largescaffoldThreshold)
+ {
+ largescaffolds++;
+ largescaffoldspan += s;
+ }
+ }
+
+ sort(contigs.begin(), contigs.end(), less<int>());
+ sort(bases.begin(), bases.end(), less<int>());
+ sort(spans.begin(), spans.end(), less<int>());
+
+ int n50bases = 0;
+
+ int basesthreshold = totalbases/2;
+ int curbases = 0;
+
+ for (n50bases = numscaffolds-1; n50bases >= 0; n50bases--)
+ {
+ curbases += bases[n50bases];
+ if (curbases >= basesthreshold)
+ {
+ break;
+ }
+ }
+
+
+ statsAddHeader("[Scaffolds]");
+ statsAddRow("TotalScaffolds", numscaffolds);
+ statsAddRow("TotalContigsInScaffolds", totalcontigs);
+ statsAddRow("MeanContigsPerScaffold", DIV(totalcontigs, numscaffolds));
+ statsAddRow("MinContigsPerScaffold", contigs[0]);
+ statsAddRow("MaxContigsPerScaffold", contigs[contigs.size()-1]);
+ statsAddRow(" ", " ");
+
+ statsAddRow("TotalBasesInScaffolds", totalbases);
+ statsAddRow("MeanBasesInScaffolds", DIV(totalbases, numscaffolds));
+ statsAddRow("MaxBasesInScaffolds", bases[numscaffolds-1]);
+ statsAddRow("N50ScaffoldBases", bases[n50bases]);
+ statsAddRow(" ", " ");
+
+
+ statsAddRow("TotalSpanOfScaffolds", totalspan);
+ statsAddRow("MeanSpanOfScaffolds", DIV(totalspan, numscaffolds));
+ statsAddRow("MinScaffoldSpan", spans[0]);
+ statsAddRow("MaxScaffoldSpan", spans[numscaffolds-1]);
+ statsAddRow("IntraScaffoldGaps", totalcontigs - numscaffolds);
+ statsAddRow("2KbScaffolds", largescaffolds);
+ statsAddRow("2KbScaffoldSpan", largescaffoldspan);
+ statsAddRow("2KbScaffoldPercent", DIV(largescaffoldspan, totalspan) * 100.0);
+ statsAddRow("MeanSequenceGapSize", DIV(totalspan-totalbases, totalcontigs-numscaffolds));
+ statsAddRow(" ", " ");
+ }
+
+ int LARGETHRESHOLD = 10000;
+
+ if (m_datastore->contig_bank.isOpen())
+ {
+ AMOS::Contig_t ctg;
+ vector<int> sizes;
+ vector<int> largesizes;
+ vector<int> smallsizes;
+ int totalsize = 0;
+ int totalreads = 0;
+
+ int largecount = 0;
+ int largesize = 0;
+ int largereads = 0;
+
+ int smallcount = 0;
+ int smallsize = 0;
+ int smallreads = 0;
+
+
+ m_datastore->contig_bank.seekg(1);
+ m_datastore->contig_bank.setFixedStoreOnly(true);
+ while (m_datastore->contig_bank >> ctg)
+ {
+ int l = ctg.getLength();
+ int r = ctg.getReadTiling().size();
+
+ sizes.push_back(l);
+ totalsize += l;
+ totalreads += r;
+
+ if (l >= LARGETHRESHOLD)
+ {
+ largecount++;
+ largesize += l;
+ largereads += r;
+ }
+ else
+ {
+ smallcount++;
+ smallsize += l;
+ smallreads += r;
+ }
+ }
+ m_datastore->contig_bank.setFixedStoreOnly(false);
+
+ sort(sizes.begin( ), sizes.end( ), less<int>( ) );
+
+ int thresh = totalsize / 2;
+ int cum = 0;
+ int n50 = 0;
+
+ int maxlarge = 0;
+ int minlarge = 0;
+ int maxsmall = 0;
+ int minsmall = 0;
+
+ for (int i = sizes.size()-1; i >= 0; i--)
+ {
+ int cur = sizes[i];
+ cum += cur;
+
+ if (!n50 && cum >= thresh) { n50 = i; }
+
+ if (cur >= LARGETHRESHOLD)
+ {
+ if (maxlarge == 0){maxlarge = cur;}
+ minlarge = cur;
+ }
+ else
+ {
+ if (maxsmall == 0){maxsmall = cur;}
+ minsmall = cur;
+ }
+ }
+
+
+ // Contigs
+
+ statsAddHeader("[Contigs]");
+ statsAddRow("TotalContigs", (int)m_datastore->contig_bank.getSize());
+ statsAddRow("TotalBasesInContigs", totalsize);
+ statsAddRow("MeanContigSize", DIV(totalsize, sizes.size()));
+ statsAddRow("MinContigSize", sizes[0]);
+ statsAddRow("MaxContigSize", sizes[sizes.size()-1]);
+ statsAddRow("N50ContigBases", sizes[n50]);
+ statsAddRow(" ", " ");
+
+ // Big Contigs
+ char buffer[1024];
+ sprintf(buffer, "%d", LARGETHRESHOLD);
+ statsAddHeader(string("[BigContigs_greater_") + buffer + "]");
+ statsAddRow("TotalBigContigs", largecount);
+ statsAddRow("BigContigLength", largesize);
+ statsAddRow("MeanBigContigSize", DIV(largesize,largecount));
+ statsAddRow("MinBigContig", minlarge);
+ statsAddRow("MaxBigContig", maxlarge);
+ statsAddRow("BigContigsPercentBases", DIV(largesize,totalsize)*100.0);
+ statsAddRow(" ", " ");
+
+ // Small Contigs
+ statsAddHeader("[SmallContigs]");
+ statsAddRow("TotalSmallContigs", smallcount);
+ statsAddRow("SmallContigLength", smallsize);
+ statsAddRow("MeanSmallContigSize", DIV(smallsize, smallcount));
+ statsAddRow("MinSmallContig", minsmall);
+ statsAddRow("MaxSmallContig", maxsmall);
+ statsAddRow("SmallContigsPercentBases", DIV(smallsize,totalsize)*100.0);
+ statsAddRow(" ", " ");
+
+
+ // Reads
+ statsAddHeader("[Reads]");
+ statsAddRow("TotalReads", (int)m_datastore->read_bank.getSize());
+ statsAddRow("ReadsInContigs", totalreads);
+ statsAddRow("BigContigReads", largereads);
+ statsAddRow("SmallContigReads", smallreads);
+ statsAddRow("SingletonReads", (int) m_datastore->read_bank.getSize() - totalreads);
+ }
+
+ tableString += "</table>\n";
+
+ if (OPT_Verbose) { cerr << timer.str() << endl; }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+
+
+ Scaffold_t scaff;
+ Contig_t contig;
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try
+ {
+
+ m_datastore = new DataStore();
+ m_datastore->openBank(OPT_BankName);
+
+ computeStatistics();
+ cout << tableString << endl;
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hsvf:")) != EOF) )
+ switch (ch)
+ {
+ case 'h': PrintHelp (argv[0]); exit (EXIT_SUCCESS); break;
+
+ default:
+ errflg ++;
+ }
+
+ if (errflg > 0 || optind != argc - 1)
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+ OPT_BankName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "-h Display help information\n"
+ << endl;
+ cerr
+ << "Compute statistics on an assembly stored in a bank\n";
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr
+ << "\nUSAGE: " << s << " [options] <bank path>\n\n";
+ return;
+}
diff --git a/src/Validation/cavalidate.acf b/src/Validation/cavalidate.acf
new file mode 100755
index 0000000..fa4900d
--- /dev/null
+++ b/src/Validation/cavalidate.acf
@@ -0,0 +1,38 @@
+## Convert a CA assembly to AMOS, run validation steps
+
+INPUTS = $(PREFIX).asm $(PREFIX).frg
+BINDIR=/fs/sz-user-supported/Linux-i686/bin
+
+## toAmos & bank-transact
+10: $(BINDIR)/toAmos -f $(PREFIX).frg -a $(PREFIX).asm -o - -S | $(BINDIR)/bank-transact -m - -b $(PREFIX).bnk -c
+
+## asmQC
+30: $(BINDIR)/asmQC -b $(PREFIX).bnk -feat -numsd 2
+
+## analyzeSNPs
+40: $(BINDIR)/analyzeSNPs -b $(PREFIX).bnk -S -cumqv 40 -minsnps 2 -r -e -H > $(PREFIX).snps
+
+## ClusterSnps
+50: $(BINDIR)/clusterSnps $(PREFIX).snps > $(PREFIX).snp.feat
+
+## Load SNP Features
+80: $(BINDIR)/loadFeatures $(PREFIX).bnk $(PREFIX).snp.feat
+
+## Find Surrogates
+90: $(BINDIR)/listSurrogates $(PREFIX).asm > $(PREFIX).surrogate.feat
+
+## Load Surrogates
+100: $(BINDIR)/loadFeatures $(PREFIX).bnk $(PREFIX).surrogate.feat
+
+## Find High Read Coveage
+110: $(BINDIR)/analyze-read-depth $(PREFIX).bnk -c 1000 -x 3 > $(PREFIX).depth.feat
+
+## Load Coverage Features
+120: $(BINDIR)/loadFeatures $(PREFIX).bnk $(PREFIX).depth.feat
+
+## Combine Features
+1000: $(BINDIR)/dumpFeatures $(PREFIX).bnk | sort -k1 -nk3 > $(PREFIX).all.feat
+1010: $(BINDIR)/suspiciousfeat2region $(PREFIX).all.feat > $(PREFIX).suspicious.regions
+
+## Create Fasta
+1100: $(BINDIR)/bank2fasta -e -b $(PREFIX).bnk > $(PREFIX).fasta
diff --git a/src/Validation/cestat-cov.cc b/src/Validation/cestat-cov.cc
new file mode 100644
index 0000000..b158608
--- /dev/null
+++ b/src/Validation/cestat-cov.cc
@@ -0,0 +1,368 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Michael Schatz
+//! \date 2011.07.29
+//!
+//! \brief Compute the ce stat along an assembly
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include <cmath>
+#include <iostream>
+#include <cassert>
+#include <sstream>
+#include <unistd.h>
+#include <map>
+#include <iomanip>
+#include "Feature_AMOS.hh"
+
+#include "DataStore.hh"
+#include "Insert.hh"
+#include "CoverageStats.hh"
+
+using namespace std;
+using namespace AMOS;
+
+typedef HASHMAP::hash_map<ID_t, Tile_t *> SeqTileMap_t;
+
+//=============================================================== Globals ====//
+string OPT_BankName; // bank name parameter
+bool OPT_BankSpy = false; // read or read-only spy
+double OPT_Features = 0.0;
+bool OPT_IIDs = false;
+bool OPT_SCAFFOLD = false;
+int OPT_MIN_LEN = 100;
+bool OPT_BAM = false;
+string CMD_SAMTOOLS = "samtools";
+
+DataStore * m_datastore;
+int m_connectMates = 1;
+typedef std::vector<Insert *> InsertList_t;
+InsertList_t m_inserts;
+
+
+int m_coveragePlot = 0;
+int m_cestats = 1;
+
+void printCEStats(const std::string &id)
+{
+ typedef map<ID_t, CoverageStats> LibStats;
+ LibStats::iterator li;
+
+ LibStats libStats = m_datastore->computeCEStats(m_inserts);
+
+ if ( OPT_Features )
+ {
+ double b = 0;
+ double e = 0;
+ double sign;
+
+ for (li = libStats.begin(); li != libStats.end(); li++)
+ {
+ // This are stored as oldvalue newvalue so skip every other one
+ for (int i = 1; i < li->second.m_curpos; i+=2)
+ {
+ if ( b )
+ if ( li->second.m_cestat[i] * sign < 0 ||
+ fabs(li->second.m_cestat[i]) < OPT_Features )
+ {
+ if (e-b >= OPT_MIN_LEN)
+ {
+ cout << id << " " << Feature_t::MATEPAIR << " " << b << " "
+ << li->second.m_coverage[i].x() << " ";
+ if ( sign < 0 )
+ cout << "CE_COMPRESS ";
+ else
+ cout << "CE_STRETCH ";
+ cout << "LIB=" << li->first << endl;
+ }
+
+ b = e = 0;
+ }
+
+ if ( fabs(li->second.m_cestat[i]) >= OPT_Features )
+ {
+ if ( b )
+ e = li->second.m_coverage[i].x();
+ else
+ {
+ b = e = li->second.m_coverage[i].x();
+ sign = li->second.m_cestat[i];
+ }
+ }
+ }
+
+ if ( b && e )
+ {
+ if (e-b >= OPT_MIN_LEN)
+ {
+ cout << id << " " << Feature_t::MATEPAIR << " " << b << " " << e << " ";
+ if ( sign < 0 )
+ cout << "CE_COMPRESS ";
+ else
+ cout << "CE_STRETCH ";
+ cout << "LIB=" << li->first << endl;
+ }
+ b = e = 0;
+ }
+ }
+ }
+ else
+ {
+ for (li = libStats.begin(); li != libStats.end(); li++)
+ {
+ cout << ">" << id << " lib:" << li->first << endl;
+ // This are stored as oldvalue newvalue so skip every other one
+ for (int i = 1; i < li->second.m_curpos; i+=2)
+ {
+ cout << setprecision(10) << li->second.m_coverage[i].x() << " "
+ << setprecision(6) << li->second.m_cestat[i] << endl;
+ }
+ }
+ }
+
+ vector<Insert *>::iterator i;
+
+ for (i = m_inserts.begin();
+ i != m_inserts.end();
+ i++)
+ {
+ delete (*i);
+ }
+
+ m_inserts.clear();
+}
+
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+ Read_t red;
+ Fragment_t frg;
+ Library_t lib;
+
+
+ Scaffold_t scaff;
+ Contig_t contig;
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ if (OPT_BAM)
+ {
+ cerr << "processing bam: " << OPT_BankName << endl;
+
+ string cmd = CMD_SAMTOOLS;
+ cmd += " view -h ";
+ cmd += OPT_BankName;
+
+ cerr << "cmd: " << cmd << endl;
+
+ FILE * bam = popen(cmd.c_str(), "r");
+
+ if (!bam)
+ {
+ cerr << "ERROR: Couldn't exec: " << cmd << endl;
+ exit(1);
+ }
+
+ char buffer[10*1024];
+
+ while (fgets(buffer, sizeof(buffer), bam))
+ {
+ fprintf(stdout, "%s", buffer);
+ }
+
+ pclose(bam);
+ }
+ else
+ {
+ m_datastore = new DataStore();
+ m_datastore->openBank(OPT_BankName);
+
+ if ( OPT_SCAFFOLD && m_datastore->scaffold_bank.isOpen() )
+ {
+ cerr << "Processing scaffolds... ";
+ int scaffcount = 0;
+ m_datastore->scaffold_bank.seekg(1);
+ while (m_datastore->scaffold_bank >> scaff)
+ {
+ scaffcount++;
+ vector <Tile_t> rtiling;
+
+ m_datastore->mapReadsToScaffold(scaff, rtiling, 1);
+ m_datastore->calculateInserts(rtiling, m_inserts, m_connectMates, 1);
+
+ if ( OPT_IIDs )
+ {
+ stringstream oss;
+ oss << scaff.getIID();
+ printCEStats(oss.str());
+ }
+ else
+ printCEStats(scaff.getEID());
+
+ }
+ }
+ else if ( m_datastore->contig_bank.isOpen() )
+ {
+ cerr << "Processing contigs... ";
+ int contigcount = 0;
+ m_datastore->contig_bank.seekg(1);
+ while (m_datastore->contig_bank >> contig)
+ {
+ contigcount++;
+
+ m_datastore->calculateInserts(contig.getReadTiling(), m_inserts, m_connectMates, 1);
+
+ if ( OPT_IIDs )
+ {
+ stringstream oss;
+ oss << contig.getIID();
+ printCEStats(oss.str());
+ }
+ else
+ printCEStats(contig.getEID());
+ }
+ }
+ }
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hif:svSl:B")) != EOF) )
+ switch (ch)
+ {
+ case 'h':
+ PrintHelp (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case 'B':
+ OPT_BAM = true;
+ break;
+
+ case 'i':
+ OPT_IIDs = true;
+ break;
+
+ case 'S':
+ OPT_SCAFFOLD = true;
+ break;
+
+ case 'f':
+ OPT_Features = atof(optarg);
+ break;
+
+ case 'l':
+ OPT_MIN_LEN = atoi(optarg);
+ break;
+
+ case 's':
+ OPT_BankSpy = true;
+ break;
+
+ case 'v':
+ PrintBankVersion (argv[0]);
+ exit (EXIT_SUCCESS);
+ break;
+
+
+ default:
+ errflg ++;
+ }
+
+ if (errflg > 0 || optind != argc - 1)
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+
+ OPT_BankName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "Print the compression-expansion (CE) statistic value at the beginning and end \n"
+ << "of each insert across each contig separated by library. If scaffold data is \n"
+ << "available and -S is specifed, compute along scaffolds.\n"
+ << "\n"
+ << "-h Display help information\n"
+ << "-B The input is a BAM file, not an AMOS bank\n"
+ << "-i Dump scaffold/contig IIDs instead of EIDs\n"
+ << "-f float Only output CE features outside float deviations\n"
+ << "-l len Only output features at least this length (default: " << OPT_MIN_LEN << ")\n"
+ << "-s Disregard bank locks and write permissions (spy mode)\n"
+ << "-S Consider scaffolds instead of contigs\n"
+ << "-v Display the compatible bank version\n"
+ << endl;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr
+ << "\nUSAGE: " << s << " [options] <bank path>\n\n";
+ return;
+}
diff --git a/src/Validation/clusterSnps.pl b/src/Validation/clusterSnps.pl
new file mode 100755
index 0000000..0a8d39c
--- /dev/null
+++ b/src/Validation/clusterSnps.pl
@@ -0,0 +1,112 @@
+#!/usr/bin/perl -w
+use strict;
+
+## Scan the snp report and cluster the snps. A cluster is based on the SNPs
+## within a window- there must be $WINDOWSNPS snps within $WINDOWSIZE bp
+## for the window to be active. The resulting feature is the maximal range
+## where there is a window of sufficient badness
+
+## Minimum number of correlated conflicting reads to be considered a true SNP
+my $MINCORRELATED = 2;
+
+## Number of SNPs in a window to declare a feature
+my $WINDOWSNPS = 2;
+
+## Size of the window to seed a feature
+my $WINDOWSIZE = 500;
+
+## Size of fringe of window to consider
+my $WINDOWFRINGE = 1000;
+
+
+my @windowsnps;
+my @featuresnps;
+my $contigid = undef;
+
+my $lastsnppos;
+my $firstsnppos;
+my $snpcount = 0;
+
+sub printResults
+{
+ if ($snpcount)
+ {
+ my $span = $lastsnppos - $firstsnppos + 1;
+ my $dist = ($snpcount > 1) ? sprintf("%.02f", $span / ($snpcount-1)) : "1.00";
+
+ print "$contigid P $firstsnppos $lastsnppos HIGH_SNP $snpcount $dist\n";
+ }
+}
+
+while (<>)
+{
+ next if /^AmblID/;
+
+ chomp;
+ my @vals = split /\s+/, $_;
+
+ if (!defined $contigid || $contigid ne $vals[0])
+ {
+ printResults();
+
+ @windowsnps = ();
+ @featuresnps = ();
+ $lastsnppos = undef;
+ $snpcount = 0;
+
+ $contigid = $vals[0];
+ }
+
+ my $curpos = $vals[1];
+ my $cursnps = $vals[5];
+
+ next if $cursnps < $MINCORRELATED;
+
+ ## Check if last feature is now definitely dead
+ if ($snpcount && ($curpos - $lastsnppos > $WINDOWFRINGE))
+ {
+ printResults();
+
+ @windowsnps = ();
+ @featuresnps = ();
+ $lastsnppos = undef;
+ $snpcount = 0;
+ }
+
+ ## find snps that are within WINDOWSIZE of current position
+ @windowsnps = grep {($curpos - $_) < $WINDOWSIZE} @windowsnps;
+ push @windowsnps, $curpos;
+ push @featuresnps, $curpos;
+
+ my $windowcount = scalar @windowsnps;
+
+ if ($snpcount == 0)
+ {
+ ## If this cluster has sufficient number of snps
+ ## This window seeds the cluster
+ if ($windowcount >= $WINDOWSNPS)
+ {
+ my $first = $windowsnps[0];
+
+ ## Get the leftmost position that is within the fringe
+ for (my $i = scalar @featuresnps - 1; $i >= 0; $i--)
+ {
+ if ($first - $featuresnps[$i] <= $WINDOWFRINGE)
+ {
+ $firstsnppos = $featuresnps[$i];
+ $snpcount++;
+ }
+ }
+ }
+ }
+ else
+ {
+ $snpcount++;
+ }
+
+ $lastsnppos = $curpos;
+}
+
+printResults();
+
+exit 0;
diff --git a/src/Validation/coords2cam.pl b/src/Validation/coords2cam.pl
new file mode 100755
index 0000000..07ee0aa
--- /dev/null
+++ b/src/Validation/coords2cam.pl
@@ -0,0 +1,197 @@
+#!/usr/local/bin/perl
+# coords2cam.pl - creates a celamy file from NUCmer .coords output
+
+use strict;
+
+my $MINPERC = 30;
+my $SEP = 500;
+
+my @alignments;
+my %query;
+my %ref;
+
+my $HEAD =
+q~0refColor: CFF0000 T2 S # reference
+0queryHangColor: C008000 T2 S # hang
+0queryHitColor: C00FF00 T2 S # hit
+~;
+
+my $REFCOLOR = "A0refColor";
+my $QUERYHANGCOLOR = "A0queryHangColor";
+my $QUERYHITCOLOR = "A0queryHitColor";
+
+
+print STDERR "reading input...\n";
+
+while (<>){
+ chomp;
+ my @fields = split('\t');
+
+ @{$alignments[++$#alignments]} = @fields;
+
+ ${$query{$fields[12]}}[++$#{$query{$fields[12]}}] = $#alignments;
+}
+
+print STDERR "done\n";
+
+print STDERR "processing queries...\n";
+
+while (my ($qid, $aligns) = each %query){
+
+# print STDERR "checking $qid: ", $#$aligns + 1, "\n";
+
+ my @chosen;
+ my @hits = sort {$alignments[$b][10] <=> $alignments[$a][10]} @{$aligns};
+
+# print STDERR "starting with ", $#hits + 1, " hits\n";
+ # here we keep those alignments that do not overlap each other.
+ for (my $h = 0; $h <= $#hits; $h++){
+ my $clean = 1;
+ if ($alignments[$hits[$h]][10] <= $MINPERC) {
+# only check the "short" hits
+ for (my $c = 0; $c <= $#chosen; $c++){
+ if (ovl($chosen[$c], $hits[$h], "query")){
+ $clean = 0;
+ last;
+ }
+ }
+ }
+ if ($clean) { # no overlap detected
+ push(@chosen, $hits[$h]); # add to the chosen overlaps
+ my $rname = $alignments[$hits[$h]][11];
+ ${$ref{$rname}}[++$#{$ref{$rname}}] = $hits[$h];
+ }
+ }
+# print STDERR "ending with ", $#chosen + 1, " hits\n";
+
+ if ($#chosen > 0) { # check if query bridges two references
+
+
+ }
+
+ @{$query{$qid}} = @chosen;
+} # while each query
+
+print STDERR "done\n";
+
+print STDERR "processing references...\n";
+
+print "$HEAD";
+
+my $offset = 0;
+my $id = 0;
+
+foreach my $rid (sort {$alignments[${$ref{$b}}[0]][7] <=> $alignments[${$ref{$a}}[0]][7] } (keys %ref)) {
+ my $aligns = $ref{$rid};
+# print STDERR "$rid $alignments[${$ref{$rid}}[0]][7]\n";
+# do reference hits in order of their coordinate
+ my @hits = sort {$alignments[$a][0] <=> $alignments[$b][0]} @{$aligns};
+
+ my @queries = ();
+ my $minx;
+ my $maxx;
+
+ for (my $h = 0; $h <= $#hits; $h++){
+ my $rl = $alignments[$hits[$h]][0];
+ my $rr = $alignments[$hits[$h]][1];
+ my $ql = $alignments[$hits[$h]][2];
+ my $qr = $alignments[$hits[$h]][3];
+ my $qlen = $alignments[$hits[$h]][8];
+
+ $#queries++;
+
+ if ($ql > $qr) { #sequence is reversed
+ $queries[$#queries][0] = $rl - $qlen + $ql;
+ $queries[$#queries][1] = $rl;
+ $queries[$#queries][2] = $rr;
+ $queries[$#queries][3] = $rr + $qr;
+ } else {
+ $queries[$#queries][0] = $rl - $ql;
+ $queries[$#queries][1] = $rl;
+ $queries[$#queries][2] = $rr;
+ $queries[$#queries][3] = $rr + $qlen - $qr;
+ }
+ $queries[$#queries][4] = $alignments[$hits[$h]][12];
+
+ if (! defined $minx || $minx > $queries[$#queries][0]){
+ $minx = $queries[$#queries][0];
+ }
+ if (! defined $maxx || $maxx < $queries[$#queries][3]){
+ $maxx = $queries[$#queries][3];
+ }
+ } # for each hit
+
+ if ($minx < 0) {
+ $offset -= $minx;
+ }
+
+ if ($maxx < $alignments[$hits[0]][7]){
+ $maxx = $alignments[$hits[0]][7];
+ }
+
+ $id++;
+ print "${id}ref: $offset $REFCOLOR ", $offset + $alignments[$hits[0]][7],
+ "R1 # $alignments[$hits[0]][11]\n";
+ for (my $q = 0; $q <= $#queries; $q++){
+ $id++;
+ print "${id}query: ", $offset + $queries[$q][0], " $QUERYHANGCOLOR ",
+ $offset + $queries[$q][1], " $QUERYHITCOLOR ", $offset + $queries[$q][2],
+ " $QUERYHANGCOLOR ", $offset + $queries[$q][3], " R2 # $queries[$q][4]\n";
+ }
+
+ $offset += $maxx + $SEP;
+
+} # while each reference
+
+print STDERR "done\n";
+
+
+exit(0);
+
+# this figures out if two alignment ranges overlap
+sub ovl
+{
+ my $aid = shift;
+ my $bid = shift;
+ my $where = shift;
+
+ my $L;
+ my $R;
+
+ if ($where eq "ref"){
+ $L = 0;
+ $R = 1;
+ } elsif ($where eq "query"){
+ $L = 2;
+ $R = 3;
+ } else {
+ die ("Don't know where: $where\n");
+ }
+
+ my $al = ($alignments[$aid][$L] < $alignments[$aid][$R])
+ ? $alignments[$aid][$L]
+ : $alignments[$aid][$R];
+
+ my $ar = ($alignments[$aid][$L] < $alignments[$aid][$R])
+ ? $alignments[$aid][$R]
+ : $alignments[$aid][$L];
+
+ my $bl = ($alignments[$bid][$L] < $alignments[$bid][$R])
+ ? $alignments[$bid][$L]
+ : $alignments[$bid][$R];
+
+ my $br = ($alignments[$bid][$L] < $alignments[$bid][$R])
+ ? $alignments[$bid][$R]
+ : $alignments[$bid][$L];
+
+# print STDERR "checking $al, $ar vs $bl, $br ";
+
+ if ($al < $br && $bl < $ar) {
+# print STDERR "nogo\n";
+ return 1;
+ } else {
+# print STDERR "go\n";
+ return 0;
+ }
+
+} # sub ovl
diff --git a/src/Validation/find-duplicate-reads.cc b/src/Validation/find-duplicate-reads.cc
new file mode 100644
index 0000000..66a5743
--- /dev/null
+++ b/src/Validation/find-duplicate-reads.cc
@@ -0,0 +1,144 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+
+using namespace AMOS;
+using namespace std;
+
+
+
+long hashstring(const string & s)
+{
+ long retval = 0;
+ int len = s.length();
+
+ for (int i = 0; i < len; i++)
+ {
+ int j;
+ switch (toupper(s[i]))
+ {
+ case 'C': j = 1; break;
+ case 'T': j = 2; break;
+ case 'G': j = 3; break;
+ default: j = 0; break;
+ };
+
+ retval += j << ((i * 2) % 63);
+ }
+
+ return retval;
+}
+
+
+
+int main(int argc, char ** argv)
+{
+ if (argc != 2)
+ {
+ cerr << "Usage: find-duplicate-reads bankname" << endl;
+ return EXIT_FAILURE;
+ }
+
+ Bank_t red_bank(Read_t::NCODE);
+ string bank_name = argv[1];
+
+ int verbose = 0;
+
+ cerr << "Processing " << bank_name << " at " << Date() << endl;
+
+
+ try
+ {
+ red_bank.open(bank_name, B_READ);
+
+ multimap<long, ID_t> hash2read;
+
+ const IDMap_t & readmap = red_bank.getIDMap();
+ IDMap_t::const_iterator r;
+
+ int count = 0;
+ for (r = readmap.begin(); r!= readmap.end(); r++)
+ {
+ Read_t red;
+ red_bank.fetch(r->iid, red);
+
+ string seq = red.getSeqString();
+ long hash = hashstring(seq);
+
+ hash2read.insert(make_pair(hash, r->iid));
+ count++;
+ }
+
+ cerr << "Loaded " << count << " reads." << endl;
+
+ count = 0;
+
+
+ multimap<long, ID_t>::const_iterator h1;
+ multimap<long, ID_t>::const_iterator h2;
+
+ for (h1 = hash2read.begin(); h1 != hash2read.end(); h1++)
+ {
+ Read_t r1;
+ red_bank.fetch(h1->second, r1);
+ string seq1 = r1.getSeqString();
+
+ int l = seq1.length();
+
+ int dups = 0;
+
+ h2 = h1;
+ h2++;
+ for (; ((h2 != hash2read.end()) && (h1->first == h2->first)); h2++)
+ {
+ Read_t r2;
+ red_bank.fetch(h2->second, r2);
+
+ string seq2 = r2.getSeqString();
+ count++;
+
+ if (l == seq2.length())
+ {
+
+ bool match = true;
+ for (int i = 0; i < l; i++)
+ {
+ char s1 = toupper(seq1[i]);
+ char s2 = toupper(seq2[i]);
+
+ if (s1 == 'N') { s1 = 'A'; }
+ if (s2 == 'N') { s2 = 'A'; }
+
+ if (s1 != s2)
+ {
+ match = false;
+ break;
+ }
+ }
+
+ if (match)
+ {
+ dups++;
+
+ if (dups == 1) { cout << r1.getEID(); }
+ cout << "\t" << r2.getEID();
+ }
+ }
+ }
+
+ if (dups) { cout << endl; }
+ }
+
+ cerr << "Made " << count << " comparisons" << endl;
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ return EXIT_FAILURE;
+ }
+
+ cerr << "End: " << Date() << endl;
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/Validation/find-query-breaks.pl b/src/Validation/find-query-breaks.pl
new file mode 100755
index 0000000..3b10f6b
--- /dev/null
+++ b/src/Validation/find-query-breaks.pl
@@ -0,0 +1,305 @@
+#!/usr/bin/perl -w
+use strict;
+
+use AMOS::AmosFoundation;
+use File::Basename;
+
+my $TRIMWIGGLE = 10;
+my $CIRCLEWIGGLE = 0;
+my $MINLENGTH = 0;
+my $FLAGDIST = undef;
+my $FLAGSAME = undef;
+my $DOAMOS = 0;
+my $BREAKONLY = 0;
+my $COLLAPSEONLY = 0;
+my $CHECKFIX = 0;
+
+my $HELPTEXT = qq~
+Find alignment breaks in query sequences.
+
+Note: You should probably run 'delta-filter -q out.delta > out.delta.q'
+ and then check the out.delta.q file.
+
+ find-query-breaks.pl [options] deltafile
+
+ -b <val> Minimum length of alignment break to report (Default: 10)
+ -w <val> Minimum distance to edge of reference sequence to report (Default: 0)
+ -l <val> Minimum length of query sequence to report (Default: 0)
+ -f <val> Flag broken alignments within this distance of reference
+ -s Flag adjacent broken alignments from same query
+ -C Only show collapses
+
+ -B Only show alignment breaks
+ -c Load fix regions from all.feat and mark if fixed in -B breakreport
+
+ -a Display breaks as AMOS features
+~;
+
+
+sub printAlignment
+{
+ my $align = shift;
+ my $rc = ($align->{qrc}) ? "[rc]" : "[]";
+ print "$align->{rid} {1 [$align->{rstart},$align->{rend}] $align->{rlen}} | $align->{qid} {1 [$align->{qstart},$align->{qend}] $align->{qlen}} $rc";
+}
+
+sub hasFix
+{
+ my $fixes = shift;
+ my $qid = shift;
+ my $pos = shift;
+
+ my $FIXWINDOW = 5000;
+
+ if (exists $fixes->{$qid})
+ {
+ foreach my $f (@{$fixes->{$qid}})
+ {
+ if (($f->{start} - $FIXWINDOW < $pos) &&
+ ($f->{end} + $FIXWINDOW > $pos))
+ {
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+my $base = new AMOS::AmosFoundation;
+$base->setHelpText($HELPTEXT);
+$base->setUsage("find-query-breaks.pl [options] deltafile");
+
+
+my $err = $base->getOptions("b=i" => \$TRIMWIGGLE,
+ "w=i" => \$CIRCLEWIGGLE,
+ "l=i" => \$MINLENGTH,
+ "f=i" => \$FLAGDIST,
+ "s" => \$FLAGSAME,
+ "C" => \$COLLAPSEONLY,
+ "B" => \$BREAKONLY,
+ "a" => \$DOAMOS,
+ "c" => \$CHECKFIX);
+
+if (!$err) { $base->bail("Command line parsing failed. See -h option"); }
+
+if (scalar @ARGV == 0)
+{
+ print "Usage: ".$base->getUsage()."\n";
+ exit(0);
+}
+
+my $multidelta = (scalar @ARGV) > 1;
+
+foreach my $deltafile (@ARGV)
+{
+ print ">$deltafile\n" if $multidelta;
+
+ my %fixes;
+ if ($CHECKFIX)
+ {
+ my $fixname = dirname(File::Spec->rel2abs($deltafile)) . "/all.feat";
+
+ open FIXES, "< $fixname" or die "Can't open $fixname ($!)\n";
+ while (<FIXES>)
+ {
+ my @vals = split /\s+/, $_;
+ if ($vals[1] eq "F")
+ {
+ my $fix;
+ $fix->{start} = $vals[2];
+ $fix->{end} = $vals[3];
+
+ if ($fix->{start} > $fix->{end})
+ {
+ $fix->{start} = $vals[3];
+ $fix->{end} = $vals[2];
+ }
+
+ push @{$fixes{$vals[0]}}, $fix;
+ }
+ }
+ }
+
+ my $cmd = "show-coords -Hcrl $deltafile";
+ open COORDS, "$cmd |" or die "Can't run $cmd ($!)\n";
+
+ my $lastalign = undef;
+
+ while (<COORDS>)
+ {
+ #print $_;
+
+ my @vals = split /\s+/, $_;
+
+ my $align;
+ $align->{rstart} = $vals[1];
+ $align->{rend} = $vals[2];
+
+ $align->{qstart} = $vals[4];
+ $align->{qend} = $vals[5];
+
+ $align->{ralen} = $vals[7];
+ $align->{qalen} = $vals[8];
+
+ $align->{pid} = $vals[10];
+
+ $align->{rlen} = $vals[12];
+ $align->{qlen} = $vals[13];
+
+ $align->{rid} = $vals[18];
+ $align->{qid} = $vals[19];
+
+ $align->{qrc} = ($align->{qend} < $align->{qstart}) ? 1 : 0;
+
+ if ($align->{qrc})
+ {
+ my $t = $align->{qstart};
+ $align->{qstart} = $align->{qend};
+ $align->{qend} = $t;
+ }
+
+ next if ($align->{qlen} < $MINLENGTH);
+
+
+ my $flag = " ";
+ if ((defined $FLAGDIST) &&
+ (defined $lastalign) &&
+ ($lastalign->{rid} eq $align->{rid}) &&
+ ($align->{rstart} - $lastalign->{rend} < $FLAGDIST))
+ {
+ $flag = "*";
+ }
+
+ if ((defined $lastalign) &&
+ ((defined $FLAGSAME) || $COLLAPSEONLY) &&
+ ($lastalign->{rid} eq $align->{rid}) &&
+ ($lastalign->{qid} eq $align->{qid}))
+ {
+ $flag = "*";
+
+ if ($COLLAPSEONLY &&
+ ($align->{qrc} == $lastalign->{qrc}))
+ {
+ my $rdist = $align->{rstart} - $lastalign->{rend};
+
+
+ my $s;
+ my $e;
+
+ if ($align->{qrc})
+ {
+ $s = $align->{qend};
+ $e = $lastalign->{qstart};
+ }
+ else
+ {
+ $s = $lastalign->{qend};
+ $e = $align->{qstart};
+ }
+
+ my $qdist = $e - $s;
+ my $delta = $qdist - $rdist;
+
+ if ($DOAMOS)
+ {
+ print "$align->{qid}\tL\t$s\t$e\tCOLLAPSE $delta\n";
+ }
+ else
+ {
+ print ">$align->{rid}\t$align->{qid}\t";
+ print "[$lastalign->{rend},$align->{rstart}]\t$rdist\t";
+ print "[$s,$e]\t$qdist\t";
+ print "|\t$delta\n";
+
+ printAlignment($lastalign); print "\n";
+ printAlignment($align); print "\n";
+
+ print "\n";
+ }
+ }
+ }
+
+
+ my $breakcount = 0;
+
+
+ if (( $align->{qrc} && ($align->{rlen} - $align->{rend} <= $CIRCLEWIGGLE)) ||
+ (!$align->{qrc} && ($align->{rstart} - 1 <= $CIRCLEWIGGLE)))
+
+ {
+
+ }
+ elsif (($align->{qstart} - 1) > $TRIMWIGGLE)
+ {
+ my $dist = $align->{qstart} - 1;
+ my $len = $align->{qend} - $align->{qstart};
+ $breakcount++;
+
+ if (!$COLLAPSEONLY)
+ {
+ if ($BREAKONLY)
+ {
+ my $fixed = hasFix(\%fixes, $align->{qid}, $align->{qstart});
+ print "$align->{rid} start $align->{rstart} $fixed $align->{qid} $align->{qstart}\n";
+ }
+ elsif ($DOAMOS)
+ {
+ my $s = $align->{qstart};
+ my $e = $s+1;
+
+ print "$align->{qid}\tB\t$e\t$s\tSTART_BREAK: $dist ($len)\n";
+ }
+ else
+ {
+
+ print "S-Break: $dist\tAlen: $len $flag\t";
+ printAlignment($align);
+ print "\n";
+ }
+ }
+ }
+
+ if ((!$align->{qrc} && ($align->{rlen} - $align->{rend} <= $CIRCLEWIGGLE)) ||
+ ( $align->{qrc} && ($align->{rstart} - 1 <= $CIRCLEWIGGLE)))
+
+ {
+
+ }
+ elsif (($align->{qlen} - $align->{qend}) > $TRIMWIGGLE)
+ {
+ my $dist = $align->{qlen} - $align->{qend};
+ my $len = $align->{qend} - $align->{qstart};
+ $breakcount++;
+
+ if (!$COLLAPSEONLY)
+ {
+ if ($BREAKONLY)
+ {
+ my $fixed = hasFix(\%fixes, $align->{qid}, $align->{qend});
+ print "$align->{rid} end $align->{rend} $fixed $align->{qid} $align->{qend}\n";
+ }
+ elsif ($DOAMOS)
+ {
+ my $s = $align->{qend};
+ my $e = $s+1;
+
+ print "$align->{qid}\tB\t$s\t$e\tEND_BREAK: $dist ($len)\n";
+ }
+ else
+ {
+ print "E-Break: $dist\tAlen: $len $flag\t";
+ printAlignment($align);
+ print "\n";
+ }
+ }
+ }
+
+ if ($breakcount)
+ {
+ $lastalign = $align;
+ }
+
+ #print $_ if $breakcount;
+ }
+}
diff --git a/src/Validation/findTcovSnp.pl b/src/Validation/findTcovSnp.pl
new file mode 100755
index 0000000..c7e6a4a
--- /dev/null
+++ b/src/Validation/findTcovSnp.pl
@@ -0,0 +1,255 @@
+#!/usr/local/bin/perl -w
+
+use strict;
+use TIGR::Foundation;
+
+
+my $USAGE = "Usage: findTcovSnp.pl prefix\n";
+
+my $HELPTEXT = qq~
+Generate a report on the slice level discrepanices present in a contig.
+
+ $USAGE
+ prefix is the prefix to the tcov file and idTbl (if -i)
+ Note: getCoverage -t --gapped -R -a all <contigfile>
+
+ Options
+ -------
+ -l Prune low quality discrepancies from report (no qv > 30)
+
+ -[no]q Print Quality Values of each base [ Default: -noq ]
+ -[no]r Print Read Ids of each base [ Default: -r ]
+ -[no]i Print count of each lib id [ Default: -noi ]
+ -[no]b Print each base [ Default: -b ]
+ -[no]H Print a header for the columns [ Default: -h ]
+ -amb Only print contig positions with an ambiguity code
+
+ -minqv Specify minimum cummulative qv of disagreeing reads
+ -minsnp Specify minimum number of consistent disagreeing reads
+ -qvs Print Quality Values stats (max, avg) [ Default: -noqvs ]
+~;
+
+my $VERSION = "findTcovSnp Version 1.00 (Build " . (qw/$Revision$/ )[1] . ")";
+
+my @DEPENDS =
+(
+ "TIGR::Foundation",
+);
+
+my $tf = new TIGR::Foundation;
+
+MAIN:
+{
+ $tf->addDependInfo(@DEPENDS);
+ $tf->setHelpInfo($HELPTEXT);
+ $tf->setVersionInfo($VERSION);
+
+ ## Options
+ my $prunelq = 0;
+ my $doPrintQuals = 0;
+ my $doPrintReads = 1;
+ my $doPrintLibs = 0;
+ my $doPrintBase = 1;
+ my $doPrintHeader = 1;
+ my $doAmbOnly = 0;
+ my $minqv = 0;
+ my $minsnp = 0;
+ my $printqvstats = 0;
+
+ my $LIBPREFIX = 4;
+ my $HIGHQUALITY = 30;
+
+ # now we handle the input options
+ my $result = $tf->TIGR_GetOptions
+ (
+ 'l!' => \$prunelq,
+ 'q!' => \$doPrintQuals,
+ 'r!' => \$doPrintReads,
+ 'i!' => \$doPrintLibs,
+ 'b!' => \$doPrintBase,
+ 'H!' => \$doPrintHeader,
+ 'qvs!' => \$printqvstats,
+ 'amb!' => \$doAmbOnly,
+ 'minqv=s' => \$minqv,
+ 'minsnp=s' => \$minsnp,
+ );
+
+ $tf->bail("Command line parsing failed") if (!$result);
+
+ my $prefix = shift @ARGV or die $USAGE;
+ $prefix = $1 if ($prefix =~ /^([\w\.]+)\.\w+$/);
+
+ my $snpcount = 0;
+ my $lqsnpcount = 0;
+ my %seqid;
+
+ if ($doPrintLibs)
+ {
+ open IDTBL, "< $prefix.idTbl"
+ or $tf->bail("Can't open $prefix.idTbl ($!)");
+
+ while (<IDTBL>)
+ {
+ my ($id, $seqname, $rc) = split /\s+/, $_;
+
+ $seqid{$id} = $seqname;
+ }
+ close IDTBL;
+ }
+
+
+ if ($doPrintHeader)
+ {
+ print "AsmblId\tGPos\tUPos\tConsensus\tdcov\tconflicts";
+
+ print "\t(Base)" if $doPrintBase;
+ print "\t{Reads}" if $doPrintReads;
+ print "\t<Libs>" if $doPrintLibs;
+ print "\t[Quals]" if $doPrintQuals;
+ print "\tmax\tavg" if $printqvstats;
+
+ print "\n";
+ }
+
+ open TCOV, "< $prefix.tcov"
+ or $tf->bail("Can't open $prefix.tcov ($!)");
+
+ OUTER:
+ while (<TCOV>)
+ {
+ my ($asmbl_id, $g, $u, $c, $cqv, $bases, $quals, $reads) = split /\s+/, $_;
+ next if !defined $reads; ## Skip 0 coverage regions
+
+ my @bases = split //, uc($bases);
+
+ my $foundsnp = grep { $_ ne $bases[0] } @bases;
+ next OUTER if !$foundsnp; ## Skip homogeneous slices
+ next OUTER if ($doAmbOnly && ($c eq "A" || $c eq "C" || $c eq "G" || $c eq "T" || $c eq "-"));
+
+ $snpcount++;
+
+ my $dcov = length $bases;
+
+ my @quals = split /:/, $quals;
+ my @reads = split /:/, $reads;
+
+ my %qvsum = ();
+ my %count = ();
+ my %quals = ();
+ my %reads = ();
+ my %libid = ();
+
+ my $i = 0;
+ foreach my $b (@bases)
+ {
+ $count{$b}++;
+ $qvsum{$b} += $quals[$i];
+
+ push @{$quals{$b}}, $quals[$i];
+ push @{$reads{$b}}, $reads[$i];
+
+ $libid{$b}->{substr($seqid{$reads[$i]}, 0, $LIBPREFIX)}++
+ if $doPrintLibs;
+
+ $i++;
+ }
+
+ my $num = scalar keys %count;
+ my @order = sort {$count{$b} <=> $count{$a} ||
+ $qvsum{$b} <=> $qvsum{$a}} keys %count;
+
+ my $cons = $order[0]; ## Grab the majority element
+
+ if ($prunelq || $minqv || $minsnp)
+ {
+ ## Test for presense of hq snp
+ my $foundhq = 0;
+ my $foundqv = 0;
+ my $foundsnp = 0;
+
+ FINDHQ:
+ foreach my $e (@order[1..$#order]) ## Skip the majority element
+ {
+ my @quals = @{$quals{$e}};
+
+ if ($count{$e} >= $minsnp)
+ {
+ $foundsnp = 1;
+ }
+
+ my $cqv = 0;
+
+ foreach my $q (@quals)
+ {
+ $cqv += $q;
+ if ($q >= $HIGHQUALITY)
+ {
+ $foundhq = 1;
+ }
+ }
+
+ if ($cqv >= $minqv)
+ {
+ $foundqv = 1;
+ }
+ }
+
+ if (($prunelq && !$foundhq) ||
+ ($minqv && !$foundqv) ||
+ ($minsnp && !$foundsnp))
+ {
+ ## Skip strictly low quality snps
+ $lqsnpcount++;
+ next OUTER;
+ }
+ }
+
+ my $conflicts = $dcov - $count{$order[0]};
+
+ print "$asmbl_id\t$g\t$u\t$c\t$dcov\t$conflicts";
+
+
+ foreach my $b (@order)
+ {
+ print "\t$b($count{$b})"
+ if $doPrintBase;
+
+ print "\t{", join(":", @{$reads{$b}}), "}"
+ if $doPrintReads;
+
+ print "\t<", join(",", map {"$_:".$libid{$b}->{$_} } sort keys %{$libid{$b}}), ">"
+ if $doPrintLibs;
+
+ print "\t[", join(":", @{$quals{$b}}), "]"
+ if $doPrintQuals;
+
+ if ($printqvstats)
+ {
+ my $s = 0;
+ my $c = 0;
+ my $m = 0;
+ foreach my $q (@{$quals{$b}})
+ {
+ if ($q > $m) { $m = $q; }
+ $s += $q;
+ $c++;
+ }
+ my $avg = sprintf("%0.1f", $s/$c);
+ print "\t$m\t$avg";
+ }
+
+
+
+
+
+ }
+ print "\n";
+ }
+
+ if ($prunelq)
+ {
+ print STDERR "$lqsnpcount low quality snps pruned\n";
+ }
+
+ print STDERR "$snpcount total snps processed\n";
+}
diff --git a/src/Validation/fixlib.pl b/src/Validation/fixlib.pl
new file mode 100755
index 0000000..f71e0a3
--- /dev/null
+++ b/src/Validation/fixlib.pl
@@ -0,0 +1,1325 @@
+#!/usr/local/bin/perl
+
+# fixlib.pl - recomputes library sizes based on reads within contigs
+
+use TIGR::Foundation;
+use AMOS::AmosLib;
+use XML::Parser;
+use Statistics::Descriptive;
+
+use strict;
+
+my $BUCKETSIZE = 100;
+my $MEANSTOP = 50;
+my $SDSTOP = 50;
+
+my $VERSION = '$Revision$ ';
+my $HELP = q~
+ fixlib (-m mates|-x traceinfo.xml|-f frg)
+ (-c contig|-a asm|-ta tasm|-ace ace)
+ [-circ] -o outfile
+ [-i insertfile] [-map dstmap]
+~;
+
+my $base = new TIGR::Foundation();
+if (! defined $base) {
+ die("A horrible death\n");
+}
+
+
+$base->setVersionInfo($VERSION);
+$base->setHelpInfo($HELP);
+
+my $matesfile;
+my $traceinfofile;
+my $ctgfile;
+my $frgfile;
+my $asmfile;
+my $tasmfile;
+my $acefile;
+my $circular;
+my $outfile;
+my $insertfile;
+my $libmap;
+
+my $err = $base->TIGR_GetOptions("m=s" => \$matesfile,
+ "x=s" => \$traceinfofile,
+ "c=s" => \$ctgfile,
+ "f=s" => \$frgfile,
+ "a=s" => \$asmfile,
+ "ta=s" => \$tasmfile,
+ "ace=s" => \$acefile,
+ "circ" => \$circular,
+ "o=s" => \$outfile,
+ "i=s" => \$insertfile,
+ "map=s" => \$libmap);
+
+
+my $matesDone = 0;
+
+# this is where all my data live
+my %contigs; # contig ids to contig length map
+my %seqids; # seq_name to seq_id map
+my %seqnames; # seq id to seq name map
+my %seqcontig; # seq id to contig map
+my %contigseq; # contig id to sequence id list
+my %seq_range; # seq id to clear range
+my %asm_range; # seq id to range within contig
+my %contigcons; # contig id to consensus sequence
+
+my %forw; # insert to forw (rev resp) end mapping
+my %rev;
+my %libraries; # libid to lib range (mean, stdev) mapping
+my %insertlib; # lib id to insert list
+my %seenlib; # insert id to lib id map
+my %seqinsert; # sequence id to insert id map
+my %libnames; # lib id to lib name
+
+my $minSeqId = 1; # where to start numbering reads
+
+my $outprefix;
+
+#first get the contig information
+
+if (! defined $outfile){
+ $base->bail("You must specify an output file with option -o\n");
+}
+open(OUT, ">$outfile") || $base->bail("Cannot open $outfile: $!\n");
+
+#then figure out the mates
+if (defined $frgfile){
+ open(IN, $frgfile) || $base->bail("Cannot open $frgfile: $!\n");
+ parseFrgFile(\*IN);
+ close(IN);
+ $matesDone = 1;
+}
+
+if (defined $asmfile){
+ $outprefix = $asmfile;
+ open(IN, $asmfile) || $base->bail("Cannot open $asmfile: $!\n");
+ parseAsmFile(\*IN);
+ close(IN);
+}
+
+if (defined $ctgfile){
+ $outprefix = $ctgfile;
+ open(IN, $ctgfile) || $base->bail("Cannot open $ctgfile: $!\n");
+ parseContigFile(\*IN);
+ close(IN);
+}
+
+if (defined $tasmfile) {
+ $outprefix = $tasmfile;
+ open(IN, $tasmfile) || $base->bail("Cannot open $tasmfile: $!\n");
+ parseTAsmFile(\*IN);
+ close(IN);
+}
+
+if (defined $acefile){
+ $outprefix = $acefile;
+ open(IN, $acefile) || $base->bail("Cannot open $acefile: $!\n");
+ parseACEFile(\*IN);
+ close(IN);
+}
+
+$outprefix =~ s/\.[^.]*$//;
+
+# now it's time for library and mates information
+
+if (defined $traceinfofile){
+ $matesDone = 1;
+ open(IN, $traceinfofile) || $base->bail("Cannot open $traceinfofile: $!\n");
+ parseTraceInfoFile(\*IN);
+ close(IN);
+}
+
+
+if (! $matesDone && defined $matesfile) { # the mate file contains either mates
+ # or regular expressions defining them
+ open(IN, $matesfile) ||
+ $base->bail("Cannot open \"$matesfile\": $!\n");
+ parseMatesFile(\*IN);
+ close(IN);
+} # if mates not done defined matesfile
+
+if (defined $insertfile){
+ open(IN, $insertfile) || $base->bail("Cannot open $insertfile: $!\n");
+ parseInsertFile(\*IN);
+ close(IN);
+}
+
+if (defined $libmap){
+ open(IN, $libmap) || $base->bail("Cannot open $libmap: $!\n");
+ parseLibMapFile(\*IN);
+ close(IN);
+}
+
+
+# now it's time to figure it all out.
+# for each insert with a defined size range:
+# if both ends are in the same contig
+# add to library size array
+# if ends are in different contigs
+# add them to list of linking clones
+#
+# for each pair of contigs linked by clones do in order of insert sizes:
+# find the average insert size (assuming any size gap)
+# add the deviations to a deviation array for the library
+#
+# for all arrays, screen out observations outside SOME RANGE
+#
+# for each library, compute a mean (based on inserts in the same contig) and
+# a standard deviation (based on all inserts, both linking and within the same
+# contig.
+my $genomesize = 0;
+while (my ($ctg, $len) = each %contigs){
+ $genomesize += $len;
+}
+
+my $nsingle = 0;
+my $nlinking = 0;
+my $nori = 0;
+my $nlen = 0;
+
+my %percontig;
+my %contigins;
+my %insertlen;
+my $it;
+
+while (my ($lib, $sz) = each %libraries){
+ my ($mean, $std) = split(" ", $sz);
+
+ %percontig = ();
+ %contigins = ();
+ %insertlen = ();
+
+ my $stat = Statistics::Descriptive::Full->new();
+
+ if ($insertlib{$lib} =~ /^\s*$/){
+ next; # empty library
+ }
+
+ my @inserts = split(' ', $insertlib{$lib});
+
+ if (exists $libnames{$lib}){
+ $lib = $libnames{$lib};
+ }
+
+ print STDERR ">$lib\n";
+
+ print "library $lib\n";
+ print "\tmean=$mean sd=$std\n";
+
+ print OUT "[library_${lib}_initial]\n";
+ print OUT "mean=$mean\n";
+ print OUT "sd=$std\n";
+
+ for (my $i = 0; $i <= $#inserts; $i++){
+ my $ins = $inserts[$i];
+
+ if (exists $forw{$ins} && exists $rev{$ins}){
+ if (! exists $seqcontig{$forw{$ins}} ||
+ ! exists $seqcontig{$rev{$ins}}) {
+ $nsingle++;
+ next; # if reads are not in contigs we don't care
+ }
+# print "$seqnames{$forw{$ins}} $seqnames{$rev{$ins}}\n";
+ if ($seqcontig{$forw{$ins}} ne $seqcontig{$rev{$ins}}){
+# print "linking\n";
+ $nlinking++;
+ next; # ignore for now
+ }
+
+ print STDERR "seqcontig is $seqcontig{$forw{$ins}} - $seqcontig{$rev{$ins}}\n";
+
+ my $contiglen = $contigs{$seqcontig{$forw{$ins}}};
+ $percontig{$seqcontig{$forw{$ins}}}++;
+ $contigins{$seqcontig{$forw{$ins}}} .= "$ins ";
+ # here all the inserts have both mates in the same contig
+ my $f = $forw{$ins};
+ my $r = $rev{$ins};
+ my ($fl, $fr) = split(" ", $asm_range{$f});
+ my ($sfl, $sfr) = split(" ", $seq_range{$f});
+ my ($rl, $rr) = split(" ", $asm_range{$r});
+ my ($srl, $srr) = split(" ", $seq_range{$r});
+
+ print STDERR "$seqnames{$f} $fl $fr\n";
+ print STDERR "$seqnames{$r} $rl $rr\n";
+
+ my $ef; # end of forward read
+ my $er;
+ my $of; # orientation of forward read
+ my $or;
+
+ if ($sfl < $sfr){
+ $of = 1;
+ $ef = $fl;
+ } else {
+ $of = -1;
+ $ef = $fr;
+ }
+
+ if ($srl < $srr){
+ $or = 1;
+ $er = $rl;
+ } else {
+ $or = -1;
+ $er = $rr;
+ }
+
+ if ($ef > $er){ # swap the values, keep forward toward the beggining of the contig
+ my $tmp = $ef; $ef = $er; $er = $tmp;
+ $tmp = $of; $of = $or; $or = $tmp;
+ }
+
+ if ($of == 1 && $or == -1){ # proper orientation
+ $nlen++;
+# $stat->add_data($er - $ef);
+ $insertlen{$ins} = $er - $ef;
+ print STDERR "len $er $ef ", $er - $ef, "\n";
+ } elsif ($circular && $of == -1 && $or == 1){
+ $nlen++;
+# $stat->add_data($ef + $contiglen - $er);
+ $insertlen{$ins} = $ef + $contiglen - $er;
+ print STDERR "len $er $ef $contiglen ", $ef + $contiglen - $er, "\n";
+ } else {
+ $nori++;
+ }
+ } else {
+ $nsingle++;
+# print "ONE\n";
+ }
+ } # for each insert
+
+
+ while (my ($i, $l) = each %insertlen){
+ $stat->add_data($l);
+ }
+
+ my $newmean;
+ my $newstd;
+ my $nout;
+ if ($stat->count() < 2) {
+ $newmean = 0;
+ $newstd = 0;
+ $nout = 0;
+ } else {
+ my ($low, $lowidx) = $stat->percentile(2);
+ my ($high, $highidx) = $stat->percentile(98);
+
+ my @data = $stat->get_data();
+ print OUT "hist=<<EOH\n";
+ print OUT join("\n", @data);
+ print OUT "\nEOH\n";
+ $nout = $lowidx + $#data - $highidx;
+
+ $stat = Statistics::Descriptive::Full->new();
+ $stat->add_data(@data[$lowidx..$highidx]); # trim the outliers
+
+ $newmean = $stat->mean();
+ $newstd = $stat->standard_deviation();
+ }
+ print OUT "\n";
+# my $nprobm = $newmean;
+# my $nprobsd = $newstd;
+ my $nartm = $newmean;
+ my $nartsd = $newstd;
+ my $artstat;
+ my $artmean; my $artstd;
+ for ($it = 0; $it <= 5; $it++){
+# my ($newestmean, $neweststd) = contigbyNum($newmean, $newstd);
+# my ($probmean, $probstd) = contigbyProb($nprobm, $nprobsd);
+
+ ($artmean, $artstd, $artstat)
+ = contigbyArt($nartm, $nartsd, \@inserts);
+
+ print ">$it\n";
+ print "\tinserts all=",
+ $#inserts + 1,
+ " nomate=$nsingle linking=$nlinking ori=$nori len=$nout good=$nlen\n";
+ printf("\tnewmean=%.2f newsd=%.2f\n", $stat->mean(),
+ $stat->standard_deviation());
+ printf("\t5mean=%.2f\n", $stat->trimmed_mean(0.05));
+ printf("\tmin=%d max=%d median=%d\n", $stat->min(), $stat->max(), $stat->median());
+# printf("\tnewestmean=%.2f newestsd=%.2f\n", $newestmean, $neweststd);
+# printf("\tprobmean=%.2f probsd=%.2f\n", $probmean, $probstd);
+ printf("\tartmean=%.2f artsd=%.2f\n", $artmean, $artstd);
+
+# my %dist = $stat->frequency_distribution(($stat->max() - $stat->min()) / 10);
+# for (sort {$a <=> $b} keys %dist){
+# print STDERR "$_ $dist{$_}\n";
+# }
+# if ($newestmean != 0){
+# $newmean = $newestmean;
+# $newstd = $neweststd;
+# }
+# if ($probmean != 0) {
+# $nprobm = $probmean;
+# $nprobsd = $probstd;
+# }
+
+ if ($artmean == 0 ||
+ (abs($artmean - $nartm) < $MEANSTOP &&
+ abs($nartsd - $artstd) < $SDSTOP)) {
+ last;
+ }
+
+ if ($artmean != 0){
+ $nartm = $artmean;
+ $nartsd = $artstd;
+ }
+ }
+
+ print OUT "[library_${lib}_final]\n";
+ print OUT "mean=$artmean\n";
+ print OUT "sd=$artstd\n";
+ if ($artmean != 0){
+ print OUT "median=", $artstat->median(), "\n";
+ my @data = $artstat->get_data();
+ print OUT "hist=<<EOH\n";
+ print OUT join("\n", @data);
+ print OUT "\nEOH\n";
+ }
+ print OUT "\n";
+
+} # for each library
+
+close(OUT);
+
+exit(0);
+
+
+
+
+###############################################################################
+
+sub contigbyNum
+{
+ my $inmean = shift;
+ my $insd = shift;
+
+ my $mean;
+ my $sd;
+
+ my $req_obs = ($insd / 500) ** 2;
+
+ my $stat = Statistics::Descriptive::Full->new();
+
+ while (my ($ctg, $nobs) = each %percontig){
+ my $testlen = $inmean + 3 * $insd;
+ my $ctglen = $contigs{$ctg};
+ my $ratio = ($ctglen > $testlen) ? 1.0 * (($ctglen - $testlen) / $genomesize) : 0;
+ $ratio /= ($nobs / ($nlinking + $nlen));
+ if ($ratio > 0.95){
+ my @ins = split(' ', $contigins{$ctg});
+ for (my $i = 0; $i <= $#ins; $i++){
+ if (exists $insertlen{$ins[$i]}){
+ $stat->add_data($insertlen{$ins[$i]});
+ }
+ }
+ }
+ print STDERR "testmean $inmean testlen $testlen contigsize $ctglen ratio $ratio nobs = $nobs\n";
+ }
+
+ if ($stat->count() < $req_obs){
+ print STDERR "num too few observations ", $stat->count(), " < $req_obs\n";
+ return (0, 0);
+ } else {
+ my ($low, $lowidx) = $stat->percentile(2);
+ my ($high, $highidx) = $stat->percentile(98);
+
+ my @data = $stat->get_data();
+
+ $stat = Statistics::Descriptive::Full->new();
+ $stat->add_data(@data[$lowidx..$highidx]); # trim the outliers
+ return ($stat->mean(), $stat->standard_deviation());
+ }
+} # contigbyNum
+
+sub contigbyProb
+{
+ my $inmean = shift;
+ my $insd = shift;
+
+ my $mean;
+ my $sd;
+
+ my $req_obs = ($insd / 500) ** 2;
+ my $stat = Statistics::Descriptive::Full->new();
+
+ while (my ($ctg, $nobs) = each %percontig){
+ my $testlen = $inmean + 3 * $insd;
+ my $ctglen = $contigs{$ctg};
+ my $ratio = ($ctglen > $testlen) ? 1.0 * ($ctglen - $testlen) : 0;
+ my $probsum = 0.0;
+ for (my $l = 0; $l <$ctglen; $l++){
+ $probsum += 1.0 * ($ctglen - $l) * bell($inmean, $insd, $l);
+ }
+ $ratio /= $probsum;
+ if ($ratio > 0.95){
+ my @ins = split(' ', $contigins{$ctg});
+ for (my $i = 0; $i <= $#ins; $i++){
+ if (exists $insertlen{$ins[$i]}){
+ $stat->add_data($insertlen{$ins[$i]});
+ }
+ }
+ }
+ print STDERR "Prob $ctg testmean $inmean testlen $testlen contigsize $ctglen ratio $ratio nobs = $nobs\n";
+ }
+
+ if ($stat->count() < $req_obs){
+ print STDERR "prob too few observations ", $stat->count(), " < $req_obs\n";
+ return (0, 0);
+ } else {
+ my ($low, $lowidx) = $stat->percentile(2);
+ my ($high, $highidx) = $stat->percentile(98);
+
+ my @data = $stat->get_data();
+
+ $stat = Statistics::Descriptive::Full->new();
+ $stat->add_data(@data[$lowidx..$highidx]); # trim the outliers
+
+ open(OUT, ">$outprefix.Prob.$it") || die ("cannot open $outprefix.Prob.$it: $!\n");
+# my %dist = $stat->frequency_distribution(($stat->max() - $stat->min()) / 1000);
+# for (sort {$a <=> $b} keys %dist){
+# print OUT "$_ $dist{$_}\n";
+# }
+ for (my $d = 0; $d <= $#data; $d++){
+ print OUT "$data[$d]\n";
+ }
+ close(OUT);
+
+
+ return ($stat->mean(), $stat->standard_deviation());
+ }
+} # contigbyProb
+
+
+sub contigbyArt
+{
+ my $inmean = shift;
+ my $insd = shift;
+ my $inserts = shift;
+
+ my $req_obs = ($insd / 500) ** 2;
+ $req_obs = ($req_obs > 10) ? $req_obs : 10; # pick at least ten
+
+ my $stat = Statistics::Descriptive::Full->new();
+
+ for (my $i = 0; $i <= $#$inserts; $i++){
+ my $ins = $$inserts[$i];
+
+ if (exists $forw{$ins} && exists $rev{$ins}){
+ if (! exists $seqcontig{$forw{$ins}} ||
+ ! exists $seqcontig{$rev{$ins}}) {
+ next; # if reads are not in contigs we don't care
+ }
+ if ($seqcontig{$forw{$ins}} ne $seqcontig{$rev{$ins}}){
+ next; # ignore for now
+ }
+
+ my $contiglen = $contigs{$seqcontig{$forw{$ins}}};
+# $percontig{$seqcontig{$forw{$ins}}}++;
+# $contigins{$seqcontig{$forw{$ins}}} .= "$ins ";
+ # here all the inserts have both mates in the same contig
+ my $f = $forw{$ins};
+ my $r = $rev{$ins};
+ my ($fl, $fr) = split(" ", $asm_range{$f});
+ my ($sfl, $sfr) = split(" ", $seq_range{$f});
+ my ($rl, $rr) = split(" ", $asm_range{$r});
+ my ($srl, $srr) = split(" ", $seq_range{$r});
+
+ my $ef; # end of forward read
+ my $er;
+ my $of; # orientation of forward read
+ my $or;
+
+ if ($sfl < $sfr){
+ $of = 1;
+ $ef = $fl;
+ } else {
+ $of = -1;
+ $ef = $fr;
+ }
+
+ if ($srl < $srr){
+ $or = 1;
+ $er = $rl;
+ } else {
+ $or = -1;
+ $er = $rr;
+ }
+
+ if ($ef > $er){ # swap the values, keep forward toward the beggining of the contig
+ my $tmp = $ef; $ef = $er; $er = $tmp;
+ $tmp = $of; $of = $or; $or = $tmp;
+ }
+
+ if ($of == 1 && $or == -1){ # proper orientation
+ if (! $circular && ($ef + 3 * $insd > $contiglen ||
+ $er - 3 * $insd < 0)){ # skip inserts that could fall off
+ next;
+ } else {
+ $stat->add_data($er - $ef);
+ if ($er < $ef) {
+ print "Weird: $seqnames{$f} - $seqnames{$r}\n";
+ }
+ }
+ } elsif ($circular && $of == -1 && $or == 1){
+ $stat->add_data($ef + $contiglen - $er);
+ if ($er > $contiglen) {
+ print "Weird c: $seqnames{$f} - $seqnames{$r}\n";
+ }
+ }
+ }
+ } # for each insert
+
+ if ($stat->count() < $req_obs){
+ print STDERR "too few observations ", $stat->count(), " < $req_obs\n";
+ return (0, 0);
+ } else {
+ my ($low, $lowidx) = $stat->percentile(2);
+ my ($high, $highidx) = $stat->percentile(98);
+
+ my @data = $stat->get_data();
+
+ $stat = Statistics::Descriptive::Full->new();
+ $stat->add_data(@data[$lowidx..$highidx]); # trim the outliers
+ if ($stat->count() < $req_obs){
+ print STDERR "too few observations after trimming ", $stat->count(), " < $req_obs\n";
+ return (0, 0);
+ }
+
+# open(OUT, ">$outprefix.Art.$it") || die ("cannot open $outprefix.Art.$it: $!\n");
+# my %dist = $stat->frequency_distribution(($stat->max() - $stat->min()) / 1000);
+# for (sort {$a <=> $b} keys %dist){
+# print OUT "$_ $dist{$_}\n";
+# }
+# for (my $d = 0; $d <= $#data; $d++){
+# print OUT "$data[$d]\n";
+# }
+# close(OUT);
+
+ return ($stat->mean(), $stat->standard_deviation(), $stat);
+ }
+}
+
+sub bell
+{
+ my $mean = shift;
+ my $sd = shift;
+ my $x = shift;
+
+ my $PI = 3.141592;
+
+ return 1.0 / (sqrt(2 * $PI) * $sd) * exp(-($x - $mean) ** 2 / 2 / $sd ** 2);
+} # bell
+
+# LIBRARY NAME PARSING
+sub parseInsertFile {
+ my $IN = shift;
+
+ while (<IN>){
+ if (/GenomicLibrary Id=\"(\S+)\" acc=\"(\d+)\"/){
+ $libnames{$2} = $1;
+ print STDERR "lib-id = $2; lib-name = $1\n";
+ }
+ }
+} # parseInsertFile
+
+sub parseLibMapFile {
+ my $IN = shift;
+
+ while (<IN>){
+ my ($name, $id) = split(' ', $_);
+ $libnames{$id} = $name;
+ }
+}
+# MATES PARSING FUNCTIONS
+
+# parse Trace Archive style XML files
+my $tag;
+my $library;
+my $template;
+my $clipl;
+my $clipr;
+my $mean;
+my $stdev;
+my $end;
+my $seqId;
+
+sub parseTraceInfoFile {
+ my $IN = shift;
+
+ my $xml = new XML::Parser(Style => 'Stream');
+
+ if (! defined $xml){
+ $base->bail("Cannot create an XML parser");
+ }
+
+ # start parsing away. The hashes will magically fill up
+
+ $xml->parse($IN);
+
+} # parseTraceInfoFile
+
+
+# Celera .frg
+# populates %seqids, %seqnames, and %seq_range, %libraries, %insertlib,
+# %seenlib, %seqinsert
+sub parseFrgFile {
+ my $IN = shift;
+
+ while (my $record = getRecord($IN)){
+ my ($type, $fields, $recs) = parseRecord($record);
+ if ($type eq "FRG") {
+ my $id = getCAId($$fields{acc});
+ my $nm = $$fields{src};
+ my @lines = split('\n', $nm);
+ $nm = join('', @lines);
+ if ($nm ne "" && $nm !~ /^\s*$/){
+ $seqnames{$id} = $nm;
+ $seqids{$nm} = $id;
+ }
+ my ($seql, $seqr) = split(',', $$fields{clr});
+ $seq_range{$id} = "$seql $seqr";
+ next;
+ }
+
+ if ($type eq "DST"){
+ my $id = getCAId($$fields{acc});
+ $libraries{$id} = "$$fields{mea} $$fields{std}";
+ next;
+ }
+
+ if ($type eq "LKG"){
+ my $id = $minSeqId++;
+ $insertlib{$$fields{dst}} .= "$id ";
+ $seenlib{$id} = $$fields{dst};
+ $seqinsert{$$fields{fg1}} = $id;
+ $seqinsert{$$fields{fg2}} = $id;
+ $forw{$id} = $$fields{fg1};
+ $rev{$id} = $$fields{fg2};
+ next;
+ }
+ }
+} #parseFrgFile
+
+
+# parses BAMBUS style .mates file
+# * expects %seqids to be populated
+# * populates %libraries, %forw, %rev, %insertlib, %seenlib, %seqinsert
+sub parseMatesFile {
+ my $IN = shift;
+
+ my @libregexp;
+ my @libids;
+ my @pairregexp;
+ my $insname = 1;
+ while (<$IN>){
+ chomp;
+ if (/^library/){
+ my @recs = split('\t', $_);
+ if ($#recs < 3 || $#recs > 4){
+ print STDERR "Only ", $#recs + 1, " fields\n";
+ $base->logError("Improperly formated line $. in \"$matesfile\".\nMaybe you didn't use TABs to separate fields\n", 1);
+ next;
+ }
+
+ if ($#recs == 4){
+ $libregexp[++$#libregexp] = $recs[4];
+ $libids[++$#libids] = $recs[1];
+ }
+ my $mean = ($recs[2] + $recs[3]) / 2;
+ my $stdev = ($recs[3] - $recs[2]) / 6;
+ $libraries{$recs[1]} = "$mean $stdev";
+ next;
+ } # if library
+ if (/^pair/){
+ my @recs = split('\t', $_);
+ if ($#recs != 2){
+ $base->logError("Improperly formated line $. in \"$matesfile\".\nMaybe you didn't use TABs to separate fields\n");
+ next;
+ }
+ @pairregexp[++$#pairregexp] = "$recs[1] $recs[2]";
+ next;
+ }
+ if (/^\#/) { # comment
+ next;
+ }
+ if (/^\s*$/) { # empty line
+ next;
+ }
+
+ # now we just deal with the pair lines
+ my @recs = split('\t', $_);
+ if ($#recs < 1 || $#recs > 2){
+ $base->logError("Improperly formated line $. in \"$matesfile\".\nMaybe you didn't use TABs to separate fields\n");
+ next;
+ }
+
+# make sure we've seen these sequences
+ if (! defined $seqids{$recs[0]}){
+ $base->logError("No contig contains sequence $recs[0] at line $. in \"$matesfile\"");
+ next;
+ }
+ if (! defined $seqids{$recs[1]} ){
+ $base->logError("No contig contains sequence $recs[1] at line $. in \"$matesfile\"");
+ next;
+ }
+
+ if (defined $recs[2]){
+ $insertlib{$recs[2]} .= "$insname ";
+ $seenlib{$insname} = $recs[2];
+ } else {
+ $base->logError("$insname has no library\n");
+ }
+
+ $forw{$insname} = $seqids{$recs[0]};
+ $rev{$insname} = $seqids{$recs[1]};
+
+ $seqinsert{$seqids{$recs[0]}} = $insname;
+ $seqinsert{$seqids{$recs[1]}} = $insname;
+
+ $insname++;
+ } # while <IN>
+
+ # now we have to go through all the sequences and assign them to
+ # inserts
+ while (my ($nm, $sid) = each %seqids){
+ for (my $r = 0; $r <= $#pairregexp; $r++){
+ my ($freg, $revreg) = split(' ', $pairregexp[$r]);
+ $base->logLocal("trying $freg and $revreg on $nm\n", 2);
+ if ($nm =~ /$freg/){
+ $base->logLocal("got forw $1\n", 2);
+ if (! exists $forw{$1}){
+ $forw{$1} = $sid;
+ $seqinsert{$sid} = $1;
+ }
+ last;
+ }
+ if ($nm =~ /$revreg/){
+ $base->logLocal("got rev $1\n", 2);
+ if (! exists $rev{$1}){
+ $rev{$1} = $sid;
+ $seqinsert{$sid} = $1;
+ }
+ last;
+ }
+ } # for each pairreg
+ } # while each %seqids
+
+ while (my ($ins, $nm) = each %forw) {
+ if (! exists $seenlib{$ins}){
+ my $found = 0;
+
+ $nm = $seqnames{$nm};
+
+ for (my $l = 0; $l <= $#libregexp; $l++){
+ $base->logLocal("Trying $libregexp[$l] on $nm\n", 2);
+ if ($nm =~ /$libregexp[$l]/){
+ $base->logLocal("found $libids[$l]\n", 2);
+ $insertlib{$libids[$l]} .= "$ins ";
+ $seenlib{$ins} = $libids[$l];
+ $found = 1;
+ last;
+ }
+ }
+ if ($found == 0){
+ $base->logError("Cannot find library for \"$nm\"");
+ next;
+ }
+ }
+ }
+} # parseMateFile;
+
+
+# CONTIG PARSING FUNCTIONS
+#
+# Each function parses either a file or a database table and
+# fills in the following hashes:
+#
+# %contigs - contig_ids and sizes
+# %seqids - seq_name to seq_id
+# %seqnames - seq_id to seq_name
+# %seq_range - seq_id to seq_range
+# %asm_range - seq_id to asm_range as blank delimited string
+# %seqcontig - seq_id to contig
+# %contigcons - contig consensus for each contig
+
+
+
+# Celera .asm
+# populates %contigs, %asm_range, %seqcontig, %contigcons
+# expects %seq_range to be populated
+sub parseAsmFile {
+ my $IN = shift;
+
+ while (my $record = getRecord($IN)){
+ my ($type, $fields, $recs) = parseRecord($record);
+ if ($type eq "CCO"){
+ my $id = getCAId($$fields{acc});
+ my $contiglen = $$fields{len};
+
+ my @offsets; my $coord;
+
+ my $consensus = $$fields{cns};
+ my @consensus = split('\n', $consensus);
+ $consensus = join('', @consensus);
+
+ $#offsets = length($consensus) - 1;
+
+ for (my $i = 0; $i < length($consensus); $i++){
+ if (substr($consensus, $i, 1) ne "-"){
+ $coord++;
+ } else {
+ $contiglen--;
+ }
+ $offsets[$i] = $coord;
+ }
+
+
+# my @gaps;
+# while ($$fields{cns} =~ /-/g){
+# $contiglen--;
+# push(@gaps, $-[0]);
+# }
+
+ $contigs{$id} = $contiglen;
+
+# $contigcons{$id} = $consensus;
+# $contigcons{$id} =~ s/-//g;
+
+ for (my $i = 0; $i <= $#$recs; $i++){
+ my ($sid, $sfs, $srecs) = parseRecord($$recs[$i]);
+ if ($sid eq "MPS"){
+ my $fid = getCAId($$sfs{mid});
+ my ($cll, $clr) = split(' ', $seq_range{$fid});
+
+ $seqcontig{$fid} = $id;
+ $contigseq{$id} .= "$fid ";
+
+ my ($asml, $asmr) = split(',', $$sfs{pos});
+ if ($asml > $asmr) {
+ my $tmp = $cll;
+ $cll = $clr;
+ $clr = $tmp;
+ $tmp = $asml;
+ $asml = $asmr;
+ $asmr = $tmp;
+ $seq_range{$fid} = "$cll $clr";
+ }
+
+ $asml = $offsets[$asml]; $asml--;
+ $asmr = $offsets[$asmr - 1];
+
+# my $g = 0;
+# while ($g <= $#gaps && $gaps[$g] < $asml){
+# $g++;
+# }
+# $asml -= $g;
+
+# while ($g <= $#gaps && $gaps[$g] < $asmr){
+# $g++;
+# }
+
+# $asmr -= $g;
+
+ $asm_range{$fid} = "$asml $asmr";
+ }
+ }
+ } # if type eq CCO
+ }
+} # parseAsmFile
+
+# TIGR .asm
+sub parseTAsmFile {
+ my $IN = shift;
+
+ my $ctg;
+ my $len;
+ my $sname;
+ my $alend;
+ my $arend;
+ my $slend;
+ my $srend;
+ my $sid;
+ my $consensus;
+ while (<$IN>){
+ if (/^sequence\s+(\w+)/){
+ $len = length($1);
+ $consensus = $1;
+ next;
+ }
+ if (/^asmbl_id\s+(\w+)/){
+ $ctg = $1;
+ $contigs{$ctg} = $len; # here we assume that length
+ # was already computed
+# $contigcons{$ctg} = $consensus;
+ next;
+ }
+ if (/^seq_name\s+(\S+)/){
+ $sname = $1;
+ if (! exists $seqids{$sname}){
+ $sid = $minSeqId++;
+ $seqids{$sname} = $sid;
+ $seqnames{$sid} = $sname;
+ } else {
+ $sid = $seqids{$sname};
+ }
+
+ $seqcontig{$sid} = $ctg;
+ $contigseq{$ctg} .= "$sid ";
+ next;
+ }
+ if (/^asm_lend\s+(\d+)/){
+ $alend = $1 - 1; # 0 based
+ next;
+ }
+ if (/^asm_rend\s+(\d+)/){
+ $arend = $1;
+ next;
+ }
+ if (/^seq_lend\s+(\d+)/){
+ $slend = $1 - 1;
+ next;
+ }
+ if (/^seq_rend\s+(\d+)/){
+ $srend = $1;
+ next;
+ }
+ if (/^offset/){
+ $seq_range{$sid} = "$slend $srend";
+ $asm_range{$sid} = "$alend $arend";
+ next;
+ }
+ }
+} # parseTasmFile
+
+
+# New .ACE format
+sub parseACEFile {
+ my $IN = shift;
+
+ my $ctg;
+ my $len;
+ my $sname;
+ my $alend;
+ my $arend;
+ my $slend;
+ my $srend;
+ my $sid;
+
+ my $inContig = 0;
+ my $inSequence = 0;
+
+ my $contigName;
+ my $contigLen;
+ my $contigSeqs;
+ my $seqName;
+ my %offset;
+ my %rc;
+ my $seq;
+ my @gaps;
+ while (<$IN>){
+ if (/^CO (\S+) (\d+) (\d+)/){
+ $contigName = $1;
+ $contigLen = $2;
+ $contigSeqs = $3;
+ $inContig = 1;
+ $seq = "";
+ %offset = ();
+ next;
+ }
+ if ($inContig && /^\s*$/){
+ $inContig = 0;
+ $seq =~ s/\*/-/g;
+ @gaps = ();
+ my $gap = index($seq, "-");
+ while ($gap != -1){
+ push(@gaps, $gap + 1);
+ $gap = index($seq, "-", $gap + 1);
+ }
+# $contigcons{$contigName} = $seq;
+ $contigs{$contigName} = $contigLen;
+
+ next;
+ }
+ if ($inSequence && $_ =~ /^\s*$/){
+ $inSequence = 0;
+ next;
+ }
+
+ if ($inContig || $inSequence) {
+ chomp;
+ $seq .= $_;
+ next;
+ }
+
+
+ if (/^AF (\S+) (\w) (-?\d+)/){
+ $offset{$1} = $3;
+ $rc{$1} = $2;
+ next;
+ }
+
+ if (/^RD (\S+)/){
+ $inSequence = 1;
+ $seqName = $1;
+ $seq = "";
+ next;
+ }
+
+ if (/^QA -?(\d+) -?(\d+) (\d+) (\d+)/){
+ my $offset = $offset{$seqName};
+ my $cll = $3;
+ my $clr = $4;
+ my $end5 = $1;
+ my $end3 = $2;
+ $seq =~ s/\*/-/g;
+ my $len = length($seq);
+ $offset += $cll - 2;
+ $seq = substr($seq, $cll - 1, $clr - $cll + 1);
+
+ my $i = 0;
+ my $asml = $offset;
+ my $asmr = $asml + $clr - $cll + 1;
+ while ($i <= $#gaps && $offset > $gaps[$i]){
+ $asml--; $asmr--; $i++;
+ } # get rid of gaps from offset here
+ while ($i <= $#gaps && $offset + $clr - $cll + 1 > $gaps[$i]){
+ $asmr--; $i++;
+ }
+
+ if ($rc{$seqName} eq "C"){ # make coordinates with respect to forw strand
+ $cll = $len - $cll + 1;
+ $clr = $len - $clr + 1;
+ my $tmp = $cll;
+ $cll = $clr;
+ $clr = $tmp;
+ }
+
+ while ($seq =~ /-/g){ #make $clr ungapped
+ $clr--;
+ }
+
+ if ($rc{$seqName} eq "C"){
+ my $tmp = $cll;
+ $cll = $clr;
+ $clr = $tmp;
+ }
+
+ my $seqId;
+ if (! exists $seqids{$seqName}){
+ $seqId = $minSeqId++;
+ $seqids{$seqName} = $seqId;
+ $seqnames{$seqId} = $seqName;
+ } else {
+ $seqId = $seqids{$seqName};
+ }
+ $seqcontig{$seqId} = $contigName;
+ $contigseq{$contigName} .= "$seqId ";
+ $seq_range{$seqId} = "$cll $clr";
+ $asm_range{$seqId} = "$asml $asmr";
+ next;
+ }
+ } # while <$IN>
+} #parseAceFile
+
+
+
+# TIGR .contig file
+sub parseContigFile {
+ my $IN = shift;
+
+ my $ctg;
+ my $len;
+ my $sname;
+ my $alend;
+ my $arend;
+ my $slend;
+ my $srend;
+ my $sid;
+ my $incontig = 0;
+ my $consensus = "";
+ while (<$IN>){
+ if (/^\#\#(\S+) \d+ (\d+)/ ){
+ if (defined $consensus){
+ $consensus =~ s/-//g;
+# $contigcons{$ctg} = $consensus;
+ }
+ $consensus = "";
+ $ctg = $1;
+ $contigs{$ctg} = $2;
+ $incontig = 1;
+ next;
+ }
+
+ if (/^\#(\S+)\(\d+\) .*\{(\d+) (\d+)\} <(\d+) (\d+)>/){
+ $incontig = 0;
+ $sname = $1;
+ if (! exists $seqids{$sname}){
+ $sid = $minSeqId++;
+ $seqids{$sname} = $sid;
+ $seqnames{$sid} = $sname;
+ } else {
+ $sid = $seqids{$sname};
+ }
+ $seqcontig{$sid} = $ctg;
+ $contigseq{$ctg} .= "$sid ";
+# print STDERR "adding $sname to $ctg\n";
+ $alend = $4 - 1;
+ $arend = $5;
+ $slend = $2 - 1;
+ $srend = $3;
+ $seq_range{$sid} = "$slend $srend";
+ $asm_range{$sid} = "$alend $arend";
+ next;
+ }
+
+ if ($incontig){
+ # here I try to get rid of dashes when computing contig sizes
+ my $ind = -1;
+ while (($ind = index($_ ,"-", $ind + 1)) != -1){
+ $contigs{$ctg}--;
+ }
+ chomp;
+ $consensus .= $_;
+ }
+ }
+ if (defined $consensus){
+ $consensus =~ s/-//g;
+# $contigcons{$ctg} = $consensus;
+ }
+
+} # parseContigFile
+
+
+###############################################################
+# XML parser functions
+###############################################################
+sub StartDocument
+{
+# print "starting\n";
+}
+
+sub EndDocument
+{
+# print "done\n";
+}
+
+sub StartTag
+{
+ $tag = lc($_[1]);
+
+ if ($tag eq "trace"){
+ $library = undef;
+ $template = undef;
+ $clipl = undef;
+ $clipr = undef;
+ $mean = undef;
+ $stdev = undef;
+ $end = undef;
+ $seqId = undef;
+ }
+}
+
+
+sub EndTag
+{
+ $tag = lc($_[1]);
+ if ($tag eq "trace"){
+ if (! defined $seqId){
+ $base->logError("trace has no name???\n");
+ }
+ if (! defined $library){
+ $base->logError("trace $seqId has no library\n");
+ }
+ if (! defined $mean){
+ $base->logError("library $library has no mean\n");
+ }
+
+ if (! defined $stdev){
+ $base->logError("library $library has no stdev\n");
+ }
+
+ if (defined $mean and defined $stdev){
+ $libraries{$library} = "$mean $stdev";
+ }
+
+ if (! defined $template){
+ $base->logError("trace $seqId has no template\n");
+ }
+
+ if (! defined $end) {
+ $base->logError("trace $seqId has no end\n");
+ }
+
+ if ($end eq "R"){
+ if (! exists $rev{$template} ||
+ $seqnames{$seqId} gt $seqnames{$rev{$template}}){
+ $rev{$template} = $seqId;
+ }
+ }
+
+ if ($end eq "F"){
+ if (! exists $forw{$template} ||
+ $seqnames{$seqId} gt $seqnames{$forw{$template}}){
+ $forw{$template} = $seqId;
+ }
+ }
+
+ $seqinsert{$seqId} = $template;
+ $insertlib{$library} .= "$template ";
+ $seenlib{$template} = $library;
+
+
+ if (defined $clipl && defined $clipr){
+ $seq_range{$seqId} = "$clipl $clipr";
+ }
+ }
+
+ $tag = undef;
+}
+
+
+sub Text
+{
+ if (defined $tag){
+ if ($tag eq "insert_size"){
+ $mean = $_;
+ } elsif ($tag eq "insert_stdev"){
+ $stdev = $_;
+ } elsif ($tag eq "trace_name"){
+ my $seqName = $_;
+ $seqId = $minSeqId++;
+ $seqids{$seqName} = $seqId;
+ $seqnames{$seqId} = $seqName;
+ } elsif ($tag eq "library_id"){
+ $library = $_;
+ } elsif ($tag eq "seq_lib_id") {
+ if (! defined $library) {
+ $library = $_;
+ }
+ } elsif ($tag eq "template_id"){
+ $template = $_;
+ } elsif ($tag eq "trace_end"){
+ $end = $_;
+ } elsif ($tag eq "clip_quality_left" ||
+ $tag eq "clip_vector_left"){
+ if (! defined $clipl || $_ > $clipl){
+ $clipl = $_;
+ }
+ } elsif ($tag eq "clip_quality_right" ||
+ $tag eq "clip_vector_right"){
+ if (! defined $clipr || $_ < $clipr){
+ $clipr = $_;
+ }
+ }
+ }
+}
+
+sub pi
+{
+
+}
diff --git a/src/Validation/getFRCvalues.cc b/src/Validation/getFRCvalues.cc
new file mode 100644
index 0000000..c5b8860
--- /dev/null
+++ b/src/Validation/getFRCvalues.cc
@@ -0,0 +1,462 @@
+#include "getFRCvalues.hh"
+
+/*
+ * Routines for computing the Feature-Response Curve
+ * on a set of assembled contigs (in an AMOS databank)
+ *
+ * Copyright 2011 New York University.
+ *
+ * Authors :
+ *
+ * 2011 : Giuseppe Narzisi
+ * Email: narzisi at nyu.edu
+*/
+
+using namespace std;
+using namespace AMOS;
+
+#define DIV(a,b) (b?(double(a)/b):0.0)
+
+void FeatureStats::computeStats() {
+
+ open_bank();
+
+ AMOS::Feature_t feat;
+ AMOS::Contig_t ctg;
+
+ int num_ctg = (int)ctg_bank->getSize();
+ int cum;
+ int cur;
+ int totallength;
+ double thresh;
+ double contig_coverage = 0.0;
+
+ multimap<int,int> ctgset; // associative container for reads and their lookahead value
+ multimap<int,int>::iterator ctgset_it;
+ multimap<int,int>::reverse_iterator ctgset_rit;
+ int n50;
+ int max_iid;
+ vector<int> ctg_feats(num_ctg+1, 0); // position 0 is not used!
+ vector<int> ctg_feats_C(num_ctg+1, 0);
+ vector<int> ctg_feats_P(num_ctg+1, 0);
+ vector<int> ctg_feats_B(num_ctg+1, 0);
+ vector<int> ctg_feats_K(num_ctg+1, 0);
+ vector<int> ctg_feats_M(num_ctg+1, 0);
+ vector<int> ctg_feats_A(num_ctg+1, 0);
+
+ set<int> iid_set;
+ set<int>::iterator iid_it;
+
+ int totalfeatures = 0;
+ int totalfeatures_C = 0;
+ int totalfeatures_P = 0;
+ int totalfeatures_B = 0;
+ int totalfeatures_K = 0;
+ int totalfeatures_M = 0;
+ int totalfeatures_A = 0;
+
+ feat_bank->seekg(1);
+
+ // static const FeatureType_t NULL_FEATURE = 0;
+ // static const FeatureType_t REPEAT = 'R';
+ // static const FeatureType_t UNITIG = 'U';
+ // static const FeatureType_t JOIN = 'J';
+ // static const FeatureType_t ORF = 'O';
+ // static const FeatureType_t FIX = 'F';
+
+ //cout << "Total contigs: " << num_ctg << endl;
+
+ max_iid = 0;
+ while ((*feat_bank) >> feat)
+ {
+ //feat.getSource().second; // type of the object which this feature refers to
+ //cout << feat.getSource().first << endl;
+ iid_set.insert(feat.getSource().first);
+ if(feat.getSource().first > max_iid) {
+ max_iid = feat.getSource().first;
+ }
+ ctg_feats.resize(max_iid+1, 0); // position 0 is not used!
+ ctg_feats_C.resize(max_iid+1, 0);
+ ctg_feats_P.resize(max_iid+1, 0);
+ ctg_feats_B.resize(max_iid+1, 0);
+ ctg_feats_K.resize(max_iid+1, 0);
+ ctg_feats_M.resize(max_iid+1, 0);
+ ctg_feats_A.resize(max_iid+1, 0);
+
+ if(feat.getType() != 'A') { // all features except MISASSEMBLY
+ ctg_feats[feat.getSource().first] += 1;
+ totalfeatures += 1;
+ }
+ if(feat.getType() == 'C') { // COVERAGE
+ ctg_feats_C[feat.getSource().first] += 1;
+ totalfeatures_C += 1;
+ }
+ if(feat.getType() == 'P') { // POLYMORPHISM
+ ctg_feats_P[feat.getSource().first] += 1;
+ totalfeatures_P += 1;
+ }
+ if(feat.getType() == 'B') { // BREAKPOINT
+ ctg_feats_B[feat.getSource().first] += 1;
+ totalfeatures_B += 1;
+ }
+ if(feat.getType() == 'K') { // KMER
+ ctg_feats_K[feat.getSource().first] += 1;
+ totalfeatures_K += 1;
+ }
+ if(feat.getType() == 'M') { // MATEPAIR
+ ctg_feats_M[feat.getSource().first] += 1;
+ totalfeatures_M += 1;
+ }
+ if(feat.getType() == 'A') { // MISASSEMBLY
+ ctg_feats_A[feat.getSource().first] += 1;
+ totalfeatures_A += 1;
+ }
+ //cout << "Obj: " << feat.getSource().second << ", IID: " << feat.getSource().first << "Type: " << feat.getType() << endl;
+ }
+
+ // store contigs into a map associative container (length,ctg_iid)
+ //for (int j = 1; j < ctg_feats.size(); j++) {
+ for ( iid_it=iid_set.begin() ; iid_it != iid_set.end(); iid_it++ ) {
+ if(ctg_bank->existsIID(*iid_it)) {
+ ctg_bank->fetch((*iid_it), ctg);
+ ctgset.insert(pair<int,int>(ctg.getLength(),(*iid_it)));
+ }
+ }
+
+ // at this point ctgset contains the contigs ordered by length (ascending order)
+
+ /*
+ for (ctgset_rit = ctgset.rbegin(); ctgset_rit != ctgset.rend(); ctgset_rit++) {
+ cout << "Contig: " << (*ctgset_rit).second << " has length " << (*ctgset_rit).first << endl;
+ }
+ */
+
+ cout << "Computing the Feature-Response curves..." << endl;
+
+ // Compute Feature-Response for all features
+ cout << "- FRC" << endl;
+ out.open("FRC.txt");
+ if (!out.is_open()){
+ cerr << "Could not open input feat_all.txt" << endl;
+ exit(1);
+ }
+ for (int k = 1; k < 100; k++) {
+ double factor = ((double)k/100.0);
+ thresh = totalfeatures * factor;
+ cum = 0;
+ totallength = 0;
+ n50 = -1;
+ for (ctgset_rit = ctgset.rbegin(); ctgset_rit != ctgset.rend(); ctgset_rit++) {
+ //cur = (*ctgset_rit).first;
+ cur = ctg_feats[(*ctgset_rit).second];
+ cum += cur;
+ //ctg_bank->fetch((*ctgset_rit).second, ctg);
+ totallength += (*ctgset_rit).first;
+
+ if (n50 == -1 && cum >= thresh) {
+ n50 = (*ctgset_rit).first;
+ break;
+ }
+ }
+ contig_coverage = DIV(totallength,genome_size);
+ out << thresh << " " << n50 << " " << contig_coverage*100.0 << endl;
+ }
+ out.close();
+
+ // Compute Feature-Response for COVERAGE features
+ cout << "- FRC-coverage" << endl;
+ out.open("FRC_coverage.txt");
+ if (!out.is_open()){
+ cerr << "Could not open input feat_coverage.txt" << endl;
+ exit(1);
+ }
+ for (int k = 1; k < 100; k++) {
+ double factor = ((double)k/100.0);
+ thresh = totalfeatures_C * factor;
+ cum = 0;
+ totallength = 0;
+ n50 = -1;
+ for (ctgset_rit = ctgset.rbegin(); ctgset_rit != ctgset.rend(); ctgset_rit++) {
+ //cur = (*ctgset_rit).first;
+ cur = ctg_feats_C[(*ctgset_rit).second];
+ cum += cur;
+ //ctg_bank->fetch((*ctgset_rit).second, ctg);
+ totallength += (*ctgset_rit).first;
+
+ if (n50 == -1 && cum >= thresh) {
+ n50 = (*ctgset_rit).first;
+ break;
+ }
+ }
+ contig_coverage = DIV(totallength,genome_size);
+ out << thresh << " " << n50 << " " << contig_coverage*100.0 << endl;
+ }
+ out.close();
+
+ // Compute Feature-Response for POLYMORPHISM features
+ cout << "- FRC-polymorphism" << endl;
+ out.open("FRC_polymorphism.txt");
+ if (!out.is_open()){
+ cerr << "Could not open input feat_polymorphism.txt" << endl;
+ exit(1);
+ }
+ for (int k = 1; k < 100; k++) {
+ double factor = ((double)k/100.0);
+ thresh = totalfeatures_P * factor;
+ cum = 0;
+ totallength = 0;
+ n50 = -1;
+ for (ctgset_rit = ctgset.rbegin(); ctgset_rit != ctgset.rend(); ctgset_rit++) {
+ //cur = (*ctgset_rit).first;
+ cur = ctg_feats_P[(*ctgset_rit).second];
+ cum += cur;
+ //ctg_bank->fetch((*ctgset_rit).second, ctg);
+ totallength += (*ctgset_rit).first;
+
+ if (n50 == -1 && cum >= thresh) {
+ n50 = (*ctgset_rit).first;
+ break;
+ }
+ }
+ contig_coverage = DIV(totallength,genome_size);
+ out << thresh << " " << n50 << " " << contig_coverage*100.0 << endl;
+ }
+ out.close();
+
+ // Compute Feature-Response for BREAKPOINT features
+ cout << "- FRC-breakpoint" << endl;
+ out.open("FRC_breakpoint.txt");
+ if (!out.is_open()){
+ cerr << "Could not open input feat_breakpoint.txt" << endl;
+ exit(1);
+ }
+ for (int k = 1; k < 100; k++) {
+ double factor = ((double)k/100.0);
+ thresh = totalfeatures_B * factor;
+ cum = 0;
+ totallength = 0;
+ n50 = -1;
+ for (ctgset_rit = ctgset.rbegin(); ctgset_rit != ctgset.rend(); ctgset_rit++) {
+ //cur = (*ctgset_rit).first;
+ cur = ctg_feats_B[(*ctgset_rit).second];
+ cum += cur;
+ //ctg_bank->fetch((*ctgset_rit).second, ctg);
+ totallength += (*ctgset_rit).first;
+
+ if (n50 == -1 && cum >= thresh) {
+ n50 = (*ctgset_rit).first;
+ break;
+ }
+ }
+ contig_coverage = DIV(totallength,genome_size);
+ out << thresh << " " << n50 << " " << contig_coverage*100.0 << endl;
+ }
+ out.close();
+
+ // Compute Feature-Response for KMER features
+ cout << "- FRC-kmer" << endl;
+ out.open("FRC_kmer.txt");
+ if (!out.is_open()){
+ cerr << "Could not open input feat_kmer.txt" << endl;
+ exit(1);
+ }
+ for (int k = 1; k < 100; k++) {
+ double factor = ((double)k/100.0);
+ thresh = totalfeatures_K * factor;
+ cum = 0;
+ totallength = 0;
+ n50 = -1;
+ for (ctgset_rit = ctgset.rbegin(); ctgset_rit != ctgset.rend(); ctgset_rit++) {
+ //cur = (*ctgset_rit).first;
+ cur = ctg_feats_K[(*ctgset_rit).second];
+ cum += cur;
+ //ctg_bank->fetch((*ctgset_rit).second, ctg);
+ totallength += (*ctgset_rit).first;
+
+ if (n50 == -1 && cum >= thresh) {
+ n50 = (*ctgset_rit).first;
+ break;
+ }
+ }
+ contig_coverage = DIV(totallength,genome_size);
+ out << thresh << " " << n50 << " " << contig_coverage*100.0 << endl;
+ }
+ out.close();
+
+ // Compute Feature-Response for MATEPAIR features
+ cout << "- FRC-matepair" << endl;
+ out.open("FRC_matepair.txt");
+ if (!out.is_open()){
+ cerr << "Could not open input feat_matepair.txt" << endl;
+ exit(1);
+ }
+ for (int k = 1; k < 100; k++) {
+ double factor = ((double)k/100.0);
+ thresh = totalfeatures_M * factor;
+ cum = 0;
+ totallength = 0;
+ n50 = -1;
+ for (ctgset_rit = ctgset.rbegin(); ctgset_rit != ctgset.rend(); ctgset_rit++) {
+ //cur = (*ctgset_rit).first;
+ cur = ctg_feats_M[(*ctgset_rit).second];
+ cum += cur;
+ //ctg_bank->fetch((*ctgset_rit).second, ctg);
+ totallength += (*ctgset_rit).first;
+
+ if (n50 == -1 && cum >= thresh) {
+ n50 = (*ctgset_rit).first;
+ break;
+ }
+ }
+ contig_coverage = DIV(totallength,genome_size);
+ out << thresh << " " << n50 << " " << contig_coverage*100.0 << endl;
+ }
+ out.close();
+
+ // Compute Feature-Response for MISASSEMBLY features
+ cout << "- FRC-misassembly" << endl;
+ out.open("FRC_misassembly.txt");
+ if (!out.is_open()){
+ cerr << "Could not open input feat_misassembly.txt" << endl;
+ exit(1);
+ }
+ for (int k = 1; k < 100; k++) {
+ double factor = ((double)k/100.0);
+ thresh = totalfeatures_A * factor;
+ cum = 0;
+ totallength = 0;
+ n50 = -1;
+ for (ctgset_rit = ctgset.rbegin(); ctgset_rit != ctgset.rend(); ctgset_rit++) {
+ //cur = (*ctgset_rit).first;
+ cur = ctg_feats_A[(*ctgset_rit).second];
+ cum += cur;
+ //ctg_bank->fetch((*ctgset_rit).second, ctg);
+ totallength += (*ctgset_rit).first;
+
+ if (n50 == -1 && cum >= thresh) {
+ n50 = (*ctgset_rit).first;
+ break;
+ }
+ }
+ contig_coverage = DIV(totallength,genome_size);
+ out << thresh << " " << n50 << " " << contig_coverage*100.0 << endl;
+ }
+ out.close();
+
+ close_bank();
+
+ cout << "done!" << endl;
+}
+
+
+void FeatureStats::open_bank() {
+
+ feat_bank = new BankStream_t(Feature_t::NCODE);
+ ctg_bank = new Bank_t(Contig_t::NCODE);
+
+ try { // try to open the bank
+ if(feat_bank->exists(bankdir)) {
+ //cout << "Opening feature bank ... " << bankdir << endl;
+ feat_bank->open(bankdir, B_READ);
+ ctg_bank->open(bankdir, B_READ);
+
+ if(feat_bank->empty()) {
+ cerr << "feature bank is empty" << endl;
+ return;
+ }
+ if(ctg_bank->empty()) {
+ cerr << "contig bank is empty" << endl;
+ return;
+ }
+ }
+ } catch (Exception_t &e) {
+ cerr << "Exception in opening the bank: " << e << endl;
+ close_bank();
+ }
+}
+
+void FeatureStats::close_bank() {
+
+ try { // try to pen the bank
+ if(feat_bank->exists(bankdir)) {
+ //cout << "Closing feature bank ... " << endl;
+ feat_bank->close();
+ //cout << "bank "<< bankdir << " closed !" << endl;
+ }
+ if(ctg_bank->exists(bankdir)) {
+ //cout << "Closing contig bank ... " << endl;
+ ctg_bank->close();
+ //cout << "bank "<< bankdir << " closed !" << endl;
+ }
+ } catch (Exception_t &e) {
+ cerr << "Exception in closing the bank: " << e << endl;
+ }
+}
+
+void FeatureStats::parse_command_line(int argc, char* argv[]) {
+ bool errflg = false;
+ int ch;
+
+ optarg = NULL;
+
+ while (!errflg && ((ch = getopt(argc, argv, "g:r:l:b:hgvs")) != EOF)) {
+ switch (ch) {
+ case 'b' :
+ bankdir = optarg;
+ break;
+
+ case 'g' :
+ genome_size = atoi(optarg);
+ break;
+
+ case 'v':
+ VERBOSE = true;
+ break;
+
+ case '?' :
+ cerr << "Unrecognized option - " << optopt << endl;
+
+ default :
+ errflg = true;
+ }
+ }
+
+ if(bankdir.empty()) {
+ cerr << " Need to provide a bankdir name " << endl;
+ errflg = true;
+ }
+
+ if(errflg) {
+ cerr << " Usage: assembler -g <genome size> -b <AMOS Bank> " << endl;
+
+ cerr << "Output:" << endl;
+ cerr << "\tThe Feature-Response curve (FRC) is saved in file 'FRC.txt', while" << endl;
+ cerr << "\tFRCs for each feature type are saved respectively in:" << endl;
+ cerr << "\t'FRC_coverage.txt', 'FRC_polymorphism.txt', 'FRC_breakpoint.txt'," << endl;
+ cerr << "\t'FRC_kmer.txt', 'FRC_matepair.txt' and 'FRC_misassembly.txt'" << endl;
+
+ cerr << "Output file format:" << endl;
+ cerr << "Each file contains the FRCs in 3-columns format" << endl;
+ cerr << "\t- column 1 = feature threshold T;" << endl;
+ cerr << "\t- column 2 = contigs' N50 associated to the threshold T in column 1;" << endl;
+ cerr << "\t- column 3 = cumulative size of the contigs whose number of features is <= T;" << endl;
+ cerr << endl;
+
+ exit(EXIT_FAILURE);
+ }
+
+ return;
+}
+
+int main(int argc, char** argv) {
+
+ FeatureStats* fs = new FeatureStats();
+ fs->parse_command_line(argc, argv);
+
+ if(fs->VERBOSE) {
+ cout << " AMOS mode " << endl;
+ cout << " use bank: " << fs->bankdir << endl;
+ }
+
+ fs->computeStats();
+}
diff --git a/src/Validation/getFRCvalues.hh b/src/Validation/getFRCvalues.hh
new file mode 100644
index 0000000..d222d86
--- /dev/null
+++ b/src/Validation/getFRCvalues.hh
@@ -0,0 +1,55 @@
+#ifndef FEATURE_CURVE_HH
+#define FEATURE_CURVE_HH 1
+
+/*
+ * Routines for computing the Feature-Response Curve
+ * on a set of assembled contigs (in an AMOS databank)
+ *
+ * Copyright 2011 New York University.
+ *
+ * Authors :
+ *
+ * 2011 : Giuseppe Narzisi
+ * Email: narzisi at nyu.edu
+*/
+
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <fstream>
+#include <math.h>
+#include <unistd.h>
+#include <vector>
+#include <set>
+
+class FeatureStats {
+
+public:
+
+ std::string bankdir;
+
+ std::ofstream out;
+
+ bool VERBOSE;
+
+ int genome_size;
+
+ AMOS::BankStream_t* feat_bank;
+ AMOS::Bank_t* ctg_bank;
+
+ FeatureStats() {
+ VERBOSE = false;
+ genome_size = 1;
+ }
+
+ ~FeatureStats() { }
+
+ void computeStats();
+
+ void parse_command_line(int argc, char* argv[]);
+
+ void open_bank();
+
+ void close_bank();
+};
+
+#endif
diff --git a/src/Validation/insert-sizes.cc b/src/Validation/insert-sizes.cc
new file mode 100644
index 0000000..aa4f967
--- /dev/null
+++ b/src/Validation/insert-sizes.cc
@@ -0,0 +1,374 @@
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <cassert>
+#include <unistd.h>
+#include <map>
+#include <set>
+#include <cmath>
+#include "amp.hh"
+
+#include "DataStore.hh"
+#include "Insert.hh"
+#include "InsertStats.hh"
+
+using namespace std;
+using namespace AMOS;
+
+
+string OPT_BankName;
+bool OPT_BankSpy = false;
+int OPT_SUBLIBRARYLEN = 0;
+int OPT_DETAILS = false;
+int OPT_PRINTSUMMARY = true;
+int OPT_PROCESSSCAFFOLDS = true;
+int OPT_COVERAGE = false;
+int OPT_UNPLACED = false;
+
+
+DataStore * m_datastore;
+int m_connectMates = 1;
+typedef std::vector<Insert *> InsertList_t;
+map <string, InsertStats *> libstats;
+
+
+void ParseArgs (int argc, char ** argv);
+void PrintHelp (const char * s);
+void PrintUsage (const char * s);
+
+
+
+
+
+
+void processInserts(const string & eid,
+ InsertList_t & m_inserts,
+ vector<Tile_t> & tiling)
+{
+ vector<Insert *>::iterator i = m_inserts.begin();
+
+ if (OPT_COVERAGE)
+ {
+ multimap<int, int> read_endpoints;
+ multimap<int, int>::iterator ep;
+
+ multimap<int, Insert *> insert_endpoints;
+ multimap<int, Insert *>::iterator iep;
+
+ sort(tiling.begin(), tiling.end(), TileOrderCmp());
+
+ int max = 0;
+ vector<Tile_t>::iterator ti;
+ for (ti = tiling.begin(); ti != tiling.end(); ti++)
+ {
+ if (ti->getRightOffset() > max) { max = ti->getRightOffset(); }
+ }
+
+ cerr << "Printing coverage for " << max << " bases" << endl;
+ ProgressDots_t dots(max, 50);
+
+ ti = tiling.begin();
+ for (int gindex = 0; gindex <= max; gindex++)
+ {
+ ep = read_endpoints.begin();
+ while ((ep != read_endpoints.end()) && (ep->first < gindex))
+ {
+ read_endpoints.erase(ep); ep = read_endpoints.begin();
+ }
+
+ while (ti != tiling.end() && ti->offset <= gindex)
+ {
+ read_endpoints.insert(make_pair(ti->getRightOffset(), ti->source));
+ ti++;
+ }
+
+ iep = insert_endpoints.begin();
+ while ((iep != insert_endpoints.end()) && (iep->first < gindex))
+ {
+ insert_endpoints.erase(iep); iep = insert_endpoints.begin();
+ }
+
+ while (i != m_inserts.end() && (*i)->m_loffset <= gindex)
+ {
+ if ((*i)->reasonablyConnected())
+ {
+ insert_endpoints.insert(make_pair((*i)->m_roffset, *i));
+ }
+ i++;
+ }
+
+ {
+ int rcov = read_endpoints.size();
+ int icov = insert_endpoints.size();
+
+ cout << eid << "\t" << gindex << "\t" << rcov << "\t" << icov << "\t";
+
+ if (0)
+ {
+ for (ep = read_endpoints.begin(); ep != read_endpoints.end(); ep++)
+ {
+ cout << ":" << m_datastore->read_bank.lookupEID(ep->second);
+ }
+ }
+
+ for (iep = insert_endpoints.begin(); iep != insert_endpoints.end(); iep++)
+ {
+ cout << " (" << iep->second->m_actual << "," << iep->second->m_libid << ")";
+ }
+
+ cout << endl;
+ }
+
+ dots.update(gindex);
+ }
+ dots.end();
+ }
+ else
+ {
+ map <string, InsertStats *>::iterator fi;
+
+ for (i = m_inserts.begin();
+ i != m_inserts.end();
+ i++)
+ {
+ if ((*i)->m_active == 2)
+ {
+ string fragment;
+
+ if (OPT_SUBLIBRARYLEN == 0)
+ {
+ char buffer[16];
+ sprintf(buffer, "%d", (*i)->m_libid);
+ fragment=buffer;
+ }
+ else
+ {
+ fragment = m_datastore->read_bank.lookupEID((*i)->m_aid).substr(0,OPT_SUBLIBRARYLEN);
+ }
+
+ if (OPT_DETAILS)
+ {
+ ID_t fragid = m_datastore->lookupFragId((*i)->m_aid);
+
+ cout << (*i)->m_libid << "\t"
+ << fragid << "\t"
+ << fragment << "\t"
+ << m_datastore->read_bank.lookupEID((*i)->m_aid) << "\t"
+ << m_datastore->read_bank.lookupEID((*i)->m_bid) << "\t"
+ << (*i)->m_actual << endl;
+ }
+
+ if (OPT_PRINTSUMMARY)
+ {
+ fi = libstats.find(fragment);
+ if (fi == libstats.end())
+ {
+ char buffer[16];
+ sprintf(buffer, "%d", (*i)->m_libid);
+ fi = libstats.insert(make_pair(fragment, new InsertStats(buffer))).first;
+ }
+
+ fi->second->addSize((*i)->m_actual);
+ }
+ }
+
+ delete (*i);
+ }
+ }
+
+ m_inserts.clear();
+}
+
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+ Read_t red;
+ Fragment_t frg;
+ Library_t lib;
+
+ InsertList_t m_inserts;
+
+
+ Scaffold_t scaff;
+ Contig_t contig;
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ m_datastore = new DataStore();
+ m_datastore->openBank(OPT_BankName);
+
+
+ map <string, InsertStats *>::iterator fi;
+
+ if (OPT_PROCESSSCAFFOLDS && m_datastore->scaffold_bank.isOpen())
+ {
+ cerr << "Processing scaffolds..." << endl;
+
+ set<ID_t> seencontigs;
+
+ m_datastore->scaffold_bank.seekg(1);
+ while (m_datastore->scaffold_bank >> scaff)
+ {
+ vector <Tile_t> rtiling;
+ m_datastore->mapReadsToScaffold(scaff, rtiling, 1);
+ m_datastore->calculateInserts(rtiling, m_inserts, m_connectMates, 0);
+ processInserts(scaff.getEID(), m_inserts, rtiling);
+
+ vector<Tile_t>::iterator ci;
+ for (ci = scaff.getContigTiling().begin();
+ ci != scaff.getContigTiling().end();
+ ci++)
+ {
+ seencontigs.insert(ci->source);
+ }
+ }
+
+ if (OPT_UNPLACED)
+ {
+ cerr << "Processing unplaced contigs..." << endl;
+ m_datastore->contig_bank.seekg(1);
+
+ set<ID_t>::iterator si;
+
+ while (m_datastore->contig_bank >> contig)
+ {
+ si = seencontigs.find(contig.getIID());
+
+ if (si == seencontigs.end())
+ {
+ m_datastore->calculateInserts(contig.getReadTiling(), m_inserts, m_connectMates, 0);
+ processInserts(contig.getEID(), m_inserts, contig.getReadTiling());
+ }
+ }
+ }
+ }
+ else
+ {
+ cerr << "Processing contigs..." << endl;
+
+ m_datastore->contig_bank.seekg(1);
+ while (m_datastore->contig_bank >> contig)
+ {
+ m_datastore->calculateInserts(contig.getReadTiling(), m_inserts, m_connectMates, 0);
+ processInserts(contig.getEID(), m_inserts, contig.getReadTiling());
+ }
+ }
+
+ if (OPT_PRINTSUMMARY)
+ {
+ cout << "SubLibrary (k=" << OPT_SUBLIBRARYLEN <<") Summaries" << endl;
+ for (fi = libstats.begin(); fi != libstats.end(); fi++)
+ {
+ cout << fi->second->m_label << "\t"
+ << fi->first << "\t"
+ << fi->second->count() << "\t"
+ << fi->second->mean() << "\t"
+ << fi->second->stdev() << endl;
+ }
+ }
+
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "Shsdvf:cCU")) != EOF) )
+ {
+ switch (ch)
+ {
+ case 'h': PrintHelp (argv[0]); exit (EXIT_SUCCESS); break;
+ case 'v': PrintBankVersion (argv[0]); exit (EXIT_SUCCESS); break;
+ case 's': OPT_BankSpy = true; break;
+ case 'd': OPT_DETAILS = true; break;
+ case 'S': OPT_PRINTSUMMARY = false; break;
+ case 'f': OPT_SUBLIBRARYLEN = atoi(optarg); break;
+ case 'c': OPT_PROCESSSCAFFOLDS = false; break;
+ case 'C': OPT_COVERAGE = true; OPT_PRINTSUMMARY = false; break;
+ case 'U': OPT_UNPLACED = true; break;
+
+ default:
+ errflg ++;
+ };
+ }
+
+ if (errflg > 0 || optind != argc - 1)
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+
+ OPT_BankName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "Options:\n"
+ << "-h Display help information\n"
+ << "-s Disregard bank locks and write permissions (spy mode)\n"
+ << "-v Display the compatible bank version\n"
+ << "-f len Number of characters of seqname to use as sublibrary (default=0)\n"
+ << "-d Show details for each insert\n"
+ << "-S Don't print library summaries\n"
+ << "-c Don't use scaffold information\n"
+ << "-C Print coverage information\n"
+ << "-U Also process contigs not placed into a scaffold\n"
+ << "\n"
+ << "Print information on the observed sizes of inserts grouped by library\n"
+ << "or sublibrary. Both reads have to be in the same scaffold (or unplaced\n"
+ << "contig) for the insert to be reported. A sublibrary is defined by the\n"
+ << "first k characters of the sequence name. By default, k=0 and it\n"
+ << "reports on the whole library, use -f to set a new length.\n"
+ << "\n"
+ << "By default, only print the SubLibrary summaries:\n"
+ << "Libid SubLibrary Count Mean StDev\n"
+ << "\n"
+ << "Use details mode (-d) to also print the size for all inserts:\n"
+ << "Libid FragmentID SubLibrary Read1 Read2 Size\n"
+ << "\n"
+ << "In Coverage mode (-C) also print read, insert coverage:\n"
+ << "eid, pos, read_coverage, insert_coverage, list of (insert size, library) pairs\n"
+ << endl;
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr
+ << "\nUSAGE: " << s << " [options] <bank path>\n\n";
+ return;
+}
diff --git a/src/Validation/library-histogram.cc b/src/Validation/library-histogram.cc
new file mode 100644
index 0000000..cf8797d
--- /dev/null
+++ b/src/Validation/library-histogram.cc
@@ -0,0 +1,235 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 03/08/2004
+//!
+//! \brief Dumps a bambus .mates file from an AMOS bank
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <cassert>
+#include <unistd.h>
+#include <map>
+#include <cmath>
+
+#include "DataStore.hh"
+#include "Insert.hh"
+#include "InsertStats.hh"
+#include <stdio.h>
+
+using namespace std;
+using namespace AMOS;
+
+typedef HASHMAP::hash_map<ID_t, Tile_t *> SeqTileMap_t;
+
+int FRAGMENTSTRLEN = 3;
+int m_verbose = 1;
+
+DataStore * m_datastore;
+int m_connectMates = 1;
+
+
+
+//=============================================================== Globals ====//
+string OPT_BankName; // bank name parameter
+bool OPT_BankSpy = false; // read or read-only spy
+
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+ Read_t red;
+ Fragment_t frg;
+ Library_t lib;
+
+
+ Scaffold_t scaff;
+ Contig_t contig;
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ m_datastore = new DataStore();
+ m_datastore->openBank(OPT_BankName);
+
+ map<ID_t, InsertStats *> librarystats;
+ map<ID_t, InsertStats *>::iterator li;
+
+ m_datastore->contig_bank.seekg(1);
+
+ int contigcount = 0;
+
+ Contig_t contig;
+ m_datastore->contig_bank.seekg(1);
+ while (m_datastore->contig_bank >> contig)
+ {
+ contigcount++;
+ vector<Insert *> inserts;
+ vector<Insert *>::iterator vi;
+ m_datastore->calculateInserts(contig.getReadTiling(), inserts, 1, 0);
+
+ for (vi = inserts.begin(); vi != inserts.end(); vi++)
+ {
+ if ((*vi)->ceConnected())
+ {
+ li = librarystats.find((*vi)->m_libid);
+
+ if (li == librarystats.end())
+ {
+ li = librarystats.insert(make_pair((*vi)->m_libid, new InsertStats(""))).first;
+ }
+
+ li->second->addSize((*vi)->m_actual);
+ }
+
+ delete *vi;
+ }
+ }
+
+ cout << "contigs: " << contigcount << endl;
+
+ for (li = librarystats.begin(); li != librarystats.end(); li++)
+ {
+ cout << endl;
+ cout << "library: " << li->first
+ << " count: " << li->second->count()
+ << " mean: " << li->second->mean()
+ << " stdev: " << li->second->stdev() << endl;
+
+ int buckets = 50;
+ li->second->histogram(buckets, false);
+ cout << "low: " << li->second->m_low
+ << " high: " << li->second->m_high
+ << " buckets: " << buckets
+ << " bucketsize: " << li->second->m_bucketsize << endl;
+
+ double starsize = li->second->m_maxcount / 40.0;
+
+ for (int i = 0; i < buckets; i++)
+ {
+ printf("%10.02f %6d: ", li->second->m_bucketlow[i], li->second->m_buckets[i]);
+
+ int numstars = floor(li->second->m_buckets[i] / starsize);
+
+ if (numstars > 40) { cerr << "ERROR: numstars: " << numstars; }
+ else
+ {
+ for (int j = 0; j < numstars; j++)
+ {
+ cout << "*";
+ }
+ }
+
+ cout << endl;
+ }
+ }
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hsvf:")) != EOF) )
+ switch (ch)
+ {
+ case 'h': PrintHelp (argv[0]); exit (EXIT_SUCCESS); break;
+
+ case 's': OPT_BankSpy = true; break;
+
+ case 'v': PrintBankVersion (argv[0]); exit (EXIT_SUCCESS); break;
+
+ case 'f': FRAGMENTSTRLEN = atoi(optarg); break;
+
+
+ default:
+ errflg ++;
+ }
+
+ if (errflg > 0 || optind != argc - 1)
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+
+ OPT_BankName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "-h Display help information\n"
+ << "-s Disregard bank locks and write permissions (spy mode)\n"
+ << "-v Display the compatible bank version\n"
+ << "-f len Number of characters of seqname to use as sublibrary (default=3)\n"
+ << endl;
+ cerr
+ << "Finds all reads that should overlap a given contig range. Includes reads that\n"
+ << "should be present by the virtue of their mate and the scaffold\n\n";
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr
+ << "\nUSAGE: " << s << " [options] <bank path>\n\n";
+ return;
+}
diff --git a/src/Validation/list-linked-contigs.cc b/src/Validation/list-linked-contigs.cc
new file mode 100644
index 0000000..1e16a60
--- /dev/null
+++ b/src/Validation/list-linked-contigs.cc
@@ -0,0 +1,220 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Michael Schatz
+//! \date 1/25/06
+//!
+//! \brief Finds unplaced contigs that link to a single other contig
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <cassert>
+#include <unistd.h>
+#include <map>
+#include <cmath>
+
+#include "DataStore.hh"
+#include "Insert.hh"
+#include "InsertStats.hh"
+#include <stdio.h>
+
+using namespace std;
+using namespace AMOS;
+
+typedef HASHMAP::hash_map<ID_t, Tile_t *> SeqTileMap_t;
+
+int FRAGMENTSTRLEN = 3;
+int m_verbose = 1;
+
+DataStore * m_datastore;
+int m_connectMates = 1;
+
+
+
+//=============================================================== Globals ====//
+string OPT_BankName; // bank name parameter
+bool OPT_BankSpy = false; // read or read-only spy
+
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+ Read_t red;
+ Fragment_t frg;
+ Library_t lib;
+
+
+ Scaffold_t scaff;
+ Contig_t contig;
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ m_datastore = new DataStore();
+ m_datastore->openBank(OPT_BankName);
+
+ map<ID_t, InsertStats *> librarystats;
+ map<ID_t, InsertStats *>::iterator li;
+
+ m_datastore->contig_bank.seekg(1);
+
+ int contigcount = 0;
+
+ Contig_t contig;
+ m_datastore->contig_bank.seekg(1);
+ while (m_datastore->contig_bank >> contig)
+ {
+ if (contig.getStatus() == 'U')
+ {
+ contigcount++;
+ vector<Insert *> inserts;
+ vector<Insert *>::iterator vi;
+ m_datastore->calculateInserts(contig.getReadTiling(), inserts, 1, 0);
+
+ map<ID_t, int> linkedcontigs;
+ map<ID_t, int>::iterator li;
+
+ for (vi = inserts.begin(); vi != inserts.end(); vi++)
+ {
+ if ((*vi)->m_state == Insert::LinkingMate)
+ {
+ li = linkedcontigs.find((*vi)->m_bcontig);
+
+ if (li == linkedcontigs.end())
+ {
+ li = linkedcontigs.insert(make_pair((*vi)->m_bcontig, 0)).first;
+ }
+
+ li->second++;
+ }
+
+ delete *vi;
+ }
+
+ cout << contig.getIID();
+
+ for (li = linkedcontigs.begin(); li != linkedcontigs.end(); li++)
+ {
+ cout << "\t" << li->first << "\t[" << li->second << "]";
+ }
+
+ if (linkedcontigs.size() == 1)
+ {
+ cout << "*";
+ }
+
+ cout << endl;
+ }
+ }
+
+ cout << "contigs: " << contigcount << endl;
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hsvf:")) != EOF) )
+ switch (ch)
+ {
+ case 'h': PrintHelp (argv[0]); exit (EXIT_SUCCESS); break;
+
+ case 's': OPT_BankSpy = true; break;
+
+ case 'v': PrintBankVersion (argv[0]); exit (EXIT_SUCCESS); break;
+
+ case 'f': FRAGMENTSTRLEN = atoi(optarg); break;
+
+
+ default:
+ errflg ++;
+ }
+
+ if (errflg > 0 || optind != argc - 1)
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+
+ OPT_BankName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "-h Display help information\n"
+ << "-s Disregard bank locks and write permissions (spy mode)\n"
+ << "-v Display the compatible bank version\n"
+ << "-f len Number of characters of seqname to use as sublibrary (default=3)\n"
+ << endl;
+ cerr
+ << "Finds all reads that should overlap a given contig range. Includes reads that\n"
+ << "should be present by the virtue of their mate and the scaffold\n\n";
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr
+ << "\nUSAGE: " << s << " [options] <bank path>\n\n";
+ return;
+}
diff --git a/src/Validation/listSingletonMates.cc b/src/Validation/listSingletonMates.cc
new file mode 100644
index 0000000..dde79e3
--- /dev/null
+++ b/src/Validation/listSingletonMates.cc
@@ -0,0 +1,204 @@
+#include "foundation_AMOS.hh"
+#include <iostream>
+#include <cassert>
+#include <unistd.h>
+#include <map>
+#include <cmath>
+
+#include "DataStore.hh"
+#include "Insert.hh"
+#include "InsertStats.hh"
+
+using namespace std;
+using namespace AMOS;
+
+typedef HASHMAP::hash_map<ID_t, Tile_t *> SeqTileMap_t;
+
+int FRAGMENTSTRLEN = 3;
+int m_verbose = 0;
+
+DataStore * m_datastore;
+int m_connectMates = 1;
+typedef std::vector<Insert *> InsertList_t;
+InsertList_t m_inserts;
+
+//=============================================================== Globals ====//
+string OPT_BankName; // bank name parameter
+bool OPT_BankSpy = false; // read or read-only spy
+
+
+//========================================================== Fuction Decs ====//
+//----------------------------------------------------- ParseArgs --------------
+//! \brief Sets the global OPT_% values from the command line arguments
+//!
+//! \return void
+//!
+void ParseArgs (int argc, char ** argv);
+
+
+//----------------------------------------------------- PrintHelp --------------
+//! \brief Prints help information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintHelp (const char * s);
+
+
+//----------------------------------------------------- PrintUsage -------------
+//! \brief Prints usage information to cerr
+//!
+//! \param s The program name, i.e. argv[0]
+//! \return void
+//!
+void PrintUsage (const char * s);
+
+void processInserts()
+{
+ map <string, InsertStats *>::iterator fi;
+ vector<Insert *>::iterator i;
+
+ for (i = m_inserts.begin();
+ i != m_inserts.end();
+ i++)
+ {
+ if ((*i)->m_state == Insert::SingletonMate || (*i)->m_state == Insert::LinkingMate)
+ {
+ cout << (*i)->m_acontig << " "
+ << m_datastore->read_bank.lookupEID((*i)->m_aid) << " "
+ << m_datastore->read_bank.lookupEID((*i)->m_bid) << " "
+ << (char)(*i)->m_state << endl;
+ }
+
+ delete (*i);
+ }
+
+ m_inserts.clear();
+}
+
+
+
+
+//========================================================= Function Defs ====//
+int main (int argc, char ** argv)
+{
+ int exitcode = EXIT_SUCCESS;
+ Read_t red;
+ Fragment_t frg;
+ Library_t lib;
+
+
+ Scaffold_t scaff;
+ Contig_t contig;
+
+ //-- Parse the command line arguments
+ ParseArgs (argc, argv);
+
+ //-- BEGIN: MAIN EXCEPTION CATCH
+ try {
+
+ m_datastore = new DataStore();
+ m_datastore->openBank(OPT_BankName);
+
+
+ map <string, InsertStats *>::iterator fi;
+
+ if (m_datastore->scaffold_bank.isOpen())
+ {
+ cerr << "Processing scaffolds... ";
+
+ m_datastore->scaffold_bank.seekg(1);
+ while (m_datastore->scaffold_bank >> scaff)
+ {
+ vector <Tile_t> rtiling;
+ m_datastore->mapReadsToScaffold(scaff, rtiling, 1);
+ m_datastore->calculateInserts(rtiling, m_inserts, m_connectMates, 1);
+ processInserts();
+ }
+ }
+ else
+ {
+ cerr << "Processing contigs... ";
+
+ m_datastore->contig_bank.seekg(1);
+ while (m_datastore->contig_bank >> contig)
+ {
+ m_datastore->calculateInserts(contig.getReadTiling(), m_inserts, m_connectMates, 1);
+ processInserts();
+ }
+ }
+
+ }
+ catch (const Exception_t & e) {
+ cerr << "FATAL: " << e . what( ) << endl
+ << " there has been a fatal error, abort" << endl;
+ exitcode = EXIT_FAILURE;
+ }
+ //-- END: MAIN EXCEPTION CATCH
+
+
+ return exitcode;
+}
+
+
+
+
+//------------------------------------------------------------- ParseArgs ----//
+void ParseArgs (int argc, char ** argv)
+{
+ int ch, errflg = 0;
+ optarg = NULL;
+
+ while ( !errflg && ((ch = getopt (argc, argv, "hsdvf:")) != EOF) )
+ switch (ch)
+ {
+ case 'h': PrintHelp (argv[0]); exit (EXIT_SUCCESS); break;
+
+ case 's': OPT_BankSpy = true; break;
+
+ case 'v': PrintBankVersion (argv[0]); exit (EXIT_SUCCESS); break;
+
+ default:
+ errflg ++;
+ }
+
+ if (errflg > 0 || optind != argc - 1)
+ {
+ PrintUsage (argv[0]);
+ cerr << "Try '" << argv[0] << " -h' for more information.\n";
+ exit (EXIT_FAILURE);
+ }
+
+
+ OPT_BankName = argv [optind ++];
+}
+
+
+
+
+//------------------------------------------------------------- PrintHelp ----//
+void PrintHelp (const char * s)
+{
+ PrintUsage (s);
+ cerr
+ << "Output:\n"
+ << "contigiid placedread missingmate type\n"
+ << "\n"
+ << "Options:\n"
+ << "-h Display help information\n"
+ << "-s Disregard bank locks and write permissions (spy mode)\n"
+ << "-v Display the compatible bank version\n"
+ << endl;
+ return;
+}
+
+
+
+
+//------------------------------------------------------------ PrintUsage ----//
+void PrintUsage (const char * s)
+{
+ cerr
+ << "\nUSAGE: " << s << " [options] <bank path>\n\n";
+ return;
+}
diff --git a/src/Validation/listSurrogates.pl b/src/Validation/listSurrogates.pl
new file mode 100755
index 0000000..402c3c4
--- /dev/null
+++ b/src/Validation/listSurrogates.pl
@@ -0,0 +1,85 @@
+#!/usr/local/bin/perl -w
+use strict;
+use TIGR::AsmLib;
+use TIGR::Foundation;
+
+my $version = '$Revision$ ';
+
+my $helptext = qq~
+ listSurrogates.pl [-i] fname
+ ~;
+
+my $base = new TIGR::Foundation;
+
+if (! defined $base){
+ print STDERR "Nasty error, hide!\n";
+ exit(1);
+}
+
+$base->setHelpInfo($helptext);
+$version =~ s/\$//g;
+$base->setVersionInfo($version);
+
+my $infile;
+
+my $err = $base->TIGR_GetOptions("i=s" => \$infile);
+
+if ($err == 0){
+ $base->bail("Command line parsing failed. See -h option");
+}
+
+if (! defined $infile){
+ if ($#ARGV < 0){
+ $base->bail("Must specify an input file name. See -h option");
+ } else {
+ $infile = $ARGV[0];
+ }
+}
+
+$base->logLocal("Opening input file $infile", 1);
+open(IN, $infile) ||
+ $base->bail("Cannot open $infile: $!");
+
+
+my $record;
+my %status;
+
+my $utgseqs = 0;
+
+while ($record = getCARecord(\*IN))
+{
+ my ($type, $fields, $recs) = parseCARecord($record);
+
+ if ($type eq "CCO")
+ {
+ my $thiscontig = getCAId($$fields{"acc"});
+ for (my $i = 0; $i <= $#$recs; $i++)
+ {
+ my ($ltype, $lfields, $lrecs) = parseCARecord($$recs[$i]);
+ if ($ltype eq "UPS")
+ {
+ my $thisunitig = getCAId($$lfields{"lid"});
+
+ if ($status{$thisunitig} eq "U" ||
+ $status{$thisunitig} eq "N"){
+ next;
+ }
+
+ my $pos = $$lfields{"pos"};
+ my ($l, $r) = split(',', $pos);
+
+ print "$thiscontig U $l $r SURROGATE $thisunitig $status{$thisunitig}\n";
+ }
+ }
+ }
+ elsif ($type eq "UTG")
+ {
+ my $thisunitig = getCAId($$fields{"acc"});
+ $status{$thisunitig} = $$fields{"sta"};
+ if ($$fields{"sta"} ne "U" &&
+ $$fields{"sta"} ne "N"){
+ $utgseqs += $$fields{"nfr"};
+ }
+ }
+}
+close(IN);
diff --git a/src/Validation/postCAqc.pl b/src/Validation/postCAqc.pl
new file mode 100755
index 0000000..a33bfc4
--- /dev/null
+++ b/src/Validation/postCAqc.pl
@@ -0,0 +1,196 @@
+#!/usr/local/bin/perl
+
+# postCAqc.pl - runs caqc, fixlib and uses an optional reference file to
+# compute new library sizes
+
+use TIGR::Foundation;
+use AMOS::AmosLib;
+use Statistics::Descriptive;
+use File::Spec;
+
+use strict;
+
+my $ca2ctg = "/local/asmg/work/mpop/Tools/CA/ca2ctg.pl";
+my $caqc = "/usr/local/common/caqc";
+my $fixlib = "/local/asmg/work/mpop/Tools/asmQC/fixlib.pl";
+my $nucmer = "/usr/local/common/nucmer";
+my $showtiling = "/usr/local/common/show-tiling";
+
+my $VERSION = '$Revision$ ';
+my $HELP = q~
+ postCAqc -f frg -a asm [-i inserts | -d dstmap ] [-r reference [-circ]]
+
+ -f (frgfile) and -a (asmfile) are required
+ -r (reference) allows to specify a reference molecule against which all
+ reads are placed
+ -circ should really only be used with -r and specifies the reference
+ molecule is circular
+ -i (.inserts file) and -d (dstmap) allow to specify a map from the library
+ ids listed in the .frg file to database ids (cat_nos). The inserts
+ file is automatically generated by pullfrag and the dstmap is
+ automatically generated by pfl.pl.
+~;
+
+my $base = new TIGR::Foundation();
+if (! defined $base) {
+ die("A horrible death\n");
+}
+
+
+$base->setVersionInfo($VERSION);
+$base->setHelpInfo($HELP);
+$base->setDebugLevel(1);
+
+my $frgfile;
+my $asmfile;
+my $insertfile;
+my $libmap;
+my $fastafile;
+my $circular;
+my $outfile;
+
+my $err = $base->TIGR_GetOptions("f=s" => \$frgfile,
+ "a=s" => \$asmfile,
+ "circ" => \$circular,
+ "o=s" => \$outfile,
+ "i=s" => \$insertfile,
+ "map=s" => \$libmap,
+ "r=s" => \$fastafile);
+
+
+check_file($frgfile);
+check_file($asmfile);
+check_file($insertfile);
+check_file($libmap);
+check_file($fastafile);
+
+if (! defined $outfile){
+ $base->bail("You must provide an output file with the -o option");
+}
+
+$asmfile =~ /(.*)\.asm$/;
+
+my $tmprefix = "tmp";
+my $tmpdir = $base->getTempDir();
+my $tmpctg = File::Spec->catfile($tmpdir, $tmprefix.'.ctg');
+my $tmpfasta = File::Spec->catfile($tmpdir, $tmprefix.'.fasta');
+my $tmpnucctg = File::Spec->catfile($tmpdir, $tmprefix.'.nuc.ctg');
+my $tmpdelta = File::Spec->catfile($tmpdir, $tmprefix.'.delta');
+my $tmplibqc = File::Spec->catfile($tmpdir, $tmprefix.'.lib.qc');
+
+my $asmprefix = $1;
+my $tmpasmqc = File::Spec->catfile($tmpdir, $asmprefix.'.qc');
+
+my $cmd;
+
+my $loglevel = $base->getDebugLevel();
+# running caqc
+if (defined $asmfile){
+ $cmd = "$caqc -silent $asmfile";
+ $base->logLocal("Running $cmd", 1);
+ system("$cmd");
+} else {
+ system("touch $tmpasmqc");
+}
+
+if (defined $fastafile){
+# need to make a contig file and map all the reads to the fasta file
+# making .ctg file
+
+ if (defined $asmfile){
+ $cmd = "$ca2ctg -i $asmfile -f $frgfile > $tmpctg 2>/dev/null";
+ $base->logLocal("Running $cmd", 1);
+ system($cmd);
+ }
+
+# making a reads.fasta file from the .frg file
+ $base->logLocal("Creating read file", 1);
+ open(FRG, $frgfile) || $base->bail("Cannot open $frgfile: $!\n");
+ open(RDS, ">$tmpfasta") ||
+ $base->bail("Cannot open $tmpfasta:$!\n");
+ while (my $record = getRecord(\*FRG)){
+ my ($type, $fields, $recs) = parseRecord($record);
+ if ($type ne "FRG"){
+ next;
+ }
+
+ my $seqname = $$fields{src};
+ my @lines = split('\n', $seqname);
+ $seqname = join('', @lines);
+ @lines = split('\n', $$fields{seq});
+ my $seq = join('', @lines);
+ my ($cll, $clr) = split(',', $$fields{clr});
+ $seq = substr($seq, $cll, $clr - $cll);
+ printFastaSequence(\*RDS, $seqname, $seq);
+ }
+
+ close(RDS);
+
+ $cmd = "$nucmer $fastafile $tmpfasta -p $tmprefix >/dev/null 2>/dev/null";
+ $base->logLocal("Running $cmd", 1);
+ system($cmd);
+ $cmd = "$showtiling -t $tmpnucctg $tmpdelta >/dev/null";
+ $base->logLocal("Running $cmd", 1);
+ system($cmd);
+ $cmd = "cat $tmpnucctg >> $tmpctg";
+ $base->logLocal("Running $cmd", 1);
+ system($cmd);
+
+ if ($loglevel < 2){ # only erase temps for normal log level
+ $base->logLocal("Removing temporary files");
+ unlink($tmpnucctg);
+ unlink($tmpdelta);
+ unlink($tmpfasta);
+ unlink("$tmprefix.mgaps");
+ unlink("$tmprefix.ntref");
+ unlink("$tmprefix.cluster");
+ }
+
+ $cmd = "$fixlib -f $frgfile -c $tmpctg -o $tmplibqc";
+} else {
+ if (! defined $asmfile){
+ $base->bail("An asmfile (-a) must be provided unless a reference (-r) is specified");
+ }
+ # just run fixlib
+ $cmd = "$fixlib -f $frgfile -a $asmfile -o $tmplibqc";
+}
+
+if (defined $insertfile){
+ $cmd .= " -i $insertfile";
+}
+if (defined $libmap){
+ $cmd .= " -map $libmap";
+}
+if (defined $circular){
+ $cmd .= " -circ";
+}
+
+$base->logLocal("Running $cmd", 1);
+system("$cmd >/dev/null 2>&1");
+
+$cmd = "cat $tmpasmqc $tmplibqc > $outfile";
+$base->logLocal("Running $cmd", 1);
+system($cmd);
+
+if ($loglevel < 2){
+ $base->logLocal("Cleaning up some more", 1);
+ unlink($tmpasmqc);
+ unlink($tmplibqc);
+ if (defined $fastafile){
+ unlink($tmpctg);
+ }
+}
+
+exit(0);
+
+####
+
+sub check_file
+{
+ my $fname = shift;
+
+ if (defined $fname && ! -e $fname){
+ $base->bail("Cannot find file $fname");
+ }
+ return;
+} # check_file
diff --git a/src/Validation/read-cov-plot.cc b/src/Validation/read-cov-plot.cc
new file mode 100644
index 0000000..bf45e09
--- /dev/null
+++ b/src/Validation/read-cov-plot.cc
@@ -0,0 +1,173 @@
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+#include "AMOS_Foundation.hh"
+#include "Feature_AMOS.hh"
+
+using namespace AMOS;
+using namespace std;
+
+int OPT_Scaffold(0);
+int OPT_Stride(1);
+
+void processContig(Contig_t & contig, int base_offset)
+{
+ vector<Tile_t> & tiling = contig.getReadTiling();
+ vector<Tile_t>::const_iterator ti;
+ sort(tiling.begin(), tiling.end(), TileOrderCmp());
+
+ multiset<int> endpoints;
+ multiset<int>::iterator ep, ep2;
+
+ int conslen = contig.getLength();
+
+ ti = tiling.begin();
+
+ for (int offset = 0; offset < conslen; offset++)
+ {
+ ep = endpoints.begin();
+ while ((ep != endpoints.end()) && (*ep < offset))
+ {
+ ep2 = ep;
+ ep++;
+ endpoints.erase(ep2);
+ }
+
+ while ((ti != tiling.end()) && (ti->offset == offset))
+ {
+ int roffset = ti->getRightOffset();
+ endpoints.insert(roffset);
+ ti++;
+ }
+
+ int gpos = offset+base_offset;
+
+ if (gpos % OPT_Stride == 0)
+ {
+ cout << gpos << " " << endpoints.size() << endl;
+ }
+ }
+}
+
+int main (int argc, char ** argv)
+{
+ int retval = 0;
+ AMOS_Foundation * tf = NULL;
+
+ try
+ {
+ string version = "Version 1.0";
+ string dependencies = "";
+ string helptext =
+"Plot the read coverage across contigs/scaffolds\n"
+"Offset is the 0-based gapped coordinate\n"
+"Output:\n"
+">id\n"
+"offset0 depth0\n"
+"offset1 depth1\n"
+"\n"
+" Usage: read-cov-plot [options] bank\n"
+"\n"
+"Options\n"
+"-------------------\n"
+"-S Print scafold coordinates instead of contig coordinates\n"
+"-n <val> Only print every n-th line\n"
+"\n";
+
+ // Instantiate a new TIGR_Foundation object
+ tf = new AMOS_Foundation (version, helptext, dependencies, argc, argv);
+ tf->disableOptionHelp();
+
+ tf->getOptions()->addOptionResult("S", &OPT_Scaffold);
+ tf->getOptions()->addOptionResult("n=i", &OPT_Stride);
+ tf->handleStandardOptions();
+
+ list<string> argvv = tf->getOptions()->getAllOtherData();
+
+ if (argvv.size() != 1)
+ {
+ cerr << "Usage: read-cov-plot [options] bank" << endl;
+ return EXIT_FAILURE;
+ }
+
+ string bankname = argvv.front(); argvv.pop_front();
+ cerr << "Processing " << bankname << " at " << Date() << endl;
+
+ Bank_t contig_bank(Contig_t::NCODE);
+ contig_bank.open(bankname, B_READ|B_SPY);
+
+ const IDMap_t & contigmap = contig_bank.getIDMap();
+ IDMap_t::const_iterator c;
+
+ if (OPT_Scaffold)
+ {
+ Bank_t scaff_bank(Scaffold_t::NCODE);
+ scaff_bank.open(bankname, B_READ|B_SPY);
+
+ const IDMap_t & scaffmap = scaff_bank.getIDMap();
+ IDMap_t::const_iterator s;
+
+ for (s = scaffmap.begin(); s != scaffmap.end(); s++)
+ {
+ Scaffold_t scaff;
+ scaff_bank.fetch(s->iid, scaff);
+
+ cout << ">Scaffold " << s->iid << endl;
+
+ vector<Tile_t> & ctiling = scaff.getContigTiling();
+ vector<Tile_t>::const_iterator ci;
+ for (ci = ctiling.begin(); ci != ctiling.end(); ci++)
+ {
+ Contig_t contig;
+ contig_bank.fetch(ci->source, contig);
+
+ cout << ">Contig " << ci->source << endl;
+
+ if (ci->range.isReverse())
+ {
+ contig.reverseComplement();
+ }
+
+ processContig(contig, ci->offset);
+ }
+ }
+ }
+ else
+ {
+ for (c = contigmap.begin(); c!=contigmap.end(); c++)
+ {
+ Contig_t contig;
+ contig_bank.fetch(c->iid, contig);
+ cout << ">Contig " << c->iid << endl;
+ processContig(contig, 0);
+ }
+ }
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ retval = 1;
+ }
+ catch (const ExitProgramNormally & e)
+ {
+ retval = 0;
+ }
+ catch (const amosException & e)
+ {
+ cerr << e << endl;
+ retval = 100;
+ }
+
+ try
+ {
+ if (tf) delete tf;
+ }
+ catch (const amosException & e)
+ {
+ cerr << "amosException while deleting tf: " << e << endl;
+ retval = 105;
+ }
+
+ cerr << "End: " << Date() << endl;
+ return retval;
+}
diff --git a/src/Validation/scaffoldRange2Ungapped.cc b/src/Validation/scaffoldRange2Ungapped.cc
new file mode 100644
index 0000000..72cabc9
--- /dev/null
+++ b/src/Validation/scaffoldRange2Ungapped.cc
@@ -0,0 +1,220 @@
+//scaffoldRange2Ungapped.cc
+//Allison Regier
+//The program translates a list of scaffold ranges into the
+//equivalent ungapped ranges.
+//Actually, it is only an approximation because this program
+//makes the assumption that contigs within a scaffold
+//do not overlap (or at least that the overlapping regions
+//do not contain any gaps). This may not always be
+//a valid assumption.
+//The basic approach is to count the number of gaps that occur in contigs before
+//the begin coordinate of the gapped range, and the number of gaps that occur in contigs
+//that fall between the begin and end coordinates of the range. We can subtract the number
+//of gaps from the gapped range, which will give us the ungapped coordinates.
+
+#include "foundation_AMOS.hh"
+#include <map>
+#include <getopt.h>
+using namespace std;
+using namespace AMOS;
+
+#define endl "\n"
+
+map<string, string> globals;
+
+void printHelpText()
+{
+ cerr <<
+ "\n"
+ ".NAME.\n"
+ "scaffoldRange2Ungapped - translates a list of gapped scaffold coordinates to ungapped coordinates\n"
+ "\n.USAGE.\n"
+ "-h, -help print out help mesesage\n"
+ "-b, -bank bank where assembly is stored\n"
+ "-f -file file containing list of gapped coordinates in the following form, one per line:\n"
+ "<scaffold_eid> <begin> <end>\n";
+}
+
+bool GetOptions(int argc, char ** argv)
+{
+ static struct option long_options[] =
+ {
+ {"help", 0, 0, 'h'},
+ {"h", 0, 0, 'h'},
+ {"b", 1, 0, 'b'},
+ {"bank", 1, 0, 'b'},
+ {"file", 1, 0, 'f'},
+ {"f", 1, 0, 'f'}
+ };
+ int option_index = 0;
+ int c;
+ while ((c = getopt_long_only(argc, argv, "", long_options, &option_index)) != -1)
+ {
+ switch (c)
+ {
+ case 'h':
+ printHelpText();
+ exit(0);
+ break;
+ case 'b':
+ globals["bank"] = string(optarg);
+ cout << globals["bank"] << endl;
+ break;
+ case 'f':
+ globals["file"] = string(optarg);
+ cout << globals["file"] << endl;
+ break;
+ }
+ }
+ return true;
+}
+
+int main(int argc, char **argv)
+{
+ if (! GetOptions(argc, argv))
+ {
+ cerr << "Command line parsing failed" << endl;
+ printHelpText();
+ exit(1);
+ }
+
+ if (globals.find("bank") == globals.end())
+ {
+ cerr << "A bank must be specified" << endl;
+ exit(1);
+ }
+
+ //Open scaffold bank
+ Bank_t scaffold_bank (Scaffold_t::NCODE);
+
+ if (! scaffold_bank.exists(globals["bank"]))
+ {
+ cerr << "No scaffold account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try
+ {
+ scaffold_bank.open(globals["bank"], B_READ);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Failed to open scaffold account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ //Open contig bank
+ Bank_t contig_bank (Contig_t::NCODE);
+ if (! contig_bank.exists(globals["bank"]))
+ {
+ cerr << "No contig account found in bank " << globals["bank"] << endl;
+ exit(1);
+ }
+ try
+ {
+ contig_bank.open(globals["bank"], B_READ);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "Failed to open contig account in bank " << globals["bank"]
+ << ": " << endl << e << endl;
+ exit(1);
+ }
+
+ //Open input file. One entry per line, in the form:
+ //<scaffold_eid> <begin> <end>
+ ifstream rangeFile;
+ rangeFile.open(globals["file"].c_str(), ifstream::in);
+ if (! rangeFile.is_open())
+ {
+ cerr << "Failed to open input range file " << globals["file"] << endl;
+ exit(1);
+ }
+ string scaffEID;
+ rangeFile >> scaffEID;
+ while (rangeFile) //for each entry in the file
+ {
+ int rangeBegin;
+ int rangeEnd;
+ rangeFile >> rangeBegin;
+ rangeFile >> rangeEnd;
+
+ int total1 = 0; //total number of gaps in the scaffold before the begin coordinate
+ int total2 = 0; //total number of gaps in the scaffold after the begin coordinate but
+ //before the end coordinate
+ Scaffold_t scaffold;
+ scaffold_bank.fetch(scaffEID, scaffold);
+ vector<Tile_t> tiles = scaffold.getContigTiling();
+ //Look through all of the contigs in the scaffold.
+ for (vector<Tile_t>::iterator ti = tiles.begin(); ti != tiles.end(); ti++)
+ {
+ AMOS::ID_t contigIID = ti->source;
+ int offset = ti->offset;
+ Contig_t contig;
+ contig_bank.fetch(contigIID, contig);
+ int contigRangeBegin = ti->range.getLo();
+ int contigRangeEnd = ti->range.getHi();
+ if (offset + contigRangeEnd <= rangeBegin)
+ {
+ //The contig is completely before our range on the scaffold
+ //Therefore, all gaps in this contig are before the begin coordinate
+ total1 = total1 + contig.getLength() - contig.getUngappedLength();
+ }
+ else if (offset <= rangeBegin &&
+ offset + contigRangeEnd > rangeBegin &&
+ offset + contigRangeEnd <= rangeEnd)
+ {
+ //The contig is partially below and partially inside our range on the scaffold
+ //Some of the gaps in the contig are before the begin coordinate, and some are
+ //between the begin and end coordinates. We need to separate them out.
+ Pos_t ungappedBeginOfRange = contig.gap2ungap(rangeBegin - offset - 1);
+ int gapsBelowRange = rangeBegin - offset - 1 - ungappedBeginOfRange;
+ total1 = total1 + gapsBelowRange;
+ int gapsWithinRange = contig.getLength() - contig.getUngappedLength() - gapsBelowRange;
+ total2 = total2 + gapsWithinRange;
+ }
+ else if (offset > rangeBegin &&
+ offset + contigRangeEnd <= rangeEnd)
+ {
+ //The contig is completely inside our range on the scaffold
+ //All gaps in this contig are between the begin and end coordinates
+ total2 = total2 + contig.getLength() - contig.getUngappedLength();
+ }
+ else if (offset <= rangeEnd &&
+ offset > rangeBegin &&
+ offset + contigRangeEnd > rangeEnd)
+ {
+ //The contig is partially inside and partially above our range
+ //Some gaps in the contig fall beteen the begin and end coordinates
+ //We need to separate them out. The gaps that fall after our end
+ //coordinate do not concern us.
+ Pos_t ungappedEndOfRange = contig.gap2ungap(rangeEnd - offset - 1);
+ int gapsWithinRange = rangeEnd - offset - 1 - ungappedEndOfRange;
+ total2 = total2 + gapsWithinRange;
+ }
+ else if (offset <= rangeBegin &&
+ offset + contigRangeEnd > rangeEnd)
+ {
+ //Our range is completely inside the contig
+ //Some gaps in the contig will come before our begin coordinate.
+ //Some will come between the begin and end coordinates. Some
+ //will come after the end coordinate, so we need to separate them all out.
+ Pos_t ungappedBeginOfRange = contig.gap2ungap(rangeBegin - offset - 1);
+ int gapsBelowRange = rangeBegin - offset - 1 - ungappedBeginOfRange;
+ total1 = total1 + gapsBelowRange;
+ Pos_t ungappedEndOfRange = contig.gap2ungap(rangeEnd - offset - 1);
+ int gapsWithinRange = rangeEnd - offset - 1 - ungappedEndOfRange - gapsBelowRange;
+ total2 = total2 + gapsWithinRange;
+ }
+ else
+ {
+ //Do nothing, because the contig comes after our range in the scaffold.
+ //All gaps in this contig come after our range in the scaffold.
+ }
+ }
+ rangeBegin = rangeBegin - total1; //Adjust the begin coordinate based on gaps that come before it
+ rangeEnd = rangeEnd - total1 - total2; //Adjust the end coordinate based on gaps that come before it
+ cout << scaffEID << " " << rangeBegin << " " << rangeEnd << endl;
+ rangeFile >> scaffEID; //Read in the next entry
+ }
+}
diff --git a/src/Validation/suspiciousfeat2region.pl b/src/Validation/suspiciousfeat2region.pl
new file mode 100755
index 0000000..4debaee
--- /dev/null
+++ b/src/Validation/suspiciousfeat2region.pl
@@ -0,0 +1,88 @@
+#!/usr/bin/perl
+use lib "/fs/szdevel/amp/AMOS/Linux-x86_64/lib";
+
+use strict;
+
+my $BUFFER = 2000;
+my $MIN_TYPES = 2;
+
+my $contigid = -1;
+my $rstart;
+my $rend;
+my $laststart;
+my @reasons;
+my %reasonshash;
+
+
+sub printEnd
+{
+ my $nfea = scalar @reasons;
+ my $ntyp = scalar(keys %reasonshash);
+
+ if ( $ntyp >= $MIN_TYPES )
+ {
+ print "$contigid A $rstart $rend MISASSEMBLY feats:$nfea types:$ntyp\t";
+ print join "\t|\t", @reasons;
+ print "\n";
+# print
+# "{FEA\n",
+# "clr:$rstart,$rend\n",
+# "typ:A\n",
+# "src:$contigid,CTG\n",
+# "com:\n",
+# "MISASSEMBLY feats:$nfea types:$ntyp\n";
+# foreach my $reason (@reasons) { print "$reason\n"; }
+# print ".\n}\n";
+ }
+
+ @reasons = ();
+ %reasonshash = ();
+}
+
+
+while (<>)
+{
+ my @vals = split /\s+/, $_;
+
+ my $cid = shift @vals;
+ my $type = shift @vals;
+ my $cstart = shift @vals;
+ my $cend = shift @vals;
+ my $desc = shift @vals;
+
+ if ($cid != $contigid)
+ {
+ printEnd();
+
+ ## new contig
+ $contigid = $cid;
+ $laststart = -10000000;
+ $rstart = -10000000;
+ $rend = -10000000;
+ }
+
+ if ($cstart < $laststart)
+ {
+ die "Features are unsorted!";
+ }
+
+ if ( $cstart > $rend + $BUFFER )
+ {
+ printEnd();
+
+ ## new region
+ $rstart = $cstart;
+ $rend = $cend;
+ }
+ elsif ( $cend > $rend )
+ {
+ $rend = $cend;
+ }
+
+ $laststart = $cstart;
+
+ push @reasons, "$cstart\t$cend\t$type\t$desc @vals";
+ $reasonshash{$desc}++;
+}
+
+printEnd();
diff --git a/src/Validation/tiling2cam.pl b/src/Validation/tiling2cam.pl
new file mode 100755
index 0000000..11bb593
--- /dev/null
+++ b/src/Validation/tiling2cam.pl
@@ -0,0 +1,81 @@
+#!/usr/local/bin/perl
+
+# tiling2cam.pl - creates a celamy file from show-tiling output
+
+my $PAD = 100;
+
+my $refColor = "0refColor: CFF0000 T2 S \# reference";
+my $refColorName = "0refColor";
+my $queryForwColor = "1quForwColor: C00FF00 T2 S \# forward query";
+my $queryForwName = "1quForwColor";
+my $queryRevColor = "2quRevColor: C008F00 T2 S \# reverse query";
+my $queryRevName = "2quRevColor";
+my $offset = 0;
+my $nq = 0;
+my $nr = 0;
+
+print "$refColor\n";
+print "$queryForwColor\n";
+print "$queryRevColor\n";
+
+open(IN, $ARGV[0]) || die ("Cannot open $ARGV[0]: $!\n");
+
+my $lastline = "";
+while ($lastline !~ /^>/){
+ $lastline = <IN>;
+}
+
+do {
+ print STDERR "got $lastline\n";
+ $lastline =~ /^>(\S+) (\d+)/;
+ my $refName = $1;
+ my $reflen = $2;
+ my $firstguy = 1;
+ $lastline = <IN>;
+ while ($lastline !~ /^>/){
+ chomp($lastline);
+ my @fields = split(' ', $lastline);
+
+ if ($firstguy){
+ if ($fields[0] < 0){
+ $offset -= $fields[0];
+ }
+ $firstguy = 0;
+ print "${nr}ref: ", $offset + 1, " A$refColorName ", $offset + $reflen,
+ " R1 \# $refName\n";
+ $nr++;
+ }
+
+ my $col = "";
+ if ($fields[6] eq "-") {
+ $col = $queryRevName;
+ } else {
+ $col = $queryForwName;
+ }
+
+ print "${nq}qu: ", $offset + $fields[0], " A$col ", $offset + $fields[1],
+ " R2 \# $fields[7] ($fields[0], $fields[1])\n";
+ $nq++;
+ if (eof(IN)){
+ last;
+ }
+ $lastline = <IN>;
+ if ($lastline =~ /^>/){
+ $offset += $reflen + $PAD;
+ if ($fields[2] < 0){
+ $offset -= $fields[2];
+ }
+ last;
+ }
+ }
+
+
+ if (eof(IN)){
+ exit(0);
+ }
+
+} while (1);
+
+
+close(IN);
+
diff --git a/src/hawkeye/AlignmentInfo.hh b/src/hawkeye/AlignmentInfo.hh
new file mode 100644
index 0000000..1d239e2
--- /dev/null
+++ b/src/hawkeye/AlignmentInfo.hh
@@ -0,0 +1,43 @@
+#ifndef ALIGNMENTINFO_HH_
+#define ALIGNMENTINFO_HH_ 1
+
+#include <vector>
+
+class AlignmentInfo
+{
+public:
+ AlignmentInfo(): m_startshift(0), m_endshift(0) {}
+ ~AlignmentInfo() {}
+
+ // global numbering -> contig gindex
+ int getContigPos(int gindex)
+ {
+ int retval = gindex - m_startshift;
+ for (unsigned int i = 0; i < m_gaps.size(); i++)
+ {
+ if (m_gaps[i] < gindex-m_startshift) { retval--; }
+ }
+ return retval;
+ }
+
+ // contig gindex -> global numbering
+ inline int getGlobalPos(int gindex)
+ {
+ return gindex;
+ int retval = gindex;
+ for (unsigned int i = 0; i < m_gaps.size(); i++)
+ {
+ if (m_gaps[i] <= gindex) { retval++; }
+ }
+
+ return retval + m_startshift;
+ }
+
+ int m_startshift;
+ int m_endshift;
+ std::vector<int> m_gaps;
+
+};
+
+#endif
+
diff --git a/src/hawkeye/AssemblyStats.cc b/src/hawkeye/AssemblyStats.cc
new file mode 100644
index 0000000..9a62c07
--- /dev/null
+++ b/src/hawkeye/AssemblyStats.cc
@@ -0,0 +1,265 @@
+#include "foundation_AMOS.hh"
+#include "DataStore.hh"
+#include "LaunchPad.hh"
+#include <q3textedit.h>
+#include "amp.hh"
+
+
+#include <vector>
+
+using namespace std;
+using namespace AMOS;
+
+
+#define DIV(a,b) (b?(double(a)/b):0.0)
+
+QString tableString;
+
+static void statsAddRow(QString tag, QString value)
+{
+ tableString += "<tr><td>" + tag + "</td><td>" + value + "</td></tr>";
+}
+
+static void statsAddHeader(QString header)
+{
+ QString s = "<b>" + header + "</b>";
+ statsAddRow(s, " ");
+}
+
+
+static void statsAddRow(QString tag, int value)
+{
+ statsAddRow(tag, QString::number(value, 'g', 12));
+}
+
+static void statsAddRow(QString tag, double value)
+{
+ statsAddRow(tag, QString::number(value, 'f', 2));
+}
+
+
+void LaunchPad::loadAssemblyStatistics()
+{
+ EventTime_t timer;
+ if (m_verbose) { cerr << "Loading AssemblyStats..."; }
+ QCursor orig = cursor();
+
+ statsText->clear();
+ tableString = "<table>";
+
+ if (m_datastore->scaffold_bank.isOpen())
+ {
+ vector<int> bases;
+ vector<int> spans;
+ vector<int> contigs;
+ int totalcontigs = 0;
+ int totalbases = 0;
+ int totalspan = 0;
+ int numscaffolds = 0;
+
+ int largescaffolds = 0;
+ int largescaffoldspan = 0;
+ int largescaffoldThreshold = 2000;
+
+ AMOS::Scaffold_t scf;
+
+ m_datastore->scaffold_bank.seekg(1);
+ while (m_datastore->scaffold_bank >> scf)
+ {
+ int s = scf.getSpan();
+ int b = 0;
+ vector<Tile_t>::const_iterator ci;
+ const vector<Tile_t> & ctiling = scf.getContigTiling();
+ for (ci = ctiling.begin();
+ ci != ctiling.end();
+ ci++)
+ {
+ b+=ci->getGappedLength();
+ }
+
+ totalcontigs += ctiling.size();
+ totalbases += b;
+ totalspan += s;
+
+ contigs.push_back(ctiling.size());
+ spans.push_back(s);
+ bases.push_back(b);
+
+ numscaffolds++;
+
+ if (s >= largescaffoldThreshold)
+ {
+ largescaffolds++;
+ largescaffoldspan += s;
+ }
+ }
+
+ sort(contigs.begin(), contigs.end(), less<int>());
+ sort(bases.begin(), bases.end(), less<int>());
+ sort(spans.begin(), spans.end(), less<int>());
+
+ int n50bases = 0;
+
+ int basesthreshold = totalbases/2;
+ int curbases = 0;
+
+ for (n50bases = numscaffolds-1; n50bases >= 0; n50bases--)
+ {
+ curbases += bases[n50bases];
+ if (curbases >= basesthreshold)
+ {
+ break;
+ }
+ }
+
+
+ statsAddHeader("[Scaffolds]");
+ statsAddRow("TotalScaffolds", numscaffolds);
+ statsAddRow("TotalContigsInScaffolds", totalcontigs);
+ statsAddRow("MeanContigsPerScaffold", DIV(totalcontigs, numscaffolds));
+ statsAddRow("MinContigsPerScaffold", contigs[0]);
+ statsAddRow("MaxContigsPerScaffold", contigs[contigs.size()-1]);
+ statsAddRow(" ", " ");
+
+ statsAddRow("TotalBasesInScaffolds", totalbases);
+ statsAddRow("MeanBasesInScaffolds", DIV(totalbases, numscaffolds));
+ statsAddRow("MaxBasesInScaffolds", bases[numscaffolds-1]);
+ statsAddRow("N50ScaffoldBases", bases[n50bases]);
+ statsAddRow(" ", " ");
+
+
+ statsAddRow("TotalSpanOfScaffolds", totalspan);
+ statsAddRow("MeanSpanOfScaffolds", DIV(totalspan, numscaffolds));
+ statsAddRow("MinScaffoldSpan", spans[0]);
+ statsAddRow("MaxScaffoldSpan", spans[numscaffolds-1]);
+ statsAddRow("IntraScaffoldGaps", totalcontigs - numscaffolds);
+ statsAddRow("2KbScaffolds", largescaffolds);
+ statsAddRow("2KbScaffoldSpan", largescaffoldspan);
+ statsAddRow("2KbScaffoldPercent", DIV(largescaffoldspan, totalspan) * 100.0);
+ statsAddRow("MeanSequenceGapSize", DIV(totalspan-totalbases, totalcontigs-numscaffolds));
+ statsAddRow(" ", " ");
+ }
+
+ int LARGETHRESHOLD = 10000;
+
+ if (m_datastore->contig_bank.isOpen())
+ {
+ AMOS::Contig_t ctg;
+ vector<int> sizes;
+ vector<int> largesizes;
+ vector<int> smallsizes;
+ int totalsize = 0;
+ int totalreads = 0;
+
+ int largecount = 0;
+ int largesize = 0;
+ int largereads = 0;
+
+ int smallcount = 0;
+ int smallsize = 0;
+ int smallreads = 0;
+
+
+ m_datastore->contig_bank.seekg(1);
+ m_datastore->contig_bank.setFixedStoreOnly(true);
+ while (m_datastore->contig_bank >> ctg)
+ {
+ int l = ctg.getLength();
+ int r = ctg.getReadTiling().size();
+
+ sizes.push_back(l);
+ totalsize += l;
+ totalreads += r;
+
+ if (l >= LARGETHRESHOLD)
+ {
+ largecount++;
+ largesize += l;
+ largereads += r;
+ }
+ else
+ {
+ smallcount++;
+ smallsize += l;
+ smallreads += r;
+ }
+ }
+ m_datastore->contig_bank.setFixedStoreOnly(false);
+
+ sort(sizes.begin( ), sizes.end( ), less<int>( ) );
+
+ int thresh = totalsize / 2;
+ int cum = 0;
+ int n50 = 0;
+
+ int maxlarge = 0;
+ int minlarge = 0;
+ int maxsmall = 0;
+ int minsmall = 0;
+
+ for (int i = sizes.size()-1; i >= 0; i--)
+ {
+ int cur = sizes[i];
+ cum += cur;
+
+ if (!n50 && cum >= thresh) { n50 = i; }
+
+ if (cur >= LARGETHRESHOLD)
+ {
+ if (maxlarge == 0){maxlarge = cur;}
+ minlarge = cur;
+ }
+ else
+ {
+ if (maxsmall == 0){maxsmall = cur;}
+ minsmall = cur;
+ }
+ }
+
+
+ // Contigs
+
+ statsAddHeader("[Contigs]");
+ statsAddRow("TotalContigs", (int)m_datastore->contig_bank.getSize());
+ statsAddRow("TotalBasesInContigs", totalsize);
+ statsAddRow("MeanContigSize", DIV(totalsize, sizes.size()));
+ statsAddRow("MinContigSize", sizes[0]);
+ statsAddRow("MaxContigSize", sizes[sizes.size()-1]);
+ statsAddRow("N50ContigBases", sizes[n50]);
+ statsAddRow(" ", " ");
+
+ // Big Contigs
+ statsAddHeader(QString("[BigContigs_greater_") + QString::number(LARGETHRESHOLD) + "]");
+ statsAddRow("TotalBigContigs", largecount);
+ statsAddRow("BigContigLength", largesize);
+ statsAddRow("MeanBigContigSize", DIV(largesize,largecount));
+ statsAddRow("MinBigContig", minlarge);
+ statsAddRow("MaxBigContig", maxlarge);
+ statsAddRow("BigContigsPercentBases", DIV(largesize,totalsize)*100.0);
+ statsAddRow(" ", " ");
+
+ // Small Contigs
+ statsAddHeader("[SmallContigs]");
+ statsAddRow("TotalSmallContigs", smallcount);
+ statsAddRow("SmallContigLength", smallsize);
+ statsAddRow("MeanSmallContigSize", DIV(smallsize, smallcount));
+ statsAddRow("MinSmallContig", minsmall);
+ statsAddRow("MaxSmallContig", maxsmall);
+ statsAddRow("SmallContigsPercentBases", DIV(smallsize,totalsize)*100.0);
+ statsAddRow(" ", " ");
+
+
+ // Reads
+ statsAddHeader("[Reads]");
+ statsAddRow("TotalReads", (int)m_datastore->read_bank.getSize());
+ statsAddRow("ReadsInContigs", totalreads);
+ statsAddRow("BigContigReads", largereads);
+ statsAddRow("SmallContigReads", smallreads);
+ statsAddRow("SingletonReads", (int) m_datastore->read_bank.getSize() - totalreads);
+ }
+
+ tableString += "</table>";
+
+ statsText->setText(tableString);
+ if (m_verbose) { cerr << timer.str() << endl; }
+}
diff --git a/src/hawkeye/AssemblyStats.hh b/src/hawkeye/AssemblyStats.hh
new file mode 100644
index 0000000..ccc2341
--- /dev/null
+++ b/src/hawkeye/AssemblyStats.hh
@@ -0,0 +1,6 @@
+#ifndef ASSEMBLY_STATS_HH
+#define ASSEMBLY_STATS_HH 1
+
+#include "LaunchPad.hh"
+
+#endif
diff --git a/src/hawkeye/BufferedLineEdit.cc b/src/hawkeye/BufferedLineEdit.cc
new file mode 100644
index 0000000..ddbc1b6
--- /dev/null
+++ b/src/hawkeye/BufferedLineEdit.cc
@@ -0,0 +1,14 @@
+#include "BufferedLineEdit.hh"
+
+BufferedLineEdit::BufferedLineEdit(QWidget * parent, const char * name)
+ : QLineEdit(parent, name)
+{
+ connect (this, SIGNAL(returnPressed()),
+ this, SLOT(handleReturnPressed()));
+}
+
+void BufferedLineEdit::handleReturnPressed()
+{
+ emit newValue(text());
+}
+
diff --git a/src/hawkeye/BufferedLineEdit.hh b/src/hawkeye/BufferedLineEdit.hh
new file mode 100644
index 0000000..46c8e6f
--- /dev/null
+++ b/src/hawkeye/BufferedLineEdit.hh
@@ -0,0 +1,22 @@
+#ifndef BUFFERED_LINE_EDIT
+#define BUFFERED_LINE_EDIT 1
+
+#include <qlineedit.h>
+
+class BufferedLineEdit : public QLineEdit
+{
+ Q_OBJECT
+
+public:
+
+ BufferedLineEdit(QWidget * parent, const char * name=0);
+
+public slots:
+ void handleReturnPressed();
+
+signals:
+ void newValue(const QString & string);
+
+};
+
+#endif
diff --git a/src/hawkeye/CGraphContig.cc b/src/hawkeye/CGraphContig.cc
new file mode 100644
index 0000000..7e3c5c8
--- /dev/null
+++ b/src/hawkeye/CGraphContig.cc
@@ -0,0 +1,90 @@
+#include "CGraphContig.hh"
+
+#include <qpainter.h>
+//Added by qt3to4:
+#include <Q3PointArray>
+
+const int CGraphContig::RTTI = 132546;
+
+using namespace AMOS;
+using namespace std;
+
+CGraphContig::CGraphContig(ID_t id, ContigEdge_t * edge, bool rc,
+ int x, int y, int width, int height,
+ Q3Canvas * canvas)
+ : Q3CanvasRectangle(x, y, width, height, canvas)
+{
+ m_id = id;
+ m_edge = edge;
+ m_rc = rc;
+
+ if (edge)
+ {
+ if (m_id != edge->getContigs().second)
+ {
+ cerr << "edge corruption detected! m_id:" << m_id
+ << " second: " << m_edge->getContigs().second
+ << endl;
+
+ }
+ }
+}
+
+void CGraphContig::drawShape(QPainter & p)
+{
+ p.setPen(Qt::black);
+ p.setBrush(Qt::yellow);
+
+ int contigheight = 40;
+ int contigwidth = 100;
+
+ int x = (int) (this->x());
+ int y = (int) (this->y());
+
+ Q3PointArray forward(5);
+ forward[0] = QPoint(x+0, y+0);
+ forward[1] = QPoint(x+contigwidth-contigheight/2, y+0);
+ forward[2] = QPoint(x+contigwidth, y+contigheight/2);
+ forward[3] = QPoint(x+contigwidth-contigheight/2, y+contigheight);
+ forward[4] = QPoint(x+0, y+contigheight);
+
+ Q3PointArray reverse(5);
+ reverse[0] = QPoint(x+0, y+contigheight/2);
+ reverse[1] = QPoint(x+contigheight/2, y+0);
+ reverse[2] = QPoint(x+contigwidth, y+0);
+ reverse[3] = QPoint(x+contigwidth, y+contigheight);
+ reverse[4] = QPoint(x+contigheight/2, y+contigheight);
+
+ if (m_rc)
+ {
+ p.drawPolygon(reverse);
+ }
+ else
+ {
+ p.drawPolygon(forward);
+ }
+
+ QString s = QString::number(m_id);
+
+ if (m_edge)
+ {
+ s += " {" + QString::number(m_edge->getContigLinks().size()) + "}";
+ s += "\n [" + QString::number(m_edge->getSize()) + "]";
+ }
+
+ p.drawText(x, y, width(), height(),
+ Qt::AlignHCenter | Qt::AlignVCenter, s);
+
+ if (m_edge)
+ {
+ if (m_id != m_edge->getContigs().second)
+ {
+ cerr << "m_edge corruption detected! m_id:" << m_id
+ << " second: " << m_edge->getContigs().second
+ << endl;
+
+ }
+ }
+}
+
+
diff --git a/src/hawkeye/CGraphContig.hh b/src/hawkeye/CGraphContig.hh
new file mode 100644
index 0000000..e44f845
--- /dev/null
+++ b/src/hawkeye/CGraphContig.hh
@@ -0,0 +1,25 @@
+#ifndef CGRAPHCONTIG_HH_
+#define CGRAPHCONTIG_HH_ 1
+
+#include <q3canvas.h>
+#include "foundation_AMOS.hh"
+
+class CGraphContig : public Q3CanvasRectangle
+{
+public:
+ CGraphContig(AMOS::ID_t id, AMOS::ContigEdge_t * edge, bool rc,
+ int x, int y, int width, int height,
+ Q3Canvas * canvas);
+
+ static const int RTTI;
+ int rtti () const { return RTTI; }
+
+ AMOS::ContigEdge_t * m_edge;
+ AMOS::ID_t m_id;
+ bool m_rc;
+
+protected:
+ void drawShape(QPainter & p);
+};
+
+#endif
diff --git a/src/hawkeye/CGraphEdge.cc b/src/hawkeye/CGraphEdge.cc
new file mode 100644
index 0000000..21c74c3
--- /dev/null
+++ b/src/hawkeye/CGraphEdge.cc
@@ -0,0 +1,12 @@
+#include "CGraphEdge.hh"
+
+const int CGraphEdge::RTTI = 132547;
+
+using namespace AMOS;
+
+CGraphEdge::CGraphEdge(ContigEdge_t * edge, Q3Canvas * canvas)
+ : Q3CanvasLine(canvas)
+{
+ m_edge = edge;
+}
+
diff --git a/src/hawkeye/CGraphEdge.hh b/src/hawkeye/CGraphEdge.hh
new file mode 100644
index 0000000..b856cb9
--- /dev/null
+++ b/src/hawkeye/CGraphEdge.hh
@@ -0,0 +1,18 @@
+#ifndef CGRAPHEDGE_HH_
+#define CGRAPHEDGE_HH_ 1
+
+#include <q3canvas.h>
+#include "foundation_AMOS.hh"
+
+class CGraphEdge : public Q3CanvasLine
+{
+public:
+ CGraphEdge(AMOS::ContigEdge_t * edge, Q3Canvas * canvas);
+
+ static const int RTTI;
+ int rtti () const { return RTTI; }
+
+ AMOS::ContigEdge_t * m_edge;
+};
+
+#endif
diff --git a/src/hawkeye/CGraphView.cc b/src/hawkeye/CGraphView.cc
new file mode 100644
index 0000000..6bbac3f
--- /dev/null
+++ b/src/hawkeye/CGraphView.cc
@@ -0,0 +1,34 @@
+#include "CGraphView.hh"
+#include "CGraphContig.hh"
+#include <qmatrix.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+
+using namespace std;
+
+CGraphView::CGraphView(Q3Canvas * canvas, QWidget * parent, const char * name)
+ : Q3CanvasView(canvas, parent, name)
+{
+
+}
+
+void CGraphView::contentsMousePressEvent(QMouseEvent * e)
+{
+ QPoint real = inverseWorldMatrix().map(e->pos());
+ Q3CanvasItemList l = canvas()->collisions(real);
+
+ for (Q3CanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it)
+ {
+ if ((*it)->rtti() == CGraphContig::RTTI)
+ {
+ CGraphContig * contig = (CGraphContig *) *it;
+ cerr << contig->m_id << " selected" << endl;
+ emit setContigId(contig->m_id);
+ }
+ else if ((*it)->rtti() == CGraphEdge::RTTI)
+ {
+ CGraphEdge * edge = (CGraphEdge *) *it;
+ emit edgeSelected(edge->m_edge);
+ }
+ }
+}
diff --git a/src/hawkeye/CGraphView.hh b/src/hawkeye/CGraphView.hh
new file mode 100644
index 0000000..1e2a5a7
--- /dev/null
+++ b/src/hawkeye/CGraphView.hh
@@ -0,0 +1,27 @@
+#ifndef CGRAPHVIEW_HH_
+#define CGRAPHVIEW_HH_ 1
+
+#include <q3canvas.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include "CGraphEdge.hh"
+
+class CGraphView : public Q3CanvasView
+{
+ Q_OBJECT
+
+public:
+ CGraphView(Q3Canvas * canvas,
+ QWidget * parent = 0,
+ const char * name = 0);
+
+signals:
+ void setContigId(int);
+ void edgeSelected(AMOS::ContigEdge_t *);
+
+protected:
+ void contentsMousePressEvent(QMouseEvent * e);
+
+};
+
+#endif
diff --git a/src/hawkeye/CGraphWindow.cc b/src/hawkeye/CGraphWindow.cc
new file mode 100644
index 0000000..1b994b7
--- /dev/null
+++ b/src/hawkeye/CGraphWindow.cc
@@ -0,0 +1,251 @@
+#include "CGraphWindow.hh"
+#include <q3canvas.h>
+#include <qstatusbar.h>
+#include <qsplitter.h>
+
+#include "CGraphContig.hh"
+#include "CGraphView.hh"
+#include "CGraphEdge.hh"
+
+#include "DataStore.hh"
+
+using namespace AMOS;
+using namespace std;
+
+CGraphWindow::CGraphWindow(DataStore * datastore,
+ QWidget * parent,
+ const char * name)
+ : Q3MainWindow(parent, name)
+{
+ setCaption("Contig Graph");
+ m_contigHeight = 40;
+ m_contigWidth = 100;
+ m_gutter = 10;
+
+ m_datastore = datastore;
+ m_canvas = new Q3Canvas(this, "cgcanvas");
+
+ QSplitter * split = new QSplitter(this);
+ split->setOrientation(Qt::Vertical);
+
+ CGraphView * myview = new CGraphView(m_canvas, split, "cgview");
+
+ m_edgeview = new Q3ListView(split, "edgeview");
+ m_edgeview->setRootIsDecorated(true);
+ m_edgeview->setAllColumnsShowFocus(true);
+
+
+ m_edgeview->addColumn("Type");
+ m_edgeview->addColumn("ID");
+ m_edgeview->addColumn("Contig 1");
+ m_edgeview->addColumn("Contig 2");
+ m_edgeview->addColumn("Adjacency");
+ m_edgeview->addColumn("Distance");
+ m_edgeview->addColumn("SD");
+ m_edgeview->addColumn("Weight");
+
+ setCentralWidget(split);
+
+ connect(myview, SIGNAL(setContigId(int)),
+ this, SIGNAL(setContigId(int)));
+
+ connect(myview, SIGNAL(edgeSelected(AMOS::ContigEdge_t *)),
+ this, SLOT(edgeSelected(AMOS::ContigEdge_t *)));
+
+ drawGraph();
+}
+
+void CGraphWindow::drawGraph()
+{
+ // clear and flush
+ Q3CanvasItemList list = m_canvas->allItems();
+ Q3CanvasItemList::Iterator it = list.begin();
+ for (; it != list.end(); ++it) {
+ if ( *it )
+ delete *it;
+ }
+
+ m_edgeview->clear();
+
+ int lineheight = m_contigHeight + m_gutter;
+
+ int leftcount = 0;
+ int rightcount = 0;
+
+ ContigEdge_t edge;
+
+ m_leftcontigs.clear();
+ m_rightcontigs.clear();
+
+ try
+ {
+ m_datastore->edge_bank.seekg(1);
+ while (m_datastore->edge_bank >> edge)
+ {
+ if ((edge.getContigs().first == m_datastore->m_contigId) ||
+ (edge.getContigs().second == m_datastore->m_contigId))
+ {
+ if (edge.getContigs().second == m_datastore->m_contigId)
+ {
+ edge.flip();
+ }
+
+ LinkAdjacency_t adj = edge.getAdjacency();
+
+ QString side;
+
+ if (adj == 'N' || adj == 'I')
+ {
+ m_rightcontigs.push_back(edge);
+ }
+ else
+ {
+ m_leftcontigs.push_back(edge);
+ }
+ }
+ }
+
+ // Draw myself
+ CGraphContig * contig = new CGraphContig(m_datastore->m_contigId, NULL, 0,
+ 2*m_contigWidth+m_gutter, m_gutter,
+ m_contigWidth, m_contigHeight,
+ m_canvas);
+ contig->show();
+
+ // Draw Neighbors
+ vector<ContigEdge_t>::iterator ci;
+ for (ci = m_leftcontigs.begin(), leftcount = 0;
+ ci != m_leftcontigs.end();
+ ci++, leftcount++)
+ {
+ drawNeighbor(&(*ci),
+ m_gutter,
+ leftcount*lineheight+m_gutter,
+ false);
+ }
+
+ for (ci = m_rightcontigs.begin(), rightcount = 0;
+ ci != m_rightcontigs.end();
+ ci++, rightcount++)
+ {
+ drawNeighbor(&(*ci),
+ 4*m_contigWidth+m_gutter,
+ rightcount*lineheight+m_gutter,
+ true);
+ }
+
+ int vmax = (rightcount > leftcount) ? rightcount : leftcount;
+ vmax = (vmax ? vmax : 1);
+
+ m_canvas->resize(5*m_contigWidth+2*m_gutter,vmax*lineheight+m_gutter);
+
+ QString status = "Viewing contig graph for contig " + QString::number(m_datastore->m_contigId);
+ statusBar()->message(status);
+ }
+ catch (Exception_t & e)
+ {
+ QString status = "Contig graph not available";
+ statusBar()->message(status);
+ }
+
+ m_canvas->update();
+}
+
+void CGraphWindow::drawNeighbor(ContigEdge_t * edge,
+ int xpos,
+ int ypos,
+ bool onRight)
+{
+ bool rc = 0;
+ LinkAdjacency_t adj = edge->getAdjacency();
+ if (adj == 'I' || adj == 'O') { rc = 1; }
+
+ CGraphEdge * line = new CGraphEdge(edge, m_canvas);
+ CGraphContig * contig = new CGraphContig(edge->getContigs().second,
+ edge, rc,
+ xpos, ypos,
+ m_contigWidth, m_contigHeight,
+ m_canvas);
+
+ QString side;
+ if (onRight)
+ {
+ side = "Right";
+ line->setPoints(xpos, ypos+m_contigHeight/2,
+ 3*m_contigWidth+m_gutter, m_gutter+m_contigHeight/2);
+ }
+ else
+ {
+ side = "Left";
+ line->setPoints(xpos+m_contigWidth, ypos+m_contigHeight/2,
+ 2*m_contigWidth+m_gutter, m_gutter+m_contigHeight/2);
+ }
+
+ line->setPen(QPen(Qt::black, edge->getContigLinks().size()));
+ line->show();
+ contig->show();
+
+ Q3ListViewItem * edgeitem = new Q3ListViewItem(m_edgeview);
+
+ edgeitem->setText(0, QString("Edge"));
+ edgeitem->setText(1, QString::number(edge->getIID()));
+ edgeitem->setText(2, QString::number(edge->getContigs().first));
+ edgeitem->setText(3, QString::number(edge->getContigs().second));
+ edgeitem->setText(4, side);
+ edgeitem->setText(5, QString::number(edge->getSize()));
+ edgeitem->setText(6, QString::number(edge->getSD()));
+ edgeitem->setText(7, QString::number(edge->getContigLinks().size()));
+
+ vector<ID_t>::const_iterator ii;
+
+ for (ii = edge->getContigLinks().begin();
+ ii != edge->getContigLinks().end();
+ ii++)
+ {
+ ContigLink_t link;
+ m_datastore->link_bank.fetch(*ii, link);
+
+ if (link.getContigs().first != m_datastore->m_contigId)
+ {
+ link.flip();
+ }
+
+ Q3ListViewItem * linkitem = new Q3ListViewItem(edgeitem);
+
+ linkitem->setText(0, QString((QChar)link.getType()));
+ linkitem->setText(1, QString::number(link.getIID()));
+ linkitem->setText(2, QString::number(link.getContigs().first));
+ linkitem->setText(3, QString::number(link.getContigs().second));
+ linkitem->setText(4, QString((QChar) link.getAdjacency()));
+ linkitem->setText(5, QString::number(link.getSize()));
+ linkitem->setText(6, QString::number(link.getSD()));
+ linkitem->setText(7, QString::number(1));
+ }
+}
+
+void CGraphWindow::contigChanged()
+{
+ drawGraph();
+}
+
+void CGraphWindow::edgeSelected(AMOS::ContigEdge_t *edge)
+{
+ QString id = QString::number(edge->getIID());
+ QString status = "Viewing edge " + id;
+ statusBar()->message(status);
+
+ Q3ListViewItem * item = m_edgeview->firstChild();
+
+ while (item)
+ {
+ if (item->text(1) == id)
+ {
+ item->setOpen(true);
+ m_edgeview->setSelected(item, true);
+ m_edgeview->ensureItemVisible(item);
+ break;
+ }
+
+ item = item->nextSibling();
+ }
+}
diff --git a/src/hawkeye/CGraphWindow.hh b/src/hawkeye/CGraphWindow.hh
new file mode 100644
index 0000000..82e9115
--- /dev/null
+++ b/src/hawkeye/CGraphWindow.hh
@@ -0,0 +1,46 @@
+#ifndef CGRAPHWINDOW_HH_
+#define CGRAPHWINDOW_HH_ 1
+
+#include <q3mainwindow.h>
+#include <q3canvas.h>
+#include <q3listview.h>
+
+#include <vector>
+#include "foundation_AMOS.hh"
+
+
+using std::vector;
+
+class DataStore;
+
+class CGraphWindow : public Q3MainWindow
+{
+ Q_OBJECT
+
+public:
+ CGraphWindow(DataStore * datastore, QWidget * parent=0, const char * name=0);
+
+signals:
+ void setContigId(int);
+
+public slots:
+ void contigChanged();
+ void edgeSelected(AMOS::ContigEdge_t *);
+
+private:
+ void drawGraph();
+ void drawNeighbor(AMOS::ContigEdge_t * edge,
+ int xpos, int ypos, bool onRight);
+
+ DataStore * m_datastore;
+ Q3Canvas * m_canvas;
+ Q3ListView * m_edgeview;
+
+ int m_contigWidth;
+ int m_contigHeight;
+ int m_gutter;
+
+ vector<AMOS::ContigEdge_t> m_leftcontigs, m_rightcontigs;
+};
+
+#endif
diff --git a/src/hawkeye/ChromoField.cc b/src/hawkeye/ChromoField.cc
new file mode 100644
index 0000000..9497b05
--- /dev/null
+++ b/src/hawkeye/ChromoField.cc
@@ -0,0 +1,315 @@
+#include "ChromoField.hh"
+#include "RenderSeq.hh"
+#include <qpainter.h>
+#include <qpainterpath.h>
+#include <qpen.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+#include <math.h>
+#include <qstring.h>
+#include <string>
+#include <qpixmap.h>
+
+#include <stdio.h>
+#include "UIElements.hh"
+#include <q3scrollview.h>
+
+using namespace std;
+using namespace AMOS;
+
+extern "C"
+{
+#include <Read.h>
+}
+
+ChromoField::ChromoField(RenderSeq_t * read,
+ const string & cons,
+ const string & cstatus,
+ QWidget *parent,
+ const char *name)
+ :QWidget(parent, name)
+{
+ setPalette(QPalette(UIElements::color_tiling));
+ m_pix = NULL;
+ m_hscale = 2.0;
+
+ m_read = read;
+ if (!m_read->m_trace) { return; }
+
+ Read * m_trace = (Read *) m_read->m_trace;
+
+ int vscale=24;
+ int tickwidth = 2;
+ int maxy = 2000;
+
+ int diam = 5;
+ int fontsize = 10;
+ int gutter = fontsize/2;
+ int lineheight = fontsize+gutter;
+
+ int consposoffset = 5;
+ int clineoffset = consposoffset+lineheight+5;
+ int discoffset = clineoffset+5;
+ int consoffset = discoffset+fontsize;
+
+ int seqoffset = consoffset+lineheight;
+ int qvoffset = seqoffset+lineheight;
+ int slineoffset = qvoffset+lineheight;
+ int sposoffset = slineoffset+5;
+
+
+ int baseline = 180;
+ int tposoffset = baseline + 5;
+
+ int lastTracePos = (int)(m_hscale*m_trace->NPoints);
+
+ m_hoffset = 20;
+ resize (lastTracePos+2*m_hoffset, tposoffset+lineheight+m_hoffset);
+
+ m_pix = new QPixmap(width(), height());
+ m_pix->fill(this, 0, 0);
+
+ QPen pen;
+ QPainter p(m_pix);
+
+ p.translate(m_hoffset, 0);
+
+ vector<int16_t> & m_pos = m_read->m_pos;
+ string & bases = m_read->m_bases;
+ string & quals = m_read->m_quals;
+
+ // tint outside the assembled
+ p.setPen(UIElements::color_tilingoffset);
+ p.setBrush(UIElements::color_tilingoffset);
+
+ if (m_read->m_rangebegin)
+ {
+ int rpos = m_pos[m_read->m_rangebegin];
+ int bpos = m_pos[m_read->m_rangebegin-1];
+
+ int width = (int)(((rpos+bpos)/2)*m_hscale);
+ if (m_read->m_rc) { width = lastTracePos - width; }
+
+ p.drawRect(-5, 2, width+5, height() -4);
+ }
+
+ if (m_read->m_rangeend != (int) bases.length()-1)
+ {
+ int rpos = m_pos[m_read->m_rangeend];
+ int bpos = m_pos[m_read->m_rangeend+1];
+
+ int width = (int)(((rpos+bpos)/2)*m_hscale);
+ if (m_read->m_rc) { width = lastTracePos - width; }
+
+ p.drawRect(width-2, 2,
+ lastTracePos-width+3, height()-4);
+ }
+
+ // Draw the bases and consensus
+ int startgindex = -1;
+ int endgindex = -1;
+
+ QString s;
+
+ int i;
+ for (i = 0; i < (int) m_pos.size(); i++)
+ {
+ int gseqpos = i;
+ if (m_read->m_rc) { gseqpos = bases.size() - i -1; }
+
+ char b = bases[i]; s = b;
+ char qv = quals[i] - AMOS::MIN_QUALITY;
+
+ int hpos = (int)(m_hscale*m_pos[i]);
+ if (m_read->m_rc) { hpos = lastTracePos - hpos; }
+
+ // base
+ p.setPen(UIElements::getBaseColor(b));
+ p.setFont(QFont("Helvetica", fontsize));
+ p.drawText(hpos-20, seqoffset,
+ 40, 20, Qt::AlignHCenter,s);
+
+ // qv
+ p.setFont(QFont("Helvetica", 8));
+ p.drawText(hpos-20, qvoffset,
+ 40, 20, Qt::AlignHCenter,QString::number(qv));
+
+
+ // gseqpos
+ p.setPen(Qt::black);
+ if (b != '-' && (gseqpos % 5 == 0))
+ {
+ p.setFont(QFont("Helvetica", 8));
+ p.drawText(hpos-20, sposoffset,
+ 40, 20, Qt::AlignHCenter, QString::number(gseqpos));
+
+ p.drawLine(hpos, slineoffset-2,
+ hpos, slineoffset+2);
+ }
+
+
+ int gindex = m_read->getGindex(gseqpos);
+ if (gindex >= 0 && gindex < (int) cons.length())
+ {
+ if (startgindex == -1) { startgindex = hpos-fontsize; }
+ else { endgindex = hpos+fontsize; }
+
+ char c = cons[gindex]; s=c;
+
+ // consensus
+ p.setFont(QFont("Helvetica", fontsize));
+ p.setPen(UIElements::getBaseColor(c));
+ p.drawText(hpos-20, consoffset,
+ 40, 20, Qt::AlignHCenter,s);
+
+ p.setPen(Qt::black);
+
+ // consensus dot
+ if (cstatus[gindex] == 'X')
+ {
+ p.setBrush(Qt::SolidPattern);
+ p.setBrush(Qt::black);
+ p.drawEllipse(hpos-diam/2-1, discoffset, diam, diam);
+ }
+
+ // consensus position
+ if (gindex % 5 == 0)
+ {
+ p.setFont(QFont("Helvetica", 8));
+ p.drawText(hpos-20, consposoffset,
+ 40, 20, Qt::AlignHCenter, QString::number(gindex));
+ p.drawLine(hpos, clineoffset-2,
+ hpos, clineoffset+2);
+ }
+ }
+ }
+
+
+ p.setPen(Qt::black);
+
+ // y-axis and ticks
+ int hpos = 0;
+ if (m_read->m_rc) { hpos = lastTracePos; }
+
+ p.drawLine(hpos, baseline, hpos, baseline-(maxy/vscale));
+ for (i = 0; i < maxy; i+=100)
+ {
+
+ int y = baseline-(i/vscale);
+ p.drawLine(hpos-tickwidth, y, hpos+tickwidth, y);
+ }
+
+ // x-axis, ticks, and labels
+ p.drawLine(0, baseline, lastTracePos, baseline);
+ for (i = 0; i < m_trace->NPoints; i+=10)
+ {
+ hpos = (int)(m_hscale*i);
+ if (m_read->m_rc)
+ {
+ hpos = lastTracePos - hpos;
+ }
+
+ // chromo ticks and labels
+ if (i % 50 == 0)
+ {
+ p.setFont(QFont("Helvetica", 8));
+ p.drawText(hpos-20, baseline+10,
+ 40,20,Qt::AlignHCenter,QString::number(i));
+
+ p.drawLine(hpos, baseline+tickwidth,
+ hpos, baseline-tickwidth);
+ }
+ else
+ {
+ p.drawLine(hpos, baseline+1,
+ hpos, baseline-1);
+ }
+ }
+
+ // trace
+ for (int channel = 0; channel < 4; channel++)
+ {
+ unsigned short * trace = NULL;
+ if (m_read->m_rc)
+ {
+ switch (channel)
+ {
+ case 0: trace = m_trace->traceA; UIElements::setBasePen(pen, 'T'); break;
+ case 1: trace = m_trace->traceC; UIElements::setBasePen(pen, 'G'); break;
+ case 2: trace = m_trace->traceG; UIElements::setBasePen(pen, 'C'); break;
+ case 3: trace = m_trace->traceT; UIElements::setBasePen(pen, 'A'); break;
+ };
+ }
+ else
+ {
+ switch (channel)
+ {
+ case 0: trace = m_trace->traceA; UIElements::setBasePen(pen, 'A'); break;
+ case 1: trace = m_trace->traceC; UIElements::setBasePen(pen, 'C'); break;
+ case 2: trace = m_trace->traceG; UIElements::setBasePen(pen, 'G'); break;
+ case 3: trace = m_trace->traceT; UIElements::setBasePen(pen, 'T'); break;
+ };
+ }
+
+ p.setPen(pen);
+
+ QPainterPath path;
+ path.moveTo(0,baseline);
+
+ if (m_read->m_rc)
+ {
+ path.moveTo(lastTracePos, baseline);
+ }
+
+ for (i = 0; i < m_trace->NPoints; i++)
+ {
+ hpos = (int)(m_hscale * i);
+ if (m_read->m_rc) { hpos = lastTracePos - hpos; }
+
+ path.lineTo(hpos,baseline-(trace[i])/vscale);
+ }
+
+ p.drawPath(path);
+ }
+
+ p.setPen(Qt::black);
+ p.drawLine(startgindex, clineoffset, endgindex, clineoffset);
+ p.drawLine(0, slineoffset, lastTracePos, slineoffset);
+
+ p.end();
+}
+
+void ChromoField::paintEvent(QPaintEvent * event)
+{
+ if (m_pix)
+ {
+ QPainter painter(this);
+ painter.drawPixmap(0, 0, *m_pix);
+ }
+}
+
+
+int ChromoField::getWindowPos(int gindex)
+{
+ int retval = 1;
+
+ if (m_pix)
+ {
+ int gseqpos = m_read->getGSeqPos(gindex);
+
+ if (m_read->m_rc)
+ {
+ gseqpos = m_read->m_pos.size() - gseqpos;
+ Read * m_trace = (Read *) m_read->m_trace;
+ retval = (int)((m_trace->NPoints-m_read->m_pos[gseqpos])* m_hscale);
+ }
+ else
+ {
+ retval = (int)(m_read->m_pos[gseqpos]*m_hscale);
+ }
+
+ retval += m_hoffset;
+ }
+
+ return retval;
+}
diff --git a/src/hawkeye/ChromoField.hh b/src/hawkeye/ChromoField.hh
new file mode 100644
index 0000000..5b47609
--- /dev/null
+++ b/src/hawkeye/ChromoField.hh
@@ -0,0 +1,40 @@
+#ifndef CHROMOFIELD_HH_
+#define CHROMOFIELD_HH_
+
+#include <qwidget.h>
+#include <qpixmap.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+#include <string>
+#include <vector>
+
+
+class RenderSeq_t;
+
+class ChromoField: public QWidget
+{
+ Q_OBJECT
+public:
+ ChromoField(RenderSeq_t * read,
+ const std::string & cons,
+ const std::string & cstatus,
+ QWidget *parent=0,
+ const char *name=0);
+
+ int getWindowPos(int gindex);
+
+protected:
+ void paintEvent( QPaintEvent * );
+
+private:
+ RenderSeq_t * m_read;
+
+ QPixmap * m_pix;
+
+ double m_hscale;
+ int m_hoffset;
+};
+
+
+
+#endif
diff --git a/src/hawkeye/ChromoPicker.cc b/src/hawkeye/ChromoPicker.cc
new file mode 100644
index 0000000..c121a36
--- /dev/null
+++ b/src/hawkeye/ChromoPicker.cc
@@ -0,0 +1,157 @@
+#include "ChromoPicker.hh"
+#include <qcursor.h>
+#include <qstatusbar.h>
+
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qtoolbutton.h>
+#include <qcheckbox.h>
+#include <q3popupmenu.h>
+//Added by qt3to4:
+#include <QPixmap>
+
+#include "foundation_AMOS.hh"
+#include "DataStore.hh"
+#include "ChromoStore.hh"
+
+
+#include <vector>
+
+using namespace std;
+
+
+
+class ChromoListItem : public Q3ListViewItem
+{
+public:
+ ChromoListItem(Q3ListView * parent,
+ QString path)
+
+ : Q3ListViewItem(parent, path) {}
+};
+
+
+ChromoPicker::ChromoPicker(QWidget * parent, const char * name)
+ :Q3MainWindow(parent, name)
+{
+ m_table = new Q3ListView(this, "ChromoPickertbl");
+ setCentralWidget(m_table);
+ setCaption("Chromatogram Information");
+ resize(550,500);
+ show();
+
+ ChromoStore * chromostore = ChromoStore::Instance();
+
+ Q3ToolBar * fetchtool = new Q3ToolBar(this, "cmdtools");
+ new QLabel("Trace AutoFetch", fetchtool, "fetchlabel");
+ m_enabled = new QCheckBox("Enable", fetchtool);
+ m_enabled->setChecked(chromostore->m_tracecmdenabled);
+
+ connect(m_enabled, SIGNAL(toggled(bool)),
+ this, SLOT(setTraceCmdEnabled(bool)));
+
+
+ Q3ToolBar * cmdtool = new Q3ToolBar(this, "cmdtools");
+ new QLabel("Command:", cmdtool, "fetchlabel");
+ m_fetchpick = new QLineEdit(cmdtool, "fetchpick");
+ m_fetchpick->setText(chromostore->m_tracecmd.c_str());
+ m_fetchpick->setMinimumWidth(800);
+ m_fetchpick->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding));
+
+ Q3ToolBar * restool = new Q3ToolBar(this, "restools");
+ new QLabel("Result:", restool, "fetchresultlabel");
+ m_fetchresultpick = new QLineEdit(restool, "fetchresultpick");
+ m_fetchresultpick->setText(chromostore->m_tracecmdpath.c_str());
+ m_fetchresultpick->setMinimumWidth(500);
+
+
+ Q3ToolBar * cachetool = new Q3ToolBar(this, "cachetools");
+ new QLabel("Cache:", cachetool, "fetchcachelbl");
+ m_fetchcachepick = new QLineEdit(cachetool, "fetchresultpick");
+ m_fetchcachepick->setText(chromostore->m_tracecache.c_str());
+ m_fetchcachepick->setMinimumWidth(800);
+
+
+ Q3ToolBar * tool = new Q3ToolBar(this, "dbtools");
+ new QLabel("Add Trace Directory:", tool, "pathlbl");
+ m_pathpick = new QLineEdit(tool, "pathpick");
+ m_pathpick->setMinimumWidth(500);
+
+ QToolButton* add = new QToolButton(QPixmap(), "Add", "Add new chromatogram location",
+ this, SLOT(addNew()), tool);
+ add->setText("Add");
+
+
+
+ m_table->addColumn("Directory");
+
+ m_table->setShowSortIndicator(true);
+ m_table->setRootIsDecorated(true);
+ m_table->setAllColumnsShowFocus(true);
+
+ QCursor orig = cursor();
+
+ vector<string>::iterator vi;
+
+ for (vi = chromostore->m_tracepaths.begin();
+ vi != chromostore->m_tracepaths.end();
+ vi++)
+ {
+ new ChromoListItem(m_table, QString(vi->c_str()));
+ }
+
+ setCursor(orig);
+}
+
+void ChromoPicker::itemSelected(Q3ListViewItem * item)
+{
+ //emit highlightRead(atoi(item->text(0)));
+}
+
+void ChromoPicker::selectiid(const QString & iid)
+{
+ cerr << qPrintable(iid) << endl;
+ Q3ListViewItem * item = m_table->findItem(iid, 0);
+ if (item)
+ {
+ m_table->setSelected(item, true);
+ m_table->ensureItemVisible(item);
+ }
+}
+
+void ChromoPicker::selecteid(const QString & eid)
+{
+ cerr << qPrintable(eid) << endl;
+ Q3ListViewItem * item = m_table->findItem(eid, 1);
+ if (item)
+ {
+ m_table->setSelected(item, true);
+ m_table->ensureItemVisible(item);
+ }
+}
+
+void ChromoPicker::acceptSelected()
+{
+ Q3ListViewItem * item = m_table->selectedItem();
+ if (item)
+ {
+ itemSelected(item);
+ }
+}
+
+void ChromoPicker::addNew()
+{
+ if (m_pathpick->text() != "")
+ {
+ ChromoStore * chromostore = ChromoStore::Instance();
+ chromostore->m_tracepaths.push_back((std::string)m_pathpick->text().ascii());
+ new ChromoListItem(m_table, m_pathpick->text());
+ m_pathpick->setText("");
+ }
+}
+
+void ChromoPicker::setTraceCmdEnabled(bool enabled)
+{
+ m_enabled->setChecked(enabled);
+ ChromoStore::Instance()->m_tracecmdenabled = enabled;
+}
diff --git a/src/hawkeye/ChromoPicker.hh b/src/hawkeye/ChromoPicker.hh
new file mode 100644
index 0000000..008ca96
--- /dev/null
+++ b/src/hawkeye/ChromoPicker.hh
@@ -0,0 +1,45 @@
+#ifndef CHROMO_PICKER_HH__
+#define CHROMO_PICKER_HH__ 1
+
+#include <string>
+#include <q3mainwindow.h>
+#include <q3listview.h>
+#include <qcheckbox.h>
+
+#include <qradiobutton.h>
+
+using std::string;
+
+class ChromoPicker : public Q3MainWindow
+{
+ Q_OBJECT
+
+public:
+ ChromoPicker(QWidget * parent, const char * name);
+
+public slots:
+ void itemSelected(Q3ListViewItem * item);
+ void selectiid(const QString & iid);
+ void selecteid(const QString & eid);
+ void acceptSelected();
+ void setTraceCmdEnabled(bool enabled);
+
+
+ void addNew();
+
+signals:
+ void highlightRead(int);
+
+private:
+ Q3ListView * m_table;
+
+ QLineEdit * m_pathpick;
+ QLineEdit * m_fetchpick;
+ QLineEdit * m_fetchresultpick;
+ QLineEdit * m_fetchcachepick;
+ QLineEdit * m_fetchdbpick;
+ QCheckBox * m_enabled;
+};
+
+
+#endif
diff --git a/src/hawkeye/ChromoStore.cc b/src/hawkeye/ChromoStore.cc
new file mode 100644
index 0000000..c8035c1
--- /dev/null
+++ b/src/hawkeye/ChromoStore.cc
@@ -0,0 +1,169 @@
+#include <sys/types.h>
+#include <sys/time.h>
+#include <dirent.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "ChromoStore.hh"
+
+
+using namespace std;
+
+ChromoStore * ChromoStore::Instance ()
+{
+ static ChromoStore inst;
+ return &inst;
+}
+
+ChromoStore::ChromoStore()
+{
+ m_tracepaths.push_back("/local/chromo/Chromatograms/%TRACEDB%/ABISSed/%EID3%/%EID4%/%EID5%/");
+ m_tracepaths.push_back("/local/chromo2/Chromatograms/%TRACEDB%/ABISSed/%EID3%/%EID4%/%EID5%/");
+ m_tracepaths.push_back("/local/chromo3/Chromatograms/%TRACEDB%/ABISSed/%EID3%/%EID4%/%EID5%/");
+
+ m_tracepaths.push_back("/fs/szasmg/Chromatograms/%TRACEDB%/");
+ m_tracepaths.push_back("chromat_dir");
+ m_tracepaths.push_back("../chromat_dir");
+
+ m_tracecache = ".tracecache";
+ m_tracecachecreated = 0;
+ m_tracecmd = "curl \"http://www.ncbi.nlm.nih.gov/Traces/trace.fcgi?cmd=java&val=%EID%\" -s -o %TRACECACHE%/%EID%";
+ m_tracecmdpath = "%TRACECACHE%/%EID%";
+ m_tracecmdenabled = 0;
+}
+
+ChromoStore::~ChromoStore()
+{
+ if (m_tracecachecreated)
+ {
+ cerr << "Cleaning tracecache directory: " << m_tracecache << endl;
+ string cmd = "/bin/rm -rf " + m_tracecache;
+ system(cmd.c_str());
+ }
+}
+
+
+static void replaceAll(string & str,
+ const string & token,
+ const string & value)
+{
+ int startpos;
+ int endpos;
+
+ string searchtoken = "%" + token;
+
+ while ((startpos = str.find(searchtoken)) != str.npos)
+ {
+ string replaceval;
+ endpos = startpos+searchtoken.length();
+
+ if (str[endpos] == '%')
+ {
+ replaceval = value;
+ }
+ else
+ {
+ // Figure out how long of a prefix of value to replace
+ int len = atoi(str.c_str()+endpos);
+ if (len > value.length()) { len = value.length(); }
+
+ // grab the first len characters of value
+ replaceval = value.substr(0, len);
+
+ // find the end token
+ while (str[endpos] != '%' && (endpos < str.length()))
+ {
+ endpos++;
+ }
+ }
+
+ str.replace(startpos, endpos-startpos+1, replaceval);
+ }
+}
+
+string ChromoStore::replaceTraceTokens(const string & str,
+ const string & eid,
+ const string & iid)
+{
+ string result(str);
+
+ replaceAll(result, "TRACECACHE", m_tracecache);
+ replaceAll(result, "TRACEDB", m_tracedb);
+ replaceAll(result, "EID", eid);
+ replaceAll(result, "IID", iid);
+
+ return result;
+}
+
+
+
+extern "C"
+{
+ #include "Read.h"
+}
+
+char * ChromoStore::fetchTrace(const AMOS::Read_t & read,
+ std::vector<int16_t> & positions )
+{
+ string eid = read.getEID();
+
+ char iidarr[16];
+ sprintf(iidarr, "%d", read.getIID());
+ string iid(iidarr);
+
+ Read * trace = NULL;
+
+ string path;
+
+ vector <string>::iterator ci;
+ for (ci = m_tracepaths.begin();
+ ci != m_tracepaths.end() && !trace;
+ ci++)
+ {
+ path = replaceTraceTokens(*ci, eid, iid);
+
+ DIR * dir = opendir(path.c_str());
+ if (dir)
+ {
+ closedir(dir);
+ path += "/" + eid;
+ trace = read_reading((char *)path.c_str(), TT_ANY);
+ }
+ }
+
+ if (!trace && m_tracecmdenabled)
+ {
+ if (!m_tracecachecreated)
+ {
+ int retval = mkdir(m_tracecache.c_str(),
+ S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH );
+ m_tracecachecreated = !retval;
+ }
+
+ string cmd = replaceTraceTokens(m_tracecmd, eid, iid);
+ path = replaceTraceTokens(m_tracecmdpath, eid, iid);
+
+ cerr << "**** Executing: \"" << cmd << "\"" << endl;
+
+ int retval = system(cmd.c_str());
+
+ if (!retval)
+ {
+ trace = read_reading((char *)path.c_str(), TT_ANY);
+ }
+ }
+
+ // Load positions out of trace
+ if (trace && positions.empty() && trace->basePos)
+ {
+ for (int i = 0; i < trace->NBases; i++)
+ {
+ positions.push_back(trace->basePos[i]);
+ }
+ }
+
+ return (char *) trace;
+}
+
+
diff --git a/src/hawkeye/ChromoStore.hh b/src/hawkeye/ChromoStore.hh
new file mode 100644
index 0000000..1822c2c
--- /dev/null
+++ b/src/hawkeye/ChromoStore.hh
@@ -0,0 +1,45 @@
+#ifndef CHROMO_STORE_HH_
+#define CHROMO_STORE_HH_ 1
+
+#include "foundation_AMOS.hh"
+#include <string>
+#include <map>
+#include <vector>
+
+
+class ChromoStore
+{
+public:
+ static ChromoStore * Instance();
+ ~ChromoStore();
+
+ char * fetchTrace(const AMOS::Read_t & read, std::vector<int16_t> & positions);
+
+
+ std::vector <std::string> m_tracepaths;
+ std::string m_tracecache;
+ std::string m_tracecmd;
+ std::string m_tracecmdpath;
+ std::string m_tracedb;
+ bool m_tracecmdenabled;
+
+
+
+
+protected:
+ ChromoStore();
+ ChromoStore(const ChromoStore&);
+ ChromoStore& operator= (const ChromoStore&);
+
+
+private:
+ std::string replaceTraceTokens(const std::string & str,
+ const std::string & eid,
+ const std::string & iid);
+
+ bool m_tracecachecreated;
+
+
+};
+
+#endif
diff --git a/src/hawkeye/ConsensusField.cc b/src/hawkeye/ConsensusField.cc
new file mode 100644
index 0000000..7e761e5
--- /dev/null
+++ b/src/hawkeye/ConsensusField.cc
@@ -0,0 +1,414 @@
+#include "ConsensusField.hh"
+#include <qpixmap.h>
+#include <qpen.h>
+#include <qpainter.h>
+//Added by qt3to4:
+#include <Q3PointArray>
+#include <QPaintEvent>
+#include <Q3Frame>
+#include <QMouseEvent>
+#include "UIElements.hh"
+#include "AlignmentInfo.hh"
+
+using namespace std;
+
+
+static int min (int a, int b)
+{
+ return a < b ? a : b;
+}
+static int max (int a, int b)
+{
+ return a > b ? a : b;
+}
+
+static int m_minheight = 8;
+
+ConsensusField::ConsensusField(const string & cons,
+ const string & cstatus,
+ const string & consqual,
+ const vector<int> & ugpos,
+ AlignmentInfo * ai,
+ int & gindex,
+ int & contigid,
+ QString & contigname,
+ QWidget * parent,
+ const char * name)
+ :Q3Frame(parent, name),
+ m_consensus(cons),
+ m_cstatus(cstatus),
+ m_consqual(consqual),
+ m_ugpos(ugpos),
+ m_alignment(ai),
+ m_gindex(gindex),
+ m_contigId(contigid),
+ m_contigName(contigname),
+ m_readnamewidth(11)
+{
+ m_shownumbers = 0;
+ m_highlightdiscrepancy = 0;
+ m_showIndicator = true;
+ m_basecolors = false;
+
+ m_diam = 5;
+ m_basespace = 5;
+
+ setFontSize(10);
+ setPalette(QPalette(UIElements::color_tiling));
+
+ m_rangestart = -1;
+ m_rangeend = -1;
+ m_displayQV = false;
+ m_showUngapped = false;
+}
+
+void ConsensusField::setFontSize(int fontsize)
+{
+ m_fontsize=fontsize;
+
+ int theight = max(m_fontsize, m_minheight);
+
+
+ int gutter = theight;
+ int framegutter = 2;
+
+ m_lineheight = theight + gutter;
+
+ m_tilehoffset = theight*(m_readnamewidth+1) + framegutter;
+ m_seqnamehoffset = gutter + framegutter;
+ m_basewidth = m_fontsize + m_basespace;
+
+ if (m_packreads)
+ {
+ m_tilehoffset = 2+framegutter;
+ }
+
+ if (m_basewidth <= 0)
+ {
+ m_basewidth = 1/(-m_basewidth+2);
+ }
+
+ m_lineoffset = m_lineheight*2;
+ m_posoffset = m_lineheight*2 + gutter; // hidden by default
+ m_discoffset = m_lineheight*2 + m_diam + m_diam;
+ m_consoffset = m_discoffset + m_diam;
+
+ if (m_shownumbers)
+ {
+ m_consoffset += m_lineheight;
+ m_discoffset += m_lineheight;
+ }
+
+ setMinimumHeight(m_consoffset+m_lineheight+2);
+}
+
+void ConsensusField::toggleShowNumbers(bool doShow)
+{
+ m_shownumbers = doShow;
+ setFontSize(m_fontsize);
+}
+
+#include <QtGui>
+
+void ConsensusField::drawContents(QPainter * p)
+{
+ int theight = max(m_fontsize, m_minheight);
+
+ if (m_consensus.empty())
+ {
+ p->drawText(20, theight+theight/2, "No Contig Loaded");
+ return;
+ }
+
+ int width = this->width();
+
+ QColor bgcolor = UIElements::color_tilingoffset;
+ bgcolor = bgcolor.light(150);
+
+ p->fillRect(rect(), bgcolor);
+
+ p->setRenderHint(QPainter::Antialiasing);
+ p->setRenderHint(QPainter::TextAntialiasing);
+
+ QPen pen;
+ pen.setColor(Qt::black);
+ p->setPen(pen);
+ p->setFont(QFont("Helvetica", theight));
+
+ int displaywidth = (int)((width-m_tilehoffset)/m_basewidth);
+
+
+ if (!m_packreads)
+ {
+ p->drawText(m_seqnamehoffset, m_consoffset,
+ m_tilehoffset - m_seqnamehoffset, m_lineheight,
+ Qt::AlignLeft | Qt::AlignBottom, "Consensus");
+ }
+
+ int grangeStart = m_gindex;
+ int grangeEnd = min(m_gindex + displaywidth, m_consensus.size()-1);
+
+ QString s = "Viewing Contig ";
+ if (!m_contigName.isEmpty())
+ {
+ s += m_contigName + " [" + QString::number(m_contigId) + "]";
+ }
+ else
+ {
+ s += QString::number(m_contigId);
+ }
+
+ s += " from ";
+
+ if (m_showUngapped)
+ {
+ s += QString::number(m_ugpos[grangeStart]) + " to " + QString::number(m_ugpos[grangeEnd]) + " of " + QString::number(m_ugpos[m_consensus.size()-1]);
+ }
+ else
+ {
+ s += QString::number(grangeStart) + " to " + QString::number(grangeEnd) + " of " + QString::number(m_consensus.size());
+ }
+
+ p->drawText(width/2 - 400, 2, 800, m_lineheight, Qt::AlignHCenter | Qt::AlignBottom, s);
+
+ //x-axis
+ p->drawLine(m_tilehoffset, m_lineoffset,
+ (int)(m_tilehoffset+(grangeEnd-grangeStart+1)*m_basewidth), m_lineoffset);
+
+ if (!(m_rangeend < grangeStart || m_rangestart > grangeEnd))
+ {
+ int drawStart = max(m_rangestart, grangeStart);
+ int drawEnd = min(m_rangeend, grangeEnd);
+
+ p->setPen(Qt::red);
+
+ p->drawRect(m_tilehoffset + (int)((drawStart - grangeStart)*m_basewidth - 1),
+ m_consoffset,
+ (int)((drawEnd - drawStart + 1) * m_basewidth - m_basespace + 3),
+ m_lineheight);
+
+ p->setPen(Qt::black);
+ }
+
+
+ int fudge = 0;
+ if (m_displayQV) { fudge = (int) (theight*.25); }
+
+ for (int gindex = grangeStart; gindex <= grangeEnd; gindex++)
+ {
+ int shifted = gindex;
+ if (m_alignment)
+ {
+ shifted = m_alignment->getContigPos(gindex);
+ }
+
+ char b = m_consensus[gindex];
+ s = b;
+
+ p->setFont(QFont("Helvetica", theight));
+ if (m_basecolors)
+ {
+ UIElements::setBasePen(pen, b);
+ p->setPen(pen);
+ }
+
+ int xcoord = (int)(m_tilehoffset + (gindex-grangeStart)*m_basewidth);
+ int bwidth = max((int) m_basewidth, 1);
+
+ if (m_fontsize < m_minheight)
+ {
+ if (m_cstatus[gindex] == 'X')
+ {
+ p->setBrush(UIElements::getBaseColor(b));
+ p->drawRect(xcoord, m_consoffset, bwidth, m_lineheight-1);
+ }
+ }
+ else
+ {
+ p->drawText(xcoord, m_consoffset,
+ theight, m_lineheight,
+ Qt::AlignHCenter | Qt::AlignBottom, s);
+
+ if (m_displayQV)
+ {
+ p->setPen(Qt::black);
+ p->setFont(QFont("Helvetica", (int)(theight*.6)));
+
+ b = m_consqual[gindex];
+ s = QString::number(b-AMOS::MIN_QUALITY);
+
+ p->drawText(xcoord, m_consoffset-theight-5,
+ theight, m_lineheight,
+ Qt::AlignHCenter | Qt::AlignBottom, s);
+ }
+
+ if (m_cstatus[gindex] == 'X' || m_cstatus[gindex] == '*')
+ {
+ p->setBrush(Qt::SolidPattern);
+ if (m_cstatus[gindex] == '*')
+ {
+ p->setPen(Qt::red);
+ p->setBrush(Qt::red);
+ }
+ else
+ {
+ p->setPen(Qt::black);
+ p->setBrush(Qt::black);
+ }
+
+
+ qreal diam = m_diam;
+ p->drawEllipse(xcoord+theight/2-m_diam/2-1, m_discoffset-fudge,
+ diam, diam);
+
+ if (m_highlightdiscrepancy)
+ {
+ p->setBrush(Qt::NoBrush);
+ p->setPen(UIElements::color_discrepancy);
+ p->drawRect(xcoord, m_consoffset, theight, m_lineheight-1);
+ }
+ }
+ }
+
+ p->setPen(Qt::black);
+ int scaledfont = (int)max((int)(theight*.8), 8);
+ p->setFont(QFont("Helvetica", scaledfont));
+
+ int nbreak = 10;
+ int jbreak = 5;
+
+ if (m_fontsize < 1)
+ {
+ nbreak = 100;
+ jbreak = 25;
+
+ if (m_fontsize < -5) { nbreak = 500; jbreak = 100; }
+ }
+
+ int n = shifted%nbreak;
+ int j = shifted%jbreak;
+ if (m_showUngapped) { n = m_ugpos[shifted] % nbreak; j = m_ugpos[shifted] % jbreak; }
+
+ if (m_shownumbers && m_fontsize >= m_minheight)
+ {
+ // Numbers
+ s = QString::number(n);
+ p->drawText(xcoord, m_posoffset,
+ theight, 2*theight,
+ Qt::AlignHCenter | Qt::AlignCenter, s);
+ }
+
+ if (n==0 && m_consensus[gindex] != '*' && (!m_showUngapped || m_consensus[gindex] != '-'))
+ {
+ if (m_showUngapped)
+ {
+ s = QString::number(m_ugpos[gindex]);
+ }
+ else
+ {
+ s = QString::number(m_alignment->getContigPos(gindex));
+ }
+
+ int xpos = xcoord + m_fontsize/2;
+ if (m_fontsize <= 0) { xpos = xcoord; }
+
+ p->drawLine(xpos, m_lineoffset-2,
+ xpos, m_lineoffset+2);
+
+ p->drawText(xpos-50, m_lineheight,
+ 100, theight*2,
+ Qt::AlignHCenter | Qt::AlignCenter, s);
+ }
+ else if (j==0 && m_consensus[gindex] != '*' && (!m_showUngapped || m_consensus[gindex] != '-'))
+ {
+ int xpos = xcoord + m_fontsize/2;
+ if (m_fontsize <= 0) { xpos = xcoord; }
+
+ p->drawLine(xpos, m_lineoffset-1,
+ xpos, m_lineoffset+1);
+ }
+
+
+ if (m_showIndicator && m_fontsize >= m_minheight)
+ {
+ Q3PointArray indicator (3);
+
+ int hbase = (int)(m_tilehoffset + 10*m_basewidth + .25*m_fontsize);
+ int hstep = (int)(.25*m_fontsize);
+
+ indicator[0] = QPoint(hbase, 1);
+ indicator[1] = QPoint(hbase + 2*hstep+1, 1);
+ indicator[2] = QPoint(hbase + hstep, 5);
+
+ p->setPen(Qt::black);
+ p->setBrush(Qt::black);
+ p->drawPolygon(indicator);
+ }
+ }
+}
+
+void ConsensusField::toggleHighlightDiscrepancy(bool show)
+{
+ //m_highlightdiscrepancy = show;
+ //update();
+}
+
+void ConsensusField::toggleBaseColors(bool show)
+{
+ m_basecolors = show;
+ update();
+}
+
+void ConsensusField::togglePackReads(bool pack)
+{
+ m_packreads = pack;
+ setFontSize(m_fontsize);
+ update();
+}
+
+void ConsensusField::toggleShowIndicator(bool show)
+{
+ m_showIndicator = show;
+ update();
+}
+
+void ConsensusField::toggleShowConsQV(bool show)
+{
+ m_displayQV = show;
+ update();
+}
+
+void ConsensusField::toggleShowUngapped(bool use)
+{
+ m_showUngapped = use;
+ update();
+}
+
+void ConsensusField::mouseReleaseEvent( QMouseEvent * e)
+{
+ if (e->x() < (m_tilehoffset - m_basewidth))
+ {
+ emit sortColumns(-1);
+ }
+ else
+ {
+ int gindex = (int)(m_gindex + (e->x() - m_tilehoffset)/m_basewidth);
+ emit sortColumns(gindex);
+ }
+}
+
+void ConsensusField::setHighlightRange(int start, int end)
+{
+ m_rangestart = start;
+ m_rangeend = end;
+}
+
+void ConsensusField::setReadnameWidth(int width)
+{
+ m_readnamewidth = width;
+ setFontSize(m_fontsize);
+ update();
+}
+
+
+
diff --git a/src/hawkeye/ConsensusField.hh b/src/hawkeye/ConsensusField.hh
new file mode 100644
index 0000000..d98271a
--- /dev/null
+++ b/src/hawkeye/ConsensusField.hh
@@ -0,0 +1,85 @@
+#ifndef CONSENSUSFIELD_HH_
+#define CONSENSUSFIELD_HH_ 1
+
+#include <vector>
+#include <string>
+#include <q3frame.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QPaintEvent>
+
+class AlignmentInfo;
+
+class ConsensusField : public Q3Frame
+{
+ Q_OBJECT
+
+public:
+ ConsensusField(const std::string & consensus,
+ const std::string & cstatsus,
+ const std::string & consqual,
+ const std::vector<int> & ugappos,
+ AlignmentInfo * ai,
+ int & gindex,
+ int & contigid,
+ QString & contigname,
+ QWidget *parent=0,
+ const char *name=0);
+ void setWidth(int width) { resize(width, height()); }
+ void mouseReleaseEvent(QMouseEvent * e);
+
+public slots:
+ void setFontSize(int fontsize);
+ void toggleShowNumbers(bool doShow);
+ void toggleShowConsQV(bool doShow);
+ void toggleHighlightDiscrepancy(bool doShow);
+ void toggleBaseColors(bool show);
+ void toggleShowIndicator(bool show);
+ void setHighlightRange(int start, int end);
+ void toggleShowUngapped(bool show);
+ void togglePackReads(bool pack);
+ void setReadnameWidth(int);
+
+signals:
+ void sortColumns(int);
+
+protected:
+ //void paintEvent(QPaintEvent *);
+ void drawContents(QPainter * p);
+
+private:
+ const std::string & m_consensus;
+ const std::string & m_cstatus;
+ const std::string & m_consqual;
+ const std::vector<int> & m_ugpos;
+ AlignmentInfo * m_alignment;
+ int & m_gindex;
+ int & m_contigId;
+ QString & m_contigName;
+
+ int m_fontsize;
+ bool m_shownumbers;
+ bool m_highlightdiscrepancy;
+ bool m_basecolors;
+ bool m_showIndicator;
+ bool m_displayQV;
+ bool m_showUngapped;
+ bool m_packreads;
+
+ int m_lineheight;
+ int m_tilehoffset;
+ int m_seqnamehoffset;
+ double m_basewidth;
+ int m_basespace;
+ int m_diam;
+ int m_lineoffset;
+ int m_posoffset;
+ int m_discoffset;
+ int m_consoffset;
+ int m_readnamewidth;
+
+ int m_rangestart;
+ int m_rangeend;
+};
+
+#endif
diff --git a/src/hawkeye/ContigCanvasItem.cc b/src/hawkeye/ContigCanvasItem.cc
new file mode 100644
index 0000000..34080ca
--- /dev/null
+++ b/src/hawkeye/ContigCanvasItem.cc
@@ -0,0 +1,22 @@
+#include "ContigCanvasItem.hh"
+#include "UIElements.hh"
+#include <qpainter.h>
+
+const int ContigCanvasItem::RTTI = 132556;
+
+ContigCanvasItem::ContigCanvasItem(int x, int y, int width, int height,
+ AMOS::Tile_t tile,
+ Q3Canvas * canvas)
+ : Q3CanvasRectangle(x, y, width, height, canvas), m_tile(tile)
+{
+ if (tile.range.isReverse())
+ {
+ setPen(UIElements::color_RContig);
+ setBrush(UIElements::color_RContig);
+ }
+ else
+ {
+ setPen(UIElements::color_FContig);
+ setBrush(UIElements::color_FContig);
+ }
+}
diff --git a/src/hawkeye/ContigCanvasItem.hh b/src/hawkeye/ContigCanvasItem.hh
new file mode 100644
index 0000000..bad686f
--- /dev/null
+++ b/src/hawkeye/ContigCanvasItem.hh
@@ -0,0 +1,20 @@
+#ifndef CONTIG_CANVAS_ITEM_HH_
+#define CONTIG_CANVAS_ITEM_HH_ 1
+
+#include <q3canvas.h>
+#include "foundation_AMOS.hh"
+
+
+class ContigCanvasItem : public Q3CanvasRectangle
+{
+public:
+ ContigCanvasItem(int x, int y, int width, int height, AMOS::Tile_t tile, Q3Canvas * canvas);
+
+ static const int RTTI;
+ int rtti () const { return RTTI; }
+
+ AMOS::Tile_t m_tile;
+};
+
+
+#endif
diff --git a/src/hawkeye/ContigPicker.cc b/src/hawkeye/ContigPicker.cc
new file mode 100644
index 0000000..2a047c1
--- /dev/null
+++ b/src/hawkeye/ContigPicker.cc
@@ -0,0 +1,310 @@
+#include "LaunchPad.hh"
+#include <qcursor.h>
+#include <qstatusbar.h>
+
+#include <qlabel.h>
+#include <q3toolbar.h>
+#include <qlineedit.h>
+#include <qmenubar.h>
+#include <qcheckbox.h>
+#include "DataStore.hh"
+
+#include "NChartStats.hh"
+#include "HistogramWindow.hh"
+#include "NChartWindow.hh"
+
+#include "foundation_AMOS.hh"
+
+#include <vector>
+#include "amp.hh"
+
+using namespace std;
+using namespace AMOS;
+
+int FIELD_OFFSET=4;
+
+class ContigListItem : public Q3ListViewItem
+{
+public:
+ ContigListItem(Q3ListView * parent,
+ QString id,
+ QString iid,
+ QString eid,
+ QString status,
+ QString length,
+ QString reads,
+ QString coverage,
+ QString gccontent)
+
+ : Q3ListViewItem(parent, id, iid, eid, status, length, reads, coverage, gccontent) {}
+
+ ContigListItem(Q3ListView * parent,
+ QString id,
+ QString iid,
+ QString eid,
+ QString status,
+ QString offset,
+ QString length,
+ QString reads,
+ QString coverage,
+ QString gccontent)
+
+ : Q3ListViewItem(parent, id, iid, eid, status, offset, length, reads, coverage)
+ { setText(8, gccontent); }
+
+ ContigListItem(ContigListItem * parent,
+ QString id,
+ QString iid,
+ QString eid,
+ QString status,
+ QString offset,
+ QString length,
+ QString reads,
+ QString coverage,
+ QString gccontent)
+
+ : Q3ListViewItem(parent, id, iid, eid, status, offset, length, reads, coverage)
+ { setText(8, gccontent); }
+
+ int compare(Q3ListViewItem *i, int col,
+ bool ascending ) const
+ {
+ if (col == 2 || col == 3)
+ {
+ return key(col,ascending).compare(i->key(col,ascending));
+ }
+
+ if ((col == 7) || (col == 8))
+ {
+ double diff = atof(key(col,ascending)) - atof(i->key(col,ascending));
+ if (diff < 0) { return -1; }
+ else if (diff > 0) { return 1;}
+ return 0;
+ }
+
+ return atoi(key(col,ascending)) - atoi(i->key(col,ascending));
+ }
+};
+
+
+
+void LaunchPad::initContigs()
+{
+ connect(contigList, SIGNAL(doubleClicked(Q3ListViewItem *)),
+ this, SLOT(contigSelected(Q3ListViewItem *)));
+
+ connect(contigList, SIGNAL(returnPressed(Q3ListViewItem *)),
+ this, SLOT(contigSelected(Q3ListViewItem *)));
+
+ connect(contigIIDEdit, SIGNAL(textChanged(const QString &)),
+ this, SLOT(contigSelectIID(const QString &)));
+
+ connect(contigEIDEdit, SIGNAL(textChanged(const QString &)),
+ this, SLOT(contigSelectEID(const QString &)));
+
+ connect(contigEIDEdit, SIGNAL(returnPressed()),
+ this, SLOT(contigViewSelected()));
+
+ connect(contigIIDEdit, SIGNAL(returnPressed()),
+ this, SLOT(contigViewSelected()));
+
+ connect(contigLengthButton, SIGNAL(clicked()),
+ this, SLOT(contigLengthHistogram()));
+
+ connect(contigReadsButton, SIGNAL(clicked()),
+ this, SLOT(contigReadCountHistogram()));
+
+ connect(contigCoverageButton, SIGNAL(clicked()),
+ this, SLOT(contigCoverageHistogram()));
+
+ connect(contigGCButton, SIGNAL(clicked()),
+ this, SLOT(contigGCHistogram()));
+
+ connect(readsCheck, SIGNAL(clicked()),
+ this, SLOT(loadContigs()));
+
+ contigList->addColumn("Id");
+ contigList->addColumn("IID");
+ contigList->addColumn("EID");
+ contigList->addColumn("Status");
+ contigList->addColumn("Offset");
+ contigList->addColumn("Length");
+ contigList->addColumn("Reads");
+ contigList->addColumn("Coverage");
+ contigList->addColumn("GC Content");
+}
+
+
+void LaunchPad::loadContigs()
+{
+ EventTime_t timer;
+ if (m_verbose) { cerr << "Loading Contigs..."; }
+
+ QCursor orig = cursor();
+ setCursor(Qt::waitCursor);
+
+ contigList->clear();
+
+ ContigListItem * curItem = NULL;
+
+ try
+ {
+ AMOS::Contig_t contig;
+ QString status = "Select from " +
+ QString::number(m_datastore->contig_bank.getSize()) +
+ " contigs in " + m_datastore->m_bankname.c_str();
+ statusBar()->message(status);
+
+ int contigid = 1;
+ m_datastore->contig_bank.seekg(1);
+ while (m_datastore->contig_bank >> contig)
+ {
+ int contiglen = contig.getLength();
+ int numreads = contig.getReadTiling().size();
+ double coverage = contig.getFoldCov();
+ double gccontent = contig.getGCContent();
+
+ ContigListItem * contigitem;
+
+ contigitem = new ContigListItem(contigList,
+ QString::number(contigid),
+ QString::number(contig.getIID()),
+ QString(contig.getEID().c_str()),
+ QString(QChar(contig.getStatus())),
+ QString(""),
+ QString::number(contiglen),
+ QString::number(numreads),
+ QString::number(coverage, 'f', 2),
+ QString::number(gccontent, 'f', 4));
+
+ if (contigid == m_datastore->m_contigId)
+ {
+ curItem = contigitem;
+ }
+
+ contigid++;
+
+ if (readsCheck->isChecked())
+ {
+ vector<AMOS::Tile_t>::iterator ti;
+ for (ti = contig.getReadTiling().begin();
+ ti != contig.getReadTiling().end();
+ ti++)
+ {
+ new ContigListItem(contigitem,
+ QString("Read"),
+ QString::number(ti->source),
+ QString(m_datastore->read_bank.lookupEID(ti->source).c_str()),
+ QString(""),
+ QString::number(ti->offset),
+ QString::number(ti->range.getLength() + ti->gaps.size()),
+ QString(""),
+ QString(""),
+ QString(""));
+ }
+ }
+ }
+
+ contigList->setSorting(5, false);
+ }
+ catch (AMOS::Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ }
+
+ contigList->setColumnWidth(2, (int)(contigList->columnWidth(2)*1.2));
+
+ setCursor(orig);
+ if (m_verbose) { cerr << " " << timer.str() << endl; }
+}
+
+void LaunchPad::contigSelected(Q3ListViewItem * item)
+{
+ int offset = 0;
+ if (item->parent())
+ {
+ offset = atoi(item->text(FIELD_OFFSET));
+ item = item->parent();
+ }
+
+ setContigId(atoi(item->text(0)));
+ setGindex(offset);
+}
+
+void LaunchPad::contigSelectIID(const QString & iid)
+{
+ Q3ListViewItem * item = contigList->findItem(iid, 1);
+ if (item)
+ {
+ contigList->setSelected(item, true);
+ contigList->ensureItemVisible(item);
+ }
+}
+
+void LaunchPad::contigSelectEID(const QString & eid)
+{
+ Q3ListViewItem * item = contigList->findItem(eid, 2);
+ if (item)
+ {
+ contigList->setSelected(item, true);
+ contigList->ensureItemVisible(item);
+ }
+}
+
+void LaunchPad::contigViewSelected()
+{
+ Q3ListViewItem * item = contigList->selectedItem();
+ if (item)
+ {
+ contigSelected(item);
+ }
+}
+
+void LaunchPad::contigLengthHistogram()
+{
+ NChartStats * stats = new NChartStats(*m_contigstats);
+ new NChartWindow(stats, this, "hist");
+}
+
+void LaunchPad::contigReadCountHistogram()
+{
+ InsertStats * stats = new InsertStats((string)"Contig Read Count Histogram");
+
+ AMOS::Contig_t contig;
+ m_datastore->contig_bank.seekg(1);
+ while (m_datastore->contig_bank >> contig)
+ {
+ stats->addSize(contig.getReadTiling().size());
+ }
+
+ new HistogramWindow(stats, this, "hist");
+}
+
+void LaunchPad::contigCoverageHistogram()
+{
+ InsertStats * stats = new InsertStats((string)"Contig Coverage Histogram");
+
+ AMOS::Contig_t contig;
+ m_datastore->contig_bank.seekg(1);
+ while (m_datastore->contig_bank >> contig)
+ {
+ stats->addSize(contig.getFoldCov());
+ }
+
+ new HistogramWindow(stats, this, "hist");
+}
+
+void LaunchPad::contigGCHistogram()
+{
+ InsertStats * stats = new InsertStats((string)"Contig GC Content Histogram");
+
+ AMOS::Contig_t contig;
+ m_datastore->contig_bank.seekg(1);
+ while (m_datastore->contig_bank >> contig)
+ {
+ stats->addSize(contig.getGCContent());
+ }
+
+ new HistogramWindow(stats, this, "hist");
+}
+
diff --git a/src/hawkeye/ContigPicker.hh b/src/hawkeye/ContigPicker.hh
new file mode 100644
index 0000000..3d888ac
--- /dev/null
+++ b/src/hawkeye/ContigPicker.hh
@@ -0,0 +1,6 @@
+#ifndef CONTIG_PICKER_HH__
+#define CONTIG_PICKER_HH__ 1
+
+#include "LaunchPad.hh"
+
+#endif
diff --git a/src/hawkeye/CoverageCanvasItem.cc b/src/hawkeye/CoverageCanvasItem.cc
new file mode 100644
index 0000000..a8e7bf0
--- /dev/null
+++ b/src/hawkeye/CoverageCanvasItem.cc
@@ -0,0 +1,50 @@
+#include "CoverageCanvasItem.hh"
+#include "UIElements.hh"
+#include <qpainter.h>
+//Added by qt3to4:
+#include <Q3PointArray>
+
+const int CoverageCanvasItem::RTTI = 132546;
+
+using namespace std;
+
+CoverageCanvasItem::CoverageCanvasItem(int x, int y, int width, int height,
+ int libid, double baseLevel,
+ Q3PointArray & arr,
+ vector<double> & raw,
+ bool copyRaw,
+ Q3Canvas * canvas,
+ const QColor & color)
+ : Q3CanvasRectangle(x, y, width, height, canvas),
+ m_points(arr),
+ m_raw(raw),
+ m_libid(libid),
+ m_baseLevel(baseLevel),
+ m_color(color),
+ m_copyraw(copyRaw)
+{
+ show();
+}
+
+void CoverageCanvasItem::drawShape (QPainter & p)
+{
+ p.save();
+
+ QPen pen(QPen(m_color,1));
+ pen.setWidth(1);
+ p.setPen(pen);
+ p.drawPolyline(m_points);
+
+ if (m_copyraw)
+ {
+ pen.setColor(Qt::gray);
+ }
+
+ pen.setStyle(Qt::DotLine);
+ p.setPen(pen);
+
+ p.drawLine((int)(x()), (int)(y() + height() - m_baseLevel),
+ (int)(x() + width()), (int)(y() + height() - m_baseLevel));
+
+ p.restore();
+}
diff --git a/src/hawkeye/CoverageCanvasItem.hh b/src/hawkeye/CoverageCanvasItem.hh
new file mode 100644
index 0000000..ee64e64
--- /dev/null
+++ b/src/hawkeye/CoverageCanvasItem.hh
@@ -0,0 +1,38 @@
+#ifndef COVERAGE_CANVAS_ITEM_HH_
+#define COVERAGE_CANVAS_ITEM_HH_ 1
+
+#include <q3canvas.h>
+//Added by qt3to4:
+#include <Q3PointArray>
+#include <vector>
+
+class CoverageCanvasItem : public Q3CanvasRectangle
+{
+public:
+ CoverageCanvasItem(int x, int y, int width, int height,
+ int libid, double baseLevel,
+ Q3PointArray & arr,
+ std::vector<double> & raw,
+ bool copyRaw,
+ Q3Canvas * canvas,
+ const QColor & color);
+
+ static const int RTTI;
+ int rtti () const { return RTTI; }
+
+ Q3PointArray m_points;
+ std::vector<double> m_raw;
+
+ int m_libid;
+ double m_baseLevel;
+ QColor m_color;
+ bool m_copyraw;
+
+
+protected:
+ void drawShape (QPainter & p);
+
+};
+
+
+#endif
diff --git a/src/hawkeye/CoverageRectCanvasItem.cc b/src/hawkeye/CoverageRectCanvasItem.cc
new file mode 100644
index 0000000..2b27c27
--- /dev/null
+++ b/src/hawkeye/CoverageRectCanvasItem.cc
@@ -0,0 +1,61 @@
+#include "CoverageRectCanvasItem.hh"
+#include "UIElements.hh"
+#include <qpainter.h>
+//Added by qt3to4:
+#include <Q3PointArray>
+#include <limits.h>
+#include <math.h>
+
+const int CoverageRectCanvasItem::RTTI = 123456;
+
+#include <iostream>
+using namespace std;
+
+CoverageRectCanvasItem::CoverageRectCanvasItem(int x, int y,
+ int width, int height,
+ int libid, double baseLevel,
+ Q3PointArray & arr,
+ vector<double> & raw,
+ bool copyRaw,
+ Q3Canvas * canvas,
+ const QColor & color)
+ : Q3CanvasRectangle(x, y, width, height, canvas),
+ m_points(arr),
+ m_raw(raw),
+ m_libid(libid),
+ m_baseLevel(baseLevel),
+ m_color(color),
+ m_copyraw(copyRaw)
+{
+ show();
+ m_low = m_baseLevel;
+ m_high = m_baseLevel;
+}
+
+void CoverageRectCanvasItem::drawShape (QPainter & p)
+{
+ p.save();
+ QColor shade;
+ double px = x();
+ double py = m_baseLevel;
+ for ( Q3PointArray::Iterator i = m_points.begin(); i != m_points.end(); ++ i )
+ {
+ int cy = abs(i->y());
+ if ( cy != py )
+ {
+ if ( py < m_low || py > m_high )
+ {
+ double df = fabs(m_baseLevel - py) / m_baseLevel * 100.0;
+ if ( df < 1 ) df = 1;
+ shade = m_color.light(int(df));
+ p.setBrush (shade);
+ p.setPen (shade);
+ p.drawRect (int(px), int(y()), int(i->x()-px+1), height());
+ }
+
+ px = i->x();
+ py = cy;
+ }
+ }
+ p.restore();
+}
diff --git a/src/hawkeye/CoverageRectCanvasItem.hh b/src/hawkeye/CoverageRectCanvasItem.hh
new file mode 100644
index 0000000..a74adcc
--- /dev/null
+++ b/src/hawkeye/CoverageRectCanvasItem.hh
@@ -0,0 +1,41 @@
+#ifndef COVERAGE_RECT_CANVAS_ITEM_HH_
+#define COVERAGE_RECT_CANVAS_ITEM_HH_ 1
+
+#include <q3canvas.h>
+//Added by qt3to4:
+#include <Q3PointArray>
+#include <vector>
+
+class CoverageRectCanvasItem : public Q3CanvasRectangle
+{
+public:
+ CoverageRectCanvasItem(int x, int y,
+ int width, int height,
+ int libid, double baseLevel,
+ Q3PointArray & arr,
+ std::vector<double> & raw,
+ bool copyRaw,
+ Q3Canvas * canvas,
+ const QColor & color);
+
+ static const int RTTI;
+ int rtti () const { return RTTI; }
+
+ Q3PointArray m_points;
+ std::vector<double> m_raw;
+
+ int m_libid;
+ double m_baseLevel;
+ QColor m_color;
+ bool m_copyraw;
+
+ double m_low;
+ double m_high;
+
+protected:
+ void drawShape (QPainter & p);
+
+};
+
+
+#endif
diff --git a/src/hawkeye/DetailWidget.cc b/src/hawkeye/DetailWidget.cc
new file mode 100644
index 0000000..3c2930c
--- /dev/null
+++ b/src/hawkeye/DetailWidget.cc
@@ -0,0 +1,67 @@
+
+#include "DetailWidget.hh"
+
+#include <qvariant.h>
+#include <q3groupbox.h>
+#include <q3textedit.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <q3whatsthis.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3GridLayout>
+
+/*
+ * Constructs a DetailWidget as a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ */
+DetailWidget::DetailWidget( QWidget* parent, const char* name, Qt::WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ if ( !name )
+ setName( "DetailWidget" );
+ DetailWidgetLayout = new Q3GridLayout( this, 1, 1, 0, 0, "DetailWidgetLayout");
+
+ detailBox = new Q3GroupBox( this, "detailBox" );
+ detailBox->setFlat( TRUE );
+ detailBox->setColumnLayout(0, Qt::Vertical );
+ detailBox->layout()->setSpacing( 0 );
+ detailBox->layout()->setMargin( 0 );
+ detailBoxLayout = new Q3VBoxLayout( detailBox->layout() );
+ detailBoxLayout->setAlignment( Qt::AlignTop );
+
+ detailText = new Q3TextEdit( detailBox, "detailText" );
+ detailText->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, detailText->sizePolicy().hasHeightForWidth() ) );
+ QFont detailText_font( detailText->font() );
+ detailText_font.setFamily( "Courier" );
+ detailText_font.setPointSize( 8 );
+ detailText->setFont( detailText_font );
+ detailText->setTextFormat( Qt::RichText );
+ detailText->setWordWrap( Q3TextEdit::NoWrap );
+ detailText->setReadOnly( TRUE );
+ detailBoxLayout->addWidget( detailText );
+
+ DetailWidgetLayout->addWidget( detailBox, 0, 0 );
+ languageChange();
+ resize( QSize(553, 537).expandedTo(minimumSizeHint()) );
+ //clearWState( WState_Polished );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+DetailWidget::~DetailWidget()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * Sets the strings of the subwidgets using the current
+ * language.
+ */
+void DetailWidget::languageChange()
+{
+ setCaption( tr( "Form2" ) );
+ detailBox->setTitle( tr( " Selection Details" ) );
+}
+
diff --git a/src/hawkeye/DetailWidget.hh b/src/hawkeye/DetailWidget.hh
new file mode 100644
index 0000000..b18b2c1
--- /dev/null
+++ b/src/hawkeye/DetailWidget.hh
@@ -0,0 +1,39 @@
+
+#ifndef DETAILWIDGET_H
+#define DETAILWIDGET_H
+
+#include <qvariant.h>
+#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
+
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
+class QSpacerItem;
+class Q3GroupBox;
+class Q3TextEdit;
+
+class DetailWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ DetailWidget( QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0 );
+ ~DetailWidget();
+
+ Q3GroupBox* detailBox;
+ Q3TextEdit* detailText;
+
+protected:
+ Q3GridLayout* DetailWidgetLayout;
+ Q3VBoxLayout* detailBoxLayout;
+
+protected slots:
+ virtual void languageChange();
+
+};
+
+#endif // DETAILWIDGET_H
diff --git a/src/hawkeye/FeatureBrowser.cc b/src/hawkeye/FeatureBrowser.cc
new file mode 100644
index 0000000..ad615dd
--- /dev/null
+++ b/src/hawkeye/FeatureBrowser.cc
@@ -0,0 +1,312 @@
+#include "FeatureBrowser.hh"
+#include <qcursor.h>
+#include <qstatusbar.h>
+#include <q3listview.h>
+
+#include <qlabel.h>
+#include <qlineedit.h>
+#include "DataStore.hh"
+#include "UIElements.hh"
+
+#include "foundation_AMOS.hh"
+
+#include <vector>
+#include "amp.hh"
+
+using namespace std;
+using namespace AMOS;
+
+
+
+class FeatureListItem : public Q3ListViewItem
+{
+public:
+
+ FeatureListItem(Q3ListView * parent,
+ QString ncode,
+ QString siid,
+ QString count,
+ QString type,
+ QString dir,
+ QString start,
+ QString end,
+ QString length,
+ QString comment)
+
+ : Q3ListViewItem(parent, ncode, siid, count, type, dir, start, end, length)
+ {
+ setText(8, comment);
+ }
+
+ FeatureListItem(FeatureListItem * parent,
+ QString ncode,
+ QString siid,
+ QString count,
+ QString type,
+ QString dir,
+ QString start,
+ QString end,
+ QString length,
+ QString comment)
+
+ : Q3ListViewItem(parent, ncode, siid, count, type, dir, start, end, length)
+ {
+ setText(8, comment);
+ }
+
+
+ int compare(Q3ListViewItem *i, int col,
+ bool ascending ) const
+ {
+ if (col == 8)
+ {
+ return key(col,ascending).compare(i->key(col,ascending));
+ }
+
+ return atoi(key(col,ascending)) - atoi(i->key(col,ascending));
+ }
+};
+
+
+
+void LaunchPad::initFeatures()
+{
+ connect(featureList, SIGNAL(doubleClicked(Q3ListViewItem *)),
+ this, SLOT(featureSelected(Q3ListViewItem *)));
+
+ connect(featureList, SIGNAL(returnPressed(Q3ListViewItem *)),
+ this, SLOT(featureSelected(Q3ListViewItem *)));
+
+ connect(groupGroup, SIGNAL(clicked(int)),
+ this, SLOT(featureGroupChanged(int)));
+}
+
+void LaunchPad::featureGroupChanged(int id)
+{
+ loadFeatures();
+}
+
+void LaunchPad::loadFeatures()
+{
+ EventTime_t timer;
+ if (m_verbose) { cerr << "Loading Features..."; }
+
+ QCursor orig = cursor();
+ setCursor(Qt::waitCursor);
+
+ featureList->clear();
+
+ int c = featureList->columns();
+ for (int i = 0; i < c; i++)
+ {
+ featureList->removeColumn(0);
+ }
+
+ if (featureGroupContigButton->isChecked())
+ {
+ featureList->addColumn("Source Type");
+ featureList->addColumn("Source IID");
+ featureList->addColumn("Count");
+ featureList->addColumn("Type");
+ featureList->addColumn("Dir");
+ featureList->addColumn("Start");
+ featureList->addColumn("End");
+ featureList->addColumn("Length");
+ featureList->addColumn("Comment");
+ }
+ else
+ {
+ featureList->addColumn("Type");
+ featureList->addColumn("Count");
+ featureList->addColumn("Source Type");
+ featureList->addColumn("Source IID");
+ featureList->addColumn("Dir");
+ featureList->addColumn("Start");
+ featureList->addColumn("End");
+ featureList->addColumn("Length");
+ featureList->addColumn("Comment");
+ }
+
+
+ try
+ {
+ QString status = "Select from " ;
+ status += QString::number(m_datastore->feat_bank.getSize()) + " features";
+ statusBar()->message(status);
+
+ Feature_t feat;
+ m_datastore->feat_bank.seekg(1);
+
+ map<string, FeatureListItem *> objectFeatureMap;
+ map<string, FeatureListItem *>::iterator ofmi;
+
+ char buffer[128];
+
+ while (m_datastore->feat_bank >> feat)
+ {
+ AMOS::Range_t range = feat.getRange();
+
+ string s;
+
+ if (featureGroupContigButton->isChecked())
+ {
+ sprintf(buffer, "%c:%d", (char)feat.getSource().second, feat.getSource().first);
+ s += buffer;
+ }
+ else
+ {
+ s += feat.getType();
+ }
+
+ ofmi = objectFeatureMap.find(s);
+ FeatureListItem * base;
+
+ if (ofmi == objectFeatureMap.end())
+ {
+ if (featureGroupContigButton->isChecked())
+ {
+ base = new FeatureListItem(featureList,
+ QString(Decode(feat.getSource().second).c_str()),
+ QString::number(feat.getSource().first),
+ QString("1"),
+ QString(""),
+ QString(""),
+ QString(""),
+ QString(""),
+ QString(""),
+ QString(""));
+ }
+ else
+ {
+ base = new FeatureListItem(featureList,
+ QString(UIElements::getFeatureStr((char)feat.getType())),
+ QString("1"),
+ QString(""),
+ QString(""),
+ QString(""),
+ QString(""),
+ QString(""),
+ QString(""),
+ QString(""));
+ }
+
+ ofmi = objectFeatureMap.insert(make_pair(s, base)).first;
+ }
+ else
+ {
+ base = ofmi->second;
+ }
+
+
+ if (featureGroupContigButton->isChecked())
+ {
+ new FeatureListItem(base,
+ QString(Decode(feat.getSource().second).c_str()),
+ QString::number(feat.getSource().first),
+ QString::number(1),
+ QString(UIElements::getFeatureStr((char)feat.getType())),
+ QString((QChar)(range.isReverse()?'R':'F')),
+ QString::number(range.getLo()),
+ QString::number(range.getHi()),
+ QString::number(range.getLength()),
+ QString(feat.getComment().c_str()));
+
+ base->setText(2, QString::number(base->childCount()));
+ }
+ else
+ {
+ new FeatureListItem(base,
+ QString(UIElements::getFeatureStr((char)feat.getType())),
+ QString::number(1),
+ QString(Decode(feat.getSource().second).c_str()),
+ QString::number(feat.getSource().first),
+ QString((QChar)(range.isReverse()?'R':'F')),
+ QString::number(range.getLo()),
+ QString::number(range.getHi()),
+ QString::number(range.getLength()),
+ QString(feat.getComment().c_str()));
+
+ base->setText(1, QString::number(base->childCount()));
+ }
+ }
+ }
+ catch (AMOS::Exception_t & e)
+ {
+ statusBar()->message("Features not available");
+ }
+
+ if (featureGroupContigButton->isChecked())
+ {
+ featureList->setSorting(2,false);
+ }
+ else
+ {
+ featureList->setSorting(1,false);
+ }
+
+ setCursor(orig);
+
+ if (m_verbose) { cerr << " " << timer.str() << endl; }
+}
+
+void LaunchPad::featureViewButtonSelected()
+{
+ Q3ListViewItem * item = featureList->selectedItem();
+ if (item)
+ {
+ featureSelected(item);
+ }
+}
+
+void LaunchPad::featureSelected(Q3ListViewItem * item)
+{
+ int offset = atoi(item->text(5));
+ ID_t iid = atoi(item->text(3));
+ char ncode = item->text(2).ascii()[0];
+
+ if (featureGroupContigButton->isChecked())
+ {
+ iid = atoi(item->text(1));
+ ncode = item->text(0).ascii()[0];
+ }
+
+ if (ncode == (char)Contig_t::NCODE)
+ {
+ ID_t bid = m_datastore->contig_bank.lookupBID(iid);
+ setContigId(bid);
+ setGindex(offset);
+ }
+ else if (ncode == Scaffold_t::NCODE)
+ {
+ AMOS::Scaffold_t scaffold;
+
+ m_datastore->fetchScaffoldIID(iid, scaffold);
+
+ ID_t contigbid = 0;
+
+ vector<Tile_t>::iterator ti;
+ for (ti = scaffold.getContigTiling().begin();
+ ti != scaffold.getContigTiling().end();
+ ti++)
+ {
+ if ((ti->offset <= offset) && (offset <= ti->getRightOffset()))
+ {
+ contigbid = m_datastore->contig_bank.getIDMap().lookupBID(ti->source);
+ offset -= ti->offset;
+
+ if (ti->range.isReverse())
+ {
+ offset = ti->getGappedLength() - offset;
+ }
+
+ break;
+ }
+ }
+
+ if (contigbid)
+ {
+ setContigId(contigbid);
+ setGindex(offset);
+ }
+ }
+}
diff --git a/src/hawkeye/FeatureBrowser.hh b/src/hawkeye/FeatureBrowser.hh
new file mode 100644
index 0000000..653f687
--- /dev/null
+++ b/src/hawkeye/FeatureBrowser.hh
@@ -0,0 +1,6 @@
+#ifndef FEATURE_BROWSER_HH__
+#define FEATURE_BROWSER_HH__ 1
+
+#include "LaunchPad.hh"
+
+#endif
diff --git a/src/hawkeye/FeatureCanvasItem.cc b/src/hawkeye/FeatureCanvasItem.cc
new file mode 100644
index 0000000..ed27569
--- /dev/null
+++ b/src/hawkeye/FeatureCanvasItem.cc
@@ -0,0 +1,39 @@
+#include "FeatureCanvasItem.hh"
+#include "UIElements.hh"
+#include <qpainter.h>
+#include "foundation_AMOS.hh"
+
+const int FeatureCanvasItem::RTTI = 132548;
+
+FeatureCanvasItem::FeatureCanvasItem(int x, int y, int width, int height,
+ AMOS::Feature_t & feat, Q3Canvas * canvas)
+ : Q3CanvasRectangle(x, y, width, height, canvas), m_feat(feat)
+{
+ setPen(UIElements::getFeatureColor(feat.getType()));
+ setBrush(UIElements::getFeatureColor(feat.getType()));
+}
+
+void FeatureCanvasItem::drawShape(QPainter & p)
+{
+ if (m_feat.getType() == 'B')
+ {
+ p.drawLine((int) x(), (int) y(),
+ (int) (x() + width() - 1), (int) y());
+
+ if (m_feat.getRange().isReverse())
+ {
+ p.drawRect((int) (x() + width() - width()/2), (int) y(),
+ (int) (width()/2), (int) height());
+ }
+ else
+ {
+ p.drawRect((int) x(), (int) y(),
+ (int) (width()/2), (int) height());
+ }
+ }
+ else
+ {
+ p.drawRect((int) x(), (int) y(),
+ (int) width(), (int) height());
+ }
+}
diff --git a/src/hawkeye/FeatureCanvasItem.hh b/src/hawkeye/FeatureCanvasItem.hh
new file mode 100644
index 0000000..0856334
--- /dev/null
+++ b/src/hawkeye/FeatureCanvasItem.hh
@@ -0,0 +1,26 @@
+#ifndef FEATURE_CANVAS_ITEM_HH_
+#define FEATURE_CANVAS_ITEM_HH_ 1
+
+#include <q3canvas.h>
+#include "foundation_AMOS.hh"
+
+
+class FeatureCanvasItem : public Q3CanvasRectangle
+{
+public:
+ FeatureCanvasItem(int x, int y, int width, int height,
+ AMOS::Feature_t & feat, Q3Canvas * canvas);
+
+ static const int RTTI;
+ int rtti () const { return RTTI; }
+
+ void drawShape(QPainter & p);
+ AMOS::Feature_t & m_feat;
+
+ static const char * getFeatureTypeStr(AMOS::FeatureType_t type);
+
+private:
+};
+
+
+#endif
diff --git a/src/hawkeye/HistogramWidget.cc b/src/hawkeye/HistogramWidget.cc
new file mode 100644
index 0000000..49aec1e
--- /dev/null
+++ b/src/hawkeye/HistogramWidget.cc
@@ -0,0 +1,282 @@
+#include "HistogramWidget.hh"
+#include "InsertStats.hh"
+
+#include <qstring.h>
+#include <qpixmap.h>
+#include <qpainter.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+
+#include <iostream>
+#include <cmath>
+
+using namespace std;
+
+HistogramWidget::HistogramWidget(InsertStats * stats, QWidget * parent, const char * name)
+ : QWidget(parent, name),
+ m_stats(stats), m_fitzero(true), m_grid(true), m_shademean(true), m_shadesd(2.0)
+{
+ setMinimumSize(550, 500);
+ setWindowFlags(Qt::WRepaintNoErase | Qt::WDestructiveClose | Qt::WResizeNoErase);
+ m_stats->histogram(200, m_fitzero);
+}
+
+HistogramWidget::~HistogramWidget()
+{
+ delete m_stats;
+ m_stats = NULL;
+}
+
+static void drawNormal(QPainter & p,
+ int histleft, int histbottom,
+ int histwidth, int histheight,
+ double xvalscale,
+ double mean, double sd,
+ double low, double high)
+{
+ double cnst = 1/(sqrt(2*3.14159*sd*sd));
+ double expval = -(mean-mean)*(mean-mean)/(2*sd*sd);
+ double maxval = cnst * exp(expval);
+ int lastx = histleft;
+ int lasty = histbottom;
+
+ double yvalscale = (histheight) / maxval;
+
+ for (int i = low; i < high; i+=10)
+ {
+ expval = -(i-mean)*(i-mean)/(2*sd*sd);
+ double val = cnst * exp(expval);
+
+ int xval = histleft + i * xvalscale;
+ int yval = histbottom - val * yvalscale;
+
+ p.drawLine(lastx, lasty, xval, yval);
+
+ lastx = xval;
+ lasty = yval;
+ }
+}
+
+void HistogramWidget::paintEvent(QPaintEvent * event)
+{
+ int width = this->width();
+ int height = this->height();
+
+ QPixmap pix(width, height);
+ pix.fill(Qt::white);
+
+ QPainter p(&pix);
+ QPen pen(Qt::black);
+
+
+ p.setPen(pen);
+ p.setFont(QFont("Helvetica", 12));
+
+ int center = width/2;
+
+ QString label = m_stats->m_label.c_str();
+
+ p.drawText(center-400,10,800,30, Qt::AlignCenter,label);
+
+ int gutter = 20;
+ int histtop = 50;
+ int bottomtext = 100;
+ int histheight = height - histtop - bottomtext;
+ int histbottom = histtop + histheight;
+
+ int histleft = 60;
+ int histwidth = width-histleft-gutter;
+
+ p.setBrush(QColor(240,240,240));
+ p.drawRect(histleft, histtop, histwidth, histheight);
+
+ int buckets = m_stats->m_buckets.size();
+
+ double xscale = (double)(histwidth)/ buckets;
+ double yscale = (double)(histheight-gutter) / m_stats->m_maxcount;
+
+ if (m_stats->count() == 0)
+ {
+ label = "Insufficient Count";
+ p.drawText(center-400, histtop + histheight/2 - 10,
+ 800, 30, Qt::AlignCenter, label);
+ }
+ else
+ {
+ // Shading
+ if (m_shademean)
+ {
+ p.setBrush(Qt::yellow);
+
+ double mean = m_stats->mean();
+ double leftsd = mean - m_shadesd*m_stats->stdev();
+ double rightsd = mean + m_shadesd*m_stats->stdev();
+
+ if (leftsd < 0) { leftsd = 0; }
+ if (rightsd > m_stats->m_high) { rightsd = m_stats->m_high; }
+
+ leftsd /= m_stats->m_bucketsize;
+ rightsd /= m_stats->m_bucketsize;
+
+ p.drawRect((int)(histleft + leftsd * xscale), histtop,
+ (int)((rightsd - leftsd + 1) * xscale), histheight);
+
+ }
+
+ // Xlabels
+ pen.setStyle(Qt::DotLine);
+ p.setPen(pen);
+
+ int labelwidth = 100;
+ int numbuckets = (int)(labelwidth / xscale);
+ if (numbuckets == 0) { numbuckets = 1; }
+
+ int prec = 0;
+ if (m_stats->m_high <= 1) { prec = 4; }
+
+ for (int i = 0; i < buckets; i++)
+ {
+ if (i % numbuckets == 0)
+ {
+ int xcoord = (int)(histleft+i*xscale);
+
+ if (m_grid) { p.drawLine(xcoord, histtop, xcoord, histbottom+5); }
+
+ label = QString::number(m_stats->m_bucketlow[i], 'f', prec);
+
+ p.drawText(xcoord-labelwidth, histbottom,
+ labelwidth*2, 30, Qt::AlignCenter, label);
+ }
+ }
+
+
+ // ylables
+ int yjump = (int)(100/yscale);
+ if (yjump == 0) { yjump = 1; }
+ for (int j = m_stats->m_maxcount; j >= 0; j -= yjump)
+ {
+ int ycoord = (int)(histbottom - j * yscale);
+
+ if (m_grid) { p.drawLine(histleft-5, ycoord, histleft+histwidth, ycoord); }
+
+ label = QString::number(j);
+
+ p.drawText(histleft-100, ycoord-15,
+ 90, 30, Qt::AlignRight | Qt::AlignVCenter, label);
+ }
+
+
+ // histogram
+ pen.setStyle(Qt::SolidLine);
+ p.setPen(pen);
+ p.setBrush(QColor(100,160,255));
+
+ for (int i = 0; i < buckets; i++)
+ {
+ int xwidth = (int)xscale;
+ if (xwidth == 0) { xwidth = 1; }
+
+ int yheight = (int)(m_stats->m_buckets[i]*yscale);
+ if (m_stats->m_buckets[i] && yheight < 5) { yheight = 5; }
+
+ p.drawRect((int)(histleft+i*xscale),
+ (int)(histbottom - yheight),
+ (int)(xwidth)+1,
+ (int)(yheight));
+ }
+
+ if (m_shademean)
+ {
+ double mean = m_stats->mean();
+ mean /= m_stats->m_bucketsize;
+ p.setPen(Qt::red);
+ p.drawLine((int)(histleft + mean*xscale), histtop,
+ (int)(histleft + mean*xscale), histbottom);
+ }
+
+ int doDrawNormal = 1;
+ if (doDrawNormal)
+ {
+ double sd = m_stats->stdev();
+ double mean = m_stats->mean();
+
+ p.setPen(Qt::red);
+
+ drawNormal(p, histleft, histbottom, histwidth, histheight-gutter,
+ xscale/m_stats->m_bucketsize, mean, sd,
+ m_stats->m_low, m_stats->m_high);
+ }
+
+ p.setPen(Qt::black);
+
+ // text
+ int textline1 = histbottom + 30;
+ int textline2 = textline1 + 20;
+ int textline3 = textline2 + 20;
+
+ prec = 2;
+ if (m_stats->m_high <= 1) { prec = 4; }
+
+ label = "Sample Range: " + QString::number(m_stats->m_low, 'f', prec) +
+ " - " + QString::number(m_stats->m_high, 'f', prec);
+
+ p.drawText(histleft, textline1,
+ histwidth, 30, Qt::AlignLeft | Qt::AlignVCenter, label);
+
+ label = "Sample Mean: " + QString::number(m_stats->mean(), 'f', prec) +
+ " SD: " + QString::number(m_stats->stdev(), 'f', prec) +
+ " Count: " + QString::number(m_stats->count());
+
+ p.drawText(histleft, textline2,
+ histwidth, 30, Qt::AlignLeft | Qt::AlignVCenter, label);
+
+
+ int withincount = m_stats->withinSD(m_shadesd);
+ double withinperc = (double)(withincount*100.0)/m_stats->count();
+
+ label = "Samples within " + QString::number(m_shadesd) +
+ " SD: " + QString::number(withincount) +
+ " (" + QString::number(withinperc, 'f', 2) + "%)";
+
+ p.drawText(histleft, textline3,
+ histwidth, 30, Qt::AlignLeft | Qt::AlignVCenter, label);
+ }
+
+ p.end();
+
+ p.begin(this);
+ p.drawPixmap(0,0,pix);
+ p.end();
+}
+
+
+void HistogramWidget::setBucketCount(int count)
+{
+ m_stats->histogram(count, m_fitzero);
+ update();
+}
+
+void HistogramWidget::setFitZero(bool fit)
+{
+ m_fitzero = fit;
+ m_stats->histogram(m_stats->m_buckets.size(), m_fitzero);
+ update();
+}
+
+void HistogramWidget::setEnableGrid(bool enable)
+{
+ m_grid = enable;
+ update();
+}
+
+void HistogramWidget::setShadeMean(bool enable)
+{
+ m_shademean = enable;
+ update();
+}
+
+void HistogramWidget::setShadeSD(double sd)
+{
+ m_shadesd = sd;
+ update();
+}
diff --git a/src/hawkeye/HistogramWidget.hh b/src/hawkeye/HistogramWidget.hh
new file mode 100644
index 0000000..e14080a
--- /dev/null
+++ b/src/hawkeye/HistogramWidget.hh
@@ -0,0 +1,38 @@
+#ifndef HISTOGRAMWIDGET_HH__
+#define HISTOGRAMWIDGET_HH__ 1
+
+#include <qwidget.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+
+class InsertStats;
+
+class HistogramWidget : public QWidget
+{
+Q_OBJECT
+
+public:
+ HistogramWidget(InsertStats * stats, QWidget * parent, const char * name);
+ ~HistogramWidget();
+
+public slots:
+ void setBucketCount(int);
+ void setFitZero(bool);
+ void setEnableGrid(bool);
+ void setShadeMean(bool);
+ void setShadeSD(double);
+
+protected:
+ void paintEvent(QPaintEvent *);
+
+private:
+ InsertStats * m_stats;
+ bool m_fitzero;
+ bool m_grid;
+ bool m_shademean;
+ double m_shadesd;
+};
+
+
+
+#endif
diff --git a/src/hawkeye/HistogramWindow.cc b/src/hawkeye/HistogramWindow.cc
new file mode 100644
index 0000000..92b2ba5
--- /dev/null
+++ b/src/hawkeye/HistogramWindow.cc
@@ -0,0 +1,75 @@
+#include "HistogramWindow.hh"
+#include "HistogramWidget.hh"
+#include "InsertStats.hh"
+
+#include <qspinbox.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+
+HistogramWindow::HistogramWindow(InsertStats * stats, QWidget * parent, const char * name)
+ : Q3MainWindow(parent, name),
+ m_stats(stats)
+{
+ //setWindowFlags(Qt::WDestructiveClose);
+
+ HistogramWidget * widget = new HistogramWidget(stats, this, "HistoWidget");
+ m_stats->histogram(100,true);
+
+ Q3ToolBar * options = new Q3ToolBar(this, "options");
+ options->setLabel("Options");
+
+ new QLabel("Buckets", options, "bucketlbl");
+ QSpinBox * spin = new QSpinBox(50,1000,50, options, "bucketlbl");
+ spin->setValue(200);
+
+ connect(spin, SIGNAL(valueChanged(int)),
+ widget, SLOT(setBucketCount(int)));
+
+#if 0
+ new QLabel(" Fit Zero", options, "fitlbl");
+ QCheckBox * fit = new QCheckBox(options, "fitcheck");
+ fit->setChecked(true);
+
+ connect(fit, SIGNAL(toggled(bool)),
+ widget, SLOT(setFitZero(bool)));
+
+ new QLabel(" Gridlines", options, "gridlbl");
+ QCheckBox * grid = new QCheckBox(options, "gridcheck");
+ grid->setChecked(true);
+
+ connect(grid, SIGNAL(toggled(bool)),
+ widget, SLOT(setEnableGrid(bool)));
+
+#endif
+
+
+ new QLabel(" Shade Mean", options, "meanlbl");
+ QCheckBox * mean = new QCheckBox(options, "meancheck");
+ mean->setChecked(true);
+
+ connect(mean, SIGNAL(toggled(bool)),
+ widget, SLOT(setShadeMean(bool)));
+
+
+ new QLabel(" SD:", options, "bucketlbl");
+ m_sdpick = new QLineEdit(options, "sdpick");
+ m_sdpick->setText(QString::number(2));
+
+ connect(m_sdpick, SIGNAL(returnPressed()),
+ this, SLOT(loadShadeSD()));
+
+ connect(this, SIGNAL(setShadeSD(double)),
+ widget, SLOT(setShadeSD(double)));
+
+ setCentralWidget(widget);
+ setCaption(stats->m_label.c_str());
+ resize(550,500);
+ show();
+}
+
+void HistogramWindow::loadShadeSD()
+{
+ emit setShadeSD(atof(m_sdpick->text().ascii()));
+}
+
diff --git a/src/hawkeye/HistogramWindow.hh b/src/hawkeye/HistogramWindow.hh
new file mode 100644
index 0000000..b4faeb4
--- /dev/null
+++ b/src/hawkeye/HistogramWindow.hh
@@ -0,0 +1,28 @@
+#ifndef HISTOGRAM_WINDOW_HH__
+#define HISTOGRAM_WINDOW_HH__ 1
+
+#include <q3mainwindow.h>
+
+#include "InsertStats.hh"
+
+class QLineEdit;
+
+class HistogramWindow : public Q3MainWindow
+{
+ Q_OBJECT
+
+public:
+ HistogramWindow(InsertStats * stats, QWidget * parent, const char * name);
+
+public slots:
+ void loadShadeSD();
+
+signals:
+ void setShadeSD(double);
+
+private:
+ InsertStats * m_stats;
+ QLineEdit * m_sdpick;
+};
+
+#endif
diff --git a/src/hawkeye/InsertCanvasItem.cc b/src/hawkeye/InsertCanvasItem.cc
new file mode 100644
index 0000000..5c3eafa
--- /dev/null
+++ b/src/hawkeye/InsertCanvasItem.cc
@@ -0,0 +1,86 @@
+#include "InsertCanvasItem.hh"
+#include "UIElements.hh"
+#include <qpainter.h>
+
+#include "Insert.hh"
+
+const int InsertCanvasItem::RTTI = 132545;
+
+using namespace std;
+
+InsertCanvasItem::InsertCanvasItem(int x, int y, int width, int height,
+ Insert * insert, Q3Canvas * canvas)
+ : Q3CanvasRectangle(x, y, width, height, canvas),
+ m_insert(insert), m_highlight(false), m_contigcolor(false),
+ m_alinked(0), m_alinkedread(0), m_blinked(0), m_blinkedread(0)
+{
+ m_insert->m_canvasItem = this;
+}
+
+void InsertCanvasItem::drawShape (QPainter & p)
+{
+ //cerr << "ICI::drawShape" << endl;
+ p.drawLine((int)x(), (int) (y()) + (int)height()-1,
+ (int)x() + (int) width()-1, (int) (y()) + (int)height()-1);
+
+ if (m_insert->m_active == 2)
+ {
+ drawTile(m_insert->m_atile, p, 'A');
+ drawTile(m_insert->m_btile, p, 'B');
+ }
+ else if (m_insert->m_active == 0)
+ {
+ drawTile(m_insert->m_atile, p, 'A');
+ }
+ else
+ {
+ drawTile(m_insert->m_btile, p, 'B');
+ }
+
+ if (m_highlight)
+ {
+ p.setPen(QColor(255,255,255));
+ p.setBrush(Qt::NoBrush);
+ p.drawRect((int) x(), (int) y()-1,
+ (int) width(), (int) height()+3);
+ }
+}
+
+void InsertCanvasItem::drawTile(AMOS::Tile_t * tile, QPainter & p, char type)
+{
+ if (!tile) { return; }
+
+ float hscale = .06250;
+ int hoffset = (int)((1/hscale)*x() - m_insert->m_loffset);
+
+ int readLength = tile->getGappedLength();
+
+ if (m_contigcolor)
+ {
+ p.save();
+
+ if (type == 'A')
+ {
+ p.setPen(m_acolor);
+ p.setBrush(m_acolor);
+ }
+ else
+ {
+ p.setPen(m_bcolor);
+ p.setBrush(m_bcolor);
+ }
+ }
+
+ p.drawRect((int)(hscale*(tile->offset+hoffset)), (int) y(),
+ (int)(hscale*(tile->offset+hoffset+readLength-1))-(int)(hscale*(tile->offset+hoffset)), (int)height());
+
+ if (m_contigcolor)
+ {
+ p.restore();
+ }
+
+ if (tile->offset+hoffset < x())
+ {
+ cerr << type << " " << tile->source << " tile->offset: " << tile->offset << " hoffset: " << hoffset << " x:" << x() << endl;
+ }
+}
diff --git a/src/hawkeye/InsertCanvasItem.hh b/src/hawkeye/InsertCanvasItem.hh
new file mode 100644
index 0000000..0047ddb
--- /dev/null
+++ b/src/hawkeye/InsertCanvasItem.hh
@@ -0,0 +1,40 @@
+#ifndef INSERT_CANVAS_ITEM_HH_
+#define INSERT_CANVAS_ITEM_HH_ 1
+
+#include <q3canvas.h>
+#include "Insert.hh"
+
+class Insert;
+
+
+class InsertCanvasItem : public Q3CanvasRectangle
+{
+public:
+ InsertCanvasItem(int x, int y, int width, int height,
+ Insert * insert, Q3Canvas * canvas);
+
+ static const int RTTI;
+ int rtti () const { return RTTI; }
+ Insert * m_insert;
+ bool m_highlight;
+
+ bool m_contigcolor;
+ QColor m_acolor;
+ int m_alinked;
+ int m_alinkedread;
+
+ QColor m_bcolor;
+ int m_blinked;
+ int m_blinkedread;
+
+protected:
+ void drawShape (QPainter & p);
+
+private:
+ void drawTile(AMOS::Tile_t * tile, QPainter & p, char type);
+
+private:
+};
+
+
+#endif
diff --git a/src/hawkeye/InsertField.cc b/src/hawkeye/InsertField.cc
new file mode 100644
index 0000000..5e3f06f
--- /dev/null
+++ b/src/hawkeye/InsertField.cc
@@ -0,0 +1,610 @@
+#include "InsertField.hh"
+#include "UIElements.hh"
+#include <qmatrix.h>
+#include <qcursor.h>
+#include <qapplication.h>
+#include <qpainter.h>
+#include <qregexp.h>
+//Added by qt3to4:
+#include <QWheelEvent>
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <QPixmap>
+#include <QMouseEvent>
+
+#include "InsertCanvasItem.hh"
+#include "FeatureCanvasItem.hh"
+#include "ContigCanvasItem.hh"
+#include "CoverageCanvasItem.hh"
+#include "DataStore.hh"
+#include "InsertCanvasItem.hh"
+#include "RangeScrollBar.hh"
+
+#include "icons/zoom_in.xpm"
+#include "icons/zoom_out.xpm"
+
+
+#include <iostream>
+using namespace std;
+
+
+InsertField::InsertField(DataStore * datastore,
+ int & hoffset,
+ Q3Canvas * canvas,
+ QWidget * parent,
+ const char * name)
+ : Q3CanvasView(canvas, parent, name),
+ m_datastore(datastore),
+ m_hoffset(hoffset),
+ m_featrect(NULL),
+ m_feat(NULL),
+ m_lastsearch(NULL),
+ m_hrange(NULL),
+ m_vrange(NULL)
+{
+ QMatrix m = worldMatrix();
+ m.translate(0, 0);
+ m.scale(0.05, 1.0);
+ setWorldMatrix(m); // init
+
+ setHScrollBarMode(Q3ScrollView::AlwaysOff);
+ setVScrollBarMode(Q3ScrollView::AlwaysOff);
+
+ m_toolstate = 0;
+ setCursor(Qt::ArrowCursor);
+}
+
+void InsertField::setScrollBars(RangeScrollBar_t * hrange,
+ RangeScrollBar_t * vrange)
+{
+ m_hrange = hrange;
+ m_vrange = vrange;
+}
+
+void InsertField::wheelEvent(QWheelEvent * e)
+{
+ if (m_vrange)
+ {
+ QApplication::sendEvent(m_vrange, e);
+ }
+}
+
+void InsertField::viewportPaintEvent(QPaintEvent * e)
+{
+ Q3CanvasView::viewportPaintEvent(e);
+
+ QRect rc = QRect(contentsX(), contentsY(),
+ visibleWidth(), visibleHeight() );
+
+ QRect real = inverseWorldMatrix().mapRect(rc);
+
+ emit visibleRange(16*real.x()-m_hoffset, worldMatrix().m11()/16);
+
+ return;
+}
+
+
+void InsertField::setSelectTool()
+{
+ m_toolstate = 0;
+ setCursor(Qt::ArrowCursor);
+}
+
+void InsertField::setZoomInTool()
+{
+ m_toolstate = 1;
+ setCursor(QCursor(QPixmap((const char ** )zoom_in)));
+}
+
+void InsertField::setZoomOutTool()
+{
+ m_toolstate = 2;
+ setCursor(QCursor(QPixmap((const char ** )zoom_out)));
+}
+
+
+void InsertField::setFeatRect (Q3CanvasItem * item)
+{
+ int jump = 0;
+
+ if (!m_featrect)
+ {
+ m_featrect = new Q3CanvasRectangle (0,0,0,0,canvas());
+ m_featrect->setBrush(QColor(59,49,31));
+ m_featrect->setPen(QColor(139,119,111));
+ m_featrect->setZ(-2);
+ }
+
+ if ( item == NULL )
+ {
+ m_featrect->hide();
+ }
+ else
+ {
+ int width = item->boundingRect().width();
+ canvas()->setChanged(m_featrect->boundingRect());
+ m_featrect->setSize(width, canvas()->height());
+ m_featrect->move(item->x(), 0);
+ m_featrect->show();
+ jump = 16*((int)item->x() + width/2) - m_hoffset;
+ }
+
+ m_feat = item;
+ canvas()->setChanged(m_featrect->boundingRect());
+ canvas()->update();
+
+ if ( jump )
+ emit setGindex(jump);
+}
+
+
+void InsertField::highlightInsert(InsertCanvasItem * iitem,
+ bool highlight,
+ bool highlightBuddy)
+{
+ iitem->m_highlight = highlight;
+
+ Insert * ins = iitem->m_insert;
+ AMOS::ID_t iida = ins->m_aid;
+ QString eida = m_datastore->read_bank.lookupEID(iida).c_str();
+
+ emit readIIDHighlighted(QString::number(iida));
+ emit readEIDHighlighted(eida);
+
+ canvas()->setChanged(iitem->boundingRect());
+
+ if (highlightBuddy &&
+ ins->m_other &&
+ ins->m_other->m_canvasItem)
+ {
+ ins->m_other->m_canvasItem->m_highlight = iitem->m_highlight;
+ canvas()->setChanged(ins->m_other->m_canvasItem->boundingRect());
+ }
+
+ canvas()->update();
+}
+
+void InsertField::highlightEID(const QString & qeid)
+{
+ AMOS::ID_t iid = m_datastore->read_bank.lookupIID(qeid.ascii());
+ highlightRead(iid);
+}
+
+void InsertField::highlightIID(const QString & qiid)
+{
+ AMOS::ID_t iid = (AMOS::ID_t) (qiid.toUInt());
+ highlightRead(iid);
+}
+
+void InsertField::highlightRead(int iid)
+{
+ if (iid == AMOS::NULL_ID)
+ {
+ return;
+ }
+
+ Q3CanvasItemList all = canvas()->allItems();
+
+ for (Q3CanvasItemList::Iterator it=all.begin(); it!=all.end(); ++it)
+ {
+ if ((*it)->rtti() == InsertCanvasItem::RTTI)
+ {
+ InsertCanvasItem * iitem = (InsertCanvasItem *) *it;
+ Insert * ins = iitem->m_insert;
+
+ if (ins->m_aid == iid || ins->m_bid == iid)
+ {
+ highlightInsert(iitem, true, true);
+ break;
+ }
+ }
+ }
+}
+
+void InsertField::processItemSelection(QString & s,
+ Q3CanvasItemList::Iterator & it,
+ int & jumptoread,
+ bool & jump,
+ bool rightButtonDown,
+ bool jumpToBuddy,
+ int clickpos)
+{
+ if (((*it)->rtti() == FeatureCanvasItem::RTTI) ||
+ ((*it)->rtti() == ContigCanvasItem::RTTI))
+ {
+
+ if (!m_featrect)
+ {
+ m_featrect = new Q3CanvasRectangle((int)(*it)->x(), 0,
+ (*it)->boundingRect().width(), canvas()->height(),
+ canvas());
+ m_featrect->setBrush(QColor(59,49,31));
+ m_featrect->setPen(QColor(139,119,111));
+ m_featrect->setZ(-2);
+ m_featrect->show();
+ }
+ else
+ {
+ if (m_feat == *it)
+ {
+ if (m_featrect->isVisible()) { m_featrect->hide(); }
+ else { m_featrect->show(); }
+ }
+ else
+ {
+ canvas()->setChanged(m_featrect->boundingRect());
+ m_featrect->setSize((*it)->boundingRect().width(), canvas()->height());
+ m_featrect->move((*it)->x(), 0);
+ m_featrect->show();
+ }
+ }
+
+ m_feat = *it;
+ canvas()->setChanged(m_featrect->boundingRect());
+ canvas()->update();
+
+ }
+
+ // insert selected
+ if ((*it)->rtti() == InsertCanvasItem::RTTI)
+ {
+ InsertCanvasItem * iitem = (InsertCanvasItem *) *it;
+ bool highlight = !iitem->m_highlight;
+ bool highlightBuddy = rightButtonDown;
+
+ if (jumpToBuddy)
+ {
+ if (iitem->m_contigcolor)
+ {
+ jumptoread = iitem->m_alinkedread;
+ }
+ else
+ {
+ jumptoread = iitem->m_insert->m_bid;
+ }
+ }
+
+ highlightInsert(iitem, highlight, highlightBuddy);
+ jump = false;
+
+ // emit details
+ Insert * ins = iitem->m_insert;
+ AMOS::ID_t iida = ins->m_aid;
+ AMOS::ID_t iidb = ins->m_bid;
+ AMOS::ID_t ctga = ins->m_acontig;
+ AMOS::ID_t ctgb = ins->m_bcontig;
+ QString eida = m_datastore->read_bank.lookupEID(iida).c_str();
+ QString eidb = m_datastore->read_bank.lookupEID(iidb).c_str();
+
+ s += "<b><em>Insert</em></b><br>";
+ s += "<table>";
+ s += "<tr><td><b>Status</b></td><td>"
+ + QString(Insert::getInsertTypeStr(ins->m_state)) + "</td></tr>";
+ s += "<tr><td><b>Size</b></td><td>"
+ + QString::number(ins->m_actual) + "</td></tr>";
+ s += "<tr><td><b>Expected</b></td><td>"
+ + QString::number(ins->m_dist.mean - Insert::MAXSTDEV*ins->m_dist.sd)
+ + "-"
+ + QString::number(ins->m_dist.mean + Insert::MAXSTDEV*ins->m_dist.sd)
+ + "</td></tr>";
+ s += "<tr><td><b>Range</b></td><td>"
+ + QString::number(ins->m_loffset) + ","
+ + QString::number(ins->m_roffset) + "</td></tr>";
+ s += "</table>";
+
+ s += "<hr>";
+
+ s += "<b><em>Reads</em></b><br>";
+ s += "<table>";
+ s += "<tr><td><b>EID</b></td><td>"
+ + eida + "</td><td>"
+ + eidb + "</td></tr>";
+ s += "<tr><td><b>IID</b></td><td>"
+ + QString::number(iida) + "</td><td>"
+ + QString::number(iidb) + "</td></tr>";
+ s += "<tr><td><b>Contig</b></td><td>"
+ + QString::number(ctga) + "</td><td>"
+ + QString::number(ctgb) + "</td></tr>";
+ s += "</table>";
+
+ s += "<hr>";
+ }
+ // feature selected
+ else if ((*it)->rtti() == FeatureCanvasItem::RTTI)
+ {
+ jump = false;
+
+ // emit details
+ FeatureCanvasItem * fitem = (FeatureCanvasItem *) * it;
+
+ s += "<b><em>Feature</em></b><br>";
+ s += "<table>";
+ s += "<tr><td><b>Type</b></td><td>"
+ + QString(UIElements::getFeatureStr
+ (fitem->m_feat.getType())) + "</td></tr>";
+ s += "<tr><td><b>Size</b></td><td>"
+ + QString::number(fitem->m_feat.getRange().getLength()) + "</td></tr>";
+ s += "<tr><td><b>Range</b></td><td>"
+ + QString::number(fitem->m_feat.getRange().begin) + ","
+ + QString::number(fitem->m_feat.getRange().end) + "</td></tr>";
+ s += "<tr><td><b>Comment</b></td><td>"
+ + QString(fitem->m_feat.getComment().c_str()) + "</td></tr>";
+ s += "<tr><td><b>EID</b></td><td>"
+ + QString(fitem->m_feat.getEID().c_str()) + "</td></tr>";
+ s += "<tr><td><b>IID</b></td><td>"
+ + QString::number(fitem->m_feat.getIID()) + "</td></tr>";
+ s += "</table>";
+
+ s += "<hr>";
+ }
+ // contig selected
+ else if ((*it)->rtti() == ContigCanvasItem::RTTI)
+ {
+ // emit details
+ ContigCanvasItem * citem = (ContigCanvasItem *) * it;
+ long int len = citem->m_tile.range.getLength();
+
+ s += "<b><em>Contig</em></b><br>";
+ s += "<table>";
+ s += "<tr><td><b>ID</b></td><td>"
+ + QString::number(m_datastore->contig_bank.getIDMap().lookupBID
+ (citem->m_tile.source)) + "</td></tr>";
+ s += "<tr><td><b>Size</b></td><td>"
+ + QString::number(len) + "</td></tr>";
+ s += "<tr><td><b>Range</b></td><td>"
+ + QString::number(citem->m_tile.offset) + ","
+ + QString::number(citem->m_tile.offset + len) + "</td></tr>";
+ s += "<tr><td><b>EID</b></td><td>"
+ + QString(m_datastore->contig_bank.lookupEID
+ (citem->m_tile.source).c_str()) + "</td></tr>";
+ s += "<tr><td><b>IID</b></td><td>"
+ + QString::number(citem->m_tile.source) + "</td></tr>";
+ s += "</table>";
+
+ s += "<hr>";
+
+ jump = false;
+ }
+ else if ((*it)->rtti() == CoverageCanvasItem::RTTI)
+ {
+ CoverageCanvasItem * citem = (CoverageCanvasItem *) * it;
+
+ int i = 1;
+
+ for (i = 1; i < citem->m_points.size(); i++)
+ {
+ int xval = citem->m_points[i].x();
+ if (xval > clickpos)
+ {
+ break;
+ }
+ }
+
+ i--;
+
+ if (0)
+ {
+ int xval = citem->m_points[i].x();
+ xval = 16*xval - m_hoffset;
+ cerr << "i: " << i << " xval: " << xval << endl;
+ }
+
+ if (citem->m_libid < 0)
+ {
+ s += "<b><em>";
+
+ if (citem->m_libid == -1) { s += "Clone"; }
+ else if (citem->m_libid == -2) { s += "Read"; }
+ else if (citem->m_libid == -3) { s += "Kmer"; }
+
+ s += " Coverage</em></b>";
+ s += "<table>";
+ s += "<tr><td><b>Value</b></td><td>"
+ + QString::number(citem->y() + citem->height() -
+ citem->m_points[i].y()) + "</td></tr>";
+ s += "<tr><td><b>Average</b></td><td>"
+ + QString::number(citem->m_baseLevel, 'f', 2) + "</td></tr>";
+ s += "</table>";
+
+ s += "<hr>";
+ }
+ else
+ {
+ s += "<b><em>CE Stat</em></b>";
+ s += "<table>";
+ s += "<tr><td><b>Library</b></td><td>"
+ + QString::number(citem->m_libid) + "</td></tr>";
+ s += "<tr><td><b>Value</b></td><td>"
+ + QString::number(citem->m_raw[i], 'f', 3) + "</td></tr>";
+ s += "</table>";
+
+ s += "<hr>";
+ }
+
+ jump = true;
+ }
+}
+
+
+
+void InsertField::contentsMousePressEvent( QMouseEvent* e )
+{
+ QPoint real = inverseWorldMatrix().map(e->pos());
+ Q3CanvasItemList l = canvas()->collisions(real);
+
+ int gindex = 16*real.x() - m_hoffset;
+ int jumptoread = 0;
+
+ bool jump = true;
+
+ int xpos = real.x();
+ int ypos = real.y();
+
+ if ((m_toolstate == 1 && e->button() == Qt::LeftButton) ||
+ (m_toolstate == 2 && e->button() == Qt::RightButton)) // zoomin
+ {
+ QMatrix m = worldMatrix();
+ QMatrix newzoom(m.m11()*2, m.m12(), m.m21(), m.m22()*1.25, m.dx(), m.dy());
+ setWorldMatrix(newzoom);
+
+ setContentsPos((int)(xpos*newzoom.m11() - visibleWidth()/2),
+ (int)(ypos*newzoom.m22() - visibleHeight()/2));
+
+ emit updateVisibleRange();
+ }
+ else if ((m_toolstate == 2 && e->button() == Qt::LeftButton) ||
+ (m_toolstate == 1 && e->button() == Qt::RightButton))// zoomout
+ {
+ QMatrix m = worldMatrix();
+ QMatrix newzoom(m.m11()/2, m.m12(), m.m21(), m.m22()/1.25, m.dx(), m.dy());
+
+ if (canvas()->width() * newzoom.m11() < width())
+ {
+ double xf = ((double) width()) / canvas()->width();
+ newzoom.setMatrix(xf, newzoom.m12(), newzoom.m21(), newzoom.m22(), newzoom.dx(), newzoom.dy());
+ }
+
+ if (canvas()->height() * newzoom.m22() < height())
+ {
+ double yf = (double) height() / canvas()->height();
+ newzoom.setMatrix(newzoom.m11(), newzoom.m12(), newzoom.m21(), yf, newzoom.dx(), newzoom.dy());
+ }
+
+ setWorldMatrix(newzoom);
+
+ setContentsPos((int)(xpos*newzoom.m11() - visibleWidth()/2),
+ (int)(ypos*newzoom.m22() - visibleHeight()/2));
+
+ emit updateVisibleRange();
+ }
+ else // center
+ {
+ QString s;
+
+ for (Q3CanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it)
+ {
+ processItemSelection(s, it, jumptoread, jump,
+ e->button() == Qt::RightButton,
+ e->state() == Qt::ControlButton,
+ real.x());
+ }
+
+ s += "<b><em>Click</em></b><br>";
+ s += "<table>";
+ s += "<tr><td><b>Position</b></td><td>"
+ + QString::number(gindex) + "</td></tr>";
+ s += "</table>";
+
+ emit setDetails(s);
+
+ if (jump)
+ emit setGindex(gindex);
+
+ if (jumptoread)
+ emit jumpToRead(jumptoread);
+ }
+}
+
+void InsertField::canvasCleared()
+{
+ m_featrect = NULL;
+ m_feat = NULL;
+ m_lastsearch = NULL;
+}
+
+
+void InsertField::search(const QString & str)
+{
+ if ( str.isEmpty() )
+ {
+ setFeatRect (NULL);
+ m_lastsearch = NULL;
+ return;
+ }
+
+ QRegExp exp (str);
+ Q3CanvasItemList all = canvas()->allItems();
+ Q3CanvasItemList::Iterator it;
+
+ // pick up the search where we left off
+ for ( it = all.begin(); it != all.end(); ++ it )
+ if ( *it == m_lastsearch )
+ {
+ ++ it;
+ break;
+ }
+
+ bool wrap = false;
+ for ( ; !wrap || it != all.end(); ++ it )
+ {
+ // wrap around
+ if ( it == all.end() )
+ {
+ it = all.begin();
+ wrap = true;
+ }
+
+ if ( (*it)->rtti() == InsertCanvasItem::RTTI )
+ {
+ InsertCanvasItem * iitem = (InsertCanvasItem *) *it;
+ Insert * ins = iitem->m_insert;
+ QString aiid (QString::number(ins->m_aid));
+ QString biid (QString::number(ins->m_bid));
+ QString aeid (m_datastore->read_bank.lookupEID(ins->m_aid).c_str());
+ QString beid (m_datastore->read_bank.lookupEID(ins->m_bid).c_str());
+
+ // search insert aiid, biid, aeid, beid
+ if ( aiid.contains(exp) || biid.contains(exp) ||
+ aeid.contains(exp) || beid.contains(exp) )
+ break;
+ }
+ else if ( (*it)->rtti() == ContigCanvasItem::RTTI )
+ {
+ ContigCanvasItem * citem = (ContigCanvasItem *) *it;
+ AMOS::Tile_t * tile = &(citem->m_tile);
+ QString bid (QString::number(m_datastore->contig_bank.
+ getIDMap().lookupBID(tile->source)));
+ QString iid (QString::number(citem->m_tile.source));
+ QString eid (m_datastore->contig_bank.lookupEID(tile->source).c_str());
+
+ // search contig bid, iid, eid
+ if ( bid.contains(exp) || iid.contains(exp) || eid.contains(exp) )
+ break;
+ }
+ else if ( (*it)->rtti() == FeatureCanvasItem::RTTI )
+ {
+ FeatureCanvasItem * fitem = (FeatureCanvasItem *) *it;
+ QString iid (QString::number(fitem->m_feat.getIID()));
+ QString eid (fitem->m_feat.getEID().c_str());
+ QString com (fitem->m_feat.getComment().c_str());
+
+ // search feature iid, eid, and comment words
+ if ( iid.contains(exp) || eid.contains(exp) || com.contains(exp) )
+ break;
+ }
+ }
+
+ if ( it != all.end() )
+ {
+ QString s;
+ int jumptoread = 0;
+ bool jump = false;
+
+ processItemSelection(s, it, jumptoread, jump,
+ false, false, 0);
+ emit setDetails(s);
+
+ setFeatRect (*it);
+ m_lastsearch = *it;
+ }
+ else
+ {
+ setFeatRect (NULL);
+ m_lastsearch = NULL;
+ }
+}
+
+void InsertField::resizeEvent(QResizeEvent * e)
+{
+ emit fieldResized();
+}
diff --git a/src/hawkeye/InsertField.hh b/src/hawkeye/InsertField.hh
new file mode 100644
index 0000000..71acdaf
--- /dev/null
+++ b/src/hawkeye/InsertField.hh
@@ -0,0 +1,87 @@
+#ifndef INSERT_FIELD_HH_
+#define INSERT_FIELD_HH_ 1
+
+#include <q3canvas.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QWheelEvent>
+#include <QMouseEvent>
+#include <QPaintEvent>
+
+class DataStore;
+class Insert;
+class InsertCanvasItem;
+class RangeScrollBar_t;
+
+class InsertField : public Q3CanvasView
+{
+ Q_OBJECT
+
+public:
+ InsertField(DataStore * datastore,
+ int & hoffset,
+ Q3Canvas * canvas,
+ QWidget * parent = 0,
+ const char * name = 0);
+
+ void setScrollBars(RangeScrollBar_t * hrange, RangeScrollBar_t * vrange);
+
+signals:
+ void visibleRange(int, double);
+ void setDetails(const QString & message);
+ void setGindex(int gindex);
+
+ void readIIDHighlighted(const QString &);
+ void readEIDHighlighted(const QString &);
+ void jumpToRead(int iid);
+ void updateVisibleRange();
+ void fieldResized();
+
+public slots:
+ void resizeEvent(QResizeEvent * e);
+
+ void setZoomInTool();
+ void setZoomOutTool();
+ void setSelectTool();
+
+
+ void highlightRead(int iid);
+ void highlightIID(const QString & qeid);
+ void highlightEID(const QString & qeid);
+
+ void canvasCleared();
+
+ void search(const QString & str);
+
+
+protected:
+ void contentsMousePressEvent(QMouseEvent* e);
+ void wheelEvent(QWheelEvent *e);
+ void viewportPaintEvent(QPaintEvent *e);
+
+private:
+ void processItemSelection(QString & s,
+ Q3CanvasItemList::Iterator & it,
+ int & jumptoread,
+ bool & jump,
+ bool rightButtonDown,
+ bool jumpToBuddy,
+ int clickpos);
+
+ void setFeatRect (Q3CanvasItem * item);
+ void highlightInsert(InsertCanvasItem * iitem, bool highlight, bool highlightBuddy);
+ void getInsertString(QString & s, int which, Insert * ins, int isSecond, InsertCanvasItem * iitem);
+ DataStore * m_datastore;
+ int & m_hoffset;
+
+ Q3CanvasRectangle * m_featrect;
+ Q3CanvasItem * m_feat;
+ Q3CanvasItem * m_lastsearch;
+
+ RangeScrollBar_t * m_hrange;
+ RangeScrollBar_t * m_vrange;
+
+ int m_toolstate;
+};
+
+#endif
diff --git a/src/hawkeye/InsertPosition.cc b/src/hawkeye/InsertPosition.cc
new file mode 100644
index 0000000..fe4382c
--- /dev/null
+++ b/src/hawkeye/InsertPosition.cc
@@ -0,0 +1,134 @@
+#include "InsertPosition.hh"
+#include <iostream>
+#include <qpainter.h>
+#include <qpixmap.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+#include "DataStore.hh"
+
+using namespace std;
+
+InsertPosition::InsertPosition(DataStore * datastore, int & scaffoldId,
+ QString & scaffoldName, QWidget * parent,
+ const char * name)
+ : m_scaffoldId(scaffoldId), m_scaffoldName(scaffoldName), QWidget(parent, name), m_datastore(datastore)
+{
+ setMinimumHeight(60);
+ setWindowFlags(Qt::WRepaintNoErase);
+
+ m_start = 0;
+ m_scale = 1;
+ m_pos = 0;
+}
+
+
+void InsertPosition::setVisibleRange(int start, double scale)
+{
+ m_start = start;
+ m_scale = scale;
+
+ update();
+}
+
+void InsertPosition::setScaffoldCoordinate(int pos)
+{
+ m_pos = pos;
+ update();
+}
+
+void InsertPosition::paintEvent(QPaintEvent * e)
+{
+ int linepos = 55;
+
+ QPainter p(this);
+
+ p.setBrush(Qt::black);
+ p.drawRect(rect());
+
+ p.setPen(Qt::white);
+ p.setFont(QFont("Helvetica", 12));
+
+ int center = (int) width()/2;
+
+ QString label = "Scaffold: ";
+
+ if (m_scaffoldName.isEmpty())
+ {
+ label += QString::number(m_scaffoldId);
+ }
+ else
+ {
+ label += m_scaffoldName + " [" +
+ QString::number(m_scaffoldId) + "]";
+ }
+
+ label += " Contig: ";
+ QString contigname = m_datastore->contig_bank.lookupEID(m_datastore->m_contigId).c_str();
+
+ if (contigname.isEmpty())
+ {
+ label += QString::number(m_datastore->m_contigId);
+ }
+ else
+ {
+ label += contigname + " [" +
+ QString::number(m_datastore->m_contigId) + "]";
+ }
+
+ label += " Position: " + QString::number(m_pos);
+
+ label += " Viewing: " + QString::number(m_start, 'f', 0)
+ + " - " + QString::number((int)m_start+(width() / m_scale), 'f', 0);
+
+ p.drawText(center-400, 2, 800, 25, Qt::AlignCenter, label);
+
+ int distance = (int)(100/m_scale); // 100 pixels between tick marks
+
+ double sd = distance;
+ int num = 0;
+
+ while (sd > 10)
+ {
+ sd /= 10;
+ num++;
+ }
+
+ distance = (int) sd;
+ while (num)
+ {
+ distance *= 10;
+ num--;
+ }
+
+ p.translate(2, 0); // account for scroll view frame
+
+ p.drawLine(0, linepos, width(), linepos);
+
+ QString pos;
+
+ for (int i = m_start; i < m_start + (width() / m_scale); i++)
+ {
+ if (i % distance == 0)
+ {
+ p.drawLine((i-m_start) * m_scale, linepos-2,
+ (i-m_start) * m_scale, linepos+2);
+
+ if (abs(i) > 1000000)
+ {
+ pos = QString::number(i/1000000.0) + "M";
+ }
+ else if (abs(i) > 1000)
+ {
+ pos = QString::number(i/1000.0) + "K";
+ }
+ else
+ {
+ pos = QString::number(i);
+ }
+
+ p.drawText((i-m_start) * m_scale - 50, linepos-20, 100, 20,
+ Qt::AlignHCenter | Qt::AlignBottom, pos);
+ }
+ }
+}
+
diff --git a/src/hawkeye/InsertPosition.hh b/src/hawkeye/InsertPosition.hh
new file mode 100644
index 0000000..d64d522
--- /dev/null
+++ b/src/hawkeye/InsertPosition.hh
@@ -0,0 +1,35 @@
+#ifndef INSERT_POSITION_HH_
+#define INSERT_POSITION_HH_ 1
+
+#include <qwidget.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+
+class DataStore;
+
+class InsertPosition : public QWidget
+{
+ Q_OBJECT
+
+public:
+ InsertPosition(DataStore * datastore, int & scaffoldId,
+ QString & scaffoldName, QWidget * parent, const char * name);
+
+ void paintEvent(QPaintEvent * e);
+
+public slots:
+ void setVisibleRange(int, double);
+ void setScaffoldCoordinate(int);
+
+private:
+ DataStore * m_datastore;
+ double m_scale;
+ int m_start;
+ int m_pos;
+
+ int & m_scaffoldId;
+ QString & m_scaffoldName;
+
+};
+
+#endif
diff --git a/src/hawkeye/InsertWidget.cc b/src/hawkeye/InsertWidget.cc
new file mode 100644
index 0000000..b756428
--- /dev/null
+++ b/src/hawkeye/InsertWidget.cc
@@ -0,0 +1,1923 @@
+#include "InsertWidget.hh"
+
+#include <set>
+
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qmatrix.h>
+#include <qmessagebox.h>
+#include <qcursor.h>
+#include <q3accel.h>
+#include <qapplication.h>
+#include <q3textedit.h>
+#include <q3hbox.h>
+#include <qregexp.h>
+//Added by qt3to4:
+#include <Q3BoxLayout>
+#include <Q3VBoxLayout>
+#include <Q3PointArray>
+#include <QtGui>
+
+#include "RenderSeq.hh"
+#include "InsertCanvasItem.hh"
+#include "CoverageCanvasItem.hh"
+#include "FeatureCanvasItem.hh"
+#include "ContigCanvasItem.hh"
+#include "UIElements.hh"
+#include "CoverageStats.hh"
+#include "InsertField.hh"
+#include "InsertPosition.hh"
+#include "DataStore.hh"
+#include "CoverageRectCanvasItem.hh"
+#include "OverviewField.hh"
+
+#include "RangeScrollBar.hh"
+
+
+
+using namespace AMOS;
+using namespace std;
+typedef HASHMAP::hash_map<ID_t, Tile_t *> SeqTileMap_t;
+
+int MAXMERCOUNT = 250;
+
+
+int extractSNPScore (const AMOS::Feature_t & fea)
+{
+ QString com (fea.getComment().c_str());
+ com.replace ("HIGH_SNP ", "");
+ com.replace (QRegExp (" .+"), "");
+ return com.toInt();
+}
+
+int extractUnitigScore (const AMOS::Feature_t & fea)
+{
+ return fea.getRange().getLength();
+}
+
+int extractQCScore (const AMOS::Feature_t & fea)
+{
+ return fea.getRange().getLength();
+}
+
+int extractBreakScore (const AMOS::Feature_t & fea)
+{
+ QString com (fea.getComment().c_str());
+ com.replace (QRegExp (" .+"), "");
+ return com.toInt();
+}
+
+
+struct FeatOrderCmp
+{
+ bool operator() (const AMOS::Feature_t & a, const AMOS::Feature_t & b)
+ {
+ int aoffset = a.getRange().getLo();
+ int boffset = b.getRange().getLo();
+
+ int offdiff = boffset - aoffset;
+
+ if (offdiff)
+ {
+ if (offdiff < 0) { return false; }
+ return true;
+ }
+
+ int lendiff = (b.getRange().getLength()) -
+ (a.getRange().getLength());
+
+ if (lendiff)
+ {
+ if (lendiff < 0) { return false; }
+ return true;
+ }
+
+ return true;
+ }
+};
+
+
+
+InsertWidget::InsertWidget(DataStore * datastore,
+ map<char, pair<int, bool> > & types,
+ QWidget * parent, const char * name)
+ : QWidget(parent, name),
+ m_types(types)
+{
+ m_datastore = datastore;
+ m_tilingVisible = NULL;
+
+ //setWindowFlags(Qt::WRepaintNoErase | Qt::WResizeNoErase);
+
+ m_hscale = .06250;
+ m_contigid = 0;
+ m_gstart = 0;
+ m_gend = 0;
+ m_width = 0;
+ m_scaffoldId = 0;
+
+ m_paddle = NULL;
+ m_ball = NULL;
+ m_timer = new QTimer(this, "timer");
+ m_autoplay = 0;
+ connect(m_timer, SIGNAL(timeout()),
+ this, SLOT(timeout()));
+
+ m_hoffset = 0;
+ m_connectMates = 1;
+ m_partitionTypes = 1;
+ m_coveragePlot = 1;
+ m_cestats = 1;
+ m_paintScaffold = 1;
+ m_colorByLibrary = 0;
+ m_colorByMate = 0;
+ m_colorByStretchiness = 0;
+
+ m_tintHappiness = 0;
+ m_showscaffold = 1;
+ m_kmercoverageplot = 1;
+ m_insertCovFeatures = 1;
+ m_readCovFeatures = 1;
+// m_snpFeatures = 1;
+// m_unitigFeatures = 1;
+// m_qcFeatures = 1;
+// m_breakFeatures = 1;
+ m_misasmFeatures = 1;
+ m_otherFeatures = 1;
+
+ m_syncWithTiling = 1;
+
+ m_kmerstats = NULL;
+ m_insertCL = NULL;
+ m_readCL = NULL;
+
+ m_overviewtop = 0;
+ m_overviewbottom = 1;
+
+ m_updatingScrollBars = false;
+
+ m_currentScaffold = AMOS::NULL_ID;
+ m_currentContig = AMOS::NULL_ID;
+
+ m_seqheight = 4;
+ m_tilingwidth = 0;
+
+ m_iposition = new InsertPosition(m_datastore, m_scaffoldId, m_scaffoldName,
+ this, "insertposition");
+ m_icanvas = new Q3Canvas(this, "icanvas");
+ m_icanvas->setBackgroundColor(QColor(0,0,0));
+ m_icanvas->retune(128);
+
+ Q3HBox * hbox = new Q3HBox(this);
+ m_ifield = new InsertField(datastore, m_hoffset, m_icanvas, hbox, "qcv");
+
+ vrange = new RangeScrollBar_t(Qt::Vertical, hbox);
+
+ m_overview = new OverviewField(m_icanvas, this, "overview");
+ m_overview->setMaximumHeight(100);
+ m_overview->setMinimumHeight(100);
+ m_overview->setVScrollBarMode(Q3ScrollView::AlwaysOff);
+ m_overview->setHScrollBarMode(Q3ScrollView::AlwaysOff);
+ connect(m_overview, SIGNAL(centerView(int)), this, SLOT(centerView(int)));
+
+ hrange = new RangeScrollBar_t(Qt::Horizontal, this);
+
+ m_ifield->setScrollBars(hrange, vrange);
+
+ Q3BoxLayout * vbox = new Q3VBoxLayout(this);
+ vbox->addWidget(m_iposition);
+ vbox->addWidget(hbox, 10);
+ vbox->addWidget(m_overview);
+ vbox->addWidget(hrange);
+ vbox->activate();
+
+ connect(this, SIGNAL(setZoomInTool()), m_ifield, SLOT(setZoomInTool()));
+ connect(this, SIGNAL(setZoomOutTool()), m_ifield, SLOT(setZoomOutTool()));
+ connect(this, SIGNAL(setSelectTool()), m_ifield, SLOT(setSelectTool()));
+
+ connect(m_ifield, SIGNAL(updateVisibleRange()),
+ this, SLOT(updateVisibleRange()));
+
+
+ connect(this, SIGNAL(search(const QString &)),
+ m_ifield, SLOT(search(const QString &)));
+
+ connect(this, SIGNAL(highlightIID(const QString &)),
+ m_ifield, SLOT(highlightIID(const QString &)));
+
+ connect(this, SIGNAL(canvasCleared()),
+ m_ifield, SLOT(canvasCleared()));
+
+ connect(this, SIGNAL(highlightRead(int)),
+ m_ifield, SLOT(highlightRead(int)));
+
+ connect(this, SIGNAL(highlightEID(const QString &)),
+ m_ifield, SLOT(highlightEID(const QString &)));
+
+ connect(m_ifield, SIGNAL(readEIDHighlighted(const QString &)),
+ this, SIGNAL(readEIDHighlighted(const QString &)));
+
+ connect(m_ifield, SIGNAL(readIIDHighlighted(const QString &)),
+ this, SIGNAL(readIIDHighlighted(const QString &)));
+
+ connect(m_ifield, SIGNAL(jumpToRead(int)),
+ this, SIGNAL(jumpToRead(int)));
+
+
+ connect(hrange, SIGNAL(rangeChanged(int, int)),
+ this, SLOT(setVisibleHRange(int, int)));
+
+ connect(hrange, SIGNAL(valueChanged(int)),
+ this, SLOT(setHPos(int)));
+
+ connect(vrange, SIGNAL(rangeChanged(int, int)),
+ this, SLOT(setVisibleVRange(int, int)));
+
+ connect(vrange, SIGNAL(valueChanged(int)),
+ this, SLOT(setVPos(int)));
+
+ connect(m_ifield, SIGNAL(visibleRange(int, double)),
+ m_iposition, SLOT(setVisibleRange(int,double)));
+
+ connect(this, SIGNAL(currentScaffoldCoordinate(int)),
+ m_iposition, SLOT(setScaffoldCoordinate(int)));
+
+ connect(m_ifield, SIGNAL(setDetails(const QString &)),
+ this, SIGNAL(setDetails(const QString &)));
+
+ connect(m_ifield, SIGNAL(setGindex(int)),
+ this, SLOT(computePos(int)));
+
+ connect(m_ifield, SIGNAL(fieldResized()), this, SLOT(resizeField()));
+ connect(m_overview, SIGNAL(overviewResized()), this, SLOT(resizeOverview()));
+
+ Q3Accel *a = new Q3Accel( this );
+ a->connectItem(a->insertItem(Qt::CTRL+Qt::SHIFT+Qt::Key_S), this, SLOT(start()) );
+ a->connectItem(a->insertItem(Qt::Key_Left), this, SLOT(left()) );
+ a->connectItem(a->insertItem(Qt::Key_Right), this, SLOT(right()) );
+ a->connectItem(a->insertItem(Qt::Key_Escape), this, SLOT(stopbreak()));
+ a->connectItem(a->insertItem(Qt::CTRL+Qt::SHIFT+Qt::Key_A), this, SLOT(autoplay()) );
+
+ a->connectItem(a->insertItem(Qt::CTRL+Qt::Key_Q), qApp, SLOT(quit()));
+
+ m_ifield->show();
+}
+
+void InsertWidget::centerView(int xpos)
+{
+ xpos = (int)(xpos*m_ifield->worldMatrix().m11());
+ m_ifield->center(xpos, (int)(m_ifield->contentsY() + m_ifield->visibleHeight()/2));
+ updateVisibleRange();
+}
+
+void InsertWidget::computePos(int gindex)
+{
+ // figure out which contig tiles this position
+
+ if (m_ctiling.size() == 1)
+ {
+ emit setGindex(gindex);
+ }
+ else
+ {
+ vector<Tile_t>::const_iterator ci;
+
+ for (ci = m_ctiling.begin(); ci != m_ctiling.end(); ci++)
+ {
+ if ((ci->offset <= gindex) && (gindex <= (ci->offset + ci->range.getLength())))
+ {
+ AMOS::ID_t bid = m_datastore->contig_bank.getIDMap().lookupBID(ci->source);
+
+ gindex -= ci->offset;
+
+ if (ci->range.isReverse())
+ {
+ gindex = ci->range.getLength() - gindex;
+ }
+
+ emit setContigId(bid);
+ emit setGindex(gindex);
+ break;
+ }
+ }
+ }
+}
+
+void InsertWidget::initializeVisibleRectangle()
+{
+ m_tilingVisible = new Q3CanvasRectangle(m_icanvas);
+ m_tilingVisible->setZ(-1);
+
+ m_tilingVisible->setBrush(QColor(200,200,100));
+ m_tilingVisible->setPen(QColor(200,200,100));
+}
+
+InsertWidget::~InsertWidget()
+{
+ flushInserts();
+
+ if (m_kmerstats) { delete m_kmerstats; }
+ if (m_insertCL) { delete m_insertCL; }
+ if (m_readCL) { delete m_readCL; }
+}
+
+
+void InsertWidget::setTilingVisibleRange(int contigid, int gstart, int gend)
+{
+ if (contigid == AMOS::NULL_ID) { return; }
+
+ m_contigid = contigid;
+ m_gstart = gstart;
+ m_gend = gend;
+
+ if (m_paintScaffold && m_datastore->m_scaffoldId != AMOS::NULL_ID)
+ {
+ vector<Tile_t>::const_iterator ci;
+ for (ci = m_ctiling.begin(); ci != m_ctiling.end(); ci++)
+ {
+ AMOS::ID_t bid = m_datastore->contig_bank.getIDMap().lookupBID(ci->source);
+
+ if (bid == (ID_t) contigid)
+ {
+ if (ci->range.isReverse())
+ {
+ int t = gstart;
+ gstart = ci->offset + (ci->range.getLength() - gend);
+ gend = ci->offset + (ci->range.getLength() - t);
+ }
+ else
+ {
+ gstart += ci->offset;
+ gend += ci->offset;
+ }
+
+ break;
+ }
+ }
+ }
+
+
+ // resize and place rectangle
+ m_tilingVisible->setSize((int)(m_hscale*(gend - gstart)) +1, m_icanvas->height());
+ m_tilingVisible->move((int)(m_hscale*(gstart+m_hoffset)), 0);
+ m_tilingVisible->show();
+
+ m_icanvas->setChanged(m_tilingVisible->boundingRect());
+ m_icanvas->update();
+
+ if (m_syncWithTiling)
+ {
+ double xpos = m_hscale*((gstart + gend)/2+m_hoffset);
+ xpos *= m_ifield->worldMatrix().m11();
+ xpos -= (m_ifield->visibleWidth())/2;
+ m_ifield->setContentsPos((int) xpos, m_ifield->contentsY());
+ updateVisibleRange();
+ }
+
+ emit currentScaffoldCoordinate(gstart);
+}
+
+void InsertWidget::setSyncWithTiling(bool sync)
+{
+ m_syncWithTiling = sync;
+}
+
+
+void InsertWidget::setHPos(int xpos)
+{
+ m_ifield->setContentsPos((int)(xpos*m_ifield->worldMatrix().m11()), m_ifield->contentsY());
+}
+
+void InsertWidget::setVPos(int vpos)
+{
+ m_ifield->setContentsPos(m_ifield->contentsX(), (int)(vpos*m_ifield->worldMatrix().m22()));
+}
+
+void InsertWidget::setVisibleHRange(int left, int right)
+{
+ if (!m_updatingScrollBars)
+ {
+ right = max(left+2, right);
+ double xf = ((double)m_ifield->width()-4) / ((right - left + 1));
+
+ QMatrix m = m_ifield->worldMatrix();
+ QMatrix newzoom(xf, m.m12(), m.m21(), m.m22(), m.dx(), m.dy());
+ m_ifield->setWorldMatrix(newzoom); // visiblehrange
+
+ setHPos(left);
+ }
+}
+
+void InsertWidget::setVisibleVRange(int top, int bottom)
+{
+ if (!m_updatingScrollBars)
+ {
+ bottom = max(top+2, bottom);
+ double yf = ((double)(m_ifield->height()-4)) / (bottom - top + 1);
+
+ QMatrix m(m_ifield->worldMatrix());
+ QMatrix newzoom(m.m11(), m.m12(), m.m21(), yf, m.dx(), m.dy());
+ m_ifield->setWorldMatrix(newzoom); //visiblevrange
+
+ setVPos(top);
+ }
+}
+
+void InsertWidget::updateVisibleRange()
+{
+ m_updatingScrollBars = true;
+ QRect rc = QRect(m_ifield->contentsX(), m_ifield->contentsY(),
+ m_ifield->visibleWidth(), m_ifield->visibleHeight() );
+ QRect real = m_ifield->inverseWorldMatrix().mapRect(rc);
+
+ hrange->setRange((int)(real.x()), (int)(real.x()+real.width()));
+ vrange->setRange((int)(real.y()), (int)(real.y()+real.height()));
+ m_updatingScrollBars = false;
+}
+
+
+void InsertWidget::flushInserts()
+{
+ vector<Insert *>::iterator i;
+
+ for (i = m_inserts.begin();
+ i != m_inserts.end();
+ i++)
+ {
+ delete (*i);
+ }
+
+ m_inserts.clear();
+}
+
+void InsertWidget::computeInsertHappiness()
+{
+ flushInserts();
+ m_datastore->calculateInserts(m_tiling, m_inserts, 1, 1);
+ computeCoverage();
+
+ if (!m_connectMates)
+ {
+ disconnectMates();
+ }
+}
+
+void InsertWidget::clearCanvas()
+{
+ // clear and flush
+ Q3CanvasItemList list = m_icanvas->allItems();
+ Q3CanvasItemList::Iterator it = list.begin();
+ for (; it != list.end(); ++it) {
+ if ( *it )
+ delete *it;
+ }
+
+ initializeVisibleRectangle();
+ m_icanvas->update();
+ emit canvasCleared();
+}
+
+void InsertWidget::initializeTiling()
+{
+ QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
+
+ if (m_kmerstats)
+ {
+ delete m_kmerstats;
+ m_kmerstats = NULL;
+ }
+
+ m_features.clear();
+ m_ctiling.clear();
+
+ bool newScaffold =
+ (m_currentScaffold == AMOS::NULL_ID && (m_currentContig != m_datastore->m_contigId)) ||
+ (m_currentScaffold != AMOS::NULL_ID && (m_currentScaffold != m_datastore->m_scaffoldId));
+
+ m_currentScaffold = m_datastore->m_scaffoldId;
+ m_currentContig = m_datastore->m_contigId;
+ m_tiling.clear();
+
+ if (m_paintScaffold && (m_currentScaffold != AMOS::NULL_ID))
+ {
+ Scaffold_t scaffold;
+ m_datastore->fetchScaffoldBID(m_datastore->m_scaffoldId, scaffold);
+
+ m_scaffoldId = scaffold.getIID();
+ m_scaffoldName = scaffold.getEID().c_str();
+
+ m_tilingwidth = scaffold.getSpan();
+
+ m_ctiling = scaffold.getContigTiling();
+ sort(m_ctiling.begin(), m_ctiling.end(), TileOrderCmp());
+
+ if (m_kmercoverageplot && !m_datastore->mer_table.empty())
+ {
+ m_kmerstats = new CoverageStats(scaffold.getSpan(), 0, Distribution_t());
+ }
+
+ EventTime_t ctime;
+ cerr << "Mapping read tiling for " << m_ctiling.size() << " contigs... ";
+
+ int lendiff = 0;
+
+ typedef map<ID_t, vector<Tile_t>::iterator > ContigTileMap;
+ ContigTileMap contigTiles;
+
+ vector<Tile_t>::iterator ci;
+ for (ci = m_ctiling.begin(); ci != m_ctiling.end(); ci++)
+ {
+ Contig_t contig;
+ m_datastore->fetchContigIID(ci->source, contig);
+
+ contigTiles.insert(make_pair(contig.getIID(), ci));
+
+ ci->offset += lendiff; // shift the start of the contig by the cummulative length difference
+
+ int clen = contig.getLength();
+
+ Range_t scaffrange = ci->range;
+
+ // Ensure contig coordinates are gapped
+ if (scaffrange.isReverse())
+ {
+ scaffrange.begin = scaffrange.end+clen;
+ lendiff += scaffrange.begin - ci->range.begin;
+ }
+ else
+ {
+ scaffrange.end = scaffrange.begin+clen;
+ lendiff += scaffrange.end - ci->range.end;
+ }
+
+ ci->range = scaffrange;
+
+ // Flip the contig if necessary
+ if (scaffrange.isReverse())
+ {
+ contig.reverseComplement();
+ scaffrange.swap();
+ }
+
+ if (m_kmerstats)
+ {
+ string cons = contig.getSeqString();
+
+ // current mer between i..j
+ DataStore::Mer_t fwd_mer = 0, rev_mer = 0;
+ int merlen = 0;
+ int j = 0; // 1 past where the mer ends
+
+ for (int i = 0; i < clen; i++)
+ {
+ while(merlen < m_datastore->Kmer_Len && j < clen)
+ {
+ if (cons[j] != '-')
+ {
+ m_datastore->Forward_Add_Ch(fwd_mer, cons[j]);
+ m_datastore->Reverse_Add_Ch(rev_mer, cons[j]);
+ merlen++;
+ }
+ j++;
+ }
+
+ if (j >= clen) { break; }
+
+ int mc = m_datastore->getMerCoverage(fwd_mer, rev_mer);
+ if (mc > MAXMERCOUNT) { mc = MAXMERCOUNT; }
+ m_kmerstats->addPoint(i+ci->offset, mc);
+
+ if (cons[i] != '-') { merlen--; }
+ }
+ }
+
+ vector<Tile_t> & rtiling = contig.getReadTiling();
+ vector<Tile_t>::const_iterator ri;
+
+ for (ri = rtiling.begin(); ri != rtiling.end(); ri++)
+ {
+ Tile_t mappedTile;
+ mappedTile.source = ri->source;
+ mappedTile.gaps = ri->gaps;
+ mappedTile.range = ri->range;
+ mappedTile.offset = ci->offset + ri->offset;
+
+ m_tiling.push_back(mappedTile);
+ }
+ }
+
+ cerr << "done. " << ctime.str() << endl;
+
+ if (m_datastore->feat_bank.isOpen())
+ {
+ EventTime_t timer;
+ cerr << "Loading Features... ";
+
+ Feature_t feat;
+ m_datastore->feat_bank.seekg(1);
+
+ while (m_datastore->feat_bank >> feat)
+ {
+ if (feat.getSource().second == Scaffold_t::NCODE &&
+ feat.getSource().first == scaffold.getIID())
+ {
+ m_features.push_back(feat);
+ }
+ else if (feat.getSource().second == Contig_t::NCODE)
+ {
+ ContigTileMap::iterator ctm = contigTiles.find(feat.getSource().first);
+
+ if (ctm != contigTiles.end())
+ {
+ Range_t rng = feat.getRange( );
+
+ if (ctm->second->range.isReverse())
+ {
+ rng.swap();
+ rng.begin = (ctm->second->range.getLength() - feat.getRange().begin);
+ rng.end = (ctm->second->range.getLength() - feat.getRange().end);
+ }
+
+ rng.begin += ctm->second->offset;
+ rng.end += ctm->second->offset;
+
+ feat.setRange(rng);
+ m_features.push_back(feat);
+ }
+ }
+ }
+
+ cerr << timer.str() << " " << m_features.size() << " features" << endl;
+ }
+ }
+ else
+ {
+ if (m_kmercoverageplot && !m_datastore->mer_table.empty())
+ {
+ cerr << "Computing kmer coverage" << endl;
+ string cons = m_datastore->m_contig.getSeqString();
+ int clen = cons.size();
+
+ m_kmerstats = new CoverageStats(clen, 0, Distribution_t());
+
+ for (int i = 0; i < clen; i++)
+ {
+ DataStore::Mer_t fwd_mer = 0, rev_mer = 0;
+ int merlen = 0;
+ int j = i;
+
+ while(merlen < m_datastore->Kmer_Len && j < clen)
+ {
+ if (cons[j] != '-')
+ {
+ m_datastore->Forward_Add_Ch(fwd_mer, cons[j]);
+ m_datastore->Reverse_Add_Ch(rev_mer, cons[j]);
+ merlen++;
+ }
+ j++;
+ }
+
+ if (j >= clen) { break; }
+
+ int mc = m_datastore->getMerCoverage(fwd_mer, rev_mer);
+ if (mc > MAXMERCOUNT) { mc = MAXMERCOUNT; }
+ m_kmerstats->addPoint(i, mc);
+ }
+ }
+
+ Tile_t currentContig;
+ currentContig.source = m_datastore->m_contig.getIID();
+ currentContig.offset = 0;
+ currentContig.range = Range_t(0, m_datastore->m_contig.getLength());
+
+ m_ctiling.push_back(currentContig);
+
+ m_tilingwidth = m_datastore->m_contig.getLength();
+ m_tiling = m_datastore->m_contig.getReadTiling();
+
+ if (m_datastore->feat_bank.isOpen())
+ {
+ Feature_t feat;
+ m_datastore->feat_bank.seekg(1);
+
+ while (m_datastore->feat_bank >> feat)
+ {
+ if (feat.getSource().second == Contig_t::NCODE &&
+ feat.getSource().first == m_datastore->m_contig.getIID())
+ {
+ m_features.push_back(feat);
+ }
+ }
+ }
+ }
+
+ sort(m_tiling.begin(), m_tiling.end(), TileOrderCmp());
+ sort(m_features.begin(), m_features.end(), FeatOrderCmp());
+
+ computeInsertHappiness();
+ paintCanvas();
+
+ if (newScaffold) { showAll(); }
+
+ QApplication::restoreOverrideCursor();
+}
+
+typedef map <ID_t, QColor> ColorMap;
+QColor getContigColor(ColorMap & contigColorMap, ID_t iid)
+{
+ ColorMap::iterator cci = contigColorMap.find(iid);
+
+ if (cci == contigColorMap.end())
+ {
+ int s = contigColorMap.size();
+ int i = s % strlen(Insert::allstates);
+ int j = (s / strlen(Insert::allstates)) % 2;
+
+ QColor color = UIElements::getInsertColor((Insert::MateState)Insert::allstates[i]);
+ if (j == 1) { color = color.dark(200); }
+
+ cci = contigColorMap.insert(make_pair(iid, color)).first;
+ }
+
+ return cci->second;
+}
+
+void InsertWidget::computeCoverage()
+{
+ int leftmost = 0;
+ if (!m_inserts.empty())
+ {
+ leftmost = min(0, (*m_inserts.begin())->m_loffset);
+ }
+ m_hoffset = -leftmost;
+
+ //cerr << "m_hoffset: " << m_hoffset << endl;
+
+ if (m_insertCL) { delete m_insertCL; }
+ if (m_readCL) { delete m_readCL; }
+
+ // coverage will change at each endpoint of each (happy) insert
+ m_insertCL = new CoverageStats((2+m_inserts.size())*4, 0, Distribution_t());
+ m_insertCL->addEndpoints(leftmost, leftmost);
+
+ m_libStats.clear();
+ LibStats::iterator li;
+
+ int curloffset = 0, curroffset = 0;
+ int totalinsertlen = 0;
+ int rightmost = 0;
+
+ int cestatsheight = 100;
+
+ vector<Insert *>::iterator ii;
+
+ for (ii = m_inserts.begin(); ii != m_inserts.end(); ii++)
+ {
+ curloffset = (*ii)->m_loffset;
+ curroffset = (*ii)->m_roffset;
+
+ if (curroffset > rightmost) { rightmost = curroffset; }
+
+ // Only count happy mates towards insert coverage
+ if ((*ii)->m_state == Insert::Happy)
+ {
+ totalinsertlen += (curroffset - curloffset + 1);
+ m_insertCL->addEndpoints(curloffset, curroffset);
+ }
+
+ // CE connected inserts count towards ce val
+ if ((*ii)->ceConnected())
+ {
+ li = m_libStats.find((*ii)->m_libid);
+
+ if (li == m_libStats.end())
+ {
+ li = m_libStats.insert(make_pair((*ii)->m_libid, CoverageStats(m_inserts.size()*4, (*ii)->m_libid, (*ii)->m_dist))).first;
+ }
+
+ li->second.addEndpoints(curloffset, curroffset);
+ }
+ }
+
+ m_insertCL->addEndpoints(rightmost,rightmost);
+ m_insertCL->finalize();
+
+ m_width = rightmost - leftmost + 1;
+
+ for (li = m_libStats.begin(); li != m_libStats.end(); li++)
+ {
+ li->second.finalize();
+ li->second.finalizeCE(cestatsheight);
+ }
+
+ m_readCL = new CoverageStats(m_tiling.size()*4, 0, Distribution_t());
+
+ int totalbases = 0;
+ int readspan = 0;
+
+ vector<Tile_t>::iterator ti;
+ for (ti = m_tiling.begin(); ti != m_tiling.end(); ti++)
+ {
+ int len = ti->getGappedLength();
+
+ curloffset = ti->offset;
+ curroffset = ti->offset + len - 1;
+
+ if (curroffset > readspan) { readspan = curroffset; }
+
+ totalbases += len;
+
+ m_readCL->addEndpoints(curloffset, curroffset);
+ }
+
+ m_readCL->finalize();
+
+ int insertspan = (int)(m_insertCL->m_coverage[m_insertCL->m_curpos-1].x() - m_insertCL->m_coverage[0].x());
+ m_meaninsertcoverage = (insertspan) ? ((double)totalinsertlen)/insertspan : 0;
+ m_meanreadcoverage = ((double)totalbases) / readspan;
+}
+
+
+void InsertWidget::disconnectMates()
+{
+ int last = m_inserts.size();
+
+ for (int i = 0; i < last; i++)
+ {
+ Insert * ins = m_inserts[i];
+ if (ins->m_active == 2)
+ {
+ // disconnect the mates
+ Insert * j = new Insert(ins->m_aid, ins->m_acontig, ins->m_atile,
+ ins->m_bid, ins->m_bcontig, ins->m_btile,
+ ins->m_libid, ins->m_dist, ins->m_matetype);
+
+ j->setActive(1, ins, 0);
+ m_inserts.push_back(j);
+
+ ins->setActive(0, j, 0);
+ }
+ else
+ {
+ // disconnect the library
+ ins->setActive(ins->m_active, ins->m_other, 0);
+ }
+ }
+
+ sort(m_inserts.begin(), m_inserts.end(), Insert::TilingOrderCmp());
+}
+
+
+// You can't paint the entire coverage plot in one go because
+// of the silly 16 bit limitation in qpainter/x11, so break the coverage
+// into small pieces, and draw each separately.
+
+void InsertWidget::paintCoverage(const PointArray_t & arr,
+ const vector<double> & rawvalues,
+ bool copyRaw,
+ int arrLen,
+ int voffset, int vheight,
+ int libid,
+ double baseLevel,
+ QColor color,
+ bool compressed)
+{
+ if (arr.empty()) { return; }
+
+ QPen pen(color, 1.0);
+
+ int i = 0;
+ while (1)
+ {
+ int size = min(1000, (arrLen - i));
+ Q3PointArray window(size);
+ vector<double> windowraw(size);
+
+ for (int j = 0; j < size; j++)
+ {
+ window[j].setX((int)((arr[i+j].x()+m_hoffset) * m_hscale));
+
+ if (compressed) { window[j].setY(arr[i+j].y()); }
+ else { window[j].setY(voffset+vheight-arr[i+j].y()); }
+
+ if (copyRaw) { windowraw[j] = rawvalues[i+j]; }
+ }
+
+ int width = window[size-1].x()-window[0].x()+1;
+
+ if ( compressed )
+ {
+ new CoverageRectCanvasItem(window[0].x(), voffset,
+ width, vheight,
+ libid, baseLevel,
+ window, windowraw, copyRaw,
+ m_icanvas, color);
+ }
+ else
+ {
+ CoverageCanvasItem * cci = new CoverageCanvasItem(window[0].x(), voffset,
+ width, vheight,
+ libid, baseLevel,
+ window, windowraw, copyRaw,
+ m_icanvas, color);
+ cci->setPen(pen);
+ }
+
+ i+= size;
+
+ if (i >= arrLen) { break; }
+ i-=10;
+ }
+}
+
+void InsertWidget::paintCanvas()
+{
+ QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
+
+ clearCanvas();
+ if (!m_datastore->m_loaded) { return; }
+
+
+ int posoffset = 5;
+ int gutter = 5;
+ int voffset = posoffset+2*gutter;
+ int lineheight = m_seqheight+gutter;
+
+ int layoutgutter = 64;
+
+ int layoutpos;
+ vector<int> layout;
+ vector<int>::iterator li;
+
+ vector<Insert *>::iterator ii;
+ vector<Tile_t>::const_iterator ci;
+
+ cerr << "Paint:";
+
+ ColorMap libColorMap;
+ ColorMap contigColorMap;
+
+ if (m_colorByLibrary || m_cestats)
+ {
+ unsigned int type = 0;
+
+ DataStore::LibLookup_t::iterator li;
+ for (li = m_datastore->m_libdistributionlookup.begin();
+ li != m_datastore->m_libdistributionlookup.end();
+ li++)
+ {
+ libColorMap[li->first] = UIElements::getInsertColor((Insert::MateState)Insert::allstates[type]);
+ type++;
+
+ if (type >= strlen(Insert::allstates))
+ {
+ type = 0;
+ }
+ }
+ }
+
+ bool doPaintCoverage = true;
+ bool doPaintContigs = true;
+ bool doPaintFeatures = true;
+ bool m_drawInserts = true;
+
+ if (doPaintCoverage)
+ {
+ cerr << " coverage";
+
+ int inswidth = (m_insertCL->m_curpos) ? (int)((m_insertCL->m_coverage[m_insertCL->m_curpos-1].x() + m_hoffset) * m_hscale) : 0;
+ int redwidth = (m_readCL->m_curpos) ? (int)((m_readCL->m_coverage[m_readCL->m_curpos-1].x() + m_hoffset) * m_hscale) : 0;
+
+ int covwidth = max(inswidth, redwidth);
+
+ int cestatsheight = 100;
+ int covheight = max(m_insertCL->m_maxdepth, m_readCL->m_maxdepth);
+ if (m_kmerstats) { covheight = max(covheight, m_kmerstats->m_maxdepth); }
+
+ int cestatsoffset = voffset;
+
+ if (m_coveragePlot)
+ {
+ cestatsoffset += covheight + 2*gutter;
+
+ paintCoverage(m_insertCL->m_coverage, m_insertCL->m_cestat, false, m_insertCL->m_curpos,
+ voffset, covheight, -1, m_meaninsertcoverage, UIElements::color_insertcoverage);
+
+ paintCoverage(m_readCL->m_coverage, m_readCL->m_cestat, false, m_readCL->m_curpos,
+ voffset, covheight, -2, m_meanreadcoverage, UIElements::color_readcoverage);
+
+ if (m_kmerstats)
+ {
+ paintCoverage(m_kmerstats->m_coverage, m_kmerstats->m_cestat, false, m_kmerstats->m_curpos,
+ voffset, covheight, -3, 0.0, Qt::yellow);
+ }
+ }
+
+ if (m_cestats)
+ {
+ LibStats::iterator li;
+ for (li = m_libStats.begin(); li != m_libStats.end(); li++)
+ {
+ paintCoverage(li->second.m_coverage, li->second.m_cestat, true, li->second.m_curpos,
+ cestatsoffset, cestatsheight, (int)li->second.m_libid, (int)(cestatsheight/2),
+ (libColorMap[li->second.m_libid]));
+ }
+ }
+
+ int i = 0;
+ while (1)
+ {
+ int size = min(1000, covwidth - i);
+
+ if (m_coveragePlot)
+ {
+ Q3CanvasRectangle * covbg = new Q3CanvasRectangle(i, voffset,
+ size+1, covheight, m_icanvas);
+ covbg->setBrush(QColor(60,60,60));
+ covbg->setPen(QColor(60,60,60));
+ covbg->setZ(-3);
+ covbg->show();
+
+ Q3CanvasLine * base = new Q3CanvasLine(m_icanvas);
+ base->setPoints(i, voffset+covheight,
+ i+size, voffset+covheight);
+ base->setPen(QPen(Qt::white));
+ base->setZ(1);
+ base->show();
+ }
+
+ if (m_cestats)
+ {
+ Q3CanvasRectangle * covbg = new Q3CanvasRectangle(i, cestatsoffset,
+ size+1, cestatsheight, m_icanvas);
+ covbg->setBrush(QColor(60,60,60));
+ covbg->setPen(QColor(60,60,60));
+ covbg->setZ(-4);
+ covbg->show();
+
+ covbg = new Q3CanvasRectangle(i, cestatsoffset + cestatsheight/2 - 3*8 ,
+ size+1, 6*8, m_icanvas);
+ covbg->setBrush(QColor(75,75,75));
+ covbg->setPen(QColor(75,75,75));
+ covbg->setZ(-3);
+ covbg->show();
+ }
+
+ i+= size;
+
+ if (i >= covwidth) { break; }
+ i-=100;
+ }
+
+ if (m_coveragePlot) { voffset += covheight + 2*gutter; }
+ if (m_cestats) { voffset += cestatsheight + 2*gutter; }
+ }
+
+ m_overviewtop = voffset - lineheight;
+
+ if (doPaintContigs)
+ {
+ cerr << " contigs";
+ layout.clear();
+
+ if (m_showscaffold) { voffset += lineheight; }
+ int rightmost = 0;
+ int lastcontig = -1;
+
+ for (ci = m_ctiling.begin(); ci != m_ctiling.end(); ci++)
+ {
+ int offset = ci->offset;
+
+ // First fit into the layout
+ for (li = layout.begin(), layoutpos = 0;
+ li != layout.end();
+ li++, layoutpos++)
+ {
+ // force adjacent contigs to different lines
+ if (layoutpos == lastcontig) { continue; }
+
+ // Otherwise, put into first row that fits
+ if (*li < offset) { break; }
+ }
+
+ if (li == layout.end()) { layout.push_back(0); }
+ layout[layoutpos] = offset + ci->range.getLength() + layoutgutter;
+ lastcontig = layoutpos;
+
+ if (offset+ci->range.getLength() > rightmost)
+ {
+ rightmost = offset+ci->range.getLength();
+ }
+
+ int vpos = voffset + layoutpos * lineheight;
+
+ ContigCanvasItem * contig = new ContigCanvasItem((int)(m_hscale*(offset + m_hoffset)),
+ vpos,
+ (int) (ci->range.getLength() * m_hscale),
+ m_seqheight,
+ *ci, m_icanvas);
+ contig->show();
+
+ if (m_showscaffold)
+ {
+ Q3CanvasRectangle * rect = new Q3CanvasRectangle((int)(contig->x()+(contig->boundingRect().width())/2-3),
+ (int)(voffset-lineheight),
+ 6, vpos-voffset+lineheight+m_seqheight, m_icanvas);
+ rect->setPen(contig->pen());
+ rect->setBrush(contig->brush());
+ rect->show();
+ }
+ }
+
+ if (m_showscaffold)
+ {
+ int i = 0;
+ while (i < rightmost)
+ {
+ int len = min(100000, rightmost-i);
+ Q3CanvasRectangle * scaff = new Q3CanvasRectangle((int)(m_hscale*(m_hoffset+i)), voffset-lineheight,
+ (int)(len * m_hscale),
+ 1, m_icanvas);
+ scaff->setPen(UIElements::color_Scaffold);
+ scaff->setBrush(UIElements::color_Scaffold);
+ scaff->show();
+
+ i += len;
+ }
+ }
+
+ if (rightmost > m_width) { m_width = rightmost; }
+
+ voffset += (layout.size() + 1) * lineheight;
+ }
+
+
+ if ( m_insertCovFeatures )
+ {
+ cerr << " insetcovfeat";
+
+ if (m_insertCL->m_curpos)
+ {
+ paintCoverage(m_insertCL->m_coverage, m_insertCL->m_cestat, false, m_insertCL->m_curpos,
+ voffset, m_seqheight*2, -1, m_meaninsertcoverage,
+ UIElements::color_insertcoverage, true);
+
+ voffset += m_seqheight*2+gutter;
+
+ int diff = (int) (m_insertCL->m_maxdepth - m_meaninsertcoverage);
+
+ //cerr << "max: " << m_insertCL->m_maxdepth << endl;
+ //cerr << "mean: " << m_meaninsertcoverage << endl;
+ //cerr << "diff: " << diff << endl;
+
+ emit newMaxInsertCovTol(((int)((diff > m_meaninsertcoverage) ? diff : m_meaninsertcoverage)));
+ }
+ }
+
+ if ( m_readCovFeatures )
+ {
+ cerr << " readcovfeat";
+ if (m_readCL->m_curpos)
+ {
+ paintCoverage(m_readCL->m_coverage, m_readCL->m_cestat, false, m_readCL->m_curpos,
+ voffset, m_seqheight*2, -2, m_meanreadcoverage,
+ UIElements::color_readcoverage, true);
+
+ voffset += m_seqheight*2+gutter;
+ emit newMaxReadCovTol((int)(m_readCL->m_maxdepth - m_meanreadcoverage >
+ m_meanreadcoverage ?
+ m_readCL->m_maxdepth - m_meanreadcoverage :
+ m_meanreadcoverage));
+ }
+ }
+
+
+ if (doPaintFeatures)
+ {
+ cerr << " features";
+ layout.clear();
+
+ int score = 0;
+ vector<AMOS::Feature_t>::iterator fi;
+ for (fi = m_features.begin(); fi != m_features.end(); fi++)
+ {
+ switch ( fi->getType() )
+ {
+ case AMOS::Feature_t::COVERAGE:
+ case AMOS::Feature_t::POLYMORPHISM:
+ case AMOS::Feature_t::BREAKPOINT:
+ case AMOS::Feature_t::KMER:
+ case AMOS::Feature_t::MATEPAIR:
+ case AMOS::Feature_t::MISASSEMBLY:
+ if ( !m_misasmFeatures ) continue;
+ break;
+
+ default:
+ if ( !m_otherFeatures ) continue;
+ break;
+ }
+
+ int offset = fi->getRange().getLo();
+ int length = fi->getRange().getLength();
+
+ if (fi->getType() == 'B')
+ {
+ length = 500;
+ offset -= length/2;
+ }
+
+ // First fit into the layout
+ for (li = layout.begin(), layoutpos = 0;
+ li != layout.end();
+ li++, layoutpos++)
+ {
+ if (*li < offset) { break; }
+ }
+
+ if (li == layout.end()) { layout.push_back(0); }
+ layout[layoutpos] = offset + length + layoutgutter;
+
+ int vpos = voffset + layoutpos * lineheight;
+
+ FeatureCanvasItem * fitem =
+ new FeatureCanvasItem((int)(m_hscale * (offset+m_hoffset)), vpos,
+ (int)(m_hscale*length), m_seqheight,
+ *fi, m_icanvas);
+ fitem->show();
+ }
+
+ if (!layout.empty())
+ {
+ voffset += (layout.size() + 1) * lineheight;
+ }
+ }
+
+ m_overviewbottom = voffset;
+
+ // bubblesort the types by the order they appear in the popup menu
+ vector<char> types;
+ map<char, pair<int, bool> >::iterator type;
+ map<char, bool> drawType;
+
+ for (type = m_types.begin(); type != m_types.end(); type++)
+ {
+ types.push_back(type->first);
+ drawType[type->first] = type->second.second;
+ }
+
+ for (unsigned int i = 0; i < types.size(); i++)
+ {
+ for (unsigned int j = i+1; j < types.size(); j++)
+ {
+ if (m_types[types[j]].first > m_types[types[i]].first)
+ {
+ char swap = types[i];
+ types[i] = types[j];
+ types[j] = swap;
+ }
+ }
+ }
+
+ if (m_drawInserts)
+ {
+ cerr << " inserts";
+
+ // For all types, or when !m_connectMates, do exactly 1 pass
+ for (unsigned int type = 0; type < types.size(); type++)
+ {
+ if (m_partitionTypes && !m_types[types[type]].second) { continue; }
+
+ layout.clear();
+
+ // For all inserts of this type (or if type enabled)
+ for (ii = m_inserts.begin(); ii != m_inserts.end(); ii++)
+ {
+ Insert::MateState istate = (*ii)->m_state;
+
+ if (m_partitionTypes)
+ {
+ if (m_colorByStretchiness)
+ {
+ if (types[type] == (char)Insert::Happy)
+ {
+ if ((istate == Insert::Happy) ||
+ (istate == Insert::CompressedMate) ||
+ (istate == Insert::ExpandedMate)) { }
+ else { continue; }
+ }
+ else if (istate == Insert::CompressedMate || istate == Insert::ExpandedMate) { continue; }
+ else if ((char)istate != types[type]) { continue; }
+ }
+ else
+ {
+ if ((char)istate != types[type]) { continue; }
+ }
+ }
+ else
+ {
+ if (!drawType[istate]) { continue; }
+ }
+
+ int offset = (*ii)->m_loffset;
+
+ // Find a position
+ for (li = layout.begin(), layoutpos = 0;
+ li != layout.end();
+ li++, layoutpos++)
+ {
+ if (*li < offset) { break; }
+ }
+
+ if (li == layout.end()) { layout.push_back(0); }
+
+ int vpos = voffset + layoutpos*lineheight;
+ layout[layoutpos] = (*ii)->m_roffset + layoutgutter;
+
+ int inserthpos = (int)(m_hscale * ((*ii)->m_loffset + m_hoffset));
+ int insertlength = (int)(m_hscale * ((*ii)->m_length-1));
+
+ if (((*ii)->m_loffset + (*ii)->m_length - 1) != (*ii)->m_roffset)
+ {
+ cerr << "loffset: " << (*ii)->m_loffset
+ << " length: " << (*ii)->m_length
+ << " l+l: " << (*ii)->m_loffset + (*ii)->m_length - 1
+ << " roffset: " << (*ii)->m_roffset << endl;
+ }
+
+ InsertCanvasItem * iitem = new InsertCanvasItem(inserthpos, vpos,
+ insertlength, m_seqheight,
+ *ii, m_icanvas);
+
+ QColor insertcolor(UIElements::getInsertColor((*ii)->m_state));
+
+
+ if (m_colorByLibrary)
+ {
+ insertcolor = Qt::cyan;
+
+ ColorMap::const_iterator lci = libColorMap.find((*ii)->m_libid);
+
+ if (lci != libColorMap.end())
+ {
+ insertcolor = lci->second;
+ }
+ }
+ else if (m_colorByMate && ((*ii)->m_state == Insert::LinkingMate))
+ {
+ insertcolor = getContigColor(contigColorMap, (*ii)->m_bcontig);
+ }
+ else if (m_colorByStretchiness &&
+ (((*ii)->m_state == Insert::Happy) ||
+ ((*ii)->m_state == Insert::CompressedMate) ||
+ ((*ii)->m_state == Insert::ExpandedMate)))
+ {
+ double disttomean = (*ii)->m_actual - (*ii)->m_dist.mean;
+
+ if (disttomean < 0)
+ {
+ insertcolor = UIElements::color_CompressedMate;
+ disttomean = -disttomean;
+ }
+ else
+ {
+ insertcolor = UIElements::color_ExpandedMate;
+ }
+
+ disttomean /= (*ii)->m_dist.sd;
+
+ disttomean += 1.5;
+
+ disttomean *= disttomean;
+ disttomean *= disttomean;
+
+ if ( disttomean > 255 ) disttomean = 255;
+ int ns = disttomean < 60 ? 60 : (int)disttomean;
+ int nv = disttomean < 60 ? 60 : (int)disttomean;
+
+ int h, s, v;
+ insertcolor.hsv(&h,&s,&v);
+ insertcolor.setHsv(h,ns,nv);
+ }
+
+ iitem->setPen(insertcolor);
+ iitem->setBrush(insertcolor);
+
+ iitem->show();
+ }
+
+ if (!layout.empty())
+ {
+ if (m_tintHappiness && m_partitionTypes)
+ {
+ Q3CanvasRectangle * covbg = new Q3CanvasRectangle(0, voffset-3,
+ (int)(m_hscale*(m_width)),
+ (layout.size() * lineheight)+6,
+ m_icanvas);
+ QColor color = UIElements::getInsertColor((Insert::MateState)types[type]);
+
+ int h, s, v;
+ color.hsv(&h, &s, &v);
+
+ s /= 2; v /= 2;
+ color.setHsv(h, s, v);
+
+ covbg->setPen(color);
+
+ s /= 2; v /= 2;
+ color.setHsv(h, s, v);
+
+ covbg->setBrush(color);
+ covbg->setBrush(QBrush(color, Qt::Dense5Pattern));
+ covbg->setZ(-2);
+ covbg->show();
+ }
+
+ voffset += (layout.size() + 2) * lineheight;
+ }
+
+ if (!m_partitionTypes)
+ {
+ break;
+ }
+ }
+ }
+
+ int scaledwidth = (int)((m_width) * m_hscale);
+
+ cerr << endl
+ << "width: " << m_width
+ << " swidth: " << scaledwidth
+ << " height: " << voffset;
+
+ m_icanvas->resize(scaledwidth, voffset);
+ cerr << ".";
+ m_icanvas->update();
+ cerr << "." << endl;
+
+
+ setInsertCanvasSize(scaledwidth, voffset);
+
+ bool old = m_syncWithTiling;
+ m_syncWithTiling = false;
+ setTilingVisibleRange(m_contigid, m_gstart, m_gend);
+ m_syncWithTiling = old;
+
+ resizeOverview();
+
+ QApplication::restoreOverrideCursor();
+}
+
+
+void InsertWidget::resizeField()
+{
+ //setInsertCanvasSize(m_icanvas->width(), m_icanvas->height());
+
+ setVisibleVRange(vrange->rangeLow(), vrange->rangeHigh());
+ setVisibleHRange(hrange->rangeLow(), hrange->rangeHigh());
+}
+
+void InsertWidget::resizeOverview()
+{
+ double xf = (double)(m_overview->width() - 2*(hrange->controlPix_m + hrange->gripPix_m)) / m_icanvas->width();
+ QMatrix matrix(xf, 0, 0, 1, hrange->controlPix_m+hrange->gripPix_m-2, 0);
+ m_overview->setWorldMatrix(matrix); // resizeoverview
+ m_overview->setContentsPos(0, m_overviewtop);
+ m_overview->update();
+ m_overview->setMaximumHeight(m_overviewbottom-m_overviewtop);
+ m_overview->setMinimumHeight(m_overviewbottom-m_overviewtop);
+}
+
+void InsertWidget::setInsertCanvasSize(int cwidth, int cheight)
+{
+ m_updatingScrollBars = true;
+ hrange->setMaxRange(0, cwidth);
+ vrange->setMaxRange(0, cheight);
+ m_updatingScrollBars = false;
+}
+
+void InsertWidget::showAll()
+{
+ hrange->setRange(hrange->minimum(), hrange->maximum());
+ vrange->setRange(vrange->minimum(), vrange->maximum());
+}
+
+
+void InsertWidget::setHappyDistance(float distance)
+{
+ if ( Insert::MAXSTDEV == distance ) return;
+ Insert::MAXSTDEV=distance;
+ computeInsertHappiness();
+ paintCanvas();
+}
+
+void InsertWidget::setConnectMates(bool b)
+{
+ if ( m_connectMates == b ) return;
+ m_connectMates = b;
+ computeInsertHappiness();
+ paintCanvas();
+}
+
+void InsertWidget::setPartitionTypes(bool b)
+{
+ if ( m_partitionTypes == b ) return;
+ m_partitionTypes = b;
+ paintCanvas();
+}
+
+void InsertWidget::setCoveragePlot(bool b)
+{
+ if ( m_coveragePlot == b ) return;
+ m_coveragePlot = b;
+ paintCanvas();
+}
+
+void InsertWidget::setCEStatistic(bool b)
+{
+ if ( m_cestats == b ) return;
+ m_cestats = b;
+ paintCanvas();
+}
+
+void InsertWidget::setTintHappiness(bool b)
+{
+ if ( m_tintHappiness == b ) return;
+ m_tintHappiness = b;
+ paintCanvas();
+}
+
+void InsertWidget::setPaintScaffold(bool b)
+{
+ if ( m_paintScaffold == b ) return;
+ m_paintScaffold = b;
+ initializeTiling();
+}
+
+void InsertWidget::setShowScaffold(bool b)
+{
+ if ( m_showscaffold == b ) return;
+ m_showscaffold = b;
+ paintCanvas();
+}
+
+void InsertWidget::setInsertCovFeatures(bool b)
+{
+ if ( m_insertCovFeatures == b ) return;
+ m_insertCovFeatures = b;
+ paintCanvas();
+}
+
+void InsertWidget::setReadCovFeatures(bool b)
+{
+ if ( m_readCovFeatures == b ) return;
+ m_readCovFeatures = b;
+ paintCanvas();
+}
+
+// void InsertWidget::setSNPFeatures(bool b)
+// {
+// if (m_snpFeatures == b ) return;
+// m_snpFeatures = b;
+// paintCanvas();
+// }
+
+// void InsertWidget::setUnitigFeatures(bool b)
+// {
+// if ( m_unitigFeatures == b ) return;
+// m_unitigFeatures = b;
+// paintCanvas();
+// }
+
+// void InsertWidget::setQCFeatures(bool b)
+// {
+// if ( m_qcFeatures == b ) return;
+// m_qcFeatures = b;
+// paintCanvas();
+// }
+
+// void InsertWidget::setBreakFeatures(bool b)
+// {
+// if ( m_breakFeatures == b ) return;
+// m_breakFeatures = b;
+// paintCanvas();
+// }
+
+void InsertWidget::setMisasmFeatures(bool b)
+{
+ if ( m_misasmFeatures == b ) return;
+ m_misasmFeatures = b;
+ paintCanvas();
+}
+
+void InsertWidget::setOtherFeatures(bool b)
+{
+ if ( m_otherFeatures == b ) return;
+ m_otherFeatures = b;
+ paintCanvas();
+}
+
+
+void InsertWidget::setInsertCovTol(int tol)
+{
+ Q3CanvasItemList all = m_icanvas->allItems();
+ for ( Q3CanvasItemList::Iterator i = all.begin(); i != all.end(); ++ i )
+ if ( (*i)->rtti() == CoverageRectCanvasItem::RTTI &&
+ ((CoverageRectCanvasItem *)*i)->m_libid == -1 )
+ {
+ CoverageRectCanvasItem * ci = (CoverageRectCanvasItem *) *i;
+ ci->m_low = ci->m_baseLevel - (double)tol;
+ ci->m_high = ci->m_baseLevel + (double)tol;
+ m_icanvas->setChanged(ci->boundingRect());
+ }
+ m_icanvas->update();
+}
+
+void InsertWidget::setReadCovTol(int tol)
+{
+ Q3CanvasItemList all = m_icanvas->allItems();
+ for ( Q3CanvasItemList::Iterator i = all.begin(); i != all.end(); ++ i )
+ if ( (*i)->rtti() == CoverageRectCanvasItem::RTTI &&
+ ((CoverageRectCanvasItem *)*i)->m_libid == -2 )
+ {
+ CoverageRectCanvasItem * ci = (CoverageRectCanvasItem *) *i;
+ ci->m_low = ci->m_baseLevel - (double)tol;
+ ci->m_high = ci->m_baseLevel + (double)tol;
+ m_icanvas->setChanged(ci->boundingRect());
+ }
+ m_icanvas->update();
+}
+
+// void InsertWidget::setSNPTol(int tol)
+// {
+// QCanvasItemList all = m_icanvas->allItems();
+// for ( QCanvasItemList::Iterator i = all.begin(); i != all.end(); ++ i )
+// if ( (*i)->rtti() == FeatureCanvasItem::RTTI &&
+// ((FeatureCanvasItem *)*i)->m_feat.getType() ==
+// AMOS::Feature_t::POLYMORPHISM )
+// {
+// FeatureCanvasItem * fi = (FeatureCanvasItem *) *i;
+// if ( extractSNPScore (fi->m_feat) >= tol )
+// fi->show();
+// else
+// fi->hide();
+// m_icanvas->setChanged(fi->boundingRect());
+// }
+// m_icanvas->update();
+// }
+
+// void InsertWidget::setUnitigTol(int tol)
+// {
+// QCanvasItemList all = m_icanvas->allItems();
+// for ( QCanvasItemList::Iterator i = all.begin(); i != all.end(); ++ i )
+// if ( (*i)->rtti() == FeatureCanvasItem::RTTI &&
+// ((FeatureCanvasItem *)*i)->m_feat.getType() ==
+// AMOS::Feature_t::UNITIG )
+// {
+// FeatureCanvasItem * fi = (FeatureCanvasItem *) *i;
+// if ( extractUnitigScore (fi->m_feat) >= tol )
+// fi->show();
+// else
+// fi->hide();
+// m_icanvas->setChanged(fi->boundingRect());
+// }
+// m_icanvas->update();
+// }
+
+// void InsertWidget::setQCTol(int tol)
+// {
+// QCanvasItemList all = m_icanvas->allItems();
+// for ( QCanvasItemList::Iterator i = all.begin(); i != all.end(); ++ i )
+// if ( (*i)->rtti() == FeatureCanvasItem::RTTI &&
+// ((FeatureCanvasItem *)*i)->m_feat.getType() ==
+// AMOS::Feature_t::COVERAGE )
+// {
+// FeatureCanvasItem * fi = (FeatureCanvasItem *) *i;
+// if ( extractQCScore (fi->m_feat) >= tol )
+// fi->show();
+// else
+// fi->hide();
+// m_icanvas->setChanged(fi->boundingRect());
+// }
+// m_icanvas->update();
+// }
+
+// void InsertWidget::setBreakTol(int tol)
+// {
+// QCanvasItemList all = m_icanvas->allItems();
+// for ( QCanvasItemList::Iterator i = all.begin(); i != all.end(); ++ i )
+// if ( (*i)->rtti() == FeatureCanvasItem::RTTI &&
+// ((FeatureCanvasItem *)*i)->m_feat.getType() ==
+// AMOS::Feature_t::BREAKPOINT )
+// {
+// FeatureCanvasItem * fi = (FeatureCanvasItem *) *i;
+// if ( extractBreakScore (fi->m_feat) >= tol )
+// fi->show();
+// else
+// fi->hide();
+// m_icanvas->setChanged(fi->boundingRect());
+// }
+// m_icanvas->update();
+// }
+
+
+class Paddle : public Q3CanvasRectangle
+{
+public:
+ static const int RTTI = 987654;
+ Paddle(int x, int y, int width, int height, Q3Canvas * canvas)
+ : Q3CanvasRectangle(x,y,width,height,canvas) {}
+ int rtti() const {return RTTI; }
+};
+
+static int min(int a, int b)
+{
+ return (a<b) ? a : b;
+}
+
+void InsertWidget::start()
+{
+ stopbreak();
+
+ QRect rc = QRect(m_ifield->contentsX(), m_ifield->contentsY(),
+ m_ifield->visibleWidth(), m_ifield->visibleHeight() );
+ QRect rect = m_ifield->inverseWorldMatrix().mapRect(rc);
+
+ int basey = min(rect.y()+rect.height(), m_icanvas->height());
+
+ m_ball = new Q3CanvasEllipse(7, 5, m_icanvas);
+ m_ball->setX(rect.x() + rect.width()/2);
+ m_ball->setY(basey - 50);
+ m_ball->setPen(QPen(Qt::white));
+ m_ball->setBrush(QBrush(Qt::white));
+ m_ball->show();
+
+ m_paddle = new Paddle((int)(m_ball->x()-25), (int)(m_ball->y()+25),
+ 50, 5, m_icanvas);
+ m_paddle->setPen(QPen(Qt::white));
+ m_paddle->setBrush(QBrush(Qt::white));
+ m_paddle->show();
+
+ m_xvel = rand() % 25 - 12;
+ m_yvel = -1;
+
+ m_icanvas->update();
+
+ m_timer->start(20);
+}
+
+void InsertWidget::left()
+{
+ if (m_paddle)
+ {
+ m_paddle->moveBy(-10, 0);
+ m_icanvas->update();
+ }
+}
+
+void InsertWidget::right()
+{
+ if (m_paddle)
+ {
+ m_paddle->moveBy(10, 0);
+ m_icanvas->update();
+ }
+}
+
+
+void InsertWidget::stopbreak()
+{
+ m_timer->stop();
+ Q3CanvasItemList list = m_icanvas->allItems();
+ Q3CanvasItemList::Iterator it = list.begin();
+ for (; it != list.end(); ++it) {
+ (*it)->show();
+ }
+
+ if (m_paddle) { m_paddle->hide(); delete m_paddle; m_paddle = NULL; }
+ if (m_ball) { m_ball->hide(); delete m_ball; m_ball = NULL;}
+
+ m_icanvas->update();
+}
+
+void InsertWidget::autoplay()
+{
+ m_autoplay = !m_autoplay;
+}
+
+
+void InsertWidget::timeout()
+{
+ if (m_ball)
+ {
+ QRect rc = QRect(m_ifield->contentsX(), m_ifield->contentsY(),
+ m_ifield->visibleWidth(), m_ifield->visibleHeight() );
+ QRect rect = m_ifield->inverseWorldMatrix().mapRect(rc);
+
+ if (m_ball->y() >= min(rect.y()+rect.height(), m_icanvas->height()))
+ {
+ m_timer->stop();
+ QMessageBox mb("Sorry!", "Game Over!",
+ QMessageBox::Critical, QMessageBox::Ok,
+ QMessageBox::NoButton, QMessageBox::NoButton);
+ mb.exec();
+ stopbreak();
+ }
+ else
+ {
+ if (m_ball->y() <= rect.y())
+ {
+ m_yvel = -m_yvel;
+ }
+ else if ((m_ball->x() <= rect.x()) ||
+ (m_ball->x() >= min(rect.x()+rect.width(), m_icanvas->width())))
+ {
+ m_xvel = -m_xvel;
+ }
+ else
+ {
+ Q3CanvasItemList l = m_icanvas->collisions(m_ball->boundingRect());// m_ball->collisions(true);
+ bool hit = false;
+
+ int left = (int)(m_ball->x());
+ int right = (int)(m_ball->x() + m_ball->width());
+ int top = (int)(m_ball->y());
+ int bottom = (int)(m_ball->y() + m_ball->height());
+
+ for (Q3CanvasItemList::Iterator li=l.begin(); li != l.end(); li++)
+ {
+ if ((right < (*li)->x()) ||
+ (left > ((*li)->x() + (*li)->boundingRect().width())) ||
+ (bottom < (*li)->y()) ||
+ (top > ((*li)->y() + (*li)->boundingRect().height())))
+ {
+ continue;
+ }
+
+ if ((*li)->rtti() == InsertCanvasItem::RTTI)
+ {
+ //cerr << "i";
+ (*li)->hide();
+ hit = true;
+ }
+ else if ((*li)->rtti() == Paddle::RTTI)
+ {
+ //cerr << "p";
+ m_xvel += rand()%10-5;
+ hit = true;
+ }
+
+ if (hit)
+ {
+ m_yvel = -m_yvel;
+ m_ball->moveBy(0, 4*m_yvel);
+ break;
+ }
+ }
+ }
+
+ if (abs(m_xvel) > 25) { m_xvel = m_xvel/2; }
+
+ m_ball->moveBy(m_xvel, m_yvel);
+
+ if (m_autoplay)
+ {
+ m_paddle->move(m_ball->x()-m_paddle->width()/2, m_paddle->y());
+ }
+
+ m_icanvas->update();
+ }
+ }
+}
+
+void InsertWidget::contigChanged()
+{
+ if (m_paintScaffold &&
+ m_currentScaffold == m_datastore->m_scaffoldId &&
+ m_currentScaffold != AMOS::NULL_ID)
+ {
+ return;
+ }
+
+ initializeTiling();
+}
+
+void InsertWidget::refreshWidget()
+{
+ initializeTiling();
+}
+
+void InsertWidget::setColorStyle(int style)
+{
+ m_colorByLibrary = 0;
+ m_colorByMate = 0;
+ m_colorByStretchiness = 0;
+
+ switch (style)
+ {
+ case 1: m_colorByStretchiness = 1; break;
+ case 2: m_colorByMate = 1; break;
+ case 3: m_colorByLibrary = 1; break;
+ };
+
+ paintCanvas();
+}
diff --git a/src/hawkeye/InsertWidget.hh b/src/hawkeye/InsertWidget.hh
new file mode 100644
index 0000000..0289c0c
--- /dev/null
+++ b/src/hawkeye/InsertWidget.hh
@@ -0,0 +1,233 @@
+#ifndef INSERT_WIDGET_HH_
+#define INSERT_WIDGET_HH_ 1
+
+#include <qwidget.h>
+#include <string>
+
+
+#include <qslider.h>
+#include <qtimer.h>
+#include <qpixmap.h>
+#include <q3canvas.h>
+#include <qwidget.h>
+#include <string>
+#include "foundation_AMOS.hh"
+#include "Insert.hh"
+#include "RangeScrollBar.hh"
+#include "CoverageStats.hh"
+
+#include <map>
+
+using std::map;
+using std::pair;
+
+
+class DataStore;
+class InsertField;
+class InsertPosition;
+class CoverageStats;
+class OverviewField;
+
+
+class InsertWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+
+ InsertWidget(DataStore * datastore,
+ map<char, pair<int, bool> > & types,
+ QWidget * parent = 0, const char * name = 0);
+ ~InsertWidget();
+
+public slots:
+ void resizeOverview();
+ void resizeField();
+
+ void initializeTiling();
+ void updateVisibleRange();
+ void centerView(int);
+
+ void refreshWidget();
+
+ void showAll();
+ void setTilingVisibleRange(int, int, int);
+ void paintCanvas();
+ void setConnectMates(bool);
+ void setPartitionTypes(bool);
+ void setCoveragePlot(bool);
+ void setCEStatistic(bool);
+ void setPaintScaffold(bool);
+ void setTintHappiness(bool);
+ void contigChanged();
+ void computePos(int);
+ void setShowScaffold(bool);
+ void setSyncWithTiling(bool);
+ void setColorStyle(int);
+
+ void setHappyDistance(float);
+
+ void setVisibleHRange(int, int);
+ void setHPos(int);
+
+ void setVisibleVRange(int, int);
+ void setVPos(int);
+
+ void setInsertCovTol(int);
+ void setReadCovTol(int);
+// void setSNPTol(int);
+// void setUnitigTol(int);
+// void setQCTol(int);
+// void setBreakTol(int);
+
+ void setInsertCovFeatures(bool);
+ void setReadCovFeatures(bool);
+// void setSNPFeatures(bool);
+// void setUnitigFeatures(bool);
+// void setQCFeatures(bool);
+// void setBreakFeatures(bool);
+ void setMisasmFeatures(bool);
+ void setOtherFeatures(bool);
+
+ void start();
+ void stopbreak();
+ void left();
+ void right();
+ void timeout();
+ void autoplay();
+
+
+signals:
+ void setDetails(const QString & message);
+ void setGindex(int gindex);
+ void setContigId(int contigid);
+
+ void canvasCleared();
+
+ void jumpToRead(int iid);
+
+ void search(const QString & str);
+
+ void highlightRead(int iid);
+ void highlightIID(const QString & qiid);
+ void highlightEID(const QString & qeid);
+
+ void readIIDHighlighted(const QString & qiid);
+ void readEIDHighlighted(const QString & qeid);
+
+ void currentScaffoldCoordinate(int);
+
+ void newMaxInsertCovTol(int);
+ void newMaxReadCovTol(int);
+// void newMaxSNPTol(int);
+// void newMaxUnitigTol(int);
+// void newMaxQCTol(int);
+// void newMaxBreakTol(int);
+
+ void setZoomInTool();
+ void setZoomOutTool();
+ void setSelectTool();
+
+
+private:
+ void flushInserts();
+ void computeInsertHappiness();
+ void computeCoverage();
+ void disconnectMates();
+ void clearCanvas();
+ void setInsertCanvasSize(int left, int right);
+ void initializeVisibleRectangle();
+ void paintCoverage(const PointArray_t & arr,
+ const std::vector<double> & rawvalues,
+ bool copyraw,
+ int arrLen,
+ int voffset, int vheight,
+ int libid, double baseLine,
+ QColor color,
+ bool compressed = false);
+
+ DataStore * m_datastore;
+ InsertField * m_ifield;
+ Q3Canvas * m_icanvas;
+ InsertPosition * m_iposition;
+
+ Q3CanvasRectangle * m_tilingVisible;
+
+ Q3CanvasRectangle * m_paddle;
+ Q3CanvasEllipse * m_ball;
+ QTimer * m_timer;
+ int m_xvel;
+ int m_yvel;
+ int m_autoplay;
+
+ bool m_connectMates;
+ bool m_partitionTypes;
+ bool m_coveragePlot;
+ bool m_cestats;
+ bool m_colorByLibrary;
+ bool m_colorByMate;
+ bool m_colorByStretchiness;
+ bool m_paintScaffold;
+ bool m_tintHappiness;
+ bool m_showscaffold;
+ bool m_kmercoverageplot;
+ bool m_syncWithTiling;
+
+ bool m_insertCovFeatures;
+ bool m_readCovFeatures;
+// bool m_snpFeatures;
+// bool m_unitigFeatures;
+// bool m_qcFeatures;
+// bool m_breakFeatures;
+ bool m_misasmFeatures;
+ bool m_otherFeatures;
+
+ int m_tilingwidth;
+ float m_hscale;
+
+ AMOS::ID_t m_currentContig;
+ AMOS::ID_t m_currentScaffold;
+
+ // from insert canvas
+ void drawTile(AMOS::Tile_t * tile, Q3Canvas * p, int hoffset, int vpos, Insert::MateState state);
+
+ int m_seqheight;
+ int m_hoffset;
+
+ int m_contigid;
+ int m_gstart;
+ int m_gend;
+
+ typedef std::vector<Insert *> InsertList_t;
+ InsertList_t m_inserts;
+
+ std::vector<AMOS::Tile_t> m_tiling;
+ std::vector<AMOS::Tile_t> m_ctiling;
+ std::vector<AMOS::Feature_t> m_features;
+
+ std::map<char, std::pair<int, bool> > & m_types;
+ CoverageStats * m_kmerstats;
+ CoverageStats * m_insertCL;
+ CoverageStats * m_readCL;
+
+ int m_width;
+
+ double m_meaninsertcoverage;
+ double m_meanreadcoverage;
+
+ typedef map<AMOS::ID_t, CoverageStats> LibStats;
+ LibStats m_libStats;
+
+
+ RangeScrollBar_t * hrange;
+ RangeScrollBar_t * vrange;
+ OverviewField * m_overview;
+
+ int m_overviewtop, m_overviewbottom;
+ bool m_updatingScrollBars;
+
+ int m_scaffoldId;
+ QString m_scaffoldName;
+};
+
+#endif
diff --git a/src/hawkeye/InsertWindow.cc b/src/hawkeye/InsertWindow.cc
new file mode 100644
index 0000000..d2ee9e3
--- /dev/null
+++ b/src/hawkeye/InsertWindow.cc
@@ -0,0 +1,446 @@
+#include "InsertWindow.hh"
+#include "InsertWidget.hh"
+
+#include <qstatusbar.h>
+#include <qlabel.h>
+#include <qslider.h>
+#include <q3popupmenu.h>
+#include <q3toolbar.h>
+#include <qtoolbutton.h>
+#include <qpushbutton.h>
+#include <qcheckbox.h>
+#include <q3buttongroup.h>
+#include <qspinbox.h>
+#include <q3accel.h>
+#include <qmenubar.h>
+#include <qpixmap.h>
+#include <qpainter.h>
+#include <qlineedit.h>
+#include <q3dockarea.h>
+#include <q3textedit.h>
+#include <q3scrollview.h>
+#include <q3vbox.h>
+#include <qradiobutton.h>
+#include <q3groupbox.h>
+#include <qlayout.h>
+#include <qobject.h>
+#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <QtGui>
+
+#include "DataStore.hh"
+#include "UIElements.hh"
+#include "BufferedLineEdit.hh"
+#include "QueryWidget.hh"
+#include "DetailWidget.hh"
+#include "SelectionWidget.hh"
+
+#include "icons/zoom_in.xpm"
+#include "icons/zoom_out.xpm"
+#include "icons/pointer_tool.xpm"
+
+
+using namespace std;
+
+InsertWindow::InsertWindow(DataStore * datastore,
+ QWidget * parent,
+ const char * name)
+ : Q3MainWindow(NULL, name),
+ m_datastore(datastore)
+{
+ setCaption("Hawkeye : Scaffold View");
+ setGeometry(150,50, QApplication::desktop()->width()-200, 600);
+
+ const char * states = Insert::allstates;
+ unsigned int type = 0;
+
+
+ // Main Widget
+ m_inserts = new InsertWidget(datastore, m_types, this, "iw");
+ InsertWidget * iw = m_inserts;
+ setCentralWidget(iw);
+
+ Q3DockWindow * sidedock = new Q3DockWindow(Q3DockWindow::InDock, this);
+ addDockWindow (sidedock, Qt::DockRight);
+
+ sidedock->setVerticallyStretchable(true);
+
+
+ // Tools
+ m_select = new SelectionWidget(sidedock);
+ sidedock->boxLayout()->addWidget(m_select, 0);
+
+ // Query Dock
+ Q3ScrollView * queryView = new Q3ScrollView (sidedock, "queryview");
+ queryView->setResizePolicy (Q3ScrollView::AutoOneFit);
+ queryView->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
+ queryView->setHScrollBarMode(Q3ScrollView::AlwaysOff);
+ queryView->setVScrollBarMode(Q3ScrollView::AlwaysOff);
+ m_query = new QueryWidget (queryView, "queries");
+ queryView->addChild (m_query);
+ sidedock->boxLayout()->addWidget(queryView, 10);
+
+ // Detail Dock
+ m_detail = new DetailWidget (sidedock, "details");
+ m_detail->setMinimumHeight(250);
+ m_detail->setMaximumHeight(250);
+ m_detail->detailText->setVScrollBarMode(Q3ScrollView::AlwaysOff);
+ m_detail->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ sidedock->boxLayout()->addWidget(m_detail, 0);
+
+
+
+ // pointer button bar
+ QIcon icon_pointer(QPixmap((const char ** )pointer_tool));
+ QIcon icon_zoomin(QPixmap((const char ** )zoom_in));
+ QIcon icon_zoomout(QPixmap((const char **)zoom_out));
+
+ m_select->selectButton->setIconSet(icon_pointer);
+ m_select->zoomInButton->setIconSet(icon_zoomin);
+ m_select->zoomOutButton->setIconSet(icon_zoomout);
+
+ connect(m_select->selectButton, SIGNAL(clicked()), this, SLOT(clickSelectTool()));
+ connect(m_select->zoomInButton, SIGNAL(clicked()), this, SLOT(clickZoomInTool()));
+ connect(m_select->zoomOutButton, SIGNAL(clicked()), this, SLOT(clickZoomOutTool()));
+
+ connect(m_select->selectButton, SIGNAL(clicked()), iw, SIGNAL(setSelectTool()));
+ connect(m_select->zoomInButton, SIGNAL(clicked()), iw, SIGNAL(setZoomInTool()));
+ connect(m_select->zoomOutButton, SIGNAL(clicked()), iw, SIGNAL(setZoomOutTool()));
+ connect(m_select->syncWithTilingButton, SIGNAL(clicked()), this, SLOT(toggleSyncWithTiling()));
+
+ // query widgets
+
+ // Happy distance
+ m_query->happyEdit->setText (QString::number(Insert::MAXSTDEV));
+
+ // Feature filters
+ iw->setInsertCovFeatures (m_query->insertCheck->isChecked());
+ iw->setReadCovFeatures (m_query->readCheck->isChecked());
+ iw->setMisasmFeatures (m_query->misasmCheck->isChecked());
+ iw->setOtherFeatures (m_query->otherCheck->isChecked());
+
+ // Mate types
+ m_query->happyLabel->setPixmap (mateIcon(UIElements::color_Happy, 0));
+ m_types[Insert::Happy].first = 7;
+ m_types[Insert::Happy].second = m_query->happyCheck->isChecked();
+
+ m_query->stretchedLabel->setPixmap (mateIcon(UIElements::color_ExpandedMate,0));
+ m_types[Insert::ExpandedMate].first = 6;
+ m_types[Insert::ExpandedMate].second = m_query->stretchedCheck->isChecked();
+
+ m_query->compressedLabel->setPixmap (mateIcon(UIElements::color_CompressedMate,0));
+ m_types[Insert::CompressedMate].first = 5;
+ m_types[Insert::CompressedMate].second = m_query->compressedCheck->isChecked();
+
+ m_query->orientationLabel->setPixmap (mateIcon(UIElements::color_OrientationViolation,1));
+ m_types[Insert::OrientationViolation].first = 4;
+ m_types[Insert::OrientationViolation].second = m_query->orientationCheck->isChecked();
+
+ m_query->linkingLabel->setPixmap (mateIcon(UIElements::color_LinkingMate,1));
+ m_types[Insert::LinkingMate].first = 3;
+ m_types[Insert::LinkingMate].second = m_query->linkingCheck->isChecked();
+
+ m_query->singletonLabel->setPixmap (mateIcon(UIElements::color_SingletonMate,1));
+ m_types[Insert::SingletonMate].first = 2;
+ m_types[Insert::SingletonMate].second = m_query->singletonCheck->isChecked();
+
+ m_query->unmatedLabel->setPixmap (mateIcon(UIElements::color_NoMate,2));
+ m_types[Insert::NoMate].first = 1;
+ m_types[Insert::NoMate].second = m_query->unmatedCheck->isChecked();
+
+
+ // Display
+ iw->setCoveragePlot(m_query->coverageCheck->isChecked());
+ iw->setCEStatistic(m_query->ceCheck->isChecked());
+ iw->setConnectMates(m_query->mateCheck->isChecked());
+ iw->setPartitionTypes(m_query->partitionCheck->isChecked());
+ iw->setTintHappiness(m_query->tintCheck->isChecked());
+
+
+ // Libraries
+ m_query->libraryBox->setColumnLayout(1,Qt::Vertical);
+ m_libLegend = NULL;
+ buildLibraryBox();
+
+
+
+ // searching and happy distance
+ connect(m_query->searchButton, SIGNAL(clicked()),
+ this, SLOT(loadSearch()));
+
+ connect(this, SIGNAL(search(const QString &)),
+ iw, SIGNAL(search(const QString &)));
+
+ connect(m_query->happyButton, SIGNAL(clicked()),
+ this, SLOT(loadHappyDistance()));
+
+ connect(this, SIGNAL(setHappyDistance(float)),
+ iw, SLOT(setHappyDistance(float)));
+
+ // feature filters
+ connect(iw, SIGNAL(newMaxInsertCovTol(int)),
+ this, SLOT(setMaxInsertCovTol(int)));
+
+ connect(m_query->insertCheck, SIGNAL(toggled(bool)),
+ iw, SLOT(setInsertCovFeatures(bool)));
+
+ connect(m_query->insertSlider, SIGNAL(valueChanged(int)),
+ iw, SLOT(setInsertCovTol(int)));
+
+ connect(iw, SIGNAL(newMaxReadCovTol(int)),
+ this, SLOT(setMaxReadCovTol(int)));
+
+ connect(m_query->readSlider, SIGNAL(valueChanged(int)),
+ iw, SLOT(setReadCovTol(int)));
+
+ connect(m_query->readCheck, SIGNAL(toggled(bool)),
+ iw, SLOT(setReadCovFeatures(bool)));
+
+ connect(m_query->misasmCheck, SIGNAL(toggled(bool)),
+ iw, SLOT(setMisasmFeatures(bool)));
+
+ connect(m_query->otherCheck, SIGNAL(toggled(bool)),
+ iw, SLOT(setOtherFeatures(bool)));
+
+ // mate type toggles
+ connect(m_query->happyCheck, SIGNAL(toggled(bool)),
+ this, SLOT(toggleItem()));
+
+ connect(m_query->stretchedCheck, SIGNAL(toggled(bool)),
+ this, SLOT(toggleItem()));
+
+ connect(m_query->compressedCheck, SIGNAL(toggled(bool)),
+ this, SLOT(toggleItem()));
+
+ connect(m_query->linkingCheck, SIGNAL(toggled(bool)),
+ this, SLOT(toggleItem()));
+
+ connect(m_query->orientationCheck, SIGNAL(toggled(bool)),
+ this, SLOT(toggleItem()));
+
+ connect(m_query->singletonCheck, SIGNAL(toggled(bool)),
+ this, SLOT(toggleItem()));
+
+ connect(m_query->unmatedCheck, SIGNAL(toggled(bool)),
+ this, SLOT(toggleItem()));
+
+ // display toggles
+ connect(m_query->coverageCheck, SIGNAL(toggled(bool)),
+ iw, SLOT(setCoveragePlot(bool)));
+
+ connect(m_query->ceCheck, SIGNAL(toggled(bool)),
+ iw, SLOT(setCEStatistic(bool)));
+
+ connect(m_query->mateCheck, SIGNAL(toggled(bool)),
+ iw, SLOT(setConnectMates(bool)));
+
+ connect(m_query->partitionCheck, SIGNAL(toggled(bool)),
+ iw, SLOT(setPartitionTypes(bool)));
+
+ connect(m_query->tintCheck, SIGNAL(toggled(bool)),
+ iw, SLOT(setTintHappiness(bool)));
+
+ // mate coloring
+ connect(m_query->mateColorBox, SIGNAL(clicked(int)),
+ iw, SLOT(setColorStyle(int)));
+
+ // detail text
+ connect(iw, SIGNAL(setDetails(const QString &)),
+ m_detail->detailText, SLOT(setText(const QString &)));
+
+ // canvas operations
+ connect(iw, SIGNAL(setGindex(int)),
+ this, SIGNAL(setGindex(int)));
+
+ connect(iw, SIGNAL(setContigId(int)),
+ this, SIGNAL(setContigId(int)));
+
+ connect(this, SIGNAL(setTilingVisibleRange(int, int, int)),
+ iw, SLOT(setTilingVisibleRange(int, int, int)));
+
+ connect(this, SIGNAL(paintCanvas()),
+ iw, SLOT(paintCanvas()));
+
+ connect(this, SIGNAL(newContig()),
+ iw, SLOT(contigChanged()));
+
+ connect(this, SIGNAL(highlightRead(int)),
+ iw, SIGNAL(highlightRead(int)));
+
+ connect(parent, SIGNAL(bankSelected()),
+ iw, SLOT(refreshWidget()));
+
+ connect(iw, SIGNAL(jumpToRead(int)),
+ parent, SLOT(jumpToRead(int)));
+
+ connect( new QShortcut(QKeySequence(tr("Ctrl+W")), this), SIGNAL(activated()),
+ this, SLOT(close()));
+
+ connect( new QShortcut(QKeySequence(tr("Ctrl+Q")), this), SIGNAL(activated()),
+ qApp, SLOT(quit()));
+
+
+ iw->initializeTiling(); // iw constructor doesn't compute anything
+}
+
+void InsertWindow::buildLibraryBox()
+{
+ if ( m_libLegend != NULL )
+ delete m_libLegend;
+
+ m_libLegend = new QWidget (m_query->libraryBox);
+ QFont font (m_libLegend->font());
+ font.setPointSize(9);
+ m_libLegend->setFont(font);
+ Q3GridLayout * grid = new Q3GridLayout
+ (m_libLegend, m_datastore->m_libdistributionlookup.size(), 2);
+
+ unsigned int type = 0;
+ const char * states = Insert::allstates;
+
+ int row = 0;
+ DataStore::LibLookup_t::iterator li;
+ for (li = m_datastore->m_libdistributionlookup.begin();
+ li != m_datastore->m_libdistributionlookup.end();
+ li++)
+ {
+ QString str = QString::number(li->first);
+ str += " [" + QString::number(li->second.mean);
+ str += " +/- " + QString::number(li->second.sd);
+ str += "] ";
+
+ QLabel * name = new QLabel (m_libLegend);
+ name->setText(str);
+ grid->addWidget(name, row, 0);
+
+ QLabel * icon = new QLabel (m_libLegend);
+ icon->setPixmap
+ (mateIcon(UIElements::getInsertColor((Insert::MateState)states[type]),0));
+ grid->addWidget(icon, row, 1);
+
+ type++;
+ row++;
+ if (type >= strlen(Insert::allstates)) { type = 0; }
+ }
+
+ m_libLegend->show();
+}
+
+
+void InsertWindow::loadHappyDistance()
+{
+ emit setHappyDistance(m_query->happyEdit->text().toFloat());
+}
+
+void InsertWindow::loadSearch()
+{
+ emit search(m_query->searchEdit->text());
+}
+
+void InsertWindow::contigChanged()
+{
+ emit newContig();
+}
+
+void InsertWindow::toggleItem()
+{
+ m_types[Insert::Happy].second = m_query->happyCheck->isChecked();
+ m_types[Insert::ExpandedMate].second = m_query->stretchedCheck->isChecked();
+ m_types[Insert::CompressedMate].second = m_query->compressedCheck->isChecked();
+ m_types[Insert::LinkingMate].second = m_query->linkingCheck->isChecked();
+ m_types[Insert::OrientationViolation].second = m_query->orientationCheck->isChecked();
+ m_types[Insert::SingletonMate].second = m_query->singletonCheck->isChecked();
+ m_types[Insert::NoMate].second = m_query->unmatedCheck->isChecked();
+
+ emit paintCanvas();
+}
+
+void InsertWindow::bankChanged()
+{
+ buildLibraryBox();
+}
+
+void InsertWindow::setMaxInsertCovTol(int maxtol)
+{
+ m_query->insertSlider->setRange(0, maxtol);
+ m_inserts->setInsertCovTol(m_query->insertSlider->value());
+}
+
+void InsertWindow::setMaxReadCovTol(int maxtol)
+{
+ m_query->readSlider->setRange(0, maxtol);
+ m_inserts->setReadCovTol(m_query->readSlider->value());
+}
+
+// void InsertWindow::setMaxSNPTol(int maxtol)
+// {
+// m_query->snpSlider->setRange(0, maxtol);
+// m_inserts->setSNPTol(m_query->snpSlider->value());
+// }
+
+// void InsertWindow::setMaxUnitigTol(int maxtol)
+// {
+// m_query->unitigSlider->setRange(0, maxtol);
+// m_inserts->setUnitigTol(m_query->unitigSlider->value());
+// }
+
+// void InsertWindow::setMaxQCTol(int maxtol)
+// {
+// m_query->qcSlider->setRange(0, maxtol);
+// m_inserts->setQCTol(m_query->qcSlider->value());
+// }
+
+// void InsertWindow::setMaxBreakTol(int maxtol)
+// {
+// m_query->breakSlider->setRange(0, maxtol);
+// m_inserts->setBreakTol(m_query->breakSlider->value());
+// }
+
+QPixmap InsertWindow::mateIcon(const QColor & color,int mode)
+{
+ static const int height = 4;
+ static const int readwidth = 30;
+ static QPixmap mate (readwidth * 3, height);
+ static const QRect cutout (readwidth,0,readwidth,height-1);
+ static const QRect nomate (readwidth,0,readwidth*2,height-1);
+ static const QRect nolink (readwidth,0,readwidth*2,height);
+
+ QPainter p(&mate);
+ p.fillRect(mate.rect(), color);
+ if ( mode == 0 ) p.fillRect(cutout, paletteBackgroundColor());
+ if ( mode == 1 ) p.fillRect(nomate, paletteBackgroundColor());
+ if ( mode == 2 ) p.fillRect(nolink, paletteBackgroundColor());
+ p.end();
+
+ return mate;
+}
+
+void InsertWindow::toggleSyncWithTiling()
+{
+ bool b = m_select->syncWithTilingButton->isChecked();
+ m_inserts->setSyncWithTiling(b);
+}
+
+void InsertWindow::clickSelectTool()
+{
+ m_select->selectButton->setOn(true);
+ m_select->zoomInButton->setOn(false);
+ m_select->zoomOutButton->setOn(false);
+}
+
+
+void InsertWindow::clickZoomInTool()
+{
+ m_select->selectButton->setOn(false);
+ m_select->zoomInButton->setOn(true);
+ m_select->zoomOutButton->setOn(false);
+}
+
+void InsertWindow::clickZoomOutTool()
+{
+ m_select->selectButton->setOn(false);
+ m_select->zoomInButton->setOn(false);
+ m_select->zoomOutButton->setOn(true);
+}
+
diff --git a/src/hawkeye/InsertWindow.hh b/src/hawkeye/InsertWindow.hh
new file mode 100644
index 0000000..d45a297
--- /dev/null
+++ b/src/hawkeye/InsertWindow.hh
@@ -0,0 +1,97 @@
+#ifndef INSERTWINDOW_HH_
+#define INSERTWINDOW_HH_ 1
+
+#include <q3mainwindow.h>
+#include <string>
+#include <q3popupmenu.h>
+#include <qlineedit.h>
+#include <qstring.h>
+#include <qpixmap.h>
+class QueryWidget;
+class DetailWidget;
+class InsertWidget;
+class SelectionWidget;
+
+#include <map>
+
+
+class DataStore;
+
+class InsertWindow : public Q3MainWindow
+{
+ Q_OBJECT
+
+public:
+ InsertWindow(DataStore * datastore, QWidget* parent=0, const char* name=0);
+
+ static int s_persistant;
+
+public slots:
+ void bankChanged();
+ void contigChanged();
+ void loadSearch();
+ void loadHappyDistance();
+
+ void toggleItem();
+
+ void setMaxInsertCovTol(int);
+ void setMaxReadCovTol(int);
+// void setMaxSNPTol(int);
+// void setMaxUnitigTol(int);
+// void setMaxQCTol(int);
+// void setMaxBreakTol(int);
+
+ void toggleSyncWithTiling();
+
+ void clickSelectTool();
+ void clickZoomInTool();
+ void clickZoomOutTool();
+
+signals:
+ void setGindex(int gindex);
+ void setContigId(int contigid);
+ void visibleRange(int, int);
+ void setTilingVisibleRange(int, int, int);
+ void paintCanvas();
+ void newContig();
+ void refreshInserts();
+
+ void setHappyDistance(float);
+ void search(const QString &);
+ void highlightRead(int);
+ void showAll();
+
+private:
+
+ QPixmap mateIcon (const QColor & color, int mode);
+ void buildLibraryBox();
+
+ typedef std::map<char, std::pair<int, bool> > typemap;
+
+ typemap m_types;
+
+ Q3PopupMenu * m_libmenu;
+ Q3PopupMenu * m_typesmenu;
+ Q3PopupMenu * m_optionsmenu;
+
+ DataStore * m_datastore;
+
+ InsertWidget * m_inserts;
+ QueryWidget * m_query;
+ DetailWidget * m_detail;
+ SelectionWidget * m_select;
+
+ int m_connectmatesid;
+ int m_partitiontypesid;
+ int m_coverageid;
+ int m_libcolorid;
+ int m_scaffid;
+ int m_ceid;
+ int m_tintid;
+ int m_tintfeatid;
+ int m_matecolorid;
+ int m_showscaffid;
+ QWidget * m_libLegend;
+};
+
+#endif
diff --git a/src/hawkeye/LaunchPad.cc b/src/hawkeye/LaunchPad.cc
new file mode 100644
index 0000000..b24bbb7
--- /dev/null
+++ b/src/hawkeye/LaunchPad.cc
@@ -0,0 +1,524 @@
+#include "LaunchPad.hh"
+
+#include <iostream>
+
+#include <QtGui>
+
+
+#include "InsertWindow.hh"
+#include "DataStore.hh"
+#include "ChromoStore.hh"
+#include "ChromoPicker.hh"
+#include "NetworkCom.hh"
+#include "MainWindow.hh"
+#include "NChartStats.hh"
+#include "NChartWidget.hh"
+#include "amp.hh"
+
+
+using namespace AMOS;
+using namespace std;
+
+
+LaunchPad::LaunchPad(QWidget* parent, const char* name, Qt::WFlags fl)
+ : LaunchPadBase(parent, name, fl)
+{
+ m_tilingWindow = NULL;
+ m_insertWindow = NULL;
+ m_chromoPicker = NULL;
+ m_gindex = 0;
+ m_verbose = 1;
+
+ m_datastore = new DataStore();
+
+ initFeatures();
+ initLibraries();
+ initScaffolds();
+ initContigs();
+ initReads();
+
+ connect(viewButton, SIGNAL(clicked()), this, SLOT(showAll()));
+ connect(tilingButton, SIGNAL(clicked()), this, SLOT(showTiling()));
+ connect(insertButton, SIGNAL(clicked()), this, SLOT(showInserts()));
+ connect(contigIDSpin, SIGNAL(valueChanged(int)), this, SLOT(setContigId(int)));
+
+ connect(contigSizes, SIGNAL(idSelected(int)), this, SLOT(setContigId(int)));
+ connect(scaffoldSizes, SIGNAL(idSelected(int)), this, SLOT(setScaffoldId(int)));
+ connect(contigSizes, SIGNAL(idSelected(int)), this, SLOT(showAll()));
+ connect(scaffoldSizes, SIGNAL(idSelected(int)), this, SLOT(showAll()));
+
+ connect(orderRadioGroup, SIGNAL(clicked(int)), scaffoldSizes, SLOT(setOrdering(int)));
+ connect(orderRadioGroup, SIGNAL(clicked(int)), contigSizes, SLOT(setOrdering(int)));
+ connect(colorRadioGroup, SIGNAL(clicked(int)), scaffoldSizes, SLOT(setColorStyle(int)));
+ connect(colorRadioGroup, SIGNAL(clicked(int)), contigSizes, SLOT(setColorStyle(int)));
+
+ statusBar()->message("No Bank Loaded");
+}
+
+
+LaunchPad::~LaunchPad()
+{
+ delete m_datastore;
+}
+
+void LaunchPad::fileChromoPaths()
+{
+ if (m_chromoPicker) { m_chromoPicker->close(); }
+
+ m_chromoPicker = new ChromoPicker(this, "chromoPicker");
+}
+
+void LaunchPad::addChromoPath(const QString & path)
+{
+ ChromoStore * chromostore = ChromoStore::Instance();
+ chromostore->m_tracepaths.push_back(path.ascii());
+}
+
+void LaunchPad::setChromoDB(const QString & db)
+{
+ ChromoStore * chromostore = ChromoStore::Instance();
+ if (chromostore->m_tracedb != db.ascii())
+ {
+ chromostore->m_tracedb = db.ascii();
+ }
+}
+
+
+void LaunchPad::fileOpen()
+{
+ QString s = QFileDialog::getExistingDirectory(this, "Open a Bank");
+
+ if (!s.isEmpty()) { setBankname(s.ascii()); }
+}
+
+void LaunchPad::fileExit()
+{
+ qApp->quit();
+}
+
+void LaunchPad::loadKmersFile()
+{
+ QString kmerfile =
+ QFileDialog::getOpenFileName(QString::null, "Kmers files (*.kmer)",
+ this, "Load Kmers File", "Kmers File");
+
+ if (!kmerfile.isEmpty())
+ {
+ std::string k = (const char*)kmerfile;
+ loadKmers(k);
+ }
+}
+
+
+void LaunchPad::fileImport()
+{
+ QString s = QFileDialog::getOpenFileName("", "ACE files (*.ace)", this,
+ "Import ACE file", "Choose an ACE file to import");
+
+ // if no file is selected just exit
+ if (s.isEmpty()) { return; }
+
+ // filenames
+ QString acefile(s);
+ QString afgfile(acefile+".afg");
+ QString bnkfile(acefile+".bnk");
+
+ // convert ACE file to AFG message file using toAmos
+ //QString cmd("toAmos -phd -m toAmos.mates -ace ");
+ // fangly: safer to not use PHD files and mate pairs
+ QString cmd("toAmos -ace ");
+ cmd.append("'"+acefile+"'");
+ cmd.append(" -o ");
+ cmd.append("'"+afgfile+"'");
+ int r = system(cmd);
+ if (r != 0)
+ {
+ cerr << "error: toAmos failed" << endl;
+ return;
+ }
+
+ // make a bank from the AFG message file using bank-transact
+ QString cmd2("bank-transact -f -m ");
+ cmd2.append("'"+afgfile+"'");
+ cmd2.append(" -b ");
+ cmd2.append("'"+bnkfile+"'");
+ r = system(cmd2);
+ if (r != 0)
+ {
+ cerr << "error: bank-transact failed" << endl;
+ return;
+ }
+
+ // conversion was successful, get bank name
+ if (!s.isEmpty()) { setBankname(bnkfile.ascii()); }
+}
+
+
+
+
+
+
+void LaunchPad::loadAmosFile()
+{
+ QString s = QFileDialog::getOpenFileName(QString::null, "AMOS files (*.afg)",
+ this, "Load AMOS file", "Choose an AMOS file to load");
+
+ // if no file is selected just exit
+ if (s.isEmpty()) { return; }
+
+ // make a bank from the AFG message file using bank-transact
+ QString bnkfile(s+".bnk");
+ QString cmd("bank-transact -f -m ");
+ cmd.append("'"+s+"'");
+ cmd.append(" -b ");
+ cmd.append("'"+bnkfile+"'");
+ int r = system(cmd);
+ if (r != 0)
+ {
+ cerr << "error: bank-transact failed" << endl;
+ return;
+ }
+
+ // conversion was successful, get bank name
+ if (!s.isEmpty()) { setBankname(bnkfile.ascii()); }
+}
+
+
+
+
+void LaunchPad::setBankname(std::string bankname)
+{
+ if (bankname != "")
+ {
+ EventTime_t total;
+ if (!m_datastore->openBank(bankname))
+ {
+ EventTime_t timer;
+ ProgressDots_t dots(10,10);
+ cerr << "Initialize Display ";
+
+ dots.update(1);
+ loadAssemblyStatistics();
+ dots.update(2);
+ loadFeatures();
+ dots.update(3);
+ loadLibraries();
+ dots.update(4);
+ loadScaffolds();
+ dots.update(5);
+ loadContigs();
+ dots.update(9);
+ loadNCharts();
+ dots.update(10);
+
+ cerr << " " << timer.str() << endl;
+
+ contigIDSpin->setRange(1, m_datastore->contig_bank.getSize());
+ setContigId(1);
+ emit bankSelected();
+
+ cerr << "Total Load Time: " << total.str() << endl;
+ }
+ else
+ {
+ QMessageBox::critical(this, tr("Hawkeye"), tr("Error opening bank:\n") + tr(bankname.c_str()), QMessageBox::Cancel, QMessageBox::Cancel);
+ }
+ }
+}
+
+
+void LaunchPad::loadNCharts()
+{
+ EventTime_t timer;
+ if (m_verbose) { cerr << "Loading NCharts..."; }
+
+ m_scaffstats = new NChartStats((string)"Scaffold Span Distribution");
+
+ if (m_datastore->scaffold_bank.isOpen())
+ {
+ AMOS::Scaffold_t scaffold;
+ m_datastore->scaffold_bank.seekg(1);
+ while (m_datastore->scaffold_bank >> scaffold)
+ {
+ int bid = m_datastore->scaffold_bank.tellg() - 1;
+ m_scaffstats->addSize(bid, scaffold.getSpan());
+ }
+ }
+
+ m_contigstats = new NChartStats((string)"Contig Length Distribution");
+
+ if (m_datastore->contig_bank.isOpen())
+ {
+ AMOS::Contig_t contig;
+ m_datastore->contig_bank.seekg(1);
+ m_datastore->contig_bank.setFixedStoreOnly(true);
+ while (m_datastore->contig_bank >> contig)
+ {
+ int bid = m_datastore->contig_bank.tellg() - 1;
+ m_contigstats->addSize(bid, contig.getLength());
+ }
+ m_datastore->contig_bank.setFixedStoreOnly(false);
+ }
+
+
+ if (m_datastore->feat_bank.isOpen())
+ {
+ try
+ {
+ Feature_t feat;
+ m_datastore->feat_bank.seekg(1);
+ m_datastore->feat_bank.setFixedStoreOnly(true);
+ while (m_datastore->feat_bank >> feat)
+ {
+ ID_t iid = feat.getSource().first;
+ NCode_t nc = feat.getSource().second;
+
+ if (nc == Contig_t::NCODE)
+ {
+ try
+ {
+ m_contigstats->addScore(m_datastore->contig_bank.lookupBID(iid), 1.0);
+
+ int scaffid = m_datastore->lookupScaffoldId(iid);
+ if (scaffid) { m_scaffstats->addScore(scaffid, 1.0); }
+ }
+ catch (AMOS::Exception_t & e)
+ {
+ cerr << "error: " << e << endl;
+ }
+ }
+ else if (nc == Scaffold_t::NCODE)
+ {
+ try
+ {
+ m_scaffstats->addScore(m_datastore->scaffold_bank.lookupBID(iid), 1.0);
+ }
+ catch (AMOS::Exception_t & e)
+ {
+ cerr << "error: " << e << endl;
+ }
+ }
+ }
+ }
+ catch (AMOS::Exception_t & e)
+ {
+ cerr << "error: " << e << endl;
+ }
+
+ m_datastore->feat_bank.setFixedStoreOnly(false);
+ }
+
+ scaffoldSizes->setStats(m_scaffstats);
+ contigSizes->setStats(m_contigstats);
+
+ if (m_verbose) { cerr << " " << timer.str() << endl; }
+}
+
+void LaunchPad::initDisplay()
+{
+ statsText->verticalScrollBar()->setValue(0);
+}
+
+void LaunchPad::showAll()
+{
+ showInserts();
+ showTiling();
+}
+
+
+void LaunchPad::showInserts()
+{
+ if (!m_insertWindow)
+ {
+ m_insertWindow = new InsertWindow(m_datastore, this, "insertWindow");
+
+ connect(m_insertWindow, SIGNAL(setGindex(int)),
+ this, SLOT(setGindex(int)));
+
+ connect(m_insertWindow, SIGNAL(setContigId(int)),
+ this, SLOT(setContigId(int)));
+
+ connect(this, SIGNAL(setTilingVisibleRange(int, int, int)),
+ m_insertWindow, SIGNAL(setTilingVisibleRange(int, int, int)));
+
+ connect(this, SIGNAL(contigIdSelected(int)),
+ m_insertWindow, SLOT(contigChanged()));
+
+ connect(this, SIGNAL(bankSelected()),
+ m_insertWindow, SLOT(bankChanged()));
+
+ connect(this, SIGNAL(highlightRead(int)),
+ m_insertWindow, SIGNAL(highlightRead(int)));
+ }
+
+ m_insertWindow->show();
+
+ if (m_tilingWindow) { m_tilingWindow->update(); }
+}
+
+void LaunchPad::showTiling()
+{
+ if (!m_tilingWindow)
+ {
+ m_tilingWindow = new MainWindow(m_datastore, this, "insertWindow");
+
+ connect(this, SIGNAL(contigIdSelected(int)),
+ m_tilingWindow, SLOT(setContigId(int)));
+
+ connect(this, SIGNAL(gindexSelected(int)),
+ m_tilingWindow, SLOT(setGindex(int)));
+
+ connect(m_tilingWindow, SIGNAL(setTilingVisibleRange(int,int,int)),
+ this, SIGNAL(setTilingVisibleRange(int,int,int)));
+
+ connect(this, SIGNAL(bankSelected()),
+ m_tilingWindow, SLOT(bankChanged()));
+
+ connect(m_tilingWindow, SIGNAL(gindexChanged(int)),
+ this, SLOT(setGindex(int)));
+
+ m_tilingWindow->bankChanged();
+ }
+
+ m_tilingWindow->setContigId(contigIDSpin->value());
+ m_tilingWindow->setGindex(m_gindex);
+
+ m_tilingWindow->show();
+}
+
+
+void LaunchPad::setContigId(int contigId)
+{
+ if ((contigId != 0) &&
+ ((AMOS::ID_t)contigId != m_datastore->m_contigId) &&
+ !m_datastore->setContigId(contigId))
+ {
+ QString s = "Viewing ";
+ s += m_datastore->m_bankname.c_str();
+ s += " with ";
+ s += QString::number(m_datastore->contig_bank.getSize());
+ s += " contigs";
+
+ s += " Contig Id:";
+ s += QString::number(contigId);
+ s += " Size: ";
+ s += QString::number(m_datastore->m_contig.getLength());
+ s += " Reads: ";
+ s += QString::number(m_datastore->m_contig.getReadTiling().size());
+
+ if (contigIDSpin->value() != contigId)
+ {
+ contigIDSpin->setValue(contigId);
+ }
+
+ loadReads();
+
+ emit contigIdSelected(m_datastore->m_contigId);
+ emit gindexSelected(0);
+ statusBar()->message(s);
+ }
+}
+
+void LaunchPad::setScaffoldId(int scaffId)
+{
+ if ((scaffId != 0) &&
+ (scaffId != m_datastore->m_scaffoldId) &&
+ (m_datastore->scaffold_bank.isOpen()))
+ {
+ AMOS::Scaffold_t scaffold;
+ m_datastore->fetchScaffoldBID(scaffId, scaffold);
+
+ AMOS::ID_t contigiid = scaffold.getContigTiling().begin()->source;
+ AMOS::ID_t bid = m_datastore->contig_bank.getIDMap().lookupBID(contigiid);
+
+ setContigId(bid);
+ }
+}
+
+void LaunchPad::initializeSimpleServer(int port)
+{
+ SimpleServer * server = new SimpleServer(this, port);
+ connect(server, SIGNAL(newConnect(ClientSocket*)),
+ SLOT(newConnect(ClientSocket*)));
+}
+
+void LaunchPad::newConnect(ClientSocket * s)
+{
+ statusBar()->message("New Connection");
+
+ connect(s, SIGNAL(logText(const QString &)),
+ statusBar(), SLOT(message(const QString &)));
+
+ connect(s, SIGNAL(setContigLocation(QString, int)),
+ this, SLOT(setContigLocation(QString, int)));
+}
+
+void LaunchPad::setContigLocation(const QString contigid, int pos)
+{
+ int bid;
+ cerr << "set contig location " << qPrintable(contigid) << ":" << pos << endl;
+
+ if (contigid[0] == 'E')
+ {
+ cerr << "Lookup: " << contigid.ascii()+1 << endl;
+ bid = m_datastore->contig_bank.getIDMap().lookupBID(contigid.ascii()+1);
+ }
+ else if (contigid[0] == 'I')
+ {
+ int iid = atoi(contigid.ascii()+1);
+
+ cerr << "Lookup " << iid << endl;
+ bid = m_datastore->contig_bank.getIDMap().lookupBID(iid);
+ }
+ else
+ {
+ bid = atoi(contigid.ascii());
+ }
+
+ setContigId(bid);
+ setGindex(pos);
+}
+
+
+void LaunchPad::enableTraceFetch(bool dofetch)
+{
+ ChromoStore * chromostore = ChromoStore::Instance();
+ chromostore->m_tracecmdenabled = dofetch;
+}
+
+void LaunchPad::loadKmers(std::string file)
+{
+ m_datastore->Read_Mers(file.c_str());
+}
+
+void LaunchPad::jumpToRead(int iid)
+{
+ ID_t contigid = m_datastore->lookupContigId(iid);
+
+ if (contigid != 0)
+ {
+ setContigId(contigid);
+ vector<AMOS::Tile_t>::iterator ti;
+ for (ti = m_datastore->m_contig.getReadTiling().begin();
+ ti != m_datastore->m_contig.getReadTiling().end();
+ ti++)
+ {
+ if (ti->source == iid)
+ {
+ setGindex(ti->offset);
+ emit highlightRead(ti->source);
+ break;
+ }
+ }
+ }
+}
+
+void LaunchPad::setGindex(int gpos)
+{
+ m_gindex = gpos;
+
+ if (!m_tilingWindow) { emit setTilingVisibleRange(m_datastore->m_contigId, gpos, gpos+100); }
+ emit gindexSelected(gpos);
+}
+
+
diff --git a/src/hawkeye/LaunchPad.hh b/src/hawkeye/LaunchPad.hh
new file mode 100644
index 0000000..ef8ec9c
--- /dev/null
+++ b/src/hawkeye/LaunchPad.hh
@@ -0,0 +1,140 @@
+#ifndef LAUNCHPAD_H
+#define LAUNCHPAD_H
+
+#include <string>
+
+#include <qcursor.h>
+#include <qpushbutton.h>
+#include <q3buttongroup.h>
+#include <qradiobutton.h>
+#include <q3listview.h>
+
+#include "LaunchPadBase.hh"
+#include "NetworkCom.hh"
+#include "DataStore.hh"
+
+class InsertWindow;
+class MainWindow;
+class NChartStats;
+
+class LaunchPad : public LaunchPadBase
+{
+ Q_OBJECT
+
+public:
+ LaunchPad(QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = Qt::WType_TopLevel);
+ ~LaunchPad();
+
+public slots:
+
+ // global
+ void fileOpen();
+ void fileExit();
+ void initDisplay();
+
+ void setBankname(std::string bankname);
+
+ void showAll();
+ void showInserts();
+ void showTiling();
+
+ void fileImport();
+ void loadAmosFile();
+
+ void fileChromoPaths();
+ void addChromoPath(const QString & path);
+ void setChromoDB(const QString & db);
+
+ void loadKmers(std::string file);
+ void loadKmersFile();
+
+ void newConnect(ClientSocket * s);
+ void setContigLocation(QString, int);
+ void jumpToRead(int iid);
+ void initializeSimpleServer(int port);
+ void enableTraceFetch(bool dofetch);
+
+ void setScaffoldId(int);
+ void setContigId(int);
+ void setGindex(int);
+
+
+ // stats tab
+ void loadAssemblyStatistics();
+ void loadNCharts();
+
+ // features tab
+ void initFeatures();
+ void loadFeatures();
+ void featureSelected(Q3ListViewItem *);
+ void featureViewButtonSelected();
+ void featureGroupChanged(int);
+
+ // libraries tab
+ void initLibraries();
+ void loadLibraries();
+ void librarySelected(Q3ListViewItem *);
+ void libraryViewSelected();
+ void libraryClearLengthSelected();
+ void libraryReadLengthSelected();
+ void libraryGCSelected();
+
+ // scaffolds tab
+ void initScaffolds();
+ void loadScaffolds();
+ void scaffoldSelected(Q3ListViewItem *);
+ void scaffoldSelectIID(const QString &);
+ void scaffoldSelectEID(const QString &);
+ void scaffoldViewSelected();
+ void scaffoldSpanHistogram();
+ void scaffoldContigHistogram();
+
+ // contigs tab
+ void initContigs();
+ void loadContigs();
+ void contigSelected(Q3ListViewItem *);
+ void contigSelectIID(const QString &);
+ void contigSelectEID(const QString &);
+ void contigViewSelected();
+ void contigLengthHistogram();
+ void contigReadCountHistogram();
+ void contigCoverageHistogram();
+ void contigGCHistogram();
+
+
+ // reads tab
+ void initReads();
+ void loadReads();
+ void readSelected(Q3ListViewItem *);
+ void readSelectIID(const QString &);
+ void readSelectEID(const QString &);
+ void readViewSelected();
+ void readLengthHistogram();
+ void readGCHistogram();
+
+
+signals:
+ void setTilingVisibleRange(int,int,int);
+ void bankSelected();
+ void highlightRead(int);
+
+ void contigIdSelected(int);
+ void gindexSelected(int);
+
+
+private:
+
+ DataStore * m_datastore;
+
+ InsertWindow * m_insertWindow;
+ MainWindow * m_tilingWindow;
+ Q3MainWindow * m_chromoPicker;
+ NChartStats * m_scaffstats;
+ NChartStats * m_contigstats;
+
+ int m_gindex;
+ int m_verbose;
+
+};
+
+#endif
diff --git a/src/hawkeye/LaunchPadBase.cc b/src/hawkeye/LaunchPadBase.cc
new file mode 100644
index 0000000..e2ef70b
--- /dev/null
+++ b/src/hawkeye/LaunchPadBase.cc
@@ -0,0 +1,619 @@
+
+#include "LaunchPadBase.hh"
+
+#include <qvariant.h>
+#include <qpushbutton.h>
+#include <qtabwidget.h>
+#include <qwidget.h>
+#include <q3textedit.h>
+#include <q3buttongroup.h>
+#include <qradiobutton.h>
+#include <q3header.h>
+#include <q3listview.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qcheckbox.h>
+#include <qspinbox.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <q3whatsthis.h>
+#include <qaction.h>
+#include <qmenubar.h>
+#include <q3popupmenu.h>
+#include <q3toolbar.h>
+#include <qimage.h>
+#include <qpixmap.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+#include <Q3VBoxLayout>
+#include <QtGui>
+
+#include "icons/Hawkeye.xpm"
+
+#include "NChartWidget.hh"
+static const unsigned char image1_data[] = {
+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
+ 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16,
+ 0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xb4, 0x6c, 0x3b, 0x00, 0x00, 0x00,
+ 0xae, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xb5, 0x94, 0x51, 0x0e, 0xc3,
+ 0x20, 0x0c, 0x43, 0x6d, 0xb4, 0x53, 0x71, 0xb6, 0x69, 0x1f, 0xd3, 0xce,
+ 0xe6, 0x6b, 0xb1, 0x8f, 0x51, 0x35, 0xa2, 0x19, 0x23, 0x5a, 0xf0, 0x4f,
+ 0x44, 0x2b, 0x5e, 0x2c, 0x03, 0xa1, 0x24, 0xec, 0x50, 0xd9, 0x42, 0xdd,
+ 0x09, 0xbe, 0x45, 0x37, 0xd4, 0x5a, 0x9b, 0x5d, 0x4b, 0xe2, 0xf8, 0x5f,
+ 0x12, 0x43, 0xe0, 0x63, 0x93, 0xd7, 0x48, 0x12, 0x6d, 0x53, 0x66, 0x1d,
+ 0x9e, 0x85, 0x4a, 0x62, 0x4a, 0xc6, 0x63, 0x3c, 0x40, 0xcf, 0xf8, 0x57,
+ 0x6e, 0x51, 0x28, 0x00, 0x10, 0x40, 0x6b, 0x0d, 0x00, 0xda, 0xb1, 0x04,
+ 0xb9, 0xc6, 0x9d, 0x19, 0xe8, 0x87, 0x77, 0x42, 0x01, 0xf6, 0x4e, 0xbc,
+ 0x7c, 0x8f, 0x34, 0x2f, 0xc6, 0x78, 0xb0, 0xce, 0x55, 0x3c, 0xc7, 0x6b,
+ 0x75, 0x2e, 0x37, 0xe3, 0x68, 0xd6, 0x9e, 0xdc, 0x8c, 0x2d, 0xf4, 0xf5,
+ 0x8c, 0x01, 0xef, 0x8f, 0x4f, 0x75, 0x33, 0xfe, 0x17, 0x6a, 0x1e, 0x48,
+ 0x2e, 0xf4, 0xe2, 0x38, 0x0b, 0x6a, 0xc0, 0xb9, 0xd0, 0xd3, 0x6a, 0x57,
+ 0x16, 0x14, 0x30, 0x83, 0x3e, 0x13, 0x0a, 0xac, 0xde, 0xf6, 0x2f, 0x9a,
+ 0xcd, 0x8a, 0xb4, 0x79, 0x3c, 0xea, 0x0d, 0x05, 0x19, 0x70, 0xcd, 0xbc,
+ 0x4f, 0x01, 0xb2, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae,
+ 0x42, 0x60, 0x82
+};
+
+
+/*
+ * Constructs a LaunchPadBase as a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ *
+ */
+LaunchPadBase::LaunchPadBase( QWidget* parent, const char* name, Qt::WFlags fl )
+ : Q3MainWindow( parent, name, fl )
+{
+ (void)statusBar();
+ QImage img;
+ img.loadFromData( image1_data, sizeof( image1_data ), "PNG" );
+ image1 = img;
+ if ( !name )
+ setName( "LaunchPadBase" );
+ setCentralWidget( new QWidget( this, "qt_central_widget" ) );
+ LaunchPadBaseLayout = new Q3GridLayout( centralWidget(), 1, 1, 11, 6, "LaunchPadBaseLayout");
+
+ tabWidget = new QTabWidget( centralWidget(), "tabWidget" );
+ tabWidget->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, tabWidget->sizePolicy().hasHeightForWidth() ) );
+
+ statsTab = new QWidget( tabWidget, "statsTab" );
+ statsTabLayout = new Q3GridLayout( statsTab, 1, 1, 11, 6, "statsTabLayout");
+
+ statsText = new Q3TextEdit( statsTab, "statsText" );
+ statsText->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)7, 0, 0, statsText->sizePolicy().hasHeightForWidth() ) );
+ statsText->setMinimumSize( QSize( 300, 0 ) );
+ statsText->setTextFormat( Qt::RichText );
+ statsText->setReadOnly( TRUE );
+
+ statsTabLayout->addMultiCellWidget( statsText, 0, 2, 0, 0 );
+
+ scaffoldSizes = new NChartWidget( statsTab, "scaffoldSizes" );
+
+ statsTabLayout->addMultiCellWidget( scaffoldSizes, 0, 0, 1, 3 );
+
+ contigSizes = new NChartWidget( statsTab, "contigSizes" );
+
+ statsTabLayout->addMultiCellWidget( contigSizes, 1, 1, 1, 3 );
+
+ orderRadioGroup = new Q3ButtonGroup( statsTab, "orderRadioGroup" );
+ orderRadioGroup->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, orderRadioGroup->sizePolicy().hasHeightForWidth() ) );
+ orderRadioGroup->setColumnLayout(0, Qt::Vertical );
+ orderRadioGroup->layout()->setSpacing( 6 );
+ orderRadioGroup->layout()->setMargin( 11 );
+ orderRadioGroupLayout = new Q3GridLayout( orderRadioGroup->layout() );
+ orderRadioGroupLayout->setAlignment( Qt::AlignTop );
+
+ radioButton8 = new QRadioButton( orderRadioGroup, "radioButton8" );
+ radioButton8->setChecked( TRUE );
+
+ orderRadioGroupLayout->addWidget( radioButton8, 0, 0 );
+
+ radioButton9 = new QRadioButton( orderRadioGroup, "radioButton9" );
+
+ orderRadioGroupLayout->addWidget( radioButton9, 0, 1 );
+
+ radioButton10 = new QRadioButton( orderRadioGroup, "radioButton10" );
+
+ orderRadioGroupLayout->addWidget( radioButton10, 0, 2 );
+
+ statsTabLayout->addWidget( orderRadioGroup, 2, 1 );
+
+ colorRadioGroup = new Q3ButtonGroup( statsTab, "colorRadioGroup" );
+ colorRadioGroup->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, colorRadioGroup->sizePolicy().hasHeightForWidth() ) );
+ colorRadioGroup->setColumnLayout(0, Qt::Vertical );
+ colorRadioGroup->layout()->setSpacing( 6 );
+ colorRadioGroup->layout()->setMargin( 11 );
+ colorRadioGroupLayout = new Q3GridLayout( colorRadioGroup->layout() );
+ colorRadioGroupLayout->setAlignment( Qt::AlignTop );
+
+ radioButton11 = new QRadioButton( colorRadioGroup, "radioButton11" );
+ radioButton11->setChecked( TRUE );
+
+ colorRadioGroupLayout->addWidget( radioButton11, 0, 0 );
+
+ radioButton12 = new QRadioButton( colorRadioGroup, "radioButton12" );
+
+ colorRadioGroupLayout->addWidget( radioButton12, 0, 1 );
+
+ statsTabLayout->addWidget( colorRadioGroup, 2, 2 );
+ spacer7 = new QSpacerItem( 81, 41, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ statsTabLayout->addItem( spacer7, 2, 3 );
+ tabWidget->insertTab( statsTab, QString::fromLatin1("") );
+
+ featuresTab = new QWidget( tabWidget, "featuresTab" );
+ featuresTabLayout = new Q3GridLayout( featuresTab, 1, 1, 11, 6, "featuresTabLayout");
+
+ featureList = new Q3ListView( featuresTab, "featureList" );
+ featureList->setAllColumnsShowFocus( TRUE );
+ featureList->setShowSortIndicator( TRUE );
+ featureList->setRootIsDecorated( TRUE );
+
+ featuresTabLayout->addMultiCellWidget( featureList, 0, 0, 0, 2 );
+
+ groupGroup = new Q3ButtonGroup( featuresTab, "groupGroup" );
+ groupGroup->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, groupGroup->sizePolicy().hasHeightForWidth() ) );
+ groupGroup->setColumnLayout(0, Qt::Vertical );
+ groupGroup->layout()->setSpacing( 6 );
+ groupGroup->layout()->setMargin( 11 );
+ groupGroupLayout = new Q3HBoxLayout( groupGroup->layout() );
+ groupGroupLayout->setAlignment( Qt::AlignTop );
+
+ featureGroupContigButton = new QRadioButton( groupGroup, "featureGroupContigButton" );
+ featureGroupContigButton->setChecked( TRUE );
+ groupGroupLayout->addWidget( featureGroupContigButton );
+
+ featureGroupTypeButton = new QRadioButton( groupGroup, "featureGroupTypeButton" );
+ featureGroupTypeButton->setChecked( FALSE );
+ groupGroupLayout->addWidget( featureGroupTypeButton );
+
+ featuresTabLayout->addWidget( groupGroup, 1, 0 );
+ spacer1 = new QSpacerItem( 190, 21, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ featuresTabLayout->addItem( spacer1, 1, 1 );
+ tabWidget->insertTab( featuresTab, QString::fromLatin1("") );
+
+ librariesTab = new QWidget( tabWidget, "librariesTab" );
+ librariesTabLayout = new Q3GridLayout( librariesTab, 1, 1, 11, 6, "librariesTabLayout");
+
+ libraryList = new Q3ListView( librariesTab, "libraryList" );
+ libraryList->setAllColumnsShowFocus( TRUE );
+ libraryList->setShowSortIndicator( TRUE );
+ libraryList->setRootIsDecorated( TRUE );
+
+ librariesTabLayout->addWidget( libraryList, 0, 0 );
+
+ histogramGroup = new Q3ButtonGroup( librariesTab, "histogramGroup" );
+ histogramGroup->setColumnLayout(0, Qt::Vertical );
+ histogramGroup->layout()->setSpacing( 6 );
+ histogramGroup->layout()->setMargin( 11 );
+ histogramGroupLayout = new Q3GridLayout( histogramGroup->layout() );
+ histogramGroupLayout->setAlignment( Qt::AlignTop );
+
+ libraryClearLengthButton = new QPushButton( histogramGroup, "libraryClearLengthButton" );
+ libraryClearLengthButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, libraryClearLengthButton->sizePolicy().hasHeightForWidth() ) );
+
+ histogramGroupLayout->addWidget( libraryClearLengthButton, 0, 1 );
+
+ libraryInsertButton = new QPushButton( histogramGroup, "libraryInsertButton" );
+ libraryInsertButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, libraryInsertButton->sizePolicy().hasHeightForWidth() ) );
+
+ histogramGroupLayout->addWidget( libraryInsertButton, 0, 0 );
+
+ libraryReadLengthButton = new QPushButton( histogramGroup, "libraryReadLengthButton" );
+ libraryReadLengthButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, libraryReadLengthButton->sizePolicy().hasHeightForWidth() ) );
+
+ histogramGroupLayout->addWidget( libraryReadLengthButton, 0, 2 );
+
+ libraryGCButton = new QPushButton( histogramGroup, "libraryGCButton" );
+ libraryGCButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, libraryGCButton->sizePolicy().hasHeightForWidth() ) );
+
+ histogramGroupLayout->addWidget( libraryGCButton, 0, 3 );
+
+ librariesTabLayout->addWidget( histogramGroup, 1, 0 );
+ tabWidget->insertTab( librariesTab, QString::fromLatin1("") );
+
+ scaffoldsTab = new QWidget( tabWidget, "scaffoldsTab" );
+ scaffoldsTabLayout = new Q3GridLayout( scaffoldsTab, 1, 1, 11, 6, "scaffoldsTabLayout");
+
+ scaffoldList = new Q3ListView( scaffoldsTab, "scaffoldList" );
+ scaffoldList->setAllColumnsShowFocus( TRUE );
+ scaffoldList->setShowSortIndicator( TRUE );
+ scaffoldList->setRootIsDecorated( TRUE );
+
+ scaffoldsTabLayout->addMultiCellWidget( scaffoldList, 0, 0, 0, 3 );
+
+ textLabel1 = new QLabel( scaffoldsTab, "textLabel1" );
+ textLabel1->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
+
+ scaffoldsTabLayout->addWidget( textLabel1, 1, 0 );
+
+ textLabel1_2 = new QLabel( scaffoldsTab, "textLabel1_2" );
+ textLabel1_2->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
+
+ scaffoldsTabLayout->addWidget( textLabel1_2, 2, 0 );
+
+ scaffoldIIDEdit = new QLineEdit( scaffoldsTab, "scaffoldIIDEdit" );
+ scaffoldIIDEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, scaffoldIIDEdit->sizePolicy().hasHeightForWidth() ) );
+
+ scaffoldsTabLayout->addWidget( scaffoldIIDEdit, 1, 1 );
+
+ scaffoldEIDEdit = new QLineEdit( scaffoldsTab, "scaffoldEIDEdit" );
+ scaffoldEIDEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, scaffoldEIDEdit->sizePolicy().hasHeightForWidth() ) );
+
+ scaffoldsTabLayout->addWidget( scaffoldEIDEdit, 2, 1 );
+
+ scaffoldHistogramGroup = new Q3ButtonGroup( scaffoldsTab, "scaffoldHistogramGroup" );
+ scaffoldHistogramGroup->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, scaffoldHistogramGroup->sizePolicy().hasHeightForWidth() ) );
+ scaffoldHistogramGroup->setColumnLayout(0, Qt::Vertical );
+ scaffoldHistogramGroup->layout()->setSpacing( 6 );
+ scaffoldHistogramGroup->layout()->setMargin( 11 );
+ scaffoldHistogramGroupLayout = new Q3HBoxLayout( scaffoldHistogramGroup->layout() );
+ scaffoldHistogramGroupLayout->setAlignment( Qt::AlignTop );
+
+ scaffoldSpanButton = new QPushButton( scaffoldHistogramGroup, "scaffoldSpanButton" );
+ scaffoldSpanButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, scaffoldSpanButton->sizePolicy().hasHeightForWidth() ) );
+ scaffoldHistogramGroupLayout->addWidget( scaffoldSpanButton );
+
+ scaffoldContigsButton = new QPushButton( scaffoldHistogramGroup, "scaffoldContigsButton" );
+ scaffoldContigsButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, scaffoldContigsButton->sizePolicy().hasHeightForWidth() ) );
+ scaffoldHistogramGroupLayout->addWidget( scaffoldContigsButton );
+
+ scaffoldsTabLayout->addMultiCellWidget( scaffoldHistogramGroup, 1, 2, 2, 2 );
+ tabWidget->insertTab( scaffoldsTab, QString::fromLatin1("") );
+
+ contigsTab = new QWidget( tabWidget, "contigsTab" );
+ contigsTabLayout = new Q3GridLayout( contigsTab, 1, 1, 11, 6, "contigsTabLayout");
+
+ textLabel1_2_2 = new QLabel( contigsTab, "textLabel1_2_2" );
+ textLabel1_2_2->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
+
+ contigsTabLayout->addWidget( textLabel1_2_2, 2, 0 );
+
+ textLabel1_3 = new QLabel( contigsTab, "textLabel1_3" );
+ textLabel1_3->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
+
+ contigsTabLayout->addWidget( textLabel1_3, 1, 0 );
+
+ scaffoldHistogramGroup_2 = new Q3ButtonGroup( contigsTab, "scaffoldHistogramGroup_2" );
+ scaffoldHistogramGroup_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, scaffoldHistogramGroup_2->sizePolicy().hasHeightForWidth() ) );
+ scaffoldHistogramGroup_2->setColumnLayout(0, Qt::Vertical );
+ scaffoldHistogramGroup_2->layout()->setSpacing( 6 );
+ scaffoldHistogramGroup_2->layout()->setMargin( 11 );
+ scaffoldHistogramGroup_2Layout = new Q3HBoxLayout( scaffoldHistogramGroup_2->layout() );
+ scaffoldHistogramGroup_2Layout->setAlignment( Qt::AlignTop );
+
+ contigLengthButton = new QPushButton( scaffoldHistogramGroup_2, "contigLengthButton" );
+ contigLengthButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, contigLengthButton->sizePolicy().hasHeightForWidth() ) );
+ scaffoldHistogramGroup_2Layout->addWidget( contigLengthButton );
+
+ contigReadsButton = new QPushButton( scaffoldHistogramGroup_2, "contigReadsButton" );
+ contigReadsButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, contigReadsButton->sizePolicy().hasHeightForWidth() ) );
+ scaffoldHistogramGroup_2Layout->addWidget( contigReadsButton );
+
+ contigCoverageButton = new QPushButton( scaffoldHistogramGroup_2, "contigCoverageButton" );
+ contigCoverageButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, contigCoverageButton->sizePolicy().hasHeightForWidth() ) );
+ scaffoldHistogramGroup_2Layout->addWidget( contigCoverageButton );
+
+ contigGCButton = new QPushButton( scaffoldHistogramGroup_2, "contigGCButton" );
+ contigGCButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, contigGCButton->sizePolicy().hasHeightForWidth() ) );
+ scaffoldHistogramGroup_2Layout->addWidget( contigGCButton );
+
+ contigsTabLayout->addMultiCellWidget( scaffoldHistogramGroup_2, 1, 2, 3, 3 );
+
+ contigList = new Q3ListView( contigsTab, "contigList" );
+ contigList->setAllColumnsShowFocus( TRUE );
+ contigList->setShowSortIndicator( TRUE );
+ contigList->setRootIsDecorated( TRUE );
+
+ contigsTabLayout->addMultiCellWidget( contigList, 0, 0, 0, 3 );
+
+ contigEIDEdit = new QLineEdit( contigsTab, "contigEIDEdit" );
+ contigEIDEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, contigEIDEdit->sizePolicy().hasHeightForWidth() ) );
+
+ contigsTabLayout->addWidget( contigEIDEdit, 2, 1 );
+
+ contigIIDEdit = new QLineEdit( contigsTab, "contigIIDEdit" );
+ contigIIDEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, contigIIDEdit->sizePolicy().hasHeightForWidth() ) );
+
+ contigsTabLayout->addWidget( contigIIDEdit, 1, 1 );
+
+ buttonGroup7 = new Q3ButtonGroup( contigsTab, "buttonGroup7" );
+ buttonGroup7->setColumnLayout(0, Qt::Vertical );
+ buttonGroup7->layout()->setSpacing( 6 );
+ buttonGroup7->layout()->setMargin( 11 );
+ buttonGroup7Layout = new Q3VBoxLayout( buttonGroup7->layout() );
+ buttonGroup7Layout->setAlignment( Qt::AlignTop );
+
+ readsCheck = new QCheckBox( buttonGroup7, "readsCheck" );
+ buttonGroup7Layout->addWidget( readsCheck );
+
+ contigsTabLayout->addMultiCellWidget( buttonGroup7, 1, 2, 2, 2 );
+ tabWidget->insertTab( contigsTab, QString::fromLatin1("") );
+
+ TabPage = new QWidget( tabWidget, "TabPage" );
+ TabPageLayout = new Q3GridLayout( TabPage, 1, 1, 11, 6, "TabPageLayout");
+
+ textLabel1_3_2 = new QLabel( TabPage, "textLabel1_3_2" );
+ textLabel1_3_2->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
+
+ TabPageLayout->addWidget( textLabel1_3_2, 1, 0 );
+
+ readEIDEdit = new QLineEdit( TabPage, "readEIDEdit" );
+ readEIDEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, readEIDEdit->sizePolicy().hasHeightForWidth() ) );
+
+ TabPageLayout->addWidget( readEIDEdit, 2, 1 );
+
+ textLabel1_2_2_2 = new QLabel( TabPage, "textLabel1_2_2_2" );
+ textLabel1_2_2_2->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
+
+ TabPageLayout->addWidget( textLabel1_2_2_2, 2, 0 );
+
+ readIIDEdit = new QLineEdit( TabPage, "readIIDEdit" );
+ readIIDEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, readIIDEdit->sizePolicy().hasHeightForWidth() ) );
+
+ TabPageLayout->addWidget( readIIDEdit, 1, 1 );
+
+ scaffoldHistogramGroup_2_2 = new Q3ButtonGroup( TabPage, "scaffoldHistogramGroup_2_2" );
+ scaffoldHistogramGroup_2_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, scaffoldHistogramGroup_2_2->sizePolicy().hasHeightForWidth() ) );
+ scaffoldHistogramGroup_2_2->setColumnLayout(0, Qt::Vertical );
+ scaffoldHistogramGroup_2_2->layout()->setSpacing( 6 );
+ scaffoldHistogramGroup_2_2->layout()->setMargin( 11 );
+ scaffoldHistogramGroup_2_2Layout = new Q3GridLayout( scaffoldHistogramGroup_2_2->layout() );
+ scaffoldHistogramGroup_2_2Layout->setAlignment( Qt::AlignTop );
+
+ readLengthButton = new QPushButton( scaffoldHistogramGroup_2_2, "readLengthButton" );
+ readLengthButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, readLengthButton->sizePolicy().hasHeightForWidth() ) );
+
+ scaffoldHistogramGroup_2_2Layout->addWidget( readLengthButton, 0, 0 );
+
+ readGCButton = new QPushButton( scaffoldHistogramGroup_2_2, "readGCButton" );
+ readGCButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, readGCButton->sizePolicy().hasHeightForWidth() ) );
+
+ scaffoldHistogramGroup_2_2Layout->addWidget( readGCButton, 0, 1 );
+
+ TabPageLayout->addMultiCellWidget( scaffoldHistogramGroup_2_2, 1, 2, 2, 2 );
+
+ readList = new Q3ListView( TabPage, "readList" );
+ readList->setAllColumnsShowFocus( TRUE );
+ readList->setShowSortIndicator( TRUE );
+ readList->setRootIsDecorated( TRUE );
+
+ TabPageLayout->addMultiCellWidget( readList, 0, 0, 0, 3 );
+ tabWidget->insertTab( TabPage, QString::fromLatin1("") );
+
+ LaunchPadBaseLayout->addWidget( tabWidget, 0, 0 );
+
+ // actions
+ fileOpenAction = new QAction( this, "fileOpenAction" );
+ fileOpenAction->setIconSet( QIcon( image1 ) );
+ fileQuitAction = new QAction( this, "fileQuitAction" );
+ fileChromatogramPathsAction = new QAction( this, "fileChromatogramPathsAction" );
+
+ fileImportAction = new QAction( this, "fileImportAction" );
+ loadAmosFileAction = new QAction( this, "loadAmosFileAction" );
+ loadKmersAction = new QAction(this, "loadKmersAction");
+
+
+ // toolbars
+ Toolbar = new Q3ToolBar( QString(""), this, Qt::DockRight );
+
+ QLabel * logo = new QLabel(Toolbar, "logolabel");
+ QPixmap pixmap((const char **)Hawkeye_xpm);
+
+ logo->setPixmap(pixmap.scaledToWidth(150, Qt::SmoothTransformation));
+
+
+ contigIDLabel = new QLabel( Toolbar, "contigIDLabel" );
+
+ contigIDSpin = new QSpinBox( Toolbar, "contigIDSpin" );
+ contigIDSpin->setMinimumSize( QSize(100,25));
+ Toolbar->addSeparator();
+
+ viewButton = new QPushButton( Toolbar, "viewButton" );
+ viewButton->setMinimumSize( QSize( 0, 25 ) );
+ Toolbar->addSeparator();
+
+ insertButton = new QPushButton( Toolbar, "insertButton" );
+ insertButton->setMinimumSize( QSize( 0, 25 ) );
+ Toolbar->addSeparator();
+
+ tilingButton = new QPushButton( Toolbar, "tilingButton" );
+ tilingButton->setMinimumSize( QSize( 0, 25 ) );
+
+
+ // menubar
+ MenuBar = new QMenuBar( this, "MenuBar" );
+
+
+ fileMenu = new Q3PopupMenu( this );
+ fileOpenAction->addTo( fileMenu );
+ fileImportAction->addTo( fileMenu );
+ loadAmosFileAction->addTo( fileMenu );
+ loadKmersAction->addTo(fileMenu);
+ fileChromatogramPathsAction->addTo( fileMenu );
+
+ fileMenu->insertSeparator();
+ fileQuitAction->addTo( fileMenu );
+ MenuBar->insertItem( QString(""), fileMenu, 1 );
+
+ languageChange();
+ resize( QSize(937, 738).expandedTo(minimumSizeHint()) );
+ //clearWindowState( Qt::WState_Polished );
+
+ // signals and slots connections
+ connect( fileOpenAction, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
+ connect( fileQuitAction, SIGNAL( activated() ), this, SLOT( fileExit() ) );
+ connect( fileChromatogramPathsAction, SIGNAL( activated() ), this, SLOT( fileChromoPaths() ) );
+ connect( fileImportAction, SIGNAL( activated() ), this, SLOT( fileImport() ) );
+ connect( loadAmosFileAction, SIGNAL( activated()), this, SLOT( loadAmosFile()));
+ connect( loadKmersAction, SIGNAL(activated()), this, SLOT(loadKmersFile()));
+
+ connect( new QShortcut(QKeySequence(tr("Ctrl+Q")), this), SIGNAL(activated()),
+ qApp, SLOT(quit()));
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+LaunchPadBase::~LaunchPadBase()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * Sets the strings of the subwidgets using the current
+ * language.
+ */
+void LaunchPadBase::languageChange()
+{
+ setCaption( tr( "Hawkeye" ) );
+ orderRadioGroup->setTitle( tr( "Ordering" ) );
+ radioButton8->setText( tr( "Size" ) );
+ QToolTip::add( radioButton8, tr( "Sort Objects by Size" ) );
+ radioButton9->setText( tr( "Feature Density" ) );
+ QToolTip::add( radioButton9, tr( "Sort Objects By Feature Density" ) );
+ radioButton10->setText( tr( "Treemap" ) );
+ QToolTip::add( radioButton10, tr( "Display Objects in a Treemap" ) );
+ colorRadioGroup->setTitle( tr( "Coloring" ) );
+ radioButton11->setText( tr( "Green - Red" ) );
+ QToolTip::add( radioButton11, tr( "Color objects with a green to red gradient" ) );
+ radioButton12->setText( tr( "White - Red" ) );
+ QToolTip::add( radioButton12, tr( "Color objects with a white to red gradient" ) );
+ tabWidget->changeTab( statsTab, tr( "Statistics" ) );
+ groupGroup->setTitle( tr( "Group by" ) );
+ featureGroupContigButton->setText( tr( "Contig" ) );
+ featureGroupTypeButton->setText( tr( "Type" ) );
+ tabWidget->changeTab( featuresTab, tr( "Features" ) );
+ histogramGroup->setTitle( tr( "Distributions" ) );
+ libraryClearLengthButton->setText( tr( "Read Clear Range" ) );
+ QToolTip::add( libraryClearLengthButton, tr( "Display histogram of the clear range length for all reads in the selected library" ) );
+ libraryInsertButton->setText( tr( "Insert Size" ) );
+ QToolTip::add( libraryInsertButton, tr( "Display histogram of inserts for selected library" ) );
+ libraryReadLengthButton->setText( tr( "Read Length" ) );
+ QToolTip::add( libraryReadLengthButton, tr( "Display a histogram of the full read length for all reads in the library" ) );
+ libraryGCButton->setText( tr( "GC Content" ) );
+ QToolTip::add( libraryGCButton, tr( "Display a histogram of the GC content for all the reads in the library" ) );
+ tabWidget->changeTab( librariesTab, tr( "Libraries" ) );
+ textLabel1->setText( tr( "IID:" ) );
+ textLabel1_2->setText( tr( "EID:" ) );
+ QToolTip::add( scaffoldIIDEdit, tr( "Search for a scaffold or contig by IID" ) );
+ QToolTip::add( scaffoldEIDEdit, tr( "Search for a scaffold or contig by EID" ) );
+ scaffoldHistogramGroup->setTitle( tr( "Distributions" ) );
+ scaffoldSpanButton->setText( tr( "Span" ) );
+ QToolTip::add( scaffoldSpanButton, tr( "Display the distribution of scaffold sizes" ) );
+ scaffoldContigsButton->setText( tr( "Contig Count" ) );
+ QToolTip::add( scaffoldContigsButton, tr( "Display a histogram of the number of contigs in each scaffold" ) );
+ tabWidget->changeTab( scaffoldsTab, tr( "Scaffolds" ) );
+ textLabel1_2_2->setText( tr( "EID:" ) );
+ textLabel1_3->setText( tr( "IID:" ) );
+ scaffoldHistogramGroup_2->setTitle( tr( "Distributions" ) );
+ contigLengthButton->setText( tr( "Length" ) );
+ QToolTip::add( contigLengthButton, tr( "Display the distribution of the length of all contigs" ) );
+ contigReadsButton->setText( tr( "Read Count" ) );
+ QToolTip::add( contigReadsButton, tr( "Display a histogram of the number of reads in each contig" ) );
+ contigCoverageButton->setText(tr("Fold Coverage"));
+ QToolTip::add( contigCoverageButton, tr( "Display a histogram of each contig's read fold coverage"));
+ contigGCButton->setText( tr( "GC Content" ) );
+ QToolTip::add( contigGCButton, tr( "Display a histogram of the GC content of each contig" ) );
+ QToolTip::add( contigEIDEdit, tr( "Search for a contig (or read) by EID" ) );
+ QToolTip::add( contigIIDEdit, tr( "Search for a contig (or read) by IID" ) );
+ buttonGroup7->setTitle( tr( "Display" ) );
+ readsCheck->setText( tr( "Reads" ) );
+ QToolTip::add( readsCheck, tr( "Include the reads in the table (May take a long time to load)" ) );
+ tabWidget->changeTab( contigsTab, tr( "Contigs" ) );
+ textLabel1_3_2->setText( tr( "IID:" ) );
+ QToolTip::add( readEIDEdit, tr( "Search for a read by EID" ) );
+ textLabel1_2_2_2->setText( tr( "EID:" ) );
+ QToolTip::add( readIIDEdit, tr( "Search for a read by IID" ) );
+ scaffoldHistogramGroup_2_2->setTitle( tr( "Distributions" ) );
+ readLengthButton->setText( tr( "Length" ) );
+ QToolTip::add( readLengthButton, tr( "Display a histogram of the full read length" ) );
+ readGCButton->setText( tr( "GC Content" ) );
+ QToolTip::add( readGCButton, tr( "Display a histogram of the GC content of these reads" ) );
+ tabWidget->changeTab( TabPage, tr( "Reads" ) );
+
+ fileOpenAction->setText( tr( "Open Bank" ) );
+ fileOpenAction->setMenuText( tr( "&Open Bank..." ) );
+ fileOpenAction->setAccel( tr( "Ctrl+O" ) );
+
+ fileQuitAction->setText( tr( "Quit" ) );
+ fileQuitAction->setMenuText( tr( "&Quit" ) );
+ fileQuitAction->setAccel( tr( "Ctrl+Q" ) );
+
+ loadAmosFileAction->setText(tr("Import AFG..."));
+ loadAmosFileAction->setMenuText(tr("&Import AFG..."));
+ loadAmosFileAction->setAccel(tr("Ctrl+L"));
+
+ fileImportAction->setText( tr( "Import ACE..." ) );
+ fileImportAction->setMenuText( tr( "&Import ACE..." ) );
+ fileImportAction->setAccel( tr( "Ctrl+I" ) );
+
+ loadKmersAction->setText(tr("Open Kmers..."));
+ loadKmersAction->setMenuText(tr("Open &Kmers..."));
+ loadKmersAction->setAccel(tr("Ctrl+K"));
+
+ fileChromatogramPathsAction->setText( tr( "Set Chromatogram Paths" ) );
+ fileChromatogramPathsAction->setMenuText( tr( "Set Chromatogram &Paths..." ) );
+ fileChromatogramPathsAction->setAccel( tr( "Ctrl+P" ) );
+
+ Toolbar->setLabel( tr( "Toolbar" ) );
+ contigIDLabel->setText( tr( "Contig ID" ) );
+ viewButton->setText( tr( "All Views" ) );
+ QToolTip::add( viewButton, tr( "Display All Views" ) );
+ insertButton->setText( tr( "Scaffold View" ) );
+ QToolTip::add( insertButton, tr( "Display scaffold of current contig" ) );
+ tilingButton->setText( tr( "Contig View" ) );
+ QToolTip::add( tilingButton, tr( "Display read tiling of current contig" ) );
+ if (MenuBar->findItem(1))
+ MenuBar->findItem(1)->setText( tr( "&File" ) );
+}
+
+void LaunchPadBase::fileNew()
+{
+ qWarning( "LaunchPadBase::fileNew(): Not implemented yet" );
+}
+
+void LaunchPadBase::fileOpen()
+{
+ qWarning( "LaunchPadBase::fileOpen(): Not implemented yet" );
+}
+
+void LaunchPadBase::fileSave()
+{
+ qWarning( "LaunchPadBase::fileSave(): Not implemented yet" );
+}
+
+void LaunchPadBase::fileSaveAs()
+{
+ qWarning( "LaunchPadBase::fileSaveAs(): Not implemented yet" );
+}
+
+void LaunchPadBase::filePrint()
+{
+ qWarning( "LaunchPadBase::filePrint(): Not implemented yet" );
+}
+
+void LaunchPadBase::fileExit()
+{
+ qWarning( "LaunchPadBase::fileExit(): Not implemented yet" );
+}
+
+void LaunchPadBase::fileChromoPaths()
+{
+ qWarning( "LaunchPadBase::fileChromoPaths(): Not implemented yet" );
+}
+
+void LaunchPadBase::loadAmosFile()
+{
+ qWarning( "LaunchPadBase::loadAmosFile(): Not implemented yet" );
+}
+
+void LaunchPadBase::loadKmersFile()
+{
+ qWarning( "LaunchPadBase::loadKmersFile(): Not implemented yet" );
+}
+
+void LaunchPadBase::fileImport()
+{
+ qWarning( "LaunchPadBase::fileImport(): Not implemented yet" );
+}
+
diff --git a/src/hawkeye/LaunchPadBase.hh b/src/hawkeye/LaunchPadBase.hh
new file mode 100644
index 0000000..cb9caf7
--- /dev/null
+++ b/src/hawkeye/LaunchPadBase.hh
@@ -0,0 +1,156 @@
+
+#ifndef LAUNCHPADBASE_H
+#define LAUNCHPADBASE_H
+
+#include <qvariant.h>
+#include <qpixmap.h>
+#include <q3mainwindow.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+#include <QLabel>
+#include <Q3PopupMenu>
+#include <Q3VBoxLayout>
+#include <Q3ActionGroup>
+
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
+class QSpacerItem;
+class QAction;
+class Q3ActionGroup;
+class Q3ToolBar;
+class Q3PopupMenu;
+class NChartWidget;
+class QTabWidget;
+class QWidget;
+class Q3TextEdit;
+class Q3ButtonGroup;
+class QRadioButton;
+class Q3ListView;
+class Q3ListViewItem;
+class QPushButton;
+class QLabel;
+class QLineEdit;
+class QCheckBox;
+class QSpinBox;
+
+class LaunchPadBase : public Q3MainWindow
+{
+ Q_OBJECT
+
+public:
+ LaunchPadBase( QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = Qt::WType_TopLevel );
+ ~LaunchPadBase();
+
+ QTabWidget* tabWidget;
+ QWidget* statsTab;
+ Q3TextEdit* statsText;
+ NChartWidget* scaffoldSizes;
+ NChartWidget* contigSizes;
+ Q3ButtonGroup* orderRadioGroup;
+ QRadioButton* radioButton8;
+ QRadioButton* radioButton9;
+ QRadioButton* radioButton10;
+ Q3ButtonGroup* colorRadioGroup;
+ QRadioButton* radioButton11;
+ QRadioButton* radioButton12;
+ QWidget* featuresTab;
+ Q3ListView* featureList;
+ Q3ButtonGroup* groupGroup;
+ QRadioButton* featureGroupContigButton;
+ QRadioButton* featureGroupTypeButton;
+ QWidget* librariesTab;
+ Q3ListView* libraryList;
+ Q3ButtonGroup* histogramGroup;
+ QPushButton* libraryClearLengthButton;
+ QPushButton* libraryInsertButton;
+ QPushButton* libraryReadLengthButton;
+ QPushButton* libraryGCButton;
+ QWidget* scaffoldsTab;
+ Q3ListView* scaffoldList;
+ QLabel* textLabel1;
+ QLabel* textLabel1_2;
+ QLineEdit* scaffoldIIDEdit;
+ QLineEdit* scaffoldEIDEdit;
+ Q3ButtonGroup* scaffoldHistogramGroup;
+ QPushButton* scaffoldSpanButton;
+ QPushButton* scaffoldContigsButton;
+ QWidget* contigsTab;
+ QLabel* textLabel1_2_2;
+ QLabel* textLabel1_3;
+ Q3ButtonGroup* scaffoldHistogramGroup_2;
+ QPushButton* contigLengthButton;
+ QPushButton* contigReadsButton;
+ QPushButton* contigCoverageButton;
+ QPushButton* contigGCButton;
+ Q3ListView* contigList;
+ QLineEdit* contigEIDEdit;
+ QLineEdit* contigIIDEdit;
+ Q3ButtonGroup* buttonGroup7;
+ QCheckBox* readsCheck;
+ QWidget* TabPage;
+ QLabel* textLabel1_3_2;
+ QLineEdit* readEIDEdit;
+ QLabel* textLabel1_2_2_2;
+ QLineEdit* readIIDEdit;
+ Q3ButtonGroup* scaffoldHistogramGroup_2_2;
+ QPushButton* readLengthButton;
+ QPushButton* readGCButton;
+ Q3ListView* readList;
+ QLabel* contigIDLabel;
+ QSpinBox* contigIDSpin;
+ QPushButton* viewButton;
+ QPushButton* insertButton;
+ QPushButton* tilingButton;
+ QMenuBar *MenuBar;
+ Q3PopupMenu *fileMenu;
+ Q3ToolBar *Toolbar;
+ QAction* fileOpenAction;
+ QAction* fileQuitAction;
+ QAction* fileChromatogramPathsAction;
+ QAction* loadAmosFileAction;
+ QAction* fileImportAction;
+ QAction* loadKmersAction;
+
+public slots:
+ virtual void fileNew();
+ virtual void fileOpen();
+ virtual void fileSave();
+ virtual void fileSaveAs();
+ virtual void filePrint();
+ virtual void fileExit();
+ virtual void fileChromoPaths();
+ virtual void loadAmosFile();
+ virtual void fileImport();
+ virtual void loadKmersFile();
+
+protected:
+ Q3GridLayout* LaunchPadBaseLayout;
+ Q3GridLayout* statsTabLayout;
+ QSpacerItem* spacer7;
+ Q3GridLayout* orderRadioGroupLayout;
+ Q3GridLayout* colorRadioGroupLayout;
+ Q3GridLayout* featuresTabLayout;
+ QSpacerItem* spacer1;
+ Q3HBoxLayout* groupGroupLayout;
+ Q3GridLayout* librariesTabLayout;
+ Q3GridLayout* histogramGroupLayout;
+ Q3GridLayout* scaffoldsTabLayout;
+ Q3HBoxLayout* scaffoldHistogramGroupLayout;
+ Q3GridLayout* contigsTabLayout;
+ Q3HBoxLayout* scaffoldHistogramGroup_2Layout;
+ Q3VBoxLayout* buttonGroup7Layout;
+ Q3GridLayout* TabPageLayout;
+ Q3GridLayout* scaffoldHistogramGroup_2_2Layout;
+
+protected slots:
+ virtual void languageChange();
+
+private:
+ QPixmap image0;
+ QPixmap image1;
+
+};
+
+#endif // LAUNCHPADBASE_H
diff --git a/src/hawkeye/LibraryPicker.cc b/src/hawkeye/LibraryPicker.cc
new file mode 100644
index 0000000..2d7b4bd
--- /dev/null
+++ b/src/hawkeye/LibraryPicker.cc
@@ -0,0 +1,275 @@
+#include "LaunchPad.hh"
+#include <qcursor.h>
+#include <qstatusbar.h>
+
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qmenubar.h>
+#include <q3popupmenu.h>
+
+#include "foundation_AMOS.hh"
+
+#include <vector>
+
+#include "Insert.hh"
+#include "InsertStats.hh"
+#include "DataStore.hh"
+#include "HistogramWindow.hh"
+#include "amp.hh"
+
+
+using namespace std;
+using namespace AMOS;
+
+
+
+class LibListItem : public Q3ListViewItem
+{
+public:
+ LibListItem(Q3ListView * parent,
+ QString iid,
+ QString eid,
+ QString mean,
+ QString sd,
+ QString count)
+
+ : Q3ListViewItem(parent, iid, eid, mean, sd, count) { }
+
+
+ int compare(Q3ListViewItem *i, int col,
+ bool ascending ) const
+ {
+ if (col == 1)
+ {
+ return key(col,ascending).compare(i->key(col,ascending));
+ }
+ else
+ {
+ return atoi(key(col,ascending)) - atoi(i->key(col,ascending));
+ }
+ }
+};
+
+void LaunchPad::initLibraries()
+{
+ connect(libraryList, SIGNAL(doubleClicked(Q3ListViewItem *)),
+ this, SLOT(librarySelected(Q3ListViewItem *)));
+
+ connect(libraryList, SIGNAL(returnPressed(Q3ListViewItem *)),
+ this, SLOT(librarySelected(Q3ListViewItem *)));
+
+ connect(libraryInsertButton, SIGNAL(clicked()),
+ this, SLOT(libraryViewSelected()));
+
+ connect(libraryClearLengthButton, SIGNAL(clicked()),
+ this, SLOT(libraryClearLengthSelected()));
+
+ connect(libraryReadLengthButton, SIGNAL(clicked()),
+ this, SLOT(libraryReadLengthSelected()));
+
+ connect(libraryGCButton, SIGNAL(clicked()),
+ this, SLOT(libraryGCSelected()));
+
+ libraryList->addColumn("IID");
+ libraryList->addColumn("EID");
+ libraryList->addColumn("Mean");
+ libraryList->addColumn("Stdev");
+ libraryList->addColumn("Inserts");
+
+ libraryList->setShowSortIndicator(true);
+ libraryList->setRootIsDecorated(true);
+ libraryList->setAllColumnsShowFocus(true);
+}
+
+
+void LaunchPad::loadLibraries()
+{
+ EventTime_t timer;
+ if (m_verbose) { cerr << "Loading Libraries..."; }
+
+ libraryList->clear();
+ QCursor orig = cursor();
+ setCursor(Qt::waitCursor);
+
+ if (!m_datastore->m_libdistributionlookup.empty())
+ {
+ try
+ {
+ m_datastore->lib_bank.seekg(1);
+
+ AMOS::Library_t lib;
+ int count = 0;
+
+ while (m_datastore->lib_bank >> lib)
+ {
+ AMOS::Distribution_t dist = lib.getDistribution();
+
+ ID_t libid = lib.getIID();
+ int frag = 0;
+
+ for (int i = 0; i < m_datastore->m_fragliblookup.size(); i++)
+ {
+ if (m_datastore->m_fragliblookup[i] == libid)
+ {
+ frag++;
+ }
+ }
+
+ new LibListItem(libraryList,
+ QString::number(libid),
+ lib.getEID().c_str(),
+ QString::number(dist.mean),
+ QString::number(dist.sd),
+ QString::number(frag));
+ count++;
+ }
+
+ QString status = QString::number(count) + " libraries";
+ statusBar()->message(status);
+ }
+ catch (AMOS::Exception_t & e)
+ {
+ cerr << "Library Information not available " << e;
+ }
+ }
+ else
+ {
+ statusBar()->message("Library Information not available");
+ }
+
+ libraryList->setColumnWidth(1, (int)(libraryList->columnWidth(1)*1.2));
+
+ setCursor(orig);
+ if (m_verbose) { cerr << " " << timer.str() << endl; }
+}
+
+void LaunchPad::librarySelected(Q3ListViewItem * item)
+{
+ ID_t libid = atoi(item->text(0));
+
+ char buffer[32];
+ sprintf(buffer, "%d", libid);
+ InsertStats * stats = new InsertStats((string)"Insert Size Histogram for Library " + buffer + " (In Contigs)");
+
+ Contig_t contig;
+ m_datastore->contig_bank.seekg(1);
+ while (m_datastore->contig_bank >> contig)
+ {
+ vector<Insert *> inserts;
+ vector<Insert *>::iterator vi;
+ m_datastore->calculateInserts(contig.getReadTiling(), inserts, 1, 0);
+
+ for (vi = inserts.begin(); vi != inserts.end(); vi++)
+ {
+ if (((*vi)->m_libid == libid) && ((*vi)->ceConnected()))
+ {
+ stats->addSize((*vi)->m_actual);
+ }
+
+ delete *vi;
+ }
+ }
+
+ new HistogramWindow(stats, this, "hist");
+}
+
+void LaunchPad::libraryViewSelected()
+{
+ Q3ListViewItem * item = libraryList->selectedItem();
+ if (item)
+ {
+ librarySelected(item);
+ }
+}
+
+
+
+void LaunchPad::libraryGCSelected()
+{
+ Q3ListViewItem * item = libraryList->selectedItem();
+ if (item)
+ {
+ QCursor orig = cursor();
+ setCursor(Qt::waitCursor);
+
+ ID_t libid = atoi(item->text(0));
+
+ char buffer[32];
+ sprintf(buffer, "%d", libid);
+ InsertStats * stats = new InsertStats((string)"GC Content Histogram for Library " + buffer + " (All Reads)");
+
+ Read_t red;
+ m_datastore->read_bank.seekg(1);
+
+ while (m_datastore->read_bank >> red)
+ {
+ if (m_datastore->getLibrary(red.getIID()) == libid)
+ {
+ stats->addSize(red.getGCContent(red.getClearRange()));
+ }
+ }
+
+ new HistogramWindow(stats, this, "hist");
+ setCursor(orig);
+ }
+}
+
+void LaunchPad::libraryClearLengthSelected()
+{
+ Q3ListViewItem * item = libraryList->selectedItem();
+ if (item)
+ {
+ QCursor orig = cursor();
+ setCursor(Qt::waitCursor);
+
+ ID_t libid = atoi(item->text(0));
+
+ char buffer[32];
+ sprintf(buffer, "%d", libid);
+ InsertStats * stats = new InsertStats((string)"Clear Range Length Histogram for Library " + buffer + " (All Reads)");
+
+ Read_t red;
+ m_datastore->read_bank.seekg(1);
+
+ while (m_datastore->read_bank >> red)
+ {
+ if (m_datastore->getLibrary(red.getIID()) == libid)
+ {
+ stats->addSize(red.getClearRange().getLength());
+ }
+ }
+
+ new HistogramWindow(stats, this, "hist");
+ setCursor(orig);
+ }
+}
+
+void LaunchPad::libraryReadLengthSelected()
+{
+ Q3ListViewItem * item = libraryList->selectedItem();
+ if (item)
+ {
+ QCursor orig = cursor();
+ setCursor(Qt::waitCursor);
+
+ ID_t libid = atoi(item->text(0));
+
+ char buffer[32];
+ sprintf(buffer, "%d", libid);
+ InsertStats * stats = new InsertStats((string)"Full Range Length Histogram for Library " + buffer + " (All Reads)");
+
+ Read_t red;
+ m_datastore->read_bank.seekg(1);
+
+ while (m_datastore->read_bank >> red)
+ {
+ if (m_datastore->getLibrary(red.getIID()) == libid)
+ {
+ stats->addSize(red.getLength());
+ }
+ }
+
+ new HistogramWindow(stats, this, "hist");
+ setCursor(orig);
+ }
+}
diff --git a/src/hawkeye/LibraryPicker.hh b/src/hawkeye/LibraryPicker.hh
new file mode 100644
index 0000000..302ece8
--- /dev/null
+++ b/src/hawkeye/LibraryPicker.hh
@@ -0,0 +1,6 @@
+#ifndef LIBRARY_PICKER_HH__
+#define LIBRARY_PICKER_HH__ 1
+
+#include "LaunchPad.hh"
+
+#endif
diff --git a/src/hawkeye/MainWindow.cc b/src/hawkeye/MainWindow.cc
new file mode 100644
index 0000000..bd0c612
--- /dev/null
+++ b/src/hawkeye/MainWindow.cc
@@ -0,0 +1,512 @@
+#include "MainWindow.hh"
+
+#include <qmenubar.h>
+#include <qinputdialog.h>
+#include <q3toolbar.h>
+#include <qtoolbutton.h>
+#include <q3accel.h>
+#include <qstatusbar.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <q3vbox.h>
+#include <qsplitter.h>
+#include <qapplication.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <Q3PopupMenu>
+#include <Q3VBoxLayout>
+#include "DataStore.hh"
+#include <QtGui>
+
+
+#include "TilingFrame.hh"
+#include "AlignmentInfo.hh"
+
+#include "icons/fontdecrease.xpm"
+#include "icons/fontincrease.xpm"
+
+using namespace std;
+
+MainWindow::MainWindow(DataStore * datastore, QWidget *parent, const char *name )
+ : Q3MainWindow( NULL, name ),
+ m_parent(parent), m_datastore(datastore)
+{
+ setCaption("Hawkeye : Contig View");
+ m_gindex = 0;
+ m_fontsize = 10;
+
+ setGeometry(150,QApplication::desktop()->height()-450-parent->pos().y(),QApplication::desktop()->width()-200,400);
+
+ m_outervbox = new Q3VBox(this, "mainvbox");
+ setCentralWidget( m_outervbox);
+
+ m_multiTilingWidget = new QWidget(m_outervbox, "multiTilingWidget");
+ m_multiTilingWidget->show();
+
+ Q3VBoxLayout * multiTilingLayout = new Q3VBoxLayout(m_multiTilingWidget, 0, -1, "mtl");
+
+ AlignmentInfo * ai = new AlignmentInfo();
+ m_tiling = new TilingFrame(m_datastore, ai, m_multiTilingWidget, "origtilingframe");
+ initializeTiling(m_tiling, true);
+ m_tiling->show();
+
+ multiTilingLayout->addWidget(m_tiling);
+
+
+ m_slider = new QScrollBar(Qt::Horizontal, m_outervbox, "slider");
+ m_slider->setTracking(1);
+ m_slider->setPageStep(20);
+
+ // Status Bar
+ statusBar()->message("No Bank Loaded");
+
+ // Status Tool Bar
+ Q3ToolBar * status = new Q3ToolBar(this, "Status");
+ status->setLabel("Navigation");
+
+ m_options = new Q3PopupMenu(this);
+ menuBar()->insertItem("&Options", m_options);
+ m_packid = m_options->insertItem("Pac&k Reads", this, SLOT(togglePackReads())); m_packchecked = false;
+ m_namewidthid = m_options->insertItem("Set Readname &Width", this, SLOT(setReadnameWidth()));
+ m_basecolorid = m_options->insertItem("Color &Bases", this, SLOT(toggleBaseColors())); m_basecolorchecked = false;
+ m_showfullid = m_options->insertItem("Show &Full Range", this, SLOT(toggleShowFullRange())); m_showfullchecked = false;
+ m_ungappedid = m_options->insertItem("Ungapped Coordinates", this, SLOT(toggleUngapped())); m_ungappedchecked = false;
+ m_options->insertSeparator();
+ m_qvid = m_options->insertItem("Show &Quality Values", this, SLOT(toggleDisplayQV())); m_qvchecked = false;
+ m_cqvid = m_options->insertItem("Show &Consensus QV", this, SLOT(toggleShowConsQV())); m_cqvchecked = false;
+ m_lowquallowerid = m_options->insertItem("Lower Case &Low QV", this, SLOT(toggleLowQualityLowerCase())); m_lowquallowerchecked = false;
+ m_qvcolorid = m_options->insertItem("Q&V Coloring", this, SLOT(toggleQVColoring())); m_qvcolorchecked = false;
+ m_options->insertSeparator();
+ m_snpcoloringid = m_options->insertItem("SN&P Coloring", this, SLOT(toggleSNPColoring())); m_snpcoloringchecked = false;
+ m_highid = m_options->insertItem("&Highlight Discrepancies", this, SLOT(toggleHighlightDiscrepancy())); m_highchecked = false;
+ m_polyid = m_options->insertItem("&Polymorphism View", this, SLOT(togglePolymorphismView())); m_polychecked = false;
+ m_options->insertSeparator();
+ m_prefetch = m_options->insertItem("&Prefetch Chromatograms", this, SLOT(toggleDisplayAllChromo())); m_prefetchchecked = false;
+
+ m_options->setItemChecked(m_snpcoloringid, true); m_snpcoloringchecked = true;
+
+
+ new QLabel("Contig", status, "contiglbl");
+ m_contigspin = new QSpinBox(1,100,1,status, "contigspin");
+ m_contigspin->setMinimumWidth(100);
+
+ status->addSeparator();
+
+ m_offsetlabel = new QLabel("Offset", status, "gindexlbl");
+ m_gspin = new QSpinBox(0,100, 1, status, "gindexspin");
+ m_gspin->setMinimumWidth(100);
+
+
+ QToolButton * bPrevDisc = new QToolButton(Qt::LeftArrow, status, "prev");
+ bPrevDisc->setTextLabel("Previous Discrepancy");
+ bPrevDisc->setAccel(Qt::CTRL + Qt::Key_Space + Qt::SHIFT);
+ bPrevDisc->setMinimumWidth(15);
+ bPrevDisc->setMaximumWidth(15);
+ bPrevDisc->setMaximumHeight(25);
+
+ QToolButton * bNextDisc = new QToolButton(Qt::RightArrow, status, "next");
+ bNextDisc->setTextLabel("Next Discrepancy");
+ bNextDisc->setAccel(Qt::CTRL + Qt::Key_Space);
+ bNextDisc->setMinimumWidth(15);
+ bNextDisc->setMaximumWidth(15);
+ bNextDisc->setMaximumHeight(25);
+
+ connect(bNextDisc, SIGNAL(clicked()),
+ this, SIGNAL(advanceNextDiscrepancy()));
+
+ connect(bPrevDisc, SIGNAL(clicked()),
+ this, SIGNAL(advancePrevDiscrepancy()));
+
+ connect(new QShortcut(QKeySequence(tr("Ctrl+Q")), this), SIGNAL(activated()),
+ qApp, SLOT(quit()));
+
+ connect(new QShortcut(QKeySequence(tr("Ctrl+W")), this), SIGNAL(activated()),
+ this, SLOT(close()));
+
+ connect(new QShortcut(QKeySequence(tr("Ctrl+Shift+=")), this), SIGNAL(activated()),
+ this, SLOT(fontIncrease()));
+
+ connect(new QShortcut(QKeySequence(tr("Ctrl+-")), this), SIGNAL(activated()),
+ this, SLOT(fontDecrease()));
+
+ connect(new QShortcut(QKeySequence(tr("Ctrl+Right")), this), SIGNAL(activated()),
+ this, SLOT(jumpFGindex()));
+
+ connect(new QShortcut(QKeySequence(tr("Ctrl+Left")), this), SIGNAL(activated()),
+ this, SLOT(jumpPGindex()));
+
+ connect(new QShortcut(QKeySequence(tr("Ctrl+Shift+.")), this), SIGNAL(activated()),
+ bNextDisc, SLOT(animateClick()));
+
+ connect(new QShortcut(QKeySequence(tr("Ctrl+Shift+,")), this), SIGNAL(activated()),
+ this, SIGNAL(advancePrevDiscrepancy()));
+
+
+
+ QIcon icon_fontminus(QPixmap((const char ** )fontdecrease_xpm));
+ QIcon icon_fontplus(QPixmap((const char **)fontincrease_xpm));
+
+ QToolButton * b = new QToolButton(icon_fontplus, "Font Increase", "Font Increase",
+ this, SLOT(fontIncrease()), status);
+ b->setMaximumWidth(25);
+ b->setMaximumHeight(25);
+
+ b = new QToolButton(icon_fontminus, "Font Decrease", "Font Decrease",
+ this, SLOT(fontDecrease()), status);
+ b->setMaximumWidth(25);
+ b->setMaximumHeight(25);
+
+ Q3ToolBar * searchbar = new Q3ToolBar(this, "SearchBar");
+ status->setLabel("Search");
+
+
+ new QLabel("Search", searchbar, "findlbl");
+ m_searchedit = new QLineEdit(searchbar, "searchbox");
+ m_searchedit->setMinimumHeight(25);
+ m_searchedit->setMinimumWidth(25);
+ connect(m_searchedit, SIGNAL(returnPressed()), this, SLOT(findNext()));
+
+ QToolButton * bFindPrev = new QToolButton(Qt::LeftArrow, searchbar, "rsearch");
+ connect(bFindPrev, SIGNAL(clicked()), this, SLOT(findPrev()));
+ bFindPrev->setTextLabel("Find Previous");
+ bFindPrev->setAccel(Qt::SHIFT + Qt::CTRL + Qt::Key_F);
+ bFindPrev->setMinimumWidth(15);
+ bFindPrev->setMaximumWidth(15);
+ bFindPrev->setMaximumHeight(25);
+
+ QToolButton * bFindNext = new QToolButton(Qt::RightArrow, searchbar, "fsearch");
+ connect(bFindNext, SIGNAL(clicked()), this, SLOT(findNext()));
+ bFindNext->setTextLabel("Find Next");
+ bFindNext->setAccel(Qt::CTRL + Qt::Key_F);
+ bFindNext->setMinimumWidth(15);
+ bFindNext->setMaximumWidth(15);
+ bFindNext->setMaximumHeight(25);
+
+
+ // gindex
+
+ connect(this, SIGNAL(gindexChanged(int)),
+ m_slider, SLOT(setValue(int)));
+
+ connect(m_slider, SIGNAL(valueChanged(int)),
+ this, SLOT(setGindex(int)));
+
+
+ connect(this, SIGNAL(gindexChanged(int)),
+ this, SLOT(updateGSpin(int)));
+
+ connect(m_gspin, SIGNAL(valueChanged(int)),
+ this, SLOT(loadGSpin(int)));
+
+ connect(m_contigspin, SIGNAL(valueChanged(int)),
+ parent, SLOT(setContigId(int)));
+
+
+ // Set defaults
+ m_gspin->setValue(0);
+ m_slider->setFocus();
+
+ // If not mpop, enable
+ //if (strcmp(getenv("USER"), "mpop") && strcmp(getenv("USER"), "mschatz"))
+ if (strcmp(getenv("USER"), "mpop"))
+ {
+ toggleBaseColors();
+ }
+
+ toggleHighlightDiscrepancy();
+
+ emit setFontSize(m_fontsize);
+}
+
+void MainWindow::initializeTiling(TilingFrame * tiling, bool isReference)
+{
+ connect(tiling, SIGNAL(setTilingVisibleRange(int, int, int)),
+ this, SIGNAL(setTilingVisibleRange(int, int, int)));
+
+ connect(this, SIGNAL(gindexChanged(int)),
+ tiling, SLOT(setGindex(int)));
+
+ connect(this, SIGNAL(toggleDisplayAllChromo(bool)),
+ tiling, SLOT(toggleDisplayAllChromo(bool)));
+
+ connect(this, SIGNAL(setFontSize(int)),
+ tiling, SLOT(setFontSize(int)));
+
+ connect(this, SIGNAL(toggleDisplayQV(bool)),
+ tiling, SIGNAL(toggleDisplayQV(bool)));
+
+ connect(this, SIGNAL(toggleShowConsQV(bool)),
+ tiling, SIGNAL(toggleShowConsQV(bool)));
+
+ connect(this, SIGNAL(toggleQVColoring(bool)),
+ tiling, SIGNAL(toggleQVColoring(bool)));
+
+ connect(this, SIGNAL(toggleLowQualityLowerCase(bool)),
+ tiling, SIGNAL(toggleLowQualityLowerCase(bool)));
+
+ connect(this, SIGNAL(toggleShowFullRange(bool)),
+ tiling, SIGNAL(toggleShowFullRange(bool)));
+
+ connect(this, SIGNAL(toggleHighlightDiscrepancy(bool)),
+ tiling, SIGNAL(toggleHighlightDiscrepancy(bool)));
+
+ connect(this, SIGNAL(toggleShowNumbers(bool)),
+ tiling, SIGNAL(toggleShowNumbers(bool)));
+
+ connect(this, SIGNAL(togglePolymorphismView(bool)),
+ tiling, SIGNAL(togglePolymorphismView(bool)));
+
+ connect(this, SIGNAL(toggleBaseColors(bool)),
+ tiling, SIGNAL(toggleBaseColors(bool)));
+
+ connect(this, SIGNAL(togglePackReads(bool)),
+ tiling, SIGNAL(togglePackReads(bool)));
+
+ connect(this, SIGNAL(toggleSNPColoring(bool)),
+ tiling, SIGNAL(toggleSNPColoring(bool)));
+
+ connect(this, SIGNAL(toggleShowUngapped(bool)),
+ tiling, SIGNAL(toggleShowUngapped(bool)));
+
+ if (isReference)
+ {
+ connect(tiling, SIGNAL(gindexChanged(int)),
+ this, SLOT(setGindex(int)));
+
+ connect(tiling, SIGNAL(setGindexRange(int, int)),
+ this, SLOT(setGindexRange(int, int)));
+
+ connect(this, SIGNAL(contigIdSelected(int)),
+ tiling, SLOT(setContigId(int)));
+
+ connect(this, SIGNAL(searchString(const QString &, bool)),
+ tiling, SLOT(searchString(const QString &, bool)));
+
+ connect(this, SIGNAL(advanceNextDiscrepancy()),
+ tiling, SLOT(advanceNextDiscrepancy()));
+
+ connect(this, SIGNAL(advancePrevDiscrepancy()),
+ tiling, SLOT(advancePrevDiscrepancy()));
+
+ connect(tiling, SIGNAL(highlightRead(int)),
+ m_parent, SIGNAL(highlightRead(int)));
+
+ }
+}
+
+
+void MainWindow::setGindex(int gindex)
+{
+ if (gindex == m_gindex) { return; }
+
+ m_gindex = gindex;
+ emit gindexChanged(gindex);
+}
+
+
+void MainWindow::setGindexRange(int a, int b)
+{
+ m_gspin->setRange(a,b);
+ m_slider->setRange(a,b);
+}
+
+void MainWindow::togglePackReads()
+{
+ m_packchecked = !m_packchecked;
+ m_options->setItemChecked(m_packid, m_packchecked);
+
+ emit togglePackReads(m_packchecked);
+}
+
+void MainWindow::toggleShowFullRange()
+{
+ m_showfullchecked = !m_showfullchecked;
+ m_options->setItemChecked(m_showfullid, m_showfullchecked);
+
+ emit toggleShowFullRange(m_showfullchecked);
+}
+
+void MainWindow::toggleDisplayQV()
+{
+ m_qvchecked = !m_qvchecked;
+ m_options->setItemChecked(m_qvid, m_qvchecked);
+
+ emit toggleDisplayQV(m_qvchecked);
+}
+
+void MainWindow::toggleShowConsQV()
+{
+ m_cqvchecked = !m_cqvchecked;
+ m_options->setItemChecked(m_cqvid, m_cqvchecked);
+
+ emit toggleShowConsQV(m_cqvchecked);
+}
+
+void MainWindow::toggleLowQualityLowerCase()
+{
+ m_lowquallowerchecked = !m_lowquallowerchecked;
+ m_options->setItemChecked(m_lowquallowerid, m_lowquallowerchecked);
+
+ emit toggleLowQualityLowerCase(m_lowquallowerchecked);
+}
+
+void MainWindow::toggleQVColoring()
+{
+ m_qvcolorchecked = !m_qvcolorchecked;
+ m_options->setItemChecked(m_qvcolorid, m_qvcolorchecked);
+
+ emit toggleQVColoring(m_qvcolorchecked);
+}
+
+void MainWindow::toggleBaseColors()
+{
+ m_basecolorchecked = !m_basecolorchecked;
+ m_options->setItemChecked(m_basecolorid, m_basecolorchecked);
+
+ emit toggleBaseColors(m_basecolorchecked);
+}
+
+void MainWindow::toggleSNPColoring()
+{
+ m_snpcoloringchecked = !m_snpcoloringchecked;
+ m_options->setItemChecked(m_snpcoloringid, m_snpcoloringchecked);
+
+ emit toggleSNPColoring(m_snpcoloringchecked);
+}
+
+void MainWindow::toggleHighlightDiscrepancy()
+{
+ m_highchecked = !m_highchecked;
+ m_options->setItemChecked(m_highid, m_highchecked);
+
+ emit toggleHighlightDiscrepancy(m_highchecked);
+}
+
+void MainWindow::toggleDisplayAllChromo()
+{
+ m_prefetchchecked = !m_prefetchchecked;
+ m_options->setItemChecked(m_prefetch, m_prefetchchecked);
+
+ emit toggleDisplayAllChromo(m_prefetchchecked);
+}
+
+void MainWindow::togglePolymorphismView()
+{
+ m_polychecked = !m_polychecked;
+ m_options->setItemChecked(m_polyid, m_polychecked);
+
+ emit togglePolymorphismView(m_polychecked);
+}
+
+void MainWindow::toggleUngapped()
+{
+ m_ungappedchecked = !m_ungappedchecked;
+ m_options->setItemChecked(m_ungappedid, m_ungappedchecked);
+
+ int pos = m_gspin->value();
+
+ if (m_ungappedchecked)
+ {
+ m_offsetlabel->setText("Position");
+ m_gspin->setRange(1, m_datastore->m_contig.gap2ungap(m_datastore->m_contig.getLength()));
+ }
+ else
+ {
+ m_offsetlabel->setText("Offset");
+ m_gspin->setRange(0, m_datastore->m_contig.getLength());
+ pos = m_datastore->m_contig.ungap2gap(pos);
+ }
+
+
+ emit toggleShowUngapped(m_ungappedchecked);
+ updateGSpin(pos);
+}
+
+void MainWindow::updateGSpin(int gindex)
+{
+ if (m_ungappedchecked)
+ {
+ m_gspin->setValue(m_datastore->m_contig.gap2ungap(gindex));
+ }
+ else
+ {
+ m_gspin->setValue(gindex);
+ }
+}
+
+void MainWindow::loadGSpin(int pos)
+{
+ if (m_ungappedchecked)
+ {
+ setGindex(m_datastore->m_contig.ungap2gap(pos));
+ }
+ else
+ {
+ setGindex(pos);
+ }
+}
+
+
+
+void MainWindow::fontIncrease()
+{
+ m_fontsize++;
+ emit setFontSize(m_fontsize);
+}
+
+void MainWindow::fontDecrease()
+{
+ if (m_fontsize <= -8) { return; }
+ m_fontsize--;
+ emit setFontSize(m_fontsize);
+}
+
+
+
+void MainWindow::jumpFGindex()
+{
+ setGindex(m_gindex+20);
+}
+
+void MainWindow::jumpPGindex()
+{
+ setGindex(m_gindex-20);
+}
+
+void MainWindow::findNext()
+{
+ const QString & str = m_searchedit->text();
+ emit searchString(str, true);
+}
+
+void MainWindow::findPrev()
+{
+ const QString & str = m_searchedit->text();
+ emit searchString(str, false);
+}
+
+void MainWindow::setContigId(int id)
+{
+ statusBar()->message(QString("Viewing Contig ") + QString::number(id));
+ m_contigid = id;
+ emit contigIdSelected(id);
+ m_contigspin->setValue(id);
+}
+
+void MainWindow::bankChanged()
+{
+ m_contigspin->setMaxValue(m_datastore->contig_bank.getSize());
+}
+
+void MainWindow::setReadnameWidth()
+{
+ bool ok;
+ int res = QInputDialog::getInteger(
+ "Hawkeye", "Enter readname width:",
+ m_tiling->getReadnameWidth(), 0, 1000, 2,
+ &ok, this );
+ if ( ok )
+ {
+ m_tiling->setReadnameWidth(res);
+ }
+}
diff --git a/src/hawkeye/MainWindow.hh b/src/hawkeye/MainWindow.hh
new file mode 100644
index 0000000..646491f
--- /dev/null
+++ b/src/hawkeye/MainWindow.hh
@@ -0,0 +1,126 @@
+#ifndef MAINWINDOW_HH_
+#define MAINWINDOW_HH_ 1
+
+#include <q3mainwindow.h>
+#include <qspinbox.h>
+#include <qscrollbar.h>
+#include <q3popupmenu.h>
+#include <qlineedit.h>
+#include <qlayout.h>
+//Added by qt3to4:
+#include <QLabel>
+#include <string>
+#include <map>
+
+
+class TilingFrame;
+class QLabel;
+class Q3VBox;
+class DataStore;
+
+class MainWindow: public Q3MainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow(DataStore * datastore, QWidget *parent=0, const char *name=0 );
+
+
+public slots:
+ void setGindexRange(int, int);
+ void setGindex(int gindex);
+ void setContigId(int);
+ void setReadnameWidth();
+
+ void toggleHighlightDiscrepancy();
+ void toggleSNPColoring();
+ void toggleDisplayAllChromo();
+ void toggleLowQualityLowerCase();
+ void toggleBaseColors();
+ void toggleQVColoring();
+ void toggleShowFullRange();
+ void toggleDisplayQV();
+ void toggleShowConsQV();
+ void togglePolymorphismView();
+ void toggleUngapped();
+ void togglePackReads();
+
+ void bankChanged();
+
+ void fontIncrease();
+ void fontDecrease();
+
+ void jumpFGindex();
+ void jumpPGindex();
+
+ void findNext();
+ void findPrev();
+
+ void updateGSpin(int gindex);
+ void loadGSpin(int pos);
+
+
+signals:
+ void contigIdSelected(int);
+ void gindexChanged(int gindex);
+ void highlightRead(int iid);
+ void searchString(const QString & str, bool forward);
+ void setTilingVisibleRange(int, int, int);
+
+ void toggleShowFullRange(bool);
+ void toggleShowNumbers(bool);
+ void toggleDisplayQV(bool);
+ void toggleLowQualityLowerCase(bool);
+ void toggleShowConsQV(bool);
+ void toggleBaseColors(bool);
+ void toggleSNPColoring(bool);
+ void toggleHighlightDiscrepancy(bool);
+ void toggleDisplayAllChromo(bool);
+ void togglePolymorphismView(bool);
+ void toggleQVColoring(bool);
+ void toggleShowUngapped(bool);
+ void togglePackReads(bool);
+ void setFontSize(int);
+
+
+ void advanceNextDiscrepancy();
+ void advancePrevDiscrepancy();
+
+private:
+ void initializeTiling(TilingFrame * tiling, bool isReference);
+
+ QSpinBox * m_contigspin;
+ QSpinBox * m_gspin;
+ QScrollBar * m_slider;
+
+ TilingFrame * m_tiling;
+
+ QWidget * m_parent;
+ Q3PopupMenu * m_options;
+ QLineEdit * m_searchedit;
+ QLabel * m_offsetlabel;
+
+ int m_packid; bool m_packchecked;
+ int m_qvid; bool m_qvchecked;
+ int m_cqvid; bool m_cqvchecked;
+ int m_highid; bool m_highchecked;
+ int m_prefetch; bool m_prefetchchecked;
+ int m_fontsize;
+ int m_lowquallowerid; bool m_lowquallowerchecked;
+ int m_basecolorid; bool m_basecolorchecked;
+ int m_namewidthid;
+ int m_showfullid; bool m_showfullchecked;
+ int m_snpcoloringid; bool m_snpcoloringchecked;
+ int m_polyid; bool m_polychecked;
+ int m_qvcolorid; bool m_qvcolorchecked;
+ int m_ungappedid; bool m_ungappedchecked;
+ int m_contigid;
+
+ int m_gindex;
+ DataStore * m_datastore;
+
+ Q3VBox * m_outervbox;
+ QWidget * m_multiTilingWidget;
+};
+
+#endif
diff --git a/src/hawkeye/Makefile.am b/src/hawkeye/Makefile.am
new file mode 100644
index 0000000..6ca9251
--- /dev/null
+++ b/src/hawkeye/Makefile.am
@@ -0,0 +1,123 @@
+##-- MAKE FRAGMENT FOR AMOS RULES
+include $(top_srcdir)/config/amos.mk
+
+bin_PROGRAMS = hawkeye
+
+AM_CPPFLAGS = \
+ $(QT_CXXFLAGS) \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/Slice \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_srcdir)/src/Staden/read \
+ -I$(top_srcdir)/src/Contig
+
+%.moc.cc: %.hh
+ $(QT_MOC) -o $@ $<
+
+hawkeye_MOCSOURCES = \
+ AssemblyStats.cc \
+ BufferedLineEdit.cc \
+ CGraphContig.cc \
+ CGraphEdge.cc \
+ CGraphView.cc \
+ CGraphWindow.cc \
+ ChromoField.cc \
+ ChromoPicker.cc \
+ ConsensusField.cc \
+ ContigCanvasItem.cc \
+ ContigPicker.cc \
+ CoverageCanvasItem.cc \
+ CoverageRectCanvasItem.cc \
+ DetailWidget.cc \
+ FeatureBrowser.cc \
+ FeatureCanvasItem.cc \
+ HistogramWidget.cc \
+ HistogramWindow.cc \
+ InsertCanvasItem.cc \
+ InsertField.cc \
+ InsertPosition.cc \
+ InsertWidget.cc \
+ InsertWindow.cc \
+ LaunchPad.cc \
+ LaunchPadBase.cc \
+ LibraryPicker.cc \
+ MainWindow.cc \
+ NChartWindow.cc \
+ NChartWindowBase.cc \
+ NChartWidget.cc \
+ NetworkCom.cc \
+ OverviewField.cc \
+ QueryWidget.cc \
+ RangeScrollBar.cc \
+ ReadInfo.cc \
+ ReadPicker.cc \
+ RenderSeq.cc \
+ ScaffoldPicker.cc \
+ SelectionWidget.cc \
+ SplashScreen.cc \
+ TilingField.cc \
+ TilingFrame.cc
+
+nodist_hawkeye_SOURCES = $(hawkeye_MOCSOURCES:.cc=.moc.cc)
+
+hawkeyeHeaders = $(hawkeye_MOCSOURCES:.cc=.hh) \
+ AlignmentInfo.hh
+
+BUILT_SOURCES = $(hawkeye_MOCSOURCES:.cc=.moc.cc)
+CLEANFILES = $(hawkeye_MOCSOURCES:.cc=.moc.cc)
+
+hawkeye_SOURCES = \
+ main.cc \
+ ChromoStore.cc \
+ ChromoStore.hh \
+ UIElements.cc \
+ UIElements.hh \
+ NChartStats.cc \
+ NChartStats.hh \
+ $(hawkeye_MOCSOURCES)
+
+EXTRA_DIST = \
+ hawkeye.pro \
+ $(hawkeyeHeaders) \
+ icons/AAI.xpm \
+ icons/fontdecrease.xpm \
+ icons/fontincrease.xpm \
+ icons/rangearrow_down.png \
+ icons/rangearrow_left.png \
+ icons/rangearrow_right.png \
+ icons/rangearrow_up.png \
+ icons/rangebar_horiz.png \
+ icons/rangebar_vert.png \
+ icons/rangegrip_down.png \
+ icons/rangegrip_left.png \
+ icons/rangegrip_right.png \
+ icons/rangegrip_up.png \
+ icons/rangegroove_horiz.png \
+ icons/rangegroove_vert.png \
+ icons/rangearrow_down.xpm \
+ icons/rangearrow_left.xpm \
+ icons/rangearrow_right.xpm \
+ icons/rangearrow_up.xpm \
+ icons/rangebar_horiz.xpm \
+ icons/rangebar_vert.xpm \
+ icons/rangegrip_down.xpm \
+ icons/rangegrip_left.xpm \
+ icons/rangegrip_right.xpm \
+ icons/rangegrip_up.xpm \
+ icons/rangegroove_horiz.xpm \
+ icons/rangegroove_vert.xpm \
+ icons/pointer_tool.xpm \
+ icons/zoom_in.xpm \
+ icons/zoom_out.xpm \
+ icons/Hawkeye.xpm \
+ icons/Hawkeye.jpg
+
+
+hawkeye_LDADD = $(QT_LIBS) $(EXTRA_LDADD) \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Staden/read/libread.a
+
+
diff --git a/src/hawkeye/Makefile.in b/src/hawkeye/Makefile.in
new file mode 100644
index 0000000..ec2f860
--- /dev/null
+++ b/src/hawkeye/Makefile.in
@@ -0,0 +1,818 @@
+# 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 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@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/amos.mk
+bin_PROGRAMS = hawkeye$(EXEEXT)
+subdir = src/hawkeye
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/amos.m4 \
+ $(top_srcdir)/config/getopt.m4 \
+ $(top_srcdir)/config/onceonly_2_57.m4 \
+ $(top_srcdir)/config/perlmodules.m4 \
+ $(top_srcdir)/config/strtod.m4 $(top_srcdir)/config/strtol.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am__objects_1 = AssemblyStats.$(OBJEXT) BufferedLineEdit.$(OBJEXT) \
+ CGraphContig.$(OBJEXT) CGraphEdge.$(OBJEXT) \
+ CGraphView.$(OBJEXT) CGraphWindow.$(OBJEXT) \
+ ChromoField.$(OBJEXT) ChromoPicker.$(OBJEXT) \
+ ConsensusField.$(OBJEXT) ContigCanvasItem.$(OBJEXT) \
+ ContigPicker.$(OBJEXT) CoverageCanvasItem.$(OBJEXT) \
+ CoverageRectCanvasItem.$(OBJEXT) DetailWidget.$(OBJEXT) \
+ FeatureBrowser.$(OBJEXT) FeatureCanvasItem.$(OBJEXT) \
+ HistogramWidget.$(OBJEXT) HistogramWindow.$(OBJEXT) \
+ InsertCanvasItem.$(OBJEXT) InsertField.$(OBJEXT) \
+ InsertPosition.$(OBJEXT) InsertWidget.$(OBJEXT) \
+ InsertWindow.$(OBJEXT) LaunchPad.$(OBJEXT) \
+ LaunchPadBase.$(OBJEXT) LibraryPicker.$(OBJEXT) \
+ MainWindow.$(OBJEXT) NChartWindow.$(OBJEXT) \
+ NChartWindowBase.$(OBJEXT) NChartWidget.$(OBJEXT) \
+ NetworkCom.$(OBJEXT) OverviewField.$(OBJEXT) \
+ QueryWidget.$(OBJEXT) RangeScrollBar.$(OBJEXT) \
+ ReadInfo.$(OBJEXT) ReadPicker.$(OBJEXT) RenderSeq.$(OBJEXT) \
+ ScaffoldPicker.$(OBJEXT) SelectionWidget.$(OBJEXT) \
+ SplashScreen.$(OBJEXT) TilingField.$(OBJEXT) \
+ TilingFrame.$(OBJEXT)
+am_hawkeye_OBJECTS = main.$(OBJEXT) ChromoStore.$(OBJEXT) \
+ UIElements.$(OBJEXT) NChartStats.$(OBJEXT) $(am__objects_1)
+am__objects_2 = AssemblyStats.moc.$(OBJEXT) \
+ BufferedLineEdit.moc.$(OBJEXT) CGraphContig.moc.$(OBJEXT) \
+ CGraphEdge.moc.$(OBJEXT) CGraphView.moc.$(OBJEXT) \
+ CGraphWindow.moc.$(OBJEXT) ChromoField.moc.$(OBJEXT) \
+ ChromoPicker.moc.$(OBJEXT) ConsensusField.moc.$(OBJEXT) \
+ ContigCanvasItem.moc.$(OBJEXT) ContigPicker.moc.$(OBJEXT) \
+ CoverageCanvasItem.moc.$(OBJEXT) \
+ CoverageRectCanvasItem.moc.$(OBJEXT) \
+ DetailWidget.moc.$(OBJEXT) FeatureBrowser.moc.$(OBJEXT) \
+ FeatureCanvasItem.moc.$(OBJEXT) HistogramWidget.moc.$(OBJEXT) \
+ HistogramWindow.moc.$(OBJEXT) InsertCanvasItem.moc.$(OBJEXT) \
+ InsertField.moc.$(OBJEXT) InsertPosition.moc.$(OBJEXT) \
+ InsertWidget.moc.$(OBJEXT) InsertWindow.moc.$(OBJEXT) \
+ LaunchPad.moc.$(OBJEXT) LaunchPadBase.moc.$(OBJEXT) \
+ LibraryPicker.moc.$(OBJEXT) MainWindow.moc.$(OBJEXT) \
+ NChartWindow.moc.$(OBJEXT) NChartWindowBase.moc.$(OBJEXT) \
+ NChartWidget.moc.$(OBJEXT) NetworkCom.moc.$(OBJEXT) \
+ OverviewField.moc.$(OBJEXT) QueryWidget.moc.$(OBJEXT) \
+ RangeScrollBar.moc.$(OBJEXT) ReadInfo.moc.$(OBJEXT) \
+ ReadPicker.moc.$(OBJEXT) RenderSeq.moc.$(OBJEXT) \
+ ScaffoldPicker.moc.$(OBJEXT) SelectionWidget.moc.$(OBJEXT) \
+ SplashScreen.moc.$(OBJEXT) TilingField.moc.$(OBJEXT) \
+ TilingFrame.moc.$(OBJEXT)
+nodist_hawkeye_OBJECTS = $(am__objects_2)
+hawkeye_OBJECTS = $(am_hawkeye_OBJECTS) $(nodist_hawkeye_OBJECTS)
+am__DEPENDENCIES_1 =
+hawkeye_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Staden/read/libread.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(hawkeye_SOURCES) $(nodist_hawkeye_SOURCES)
+DIST_SOURCES = $(hawkeye_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAT = @BLAT@
+BOOST_CXXFLAGS = @BOOST_CXXFLAGS@
+BOOST_DIR = @BOOST_DIR@
+CA_CXXFLAGS = @CA_CXXFLAGS@
+CA_DIR = @CA_DIR@
+CA_LDADD = @CA_LDADD@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DELTAFILTER = @DELTAFILTER@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT_H = @GETOPT_H@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NUCMER = @NUCMER@
+OBJEXT = @OBJEXT@
+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@
+PERL = @PERL@
+POW_LIB = @POW_LIB@
+PYTHON = @PYTHON@
+QT_CXXFLAGS = @QT_CXXFLAGS@
+QT_LIBS = @QT_LIBS@
+QT_MOC = @QT_MOC@
+QT_QMAKE = @QT_QMAKE@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SHOWCOORDS = @SHOWCOORDS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amosincludedir = @amosincludedir@
+amoslibdir = @amoslibdir@
+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@
+tigrincludedir = @tigrincludedir@
+tigrlibdir = @tigrlibdir@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = \
+ $(QT_CXXFLAGS) \
+ -I$(top_srcdir)/src/Common \
+ -I$(top_srcdir)/src/Slice \
+ -I$(top_srcdir)/src/AMOS \
+ -I$(top_srcdir)/src/Staden/read \
+ -I$(top_srcdir)/src/Contig
+
+hawkeye_MOCSOURCES = \
+ AssemblyStats.cc \
+ BufferedLineEdit.cc \
+ CGraphContig.cc \
+ CGraphEdge.cc \
+ CGraphView.cc \
+ CGraphWindow.cc \
+ ChromoField.cc \
+ ChromoPicker.cc \
+ ConsensusField.cc \
+ ContigCanvasItem.cc \
+ ContigPicker.cc \
+ CoverageCanvasItem.cc \
+ CoverageRectCanvasItem.cc \
+ DetailWidget.cc \
+ FeatureBrowser.cc \
+ FeatureCanvasItem.cc \
+ HistogramWidget.cc \
+ HistogramWindow.cc \
+ InsertCanvasItem.cc \
+ InsertField.cc \
+ InsertPosition.cc \
+ InsertWidget.cc \
+ InsertWindow.cc \
+ LaunchPad.cc \
+ LaunchPadBase.cc \
+ LibraryPicker.cc \
+ MainWindow.cc \
+ NChartWindow.cc \
+ NChartWindowBase.cc \
+ NChartWidget.cc \
+ NetworkCom.cc \
+ OverviewField.cc \
+ QueryWidget.cc \
+ RangeScrollBar.cc \
+ ReadInfo.cc \
+ ReadPicker.cc \
+ RenderSeq.cc \
+ ScaffoldPicker.cc \
+ SelectionWidget.cc \
+ SplashScreen.cc \
+ TilingField.cc \
+ TilingFrame.cc
+
+nodist_hawkeye_SOURCES = $(hawkeye_MOCSOURCES:.cc=.moc.cc)
+hawkeyeHeaders = $(hawkeye_MOCSOURCES:.cc=.hh) \
+ AlignmentInfo.hh
+
+BUILT_SOURCES = $(hawkeye_MOCSOURCES:.cc=.moc.cc)
+CLEANFILES = $(hawkeye_MOCSOURCES:.cc=.moc.cc)
+hawkeye_SOURCES = \
+ main.cc \
+ ChromoStore.cc \
+ ChromoStore.hh \
+ UIElements.cc \
+ UIElements.hh \
+ NChartStats.cc \
+ NChartStats.hh \
+ $(hawkeye_MOCSOURCES)
+
+EXTRA_DIST = \
+ hawkeye.pro \
+ $(hawkeyeHeaders) \
+ icons/AAI.xpm \
+ icons/fontdecrease.xpm \
+ icons/fontincrease.xpm \
+ icons/rangearrow_down.png \
+ icons/rangearrow_left.png \
+ icons/rangearrow_right.png \
+ icons/rangearrow_up.png \
+ icons/rangebar_horiz.png \
+ icons/rangebar_vert.png \
+ icons/rangegrip_down.png \
+ icons/rangegrip_left.png \
+ icons/rangegrip_right.png \
+ icons/rangegrip_up.png \
+ icons/rangegroove_horiz.png \
+ icons/rangegroove_vert.png \
+ icons/rangearrow_down.xpm \
+ icons/rangearrow_left.xpm \
+ icons/rangearrow_right.xpm \
+ icons/rangearrow_up.xpm \
+ icons/rangebar_horiz.xpm \
+ icons/rangebar_vert.xpm \
+ icons/rangegrip_down.xpm \
+ icons/rangegrip_left.xpm \
+ icons/rangegrip_right.xpm \
+ icons/rangegrip_up.xpm \
+ icons/rangegroove_horiz.xpm \
+ icons/rangegroove_vert.xpm \
+ icons/pointer_tool.xpm \
+ icons/zoom_in.xpm \
+ icons/zoom_out.xpm \
+ icons/Hawkeye.xpm \
+ icons/Hawkeye.jpg
+
+hawkeye_LDADD = $(QT_LIBS) $(EXTRA_LDADD) \
+ $(top_builddir)/src/Contig/libDataStore.a \
+ $(top_builddir)/src/Common/libCommon.a \
+ $(top_builddir)/src/AMOS/libAMOS.a \
+ $(top_builddir)/src/Slice/libSlice.a \
+ $(top_builddir)/src/Staden/read/libread.a
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/amos.mk $(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) --foreign src/hawkeye/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/hawkeye/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):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+hawkeye$(EXEEXT): $(hawkeye_OBJECTS) $(hawkeye_DEPENDENCIES)
+ @rm -f hawkeye$(EXEEXT)
+ $(CXXLINK) $(hawkeye_OBJECTS) $(hawkeye_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/AssemblyStats.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/AssemblyStats.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/BufferedLineEdit.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/BufferedLineEdit.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CGraphContig.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CGraphContig.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CGraphEdge.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CGraphEdge.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CGraphView.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CGraphView.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CGraphWindow.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CGraphWindow.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ChromoField.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ChromoField.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ChromoPicker.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ChromoPicker.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ChromoStore.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ConsensusField.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ConsensusField.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ContigCanvasItem.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ContigCanvasItem.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ContigPicker.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ContigPicker.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CoverageCanvasItem.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CoverageCanvasItem.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CoverageRectCanvasItem.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/CoverageRectCanvasItem.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/DetailWidget.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/DetailWidget.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/FeatureBrowser.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/FeatureBrowser.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/FeatureCanvasItem.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/FeatureCanvasItem.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/HistogramWidget.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/HistogramWidget.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/HistogramWindow.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/HistogramWindow.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/InsertCanvasItem.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/InsertCanvasItem.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/InsertField.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/InsertField.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/InsertPosition.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/InsertPosition.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/InsertWidget.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/InsertWidget.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/InsertWindow.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/InsertWindow.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/LaunchPad.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/LaunchPad.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/LaunchPadBase.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/LaunchPadBase.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/LibraryPicker.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/LibraryPicker.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MainWindow.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MainWindow.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/NChartStats.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/NChartWidget.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/NChartWidget.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/NChartWindow.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/NChartWindow.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/NChartWindowBase.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/NChartWindowBase.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/NetworkCom.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/NetworkCom.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/OverviewField.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/OverviewField.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/QueryWidget.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/QueryWidget.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/RangeScrollBar.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/RangeScrollBar.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ReadInfo.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ReadInfo.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ReadPicker.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ReadPicker.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/RenderSeq.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/RenderSeq.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ScaffoldPicker.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ScaffoldPicker.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/SelectionWidget.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/SelectionWidget.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/SplashScreen.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/SplashScreen.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TilingField.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TilingField.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TilingFrame.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TilingFrame.moc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/UIElements.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/main.Po at am__quote@
+
+.cc.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 $@ $<
+
+.cc.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) '$<'`
+
+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: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) 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:
+ $(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:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+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."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic 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-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: all check install install-am install-exec-am install-strip \
+ uninstall-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ 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-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-hook
+
+
+install-exec-hook: install-bin-scripts-hook
+
+uninstall-hook: uninstall-bin-scripts-hook
+
+install-bin-scripts-hook: $(dist_bin_SCRIPTS) $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ if test -f "$(DESTDIR)$(bindir)/$$f" && test "$$f" != "$$b"; then \
+ $(INSTALL_SCRIPT) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ case "$$p" in \
+ *.pl) \
+ echo " configuring perl '$$b'"; \
+ echo '#!$(PERL)' > "$(DESTDIR)$(bindir)/$$b"; \
+ echo 'use lib "$(libdir)";' >> "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.py) \
+ echo " configuring python '$$b'"; \
+ echo '#!$(PYTHON)' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e '1 {s|^#!.*$$||;}' \
+ -e 's|^AMOSDIR[ ]*=.*$$|AMOSDIR=\"$(bindir)/\"|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *.acf) \
+ echo " configuring acf '$$b'"; \
+ echo '#!$(bindir)/runAmos -C' > "$(DESTDIR)$(bindir)/$$b"; \
+ sed -e 's|^BINDIR[ ]*=.*$$|BINDIR=$(bindir)|' \
+ -e 's|^NUCMER[ ]*=.*$$|NUCMER=$(NUCMER)|' \
+ -e 's|^DELTAFILTER[ ]*=.*$$|DELTAFILTER=$(DELTAFILTER)|' \
+ "$(DESTDIR)$(bindir)/$$f" >> "$(DESTDIR)$(bindir)/$$b" \
+ || exit 1; \
+ ;; \
+ *) \
+ echo " configuring '$$b'"; \
+ cp "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$b" \
+ ;; \
+ esac; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-bin-scripts-hook:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS) $(bin_SCRIPTS)'; for p in $$list; do \
+ b=`echo "$$p" | sed 's|^.*/||;s|.[^.]*$$||;$(transform)'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$b'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$b"; \
+ done
+
+%.moc.cc: %.hh
+ $(QT_MOC) -o $@ $<
+
+# 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/hawkeye/NChartStats.cc b/src/hawkeye/NChartStats.cc
new file mode 100644
index 0000000..e0e9ee4
--- /dev/null
+++ b/src/hawkeye/NChartStats.cc
@@ -0,0 +1,106 @@
+#include "NChartStats.hh"
+#include <cmath>
+#include <algorithm>
+#include <functional>
+#include <iostream>
+
+using namespace std;
+
+
+NChartStats::NChartStats(const string & label)
+ : m_label(label), m_sum(0), m_maxsize(0), m_maxscore(0)
+{
+}
+
+void NChartStats::addSize(int id, double size)
+{
+ m_sum += size;
+ if (size > m_maxsize) { m_maxsize = size; }
+ m_sizes.push_back(StatValue(id, size));
+}
+
+struct StatLengthCmp
+{
+ bool operator () (const StatValue & a, const StatValue & b)
+ {
+ return a.m_size > b.m_size;
+ }
+};
+
+struct StatScoreCmp
+{
+ bool operator () (const StatValue & a, const StatValue & b)
+ {
+ if (a.m_score == b.m_score)
+ {
+ return a.m_size > b.m_size;
+ }
+ return (a.m_score > b.m_score);
+ }
+};
+
+struct StatIdCmp
+{
+ bool operator () (const StatValue & a, const StatValue & b)
+ {
+ return a.m_id > b.m_id;
+ }
+};
+
+
+void NChartStats::nchart(int sortMethod)
+{
+ int l = m_sizes.size();
+
+ if (sortMethod == 0)
+ {
+ sort(m_sizes.begin(), m_sizes.end(), StatLengthCmp());
+ }
+ else if (sortMethod == 1)
+ {
+ sort(m_sizes.begin(), m_sizes.end(), StatScoreCmp());
+ }
+ else if (sortMethod == 2)
+ {
+ sort(m_sizes.begin(), m_sizes.end(), StatScoreCmp());
+ }
+}
+
+StatValue NChartStats::nvalue(double perc)
+{
+ int l = m_sizes.size();
+
+ double cursize = 0;
+
+ for (int i = 0; i < l; i++)
+ {
+ cursize += m_sizes[i].m_size;
+ if ((((double)cursize*100.0) / m_sum) >= perc)
+ {
+ return m_sizes[i];
+ }
+ }
+
+ return StatValue(0,0);
+}
+
+int NChartStats::count() const
+{
+ return m_sizes.size();
+}
+
+void NChartStats::addScore(int id, double val)
+{
+ int l = m_sizes.size();
+
+ for (int i = 0; i < l; i++)
+ {
+ if (m_sizes[i].m_id == id)
+ {
+ m_sizes[i].m_score+=val;
+ if (m_sizes[i].m_score > m_maxscore) { m_maxscore = m_sizes[i].m_score; }
+
+ break;
+ }
+ }
+}
diff --git a/src/hawkeye/NChartStats.hh b/src/hawkeye/NChartStats.hh
new file mode 100644
index 0000000..95c2085
--- /dev/null
+++ b/src/hawkeye/NChartStats.hh
@@ -0,0 +1,40 @@
+#ifndef NCHARTSTATS_HH_
+#define NCHARTSTATS_HH_ 1
+
+#include <vector>
+#include <string>
+#include <qrect.h>
+
+class StatValue
+{
+public:
+ StatValue(int id, double size) : m_id(id), m_size(size), m_score(0), m_pivotlevel(0) {}
+ int m_id;
+ int m_pivotlevel;
+ double m_score;
+ double m_size;
+
+ QRect m_rect;
+};
+
+class NChartStats
+{
+public:
+ NChartStats(const std::string & label);
+ std::string m_label;
+
+ int count() const;
+ void addSize(int id, double size);
+ void addScore(int id, double val);
+
+ StatValue nvalue(double perc);
+ void nchart(int sortMethod);
+
+ std::vector<StatValue> m_sizes;
+ double m_sum;
+ double m_maxscore;
+ double m_maxsize;
+};
+
+
+#endif
diff --git a/src/hawkeye/NChartWidget.cc b/src/hawkeye/NChartWidget.cc
new file mode 100644
index 0000000..276bdf1
--- /dev/null
+++ b/src/hawkeye/NChartWidget.cc
@@ -0,0 +1,572 @@
+#include "NChartWidget.hh"
+#include "NChartStats.hh"
+
+#include <qstring.h>
+#include <qpixmap.h>
+#include <qpainter.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+#include <QMouseEvent>
+#include <cmath>
+
+#include <iostream>
+
+using namespace std;
+
+double NiceNumber (double x, bool round)
+{
+ // adapted from "Nice numbers for graph labels"
+ // by Paul S. Heckbert published in Graphics Gems pp. 61-63
+ // finds a "nice" number approximately equal to x.
+ // Round the number if round=1, take a ceiling if round=0
+
+ double nf; // nice, rounded fraction
+ int exp = (int)floor ( log10 ( x ) ); // exponent of x
+ double f = x / pow ( 10.0, exp ); // fractional part of x; between 1 and 10
+
+ if ( round )
+ {
+ if ( f < 1.5 )
+ nf = 1.0;
+ else if ( f < 3.0 )
+ nf = 2.0;
+ else if ( f < 7.0 )
+ nf = 5.0;
+ else
+ nf = 10.0;
+ }
+ else
+ {
+ if ( f < 1.0 )
+ nf = 1.0;
+ else if ( f < 2.0 )
+ nf = 2.0;
+ else if ( f < 5.0 )
+ nf = 5.0;
+ else
+ nf = 10.0;
+ }
+
+ return nf * pow ( 10.0, exp );
+}
+
+
+NChartWidget::NChartWidget(QWidget * parent, const char * name)
+ : QWidget(parent, name),
+ m_stats(NULL), m_grid(true), m_clickpoint(-1,-1)
+{
+ setMinimumSize(250, 250);
+ // setWFlags(Qt::WRepaintNoErase | Qt::WDestructiveClose | Qt::WResizeNoErase);
+
+ m_ordering = 0;
+ m_colorstyle = 0;
+
+ setMouseTracking(true);
+}
+
+NChartWidget::~NChartWidget()
+{
+ delete m_stats;
+ m_stats = NULL;
+}
+
+void NChartWidget::setStats(NChartStats * stats)
+{
+ if (m_stats) { delete m_stats; }
+ m_stats = stats;
+ m_stats->nchart(m_ordering);
+}
+
+void NChartWidget::setOrdering(int ordering)
+{
+ m_ordering = ordering;
+ m_stats->nchart(m_ordering);
+ update();
+}
+
+void NChartWidget::setColorStyle(int colorstyle)
+{
+ m_colorstyle = colorstyle;
+ update();
+}
+
+class DRect
+{
+public:
+ DRect(double _x, double _y, double _w, double _h) : x(_x), y(_y), w(_w), h(_h) { }
+
+ double x,y,w,h;
+};
+
+static int pivotlevel = 1;
+
+
+static void layoutTreemap(NChartStats * stats, int start, int end, DRect space)
+{
+ if (start > end) { return; }
+
+ if (start == end)
+ {
+ stats->m_sizes[start].m_rect = QRect(floor(space.x-.5), floor(space.y-.5), floor(space.w+.5)+2, floor(space.h+.5)+2);
+ return;
+ }
+
+ // start ... r1pivot .. r2pivot ... end
+ // r1: [start, r1pivot) r1size
+ // rp: [r1pivot, r1pivot] rpsize
+ // r2: (r1pivot, r2pivot] r2size - rpsize
+ // r3: (r2pivot, end] r3size
+
+ int r1pivot = (int)((start+end) / 2);
+ double rpsize = stats->m_sizes[r1pivot].m_size;
+
+ stats->m_sizes[r1pivot].m_pivotlevel = pivotlevel;
+ pivotlevel++;
+
+ double r1size = 0; double r3size = 0; double allsize = 0;
+ for (int i = start; i <= end; i++) { allsize += stats->m_sizes[i].m_size; }
+ for (int i = start; i < r1pivot; i++) { r1size += stats->m_sizes[i].m_size; }
+
+ int r2pivot = r1pivot;
+ double bestratio = -1;
+ double cumsize = 0;
+ double r2size = 0;
+
+ if (space.h < space.w)
+ {
+ //layout regions into vertical stripes
+ for (int r2 = r1pivot; r2 <= end; r2++)
+ {
+ cumsize += stats->m_sizes[r2].m_size;
+ double r2width = space.w * cumsize / allsize;
+ double rpheight = space.h * rpsize / cumsize;
+
+ double rpratio = (rpheight > r2width) ? rpheight / r2width : r2width / rpheight;
+
+ if (bestratio == -1 || rpratio < bestratio)
+ {
+ r2pivot = r2; r2size = cumsize; bestratio = rpratio;
+ }
+ }
+
+ for (int i = r2pivot+1; i <= end; i++) { r3size += stats->m_sizes[i].m_size; }
+
+ double r1width = space.w * r1size / allsize;
+ double r2width = space.w * r2size / allsize;
+ double r3width = space.w * r3size / allsize;
+
+ double rpheight = space.h * rpsize / r2size;
+
+ layoutTreemap(stats, start, r1pivot-1, DRect(space.x, space.y, r1width, space.h)); // r1
+ layoutTreemap(stats, r1pivot, r1pivot, DRect(space.x+r1width, space.y, r2width, rpheight)); // rp
+ layoutTreemap(stats, r1pivot+1, r2pivot, DRect(space.x+r1width, space.y+rpheight, r2width, space.h-rpheight)); // r2
+ layoutTreemap(stats, r2pivot+1, end, DRect(space.x+r1width+r2width, space.y, r3width, space.h)); // r3
+ }
+ else
+ {
+ //layout regions into horizontal stripes
+ for (int r2 = r1pivot; r2 <= end; r2++)
+ {
+ cumsize += stats->m_sizes[r2].m_size;
+ double r2height = space.h * cumsize / allsize;
+ double rpwidth = space.w * rpsize / cumsize;
+
+ double rpratio = (r2height > rpwidth) ? r2height / rpwidth : rpwidth / r2height;
+
+ if (bestratio == -1 || rpratio < bestratio)
+ {
+ r2pivot = r2; r2size = cumsize; bestratio = rpratio;
+ }
+ }
+
+ for (int i = r2pivot+1; i <= end; i++) { r3size += stats->m_sizes[i].m_size; }
+
+ double r1height = space.h * r1size / allsize;
+ double r2height = space.h * r2size / allsize;
+ double r3height = space.h * r3size / allsize;
+
+ double rpwidth = space.w * rpsize / r2size;
+
+ layoutTreemap(stats, start, r1pivot-1, DRect(space.x, space.y, space.w, r1height)); // r1
+ layoutTreemap(stats, r1pivot, r1pivot, DRect(space.x, space.y+r1height, rpwidth, r2height)); // rp
+ layoutTreemap(stats, r1pivot+1, r2pivot, DRect(space.x+rpwidth, space.y+r1height, space.w-rpwidth, r2height)); // r2
+ layoutTreemap(stats, r2pivot+1, end, DRect(space.x, space.y+r1height+r2height, space.w, r3height)); // r3
+
+ }
+}
+
+
+
+static void setFeatRectColor(NChartStats * stats, int i, QColor & rectcolor, int colorstyle)
+{
+ if (stats->m_maxscore)
+ {
+ int h,s,v;
+ rectcolor.hsv(&h,&s,&v);
+
+ double badness = ((double)stats->m_sizes[i].m_score) / stats->m_maxscore;
+
+ if (colorstyle == 1)
+ {
+ s = (int)(badness * 255);
+ }
+ else if (colorstyle == 0)
+ {
+ h -= badness * (h);
+ h %= 360;
+ }
+
+ rectcolor.setHsv(h,s,v);
+ }
+}
+
+void NChartWidget::paintEvent(QPaintEvent * event)
+{
+ if (!m_stats) { return; }
+
+ int width = this->width();
+ int height = this->height();
+
+ QPixmap pix(width, height);
+ pix.fill(Qt::white);
+
+ QPainter p(&pix);
+ QPen pen(Qt::black);
+
+
+ p.setPen(pen);
+ p.setFont(QFont("Helvetica", 12));
+
+ int center = width/2;
+
+ QString label = m_stats->m_label.c_str();
+
+ p.drawText(0,5,width,25, Qt::AlignCenter | Qt::AlignVCenter,label);
+
+ int gutter = 20;
+ int bottomtext = 80;
+ m_histtop = 40;
+ m_histleft = 40;
+ m_histheight = height - m_histtop - bottomtext;
+ m_histbottom = m_histtop + m_histheight;
+
+ m_histwidth = width-m_histleft-gutter;
+
+ if (m_stats->m_maxscore)
+ {
+ m_histwidth -= 30;
+ }
+
+ int textline1 = m_histbottom + 25;
+ int textline2 = textline1 + 20;
+
+ QColor baserectcolor(100,160,255);
+
+ if (m_colorstyle == 1)
+ {
+ baserectcolor.setHsv(0,1,255);
+ }
+ else if (m_colorstyle == 0)
+ {
+ baserectcolor.setHsv(105,160,255);
+ }
+
+ p.setBrush(QColor(240,240,240));
+ p.drawRect(m_histleft, m_histtop, m_histwidth, m_histheight);
+
+ if (m_stats->m_maxscore)
+ {
+ // feature color gradient
+ int thermoleft = m_histleft+m_histwidth+10;
+
+ int h,s,v;
+ baserectcolor.hsv(&h,&s,&v);
+
+ QColor tcolor(baserectcolor);
+
+ if (m_colorstyle == 1)
+ {
+ for (int i = 0; i < 255; i+=5)
+ {
+ if (i+5 > 255) { i = 255-5; }
+
+ tcolor.setHsv(h,i,v);
+ p.setPen(tcolor);
+ p.setBrush(tcolor);
+
+ double top = m_histheight * (i+5) / (255);
+ double theight = m_histheight * 7.0 / (255.0);
+
+ p.drawRect((int)(thermoleft+1), (int)(m_histbottom-1-top), (int)8, (int)theight);
+ }
+ }
+ else if (m_colorstyle == 0)
+ {
+ double yscale = (double)(m_histheight) / (h+5);
+
+ for (int i = h; i >= 0; i-=5)
+ {
+ tcolor.setHsv(i,s,v);
+ p.setPen(tcolor);
+ p.setBrush(tcolor);
+
+ double top = yscale * (h-i+5);
+ double theight = yscale * 6;
+
+ p.drawRect(thermoleft+1, (int)(m_histbottom-1-top), 8, (int)(theight));
+ }
+ }
+
+ p.setPen(Qt::black);
+ p.setBrush(Qt::NoBrush);
+ p.drawRect(thermoleft, m_histtop, 10, m_histheight);
+ p.setBrush(Qt::SolidPattern);
+
+ QPixmap buffer0(80,15);
+ buffer0.fill();
+ QPainter lp0(&buffer0);
+ lp0.setPen(Qt::black);
+ lp0.setPen(Qt::black);
+ lp0.setFont(QFont("Helvetica", 12));
+ lp0.drawText(0,0,80,15, Qt::AlignHCenter|Qt::AlignVCenter, "0");
+ lp0.end();
+
+ QPixmap buffermax(80,15);
+ buffermax.fill();
+ QPainter lp1(&buffermax);
+ lp1.setPen(Qt::black);
+ lp1.setPen(Qt::black);
+ lp1.setFont(QFont("Helvetica", 12));
+ lp1.drawText(0,0,80,15, Qt::AlignHCenter|Qt::AlignVCenter, QString::number(m_stats->m_maxscore));
+ lp1.end();
+
+ QPixmap bufferfeat(80,15);
+ bufferfeat.fill();
+ QPainter lp2(&bufferfeat);
+ lp2.setPen(Qt::black);
+ lp2.setPen(Qt::black);
+ lp2.setFont(QFont("Helvetica", 12));
+ lp2.drawText(0,0,80,15, Qt::AlignHCenter|Qt::AlignVCenter, "Features");
+ lp2.end();
+
+ p.save();
+ p.rotate(-90);
+ int mapx, mapy;
+ p.worldMatrix().invert().map(thermoleft+25, m_histbottom, &mapx, &mapy);
+ p.drawPixmap(mapx-40, mapy-10, buffer0);
+
+ p.worldMatrix().invert().map(thermoleft+25, m_histtop + m_histheight/2, &mapx, &mapy);
+ p.drawPixmap(mapx-40, mapy-10, bufferfeat);
+
+ p.worldMatrix().invert().map(thermoleft+25, m_histtop, &mapx, &mapy);
+ p.drawPixmap(mapx-40, mapy-10, buffermax);
+
+ p.restore();
+ }
+
+
+ if (m_stats->count() == 0)
+ {
+ label = "Insufficient Count";
+ p.drawText(center-400, m_histtop + m_histheight/2 - 10,
+ 800, 30, Qt::AlignCenter, label);
+ }
+ else
+ {
+ m_xscale = (double)(m_histwidth)/ 100;
+ m_yscale = (double)(m_histheight-gutter) / m_stats->m_maxsize;
+
+ if (m_ordering < 2)
+ {
+ // Xlabels
+ pen.setStyle(Qt::DotLine);
+ p.setPen(pen);
+
+ int labelwidth = 100;
+ int numbuckets = (int)(labelwidth / m_xscale);
+ if (numbuckets == 0) { numbuckets = 1; }
+
+ for (double i = 12.5; i < 100; i+=12.5)
+ {
+ int xcoord = (int)(m_histleft+i*m_xscale);
+ p.drawLine(xcoord, m_histtop, xcoord, m_histbottom+5);
+
+ if (i == 25.0 || i == 50.0 || i == 75.0)
+ {
+ label = " ";
+ label += QString::number(i, 'f', 0);
+ label += "%";
+ p.drawText(xcoord-labelwidth, m_histbottom,
+ labelwidth*2, 30, Qt::AlignCenter, label);
+ }
+ }
+
+ // Y-labels
+ int yjump = (int)(100/m_yscale);
+ yjump = (int)NiceNumber(yjump, true);
+ if (yjump == 0) { yjump = 1; }
+
+ for (int j = (int)NiceNumber(m_stats->m_maxsize, true); j > 0; j -= yjump)
+ {
+ if (j > m_stats->m_maxsize) { continue; }
+ int ycoord = (int)(m_histbottom - j * m_yscale);
+
+ if (m_grid) { p.drawLine(m_histleft-5, ycoord, m_histleft+m_histwidth, ycoord); }
+
+ if (j >= 1000000)
+ {
+ double q = j /1000000.0;
+
+ label = QString::number(q, 'f', 1);
+ label += "M";
+ }
+ else if (j >= 1000)
+ {
+ double q = j /1000.0;
+
+ label = QString::number(q, 'f', 1);
+ label += "K";
+ }
+ else
+ {
+ label = QString::number(j);
+ }
+
+ QPixmap buffer(80,15);
+ buffer.fill();
+ QPainter lp(&buffer);
+ lp.setPen(Qt::black);
+ lp.setFont(QFont("Helvetica", 12));
+ lp.drawText(0,0,80,15, Qt::AlignHCenter|Qt::AlignVCenter, label);
+ lp.end();
+
+ p.save();
+ p.rotate(-90);
+ int mapx, mapy;
+ p.worldMatrix().invert().map(m_histleft-20, ycoord, &mapx, &mapy);
+ p.drawPixmap(mapx-40, mapy-10, buffer);
+ p.restore();
+ }
+ }
+
+
+ // NChart
+ pen.setStyle(Qt::SolidLine);
+ p.setPen(pen);
+
+ int l = m_stats->m_sizes.size();
+
+ //layout the rectangles
+
+ if (m_ordering == 0 || m_ordering == 1)
+ {
+ // layout by size, feature density
+ double xsizescale = ((double) m_histwidth) / m_stats->m_sum;
+ double cumsize = 0;
+
+ for (int i = 0; i < l; i++)
+ {
+ int xcoord = (int) (cumsize * xsizescale);
+ int width = (int) (m_stats->m_sizes[i].m_size * xsizescale) + 1;
+ int height = (int) (m_stats->m_sizes[i].m_size * m_yscale)+1;
+
+ m_stats->m_sizes[i].m_rect.setRect(m_histleft+xcoord, m_histbottom-height, width, height);
+ cumsize += m_stats->m_sizes[i].m_size;
+ }
+ }
+ else if (m_ordering == 2)
+ {
+ pivotlevel = 1;
+ layoutTreemap(m_stats, 0, l-1, DRect(0,0,m_histwidth,m_histheight));
+
+ for (int i = 0; i < l; i++)
+ {
+ m_stats->m_sizes[i].m_rect.moveBy(m_histleft, m_histtop);
+ }
+ }
+
+ // draw the rectangles
+ bool first = true;
+ for (int i = 0; i < l; i++)
+ {
+ QColor rectcolor(baserectcolor);
+ setFeatRectColor(m_stats, i, rectcolor, m_colorstyle);
+ p.setBrush(rectcolor);
+
+ if (first && m_stats->m_sizes[i].m_rect.contains(m_clickpoint))
+ {
+ first = false;
+ p.setBrush(QColor(99,175,252));
+
+ double perc = ((double)m_stats->m_sizes[i].m_size*100) / m_stats->m_sum;
+
+ QString info = "Selected: " + QString::number(m_stats->m_sizes[i].m_id, 'f', 0) +
+ " Size: " + QString::number(m_stats->m_sizes[i].m_size, 'f', 0) +
+ " (" + QString::number(perc, 'f', 2) +
+ "%) " + QString::number(m_stats->m_sizes[i].m_score) +
+ " Features";
+
+ p.drawText(0, textline2,
+ width, 30, Qt::AlignHCenter | Qt::AlignVCenter, info);
+ }
+
+ p.drawRect(m_stats->m_sizes[i].m_rect);
+
+ /*
+ if (m_ordering == 2 && m_stats->m_sizes[i].m_pivotlevel)
+ {
+ p.setFont(QFont("Helvetica", 8));
+ p.drawText(m_stats->m_sizes[i].m_rect,
+ Qt::AlignHCenter | Qt::AlignVCenter,
+ QString::number(m_stats->m_sizes[i].m_pivotlevel));
+ p.setFont(QFont("Helvetica", 12));
+ }
+ */
+ }
+
+
+ // text
+
+ label = "Count: " + QString::number(m_stats->m_sizes.size(), 'f', 0);
+ label += " Max: " + QString::number(m_stats->m_maxsize, 'f', 0);
+ label += " N50: " + QString::number(m_stats->nvalue(50).m_size, 'f', 0);
+ label += " Total: " + QString::number(m_stats->m_sum, 'f', 0);
+
+ p.drawText(0, textline1,
+ width, 30, Qt::AlignHCenter | Qt::AlignVCenter, label);
+
+ }
+
+ p.end();
+
+ p.begin(this);
+ p.drawPixmap(0,0,pix);
+ p.end();
+}
+
+void NChartWidget::resizeEvent()
+{
+ m_clickpoint = QPoint(-1,-1);
+}
+
+
+void NChartWidget::mouseMoveEvent(QMouseEvent * e)
+{
+ m_clickpoint = e->pos();
+ update();
+}
+
+void NChartWidget::mouseDoubleClickEvent(QMouseEvent * e)
+{
+ mouseMoveEvent(e);
+
+ int l = m_stats->m_sizes.size();
+ for (int i = 0; i < l; i++)
+ {
+ if (m_stats->m_sizes[i].m_rect.contains(m_clickpoint))
+ {
+ emit idSelected(m_stats->m_sizes[i].m_id);
+ break;
+ }
+ }
+}
diff --git a/src/hawkeye/NChartWidget.hh b/src/hawkeye/NChartWidget.hh
new file mode 100644
index 0000000..d16b037
--- /dev/null
+++ b/src/hawkeye/NChartWidget.hh
@@ -0,0 +1,55 @@
+#ifndef NCHARTWIDGET_HH__
+#define NCHARTWIDGET_HH__ 1
+
+#include <qwidget.h>
+#include <qpoint.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+#include <QMouseEvent>
+
+class NChartStats;
+
+class NChartWidget : public QWidget
+{
+Q_OBJECT
+
+public:
+ NChartWidget(QWidget * parent, const char * name);
+ ~NChartWidget();
+
+public slots:
+ void setStats(NChartStats * stats);
+ void mouseDoubleClickEvent(QMouseEvent * e);
+ void mouseMoveEvent(QMouseEvent * e);
+ void setOrdering(int ordering);
+ void setColorStyle(int style);
+
+signals:
+ void idSelected(int id);
+
+protected:
+ void paintEvent(QPaintEvent *);
+ void resizeEvent();
+
+private:
+ NChartStats * m_stats;
+ bool m_grid;
+
+ int m_histleft;
+ int m_histwidth;
+ int m_histtop;
+ int m_histheight;
+ int m_histbottom;
+
+ int m_ordering;
+ int m_colorstyle;
+
+ double m_xscale;
+ double m_yscale;
+
+ QPoint m_clickpoint;
+};
+
+
+
+#endif
diff --git a/src/hawkeye/NChartWindow.cc b/src/hawkeye/NChartWindow.cc
new file mode 100644
index 0000000..e45521f
--- /dev/null
+++ b/src/hawkeye/NChartWindow.cc
@@ -0,0 +1,23 @@
+#include "NChartWindow.hh"
+#include "NChartWidget.hh"
+
+#include <qspinbox.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <q3buttongroup.h>
+
+#include "NChartStats.hh"
+
+NChartWindow::NChartWindow(NChartStats * stats, QWidget * parent, const char * name)
+ : NChartWindowBase(parent, name)
+{
+ nChartWidget->setStats(stats);
+
+ connect(orderingGroup, SIGNAL(clicked(int)), nChartWidget, SLOT(setOrdering(int)));
+ connect(colorGroup, SIGNAL(clicked(int)), nChartWidget, SLOT(setColorStyle(int)));
+
+ setCaption(stats->m_label.c_str());
+ resize(800,500);
+ show();
+}
diff --git a/src/hawkeye/NChartWindow.hh b/src/hawkeye/NChartWindow.hh
new file mode 100644
index 0000000..7061d2b
--- /dev/null
+++ b/src/hawkeye/NChartWindow.hh
@@ -0,0 +1,17 @@
+#ifndef NCHART_WINDOW_HH__
+#define NCHART_WINDOW_HH__ 1
+
+
+#include "NChartWindowBase.hh"
+
+class NChartStats;
+
+class NChartWindow : public NChartWindowBase
+{
+ Q_OBJECT
+
+public:
+ NChartWindow(NChartStats * stats, QWidget * parent, const char * name);
+};
+
+#endif
diff --git a/src/hawkeye/NChartWindowBase.cc b/src/hawkeye/NChartWindowBase.cc
new file mode 100644
index 0000000..175961c
--- /dev/null
+++ b/src/hawkeye/NChartWindowBase.cc
@@ -0,0 +1,113 @@
+
+#include "NChartWindowBase.hh"
+
+#include <qvariant.h>
+#include <qpushbutton.h>
+#include <q3frame.h>
+#include <q3buttongroup.h>
+#include <qradiobutton.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <q3whatsthis.h>
+#include <qaction.h>
+#include <qmenubar.h>
+#include <q3popupmenu.h>
+#include <q3toolbar.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include "NChartWidget.hh"
+
+/*
+ * Constructs a NChartWindowBase as a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ *
+ */
+NChartWindowBase::NChartWindowBase( QWidget* parent, const char* name, Qt::WFlags fl )
+ : Q3MainWindow( parent, name, fl )
+{
+ (void)statusBar();
+ if ( !name )
+ setName( "NChartWindowBase" );
+ setBaseSize( QSize( 500, 500 ) );
+ setCentralWidget( new QWidget( this, "qt_central_widget" ) );
+ NChartWindowBaseLayout = new Q3GridLayout( centralWidget(), 1, 1, 11, 6, "NChartWindowBaseLayout");
+
+ nChartWidget = new NChartWidget( centralWidget(), "nChartWidget" );
+ nChartWidget->setMinimumSize( QSize( 400, 400 ) );
+
+ NChartWindowBaseLayout->addWidget( nChartWidget, 0, 0 );
+
+ frame5 = new Q3Frame( centralWidget(), "frame5" );
+ frame5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, 0, 0, frame5->sizePolicy().hasHeightForWidth() ) );
+ frame5->setFrameShape( Q3Frame::StyledPanel );
+ frame5->setFrameShadow( Q3Frame::Raised );
+ frame5Layout = new Q3GridLayout( frame5, 1, 1, 11, 6, "frame5Layout");
+
+ colorGroup = new Q3ButtonGroup( frame5, "colorGroup" );
+ colorGroup->setColumnLayout(0, Qt::Vertical );
+ colorGroup->layout()->setSpacing( 6 );
+ colorGroup->layout()->setMargin( 11 );
+ colorGroupLayout = new Q3GridLayout( colorGroup->layout() );
+ colorGroupLayout->setAlignment( Qt::AlignTop );
+
+ greenRedColor = new QRadioButton( colorGroup, "greenRedColor" );
+ greenRedColor->setChecked( TRUE );
+ colorGroup->insert( greenRedColor, 0 );
+
+ colorGroupLayout->addWidget( greenRedColor, 0, 0 );
+
+ redTintColor = new QRadioButton( colorGroup, "redTintColor" );
+
+ colorGroupLayout->addWidget( redTintColor, 1, 0 );
+
+ frame5Layout->addWidget( colorGroup, 2, 0 );
+
+ orderingGroup = new Q3ButtonGroup( frame5, "orderingGroup" );
+
+ sizeOrder = new QRadioButton( orderingGroup, "sizeOrder" );
+ sizeOrder->setGeometry( QRect( 11, 22, 133, 21 ) );
+ sizeOrder->setChecked( TRUE );
+
+ featureOrder = new QRadioButton( orderingGroup, "featureOrder" );
+ featureOrder->setGeometry( QRect( 11, 49, 133, 21 ) );
+
+ treemapOrder = new QRadioButton( orderingGroup, "treemapOrder" );
+ treemapOrder->setGeometry( QRect( 11, 76, 133, 21 ) );
+
+ frame5Layout->addWidget( orderingGroup, 1, 0 );
+ spacer3 = new QSpacerItem( 41, 81, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ frame5Layout->addItem( spacer3, 3, 0 );
+
+ NChartWindowBaseLayout->addWidget( frame5, 0, 1 );
+
+ // toolbars
+
+ languageChange();
+ resize( QSize(618, 455).expandedTo(minimumSizeHint()) );
+ //clearWState( WState_Polished );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+NChartWindowBase::~NChartWindowBase()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * Sets the strings of the subwidgets using the current
+ * language.
+ */
+void NChartWindowBase::languageChange()
+{
+ setCaption( tr( "NChartWindowBase" ) );
+ colorGroup->setTitle( tr( "Coloring" ) );
+ greenRedColor->setText( tr( "Green - Red" ) );
+ redTintColor->setText( tr( "White - Red" ) );
+ orderingGroup->setTitle( tr( "Ordering" ) );
+ sizeOrder->setText( tr( "Size" ) );
+ featureOrder->setText( tr( "Feature Density" ) );
+ treemapOrder->setText( tr( "Treemap" ) );
+}
+
diff --git a/src/hawkeye/NChartWindowBase.hh b/src/hawkeye/NChartWindowBase.hh
new file mode 100644
index 0000000..d39e169
--- /dev/null
+++ b/src/hawkeye/NChartWindowBase.hh
@@ -0,0 +1,61 @@
+
+#ifndef NCHARTWINDOWBASE_H
+#define NCHARTWINDOWBASE_H
+
+#include <qvariant.h>
+#include <qpixmap.h>
+#include <q3mainwindow.h>
+//Added by qt3to4:
+#include <Q3PopupMenu>
+#include <Q3VBoxLayout>
+#include <Q3Frame>
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+#include <Q3ActionGroup>
+
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
+class QSpacerItem;
+class QAction;
+class Q3ActionGroup;
+class Q3ToolBar;
+class Q3PopupMenu;
+class NChartWidget;
+class Q3Frame;
+class Q3ButtonGroup;
+class QRadioButton;
+
+class NChartWindowBase : public Q3MainWindow
+{
+ Q_OBJECT
+
+public:
+ NChartWindowBase( QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = Qt::WType_TopLevel );
+ ~NChartWindowBase();
+
+ NChartWidget* nChartWidget;
+ Q3Frame* frame5;
+ Q3ButtonGroup* colorGroup;
+ QRadioButton* greenRedColor;
+ QRadioButton* redTintColor;
+ Q3ButtonGroup* orderingGroup;
+ QRadioButton* sizeOrder;
+ QRadioButton* featureOrder;
+ QRadioButton* treemapOrder;
+
+protected:
+ Q3GridLayout* NChartWindowBaseLayout;
+ Q3GridLayout* frame5Layout;
+ QSpacerItem* spacer3;
+ Q3GridLayout* colorGroupLayout;
+
+protected slots:
+ virtual void languageChange();
+
+private:
+ QPixmap image0;
+
+};
+
+#endif // NCHARTWINDOWBASE_H
diff --git a/src/hawkeye/NetworkCom.cc b/src/hawkeye/NetworkCom.cc
new file mode 100644
index 0000000..fbe79b8
--- /dev/null
+++ b/src/hawkeye/NetworkCom.cc
@@ -0,0 +1,126 @@
+#include "NetworkCom.hh"
+#include <iostream>
+//Added by qt3to4:
+#include <Q3TextStream>
+#include <QLabel>
+
+using namespace std;
+
+
+/*
+ The ClientSocket class provides a socket that is connected with a client.
+ For every client that connects to the server, the server creates a new
+ instance of this class.
+*/
+ClientSocket::ClientSocket( int sock, QObject *parent, const char *name ) :
+ Q3Socket( parent, name )
+{
+ connect(this, SIGNAL(readyRead()), SLOT(readClient()));
+ connect(this, SIGNAL(connectionClosed()), SLOT(deleteLater()));
+ setSocket(sock);
+}
+
+ClientSocket::~ClientSocket()
+{
+}
+
+void ClientSocket::readClient()
+{
+ Q3TextStream ts( this );
+ while ( canReadLine() )
+ {
+ QString status;
+ QString str;
+
+ ts >> str;
+
+ int err = 1;
+
+ if (str == "contig")
+ {
+ int pos;
+ ts >> str >> pos;
+ emit setContigLocation(str, pos);
+ status = "contig: " + str + ":" + QString::number(pos) + "\n";
+ err = 0;
+ }
+ else if (str == "kill")
+ {
+ ts >> str;
+
+ if (str == "flanders")
+ {
+ emit logText("Kill Flanders!");
+ }
+ }
+
+ if (err)
+ {
+ status = "unknown command\n";
+ }
+
+ str = ts.readLine();
+
+ ts << status;
+ }
+}
+
+/*
+ The SimpleServer class handles new connections to the server. For every
+ client that connects, it creates a new ClientSocket -- that instance is now
+ responsible for the communication with that client.
+*/
+SimpleServer:: SimpleServer( QObject* parent, int port )
+ : Q3ServerSocket( port, 1, parent )
+{
+ if ( !ok() )
+ {
+ qWarning("Failed to bind to port");
+ exit(1);
+ }
+}
+
+SimpleServer::~SimpleServer()
+{
+}
+
+void SimpleServer::newConnection( int socket )
+{
+ ClientSocket *s = new ClientSocket( socket, this );
+ emit newConnect( s );
+}
+
+
+ServerInfo::ServerInfo()
+{
+ SimpleServer *server = new SimpleServer( this );
+
+ QString itext = tr(
+ "This is a small server example.\n"
+ "Connect with the client now."
+ );
+ QLabel *lb = new QLabel( itext, this );
+ lb->setAlignment( Qt::AlignHCenter );
+ infoText = new Q3TextView( this );
+ QPushButton *quit = new QPushButton( tr("Quit") , this );
+
+ connect( server, SIGNAL(newConnect(ClientSocket*)), SLOT(newConnect(ClientSocket*)) );
+ connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
+}
+
+ServerInfo::~ServerInfo()
+{
+}
+
+void ServerInfo::newConnect( ClientSocket *s )
+{
+ infoText->append( tr("New connection\n") );
+ connect( s, SIGNAL(logText(const QString&)), infoText, SLOT(append(const QString&)) );
+ connect( s, SIGNAL(connectionClosed()), SLOT(connectionClosed()) );
+}
+
+void ServerInfo::connectionClosed()
+{
+ infoText->append( tr("Client closed connection\n") );
+}
+
diff --git a/src/hawkeye/NetworkCom.hh b/src/hawkeye/NetworkCom.hh
new file mode 100644
index 0000000..9f9d2f9
--- /dev/null
+++ b/src/hawkeye/NetworkCom.hh
@@ -0,0 +1,78 @@
+#ifndef NETWORKCOM_HH_
+#define NETWORKCOM_HH_ 1
+
+#include <q3socket.h>
+#include <q3serversocket.h>
+#include <qapplication.h>
+#include <q3vbox.h>
+#include <q3textview.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <q3textstream.h>
+
+#include <stdlib.h>
+
+
+/*
+ The ClientSocket class provides a socket that is connected with a client.
+ For every client that connects to the server, the server creates a new
+ instance of this class.
+*/
+class ClientSocket : public Q3Socket
+{
+ Q_OBJECT
+public:
+ ClientSocket( int sock, QObject *parent=0, const char *name=0 );
+ ~ClientSocket();
+
+signals:
+ void logText( const QString& );
+ void setContigLocation(QString, int);
+
+private slots:
+ void readClient();
+
+private:
+ int line;
+};
+
+
+/*
+ The SimpleServer class handles new connections to the server. For every
+ client that connects, it creates a new ClientSocket -- that instance is now
+ responsible for the communication with that client.
+*/
+class SimpleServer : public Q3ServerSocket
+{
+ Q_OBJECT
+public:
+ SimpleServer( QObject* parent=0 , int port=4242);
+ ~SimpleServer();
+ void newConnection( int socket );
+
+signals:
+ void newConnect( ClientSocket* );
+};
+
+
+/*
+ The ServerInfo class provides a small GUI for the server. It also creates the
+ SimpleServer and as a result the server.
+*/
+class ServerInfo : public Q3VBox
+{
+ Q_OBJECT
+public:
+ ServerInfo();
+ ~ServerInfo();
+
+private slots:
+ void newConnect( ClientSocket *s );
+ void connectionClosed();
+
+private:
+ Q3TextView *infoText;
+};
+
+
+#endif
diff --git a/src/hawkeye/OverviewField.cc b/src/hawkeye/OverviewField.cc
new file mode 100644
index 0000000..fee6acf
--- /dev/null
+++ b/src/hawkeye/OverviewField.cc
@@ -0,0 +1,42 @@
+#include "OverviewField.hh"
+#include <q3canvas.h>
+#include <qpainter.h>
+#include <qcursor.h>
+//Added by qt3to4:
+#include <QWheelEvent>
+#include <QResizeEvent>
+#include <QMouseEvent>
+
+#include <vector>
+#include <iostream>
+
+using namespace std;
+
+
+OverviewField::OverviewField(Q3Canvas * canvas,
+ QWidget * parent,
+ const char * name)
+ :Q3CanvasView(canvas, parent, name, Qt::WNoAutoErase)
+{
+ setCursor(Qt::CrossCursor);
+}
+
+void OverviewField::wheelEvent(QWheelEvent * e)
+{
+ // just eat the event
+}
+
+
+void OverviewField::contentsMousePressEvent( QMouseEvent* e )
+{
+ QPoint real = inverseWorldMatrix().map(e->pos());
+
+ cerr << "center on: " << real.x() << endl;
+
+ emit centerView(real.x());
+}
+
+void OverviewField::resizeEvent(QResizeEvent * e)
+{
+ emit overviewResized();
+}
diff --git a/src/hawkeye/OverviewField.hh b/src/hawkeye/OverviewField.hh
new file mode 100644
index 0000000..2244a50
--- /dev/null
+++ b/src/hawkeye/OverviewField.hh
@@ -0,0 +1,36 @@
+#ifndef OVERVIEW_FIELD_HH__
+#define OVERVIEW_FIELD_HH__ 1
+
+#include <q3canvas.h>
+//Added by qt3to4:
+#include <QWheelEvent>
+#include <QResizeEvent>
+#include <QMouseEvent>
+
+class OverviewField : public Q3CanvasView
+{
+ Q_OBJECT
+
+public:
+
+ OverviewField(Q3Canvas * canvas,
+ QWidget * parent = 0,
+ const char * name = 0);
+
+public slots:
+ void resizeEvent(QResizeEvent * e);
+
+signals:
+ void centerView(int);
+ void overviewResized();
+
+protected:
+ void wheelEvent(QWheelEvent *e);
+ void contentsMousePressEvent( QMouseEvent* e );
+
+private:
+
+};
+
+
+#endif
diff --git a/src/hawkeye/QueryWidget.cc b/src/hawkeye/QueryWidget.cc
new file mode 100644
index 0000000..ea52bb0
--- /dev/null
+++ b/src/hawkeye/QueryWidget.cc
@@ -0,0 +1,444 @@
+/****************************************************************************
+** Form implementation generated from reading ui file 'ui/QueryWidget.ui'
+**
+** Created by: The User Interface Compiler ($Id$)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#include "QueryWidget.hh"
+
+#include <qvariant.h>
+#include <qpushbutton.h>
+#include <q3groupbox.h>
+#include <qlineedit.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qslider.h>
+#include <q3buttongroup.h>
+#include <qradiobutton.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <q3whatsthis.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+#include <Q3VBoxLayout>
+
+/*
+ * Constructs a QueryWidget as a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ */
+QueryWidget::QueryWidget( QWidget* parent, const char* name, Qt::WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ if ( !name )
+ setName( "QueryWidget" );
+ QueryWidgetLayout = new Q3VBoxLayout( this, 0, 0, "QueryWidgetLayout");
+
+ queryBox = new Q3GroupBox( this, "queryBox" );
+ queryBox->setFlat( TRUE );
+ queryBox->setColumnLayout(0, Qt::Vertical );
+ queryBox->layout()->setSpacing( 6 );
+ queryBox->layout()->setMargin( 11 );
+ queryBoxLayout = new Q3GridLayout( queryBox->layout() );
+ queryBoxLayout->setAlignment( Qt::AlignTop );
+
+ layout9 = new Q3HBoxLayout( 0, 0, 6, "layout9");
+
+ searchEdit = new QLineEdit( queryBox, "searchEdit" );
+ //searchEdit->setCursor( QCursor( 4 ) );
+ searchEdit->setAlignment( Qt::AlignLeft );
+ layout9->addWidget( searchEdit );
+
+ searchButton = new QPushButton( queryBox, "searchButton" );
+ searchButton->setMaximumSize( QSize( 60, 21 ) );
+ QFont searchButton_font( searchButton->font() );
+ searchButton_font.setPointSize( 9 );
+ searchButton->setFont( searchButton_font );
+ layout9->addWidget( searchButton );
+
+ queryBoxLayout->addMultiCellLayout( layout9, 0, 0, 0, 1 );
+
+ layout8 = new Q3HBoxLayout( 0, 0, 6, "layout8");
+
+ happyEdit = new QLineEdit( queryBox, "happyEdit" );
+ //happyEdit->setCursor( QCursor( 4 ) );
+ happyEdit->setAlignment( Qt::AlignRight );
+ layout8->addWidget( happyEdit );
+
+ happyButton = new QPushButton( queryBox, "happyButton" );
+ happyButton->setMaximumSize( QSize( 130, 21 ) );
+ QFont happyButton_font( happyButton->font() );
+ happyButton_font.setPointSize( 9 );
+ happyButton->setFont( happyButton_font );
+ layout8->addWidget( happyButton );
+
+ queryBoxLayout->addMultiCellLayout( layout8, 1, 1, 0, 1 );
+
+ mateTypeBox = new Q3GroupBox( queryBox, "mateTypeBox" );
+ mateTypeBox->setColumnLayout(0, Qt::Vertical );
+ mateTypeBox->layout()->setSpacing( 6 );
+ mateTypeBox->layout()->setMargin( 11 );
+ mateTypeBoxLayout = new Q3GridLayout( mateTypeBox->layout() );
+ mateTypeBoxLayout->setAlignment( Qt::AlignTop );
+
+ singletonCheck = new QCheckBox( mateTypeBox, "singletonCheck" );
+ QFont singletonCheck_font( singletonCheck->font() );
+ singletonCheck_font.setPointSize( 9 );
+ singletonCheck->setFont( singletonCheck_font );
+ singletonCheck->setChecked( TRUE );
+
+ mateTypeBoxLayout->addWidget( singletonCheck, 5, 0 );
+
+ unmatedCheck = new QCheckBox( mateTypeBox, "unmatedCheck" );
+ QFont unmatedCheck_font( unmatedCheck->font() );
+ unmatedCheck_font.setPointSize( 9 );
+ unmatedCheck->setFont( unmatedCheck_font );
+ unmatedCheck->setChecked( TRUE );
+
+ mateTypeBoxLayout->addWidget( unmatedCheck, 6, 0 );
+
+ stretchedCheck = new QCheckBox( mateTypeBox, "stretchedCheck" );
+ QFont stretchedCheck_font( stretchedCheck->font() );
+ stretchedCheck_font.setPointSize( 9 );
+ stretchedCheck->setFont( stretchedCheck_font );
+ stretchedCheck->setChecked( TRUE );
+
+ mateTypeBoxLayout->addWidget( stretchedCheck, 1, 0 );
+
+ linkingCheck = new QCheckBox( mateTypeBox, "linkingCheck" );
+ QFont linkingCheck_font( linkingCheck->font() );
+ linkingCheck_font.setPointSize( 9 );
+ linkingCheck->setFont( linkingCheck_font );
+ linkingCheck->setChecked( TRUE );
+
+ mateTypeBoxLayout->addWidget( linkingCheck, 4, 0 );
+
+ compressedCheck = new QCheckBox( mateTypeBox, "compressedCheck" );
+ QFont compressedCheck_font( compressedCheck->font() );
+ compressedCheck_font.setPointSize( 9 );
+ compressedCheck->setFont( compressedCheck_font );
+ compressedCheck->setChecked( TRUE );
+
+ mateTypeBoxLayout->addWidget( compressedCheck, 2, 0 );
+
+ happyCheck = new QCheckBox( mateTypeBox, "happyCheck" );
+ happyCheck->setPaletteForegroundColor( QColor( 0, 0, 0 ) );
+ QFont happyCheck_font( happyCheck->font() );
+ happyCheck_font.setPointSize( 9 );
+ happyCheck->setFont( happyCheck_font );
+ happyCheck->setChecked( TRUE );
+
+ mateTypeBoxLayout->addWidget( happyCheck, 0, 0 );
+
+ orientationCheck = new QCheckBox( mateTypeBox, "orientationCheck" );
+ QFont orientationCheck_font( orientationCheck->font() );
+ orientationCheck_font.setPointSize( 9 );
+ orientationCheck->setFont( orientationCheck_font );
+ orientationCheck->setChecked( TRUE );
+
+ mateTypeBoxLayout->addWidget( orientationCheck, 3, 0 );
+
+ happyLabel = new QLabel( mateTypeBox, "happyLabel" );
+ happyLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, happyLabel->sizePolicy().hasHeightForWidth() ) );
+
+ mateTypeBoxLayout->addWidget( happyLabel, 0, 1 );
+
+ stretchedLabel = new QLabel( mateTypeBox, "stretchedLabel" );
+ stretchedLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, stretchedLabel->sizePolicy().hasHeightForWidth() ) );
+
+ mateTypeBoxLayout->addWidget( stretchedLabel, 1, 1 );
+
+ compressedLabel = new QLabel( mateTypeBox, "compressedLabel" );
+ compressedLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, compressedLabel->sizePolicy().hasHeightForWidth() ) );
+
+ mateTypeBoxLayout->addWidget( compressedLabel, 2, 1 );
+
+ linkingLabel = new QLabel( mateTypeBox, "linkingLabel" );
+ linkingLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, linkingLabel->sizePolicy().hasHeightForWidth() ) );
+
+ mateTypeBoxLayout->addWidget( linkingLabel, 4, 1 );
+
+ orientationLabel = new QLabel( mateTypeBox, "orientationLabel" );
+ orientationLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, orientationLabel->sizePolicy().hasHeightForWidth() ) );
+
+ mateTypeBoxLayout->addWidget( orientationLabel, 3, 1 );
+
+ singletonLabel = new QLabel( mateTypeBox, "singletonLabel" );
+ singletonLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, singletonLabel->sizePolicy().hasHeightForWidth() ) );
+
+ mateTypeBoxLayout->addWidget( singletonLabel, 5, 1 );
+
+ unmatedLabel = new QLabel( mateTypeBox, "unmatedLabel" );
+ unmatedLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, unmatedLabel->sizePolicy().hasHeightForWidth() ) );
+
+ mateTypeBoxLayout->addWidget( unmatedLabel, 6, 1 );
+
+ queryBoxLayout->addMultiCellWidget( mateTypeBox, 3, 3, 0, 1 );
+
+ featureBox = new Q3GroupBox( queryBox, "featureBox" );
+ featureBox->setColumnLayout(0, Qt::Vertical );
+ featureBox->layout()->setSpacing( 6 );
+ featureBox->layout()->setMargin( 11 );
+ featureBoxLayout = new Q3VBoxLayout( featureBox->layout() );
+ featureBoxLayout->setAlignment( Qt::AlignTop );
+
+ sliderLayout = new Q3GridLayout( 0, 1, 1, 0, 6, "sliderLayout");
+
+ allLabel = new QLabel( featureBox, "allLabel" );
+ QFont allLabel_font( allLabel->font() );
+ allLabel_font.setPointSize( 9 );
+ allLabel->setFont( allLabel_font );
+ allLabel->setAlignment( Qt::AlignBottom | Qt::AlignRight );
+
+ sliderLayout->addWidget( allLabel, 0, 2 );
+
+ readCheck = new QCheckBox( featureBox, "readCheck" );
+ QFont readCheck_font( readCheck->font() );
+ readCheck_font.setPointSize( 9 );
+ readCheck->setFont( readCheck_font );
+ readCheck->setChecked( TRUE );
+
+ sliderLayout->addWidget( readCheck, 2, 0 );
+
+ noneLabel = new QLabel( featureBox, "noneLabel" );
+ QFont noneLabel_font( noneLabel->font() );
+ noneLabel_font.setPointSize( 9 );
+ noneLabel->setFont( noneLabel_font );
+ noneLabel->setAlignment( Qt::AlignBottom | Qt::AlignLeft );
+
+ sliderLayout->addWidget( noneLabel, 0, 1 );
+
+ insertSlider = new QSlider( featureBox, "insertSlider" );
+ insertSlider->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 0, 0, insertSlider->sizePolicy().hasHeightForWidth() ) );
+ insertSlider->setMinValue( 0 );
+ insertSlider->setMaxValue( 10 );
+ insertSlider->setValue( 0 );
+ insertSlider->setOrientation( Qt::Horizontal );
+ insertSlider->setTickmarks( QSlider::NoMarks );
+ insertSlider->setTickInterval( 1 );
+
+ sliderLayout->addMultiCellWidget( insertSlider, 1, 1, 1, 2 );
+
+ readSlider = new QSlider( featureBox, "readSlider" );
+ readSlider->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 0, 0, readSlider->sizePolicy().hasHeightForWidth() ) );
+ readSlider->setMinValue( 0 );
+ readSlider->setMaxValue( 10 );
+ readSlider->setValue( 0 );
+ readSlider->setOrientation( Qt::Horizontal );
+ readSlider->setTickmarks( QSlider::NoMarks );
+ readSlider->setTickInterval( 1 );
+
+ sliderLayout->addMultiCellWidget( readSlider, 2, 2, 1, 2 );
+
+ insertCheck = new QCheckBox( featureBox, "insertCheck" );
+ QFont insertCheck_font( insertCheck->font() );
+ insertCheck_font.setPointSize( 9 );
+ insertCheck->setFont( insertCheck_font );
+ insertCheck->setChecked( TRUE );
+
+ sliderLayout->addWidget( insertCheck, 1, 0 );
+ featureBoxLayout->addLayout( sliderLayout );
+
+ misasmCheck = new QCheckBox( featureBox, "misasmCheck" );
+ QFont misasmCheck_font( misasmCheck->font() );
+ misasmCheck_font.setPointSize( 9 );
+ misasmCheck->setFont( misasmCheck_font );
+ misasmCheck->setChecked( TRUE );
+ featureBoxLayout->addWidget( misasmCheck );
+
+ otherCheck = new QCheckBox( featureBox, "otherCheck" );
+ QFont otherCheck_font( otherCheck->font() );
+ otherCheck_font.setPointSize( 9 );
+ otherCheck->setFont( otherCheck_font );
+ otherCheck->setChecked( TRUE );
+ featureBoxLayout->addWidget( otherCheck );
+
+ queryBoxLayout->addMultiCellWidget( featureBox, 2, 2, 0, 1 );
+
+ mateColorBox = new Q3ButtonGroup( queryBox, "mateColorBox" );
+ mateColorBox->setColumnLayout(0, Qt::Vertical );
+ mateColorBox->layout()->setSpacing( 6 );
+ mateColorBox->layout()->setMargin( 11 );
+ mateColorBoxLayout = new Q3VBoxLayout( mateColorBox->layout() );
+ mateColorBoxLayout->setAlignment( Qt::AlignTop );
+
+ categoricalButton = new QRadioButton( mateColorBox, "categoricalButton" );
+ QFont categoricalButton_font( categoricalButton->font() );
+ categoricalButton_font.setPointSize( 9 );
+ categoricalButton->setFont( categoricalButton_font );
+ categoricalButton->setChecked( TRUE );
+ mateColorBoxLayout->addWidget( categoricalButton );
+
+ continuousButton = new QRadioButton( mateColorBox, "continuousButton" );
+ QFont continuousButton_font( continuousButton->font() );
+ continuousButton_font.setPointSize( 9 );
+ continuousButton->setFont( continuousButton_font );
+ continuousButton->setChecked( FALSE );
+ mateColorBoxLayout->addWidget( continuousButton );
+
+ linkingButton = new QRadioButton( mateColorBox, "linkingButton" );
+ QFont linkingButton_font( linkingButton->font() );
+ linkingButton_font.setPointSize( 9 );
+ linkingButton->setFont( linkingButton_font );
+ mateColorBoxLayout->addWidget( linkingButton );
+
+ libraryButton = new QRadioButton( mateColorBox, "libraryButton" );
+ QFont libraryButton_font( libraryButton->font() );
+ libraryButton_font.setPointSize( 9 );
+ libraryButton->setFont( libraryButton_font );
+ mateColorBoxLayout->addWidget( libraryButton );
+
+ queryBoxLayout->addWidget( mateColorBox, 4, 1 );
+
+ displayBox = new Q3GroupBox( queryBox, "displayBox" );
+ displayBox->setColumnLayout(0, Qt::Vertical );
+ displayBox->layout()->setSpacing( 6 );
+ displayBox->layout()->setMargin( 11 );
+ displayBoxLayout = new Q3VBoxLayout( displayBox->layout() );
+ displayBoxLayout->setAlignment( Qt::AlignTop );
+
+ coverageCheck = new QCheckBox( displayBox, "coverageCheck" );
+ coverageCheck->setPaletteForegroundColor( QColor( 0, 0, 0 ) );
+ QFont coverageCheck_font( coverageCheck->font() );
+ coverageCheck_font.setPointSize( 9 );
+ coverageCheck->setFont( coverageCheck_font );
+ coverageCheck->setChecked( TRUE );
+ displayBoxLayout->addWidget( coverageCheck );
+
+ ceCheck = new QCheckBox( displayBox, "ceCheck" );
+ ceCheck->setPaletteForegroundColor( QColor( 0, 0, 0 ) );
+ QFont ceCheck_font( ceCheck->font() );
+ ceCheck_font.setPointSize( 9 );
+ ceCheck->setFont( ceCheck_font );
+ ceCheck->setChecked( TRUE );
+ displayBoxLayout->addWidget( ceCheck );
+
+ mateCheck = new QCheckBox( displayBox, "mateCheck" );
+ mateCheck->setPaletteForegroundColor( QColor( 0, 0, 0 ) );
+ QFont mateCheck_font( mateCheck->font() );
+ mateCheck_font.setPointSize( 9 );
+ mateCheck->setFont( mateCheck_font );
+ mateCheck->setChecked( TRUE );
+ displayBoxLayout->addWidget( mateCheck );
+
+ partitionCheck = new QCheckBox( displayBox, "partitionCheck" );
+ partitionCheck->setPaletteForegroundColor( QColor( 0, 0, 0 ) );
+ QFont partitionCheck_font( partitionCheck->font() );
+ partitionCheck_font.setPointSize( 9 );
+ partitionCheck->setFont( partitionCheck_font );
+ partitionCheck->setChecked( TRUE );
+ displayBoxLayout->addWidget( partitionCheck );
+
+ tintCheck = new QCheckBox( displayBox, "tintCheck" );
+ tintCheck->setPaletteForegroundColor( QColor( 0, 0, 0 ) );
+ QFont tintCheck_font( tintCheck->font() );
+ tintCheck_font.setPointSize( 9 );
+ tintCheck->setFont( tintCheck_font );
+ tintCheck->setChecked( FALSE );
+ displayBoxLayout->addWidget( tintCheck );
+
+ queryBoxLayout->addWidget( displayBox, 4, 0 );
+
+ libraryBox = new Q3GroupBox( queryBox, "libraryBox" );
+
+ queryBoxLayout->addMultiCellWidget( libraryBox, 5, 5, 0, 1 );
+ QueryWidgetLayout->addWidget( queryBox );
+ languageChange();
+ resize( QSize(295, 816).expandedTo(minimumSizeHint()) );
+ //clearWState( WState_Polished );
+
+ // signals and slots connections
+ connect( insertCheck, SIGNAL( toggled(bool) ), insertSlider, SLOT( setEnabled(bool) ) );
+ connect( readCheck, SIGNAL( toggled(bool) ), readSlider, SLOT( setEnabled(bool) ) );
+ connect( searchEdit, SIGNAL( returnPressed() ), searchButton, SLOT( animateClick() ) );
+ connect( happyEdit, SIGNAL( returnPressed() ), happyButton, SLOT( animateClick() ) );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+QueryWidget::~QueryWidget()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * Sets the strings of the subwidgets using the current
+ * language.
+ */
+void QueryWidget::languageChange()
+{
+ setCaption( tr( "Form2" ) );
+ queryBox->setTitle( tr( " Queries" ) );
+ searchButton->setText( tr( "Search" ) );
+ QToolTip::add( searchButton, tr( "Regexp search for a contig, feature or insert" ) );
+ happyEdit->setText( tr( "2.0" ) );
+ happyButton->setText( tr( "Happy Distance" ) );
+ QToolTip::add( happyButton, tr( "Allowed number of std. deviations from the mean" ) );
+ mateTypeBox->setTitle( tr( "Mate Types" ) );
+ singletonCheck->setText( tr( "Singleton" ) );
+ QToolTip::add( singletonCheck, tr( "Mated read is unassembled" ) );
+ unmatedCheck->setText( tr( "Unmated" ) );
+ QToolTip::add( unmatedCheck, tr( "Mate does not exist" ) );
+ stretchedCheck->setText( tr( "Stretched" ) );
+ QToolTip::add( stretchedCheck, tr( "Larger than expected" ) );
+ linkingCheck->setText( tr( "Linking" ) );
+ QToolTip::add( linkingCheck, tr( "Mates are in different scaffolds" ) );
+ compressedCheck->setText( tr( "Compressed" ) );
+ QToolTip::add( compressedCheck, tr( "Smaller than expected" ) );
+ happyCheck->setText( tr( "Happy" ) );
+ QToolTip::add( happyCheck, tr( "Correctly oriented and sized" ) );
+ orientationCheck->setText( tr( "Orientation" ) );
+ QToolTip::add( orientationCheck, tr( "Mates do not point towards one another" ) );
+ happyLabel->setText( tr( "pixmap" ) );
+ QToolTip::add( happyLabel, tr( "Correctly oriented and sized" ) );
+ stretchedLabel->setText( tr( "pixmap" ) );
+ QToolTip::add( stretchedLabel, tr( "Larger than expected" ) );
+ compressedLabel->setText( tr( "pixmap" ) );
+ QToolTip::add( compressedLabel, tr( "Smaller than expected" ) );
+ linkingLabel->setText( tr( "pixmap" ) );
+ QToolTip::add( linkingLabel, tr( "Mates are in different scaffolds" ) );
+ orientationLabel->setText( tr( "pixmap" ) );
+ QToolTip::add( orientationLabel, tr( "Mates do not point towards one another" ) );
+ singletonLabel->setText( tr( "pixmap" ) );
+ QToolTip::add( singletonLabel, tr( "Mated read is unassembled" ) );
+ unmatedLabel->setText( tr( "pixmap" ) );
+ QToolTip::add( unmatedLabel, tr( "Mate does not exist" ) );
+ featureBox->setTitle( tr( "Features" ) );
+ allLabel->setText( tr( "NONE" ) );
+ readCheck->setText( tr( "Read Cov" ) );
+ QToolTip::add( readCheck, tr( "Read coverage heat map features" ) );
+ noneLabel->setText( tr( "ALL" ) );
+ QToolTip::add( insertSlider, tr( "Insert coverage tolerance" ) );
+ QToolTip::add( readSlider, tr( "Read coverage tolerance" ) );
+ insertCheck->setText( tr( "Insert Cov" ) );
+ QToolTip::add( insertCheck, tr( "Insert coverage heat map features" ) );
+ misasmCheck->setText( tr( "Mis-assembly features" ) );
+ QToolTip::add( misasmCheck, tr( "Mis-assembly evidence features" ) );
+ otherCheck->setText( tr( "Generalized features" ) );
+ QToolTip::add( otherCheck, tr( "Generalized features" ) );
+ mateColorBox->setTitle( tr( "Mate Colors" ) );
+ categoricalButton->setText( tr( "Categorical" ) );
+ QToolTip::add( categoricalButton, tr( "Color mates by category" ) );
+ continuousButton->setText( tr( "Continuous" ) );
+ QToolTip::add( continuousButton, tr( "Color mates by degree of compression or expansion" ) );
+ linkingButton->setText( tr( "Linking" ) );
+ QToolTip::add( linkingButton, tr( "Color mates by linked contig" ) );
+ libraryButton->setText( tr( "Library" ) );
+ QToolTip::add( libraryButton, tr( "Color mates by library" ) );
+ displayBox->setTitle( tr( "Display" ) );
+ coverageCheck->setText( tr( "Coverage Stat" ) );
+ QToolTip::add( coverageCheck, tr( "Read and insert coverage statistic plot" ) );
+ ceCheck->setText( tr( "CE Statistic" ) );
+ QToolTip::add( ceCheck, tr( "Compression-expansion statistic plot" ) );
+ mateCheck->setText( tr( "Connect Mates" ) );
+ QToolTip::add( mateCheck, tr( "Connect mated reads" ) );
+ partitionCheck->setText( tr( "Partition Types" ) );
+ QToolTip::add( partitionCheck, tr( "Partition mate types into separate tracks" ) );
+ tintCheck->setText( tr( "Tint Partitions" ) );
+ QToolTip::add( tintCheck, tr( "Tint mate partition backgrounds by color" ) );
+ libraryBox->setTitle( tr( "Libraries" ) );
+}
+
diff --git a/src/hawkeye/QueryWidget.hh b/src/hawkeye/QueryWidget.hh
new file mode 100644
index 0000000..f23d2fd
--- /dev/null
+++ b/src/hawkeye/QueryWidget.hh
@@ -0,0 +1,99 @@
+/****************************************************************************
+** Form interface generated from reading ui file 'QueryWidget.ui'
+**
+** Created by: The User Interface Compiler ($Id$)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#ifndef QUERYWIDGET_H
+#define QUERYWIDGET_H
+
+#include <qvariant.h>
+#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
+#include <QLabel>
+
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
+class QSpacerItem;
+class Q3GroupBox;
+class QLineEdit;
+class QPushButton;
+class QCheckBox;
+class QLabel;
+class QSlider;
+class Q3ButtonGroup;
+class QRadioButton;
+
+class QueryWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ QueryWidget( QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0 );
+ ~QueryWidget();
+
+ Q3GroupBox* queryBox;
+ QLineEdit* searchEdit;
+ QPushButton* searchButton;
+ QLineEdit* happyEdit;
+ QPushButton* happyButton;
+ Q3GroupBox* mateTypeBox;
+ QCheckBox* singletonCheck;
+ QCheckBox* unmatedCheck;
+ QCheckBox* stretchedCheck;
+ QCheckBox* linkingCheck;
+ QCheckBox* compressedCheck;
+ QCheckBox* happyCheck;
+ QCheckBox* orientationCheck;
+ QLabel* happyLabel;
+ QLabel* stretchedLabel;
+ QLabel* compressedLabel;
+ QLabel* linkingLabel;
+ QLabel* orientationLabel;
+ QLabel* singletonLabel;
+ QLabel* unmatedLabel;
+ Q3GroupBox* featureBox;
+ QLabel* allLabel;
+ QCheckBox* readCheck;
+ QLabel* noneLabel;
+ QSlider* insertSlider;
+ QSlider* readSlider;
+ QCheckBox* insertCheck;
+ QCheckBox* misasmCheck;
+ QCheckBox* otherCheck;
+ Q3ButtonGroup* mateColorBox;
+ QRadioButton* categoricalButton;
+ QRadioButton* continuousButton;
+ QRadioButton* linkingButton;
+ QRadioButton* libraryButton;
+ Q3GroupBox* displayBox;
+ QCheckBox* coverageCheck;
+ QCheckBox* ceCheck;
+ QCheckBox* mateCheck;
+ QCheckBox* partitionCheck;
+ QCheckBox* tintCheck;
+ Q3GroupBox* libraryBox;
+
+protected:
+ Q3VBoxLayout* QueryWidgetLayout;
+ Q3GridLayout* queryBoxLayout;
+ Q3HBoxLayout* layout9;
+ Q3HBoxLayout* layout8;
+ Q3GridLayout* mateTypeBoxLayout;
+ Q3VBoxLayout* featureBoxLayout;
+ Q3GridLayout* sliderLayout;
+ Q3VBoxLayout* mateColorBoxLayout;
+ Q3VBoxLayout* displayBoxLayout;
+
+protected slots:
+ virtual void languageChange();
+
+};
+
+#endif // QUERYWIDGET_H
diff --git a/src/hawkeye/RangeScrollBar.cc b/src/hawkeye/RangeScrollBar.cc
new file mode 100644
index 0000000..0718508
--- /dev/null
+++ b/src/hawkeye/RangeScrollBar.cc
@@ -0,0 +1,734 @@
+///////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 04/07/2006
+//!
+//! \brief A QScrollBar with an adjustable viewing range
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+//#include <QtGui>
+//#include "QtUtilities.hh"
+
+#include "RangeScrollBar.hh"
+#include <qpainter.h>
+#include <qcursor.h>
+//Added by qt3to4:
+#include <QTimerEvent>
+#include <QWheelEvent>
+#include <QPaintEvent>
+#include <QPixmap>
+#include <QMouseEvent>
+#include <QHideEvent>
+#include <QKeyEvent>
+#include <QEvent>
+#include <iostream>
+
+#include "icons/rangebar_horiz.xpm"
+#include "icons/rangebar_vert.xpm"
+#include "icons/rangegroove_horiz.xpm"
+#include "icons/rangegroove_vert.xpm"
+#include "icons/rangearrow_left.xpm"
+#include "icons/rangearrow_right.xpm"
+#include "icons/rangearrow_up.xpm"
+#include "icons/rangearrow_down.xpm"
+#include "icons/rangegrip_left.xpm"
+#include "icons/rangegrip_right.xpm"
+#include "icons/rangegrip_up.xpm"
+#include "icons/rangegrip_down.xpm"
+
+
+
+
+//======================================================== RangeScrollBar_t ====
+//-- Load in the xpms for the RangeScrollBar
+const QImage RangeScrollBar_t::hBarImage_m (rangebar_horiz);
+const QImage RangeScrollBar_t::vBarImage_m (rangebar_vert);
+const QImage RangeScrollBar_t::hGrooveImage_m(rangegroove_horiz);
+const QImage RangeScrollBar_t::vGrooveImage_m(rangegroove_vert);
+const QImage RangeScrollBar_t::lArrowImage_m (rangearrow_left);
+const QImage RangeScrollBar_t::rArrowImage_m (rangearrow_right);
+const QImage RangeScrollBar_t::uArrowImage_m (rangearrow_up);
+const QImage RangeScrollBar_t::dArrowImage_m (rangearrow_down);
+const QImage RangeScrollBar_t::lGripImage_m (rangegrip_left);
+const QImage RangeScrollBar_t::rGripImage_m (rangegrip_right);
+const QImage RangeScrollBar_t::uGripImage_m (rangegrip_up);
+const QImage RangeScrollBar_t::dGripImage_m (rangegrip_down);
+
+//-- Shorthand
+#define IS_HORIZ (orientation_m == Qt::Horizontal)
+#define IS_VERT !IS_HORIZ
+
+
+inline QRect Shrunk (const QRect & r, int v)
+{
+ QRect n(r);
+ n.addCoords (v,v,-v,-v);
+ return n;
+}
+
+
+
+//-------------------------------------------------------- RangeScrollBar_t ----
+RangeScrollBar_t::RangeScrollBar_t (QWidget * parent)
+ : QWidget (parent)
+{
+ orientation_m = Qt::Horizontal;
+ init();
+}
+
+
+//-------------------------------------------------------- RangeScrollBar_t ----
+RangeScrollBar_t::RangeScrollBar_t
+(Qt::Orientation orientation, QWidget * parent)
+ : QWidget (parent)
+{
+ orientation_m = orientation;
+ init();
+}
+
+
+//------------------------------------------------------- ~RangeScrollBar_t ----
+RangeScrollBar_t::~RangeScrollBar_t()
+{
+}
+
+
+//--------------------------------------------------------- activateControl ----
+void RangeScrollBar_t::activateControl (int control, int threshold)
+{
+ SliderAction action = SliderNoAction;
+ switch ( control )
+ {
+ case SC_AddPage:
+ action = SliderPageStepAdd;
+ break;
+ case SC_SubPage:
+ action = SliderPageStepSub;
+ break;
+ case SC_AddStep:
+ action = SliderSingleStepAdd;
+ break;
+ case SC_SubStep:
+ action = SliderSingleStepSub;
+ break;
+ case SC_FirstPage:
+ action = SliderToMinimum;
+ break;
+ case SC_LastPage:
+ action = SliderToMaximum;
+ break;
+ default:
+ break;
+ }
+
+ if ( action )
+ {
+ triggerAction (action);
+ setRepeatAction (action, threshold);
+ }
+}
+
+
+//------------------------------------------------------------- changeEvent ----
+void RangeScrollBar_t::changeEvent (QEvent * e)
+{
+ //-- Stop the repeat if widget becomes disabled
+ // if ( e->type() == QEvent::EnabledChange && !isEnabled() )
+ if ( e->type() == QEvent::EnabledChange && !isEnabled() )
+ repeatActionTimer_m.stop();
+
+ QWidget::changeEvent (e);
+}
+
+
+//------------------------------------------------------------------- event ----
+bool RangeScrollBar_t::event (QEvent * e)
+{
+ switch( e->type() )
+ {
+ //-- Capture mouse hover events
+ /*
+ case QEvent::HoverEnter:
+ case QEvent::HoverLeave:
+ case QEvent::HoverMove:
+ if ( const QHoverEvent * he = static_cast<const QHoverEvent *>(e) )
+ updateHover (he->pos());
+ break;
+ */
+ default:
+ break;
+ }
+ return QWidget::event (e);
+}
+
+
+//--------------------------------------------------------------- hideEvent ----
+void RangeScrollBar_t::hideEvent (QHideEvent *)
+{
+ //-- Stop the repeat if widget becomes hidden
+ if ( pressedControl_m )
+ {
+ pressedControl_m = SC_None;
+ setRepeatAction (SliderNoAction);
+ }
+}
+
+
+//----------------------------------------------------------- highlightRect ----
+QRect RangeScrollBar_t::highlightRect (int control)
+{
+ //-- Return the highlight rect for a given control
+ switch ( control )
+ {
+ case SC_RangeGrip:
+ case SC_LowGrip:
+ case SC_HighGrip:
+ return Shrunk (sliderRect_m, 1);
+
+ case SC_AddStep:
+ return Shrunk (addRect_m, 1);
+
+ case SC_SubStep:
+ return Shrunk (subRect_m, 1);
+
+ default:
+ return QRect();
+ }
+}
+
+
+//-------------------------------------------------------------------- init ----
+void RangeScrollBar_t::init()
+{
+ setWindowFlags(Qt::WRepaintNoErase | Qt::WResizeNoErase);
+ setBackgroundMode(Qt::NoBackground); // for some reason this is necessary on qt 3.3.6
+
+ //-- Default pixel size
+ controlPix_m = 15;
+ gripPix_m = 5;
+
+ //-- Default values
+ min_m = 0;
+ max_m = 99;
+ low_m = 0;
+ high_m = 10;
+ singleStep_m = 1;
+ pageStep_m = 10;
+
+ pressedControl_m = SC_None;
+ hoveredControl_m = SC_None;
+
+ repeatAction_m = SliderNoAction;
+
+ setMinimumSize (sizeHint());
+ setMouseTracking(true);
+
+ if ( IS_HORIZ )
+ setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Fixed);
+ else
+ setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Minimum);
+
+ //setAttribute (Qt::WA_Hover, true);
+ //setFocusPolicy (Qt::NoFocus);
+}
+
+
+//----------------------------------------------------------- keyPressEvent ----
+void RangeScrollBar_t::keyPressEvent (QKeyEvent * e)
+{
+ SliderAction action = SliderNoAction;
+
+ //-- Tie key presses to their actions
+ switch ( e->key() )
+ {
+ case Qt::Key_Left:
+ case Qt::Key_Up:
+ action = SliderSingleStepSub;
+ break;
+
+ case Qt::Key_Right:
+ case Qt::Key_Down:
+ action = SliderSingleStepAdd;
+ break;
+
+ case Qt::Key_PageUp:
+ action = SliderPageStepSub;
+ break;
+
+ case Qt::Key_PageDown:
+ action = SliderPageStepAdd;
+ break;
+
+ case Qt::Key_Home:
+ action = SliderToMinimum;
+ break;
+
+ case Qt::Key_End:
+ action = SliderToMaximum;
+ break;
+
+ default:
+ e->ignore();
+ break;
+ }
+
+ if ( action )
+ triggerAction (action);
+}
+
+
+//---------------------------------------------------------- mouseMoveEvent ----
+void RangeScrollBar_t::mouseMoveEvent (QMouseEvent * e)
+{
+ updateHover (e->pos());
+
+ if ( !pressedControl_m)
+ return;
+
+ int pos = IS_HORIZ ? e->pos().x() : e->pos().y();
+
+ //-- Range adjustment via mouse dragging
+ switch ( pressedControl_m )
+ {
+ case SC_RangeGrip:
+ setValue (pix2val (pos - clickOffset_m));
+ break;
+ case SC_LowGrip:
+ setRangeLow (pix2val (pos - clickOffset_m));
+ break;
+ case SC_HighGrip:
+ setRangeHigh (pix2val (pos - clickOffset_m));
+ break;
+ }
+
+ repaint(); // can't call update, or the repaint events will just queue up
+}
+
+
+//--------------------------------------------------------- mousePressEvent ----
+void RangeScrollBar_t::mousePressEvent (QMouseEvent * e)
+{
+ if ( min_m == max_m
+ || (e->button() & (~e->button()))
+ || !(e->button() == Qt::LeftButton || e->button() == Qt::MidButton) )
+ return;
+
+ updatePress (e->pos());
+ int pos = IS_HORIZ ? e->pos().x() : e->pos().y();
+
+ //-- Middle button goto
+ if ( e->button() == Qt::MidButton &&
+ (pressedControl_m == SC_RangeGrip
+ || pressedControl_m == SC_SubPage
+ || pressedControl_m == SC_AddPage) )
+ {
+ int half = (IS_HORIZ ? rangeRect_m.width() : rangeRect_m.height()) / 2;
+ setValue (pix2val (pos - half));
+ pressedControl_m = SC_RangeGrip;
+ clickOffset_m = half;
+ }
+ //-- Range adjustments
+ else if ( pressedControl_m == SC_RangeGrip )
+ clickOffset_m =
+ IS_HORIZ ? pos - rangeRect_m.x() : pos - rangeRect_m.y();
+ else if ( pressedControl_m == SC_LowGrip )
+ clickOffset_m =
+ IS_HORIZ ? pos - rangeRect_m.x() : pos - rangeRect_m.y();
+ else if ( pressedControl_m == SC_HighGrip )
+ clickOffset_m =
+ IS_HORIZ ? pos - rangeRect_m.right() : pos - rangeRect_m.bottom();
+
+ activateControl (pressedControl_m);
+}
+
+
+//------------------------------------------------------- mouseReleaseEvent ----
+void RangeScrollBar_t::mouseReleaseEvent (QMouseEvent * e)
+{
+// if ( !pressedControl_m
+// || e->button() && (~e->button()) )
+// return;
+
+ setRepeatAction (SliderNoAction);
+ pressedControl_m = SC_None;
+ updateHover (e->pos());
+}
+
+//-------------------------------------------------------------- paintEvent ----
+void RangeScrollBar_t::paintEvent (QPaintEvent *)
+{
+ QPixmap pix(width(), height());
+ pix.fill(this,0,0);
+ QPainter p (&pix);
+
+ updateRects(); // update the control boundaries
+
+ if ( IS_HORIZ )
+ {
+ p.drawImage (grooveRect_m, hGrooveImage_m);
+ p.drawImage (subRect_m, lArrowImage_m);
+ p.drawImage (addRect_m, rArrowImage_m);
+ p.drawImage (lowRect_m, lGripImage_m);
+ p.drawImage (rangeRect_m, hBarImage_m);
+ p.drawImage (highRect_m, rGripImage_m);
+ }
+ else
+ {
+ p.drawImage (grooveRect_m, vGrooveImage_m);
+ p.drawImage (lowRect_m, uGripImage_m);
+ p.drawImage (rangeRect_m, vBarImage_m);
+ p.drawImage (highRect_m, dGripImage_m);
+ p.drawImage (subRect_m, uArrowImage_m);
+ p.drawImage (addRect_m, dArrowImage_m);
+ }
+
+ /*
+ //-- Highlight the hovered control
+ if ( hoveredControl_m )
+ {
+ p.setPen (Qt::NoPen);
+ p.setBrush (QColor (0, 0, 0)); //, 50));
+ p.drawRect (highlightRect (hoveredControl_m));
+ }
+ */
+
+ p.end();
+
+ p.begin(this);
+ p.drawPixmap(0,0,pix);
+ p.end();
+}
+
+
+//---------------------------------------------------------- setOrientation ----
+void RangeScrollBar_t::setOrientation (Qt::Orientation orientation)
+{
+ if ( orientation_m == orientation )
+ return;
+
+ orientation_m = orientation;
+ QSizePolicy sp = sizePolicy();
+ sp.transpose();
+ setSizePolicy (sp);
+
+ update();
+ updateGeometry();
+}
+
+
+//------------------------------------------------------------- setMaxRange ----
+void RangeScrollBar_t::setMaxRange (int min, int max)
+{
+ if ( min > max )
+ std::swap (min, max);
+
+ if ( min == min_m && max == max_m )
+ return;
+
+ min_m = min;
+ max_m = max;
+
+ emit maxRangeChanged (min_m, max_m);
+ setRange (low_m, high_m); // re-bound
+
+ update();
+}
+
+
+//---------------------------------------------------------------- setRange ----
+void RangeScrollBar_t::setRange (int low, int high)
+{
+ //-- Keep the range within bounds
+ low = std::max (min_m, std::min (max_m, low));
+ high = std::max (min_m, std::min (max_m, high));
+
+ if ( high < low )
+ std::swap (low, high);
+
+ if ( low == low_m && high == high_m )
+ return;
+
+ if (low == high)
+ return;
+
+ low_m = low;
+ high_m = high;
+
+ emit rangeChanged (low_m, high_m);
+ QRect oldSlider (sliderRect_m);
+ updateRects();
+ update (sliderRect_m | oldSlider);
+}
+
+
+//--------------------------------------------------------- setRepeatAction ----
+void RangeScrollBar_t::setRepeatAction
+ (SliderAction action,
+ int thresholdTime,
+ int repeatTime)
+{
+ //-- Set up a repeating action
+ repeatAction_m = action;
+ if ( action == SliderNoAction )
+ repeatActionTimer_m.stop();
+ else
+ {
+ repeatActionTime_m = repeatTime;
+ repeatActionTimer_m.start (thresholdTime, this);
+ }
+}
+
+
+//---------------------------------------------------------------- setValue ----
+void RangeScrollBar_t::setValue (int low)
+{
+ //-- Keep the range within bounds
+ int width = high_m - low_m;
+ if ( low < min_m )
+ low = min_m;
+ if ( low + width > max_m )
+ low = max_m - width;
+
+ if ( low == low_m )
+ return;
+
+ low_m = low;
+ high_m = low + width;
+
+ emit valueChanged (low_m);
+ QRect oldSlider (sliderRect_m);
+ updateRects();
+ update (sliderRect_m | oldSlider);
+}
+
+
+//---------------------------------------------------------------- sizeHint ----
+QSize RangeScrollBar_t::sizeHint() const
+{
+ //ensurePolished();
+
+ //-- Two page step controls and two range grips
+ QSize size (controlPix_m * 2 + gripPix_m * 2, controlPix_m);
+
+ if ( orientation_m == Qt::Vertical )
+ size.transpose();
+
+ return size;
+}
+
+
+//-------------------------------------------------------------- timerEvent ----
+void RangeScrollBar_t::timerEvent (QTimerEvent * e)
+{
+ if ( e->timerId() == repeatActionTimer_m.timerId() )
+ {
+ if ( repeatActionTime_m )
+ {
+ repeatActionTimer_m.start (repeatActionTime_m, this);
+ repeatActionTime_m = 0;
+ }
+ triggerAction (repeatAction_m);
+ }
+}
+
+
+//----------------------------------------------------------- triggerAction ----
+void RangeScrollBar_t::triggerAction (SliderAction action)
+{
+ switch ( action )
+ {
+ case SliderSingleStepAdd:
+ setValue (low_m + singleStep_m);
+ break;
+ case SliderSingleStepSub:
+ setValue (low_m - singleStep_m);
+ break;
+ case SliderPageStepAdd:
+ setValue (low_m + pageStep_m);
+ break;
+ case SliderPageStepSub:
+ setValue (low_m - pageStep_m);
+ break;
+ case SliderToMinimum:
+ setValue (min_m);
+ break;
+ case SliderToMaximum:
+ setValue (max_m);
+ case SliderNoAction:
+ break;
+ };
+
+ emit actionTriggered (action);
+}
+
+
+//------------------------------------------------------------- updateHover ----
+void RangeScrollBar_t::updateHover (const QPoint & pos)
+{
+ //-- The mouse is at pos, update hover info
+
+ if ( pressedControl_m )
+ return;
+
+ QRect old (highlightRect (hoveredControl_m));
+
+ hoveredControl_m = whichControl (pos);
+
+ if ( hoveredControl_m == SC_LowGrip || hoveredControl_m == SC_HighGrip )
+ {
+ if ( IS_HORIZ ) setCursor (QCursor(Qt::SizeHorCursor));
+ else setCursor (QCursor(Qt::SizeVerCursor));
+ }
+ else
+ unsetCursor();
+
+ //update (old | highlightRect (hoveredControl_m));
+}
+
+
+//------------------------------------------------------------- updatePress ----
+void RangeScrollBar_t::updatePress (const QPoint & pos)
+{
+ //-- The mouse was pressed at pos, update press info
+
+ pressedControl_m = whichControl (pos);
+}
+
+
+//------------------------------------------------------------- updateRects ----
+void RangeScrollBar_t::updateRects()
+{
+ //-- Update the control boundaries
+ grooveRect_m =
+ addRect_m =
+ subRect_m =
+ lowRect_m =
+ highRect_m =
+ rangeRect_m = rect();
+
+ if ( IS_HORIZ )
+ {
+ //-- Groove is everything but the page step controls
+ // grooveRect_m.adjust (controlPix_m - 1, 0, - controlPix_m + 1, 0);
+ grooveRect_m.addCoords (controlPix_m - 1, 0, - controlPix_m + 1, 0);
+
+ //-- Minimum and maximum pixel values, groove - grips
+ minPix_m = grooveRect_m.left() + gripPix_m;
+ maxPix_m = grooveRect_m.right() - gripPix_m;
+
+ //-- Range bar, scroll bar between the range grips
+ rangeRect_m.setLeft (val2pix (low_m));
+ rangeRect_m.setRight (val2pix (high_m));
+
+ //-- Low value range grip
+ lowRect_m.setLeft (rangeRect_m.left() - gripPix_m);
+ lowRect_m.setRight (rangeRect_m.left() - 1);
+
+ //-- High value range grip
+ highRect_m.setRight (rangeRect_m.right() + gripPix_m);
+ highRect_m.setLeft (rangeRect_m.right() + 1);
+
+ //-- Page step controls
+ addRect_m.setLeft (grooveRect_m.right());
+ subRect_m.setRight (grooveRect_m.left());
+ }
+ else
+ {
+ //-- Same as above, but left/right replaced with top/bottom
+ //grooveRect_m.adjust (0, controlPix_m - 1, 0, - controlPix_m + 1);
+ grooveRect_m.addCoords (0, controlPix_m - 1, 0, - controlPix_m + 1);
+
+ minPix_m = grooveRect_m.top() + gripPix_m;
+ maxPix_m = grooveRect_m.bottom() - gripPix_m;
+ rangeRect_m.setTop (val2pix (low_m));
+ rangeRect_m.setBottom (val2pix (high_m));
+ lowRect_m.setTop (rangeRect_m.top() - gripPix_m);
+ lowRect_m.setBottom (rangeRect_m.top() - 1);
+ highRect_m.setBottom (rangeRect_m.bottom() + gripPix_m);
+ highRect_m.setTop (rangeRect_m.bottom() + 1);
+ addRect_m.setTop (grooveRect_m.bottom());
+ subRect_m.setBottom (grooveRect_m.top());
+ }
+
+ //-- Slider rect is the union of both range grips and the range bar
+ sliderRect_m = lowRect_m | rangeRect_m | highRect_m;
+}
+
+
+//----------------------------------------------------------------- pix2val ----
+int RangeScrollBar_t::pix2val (int pos) const
+{
+ //-- Convert from a pixel value to a scroll value
+ double frac = (double)(pos - minPix_m) / (maxPix_m - minPix_m);
+ return qRound (frac * (max_m - min_m)) + min_m;
+}
+
+
+//----------------------------------------------------------------- val2pix ----
+int RangeScrollBar_t::val2pix (int pos) const
+{
+ //-- Convert from a scroll value to a pixel value
+ double frac = (double)(pos - min_m) / (max_m - min_m);
+ return qRound (frac * (maxPix_m - minPix_m) + minPix_m);
+}
+
+
+//-------------------------------------------------------------- wheelEvent ----
+void RangeScrollBar_t::wheelEvent (QWheelEvent * e)
+{
+ //-- Turn a mouse wheel event into a scroll event
+ if ( e->orientation() != orientation_m && !rect().contains(e->pos()) )
+ return;
+
+ static double offset = 0;
+ static RangeScrollBar_t * offset_owner = NULL;
+
+ if ( offset_owner != this )
+ {
+ offset_owner = this;
+ offset = 0;
+ }
+
+ //int step = std::min (QApplication::wheelScrollLines() * singleStep_m, pageStep_m);
+ int step = std::min (6 * singleStep_m, pageStep_m);
+
+ /*
+ if ( (e->modifiers() & Qt::ControlModifier) ||
+ (e->modifiers() & Qt::ShiftModifier) )
+ step = pageStep_m;
+ */
+
+ offset += e->delta() * step / 120;
+ offset = -offset;
+
+ if ( offset > -1 && offset < 1 )
+ return;
+
+ setValue (low_m + (int)offset);
+ offset -= int(offset);
+ e->accept();
+}
+
+
+//------------------------------------------------------------ whichControl ----
+int RangeScrollBar_t::whichControl (const QPoint & pos)
+{
+ //-- Return the control containing the point
+ if ( rangeRect_m.contains (pos) )
+ return SC_RangeGrip;
+ else if ( lowRect_m.contains (pos) )
+ return SC_LowGrip;
+ else if ( highRect_m.contains (pos) )
+ return SC_HighGrip;
+ else if ( subRect_m.contains (pos) )
+ return SC_SubStep;
+ else if ( addRect_m.contains (pos) )
+ return SC_AddStep;
+ else if ( grooveRect_m.contains (pos) )
+ return IS_HORIZ ?
+ ( pos.x() < sliderRect_m.x() ? SC_SubPage : SC_AddPage ) :
+ ( pos.y() < sliderRect_m.y() ? SC_SubPage : SC_AddPage );
+ else
+ return SC_None;
+}
diff --git a/src/hawkeye/RangeScrollBar.hh b/src/hawkeye/RangeScrollBar.hh
new file mode 100644
index 0000000..b03037e
--- /dev/null
+++ b/src/hawkeye/RangeScrollBar.hh
@@ -0,0 +1,226 @@
+////////////////////////////////////////////////////////////////////////////////
+//! \file
+//! \author Adam M Phillippy
+//! \date 04/07/2006
+//!
+//! \brief A QScrollBar with an adjustable viewing range
+//!
+////////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef RANGESCROLLBAR_HH
+#define RANGESCROLLBAR_HH
+
+#include <qwidget.h>
+#include <qtimer.h>
+#include <qstyle.h>
+#include <qimage.h>
+//Added by qt3to4:
+#include <QTimerEvent>
+#include <QWheelEvent>
+#include <QPaintEvent>
+#include <QMouseEvent>
+#include <QHideEvent>
+#include <QKeyEvent>
+#include <QEvent>
+//#include <qstyleoptionslider.h>
+
+#include <algorithm>
+
+
+//======================================================== RangeScrollBar_t ====
+class RangeScrollBar_t : public QWidget
+{
+
+ Q_OBJECT
+
+public:
+
+ enum SliderAction {
+ SliderNoAction, //!< no action
+ SliderSingleStepAdd, //!< add single step action
+ SliderSingleStepSub, //!< subtract single step action
+ SliderPageStepAdd, //!< add page action
+ SliderPageStepSub, //!< subtract page action
+ SliderToMinimum, //!< goto minimum action
+ SliderToMaximum //!< goto maximum action
+ };
+
+ RangeScrollBar_t (QWidget * parent = NULL);
+ RangeScrollBar_t (Qt::Orientation, QWidget * parent = NULL);
+ ~RangeScrollBar_t();
+
+ bool event (QEvent * event);
+ int maximum() const;
+ int minimum() const;
+ Qt::Orientation orientation() const;
+ int pageStep() const;
+ void setMaximum (int max);
+ void setMinimum (int min);
+ void setPageStep (int page);
+ void setSingleStep (int step);
+ int singleStep() const;
+ QSize sizeHint() const;
+ void triggerAction (SliderAction action);
+ int value() const;
+ int length() const;
+ int rangeLow() const;
+ int rangeHigh() const;
+
+ int controlPix_m; //!< thickness of groove
+ int gripPix_m; //!< thickness of grip
+
+
+public slots:
+
+ void setMaxRange (int min, int max);
+ void setOrientation (Qt::Orientation);
+ void setRangeLow (int low);
+ void setRangeHigh (int high);
+ void setRange (int low, int high);
+ void setValue (int value);
+
+
+signals:
+
+ void actionTriggered (int action);
+ void maxRangeChanged (int min, int max);
+ void rangeChanged (int low, int high);
+ void valueChanged (int value);
+
+
+protected:
+
+ QRect highlightRect (int control);
+ void setRepeatAction
+ (SliderAction action,
+ int thresholdTime = 500,
+ int repeatTime = 50);
+ void updateHover (const QPoint & pos);
+ void updatePress (const QPoint & pos);
+ void updateRects();
+ int whichControl (const QPoint & pos);
+
+ void changeEvent (QEvent *);
+ void hideEvent (QHideEvent *);
+ void keyPressEvent (QKeyEvent *);
+ void mouseMoveEvent (QMouseEvent *);
+ void mousePressEvent (QMouseEvent *);
+ void mouseReleaseEvent (QMouseEvent *);
+ void paintEvent (QPaintEvent *);
+ void timerEvent (QTimerEvent *);
+ void wheelEvent (QWheelEvent *);
+
+
+private:
+
+ void activateControl (int control, int threshold = 500);
+ void init();
+ int pix2val (int pos) const;
+ int val2pix (int pos) const;
+
+
+ QRect grooveRect_m; //!< slider groove
+ QRect subRect_m; //!< subtract single step button
+ QRect addRect_m; //!< add single step button
+ QRect lowRect_m; //!< low range grip
+ QRect highRect_m; //!< high range grip
+ QRect sliderRect_m; //!< low grip + range grip + high grip
+ QRect rangeRect_m; //!< range grip (between low and high)
+
+
+ int min_m; //!< minimum value
+ int max_m; //!< maximum value
+ int minPix_m; //!< minimum pixel value
+ int maxPix_m; //!< maximum pixel value
+ int low_m; //!< low range value
+ int high_m; //!< high range value
+ int singleStep_m; //!< single step
+ int pageStep_m; //!< page step
+ int pressedControl_m; //!< currently pressed control
+ int hoveredControl_m; //!< currently hovered control
+ int clickOffset_m; //!< click offset from low range value
+
+ Qt::Orientation orientation_m;
+
+ QTimer repeatActionTimer_m;
+ SliderAction repeatAction_m;
+ int repeatActionTime_m;
+
+ enum Control {
+ SC_None, //!< no control
+ SC_AddPage, //!< page add control
+ SC_SubPage, //!< page subtract control
+ SC_AddStep, //!< step add control
+ SC_SubStep, //!< step subtract control
+ SC_FirstPage, //!< goto first page control
+ SC_LastPage, //!< goto last page control
+ SC_LowGrip, //!< low range grip control
+ SC_RangeGrip, //!< range grip control
+ SC_HighGrip //!< high range grip control
+ };
+
+ static const QImage hBarImage_m; //!< horizontal range grip image
+ static const QImage vBarImage_m; //!< vertical range grip image
+ static const QImage hGrooveImage_m; //!< horizontal groove image
+ static const QImage vGrooveImage_m; //!< vertical groove image
+ static const QImage lArrowImage_m; //!< left arrow image
+ static const QImage rArrowImage_m; //!< right arrow image
+ static const QImage uArrowImage_m; //!< up arrow image
+ static const QImage dArrowImage_m; //!< down arrow image
+ static const QImage lGripImage_m; //!< left grip image
+ static const QImage rGripImage_m; //!< right grip image
+ static const QImage uGripImage_m; //!< up grip image
+ static const QImage dGripImage_m; //!< down grip image
+};
+
+
+
+//================================================================= Inlines ====
+//-------------------------------------------------------- RangeScrollBar_t ----
+inline int RangeScrollBar_t::maximum() const
+{ return max_m; }
+
+inline int RangeScrollBar_t::minimum() const
+{ return min_m; }
+
+inline Qt::Orientation RangeScrollBar_t::orientation() const
+{ return orientation_m; }
+
+inline int RangeScrollBar_t::pageStep() const
+{ return pageStep_m; }
+
+inline void RangeScrollBar_t::setMaximum (int max)
+{ setMaxRange (std::min (min_m, max), max); }
+
+inline void RangeScrollBar_t::setMinimum (int min)
+{ setMaxRange (min, std::max (max_m, min)); }
+
+inline void RangeScrollBar_t::setPageStep (int page)
+{ pageStep_m = abs (page); update(); }
+
+inline void RangeScrollBar_t::setSingleStep (int step)
+{ singleStep_m = abs (step); update(); }
+
+inline void RangeScrollBar_t::setRangeLow (int low)
+{ if ( low > high_m ) low = high_m; setRange (low, high_m); }
+
+inline void RangeScrollBar_t::setRangeHigh (int high)
+{ if ( high < low_m ) high = low_m; setRange (low_m, high); }
+
+inline int RangeScrollBar_t::singleStep() const
+{ return singleStep_m; }
+
+inline int RangeScrollBar_t::value() const
+{ return low_m; }
+
+inline int RangeScrollBar_t::length() const
+{ return high_m - low_m; }
+
+inline int RangeScrollBar_t::rangeLow() const
+{ return low_m; }
+
+inline int RangeScrollBar_t::rangeHigh() const
+{ return high_m; }
+
+#endif // RANGESCROLLBAR_HH
diff --git a/src/hawkeye/ReadInfo.cc b/src/hawkeye/ReadInfo.cc
new file mode 100644
index 0000000..682941b
--- /dev/null
+++ b/src/hawkeye/ReadInfo.cc
@@ -0,0 +1,51 @@
+#include "ReadInfo.hh"
+#include <qlabel.h>
+#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3Frame>
+#include <Q3BoxLayout>
+#include "ChromoField.hh"
+#include "RenderSeq.hh"
+
+
+
+using namespace std;
+
+ReadInfo::ReadInfo(RenderSeq_t * read,
+ const string & cons,
+ const string & cstatus,
+ QWidget*parent,
+ const char * name)
+ : QDialog(parent, name),
+ m_read(*read)
+{
+ resize(1000,256);
+
+ Q3BoxLayout * layout = new Q3VBoxLayout(this);
+
+ QString s = QString(" \"")
+ + m_read.m_read.getEID().c_str() + "\" {"
+ + QString::number(m_read.m_read.getIID()) + "}";
+
+ QLabel *label = new QLabel( this );
+ label->setFrameStyle( Q3Frame::Panel | Q3Frame::Sunken );
+ label->setMaximumHeight(20);
+ label->setText(s);
+ label->setAlignment( Qt::AlignTop | Qt::AlignLeft );
+
+ m_sv = new Q3ScrollView(this, "scroll");
+ layout->addWidget(label);
+ layout->addWidget(m_sv);
+
+ m_chromo = new ChromoField(&m_read, cons, cstatus, m_sv->viewport(), "chromo");
+ m_sv->addChild(m_chromo);
+}
+
+void ReadInfo::setTilingVisibleRange(int contigid, int grangeStart, int grangeEnd)
+{
+ // TODO:: Assume contigid is current
+ int pos = m_chromo->getWindowPos((int) ((grangeStart+grangeEnd)/2));
+ m_sv->center(pos, 0);
+}
+
diff --git a/src/hawkeye/ReadInfo.hh b/src/hawkeye/ReadInfo.hh
new file mode 100644
index 0000000..fb09b5a
--- /dev/null
+++ b/src/hawkeye/ReadInfo.hh
@@ -0,0 +1,31 @@
+#ifndef READINFO_HH_
+#define READINFO_HH_ 1
+
+#include <qdialog.h>
+#include <string>
+#include <q3scrollview.h>
+#include "RenderSeq.hh"
+
+class ChromoField;
+
+class ReadInfo: public QDialog
+{
+ Q_OBJECT
+
+public:
+ ReadInfo(RenderSeq_t * read,
+ const std::string & cons,
+ const std::string & cstatus,
+ QWidget * parent=0,
+ const char *name=0);
+
+public slots:
+ void setTilingVisibleRange(int contigid, int grangeStart, int grangeEnd);
+
+private:
+ Q3ScrollView * m_sv;
+ ChromoField * m_chromo;
+ RenderSeq_t m_read;
+};
+
+#endif
diff --git a/src/hawkeye/ReadPicker.cc b/src/hawkeye/ReadPicker.cc
new file mode 100644
index 0000000..54157eb
--- /dev/null
+++ b/src/hawkeye/ReadPicker.cc
@@ -0,0 +1,250 @@
+#include "LaunchPad.hh"
+#include <qcursor.h>
+#include <qstatusbar.h>
+#include <qmenubar.h>
+
+#include <qlabel.h>
+#include <qlineedit.h>
+
+#include "foundation_AMOS.hh"
+#include "HistogramWindow.hh"
+#include "amp.hh"
+
+#include <vector>
+
+using namespace std;
+
+
+
+class ReadListItem : public Q3ListViewItem
+{
+public:
+ ReadListItem(Q3ListView * parent,
+ QString iid,
+ QString eid,
+ QString type,
+ QString matetype,
+ QString offset,
+ QString endoffset,
+ QString len,
+ QString dir,
+ QString seql,
+ QString seqr,
+ QString libid,
+ QString gccontent)
+
+ : Q3ListViewItem(parent, iid, eid, type, matetype, offset, endoffset, len, dir)
+ {
+ setText(8, seql);
+ setText(9, seqr);
+ setText(10, libid);
+ setText(11, gccontent);
+ }
+
+
+ int compare(Q3ListViewItem *i, int col,
+ bool ascending ) const
+ {
+ if (col == 11)
+ {
+ double diff = atof(key(col,ascending)) - atof(i->key(col,ascending));
+ if (diff < 0) { return -1; }
+ else if (diff > 0) { return 1;}
+ return 0;
+ }
+ else if (col == 1 || col == 2 || col==3 || col == 7)
+ {
+ return key(col,ascending).compare(i->key(col,ascending));
+ }
+
+ return atoi(key(col,ascending)) - atoi(i->key(col,ascending));
+ }
+};
+
+
+void LaunchPad::initReads()
+{
+ connect(readList, SIGNAL(doubleClicked(Q3ListViewItem *)),
+ this, SLOT(readSelected(Q3ListViewItem *)));
+
+ connect(readList, SIGNAL(returnPressed(Q3ListViewItem *)),
+ this, SLOT(readSelected(Q3ListViewItem *)));
+
+ connect(readIIDEdit, SIGNAL(textChanged(const QString &)),
+ this, SLOT(readSelectIID(const QString &)));
+
+ connect(readEIDEdit, SIGNAL(textChanged(const QString &)),
+ this, SLOT(readSelectEID(const QString &)));
+
+ connect(readEIDEdit, SIGNAL(returnPressed()),
+ this, SLOT(readViewSelected()));
+
+ connect(readIIDEdit, SIGNAL(returnPressed()),
+ this, SLOT(readViewSelected()));
+
+ connect(readLengthButton, SIGNAL(clicked()),
+ this, SLOT(readLengthHistogram()));
+
+ connect(readGCButton, SIGNAL(clicked()),
+ this, SLOT(readGCHistogram()));
+
+
+
+ readList->addColumn("IID");
+ readList->addColumn("EID");
+ readList->addColumn("Type");
+ readList->addColumn("MateType");
+ readList->addColumn("Offset");
+ readList->addColumn("End Offset");
+ readList->addColumn("Length");
+ readList->addColumn("Dir");
+ readList->addColumn("CLR Begin");
+ readList->addColumn("CLR End");
+ readList->addColumn("Lib ID");
+ readList->addColumn("GC Content");
+}
+
+void LaunchPad::loadReads()
+{
+ EventTime_t timer;
+ if (m_verbose) { cerr << "Loading reads..."; }
+
+ QCursor orig = cursor();
+ setCursor(Qt::waitCursor);
+
+ readList->clear();
+
+ try
+ {
+ QString status = "Select from " ;
+ status += QString::number(m_datastore->m_contig.getReadTiling().size())
+ + " reads";
+ statusBar()->message(status);
+
+ vector<AMOS::Tile_t>::iterator ti;
+ for (ti = m_datastore->m_contig.getReadTiling().begin();
+ ti != m_datastore->m_contig.getReadTiling().end();
+ ti++)
+ {
+ AMOS::ID_t libid = m_datastore->getLibrary(ti->source);
+ AMOS::Distribution_t dist = m_datastore->getLibrarySize(libid);
+
+ AMOS::Read_t red;
+ m_datastore->fetchReadIID(ti->source, red);
+
+ double gccontent = red.getGCContent(red.getClearRange());
+
+ char type = red.getType();
+ if (type == 0) { type = '?'; }
+
+ DataStore::MateInfo_t mates = m_datastore->getMatePair(ti->source);
+
+ char mateType = '?';
+ if ((mates.first != 0) && (mates.second != 0))
+ {
+ mateType = mates.second;
+ }
+
+ int len = ti->range.getLength() + ti->gaps.size();
+ new ReadListItem(readList,
+ QString::number(ti->source),
+ red.getEID().c_str(),
+ QString(QChar(type)),
+ QString(QChar(mateType)),
+ QString::number(ti->offset),
+ QString::number(ti->offset + len - 1),
+ QString::number(len),
+ ((ti->range.isReverse())?"R":"F"),
+ QString::number(ti->range.begin),
+ QString::number(ti->range.end),
+ QString::number(libid),
+ QString::number(gccontent, 'f', 4));
+ }
+ }
+ catch (AMOS::Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ }
+
+ readList->setSorting(4, true);
+
+ setCursor(orig);
+
+ if (m_verbose) { cerr << " " << timer.str() << endl; }
+}
+
+void LaunchPad::readSelected(Q3ListViewItem * item)
+{
+ emit highlightRead(atoi(item->text(0)));
+ setGindex(atoi(item->text(4)));
+}
+
+void LaunchPad::readSelectIID(const QString & iid)
+{
+ Q3ListViewItem * item = readList->findItem(iid, 0);
+ if (item)
+ {
+ readList->setSelected(item, true);
+ readList->ensureItemVisible(item);
+ }
+}
+
+void LaunchPad::readSelectEID(const QString & eid)
+{
+ Q3ListViewItem * item = readList->findItem(eid, 1);
+ if (item)
+ {
+ readList->setSelected(item, true);
+ readList->ensureItemVisible(item);
+ }
+}
+
+void LaunchPad::readViewSelected()
+{
+ Q3ListViewItem * item = readList->selectedItem();
+ if (item)
+ {
+ readSelected(item);
+ }
+}
+
+
+void LaunchPad::readLengthHistogram()
+{
+ char buffer[16];
+ sprintf(buffer, "%d", m_datastore->m_contigId);
+
+ InsertStats * stats = new InsertStats((string)"Clear Range Length Histogram for Contig " + buffer);
+
+ vector<AMOS::Tile_t>::iterator ti;
+ for (ti = m_datastore->m_contig.getReadTiling().begin();
+ ti != m_datastore->m_contig.getReadTiling().end();
+ ti++)
+ {
+ stats->addSize(ti->range.getLength());
+ }
+
+ new HistogramWindow(stats, this, "hist");
+}
+
+void LaunchPad::readGCHistogram()
+{
+ char buffer[16];
+ sprintf(buffer, "%d", m_datastore->m_contigId);
+
+ InsertStats * stats = new InsertStats((string)"Read GC Content Histogram for Contig " + buffer);
+
+ vector<AMOS::Tile_t>::iterator ti;
+ for (ti = m_datastore->m_contig.getReadTiling().begin();
+ ti != m_datastore->m_contig.getReadTiling().end();
+ ti++)
+ {
+ AMOS::Read_t red;
+ m_datastore->fetchReadIID(ti->source, red);
+
+ stats->addSize(red.getGCContent(red.getClearRange()));
+ }
+
+ new HistogramWindow(stats, this, "hist");
+}
+
diff --git a/src/hawkeye/ReadPicker.hh b/src/hawkeye/ReadPicker.hh
new file mode 100644
index 0000000..1ff83e5
--- /dev/null
+++ b/src/hawkeye/ReadPicker.hh
@@ -0,0 +1,6 @@
+#ifndef READ_PICKER_HH__
+#define READ_PICKER_HH__ 1
+
+#include "LaunchPad.hh"
+
+#endif
diff --git a/src/hawkeye/RenderSeq.cc b/src/hawkeye/RenderSeq.cc
new file mode 100644
index 0000000..9c4935b
--- /dev/null
+++ b/src/hawkeye/RenderSeq.cc
@@ -0,0 +1,344 @@
+#include "RenderSeq.hh"
+
+#include "DataStore.hh"
+#include "ChromoStore.hh"
+
+using namespace std;
+using namespace AMOS;
+
+RenderSeq_t::RenderSeq_t()
+{
+ m_trace = NULL;
+ m_displayTrace = false;
+ m_displaystart = 0;
+ m_displayend = 0;
+ bgcolor = ' ';
+}
+
+RenderSeq_t::~RenderSeq_t()
+{ }
+
+
+char RenderSeq_t::base(Pos_t gindex, bool outsideclr, Pos_t conslen) const
+{
+ int leftboundary = m_loffset;
+ int rightboundary = m_roffset;
+
+ if (outsideclr)
+ {
+ leftboundary = m_lfoffset;
+ rightboundary = m_rfoffset;
+ }
+
+ if (conslen != -1 && m_roffset >= conslen)
+ {
+ // read is circular
+
+ if (gindex < m_loffset)
+ {
+ gindex += conslen;
+ }
+ }
+
+ if (gindex < leftboundary || gindex > rightboundary)
+ {
+ return ' ';
+ }
+ else
+ {
+ return m_bases[gindex - m_loffset + m_rangebegin];
+ }
+}
+
+void RenderSeq_t::getBases(string & alignedBases, Pos_t grangeStart, Pos_t grangeEnd)
+{
+ alignedBases.erase();
+
+ int gindex;
+
+ // Initialize string with spaces
+ if (grangeStart < m_loffset)
+ {
+ for (gindex = grangeStart;
+ gindex < m_loffset && gindex <= grangeEnd;
+ gindex++)
+ {
+ alignedBases += ' ';
+ }
+
+ grangeStart = m_loffset;
+ }
+
+
+ // Now incorporate the bases
+ for (gindex = grangeStart;
+ gindex <= m_roffset && gindex <= grangeEnd;
+ gindex++)
+ {
+ alignedBases += m_bases[gindex-m_loffset + m_rangebegin];
+ }
+
+ // Trailing spaces
+ for (gindex = m_roffset+1; gindex <= grangeEnd; gindex++)
+ {
+ alignedBases += ' ';
+ }
+
+}
+
+int RenderSeq_t::qv(Pos_t gindex, bool outsideclr, Pos_t conslen) const
+{
+ int leftboundary = m_loffset;
+ int rightboundary = m_roffset;
+
+ if (outsideclr)
+ {
+ leftboundary = m_lfoffset;
+ rightboundary = m_rfoffset;
+ }
+
+ if (conslen != -1 && m_roffset >= conslen)
+ {
+ // read is circular
+
+ if (gindex < m_loffset)
+ {
+ gindex += conslen;
+ }
+ }
+
+ if (gindex < leftboundary || gindex > rightboundary)
+ {
+ return -1;
+ }
+ else
+ {
+ return m_quals[gindex - m_loffset + m_rangebegin] - AMOS::MIN_QUALITY;
+ }
+}
+
+int RenderSeq_t::pos(Pos_t gindex, bool outsideclr, Pos_t conslen) const
+{
+ int leftboundary = m_loffset;
+ int rightboundary = m_roffset;
+
+ if (outsideclr)
+ {
+ leftboundary = m_lfoffset;
+ rightboundary = m_rfoffset;
+ }
+
+ if (conslen != -1 && m_roffset >= conslen)
+ {
+ // read is circular
+
+ if (gindex < m_loffset)
+ {
+ gindex += conslen;
+ }
+ }
+
+
+ if (gindex < leftboundary)
+ {
+ return m_pos[m_rangebegin];
+ }
+ else if (gindex > rightboundary)
+ {
+ return m_pos[m_rangeend];
+ }
+ else
+ {
+ return m_pos[gindex - m_loffset + m_rangebegin];
+ }
+}
+
+Pos_t RenderSeq_t::getGindex(Pos_t gseqpos) const
+{
+ Pos_t gindex = 0;
+ int seqoffset;
+
+ if (m_rc)
+ {
+ // compute distance to right aligned position
+ seqoffset = gseqpos - m_tile->range.end;
+ gindex = m_roffset-seqoffset;
+ }
+ else
+ {
+ // compute distance to left aligned position
+ seqoffset = gseqpos - m_tile->range.begin;
+ gindex = m_loffset + seqoffset;
+ }
+
+ return gindex;
+}
+
+void RenderSeq_t::load(DataStore * datastore, Tile_t * tile)
+{
+ m_tile = tile;
+ datastore->fetchReadIID(tile->source, m_read);
+
+ m_loffset = tile->offset;
+ m_roffset = tile->offset + tile->getGappedLength() - 1;
+
+ m_rc = tile->range.isReverse();
+ m_rangebegin = m_tile->range.begin;
+
+ // Render the full gapped sequence
+ m_bases = m_read.getSeqString();
+ m_quals = m_read.getQualString();
+
+ if (m_rc)
+ {
+ m_rangebegin = m_bases.length() - m_tile->range.begin;
+
+ Reverse_Complement(m_bases);
+ reverse(m_quals.begin(), m_quals.end());
+ }
+
+ // last aligned base is the first plus the gapped aligned range
+ m_rangeend = m_rangebegin + m_tile->getGappedLength() -1;
+
+ vector<Pos_t>::const_iterator lastgap = m_tile->gaps.end();
+
+ // Insert gaps
+ Pos_t gapcount;
+ vector<Pos_t>::const_iterator g;
+ for (g = m_tile->gaps.begin(), gapcount = 0;
+ g != lastgap;
+ g++, gapcount++)
+ {
+ unsigned int gappos = *g+gapcount+m_rangebegin;
+ m_bases.insert(gappos, 1, '-');
+
+ // qv of a gap is the min of the flanking values
+ char lqv = (gappos > 0) ? m_quals[gappos-1] : -1;
+ char rqv = (gappos < m_quals.size()) ? m_quals[gappos] : -1;
+ char gapqv = (lqv < rqv)
+ ? (lqv != -1) ? lqv : rqv
+ : (rqv != -1) ? rqv : lqv;
+
+ m_quals.insert(gappos, 1, gapqv);
+ }
+
+ m_lfoffset = m_loffset - m_rangebegin;
+ m_rfoffset = m_lfoffset + m_bases.size() - 1;
+}
+
+bool RenderSeq_t::hasOverlap(Pos_t rangeStart, // 0-based exact offset of range
+ Pos_t rangeEnd, // 0-based exact end of range
+ Pos_t seqOffset, // 0-bases exact offset of seq
+ Pos_t seqLen, // count of bases of seq (seqend+1)
+ Pos_t contigLen) // count of bases in contig (contigend+1)
+{
+ int retval = 1;
+
+ if (seqOffset + seqLen > contigLen)
+ {
+ // wraps around right edge.
+ seqOffset = seqOffset - contigLen;
+ }
+
+ if (seqOffset >= (Pos_t) 0)
+ {
+ if ((seqOffset > rangeEnd) // sequence right flanks
+ || (seqOffset + seqLen-1 < rangeStart)) // sequence left flanks
+ {
+ retval = 0;
+ }
+ }
+ else
+ {
+ // Negative Offset, test left and right separately
+ retval = hasOverlap(rangeStart, rangeEnd,
+ 0, seqLen+seqOffset, contigLen) ||
+ hasOverlap(rangeStart, rangeEnd,
+ contigLen+seqOffset, -seqOffset, contigLen);
+ }
+
+ return retval;
+}
+
+void RenderSeq_t::loadTrace()
+{
+ if (m_trace) { return; }
+
+ ChromoStore * chromostore = ChromoStore::Instance();
+
+ m_pos = m_read.getBasePositions();
+ cerr << "Load Positions [" << m_pos.size() << "] ";
+ if (m_pos.empty()) { cerr << "(load from trace)"; }
+
+ cerr << " load trace" << endl;
+ m_trace = chromostore->fetchTrace(m_read, m_pos);
+ if (!m_trace) { cerr << "Trace Not Found" << endl; return; }
+ if (m_pos.empty()) { cerr << "Trace Positions Not Available" << endl; return; }
+
+ if (m_rc)
+ {
+ reverse(m_pos.begin(), m_pos.end());
+
+#if RC_TRACE
+ vector<int16_t>::iterator p;
+ for (p = m_pos.begin(); p != m_pos.end(); p++)
+ {
+ *p = m_trace->NPoints - *p;
+ }
+#endif
+ }
+
+ // Insert gaps
+ Pos_t gapcount;
+ vector<Pos_t>::const_iterator g;
+ for (g = m_tile->gaps.begin(), gapcount = 0;
+ g != m_tile->gaps.end();
+ g++, gapcount++)
+ {
+ int gappos = *g+gapcount+m_rangebegin;
+
+ int left = m_pos[gappos-1];
+ int right = m_pos[gappos];
+
+ m_pos.insert(m_pos.begin()+gappos, 1, (left+right)/2);
+ }
+
+ if (m_pos.size() != m_quals.size())
+ {
+ cerr << "Warning for eid: " << m_read.getEID() << " iid: " << m_read.getIID() << endl;
+ cerr << "m_pos.size()=" << m_pos.size() << " m_quals.size()=" << m_quals.size() << endl;
+ }
+
+}
+
+int RenderSeq_t::getGSeqPos(int gindex)
+{
+ int gseqpos;
+
+ if (m_rc)
+ {
+ int distance = m_roffset - gindex;
+ gseqpos = m_tile->range.end + distance;
+ }
+ else
+ {
+ int distance = gindex - m_loffset;
+ gseqpos = m_tile->range.begin + distance;
+ }
+
+ if (gseqpos < 0) { gseqpos = 0; }
+ else if (gseqpos >= (int) m_pos.size()) { gseqpos = m_pos.size()-1; }
+
+ return gseqpos;
+}
+
+Pos_t RenderSeq_t::gappedLen() const
+{
+ if (!m_tile) { cerr << "m_tile is NULL!" << endl; return -1;}
+ return m_tile->range.getLength() + m_tile->gaps.size();
+}
+
+Pos_t RenderSeq_t::fullLen() const
+{
+ return m_bases.size();
+}
diff --git a/src/hawkeye/RenderSeq.hh b/src/hawkeye/RenderSeq.hh
new file mode 100644
index 0000000..ca1ffdf
--- /dev/null
+++ b/src/hawkeye/RenderSeq.hh
@@ -0,0 +1,71 @@
+#ifndef RENDERSEQ_H
+#define RENDERSEQ_H
+
+#include <algorithm>
+
+#include "foundation_AMOS.hh"
+#include "amp.hh"
+#include "fasta.hh"
+
+class DataStore;
+
+class RenderSeq_t
+{
+
+public:
+ RenderSeq_t();
+ ~RenderSeq_t();
+
+ void load(DataStore * datastore, AMOS::Tile_t * tile);
+ void loadTrace();
+
+ char base(AMOS::Pos_t gindex, bool outsideclr = false, AMOS::Pos_t conslen=-1) const;
+ int qv(AMOS::Pos_t gindex, bool outsideclr = false, AMOS::Pos_t conslen=-1) const;
+ int pos(AMOS::Pos_t gindex, bool outsideclr = false, AMOS::Pos_t conslen=-1) const;
+
+ void getBases(std::string & alignedBases,
+ AMOS::Pos_t grangeStart,
+ AMOS::Pos_t grangeEnd);
+
+ int getGSeqPos(int gindex);
+ AMOS::Pos_t getGindex(AMOS::Pos_t seqpos) const;
+ AMOS::Pos_t gappedLen() const;
+ AMOS::Pos_t fullLen() const;
+
+ // Tiling Specific
+ int m_displaystart;
+ int m_displayend;
+
+ int m_loffset;
+ int m_roffset;
+
+ char bgcolor;
+
+ // Projected left and right offsets to full range sequence
+ int m_lfoffset;
+ int m_rfoffset;
+
+ // full gapped sequence contig oriented
+ std::string m_bases;
+ std::string m_quals;
+ std::vector<int16_t> m_pos;
+
+ int m_rangebegin; // first aligned base of m_bases
+ int m_rangeend; // last aligned base of m_bases
+
+ bool m_rc;
+ AMOS::Read_t m_read;
+ AMOS::Tile_t * m_tile;
+
+ char * m_trace;
+ bool m_displayTrace;
+
+ static bool hasOverlap(AMOS::Pos_t rangeStart, // 0-based exact offset of range
+ AMOS::Pos_t rangeEnd, // 0-based exact end of range
+ AMOS::Pos_t seqOffset, // 0-bases exact offset of seq
+ AMOS::Pos_t seqLen, // count of bases of seq (seqend+1)
+ AMOS::Pos_t contigLen); // count of bases in contig (contigend+1)
+
+};
+
+#endif
diff --git a/src/hawkeye/ScaffoldPicker.cc b/src/hawkeye/ScaffoldPicker.cc
new file mode 100644
index 0000000..5b83dd6
--- /dev/null
+++ b/src/hawkeye/ScaffoldPicker.cc
@@ -0,0 +1,250 @@
+#include "ScaffoldPicker.hh"
+#include <qcursor.h>
+#include <qstatusbar.h>
+
+#include <qlabel.h>
+#include <q3toolbar.h>
+#include <qlineedit.h>
+#include <qmenubar.h>
+
+#include "foundation_AMOS.hh"
+#include "RenderSeq.hh"
+#include "DataStore.hh"
+
+#include "InsertStats.hh"
+#include "NChartStats.hh"
+#include "HistogramWindow.hh"
+#include "NChartWindow.hh"
+#include "amp.hh"
+
+
+#include <vector>
+
+using namespace std;
+using namespace AMOS;
+
+
+
+class ScaffoldListItem : public Q3ListViewItem
+{
+public:
+
+ ScaffoldListItem(Q3ListView * parent,
+ QString id,
+ QString iid,
+ QString eid,
+ QString span,
+ QString bases,
+ QString offset)
+
+ : Q3ListViewItem(parent, id, iid, eid, span, bases, offset) {}
+
+ ScaffoldListItem(ScaffoldListItem * parent,
+ QString id,
+ QString iid,
+ QString eid,
+ QString span,
+ QString bases,
+ QString offset)
+
+ : Q3ListViewItem(parent, id, iid, eid, span, bases, offset) {}
+
+ int compare(Q3ListViewItem *i, int col,
+ bool ascending ) const
+ {
+ if (col == 2)
+ {
+ return key(col,ascending).compare(i->key(col,ascending));
+ }
+
+ return atoi(key(col,ascending)) - atoi(i->key(col,ascending));
+ }
+};
+
+
+void LaunchPad::initScaffolds()
+{
+ connect(scaffoldList, SIGNAL(doubleClicked(Q3ListViewItem *)),
+ this, SLOT(scaffoldSelected(Q3ListViewItem *)));
+
+ connect(scaffoldList, SIGNAL(returnPressed(Q3ListViewItem *)),
+ this, SLOT(scaffoldSelected(Q3ListViewItem *)));
+
+ connect(scaffoldIIDEdit, SIGNAL(textChanged(const QString &)),
+ this, SLOT(scaffoldSelectIID(const QString &)));
+
+ connect(scaffoldEIDEdit, SIGNAL(textChanged(const QString &)),
+ this, SLOT(scaffoldSelectEID(const QString &)));
+
+ connect(scaffoldIIDEdit, SIGNAL(returnPressed()),
+ this, SLOT(scaffoldViewSelected()));
+
+ connect(scaffoldEIDEdit, SIGNAL(returnPressed()),
+ this, SLOT(scaffoldViewSelected()));
+
+ connect(scaffoldSpanButton, SIGNAL(clicked()),
+ this, SLOT(scaffoldSpanHistogram()));
+
+ connect(scaffoldContigsButton, SIGNAL(clicked()),
+ this, SLOT(scaffoldContigHistogram()));
+}
+
+void LaunchPad::loadScaffolds()
+{
+ EventTime_t timer;
+ if (m_verbose) { cerr << "Loading Scaffolds..."; }
+
+ scaffoldList->clear();
+ int c = scaffoldList->columns();
+ for (int i = 0; i < c; i++)
+ {
+ scaffoldList->removeColumn(0);
+ }
+
+ scaffoldList->addColumn("Id");
+ scaffoldList->addColumn("IID");
+ scaffoldList->addColumn("EID");
+ scaffoldList->addColumn("Span");
+ scaffoldList->addColumn("Bases/Offset");
+ scaffoldList->addColumn("Contigs/Orientation");
+
+ if (!m_datastore->scaffold_bank.isOpen())
+ {
+ QString status = "Scaffold Information not available";
+ statusBar()->message(status);
+ return;
+ }
+
+ QCursor orig = cursor();
+ setCursor(Qt::waitCursor);
+
+ try
+ {
+ AMOS::Contig_t contig;
+ AMOS::Scaffold_t scaffold;
+
+ QString status = "Select from " +
+ QString::number(m_datastore->scaffold_bank.getSize()) +
+ " scaffolds in " + m_datastore->m_bankname.c_str();
+ statusBar()->message(status);
+
+ int scaffid = 1;
+ m_datastore->scaffold_bank.seekg(1);
+ while (m_datastore->scaffold_bank >> scaffold)
+ {
+ int span = scaffold.getSpan();
+ int numcontigs = scaffold.getContigTiling().size();
+ int bases = 0;
+
+ vector<AMOS::Tile_t> & ctiling = scaffold.getContigTiling();
+
+ vector<AMOS::Tile_t>::iterator ti;
+ for (ti = ctiling.begin();
+ ti != ctiling.end();
+ ti++)
+ {
+ bases += ti->range.getLength();
+ }
+
+ ScaffoldListItem * scaffolditem;
+
+ scaffolditem = new ScaffoldListItem(scaffoldList,
+ QString::number(scaffid),
+ QString::number(scaffold.getIID()),
+ QString(scaffold.getEID().c_str()),
+ QString::number(span),
+ QString::number(bases),
+ QString::number(numcontigs));
+
+ scaffid++;
+
+ for (ti = ctiling.begin();
+ ti != ctiling.end();
+ ti++)
+ {
+ QString oo = ti->range.isReverse() ? "EB" : "BE";
+ new ScaffoldListItem(scaffolditem,
+ QString::number(m_datastore->contig_bank.getIDMap().lookupBID(ti->source)),
+ QString::number(ti->source),
+ QString(m_datastore->contig_bank.lookupEID(ti->source).c_str()),
+ QString::number(ti->range.getLength()),
+ QString::number(ti->offset),
+ oo);
+ }
+ }
+ }
+ catch (AMOS::Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ }
+
+ scaffoldList->setSorting(3, false);
+
+ scaffoldList->setColumnWidth(2, (int)(scaffoldList->columnWidth(2)*1.2));
+
+ setCursor(orig);
+ if (m_verbose) { cerr << " " << timer.str() << endl; }
+}
+
+void LaunchPad::scaffoldSelected(Q3ListViewItem * item)
+{
+ if (item->parent())
+ {
+ setContigId(atoi(item->text(0)));
+ }
+ else
+ {
+ setScaffoldId(atoi(item->text(0)));
+ }
+}
+
+void LaunchPad::scaffoldSelectIID(const QString & iid)
+{
+ Q3ListViewItem * item = scaffoldList->findItem(iid, 1);
+ if (item)
+ {
+ scaffoldList->setSelected(item, true);
+ scaffoldList->ensureItemVisible(item);
+ }
+}
+
+void LaunchPad::scaffoldSelectEID(const QString & eid)
+{
+ Q3ListViewItem * item = scaffoldList->findItem(eid, 2);
+ if (item)
+ {
+ scaffoldList->setSelected(item, true);
+ scaffoldList->ensureItemVisible(item);
+ }
+}
+
+void LaunchPad::scaffoldViewSelected()
+{
+ Q3ListViewItem * item = scaffoldList->selectedItem();
+ if (item)
+ {
+ scaffoldSelected(item);
+ }
+}
+
+
+void LaunchPad::scaffoldSpanHistogram()
+{
+ NChartStats * stats = new NChartStats(*m_scaffstats);
+ new NChartWindow(stats, this, "hist");
+}
+
+void LaunchPad::scaffoldContigHistogram()
+{
+ InsertStats * stats = new InsertStats((string)"Scaffold Contig Count Histogram");
+
+ AMOS::Scaffold_t scaffold;
+ m_datastore->scaffold_bank.seekg(1);
+ while (m_datastore->scaffold_bank >> scaffold)
+ {
+ stats->addSize(scaffold.getContigTiling().size());
+ }
+
+ new HistogramWindow(stats, this, "hist");
+}
+
diff --git a/src/hawkeye/ScaffoldPicker.hh b/src/hawkeye/ScaffoldPicker.hh
new file mode 100644
index 0000000..387608e
--- /dev/null
+++ b/src/hawkeye/ScaffoldPicker.hh
@@ -0,0 +1,6 @@
+#ifndef SCAFFOLD_PICKER_HH__
+#define SCAFFOLD_PICKER_HH__ 1
+
+#include "LaunchPad.hh"
+
+#endif
diff --git a/src/hawkeye/SelectionWidget.cc b/src/hawkeye/SelectionWidget.cc
new file mode 100644
index 0000000..9031be4
--- /dev/null
+++ b/src/hawkeye/SelectionWidget.cc
@@ -0,0 +1,101 @@
+
+#include "SelectionWidget.hh"
+
+#include <qvariant.h>
+#include <qpushbutton.h>
+#include <q3groupbox.h>
+#include <qtoolbutton.h>
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <q3whatsthis.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+
+/*
+ * Constructs a SelectionWidget as a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ */
+SelectionWidget::SelectionWidget( QWidget* parent, const char* name, Qt::WFlags fl )
+ : QWidget( parent, name, fl )
+{
+ if ( !name )
+ setName( "SelectionWidget" );
+ SelectionWidgetLayout = new Q3GridLayout( this, 1, 1, 0, 0, "SelectionWidgetLayout");
+
+ groupBox7 = new Q3GroupBox( this, "groupBox7" );
+ groupBox7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, groupBox7->sizePolicy().hasHeightForWidth() ) );
+ groupBox7->setColumnLayout(0, Qt::Vertical );
+ groupBox7->layout()->setSpacing( 2 );
+ groupBox7->layout()->setMargin( 2 );
+ groupBox7Layout = new Q3GridLayout( groupBox7->layout() );
+ groupBox7Layout->setAlignment( Qt::AlignTop );
+
+ zoomInButton = new QToolButton( groupBox7, "zoomInButton" );
+ zoomInButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, zoomInButton->sizePolicy().hasHeightForWidth() ) );
+ zoomInButton->setMinimumSize( QSize( 25, 25 ) );
+ zoomInButton->setMaximumSize( QSize( 25, 25 ) );
+ zoomInButton->setToggleButton( TRUE );
+
+ groupBox7Layout->addWidget( zoomInButton, 0, 2 );
+
+ zoomOutButton = new QToolButton( groupBox7, "zoomOutButton" );
+ zoomOutButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, zoomOutButton->sizePolicy().hasHeightForWidth() ) );
+ zoomOutButton->setMinimumSize( QSize( 25, 25 ) );
+ zoomOutButton->setMaximumSize( QSize( 25, 25 ) );
+ zoomOutButton->setToggleButton( TRUE );
+
+ groupBox7Layout->addWidget( zoomOutButton, 0, 3 );
+
+ syncWithTilingButton = new QCheckBox( groupBox7, "syncWithTilingButton" );
+ syncWithTilingButton->setChecked( TRUE );
+
+ groupBox7Layout->addWidget( syncWithTilingButton, 0, 5 );
+ spacer2_2 = new QSpacerItem( 30, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ groupBox7Layout->addItem( spacer2_2, 0, 6 );
+
+ selectButton = new QToolButton( groupBox7, "selectButton" );
+ selectButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, selectButton->sizePolicy().hasHeightForWidth() ) );
+ selectButton->setMinimumSize( QSize( 25, 25 ) );
+ selectButton->setMaximumSize( QSize( 25, 25 ) );
+ selectButton->setToggleButton( TRUE );
+ selectButton->setOn( TRUE );
+
+ groupBox7Layout->addWidget( selectButton, 0, 1 );
+ spacer2 = new QSpacerItem( 16, 20, QSizePolicy::Fixed, QSizePolicy::Minimum );
+ groupBox7Layout->addItem( spacer2, 0, 4 );
+ spacer2_3 = new QSpacerItem( 16, 20, QSizePolicy::Fixed, QSizePolicy::Minimum );
+ groupBox7Layout->addItem( spacer2_3, 0, 0 );
+
+ SelectionWidgetLayout->addWidget( groupBox7, 0, 0 );
+ languageChange();
+ resize( QSize(347, 47).expandedTo(minimumSizeHint()) );
+ //clearWState( WState_Polished );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+SelectionWidget::~SelectionWidget()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * Sets the strings of the subwidgets using the current
+ * language.
+ */
+void SelectionWidget::languageChange()
+{
+ setCaption( tr( "Selection Widget" ) );
+ groupBox7->setTitle( tr( "Selection" ) );
+ zoomInButton->setText( tr( "Zoom In" ) );
+ QToolTip::add( zoomInButton, tr( "Zoom In" ) );
+ zoomOutButton->setText( tr( "Zoom Out" ) );
+ QToolTip::add( zoomOutButton, tr( "Zoom Out" ) );
+ syncWithTilingButton->setText( tr( "Center on Tiling" ) );
+ QToolTip::add( syncWithTilingButton, tr( "Center view on currently displayed region of contig." ) );
+ selectButton->setText( tr( "Select" ) );
+ QToolTip::add( selectButton, tr( "Select" ) );
+}
+
diff --git a/src/hawkeye/SelectionWidget.hh b/src/hawkeye/SelectionWidget.hh
new file mode 100644
index 0000000..16a4cee
--- /dev/null
+++ b/src/hawkeye/SelectionWidget.hh
@@ -0,0 +1,46 @@
+
+#ifndef SELECTIONWIDGET_H
+#define SELECTIONWIDGET_H
+
+#include <qvariant.h>
+#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
+
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
+class QSpacerItem;
+class Q3GroupBox;
+class QToolButton;
+class QCheckBox;
+
+class SelectionWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ SelectionWidget( QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0 );
+ ~SelectionWidget();
+
+ Q3GroupBox* groupBox7;
+ QToolButton* zoomInButton;
+ QToolButton* zoomOutButton;
+ QCheckBox* syncWithTilingButton;
+ QToolButton* selectButton;
+
+protected:
+ Q3GridLayout* SelectionWidgetLayout;
+ Q3GridLayout* groupBox7Layout;
+ QSpacerItem* spacer2_2;
+ QSpacerItem* spacer2;
+ QSpacerItem* spacer2_3;
+
+protected slots:
+ virtual void languageChange();
+
+};
+
+#endif // SELECTIONWIDGET_H
diff --git a/src/hawkeye/SplashScreen.cc b/src/hawkeye/SplashScreen.cc
new file mode 100644
index 0000000..07ecf81
--- /dev/null
+++ b/src/hawkeye/SplashScreen.cc
@@ -0,0 +1,48 @@
+#include <qapplication.h>
+#include <qpainter.h>
+#include <qpixmap.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include "SplashScreen.hh"
+#include <QtGui>
+
+SplashScreen::SplashScreen( const QPixmap &pixmap )
+ : QWidget( 0, 0, Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool | Qt::WWinOwnDC ),
+ pix( pixmap )
+{
+ setErasePixmap( pix );
+ resize( pix.size() );
+ QRect scr = QApplication::desktop()->screenGeometry();
+ move( scr.center() - rect().center() );
+ show();
+ repaint();
+}
+
+void SplashScreen::repaint()
+{
+ QWidget::repaint();
+ QApplication::flush();
+}
+
+void SplashScreen::finish( QWidget *mainWin )
+{
+ close();
+}
+
+void SplashScreen::setStatus( const QString &message, int alignment, const QColor &color )
+{
+ QPixmap textPix = pix;
+ QPainter painter( &textPix);
+ painter.setPen( color );
+ QRect r = rect();
+ r.setRect( r.x() + 10, r.y() + 10, r.width() - 20, r.height() - 20 );
+ painter.drawText( r, alignment, message );
+ setErasePixmap( textPix );
+ repaint();
+}
+
+void SplashScreen::mousePressEvent( QMouseEvent * )
+{
+ hide();
+}
+
diff --git a/src/hawkeye/SplashScreen.hh b/src/hawkeye/SplashScreen.hh
new file mode 100644
index 0000000..3faa995
--- /dev/null
+++ b/src/hawkeye/SplashScreen.hh
@@ -0,0 +1,27 @@
+#ifndef SPLASHSCREEN_H
+#define SPLASHSCREEN_H
+
+#include <qpixmap.h>
+#include <qwidget.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+
+class SplashScreen : public QWidget
+{
+ Q_OBJECT
+
+public:
+ SplashScreen( const QPixmap &pixmap );
+
+ void setStatus( const QString &message, int alignment = Qt::AlignLeft, const QColor &color = Qt::black );
+ void finish( QWidget *mainWin );
+ void repaint();
+
+protected:
+ void mousePressEvent( QMouseEvent * );
+
+private:
+ QPixmap pix;
+};
+
+#endif
diff --git a/src/hawkeye/TilingField.cc b/src/hawkeye/TilingField.cc
new file mode 100644
index 0000000..18064cf
--- /dev/null
+++ b/src/hawkeye/TilingField.cc
@@ -0,0 +1,797 @@
+#include "TilingField.hh"
+#include <qpainter.h>
+#include <qpixmap.h>
+#include <q3pointarray.h>
+#include <qstring.h>
+#include <qapplication.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QPaintEvent>
+#include <QtGui>
+
+#include "ReadInfo.hh"
+#include "UIElements.hh"
+#include "DataStore.hh"
+#include "AlignmentInfo.hh"
+
+#define DEBUGQV 0
+
+static int min (int a, int b)
+{
+ return a < b ? a : b;
+}
+static int max (int a, int b)
+{
+ return a > b ? a : b;
+}
+
+using namespace AMOS;
+using namespace std;
+
+extern "C"
+{
+#include <Read.h>
+}
+
+static int m_minheight = 8;
+
+TilingField::TilingField(DataStore * datastore,
+ vector<RenderSeq_t> & renderedSeqs,
+ const string & consensus,
+ const string & cstatus,
+ AlignmentInfo * ai,
+ int & gindex,
+ int & fontsize,
+ QWidget *parent, const char *name )
+ : QWidget( parent, name ),
+ m_consensus(consensus),
+ m_cstatus(cstatus),
+ m_alignment(ai),
+ m_renderedSeqs(renderedSeqs),
+ m_fontsize(fontsize),
+ m_gindex(gindex)
+{
+ m_datastore = datastore;
+ m_readnamewidth = 11;
+ m_width=100;
+ m_height=0;
+ m_stabletiling = 0;
+ m_highlightdiscrepancy = 0;
+ m_tracespace = 50;
+ m_traceheight = m_tracespace - 10;
+ m_displayqv = 0;
+ m_lowquallower = false;
+ m_fullseq = false;
+ m_snpcoloring = true;
+ m_basecolors = false;
+ m_polymorphismView = false;
+ m_qvcoloring = false;
+ m_doubleclick = false;
+ m_packreads = false;
+
+ m_clickTimer = new QTimer(this, 0);
+ connect (m_clickTimer, SIGNAL(timeout()),
+ this, SLOT(singleClick()));
+
+ m_clickstate = 0;
+
+ setMinimumSize(m_width, m_height);
+
+ m_width=QApplication::desktop()->width();
+ resize(m_width, 100);
+ setPalette(QPalette(UIElements::color_tiling));
+}
+
+int TilingField::getReadCov(int y)
+{
+ int dcov;
+ vector<RenderSeq_t>::iterator ri;
+
+ for (ri = m_renderedSeqs.begin(), dcov = 0;
+ ri != m_renderedSeqs.end();
+ ri++, dcov++)
+ {
+ if (y >= ri->m_displaystart && y < ri->m_displayend)
+ {
+ #if DEBUGQV
+ cerr << "Hit " << ri->m_read.getEID() << " [" << dcov << "]" << endl;
+ #endif
+
+ return dcov;
+ }
+ }
+
+ return -1;
+}
+
+void TilingField::singleClick()
+{
+ #if DEBUGQV
+ cerr << "Timer fired! single click" << endl;
+ #endif
+
+ int dcov = getReadCov(m_yclick);
+ if (dcov == -1) { return; }
+
+ m_renderedSeqs[dcov].m_displayTrace = !m_renderedSeqs[dcov].m_displayTrace;
+
+ if (m_renderedSeqs[dcov].m_displayTrace)
+ {
+ m_renderedSeqs[dcov].loadTrace();
+ }
+
+ update();
+}
+
+void TilingField::mouseReleaseEvent( QMouseEvent * e)
+{
+ #if DEBUGQV
+ cerr << "mouserelease state:" << m_clickstate << endl;
+ #endif
+
+ int theight = max(m_fontsize, m_minheight);
+ int tilehoffset = theight*12;
+
+ if (e->x() < tilehoffset)
+ {
+ int dcov = getReadCov(e->y());
+ emit highlightRead(m_renderedSeqs[dcov].m_read.getIID());
+ }
+ else if (m_doubleclick)
+ {
+ // Eat the release from the doubleclick
+ m_doubleclick = false;
+ }
+ else
+ {
+ m_clickTimer->start(400, true);
+ m_yclick = e->y();
+ }
+}
+
+
+void TilingField::mouseDoubleClickEvent( QMouseEvent *e )
+{
+ #if DEBUGQV
+ cerr << "doubleclick, stop timer" << endl;
+ #endif
+
+ m_clickTimer->stop();
+ m_doubleclick = true;
+
+ int dcov = getReadCov(e->y());
+ if (dcov == -1) { return; }
+
+ m_renderedSeqs[dcov].loadTrace();
+ ReadInfo * readinfo = new ReadInfo(&m_renderedSeqs[dcov],
+ m_consensus,
+ m_cstatus,
+ this,
+ "readinfo");
+ readinfo->show();
+
+ connect(this, SIGNAL(setTilingVisibleRange(int, int, int)),
+ readinfo, SLOT(setTilingVisibleRange(int, int, int)));
+}
+
+
+
+void TilingField::paintEvent( QPaintEvent * paintevent )
+{
+ if (m_renderedSeqs.empty()) { resize(m_width, m_height); return; }
+
+ int theight = max(m_fontsize, m_minheight);
+
+ int basespace = 5;
+ int gutter = theight;
+ int lineheight = theight+gutter;
+ int tilehoffset = theight*(m_readnamewidth+1);
+ int seqnamehoffset = gutter;
+ int rchoffset = theight*m_readnamewidth;
+ double basewidth = m_fontsize+basespace;
+
+ if (m_packreads) { tilehoffset = 2; }
+
+ int packgutter = m_readnamewidth; // separate reads on same row by this much
+
+ if (basewidth <= 0)
+ {
+ basewidth = 1/((-basewidth+2));
+ }
+
+ int bwidth = max(basewidth, 1);
+
+ double tracevscale = 1500.0 / m_traceheight;
+ int displaywidth = (int) ((m_width-tilehoffset)/basewidth);
+
+ Pos_t grangeStart = m_gindex;
+ Pos_t grangeEnd = min(m_gindex + displaywidth, m_consensus.size()-1);
+
+ Pos_t srangeStart = m_alignment->getContigPos(grangeStart);
+ Pos_t srangeEnd = m_alignment->getContigPos(grangeEnd);
+
+ // Compute the exact height we want
+ vector<RenderSeq_t>::iterator ri;
+ int dcov = 0;
+ int ldcov = 0;
+ int clen = m_consensus.size();
+
+ vector<int> rows;
+
+ int rowheight = lineheight;
+ if (m_displayqv) rowheight += lineheight;
+
+ for (ri = m_renderedSeqs.begin();
+ ri != m_renderedSeqs.end();
+ ri++)
+ {
+ int hasOverlap = RenderSeq_t::hasOverlap(srangeStart, srangeEnd,
+ ri->m_loffset, ri->gappedLen(),
+ clen);
+
+ if (m_fullseq)
+ {
+ hasOverlap = RenderSeq_t::hasOverlap(srangeStart, srangeEnd,
+ ri->m_lfoffset, ri->fullLen(),
+ clen);
+ }
+
+ if (hasOverlap || m_stabletiling)
+ {
+
+ if (m_packreads)
+ {
+ int r;
+
+ for (r = 0; r < (int) rows.size(); r++)
+ {
+ if (ri->m_loffset > rows[r])
+ {
+ break;
+ }
+ }
+
+ if (r >= (int) rows.size())
+ {
+ rows.push_back(0);
+ }
+
+ rows[r] = ri->m_loffset+ri->gappedLen()+packgutter;
+
+ ri->m_displaystart = r*rowheight;
+ ri->m_displayend = (r+1)*rowheight;
+ }
+ else
+ {
+ ri->m_displaystart = ldcov;
+
+ int readheight = lineheight; // seqname
+ if (m_displayqv) { readheight += lineheight; }
+ if (ri->m_displayTrace) { readheight += m_tracespace; }
+
+ dcov++;
+ ldcov += readheight;
+ ri->m_displayend = ldcov;
+ }
+ }
+ else
+ {
+ ri->m_displaystart = -1;
+ ri->m_displayend = -1;
+ }
+ }
+
+ if (m_packreads)
+ {
+ ldcov = rows.size() * lineheight;
+ }
+
+ // +1 takes care of 0dcov regions
+ int height = ldcov + 1;
+ if (height > 32000) { height = 32000; }
+
+ if (m_width != this->width() || height != this->height())
+ {
+ //cerr << "Resize: " << m_width << "x" << height << endl;
+ resize(m_width, height);
+ update();
+ }
+
+ int drawtop = paintevent->rect().top();
+ int drawbottom = paintevent->rect().bottom();
+
+ QString s;
+
+ QPainter p(this);
+
+ QPen pen;
+ pen.setColor(Qt::black);
+ p.setPen(pen);
+ p.setFont(QFont("Helvetica", theight));
+ p.setBrush(Qt::SolidPattern);
+
+ Q3PointArray rcflag(3);
+ int tridim = theight/2;
+ int trioffset = lineheight-.75*theight-2;
+
+
+ #if 0
+ cerr << "paintTField:" << m_renderedSeqs.size() << " dcov: " << dcov << " height: " << height
+ << " [" << srangeStart << "," << srangeEnd << "]" << endl;
+ cerr << "Draw top: " << drawtop << " bottom: " << drawbottom << endl;
+ #endif
+
+ if (m_packreads)
+ {
+ for (int r = 0; r < rows.size(); r++)
+ {
+ QColor bgcolor = UIElements::color_tilingoffset;
+
+ // background rectangle
+ if (r % 2) { bgcolor = bgcolor.light(175); }
+ else { bgcolor = bgcolor.light(150); }
+
+ p.setPen(bgcolor);
+ p.setBrush(bgcolor);
+
+ p.drawRect(0, r*lineheight, m_width, lineheight);
+ }
+ }
+
+ dcov = 0;
+
+ for (ri = m_renderedSeqs.begin();
+ ri != m_renderedSeqs.end();
+ ri++)
+ {
+ if (ri->m_displaystart != -1)
+ {
+ int hasOverlap = RenderSeq_t::hasOverlap(srangeStart, srangeEnd,
+ ri->m_loffset, ri->gappedLen(),
+ clen);
+
+ if (m_fullseq)
+ {
+ hasOverlap = RenderSeq_t::hasOverlap(srangeStart, srangeEnd,
+ ri->m_lfoffset, ri->fullLen(),
+ clen);
+ }
+
+ if (!hasOverlap)
+ {
+ cerr << "wtf?" << endl;
+ }
+
+ ldcov = ri->m_displaystart;
+ dcov++;
+
+ int readheight = lineheight; // seqname
+ if (m_displayqv) { readheight += lineheight; }
+ if (ri->m_displayTrace) { readheight += m_tracespace; }
+
+ if ((ldcov > height) || (ldcov > drawbottom) || ((ldcov+readheight) < drawtop))
+ {
+ continue;
+ }
+
+ if (!m_packreads)
+ {
+ QColor bgcolor;
+ if (m_snpcoloring)
+ {
+ bgcolor = UIElements::getSNPColoring(ri->bgcolor);
+ }
+ else
+ {
+ bgcolor = UIElements::color_tilingoffset;
+ }
+
+ // background rectangle
+ if (dcov % 2) { bgcolor = bgcolor.light(175); }
+ else { bgcolor = bgcolor.light(150); }
+
+ p.setPen(bgcolor);
+ p.setBrush(bgcolor);
+
+ p.drawRect(0, ldcov, m_width, readheight);
+
+ // black pen
+ p.setPen(QPen(Qt::black));
+ p.setBrush(QBrush(Qt::black));
+ p.setFont(QFont("Helvetica", theight));
+
+ // RC Flag
+ if (ri->m_rc)
+ {
+ rcflag[0]=QPoint(rchoffset+tridim, ldcov+trioffset);
+ rcflag[1]=QPoint(rchoffset+tridim, ldcov+trioffset+tridim);
+ rcflag[2]=QPoint(rchoffset, ldcov+trioffset+tridim/2);
+ }
+ else
+ {
+ rcflag[0]=QPoint(rchoffset, ldcov+trioffset);
+ rcflag[1]=QPoint(rchoffset, ldcov+trioffset+tridim);
+ rcflag[2]=QPoint(rchoffset+tridim, ldcov+trioffset+tridim/2);
+ }
+
+ p.drawPolygon(rcflag);
+
+ // Seqname
+ int PrintIID = 0;
+ if (PrintIID)
+ {
+ p.drawText(seqnamehoffset, ldcov,
+ rchoffset-seqnamehoffset, lineheight-2,
+ Qt::AlignLeft | Qt::AlignBottom,
+ QString::number(ri->m_read.getIID()));
+ }
+ else
+ {
+ p.drawText(seqnamehoffset, ldcov,
+ rchoffset-seqnamehoffset, lineheight-2,
+ Qt::AlignLeft | Qt::AlignBottom,
+ QString(ri->m_read.getEID().c_str()));
+ }
+ }
+
+ if (hasOverlap)
+ {
+
+ if (m_fullseq)
+ {
+ p.setPen(UIElements::color_tilingtrim);
+ p.setBrush(UIElements::color_tilingtrim);
+
+ if (srangeStart < ri->m_loffset)
+ {
+ int left = max(srangeStart, ri->m_lfoffset);
+ int right = min(ri->m_loffset-1, srangeEnd);
+
+ int start = (int) ((left - srangeStart) * basewidth);
+
+ p.drawRect(tilehoffset + start, ldcov + 2,
+ (int)((right - left + 1) * basewidth), readheight - 4);
+ }
+
+ if (srangeEnd > ri->m_roffset)
+ {
+ int left = max(srangeStart, ri->m_roffset+1);
+ int right = min(ri->m_rfoffset, srangeEnd);
+
+ int start = (int)((left - srangeStart) * basewidth);
+
+ p.drawRect(tilehoffset + start, ldcov + 2,
+ (int)((right - left + 1 ) * basewidth), readheight - 4);
+ }
+ }
+
+ if (m_fontsize < m_minheight)
+ {
+ p.setPen(Qt::black);
+ p.setBrush(QColor(200,200,200));
+
+ int left = max(srangeStart, ri->m_loffset);
+ int right = min(srangeEnd, ri->m_roffset);
+
+ int start = (int)((left - srangeStart) * basewidth);
+
+ p.drawRect(tilehoffset + start-1, ldcov + 2,
+ (int)((right - left + 1 ) * basewidth+2), readheight - 4);
+
+ }
+
+ for (int gindex = grangeStart, alignedPos = 0;
+ gindex <= grangeEnd;
+ gindex++, alignedPos++)
+ {
+ int hoffset = (int)(tilehoffset + (gindex-grangeStart)*basewidth);
+
+ int shifted = m_alignment->getContigPos(gindex);
+
+ if (m_consensus[gindex] == '*')
+ {
+ continue;
+ }
+
+ int qv = ri->qv(shifted, m_fullseq, m_consensus.length());
+ char b = ri->base(shifted, m_fullseq, m_consensus.length());
+
+ if (qv < 30 && m_lowquallower) { b = tolower(b); }
+ else { b = toupper(b); }
+
+ s = b;
+
+ {
+ bool bad = m_highlightdiscrepancy && (toupper(b) != toupper(m_consensus[gindex]));
+
+ if ((bad || m_qvcoloring) && b != ' ')
+ {
+ QColor bg;
+
+ if (bad && !m_qvcoloring)
+ {
+ bg = UIElements::color_discrepancy;
+ }
+ else
+ {
+ int h = 0, s = 0, v = 60 + qv*3;
+
+ if (bad && m_qvcoloring)
+ {
+ h = 300; s = 220 ; v = (int)(160 + 1.5*qv);
+ }
+
+ bg.setHsv(h,s,v);
+ }
+
+ p.setBrush(bg);
+ p.setPen(bg);
+ if (m_fontsize >= m_minheight)
+ {
+ p.drawRect(hoffset-basespace/2, ldcov+3, bwidth, lineheight-6);
+ }
+ else
+ {
+ int baseheight = lineheight - 6;
+ if (m_displayqv) { baseheight = lineheight-3; }
+ p.drawRect(hoffset, ldcov+3, bwidth, baseheight);
+ }
+ }
+ }
+
+ // Bases
+ p.setPen((m_basecolors) ? UIElements::getBaseColor(b) : QPen(Qt::black));
+ p.setFont(QFont("Helvetica", m_fontsize));
+
+ if (m_fontsize < m_minheight)
+ {
+ if ((b != ' ') && ((m_polymorphismView) || (toupper(b) != toupper(m_consensus[gindex]))))
+ {
+ int baseheight = lineheight-6;
+ if (m_displayqv) { baseheight = lineheight-3; }
+
+ p.setBrush((m_basecolors) ? QBrush(UIElements::getBaseColor(b)) : QBrush(Qt::black));
+ p.drawRect(hoffset, ldcov+3, bwidth, baseheight);
+ }
+ }
+ else
+ {
+ if (m_polymorphismView && toupper(b) == toupper(m_consensus[gindex]))
+ {
+ s = '.';
+ }
+
+ p.drawText(hoffset, ldcov,
+ m_fontsize, lineheight-2,
+ Qt::AlignHCenter | Qt::AlignBottom, s);
+ }
+
+ // QV
+ if (m_displayqv && b != ' ' && qv != -1)
+ {
+ if (m_fontsize < m_minheight)
+ {
+ QColor qvcolor;
+ int h = 0, s = 0, v = 60 + qv*3;
+ qvcolor.setHsv(h,s,v);
+ p.setBrush(qvcolor);
+ p.setPen(qvcolor);
+
+ p.drawRect(hoffset, ldcov+lineheight, bwidth, lineheight-3);
+ }
+ else
+ {
+ s = QString::number(qv);
+
+ p.setFont(QFont("Helvetica", (int)(m_fontsize*.75)));
+ p.setPen(QPen(Qt::black));
+ p.drawText(hoffset-m_fontsize, ldcov+lineheight,
+ 3*m_fontsize, m_fontsize,
+ Qt::AlignHCenter | Qt::AlignVCenter, s);
+ }
+ }
+ }
+
+ ldcov += lineheight;
+ if (m_displayqv) { ldcov += lineheight; }
+
+ if (ri->m_displayTrace)
+ {
+ int baseline = ldcov + m_traceheight;
+
+ if (ri->m_trace)
+ {
+ unsigned short * trace = NULL;
+ Read * chromotrace = (Read *) ri->m_trace;
+
+ for (int channel = 0; channel < 4; channel++)
+ {
+ if (!ri->m_rc)
+ {
+ switch (channel)
+ {
+ case 0: trace = chromotrace->traceA; UIElements::setBasePen(pen, 'A'); break;
+ case 1: trace = chromotrace->traceC; UIElements::setBasePen(pen, 'C'); break;
+ case 2: trace = chromotrace->traceG; UIElements::setBasePen(pen, 'G'); break;
+ case 3: trace = chromotrace->traceT; UIElements::setBasePen(pen, 'T'); break;
+ };
+ }
+ else
+ {
+ switch (channel)
+ {
+ case 0: trace = chromotrace->traceA; UIElements::setBasePen(pen, 'T'); break;
+ case 1: trace = chromotrace->traceC; UIElements::setBasePen(pen, 'G'); break;
+ case 2: trace = chromotrace->traceG; UIElements::setBasePen(pen, 'C'); break;
+ case 3: trace = chromotrace->traceT; UIElements::setBasePen(pen, 'A'); break;
+ };
+ }
+
+ p.setPen(pen);
+
+ bool first = true;
+
+ int leftboundary = ri->m_loffset;
+ int rightboundary = ri->m_roffset;
+
+ if (m_fullseq)
+ {
+ leftboundary = ri->m_lfoffset;
+ rightboundary = ri->m_rfoffset;
+ }
+
+ leftboundary = m_alignment->getGlobalPos(leftboundary);
+ rightboundary = m_alignment->getGlobalPos(rightboundary);
+
+ // go beyond the range so the entire peak will be drawn
+ for (int gindex = max(leftboundary, grangeStart-1);
+ gindex <= min(rightboundary, grangeEnd+1);
+ gindex++)
+ {
+ if (m_consensus[gindex] == '*')
+ {
+ continue;
+ }
+
+ int hoffset = (int)(tilehoffset + (gindex-grangeStart)*basewidth+m_fontsize/2);
+ int shifted = m_alignment->getContigPos(gindex);
+
+ int peakposition = ri->pos(shifted, m_fullseq, m_consensus.length());
+ int nextpeakposition = ri->pos(shifted+1, m_fullseq, m_consensus.length());
+
+ int count = 1;
+ while (m_consensus[gindex+count] == '*')
+ {
+ count++;
+ }
+
+ QPainterPath path;
+
+ // in 1 basewidth worth of pixels, cover hdelta worth of trace
+ int hdelta = nextpeakposition - peakposition;
+ double hscale = ((double)(count*basewidth))/hdelta; // rc negative
+
+ int tpos = peakposition;
+ while ((!ri->m_rc && tpos < nextpeakposition) ||
+ ( ri->m_rc && tpos > nextpeakposition))
+ {
+ int hval = hoffset + (int)((tpos-peakposition)*hscale); // rc negative
+ int tval = (int)(trace[tpos]/tracevscale);
+
+ // truncate very tall peaks
+ if (tval > m_traceheight) { tval = m_traceheight; }
+
+ if (first)
+ {
+ path.moveTo(hval, baseline - tval);
+ first = false;
+ }
+
+ // draw trace
+ path.lineTo(hval, baseline-tval);
+
+ // ticks
+ if ((tpos % 5 == 0) && channel == 0)
+ {
+ p.setPen(Qt::black);
+
+ p.drawLine(hval, baseline-1, hval, baseline+1);
+
+ p.setPen(pen);
+ }
+
+ if (ri->m_rc) { tpos--; }
+ else { tpos++; }
+ }
+
+ p.drawPath(path);
+ }
+ }
+ }
+
+ p.setPen(QPen(Qt::black));
+ p.drawLine((int)(tilehoffset-basewidth), baseline, m_width, baseline);
+ }
+ }
+ }
+ }
+
+ emit setTilingVisibleRange(m_datastore->m_contigId, srangeStart, srangeEnd);
+}
+
+
+QSizePolicy TilingField::sizePolicy() const
+{
+ return QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+}
+
+void TilingField::setSize(int width, int height)
+{
+ m_width = width;
+ m_height = height;
+}
+
+void TilingField::togglePackReads(bool pack)
+{
+ m_packreads = pack;
+ update();
+}
+
+void TilingField::toggleHighlightDiscrepancy(bool show)
+{
+ m_highlightdiscrepancy = show;
+ update();
+}
+
+void TilingField::toggleBaseColors(bool showColors)
+{
+ m_basecolors = showColors;
+ update();
+}
+
+void TilingField::toggleShowFullRange(bool showFull)
+{
+ m_fullseq = showFull;
+ update();
+}
+
+void TilingField::toggleDisplayQV(bool show)
+{
+ m_displayqv = show;
+ update();
+}
+
+void TilingField::toggleLowQualityLowerCase(bool dolower)
+{
+ m_lowquallower = dolower;
+ update();
+}
+
+void TilingField::toggleSNPColoring(bool doColor)
+{
+ m_snpcoloring = doColor;
+ update();
+}
+
+void TilingField::togglePolymorphismView(bool doPV)
+{
+ m_polymorphismView = doPV;
+ update();
+}
+
+void TilingField::toggleQVColoring(bool doqvc)
+{
+ m_qvcoloring = doqvc;
+ update();
+}
+
+void TilingField::setReadnameWidth(int width)
+{
+ m_readnamewidth = width;
+ update();
+}
+
+int TilingField::getReadnameWidth()
+{
+ return m_readnamewidth;
+}
diff --git a/src/hawkeye/TilingField.hh b/src/hawkeye/TilingField.hh
new file mode 100644
index 0000000..c4eb7f5
--- /dev/null
+++ b/src/hawkeye/TilingField.hh
@@ -0,0 +1,92 @@
+#ifndef TILING_H
+#define TILING_H
+
+#include <qwidget.h>
+#include <qtimer.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QPaintEvent>
+#include "RenderSeq.hh"
+
+class DataStore;
+class AlignmentInfo;
+
+class TilingField : public QWidget
+{
+ Q_OBJECT
+public:
+ TilingField(DataStore * datastore,
+ std::vector<RenderSeq_t> & renderedSeqs,
+ const std::string & consensus,
+ const std::string & cstatus,
+ AlignmentInfo * ai,
+ int & gindex,
+ int & fontsize,
+ QWidget *parent=0,
+ const char *name=0 );
+
+ QSizePolicy sizePolicy() const;
+ void mouseDoubleClickEvent(QMouseEvent * event);
+ void mouseReleaseEvent(QMouseEvent * event);
+ void setSize(int width, int height);
+
+public slots:
+ void toggleHighlightDiscrepancy(bool);
+ void toggleDisplayQV(bool);
+ void togglePolymorphismView(bool);
+ void toggleLowQualityLowerCase(bool);
+ void toggleBaseColors(bool);
+ void toggleShowFullRange(bool);
+ void toggleSNPColoring(bool);
+ void toggleQVColoring(bool);
+ void togglePackReads(bool);
+ void singleClick();
+ void setReadnameWidth(int);
+ int getReadnameWidth();
+
+signals:
+ void setTilingVisibleRange(int, int, int);
+ void highlightRead(int);
+
+protected:
+ void paintEvent( QPaintEvent * );
+
+private:
+ int getReadCov(int y);
+
+ const std::string & m_consensus;
+ const std::string & m_cstatus;
+ AlignmentInfo * m_alignment;
+
+ std::vector<RenderSeq_t> & m_renderedSeqs;
+ DataStore * m_datastore;
+
+ int m_clickstate;
+ QTimer * m_clickTimer;
+ int m_yclick;
+
+ int & m_fontsize;
+ int & m_gindex;
+
+ int m_height;
+ int m_width;
+ int m_traceheight;
+ int m_tracespace;
+ int m_readnamewidth;
+
+ bool m_displayqv;
+ bool m_stabletiling;
+ bool m_snpcoloring;
+ bool m_polymorphismView;
+ bool m_qvcoloring;
+ bool m_highlightdiscrepancy;
+ bool m_lowquallower;
+ bool m_basecolors;
+ bool m_fullseq;
+ bool m_packreads;
+
+ bool m_doubleclick;
+};
+
+
+#endif
diff --git a/src/hawkeye/TilingFrame.cc b/src/hawkeye/TilingFrame.cc
new file mode 100644
index 0000000..cea73ab
--- /dev/null
+++ b/src/hawkeye/TilingFrame.cc
@@ -0,0 +1,565 @@
+#include "TilingFrame.hh"
+#include "TilingField.hh"
+#include <set>
+
+#include <q3scrollview.h>
+#include <qlayout.h>
+#include <qapplication.h>
+#include <qcursor.h>
+//Added by qt3to4:
+#include <Q3BoxLayout>
+#include <QPaintEvent>
+#include <Q3Frame>
+#include <Q3VBoxLayout>
+#include "ConsensusField.hh"
+#include "RenderSeq.hh"
+#include "UIElements.hh"
+#include "DataStore.hh"
+#include "AlignmentInfo.hh"
+#include <qregexp.h>
+
+using namespace std;
+using namespace AMOS;
+
+int min (int a, int b)
+{
+ return a < b ? a : b;
+}
+
+struct SeqnameOrderCmp
+{
+ bool operator() (const RenderSeq_t & a, const RenderSeq_t & b)
+ {
+ return a.m_read.getEID() < b.m_read.getEID();
+ }
+};
+
+
+struct SNPTilingOrderCmp
+{
+ static int snpposition;
+ static int contiglen;
+ static int reverse;
+
+ bool operator() (const RenderSeq_t & a, const RenderSeq_t & b)
+ {
+ char abase = a.base(snpposition, false, contiglen);
+ char bbase = b.base(snpposition, false, contiglen);
+
+ if (reverse)
+ {
+ return toupper(abase) > toupper(bbase);
+ }
+
+ return toupper(abase) < toupper(bbase);
+ }
+};
+
+int SNPTilingOrderCmp::snpposition(0);
+int SNPTilingOrderCmp::contiglen(0);
+int SNPTilingOrderCmp::reverse(0);
+
+
+TilingFrame::TilingFrame(DataStore * datastore,
+ AlignmentInfo * ai,
+ QWidget * parent,
+ const char * name,
+ Qt::WFlags f)
+ :Q3Frame(parent, name, f),
+ m_datastore(datastore),
+ m_alignment(ai)
+{
+ m_gindex = 0;
+ m_fontsize = 10;
+ m_displayAllChromo = true;
+
+ m_loadedStart = m_loadedEnd = -1;
+
+ toggleDisplayAllChromo(false);
+ m_nextDiscrepancyBuffer = 10;
+
+ m_sv = new Q3ScrollView(this, "tilingscroll");
+ m_sv->setHScrollBarMode(Q3ScrollView::AlwaysOff);
+
+ m_tilingfield = new TilingField(datastore,
+ m_renderedSeqs,
+ m_consensus,
+ m_cstatus,
+ m_alignment,
+ m_gindex,
+ m_fontsize,
+ m_sv->viewport(),
+ "tiling" );
+ m_sv->addChild(m_tilingfield);
+ m_sv->setPaletteBackgroundColor(UIElements::color_tiling);
+
+ m_consfield = new ConsensusField(m_consensus,
+ m_cstatus,
+ m_consqual,
+ m_ugpos,
+ m_alignment,
+ m_gindex,
+ m_contigId,
+ m_contigName,
+ this,
+ "cons");
+
+ Q3BoxLayout * layout = new Q3VBoxLayout(this);
+ layout->addWidget(m_consfield);
+ layout->addWidget(m_sv, 10);
+
+
+ connect(m_tilingfield, SIGNAL(highlightRead(int)),
+ this, SIGNAL(highlightRead(int)));
+
+ connect(this, SIGNAL(fontSizeChanged(int)),
+ m_consfield, SLOT(setFontSize(int)));
+
+ connect(m_tilingfield, SIGNAL(setTilingVisibleRange(int, int, int)),
+ this, SIGNAL(setTilingVisibleRange(int, int, int)));
+
+ connect(m_consfield, SIGNAL(sortColumns(int)),
+ this, SLOT(sortColumns(int)));
+
+ connect(this, SIGNAL(togglePackReads(bool)),
+ m_tilingfield, SLOT(togglePackReads(bool)));
+
+ connect(this, SIGNAL(togglePackReads(bool)),
+ m_consfield, SLOT(togglePackReads(bool)));
+
+ connect(this, SIGNAL(toggleShowUngapped(bool)),
+ m_consfield, SLOT(toggleShowUngapped(bool)));
+
+ connect(this, SIGNAL(toggleDisplayQV(bool)),
+ m_tilingfield, SLOT(toggleDisplayQV(bool)));
+
+ connect(this, SIGNAL(togglePolymorphismView(bool)),
+ m_tilingfield, SLOT(togglePolymorphismView(bool)));
+
+ connect(this, SIGNAL(toggleQVColoring(bool)),
+ m_tilingfield, SLOT(toggleQVColoring(bool)));
+
+ connect(this, SIGNAL(toggleLowQualityLowerCase(bool)),
+ m_tilingfield, SLOT(toggleLowQualityLowerCase(bool)));
+
+ connect(this, SIGNAL(toggleShowFullRange(bool)),
+ m_tilingfield, SLOT(toggleShowFullRange(bool)));
+
+ connect(this, SIGNAL(toggleHighlightDiscrepancy(bool)),
+ m_tilingfield, SLOT(toggleHighlightDiscrepancy(bool)));
+
+ connect(this, SIGNAL(toggleShowNumbers(bool)),
+ m_consfield, SLOT(toggleShowNumbers(bool)));
+
+ connect(this, SIGNAL(toggleBaseColors(bool)),
+ m_consfield, SLOT(toggleBaseColors(bool)));
+
+ connect(this, SIGNAL(toggleShowConsQV(bool)),
+ m_consfield, SLOT(toggleShowConsQV(bool)));
+
+ connect(this, SIGNAL(toggleShowIndicator(bool)),
+ m_consfield, SLOT(toggleShowIndicator(bool)));
+
+ connect(this, SIGNAL(toggleSNPColoring(bool)),
+ m_tilingfield, SLOT(toggleSNPColoring(bool)));
+
+ connect(this, SIGNAL(toggleBaseColors(bool)),
+ m_tilingfield, SLOT(toggleBaseColors(bool)));
+}
+
+void TilingFrame::toggleDisplayAllChromo(bool display)
+{
+ m_displayAllChromo = display;
+
+ if (m_displayAllChromo)
+ {
+ m_loadedWidth = 500;
+
+ // load only the reads in this region
+ setGindex(m_gindex);
+
+ // force loading of chromatograms
+ vector<RenderSeq_t>::iterator ri;
+ for (ri = m_renderedSeqs.begin();
+ ri != m_renderedSeqs.end();
+ ri++)
+ {
+ ri->loadTrace();
+ ri->m_displayTrace = true;
+ }
+
+ update();
+ }
+ else
+ {
+ m_loadedWidth = 5000;
+ }
+}
+
+
+void TilingFrame::paintEvent(QPaintEvent * event)
+{
+ Q3Frame::paintEvent(event);
+ m_consfield->update();
+
+ m_tilingfield->setSize(width(), m_sv->visibleHeight());
+ m_tilingfield->update();
+}
+
+void TilingFrame::setContigId(int contigId)
+{
+ if (m_datastore->m_loaded)
+ {
+ try
+ {
+ m_contigId = contigId;
+ m_contigName = m_datastore->contig_bank.lookupEID(contigId).c_str();
+ m_tiling = m_datastore->m_contig.getReadTiling();
+ m_consensus = m_datastore->m_contig.getSeqString();
+ m_consqual = m_datastore->m_contig.getQualString();
+
+ int l = m_consensus.size();
+
+ m_cstatus.erase();
+ m_cstatus.resize(l, ' ');
+ m_renderedSeqs.clear();
+
+ int i = 0;
+ m_ugpos.resize(l);
+ while (i < l && m_consensus[i] == '-')
+ {
+ m_ugpos[i] = 0;
+ i++;
+ }
+
+ if (i < l)
+ {
+ m_ugpos[i] = 1;
+
+ for (i++; i < l; i++)
+ {
+ int last = m_ugpos[i-1];
+ if (m_consensus[i] == '-') { m_ugpos[i] = last; }
+ else { m_ugpos[i] = last+1; }
+ }
+ }
+
+ for (unsigned int i = 0; i < m_alignment->m_gaps.size(); i++)
+ {
+ m_consensus.insert(i+m_alignment->m_gaps[i], 1, '*');
+ m_consqual.insert (i+m_alignment->m_gaps[i], 1, '*');
+ m_cstatus.insert (i+m_alignment->m_gaps[i], 1, '*');
+ //m_ugpos.insert (i+m_alignment->m_gaps[i], 1, -1); TODO
+ }
+
+ m_consensus.insert((unsigned) 0,(unsigned) m_alignment->m_startshift, '*');
+ m_cstatus.insert ((unsigned) 0,(unsigned) m_alignment->m_startshift, '*');
+ m_consqual.insert ((unsigned) 0,(unsigned) m_alignment->m_startshift, '*');
+ // m_ugpos.insert ((unsigned) 0,(unsigned) m_alignment->m_startshift, -1); TODO
+
+ m_consensus.append(m_alignment->m_endshift, '*');
+ m_cstatus.append (m_alignment->m_endshift, '*');
+ m_consqual.append (m_alignment->m_endshift, '*');
+ //m_ugpos.append (m_alignment->m_endshift, -1); // TODO
+
+ sort(m_tiling.begin(), m_tiling.end(), TileOrderCmp());
+
+ m_loadedStart = m_loadedEnd = -1;
+
+ m_consfield->setHighlightRange(-1,-1);
+ setGindex(0);
+ emit setGindexRange(0, l-1);
+ }
+ catch (Exception_t & e)
+ {
+ cerr << "ERROR: -- Fatal AMOS Exception --\n" << e;
+ }
+ }
+}
+
+void TilingFrame::setFontSize(int fontsize )
+{
+ if (fontsize == m_fontsize) { return; }
+ m_fontsize = fontsize;
+
+ loadContigRange(m_gindex);
+
+ emit fontSizeChanged(m_fontsize);
+ update();
+}
+
+void TilingFrame::loadContigRange(int gindex)
+{
+ if (m_tiling.empty()) { return; }
+
+ int basespace = 5;
+ double basewidth = m_fontsize + basespace;
+ int tilehoffset = m_fontsize*10;
+
+ if (basewidth <= 0)
+ {
+ basewidth = 1/((-basewidth+2));
+ }
+
+ int minheight = 8;
+
+ if (m_fontsize < minheight)
+ {
+ tilehoffset = minheight * 10;
+ }
+
+
+ m_displaywidth = (width()-tilehoffset)/basewidth;
+
+ gindex = min(gindex, m_consensus.size()-m_displaywidth+1);
+ gindex = max(gindex, 0);
+ m_gindex = gindex;
+
+ int grangeStart = m_alignment->getContigPos(m_gindex);
+ int grangeEnd = m_alignment->getContigPos(min(m_gindex + m_displaywidth+1000, (int)m_consensus.length()));
+
+ if (grangeStart < m_loadedStart || grangeEnd > m_loadedEnd)
+ {
+ QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
+
+ m_loadedStart = max(0, grangeStart-m_loadedWidth/2);
+ m_loadedEnd = min(m_consensus.length(), grangeEnd+m_loadedWidth/2);
+
+ int writepos = 0;
+ int vectorpos = 0;
+ int orig = m_renderedSeqs.size();
+ int erase = 0;
+
+ // remove sequences that are no longer in the view window
+ //cerr << "checking to erase: " << orig << endl;
+
+ std::set<ID_t> keepset;
+
+ for (vectorpos = 0; vectorpos < orig; vectorpos++)
+ {
+ RenderSeq_t & r = m_renderedSeqs[vectorpos];
+ if (RenderSeq_t::hasOverlap(m_loadedStart, m_loadedEnd,
+ r.m_tile->offset, r.gappedLen(),
+ m_consensus.length()))
+ {
+ if (writepos != vectorpos)
+ {
+ m_renderedSeqs[writepos] = r;
+ }
+
+ writepos++;
+ keepset.insert(r.m_tile->source);
+ }
+ else
+ {
+ erase++;
+ }
+ }
+
+ m_renderedSeqs.resize(writepos);
+
+
+ // Render the aligned sequences
+ vector<Tile_t>::iterator vi;
+ vector<Tile_t>::iterator viend = m_tiling.end();
+
+ orig = m_renderedSeqs.size();
+ vector<RenderSeq_t>::iterator ri;
+ int clen = m_consensus.length();
+
+ for (vi = m_tiling.begin(); vi != viend; vi++)
+ {
+ int hasOverlap = RenderSeq_t::hasOverlap(m_loadedStart, m_loadedEnd,
+ vi->offset, vi->getGappedLength(),
+ clen);
+ if (hasOverlap)
+ {
+ // see if this has already been rendered
+ bool found = false;
+
+ if (keepset.find(vi->source) != keepset.end())
+ {
+ found = true;
+ }
+
+ if (found) { continue; }
+
+
+ // hasn't been rendered before
+ RenderSeq_t rendered;
+ rendered.load(m_datastore, &*vi);
+ if (m_displayAllChromo) { rendered.loadTrace(); rendered.m_displayTrace = true; }
+ m_renderedSeqs.push_back(rendered);
+
+ for (int gindex = rendered.m_loffset; gindex <= rendered.m_roffset; gindex++)
+ {
+ int circ = gindex;
+ if (circ < 0) { circ += clen; }
+ circ = circ % clen;
+ int global = m_alignment->getGlobalPos(circ);
+
+ if (m_cstatus[global] != 'X')
+ {
+ if (m_cstatus[global] == '*')
+ {
+ cerr << "err" << endl;
+ }
+ else if (m_cstatus[global] == ' ')
+ {
+ m_cstatus[global] = rendered.base(gindex, false, clen);
+ }
+ else if (toupper(m_cstatus[global]) != toupper(rendered.base(gindex, false, clen)))
+ {
+ m_cstatus[global] = 'X';
+ }
+ }
+ }
+ }
+ }
+ //cerr << "Loaded [" << m_loadedStart << "," << m_loadedEnd << "]:" << m_renderedSeqs.size() << " kept:" << orig << " erased: " << erase << endl;
+
+ QApplication::restoreOverrideCursor();
+ }
+}
+
+void TilingFrame::setGindex(int gindex)
+{
+ if (m_loadedStart != -1 && gindex == m_gindex) { return; }
+
+ if (gindex < 0) { gindex = 0; }
+ else if (gindex > (int) m_consensus.length()) { gindex = m_consensus.length(); }
+
+ loadContigRange(gindex);
+ emit gindexChanged(gindex);
+ update();
+}
+
+void TilingFrame::advanceNextDiscrepancy()
+{
+
+ int gindex = m_gindex+m_nextDiscrepancyBuffer+1;
+
+ while (gindex < (int)m_consensus.length())
+ {
+ if (gindex > m_loadedEnd)
+ {
+ loadContigRange(gindex);
+ }
+
+ while (gindex <= m_loadedEnd)
+ {
+ if (m_cstatus[gindex] == 'X')
+ {
+ setGindex(gindex-m_nextDiscrepancyBuffer);
+ return;
+ }
+ else
+ {
+ gindex++;
+ }
+ }
+ }
+
+ setGindex(gindex);
+}
+
+void TilingFrame::sortColumns(int gindex)
+{
+ vector<RenderSeq_t>::iterator vi;
+
+ if (gindex == -1)
+ {
+ stable_sort(m_renderedSeqs.begin(), m_renderedSeqs.end(), SeqnameOrderCmp());
+ }
+ else
+ {
+ if (SNPTilingOrderCmp::snpposition == gindex)
+ {
+ SNPTilingOrderCmp::reverse = !SNPTilingOrderCmp::reverse;
+ stable_sort(m_renderedSeqs.begin(), m_renderedSeqs.end(), SNPTilingOrderCmp());
+ }
+ else
+ {
+ SNPTilingOrderCmp::snpposition = gindex;
+ SNPTilingOrderCmp::contiglen = m_consensus.length();
+ SNPTilingOrderCmp::reverse = 0;
+ stable_sort(m_renderedSeqs.begin(), m_renderedSeqs.end(), SNPTilingOrderCmp());
+ }
+
+ for (vi = m_renderedSeqs.begin();
+ vi != m_renderedSeqs.end();
+ vi++)
+ {
+ vi->bgcolor = vi->base(gindex, false, m_consensus.length());
+ }
+ }
+ update();
+}
+
+void TilingFrame::advancePrevDiscrepancy()
+{
+ int gindex = m_gindex+m_nextDiscrepancyBuffer-1;
+
+ while (gindex >=0 )
+ {
+ if (gindex < m_loadedStart)
+ {
+ loadContigRange(gindex);
+ }
+
+ while (gindex >= m_loadedStart)
+ {
+ if (m_cstatus[gindex] == 'X')
+ {
+ setGindex(gindex-m_nextDiscrepancyBuffer);
+ return;
+ }
+
+ gindex--;
+ }
+ }
+
+ setGindex(gindex);
+}
+
+
+
+void TilingFrame::searchString(const QString & str, bool forward)
+{
+ if (!str.isEmpty())
+ {
+ int pos;
+ QRegExp regex(str);
+ QString qcons(m_consensus.c_str());
+
+ int gindex = m_gindex + m_nextDiscrepancyBuffer;
+
+ if (forward)
+ {
+ gindex += 1;
+ pos = regex.search(qcons, gindex);
+ }
+ else
+ {
+ gindex -= 1;
+ pos = regex.searchRev(qcons, gindex - m_consensus.length());
+ }
+
+ if (pos != -1)
+ {
+ m_consfield->setHighlightRange(pos, pos+regex.matchedLength() - 1);
+ setGindex(pos-m_nextDiscrepancyBuffer);
+ }
+ }
+}
+
+void TilingFrame::setReadnameWidth(int width)
+{
+ m_tilingfield->setReadnameWidth(width);
+ m_consfield->setReadnameWidth(width);
+}
+
+int TilingFrame::getReadnameWidth()
+{
+ return m_tilingfield->getReadnameWidth();
+}
diff --git a/src/hawkeye/TilingFrame.hh b/src/hawkeye/TilingFrame.hh
new file mode 100644
index 0000000..523aa2f
--- /dev/null
+++ b/src/hawkeye/TilingFrame.hh
@@ -0,0 +1,104 @@
+#ifndef TILINGFRAME_HH_
+#define TILINGFRAME_HH_ 1
+
+#include <q3frame.h>
+#include <q3scrollview.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+#include <string>
+
+#include "foundation_AMOS.hh"
+#include "RenderSeq.hh"
+
+
+class DataStore;
+class TilingField;
+class AlignmentInfo;
+class ConsensusField;
+
+
+class TilingFrame: public Q3Frame
+{
+ Q_OBJECT
+
+public:
+ TilingFrame(DataStore * datastore,
+ AlignmentInfo * ai,
+ QWidget * parent = 0,
+ const char * name = 0,
+ Qt::WFlags f = 0);
+public slots:
+ void setGindex(int gindex);
+ void setContigId(int contigId);
+ void setFontSize(int);
+ void advanceNextDiscrepancy();
+ void advancePrevDiscrepancy();
+ void sortColumns(int);
+ void toggleDisplayAllChromo(bool);
+ void searchString(const QString &, bool forward);
+ int getReadnameWidth();
+ void setReadnameWidth(int);
+
+signals:
+ void gindexChanged( int );
+ void setGindexRange( int, int );
+ void contigLoaded(int);
+ void setStatus(const QString &);
+ void fontSizeChanged(int);
+ void setShowNumbers(bool);
+ void setTilingVisibleRange(int, int, int);
+ void highlightRead(int);
+
+ void toggleShowFullRange(bool);
+ void toggleShowNumbers(bool);
+ void toggleShowIndicator(bool);
+ void toggleDisplayQV(bool);
+ void toggleLowQualityLowerCase(bool);
+ void toggleBaseColors(bool);
+ void toggleSNPColoring(bool);
+ void togglePolymorphismView(bool);
+ void toggleHighlightDiscrepancy(bool);
+ void toggleQVColoring(bool);
+ void toggleShowConsQV(bool);
+ void toggleShowUngapped(bool);
+ void togglePackReads(bool);
+
+protected:
+ void paintEvent(QPaintEvent *);
+
+private:
+
+ void loadContigRange(int gindex);
+
+ DataStore * m_datastore;
+ AlignmentInfo * m_alignment;
+
+ int m_fontsize;
+ int m_gindex;
+ int m_displaywidth;
+
+ bool m_displayAllChromo;
+
+ int m_loadedStart;
+ int m_loadedEnd;
+ int m_loadedWidth;
+ int m_nextDiscrepancyBuffer;
+ int m_contigId;
+ QString m_contigName;
+
+ Q3ScrollView * m_sv;
+
+ std::vector<AMOS::Tile_t> m_tiling;
+ std::string m_consensus;
+ std::string m_consqual;
+ std::string m_cstatus;
+ std::vector<int> m_ugpos;
+
+ std::vector<RenderSeq_t> m_renderedSeqs;
+
+ TilingField * m_tilingfield;
+ ConsensusField * m_consfield;
+};
+
+
+#endif
diff --git a/src/hawkeye/UIElements.cc b/src/hawkeye/UIElements.cc
new file mode 100644
index 0000000..fa3cafb
--- /dev/null
+++ b/src/hawkeye/UIElements.cc
@@ -0,0 +1,169 @@
+#include "UIElements.hh"
+
+QColor UIElements::color_a(Qt::darkGreen);
+QColor UIElements::color_c(Qt::blue);
+QColor UIElements::color_g(Qt::yellow);
+QColor UIElements::color_t(Qt::red);
+QColor UIElements::color_default(Qt::black);
+QColor UIElements::color_discrepancy(153, 102, 255);
+
+QColor UIElements::color_FContig(QColor(170,170,255));
+QColor UIElements::color_RContig(QColor(100,100,255));
+QColor UIElements::color_Scaffold(UIElements::color_FContig);
+
+QColor UIElements::color_Happy(QColor(120,255,120));
+QColor UIElements::color_ExpandedMate(QColor(30,170,255));
+QColor UIElements::color_CompressedMate(QColor(255,255,30));
+QColor UIElements::color_OrientationViolation(QColor(255,30,30));
+QColor UIElements::color_LinkingMate(QColor(255,150,255));
+QColor UIElements::color_SingletonMate(QColor(190,80,255));
+QColor UIElements::color_NoMate(QColor(200,200,200));
+QColor UIElements::color_Unknown(Qt::white);
+
+
+QColor UIElements::color_tiling(180,180,180);
+QColor UIElements::color_tilingoffset(100,100,100);
+QColor UIElements::color_tilingtrim(204, 153, 153);
+
+QColor UIElements::color_snpgap(Qt::cyan);
+
+
+QColor UIElements::color_featdefault(QColor(200,200,200));
+QColor UIElements::color_featrepeat(Qt::white);
+QColor UIElements::color_featunitig(Qt::white);
+QColor UIElements::color_featjoin(Qt::white);
+QColor UIElements::color_featfix(Qt::white);
+QColor UIElements::color_featorf(Qt::white);
+
+QColor UIElements::color_featcoverage(QColor(0,140,221));
+QColor UIElements::color_featsnp(QColor(255,30,30));
+QColor UIElements::color_featbreak(QColor(255,150,150));
+QColor UIElements::color_featkmer(QColor(255,255,0));
+QColor UIElements::color_featmatepair(QColor(125,200,255));
+QColor UIElements::color_featmisassembly(QColor(255,150,0));
+
+QColor UIElements::color_insertcoverage(QColor(255,150,255));
+QColor UIElements::color_readcoverage(QColor(120,255,120));
+
+
+QColor & UIElements::getSNPColoring(char base, bool dark)
+{
+ switch (base)
+ {
+ case 'A':
+ case 'a': return color_a;
+
+ case 'C':
+ case 'c': return color_c;
+
+ case 'G':
+ case 'g': return color_g;
+
+ case 'T':
+ case 't': return color_t;
+
+ case ' ': return color_tilingoffset;
+ case '-': return color_snpgap;
+
+ default: return color_default;
+ };
+}
+
+
+QColor & UIElements::getFeatureColor(AMOS::FeatureType_t type)
+{
+ switch (type)
+ {
+ case AMOS::Feature_t::REPEAT: return color_featrepeat;
+ case AMOS::Feature_t::UNITIG: return color_featunitig;
+ case AMOS::Feature_t::JOIN: return color_featjoin;
+ case AMOS::Feature_t::FIX: return color_featfix;
+ case AMOS::Feature_t::ORF: return color_featorf;
+ case AMOS::Feature_t::COVERAGE: return color_featcoverage;
+ case AMOS::Feature_t::POLYMORPHISM: return color_featsnp;
+ case AMOS::Feature_t::BREAKPOINT: return color_featbreak;
+ case AMOS::Feature_t::KMER: return color_featkmer;
+ case AMOS::Feature_t::MATEPAIR: return color_featmatepair;
+ case AMOS::Feature_t::MISASSEMBLY: return color_featmisassembly;
+ default: return color_featdefault;
+ };
+}
+
+static const char * repeatstr = "Repeat";
+static const char * unitigstr = "Unitig";
+static const char * joinstr = "Join";
+static const char * fixstr = "Fix";
+static const char * orfstr = "Orf";
+static const char * coveragestr = "Coverage";
+static const char * polymorphismstr = "Polymorphism";
+static const char * breakstr = "Breakpoint";
+static const char * kmerstr = "Kmer";
+static const char * matepairstr = "Matepair";
+static const char * misassemblystr = "Misassembly";
+static const char * unknownstr = "Unknown";
+
+//const char * UIElements::allFeatureTypes = "UCPBX";
+
+const char * UIElements::getFeatureStr(AMOS::FeatureType_t type)
+{
+ switch (type)
+ {
+ case AMOS::Feature_t::REPEAT: return repeatstr;
+ case AMOS::Feature_t::UNITIG: return unitigstr;
+ case AMOS::Feature_t::JOIN: return joinstr;
+ case AMOS::Feature_t::FIX: return fixstr;
+ case AMOS::Feature_t::ORF: return orfstr;
+ case AMOS::Feature_t::COVERAGE: return coveragestr;
+ case AMOS::Feature_t::POLYMORPHISM: return polymorphismstr;
+ case AMOS::Feature_t::BREAKPOINT: return breakstr;
+ case AMOS::Feature_t::KMER: return kmerstr;
+ case AMOS::Feature_t::MATEPAIR: return matepairstr;
+ case AMOS::Feature_t::MISASSEMBLY: return misassemblystr;
+ case AMOS::Feature_t::NULL_FEATURE:
+ default: return unknownstr;
+ };
+}
+
+
+QColor & UIElements::getBaseColor(char base)
+{
+ switch (base)
+ {
+ case 'A':
+ case 'a': return color_a;
+
+ case 'C':
+ case 'c': return color_c;
+
+ case 'G':
+ case 'g': return color_g;
+
+ case 'T':
+ case 't': return color_t;
+
+ default: return color_default;
+ };
+}
+
+void UIElements::setBasePen(QPen & pen, char base)
+{
+ pen.setColor(getBaseColor(base));
+}
+
+
+QColor & UIElements::getInsertColor(Insert::MateState state)
+{
+ switch (state)
+ {
+ case Insert::Happy: return color_Happy;
+ case Insert::CompressedMate: return color_CompressedMate;
+ case Insert::ExpandedMate: return color_ExpandedMate;
+ case Insert::SingletonMate: return color_SingletonMate;
+ case Insert::OrientationViolation: return color_OrientationViolation;
+ case Insert::LinkingMate: return color_LinkingMate;
+ case Insert::NoMate: return color_NoMate;
+
+ default: return color_Unknown;
+ };
+}
+
diff --git a/src/hawkeye/UIElements.hh b/src/hawkeye/UIElements.hh
new file mode 100644
index 0000000..e108550
--- /dev/null
+++ b/src/hawkeye/UIElements.hh
@@ -0,0 +1,68 @@
+#ifndef UIELEMENTS_HH_
+#define UIELEMENTS_HH_ 1
+
+#include <qpen.h>
+#include <qcolor.h>
+
+#include "Insert.hh"
+
+
+class UIElements
+{
+public:
+ static void setBasePen(QPen & pen, char base);
+ static QColor & getBaseColor(char base);
+ static QColor & getSNPColoring(char base, bool dark=false);
+ static QColor & getInsertColor(Insert::MateState state);
+ static QColor & getFeatureColor(AMOS::FeatureType_t type);
+
+ static QColor color_tiling;
+ static QColor color_tilingoffset;
+ static QColor color_tilingtrim;
+
+ static QColor color_a;
+ static QColor color_c;
+ static QColor color_g;
+ static QColor color_t;
+ static QColor color_default;
+
+ static QColor color_discrepancy;
+ static QColor color_snpgap;
+
+ static QColor color_FContig;
+ static QColor color_RContig;
+ static QColor color_Scaffold;
+
+ static QColor color_Happy;
+ static QColor color_Unknown;
+ static QColor color_ExpandedMate;
+ static QColor color_CompressedMate;
+ static QColor color_SingletonMate;
+ static QColor color_OrientationViolation;
+ static QColor color_LinkingMate;
+ static QColor color_NoMate;
+
+
+static QColor color_featdefault;
+static QColor color_featrepeat;
+static QColor color_featunitig;
+static QColor color_featjoin;
+static QColor color_featfix;
+static QColor color_featorf;
+
+static QColor color_featcoverage;
+static QColor color_featsnp;
+static QColor color_featbreak;
+static QColor color_featkmer;
+static QColor color_featmatepair;
+static QColor color_featmisassembly;
+
+static QColor color_insertcoverage;
+static QColor color_readcoverage;
+
+ // static const char * allFeatureTypes;
+ static const char * getFeatureStr(AMOS::FeatureType_t type);
+};
+
+
+#endif
diff --git a/src/hawkeye/hawkeye.pro b/src/hawkeye/hawkeye.pro
new file mode 100644
index 0000000..1883c37
--- /dev/null
+++ b/src/hawkeye/hawkeye.pro
@@ -0,0 +1,107 @@
+CONFIG += thread
+
+SOURCES += \
+AssemblyStats.cc\
+BufferedLineEdit.cc\
+CGraphContig.cc\
+CGraphEdge.cc\
+CGraphView.cc\
+CGraphWindow.cc\
+ChromoField.cc\
+ChromoPicker.cc\
+ChromoStore.cc\
+ConsensusField.cc\
+ContigCanvasItem.cc\
+ContigPicker.cc\
+CoverageCanvasItem.cc\
+CoverageRectCanvasItem.cc\
+DetailWidget.cc\
+FeatureBrowser.cc\
+FeatureCanvasItem.cc\
+HistogramWidget.cc\
+HistogramWindow.cc\
+InsertCanvasItem.cc\
+InsertField.cc\
+InsertPosition.cc\
+InsertWidget.cc\
+InsertWindow.cc\
+LaunchPadBase.cc\
+LaunchPad.cc\
+LibraryPicker.cc\
+main.cc\
+MainWindow.cc\
+NChartStats.cc\
+NChartWidget.cc\
+NChartWindowBase.cc\
+NChartWindow.cc\
+NetworkCom.cc\
+OverviewField.cc\
+QueryWidget.cc\
+RangeScrollBar.cc\
+ReadInfo.cc\
+ReadPicker.cc\
+RenderSeq.cc\
+ScaffoldPicker.cc\
+SelectionWidget.cc\
+SplashScreen.cc\
+TilingField.cc\
+TilingFrame.cc\
+UIElements.cc
+
+
+HEADERS += \
+AlignmentInfo.hh\
+AssemblyStats.hh\
+BufferedLineEdit.hh\
+CGraphContig.hh\
+CGraphEdge.hh\
+CGraphView.hh\
+CGraphWindow.hh\
+ChromoField.hh\
+ChromoPicker.hh\
+ChromoStore.hh\
+ConsensusField.hh\
+ContigCanvasItem.hh\
+ContigPicker.hh\
+CoverageCanvasItem.hh\
+CoverageRectCanvasItem.hh\
+DetailWidget.hh\
+FeatureBrowser.hh\
+FeatureCanvasItem.hh\
+HistogramWidget.hh\
+HistogramWindow.hh\
+InsertCanvasItem.hh\
+InsertField.hh\
+InsertPosition.hh\
+InsertWidget.hh\
+InsertWindow.hh\
+LaunchPadBase.hh\
+LaunchPad.hh\
+LibraryPicker.hh\
+MainWindow.hh\
+NChartStats.hh\
+NChartWidget.hh\
+NChartWindowBase.hh\
+NChartWindow.hh\
+NetworkCom.hh\
+OverviewField.hh\
+QueryWidget.hh\
+RangeScrollBar.hh\
+ReadInfo.hh\
+ReadPicker.hh\
+RenderSeq.hh\
+ScaffoldPicker.hh\
+SelectionWidget.hh\
+SplashScreen.hh\
+TilingField.hh\
+TilingFrame.hh\
+UIElements.hh
+
+
+INCLUDEPATH += ../AMOS ../Common ../Slice ../Staden/read ../../ ../Contig
+LIBS += -L../AMOS -L../Common -L../Staden/read -L../Contig/ -lDataStore -lAMOS -lCommon -lAMOS -lCommon -lread -lz
+
+#The following line was inserted by qt3to4
+QT += qt3support
+
+#CONFIG += x86_64
diff --git a/src/hawkeye/icons/AAI.xpm b/src/hawkeye/icons/AAI.xpm
new file mode 100644
index 0000000..eb3e83c
--- /dev/null
+++ b/src/hawkeye/icons/AAI.xpm
@@ -0,0 +1,549 @@
+/* XPM */
+static const char * AAI_xpm[] = {
+"400 289 257 2",
+" c None",
+". c #6668C4",
+"+ c #BBBBFF",
+"@ c #FFFFFF",
+"# c #F7F7F7",
+"$ c #6B6B6B",
+"% c #424242",
+"& c #313131",
+"* c #C6C6C6",
+"= c #525252",
+"- c #000000",
+"; c #E7E7E7",
+"> c #848484",
+", c #949494",
+"' c #101008",
+") c #A5A5A5",
+"! c #636363",
+"~ c #212121",
+"{ c #B5B5B5",
+"] c #D6CECE",
+"^ c #474747",
+"/ c #232323",
+"( c #F8F8F8",
+"_ c #808080",
+": c #7F7F7F",
+"< c #A8A8A8",
+"[ c #0D0D0D",
+"} c #F4F4F4",
+"| c #F1F1F1",
+"1 c #EBEBEB",
+"2 c #464646",
+"3 c #9F9F9F",
+"4 c #E2E2E2",
+"5 c #020202",
+"6 c #3D3D3D",
+"7 c #828282",
+"8 c #DBDBDB",
+"9 c #FEFEFE",
+"0 c #222222",
+"a c #090909",
+"b c #797979",
+"c c #BEBEBE",
+"d c #8A8A8A",
+"e c #151515",
+"f c #1A1A1A",
+"g c #FCFCFC",
+"h c #5C5C5C",
+"i c #060606",
+"j c #ECECEC",
+"k c #737373",
+"l c #B4B4B4",
+"m c #565656",
+"n c #D6D6D6",
+"o c #989898",
+"p c #B9B9B9",
+"q c #393939",
+"r c #050505",
+"s c #EFEFEF",
+"t c #969696",
+"u c #515151",
+"v c #0E0E0E",
+"w c #040404",
+"x c #121212",
+"y c #2B2B2B",
+"z c #5A5A5A",
+"A c #939393",
+"B c #DCDCDC",
+"C c #BABABA",
+"D c #656565",
+"E c #2D2D2D",
+"F c #0B0B0B",
+"G c #252525",
+"H c #555555",
+"I c #9D9D9D",
+"J c #F3F3F3",
+"K c #E3E3E3",
+"L c #C7C7C7",
+"M c #5B5B5B",
+"N c #1C1C1C",
+"O c #333333",
+"P c #7A7A7A",
+"Q c #E4E4E4",
+"R c #ACACAC",
+"S c #4C4C4C",
+"T c #171717",
+"U c #131313",
+"V c #363636",
+"W c #ADADAD",
+"X c #545454",
+"Y c #292929",
+"Z c #101010",
+"` c #0A0A0A",
+" . c #242424",
+".. c #FDFDFD",
+"+. c #EDEDED",
+"@. c #E5E5E5",
+"#. c #E9E9E9",
+"$. c #1E1E1E",
+"%. c #8E8E8E",
+"&. c #2E2E2E",
+"*. c #919191",
+"=. c #CBCBCB",
+"-. c #323232",
+";. c #979797",
+">. c #6F6F6F",
+",. c #010101",
+"'. c #A3A3A3",
+"). c #EAEAEA",
+"!. c #414141",
+"~. c #BCBCBC",
+"{. c #C9C9C9",
+"]. c #353535",
+"^. c #D3D3D3",
+"/. c #DFDFDF",
+"(. c #D4D4D4",
+"_. c #0C0C0C",
+":. c #707070",
+"<. c #646464",
+"[. c #B8B8B8",
+"}. c #DEDEDE",
+"|. c #898989",
+"1. c #D1D1D1",
+"2. c #E8E8E8",
+"3. c #D9D9D9",
+"4. c #9E9E9E",
+"5. c #2F2F2F",
+"6. c #5D5D5D",
+"7. c #D2D2D2",
+"8. c #1D1D1D",
+"9. c #AEAEAE",
+"0. c #080808",
+"a. c #C8C8C8",
+"b. c #696969",
+"c. c #E0E0E0",
+"d. c #B2B2B2",
+"e. c #4E4E4E",
+"f. c #0F0F0F",
+"g. c #CACACA",
+"h. c #E1E1E1",
+"i. c #2C2C2C",
+"j. c #E6E6E6",
+"k. c #727272",
+"l. c #AFAFAF",
+"m. c #FBFBFB",
+"n. c #606060",
+"o. c #3C3C3C",
+"p. c #C3C3C3",
+"q. c #C5C5C5",
+"r. c #181818",
+"s. c #F5F5F5",
+"t. c #595959",
+"u. c #CFCFCF",
+"v. c #B3B3B3",
+"w. c #1F1F1F",
+"x. c #191919",
+"y. c #111111",
+"z. c #141414",
+"A. c #F9F9F9",
+"B. c #C4C4C4",
+"C. c #FAFAFA",
+"D. c #161616",
+"E. c #454545",
+"F. c #686868",
+"G. c #4D4D4D",
+"H. c #070707",
+"I. c #D8D8D8",
+"J. c #C1C1C1",
+"K. c #4B4B4B",
+"L. c #F0F0F0",
+"M. c #6A6A6A",
+"N. c #DADADA",
+"O. c #4A4A4A",
+"P. c #303030",
+"Q. c #A6A6A6",
+"R. c #2A2A2A",
+"S. c #F6F6F6",
+"T. c #6C6C6C",
+"U. c #404040",
+"V. c #8D8D8D",
+"W. c #030303",
+"X. c #535353",
+"Y. c #D0D0D0",
+"Z. c #D5D5D5",
+"`. c #9A9A9A",
+" + c #505050",
+".+ c #585858",
+"++ c #6E6E6E",
+"@+ c #888888",
+"#+ c #282828",
+"$+ c #575757",
+"%+ c #494949",
+"&+ c #BFBFBF",
+"*+ c #B7B7B7",
+"=+ c #272727",
+"-+ c #343434",
+";+ c #7D7D7D",
+">+ c #868686",
+",+ c #262626",
+"'+ c #F2F2F2",
+")+ c #B1B1B1",
+"!+ c #3E3E3E",
+"~+ c #626262",
+"{+ c #5E5E5E",
+"]+ c #818181",
+"^+ c #D7D7D7",
+"/+ c #909090",
+"(+ c #999999",
+"_+ c #BBBBBB",
+":+ c #9C9C9C",
+"<+ c #929292",
+"[+ c #3A3A3A",
+"}+ c #434343",
+"|+ c #EEEEEE",
+"1+ c #787878",
+"2+ c #CECECE",
+"3+ c #767676",
+"4+ c #838383",
+"5+ c #858585",
+"6+ c #A7A7A7",
+"7+ c #6D6D6D",
+"8+ c #202020",
+"9+ c #A1A1A1",
+"0+ c #C0C0C0",
+"a+ c #757575",
+"b+ c #CCCCCC",
+"c+ c #A0A0A0",
+"d+ c #CDCDCD",
+"e+ c #9B9B9B",
+"f+ c #676767",
+"g+ c #3B3B3B",
+"h+ c #666666",
+"i+ c #8F8F8F",
+"j+ c #3F3F3F",
+"k+ c #616161",
+"l+ c #A4A4A4",
+"m+ c #4F4F4F",
+"n+ c #7C7C7C",
+"o+ c #AAAAAA",
+"p+ c #DDDDDD",
+"q+ c #8C8C8C",
+"r+ c #BDBDBD",
+"s+ c #8B8B8B",
+"t+ c #878787",
+"u+ c #7B7B7B",
+"v+ c #1B1B1B",
+"w+ c #A9A9A9",
+"x+ c #373737",
+"y+ c #484848",
+"z+ c #747474",
+"A+ c #959595",
+"B+ c #B6B6B6",
+"C+ c #7E7E7E",
+"D+ c #444444",
+"E+ c #383838",
+"F+ c #717171",
+"G+ c #5F5F5F",
+"H+ c #777777",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [...]
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [...]
+". . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [...]
+". . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [...]
+". . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # $ % % % % % % % % % & * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = - - - - - - - - - - - = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - - - - - - - - - - - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - - - - - - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , > > > = - - - - - - - ' @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = - - - - - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - - - % - - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - , ! - - - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - - - ~ @ * - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - - - - > @ @ ~ - - - ' @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = - - - - ; @ @ ) - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - - - % @ @ @ # ' - - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - { @ @ @ @ ! - - - - ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - - - ' * { * { * > - - - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - - - - - - - - - - - - - - - ' # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = - - - - - - - - - - - - - - - - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - - - - - - - - - - - - - - - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - - - - - - - - - - - - - - - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - - - ~ * { * * { * * { * { - - - - = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - - - - > @ @ @ @ @ @ @ @ @ @ % - - - - # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; > ~ - - - - $ > ] @ @ @ @ @ ; ) > & - - - - = > ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - - - - - - - - - > @ @ @ @ % - - - - - - - - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - - - - - - - & @ @ @ @ - - - - - - - - - - - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - - - - - - - = @ @ @ @ ' - - - - - - - - - - ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ & - - - - - - ~ = # @ @ @ @ { % ' - - - - - - & ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # & - - - - - - ! @ @ @ @ @ @ @ @ @ @ % - - - - - - = # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! - - - - - - - - ; @ @ @ @ @ @ @ @ * - - - - - - - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - - - - - - - - = @ @ @ @ @ @ @ @ = - - - - - - - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - - - - - - - - ' # @ @ @ @ @ @ ; - - - - - - - - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; { - - - - - - - > @ @ @ @ @ @ $ - - - - - - ~ ) ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - - - - ' @ @ @ @ @ # ' - - - - - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # & > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - - - - - ) @ @ @ @ > - - - - - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] ~ - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - - - - - ~ @ @ @ @ ~ - - - - - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] ' - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - - - - - - { @ @ ) - - - - - - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] ' - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - % - - - - & @ @ ~ - - - - ! - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] ' - - - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - > % - - - - ] * - - - - ! > - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] ' - - - - - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - > ) - - - - ! & - - - - * > - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] ' - - - - - - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - > @ ~ - - - - - - - - & @ > - - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] ' - - - - - - - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - > @ ) - - - - - - - - { @ > - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] ' - - - - - - - - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - > @ @ ' - - - - - - ~ @ @ > - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ( _ : : ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] ' - - - - - - - - - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - > @ @ > - - - - - - ) @ @ > - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ < - - - [ } @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ~ - - - - - - - - - - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - > @ @ # ' - - - - ' # @ @ > - - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 2 - - - - 3 @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ~ - - - - - - - - - - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - > @ @ @ ! - - - - > @ @ @ > - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 4 5 - - - - 6 @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = - - - - - - - - - - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - > @ @ @ ; - - - - ; @ @ @ > - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 7 - - - - - - 8 @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! - - - - - - - - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - > @ @ @ @ @ @ @ @ @ @ @ @ > - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 9 0 - a - - - - b @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - - - - - - - - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , = - - - - ~ & % , ; @ @ @ @ # > & % ~ - - - ' = ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ c - - d e - - - f g @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - - - - - - - - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - - - - - - - ! @ @ @ @ % - - - - - - - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ h - i j k - - - - l @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ~ - - - - - - - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - - - - - - - - - - % @ @ @ @ - - - - - - - - - - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ | a - m @ n - - - - = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - - - - - - - - - ' ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - - - - - - - ! @ @ @ @ = - - - - - - - - - - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ o - - p @ @ q - - - r 1 @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ s t u 0 v w x y z A B @ @ @ @ @ @ @ @ @ @ @ @ s t u 0 v w x y z A B @ @ @ @ @ @ @ @ @ @ @ @ @ 9 C D E [ 5 F G H I J @ @ @ @ @ @ @ @ K : : : : : : : @ @ @ L M N w v O P Q @ @ @ @ @ @ R S [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - - - - - - - - - ' ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , = % % % % % % % > # @ @ @ @ # > % % % % % % % = ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ V - $...@ @ I - - - - %.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , v - - - - - - - - - - &.*.( @ @ @ @ @ @ @ @ , v - - - - - - - - - - &.*.( @ @ @ @ @ @ @ @ @ =.-.- - - - - - - - - x ;.@ @ @ @ @ @ @ L - - - - - - - @ g >.,.- - - - - - F '.@ @ @ ).!.- - [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - - - - - - - - - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ (.- - : @ @ @ J _.- - - E @ @ @ @ @ @ @ @ @ @ @ @ @ @ :.- - w <.[.}.; ^.o Y - - - - 8 @ @ @ @ @ @ @ :.- - w <.[.}.; ^.o Y - - - - 8 @ @ @ @ @ @ @ @ '.i - - e |.1.2.3.4.5.- - - 6.g @ @ @ @ @ 7.5.5.5.i - - - @ D - - ` 8._.- - - - ,.9.@ s y - - [ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # & - - - - - - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ k.- ,.c.@ @ @ @ ! - - - - g.@ @ @ @ @ @ @ @ @ @ @ @ C - - - W @ @ @ @ @ @ ( X - - - 8 @ @ @ @ @ @ C - - - W @ @ @ @ @ @ ( X - - - 8 @ @ @ @ @ @ @ l.5 - - y ; @ @ @ @ @ m.n.- - - >.@ @ @ @ @ @ @ @ @ / - - - ) - o.p.9 @ 9 q.O - - - r.s.t.- = u.@ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - - - - - - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ C.D.- E.@ @ @ @ @ * - - - - F.@ @ @ @ @ @ @ @ @ @ @ @ G.- - & @ @ @ @ @ @ @ @ J D.- - 8 @ @ @ @ @ @ G.- - & @ @ @ @ @ @ @ @ J D.- - 8 @ @ @ @ @ @ K v - - H.I.@ @ @ @ @ @ @ m.i.- - - J.@ @ @ @ @ @ @ @ / - - - f K.g @ @ @ @ @ L.f - - - M.- $ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - - - - - - - - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 9.- - < @ @ @ @ @ @ R.- - - f.S.@ @ @ @ @ @ @ @ @ @ @ U - - = @ @ @ @ @ @ @ @ @ b.- - 8 @ @ @ @ @ @ U - - = @ @ @ @ @ @ @ @ @ b.- - 8 @ @ @ @ @ @ h - - - T.@ @ @ @ @ @ @ @ @ W - - - 6 @ @ @ @ @ @ @ @ / - - - [ #.@ @ @ @ @ @ @ > - - - - ~ ( @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - - - - - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ S - x ( @ @ @ @ @ @ V.- - - - '.@ @ @ @ @ @ @ @ @ @ @ W.- - &.@ @ @ @ @ @ @ @ @ v.X.X.; @ @ @ @ @ @ W.- - &.@ @ @ @ @ @ @ @ @ v.X.X.; @ @ @ @ @ @.W.- - - Y.@ @ @ @ @ @ @ @ @ A.f.- - - Z.@ @ @ @ @ @ @ / - - - D @ @ @ @ @ @ @ @ * - - - - |.@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - - - - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; w - ++@ @ @ @ @ @ @ ).r - - - !.@ @ @ @ @ @ @ @ @ @ @ T - - - I @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ T - - - I @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ *.- - - D.@ @ @ @ @ @ @ @ @ @ @ % - - - @+@ @ @ @ @ @ @ / - - - l.@ @ @ @ @ @ @ @ ).- - - - ^.@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; ' - - - - - - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @+- - 1.@ @ @ @ @ @ @ @ X.- - - ,.}.@ @ @ @ @ @ @ @ @ @ $+- - - - M 7.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $+- - - - M 7.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = - - - %+@ @ @ @ @ @ @ @ @ @ @ $ - - - e.@ @ @ @ @ @ @ / - - - 8 @ @ @ @ @ @ @ @ ( - - - r C.@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - - - - - - - & # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ =+- -+@ @ @ @ @ @ @ @ @ *+- - - - ;+@ @ @ @ @ @ @ @ @ @ 1.H.- - - - - O >+(.@ @ @ @ @ @ @ @ @ @ @ @ @ 1.H.- - - - - O >+(.@ @ @ @ @ @ @ @ @ @ @ @ ,+- - - $ @ @ @ @ @ @ @ @ @ @ @ _ - - - / @ @ @ @ @ @ @ / - - - '+@ @ @ @ @ @ @ @ @ - - - D.@ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - - - - - - ' ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ B.- - ;.@ @ @ @ @ @ @ @ @ ..8.- - - $...@ @ @ @ @ @ @ @ @ @ )+_.- - - - - - - 0 :.{.@ @ @ @ @ @ @ @ @ @ @ )+_.- - - - - - - 0 :.{.@ @ @ @ @ @ @ @ @ _.- - - - - - - - - - - - - - - - - - - H.@ @ @ @ @ @ @ / - - - ..@ @ @ @ @ @ @ @ @ - - - ~ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - - - - - - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~+- i B 1 1 1 1 1 1 1 1 1 1 :.- - - - [.@ @ @ @ @ @ @ @ @ @ @ c.{+r - - - - - - - - -.l @ @ @ @ @ @ @ @ @ @ c.{+r - - - - - - - - -.l @ @ @ @ @ @ @ 5 - - - - - - - - - - - - - - - - - - - - # @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ - - - / @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - - - - - - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ } _.- - - - - - - - - - - - - - - - - - m @ @ @ @ @ @ @ @ @ @ @ @ @ )./+-+- - - - - - - - ! m.@ @ @ @ @ @ @ @ @ @ )./+-+- - - - - - - - ! m.@ @ @ @ @ r - - - :.1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ - - - / @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - - - - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 4.- - - - - - - - - - - - - - - - - - - H.+.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ N._ / - - - - - - k.@ @ @ @ @ @ @ @ @ @ @ @ @ N._ / - - - - - - k.@ @ @ @ @ T - - - k.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ - - - / @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - - - - - - ' ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ o.- ,+@ @ @ @ @ @ @ @ @ @ @ @ @ :+- - - - <+@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 9 l E - - - - w 4 @ @ @ @ @ @ @ @ @ @ @ @ @ @ 9 l E - - - - w 4 @ @ @ @ [+- - - M @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ - - - / @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - - - - - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ N.- - @+@ @ @ @ @ @ @ @ @ @ @ @ @ J _.- - - P.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ A.}+- - - - I @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ A.}+- - - - I @ @ @ @ :.- - - V @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ - - - / @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - - - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 1+- w ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~+- - - - 2+@ @ @ @ @ @ ).k 3+@ @ @ @ @ @ @ @ @ @ u.- - - - ]+@ @ @ @ ).k 3+@ @ @ @ @ @ @ @ @ @ u.- - - - ]+@ @ @ @ ~.- - - i } @ @ @ @ @ @ @ @ @ @ @ 4+T T 7 @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ - - - / @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - - - - - ~ # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ g f - e.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ q.- - - - $ @ @ @ @ @ @ ^+- - j @ @ @ @ @ @ @ @ @ A.- - - - d @ @ @ @ ^+- - j @ @ @ @ @ @ @ @ @ A.- - - - d @ @ @ @ 9 .- - - 6+@ @ @ @ @ @ @ @ @ @ ../ - - B.@ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ - - - / @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - - - - - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ l - - )+@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ #+- - - y.( @ @ @ @ @ ^+- - Q.@ @ @ @ @ @ @ @ @ h.- - - - p @ @ @ @ ^+- - Q.@ @ @ @ @ @ @ @ @ h.- - - - p @ @ @ @ @ Q.- - - P.g @ @ @ @ @ @ @ @ @ 9+- - V @ @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ - - - / @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! - - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = - r.m.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ d - - - - 6+@ @ @ @ @ ^+- - #+'+@ @ @ @ @ @ @ @ ;+- - - $.m.@ @ @ @ ^+- - #+'+@ @ @ @ @ @ @ @ ;+- - - $.m.@ @ @ @ @ @ = - - - a+@ @ @ @ @ @ @ @ (.y.- 5 J.@ @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ - - - / @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ' - - - - ' # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 1 1 B r - b.1 1 s @ @ @ @ @ @ @ @ @ @ @ ( 1 1 (.5 - - - }+1 1 1 @ @ ^+- - - O b+@ @ @ @ @ # 5+5 - - W.*+@ @ @ @ @ ^+- - - O b+@ @ @ @ @ # 5+5 - - W.*+@ @ @ @ @ @ @ J [+- - - h @.@ @ @ @ m.c+x - - 5+@ @ @ @ @ @ 1 1 1 ~ - - - 1 1 1 | @ @ } 1 1 1 - - - ~ 1 1 1 @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - - - - - 5.@ @ @ @ @ @ @ @ @ @ @ e+- - - - - - - - - - - @ @ Q f - - - - ,+m f+! E.[ - - - Z R @ @ @ @ @ @ Q f - - - - ,+m f+! E.[ - - - Z R @ @ @ @ @ @ @ @ @ } h - - - w g+~+h+e.z.- - i i+@ @ @ @ @ @ @ - - - - - - - - - - K.@ @ $ - - - - - - - - - - @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - - - - - 5.@ @ @ @ @ @ @ @ @ @ @ e+- - - - - - - - - - - @ @ @ g d.{+r.- - - - - - - - r.k ).@ @ @ @ @ @ @ @ g d.{+r.- - - - - - - - r.k ).@ @ @ @ @ @ @ @ @ @ @ @ ~.E.5 - - - - - - ` {+I.@ @ @ @ @ @ @ @ - - - - - - - - - - K.@ @ $ - - - - - - - - - - @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - - - - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 9 }.{ ;.|.> /+Q.(...@ @ @ @ @ @ @ @ @ @ @ @ @ 9 }.{ ;.|.> /+Q.(...@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 1 l /+4+d e+q.S.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - - - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - - - = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) ! % % % & > ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - - - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - @ @ @ @ @ @ @ @ @ @ @ @ > ' - - - - - - - - ~ * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = - - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * ' @ @ @ @ @ @ @ @ @ @ # ~ - - - - - - - - - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ' - - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * % @ @ @ @ @ @ @ @ @ ] ' - - - - - - - - - - - - - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > % @ @ @ @ @ @ @ @ # ~ - - - - - - = > $ & - - - - - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > > @ @ @ @ @ @ @ @ & - - - - - $ # @ @ @ @ ; % - - - - - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! - - ' # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = > @ @ @ @ @ @ @ { - - - - - ) @ @ @ @ @ @ @ @ ! - - - - ' # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & { @ @ @ @ @ @ @ ~ - - - - ) @ @ @ @ @ @ @ @ @ @ = - - - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ' { @ @ @ @ @ @ ] - - - - & @ @ @ @ @ @ @ @ @ @ @ # ' - - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - ' @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - # @ @ @ @ @ @ , - - - - ] @ @ @ @ @ @ @ @ @ @ @ @ > - - - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - @ @ @ @ @ @ @ = - - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * ~ @ @ @ @ @ @ @ % - - - = @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > % @ @ @ @ @ @ @ % - - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ $ @ @ @ @ @ @ @ & - - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % > @ @ @ @ @ @ @ % - - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ' * @ @ @ @ @ @ @ % - - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - - - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # - ] @ @ @ @ @ @ @ > - - - - ; @ @ @ @ @ @ @ @ @ @ @ @ , - - - - ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - @ @ @ @ @ @ @ @ { - - - - = @ @ @ @ @ @ @ @ @ @ @ @ ~ - - - ' @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , & @ @ @ @ @ @ @ @ @ ~ - - - - ] @ @ @ @ @ @ @ @ @ @ > - - - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! = @ @ @ @ @ @ @ @ @ > - - - - ' ] @ @ @ @ @ @ @ @ ) - - - - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ > @ @ @ @ @ @ @ @ @ @ ~ - - - - ' { @ @ @ @ @ # $ - - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - { @ @ @ @ @ @ @ @ @ @ ] ' - - - - - ~ > * { $ ' - - - - - ~ # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - ] @ @ @ @ @ @ @ @ @ @ @ ) - - - - - - - - - - - - - - - & # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - @ @ @ @ @ @ @ @ @ @ @ @ @ * ' - - - - - - - - - - - - & # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = % @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; = - - - - - - - - - ' > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] $ & - - - - & , # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - ' @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ : : : : : : : : : : : : h.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - - - - - - - - - p.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ $ $ $ - - - - -+$ $ $ p+@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ s+s+s+o @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - - - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - - - ' # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ K : : : : : : : @ @ @ C m 8.r v #+h+=.@ @ @ @ @ @ @ s : : : : : : : : : : +.@ @ @ @ @.: : : : : : : : #.@ @ @ @ @ @ @ 9 C D E [ 5 F G H I J @ @ @ @ @ @ @ @ @ @ @ @ @ s t u 0 v w x y z A B @ @ @ @ @ @ @ *+: : : - - - [ : : : : [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - - - - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ L - - - - - - - @ J = - - - - - - - ,.z+9 @ @ @ @ @ /.- - - - - - - - - - 8 @ @ @ @ =.- - - - - - - - ^.@ @ @ @ @ @ =.-.- - - - - - - - - x ;.@ @ @ @ @ @ @ @ @ @ @ , v - - - - - - - - - - &.*.( @ @ @ @ >.- - - - - - - - - - - [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ' - - - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ /.$ $ $ f.- - - C.j+- - _.~ y.- - - - - t+@ @ @ @ @ +.$ $ V - - - .$ $ $ 1 @ @ @ @ h.$ $ $ i - i.$ $ j.@ @ @ @ @ '.i - - e |.1.2.3.4.5.- - - 6.g @ @ @ @ @ @ @ @ :.- - w <.[.}.; ^.o Y - - - - 8 @ @ @ @ R $ $ $ - - - F $ $ $ $ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - ;+- !+q.9 @ @ Y.!.- - - a ).@ @ @ @ @ @ @ g.- - - z.A.@ @ @ @ @ @ @ @ @ @ B.- - v.@ @ @ @ @ @ @ l.5 - - y ; @ @ @ @ @ m.n.- - - >.@ @ @ @ @ @ @ C - - - W @ @ @ @ @ @ ( X - - - 8 @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - - - - - - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - 0.G.g @ @ @ @ @ # Y - - - A @ @ @ @ @ @ @ @ & - - - Q.@ @ @ @ @ @ @ @ @ @ h - 8.g @ @ @ @ @ @ K v - - H.I.@ @ @ @ @ @ @ m.i.- - - J.@ @ @ @ @ @ G.- - & @ @ @ @ @ @ @ @ J D.- - 8 @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - - - - - ~ ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ' - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - v ).@ @ @ @ @ @ @ A+- - - X.@ @ @ @ @ @ @ @ ;.- - - U.@ @ @ @ @ @ @ @ @ +.0.- ]+@ @ @ @ @ @ @ h - - - T.@ @ @ @ @ @ @ @ @ W - - - 6 @ @ @ @ @ @ U - - = @ @ @ @ @ @ @ @ @ b.- - 8 @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - - - - - - = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - - ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - D @ @ @ @ @ @ @ @ n - - - =+@ @ @ @ @ @ @ @ '+_.- - - I.@ @ @ @ @ @ @ @ %.- W.Q @ @ @ @ @ @ @.W.- - - Y.@ @ @ @ @ @ @ @ @ A.f.- - - Z.@ @ @ @ @ W.- - &.@ @ @ @ @ @ @ @ @ v.X.X.; @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; ' - - - - - - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - l.@ @ @ @ @ @ @ @ ( ,.- - y.@ @ @ @ @ @ @ @ @ D - - - k.@ @ @ @ @ @ @ @ #+- m+@ @ @ @ @ @ @ *.- - - D.@ @ @ @ @ @ @ @ @ @ @ % - - - @+@ @ @ @ @ T - - - I @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - - - - ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - 8 @ @ @ @ @ @ @ @ @ y.- - w @ @ @ @ @ @ @ @ @ b+- - - U ( @ @ @ @ @ @ &+- - B+@ @ @ @ @ @ @ = - - - %+@ @ @ @ @ @ @ @ @ @ @ $ - - - e.@ @ @ @ @ $+- - - - M 7.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - - - - - - ~ # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - '+@ @ @ @ @ @ @ @ @ f - - - @ @ @ @ @ @ @ @ @ @ O - - - ) @ @ @ @ @ @ .+- w...@ @ @ @ @ @ @ ,+- - - $ @ @ @ @ @ @ @ @ @ @ @ _ - - - / @ @ @ @ @ 1.H.- - - - - O >+(.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = - - - - - - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * ! ~ - - - - % , ; ; ) { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - ..@ @ @ @ @ @ @ @ @ w.- - - @ @ @ @ @ @ @ @ @ @ `.- - - !+@ @ @ @ @ ).i - > @ @ @ @ @ @ @ @ _.- - - - - - - - - - - - - - - - - - - H.@ @ @ @ @ @ )+_.- - - - - - - 0 :.{.@ @ @ @ @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; ' - - - - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; & - - - - - - - - - ' ' - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ w.- - - @ @ @ @ @ @ @ @ @ @ J [ - - - ^+@ @ @ @ |.- w j.@ @ @ @ @ @ @ @ 5 - - - - - - - - - - - - - - - - - - - - # @ @ @ @ @ @ c.{+r - - - - - - - - -.l @ @ @ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ ' - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] ' - - - - - - - - - - - - - - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ w.- - - @ @ @ @ @ @ @ @ @ @ @ f+- - - :.@ @ @ 9 / - = @ @ @ @ @ @ @ @ @ r - - - :.1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 @ @ @ @ @ @ @ @ )./+-+- - - - - - - - ! m.@ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ' - - - - - - - - ] @ @ @ @ @ @ @ @ @ @ @ @ ) - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ' - - - - - - - - - - - - - - - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ w.- - - @ @ @ @ @ @ @ @ @ @ @ 2+- - - x # @ @ _+- - p @ @ @ @ @ @ @ @ @ T - - - k.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ N._ / - - - - - - k.@ @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - - - - - - - - ' ] @ @ @ @ @ @ @ @ @ @ @ ~ - - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = - - - - - % > { ) $ ~ - - - - - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ w.- - - @ @ @ @ @ @ @ @ @ @ @ @ ].- - - '.@ @ X - 0 9 @ @ @ @ @ @ @ @ @ [+- - - M @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 9 l E - - - - w 4 @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - - - - - - - - & # @ @ @ @ @ @ @ @ @ { - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ' - - - - ) @ @ @ @ @ @ > - - - - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ w.- - - @ @ @ @ @ @ @ @ @ @ @ @ :+- - - o.@ ; r - t+@ @ @ @ @ @ @ @ @ @ :.- - - V @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ A.}+- - - - I @ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; ' - - - - - - - - ~ # @ @ @ @ @ @ @ @ & - - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - - - > @ @ @ @ @ @ @ @ ! - - - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ w.- - - @ @ @ @ @ @ @ @ @ @ @ @ } v - - - Z.5+- r 2.@ @ @ @ @ @ @ @ @ @ ~.- - - i } @ @ @ @ @ @ @ @ @ @ @ 4+T T 7 @ @ @ @ ).k 3+@ @ @ @ @ @ @ @ @ @ u.- - - - ]+@ @ @ @ @ @ @ - - - v+@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - - - - - - - - - = @ @ @ @ @ @ @ * - - ' ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - - - * @ @ @ @ @ @ @ @ ) - - - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ w.- - - @ @ @ @ @ @ @ @ @ @ @ @ @ b.- - - 7+8+- H @ @ @ @ @ @ @ @ @ @ @ 9 .- - - 6+@ @ @ @ @ @ @ @ @ @ ../ - - B.@ @ @ @ ^+- - j @ @ @ @ @ @ @ @ @ A.- - - - d @ @ @ @ @ @ @ i - - r.@ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - - - - - - - - - ! @ @ @ @ @ @ & - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - - - - > @ @ @ @ @ @ @ @ # ' - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ w.- - - @ @ @ @ @ @ @ @ @ @ @ @ @ Y.- - - W.- - ~.@ @ @ @ @ @ @ @ @ @ @ @ Q.- - - P.g @ @ @ @ @ @ @ @ @ 9+- - V @ @ @ @ @ ^+- - Q.@ @ @ @ @ @ @ @ @ h.- - - - p @ @ @ @ @ @ @ D.- - [ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ' - - - - - - - - - $ @ @ @ @ * - - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ' - - - - > ; @ @ @ @ @ @ @ ; , , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - u+@ @ @ @ @ @ @ @ @ @ @ / - - - @ @ @ @ @ @ @ @ @ @ w.- - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ x+- - - - .9 @ @ @ @ @ @ @ @ @ @ @ @ @ = - - - a+@ @ @ @ @ @ @ @ (.y.- 5 J.@ @ @ @ @ ^+- - #+'+@ @ @ @ @ @ @ @ ;+- - - $.m.@ @ @ @ @ @ @ j+- - - |+@ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - - - - - - - - - - ) @ @ @ = - - = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - - - % > ) ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 1 1 1 1 - - - - k.1 1 1 m.@ @ @ @ 1 1 1 ~ - - - 1 1 1 | @ @ @ 1 1 1 8.- - - 1 1 1 '+@ @ @ @ @ @ @ @ @ @ 4.- - - - d @ @ @ @ @ @ @ @ @ @ @ @ @ @ J [+- - - h @.@ @ @ @ m.c+x - - 5+@ @ @ @ @ @ ^+- - - O b+@ @ @ @ @ # 5+5 - - W.*+@ @ @ @ @ @ @ @ t+- - - , @ @ . [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - - - - - - - - - - , @ ; - - - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ~ - - - - - - - - - ~ ! ) ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - - - - - - - - - p.@ @ @ @ - - - - - - - - - - K.@ @ @ - - - - - - - - - - X.@ @ @ @ @ @ @ @ @ @ s.f.- - i ).@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ } h - - - w g+~+h+e.z.- - i i+@ @ @ @ @ @ @ Q f - - - - ,+m f+! E.[ - - - Z R @ @ @ @ @ @ @ @ @ +.r.- - ,.E.G+i [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - - - - - - - - - - ) = - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] ' - - - - - - - - - - - ' > # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - - - - - - - - - p.@ @ @ @ - - - - - - - - - - K.@ @ @ - - - - - - - - - - X.@ @ @ @ @ @ @ @ @ @ @ T.- - .+@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~.E.5 - - - - - - ` {+I.@ @ @ @ @ @ @ @ @ g d.{+r.- - - - - - - - r.k ).@ @ @ @ @ @ @ @ @ @ @ (.& - - - - - [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ~ - - - - - - - - - ' - - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ! - - - - - - - - - - - - ~ # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ 1 l /+4+d e+q.S.@ @ @ @ @ @ @ @ @ @ @ @ @ @ 9 }.{ ;.|.> /+Q.(...@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ u.e+t+t+4 [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] ' - - - - - - - - - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; ) ! ~ - - - - - - - - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - - - - - - - - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # { > % - - - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - - - - - - - ' ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] * @ @ @ @ @ @ @ @ @ @ # ! - - - - = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! - - - - - - - - - - ~ # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - - & @ @ @ @ @ @ @ @ @ @ @ % - - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - - - - - - - - - - ~ # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - { @ @ @ @ @ @ @ @ @ @ > - - - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # & - - - - - - - - - - & ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - = @ @ @ @ @ @ @ @ @ ; ~ - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; ' - - - - - - - - - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - - & { @ @ @ @ @ @ * ~ - - - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - - - - - - - - - - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - - - - ~ = > > = ~ - - - - - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! - - - - - - - - - - - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - - - - - - - - - - - - - - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - - - - - - - - - - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - - - - - - - - - - - - - - - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = - - ~ ) - - - - - - - - - - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - - ! ! - - - - - - - - - - ~ { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - - , @ ) - - - - - - - - - - ' ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] * @ @ # , $ % % % % % > ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! - - ~ @ @ @ ) - - - - - - - - - - ~ # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # - - - ) @ @ @ @ $ - - - - - - - - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - ~ @ @ @ @ @ @ ! - - - - - - - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; ' - - ) @ @ @ @ @ @ @ ! - - - - - - - - - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - ~ @ @ @ @ @ @ @ @ @ ! - - - - - - - - - ' ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ' - - ) @ @ @ @ @ @ @ @ @ ; & - - - - - - - - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - - ~ @ @ @ @ @ @ @ @ @ @ @ # ~ - - - - - - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - - ) @ @ @ @ @ @ @ @ @ @ @ @ # & - - - - - - - - - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] ' - - - - - - - - ' # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] ' - - - - - - - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - ' @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - - - - - - - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - - - - - - - - ~ # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - ' # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - - - - - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! - - - - - - - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ' - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ~ - - - - - - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; ' - - - - - - - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - - - - - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - - - - - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ' - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ' - - - - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - - - - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - - - - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - ' # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - - - - - - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ~ - - - - - = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - - - - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - - - - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # ' - - - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - ' # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - - - - - ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - - - - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - - - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - - - - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - - - = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - - - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ' - - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - - = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - ; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - - # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ' % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - , @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ' { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ' - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ) - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ , > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - - # @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ] > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ > - & @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ~ - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - - { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # - - ] @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - ~ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ { - ! @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - > @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ * - ) @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ; - * @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ - @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ = @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ [...]
+". . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [...]
+". . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [...]
+". . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [...]
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [...]
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . [...]
diff --git a/src/hawkeye/icons/Hawkeye.jpg b/src/hawkeye/icons/Hawkeye.jpg
new file mode 100644
index 0000000..68789f4
Binary files /dev/null and b/src/hawkeye/icons/Hawkeye.jpg differ
diff --git a/src/hawkeye/icons/Hawkeye.xpm b/src/hawkeye/icons/Hawkeye.xpm
new file mode 100644
index 0000000..2ffcd14
--- /dev/null
+++ b/src/hawkeye/icons/Hawkeye.xpm
@@ -0,0 +1,562 @@
+/* XPM */
+static const char *Hawkeye_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"450 300 256 2",
+" c #000000",
+". c #0A0D0E",
+"X c #0A0D10",
+"o c #030518",
+"O c #161A1D",
+"+ c #130C19",
+"@ c #030228",
+"# c #040836",
+"$ c #161922",
+"% c #171837",
+"& c #110E32",
+"* c #1E2731",
+"= c #1E272E",
+"- c #281731",
+"; c #23282D",
+": c #242734",
+"> c #2A343E",
+", c #27333E",
+"< c #31363E",
+"1 c #362438",
+"2 c #260617",
+"3 c #081745",
+"4 c #161A44",
+"5 c #060D47",
+"6 c #192954",
+"7 c #152A4F",
+"8 c #133767",
+"9 c #271C43",
+"0 c #272847",
+"q c #262B54",
+"w c #2A3440",
+"e c #293445",
+"r c #293656",
+"t c #342A46",
+"y c #353648",
+"u c #363956",
+"i c #352C53",
+"p c #283B63",
+"a c #373D64",
+"s c #164372",
+"d c #39424D",
+"f c #394558",
+"g c #32475A",
+"h c #3A4965",
+"j c #364A73",
+"k c #3B5269",
+"l c #3D5678",
+"z c #3D5979",
+"x c #3C5776",
+"c c #29486C",
+"v c #3E647B",
+"b c #473033",
+"n c #411F38",
+"m c #46364A",
+"M c #463B55",
+"N c #4C3549",
+"B c #483F61",
+"V c #46485A",
+"C c #48525D",
+"Z c #544858",
+"A c #524D55",
+"S c #464B65",
+"D c #495569",
+"F c #435B79",
+"G c #4B5D74",
+"H c #4A5D79",
+"J c #455874",
+"K c #554D64",
+"L c #555869",
+"P c #525C73",
+"I c #565B76",
+"U c #434B71",
+"Y c #4E6075",
+"T c #4C6179",
+"R c #47627B",
+"E c #57616C",
+"W c #526375",
+"Q c #526379",
+"! c #596575",
+"~ c #5C6876",
+"^ c #5B6A7B",
+"/ c #57667C",
+"( c #4F6974",
+") c #695257",
+"_ c #655969",
+"` c #6B5969",
+"' c #616C7C",
+"] c #646777",
+"[ c #66717C",
+"{ c #716C71",
+"} c #7E6B4B",
+"| c #325886",
+" . c #356793",
+".. c #2F74A9",
+"X. c #166496",
+"o. c #4C5B82",
+"O. c #4B6684",
+"+. c #526981",
+"@. c #5B6B83",
+"#. c #556784",
+"$. c #546C94",
+"%. c #5A738A",
+"&. c #5A7593",
+"*. c #486E92",
+"=. c #4E77A8",
+"-. c #636C84",
+";. c #667589",
+":. c #677A95",
+">. c #747988",
+",. c #737B93",
+"<. c #686C93",
+"1. c #667CA3",
+"2. c #3483BA",
+"3. c #378ECB",
+"4. c #3FA2DB",
+"5. c #5C8195",
+"6. c #5286B4",
+"7. c #68839A",
+"8. c #768699",
+"9. c #74868D",
+"0. c #6887A5",
+"q. c #758BA6",
+"w. c #738CB2",
+"e. c #7892AA",
+"r. c #7699BE",
+"t. c #7B9BBD",
+"y. c #7696B7",
+"u. c #6A8FB2",
+"i. c #7AA4B6",
+"p. c #4998D7",
+"a. c #549AD8",
+"s. c #4E8FC8",
+"d. c #489CE2",
+"f. c #569DE2",
+"g. c #54A3DA",
+"h. c #59A7E7",
+"j. c #51ACE9",
+"k. c #6697C9",
+"l. c #669CD5",
+"z. c #789BC1",
+"x. c #6B90C5",
+"c. c #69A5DA",
+"v. c #77A9D6",
+"b. c #65A9E8",
+"n. c #68B2EC",
+"m. c #69B4F2",
+"M. c #76B3EC",
+"N. c #7DB6F9",
+"B. c #7EB9F9",
+"V. c #78B8F5",
+"C. c #6CACEB",
+"Z. c #629FE0",
+"A. c #7AC4F9",
+"S. c #74C9F3",
+"D. c #897574",
+"F. c #8B634E",
+"G. c #867D85",
+"H. c #938579",
+"J. c #ACA878",
+"K. c #C2AD7E",
+"L. c #838999",
+"P. c #918B8B",
+"I. c #8595A9",
+"U. c #849CBA",
+"Y. c #9096AB",
+"T. c #8BA2BA",
+"R. c #93A5B9",
+"E. c #99ACB0",
+"W. c #A8948E",
+"Q. c #B3A496",
+"!. c #ADAEB1",
+"~. c #97A098",
+"^. c #839CC2",
+"/. c #87A8CA",
+"(. c #8CB4DB",
+"). c #94ABC9",
+"_. c #9BB2C9",
+"`. c #97B6DA",
+"'. c #88ABD2",
+"]. c #89B7E4",
+"[. c #81B6F9",
+"{. c #84BBFC",
+"}. c #8ABDFC",
+"|. c #84B9F5",
+" X c #96BBE9",
+".X c #91BEFB",
+"XX c #9ABEF0",
+"oX c #84ADE1",
+"OX c #A5BAD7",
+"+X c #AAB6C7",
+"@X c #A0BBE8",
+"#X c #BCC1A3",
+"$X c #85C1FC",
+"%X c #8CC1FC",
+"&X c #8AC7FA",
+"*X c #88D3FD",
+"=X c #99C2EC",
+"-X c #92C4FD",
+";X c #95C9FE",
+":X c #9BC4F6",
+">X c #9BC5FA",
+",X c #9EC9F6",
+"<X c #9CCBFD",
+"1X c #95C4F6",
+"2X c #9DD0FE",
+"3X c #94D4FD",
+"4X c #ABC1D9",
+"5X c #B5C5D7",
+"6X c #A4C5ED",
+"7X c #A5C8EE",
+"8X c #A9CAEE",
+"9X c #AAC6E9",
+"0X c #A3C6F3",
+"qX c #A1C6F9",
+"wX c #A3CAF5",
+"eX c #A2CCFB",
+"rX c #ACCDF3",
+"tX c #AACDF9",
+"yX c #AED0EF",
+"uX c #A4D0FD",
+"iX c #ADD0F5",
+"pX c #ABD2FC",
+"aX c #AAD6FC",
+"sX c #B4CCE9",
+"dX c #B1CEF4",
+"fX c #B2CEF8",
+"gX c #B4D1EE",
+"hX c #B3D2F5",
+"jX c #B3D3FA",
+"kX c #B4D8FC",
+"lX c #BAD4F5",
+"zX c #BAD5F9",
+"xX c #BDD8F6",
+"cX c #BCD9F9",
+"vX c #B6D8F6",
+"bX c #9AE4FE",
+"nX c #C9ADA5",
+"mX c #C3BCCA",
+"MX c #CCC5A6",
+"NX c #D0CECE",
+"BX c #C0D6F6",
+"VX c #C2DBF6",
+"CX c #C2DBF9",
+"ZX c #C9DEF6",
+"AX c #C9DDF9",
+"SX c #C0D6F9",
+"DX c #C3D5E6",
+"FX c #C5E0FA",
+"GX c #CBE1F5",
+"HX c #CBE1F8",
+"JX c #C6E0F6",
+"KX c #D2E4F5",
+"LX c #D2E4F8",
+"PX c #CEE2EE",
+"IX c #EFF2F4",
+"UX c #F1E6D1",
+/* pixels */
+"x z x x l l l | x l x x l x x x x z x x z z l l l l l l x x x x x z l z z x x x z x x z x l l F z x z x x x x z z z z x z z z z z l z z z l z z l z z z F z z F l l l z z l z l z z z z l F l z l z F F z F F J l l F j z F F z z l z z F z z z z z F F z J F z z z z z z l z z z z z z z z F x F F z z F z z F z z z F F J z z z z z z z z z F J R z z z z z z F z z G z z R z z z F z z F z F l F z J z z z z F H F F F F F F z F F z H z F F z F F J F F F J F F F F F G F F F F F R F F F H F H R G G G [...]
+"x x x x z l l l x l x x x l l x J j z l x l l l l l x l l z l l z z l l l l l x z z l x z l z l z z l z x x z z z x x z x x x z z z z l z z F l l l z z l z l z z z z z z z z l z z z l l l l F z z z z z F | J z z F J F z l J F F | z z z z z z z J x F z l z F z z l F F z z z z v x z F x v z z F F F F F z z F F x z F z F z z R z R z z z z z z R F F z F F z x F z z F z F F F z F z F F F z z z J x z F z F J J z F F z z J F z z R F F F z z z z J F F F F z G F F F H F R R J R G G R H F H R F G [...]
+"z l V.N.N.B.B.V.N.V.V.N.N.N.N.[.[.[.[.N.N.N.N.N.N.[.[.V.N.[.[.[.[.[.[.[.[.[.N.V.V.[.B.[.V.B.B.N.|.|.N.N.N.N.B.N.B.N.B.[.N.N.B.B.B.N.B.[.[.[.N.[.[.[.B.B.B.B.B.B.[.B.B.N.B.{.[.[.[.{.[.}.[.[.[.}.[.}.[.}.[.[.[.}.[.}.[.[.{.[.[.[.[.[.[.B.[.[.{.[.{.[.[.{.[.[.[.{.[.[.[.[.[.{.[.[.{.{.{.[.B.|.B.B.B.[.{.{.{.[.{.{.$X{.{.$X|.{.$X{.{.[.{.}.{.{.{.}.|.|.{.{.{.[.}.[.[.{.|.{.}.[.[.}.[.}.[.[.}.}.}.}.{.{.{.{.}.}.}.[.$X.X}.}.}.}.}.[.[.}.}.}.$X}.}.%X}.$X$X}.}.}.|..X}.}..X|..X.X}.}..X.X.X>X.X%X1X%X-X1X>X.X.X: [...]
+"z x V.V.N.N.V.N.N.|.[.[.N.[.[.[.[.[.N.N.N.N.N.[.[.[.N.[.[.[.N.[.N.[.[.[.[.N.[.N.[.[.N.N.B.[.[.[.|.|.[.N.N.N.B.B.N.N.B.[.B.B.N.N.B.V.N.[.[.[.[.[.[.[.[.[.[.B.N.[.B.[.[.[.N.[.{.[.{.[.{.[.[.[.[.[.[.[.[.[.[.{.[.[.[.[.}.[.[.}.[.[.{.[.[.{.[.{.{.B.B.{.[.[.}.}.[.[.[.}.}.}.[.}.{.{.{.{.{.{.B.B.B.{.{.{.|.{.}.[.{.{.{.{.{.{.}.{.{.|.{.{.[.[.[.{.[.}.}.}.}.$X{.[.[.}.{.{.}.}.}.[.[.}.}.[.}..X}.}.|.|.|.}.}.}.{.{.}.}.}.}.}.}.}.}.}.}.}.}.|.}.}.}.|.|.}.{.{.}.}.}.}.}.}..X.X.X.X%X.X.X|..X}.}..X.X-XXX>X%XXX.X-X. [...]
+"z z N.N.V.V.N.[.[.[.[.[.N.[.[.[.[.[.[.[.N.B.[.N.[.[.[.[.[.[.[.N.[.N.[.N.N.[.B.B.[.[.[.[.B.N.N.[.[.[.[.[.B.B.V.[.B.{.B.B.N.B.N.B.B.V.B.[.[.[.[.[.[.[.[.{.[.[.[.N.B.B.[.{.[.[.{.B.[.[.[.[.[.[.{.[.[.}.[.}.[.[.[.[.[.[.}.[.[.{.}.[.{.[.{.{.{.|.|.{.B.B.{.[.{.[.[.{.{.B.{.{.}.{.[.[.[.}.[.{.B.{.{.{.{.{.{.[.{.{.{.A.{.[.}.}.{.{.}.}.}.}.[.[.[.}.}.[.}.{.{.[.}.[.[.[.{.}.{.}.{.{.{.{.}.[.}.}.|.}.}.}.}.[.|.}.}.}.}.}.}..X|.}.}.}.}.}.%X{.|.%X}.}.{.{.{.{.}.}.}.}..X}.|.|..X.X|.&X&X.X%X-X%X.XXX.X.X.X-XXX1X-X>X> [...]
+"z l N.N.N.N.N.N.[.[.[.[.N.[.[.[.[.N.[.N.B.{.[.N.[.[.[.[.|.{.[.[.N.[.B.N.[.N.[.[.V.V.V.[.B.B.{.|.[.[.[.[.B.{.B.[.[.[.[.[.B.B.B.N.B.B.[.{.N.|.[.{.[.[.[.B.[.[.B.B.[.B.B.[.{.B.[.B.{.[.[.{.[.}.[.[.[.[.[.[.[.[.[.}.}.[.[.[.[.[.[.[.[.[.[.[.{.B.{.{.B.{.[.{.{.{.{.[.{.{.{.{.{.[.N.}.}.{.[.[.B.{.B.{.[.$X$X[.{.{.{.B.{.[.}.{.|.{.{.{.[.{.[.}.{.{.{.{.[.}.}.{.[.}.[.}.}.}.{.{.{.{.}.$X|.|.}.}.|.{.}.{.}.}.}.}.}.}.}.}.}.|..X.X}.|.|.}.|.%X}.|.|.}.}.}.}.$X}.}.}..X|.&X}.&X|.|.%X.X.X.X%X1X}.-X.X.X-X.X}.}.}.-X-X. [...]
+"l z [.B.N.N.N.N.N.[.N.N.N.M.[.[.N.B.N.V.B.B.B.B.N.N.[.[.[.[.[.N.[.B.B.N.N.B.N.[.|.N.B.B.V.|.[.N.[.[.[.}.B.[.B.B.[.{.B.N.N.B.B.B.B.B.B.[.B.B.[.{.{.{.[.{.{.B.B.B.{.B.B.[.[.[.[.[.{.[.{.[.[.[.[.[.[.}.[.[.[.{.[.{.[.[.B.B.B.[.}.[.[.|.|.[.|.{.{.{.[.}.[.[.[.{.{.B.B.{.{.{.}.[.|.}.{.[.{.{.B.B.[.[.[.}.}.[.{.{.B.{.B.{.{.{.[.}.{.[.[.}.|.{.}.[.[.{.[.}.{.{.[.}.{.$X{.{.{.}.[.}.}.[.}.}.}.|.}.|.}.}.}.}.}..X}..X}.[.}..X.X|..X.X}.}.}.}.}.}.}.}.}.[.}.}.}..X}.|.|.|..X&X.X&X.X.X.X|.}.%X&X1X}.}.-X-X-X-X%X%X.X. [...]
+"l z [.[.[.[.[.N.[.[.[.[.N.N.N.N.[.[.[.V.B.N.[.[.[.[.[.[.V.V.N.|.[.[.[.B.[.[.N.[.B.|.B.B.B.B.B.|.[.[.[.[.[.[.[.{.[.B.N.N.B.B.B.B.B.B.[.[.[.[.[.{.[.{.[.[.[.{.B.B.B.B.[.[.}.[.}.}.{.{.[.{.{.[.{.{.}.[.}.[.}.[.[.{.}.}.[.[.B.[.[.}.{.|.[.B.|.{.[.}.{.[.[.}.}.[.B.{.{.B.[.}.[.[.[.}.[.B.{.{.{.{.[.[.{.$X[.{.{.[.$X{.{.{.{.{.}.{.[.}.}.}.}.}.}.}.}.}.}.{.[.{.[.{.{.{.}.{.[.{.}.}.}.}.}.|..X}.}.}.}..X.X}.}.}.}.}..X.X.X|..X|..X|..X.X|.}.}.}.}.{.{.}.$X}.}.}.}..X.X.X.X$X|..X&X|.&X.X%X}.}..X}.}.%X.X}.1X-X&X-X- [...]
+"l J [.|.[.[.[.[.N.N.[.N.N.N.V.[.[.[.N.[.[.N.[.[.[.{.|.N.N.N.[.[.N.B.B.N.N.N.N.[.[.[.B.B.N.|.|.[.[.[.[.B.B.B.B.B.B.B.B.B.B.B.{.B.{.{.B.B.B.B.B.B.B.B.[.[.{.[.B.B.[.B.[.B.[.{.[.{.{.{.[.{.{.B.[.[.[.}.[.[.[.[.{.{.[.}.[.}.[.[.[.}.}.[.{.[.{.{.[.[.[.}.}.{.[.{.[.{.{.[.{.{.[.{.}.}.[.[.}.[.[.}.[.}.$X$X$XB.{.{.[.[.{.{.}.[.{.}.[.}.}.[.}.}.}.}.}.[.{.{.{.{.[.{.}.{.{.{.$X}.{.}.}.}.}.[.}.}.|..X|.}..X}..X.X|..X.X|.|..X|.&X.X|..X|.|..X.X}.}.}.[.}.}.}..X}.}.}..X.X|..X|.|.%X.X}..X}.%X%X}..X}.%X-X-X}.%X%X}.X [...]
+"l x [.[.[.N.{.V.N.[.N.N.B.N.N.N.N.[.[.[.[.N.V.[.B.[.N.|.N.[.[.[.[.[.[.N.N.[.[.[.B.B.B.[.[.[.B.B.{.B.B.B.B.B.{.B.B.B.[.[.[.{.B.B.B.{.B.B.B.[.B.{.{.{.[.[.[.[.{.B.{.{.[.{.[.{.[.[.[.[.[.{.{.[.{.{.[.{.{.[.{.B.[.[.[.[.[.}.}.[.[.[.[.[.[.{.{.[.}.[.[.[.[.[.{.{.{.{.{.{.{.{.}.[.[.}.[.}.[.}.}.}.}.}.{.B.B.B.{.$X{.{.{.{.[.}.{.{.{.{.{.{.[.}.}.[.{.[.{.{.[.{.{.{.{.}.{.}.}.[.}.}.}.[.}.}.}..X.X.X.X.X.X|..X.X.X.X|..X.X&X.X.X.X|..X1X.X|..X|.}.}..X|.}.}.}.}.}.|.}.$X.X&X.X}.%X}.}.}.}..X}.}.}.}.%X%X}..X-X-X%X- [...]
+"l x N.[.[.[.[.N.N.[.N.N.B.N.N.B.B.N.N.B.N.B.B.N.B.B.N.[.[.[.{.N.[.[.[.[.|.[.[.[.[.B.[.[.[.[.B.B.B.B.V.B.B.{.[.{.[.[.[.{.{.B.B.B.B.B.B.B.N.B.[.B.{.|.[.{.{.B.{.{.[.{.{.{.[.{.[.[.{.[.{.{.[.B.{.[.[.{.[.[.{.{.[.[.[.}.[.[.}.[.}.}.{.[.[.[.[.}.}.}.}.[.[.}.{.}.{.B.[.{.{.[.}.[.[.}.[.}.}.}.}.[.}.{.$X{.{.{.{.{.}.[.{.[.}.[.{.$X}.[.{.{.{.[.{.}.{.[.{.{.}.}.$X}.}.{.}.}.}.{.{.|.|..X}.}.}..X|.%X}..X|.}.}..X&X|.|..X.X.X.X|.}.]..X.X.X.X.X.X.X}.|..X}.}.}.}..X|.}.}.}.%X}.}..X|.$X.X.X.X.X.X}..X%X}.}..X%X1X}.; [...]
+"F z [.|.[.[.[.B.[.[.N.N.N.B.N.N.[.[.N.B.N.[.B.B.B.B.N.N.|.[.|.|.[.[.[.[.N.{.{.[.[.B.{.[.B.|.{.[.|.{.{.N.B.B.B.B.[.[.{.[.[.[.B.B.B.B.B.B.B.B.B.[.B.B.B.B.{.[.B.B.{.{.[.{.[.{.[.B.[.[.{.[.{.{.{.[.[.}.}.[.{.{.}.{.[.[.[.[.[.[.}.[.{.[.}.[.[.}.[.[.[.[.{.{.}.[.{.{.[.[.}.{.[.[.}.[.}.[.}.[.[.}.}.[.{.{.{.{.{.{.[.[.{.}.[.}.{.{.{.{.$X{.{.[.{.[.{.}.{.{.[.}.}.[.{.}.{.{.{.{.}.&X.X|..X}.|.}.}..X}.%X|..X}.}.|..X&X.X|.}.&X.X%X.X.X.X|..X.X.X}..X.X}.}.}..X}.%X}.%X}.}..X}.%X&X.X.X.X$X$X.X.X.X.X%X}.%X%X}.%X1X} [...]
+"z z N.[.N.N.[.[.[.[.V.[.B.B.B.N.B.[.[.B.N.B.N.B.B.[.[.[.[.[.N.V.{.{.[.[.B.|.{.{.[.{.B.[.B.B.|.{.V.|.B.B.{.B.B.B.[.{.{.[.[.[.{.{.B.{.{.B.B.B.N.{.B.B.[.{.{.B.B.B.B.B.{.{.{.B.{.{.B.{.B.{.{.{.|.[.[.{.[.{.[.[.}.[.[.[.}.{.}.}.}.[.[.[.{.}.[.[.[.}.}.}.[.}.{.{.{.{.{.{.[.}.}.[.[.}.[.[.}.}.|.}.}.}.{.{.[.{.[.}.[.}.}.}.{.}.{.{.{.{.{.{.{.}.}.[.{.{.{.{.$X}.{.}.{.{.{.{.}.}..X|..X&X}.|..X}.[..X%X}.}..X|.}.|.%X.X.X.X.X.X.X%X.X.X.X.X.X.X}.}..X}.}.%X}.}.}.}.}.%X}.}.}.}..X}.%X}.}..X|.}.}.}.%X}..X-X}..X-X.X| [...]
+"z z [.N.B.N.B.[.[.[.[.B.N.N.B.[.B.[.[.[.N.B.N.B.[.[.[.[.|.{.B.B.{.B.B.{.N.{.[.[.[.[.B.B.B.B.A.B.[.B.B.B.B.B.B.B.B.B.{.[.{.{.{.B.B.B.B.B.{.{.{.B.[.{.{.{.{.[.{.{.[.{.{.{.{.B.B.B.{.B.{.{.{.{.}.B.{.B.B.{.{.{.{.{.}.}.[.{.[.[.}.[.}.[.{.[.[.}.}.[.}.[.[.[.{.{.{.[.[.}.}.[.}.}.}.[.}.}.}.$X}.}.}.|.{.{.{.{.}.}.}.}.}.$X{.$X$X}.{.{.{.{.{.}.}.}.{.[.$X{.}.{.{.}.{.{.}.$X}..X|..X|..X.X.X}.}..X}.|.}..X}.}.}..X%X.X|.}.}.}.}.}.}.|.%X}.}.}..X.X}.}..X}.}.$X}.[.$X}.}.$X}.%X%X.X.X.X}.%X}.}.}.}.}.%X-X}.-X}..X.X. [...]
+"l z [.B.B.[.N.[.[.[.[.B.B.B.B.B.|.[.[.[.N.[.B.B.N.B.[.B.{.B.{.{.B.B.[.[.|.{.{.{.$XB.B.B.{.$X{.$X$XV.B.|.{.{.{.B.{.B.[.[.[.{.{.N.[.{.B.N.A.{.{.{.[.{.{.{.[.{.[.{.[.{.B.B.B.B.[.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.[.[.[.{.}.[.[.[.[.}.}.[.}.}.}.}.[.}.}.[.[.{.{.{.{.{.}.}.[.|.}.}.{.{.{.|.{.{.{.{.{.[.{.{.}.[.{.}.}.[.{.{.}.$X{.{.{.{.}.}.}.[.}.}.}.}.}.{.}.[.}.}.}.}.%X|..X.X.X.X|..X}.}.|..X|.|.|.}.}..X|.%X}.}.|.}.}.}.}.}.%X%X}.}..X}.}.}.}.}.{.}.}.}.}.}.}..X}.}.}.}.}.%X%X.X&X}.}.}.}.}..X%X%X|..X.X.X& [...]
+"l z [.B.[.B.B.B.[.[.[.B.B.B.B.B.N.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.[.{.B.B.{.B.B.V.B.{.B.B.V.B.V.B.{.[.[.[.{.{.B.[.{.[.{.{.B.{.{.B.B.{.{.[.{.{.[.{.|.{.{.[.{.{.[.[.{.B.{.[.{.{.{.B.{.B.[.{.{.[.{.{.[.{.[.[.[.}.{.{.{.[.{.[.{.{.[.[.[.[.{.{.{.}.[.[.{.{.{.{.[.}.}.}.}.}.[.}.{.{.{.{.{.B.{.{.$X}.{.{.[.{.}.{.{.}.}.{.}.$X{.{.{.}.[.{.}.{.}.}.}.$X{.}.[.}.}.}.}.}.}.}.}.}.|.}.}.}.}.}.}.|.}..X%X&X.X.X.X.X-X}.}.}.}.}..X}..X}.{.}..X.X}..X}.%X$X}.}.}..X}..X}..X}.}.}.}.}.}.%X%X.X.X.X-X.X}.}.%X1X%X|..X$ [...]
+"z F B.[.B.[.B.[.B.B.B.B.[.B.{.V.B.B.B.B.B.B.V.|.B.B.B.B.B.B.B.B.B.{.B.B.B.B.B.{.B.B.V.m.V.A.B.B.B.V.V.V.B.B.$X{.B.B.B.{.[.B.B.{.{.{.{.{.B.{.[.[.[.[.[.{.{.{.[.{.{.{.{.{.{.{.{.{.B.{.{.B.B.{.{.{.}.[.{.}.{.}.[.[.[.[.{.[.{.{.{.[.{.{.{.[.{.{.[.}.{.}.[.[.{.[.{.}.[.}.}.}.}.}.}.[.$X{.[.{.B.{.{.{.[.}.{.}.}.{.{.[.}.{.$X}.{.}.}.}.}.}.}.{.$X}.}.{.$X}.}.[.}.}.[.}.}.}.}.$X|.}.}.}.}.}.%X|..X|..X|.|.}.}.}..X%X%X.X|.%X.X|..X|..X&X}.}.-X}.}.}.1X%X.X}.{.$X$X}..X.X}.%X}.}.$X}.}.}.}..X.X%X}..X$X}.%X%X1X}.%X% [...]
+"z l [.B.B.B.V.B.N.B.B.B.[.B.V.{.B.B.V.N.|.$X[.|.[.{.[.N.B.{.B.B.{.B.{.B.B.B.{.B.B.B.V.m.n.V.$XB.{.A.m.n.B.{.B.{.B.{.{.B.{.{.B.B.[.{.B.B.B.{.{.{.{.[.[.{.[.{.{.{.{.{.[.[.{.{.B.[.{.{.B.B.{.{.[.{.[.{.{.|.{.{.{.{.{.[.{.{.{.{.{.{.[.{.{.{.{.[.{.{.{.{.}.{.[.{.[.{.}.}.[.[.}.[.}.[.{.{.{.$X{.{.B.{.}.$X$X[.{.}.{.{.$X[.{.{.}.}.}.}.}.{.[.}.{.}.{.{.}.}.{.}.}.[.}.$X}.}.}.}.}.}.}.}.}.}.}.%X|..X%X{.$X}.}.}..X|.%X|..X.X&X.X.X.X.X%X.X}.%X}.}.}.}..X%X$X}.}.$X.X.X}.}.}.}.%X}.}..X.X}.}..X%X}.%X}.}.%X}.}.1X.X- [...]
+"z z N.N.B.N.[.B.B.B.B.{.B.B.B.B.B.B.N.|.B.{.|.[.[.[.N.[.[.{.B.B.B.B.B.B.B.V.B.B.B.B.V.m.n.m.B.{.{.B.m.m.B.B.{.[.{.[.{.[.{.{.{.{.{.[.{.B.{.B.{.{.{.[.[.}.{.[.{.[.[.}.[.}.[.{.}.[.{.{.{.{.{.{.B.{.{.{.{.{.{.{.[.{.[.}.{.{.{.{.{.{.{.{.{.{.$X{.{.{.{.{.}.[.}.}.[.[.}.[.}.}.}.[.}.}.{.{.{.{.$X$X[.}.{.}.}.}.{.{.}.[.}.[.{.}.}.}.[.}.}.{.}.{.}.}.}.}.}.[.}.[.}.}.}.{.}.}.}.}.{.}.}.}.}.}.|.}.%X%X}.}.}.}.}.}..X.X.X.X-X.X.X-X.X|..X%X.X}..X}.&X.X%X}.-X}.}.}.}.%X.X%X}.}.}.%X%X%X%X%X}.%X}.%X%X}.}.%X}.%X}.1X%X. [...]
+"z l [.B.B.N.B.B.B.B.B.B.B.B.B.B.V.|.B.B.B.N.[.B.[.[.[.[.[.[.B.{.|.{.B.V.V.V.C.A.B.A.B.h.m.h.m.B.B.B.m.h.m.{.B.[.B.{.B.B.{.{.B.{.{.{.B.{.{.{.{.{.{.{.[.{.{.{.B.[.{.[.$X{.{.[.}.[.}.$X{.{.{.$X{.{.{.[.{.{.}.}.{.{.{.}.[.[.{.[.{.{.{.{.{.{.}.{.{.}.}.[.{.{.[.{.}.}.}.}.[.}.}.}.{.}.}.{.}.$X{.{.}.}.}.[.}.}.}.{.}.{.}.}.}.[.[.$X}.[.{.{.}.}.}.}.}.[.[.}.$X}.}.}.$X}..X}.}.}.}.}.}.}..X}.|.$X.X%X}.$X}.$X}.}.|.|..X}.}.}.}.}.&X.X%X.X.X&X|.}..X}.}.%X}.%X%X}.}.%X.X}.}..X}.}..X%X%X%X%X}.}..X%X%X.X}.%X%X%X}.%X. [...]
+"z l B.V.N.[.N.N.B.B.[.B.B.B.B.B.[.[.B.B.B.B.|.{.[.[.{.B.B.[.{.{.B.{.{.V.V.m.m.n.V.{.{.m.m.h.j.B.{.{.V.n.n.V.{.[.{.{.B.N.{.{.B.{.{.{.{.B.$XB.{.$X{.{.{.{.{.{.B.B.{.{.{.B.[.}.[.[.[.}.[.[.[.[.$X[.$XB.{.{.}.}.[.}.{.[.{.}.}.[.[.}.[.[.{.}.{.}.{.}.{.{.}.}.[.[.}.[.[.[.[.}.}.}.}.}.$X{.}.$X}.{.}.}.}.}.}.}.}.}.}.}.{.}.$X{.}.}.}.[.{.}.{.}.}.}.}.}.}.}.$X}.}.}.}.}.}.$X}.}.}.}.%X%X}.}..X|.%X}.-X}.{.}..X}.&X.X%X}..X}.}.%X&X.X%X.X.X.X%X%X}.}..X}.}.%X.X.X}.}.}.}.}.}.}.%X}.%X.X%X%X.X}..X%X%X%X.X%X%X$X}.%X} [...]
+"z z N.B.B.B.B.B.B.B.B.B.B.B.[.B.B.N.N.B.B.B.B.B.B.B.[.{.[.|.{.|.A.{.$X{.B.j.m.h.n.B.[.V.b.h.h.h.B.{.B.h.n.n.{.[.{.{.V.V.B.B.{.{.{.[.{.B.B.B.{.B.{.{.{.[.[.{.{.{.{.{.{.{.[.}.}.}.}.}.}.}.}.{.}.}.{.$XB.{.[.}.}.[.}.{.{.}.{.[.}.$X}.{.}.}.[.{.}.[.}.[.[.[.}.}.}.}.[.}.[.}.{.{.{.}.}.{.{.[.[.{.[.}.[.}.}.}.}.%X}.$X$X}.}.}.{.$X}.$X}.$X}.$X}.}.}.$X{.}.}.$X$X.X}.}.{.}.}.}.}.}.%X}.}.}.%X%X}.$X%X}.$X-X}.}.%X.X.X}.}.-XXX}.}..X.X&X%X%X%X}.}.}..X%X.X%X%X%X}.$X%X}.}.}.%X%X.X.X}.}.}.}.}.}.}.}.%X-X-X%X-X}.%X- [...]
+"z z B.B.[.[.B.[.B.B.B.V.B.B.B.B.N.N.B.B.[.[.B.|.[.B.B.[.[.B.B.B.B.{.{.}.B.n.j.n.h.m.{.{.V.b.h.f.n.{.{.n.n.b.V.{.[.{.V.m.A.B.{.B.{.{.{.$X{.B.{.{.[.{.{.{.{.{.[.{.{.{.[.{.[.[.}.[.[.}.[.}.$X{.{.{.{.{.{.B.B.{.[.{.}.[.{.[.[.}.[.}.}.{.{.[.{.}.[.}.[.}.}.[.}.}.[.}.}.[.}.}.{.{.{.|.}.}.{.}.}.}.{.{.}.}.{.{.}.{.}.{.}.{.{.{.}.$X}.}.}.}.}.{.{.}.$X}.{.}.}.{.}.}.{.$X}.}.}.}.}.}.}.$X$X}.}.}.$X}.}.}.}.}.}.%X.X}..X.X.X%X}.%X}..X.X|.%X%X}.}.}.}.}.%X%X%X%X%X}.$X}.}.%X%X.X.X%X%X%X}.%X%X}.}.}.-X}.-X}.%X%X%X%X- [...]
+"F F {.B.B.[.[.[.B.B.{.B.B.{.B.B.[.[.B.{.|.|.{.{.B.[.{.{.|.{.{.{.{.|.B.{.[.B.b.n.n.h.m.{.[.m.j.a.h.V.{.V.h.h.j.B.{.B.V.m.V.{.{.B.B.$XB.B.B.$XB.{.{.{.{.{.{.{.{.{.}.{.[.}.}.[.[.}.[.}.[.[.{.$X{.{.{.B.{.A.B.B.{.{.{.[.}.}.{.}.{.$X}.{.}.[.{.{.[.}.}.[.}.}.}.}.}.}.[.}.}.[.}.}.%X}.}.}.$X}.[.}.}.}.[.[.{.$X$X$X{.}.}.}.}.}.}.}.}.$X$X{.}.$X[.}.}.}.$X}.}.}.}.}.}.{.}.$X}.%X}.$X}.}.%X}.{.{.$X%X}.$X}.}.}.}.|.&X&X.X}.%X}.|.%X.X&X.X}.}.}..X}.}..X%X%X%X%X}.}.}.}.%X.X%X%X}.-X%X%X}..X}..X%X%X}.%X}.}.}.%X%X}.} [...]
+"J J [.[.[.[.[.[.[.{.B.B.B.B.{.{.[.B.{.[.[.{.[.[.[.|.B.[.{.{.{.{.B.{.V.$X|.{.V.b.b.b.h.h.$X{.h.f.h.h.V.V.b.h.h.V.B.&XV.n.m.{.{.B.B.B.A.{.B.{.{.{.{.{.}.{.{.{.{.{.{.{.}.}.[.{.$X{.{.{.{.{.{.{.{.B.$X$XB.$X{.{.[.{.{.}.{.{.$X{.{.$X[.}.{.}.{.{.[.}.[.}.}.{.{.$X}.{.}.}.}.{.$X}.}.}.}.}.}.}.}.{.}.[.{.}.}.$X}.$X}.}.}.}.}.}.}.}.{.$X}.}.}.$X}.}.}.[.}.}.}.}.}.|.}.%X%X}.}.}.}.}.}.}.}.}.}.$X}.}.}.}.%X}.}.}.$X}.}.%X%X}.}.}.%X.X.X%X.X.X}.}.}.}.%X}.}.}.%X%X%X}.%X%X.X}..X}.}.-X$X%X-X%X}.-X}.%X}.}.$X%X-X}.-X% [...]
+"l l [.[.[.B.[.{.[.{.B.B.{.{.{.B.{.|.[.[.{.{.{.{.{.{.B.{.B.B.A.{.B.$XV.A.V.&X$XV.C.b.p.d.n.A.n.h.h.j.m.V.m.j.h.n.|.{.V.n.j.B.$XB.{.B.{.{.{.A.B.{.{.{.{.{.}.{.{.{.{.{.$X[.{.{.[.{.{.{.B.{.{.B.{.$X{.B.B.{.{.}.{.[.{.$X{.{.{.{.{.$X}.[.[.{.}.{.}.}.}.{.[.{.{.{.{.$X{.[.$X{.{.{.{.{.}.}.[.}.$X{.}.$X}.{.}.}.{.}.}.}.}.}.}.{.}.{.}.}.{.}.{.[.[.}.}.}.}..X}..X-X}..X%X}.|.}.$X}.}..X}.$X}.$X}.$X}.}.}.$X}.$X{.}.}.}.}.%X}..X%X.X|..X&X}.%X.X%X}.}..X}.}..X.X%X%X%X%X%X%X}.&X%X}.-X%X}.}.}.%X}.%X%X%X$X$X%X}.}.}.} [...]
+"F F }.[.B.B.[.[.B.B.{.B.B.B.{.{.[.{.{.{.{.[.{.[.B.{.{.B.$XB.B.B.B.B.B.B.V.V.B.A.V.f.a.f.h.m.V.C.b.h.h.m.V.j.h.h.M.B.$Xn.n.m.{.{.{.{.{.{.{.{.B.{.{.B.{.{.{.{.{.[.}.$X{.{.{.{.{.{.$XB.B.{.A.B.{.{.{.$X{.$X}.{.}.{.{.{.{.}.}.{.{.$X$X[.{.{.{.}.}.}.}.}.}.}.[.}.{.$X}.}.}.}.}.}.}.{.$X$X}.{.}.$X}.{.}.}.}.$X}.{.{.}.}.}.{.}.}.}.{.}.}.}.[.}.}.}.$X$X}.}.%X$X|..X$X}.}.}.}.{.}.}.}.}.}.}.}.}.}.}.%X$X%X}.}.%X}.}.}.}.}..X}.}.%X.X}.%X}..X.X}.}.%X}.%X.X%X}.%X.X%X}.%X-X}.}.%X%X%X.X}.}.-X.X-X%X}.}.%X%X}.}.-X-X- [...]
+"z F [.[.{.B.{.[.$X{.B.B.B.B.B.{.{.{.{.{.B.[.[.B.{.B.B.B.B.$XB.B.{.|.$XV.V.m.n.m.A.n.p.h.f.b.m.V.C.h.f.f.m.m.h.n.b.{.{.n.b.n.{.[.B.B.{.{.B.{.{.$X}.}.{.{.}.{.{.{.{.[.}.[.{.{.[.{.{.{.{.{.{.{.$XB.$X{.$X$X$X{.[.}.{.{.{.{.[.$X{.[.}.}.$X{.[.}.[.}.{.{.}.}.}.}.$X{.}.{.}.{.[.[.}.{.{.{.{.}.{.}.{.}.}.}.}.}.{.}.{.}.}.[.{.$X}.}.}.}.}.}.}.}.%X%X}.}.}.$X$X|.}.$X}.}..X}.}.}.}.%X.X}.%X%X}.}.}.}..X.X.X}..X%X}.$X%X}.}.%X-X%X%X}.%X-X}.%X.X}.%X}.%X%X}.}..X%X}.%X%X%X%X%XXX%X-X%X}.}.%X}.}.%X.X.X}.%X%X}.}.-X}.} [...]
+"z z [.[.[.{.{.{.[.}.[.[.{.B.B.[.{.B.[.{.{.B.B.{.{.B.B.B.$XB.B.$X{.B.B.B.m.n.n.h.n.m.n.b.b.b.b.C.n.h.Z.a.h.n.b.b.h.m.B.A.b.h.B.{.{.{.{.[.[.}.}.}.{.}.}.{.{.{.{.{.[.}.}.[.}.}.[.{.{.{.{.{.{.{.{.{.{.{.{.{.}.}.[.}.}.{.[.}.{.$X}.{.[.$X}.{.}.}.}.$X}.{.{.{.{.{.{.}.}.}.}.$X$X}.}.}.{.{.{.$X[.}.}.}.}.}.}.}.{.{.{.{.}.}.}.}.$X{.}.}.}.}.}.}.$X}.}.$X}.}.}.}.}.}.}.}.}.}.%X%X$X1X.X.X.X.X}.}.%X}.$X%X.X.X}.}.}.{.}.}.}.&X}.%X%X%X}.%X}.-X}.%X.X%X%X.X}.}.%X%X}.%X}.%X.X.X%X-X-X}.}.$X%X%X%X%X%X%X%X%X%X%X%X-X.X. [...]
+"J l [.[.[.{.|.|.{.[.{.[.{.[.{.[.{.|.{.[.B.{.B.{.B.B.B.{.{.B.B.{.B.{.{.B.V.n.h.j.h.C.V.C.b.C.f.f.f.b.f.p.f.C.b.h.h.d.V.$Xm.h.n.{.{.{.}.[.}.[.[.$X|.{.{.{.{.{.{.$X}.[.}.[.}.[.{.{.{.[.{.{.}.{.{.{.}.{.{.}.[.}.}.}.}.}.}.$X$X}.[.}.}.}.}.}.$X{.{.{.}.}.}.{.}.$X}.}.$X}.$X$X}.$X}.$X}.{.$X}.}.}.}.}.}.}.}.}.}.{.$X}.}.}.}.}.}.}.}.{.}.}.}.}.}.[.}.{.}.}.%X}.[.}.}.}.}.$X.X%X}.}.|.&X%X}.}.}.}.}.}.%X$X$X}.$X}.$X}.}.}.}.}.%X-X}.}.%X}.$X}.$X%X}.%X}.}.-X%X}..X%X%X.X%X-X%X%X%X.X}.%X%X}.}.%X.X.X%X%X%X}.}.}.%X- [...]
+"z F [.{.{.{.{.{.{.{.{.[.{.[.{.{.{.{.{.[.{.{.[.{.B.B.[.{.{.{.{.{.{.$X{.B.{.V.b.h.b.c.n.M.b.Z.h.p.p.h.Z.a.f.C.C.f.f.h.h.B.V.h.d.B.{.{.{.[.[.[.[.{.{.{.{.}.{.{.{.}.[.}.{.}.}.{.{.B.[.$X$X{.{.{.}.[.{.{.{.{.}.}.{.}.|.$X}.}.{.{.{.}.}.}.}.}.}.{.}.{.}.}.$X}.}.{.$X$X}.{.{.{.}.$X}.}.}.{.{.}.}.}.}.}.}.}.}.[.}.}.}.}.[.}.}.}.}.}.$X[.$X}.}.$X}.}.}.}.$X$X}.$X}.}.{.{.}.%X%X$X}.}..X|.}.$X%X}.}.$X}.}.$X$X}.}.}.%X%X%X}.$X}..X.X}.}.1X%X$X$X%X%X&X|.;X}.-X%X|.%X.X.X%X%X%X%X}.}.%X%X-X.X}.%X%X%X.X%X%X%X-X-X%X%X. [...]
+"z z [.{.[.[.[.{.[.{.B.{.{.B.{.{.{.{.{.[.[.{.{.{.B.{.{.{.$X{.{.{.{.$X{.$X|.{.V.n.f.l.l.d.d.l.a.s.p.h.b.l.a.h.b.a.3.j.h.m.B.n.g.n.{.{.{.{.B.{.{.{.{.}.[.{.{.{.[.{.{.{.}.{.{.{.{.{.{.{.[.{.}.{.[.}.[.}.{.{.{.{.{.$X{.{.}.{.{.$X$X{.}.[.}.}.}.}.{.}.{.}.}.}.}.}.{.}.}.{.{.}.{.}.}.}.}.}.$X}.$X}.}.}.}.}.}.}.}.}.}.}.{.}.}.}.}.}..X}.}.}.$X%X}.}.}.}.}.}.}.}.}.}.$X}.}.%X}.}.}.$X$X%X}.$X%X}.}.%X}.}.}.}.%X%X}.%X%X%X%X}.%X%X.X.X1X}.}.%X%X%X.X.X}.%X%X%X%X.X%X-X%X%X}.%X}.}.%X}..X-X.X-X%X%X%X}.-X%X}.-X%X%X.X- [...]
+"z z [.{.{.[.{.[.{.{.{.[.{.{.{.{.{.{.B.B.{.{.{.{.}.}.{.{.{.[.{.[.{.{.{.{.{.B.&XB.C.k.=.2.p.h.b.s.s.c.c.C.l.a.Z.Z.s.p.h.b.C.n.h.h.V.{.{.{.V.B.{.{.$X}.}.}.}.[.{.}.[.}.$X{.{.}.{.}.{.{.{.{.$X{.{.{.{.{.[.{.}.[.}.}.{.}.}.}.{.{.{.{.{.}.}.}.{.{.}.}.{.}.}.}.}.$X$X$X{.$X}.$X{.}.{.[.}.$X$X{.}.}.{.{.}.$X}.{.}.}.$X}.}.}.$X}.}.}.}.}.}.}.}.}.%X-X}.}.}.[.}.}.$X}.%X%X}.%X}.}.}.$X$X}.}.%X$X}.}.}.-X}.%X%X%X}.%X}.}.%X%X$X}.}.-X}..X%X%X}.%X%X}.-X}.-X%X%X}.%X%X%X%X-X%X-X}.%X%X%X%X.X}.}.}.-X-X}.-X.X-X-X%X-X.X- [...]
+"z z {.{.B.B.B.B.[.{.{.}.{.[.{.{.{.B.{.{.A.B.{.{.[.[.{.[.{.}.[.}.{.[.{.B.B.{.{.{.}.c.$.c .s.b.l.l.l.l.l.b.s.3.p.p.p.p.h.j.n.h.b.b.{.B.B.m.m.{.[.[.{.{.[.}.{.[.$X{.{.{.}.}.[.{.{.}.[.{.}.$X}.}.{.}.}.}.$X{.}.[.{.}.{.}.$X%X$X{.{.{.{.[.{.$X{.{.}.{.}.{.$X}.{.{.{.{.{.}.}.}.}.}.{.{.{.$X{.{.{.$X$X}.$X}.{.{.{.{.}.$X}.}.}.}.}.}.-X}.$X{.}.%X%X}.}.}.}.}.}.}.}.}.$X%X}.%X.X%X}.%X}.%X}.}.$X}.%X}.-X%X}.%X%X%X%X-X%X%X-X}..X}..X}.}.-X%X-X.X%X%X%X}.-X%X%X}..X}.%X}.-X%X.X-X-X%X%X%X.X%X-X}.%X-X%X%X%X%X%X-X%X> [...]
+"F z }.{.[.{.{.{.{.[.[.[.{.[.[.{.{.B.B.{.{.B.B.{.[.}.{.$X}.[.{.}.{.[.{.{.{.{.{.{.$Xc.6.o.o.6.u.c.c.s.=.6.s.3.2.X...a.s.p.d.h.b.b.g.C.{.{.M.b.A.{.{.{.{.{.{.{.{.{.{.{.{.{.}.[.}.}.}.{.}.}.}.{.{.{.}.}.}.{.}.{.$X$X{.}.{.$X$X$X$X$X{.$X{.{.}.{.{.$X$X}.}.}.}.{.{.$X$X{.{.$X}.$X{.{.}.}.}.$X}.}.}.}.}.{.}.}.{.}.{.$X$X}.}.}.$X}.|.{.{.}.$X}.}.}.}.}.{.}.$X$X%X}.$X}.}.}.%X}.%X%X}.}.-X}.}.$X$X}.}..X}.-X}.%X}.}.%X%X}.%X}..X-X}.%X-X%X%X.X%X%X%X-X}..X%X-X%X}.%X}.-X%X%X%X%X%X%X%X%X%X%X-X%X%X%X-X%X%X;X-X-X-X- [...]
+"z F [.{.[.{.{.{.[.{.{.{.}.[.{.{.[.$X$XB.{.B.{.{.{.[.B.{.B.{.{.{.}.{.{.{.{.[.{.{.{.B.C.k.1.O.&.u.u.=.l Q o. .=.o.o.x.k.s.s.d.b.f.h.j.V.$Xn.h.n.$X{.{.}.{.{.{.$X{.{.{.}.{.{.[.}.}.{.{.{.$X}.{.}.}.{.[.{.{.}.{.$X{.$X{.}.$X{.{.{.}.$X{.{.{.}.$X{.}.}.}.}.$X}.$X}.$X$X{.}.}.}.$X{.{.{.$X{.}.{.}.}.$X}.}.$X$X$X$X$X}.}.}.}.}.}.}.$X{.}.}.}.}.}.%X}.}.}.$X}.$X%X$X$X&X}.$X}.}.%X%X}.%X%X}.}.}.-X}.%X%X%X%X-X}.}.1X}.$X}.%X.X-X-X%X-X%X%X%X.X%X%X-X}.-X-X%X-X}.-X-X%X-X%X-X-X%X-X%X-X-X.X%X.X-X-X%X%X}.%X-X%X-X}.- [...]
+"F z [.{.{.B.B.B.{.{.{.}.{.}.{.|.$X{.{.{.{.{.{.[.{.{.B.{.{.{.{.{.{.{.{.{.{.$X{.{.$X{.N.b.6.U o.:.:.o.p j $.o.$.5.:.0.u.6...=.h.p.p.j.h.A.N.h.h.B.$X{.$X{.$X}.[.}.[.{.{.}.$X}.{.}.{.}.{.{.}.$X{.{.{.}.{.}.{.$X{.$X{.$X{.{.{.}.}.}.}.}.{.$X{.{.}.$X{.}.$X}.}.$X$X{.}.}.{.$X}.{.}.}.$X$X$X$X}.$X}.}.{.{.$X}.$X{.}.}.}.{.$X}.%X}.|..X}.}.}.{.}.$X}.$X}.}.$X}.{.$X$X%X$X}.%X$X.X%X%X%X}.-X}.}.%X%X%X%X%X}.%X-X%X-X-X-X%X%X-X.X%X%X%X%X%X%X.X}.%X%X%X%X%X%X-X}.%X-X.X%X.X-X}..X%X.X}.%X%X-X-X%X%X%X%X%X&X%X-X-X}.> [...]
+"z F {.{.{.{.{.{.{.{.[.{.{.}.}.|.{.{.$X{.{.{.[.{.[.{.B.{.{.{.{.{.{.B.{.{.{.{.{.{.{.{.{.N.0.M J <.#.H I ;.:.%.:.q.0.q.0.0.| X.p.c.3.g.h.B.{.b.b.N.$X}.{.$X}.$X}.}.}.}.{.}.}.[.}.$X}.$X}.{.{.[.$X{.}.$X{.{.{.{.{.$X$X{.{.$X}.$X{.$X}.{.}.$X}.$X}.{.$X}.$X}.{.}.}.}.{.}.}.}.$X$X$X$X}.%X}.|.{.$X}.}.}.}.}.{.}.}.{.$X$X$X$X%X}..X&X.X}.}.}.}.}.}.$X}.}.%X}.}.$X%X$X$X%X%X-X%X%X%X%X%X%X$X$X%X%X}.1X}.%X}.}.}.}.}.%X}..X}.-X}.}.$X}.%X-X%X.X%X%X%X%X}..X}.%X%X%X%X.X.X%X%X%X-X%X%X%X%X}.-X%X-X}.%X-X-X-X-X-X-X1X} [...]
+"z z {.{.}.{.{.}.{.{.{.{.{.$X}.[.{.{.{.{.{.[.[.}.{.{.{.{.{.[.}.[.B.{.{.{.{.}.{.{.{.}.{.}.x.z h @.#.+.;.q.:.7.I.7.:.8.&.F s 7 .l.3.3.d.m.{.m.h.b.{.{.$X$X{.}.{.{.{.$X}.$X$X{.{.}.}.[.$X}.}.}.}.{.}.$X$X}.{.{.{.{.{.{.}.{.{.$X$X$X}.{.}.{.{.{.}.}.{.}.}.}.$X}.}.}.}.}.{.$X}.}.$X{.}.}.}..X}.}.}.}.$X}.}.}.}.$X$X{.$X{.{.}.%X.X.X}.$X}.$X}.}.%X%X%X}.-X}.%X%X}.}.%X}.-X%X%X%X}.%X$X}.%X%X$X%X%X-X}.&X%X}.%X%X%X-X}.-X%X}.%X&X$X%X%X%X%X}.-X%X%X}..X%X.X-X-X-X-X%X.X.X.X.X%X-X%X-X%X%X%X-X&X-X%X-X}.-X-X>X-X1X1 [...]
+"z z {.}.{.[.{.[.{.{.{.{.|.{.{.}.{.{.{.{.}.[.{.[.$X{.$X{.{.}.{.}.$X{.{.}.[.{.{.$X}.[.}.}.l.6.o.U @.:.8.T O.e.q.#.Y :.#.q 5 6 +.6.6...2.d.m.V.j.h.V.{.{.{.{.$X{.{.{.$X$X{.}.$X{.{.}.{.}.[.}.$X{.}.{.{.{.$X{.{.}.$X{.{.{.}.}.{.}.{.{.{.}.$X{.}.{.$X}.{.{.}.}.$X{.}.}.$X$X}.}.$X}.}.$X.X$X}.$X$X{.}.}.{.}.$X$X{.$X$X}.}.}.}.%X$X$X}.}.}.%X-X}.%X$X}.}.$X}.}.%X%X}.%X%X}..X}..X}.$X$X}.%X%X$X&X%X$X%X%X%X%X%X-X}.}.}.%X%X%X%X%X%X%X%X-X%X}.%X}.%X-X%X.X%X%X-X%X-X%X.X%X%X%X-X%X.X-X%X%X-X%X}.&X%X-X-X%X1X1X>X>X, [...]
+"F z {.|.[.}.{.{.}.[.{.{.}.{.{.{.{.{.{.{.|.}.[.}.}.[.}.{.{.{.$X}.$X{.{.{.[.}.}.$X}.{.}.[.|.c.=.U J &.,.x J w.:.H k #.^ k q J ,.;.$.=...3.p.h.j.h.h.{.{.$X{.{.{.}.$X{.{.}.&XB.$X$X{.$X$X$X$X}.}.$X$X}.$X}.{.}.{.$X[.{.$X{.{.}.}.{.$X$X$X{.$X$X}.}.}.}.}.$X}.}.$X$X}.$X}.}.}.}.$X$X}.$X{.$X}.}.}.$X}.$X}.}.$X}.$X$X$X%X}.%X}.$X$X$X}.$X}.$X%X%X}.$X%X$X%X$X$X-X$X}.%X-X%X%X%X%X-X%X$X$X&X%X%X}.-X}.%X$X}.%X%X}.-X%X}..X}.$X}.%X%X%X%X%X-X%X&X%X.X%X%X.X%X%X%X%X%X-X-X-X}.-X.X.X-X.X.X%X-X%X-X%X;X-X-X>X>X>X>X1 [...]
+"F F {.{.[.{.{.{.{.[.$X}.[.}.$X}.{.{.{.{.[.$X{.[.{.{.{.}.{.$X$X{.{.{.[.}.}.[.{.{.{.{.{.}.}.B.u.a h H -.H <.e.,.#.J @.;.#.^ :.5.,.#.s . ...j.b.j.h.n.$X$X}.$X{.{.}.}.{.{.$X{.B.$XB.$X}.$X{.}.{.}.{.}.{.{.{.$X{.}.}.}.}.{.{.$X$X{.$X}.}.{.}.}.{.}.%X$X}.}.}.$X$X{.{.}.$X$X}.$X%X$X{.}.}.}.{.$X$X}.}.}.$X$X{.$X%X}.}.}.}.$X}.}.}.%X$X}.}.}.%X%X}.$X}.$X%X%X}.}.%X}.}.}.%X%X}.}.%X}.%X%X%X%X%X}.%X-X-X}.$X%X%X$X%X}.$X%X-X%X-X&X%X&X&X%X}.-X%X-X%X-X-X%X-X%X%X-X-X-X-X}.-X%X.X-X.X-X%X-X-X-X%X-X&X-X>X-X>X>X>X, [...]
+"F z {.{.{.{.{.$X{.}.}.[.{.}.{.{.|.}.}.}.{.[.{.}.}.}.$X{.$X}.{.{.{.{.{.{.}.{.}.[.{.[.}.}.}.}.l.J S I -. at .:.q.:.:.-.H #.%.,.%.+.7.I 4 j U .p.h.h.b.h.B.{.$X}.{.}.{.{.{.$X{.{.{.$X}.{.{.}.$X}.}.$X{.[.}.{.{.{.{.}.$X$X}.$X$X$X$X}.}.$X}.}.{.{.{.$X}.}.$X}.}.}.$X}.{.}.}.{.$X}.}.%X$X}.}.}.}.$X}.}.%X%X|.{.$X%X$X}.}.}.}.}.}.%X}.%X}.}.$X}.$X%X}.%X}.%X%X}.$X%X%X%X%X%X%X&X%X%X%X$X%X%X%X%X}.%X}.%X}.%X%X%X%X%X%X%X.X&X%X%X%X%X%X%X-X-X-X}.-X-X.X%X.X%X%X.X-X%X.X%X%X.X.X%X%X-X%X-X-X.X-X-X-X-X-X1X>XXX:X>XqX, [...]
+"J z {.{.[.}.}.}.}.{.}.}.}.[.{.{.{.|.|.$X}.}.}.}.}.}.}.{.}.{.{.{.}.}.$X{.$X{.}.$X{.}.}.}.}.}.C.6.o.J / :.:.%.H -. at .U j 7.w.+.G %. at .f a o.o.=.a.j.f.n.m.$X}.{.$X$X$X{.{.$X{.$X$X{.}.}.}.$X{.}.$X$X{.}.{.}.}.$X{.}.{.{.{.$X}.}.}.}.}.{.}.{.$X}.}.$X{.}.}.}.}.$X}.$X{.$X$X{.}.$X}.$X%X}.$X$X$X&X%X}.$X%X%X|.}.}.$X}.$X}.}.$X$X%X}.%X}.}.-X}.$X$X$X%X%X}.$X$X}.-X%X%X}.-X}.}.}.%X%X%X%X%X}.%X%X%X$X%X%X-X%X%X%X%X%X%X%X%X&X&X-X%X%X%X%X%X-X-X.X%X-X-X.X-X%X.X-X-X-X.X-X-X-X-X-X-X-X%X-X-X-X-X>X-X-X}.qX-X>XqXqX, [...]
+"F z }.}.}.}.|.[.[.}.[.[.}.}.}.[.[.}.}..X}.}.|.}.}.}.}.}.$X{.{.{.{.[.}.{.}.{.{.{.}.{.{.}.}.}.[.b.k.&.J #.:.-.D I @.U G 7.7.#.h #.+.T H :.:.&.=.p.3.a.h.m.$X}.}.B.{.{.$X}.$X}.{.}.{.}.}.}.{.$X}.}.{.}.}.{.{.}.$X}.$X}.{.{.$X{.[.}.{.}.$X{.}.$X}.{.}.{.$X}.}.}.{.{.{.{.$X$X%X$X$X}.}.}.}..X}..X&X|.}.}.{.&X$X$X%X%X}.%X$X}.%X%X$X$X%X%X%X$X}.}.}.-X}.$X$X%X}.&X%X}.&X%X%X%X%X%X%X%X%X&X-X}.%X%X%X$X$X-X}.%X&X}.%X}.%X%X%X%X-X}.%X%X-X%X.X-X.X.X%X-X%X.X-X-X-X%X%X%X.X-X-X%X-X-X-X-X-X-X-X>X>X>X>X:X>X>X>XqXqXq [...]
+"F U .X}.}.}.}.}.[.[.}.}.}.[.}.}.}.[.}.}.}.}.|.}.}.}.[.}.}.{.{.{.{.}.{.{.{.{.$X{.{.$X{.}.[.}.&X{.N.1.J U #.-.#.<.8.#.,.&.+.%.H o.#.7.q.&.%.7.H | 3.2.3.d.m.$X$X{.}.$X$X}.}.}.}.}.$X{.$X{.{.}.}.$X$X{.}.{.{.$X}.}.}.$X$X{.}.}.}.}.{.{.}.}.{.$X{.}.%X$X}.$X}.$X{.}.}.{.}.}.%X}.$X}.%X}..X%X.X}.}.}.&X%X%X}..X&X.X$X}.}.%X}.$X%X$X$X$X}.}.}.}.$X%X%X-X}.$X%X%X%X%X}.%X}.}.-X%X%X%X}.%X%X-X%X%X%X%X%X}.%X%X%X%X}.%XXX%X&X%X%X}..X-X%X%X%X%X%X%X%X%X%X-X%X-X-X-X>X}.-X%X.X%X%X-X-X-X-X-X>X>X-X-X>X>X-X>X1XqX<X<X> [...]
+"J F }.}.}.}.}.}.}.}.}.}.[.}.[.}.}.}.}.[.}.}.}.}.}.[.}.{.{.{.}.}.$X}.[.{.}.$X{.{.$X$X}.{.}.}.$X$X}.$.U D #.:.&.,.;.#.,. at .D #.#.U %.q.q.#.O.0.-.p .=...3.4.A.$X}.}.}.{.}.{.}.{.}.}.}.$X{.{.}.}.}.}.{.}.}.}.}.}.$X$X}.}.{.}.{.{.$X$X{.}.}.$X{.$X}.$X}.$X}.$X}.{.$X%X}.}.$X}.}.$X}.}.%X}.$X$X}.&X$X$X$X%X$X$X.X}.%X%X}.}.}.-X%X}.%X%X}.-X%X$X%X-X$X}.%X%X%X-X}.1X}.%X$X%X%X%X$X%X%X-X}.%X%X-X}.%X%X%X%X1X-X}.}.-X}.-X%X&X%X%X%X%X.X%X%X.X%X%X%X-X%X%X-X-X-X-X%X}.>X>X-X}.-X-X-X>X-XXXqX>X-X>X>XXX>XqX>X>X,X,X, [...]
+"z o.}.}.}..X}.}..X|.}.}.[.}.}.}.}.}.}.}.}.}.{.[.}.}.{.}.$X{.$X$X}.}.}.{.{.{.$X{.{.$X}.{.[.}.{.%X|.u.I S I #.:.8. at .H <.I U I <.-.:.:.;.H l &.#.#.$.*.H X.3.j.{.[.$X}.$X}.}.{.$X$X{.}.{.}.$X$X$X}.}.$X$X}.}.}.$X}.{.}.$X}.}.$X}.$X{.}.$X}.}.}.}.$X}.$X}.}.$X}.}.}.%X%X}.}.$X%X}.}.$X}.%X}.%X}.$X}.}.$X}.}.}.}.}.$X$X}.-X}.%X}.}.$X%X&X%X%X%X}.}.%X-X}.-X%X%X}.%X%X%X%X%X%X%X}.%X}.$X-X%X}.%X-X%X-X%X1X}.%X1X%X%X-X}.%X&X%X}.-X-X.X.X-X-X-X-X-X%X-X-X%X-X-X-X-X-X-X-X-X-X-X-X>X>X>X>X.X>X>X-X>X>X>X>X>X>XqXqX> [...]
+"F F }.}.|.}.}.}.}.}.[.}.}.}.[.}.}..X}.}.}.}.}.}.{.{.$X}.}.}.}.{.{.}.}.[.[.}.$X$X$X{.}.[.{.{.{.}.|.Z.6.P S D @.:.;./ -.-.:.,.%. at .<.;.O.T #.%.%.7.:.%.%.x ..3.j.V.{.$X$X$X{.}.$X{.{.}.{.}.$X}.}.}.}.}.{.}.}.}.}.$X}.}.}.$X}.{.}.}.}.$X}.}.}.}.}.}.}.}.$X}.$X}.}.}.$X$X%X$X}.}.}.}.$X}.%X%X%X}.%X$X}.%X$X}.%X$X-X%X.X&X%X}.}.%X%X}.%X-X-X%X%X%X%X%X}.-X%X-X%X%X%X$X}.-X%X%X-X%X%X%X}.-X}.}.-X}.}.-X}.1X%X%X}.%X&X&X-X-X&X%X%X%X&X-X.X%X%X%X.X-X.X%X%X%X%X-X-X-X-X-X%X-X1X1X1X:X>X:X:X>X:X>X:X:X<X>X:X>X:X:X,X> [...]
+"H J }.}..X}.}.}.|.}.}.}.}.[.}.}.$X}.}.}.}.{.[.}.}.}.}.}.$X{.{.$X{.}.}.}.}.}.}.}.}.{.}.}.}.{.}.$X}.V.v.:.f U #.,.>. at .#.%.,.7.D U @.;.#.%.&.#.7.w.&.&.:.k 7 .3.d.j.A.%X%X$X}.}.{.{.}.$X}.}.}.$X}.$X}.}.$X$X$X}.[.}.$X}.}.}.}.$X}.}.}.$X}.}.$X$X}.{.$X}.$X}.}.}.$X}.}.}.}.$X}.%X}.%X%X$X}.}.}.%X}.%X%X%X%X%X%X%X%X%X%X.X$X%X%X-X%X%X$X}.%X%X%X%X%X}.-X-X%X%X.X-X%X-X}.-X%X%X%X%X%X-X%X-X-X%X-X%X%X%X%X-X%X%X%X-X%X-X}.%X-X-X}.}.-X-X-X-X-X.X-X-X%X-X-X-X-X-X%X-X-X>X-X>X:X>X>X>X>X>X>X:X>X:X>X:X1X:X,X,X0XqX> [...]
+"F F .X.X}.}.}.}.}.}.}.}.}.}.%X%X[.}.}.}.}.|.}.|.$X}.}.}.}.{.{.{.}.$X{.$X{.{.}.}.}.}.$X}.[.}.}.}.}.{..Xw.h a S G @.$. at .Q #.%.k D %.:.;.:.#.+.7.:.%.&.$.k g #.| .s.4.m.B.$X$X}.$X$X$X}.$X}.}.}.$X$X}.}.}.}.{.}.}.$X$X}.}..X}.}.}.}.%X}.}.}.$X$X}.%X}.%X%X}.}.}.}.%X$X}.}.%X}.%X$X}.%X%X%X}.$X$X}.}.%X}.}.}.%X}.}.%X%X%X}.%X}.%X%X%X%X}.%X%X}.%X&X&X}.%X%X%X%X%X%X%X-X%X-X%X%X%X%X}.-X-X%X%X$X-X%X%X&X-X%X%X-X&X%X-X%X%X1X%X-X-X}.%X%X-X%X-X-X-X.X-X-X-X-X-X-X-X>X1X<X:X>XqX>XqX,X:X:X>X:XqX>X,X,X>X,X>X,X,X> [...]
+"F J .X|.}..X}.}.}.}.}..X|.}..X}.}.}.}.}.}.}.}.}.}.{.[.}.}.}.}.}.{.}.{.{.}.{.{.}.}.[.[.}.}.}.}.{.{.}.}.v.$.J k h U @.-.L a J ;.;.P G %.;.F T ;.#.&.7.%.o.#.:.J a l ..4.j.V.$X}.$X}.}.$X}.}.}.$X$X{.}.$X}.}.$X}.}.}.}.}.}.}.}.}.}.}.}.}.$X%X}.}.}.}.$X%X%X}.}.}.}.%X$X$X}.}.}.$X$X}.$X$X%X%X%X}.%X$X-X-X%X%X%X-X%X}.-X%X-X%X1X%X%X%X-X-X%X}.-X-X%X%X}.-X}.}.-X%X%X%X%X&X-X%X%X-X%X.X-X%X%X-X-X-X-X-X%X%X%X%X-X-X%X}.-X}.%X-X%X-X-X.X-X-X-X-X-X-X-X-X%X-X>X>X>X>X>X>XqX>X:XqX:XqX:XqXqXqX>X>XqX0XqXqX>X,X,X,Xq [...]
+"F F }.}.}.}.}.}.}.%X$X}.{.}.}.}.}.}.}.}.}.}.}.}.$X}.$X}.}.}.$X}.}.}.{.{.{.{.{.}.}.}.}.}.}.}.}.$X$X}.%X|.r.G h p h I ' U 0 a :.-.S r J @.#.I / Q ;.:.#.+.&.:.#.#.D h .s.j.m.{.%X%X}..X}.}.}.{.{.}.%X}.}.$X}.$X}.}.}.$X$X}.}.}.}.%X}.}.}.%X}.%X}.}.}.}.}.}.}.$X}.}.}.%X}.}.}.$X%X$X%X%X$X}.$X}.}..X%X%X%X%X.X.X%X-X%X%X}.}.}.&X%X&X%X}.-X-X-X}.-X%X-X.X%X-X}.-X}.%X.X-X-X%X%X&X-X-X.X%X%X%X%X%X%X-X%X%X&X-X-X%X-X%X-X%X-X%X-X-X-X-X-X-X-X-X-X-X-X-X>X-X-X>X>X>X>X>X>XqX>X,X>X,X>XqXqX:XqX,X>X,X:XqXqX<XqXqXq [...]
+"H F .X}.}..X}.}.}.}.}.}.{.%X}.}.{.}.}.}.}.}.}.}.{.{.{.}.}.$X{.$X[.{.{.$X$X{.$X}.[.$X$X[.}.$X{.{.}.%X$X}.^.P u q u U L L K S J [ ^ G S G :.-.! P @.^ #.&.&.&.%.%.^ K P | ..p.j.$X}.%X$X$X.X$X}.}.$X$X$X$X$X}.}.$X%X}.$X%X}.}.}.}.}.$X$X%X$X}.}.}.}.}..X%X%X%X%X}.}.}.%X%X%X%X%X%X%X%X%X$X}.-X}.-X%X%X%X%X%X-X-X}.%X%X%X%X%X%X%X-X%X%X%X}.}.%X-X}.%X%X}.-X-X%X-X.X%X%X.X%X%X%X-X%X%X-X-X-X-X-X-X-X-X&X-X-X-X%X-X%X-X%X-X%X}.-X%X}.%X-X-X-X&X-X-X-X-X>X>X-X>X>X1X;X>X>XqX>XqXqX>X,X,X<X,X,XwX<X:X>X,X,X,X,X,Xw [...]
+"z F }.}.}.}.}.$X}.}.}.[.}.}.}.}.}.}.[.}.}..X}.}.}.}.{.}.$X}.{.$X{.}.{.$X{.$X}.}.}.$X}.}.$X}.[.}.}.}.}.-XoX&.j u a S I -.;.S V ;.9.,.u f ;.,.-.f D %.-.;.#.%.$. at .%.! ;.K k ...d.S.$X%X}.}.$X$X$X}.}.}.}.}.}.}.}.$X%X}.%X$X}.$X}.}.%X$X%X%X%X$X$X%X}.%X%X}.}.%X}.%X}.}.%X$X.X%X%X%X}.1X}.-X-X}.%X}.%X}.%X}.-X}.$X}.%X%X%X%X1X%X%X%X%X%X-X%X-X-X%X%X%X}.XX}.-X-X%X-X%X%X-X%X%X}.-X-X%X%X-X-X-X%X-X-X-X%X}.-X-X%X%X&X-X-X-X-X%X1X%X-X.X-X-X-X-X-X;X;X;X-X>X-X>X>X>X:X>X,X,X,X<XqXqXqXqX,X,X,X>X,XqX<X0X,XqX,Xq [...]
+"F F }..X.X%X}.{.}.}.}.}.}.[.}.}.}.}..X[.}.}.}.[.{.}.$X}.}.}.{.{.$X$X}.{.{.}.{.$X{.{.}.{.{.{.}.}.}.}.}.}.|.c.x.&.J p z T Q L S I W -.L u U -.-.D S #.:.-.k R ;.%.G J @.! L S r X.3.4.V.%X&X}.}.$X$X.X}.}.$X.X}.}.}.}.}.$X}.}.}.}.}.}.$X$X%X%X$X%X%X%X.X}.-X$X$X%X}.}.|.$X%X$X.X$X%X%X-X}.%X%X%X%X%X%X-X}.-X-X}.-X%X%X%X-X%X&X-X}..X%X%X-X%X-X;X%X%X-X-X}.-X}.%X&X.X-X.X-X-X-X%X%X%X%X-X-X-X-X-X%X-X%X-X-X}.-X-X-X-X-X-X-X-X%X>X-X-X%X-X-X-X>X-X>X>X-X-X-X-X>X>X1XqXqX<X>XqXqXqXqXqXqXqX>X,X0XqXqXqXqX>XqX<Xq [...]
+"F z }.}.}.}.}.[.}.$X}.{.{.}.$X}.}.}.{.}.{.}.}.}.{.}.$X}.{.}.{.}.}.}.}.}.[.[.}.$X}.}.}.{.{.$X$X}.}.{.}.$X&X|.|.q.S q r a h S C 4 0 @.;.K 0 h ;.>.S g -.,.G k +.;./ k | :.<.R C N h ..a.j.A.$X-X$X&X$X-X%X%X%X.X-X}.%X}.$X$X}.}.}.-X}.$X}.%X}.%X%X}.%X%X&X-X}.%X%X}.%X%X%X%X.X}.%X%X%X-X.X.X&X.X&X-X%X-X%X%X%X1X%X%X1X%X}.}.-X%X-X%X-X}.1X-X-X-X-X-X}.-X%X-X-X-X%X%X%X-X-X-X-X%X&X-X%X-X>X-X-X-X-X-X-X-X-X-X-X-X-X-X&X&X1X>X;X-X-X-X-X}.-X1X>X>X>X>X-X-X;X-X-X;X>X>XqX,X,X<XwX,XqXqXqXwXqXqXqXqXqXqX,X<X,XwXq [...]
+"z J }.}.}.}.}.}.}.}.}.}.$X}.}.}.{.}.$X}.[.}.}.}.{.}.}.$X}.}.$X}.$X}.[.}.{.}.}.}.$X{.{.}.}.$X}.$X{.{.{.&X$X&X:X0.B 0 q u S G ' q S >.9.>.e 0 ^ >.D d ~ :.;.g S <.#.K H 9. at .+.' L N t | =.d.S.%X%X$X$X$X}.}.}..X}.}.%X}.$X}.}.}.}.}.%X%X%X-X}.%X%X%X%X}.}.}.-X}.%X-X%X%X%X%X-X%X.X-X%X%X}.%X.X.X&X%X.X-X-X%X.X-X&X}.}.-X%X-X%X%X-X-X-X-X>X-X>X>X>X-X>X>X1X%X-X}.-X-X-X-X-X-X-X%X>X>X-X>X>X>X>X>X>X>X1X-X1X>X-X>X>X>X;X1X;X>X>X>X>X-X>X1X>X;X>X1X>X>X>X1X>X>X>X>X>X,X,X,X,XqX0X,X,X<X>XwX<XtXqXeXqX,X0XqXqX,X, [...]
+"F F }.}.}.}.}.}.}.}.$X}.{.}.[.}.}.}.}.}.}.$X}.$X}.}.}.}.$X}.}.}.}.}.}.}.{.}.}.{.}.}.}.}.}.}.}.}.}.{.{.$X$X$X.Xz.$.h B j H -.-.D L P @. at .V q r R -.A u D >.P q H %./ J @.-. at .@.^ E A N a .4.n.B.&X}.$X}.}.%X%X%X}.}.%X$X%X$X}.$X}.-X%X%X}.}.}.}.%X-X}.%X-X}.%X%X%X$X$X$X%X%X%X}.%X%X}.%X}.%X1X%X-X}.}..X%X%X-X}.%X}.-X&X-X%X-X}.-X.X-X-X>X-X>X>X>X-X>X>X1X1X;X;X-X-X-X>X-X>X>X>X>X>X>X>X>X<X>X>X,X>X1X>X>XqX1X>X>X>X1X>X>X>X>X>X>X>X>XqX>X>X<X<X;X<X<XqX>X>X>XwXqX,XqX,X,X,X,X,XwXwXqX0XqXwXqXqXqX0X,XwX>X< [...]
+"F F }.}.$X[.$X}.}.}.}.}.}.}.[.}.}.}.[.}.}.[.}.}.$X{.}.}.$X[.$X}.}.}.[.$X$X}.}.}.%X}.}.%X}.}.{.$X$X$X$X$X|.$X$X|.l.6.#.U j k J S u t 0 L { K % q -.' M u #.] u g T ^ S W %.#.#. at .~ L _ N u j ..p.j.B.&X%X%XB.$X}.%X%X%X$X}.%X}.}.$X}.%X%X-X%X%X%X%X}.%X-X%X%X%X%X%X-X%X}.%X%X%X.X-X%X-X%X%X%X%X}.1X-X%X}.%X%X-X%X%X%X%X-X-X%X;X-X-X-X-X-X-X>X-X1X>X>X-X;X-X-X-X1X%X-X;X>X>X>X>X>X>X>X>X>XqX>X,X>X>X1X>X>X>XqX>XqX>X>X>X,X>XqX<X<XqX<X>X<XqX<XeX<XwXwXeXqXtXqX0XqX,X>XqX,X>X0XqX<X0XqX0XwXwXqXwXwX,XqX,XqXqXq [...]
+"F F }.}.$X}.}.{.{.}.}.}.}.[.$X}.}.}.}.}.}.}.}.}.}.}.}.{.}.}.}..X}.}.$X}.}.$X}.}.%X.X}.%X$X}.}.}.{.$X$X$X$X}.}.$X$X}.1.i 6 7 r D I I t P 9.,.K i K ;.] I V L ^ ] S J I P +.%.Q H O.%.~ E _ N i 7 | 6.m.$X&X}.}.%X}..X%X%X}.%X}.}.}.%X%X-X%X.X%X%X-X-X}.-X%X%X%X%X-X-X}.%X}..X.X.X.X-X%X.X%X%X-X-X%X-X-X%X%X%X%X-X1X%X1X-X-X-X-X-X>X-X;X-X>X-X-X>X>X>X1X-X;X-X-X%X:X>X>X,X>X>XqX>X>X<X,X1X,X<XqXqX>X,X>X>X>XqX,X<XqX<XqXqX<XqX<XqXqX,X<XqXtXqXwXqXeXwXtXqXqXtX<XqXwXqXqX,X,X<XqXqX0XqX0XqX,XwXwXwX0XwXqXqXqXw [...]
+"F F }.}.}.$X}.}.}.}.}.}.{.}.}.}.}..X}.[.}.}.$X}.$X}.}.$X%X}.%X%X}.}.}.}.}.{.}.}.$X}.}.}.}.}.}.[.{.$X$X[.$X$X}.}.&X}.w.I i q S G ;.;.#.H H Q ~ K 0 p / ] V r -.-.V u D ^ P G P G %.&.%. at .] K M < Z L .h.A.$X-X}.%X-X%X%X-X}.-X%X-X}.%X%X%X-X%X%X}.-X&X-X-X1X.X%X%X%X.X-X1X}..X-X.X.X%X.X%X.X}.%X-X%X%X-X.X-X-X%X%X-X}.-X}.-X-X%X;X-X&X%X-X-X;X>X>X-X>X;X-X1X>X-X1X>X>XqX,X<XqX<XeX<X,XqXqXqXtX<X>XqX>X>XqXqX>X>X,X,X>X<X<XqXwXwX,X>XeXwXqXqXtXtXtXqXqXtXeXeXqXeXwXwX0XqXqXqXqXwXtXqXqXwXwXqXqXqXqXqXqXwXqXq [...]
+"F F $X}.}.{.{.}.}.}.{.$X}.}.}.}.}.}.%X}.}.}.}.$X$X}.$X}.}.}.}.}.$X}.$X}.{.}.{.}.$X}.}.$X$X}.}.}.}.{.$X}.}.{.$X}.$X$XoX0.o.U a F *.#.o.a 4 0 D -.V # u [ ~ V S L L C S / ! D Q h J +.%.+.+./ P L L _ t | d.A.&X%X}.}.%X$X.X%X%X$X%X-X-X%X%X.X%X%X%X%X%X-X-X}.&X%X%X-X}.}.%X%X1X.X-X-X-X%X-X.X.X-X%X-X%X-X%X}.1X%X-X%X-X-X%X%X-X-X-X-X-X-X;X-X-X;X1X>X;X>X>X>X>X>X<X>X>X<X>X<XqX>XqX<X<XqXqXtXqXqX>X>X<XqXqX<X<X<X,X>X<XqX<X,X>XuX<XqXqXtXwXtXtXtXqXwXqXtXtXqXwXwXwXqXwX0X,X,XqXtXqX0XwXwXwXwXqXwXqX<XqXqXwX< [...]
+"o.F }.{.}.}.$X}.$X{.}.}.}.}.}.}.%X}..X}.}.$X$X}.}.}..X%X}.}.}.}.}.}.}.}.$X$X}.$X}.$X}.{.$X}.$X{.$X$X}.}.}.}.%X$X$X{.&XM.a.6.O.j r q i S S : S 8.>.B t J ^ -.D u L ^ S u Y ^ Q G T &.&.O.O.^ ^ _ A L : - H g.A.%X%X%X%X}.}.%X-X%X%X%X%X%X%X}.}.%X%X-X%X%X%X%X}.-X%X%X%X-X%X%X-X-X-X.X.X.X%X-X}.%X-X%X%X%X%X%X-X%X%X-X%X}.%X-X%X-X}.-X-X-X-X-X%X>X>X-X;X1X>X,X>X,X>X>X<X>X>X<XqXqX,X>XqXqXqXqXqXqXqXqXqX<X<X<X,X,XqX<XqX<X>X>X>X<X<X>X>XqXtXtXwXwXtXwXwXwXqXeXwXtXqXwXqXwXqXtXqXwXqXwXqXeXqXqXwXqXtXwX<XwXqX< [...]
+"z F }.%X}.}.$X}.%X%X%X}.}.$X}.}..X.X}.}.}.$X}.}.}.}.}.}.}.}.$X}.$X}.}.$X}.}.$X}.%X$X}.}.%X}.$X$X}.}.$X}.}.}.}.{.$X$X&X%XB.$Xw.9 3 4 r L >.L J :.;.! M 9 7 T -.u p I L q k ! P @.#.$.*.#.O.O.#. at .K V y A { H s.A.*X}.}.%X}.%X}.}.%X%X%X.X%X%X%X&X%X-X}.%X-X%X}.-X}.%X%X%X%X}.}.-X-X}.-X-X&X%X-X}.%X%X.X-X%X%X}.-X%X.X-X%X%X-X-X}.%X-X-X-X%X-X%X-X>X%X-X-X>X>X>X>X>X>X>X>XqX>X>X>XqXqX>X>XqX>X<X>XqX>X>X<X<X<XqX,X>X>X<X>X>X>X<X<XqXqX,XqXtXwXwXtXwXqXwXtXtXqXqXtX,XwXtXrXqXtX0X0XtXqXqXqXwXqXqXqXtXtXwXqX<Xq [...]
+"F F }.}..X}.}.}.%X}.$X$X}.}..X}.}.}.}.}.}.$X$X}.}..X}.}.}.}.}.$X}.$X}.$X}.$X}.}.%X}.%X-X}.}.}.}.}.%X}..X}.$X}.}.%XB.$X$X$X3Xv.I a p h H :.:.H i 0 h ^ L % y >.] m u S P f f L I k x z R G R $. at .! P K A [ m 3 6.S.&X%X$X&XB.1X%X}.}.-X%X-X%X;X}.-X-X%X&X%X%X;X}.-X-X%X&X%X-X-X%X-X-X-X;X;X-X%X-X%X}..X%X-X%X-X-X-X-X%X-X%X-X&X-X-X-X-X-X-X-X-X-X-X-X%X-X&X;X>X>X>X>X>X>X>X>XqX>X>X<X<X>X>X>XqX>X>X>X<X>X>X>X<XqXwX<X<X>XqXwXqXqX<XqX,X<XtXqXqXtXtXtXwXqXwXwX0XwXqXtXqXfXrXtX0XtXqXqXqXtXqXrXrXqXwXqXwX,XwXw [...]
+"F R }.}.}.}.}.}.}.}.$X}.}.}..X.X}..X}.}.}.{.}.{.}.}.}.$X{.}.$X}.}.}.}.}.}.}.$X}.%X%X&X|.$X}.$X}.}.%X}.&X%X%X}.}.$X%X{.%X$X}.$Xz.$.U j l z c u a i i -.L.] t f T @.K q G D % e Y D S D +.#.R +.+.^ @.K Z ) V 1 q X.j.*X%X1X&X&X$X1X%X%X%X%X-X-X-X.X%X-X%X%X%X%X&X%X%X%X-X-X-X-X-X&X-X1X&X-X-X1X;X-X%X%X-X-X-X%X%X.X-X.X%X-X-X-X-X-X-X%X-X-X%X-X-X-X-X-X-X-X-X-X-X;X&X-X;X>X>X>X>X>X>X>X<X>X>X;X>X;X>X>X;X<X>XqX<X<X<XqX,X<XwXeXqXeX<X0XqXwXwXtXwXqXtXrXwXwXtXtXqXqX0XqX0XfX0XfX0XqXtXwXtXtXtXrXtXeXwXwXqXwXq [...]
+"F z $X}.}.}.}.}.}.}.}.}.%X.X%X}..X}.}.}.$X}.$X}.}.}.}.}.{.{.}.}.}.}.}.}.}.$X}.}.}.$X%X}.}.}.}.}.}.%X}..X$X}.$X}.$X$X%X%X}.}.}.{.b.1.=.j # 5 u S L M D %.-.L % 7 ;.] 0 q Y C r D L ;.7.:.#.F @.J k +.I D D A _ m t | h.&X%X}.$X%X}.%X}.-X.X.X%X&X%X.X-X%X-X-X&X%X-X1X-X%X-X-X;X&X%X%X%X-X1X%X}.&X-X-X%X%X-X%X%X-X-X%X-X-X%X-X-X;X-X-X-X-X-X-X-X-X%X-X-X-X-X-X;X-X>X&X-X;X-X-X-X>X>X-X>X>X<X>X>X;X;X>X>X<X>XqXqXqXqXeXwX<XwXqXeXeXqX<X0XqXwXtXwXwXtXtXwXrX0XrXrXtXrXtXrXtXtXtXtXtXtXtXtXtXtXtXwXwXrXtXwXrXtXq [...]
+"F F $X}.}.}.%X}.}.}.$X}.%X}.}.}.}..X.X}.%X.X.X}.}.}.}.}.$X}.}..X}.%X}.}.$X}.}.}.}.}.}.}.}.%X.X}.}.%X%X$X}.$X}.}.}.&X%X}.%X}.%X}.%X$X|.U % 6 S I &.-.h 4 r I K % r -.D i u G E y D &.v h l h #.G J / +.R D V V A Z 9 j a.A.%X}.%X%X}.&X}.%X%X%X-X%X%X-X%X%X-X}.-X-X-X}.-X-X%X-X%X%X>X;X-X-X-X-X-X-X%X-X%X-X%X-X-X-X%X-X-X>X-X%X>X-X%X-X-X-X-X-X-X-X-X-X%X-X>X-X-X;X&X>X-X-X-X>X-X-X-X-X>X1X;X1X;X<X>XqXqX>X>XqXqXtXqXeXwXeXeXeXwXqXtXwXtXwXrXtXqXtXrXqXrXqXfXfX0X0XtXtXtXtXqXfXqXwXtXtXtXtXtXtXtXtXwX0XtXwXt [...]
+"F F }.$X}.}.}.}.%X%X.X}.}.%X}..X}.}.}.}..X}.}..X$X}.$X}.}.%X}..X}..X%X}.}.}.$X}.}.}.}.}.%X%X%X}.%X%X%X-X%X$X}.}.}.}.$X$X%X$X$XA.%X-X>X&.V r k o.:.&.p 4 # U I.K & r P ] q 4 R D J k g h h h ] %.O. at .+.F x P V f K N 1 q c.A.*X&X}.%X-X%X%X-X-X%X>X1X%X-X-X-X1X}.-X%X-X-X-X-X-X%X1X&X-X-X-X-X-X-X-X-X-X&X&X-X-X-X-X-X;X-X-X-X-X-X-X.X-X-X;X-X-X-X-X-X-X-X-X-X%X-X-X;X-X;X-X>X-X>X>X>X>X-X;X;X>X>X>X<XqX<X>XqX<XqXeXqXtXqXqXwXwXtXqXtXwXtXtXwXtXtXtXqXrXtXrXtXtXrXrXtXfXqX0XfXtXfXtXtXtXwXwXwXtXtXtXtXtXwXtXf [...]
+"F F }.%X}.%X}.}.}.}.}.%X%X%X}.$X}.}.$X}.$X}.}.$X}.}.}.%X}.}.%X%X}.%X%X}.}.}.$X$X$X}.}.}.-X%X.X}.}.}.$X}.%X%X%X}.$X$X&X%X$X$X}.{.&X$X.Xv.$.j c j j q u U u S :.;.D u 4 P I 0 6 r P P G J x h k j p I G G G ! P S f V m n q ..n.*X&X-X&X&X|.-X%X>X}.%X&X-X-X}.$X&X&X-X}.-X-X-X-X%X-X%X-X-X-X-X-X-X-X-X-X;X;X-X-X-X-X%X%X>X>X-X-X-X-X-X-X-X-X-X%X-X-X-X-X-X-X%X-X-X;X-X;X;X-X&X%X-X-X>X-X;X;X>X>X>X>X<XqX<X<XqXqXqXwXwXeXeXeXeXeXtXqX0XtXtXtXqXqXrXrXrXtXtXrXfXrXtXfXqXtXfXtXtXtXtXtXtXtXtXfXtXtXtXfXtXtXfXtXf [...]
+"F F }.}.}.}.$X}.}.}.%X%X}.}.}.$X{.$X}.$X}.%X}.%X$X}.}.}.}.}..X}..X%X%X-X}.$X%X%X}.%X-X}..X%X}.}.}.}.%X$X%X%X%X%X$X%X$X%X}.}.}..X%X}.}.}.[.x.=.$.4 # q S ] ! r 7 J @.M & f ] K i r Q ^ z c p r B V S / P D D J M D U y V 1 & c g.*X;XV.$X-X%X$X}.-X}.%X}.-X%X&X{.}.%X&X%X-X&X%X-X&X-X&X%X-X-X-X-X-X-X-X-X-X-X-X-X-X-X>X-X-X>X>X-X-X;X;X-X-X%X-X%X-X-X-X-X%X-X;X&X-X-X-X;X-X>X-X>X-X-X-X;X-X;X-X>X<X<XqXqXqXtXtXqXwX<XeXqXqXtXqXtXqXtXtXtXtXtXtXrXrXqXwXtXtXqXtXtXfXtXtXtXtXfXtXtXtXtXfXtXtXfXpXpXtXtXtXtXfXw [...]
+"F o.$X$X.X}.}.}.}.$X$X$X%X%X$X}.}.$X}.}.}.%X}.$X%X%X%X.X}.}.}.}.}.-X$X}.}.$X}.%X%X%X%X}.$X$X%X}.}.}.-X}.%X%X%X%X$X%X$X$X}.}.}.%X%X-X.X}.%X$X.Xv.r 9 u T 7.;.7 # 5 ] 9.0 % u h K % g c r g g q 0 g , a L L P W D S h V S i - & a s.*X;X$XV.%X&X&X%X%X%X}.-X%X}.&X%X$X%X&X%X&X&X-X-X1X&X-X;X}.-X&X-X>X;X-X>X;X-X>X-X>X-X;X-X>X-X-X-X;X-X-X-X-X-X-X-X-X-X-X-X&X;X-X-X%X;X-X;X>X;X;X>X-X;X;X;X>X>XqXqX<XqXeXqXtXqXtXwXeXqXeXwXwXtXtXfXtXtXtXqXfXtXqXtXtXtXwXtXtXrXtXtX0XfXtXtXtXrXtXtXpXtXrXtXfXtXtXtXtXpXpXpXt [...]
+"F F $X}.}.}..X}.}.%X}.}.}.%X$X}.%X}.[.$X%X%X$X}.}.}.$X}.}.$X%X}.}.}.}.$X}.}.-X%X%X|..X.X}.%X-X}.%X%X-X}.%X%X%X%X$X}.%X%X%X}.}.%X%X}.}.%X$X-X;X*XO.j j x *.H u K t < 5.-.L i 4 h S e % J G t S r r k k P P Y Y h y S h f M t - t 4 =.*X*X}..X.X&X.X%X.X-X&X}.%X-X%X%X%X%X&X%X%X-X-X%X&X;X%X;X;X-X%X-X;X>X>X>X>X-X-X>X;X-X;X-X-X>X-X1X-X-X-X-X;X-X>X-X-X-X-X-X-X;X>X-X-X-X-X-X-X-X-X;X>X>X>X;XqX<XqX<XqXqXeXeXqXqXeXtXeXtXtXtXtXtX0XtXqXfXtXtXtXfXtXtXtXtXtXtXwXrX0XfXtXfXfXrXtXfXfXtXfXtXtXfXfXrXfXtXrXrXdXd [...]
+"F F }.}.}.}..X}.%X}.}.}.}.}.}.%X%X%X%X%X}.%X|.$X}.$X}.}.$X%X%X%X}.%X}.}.}.%X%X%X&X.X%X%X.X}.%X%X}.}.}.}.}.}.%X-X}..X-X.X%X.X}.%X}.%X-X$X&X$X%X;Xx.z 6 p j 6 r D [ Z u q I ;.D % r r A ' 4 0 -.q 4 R q f r 7 g D ! G D S S f i t - 1 &.M.qX}.{..X}.%X}..X&X&X&X1X1X;X&X*X-X}.%X&X&X-X-X%X1X;X-X%X;X1X1X-X>X>X>X>X>X>X;X>X>X-X>X;X-X-X-X-X-X&X-X-X-X-X>X-X-X-X-X-X&X-X;X-X;X-X-X-X;X-X>X>X>X>X>X<XqX<XqX<XeXtXtXeXtXtXeXqXqXtXtXtXfXtXqXtXtXtXfXqXtXtXtXrXrXrXrXtXrXtXtXfXtXtXfXtXfXtXtXtXtXrXfXpXfXtXfXpXfXt [...]
+"F F $X}.}.}.}.%X}.$X}.$X}.}.-X}.}.}.}.}.%X%X.X&X-X}.-X$X}.%X}.}.-X%X%X%X-X}.}.}.$X.X.X}..X-X-X}.$X-X}.}.}.}.$X}.%X%X%X%X%X%X%X$X}.&X%X}.$X}.&X-X.Xc.=.$.o.# & f I ,.S 5 0 I :.K i 4 4 q e f f 0 q h 4 g h 0 k r P D ^ P M S M e : t Z { E.+X X.X-X&X&X3X*XA.A.&XA.A.A.S.A.*X3X;X-X-X-X-X&X-X-X&X-X;X;X-X;X>X>X>X>X>X>X>X>X>X-X-X>X;X>X-X>X>X>X>X-X>X%X-X%X-X-X;X>X-X-X>X-X;X>X>X-X>X>X>X>X>X<XeXqXqXeXeXqXqXqXtXeXqXtXtXtXtXtXtXqXtXfXtX0XfXqXfXtXwXtXwXtXwXtXfXtXrXrXtXtXfXtXfXtXtXtXfXtXrXpXfXrXrXfXrXdXt [...]
+"F F }.%X}.%X-X}.-X}.}.}.}.$X}.%X}.%X}.%X.X.X.X.X%X&X%X}.%X%X.X}.-X.X}.}.%X}.%X%X.X&X%X%X%X%X}.}.}.-X}.-X$X}.}.}.}.%X%X%X%X%X%X$X%X$X%X-X%X%X.X}.%X%X;X&XoXa i j z &.k h V u f I D W r 3 z / 0 H x r # 0 k q %.q U f P G _ P C L V u b { { D.nXmX).^.x.6.l. . . .8 8 | O.s ..s.j.A.3X$X}.&X%X1X-X-X;X>X-X>X>X>X>X<XqX>X>X>X>X>X>X>X-X>X>X;X>X>X;X-X-X-X%X&X-X&X;X-X;X-X;X>X>X>X>XqX>XqXqXqX<XqX<XeXqXwXeXqXtXwXqXtXtXqXtXtXtXtXtXtXfXtXtXtXwXtXtXwXrXtXrXfXtXrXtXfXtXfXtXtXfXtXtXtXfXtXfXtXtXrXrXhXfXjXtXrXp [...]
+"F o.%X}.%X}.}.%X%X}.}.}.%X}.}.}.%X%X%X}.%X-X$X.X.X1X.X.X%X%X.X.X%X}..X}..X.X%X%X$X}.%X%X}.-X-X}.}.-X%X%X%X%X%X-X-X}.%X%X$X$X%X%X}.-X%X%X$X.X%X%X%X}.&X%X2X0.F r c p 4 c F ! M * % q S G z r S x 0 4 q 0 g r *.7 %.k D L +.P ' ] V L A t < 1 D.W.W.nX` _ L K ` N m t t B _ Z u p X.m.*X&X&X-X-X-X-X-X-X>X>X>X>X>X;X;X>X>X>X>X-X>X-X-X>X>X>X-X>X>XqX-X>X>X-X;X>X;X;X-X>X>X>X>X>X<XqX<X<XqX<XeXqXeXeX<XeXeXeXeX<XtXqXqXtXqXqXtXfXtXtXtXtXtXtXtXtXrXtXtXeXtXqXrXtXrXrXtXrXtXrXtXfXtXrXtXrXfXtXdXpXrXpXrXfXrXrXp [...]
+"F o.$X.X%X%X}.}.%X.X}.%X%X%X%X.X}..X%X%X|.%X&X.X}..X.X}.%X}..X%X-X%X-X}.}.%X%X%X}.}.%X.X-X}.}.-X%X-X}.}.%X}.-X}.%X}.}.%X}.%X%X%X$X-X}.%X&X%X%X-X-X%X}.%X&XM.6.j l j @ % r ! I S u 4 4 0 r U g % & 7 r g r 0 6 7 &.c D K G S ^ U V ! L - M M ) D.H.MXD.` { D.G.D.` ` m M K ` { M % p M.1X$X.X-X;X-X>X;X>X>X>X>X;X>X>X>X>X>X>X>X-X>X-X>X-X>X>X>X>X>X>X<X>X>X>X>X;X;X>X>X>X<X<X<XqXqXtXqXqXtXqXeXqXwXuXeXwXqXtXtXqXqXtXfXfX0XfX0XtXqXfXtXtXtXrXtXtXwXtXtXtXtXtXtXrXtXrXtXtXtXtXfXtXfXtXdXrXfXtXtXfXpXrXtXtXhXr [...]
+"F F }.}..X%X%X}.}.}.1X%X%X%X%X%X}.%X&X1X&X.X.X.X%X}.}.%X-X.X-X-X-X%X}.}.%X%X.X%X%X%X&X}.%X}.}.}.$X}.}.%X$X%X-X}.%X%X-X}.}.-X%X%X%X%X&X}.}..X%X%X}.%X%X$X}.%X.Xz.x.=.0 % a O.O.h p a 4 @ 8 r r q @ o 3 j 6 a h q j r q D u t u y i i 0 K L L F.G.Q.D.) F.G.G.mX!.+XNX!.G.` D.H.` ) D.R.&X&X|.-X-X;X>X>X>X>X>X>X<X;X;X>X>X>X>XqX>X>X>X>X>X>X<X<X<XqXqXqX<X<X>X>X<X>X>X>XqXtXwXqXtXeXqXtXtXeXtXwXqXeXtXwXtXqXqXtXtXqXtXqXtXfX0XfXtXtXtXtXtXtXwXtXtXwXtXtXqXtXtXtXfXtXfXtXrXfXtXrXrXpXrXtXpXrXrXpXrXtXrXrXhXtXi [...]
+"H F %X%X.X%X-X%X.X}.%X1X.X%X-X%X%X.X.X1X%X1X}.}.1X}..X-X.X.X}.}.-X$X.X%X}.%X}.%X}.-X}.}.%X%X%X-X%X%X-X%X%X%X%X%X1X%X}.%X-X-X%X%X$X}..X-X%X%X-X-X%X%X-X%X%X$X&X&X$X1Xu.l j c 6 5 4 6 % 6 8 # o o o @ U p q D u u U h S W L ] u V ] a 6 G.K ` W.nXnXD.D.W.H.G.] d ;.L.!.NXQ.D.P.G.P.UX .S.&X&X;X;X;X-X-X>X>X>X>X>X>X<X;X>XqX>XqX>XqXqXqXqX<XqXqXqXqX>XqXqX<XeX<X<X<XqXqXeXeXtXtXtXqXeXtXtXwXtXtXtXwXtXtXtXeXqXtXqXtXqXtXtXtXtXtXqXtXtXqXwXfXtXtXtXeXtXtXtXtXtXtXtXtXtXtXtXtXtXtXfXjXtXtXtXtXrXtXpXiXiXeXtXtXe [...]
+"F H %X%X}.}..X.X%X%X.X}..X}..X}.%X}.%X&X-X%X1X-X-X1X.X.X-X>X%X1X-X}..X&X%X1X.X.X}.1X}.-X%X}.}.}.$X%X%X%X%X%X%X%X-X}.%X%X.X.X%X}.}.}.}.%X%X%X%X%X%X%X%X%X%X&X$X$X$X;X1Xv. .j q @ @ @ # # # o o & & ;.%.@ K V 0 _ - <.L.% I e.J V N t - _ B ) nXW.D.D.Q.Q.D.D.D.D.W.% D NX5X9.+XMX9.0.* =XA.1X;X1X-X;X1X>X>X>X>X>X>X;X;X>X<X>X>XqXqXqXeXtXqXwXtX<XqX<X<XqXqXqX<XtXeXqXwXtXeXqXeXtXtXtXtXtXtXtXqXtXeXtXqXtXwXtXqXtXeXtXtXtXtXtXtXtXtXtXtXwXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXpXfXpXhXtXrXrXrXeXrXtXa [...]
+"F F }.%X}.}.%X-X%X.X1X}..X&X%X1X%X-X1X1X-X>XXX-X-X-X>X-X>X-X:X1X%X1X-X1X-X.X.X.X&X1X-X-X&X%X%X-X}.%X%X%X}.%X%X%X}.-X%X%X.X}..X%X-X}.%X%X}.%X%X%X%X&X%X%X%X&X%X&X$X%X%X&Xv.u.j o # @ @ o o - :.&.@ h 4 A e.u V E @ D u O S D : - 9 ` B n b G.UXnXW.H.Q.D.` W.NXnXK.F.H.Y.E.9.UXUX~.k , S.*X1X1X;X>X;X;X>X>X>X>X>X>X>X<X>X>XqXqXqXwXqXqXtXtXqXeXrXtXqXqXqXeXqXwXwXqXtXqXtXtXtXqXtXeXtXtXtXtXeXtXwXtXeXtXeXqXtXtXtXtXeXtXtXtXtXtXtXtXtXqXtXtXfXtXqXwXtXtXwXtXtXtXtXtXtXtXtXfXtXqXtXtXtXtXtXtXrXrXtXtXrXiXtXtXr [...]
+"F F }.}.}..X%X%X.X}.}.-X}.|.-X}.%X1X>X1X1X>X1X-X>X-X-X:XXX>X>X1X:X1X}.}.>X-X-X-X}.%X%X-X%X&X%X%X%X%X%X%X%X%X%X%X%X%X%X.X%X%X%X-X%X-X}.%X-X%X%X-X-X%X-X-X%X$X%X%X%X&X%X-X2X&X$.u 6 @ o o 1 <.0.7.y ,.r ^ 8.1 C y - b - n & 0 _ D.N -.` 2 ) UXQ.D.Q.nXW.W.D.Q.NXY.J.#XE.9.9.9.NXIX~.g 7 c.>X-X;X;X>X1X1X>X>X>X<X>X>XqX<X<X>XqX>X<X<XqX<XqXqXwXqXqXqXqXeXeXwXqXtXtXtXqXtXtXqXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXqXtXtXtXeXqXwXtXtXtXtXtXtXtXtXtXtXtXeXtXtXtXrXwXtXfXtXfXtXfXtXtXtXfXfXpXfXtXfXtXtXrXpXrXrXuXeXr [...]
+"F F }.%X}..X}.-X%X}.-X}.}.}.1X&X>X1X>X1X>X>X>X:X.XqX:X>X>XqX>X>X:XXX1X;X>X>X-X-X1X1X%X;X%X1X-X%X%X-X}.-X%X}.%X%X%X%X%X-X%X%X%X%X-X%X%X%X%X%X%X%X%X%X-X-X%X-X%X%X&X}.-X-X&X1Xv U i 4 & Z 9.-.+.e.7.z.J q.#.- { 9 S R.S t _ ' q.q.>.G L.L.mXNXF.D.W.D.W.Q.W.W.E.Q.D.[ 5X+X9.>.I._.v k q c.>X&X>X;X>X>X;X>X<X>X>X>X<X>XqX>XqX>XqXqXwX<XqXqXeXeX<XeXqXeXeXqXtXwXeXqXtXqXtXqXqXtXtXtXtXtXtXtXeXtXeXtXrXtXtXtXqXtXeXtXtXeXtXtXtXtXtXeXtXtXtXtXtXfXtXqXtXeXtXtXrXrXtXtXqXfXtXtXtXtXfXtXtXtXfXtXpXrXtXtXpXrXrXeXtXr [...]
+"F H .X%X.X-X}.%X%X}.}.XX-X}.%X,X1X1X1X:X:X:X,X1X:X:X:X:X>X>X:X>X>X:X>X>X>X>X1X>X>X>X>X1X1X1X1X}.-X}.}.-X-X}.%X-X-X%X%X&X-X1X-X%X%X&X%X$X-X-X%X-X%X%X}.-X&X%X-X-X}.&X%X}.$X1Xv.7.$.K ] >.7.Y &.5.0.q.D 5.: - ] : 7.T.f [ 8./ k Y A Z q./.PXUXnXnXD.D.W.Q.>.P.!.mXE.P.E.PX~.9.*.8 | @.h v.&X-X;X&X&X;X1X;X>X;X>X<X>XqX<X>XqX<X<XqXqX<X<XqXeXeXwXqXwXqXeXeXqXqXeXwXtXwXtXqXeXtXqXeXtXeXtXtXqXtXtXtXtXtXtXtXtXtXtXeXtXtXtXtXqXeXtXtXtXtXfXtXtXqXtXtXtXtXwXwXwXtXqXtXrXtXtXtXtXtXqXfXtXtXtXtXpXtXpXrXtXrXwXtXeXt [...]
+"F F }..X-X}.%X-X}.-X-X-X.X-XXX>X>X:X>X:X1X,X>X<XqXqX>X:X>X:X:X>X>X>XqX>X-XqX<X1X>X>X>X>X>X1X-X-X-X-X1X%X%X%X-X}.-X&X%X%X%X%X%X%X-X-X-X}.}.%X}.-X-X}.%X%X}.-X1X}.;X&X%X%X1XbXbX*X$.K 8.E L :.q.Y #.8.y S i M /.$ +.R h _.y 2 - i N N ; : _ +XIXIXH.H.D.P.{ ~.T.!.8.^ 9.E.E.[ 0 o c ' | %X&X&X-X-X>X;X;X;X;X>X<X;X<X>XqX>XqX>X<X<XqXqX<X<X<X<XqX<XwX<XqXtXeXeXeXqXtXqXeXtXeXtXqXeXqXeXtXtXwXtXeXwXtXrXtXtXtXtXtXeXtXtXtXtXtXtXtXtXtXtXtXtXtXeXtXqXtXtXtXtXtXeXtXtXtXfXfXtXfXtXtXtXfXtXtXtXtXwXtXrXtXrXuXrXrXe [...]
+"F H %X%X}.}..X-X}.}.-X-X-X-X>X:X>X>X,X>X>X,X>X,XqX>XqX:X>X>X>X:XqX:X>X>XqXqXqX>X>X>X>X>X;X-X%X1X-X}..X-X%X-X%X%X-X%X&X%X%X%X.X%X%X&X%X%X&X&X%X}.-X&X%X%X-X%X}.&X.X1X*X3XA.n.6.%.Z I 9.L -.R :.V ' /.;.7.8.h /.y D ] + J t ~ 9.8.] n - 2 ` Y.NXIXMX{ { [ 9.A d D L L ^ D d V C $ g f u.3X&X&X&X%X&X-X;X;X;X;X>X>X<XqX>X>X>XqX<XqX<XqX<XqXqXqXwXeXqX<XqXqX<XqXeXeX<XqXeXqXtXqXtXeXqXtXeXeXtXtXtXtXtXqXtXtXtXwXtXtXeXtXtXtXeXtXtXtXtXtXtXtXeXtXtXtXeXtXwXtXtXtXtXtXtXtXtXqXtXtXtXtXtXtXtXqXtXeXrXwXwXwXrXwXaXr [...]
+"H F }.%X}.}.%X1X-X%X%X>X-X>X>X:X>X:X:X:XqXqX0X0XqXqX<XqX>XqX:X,XqX>X>X>X>X>XqX>X-X>X>X>X>X>X-X%X1X%X%X}.%X&X-X%X%X%X&X%X1X&X&X$X$XA.&X&X|.&X%X&X&X&X&X&X&X$X&X3XbXS.n.x.s q Y.I.>.' >.A ] t :.] V 0.+.O.y.l u.:.0.E.: L ;.D 8.8.n Z 9.Y.nX) ) L.E.H.A V E A A D > V ] A < - V E ` $.*X*XS.$X&X%X%X&X-X>X;X-X>X>X;X>X>X>X;X>X>X>X;X;X>X>X>X<X<X>X<XqX<X<X<XqXqXqXqXeXtXtXwXtXtXtXeXtXeXtXtXfXwXtXtXtXtXtXtXtXtXtXqXtXtXtXtXeXtXqXtXtXtXqXwXeXwXeXtXtXeXtXtXtXqXtXqXtXtXtXtXtXtXtXtXwXtXtXtXtXtXtXrXeXtXtXtXt [...]
+"F F 1X}.1X-X-X-XXX-X1X>X>X>X>X>X>X>X,X:X,X:X>XqX:X,X>X,X<X>X1X:XXX>X>X>X>X>X>X>X>X>X>X>X>X1X-XXX-X-X1X.X1X&X&X$X&X&X%X%X$X%X&X%X&X&X$XA.A..X%X%XV.=X1X;X3X3X*XM.k.*.u 1 Z mXIXI.%.;.8.%.] ` e.T.b < Q L T.y.#.q.6.(.Q 5._.;._ b 2 m ^ T.IXNXD.) E ) ) { { A A C A { ~ E $ < L 9.] o.S.3XXX|.-X;X-X;X-X-X>X-X-X;X;X;X;X>X;X;X;X<X<X>X>X;X;X>X>X>X<XqX>X>XqX<X>X>XqXeX<XeXtXqXqXtXqXeX<XwXeXtXqXeXeXqXtXqXqXtXtXtXtXtXtXtXqXtXeXtXqXtXtXqXeXeXeXeXeXeXeXeXeXtXtXqXqXtXtXqXeXeXeXeXeXtXtXeXtXtXaXtXeXtXtXaXtXw [...]
+"R G }.}.-X-X1X>X-X:X>XXX:X>X>X,X,X>X>X:X,X,XqX<X:X>X,X>X:X:X:XqX>X>X:X>X>X>X>X1XqX>X>X>X1X>X-X-X-X}.-X-X-X&X%X.X}.-X&X1X}.&X%X&X%X&X.X&X&X1X&X3X3X*X*XS.v.v.%.r w u G.NXIXIXT.L ^ ] f U 5.Y.7.i.L D 0.S 5.q.j I.%.7.( u.`.I.) Z ;.I.e.I.NX+X5X5X!.5X!.{ ; + A ] 9.~ L A 1 V _ ~ y i *.&X2X-X1X&X-X>X&X>X-X-X>X&X-X;X;X;X>X&X;X;X>X>X>X>X>X<XqXqX<X<XqX<X>X<X<X>X>X<XqX<X<XqXeXeXeXeXuX<XqXtXtXeXtXeXeXeXeXeXeXeXqXtXtXqXqXtXqXtXtXeXqXtXqXtXtXeXeXeXqXeXqXeXeXtXtXqXqXtXwXuXeXeXeXeXtXeXwXeXtXeXtXeXtXeXtXt [...]
+"F R 1X1XXX1X-X>X:X>X>X>X:X>X>X:X,X,X,XqX>X>X1X>X,X,X>X>XqX:X>X>XqX>XXX>X;X-X;X>X>X>X1X-X>X>X1X-X.X-X-X}.}.%X&X1X%X&X&X&X1X%X%X1X1X*X3X<X3X*XS.v.6.*.P G f t $ N Y.IXIXIXIX5X-.) A _ -.8.i./.5.9.-.;.w.L 0 / u ] : r [ D v e e 8.T.0.9.>.A V ~ ( i.4XI.L A ~ >.0 L V C K A K S ^ r : & v n.*X;X&X&X;X-X&X>X-X;X>X;X-X>X;X;X<X;X;X3X;X,XqX<X<X<XtXqXqXqXwX>X<X;X<XqX<XqXqXqXeXqXeXeXeXeXqXeXeXwXeXeXeXqXeXeXqXeXeXqXqXtXtXtXqXeXqXtXtXtXeXtXtXtXqXeXeXqXqXeXtXeXqXtXtXtXqXwXeXeXuXtXeXtXtXtXtXtXtXtXtXtXeXtXt [...]
+"F H XX.X-X>X>X>X>XXX>X>X:XqX:X:X:X>X>X,X>X:X:X,X:X:X:X:X>X:XXXqX>X>X-X>X-X>X>X1X-X>X>X1X>X-X>X-X3X*X*XbX3X*X3X*XbX3X3XbX*XbX3XbXS.j.g.6.6.5.+.L M - % r a J 9.5XIXIXIXDX4X_.Y.{ _ :.u.z.e.9.V S q.e./.I.{ 8.&.:.-.( :.1 + : ,.E.L 2 $ $ : _ b V 9.:.k S :.[ D C V K C d K ] e G S t o & c s.S.*X3X&X>X-X;X&X-X;X;X;X-X;X>X<X>X>X>X;X>X<X;X,X<X<XqX<XqXqX<X<XqXqXeX<XqXqXqXqX<XeX<XeXqXeXeXeX<XeX<XtX<XqXeXqXeXeXeXeXtXtXtXqXeXtXqXqXtXqXtXtXtX<XeXeXeX<XtXqXeXeXqXeXeXeXuXwXuX,XqXtXtXtXtXtXtXtXtXtXtXtXtXt [...]
+"R Y }.>X-X>X.X>X>X>X>X>XqX>X1X:X,X>X>X>X:X>X>X1X1X>X>X>X1X>X>XqX>X-X-X.X1X1X;X-X1X>X1X>X;X>X1X|.v.c.j.c.M.v.v.c.s.s.g.g.g.6. .c v x k u @ # q c j h S +.7.e.).vXsXOXsX_.4X`._.U.T.)./.z.t. at .,.:.z./.i.5.7.q.8.7.#.r ( 9.Y.I.7.8.] M ] ` [ 8.8.Y.[ A Y E ! 9.>.S D E V L u ' u 0 - t @ & _ { | 4.A.3X%X&X&X%X-X;X-X>X;X>X>X>X<X<X>X;X<X;X>X>X;X<X<XeXeXqXeX<X<XqXqXqXtX<X<X<XqX<XeX<XqX<XqX<XqXeX<XeXeXtXtXeXeXeXeXeXeXeXeXtXtXtXtXtXqXtXtX<XeXeX<XeXtXqXtX<XqX<XeXqXeXeXuX>XeX<XtXeXeX<X<XqX<XeXeXeXwXwXwXt [...]
+"G F -X>X-X.X>X-X>XXX>X>X1X>X>X:X:X>X,X>X:X>X>X:X>X>X>X>X>X>X.X>X-X>X>X&X;X%X>X>X1X>X>X-X&X-X>Xe.D 8 3 3 c ( x R 8 @ % x h h % o # c k k u 4 3 g 5.5.7.5.0.7.y.).t.z.^._.4XOX/.U.7.5.0.5.e.O.i.y.y.z.w.F 7.i.] $ B ^ m %.7.( L t S R ^ 7.5.5.I.e.0.5.e k I.( 4 C ;.y A A D L d y t i 0 9 D H.) h 2.S.*X&X1X%X&X>X1X;X;X>X<XqX<XqX<X<XqX<X<X>XqX<X<XqXqX<XqXqXqXeXqX<XqXtXqX<X<X,X<X>X<X>X<X<X<X>X<XqXeXqX<XqXeXeXeXeXeXeXeXtXeXqX<XeXeX<X<XeXeXeXeXqXeXqXqX<X<X<X<X<XeX<X<XeX<XqXeXqXqXqXqX<XeXeXeXeXeXeXeXe [...]
+"z R -X-X.X>X.X-X-XXX>X>X>X>X:X:X>XqX>X1X.X>X>X1X-X>X-XqX.X>XXX>X>X-X1X;X1X1X>XqX1X>X1X-X;X1X1XY.V 7 3 @ # 8 8 c k 7 # 3 c k v u 4 3 7 k J u 3 3 O.5.&.7.5.5.&.8.0.q.Y.OX4X4XI.,./ #.:.D S #.q.U.Y S g G &.i.8.V 5./.q.y % ^ ^ { m % y ; ; E D 7 % & 0 9.G C ;.: A E C L 0 t m m y : t * < _ A t ..j.*X2X,X;X1X;X>X<X;XqX<XqX<X<X<X>X,X<X<X>X<X>X<XeXqX<X<XqX<X<XqX<XqX<X<X>X<X<X<X>X>X>X;X;X<XqX<X<X<XeXeX<XqXqXeXeXeXeXeXeXeXqXtX<XtXqXqX<XqXeXqX<XeX<XqX<XqX<XqX<XqXqXqXqXtXqXqXeX<XqX<XqXeX<XeXeXeXeXe [...]
+"R F -X%X.X%X-X.X>X-X-X>X-X>X-X:X>X>X>XqX>X>X:X>X>X>X>X:X>X>X>X>X-X-X-X-X&X;X;X;X-X}.-X&X;X-X;X+XK a g 6 3 5 7 8 c J g q r 6 p c g r k J G ! F 3 @ 7 G R l f D S E #XsXsXOXT.8.e.i.i.i.q.0.t.e.;.L P T 8.L K d J ;.W :.;.L e.^ C K C I >.9.] % * S t K D y D V : D ] ] L y i 9 t u m V t < M 0 y ) Z p ..m.*X3X&X>X>X>X<X;X>X,X;X<X;X<X>X;X;X;X>X<X;X>X<X<X>X<X>X<X<X;X<XuX;X<X>X<X<X<X>X;X2X<X<X<XqX<X<X<XuX<X<X<XeXeXeXeXqXqXeXqXeXeXeXtXqX<XqXqXqXqX<X<X<XqXeX<X<X<X<XqXqXqXtXeX<XeX<X<XqXeXeX<X<XqXeXeXt [...]
+"G F -X%X.X-X-X.X-X>X1X-X1X>X>X>X>X1X.X>X-X>X>XqX:X.XXX>X>X>X-X-X1X>X1X%X1X1X-X-X;X1X-X>X-X-X}.sX>.M j r 5 5 5 # 7 c c g g q # @ # 5 r o.+.&.x 3 h z k k G A ) D.Q.UX5XT.T.i.i.e.t.e.u.&.&.7.0.7.7.7.y.t.8.;.] 8.I.E g % J 5.7.>.9.h P +.k 0 - Y D % t L V 0 y [ [ C d % * % 0 4 u u V t u V t t f A ) m 8 3.A.;X>X<X;X;X>X<X,X<X>X;X>X;X;X;X;X;X<X>X;X>X;X>X;X<X>X<X>X2X;X>X;X>X;X>X<X<X;X;X;X<X<X<X<X<X>X<X>X>XqXqX<XeXqX<XeXeXeXeXeXeX<X<XqXqX<X<X<X<X<XeX<X<X<XqXeX<XeX<XtXqXqXeXqXeXqX<X<X<XqXqX<XeX<Xe [...]
+"F F %X-X.X%X-X-X-X-X-X>X>X-X>X}.1X-X1X;X1X-X1X1X>X>X>X-X-X>X-X>X>X;X-X%X1X%X&X-X-X-X&X-X-X-X%X-XOX] S Z p 4 5 5 # 3 8 F Q R U u & # 8 #.#.o.8 c 0.c * { { E J.Q.H.9.8.7.i.T.y.7. at .u k O.:.:.$.*.R &.7.7.7.7.5.7.S u % y K 0 u : t t d u u C Y g 7 h K V : I [ f e f y S S y y 0 t V Z D V f V C u q K Z n g ..j.*X*X%X;X2X;X;X>X;X>X-X>X>X;X>X>X;X>X>X;X;X;X;X>X;X;X<X>X>X;X;X;X<X<X>X<X>X;X<X;X>X;X<X;X;X<X<X<X<XeX<XqX<XeXeXeXeXeXqX<X<X<X<X<X<X<X<XqXqXeXuXeXtXtX<XeXeXqXqXtXeXeXqXeXeX<X<X<X<X<X<XqXqXe [...]
+"R H -X%X-X%X-X1X%X%X-X-X-X>X1X%X-X-X>X1X%X-X%X%X.X-X-X%X-X>X&X-X%X1X%X;X}.%X%X-X-X-X%X-X}.}.-X-X1X XI.-.S 4 @ @ @ # c x v v O.$.c # 6 $.+.%.r # 7 3 r ) ) L ; X o , d E ~ :.&.%.' L G 5.5.h %.%.D 7.( %.+.r u 6 h S C :.7.D I ! L K D G G S d u C V y M f r f t M 4 q D D f d V y V D C C S L V y u u m A A r | 3.S.;X&X1X;X&X>X;X;X>X&X;X;X-X>X>X;X>X;X;X>X;X<X;X;X;X;X;X<X;X;X<X<X>X<X>X;X;X;X;X;X;X;X<X<X>X<X<X<XeXqX<XqXqXqX<XeXeXeXqX<X<X<XeXqX<XqX<XeXeXeXqXqXqXeXqX<XtXeXqXeXtXqX<XqXqXqX<X<X<XeXqXq [...]
+"F F -X-X%X-X-X}..X-X-X-X-X-X-X-X;X%X1X-X%X-X-X%X-X%X;X-X;X-X-X-X-X-X-X>X-X-X-X-X-X-X-X-X-X}.%X&X%X-X3X,X_.q.U @ @ 5 # # 6 j .H F H c p z O.:./ r * 3 ) } ) 1 1 ; - b b n 1 %.0.&.;.%.R k +. at .f J G D D i u h S M - w 0 y y V y y V S K I I K M f K [ C & - S ] % & g C u y D K D D V V ! ] y y t y q u _ ` ) p ..j.&X;X3X;X;X;X;X>X;X;X;X>X>X>X>X>X;X2X;X;X;X;X;X;X;X;X>X;X;X>X;X<X<X<X>X<X;X>X;X;X<X<X<X<X;X<XqX<XqX<XqXqXqXqXqXeXeX<XqX<XqX<XqX<XqX<XqXeXtXqXtXtXqXeXtXqXeXtX<X<XqX<X<X<X<XqXqXeXqXqXe [...]
+"F R -X-X%X-X}.-X-X-X%X%X-X-X-X-X-X-X&X-X&X-X-X-X1X}.}.-X%X-X-X-X%X%X%X-X-X-X%X-X%X-X-X%X-X-X1X}.$X-X%X-X-XuXOXK q q 4 @ @ 5 8 o.O.$.#.S j 6 6 x *.R 7 & * r -.q.T.)./.(.R.y./.2X;X&X1X1X(.].].(.'.oX].(.'.(.'.z.z.w.1.$.%.I U J $.:.L A V V L { ;._ K u L L Z K V 0 S L K , M C d u D L K S D I S K L I S 0 D { ) M c 2.j.A.;X;X>X-X;X;X;X;X;X<X;X;X;X;X&X;X;X;X2X;X<X>X;X;X>X;X;X;X;X<X>X>X<X;X;X;X<X;X;X;X>X<X<X<X<X<XeX<X<X<X<XqX<X<XeXeXqX<X<XqX<X<XeXeXeXqXqXtX<XtXeX<XtX<XqX<X<X<X>X>X<XeX<X<X<X<XqX< [...]
+"H z &X-X-X-X-X}.-X-X-X%X-X%X%X-X-X-X-X-X>X&X-X-X;X-X%X-X&X;X-X&X>X-X%X-X-X-X-X-X-X-X-X&X-X-X%X-X-X-X&X-X$X&XdXmX` K J q 3 r 4 # 7 g x H k r & 4 c 1.z.oX].3X2X3XuX3X;X&X3X3X3X&X&X;X-X&X%X3X&X;X&X*X&X;X3X;X3X3X3X3X3X3X2X<X;X3X2XaXI.I M i K ;.9.8.G.Z A L [ [ I 1 K _ { D V C Z r S C V f L @.G ^ -.;.G 4 u S ! { ` 0 X.3.S.%X;X;X;X;X>X;X;X;X;X;X;X<X>X;X;X<X>X;X<X<X;X;X;X;X;X;X;X;X;X;X;X<X;X;X;X;X;X>X>X<X<X>X<X<X<X<X<X>XqX<X<X<X<X<X;X>X>XqX<XeX<XqXeX<XqXeX<XqXeXqX<X<X<X<X2X<X<X<X<X<X<X<X<XeXeX< [...]
+"o.R %X-X-X%X%X-X-X-X-X-X-X%X%X-X-X-X-X-X-X-X;X%X%X-X&X-X;X-X%X-X-X-X&X;X&X-X;X-X%X-X-X-X%X&X%X%X-X&X}.$X%X$X%XaX).K K D V u 1 & + @ @ 6 o.u.`.,XuX3X3X3X3X;X&X;X&X%X&X.X&X1X&X%X&X&X-X.X-X}.%X-X-X%X-X-X-X%X%X&X&X}.;X%X&X>X&X&X%X%X.X|.c.^.-.u h V I ] L L K C L ` Z M S ^ L _ ! M u D u V P #.H W ] %./ P I ] e V G.` N p ..4.*X;X;X;X;X;X;X;X;X;X;X;X;X;X<X;X;X>X<X>X;X;X<X;X;X;X>X;X;X;X;X>X<X>X;X<X;X2X;X<X<X<X>XqX<X<X>X<X<X<X<X<X;X;X<X<X>X<X<X<X<XqX<XeXqXeXqX<XeX<X<XqX<X<X<X<X<X>X<X<XeXtXeXqXeXe [...]
+"R F %X-X-X%X%X%X%X%X-X-X-X.X%X-X-X-X%X-X-X-X-X-X-X%X-X&X&X-X%X-X;X-X%X-X-X&X-X&X%X-X-X%X&X&X-X-X-X-X%X%X&X-X-X-X1X1X`.(./.^.U.U.^.U.v.=XbX2X3X%X>X-X-X-X-X-X-X-X-X-X-X-X-X>X-X-X-X;X-X;X&X-X-X;X-X%X-X-X-X&X%X>X&X>X-X-X-X;X-X-X-X;X;X&X;X3X'.#.i 9 u I ,.G.,._ M ^ >.{ ] K C ] ' L K L L S S G P L / ! / ^ W -.u V A { { { m c p.m.%X&X-X-X;X;X;X>X;X;X;X;X2X;X<X;X;X;X;X2X>X;X;X>X;X;X>X;X;X;X;X;X;X<X;X;X<X;X;X;X2X<X<X;X;X2X<X>X<X<X>X<X<X<X<X<X<X<X,X<X<X<X<X<X<X<XqXqX<XqX<X<X<X<X<X<XeX<XeXqXtXeXeX< [...]
+"F H %X%X-X-X-X-X%X-X%X%X.X%X-X-X-X-X%X-X-X-X-X-X%X-X;X;X;X-X&X-X-X&X&X&X&X;X&X-X%X&X%X&X&X-X%X&X-X-X&X-X-X&X-X-X%X%X*X&X;X3X2X3X2X3X3X;X&X%X-X-X%X-X-X-X-X-X>X%X;X-X-X&X-X-X-X;X;X-X-X-X-X-X-X-X;X-X-X&X-X-X-X;X-X;X-X;X&X-X;X;X-X&X-X-X-X3X;Xz.$.V m S ;.;.9.>.! L I ] ' D V M D L L I ' D y ^ ^ S P D D P Y @.%.! V D ] ~.{ m p ..j.S.;X&X;X>X;X;X;X;X2X;X>X;X;X;X;X>X;X;X;X;X;X2X;X;X;X>X;X;X;X;X;X;X;X;X;X;X>X2X<X;X;X<X<X;X;X<X>X<X<X<X>X<X<X<X<X;X<X;X<X<X<X<X<XeXeX<XeX<X<XeXeX<XuX<XtXuXeXeXeXeXeXe [...]
+"R F -X-X%X-X-X%X-X-X-X-X-X-X%X-X-X%X-X%X%X%X-X-X-X-X-X-X-X-X-X-X-X-X}.;X-X-X%X&X-X%X%X-X-X-X-X-X&X-X&X&X-X&X-X-X-X}.%X.X%X&X&X&X%X-X-X%X-X-X-X-X-X%X-X-X-X-X-X-X;X-X%X-X%X-X-X;X-X;X>X;X-X-X-X-X-X-X-X-X>X;X&X-X-X-X;X&X-X;X-X&X;X-X;X;X-X;X-X%X].v.k.y.I V u h P ] ] ] K D -.,.-.P u ^ 5.! S P P S D L ! P / T ^ / Q I E ] >.{ M N l 6.n.*X1X;X2X;X;X;X;X;X;X;X;X;X;X;X;X<X;X;X2X>X;X>X2X&X;X;X<X;X;X;X;X<X>X;X;X;X;X>X<X;X<X2X<X>X<X<X<X<X<X<X>X;X;X<X2X<X;X;X>X<X<X<XqXeXqXeXqXeXuX<X2XuXeXeXeXtXeXeXeXt [...]
+"R R -X%X.X-X-X-X%X-X-X-X-X-X%X-X-X-X&X-X-X%X%X-X%X%X&X-X-X-X-X-X-X-X-X-X-X%X-X-X-X-X-X%X-X&X%X-X-X;X&X%X-X-X-X-X&X%X%X%X%X$X%X}.%X%X&X%X-X-X-X-X-X-X;X-X&X%X-X-X&X%X-X-X&X-X-X&X;X&X&X;X;X-X;X-X-X;X;X;X-X-X>X;X;X-X-X;X-X>X-X-X;X>X&X&X-X&X&X;X;X;X;X;Xz.I M i V >.L.Y.>.L >.8.L.] V L L L L L ^ [ I W ;.H D S G +.%. at .^ D P >.9.N N K .j.*X&X&X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X2X;X;X;X;X;X;X;X<X;X;X;X;X;X;X2X;X;X;X;X;X;X;X2X<X<X<X<X<X<X<X>X2X;X;X2X<X,X<XeX<X<X<XqXeXqXeX<X<X2XuXeXeXeXeXeXeXqX<Xe [...]
+"F F -X-X>X-X%X%X%X-X%X-X.X-X-X-X-X-X-X;X-X-X&X&X&X&X-X-X-X%X-X%X%X-X-X-X-X-X-X}.%X-X-X&X-X-X-X&X;X-X-X-X%X-X-X-X>X%X&X;X%X%X&X-X&X-X%X&X%X&X;X>X-X&X;X&X;X&X>X&X&X-X&X-X-X-X;X-X-X&X>X&X-X;X-X-X-X-X&X-X>X;X;X&X&X-X-X&X&X-X;X-X-X>X&X>X>X&X;X;X&X&X&X1X.Xr.$.S f G %.7.-._ I ] L L K I ] ! P Y ;.>. at .W ^ D S J #.+. at .P W / Y ] ] A { _ y =.j.S.;X-X;X-X;X;X<X;X;X2X;X;X;X<X;X;X;X;X<X<X>X;X;X;X<X;X;X>X<X<X<X>X>X;X;X;X;X;X;X2X;X2X2X>X<X<X<X<X<X<X<X<X<X<X<X<X<X>X<XeX<X<XeX<X<XeXeXeX<XeXeXeXeXuXeXuXeXe [...]
+"F R %X-X-X%X-X-X&X-X-X-X%X-X%X.X%X-X-X-X;X>X&X%X;X-X-X;X&X-X%X-X&X;X-X-X-X&X&X-X%X-X-X-X&X-X&X-X-X;X%X-X%X-X-X%X-X-X%X-X-X-X&X;X&X-X-X%X-X-X-X&X;X%X-X-X;X-X;X>X&X-X>X;X&X;X-X-X;X-X;X>X&X-X-X-X;X-X-X-X&X-X-X%X>X;X;X>X>X;X&X-X-X;X>X&X;X;X-X&X-X$X&X&X&X}.v.k.x.&.D D D D ^ ;.>.;.L >.L.>.! / ^ / P L I I ^ / ;.#.H D W -.;.+.P ! >.E Z f ..d.A.*X;X;X;X>X>X>X;X;X<X<X;X>X;X>X;X;X;X<X;X;X>X>X>X<X<X<X<X>X;X>X<X>X;X;X;X2X;X<X;X;X>X>X<XeX<X<X<X<XqX>X<X<X<X<X>X<X<XeX<XqXqX<XeXeXeXeXeXtXeX<XeXtXeX<XeXe [...]
+"R R -X-X-X-X-X-X;X-X-X%X.X-X-X-X-X-X;X&X-X-X-X-X&X-X%X&X;X-X-X-X%X-X&X-X>X-X%X-X&X-X%X-X;X-X-X%X%X&X-X&X-X-X-X-X;X%X-X-X-X&X-X;X-X;X&X-X-X-X>X&X-X;X&X-X-X-X&X>X-X-X;X-X-X>X&X;X&X-X-X&X;X-X%X>X&X%X-X;X;X-X-X-X;X-X>X&X&X-X-X>X;X;X;X;X;X&X&X>X;X;X;X;X&X;X;X$X%XoX<.K V u ] ,.L.8.] >.8.[ P L D ! I P D %.8.^ ! G I ^ %.%.+.%./ G L ] ! N i =.h.$X&X>X;X;X;X;X;X<X>X;X;X<X;X<X>X<X<X<X<X<X<X<X<X;X>X;X>X<X<X>X<X<X;X;X<X<X;X;X<X>X>X>X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<XeX<XqX<XeXeXeXeXuXuX<XuXeXeXeXeX<Xe [...]
+"z R }.-X-X%X-X-X-X%X-X-X-X.X-X-X%X-X-X%X%X-X;X-X&X&X&X&X&X%X-X;X;X-X-X;X&X-X-X;X-X;X-X%X-X-X-X-X-X-X-X-X>X&X;X-X&X-X-X%X%X-X&X-X-X&X-X-X;X-X&X>X&X-X>X&X-X-X&X-X;X;X-X-X-X;X>X-X;X;X;X&X>X&X-X&X-X-X-X-X&X-X;X;X;X-X-X&X>X;X;X;X;X;X&X;X;X>X;X;X;X>X;X&X>X&X-X;X&X>X(.w.#.h D -.;.-.E L W / -.I I ,.,.-.G ;.;.G I / @.-.%.Q T @. at .P ! ;.! ] K K O.g.m.*X;X;X;X>X;X;X;X;X;X;X;X;X;X;X;X;X;X<X<X<X<X<X<X<X<X<X<X<X<X<X;X<X;X;X<X;X<X;X<X<X<XqX<X<X<X<XeX<X<X<X<X<X<X<X<X<XeX<XqXeX<XeX<XeX<XuXuXwXuX<X2XuX<Xu [...]
+"H z %X%X-X-X-X-X&X-X-X}.-X-X-X-X-X-X;X-X-X&X-X-X&X-X&X-X-X-X%X&X&X-X-X-X;X-X-X;X-X;X%X&X>X-X-X-X-X-X-X&X;X;X-X&X-X%X%X;X-X&X-X;X-X&X-X&X>X;X;X&X>X&X-X;X-X;X;X;X-X-X-X&X>X>X&X;X&X-X;X-X>X-X-X&X;X&X&X>X&X-X-X;X;X;X&X;X-X;X;X;X;X;X;X&X;X;X;X;X;X;X;X;X;X-X&X;X;X;X;X&XM.v.x.k.=.J A K ] ,.q.>.>.L.,.;.G P W D P Y :.-. at .Q %.;.#.J %.:.>./ ^ L A j 3.n.A.*X-X;X;X;X;X;X<X;X;X;X;X;X<X;X2X;X<X;X>X;X2X;X<X<X<X<X<X2X2X;X<X<X>X<X<X<X<X<X<X<X<X>X2X<X<X;X;X<X<X<X<XeX<X<XqX<XqX<X2X<X<XuXeX<X<XuXuX<XeXeXeXe [...]
+"H R -X-X-X-X-X-X%X-X-X-X%X-X-X-X%X-X&X-X-X-X-X-X-X-X;X-X%X-X-X-X;X-X-X>X-X-X%X-X;X&X%X&X%X-X-X-X-X-X-X-X-X-X-X&X-X-X%X&X-X-X&X>X;X;X-X;X&X>X-X;X&X-X;X;X&X-X;X>X&X-X-X;X&X;X;X-X;X&X;X-X-X;X>X&X>X;X-X-X;X;X;X-X;X;X-X-X-X;X;X;X;X;X;X;X;X;X;X&X;X;X;X;X;X;X-X;X&X-X&X>X>X&X&X&XoXw. at .u S -.,.>.L ^ ^ ^ ! S P ] 9. at .@.P #.;.;.+.G %.:.:.%.Q ^ @.] y x 3.j.B.&X>X>X;X<X;X>X<X;X<X<X;X;X;X>X<X;X;X;X;X;X<X;X<X<X;X;X;X;X;X;X<X<X<X;X<X>X<X<X>X<X>X<X<X>X<X2X>X>X<X<X<X<X<XeXeXeXeX<X<X<XuXuX<X<XeX<X<XuXeXeXe [...]
+"o.R %X;X-X>X-X-X-X%X-X-X-X-X-X&X-X%X-X-X-X-X-X;X%X&X-X;X&X-X-X-X;X-X-X&X-X&X&X&X-X-X-X-X-X-X-X-X%X-X-X-X-X-X;X&X>X;X-X;X;X&X;X&X-X;X-X-X&X-X;X&X&X;X;X;X;X;X;X&X-X-X-X;X-X;X&X-X&X-X;X&X-X;X-X;X&X;X-X-X>X&X;X;X&X>X;X;X&X;X;X;X;X;X;X>X&X;X>X;X;X;X;X;X;X>X;X;X>X;X&X&X-X&X&X;X}.oXz.$.U #.%.L S S G ! ;.>.-.>.;.P @.-.%.+./ Q Q :.0.&.O.%.;.^ ] ~ V h 6.4.V.;X2X;X;X;X<X>X;X<X;X<X;X<X;X;X;X<X;X<X2X<X<X;X;X<X<X;X<X<X<X;X<X;X<X<X<X<X>X<X<X<X<X<X2X<X<X<X<X<X<X>XeX<X<X<X<X<X<X<X<X;X;X,X<X<X<X<X<XeXeXe [...]
+"R z -X-X&X&X%X-X-X-X-X;X&X;X-X%X-X-X-X-X-X-X-X-X-X;X-X-X-X>X-X&X-X-X-X-X-X-X-X;X-X-X;X&X&X;X-X;X-X;X-X%X-X-X;X-X&X;X-X;X-X-X-X-X-X-X-X&X-X;X;X>X;X>X&X-X-X-X&X>X;X&X;X;X&X;X;X-X-X;X-X-X-X;X-X;X;X;X-X&X;X;X;X-X>X;X;X>X;X>X;X;X-X;X;X&X>X;X;X;X;X>X;X;X;X-X;X;X;X;X>X<X&X;X;X;X%X-XM.l.x.s.6.$.D V L -.>.>.-.:.;.P D / %./ P H ^ :.%.H T 7. at .T ' ;.I Z c ..4.m.*X;X1X>X<X;X<X;X<X<X>X<X<X<X;X;X;X;X<X<X<X;X<X;X;X<X;X2X<X;X2X<X;X<X;X<X2X;X;X<X<X<X2X>X<X<X<X<X;X<X<X<X<X<X2X<X<X<X<X<X<X2X<X<XuX<X2XuX<X< [...]
+"R R -X>X>X&X-X;X-X;X-X&X%X-X-X-X&X%X-X-X-X-X-X&X;X-X-X-X-X-X-X-X-X-X-X-X-X-X&X&X-X;X&X-X&X&X&X;X>X&X-X-X;X&X;X;X&X>X&X;X-X;X&X-X-X;X-X-X-X-X;X;X;X-X;X;X-X;X&X;X>X&X;X>X>X;X;X&X-X;X;X-X;X;X&X-X;X&X>X&X-X-X;X>X;X;X;X;X&X;X;X;X&X;X;X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X3X;X;X;X>X;X&X.XB.M.'.w.#.I / -.L S L L ^ @.-.^ / / / %.%.#.I %.8.#.o.:.;.;.;.L S .3.n.{.;X*X>X;X<X>X<X<X<X<X;X<X;X;X<X;X<X<X<X<X<X;X;X;X<X<X<X<X<X<X<X<X<X;X;X2X;X;X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X>X<XeXuX< [...]
+"R H %X%X-X-X-X%X;X&X%X%X-X-X-X-X-X-X-X-X-X&X;X>X>X&X;X-X-X-X-X;X%X;X&X>X&X;X-X;X&X-X-X&X-X-X>X-X;X-X-X;X;X-X&X-X;X;X>X;X;X;X-X-X&X&X-X;X;X-X-X;X&X;X;X;X;X-X>X>X;X;X-X&X;X;X;X>X;X;X;X;X;X;X>X;X;X;X;X-X;X;X>X&X;X;X;X&X>X;X;X>X;X;X;X&X;X;X;X;X;X;X;X;X;X;X;X;X>X;X;X;X;X;X&X;X;X;X;X>X;X;X3X&X{.l.6.=.$.#.I D D Q ! ! -.^ ;.-.,.-.W Q @.7.#. at .8.7.&.7.,. at .f j 6.j.m.%X;X<X>X<X<X>X<X<X<X;X<X2X;X<X;X;X<X;X;X<X2X2X;X<X<X<X<X>X<X<X<X>X<X<X;X2X;X2X<X<X<X<X<X<X<X<X<X<X<X<X<X<XuX<X<X<X<X<X<X2XeX<XqX<X<X2 [...]
+"F H %X-X-X-X-X%X-X%X%X-X&X>X;X%X-X&X&X>X-X-X-X-X-X;X-X;X-X-X;X&X;X;X;X&X-X-X-X;X;X;X-X;X;X-X;X-X;X-X-X;X;X-X;X;X;X;X-X-X-X-X-X;X;X-X;X-X;X;X&X>X&X;X;X-X-X-X;X;X;X-X;X-X-X-X-X;X;X;X;X;X-X;X;X-X>X-X-X;X;X;X;X;X;X;X;X&X;X;X;X&X;X>X;X;X;X-X;X>X>X;X;X;X;X2X2X;X;X;X;X;X;X;X<X;X&X;X;X;X&X;X;X;X>X$XM.b.b.l.x.1.:.&.I K P @.:.e.;.I / / 9.7. at .] 9.:.$.&.7.;.] K *.2.d.m.*X>X<X;X;X<X<X<X<X>X;X<X<X<X<X>X<X;X;X;X<X>X2X<X<X<X<X>X<X2X2X;X;X;X<X<XuX<X<X<X<X,X2X<X<X<X<X<X2X<X<XqX<XeX<X<X<X<X<X<X<XtXqXqX<X2 [...]
+"R R -X-X-X-X-X%X-X;X&X-X-X-X-X-X;X-X%X-X-X-X&X-X>X&X-X;X&X;X&X%X&X-X-X&X-X-X;X;X-X;X-X-X;X;X;X-X-X&X-X%X-X;X-X;X;X>X&X;X;X;X&X-X;X;X&X;X>X;X;X&X;X&X;X;X;X;X>X&X>X&X;X;X>X&X;X-X;X&X;X>X&X-X;X>X;X;X;X;X;X;X;X&X;X;X;X;X;X;X&X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X3X;X;X;X&X;X3X;X;X;X;X;X1X&X>X%X&X}.}.|.b.a.k.6.$.I ] ,.:.-.! -.,.I.q.%.I %.:.+.%.0.7.%.-.Q | =.a.h.&X;X;X;X>X<X<XuX<X<X<X<X<X<X>X<X>X2X;X;X;X<X;X>X<X<X<X;X<X<X;X<X<X>X<X;X<X<X<X<X<X<X<X<X<X<X;X;X>XeXeXqXeXqX<X<X<X<X<X<X<X<X<X>Xu [...]
+"F z -X%X-X-X-X%X-X%X&X;X-X-X-X-X-X&X-X;X-X-X-X>X;X-X-X;X&X-X>X-X;X-X;X-X-X>X-X-X-X-X-X-X;X-X;X-X;X-X-X-X;X-X-X-X&X;X-X&X;X&X>X-X-X-X;X-X-X;X&X&X;X&X;X;X;X&X>X-X-X;X;X;X;X;X;X;X;X;X&X>X&X&X;X&X&X;X;X;X-X>X-X-X>X>X;X;X;X;X&X;X;X;X;X;X;X&X;X;X>X-X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X&X;X;X;X1X;X;X;X-X;X>X$XM.C.l.x.0.&.7. at .I -.<.L.Y.I.^ / Q :.;.%.7.&.&.,.;.Q H =.f.j.A.1X;X;X;X;X2X<X>X;X2X;X>X;X;X2X2X<X<X;X;X<X2X2X<X<X<X<X<X<X<X<X<X<X<X<X<X<X;X2X2X;XuX<X;X<X;X>X<XeX<X<X<X<XeX<X<X<X<XuXuX<X<X< [...]
+"o.R ;X&X-X-X-X-X-X-X%X-X&X-X-X;X-X-X-X-X;X&X>X&X-X%X-X&X-X-X;X;X-X-X;X;X&X;X&X>X-X&X-X;X-X;X;X;X-X;X;X;X;X-X-X;X>X;X;X-X-X;X;X;X&X;X&X;X;X-X>X;X;X;X;X;X>X;X;X;X&X>X;X;X&X;X;X>X;X;X;X;X;X;X;X;X;X;X>X&X;X;X;X;X;X;X;X;X;X>X>X;X;X;X;X;X;X;X;X;X;X;X;X>X>X;X;X;X;X;X;X;X;X;X;X;X;X&X;X2X;X<X;X;X;X;X;X;X>X;X;X3X>X-X&XM.c.k.u.=.u.u.q.I.I.,.I P G >.q. at .@.;.:.:.5.5.-.#.6.s.j.m.-X&X;X>X<X<XuX;X<X2X;X<X;X;X;X<X;X2X;X;X;X;X;XuX;X<X<X>X<X<X<X<X<X<XuX<X;X;X;X2X<X<X2X;X2X<X<X<X<X>X<X<X<X<XuX<X<X<X;X<X<X< [...]
+"R R -X%X%X;X>X&X-X&X&X;X;X-X-X&X-X-X-X;X-X-X-X-X-X-X-X;X&X;X>X&X-X-X;X;X;X-X;X;X&X;X&X;X-X-X>X&X;X-X&X>X;X;X;X&X;X;X-X;X;X;X;X>X&X;X>X;X;X;X-X;X&X-X;X;X;X;X1X;X;X;X;X;X&X;X;X;X;X;X;X-X;X>X>X;X;X&X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X;X>X;X<X<X<X<X;X<X;X;X;X>X;X>X;X*X;X-XM.b.b.V.C.v.z.w.<.J D S q.Y.>.! -.%.;.9.%.^ 8.' | 6.p.j.*X>X;X>X;X;X;X;X2X2X;X<X2X2X;X2X;X;X<X;X<X;X2X<X2X;X<X<X<X<XqX<X<X>X;X;X2X;X,X<X<XuXuX;X<X<X<X<X<X2X;X<XeXuX<X2X<X<X<XuX; [...]
+"R H -X&X-X;X-X;X>X-X-X;X>X&X>X-X&X;X-X-X;X-X-X-X-X-X-X-X-X;X;X>X>X;X-X-X;X&X;X;X>X&X>X&X&X;X;X;X-X;X;X&X&X>X-X;X-X&X-X-X;X&X;X&X;X;X;X-X;X;X;X;X>X;X;X-X&X;X;X;X;X;X>X*X-X*X;X;X;X;X>X;X;X;X;X<X;X;X>X;X;X>X;X;X;X;X;X;X;X;X;X;X;X;X;X;X<X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X3X;X;X;X;X;X2X;X;X;X>X<X<X<X;X;X;X2X2X;X;X;X;X;X>X;X-X-X*XV.M.b.l.u.&.$.H I.8.>. at .^ @.,.8.%.R 8.<.U %.6.3.j.$X%X;X2X;X2X<X;X;X2X<X;X<X2X;X<X2X;X2X;X<X;X<X<X<X<X<X<X<X<X>X<X2X2X;X;X2X<X<X<X<X<XuX<XuX<X<X<X2X<X<X<X<X<X<X2XuX<X<X< [...]
+"R F -X-X;X-X-X>X-X;X&X>X-X-X>X;X>X;X;X&X>X&X-X-X;X-X;X-X&X-X-X;X;X&X-X;X;X-X;X;X;X;X;X&X;X;X&X>X;X-X&X;X;X;X;X;X>X&X&X;X-X;X&X>X>X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X>X;X;X;X;X>X;X;X-X;X;X;X;X>X;X;X;X;X;X;X;X;X;X3X;X;X;X;X;X>X;X;X<X>X;X;X>X;X;X;X2X;X;X;X;X<X;X>X2X;X<X<X<X;X;X<X<X<X>X;X<X;X<X<X<X;X<X;X;X&X;X;XV.C.c.k.s.x.z.w.,.P J U ,.L.;.-.;.+. at .;.H ..3.h.V.$X&X%X$X;X;X;X2X2X<X>X;X;X2X,X;X;X;X<X<X<X<X<X<X,X;X;X;X;X;X2X<X2X;X<X<X<X<X<X<X<XeX<X<X<XuX<X;XeX<X<XuX<X<X<X<X<Xu [...]
+"R H -X;X&X%X-X-X-X-X>X-X-X;X&X-X-X;X>X;X-X;X;X-X-X-X-X-X-X;X-X-X&X;X;X&X;X;X;X;X;X;X>X&X&X;X;X;X>X&X;X;X&X;X;X;X;X;X;X;X;X&X;X>X>X-X;X;X;X;X;X&X>X&X;X;X;X>X-X;X;X;X&X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X>X;X;X;X;X;X>X-X>X;X;X2X2X;X;X;X;X;X;X;X<X;X;X;X;X<X;X;X;X;X;X;X;X;X;X;X;X;X<X;X;X;X>X;X;X;X2X;X;X<X<X>X2X;X;X;X>X2X;X<X<X;X>X;X;X;X%XV.b.c.b.v.v.z.:.%.P ,.q.>.>.-.^ :.8.I h *.a.f.h.h.m.m.V.&X%X&X;X;X;X;X;X;X;X;X2X;X<X<X<X<X<X<X<X;X2X2X<X;X2X;X;X2X;X;X;X<X<X<X<XeX<XeXuX<X<XuX<X<X<X<XuX<X<X<X<Xe [...]
+"R R %X;X;X&X-X-X-X-X;X;X;X-X;X-X&X>X&X-X-X&X>X&X&X;X-X;X>X;X;X&X;X&X-X-X;X-X&X;X;X>X&X;X>X>X;X;X;X&X>X;X;X;X;X;X;X&X;X;X;X-X;X;X;X>X;X;X;X;X;X>X;X;X;X-X;X;X;X;X;X;X;X>X<X;X>X&X;X;X;X;X<X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X;X<X;X<X<X>X;X;X;X;X;X;X<X;X2X2X;X;X;X;X2X2X;X;X;X2X;X;X>X<X;X;X<X;X;X<X;X;X<X<X;X;X;X>X;X&X$X|.C.C.Z.k.x.=.x.y.w.:.;.! :.8.$.L +.6.=.6.p.p.d.j.j.m.j.n.j.S.m.m.m.m.n.&X3X;XuX;X&X;XwX<X2X1X;X3X;X;X;X2X;X;X;X<X<XuX<XeXeXqXeX<X<X;XuXuX<XuX<X<XuXuX<X<Xe [...]
+"F R &X;X;X-X-X&X-X-X;X;X-X;X;X-X;X-X-X;X;X-X;X;X;X;X-X&X&X>X;X-X;X;X-X;X;X-X;X;X;X&X;X;X;X&X&X>X&X>X;X&X&X;X;X;X;X;X>X;X;X;X;X&X&X;X;X;X;X-X>X-X>X;X>X;X>X;X;X-X;X;X;X-X;X;X;X2X;X;X;X;X;X;X;X;X;X>X-X>X;X;X>X;X;X;X;X;X;X2X;X;X;X;X;X;X;X;X;X;X2X;X>X<X<X>X;X;X;X<X;X;X<X;X;X;X;X;X<X;X;X;X;X<X2X;X;X;X;X2X;X<X;X;X>X3X;X;X>X<X2X<X<X2X;X2X2X;X>X;X}.|.C.b.Z.C.v.v.x.0.&.,.:.^ :.:. at .$.*. . ...2.3.3.3.p.p.p.p.p.p.p.j.{.&X{.A.A.V.A.B.$X&X;X<X;X;X2X;X;X;X;X;X>XuXeX<X<X<X2X<X<X<XuXeX<X<XeX<X<X<X<X<XeX< [...]
+"R R -X-X-X;X-X-X-X-X-X&X&X-X&X-X-X-X;X-X&X;X>X&X-X>X-X-X-X;X&X;X-X;X-X-X;X-X;X;X>X&X;X;X-X;X;X>X;X;X;X&X;X&X&X;X;X;X&X;X;X;X&X;X;X1X;X;X;X;X;X>X-X;X;X;X;X;X>X;X;X;X;X;X1X;X;X2X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X2X<X<X;X<X;X;X;X;X<X<X<X>X<X;X;X;X>X;X2X;X<X;X;X2X>X;X;X;X;X;X;X2X;X<X2X;X;X;X;X2X<X2X;X2X;X;X;X<X;X<X<X;X>X;X2X;X;X2X;X;X;X;X$XN.V.M.M.b.l.u.y.u.0.w.q.-.1.x.1.l | . .X.X.X.X...2.X.2.2.d.m.h.h.h.f.h.d.h.h.V.-X%X>X;X;X2X;X;X2X;X,X2X<X<X<X<X<X<X2X<X<X<XeX<X<X<XeX<X<X<XuX< [...]
+"R H %X-X-X-X;X-X;X;X-X-X;X;X>X-X&X;X-X;X;X;X;X;X&X&X;X;X;X-X;X;X&X&X;X;X;X;X;X;X;X>X&X;X;X3X;X;X;X;X;X;X;X;X;X&X&X;X;X>X;X>X;X>X;X;X;X;X&X;X-X-X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X1X;X;X;X;X;X;X<X<X;X;X;X;X;X;X;X>X;X;X2X;X>X;X;X;X>X;X;X2X;X;X<X<X;X;X;X;X;X;X;X2X;X;X<X;X<X<X<X;X2X;X;X;X;X<X;X;X2X;X;X;X;X;X2X;X;X;X<X<X;X<X;X<X<X;X2X;X2X;X2X;X;X2X2X;X1X;X*XM.M.b.b.a.l.k.x.y.$.6.l.l.x.s.=. .| p 8 5 5 8 8 s ..3.d.d.p.p.d.p.p.3.4.j.m.C.{.2X;X;X;X;X;X;X;X2X2X<X<XuX<X<X<X2XuX<X<X2XuX<XuX<XuXeXeXe [...]
+"R F -X-X&X>X-X;X-X;X-X-X-X;X-X;X>X&X>X;X-X&X;X;X;X;X&X;X-X;X;X;X;X;X;X;X;X;X>X;X&X;X;X;X;X;X;X&X;X;X;X;X;X;X;X&X>X;X&X;X;X;X;X;X;X;X;X;X;X>X;X;X>X;X;X;X;X;X;X;X;X;X;X2X;X;X;X<X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X<X<X;X;X;X;X;X;X;X;X2X<X;X2X<X<X;X>X<X<X<X;X2X;X<X;X<X;X;X;X;X;X2X;X;X;X2X;X2X;X;X<X>X<X2X;X<X;X;X;X;X2X;X;X;X2X2X2X;X;X2X;X;X>X;X;XB.M.b.c.C.v.l.s.c.l.l.h.b.d.s.2.=.s 8 8 5 5 | ..2.2.s...2.2.......3.d.d.d.n.2X<X>X;X;X;X<X;X2X<XuXuX<X<X<X<X>X;X2X2XuX<X<X2X2XuXeXeXe [...]
+"F R -X&X>X&X;X;X-X;X;X;X-X;X;X;X;X>X&X-X;X>X;X>X>X-X-X-X;X;X&X;X;X-X;X;X;X&X;X;X;X;X;X;X&X;X;X>X;X;X;X&X;X;X;X;X;X;X;X;X;X;X;X;X;X;X&X;X;X;X;X;X;X;X;X;X;X;X;X;X&X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X2X;X<X;X>X;X;X2X;X;X;X;X;X;X;X>X<X<X<X<X;X;X<X;X;X;X<X<X<X>X<X<X;X;X2X>X;X;X<X;X<X;X;X;X;X<X;X2X;X3X;X<X<X<X;X>X2X;X;X2X2X;X2X;X2X;X;X1X2X<X2X;X;X;X2X2X;X%X{.V.M.V.C.Z.n.b.Z.b.m.C.f.f.s. .X.s 3 8 8 s s s s 8 8 8 8 8 8 | s.p.d.V.;X;X;X;X>X3X2X<X<X2X<X<XeX<X<X2X;XuX<X<X<X<X<XuXuXeXuXuXa [...]
+"R F %X&X&X-X-X;X-X-X;X-X&X;X;X>X;X;X;X;X;X;X-X&X;X-X>X;X-X&X-X>X&X&X;X;X-X;X&X&X;X;X;X*X*X&X;X-X;X;X;X;X;X;X;X;X2X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X&X;X;X;X;X>X;X;X>X;X;X;X;X>X;X;X<X<X;X;X2X;X;X;X>X;X;X;X;X;X;X;X<X;X;X;X;X<X<X>X;X<X<X;X>X<X>X<X<X;X;X;X;X<X;X<X;X;X;X;X;X;X2X<X2X;X;X<X<X;X;X;X2X;X<X<X<X;X<X;X2X,X<X<X<X<X;X2X2X;X;X;X;X<X;X2X2X;X<X<X<X<X<X<X2X<X<X2X;X>X;X&X1X%Xn.b.V.V.N.$XN.m.m.b.a.s...| 8 5 5 5 6 s j p q 6 q 6 | 6.f.h.|.2X<X;X1X;X;X;X<X<X<X<X<XuX<X<X<XuX<X<X<X<XuXuXuXeXeXuXuXu [...]
+"R R ;X>X;X-X;X-X;X;X;X;X;X;X;X&X&X;X;X>X>X-X;X-X&X;X;X;X;X-X>X&X>X;X>X-X;X;X;X;X;X&X&X-X;X;X;X;X;X;X1X;X;X;X;X;X&X;X;X;X;X;X&X;X;X;X;X;X;X>X;X-X;X;X;X;X;X;X;X<X;X<X;X;X;X;X;X;X;X;X<X;X;X;X>X;X;X;X>X;X;X>X;X;X;X;X<X<X;X<X>X<X<X;X2X<X>X<X<X<X>X;X<X;X;X;X<X;X;X;X2X;X2X;X;X>X2X;X<X;X;X<X<X<X>X2X<X<X<X;X<X;X;X;X2X<X<X<X<X;X;X<X2X;X<X;X;X;X<X2X2X;X<X;X<X<X<X<X<X<X<X<X<X<X;X<X&XM.n.n.A.&X%X[.A.V.b.f.s.s.=.| 8 8 8 =.6.=.=.=.=.=.=.a.f.Z.B.2X;X;X;X2X;X2XuXuX<XuX<XeX<XuX<XuXuXuX<X<XuXtXeXuXuXeXuXe [...]
+"R R ;X;X-X;X-X;X;X;X-X;X;X;X&X>X;X&X&X>X;X;X;X;X*X;X&X>X;X;X-X-X;X;X;X;X%X>X;X;X;X;X;X&X&X;X*X;X;X;X>X;X;X;X;X;X;X;X;X;X>X;X;X;X;X;X;X>X;X;X;X;X;X;X;X<X<X>X<X;X<X;X<X>X;X>X<X;X;X;X>X;X>X;X;X;X;X;X;X;X;X;X;X;X;X2X;X2X;X;X;X;X;X;X;X<X<X<X>X<X;X;X;X2X;X;X<X2X>X;X;X2X;X;X;X<X<X;X;X<X2X<XuX<X<X;X<X;X<X;X;X;X<X;X<X;X<X<X<X<X;X<X>X<X<X<X;X<X<X<X<X2X;X;X<X<X<X<X<X<X<X<X<X<X<X;X2X;XB.m.$X;X>X;X&XB.m.m.h.d.d.3...=...s.a.s.s.3.3.s.d.h.n.n.&X;X;X;X;X2X2X<X<X2X<X<X<X2XuX<X<XuX2X<XuX2X<XeXuXuXuXuXtXu [...]
+"R R -X&X;X-X;X;X;X;X&X;X;X&X;X&X;X-X;X;X;X;X;X-X-X;X;X;X;X-X;X>X;X;X;X;X*X;X;X;X;X;X>X>X>X<X&X;X;X;X;X;X2X;X>X&X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X;X;X<X<X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X2X;X2X;X>X2X;X>XeX<X<X<X;X;X;X;X<X;X;X;X<X<X<X<X<X<X<X<X<X;X<X;X2X;X;X<X;X2X;X2X;X<X;X<X;X;X2X;X;X2X;X<X2X;X<X<X<X2X2XuX>X2X<X;X;X2X;X<X>X<X<X<X<X<X<X<X;X2X<X>X;X|.&X1X>X;X;X&XB.m.m.m.f.d.f.s.s.f.h.f.f.f.d.f.b.[.%X&X;X2XuX2X;XeX,X2X<X<X<XuX<X<X2X<X;XuX<XuX2XuXuXuXuXuX2XuXuXu [...]
+"R H ;X;X;X-X;X-X;X;X;X-X&X>X&X>X-X;X;X;X;X;X-X;X;X;X;X>X;X&X-X;X;X-X;X;X;X*X-X>X2X;X;X;X;X;X;X;X;X;X;X2X;X*X;X<X;X;X;X;X;X;X;X;X;X&X>X;X2X;X;X;X;X;X>X>X;X;X;X;X;X>X;X;X;X<X;X;X;X;X>X;X;X>X;X2X;X;X;X;X;X<X>X;X;X;X2X;X<X<X<X>X;X;X;X;X<X<X>X<X<X>X;X;X2X;X<X<X<X<X<X<X<X>X<X2X;X;X2X;X<X;X;X;X;X2X2X;X2X;X<X;X2X;X<X<X>X<X<X<XuX<X;X<X2X;X2X;X<X<X<X<X<X<X<X<X<X;X<X;X<X;X2X<X<X<X<XuX;X;X<X;X;X<X<X<X;X;X{.M.C.f.j.h.b.V.B.n.C.n.b.n.-X<X<X<X<X<X<XuX<X2X2XuXuX2XuX<X<X<X2X2X<X<X2XuX<X2X2X<X<X2XuXeX2Xu [...]
+"O.H &X;X-X;X&X-X-X;X&X;X;X&X-X;X;X-X;X-X-X-X;X>X>X;X>X&X;X;X*X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X1X;X>X&X;X;X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X>X;X;X<X;X;X>X<X;X>X;X;X;X;X<X;X<X;X&X;X;X;X;X;X;X;X<X;X;X;X;X<X;X;X2X<X<X<X<X;X;X2X;X;X2X<X;X<X;X;X;X;X;X;X;X<X;X<X<X<X;X<X;X;X<X<X;X;X<X2X;X;X;X;X2X;X;X2X<X<X<XeX<X<X<X<X<X;X2X<X;XuX<X<X;X;X<X<X<X<X<X<X<X<X<X<X<X;X<X<XuX<X<X<X2X<X<X<X;X;X;X;X;X2X;X3X2X.XN.m.m.C.>X;X$X>X&X-X;X2X<X<X<XeX<X<XeX<X<XuXeX;XuX2X<X<X2X<XuXuX<X<X2X2X2X;X2XuX<XuX<X2X2 [...]
+"z R -X>X&X;X>X;X&X>X;X>X-X;X;X;X;X-X;X;X-X;X;X;X;X;X;X;X-X;X;X>X;X-X&X>X;X&X;X;X;X;X;X;X;X;X1X2X3X;X&X;X;X>X;X;X;X;X;X;X;X<X;X>X;X;X;X;X;X;X;X;X;X;X;X;X;X;X<X;X;X;X2X>X;X>X>X<X<X;X>X;X;X;X;X;X2X;X;X;X<X;X;X;X;X;X;X2X>X<X<X<X<X;X;X;X;X2X;X2X;X2X2X;X<X;X;X2X2X;X<X<X<X;X;X2X;X>X<X<X<X<X;X<X<X;X<X;X;X<X<X<X<X<X<X<X;X<X;X;X;X;X<X<X;X<X<X<X<X<X<X<X<XuX<XeX>X<X2X;X;X2X;X2X<X<X<X<X<XuX2X>X2X;X;X;X;X;X;XuXqX<X>X>X1X;X;X,X2X<X<X<X<XuX<X<XuX<X<X<X<XeX<X<XuX<X<XuX2X<X<X2X<XuX<X<XuX2X2X2X2X<X<XeX<Xe [...]
+"R R %X&X;X>X&X;X;X;X;X&X;X-X-X;X;X;X-X;X>X;X>X&X>X;X;X;X;X;X;X;X;X;X;X;X;X>X&X*X;X;X;X;X;X;X;X;X1X;X;X;X;X;X;X2X1X3X;X2X<X<X;X;X>X;X<X;X;X;X>X;X;X;X;X>X;X;X>X;X;X>X;X;X;X2X1X;X<X;X;X<X;X;X;X<X;X;X;X;X;X<X;X<X;X2X;X;X;X;X;X<X;X;X2X;X;X;X;X;X;X;X;X;X2X;X<X;X;X;X2X;X;X;X2X;X<X<X<X<X<X<X<X<X<X<X;X<X2X;X>X<X<XeXeX<X<X;X<X2X2X<X;X;X<X<X2X;X<X<X<X<X<X<X<X<XuX<X2X<X<XuX<X<XuX<XuX<X2X<X<X2XeX<X2X2X<XuX<X<X>X<X<X<X2X<X<X2X<X<X;X<X<X<X<X2X<X2XuX<X<XuXeX<X<X<X<X2XuXuX<X<X2X2X<XuX<X<X2X;X<X<X<XuXaXe [...]
+"H R *X;X;X&X>X;X;X;X;X;X;X;X&X;X;X;X;X;X;X;X;X;X;X;X;X&X&X*X;X;X;X;X;X;X;X;X;X;X;X;X;X3X-X;X;X3X;X;X;X;X;X;X;X;X;X;X<X;X;X;X>X;X>X;X;X;X;X;X;X>X;X;X<X<X;X;X>X;X;X>X;X;X;X;X<X;X>X2X;X;X2X;X;X>X;X;X;X<X;X<X<X<X;X2X;X;X;X;X;X<X;X<X<X;X;X;X2X;X<X<X<X2X<X<X;X;X<X;X2X;X<X<X<X>X;X;X2X;X2X<X<X>X<X<X<X<X<X<X<X<X<X<X<X>X<X<X<X>X;X2X;X2X2X;X2X<X<X<X<X<X<X<X<X<X<X<X2X<XuX<XeXuX<X<X<X<X<X<X<X<X2X<XuX2XuX<X<X<X<X<XuX<X<XuX<X;X;XuXuX<X<X2X<X<X<X<X2X2X<XuX2X<X<XuX2X<XuX2X<X<X<XuX2X2XuX2X<X2XuX<XuX<XeXe [...]
+"R R ;X;X;X;X&X;X;X;X>X;X;X;X;X;X;X;X;X&X;X;X-X;X>X&X;X;X>X;X;X;X;X;X;X;X;X>X-X;X;X;X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X1X;X2X;X;X;X;X;X<X<X;X;X;X;X;X;X<X<X<X;X;X<X;X;X;X>X;X<X<X<X;X;X<X;X;X;X;X<X;X>X2X;X;X<X>X<X<X;X;X;X<X<X;X;X<X>X<X<X;X;X;X;X;X;X;X;X;X;X<X2X<X<X;X;X<X;X<X<X2X;X;X2X;X<X<X<X<X<X2X<X2X<X<X<X<X<X2X2X<X<X2X;X>X<X2X;X;X2X<X<X<X<X2X<X<X2XeXuXuX;X;X;X<X<X<X<X<X<X<X<X<X2XuX<X<X2X<X2X<X<X<X2X2X<X<XuX2X;X2XuX<X2X<X2X2X;XuXeX2X<X<X<X;XuX2X<X<X<X<X<XuX<X2X<X2X2XuXuX;XuXuX;X2XuX<X<X<Xu [...]
+"F R ;X;X;X;X;X;X&X;X3X;X;X;X;X;X;X;X;X;X;X;X;X-X;X;X;X&X;X;X;X;X;X;X>X>X;X>X;X;X;X;X3X;X;X;X;X;X;X;X;X;X;X;X;X2X;X;X;X>X;X;X;X<X;X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X<X;X2X;X>X2X;X;X2X;X;X<X;X;X;X<X;X;X;X<X>X;X<X<X;X;X;X;X;X>X;X;X2X<X<X2X;X;X<X<X;X;X2X;X<X;X<X;X2X;X2X;X;X<X<X;X<X;X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X>X<X<X<X<X<X<X;X2XuX<X2X;X<X;XuX<X<X<X<X2X;X<XuX<X<X<X<X<X<X<X2X<XuX2X<XuX<XuX2X2X<X<X2X<XuX<X<X<X2X<X<XuXuX<X2X<XuX<X2XuXuX2XuX2X2XuXuX<X<X2X2X2XuXuX<X2X<X<X<X<XuXuXuXuX<XeX<X< [...]
+"H R ;X;X;X;X;X;X;X;X>X;X;X;X&X;X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X&X;X;X>X&X;X;X;X>X;X;X;X;X;X;X;X;X;X3X;X;X1X2X;X;X;X;X;X;X;X;X>X;X;X;X>X;X;X<X;X;X;X;X;X<X;X;X;X;X;X;X>X;X;X>X;X;X;X;X;X;X;X<X;X;X;X;X>X>X<X2X;X;X;X;X<X;X<X;X;X;X<X<X<X<X<X;X<X2X;X;X;X>X2X2X;X;X;X2X;X;X2X;X;X;X<X;X2X<X>X<X>X2X;X>X<X<X<X<X<X<X<X;X<X<X<X<X<X<X<XuX<X<X<X<X;X2X2X;X<XuX<X>X;X<XuX<X<XuX;X<XuX2X2X2X<X2X<X2X;X<X2X;X<X2X2X<XuX2X;XuX<XuX<X<X<X<X<XuX<X;X2X<X<X2X<X<X<X2X<X2X2X2X<X2X<X<X2X<X<XuX<XtXuXuX;X<X<X<XuXuX< [...]
+"R R ;X&X;X;X*X;X;X;X&X;X;X;X;X3X;X;X;X&X;X>X;X;X;X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X;X;X-X;X;X;X;X;X;X;X;X;X;X-X;X;X;X;X;X;X2X;X;X;X;X;X;X>X;X<X;X;X;X;X;X;X;X<X;X2X;X<X>X<X>X>X<X;X;X;X<X<X<X<X>X<X;X;X;X<X2X;X;X<X;X2X<X;X2X;X2X;X2X;X<X<X<X<X<X<X<X2X;X;X2X;X<X;X2X<X;X;X;X<X;X<X;X<X;X<X<X<X<X<X<X;X<X;X;X<X<X<X<X<X<X;X2X<X<X>X<X<X<X<XeXuX2X;X;X;X2X<X;X<X<X<X<X2X<X<X<X<XuX<XuX;X2X2X;X<X;X2X2X<X<XuX2X<X2X;X<X<X<X<X2X<X2X;XuX<X<X<XuX2X2X<X<X<XuXuX2X2XuX2X2X2X2X<X<X<X2X<XuX<X2X<X<X2XuX2XuXuXu [...]
+"R F >X;X;X;X;X;X;X;X;X&X;X;X;X;X;X&X;X2X;X;X;X;X;X;X1X;X;X;X;X;X;X;X;X;X;X;X;X3X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X;X;X<X;X<X<X>X>X;X;X;X;X<X;X;X;X>X;X;X;X;X;X;X<X;X;X;X<X<X>X;X<X<X>X;X<X;X2X;X;X;X;X<X<X;X;X2X<X;X<X;X;X;X<X<X<X;X;X;X2X;X;X;X;X;X;X;XuX<X<X2X;X;X;X<X<X<XuX;X;XuX2X<X<X2X2X;X<XuX<X<X<X<X<X<X<X<X;XuX<X<X;X2X2X2X2X2XuX2X<X<X2X2X<X;X2X<X<X<X<X<X2X<X<XuX<X2X;X<X2X;X;X<X2X2XuX2XuXeXuX<X<X<XuX<X<X<X2X<XuXeX2X<XuX<X2X2X2X;X2X2X<X2XuX<X<XuXeX<XuXuXuX<X<XeXuXuXeXe [...]
+"R R ;X;X;X;X;X;X;X;X;X;X;X;X;X1X;X;X;X;X;X;X;X;X;X;X&X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X3X1X;X3X;X;X;X;X;X;X;X;X3X;X;X;X;X<X>X<X<X;X;X>X;X;X;X<X>X>X;X;X;X;X<X;X;X;X<X>X>X<X2X<X;X<X<X<X;X>X<X;X;X;X2X<X;X2X>X;X<X;X;X2X<X<X;X<X<X;X>X;X;X<X>X<X2X<X2X;X<X<X;X<X<X<X<X>X2X<X<X<X2X<X<X<X<X;X;X;X;X;XuX<X<XeX<XqXeX<X<XuX<XuX2X2X<X<X<X<XuX>X<X<X<XuX2X;X;X2X2X;X2X<XeX<X<X;X<X<X2X<XuX2X2X2X2X2X2X<X<X2X<XuX2X2XuX<XuXeXuX<X<X<X<X<X<XuX2X<X2X;X<X2X2X2X2X2X2X2XeXuX2X<XuXuX2XuXuX<X<XeXeXe [...]
+"R F ;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X>X;X;X;X;X>X;X<X;X<X;X;X2X<X;X;X;X;X;X;X2X;X;X;X2X;X>X;X;X2X;X;X;X;X;X;X;X;X<X;X2X;X;X;X2X;X;X;X;X;X<X<X;X>X;X<X;X<X<X<X<X<X<X<X;X;X<X;X<X;X>X<X<X>X<X;X;X2X>X<X<X>X<X<X;X<X>X;X;X<X<X<X;X;X;X<X;X;X;X<X;X>X<X;X;X2X<X>X<X<X<X<XuX;X<X;X;X;X<X;X;XuX<X<X<X<X;X<X;X2X;X2X2X<XuX<X<XuXeX<XeXqX<X<X<X<X<X<X<X<X2X2X;X<X<X2XuX2X<X2X;X2X<X<XuX<X<X<X<X<XuXuXeX<XuX<X<X2X;X2X<X;X2X2X;X2X<X2X;X<X<X<XeXuX<X<XuXuX<X<X2X<XuX2X<XuX<XuX;X<X2X2X2X2XuXuX;XuX<X<X2X<XuXeXeXeXe [...]
+"R H ;X;X;X;X;X&X;X;X;X;X;X;X;X;X;X;X;X;X;X;X&X;X;X;X>X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X;X;X;X>X;X<X;X;X;X;X;X2X;X;X2X;X;X;X>X;X;X;X;X<X;X;X2X>X;X<X;X<X>X<X>X>X;X<X<X;X;X;X2X;X<X>X<X<X<X;X<X;X;X<X;X;X2X;X;X2X;X>X;X>X>X;X<X<X<X;X<X;X;X;X<X;X;X<X<X;X<X<X<X<XeX>X<X<X<X<X<X>X2X<X<X<X<X<X<X>X;X<X;X<X2X2X;X2X2X<X<X2X<X;X2XuXeX<X<X<X,X;X;X2X2X;X<X2X<X2X;X2X<X<X<X<X<X<X<XeXuX2X<X<X<XeXeX<X<XuX<X<X<X2X2X;X2X2X2X2X<X2X2X<X<XuXeX<X<X<X2X<X<XuX2X2X2XuX2XuX<X2X2X2X2X2X2XuXuX2X<XeX<XeXeXuXuXuX2XuX<X< [...]
+"H R ;X;X;X;X;X;X;X2X;X;X;X;X;X&X;X;X;X;X>X<X;X;X;X;X;X;X;X;X;X;X;X;X;X>X;X;X;X;X;X>X;X;X;X<X;X;X;X,X<X>X;X<X;X;X;X>X;X>X;X3X&X2X;X>X;X>X;X;X;X;X2X;X;X;X2X;X;X;X;X2X<X>X<X<X;X;X<X<X;X<X<X;X;X<X;X>X;X<X;X<X2X2X>X3X2X;X;X;X;X<X;X2X;X2X2X2X<X<X<X;X<X;X<X<XeX<XeX<X2X<X<X<X<X<X<X<X<X<X<X;X<X<X<X;XuX<X2X;X;X2X;X;X<X<X<XuX<X<XeX<XeXuX2X<X2X;X<XuXeX<X<X;X;X2X<X2XuX>X<X2X<X<X<XuXuX<XtXeXeXuX<X<X2X2X2X2X2X2X2X2X2X<X<XuX>X<X2XuX<X<X<XuXuX<X2X2X;XuX2X<X<X2X2XuX2XuX2X2XuX2X2XuX2XuX<X2XuX2XuX2XuX<XuXu [...]
+"R R ;X;X;X;X;X;X;X;X&X;X;X;X>X;X;X;X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X;X;X-X;X;X;X;X>X;X;X;X2X<X>X<X;X<X2X2X1X2X;X<X>X;X;X>X2X;X;X;X;X;X<X<X<X<X<X>X;X;X;X;X;X;X;X>X;X;X2X;X;X;X<X;X<X<X;X<X;X<X2Xz. O.<X>X<X;X>X<X;X;X<X;X2X;X<X<X;X2X;X2X2X<X<X<X<XuX<X<X<X2X;Xw 2X<X2X>X<X<X<XuX;X<X;XuXuX<XuX<X<X<X<X<X<X<X<XuXuX<X;X2X<XeXuX<X<X2X2X<X2X<X<X<X<X<X<X<X<XeXeX<X<X<X2XuX<X2X;X2X;X2X2X;X;XuXuX<X<X2XuX2X;XuX<X2X<X<X2X<X2X<X<XuX<XuX<XuX2XuX2XuX<X2X<XuX2X2X2X<X2X2X2X2X2XuX2Xe [...]
+"H H &X;X;X;X;X;X;X;X;X;X>X;X;X;X;X;X>X;X2X;X<X>X;X;X;X;X;X;X<X>X;X;X;X;X;X>X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X<X<X<X>X;X;X;X;X2X;X;X;X;X<X<X;X;X;X;X<X<X>X<X<X<X<X;X<X;X>X;X>X<X<X<X>X>X;X;X;Xr. O.;X<X;X;X2X<X<X;X;X2X;X;X2X;X2X<X;X;X;X;X<X<X<X<X<X<X;X;X>Xw <X<X<X<X;X2X;X2X2X<X<X;X;X2X;X<X<X<X<X<XuX2X<X<X<X2X<X<X<X<X<X2X<X;X2X<XuX2XuX<XeX<XuXuXeXeX<X<XuX2X<X<X2X<X2X2X;X2X2X2X2X;XuX<XuX<X<X2XuXuX<X<XuX2X<X<X2X<X2X<X<XuX<X<X2X<XuXuXeXuX<XuX<XuX2X,X2X2X3XuX2X2X<X< [...]
+"R F ;X>X;X;X;X>X;X;X-X>X;X;X;X;X;X>X;X;X;X;X;X2X>X<X<X;X;X;X>X<X<X;X;X;X;X;X;X>X;X2X;X;X<X>X;X<X;X;X;X;X;X;X;X;X>X<X;X;X>X;X<X;X;X2X;X;XuX;X<X<X<X<X>X<X<X<X<X>X<X>X;X<X;X;X>X<X<X<X<X<X<X2X>X<Xz. Q 3X;X2X;X<X<X<X>X;X2X;X<X;X<X<X<X<X<X>X<X;X;X<X;X2X<X2X<X>Xw <X<X2X;X;X<X<X2X<X<X2X;X<X2X2X<X<X<X2X<X2X<XuX<X<X<X<X<X<X<X<X2X2X<X;X<XuX<X<X<X<XuX<X<XuX<X<XeX2XuX2X<XuX<X2X;X2X;X<X<X<X2X2X<X<X2XuXuX2X<X<XuXuXuX;X2X2X<X2X2X2X2X<XuX<X2XuXeXuXuXuX<X<XuX2XuX2X2X2X2X2X2X<X< [...]
+"R R ;X;X;X;X;X;X;X;X;X-X>X;X;X;X;X;X;X;X;X;X<X;X;X>X;X;X;X;X;X;X<X;X;X;X2X;X2X2X<X;X2X;X;X;X;X;X>X<X;X2X;X>X;X;X;X<X;X;X3X2X;X;X;X;X2X<X;X;X;X;X;X;X<X<X<X<X2X;X;X;X;X2X<X<XeX<XqXqX<X<X>X>X<X<Xr. T ;X;X<X<X<X<X;X<X<X;X<X<X2X;XuX<X<X2X<X<X<X2X>X;X<X<X<X2X<Xw <X2X<X;XuX2X<X<X2X<X2X<X<X2X;X2X2X<X<X<X<X<X<X<X<XuX<X<XuX<X2X<X2X;X<X2X<XeX<XuX<X2XuX<X2X<X<XuX<X2XuX2X2XuXuX<X2XuX2XuXuX<XuXuXuX2X2X<X<X<X2XuX2X<X2XuX2XuX<X<X;X2X2X<XuX<X<X<X<XuX<XuXuX<X2X2XuX2XuXuX<XuXeXe [...]
+"R R ;X;X<X>X;X;X>X;X;X;X;X;X>X;X;X-X;X;X;X;X;X2X;X;X<X;X;X<X<X<X;X>X>X;X;X;X;X;X;X;X;X;X;X>X;X<X<X<X;X;X;X;X<X<X<X<X;X2X;X;X<X>X;X2X2X;X;X2X;X;X<X<X<X;X<X>X>X2X<X<X<X<X<X<XeXqXqX<XeX<X<X<X<X<Xz. O.>X;X<X<X<X<X;X;X<X<X;X;X2X;X;X<XuX<X<X<X<X<X<X<X<X<X<X<X<Xw <X<XuX2XuX<X<X2X2X<X<X<X<X<XeX<X2X<XuX<X<XuXuX2X2X2X<X<X<XuX<X2X2X2X2XuX<X<XuX<X<X<XuX<XuX<X<XuX;X<XuX2X<X2XuX<XeX<X<XuX2X<X2X<X2X2XuX<XuX<X<XuXuXuX2XuX<X<X;X2X;X2XuX<X2XuXuXuX<XuXuX2XuX2X<X2XuX<X<XeXuXuXuXu [...]
+"H H ;X;X;X>X<X>X;X-X;X;X;X;X>X;X;X;X>X;X;X;X;X;X;X;X;X;X<X;X>X<X<X<X<X<X;X>X<X;X3X;X;X;X;X>X<X<X<X<X;X;X;X2X<X>X<X>X,X;X2X<X2X>X;X;XuX<X;X;X;X>X<X>X<X<X<X<X<X<XeX<XqXeXqXqX<XeXqXeXqX<X<X<X<X<Xr. +.<X;X;X;X;X>X<X;X;X2X;X;X<X2X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X, <X<X<X<X<X2X;X<X2X;X2X<X<XuXuX<X<X<X<X<X2X<X<X<X<X<XuXeX<X2XuX<X;XuX<X<X<X<X<X<XeX<X<X<X2X<XuX2XuXuX2X<XuX<X<X<XuX<X2XuX<X<X2XuX<XuXuXuX<X2X2X2X2XeXuXuX<XuX2X2X2XuX2XuX<XuX<X2X<XuXuX<X2X2XuXuX2XuXuXeXeXuXuXu [...]
+"T H >X;X>X;X;X;X;X;X;X;X;X;X;X;X>X;X;X;X<X;X;X2X;X;X;X;X;X<X;X;X;X;X;X<X<X;X;X;X;X;X2X;X;X<X<X<X>X<X;X;X;X<X2X;X;X2X>X;X2X<X<X<X2X<X>X<X<X>X<X<X<X<X<X<X<X<X<X<X<X>X<X<X<X<X<X<X<X>X<X<X<XqX<X<Xr. +.<X;X<X<XuX<X<X;X<X<X>X;X2X;XuX<X<X<X<X<X<X<X<X<X<X<X2X2X2X, 2X<X<XuX<X<X;X2X;X2X2X<X<X<X<XuX<X<X<X<X<X<XuX<X<X<X<X<X<XuXuX2X2XuX<XuXuX<X<X<XeXuX<X<X2XuX<XuX2X2X<X<X<X2X<XuX2X2X<X2X2X<X<XuXuX<X<X<X<XuX2X<X<X<X2XuXeXeXuX2X<XuX2XuX2XuXuXuX2X2XuX2XuXuXuX2X2XuXuXuXuXuXaXu [...]
+"R R ;X;X;X;X;X;X<X;X;X;X;X>X;X;X;X;X;X;X>X&X;X;X>X;X;X;X;X>X;X;X>X;X;X;X;X;X;X;X;X;X;X;X;X;X>X<X<X>X;X<X;X;X;X<X;X<X;X;X;X<X<X<X;X<X<X<X<X<X<X<X>X<X>X>X<X<X<X<X<XuX<X;X<X<X<X<X<X<X<X<X<X<X<X<Xr. T <X<X<X<X<X<X;X<X<X<X<X<X;X2X;X<X<X<X<X<X<X<X<X<XuX<X<X<X;Xw <X<X<X2X;X2X2X<X2X<X2X;XuXuX2X<X<X2X2X<XuX<X<X2X<XuX2X2X2XuX<XuX<X<X2X<X<XuX<XuX2X2XuX<X<X<X2X<X<X<X<X<XuX<X2XuXuX<XuX<X<X2X<X2X<X<X<XuX<X<XuX<XuX<X2XuX<XuX<XuXuX<XuX;XuX2X2XuX<XuX2XuXuX2X2XuX2X2XuXuXtX<XeXu [...]
+"T R ;X<X;X;X;X;X<X;X;X>X;X;X;X;X;X>X;X;X;X;X;X;X>X;X;X;X;X;X3X;X;X;X>X;X;X;X;X;X;X<X;X;X>X<X<X<X<X<X;X2X2X;X;X;X;X;X2X<X<X>X>X2X;X;X<X<X<X<X<X;X<X<X>X<X2X>X>X<X<X<X;X;X<X;X<X<X>X<XqX<X<X<XuX;Xz. O.<X<X<X<X<X<X;X<X<X<X2X<X<X;X2X<X<X<X<X<XeX<X<XuX<XuX<X<X;X, ;X2X2X;X<XuX<XuX2X<X<XuXuX<X<XuX<XuX2X<X<XuX<X<X<XeX<X2X2XuX<X<X<X<X<X<XeXuXeX<X<X2X2X;X<XuX<XuXuXuXeX2X<X<X<X<XuX2XuX2X2X2X2X;XuX2XuXuX2X<X<X<X<X<XuXuXuXuX<X<X<X2X<X<X2XuX<X2X2XuX<XuXuX2X2X2X2X2XuXuXeXeXeXe [...]
+"R R ;X;X;X>X;X;X;X;X;X;X;X>X;X<X;X<X;X;X;X;X;X;X;X;X;X2X;X;X>X;X>X;X;X;X>X2X;X;X;X;X;X;X;X<X<X<X<X<X;X;X<X;X;X2X;X;X<X>X<X;X;X;X2X<X;X<X;X<X;X<X<X<X<X<X<XuX>X<X;X;X<X;X<X<X<X<X<X<X<X<X<X<X;X>Xz. +.<X<X<X>X<X;X<X;X>X<X<XuX;X;X2X>X<X<X<X<X<X<X<X<X;X<X<X<X<Xw 2X<X<XuX2X<X2X<X<X<XuX<X<X<X2X<X<X<XuXuX<X<XeXeX<XuXuX2XuX<X2X2XuXuXeX<XeXeXeX<X<X<X<X2X2X<XuX<XeX<XeXuX<XuX<XuX2XuX2XuX;XuX2X2X2X2X2X<XuX2X2XuXuX2XuX<X<X<XuX2XuXuXeXeXuXuXuXuX<X2X2XuX2X2X2X2X2XuXuXeXuXuXeX2 [...]
+"H H ;X;X;X;X;X>X;X-X;X;X;X>X>X;X;X2X;X>X;X;X<X;X;X;X;X;X>X;X;X;X>X;X;X;X;X>X;X;X;X;X3X>X;XuX;X<X<X>X;X;X;X2X;X;X;X<X<X>X;X;X;X>X<X<X<X<X<X;X<X;X<X<X<X<X<X<X<X<X>X;X2X2X;X2XuX<X<X<X<X<X<X>X;X<Xr. T <X>X;X;X<X;X;X2X<X;X2X<X<X;X;X<X<XuX<X>X<X;X<X2X2X<X<X<X<Xw <X<X<XuX<XuX<X2X<X<X2X2X<X<XuX<XeXuXuXeXuX,XeXeXeXeXeXuX2X<X<X2X<X<XeXeXeXeX<X<XuX<X2XuX<X2X<X<XuXuX2XuXuXuXuXeX;X2XuXeX2XuX2X<X2XuX<X2X<X<X2X2X<X2X2X<X2X2X2XuX2XuXeXuXuXuX2XeXuXuX<XuXuX2XuXuX<XuXuXeXtXuXuXu [...]
+"R H ;X>X;X;X;X;X;X>X;X;X;X>X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X;X<X<X<X;X;X2X;X2X2X;X<X;X>X;X<X<X<X;X;X;X;X2X<X;X;X2X;X2X;X2X3X2X;X<X<X;X>X;X<XuX;X<X<X<X<X<X<X<X<X>X;X&X>X2X;X<X<X<X<X;X2X;X<X<Xr. O.2X2X;X<X<X<X<X;X<X>XuXuX<X<X<XuX<X2X<X<X<X<X<X<X<X2X<X<X2X, <X<X;XuX2X<XuX<XuX<X<X<XuXeXuX<XeXeX<XeXtX<XeXuXuXuXuXuXuXuXuXuXeX<XeX<XtXqXeXtXeX<X<XuXuX<XuX<X<X<X<X<XuXeX2XuX2XuX2X<X<XuX2X<X2X;XuXuXuX2X<X2XuXuX<XuXeXeXuX2X2XeXuXeXuXuX<XeXuXuXuX2X2XuXuX2X2XuX2X<XeXuXuXu [...]
+"H R &X;X<X;X;X;X;X;X;X<X;X;X&X;X;X;X;X;X;X>X<X;X<X<X;X<X;X<X;X>X<X>X;X>X2X;X;X,X;X<X;X<X<X>X<X<X<X<X>X2X<X;X;X;X<X;X;X2X2X;X2X1X2X<X>X>X<X<X;X<X<X<X<X2X<X<X<X<X;X>X;X<X<X<X<X<X>X>X<X;X<X<X<X<Xr. +.;X;X;X;X<X>X<XuX2X<X<XuX<XeXuXuX<X<X<X2X<X<X<XeXeX<X<X<X<X, uX<XuX<X<X<X2X<X<X<XuX<XuX2X2X,X2XuXeXeXeXeXeXuXeX<XuXeXuX<X<XuXeXeXeXtXtXeXeXeXuX<XuX<XuX;X<X<XuX;XuX<XuX2X2X2X<X2X2X2X2X<X2X<X<XuX2X<XuX<XuXuXuXuXeXeXeXeX<X2XuXuXuXuXeXeXuXeXuX<X2X2X2X2XuXuX2X2X2XuXuXuXtXu [...]
+"O.R >X;X;X;X;X>X;X;X;X;X;X;X>X;X;X2X;X;X;X>X;X;X;X;X<X;X<X<X;X<X<X;X<X<X;X;X<X;X;X;X<X<X>X<X>X<X<X<X;X;X2X;X;X<X;X;X<X;X<X>X;X2X<X<X;X2X;X<X;X;X>X<X;X;X<X;X<X<X<X<X;X2X<X<X<X<X<X>X<X>X<X;X;X>Xr. +.<X<XuX<X<X<X<X>X<X<X<X;X;X<X<X<XeX<X<X<X<X2X<X<X<XeXeX<XuX, 2XuXeX<XeXuX<XuXuX<X<X2XtX<X<XuX<XaXaXeXaXeXeXeXtXuXeXeXeXuXuXuXeXaXeXeXeX<XuX<X<XuX2X<X2XuXuX2XuXuXuX<XeX<X<X2X2XuXuX2X2XuXuXeXuXuX<XuX<XuX2X2X2XuXuXeXeX<XuXuX<X2X2X2XuXuXuX<XuXuXuX2XuXuX2XuXuXuXuXuXuXaXaXp [...]
+"H R ;X;X;X;X;X;X;X;X>X<X;X;X;X;X;X1X2X;X;X;X;X;X;X;X;X;X;X<X;X;X>X<X;X;X;X;X<X;XuX>X;X<X<X>X>X<X<X2X<X;X>X;X<X;X<X2X;X;X<X<X<X<X2X;X2X;X;X<X<X<X>X<X<X<X;X;X<X<X<X<X<XuX<X<X<X<X2X>X<X<X;X;X<X;Xr. T <XeX<X<X<X<X<X<X<XuX;X<X;X;X2X2X<X<X2X2X<X2X2X<XqXeXeXeXeX, <XeX<XeXuXeXeXeX<XuX<XeXeXeXuXuXeXeXeXeXeXeXtXeXeXuX(.z.t.z.z.z.'.wXeXwXuXqX<XuX2X2XuXuXuXeXuXuXuX<XeX<XuX<X<XuX<X<X2XuX2X2XuXuXuXuXuX<X<XuX2XuX2XuXuXuX2XuXuXuX2XuXuX<XuXuXuXuXuXuXuX2XuXuXuXuXuXuX<XtXuXuXeXp [...]
+"R R ;X>X;X>X;X;X;X>X;X;X;X>X;X;X;X2X,X;X>X;X>X&X;X;X;X;X;X;X<X,X<X<X<X<X;X;X2X<X<X;X>X<X<X>X<X<X<X;X,X<X;X2X<X<X;X<X<X>X<X<X<X<X<X2X;X>X2X;X<X<X<X<X<X;X2X>X<X;X<X<X<X<X<X<X;X2X<X2X;X;X;X<X<X<Xz. +.>X<X<X<XeX<XuX<X2X<XuX<X2X<X>X<XuXuX<X;X<X;XuXuX<X<X<X<X<Xw eXeXuXuX<XtXeXeXeXeXeXeXeXeX2XuXeXeXpXeXeX/.+.w $ . e J u.eXeX<XuXuX<X<XuXuX2X<X<X2X'.r.t.t.z.t.z.(.uXuX2XuXeX2X2XuX<XeX<X2XuX<XeXuXuX(.t.z.t.t.r.z.'.2XuXuXuXeXuXuXaXuXuXuXuXuXuXeXuXtX=XT.t [...]
+"H R ;X;X;X<X>X;X>X;X;X;X;X;X;X;X;X;X;X;X;X;X;X2X2X;X>X>X;X<X>X<X<X>X;X;X<X<X<X;X;X2X<X;X<X<X<X<X<X>X<X<X;X<X<X<X<X;X<X<X<X<X<X<X>X<XuX<X<X;X<X;X<X<X<X;X;X<X<X<X<X<X<X<X<X<X;X<X<X;X<X;X;X;X<X<Xr. T ;X<X<X<X<X<XuX<XuX<X<X<X<X<X2X<X<X<X<XuX<X;X<X<X<XeX<X<XuXw uXuXeXeXeXeXtXuX2XwXeXaX<X<X<XuX<XwX(.G X $ +.=XuX<XuX<X<XuXuX<X<XeXh k 2XuX2X2X<X2X2XuXuXeXuXeXuXuXuX3XuXh O 2X2X<XuXuX2XeXuX2XuXuX2XuXaXaXuXuX:. [...]
+"R H ;X;X>X;X;X;X<X<X;X2X;X;X;X;X;X;X2X>X;X;X2X>X;X<X<X2X;X;X>X<X,X<X<X>X2X;X;X;X;X;X<X>X>X<X<X<X;X;X>X2X<X<X<X<X<X2X<X>X>X>X<X<X,X;X;X;X2X>X<X<X2X;X2X2X<X>X>X<X<X>X;X<X>X;X<X<X<X2X<X2X;X2X<X<Xr. #.>XeX<X2X<X<XeX<X<X<X<X2XuX<X<X2X<X<X2X<X2XuX<X<XeXeXuXeXeX, <X2XeX<XaXeXeX<XwXuXuXuXuX2XeXuX=Xh . 0.<X<XuX2X<XuXuX2XuXu. . uX2XuX<XuX2X2X<XaXeXeXeXuXuXuXuX2XX `.uXuXuXuXuXeXeX<XuXuXuX2XuXuXtXuX= [...]
+"R R ;X>X2X;X;X<X;X>X;X;X;X;X;X>X;X<X<X;X;X2X;X;X;X;X;X;X2X;X;X<X<X<X>X;XuX>X;X;X<X;X<X<X<X<X>X<XeX>X<X<X;X;X;X2X;X<X;X2X;X;X<X2X;X;X<X;X<X;X2X;X2X<X<X2X;X<X<X<X<X<X<X<X>X<X<X<X<X<X2X2X;X>X<X<Xr. +.<XeX<X<X<X;X2X<X<X<X<X<X<X<X<XuX<X<XeX<XuX<X<X<XeXeXeXeXeX, <XuXuX<XeXuXuXeXuX<XuX<XuX2XuXz.X h uXuX;X<X2XuXuXuX=X /.2X2XuX2X2XuX2XuX<XeXeXuX<XuXuXv. :.eXeXeXuXuXuX2XuXuXaXeXuXuXuXuX(. [...]
+"R R ;X;X;X>X<X;X<X2X<X,X<X;X<X;X;X;X;X;X;X;X;X;X1X;X;X;X<X>X;X;X;X>X;X>X<X;X;X2X;X;X;X<X<X<X<X<X2X<X<X<X2X;X2X;X2X;X<X;X<X;X;X<X;X2X<X2X;X2X<X<X2X<X<X<X<X<XuX<X>X<X<X>X<X<X<X<X2X;X;X<X<X<XuX<Xr. T uX<X<X<X<X2X;X<XuXeXeX<XeXeX<X<XeXqX<X<XuX2X<XeX<XeX<X<X<X> uXeXuXwXeXeXuXeXeX2XwX2X<X<X:. O.uX2X2X2X2XeX<X2Xd O.2XuXuX<X2XuX<XuX2XuXaXeX<X<XuX&. k uXuXuXuXuXuXuXuXuXuXuXeXuXuXuX&. [...]
+"R R ;X<X<X>X;X;X;X;X<X<X<X<X<X<X<X;X;X;X;X<X;X>X;X;X2X,X<X<X;X<X;X<X;X;X<X>X<X>X<X<X<X<X>X<X<X<X<X<X>X<X<X>X<X>X;X;X<X<X;X<X>X<X;X;X;X<X;X;X;X2X<X<X<X<X<X2X2XuX<X<X<X<X<X<X<X<XuX;X<X2X<XuX<X<Xz. O.<X<XeXeX<XeXuXuX<XeXeX<X<XuX<XeXeXeX<X<X<X<XuXeXeXeXeXeX<X, eXeXuXwXuXuXuXuXuX<XuXuXuXr. $ w G / +.O./ , O (.wX<XuXeXeXuXuX0. * uXuX2XuXuX2XuX2X2XuXuX<XuXuXuXw O 2XuXuXuX2XuXuXuXuXaXuXuXuXuXuXd [...]
+"R R >X;X;X;X;X>X<X>X<X<X<X<X>X>X<X<X<X;X<X<X<X<X;X<X;X;X>X<X<X<X<X<X<X>X<X<X<X<X<X<X<X<X>X<X<X<X<X<X;X>X2X;X<X<X<X<X<X<X<X<X<X<X<X<X<X;X<X<X<X<X<X<X<X<X>X<X>X<X<X<X<X<X<X<X2X<X;X2X<X;X<X<X;X2Xr. +.qXeXeXeX<X<X<X<XeX<X<X<X2X<XuXuXeXeXeXeX<XuXeXeXeXeXeXeX<X> uXuXuXwXuXeXwXuXwXuXuXwX:X$ X G '.qX<X<XeX2X<X2X<XwX].Q X k <XuXuX<XuXuX<X X =XuX2X<X2X2X2X2X<XeX<XuX2XuXuX ].2XuX2X2XuXuXuXuXuXuXuXaXuX=X [...]
+"R T ;X;X;X;X>X>X<X<X<X<X<X<X<X<X<X<X>X<X<X<X>X<X<X<X2X;X<X;X<XqX<X>X<X<X<X<X>X<X<X<X<X<X>X<X;X;X<X>X>X;X<X<X<X<X<X<X>X>X<X<X<X<X<X<X<X;X<X<X<X>X<X<X2X<X<X<X<X<X<X<X<X<X<X<X<X>X<X<X;X<X;X;X2X<Xr. +.<X<XqXeXuX>X<XuX<X2X<X2X<X<X<XeXuXuX2XuX<X2XuXeX<XeX<X2XuX, wXuXuXuXwXeX<XuXuXwX2XeXQ * /.eX<XeX<XeX<X<X<XuXuX2X2X<X1Xy =X;XuX2X2XuX<X<X> :.uX2XuXuX2XuXuXuXuXeXuXuXuXu. &.uXuXuXuXuXuXuXuXuXuXuXuXuX7. [...]
+"T H >X;X;X<X<X<X<X<X<X>X>X<X<X;X>X<X<X<X>X<X<X<X>X>X<X;X<X>X<X<X>X<X<X<X>X;X;X<X>X;X<X<X<X<XuX;X<X<X<X<X<X<XeX<X<X<X<XeX<X<X<X<X;X2X;X>X<X<X<X<X<X>X<X<X<X<X>X<X<X<X<X>X<X<X<X<X2X<X2X2X2X<X2X;Xr. w +.Q #.+.T +.+.Q +.O.Q Q +.+.Q +.+.Q +.O.Q Q +.+.+.Q #./ +.$ wX2XuXuXwXuXeXuXeX<X2X=XX . =X<X<X<XuXuXuX2XuXuX<XeX<XuX2X2XuX, u.uX2X2X2XuX2XuX&. k 2X2X2X2X2XuX2XuXuXuXtXuXuXJ d uX2XuXuXuXaXuXuXuXuXaXuXuXk [...]
+"R H >X;X;X<X<X<XqX<X<X<X<X<X>X>X;X<X>X<X>X<X<X<X<X<X<X>X;X;X;X<X<X<X<X2X;X;X>X>X<X<X,X<X<X<X<X<X>X<X<X<X<X<XeXqX<X<X<X<X<X>X<X<X<X<X>X<X<X<X<X<X<X;X<X>X2X<X>X<X<X<X<X<X<X<X2XuX<X;X;X2X<X<XuX<Xz. uXwXeXeX<XuXeXuX<XeX2X7. u.eX<X<X<XuXeX<XeXuXeXuXeXeXeXeXeX2X(. +.uX2X2X2X<XuXuX]. . <X2XuXuXuXuX2XuXuXuXuXuXuX; X aXuXuXuXuXuXuXuXeXeXaXeXuXX [...]
+"R R ;X;X;X<X<X<XqX<XqX>X;X<X<X<X<X>X<X;X>XqX<X<X<X>X<X;X<X;X;X>X<X;X>X;X;X2X<X<XqX<X<X<X<XuX>X>X;X<X<X<X<X<X>X<X<X<X<X<X<X<X<X<X<X<X<X2X<X<X<X>X<X2X2X<X<X<X<X<X<X<X<X<X<X<X<X<X<X2X<X;XuX<X<X<Xz. eXeXeXtX<XwXuXuX2XuX2Xd = uX<XuXuXeX<X2XuXeXuXuXuXeXeX<XeXeX<X2Xf G 2X2XuX2XuX2X2X2X; '.2XuX3XaX2XuX2XuXuXuXaX]. = v.uXaXuXuXuXaXtXeXaXtXeXe. [...]
+"T R ;X>X>X>X>X<X<X<X2X>X;X>X,X<X<X>X<X<X<X<X<X<X;X;X<X;X>X;X;X,X<X>X<X<X<X<X<X>X<X<X<X<X<X<X<X<X,X<X<X<X<XeX<X<X<X<X;XuX;X<X2X<XeX<X<X<X<X<X<X<X<X2X<X<X<XeX<X<X<X;X<X<X<X2X<X<X2X<X<X<X2X<X<X<Xr. uXtXwXeXeXeXeXeXeXuXeX 7.<X2X2X2X2XuX<XuX<X2XuX;XuXuX<X<XuXuX<X+. , <XuX2XuX2X2XuX2X&. / 2XuXuXuXuXuXuXuXuX<XeX7. G = &.uXeXaXaXtXeXaXuXpXaXeXG [...]
+"T R 2X<X;X<X<X<X>X<X>X<X<X<X;X;X<X<X>X,X<X<X,X;X;X<X;X;X;X<X<X;X>X<X;X<X>X<X<X;X>X<X<X>X<X2X<X<X;X;X<X<X<X<X<X<X<X<X<X<X<X;X2X;X<X<X<X<X<X2X;X;X<X;X<X<X<X<XeX<X<XuX<X<X<X;X;X<X;X<X;XuXuX<X<X<Xz. eXeX<XuX<XeXeXeX<X2X].f , X =X<X<XuX<XuXuX2XuX<XuX<X<XuX<X<X2XuX<X<Xt. , 2XuXuXuXuXuXuXuX/. * uXaXuXuX2XuX2X2X2XuX<Xk w.G d uXuXuXeXeXeXeXtXeXaXtXO [...]
+"T H <X>X;X<X<X<X;X<X>X;X<X>X<X>X<X;X<X<X<X;X;X2X;X;X<X2X<X<X<X<X;X<X>X<X<X>X<X<X<X<X<X<XuX;X<X<X2X<X<X<X<X<X<X<X>X<X<X<X2X;X;X;X<X<X2X<X;X<X;X2X2X<X<X<X<X<X<X<X<X<XuX<X;X2X<X<XuX<X<X2X<X<X<X<Xr. wX<X<X<XuXeXeXeXeX<X<X2X;XuXeXz.w.7.2X<XuXuXuX<X,X2XuX<X2XuX2XeXuX2XuXuX<X2Xr. , uX<XuX2X2XuX2XuXuXO =XuXuX<XuXuXuX2X2XuXuX$ =Xw. . aXeXuXuXuXeXaXuXaXaX/. [...]
+"T T <X<X<X<X<X;X;X>X>X<X<X;X>X<X<X>X>X<X<X;X2X;X<X<X<X<X>X<X>X<X>X<X<X<X<X<X<X<X<X<X<X<X;X<X>X<X<X<X<X<X<X>X<X;X2X;X2X;X2X;X<X<X2X;X;X<X<X<X<XuX;X<X2X<X<X<X<X<X<X<X<X<X>XuX<X<X2X<X<X<X<XuX<XeXr. uX<XeXuX<XeX<XeXeX<X2XuXeXtXuXeXuX2X2X<X2X2X<XeXaX<XuX<X<X2X<X<XuX2X<X<X2X2Xz. w uX2XuX2XuXuX2XuXeXR 0.tXeXtXuXuX2XuXuXuX'. > uX:X i.aXeXuXuXuXaXeXeXtXY [...]
+"R R >X>X;X<X;X;X;X;X;X<X<X<X>X<X>X<X<X<X>X<X<X>X<X<X<X>X;X>X<X>X<X<X<X;X<X<X<X<X<X>X<X<X>X2X<X<X<X<X>X<X<X<X2X>X>X>X2X3X2X;X;X;X<X<X<X>X<X<X<X<XuX<X;X2X2X;X<X<X<X<XuX<X>X2XuX<X<X<X2X;X2X2X<X2Xr. h t.z.z.r.r.t.z.z.t.z.r.z.r.r.r.r.z.r.r.z.z.t.z.z.t.z.t.z.z.* <XuX2X2XuXuXuX<X2XuX2X<XeXeX<X<X2X2X2XuXuXuXeXeXuXuX<X<X<XuX<X<XuXuX<XuXuXuXt. > uXuXuXuXuXuX2XuXuX'. f 2XuXuXuXeXaXuXeXeX&. +.eXeX= +.aXeXaXeXaXeXuXuXaX= $ [...]
+"R T ;X;X;X;X;X<X;X;X2X;X<X<X;X<X<X;X>X<X>X2X<X>X<X;X<X<X<X<X<X;X>X<X<X>X<X>X<X<X<X<X<X<X<X;X<X<X<X<X<X<X<X<X<X<X<X<X<X>X;X;X2X2X>X2XuX<X<X<X<X<X<X2X;X<X;X2X2X<X<X<X<XuX<X<X<X<XuX<X2X<X<X<X<X<Xr. O.uX2X<X<X<X<X<X<X<X<X<X<XuX<X2X<XuX<X<X<XuX>X<X<X<XuX<XuX2X, <X<X<X<X<X<X<XuX<X<XuX<X<X<XuX2XuXuXuX2X2X<XeXtXuX<XuXuXeXuX2XuX<X;XuX].:.k . > uX2XuX2XuX2XuXuXuX2X$ $ aXuXuXuXuXeXtXuXeXd '.aXtXG w uXaXeXtXaXtXuXuX(. G [...]
+"R R ;X2X;X;X;X<X;X<X;X<X>X;X;X>X<X<X;X<X<X<X<X<X>X<X>X<X<X<X<X<X<X<X<X<X<X>X<X<X<X<X<XuX<X<X<X<X<X>X<X<X;X;X2X<X<X2X;X<X<X<X<X<X>X2X<X2X<X<X<X2X<X2XuX>X<XeX<X<XeX<XeX<X<XeX<X<X<X<X<X<X2X;XuX<Xz. Q 2X<XuX<X<XtXuX<XuX<X<XuX<XuX<X<XuX2X<XeXeXeXeXeXeX;XuX<X2X> <XuXeXeXeXeXuX<X<XeXuXuX2XuX<XuXuX2X2XuXuX<X<XeXeXeXeX2XuX<Xv.w./ d $ w 2XuXuXuXuX2XuX2XuX2Xk '.uXuXuXuXeXaXuXtX X eXeXeXy. eXuXuXuXeXuXaXuX%. ' [...]
+"T T ;X<X;X>XuX<X<X<X<X<X<X<X<X<X>X<X<X;X;X;X<X<X<X<X<X<X>X<X<X>X<X<X<X>X<X;X<X;X>X<X;X<X<X<X<X<X<X<XuX;X2X;X2X;X<X;X2X<X2X1X<X<X<X<X<X<X<X2X;X<X<X<X<X<XqXeX<X<X<X<XeXeXeX<XuX;X<X2X2X<XuXuX<X<Xt. +.2XwX<X<X<X<XeXeXeXeX<X<X<X<X<XeXqXeXeXeXeXeXeX<XeXuX2X2X<Xw 2XuXeX<X<X<X2X2X2XuXeX<X<XuXeXeXeXeXeX<X<XuX=Xr.0.+.f , $ w 2XuXuXuXuXuXuXuXuXuXq. %.uXuXuXuXaXuXuXz. d eXaXaX=X t.uXuXuXuXuX2XuXw $ a [...]
+"R T <X<X>X;X<X<X<X<X<X>X;X<X<X<X<X;X<X>X>X<X<X<X>X<X<X>X<X<X>X<X;X2X>XuX>X;X<X>X;X<X<X;X<X<X<X>X2X<X<X<X;X2X;X2X2X;X2X2X;X2X;X2X<X<X;X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X2X<X2X2XuX<X<X2X<X<X<X<XuXr. +.<XuX<XuX<XuXeXuX<X<X2X<XuX<X2XeX<XuXeXuX<X<X<X<XeX<XuXuX2X, uX2XeX2XuX<XuX2X2X<XuX<X<XaX<XeXeX2X].%.d $ , uXuXuXuX2XuXuX2X2X2X2X. w uXuXeXaXtXeXeXY &.aXuXuXaX; +.uXuXuXaXuXuX:X G a [...]
+"R T ;X<X>X2X,X<X<X,X<X<X<X<X<X>X<X<X<X2X<X<X>X<X<X<X<X<X<X<X<X>X<X<X;X<X<X<X<X<X<X<X<X>X<XqX<X<XeX<X<X<X<X<X2X;X;X2X;X;X;X2X2X<X<X<X>X<X<X<X<X<X2X<X<XuX<X<X<X<X<X<X<X<X2X<X<X;X2X<X<XuX2X<X<XuXr. +.2X<XuX2X<X<X<XuX<XuXuXuX<X<X<X<X<X<X<XeX<X2X<XeX<X<X<XuXeX, uXuXtXuXuX2XuXeXuX<XuX<X<XuXuX<Xz.d , uX2X2X2X2XuXuX2X2X2XuXh :XaXaXuXuXeXeX* (.uXuXuXuXG w uXuXuXuXuXaX7. /.u [...]
+"T T ;X<X<X2X;X<X2X;X<X<X<X<X>X<X>X<X;X<X;X<X<X<X>X<X<X>X>X<X<X>X<X<X<X;X<X;X2X<X;X<X2X<X<X<X<XeX<XqXqX<X>X2X;X;X2X;X<X2X2X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<XuX<X<X<X,XuX<X<X2X<X<XuX<X2Xr. T <X<X<X<X<X<X<X<XeXuX<X<X<X<X<XeXeX<XeXeXuX2X2X2X2XeXeXeXeXw 2XaXuXuX<X<X<XeXuXuXuXeX<XuX=Xd X e , uX2X2XuXuXuXuXuXaX2XuXe. u.wXuXuX<XaX=X O uX2XuX2XuXu. =XuXeXuXaXuXd O eXa [...]
+"R T ;X<X<X<X<X<X<X;X<X<X<X<X<X<X<X;X2X<X;X<X<X>X<X<X<X<X<X<X<X<X>X<X<X2X<X>X<X;X2X;X;X<X<X<X<X<X<X<XuX<X;X2X;X2X;X<X2X<X<X;X2X<X<X<XuX<X<X<X<X<X<XuX<X<X<XuX<X2X<X2X<X<X2XuX;XuX<X2X<X<X<X<X<X<Xr. +.2X<X<XuXuXuX<X<XeX<XeXqXeXtX<XeXeXeX<XeXuX2XuX2XuXuXeX<X2X, eXuXuXtXeX<X<XuXuXuXuX<X<X'.. * G u.<Xz. , 2X2XuXaXuXeX2XaXuXaXuX=X S tXeXtXaXuX0. k uXuX2XuXaX=X u.uXtXaXuXuXX G eXt [...]
+"T T >X<X>X<X<X<X<X<X;X<X2X;X<X<X;X<X<X<X>X>X;X<X<X<X<X>X<X<X>X;X;X;X<X,X;X<X;X<X<X<X>X<X<X<X<X<X2X;X2X<X2X;X2X<X<X<X<X<X2X<X<X2X2X;X<X<X<X<X<XuXeX<X<XuX2X<X2X;X<X;X2X<X<X<X<X<X2X2X;X<XuX<XuX<Xt. T <X<X<X2X<X2X2X<XeXeX<XtXeXeXeX<XuX<XeXuXuX<X2XuX2X2X<XeX<X, eXeXeXeX<X2X2X2XuXuXeXeX'.X , k Q t.1XuXeXuXuXz. , uXuXuXuXuXuXuXuX2XaX2XaXd O aXuXaXuXuXk 0.uXuX2XuXuXuX= G uXaXuXuXu. '.aXe [...]
+"R T ;X<X<X<X<X<X>X<X<X;X;X<X;X<X2X<X<X<X<X<X<X<X<X<X<X<X<X;X;X;X<X2X2X;X<X2X<X<X;X<X<X<X<X<X<X<X<X,X<X<X<X,X2X<X<XuX<X<X<X<X<X<X<X<XuX2XeXuX<X<X<X<X<X<X<X2X;X2X2X<X<X<X<X2X<X<X2X;X<X2X<X<XeX<Xr. +.2XuXeXuX<X2X<XeX<XeX<XeXeXeXeXuX<X<X<X<XuX<XuXeX<XuX<XuXeX> eXeXeXuXuXuX2X2XuXeXuX:XX * h %.z.].uXuX2XuXuXeXuXuXuXuXt. > uXuXuXuXuXuXuX2X2X2X2XbX0. '.aXuXaXeXO =X2X2XuXuXuXaXY = 2XiXuXaXC X eXuXa [...]
+"T R 2X<X<X<X<X>X>X<X<X;X;X<X<X>X<X<X<X>X2X<X<X<X<X<X<X<X<X;X<X2X;X;X;X<X<X;X<X;X<X<X2X<X<XuX<X<X<X<X<X<X<X<X<X;X;X;X;X<X2X<X<X<X<X2X<X<X<X<X2X<X<XeX<X<X<X<X<X;X2X<X<X2X2X<X<X2X;X<X2X<X<X<X<X<Xr. O.2XuX2X<X2X2XuXuXuXeXuX<X<XuXuX<X<X2X;X2X2X<XeXeX<XeXuXuXuXw <XeXuXuXuXeX<XeXuXuX2Xd $ :.,X2XuX<XuXuX2XuXuXuXuXuXeXeXuX2Xz. , uX2XuX2XuXuX2X2XuXuXuX2X=X &.uX2XuX'. = aX2XuXaXuXaXeXu. =XuXuXeXX S aXtXu [...]
+"T T ;X>X<X<X<X<X<X<X<X<X<X<X<X<X<X<X2X;X;X<X>X<X<X>X<X<X<X<X<X;XuX<X<X;X2X,X<X<X<X<X<X>X<X<XuX>X2X<X;X2X;X;X<X2X2X<X<X2X<X<X<X<X<X>X<X2X;X<XuX<X<X<X<XuX<X<X,XuX;X;X2X;X<X2X;X<X<X<X<X<X2XuX<XeXr. Q <X2X<XuX<X2X<X<X2X<XuXeX2XuXuX2XuX<X2X<X<X<XuXuX<X<XuX2X<X, <XeXuX2X<X<XuX<XuX2X'. &.<XuX2X2X<X2X2XuXuX2XuX2X2XuXuX2X2XuX5. > uXuXuXuX2XaXaX2XuX2XuXuXuX* > uXuXuX&. G 2XaXeXuXuXuXuXuX u.uXaX'. e.uXaXe [...]
+"R R <X;X<X<X>X<X<X<X<X<X<X<X<X<X<X<XuX;X2X;X>X;X<X>X<X<X<X<X<X<X<X<X<X<X<X<X>X<X<X<X<X<X<X<X<X<X;X<X2X;X;X2X;X;X2X<X2X;X<X<X<X>X<X<X<X;X<X<X<X<X>X<X<X<XuX<X<XuX<XuX2X;X2X2X;X<X<X<X<X2X2X<X<X<Xt. T 2XuX<X2X<XuX<XuX2X<X<X2XuX2XuX<X2X<X2X<X2X2X<X<X<XuX2X<XuX, 2XuXuX<X2X2X2XuX2X2Xk +.<X2X2X2X2X2XuXuX2X2X2XuX2X2XuXuXuX2X2X+. > 2XuXuX2XuXuXuXuXuXuXuX2XuX&. eXuXuXd e.uXuXuXuXuXuXaXuX> G uXuXG . aXuXeXa [...]
+"T T <X<X<X<X;X<X;X<X<X<X<X<X<XeX<X<X<X<X;XuX<X<X<X<X<X<X<X<X<X<X<X<X>X>X<X<X<X<XeX<X<XuX<X2X<X<X<X<X<X2X2X;X2X<X<X<X;X,X<XuX<X2X<X<X<X2X<X<XeX<XuX<X<X<X<X<X<X<X<X<X2X<X<X2X<X<XeX<XeXuX<X<X<XuXz. +.;X;X2X<X<XuXuX<XuXeXuX<X2XuX<XuX<X<X<X2XuX<XuXeX<X<XuX<XuX, 2X2X<X2XuX2X<XuXeXuX. $ <X2XuXuXuX2X2XeX2XuXuXuXuXuXuXuXuXuXuXuXk w uXaXuXuXuXaXuXuXuXuXaXuXuX(. u.aXuX. uXaXuXuXeXaXuXuXuX+. * aXuX= k uXuXtXa [...]
+"T T >X<X>X<X<X2X<X<X<X<X>X<X<X<X<X<X<XuXeX<X<XqX<X<X<X<X<X<XeX<X<X<X<X<X<X<X<X<XeX<X<X<X<XuX<X<X<X<X,X<XeXuX<X<X<X,X2X2X<X<X<X2X<X<X2X<X<X<X<X<X<X2XeXeX,X2X<X<X<XeX<X<X<XuX<X<X<X<X<X<X<X<X2XeXz. Q 3XuX<X2X<X<X<XeXuX<X2XuXuX<XuXuXeXeXuX2X<X<X<XuX<XuX<X<XeX, uXuXuX<XuXuXeXtXuX]. +.uX2X2X2XuXuX2X2XuX2XuXuXuXuXuXuX2XuXuXuXO e uXuXaX2XuXuXuXaXuXuXuXuXuXuX* J eX'. > aX2XuXaXuXaXuXuXuXt. =X`. u.iXeXpXp [...]
+"T T <X<X<X<X<X;X<X<X<X<X<X<X<X>X>X<X<X>X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<X<XeX<X<X<X<X<X<X<X<X<X<X<XuX<X<X<X<X<X<X;X<X;X2X;X<X<X<X<X<XuX<X<X<X<X<X<X<X<X2XuX<X<XuXuX<X<X<X<X;X<X<XeX<X<X2X<X<X<X<X<Xt. O.uXuX<X2X<X<X2X<X<X<XuXuX<XuX<X<X<XuXuXuX2X<XuX2XuX<X2XuXuX, 2XuXuXuXuXaXeXuXuXz. z.uXuXuXeXuX2XuXuX2XuXuX2XuXuXuXuXuXeXuX/. w uXuX2XuX2XuXuXuXuX2XuXuXuXaX+. O aX+. +.uXuXuXeXuXuXaXuXaXuX e.&. X eXaXaXuXt [...]
+"T T <X<X<X<X>X<X<X<X<X;X<X<X<X<X<X2X<X<X2X;X;X>X>X2X<X<X>X2X<X<X<X<X<X<XuX2X<X,X<X<X<X<X<X<X<X<X<X<X<X<X<XeXuX<X2X;X<X;XuXuX<X<X<X2X2X2X<X<X<X<X2X<XeX<XuX2X<XwX<X<X2X2X<X;XuX<X<X2X<X2X2X<X<X<Xz. +.<X2X<X<X2X2X<XuX<X<XuXuX2XuX<XeXeXuXuX2X2X<X2X<XuXuX2XuX2X, uXuX2X2X2X2XuX<XuXt. t.uX<XuX2XuXuXuXuXeXaXuX2XuXuX2XuXuXuXeXk e uXuXuXuXuXuX2XuXuXuXuX2XuXaX/. ].e /.uXuXuXaXuX2XuXaXuXeXe H > C eXtXaXaXa [...]
+"T R ;X<X<X<X<X2X<XuX<X2X<X<X<X2X<X<X<X2X;X>X<X2X<X<X<X>X<X<X<X<X<X2X<X;X;X;X<X<X<X<X<XuX<XuX<X<XuX<X<X<X<X<XeX<XuX<X2XuX;X<XuX<XuX2X;X,X<X2X<X<X<X<XeX<X<X<X2X<X<XuX;X2X2X<XuX<XuX<X<XuX<X2XuXuXz. Q 2XuXuX,X2X<XuXeXeXeXeX2X;X2X2XuXeXeX2XuX<X<XuX<XtXeX2X2X<X, uX2XuXuX<XuXuXuXuXz. 7.2X2XuX2XuXuXuXuXuXuXuXuX2X2XuX2X2XuXz. > aXuX2XuXuXuXuXuXuXuXuXuXuXeXuXO 0. X aXuXeXtXeXuXuXaXaXtXaX+. : w.aXpXpXpXt [...]
+"R R ;X2X<X<X<X<X<X<X<X<X<X<X<X<X>X;X<X2X2X;X<X<X<X<X<X<X<X<X<X<X>X;X;X2X;X2X<X<X<XuX<X<X2X<X<X<X<X<X<X<X<XeX<X<X<X<X<X<X2X;X;X2X<X;X2X;XuX<XuX2XeX<XuX<X2X2X<X<XuX<X<X;X2X<X<X<X<X2X<X2X<XuX<X<Xr. O.2X2X<XuXeX<XeXeXeXeXeX<XuX2X2X<X<XeXuX2X2X2X2X<XuXuX2X<X2X> aXuXuXuXuXuX<X<XuX=X k 2XuXeXuX2XuXuXuXuXuX2XuXuXuXuXuXuX=X. . aXuXuXuX2XuXuXuXuXuXaXuXuXeXuXY X d uXaXeXaXaXeXaXeXeXeXaXz. pXtXaXpXpXa [...]
+"T T <X;X<X;X,X<X<X<X<X<X,X<X<X<X<X<X<X>X<X<X<X<X<X<X<XeX<X<X<X<X,X2X;X2X2X2X;X<X<X2X;X<X;X<X<X<X<X<X<X<X<X<X<X<X<X>X<X2X<X<X;X2X;X2X;X2X;XuX<X<X<X<X;X2X;X<XuX2XuX<XuX<X<X<X<XuXuX<X<XuX<X2X2X<Xr. +.2XuX<XuX<X<X<X<X<XuX<X<XuXeX<XeXuXuX<X2X2X2X<X<X<XuX2X2X2Xw 2XeX<XaXeX<XuXuXuXuX$ '.uXuXuXuXaX2XuXuXuXuX2XuX2X2XuX/.* 2XuXuX2XuXuXuXuXuXuXuXuXaXuXuX'. &.aXeXaXeXeXaXeXaXuXtXaXaX d aXaXaXeXpXp [...]
+"R R 2X2X;X2X;X<X<X<XuX;X,X<X<X<X<X<X<XeX<X<X<X,X<X2X<X;X2X<X<X<X2X<X<X<X2X<X;X;X<X,X;X2X;X<X;X;X<XuX<X<XeX<XeX<X<XeXeX<X<X<X<X;X2X;X;X;X2X<X<X<X2X;X<X;X2X<X<X<X<X<XuX<X<XuX<X<X<X2X<X<XuX2XuX2Xt. Q 2X2X2X,X2X<X<XuX2X<X<X<XeXuX<X2X;X2X2X<X2XuX<X2X<X2X<X2X2X, <XeXeXeXuXuXeXtXeXtXG O (.2X<XuX2XuXuXuXuXuXuXuXuXeX&.X uXuXuXuXeXuXuXeXeXaXuXeXeXuXaXeXX ].eXaXuXtXuXaXeXuXaXaXuXuX> 7.tXaXaXuXaXa [...]
+"R T ;X;X2X;XuX2X<X2X;X<X2X<XuX<XuX<X<X<X<X<X<X<X<X<X2X<X>X>X<X<X;X2X<X<X<X<X<X<X<X2X2X;X<X2X<XuX<X<XeX<X<X<X<X<XqXeXeX<X<XuX2XuX<X<X<X2X<X<X<XuX<X2X<X2X<X<X<X<X<X<X2XuXeX<X<XuXuX<X2XuXeX<X<XuXt. +.2X2X2X2X2XuX2X<XuX2XuXuX<XuX<X<X<XuXuXuX2XuX2XuXeX2X2X2X2X, 2XuXuXuXaXeXeX<XuXuX(. . 0.uXuXuXuXuXuXuXuXaXuX:.$ =XuXuXtXuXuXtXeXeXeXaXaXaXuXuXeXk $ tXtXeXaXaXeXtXaXaXaXtXtXaX^ :XaXaXuXaXtXp [...]
+"T T <X<X<X;X<X;X,X2X;X<X<X<X<X<X<X<X<X2XuX2X<X2X<X<XuX<X<X<X2X<X;X2XuX<X<X<X<X<X<X<X<X,X<X<X<X2X<X<XeXeX<X<X<XeX<XeXeXeX<X<X<X2XuX<XuX<X2X<XeXeX<XuX<X;X<X<X<X2X2X2X<X<X<X<XeX<X<X<X<X<X<X<X<X<Xr. Q uX2X2X2XuX<X2X2X<X2X2X<X2X<X2XuX2X2X<X2XuX<XuX2X<XuX2X2X2Xe uXuXuXuXeXeXtXeX2XuXuXG $ G &.i.r.t.u.+.d X h g i.uXuXuXaXeXeXaXeXaXeXuXuXeXaXaXw. k tXeXaXaXeXaXaXtXtXeXaXuXuX'. d tXtXtXtXtXtXa [...]
+"R T ;X<XuX;X<X<X2X;X2X;X<X<X<X<X<X,X<X<X<X<X<X<X<X<X>X<X<X<X;X2X<X<X<X<XeX<X<X<X<X<X<X2X<XuX<X<XeX<X<X<X<XeX<X<X<XeXeXuX<X<XuX<XeX<X<X<X<X<X<X<X<X<X<X;X2XuXuX<X;X;XuX<X<XuX<X<XuX<XuXeX<XuXeX<Xr. +.3X2X2X2X2XuX<X<XuX2X2X2XuXuXuXuXuX2XuX<X2X2X2X2XuXuX2X2XuX, 2XuX<XeXuXeXeX<XuXuXuX=X= &.aX+. &.uX2XuXeXeXaXuXtXeXeXeXuXuXaXuXtXX e.uXtXaXaXeXaXeXuXaXaXaXuXuXtX. 0.pXtXaXtXaXtXa [...]
+"H T <X<X<X>X;X;X;X2X2X;X<X<X<X<X<X<X>X<X<X<X2X<X<X2X<X<X<X<X<X>X<X<X2X;X,X2X<X<XeX<XuX<X<X<XuX<X<XuX<XuX<X<X<XuX<XeX<X<XuX2X<X<X<XeX<XeX<X<X<X<X<X<X<XuXuX<X<XeX2X<X<XeX<X<X<X<X;XuXeXeXeXuX<X<Xr. +.<X<X2X2X<X<XtX2X2X2X2X2X2XeXeX2XuXuX2X2X2X<X2XuX<XuXeXtX<Xw <XuXuXuXeXuXeXeXtXeXeXuX=X= $ '.uXuX'. ; aXeXtXaXuXaXeXaXuXuXaXaXeXuXeXuXD :XtXaXaXeXaXuXuXaXuXeXaXeXaXaXd ,XaXaXaXaXtXpXp [...]
+"R T <X<X;X<X2X2X;X<X>X<X<X<XuX<X2X<X2X<X<X<X<X<X,X<X<X;X;X2X<X<X<X<X<X;X2X2X<XuX<X<X<X<XeX<X<X<X<X<X<X<X<XuXeX<X<X<X<XuX<X<XuX<X<X<X<X<X<X2XuX<XuX<X<X<X<X<XeX<X2XuX<X<XeXeXuX<X2X<X<XeXeX<X2X<Xz. Q 2X<X2X<XeXeXuXuX2X2X2X2XuXuX<X2X<X<X2XuX2XuXuXuXuXuXaXaX<X> 2XuXuXuXuXuXaXeXuXeXaXeXeX:X, X +.uXuXuXaXuX$ ].uXeXeXuXuXuXeXaXaXeXaXuXaXtXeX7. * aXeXeXuXuXuXuXuXaXuXuXaXaXaXaX&. d tXaXpXpXpXpXpXp [...]
+"T Q <X<X<XuX<X<X2X<X<X<X<X2X<X<X<X<X;X2X<X<X<XuX<X;X,X2X<X<X<X<X<X2X<X2X;X2X;X2X<X2XuX<X<X<XeX<X<X<X<X<X<X<XuXeX<XeX<X<XuX<X<XuX<XeX<X<X<X<X<XuX<X<X<XeXuX<X<X<X<X<XuXeX<XeX<X<X<XuX<X<XeXuX<XuXr. +.2XuX2X<X<XeXeX<XuX3X2XuX2X2X2XuX2X2X<XuXuXuX2XuX<XeXeXeX<X> uX2XuX2XuXuXuXuXaXeXeXeXuXuXuX0.$ X +.=XuXuXuXuX2XuX:. k eXtXaXeXaXuXeXuXaXuXeXtXaXtXeX:X G tXuXuXaXuXuXaXeXaXeXaXaXuXtXeX'. 7.tXtXpXpXaXpXpXa [...]
+"R H <X<X<X<X2X<X2X<X2X2X<X<X>XuX<X2X<X;XuX<XeX<X<X,X<X<X<X<X2X<X<X<X2X;X;X2X;X2X<X<X<X<X<X<XuX<XuX<X<X<X<X<X<X<X<X<X<X<X<X<X<X<XeXeXeX<X<XuX<X2X<X<XuX2X<X<X<X<X<X<X<XeX<XeX<XuX2X<X<XuXuX<X<X<X Xz.z.t.z.z.i.r.(.2XeXeXeXuX<XuXuX<XuX2X2X2X2XuX2XuXuXeXuXeX<X<XeXuXuXuXtX2X/.t.z.t.z.t.t.z.uX2XuXuXuXuXuXuXeXuXuXuX2XeX2XuXuXw.Y ; > G u.uXuXuXuXuXuXuXuXaXuXz.t.z.t./.t.t.aXeXtXaXaXuXaXeXuXeXaXuXuXuXaXtX'.t.z.U.t.t.U.=XuXtXaXeXuXaXaXeXeXaXtXuXpXaXuXaXU.z.U.t.z.^./.=XpXaXaXaXaXaXpXa [...]
+"T H ;X,X<X<X<X<XuX<X<X<X<X<X<XuX2X<X<X2X<X2X<X<X<X<X,X<X<X<X<X2X<XuX<X<X;X,X<X<X;X<X<X<X<X<X<XuX>X<XuX;X<X<XuX<XuX2X<X<X2X<X<XeXeX<XqX<X<X<X;X2X<X<XuX<X2X,X2X2X<X<X<X<X<X<X<X2X2XuXuX<XuX<X2X<X;X2XeXuX<X<X2X<X<XuX<XuX<X2X2XuX2X2XuX2X2XuXuX2XuXaXuX<XuX2XuXuXuX2XuX2X2X2XuXuXuXuXuX2X2XuX2XuXeXeXuXuXuX2XuXuX2X2XuXuXuXaXeXtXuX2XuX].t.t.t.z.].uXeXuXuXaXuXuXaX2XuXuXuXuXuX2XaXuXuXuXaXaXeXaXuXuXuXaXeXuXaXeXtXaXuXaXeXaXtXeXuXaXeXaXaXeXaXaXaXaXaXtXaXeXeXaXtXaXtXeXeXaXtXtXtXaXeXtXpXpXpXpXtXpXpXaXpXp [...]
+"T T 2X<X2X<X2X<X<X<X<X<XuX<X;XuXuX<X<X<X<X,X<X<X<X2X2X<X<X2X<X<X;X<X<X<X2X2X<X2X2X2X;X<X<X2X<X<X<X<X2X<X2X<X2X<X<X<XuX<XuX<X<X<XeX<XeXuX<X<XuX<X<XuX<X;X<X<X<XuX<XuXuX2X<X<X<X2X<X<X<X<X<XeX<XtX<X<X<X<XuX<XuXuX<XuX<X<X;XuXuXeX<X2X2X2X<X2XuXuXuXuXuX2XuX<X<XuX2XuX2XuXuXuXuX2X2X2XuX3X2XuXuXuXaXuXuXeXuXuX2XuXuXuXuXuXuXeXeXaXuX2XuXuXuXeXeXaXeXuXeXaXuXuXuXuXuXuXuX2XuXuXuXuXuXaXuXuXeXaXaXeXeXaXuXaXaXeXeXaXeXaXeXaXuXeXuXaXeXaXaXtXeXaXaXeXuXaXaXaXaXaXaXaXuXuXaXaXaXaXuXaXaXaXpXjXpXpXpXpXpXpXpXpXpXt [...]
+"T T <X;X<X;X<X<X<X<X<X<X<X<X>X<X<X<X<X<X2X,X<X<X2X<X<XuXuXuX<X<X<XuX2X<XuX2XuX<X2X;X<X2X<XuX2X;X<X2X<X<XuX<X2X;X<X<X<X<XuXeXeX<X<XuXuXeXeX<XeXuX<X2X2X2X;X2X2XuXeXuX2X<XuX2X2X;X<X<X2X<XeXeX<XeX<XuX2X2XuX<X;X2X2X<X<X<XuX2X2X<XuXuX2X2XuX2X2XuXeXuXuXeXuXuXuXuXuX<XuX2XuX2XuXuXuXuX2XuX2X2XuXuXuXuXuXuX2X2XuX2XuXuXuX2XuXtXeXuXuXuXuXuXuXaXtXaXaXeXaXeXuXuXuXuX2XuXuXuXuX2XuX2XeXaXuXaXaXeXaXeXtXeXaXuXeXaXaXaXuXaXeXeXaXuXuXeXuXtXuXeXaXuXeXuXuXtXtXpXtXaXaXaXaXaXaXaXaXtXaXaXtXaXpXkXkXjXpXaXpXpXpXpXaXa [...]
+"T T ;X<X2X<X<X2X<XuX<X,X<X<X<X<X<X<X<XuX2X<X2X<XuX;X,X<X<X<X<X>X<X<X<XuX<X<X2X,XuXuX<X<X<X<XuX;X<X<XuX<X<X<X<XuX2X<X<XeX<X<XeX<X2X2X<X<X<X<X<XeX2XuX2X;X2X<X<X<X<X2X2XuX,X<XuXuXeXeXuXuXuXeX<X<XeXuX2X<X2X<X2X2X2X2XuXuX<XuX<XeXeXeXuX2X2XuXuX<XeXuXuXeXuX2X2X<XuX2XuXuXuXeXuXeX2XuXuXuXuXuXuXuXuXuXuX2XuXuXuXuXaXuXuX2XeXaXuXeXuXuXuXuXuXeXuXuXeXeXeXaXaXuXuXuX2XuXuXuXuXuXaXuXeXaXuXeXuXeXtXeXuXaXeXtXaXuXeXeXeXaXaXaXtXtXaXaXtXaXpXaXtXaXtXaXtXaXpXaXaXtXtXeXpXeXtXaXpXtXpXtXeXtXpXpXtXtXaXpXaXpXpXpXtXa [...]
+"T T 2X;X<X<X2X<X<XuX2X2XuX;X<X<X2X<X,X<X<X<X,X;X,X2X<X<X<XeX>X<X<X<X<X<X2X<X<X2X<X<X<X<X2X<X<XuXuX<X<XeX<X<XuX<X<X<XeX<XeX<XeX<X2X2X<X<X<X<X<X<X<X2X<X2X2X;X<X2X2X<X<XuX<XeXeXeXeX<X<XeXeXuX<XuX2X2XuX<X<XuX2XuX<XuX2XeX<XuXeX<XuXuXuX2X<XuXuX2X2XuXuX<XuX<X2XuXuXuXuXuX2X2X2X<XuXuXuXuXuXuXuX2XuXuXuX2XuXuXuXuX2X2XuXaXeXuXuXaXuXaXuXuXuXuXuXuXeXaXeXaXuXuXuXuXuXuXuXaXeXaXaXuXaXeXeXaXeXaXeXaXuXeXaXeXeXeXaXuXaXeXaXeXaXtXtXaXeXaXtXtXuXtXuXaXeXaXaXuXaXeXuXaXaXaXaXaXpXpXtXtXaXpXpXpXtXpXaXaXpXpXtXpXaXa [...]
+"T T <X<X;X<X<X<X;X2X,X;X<X2X<X2X<X<X2X2X<X<X<XuX2X,XuX<XqX<X2XuX<X2X<XuXuX<X2X2X2X2X2X<X<X<XuX<X<X<X<X<X<X<X<XuX<X<X<X<X<X<X<XuX<X<X<X<X<X2XuX<XuX<X<X2X2X2X2X<XuX2X2X<X<XuXeXeXuX<X<XeX<XeXeX<X<XuX,X<XuX2X<X>XuX2XuX<XuXuXuXuX2X2XuXuXeXeX<XuX2XuX2X2X<X2X2XuXuXuXuXuXuX2X<XuX2XuXtXeXuXuXuXuX2XuXuXuXuXaXuXuXuXuXeXaXtXaXeXuXuXuXuXuX2XaXuXuXaXuXeXaXuXeXuXuXuXaXaXuXaXuXeXuXaXeXtXaXeXeXaXeXaXaXuXaXaXeXaXuXuXaXtXaXeXaXeXpXaXtXaXaXaXtXpXpXaXaXtXeXeXaXaXtXtXpXtXtXpXpXjXpXtXpXjXpXtXpXpXpXpXpXaXaXeXt [...]
+"T T <XuX2X,X2X;X2X;X<X<X;XuX2X,X<X<X<X<X;X,X;X2X2X<X<X<X<XeX2X<X2X,XuX2X<X2XuX<X;X2X<X<X2X2X2XuX<X<XeX<XeXuX<X<X<XeX<XuXuX;XuX<XuX<XuX<XeXuX2XuXuX2XuXuX,XuX2XuXuX<XuX<XuX<X2XuX<X<XtXeXuX<X<X<XuX2X2X2XuX<XeXuXeXuXeX<X<XuX2XuX2XuX2XuXeXeXeXeXeXuXuX2XuXuX2XuXuX2XuX2XuXuXuXuXuXeXuXeXuXuXuXuX2XuXuXuXuXuXuX2XuXuXuXaXtXtXeXuXuXuXuXuXaXuXuXaXeXaXaXuXuXuXaXuXuXuXuXuXuXuXuXuXeXeXuXeXuXaXeXaXtXuXeXtXtXeXtXaXeXeXtXaXaXeXaXeXeXaXtXtXeXaXpXpXpXtXaXpXaXaXaXpXpXtXtXpXpXpXtXpXtXaXtXpXtXpXpXaXpXaXaXuXpXt [...]
+"Q T <X<X2X2X3X,X2X<X<X<X>X<X2XeX<X2X<X2XuX<X2X;X<X<XuX<X;XuX<X<XuXuXeXwXeX<XuX<X2X<X2X2X2X,X<X;X<X<XuX<XeXeXuX<X<X<X2X2X;X2XuX<X<X<X<X<XuX<X;XuX<X2X<X<X2X<XuX<X<X<X<XuXuX;X2X;XuX2XuXuX2XuXeX<X<X<XuX2X2X<X2X2X<X2XuX<X<X2X2X2XuX2X2XuXeXaXeXeXeX<X<XuX<X2X2X2X2XuXuXuX2X2X2X<XuXuX2XuXuXuX2XuX2XuXuXuX2XuXuXuXuXuXuXuXuXaXaXeXuXuXuXuXuXuXuXuXaXeXuXuXuXuXuXuXuXuXaXuXuXuXeXuXuXaXaXeXaXeXaXeXeXaXaXaXuXaXaXeXtXaXuXeXaXaXeXaXaXeXaXtXaXtXaXaXtXaXeXaXuXeXaXeXaXeXaXaXaXaXpXpXaXaXkXtXtXpXaXaXpXaXtXaXaXa [...]
+"Q R 2X2X<X2X2X2X;X,X<X2X<X<X,X<X,X,X2X;X<X<X<X<X,X<X2X,X<X<X<XuX2X<X<X<XeX<X<X<X<X<X2XuX2X,XwX2X<XuXuX<X<XuXuX<X<XeX;X<X;X<XuXuX<XuX2X<XuX<XeXuXuXeX<X<X<X2X2X<XuX<X<X2XuX<X<X2X2X2X<XuX2X<X<X2X<XuX<XuXuX2XuX<XuX;XuXuXuX2XuXuXuX2X2X2XuXuX2XuX<X<XuX2X2XuXuXuX2XuXuX2XuX<XuXuX2XuXuX2XuX2XuXeXeXeXuXuXuXuXaXaXuXuX2XuXuXeXuXuXuXuXaXuXaXeXaXuXuXuX2XuXuXuXaXuXeXuXuXaXeXtXeXpXaXeXuXeXuXuXaXuXaXeXaXaXeXaXeXaXtXuXeXuXuXuXuXuXtXaXtXaXaXuXtXtXaXuXaXuXeXaXeXaXaXeXeXaXaXuXaXaXaXtXaXaXpXaXaXtXaXaXpXpXaXt [...]
+"R R ;X2X;XuX2X,X2X<X<X<X<X<X;X<X<XuX<XuX2X<X2X<X2X2X<X2X<X<X<XeX,X<X2X2XuX2XuX<X2X<X2X2X2X<X<X2X<X<X<X2X<X2X2XeX2XuX2X2X2X<X2X2X2XuX2X<XuX<X<X<X<X<X<X<X<X<XuX2X2X2X2X2X<X<X2XuX2XuXuX<XuXeXuXuXuX<X<XuXuX<XuX2XuX2X2X2X2XuXuXeXuXuXuXuX2XuXuX2X<XuX2XuXuXuX2XuXuX<X2X2XuXuXuXuXuXuXuX2XuXuXuXuXuXuXeXaXuXuXuXuXuXuXaXuXuXaXuXuXuXuXeXuXeXaXeXeXuXuXuXuXuXuXuXuXaXeXaXeXaXuXaXtXtXaXuXeXaXeXaXuXeXaXaXeXaXaXtXuXeXaXeXaXaXuXaXaXaXeXaXtXtXtXaXaXtXtXtXaXaXuXaXaXaXpXaXtXtXpXtXaXaXaXeXaXtXaXaXtXaXkXpXpXpXa [...]
+"R T 3X,X;X2X;X,X<X<X<X<X<XuXuX<X<XwX<X<X<X<X<XuX2X<X<X<XuX2X<X<X2X<X2X<X<X2X<X2XuX<X<X2X<X<X<X2X2XuX<X,X2X<X<XuX<X;X2X2XuXeX<XuXeX<XeX<X<XeXeX<XuX2X<X2XuX<XuXuX<XuXuXuX2XeX<XuXuX,X<XuX<X<X2X<X<X<X<XuXuXuXuXuX2XuX2XuXuXuX<XuXeXeXuXuXuX2XuX<X<X2X2XuXuXuXuXeX2X2XuXuX<XeXeXuXuXuXuXuXuX2XuXeX2XuXuXuXuXuXuXuXuXuXuXuXuXuXeXuXuXuXeXaXaXeXaXtXaXeXuXuXuXuXuXaXuXaXuXuXuXaXeXaXtXuXuXaXaXuXaXtXaXeXaXeXtXuXuXtXeXtXaXeXtXuXaXeXtXaXeXaXaXaXaXtXpXtXtXpXaXtXaXuXaXtXaXaXpXtXaXaXaXaXaXkXpXpXtXaXtXtXpXaXaXa [...]
+"R R <X;X<X2X<XuX<X<X<X2X2X;X2X<X<X<X2X<X<X<X<X,X<X<XuX<X<X<X2X<X2X<X<X<XuX<XuX<X<X<X2X<X<X<X,X2X2X<X2X<X<XuX<X2XuX<XuX<X<XqX<X<XeX<X<XeX<XeXeXuX<X<X<XuXuX<XeX<X<XeX2X<X<X2XuX2X<X2X<XuX<XuXuX2XuXuX<XuX2XuX2X<XuX2X2XuXuXuXeX2XeXuXuX2XuXuX2X2XuX2X2XuXuXtXuXeX2XuXuXuXuXeXuXuXuXuXuX2XuXuXuXuXuX2XuX2XuXuXuXuXuXuXuXeXeXaXaXeXuXaXtXaXaXtXpXpXaXaXaXaXaXuXuXaXaXuXuXtXaXeXaXeXaXeXuXaXuXtXeXtXeXaXaXtXeXaXuXaXaXaXaXuXaXeXaXaXeXuXaXeXeXaXuXaXaXuXtXaXtXaXeXtXaXaXaXtXpXaXuXtXtXeXaXpXaXpXaXtXaXtXpXtXaXe [...]
+"T T <X<X;XuX;X2X<XuX<X;X2X;X2X<X2X2X;X2X2X<X2X2XuX<X<X<X2X<X<XuX2XuXuX<X2XuX<X<X<X<X<X<X<X2XuX2X<X<X2XuX2X<X2X<X2X2X<X2X<X;X2X<X2X<X2XuX<XuX<X<XeX<X<XuXuXeXuXeX<X2X<XuXeXuXeX<X<XuX<X2X2X2X2X2XuXuX<XuX2X2X2XuX<XeXuXuX2XuXuXuXuXuXuXuXuXuXuXuXuX<X2XuXeXtXeXaXeXuXuXuX2XuX2X2X2XuXuXuXuXuXuXuXuXuXuXuXuXaXeXeXuXeXuXaXuXaXaXaXaXaXpXpXtXjXjXpXkXaXtXaXaXaXpXaXpXuXaXaXaXeXuXtXtXaXuXaXaXaXtXaXtXuXeXaXeXtXaXeXuXuXeXuXuXaXaXeXaXeXuXaXuXaXtXuXuXaXeXaXtXaXaXaXtXaXpXpXpXtXuXaXpXaXpXpXkXpXpXpXtXaXpXpXaXt [...]
+"T T 2X<X<X2X2X<X<X<X<X<XuX<X<X;X2X;X2XuX<X<X2X<X2X<X<X<X<X<XuX<X<X<X<XuX<X<X<X<X<X2XeXuXuXuX<XuX<XuX;X>XuX2X<X2X2X<XuXuX2X2X2X<X2X;X<X<X<X<XuXuXeXeX<XuX<XeX<XeXeXuXeXuXuX2XuXeXuX<XuX2XeXuX,XuXuX2XuXuX2XuX2XuX2XuXuXuX2XuX2X2X2XuXuXuXuXuXuXuXeXeXuXuXeXuXuXuXuXeX2XuXuXuX2XuXeXuXuXuXuXuXaXuXeXuX2X2XuXuXuXaXuXaXuXuXuXeXeXtXpXtXpXpXjXkXkXzXzXjXjXpXaXaXpXpXpXpXpXpXtXaXuXuXuXuXaXeXeXaXuXuXuXtXaXtXaXuXuXuXuXaXaXuXuXeXuXaXaXuXtXaXtXaXaXaXtXaXaXtXaXeXeXtXtXaXtXeXtXaXaXuXtXpXpXpXpXpXpXpXpXpXpXpXaXa [...]
+"T W <X,X2X,X;X,XuXuX<X<X<X<X<X2X<X,X<X<X<X<XuX<X2X<X<X2X<X<X<X<X<X<XeXeX<X<XeX<X2X<XuX2X<X<X<X<X<X2XuX2X<XuX2X2X2X<XeXeXuXuX<X<X<XuXeXeX<X<X<XuXeXeXuX<X2X<XeX<XuX<X<XuX2XuXeXeX<XuXuXuXuX2XeXuXuXuXuX<X<X<XeX2XuXeXeXeXeXuXuXuXuXuXuXeX<XeXtXeXuXuXuXuXuXuXuXuXuXuXuXuX2XuXuXuXuXuXuXeXtXeXuXeXaXaXuXuXuXaXaXeXeXaXeXeXaXeXtXtXjXjXzXkXjXcXcXcXzXkXpXkXpXjXkXpXpXkXjXjXpXtXeXtXtXaXaXtXuXaXuXtXuXeXaXaXaXaXeXtXaXeXaXeXaXaXeXuXaXaXuXaXaXaXtXtXtXpXaXpXtXeXaXaXeXaXtXtXtXaXaXeXpXtXpXpXaXtXaXpXpXpXaXpXaXu [...]
+"T T uX2X2X2X2X<X<X<X<X<X<XuX,X2X2X<X<X2X<X<X<X<X<X<XuX<X<XuX2X<X2XwX<XeX<X<XuXeXeXuX;X<X<XuX<XuX;X2X2X<X2X<XuXeXeX<XeXeX<XeXeX<XuXuXeXeXeX<X<X2XuX<XuX<XuXeXeX<X2XuX<X2X2X2X2XuXuXuXuXeXuX<XeXeX2X<X<X<X<XuXuXuX<XuXuXeXeXeXuXuXuXeXeXeXtXeXuXuXuXuXuXuXuX2XuXuX2X2XuX2XuX2XuXuXuXuXuXeXuXeXeXaXuXuXuXuXuXuXuXaXuXuXeXaXuXuXpXtXjXjXkXkXkXzXcXcXjXkXkXcXzXkXjXkXpXpXtXkXpXpXaXaXtXtXeXaXtXuXaXuXaXaXaXeXeXaXeXaXaXeXeXaXaXeXtXaXuXtXuXpXaXeXpXpXpXtXpXpXtXaXeXaXaXaXaXaXtXpXtXtXpXpXpXtXtXaXtXaXkXpXaXaXaXa [...]
+"T R 2X2X,X2X1X2X;X2X;X2X,X<X<XuX<X2X<X2X<X2X2X<X;XuX<X<X;XuX2XuX2X<X<X<X<X;X2X2X2X<XwX<X<X<X<X2X2X;X2X2X<X<XuXuX<XuXuXeX<XuX<XuXwX2XwXuX2X2X<XuX<XuX<X<XuX<X2X<XeXuX2X<X<XuXuXuXuX2XuX<X2X<XeXeXeXeX<X<XuX<X<X2XuXeXuXeXaXeXaXeXuXuXeXeXeXuXuXuX2XuXuXuXuXuXuXuXuXuXuXuXuXuXuXuXuXuXaXaXeXeXuXuXuXuXuXuXaXeXeXeXeXaXeXaXeXtXpXkXjXjXkXkXzXzXzXzXzXzXzXcXkXrXkXjXjXjXjXjXjXjXaXtXpXpXtXaXtXuXaXtXuXeXaXtXeXaXaXuXeXaXtXaXeXaXaXuXaXeXtXaXaXeXaXtXaXpXpXaXpXtXpXpXeXaXtXpXtXtXtXpXpXpXpXtXaXtXpXpXaXpXpXpXaXe [...]
+"Y R 2X,X3X;X2X2X2X,X2X;X<X2X<XeX<X<X<X,X<X<X<X<X<X<X2XuX<X,X<X<XuX<XuX<X2X2X2X<XuX<X<XuXeX<X<XuX2X2X<X2XuX2X<X<X<X<X2XeX<XuXeX2X2X2X2X<X<X,X<X,X<X<X<XuX<XuX;XuX<X2XuXuX<XeX<XuX<XuX2XuXeX<X<X<XeXeX<XuX<XuXuX2XuXuXeXtX<XeXeXeXuXeXeX2XuX2XuXuXuX2XuXuXuX2XuX2XuXuXuXuXuXuXuXuXuXeXeXuXuXuXuXuX2XeXaXuXeXaXuXaXeXeXeXaXaXaXpXpXkXkXzXjXzXcXcXzXjXzXcXjXkXjXjXjXpXjXkXjXpXjXjXjXpXtXtXpXeXaXeXaXaXaXuXuXaXuXtXeXaXuXuXeXaXeXaXaXeXaXuXeXaXaXuXuXtXeXaXtXjXpXpXpXuXtXtXaXtXaXtXpXpXkXpXpXtXaXpXpXpXpXpXpXaXt [...]
+"T T 2X;X2X3X2X2X2X<X2XuX2X2X<X<X>X<X<X<X<X2X2X2XwX<X<X<X<X<X<XeX<X<XuX<X;X2X,X2X<XuX<XuX<XuXuX<X<X2X2X;XuX2X<X<XuXuX2X2X2XuX2X2X2XuX<X<X<X2X<X2X<X<X<XuX2X2X2XuXuXwXuXeXeX<X<XuXuX2XuXuXuX2X2X2XuXuXuX<XuX2X2XuX2XuXeXeXeXtXuXuXuXuX2XuXuX2XuXuX2XuXuXuXuXuXuXuXaXuXuXuXtXeXuXuXuXuXeXaXuXuXuXuXuXeXeXeXuXuXeXaXaXtXtXpXtXpXkXkXjXjXzXjXzXzXzXjXjXjXjXzXjXhXvXpXjXpXvXkXvXjXjXpXjXpXtXpXpXaXeXuXtXaXaXeXeXaXaXtXeXaXuXaXtXaXtXeXpXaXaXaXaXaXpXaXtXuXaXtXtXtXpXpXaXaXpXaXtXkXpXpXpXpXpXtXaXaXtXpXjXkXpXpXaXa [...]
+"T R ,X3X2X,X;X;X2X;X<X,X<X<X<XwX<X<X2X<X<X<X,X;X<X2X<X<X;XuX<X<X<X<X<X<X2X,X<X<X<X<X<X<XeXeX<X<X<XuX<X2X<X<X2X2X<X2X2X;X2X2X2XeX<X2XuXuX2XuX2X2X<X<X2XuXuX2XuXeXuX2X<X<XeX2X;X2X<X2XuXuXuXuXuXuX2X2X2XuX2XuXuX2X2XuXuXeXeXeXeXeXeX<XuXuXuXuXuXuXuX2X2XuX2XuXuXuXuXuXeXuXuXeX<XuXeXeXaXeXaXeXuXuXaXaXuXaXeXaXuXuXtXpXaXtXjXkXkXcXkXjXzXjXkXkXzXkXcXzXzXjXjXjXjXvXjXhXtXjXaXjXjXjXkXpXpXpXpXtXaXeXuXtXtXaXaXtXeXtXeXaXaXaXtXeXaXtXaXaXtXaXaXtXpXtXpXaXaXpXuXtXpXpXpXtXpXkXpXpXpXpXpXtXpXkXpXpXpXpXtXpXpXpXtXa [...]
+"Y T 2X2X2X2X,X2X2X<X<X,X>X;X<X<X<X<X<X<X2X;X,X2X<X;X2X<XuX<X<XeX<X<X<X<XuX<XwX2X2X,X2X<X,X<X2XuX<XeX<XeX<XuXuX2X2X2X2X,X2X2X2X2X2X<XeX2X<XuX2X<XeXuXeXuXuX<X<X<X<X<X2X<XuX<X<XeXuXuX2XeXuX<XuXuXuX2XuXuX2X2XuXuXuXeXuXuXuXuXuXtXeXuXeXuXaXeXaXeXuXuX2XuXuXuXuXuXeXuXuXuXeXuXaXeXaXuXaXeXeXaXaXuXeXaXaXeXeXuXuXtXpXtXtXjXtXkXkXkXjXjXzXjXjXjXjXkXjXjXkXkXjXjXjXpXjXpXpXjXpXjXjXtXrXjXpXpXpXpXaXeXaXuXaXaXaXaXaXeXaXaXtXeXaXeXaXaXaXtXuXaXaXpXpXjXtXkXuXaXaXtXpXpXtXpXpXpXpXpXpXkXpXpXpXpXpXpXpXpXpXpXtXpXaXa [...]
+"R T ,X2X<X<X2X2X<X2X2X2XuXuXeX<X<X<X<XuX2X2X2X2X<XuXuX<X<X<X<X<XeXuX,XuX<XuX2XuX<XuXuX2XuX<XuX2X<XuX<X<X<XuXeX<X<X2X2X2X<X2X2X<X;X2X2X2XuX<X<X>XeXeX<XuXeX<X<X<X2X2XuX2X<XuXeXeXeXeX<X<X<XuX<X2X<X2XuX<XuXuXuX<XeXeXeXuXuX2X2X<XeXeXeXaXeXaXeXeXuXuXuXuXuXuXuXuXuXuXeXeXuXuXuXuXuXuXeXaXeXaXeXeXaXeXeXaXuXaXaXeXpXpXpXpXpXcXkXkXzXjXjXzXzXjXzXjXjXjXrXjXrXjXjXhXpXiXjXpXrXjXfXjXpXpXpXpXpXpXtXtXtXtXaXeXeXaXtXaXtXaXaXaXuXtXtXaXtXaXaXaXaXpXpXpXpXpXaXaXaXpXpXpXaXpXpXpXpXtXpXtXtXjXpXpXkXpXaXpXaXaXaXaXeXa [...]
+"T R <X2X,X,X<X,X<X<X2X<XeXeX<X;X<X<X,XuX2X,X<X,X;X2X;XuXuX<X2XuXeX<X2XeXeX<X2X<X,X2X2X2X2X<X<XuX<XuX<X<XuXuX<XeXuX2X2X,X,X2X<X2X<X<X<XuX<X<XuX<XuX<XuX<XeX<X<X2X2X<XuX<XeX<XuXuX<X<XuX<X2XuX2X2XuXuXuXeXeXuX2X2XuXuXuXuX2XuXuXuXuXeXtXeXeXeXeXeXeXuXuXuXuXuX2XuXuXuXuXuXeXuXuXuXaXeXuXeXaXeXuXaXtXeXaXuXuXuXeXeXtXpXpXpXfXkXzXkXjXzXzXjXjXjXzXfXfXjXjXjXjXjXpXaXiXpXtXhXpXpXpXpXpXpXtXtXpXpXpXpXtXpXeXaXtXuXeXeXaXtXaXtXaXaXtXaXaXeXaXtXpXpXpXtXaXpXaXtXpXpXaXpXpXpXtXtXpXpXpXpXpXpXpXpXpXpXaXpXaXaXtXpXpXp [...]
+"Y R ,X<X2X2X2X2XeX<X2X<X<XeXeX2X,X;X2X<X2X,X2X2X2X2X<X<X<X<X<XeX<XuXuXeX<X<X,XuXuX<X<X,XuXeXuXuXeXuX2X2X<XuX<XeXeXwXuX<X<X2X2XuXuXuX<XeX<X<X<X<X2X2X<X<XuX<XuX<XuX<XuXeXeX2XuX2X2X<XuXuX<X2XuXuXaXuXeXeX<XuXuXuX2X2XuXuXuXuXeXeXeXuXuXuXuXeXaXuXuXuXuXuXuX2XuXuXuXuXuXuXuXeXaXuXuXuXuXaXeXuXtXuXeXtXeXuXuXuXaXtXtXpXtXtXjXjXkXkXzXzXzXzXfXhXfXjXjXfXtXfXhXiXiXiXaXrXtXtXpXtXpXtXpXtXpXtXaXaXpXtXpXaXtXtXtXaXpXaXaXaXaXuXuXtXaXaXeXaXaXeXaXpXpXpXtXtXaXuXaXtXtXpXpXpXaXaXaXpXaXaXpXpXpXpXaXpXpXpXtXpXpXpXpXa [...]
+"R T ,X2X2XeX<XeXwX<X<X<X<X<X,X,X2X<X2X2X,X<X,X2X<XuX<X<X<XeXeXeXeXtXuX2X,X2X2XuX<X<X<XeXuXeX2XuX2X2XuX<XuXuXeX<X2X2X2X,X3X,X2X2X<XeXeXeXuXuXuXuXuX;X2X<X<X<XuX<X2X2X<XeXuXeXuX2XuX2XuX2XuX2XuXuX2XuXuXuXuX2XuX2XuXeXuXuX2XuXeXeXuXeXeXuXeXuXuXeXeXeXuXuXuXuX2X2XuX2XuXuXuXaXeXeXeXuXuXuXuXeXaXtXuXeXeXaXuXtXtXtXkXjXtXpXkXzXzXkXzXzXjXzXfXzXjXfXhXtXhXhXiXiXtXaXrXrXaXtXtXtXaXtXtXtXaXtXaXpXtXpXpXaXtXuXaXaXtXaXaXaXeXtXeXaXaXeXaXaXuXaXaXaXtXtXtXpXpXaXaXtXpXpXaXpXpXaXaXtXpXaXtXtXpXpXpXpXkXpXtXtXpXpXpXp [...]
+"( T 2X,X<X<X<X<X<XuXeXuXuX,X;X,X;XuX<X<X2X2X,XuX<XuX<XuX,XuX<X<XeX<XuX<XuX<X<X<X2X2XuX<XeX<X<X<X<X2X,X2X2XuXuX2X2X2X2X2X,X2X2X<X2XuXuXeXeXeXeX<X<XuX<XtXeXuXuX2X<XuXuXeXeXeX2X2XwXuX<XuXeXuXuX<XeX<XeXeXuX2X2X2XeXuXuXaXuXeXtXeXeXeXeXtXeXuXeXaXeXeXtXeXuXuXuXuXuXuXuXeXeXuXeXaXuXuXuXuXuXuXeXuXeXtXaXeXeXpXpXjXpXtXjXjXkXjXkXkXkXhXjXjXjXjXjXjXhXpXjXrXaXiXiXrXuXrXtXtXtXtXtXtXpXpXtXpXtXaXpXaXtXaXaXuXuXaXaXuXaXeXaXaXeXtXtXaXaXeXtXaXaXtXpXpXtXtXpXpXaXaXaXuXtXaXpXpXaXaXpXaXaXaXaXpXpXpXpXpXpXjXkXpXpXp [...]
+"R T 2X2X<X<XuX,X2X<X<X2X2X2X2X<X<XeXuX<X,X2X2X<XuX<XuXeX<X2X<X<XeX<X<XuX2X<X2XuX<X2X<X2XuX2X;X2X<X<X,X2X<X<XuX<XwX2X2X2X2X2X2X2XuX2X<XuXuXuXuXuXuX<XeXeXeXeX<XuX,X2XuX2X<XeXuX2X2XuXeXuXeXeXeXeXeXeXeXuXuX2XuXuXuXuXuXuXuXeXeXaXaXeXtXeXeXeXeXtXeXaXeXeXeXuXuXuXuXuXaXuXuXuXeXuXuXuXaXiXaXeXuXuXeXaXtXaXaXpXjXjXkXjXjXjXcXjXzXzXzXkXkXfXjXjXkXjXpXhXkXtXtXtXtXtXtXtXtXtXtXaXtXtXaXtXaXaXaXtXtXtXuXaXaXeXaXuXuXaXaXtXaXuXaXaXaXeXaXaXtXaXpXpXpXpXpXjXpXaXaXtXaXaXpXtXpXaXaXtXtXtXaXaXaXtXpXpXpXpXpXpXtXpXpXp [...]
+"Q R 2XuXuX2X2X<X,X2XwX<X2X<X<X2X<XeX<XuXuXuX2X,XwX<XuXeX<X,X<XuX2X2X<X<XuX,XuXeXwXuX,XuXeX<X2X2X<X<X<XuXeXeXeXeXuX<X2X,X2XeX<XwX<XuX2X<XuX2X;XuX<X<X<XeX<XeX<XuX2X2XuX,XuXwX2X2XuXuXeXeXeXuXuX2X2XeXtXuX,X2XuXuXeXeXaXuXuX<XeXeXeXeXeXeXuXuXeXuXeXaXuXeXuXuXuXuXuXuXeXeXuXuX2XaXuXiXuXuXeXaXuXuXuXeXeXaXaXkXkXjXkXkXjXzXjXzXcXlXlXzXzXhXjXjXjXjXkXhXrXtXpXwXeXaXuXtXaXuXtXtXaXaXtXtXaXeXtXaXuXaXaXeXeXaXaXtXaXaXaXaXeXtXtXeXeXaXtXaXaXtXpXtXpXpXpXpXpXtXtXaXeXtXpXaXtXaXaXaXuXaXtXaXpXpXpXpXpXpXkXpXpXpXaXk [...]
+"Q R 2XeX2X2X,X<XeXuX2XuXeX<X<X<X<X<X<X<X2XuX<XuXuX<XuX<X<X,X<X<X<X2XuX<X<X<XeXeXuXuX<XeXuXuX,XuXeXuX<XuXwX<XeXuXuXeXuXuXuXuXeX<XuX<XuXuXuX<X<X2XuX<XuX<XeXuXuX2XuX2XeXuXuX2XuXuX2XuXeXtXeXeXaX2XuXeXeX<XuXuXuXuXaXeXeXeXuXeXeXeXeXeXtXeXuXuXuXuXuXuXuX2X2X2XuX2XeXaXaXuXuXuX<XuX2XwXuX2XaXuXuXuXeXtXuXaXtXkXkXkXzXjXzXjXzXzXcXlXzXlXhXkXjXfXcXrXrXrXjXfXpXrXuXuXuXaXuXaXtXaXtXtXtXpXaXtXaXeXuXaXaXaXaXuXeXaXaXeXaXaXtXtXpXtXeXtXaXaXpXjXpXtXpXaXpXpXtXtXpXtXtXaXaXaXaXaXtXaXpXkXpXaXpXjXpXpXpXpXpXpXpXpXpXa [...]
+"T T 2X<X2X<X2XwXeXqX<XeX<XeX<XeX<XuXeX<X<XeXuX<XeX<X<X<X<X<XuXuX<X<X<XuXeXeXeXeX<X<XuXeX<XuX<XuXuXuXwX<X2XuXuXuXuX2X<X<XuXeXuXuX,X2XuX2X2X2XuX2XuXuXuXuXeXeXeXuXuX<XuXeXtX<XtXeX<XuXuXuXeXuX,X2X2XeXeXuXuX<XeX<XuXeXeXeXuXaXuXeXeXeXeXeXeXuXuXuXuXeXuXuX2XuXuXuXeXuXuXuXuXuXuXuX2XaXuX2XuXuXuXtXaXaXuXtXjXjXkXjXzXzXzXcXSXcXzXzXzXhXzXhXzXkXzXzXkXdXpXfXtXrXtXiXpXeXtXaXtXtXaXtXtXaXaXaXaXuXaXeXtXaXtXtXtXeXeXaXaXpXtXpXpXpXtXaXtXpXtXpXpXpXpXpXpXtXpXpXpXpXpXtXaXtXaXpXpXtXpXpXpXpXpXtXpXpXpXtXaXpXjXpXpXp [...]
+"T T 2XuX2XuXuX2XeX<X<XuX<XeX<X<X<X<X<X<XeX<X<XeX<X<X<X<X2X<X2X<XuX<X,X<XuX<X<X<X<XuX2X<X<XeXeXuX<X2XuXuX2X<X2XuX2X2X2X<XwX2X2X<XuX2XuX2XuX2XuX2X2X2X<XuXeXeXuXuXuX<X2X<XeXuXuX<XeXuXuXeXuXuX2XuXeX2XuX,XeXuXeXtXuXeXeXeXuX<XuX2XuXeXtXeXaXeXuXuXuXuXuXeXuXeXeXuXuX2XwXwXwXwXuXuXuXuXuXuXuXwXuXtXtXaXtXtXjXjXjXzXjXzXfXlXzXcXzXkXlXhXzXlXkXjXtXhXiXiXtXiXtXiXpXtXtXaXtXeXaXaXeXaXpXtXpXtXtXaXtXtXaXtXpXaXtXtXpXtXaXpXpXtXkXtXtXaXaXaXpXpXtXpXpXpXaXpXpXpXpXtXtXpXpXpXaXpXpXpXpXpXpXtXpXpXpXpXaXaXaXaXaXpXpXp [...]
+"T T <X<X,X2X,X<X<X<X<X<X<XuX<X<XuXeXeX<X<X<X,X<XeX<XuXuX<X<X<X,X<X<X2X<X<X<XeX<X<XeX2XuXeXuXuXuXuXuX2X<XuX2X,XuX3X,X<X3X2X<XuXuX<XuX<X<XuX<XeXeX<XuX,X2X2XuX<XuX2XuXuXuXeXtXuX<XtXuX<XeXuX<XuX2X2XuXuX<XuXeXuXuXeXtXuXuXuXeX2X2XuXaXeXeXeXeXeXeXtXeXaXeXuXuX2XaXuXiXaXuXuXiXuXuXuXiXuXwXiXuXuXaXeXuXtXaXjXjXzXjXlXjXzXzXzXSXjXfXkXhXkXzXhXdXhXhXiXiXiXiXtXpXtXaXiXpXaXeXeXaXaXtXaXtXpXaXtXtXtXjXaXtXpXtXaXeXaXaXtXpXpXjXpXtXtXaXtXtXpXpXpXpXpXpXtXtXaXtXaXpXaXeXtXpXtXtXtXpXtXpXpXjXpXpXpXpXpXaXaXaXiXaXpXp [...]
+"T T 2XeXtXuX<XeX<X<X<XeX<XqXeXeXeXeXeXeXeX<X<X<XuX<XuX,X2X<X,XuX<XuX<X<X2XeX<XuX2XuXuX<XuX<X<X<X<X<XuXuX<XuX<X<XeX<X,X2X2X<XuXuXuXuX2XuXuX,X2XeXuXuXuXeXeXeXeXuXeX2XuX<X2XuXeXuXuXwX2XaX,X2XuXuXeXuX2XuXeXuXuX2XeXuXeXeXaXeXuXuXeXtXeXaX<XtXtXeXuXaXeXuXuXrXuXuXuXuXuXiXeXaXuXeXiXuXiXuXaXuXaXtXaXtXpXpXjXjXzXzXzXzXkXjXlXzXzXfXjXzXhXhXhXrXrXrXhXhXiXtXpXrXtXtXeXaXaXaXuXtXtXpXpXtXaXtXtXtXtXtXtXtXpXpXtXpXaXaXaXtXpXaXpXaXtXpXtXaXpXtXtXpXjXtXaXtXtXaXpXpXaXaXpXpXpXpXpXpXtXtXpXpXtXpXpXpXtXaXaXaXtXpXpXp [...]
+"T R 2X<X<X<XuX<XeX<XeX<XeXeXeX<X<XeXuX<X<X<X<XuX<XuX<X<X<X<X2X<XuXeX<X<X<X2XuX<X<XeX<X<X<X<XuX<X<XuX2X<X<XuXuX<XuXuX<X2XuX<X<XuXeXuXeXeXwXuXuXuXeX<XuXeX<XuXeXuX2XuX2XuX<XuXwX2XuXuXuX,XuXuXuXwXeXuX<XuXeXuXuXuXeXeXeXeXeXuXeXeXeXeXuXeXeXeXeXuXeXuXrXeXuXeXeXeXuXuXwXuXuXeXaXaXuXuXuXaXaXuXtXtXtXjXjXkXjXkXjXjXfXfXzXjXlXlXSXfXzXzXhXlXhXhXdXdXtXtXrXiXrXpXtXtXtXtXtXtXtXpXpXpXpXaXtXtXtXaXtXaXpXpXpXpXpXpXtXpXpXpXtXpXpXpXpXpXpXpXpXpXpXpXpXpXtXaXaXtXpXpXpXpXpXpXpXtXpXpXpXaXpXpXpXpXpXaXpXpXtXaXpXpXpXp [...]
+"T Y 2X2X<XeX<XqXeXeX<XeXeXeX>X<X<X<X<XeX<X<X<X<X<X<XwX2XuXuXeX<X2XeX<X2XuX<X2XuXeXeXuXuXuX<XuXuXuXuX2X<XuXuXeXeXuXuXuXuXeXuX<XeXtXeXuXeXuXwXuXuXuXuXuXeXeXuX<XuXuXuXuXeXuXuXeXeXuXuX3XaXwXuXuXwXeX<XuXwXwXuXuXuXuXeXuXaXeXaXuXuXeX<XeXeXeXeXeXaXeXuXuXuXaXeXuXeXiXuXuXuXrXuXaXwXuXuXuXuXuXeXtXpXjXjXjXjXfXkXzXjXzXkXhXzXlXlXfXzXhXhXlXhXlXhXrXtXpXrXrXwXtXtXtXpXjXtXtXpXtXpXpXpXaXtXtXtXaXaXpXaXpXpXpXtXpXpXtXpXtXtXpXpXpXpXpXtXpXpXpXtXpXpXjXpXpXpXtXpXpXpXtXjXpXpXpXpXkXpXaXaXpXpXpXjXpXpXkXtXpXpXpXpXjXp [...]
+"Y T eX,X<X<XeX<X<XqXeX<X<X<X<X<X<XuXeX<XeXuXuX<X<XuXeX<XeXeXeXuXeX2XuXuXuX<XeXuXwX<XeXeXtX<XeXeXuXeXeXeXeXeXeXeXuXwXuX,XuXuXeXeX<XuXuX<XuX2XuXwX<X<XuXeX<XuX<X2XuXuXeXeXuXwXuXuXwXuX7XuXuXwXuXuXtXuXuXuX2XwX2XuXuXuXuXuXeXeXeXuXaXuXeXeXeXtXeXeXaXeXaXuXuXeXuXeXuXuXuXuXeXuXeXeXuXuXeXuXuXuXtXkXpXpXtXjXfXfXjXjXfXfXjXjXhXhXjXjXhXhXhXhXrXrXtXrXrXrXpXrXtXeXtXtXtXtXtXtXpXpXpXpXpXpXaXtXpXtXpXpXpXpXpXpXpXpXpXpXpXpXpXpXeXpXpXpXpXpXtXpXpXpXtXtXtXpXpXpXpXpXtXpXpXkXpXpXtXpXpXpXpXkXpXpXpXpXpXpXkXpXtXpXpXp [...]
+"T T eX<X<XeXeX<XeXeXeXeXeX<XeXeXeXeX<XeX2X<X,X2XeXeX<XeXeXeXeXwXeXeXeX<X<XeXeXeXeXeXeXeXeXeXeX<X<XeX<XeXeXuX2X<XuXeXuXeXeXuX<XeX2XuX<XeXeXeXuXeXeXuXuXuX<XeXuXuXuXeX2XuX<X2XuXwXuXuXeXuXiX2XuXeXeXeXwXuX2XaX2XwXuXuXeXeXeXeXuXaXuXuXeXtXeXuXeXuXeXeXuXuXtXuXaXeXeXuXwXuXuXuXwXeXwXeXuXuXuXaXtXpXfXpXkXfXkXkXjXjXkXrXrXkXrXhXfXjXiXiXpXrXtXtXrXrXpXtXrXrXtXtXuXrXuXtXuXaXaXtXtXpXpXpXpXpXpXtXpXpXpXpXaXaXeXaXpXpXpXpXpXtXkXtXaXtXeXaXaXaXpXpXpXpXpXkXpXpXpXjXpXpXpXpXkXjXkXtXtXpXjXpXjXtXtXtXpXpXtXpXaXpXpXp [...]
+"Q T eX<XqX<XeXqXeXeXeXeXeXeXeXeXeXeXqX<XuXuX2X<XeXeXeXeXeX<X2X<XeXeXeXeXeXeXeXuXeXeXeXeXeX<XuXuXeXeX<XuXuX2X2X,X2X<XeXuXuXuXeXuXuXuXtX<XeXeX<XaXuXwXuXuXeXeXeXeX<X<X2X2X2X2X2X2X<XuXuXwXwXuXiXeXeXuX2XaX,XuXaXwXeXuXtXeXeXeXuXeXeXuXuXeXuXeXuXeXeXuXuXeXwXuXeXuXuXuXuXuXuXuXeXaXaXuXuXeXeXaXtXtXjXpXpXrXjXjXhXkXkXjXhXhXkXhXrXtXrXaXiXiXtXrXtXtXwXrXpXpXtXwXuXiXeXeXtXtXtXtXpXtXtXpXpXtXtXtXpXpXaXpXtXaXpXpXpXpXfXpXpXpXtXaXpXpXtXaXtXtXpXpXpXpXjXjXpXpXpXtXpXpXpXpXtXjXpXtXpXtXtXpXpXtXtXjXpXpXpXpXpXpXpXp [...]
+"T Q 2XeXqXeXeXeX<XqXeX<XeXeXuX<X<XwXeX<X,X2XuXuXeXeXeXeXeXuX2X<X2XwXeXeXeXeXeXeXuXeXeXuXuXuX<XuXeXeXeXeX2XeXuX2XeXuXeXuXuX2XuXuXeXuXeXeXaXeXeXeXwX<XeXeXeXtXeXeX2X2XuX2XaXeXuXeX2XuXuXwXuXuXuXuXuXwXuXwXuXuXyXuXuXaXeXaXaXeXuX<XeXuXuXuXuXuXeXuXaXaXtXaXtXeXaXtXiXuXiXuXuXwXuXuXaXuXaXuXeXuXtXtXfXfXjXhXrXhXkXvXdXjXtXrXhXrXrXhXrXrXuXrXiXrXrXrXtXrXwXwXrXtXeXuXaXeXaXtXtXtXtXpXpXtXtXtXpXpXuXtXtXpXpXpXpXpXpXpXpXpXpXpXtXjXtXpXpXtXpXpXtXpXtXpXtXpXpXpXpXpXpXtXpXtXpXpXkXjXjXtXpXpXpXpXpXkXpXtXpXpXpXpXpXp [...]
+"Q T <X<XeXeX<XeXeX<XeX<XuX<X<XeXuXwX<X,X<XuXeX<XeXuXuX<XeXeX<XeX<X<XuXuXeX<XeX<XuXeXeX<XeXeX<XuXuX<XeXqX<XeX2XuX<XuXeXeX<XuXuXuXuXuXuXuXeXeX<X<X2XuXeXeXeXeXuXuXiXuXwXwXeXeXeXuX<XuXwX2XuXeXeXuXuXuXuXuX2XuX3XwXuXwXuXuXeXuXtXeXeXuXeXeX<XuXeXuXeXeXeXuXeXeXeXeX<X<XiXuXrXuXuXeXtXrXaXuXaXuXuXtXtXpXpXpXjXfXfXrXfXdXhXrXiXrXiXiXrXrXrXrXuXeXuXrXrXwXtXtXeXeXiXuXeXuXeXtXaXtXpXpXtXtXaXpXtXaXpXaXtXpXpXpXpXtXpXpXpXpXpXtXtXpXpXaXaXtXpXpXtXpXaXtXtXtXtXtXjXtXpXjXpXtXjXpXpXtXpXtXkXpXtXkXtXkXpXtXpXpXkXpXjXp [...]
+"Q T eXeX,XeX<XeXeX<X<XeX<XuX<XuXeXeXuXeXuXwXwXuX,X,X2X,X,XuXeXeX<XeX<X<XuX<XwX2X2X,X2X<XeXuXeXeX<XuXuXwXeXeX<XuXwXuXaX2XwXuXuXuXeXeXeXeXuX<XuXuXuXuXeXeXeXuXeXuX<XuX<XeXeXeXeXuXuXuXuXtXeXeXtXeXeXuXwXuXuX2X2X2XuXuXwXuXuXuXuXeXeXeXuXuXaXeXaXeXtXeXeXtXtXeXeXtX2XuX2XuXuXuXuXiXrXaXaXuXaXeXaXtXtXaXrXiXpXhXjXjXjXrXrXkXrXhXtX8XiXuXwXuXrXwXrXwXrXtXrXuXtXaXtXpXaXtXpXtXtXtXtXtXtXpXpXpXpXaXaXtXtXpXpXpXpXpXpXtXpXpXpXpXpXtXtXtXpXpXpXpXrXaXaXaXtXaXtXjXtXjXpXtXpXpXtXpXjXpXpXpXpXpXtXpXpXpXtXjXpXtXpXaXtXj [...]
+"T T qXeXwXeXeXeXeX<XqXeXeXeXeX<XeXeX<X<X2X<XeX2X2X2X,X2X2X<XuXeX<XwXwX<XeX2X2XuXuX<X2XuXeX<XeXuXwX,XuXeXeXeXwXuXwXuXwXuX<XwX<XuXaXuXuXeXeXeXuXuXeXeXeXeXeXtXuXeXeXeXuXuXeXeXeXeXeXeXeXeXtXtXeXeXeXaXwX2X2XuXuXwXuXeXuXuXuXuXuXeXeXaXuXeXtX<XeXuXuXeXuXeXeXaXeXaXiXwXyXuXuXiXuXaXaXeXeXeXeXtXeXtXtXtXtXpXfXpXjXhXiXfXhXtXfXtXrXiXwXiXrXrXrXwXrXwXeXrXeXeXeXtXaXeXtXtXtXtXpXjXtXjXtXjXtXpXpXpXtXpXpXpXpXtXpXpXpXtXpXpXpXpXtXaXpXpXpXtXpXpXpXtXtXaXpXtXjXpXjXtXjXjXpXtXpXpXtXpXpXpXpXpXpXtXtXkXjXkXpXjXpXpXtXt [...]
+"T T eX<XuX<XeX<XeXtX<XeXeXeX<XqXeX<XuX2XuX<XuX<X2X,X<XuXeXeX<XeXuXeXeXeXuX<XuX<X2X2X2X2XeXeXeXeX<XwXeXeXeXeXwXuXuX2X<X2XuXuXeXeXeXeXeXeXeXeXeXeXuX<XeXeXeXeXeXeXeXeXeXeXuXeXtXtXeXeXeXtXeXtXeXeXuXeXwXuXwXuXeXuXuXwXeXuXuXeXeXtXeXeXeXeXuX<XeXeXuXeXeXuXaXwXaXeX2XwXuXuX2XiXiXuXeXaXtXaXtXtXtXaXaXtXrXpXiXjXfXtXpXtXtXrXrXuXuXwX8XwXwXiXeXuXuXuXiXwXuXiXaXtXtXtXtXaXtXtXjXtXtXtXtXtXjXtXtXpXpXaXpXpXpXaXpXpXpXjXjXpXpXkXaXtXpXpXpXpXpXpXaXaXpXtXpXjXpXjXtXjXpXkXpXjXtXpXtXjXjXtXpXpXpXtXjXpXpXpXiXjXjXtXpXp [...]
+"T Y wX<XeX<XeXeX<XeXqXeXeXeXeXeXeXeX<XwXwX<XwX<X,XaXwX,X2XeXeXeXeXeX2XwXwXwXuXeXuX,XuXwXeXeXeXuXeX<X<XuXuXuXuXuX<XeXuX2XuXuXeXeXeXeXeXeXeXeXeXuXeXeXeXtXeXeXeXeXuXeXuXeXeXeXeXtXeXeXtXeXeXuXeXeXeXuXuX<XuXiXuXuXuXuXwXuXuXeXuXeXeXeXpXeXaXuXeXuXeXuXeXaXeXuXuXuXuXuXuXwXwXuXuXuXaXtXtXtXpXpXeXeXuXeXaXpXiXpXrXrXrXtXhXpXrXuXwXyXwXuXrXaXiXuXrXwXuXuXiXeXuXeXaXtXtXtXtXtXtXtXtXjXpXtXtXjXtXpXpXaXpXpXpXtXtXjXpXtXtXpXtXpXtXpXtXjXjXpXpXpXtXtXpXrXtXtXpXpXtXtXpXpXjXjXjXtXpXpXtXpXtXpXkXpXtXpXjXtXpXaXkXpXpXp [...]
+"Q T wX;XeX<X<X<XwX<XeX<X<X<XeXeXeX,XuX<XeX<XeXeX2X2X2XwXwXuX<XeXeX,X2X2X2X2XuXwXeX<XeXeXuXeXeXeXeXuXuXuX<XuXeXuXeXeXuX<XwXuX2XwXeXeXeXeXuXwX<XuXeXuXuXeXeXeXeXeXuX<XuXtXeXeXuXtXwXwXeXeXwXuXwXuXeXuXeXeXuXuXwXwXeXuXeXuXeXeXtXuXeXtXtXtXaXeXuXeXuXuXaXeXeXaXeXeXeXuXuXuXuXeXuXuXeXtXuXuXaXuXeXeXtXeXtXpXfXpXrXdXpXpXtXtXeXuXrXwXyXwXuXwXeXtXrXwXeXtXeXuXeXtXaXtXaXtXaXtXtXtXpXpXpXpXpXpXtXaXaXtXpXaXtXtXpXpXjXaXpXpXtXpXtXpXtXpXpXpXpXhXpXtXfXpXpXpXtXpXtXtXaXpXpXfXpXiXpXpXpXjXtXaXtXpXtXtXpXpXpXpXjXpXjXj [...]
+"T T wX<X<XwXuXeXuXeXuXeXeXeX<XeXuX,X<XwXeXeXeXeXwXwX2XwXeX<XeXeXwX2X,X<X2XwX2XwXeXeXqXeX<XeXeXeXeXeXeX<XeXuXwXeXuXuXwXwXuXeX<XwX<XuXuXeXuXeXuXuXeXeXuXuX<XuXeXuXuXuXuXeXeXeXuXuXuXuXeXuXuXuXuXuX2XuXuX2XuXwXuXuXuXeXuXtXaXeXuXuXaXeXeXtXtXuXuXuXeXuXuXeXeXtXeXtXuXeXiXuXiXuXuXwXaXeXaXuXuXtXaXaXtXtXtXtXrXpXtXtXrXtXrXrXtXuXwXwXwXwXuXwXtXrXeXtXaXtXtXrXtXuXtXeXtXtXtXtXaXtXaXtXtXtXtXpXtXtXtXaXpXaXaXpXtXtXtXtXpXpXpXpXpXpXpXpXtXtXtXtXpXpXpXpXpXtXtXpXtXjXtXtXpXpXpXpXpXpXaXiXtXpXpXtXpXjXpXpXpXjXpXhXkXp [...]
+"T T ,X2X<X2X2XwX<XeX<XuXeXeXeXeXeXeXeXeXeXeX<XeX<XeXwXeX2XeXeX2XuX2XuX<X<XuXeXuXeXeXeXeXeXeX<XeXuXtXuXuXuXeX2XeXuXuXwXuXuXwXuXwXuXuXuXeX<XeXeXuXuXuX<X<XuXuXeX<X<XeXuXeXtXeXeXuXuXuXuXuXuXuXwXuXuXwX2XuXeX2XeXeXuXeXuXeXeXuXuX<XuXeXtXtXeXeXeXuXeXeXuXeXeXaXeXaXaXeXiXuXeXaXtXeXuXaXeXtXaXtXtXtXtXuXtXeXaXeXeXaXtXtXeXaXiXwXiXuXwXuXwXuXrXtXaXuXaXeXeXaXtXtXtXuXeXaXeXaXtXpXtXtXpXjXpXpXpXtXpXpXaXuXtXtXtXjXtXtXpXpXpXpXpXtXpXjXpXpXpXpXpXpXpXpXpXtXpXpXpXpXpXpXpXpXpXpXpXpXpXtXiXpXpXfXpXpXpXpXiXpXjXtXkXf [...]
+"T T ,X;X2X,X2X,XwX2XwX<XeXeXeXeX<XuXwXwX<XeXeXtXqX<XuX,XwXeXuXeXwXwXwX<XuX<XuX,XeX<XeXeXeXeXeX<XuXeX<X<X<X2XwXwXuXeXuX<XuXuXuXuXeXeXeXeXuXtXeXeXuXeXtXeXeXtXeXuXtXeXeXeXeX<XuXeXeXwXuXwXuXuXuX2XwX2X2XuX2XiXuXeXeXaXeXeXuXwXuXeXeXuXeXuXeXeXeXaXeXtXuXeXeXwXaXuXeXtXuXeXaXeXtXaXeXtXtXaXtXtXaXtXaXeXtXaXuXeXrXeXtXtXiXuXwXwXuXwXuXrXuXeXwXeXeXiXwXaXtXrXtXaXtXtXtXtXtXaXtXtXaXtXpXtXtXpXpXpXpXrXtXaXuXuXaXpXpXjXpXpXtXpXpXtXtXjXpXaXtXtXtXrXtXpXpXtXjXpXpXfXtXrXpXpXpXtXrXpXjXpXpXpXjXpXpXpXaXaXiXpXvXpXpXp [...]
+"T T <XeX<XeXuXwXqXeXwXeXeXwX<XtXeXeXwX2XwXeX<XwX<XeX<XwX<XeX<XeX2X,X2XuXwXwXwX,XuX2X<XeXwXwXuXwXuXeXuX<XuX2XuXeXeXwX2XuXuXuXuXwXuXeXuXwXwXuXuXuXuXwXuXeXuXuXwXeXeXtXeXaX<XeXuXeXuX<XeXeXuXuXwXiX2XwXuXuXuX,XaXwXwXeX2XaX,XaXaXuXuXuXuXwXuXeXaXeXeXaXtXeXaXeXeXeXuXeXeXtXuXeXeXeXaXeXaXtXeXaXtXaXtXwXpXtXtXeXtXtXtXeXuXtXeXaXuXuXwXuXrXuXuXiXuXaXwXaXtXtXeXaXtXtXpXpXfXpXpXpXaXtXaXpXpXpXtXpXpXaXtXtXpXpXpXtXtXpXtXaXtXpXrXtXpXpXpXpXpXpXpXpXpXpXrXpXpXtXtXpXpXpXaXtXaXpXtXtXjXpXkXpXpXjXpXjXpXpXhXiXiXaXiXp [...]
+"T T <XuXeXeXwX<X<XeXuX<XeXeXeXeXeX,XwXeXwX2X<XuXwX2X<X2X<XeXeXeX2XaXuXwXuX,XwX2XeXwXeXeXuXeXwXuXuXuXuXwXwX2XwXuXuXwXwXwXuXwXeXeXuXeXuXuXuX<XeXeXeXuXuXeXiX<XwXuXeXeXeXuXeXeXeXuXuXuXeXuXwXwXuXuXwXuXuXwXyXuXaXaXiXuXuX,XwXuXwX2XwXuXuXuXuXuXtXwXeXeXeXrXeXtXaXuXuXtXaXtXeXaXaXtXtXtXaXeXuXeXeXuXeXtXeXtXtXaXtXpXwXrXtXtXwXtXeXiXuXrXuXiXwXuXiXwXuXiXaXwXtXtXtXtXtXpXtXpXtXtXtXtXaXtXiXtXtXaXpXtXtXaXtXtXpXpXpXpXrXpXaXpXtXpXpXfXpXrXpXpXpXpXpXpXtXpXpXtXpXpXpXpXtXaXtXaXtXpXpXpXpXfXjXjXjXrXtXjXpXpXiXpXaXp [...]
+"T T <XeXeXeXuX2XwXeXwXuXuXwXeXeXwXuXuX2XuX2X,X2X2X2X2XuX<X2XuXeXuX,XuXuX,X,XuXuXeXeXeXeXeXeXuXuXwX2XwX2XwXuX2X2XuXwXuXuXwXeXuXeXeXeXuXwXuXwXuXwXeXuXuXwXwXuXuXuXeXeXuXeXeXtXeXuX2X<XuXuXuXuX2XiXuXuXwXuXyXuX2XwXiX2X2XeXuXaXuXiXaXuXiXuXeXwXeXtXeXwXuXuXeXaXtXeXwXeXtXtXtXeXtXtXtXtXtXtXaXtXtXeXeXeXeXwXeXaXaXtXeXaXaXeXwXuXuXeXuXeXeXtXtXaXaXaXuXuXpXrXuXiXaXtXaXeXuXaXpXeXiXaXtXuXaXtXpXtXaXaXtXtXtXpXrXaXrXrXiXpXpXrXiXjXpXpXfXpXfXpXpXpXpXpXfXjXtXtXpXpXaXaXaXtXtXpXtXpXfXrXjXtXtXtXpXpXaXiXpXjXaXpXpXp [...]
+"Q T eX<X<XeXeX,X<X<X,XwX<X<X<XeXuX<XwX,XwXuXwXwX,XuXwXwXwX,XuXwXwXuXwXeXuXuXwXuXuXeXtXeXeXwX2X2X2X2XwXwXuXuXwX2XwXuXuXuXuXuXeXuXuXuXwX2XwXuXuXwXeXwX2XeX2XeXuX<X<XuXuXeXeXeXuXeXuXiXuX<X2XuXeXeX2XwXwXuX2XuXuXwXeXeXrXaXuXwXwXaXwXwXuXuXiXuXuXuXuXuXrXeXtXeXtXaXwXtXeXeXtXtXpXtXaXtXaXtXpXtXtXtXtXaXtXaXtXtXuXeXiXuXeXiXuXuXiXeXuXaXtXaXeXrXtXuXaXtXaXuXuXiXuXuXaXeXaXuXaXrXuXaXrXtXaXtXpXtXtXtXrXaXtXaXtXtXrXaXaXrXaXaXtXpXpXpXtXpXfXpXfXpXjXpXjXpXjXtXpXpXtXpXpXpXpXpXhXpXjXpXjXjXjXpXiXpXaXiXjXaXpXiXtXp [...]
+"Y T eXwXeXeXeX<X<XeXeXeX,X2XwX2X<X<XuXeX2XwXeXuXwXuXtXeXuXuXwX,XuXuXuXeX2XuXwX2XuXwXeXeXeXeX2X<XeXeXuXwXwXuXeXuXeXeXeXeXuXuXuXwXwXuXwXeXuXeXeXeXeX2X2XuXeXuXwXeXuXwXuX<XuXaXaXuXuXuXuXwX2XwXwXuXeXeXtXeX2XeXaXuXuXuXrXiXaXiXuXaXiX2XuX2XuXuXtXuXuXuXaXeXeXtXeXaXtXtXeXaXaXtXtXtXtXaXaXtXaXtXaXtXaXuXaXuXuXaXeXtXuXrXuXuXrXaXeXtXiXuXtXiXuXwXiXuXuXtXeXaXuXtXtXaXaXtXtXtXtXtXpXpXaXiXpXrXeXtXtXpXtXtXaXpXtXaXpXtXpXpXpXiXrXpXpXaXpXpXrXpXpXpXfXfXjXtXpXjXpXpXiXaXpXtXjXpXjXpXjXpXtXfXjXpXhXpXpXpXiXpXpXpXpXp [...]
+"T ( <X<X<XeXuXwXiXwXwX2XwX2XeXeXuX<X<XeX<XeX,XeXuXeXeX<X<XeX,X2X,X2XwXwXwX,XuXuXuXuXwXwXuXeXeX<XuXwXuXuX2XwXwXuXeX,XeXeXwX2XwXuXeXuXwXuXeXeXeX2XeXwXwXuXeXuXuXuXuXwX2XyX,XeXeXeXeXwXeXuXiXuXuX2XuXeXtXtXwXeXeXeXuXiXeXeXuXwX2XiXuXwXwXwXeXrXeXtXrXeXtXuXaXaXrXuXtXaXtXtXeXeXtXaXaXtXtXaXtXeXtXeXtXuXtXtXeXeXeXeXuXrXiXwXaXtXtXtXuXiXaXuXuXiXiXuXtXaXtXtXrXaXeXtXtXtXtXtXaXaXrXtXtXaXiXtXpXpXtXaXiXuXaXtXuXaXtXtXiXtXpXtXtXpXpXtXpXpXaXtXtXfXpXpXpXpXpXaXpXiXiXiXfXpXpXrXtXpXjXjXpXtXpXpXpXiXiXjXaXpXiXfXjXp [...]
+"T Y <XwXuXwX2XwXwXuXwXwXuXwX,X<XeXeXuXwXeXuX,X<XwXuXeXeXeXeXuX<XwXuXuXwXwXuXwXuX<XtXeX2X<X2XeXuXuXeXuXwXiXuXuXrXuXeXeXuXuX2XwXuXwXeXuXuXwXeXiXuX2XwX2XwXuXuXeXeXuXuXuXiXuXuXeXuXuXeXaXeXuXuXuXiXuXeXtXtXtXeXeXuXeXuXuXuXuXuXwXuXuX2XuX2XuXrXwXeXeXeXeXuXtXaXtXtXaXtXeXtXtXtXtXtXtXtXaXtXeXaXtXaXaXtXtXeXtXtXpXpXuXuXeXaXeXaXtXaXeXtXeXtXuXaXeXtXaXtXtXaXtXaXtXaXtXaXaXpXtXtXaXeXaXpXiXtXpXpXpXtXaXeXaXeXaXuXtXaXtXpXpXtXaXtXpXpXpXpXpXtXpXpXpXtXpXpXpXhXtXhXaXpXpXpXpXfXpXpXaXpXpXaXiXhXjXjXpXpXaXiXpXpXpXp [...]
+"Q T wXeX2X<XeX,XwX2X2X2XwXuXwX2X<XeX2X,XwXuX,XuXuXeXeXeXeXeXeXeX,XuX<X<XwX2XwXwXeXeXeXuXwXuXuXwXuXeXeXwX2XwXuXeXuXeX<XuXeXwXuXuXeXeXeXeXeXuX<XuX2XiXwXuXwXeXuXeXwXuXwXwXuXwXeXuXeXuXeXeXuXwXuX<XeXtXtXtXaXaXeXtXeXuXeXeXiXwXuXyXwXiXuXiXeXuXeXuXuXuXuXeXtXtXuXrXeXaXeXtXtXtXtXtXuXeXeXtXtXtXtXaXtXtXaXtXtXaXtXpXaXuXiXuXtXtXaXtXaXrXaXtXaXiXiXaXrXaXtXaXtXtXpXtXaXtXtXpXtXtXtXtXtXtXaXpXjXtXpXaXpXpXaXaXtXrXaXtXpXpXpXpXpXtXpXtXjXpXpXfXpXpXtXrXpXpXpXhXtXpXaXjXpXtXpXpXpXpXtXfXiXjXiXaXpXiXiXpXpXpXpXpXjXp [...]
+"T Q uXwXeX<XeX,XeXeXeXwX2X2XwXwXwXeXwXwX2XwX2XwX2XwXuX2X,XeXeXwX2XwXwX2XwX2X2X2XwX2XuXuXrXuXuX<XeXeXuXeXuX2XwX2X<XuXuXwX2XwXuXuXeXeX<XuXuXwX2XuXuXeXuXwXuXuXwXiXwXuXwXeXuXeXaXeXwXuXuXwXwXuXiXuXeXtXeXtXeXaXpXtXeXaXuXwXuXuXuXuXuXuXuXeXeXuXaXeXuXuXtXwXaXwXtXaXeXeXtXeXtXtXqXtXtXeXuXtXtXaXpXeXuXaXtXtXtXtXaXaXrXaXuXwXtXuXtXaXtXtXtXtXaXtXaXtXtXaXtXaXtXiXaXtXeXtXaXtXtXtXuXaXaXiXtXaXtXpXpXtXpXtXpXiXiXaXtXpXpXtXtXpXpXpXpXfXpXtXtXpXpXtXtXpXfXpXtXfXtXpXtXpXpXiXpXpXjXtXpXkXrXkXjXjXpXpXiXpXhXpXjXpXpXp [...]
+"T T uX<XuXwX2XwXeXeXuX<XwX2X2XwX2XwX2X2XwXwXwXuXuX<XwX2X2X,XwXuXuXwXuXuXwXwXwX,XuXwXeXrXeXuXwXuXeXeXeXwXuXwXeXuXwXeX,XuXaXwXuXwXwXeXeXwXuXuXwX2XwXuXeX2X,XuXwX2XuXeXeXeXuXeXeXeXaXwXuXuXuXeXeXuXaXwXtXaXuXiXaXwXtXuXuXwXuXuXrXuXeXuXtXtXtXtXtXtXeXiXeXaXtXtXtXtXaXtXtXtXaXtXtXtXeXaXaXaXeXtXtXtXeXuXtXaXaXeXrXeXeXaXuXiXeXaXaXtXtXaXtXtXtXtXtXaXrXeXrXaXtXuXaXtXaXiXtXaXaXtXuXiXwXuXaXeXpXtXpXpXpXpXiXpXrXpXaXpXpXtXjXtXtXtXpXpXtXpXpXpXtXpXjXfXfXfXpXpXaXtXtXjXpXpXpXpXjXjXfXpXjXpXpXtXpXpXkXpXaXpXiXpXpXp [...]
+"Y T eX,XwXuX2XuXuXwX<XeXwXuX2XwXwXuX2X,X2XwXwX<XwXwX,XuXeXeXuX<XeXeXwXuXeX2XwXuXuX2XwXuXrXeX<XeXwXuXuXwXuX2X2XaXeXwXuXeXuXuXuXwXeXeXuXeXuXuX2X,XuX2XwXuXeXuXuXwXuXuXeXeXuXuXeXaXiXuXuXuXuXeXuXeXeXtXeXtXuXuXuXiX<XiXuXuXuXeXeXuXuXeXeXtXaXeXeXaXaXtXeXtXtXtXtXaXtXtXtXtXtXtXaXaXaXtXtXeXtXtXtXaXeXeXtXaXtXtXtXaXtXaXuXiXeXtXtXaXtXtXtXaXtXaXtXtXaXrXuXtXaXiXrXeXeXpXuXuXtXtXiXiXaXrXaXaXaXtXaXtXrXaXiXaXiXaXpXjXpXpXpXtXtXpXaXaXjXpXiXaXhXiXaXtXaXpXfXpXpXtXpXtXpXpXpXaXtXpXkXjXfXjXjXpXpXpXpXiXpXpXaXrXiXj [...]
+"T Q eXeX2XwXwXwX2X,X2XwXuX<XwXwX<XwXuXwXuXwXuXwX2XwXuXwXeXwXeX<X,X<XuX<XwXuXuXwXwXwXuXuXwXuXwXuXuXuXuXwXwXuXwXwXeXaXeXeXwX2XwXuXeXeXeXeXeXeXyX2XuXuXwXuXeXeX2XiXiXuXuXeXuXuXeXeXuXuXwXeXeXuXeXiXrXeXtXaXiXwX2XuXiXeXrXwXrXeXaXuXaXeXeXeXaXtXwXaXeXtXpXrXtXtXtXeXeXtXeXaXuXaXtXeXeXeXaXtXtXpXtXtXaXaXtXtXaXtXeXtXaXiXuXuXaXtXtXtXaXtXtXtXtXwXtXtXtXtXtXaXaXtXtXaXrXiXaXiXaXtXeXiXtXaXpXrXuXuXtXaXaXtXtXtXiXtXpXpXrXjXtXpXpXtXpXuXiXiXiXpXpXaXaXrXpXpXpXjXjXpXkXpXaXaXpXiXtXpXpXpXpXtXhXpXpXjXaXiXiXpXrXaXtXa [...]
+"T Q uXeXeXeXwX<X,X,XwX,XeX<X2X,XuXwXwXeX,X2XwXeXwXiXwXuXeXeXeXeXwX2XwXuXuXeX2XuXuX2X2XwXwX2X2XwXuXwXuXuXrXuXuXwXeXiXuXuXuXwXuXuXeXeXuXeXwXuXwXwXwXuXuXwXuXrX,XuXiXuX<XwX2X,X2XyXwXaXwXuXuXiX2XuXeXeXuXuXwXuXuXrXuXwXeXeXtXtXtXeXeXeXeXrXtXeXeXeXtXeXtXtXtXtXaXtXtXtXtXeXtXtXtXtXtXtXtXtXtXpXtXpXpXpXtXtXpXaXtXaXtXeXrXuXpXtXpXtXrXrXaXtXtXuXaXtXtXaXaXuXtXuXiXuXuXiXuXaXtXpXtXtXaXtXtXaXtXaXtXpXpXtXtXtXpXtXpXpXtXiXiXiXpXhXiXiXaXpXiXpXiXaXpXaXpXiXpXpXpXpXpXpXiXaXpXpXtXtXtXkXjXpXiXaXpXpXiXjXjXiXiXaXaXt [...]
+"T T ,XeX<XeXuXwXeXwXwX2X,XuXuXeX2X,XeXwXuXuX<XwXwXwXuXuX,XeXeXeXuXwXuXwX2XwXwXuXuXwX,XwXuXuXuXwX<XuX<XiXrXuXuXwX<XeXeXwXeXwXwXuXeXuX2XwX3XyXuXuXuXuXwXuXwXuXeXtXeXeXuXuXiXaXwXuXwXwXwXuXuXwXwXuXuXwXwXuXuXiXuXwXeXeXtXeXtXtXeXtXuXrXuXaXuXtXaXwXuXuXeXtXtXtXaXtXtXtXtXtXeXtXeXaXtXaXtXjXpXpXpXtXtXtXpXtXpXpXtXtXtXpXeXaXpXpXtXwXeXtXtXtXuXiXrXaXtXrXrXiXuXrXiXiXiXrXaXwXtXpXtXtXtXaXtXtXjXtXtXtXaXrXaXiXtXpXtXtXiXhXpXrXpXiXhXpXrXaXiXpXpXiXiXiXiXpXpXtXpXiXiXiXiXaXiXpXpXjXpXpXpXiXvXaXhXpXpXaXaXjXvXjXaXi [...]
+"T T eX,XeXeXeX,XwX2XwXwX2X,XeXwXwXuX2XwX<XeX<XtXeXuXwXeXwX,XeX<X2XwXwXuXuXwXuXwXuXwXuXyXuXeXeXuXuXwXwXwXwXwXuXuXuXuXwXuXeXwXuXwX2XaX2X2X2XuX3X7XwXuXwXiXwXuXeXeXrXtXiXeXeXwX,XuXuXaXuXuXaXwXwXuXuXuXwXwXuXuXwXuXeXeXeXtXeXtXtXeXuXeXeXuXeXuXtX<XuXeXeXaXtXtXtXtXwXtXtXuXuXtXeXtXtXtXtXpXtXtXpXpXtXtXtXtXpXtXtXtXpXaXtXrXaXaXtXtXtXaXaXrXiXuXeXaXpXrXuXiXrXuXaXuXaXuXtXrXtXaXeXaXaXtXtXaXrXtXpXpXrXjXpXpXpXpXrXaXpXpXrXaXiXhXpXiXrXaXrXaXpXpXpXtXaXpXpXjXpXaXpXiXiXaXpXpXpXpXtXpXpXpXaXrXpXpXpXaXiXiXaXaXiXa [...]
+"T Q eXeXeXwX2XwXwXeXeXeX,XuXuXwX2X2X,XeXeX<XwXwXuX,XwX2XiX2X2X,X2XeX,XuXeXwXwX2XwX,X2X2XwXuXeXeXiX2XuXuX2XwX2XwXuXuXuXeXuXuXeX2X2X,X,XuXwX,XaXuXwXuXuXuXwXwXuXuXuXaXeXuXiXuXaXwX,X,XuXwXuXwXuXwXuXwXrXeXuX,XwXuXtXeXuXaXeXtXeXeXeXeXaXeXtXeXeXuXaXtXtXaXtXtXtXtXtXtXaXtXaXuXaXeXaXaXtXtXtXtXpXtXtXpXtXtXtXjXjXtXtXpXuXaXtXtXtXaXtXtXaXtXiXuXiXrXeXaXiXuXuXiXaXwXiXtXtXtXtXpXtXaXtXaXeXtXpXtXjXpXpXpXpXiXiXaXtXtXaXpXtXiXiXaXhXiXrXiXtXaXpXpXpXtXpXpXpXjXpXiXjXaXjXhXtXpXfXfXjXpXtXpXtXaXpXpXpXpXaXpXiXiXiXi [...]
+"T Y eX<XeX,XwX<X2XeX<XwXwX,XwXuX,XeXeXwXeXwX<XuX<XwXeXuXwX2X2X2XwXuXuX,XwXwXeXuXwXwXuXwXuXwXuXwXuXuX2XaX2X,XwXuXuXwXuXiXuXuXuXwXwX,XwXuXuXuXwXwXwXuXeXwXuXuXuXwXiXuXuXrXeXuXiXwX<XuXuXwXuXwXuXuXuXwXyXuXwXaXuXwXiXeXeXaXtXaXtXtXpXiXuXiXaXeXtXeXtXtXaXtXtXtXtXtXtXtXtXtXtXeXtXeXaXtXaXeXtXaXtXpXtXtXtXtXtXtXtXtXaXuXtXrXtXaXaXrXiXpXjXpXiXaXpXrXiXiXuXrXaXtXiXuXiXaXpXrXtXtXtXtXpXtXrXtXpXtXpXrXiXtXtXpXjXpXtXpXjXiXrXpXiXpXpXjXaXtXiXpXjXtXpXaXpXiXiXjXaXhXpXjXpXjXpXjXjXpXjXtXjXpXjXpXpXjXjXpXaXhXpXhXiXp [...]
+"T R eXwXwXeX<XwX,X<XwX2XwXwX2XeX,XeXwXuXwXeXwXeX<XuXwXwXuXwXwXwXeXeXuXrXwXrXwXeX2X2X2XeXeXeXuXuXuXwXwXwXwX,XaXuXuXwXuXwXwXiXwX2XwXuXuX2XwXuXwXuXtXeXuXuXuXwX2XiXwXuXiXwXuXrXuXuXiXuXwXuX2XaXuX,XuXuX2XaXuXwXuXuXuXrXuXrXwXeXtXaXiXuXiXuXtXuXaXtXaXtXrXtXeXtXtXaXtXtXjXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXaXaXtXaXtXaXtXtXtXaXtXtXtXeXaXpXpXfXiXiXjXjXjXkXiXaXtXaXuXiXaXrXpXrXaXrXrXaXpXpXtXtXpXpXaXrXiXaXhXpXtXpXpXpXpXpXaXpXtXtXtXaXiXaXaXiXpXtXpXiXpXhXpXjXhXiXpXjXjXpXrXjXaXhXaXiXpXiXpXfXpXiXpXjXiXaXhXaXpXh [...]
+"T Y eXwX<XeXuX<X,XwX,XeX2XuXwXeXeXwXeX<X,XeXeXeXwXeX,XuXwXuXuXwX,X2XeXeXeX<XwXeXwX2XwXuXuX2XeXeXwXwXwXwXuXuXuXwXwXwXuX,XuXwXaX,XuXuXwX,XeXeXuXiXeXeXuXwXuX2XwXwXrXrXwXuX<XiXiXuXrXeXuXuXwX,XaXuXwXuXuXwXwXuXuXiXuXwXuXuXeXaXeXtXuXiXuXuXrXtXtXtXrXtXaXtXtXaXtXeXtXtXtXtXaXtXtXtXtXtXtXtXtXaXaXeXpXtXtXtXtXaXrXiXrXtXtXpXtXtXaXiXjXjXkXkXrXpXjXjXjXjXpXaXiXaXtXuXtXpXrXaXaXrXiXiXpXtXpXpXpXjXtXrXpXiXiXaXkXpXrXtXpXiXpXtXtXpXpXiXaXiXpXpXtXpXiXpXiXtXhXiXfXrXpXjXpXiXaXjXpXpXiXaXiXpXpXrXjXpXjXiXpXaXvXiXvXp [...]
+"T Y eX<XwX,XwXeXeX<X,XuX,XwXeX,XwXwXwXuXuXeXeXeX<XeXuXeX,XwXuX,X2XuXeXeXwX,XwXuXuXuXwXwXwXuXwXwXuXwXuXaX,XyX<XyXiXwXwXuXwX2XwXwX,XuXwXaXeXuXeX2XwXwXuXwXwXiXuXuXuXuX,XuXuXuXiXeXuXeXiXeXuXwXuXuXuXiXwXuXaXwXwX2XwXuXuXeXeXtXtXtXuXuXwXuXaXeXaXpXtXeXtXaXeXeXtXeXtXtXjXjXtXtXtXtXaXtXtXpXtXaXtXiXtXtXtXtXtXtXrXaXiXtXuXiXuXiXiXiXaXhXkXhXcXhXhXvXhXvXiXiXiXpXrXuXtXaXtXtXuXaXiXuXrXpXpXpXpXpXpXpXaXiXiXaXpXtXpXpXaXiXpXjXpXpXjXpXiXiXiXpXaXpXpXaXiXaXpXiXpXpXtXpXtXpXfXpXiXiXaXhXjXkXpXhXiXiXiXtXhXpXpXpXaXi [...]
+"T Q eXeXqXeX<XwXeXuX,XwX2XwXwXeXwXrXwXwXeXwXeXeXwXeX,X2X2XaX2XwXqXeXeXeXeXeXeXwXyX2XwXeXwXuXuXwXuXwXuX7XyX2XuXwX2XwXuXwX,X2XuXuXwXwXuXwXeX,XwXeXeXwXuXwXwXuXuXuXuX2XwXuXuXuXiXeXtXeXtXtXtXeXeXtXeXuXwXuXaXwXaXyXuXuXwXiXuXwXrXtXuXwXiX2XiXeXuXtXtXtXaXeXtXeXuXiXaXpXtXtXpXtXrXuXeXeXeXaXtXaXtXpXpXtXeXpXtXtXtXpXaXtXaXtXrXiXiXaXjXfXfXzXzXjXjXzXhXjXaXhXhXpXiXiXaXuXaXrXrXaXrXtXiXpXpXpXtXfXpXrXhXiXpXiXiXaXtXpXpXrXiXpXpXpXhXhXaXiXtXiXpXaXfXtXiXtXpXpXpXpXfXpXhXpXkXpXfXjXjXjXhXjXjXjXpXhXaXvXjXiXaXjXiXa [...]
+"Y T wXeXeXqXqXeXwXuXwX,XeXwX2XwXwXwXwXeXwXeXwXeXuXwXwX2XwX,XwXuXeXeXeXqXwXtXwXwXwX,XuXeXwXeXuX2X,XuXuX,XwXuXwXuXwXuXuX2XaXwXwXuXiXuXuXwXuXuXwXaXuX<X2XuXiXuXrXiXrXiXuXiXyXuXaXuXrXeXrXeXtXtXeXeXwXuX2XiXwXwXwXwXiXuXyXuXuXaXaXtXrXaXuXuXuXuXtXwXeXtXtXrXtXuXuXeXuXuXrXaXtXaXuXeXaXtXeXtXtXtXtXtXtXtXtXrXtXaXtXeXtXaXpXtXpXpXuXiXkXzXjXkXkXkXkXfXjXaXjXjXkXhXaXiXiXiXrXrXiXaXpXpXaXiXrXpXpXkXkXkXjXaXjXiXiXjXtXaXaXpXpXpXiXuXtXpXaXpXtXpXiXpXpXpXaXtXjXpXjXpXkXpXaXiXhXiXtXfXjXjXjXjXjXjXaXhXjXjXjXaXiXjXaXj [...]
+"( Y uX2XeX<XwXeXeXwXwXwXeXwX2XwX<XeXwXeX<XeXqXeX,X,XwXuXwXuXuX2XuX<XeX<XwXeXeXeXwXuXeXeXeXeXuXeXaXeXuX,XuX,X,XuXuXuXwX,XuXwXwX7XeXwXuXwXuXwXeXuXuXiXuXiXuXuXuXwXrXrXrXwXiXiXuXrXuXrXuXeXeXeXwXeXwXuXuXuXiXuXuXiXwXuX2XiXtXuXaXtXtXrXeXeXiXaXtXaXtXeXeXuXiXuXiXuXrXtXtXaXtXaXtXaXtXtXtXpXaXaXtXuXtXrXiXaXiXiXtXtXtXjXrXaXtXtXiXjXjXjXhXhXtXjXpXkXiXpXjXhXrXfXiXiXiXiXtXiXaXrXiXiXpXtXrXpXkXkXkXfXhXjXjXvXpXaXtXaXtXtXtXpXaXrXuXiXiXaXpXpXjXiXaXaXaXtXaXiXiXpXpXpXtXhXhXtXpXkXjXjXjXpXjXhXjXjXhXhXjXjXjXjXhXi [...]
+"T Y wX,X<XeX<XeX,XwXwXwX,XwX2XeX<XeX<XwXwXuXeX,XeX,XwXuXwXwX2XwX,XuXeXuXwXwXqXeX2XwXwXwXwXeXwXeXwXeXwXuXwX2XiXiXwXwXuXyXwXuXeXuXuXwXeXtX,XeXeXwXwXrXuXeXyXwXiXuXrXuXuXuXwXwXrXuXiXwXuXwXuXeXaXwXrXwXuXrXwXuXuXuXiXiXuX<XwXaXeXeXuXuXuXrXeXrXeXtXeXtXiXuXuX<XiXuXaXeXtXtXtXtXtXiXeXaXeXuXeXeXaXrXpXuXtXwXtXtXuXtXtXtXpXpXtXtXkXjXjXjXjXrXhXhXjXfXhXpXjXpXfXpXpXpXuXiXpXrXpXaXtXaXjXrXpXpXjXjXkXhXjXjXjXaXvXpXrXaXiXtXjXpXiXaXiXtXiXaXrXtXpXiXaXiXiXiXjXaXiXpXpXjXaXiXpXjXfXkXjXjXvXjXkXkXkXjXpXjXjXjXvXpXpXv [...]
+"T T wX,XwXwX<XeX<XwX,XwXwX2X<XwX<XeX<X<X2XwXwXuXuXuXeXwXuXuXwXwXuXwX<XeXeXtXeXwXwXwXwXwXeXwXuXwX,XeXwXuXuXiXeXwXrXeXaXrXuXeXwXuXuX<XuXwXwXeXeXuXuXwXuXiXwXrXwXrXuXuXrXrXtXeXrXrXtXuXuXwXuXwXuXwXwXtXpXrXeXuXuXrXrXuXuXwXuXuXaXtXuXeXrXtXaXrXuXeXuXrXtXeXeXuXiXuXtXeXiXrXeXtXrXeXuXeXwXaXeXaXuXtXiXaXtXaXrXuXrXtXtXtXpXpXpXpXpXjXpXjXjXiXiXpXvXiXpXpXjXpXjXpXtXpXaXeXpXaXtXpXpXtXpXfXpXrXhXjXpXkXhXpXjXjXjXiXiXaXaXrXaXjXpXpXaXtXrXtXaXtXpXpXpXtXaXtXrXfXpXpXpXiXtXfXpXpXkXzXzXjXjXjXzXjXjXjXfXdXkXjXjXhXpXk [...]
+"T T uX,XwXeXwX<XwX2X2X<XwX<XwXwXwXwXqXwX,XwX,X2XwXwXwX,X<XwXeX,XwX<XwXtXwXeXqXtX,X2XuXuXuX<XwXeXwXaXuXeXwXiXrXuXeXwXwXeXuXuXuX,XwXiXuXwXuXeXwXeXuXrXuXiXuXtXaXuXwXrXuXeXeXtXeXuXtXeXtXrXuXuXrXuXtXaXtXuXuXaXeXrXuXrXuXrXwXuXeXrXpXaXuXuXeXeXrXrXuXeXeXeXuXrXaXtXtXtXaXtXrXaXpXeXpXtXaXuXtXtXrXtXrXeXwXaXaXtXtXtXtXtXtXtXiXpXjXhXiXiXpXvXiXjXfXjXhXjXiXfXiXpXtXpXiXiXaXrXrXtXpXjXkXjXjXkXfXkXhXhXhXkXjXhXjXpXrXpXiXpXtXrXjXiXrXaXaXaXpXtXpXjXpXtXpXpXpXpXhXjXkXkXkXjXzXkXkXjXjXjXkXjXzXdXzXzXjXlXkXjXjXjXfXj [...]
+"T T eX,XwX<X<XwX,X2X<XeXeXeX2X,XeXeXeX<X<X,X,X,XwX,XeXwXtXqXwXtXeXtXeXeXtXtXqXeXeXwXwXuXeX,XwXeXwXeXwX,X,XuXeXwXwXwXeXiXuXrXuXwXwXrXtXrXeXrXwXtXtXtXtXrXrXtXuXrXeXtXrXuXwXwXeXtXeXtXaXeXuXwXuXtXeXaXeXuXtXtXtXtXrXuXiXuXuXiXuXtXpXrXrXuXeXeXuXuXrXwXtXtXeXtXtXtXtXtXtXaXtXrXuXrXtXrXeXiXrXtXrXaXuXuXiXaXaXtXaXrXtXtXtXrXiXiXaXaXpXhXhXpXaXhXtXjXjXjXjXpXtXaXpXjXhXtXrXrXpXiXfXfXkXkXjXjXjXkXzXjXhXzXfXkXkXpXhXjXhXiXiXiXjXiXiXiXpXiXaXrXpXrXjXjXpXtXjXjXjXjXzXjXjXzXzXzXzXzXzXfXjXzXjXzXzXjXjXjXkXkXfXjXhXp [...]
+"Q T eX2X<X,XwXuXwXuXwXwX,XeX,XwX<XwXwX,XeXeXuXwX,XwXuXwXwXtX<XwXwXwXeX<X<XtXtXqXeXwXwXwXuXtXwXwX,XwXwXeXuXeXtXwXwXuXwXwXwXwXuXrXeXwXwXtXtXtXeXrXwXwXaXeXrXrX0XuXrXtXwXrXtXtXqXeXiXtXwXuXeXwXiXeXuXtXrXeXwXtXwXaXuXuX<XuXwXwXuXrXeXtXuXaXwXiXwXuXtXeXaXtXpXtXeXaXtXrXuXtXtXtXtXaXaXrXiXiXuXiXiXuXrXiXiXwXrXtXtXaXjXpXpXpXpXiXjXjXhXkXjXhXjXhXhXiXpXiXhXtXfXjXkXpXhXjXrXpXfXjXkXjXzXkXjXhXfXkXfXhXkXjXjXjXrXhXjXjXpXhXiXaXiXaXiXaXjXpXjXjXpXfXpXtXjXjXtXkXzXjXjXjXjXkXzXzXlXlXzXzXcXfXzXjXzXkXkXkXrXkXjXjXhXh [...]
+"Q T wXqXqXwXwXwX7XwX,X,XwX,X2XwXwXwXwX,XuX2XwXwXwX,XwXwXwX<XeXwXwXuXwXiXwXuXeXwXeXeXeXeXeXtXwXeXwXwXwX<XuXuXuXrXeXuXwXuXuXwXeXrXuXrXyX2XuXwXtXeXtXwXwXtXeXtXeXrXtXtXwXwXtXwXwXtXeXeXqXtXtXeXtXeXtXtXtXtXeXtXtXeXuXwXwXiXuXwXuXwXeXeXrXiXrXuXwXuXuXuXtXaXtXrXeXaXtXtXtXtXpXpXtXtXrXiXaXaXpXiXiXeXiXaXiXtXrXiXpXjXpXfXpXpXjXfXjXjXzXvXkXrXkXtXiXvXiXiXpXtXhXjXjXjXpXhXfXfXjXkXzXzXzXzXjXjXkXjXkXkXjXkXfXjXkXzXfXjXjXiXjXiXiXaXpXjXtXtXhXjXjXiXpXjXpXjXfXlXzXhXhXkXkXkXlXzXlXjXlXjXjXfXzXjXkXzXjXzXkXkXhXjXjXj [...]
+"Q Q <X<XwX,XqXwXwXwX,XeXwXwXwXeXwXwXwXwXwX,XwXwXwXeXeXwXwX,X,XeXwXuXwXwXwXwXwXwXeXrXwXrXtXtXtXwXeXwXeXqXwX,XwXwXwXwXwXuXwXuXuXeXwXuXuXwXuXrXwXrXwXtXrXeXeXrXrXtXpXtXrXqXtXwXwXtXwXuXtXtXtXtXtXwXeXtXtXtXtXuXtXtXrXuXuXwXwX2XiX<XaXtXuXuXuXtXiXiXrXrXeXeXeXuXeXwXaXeXuXrXtXtXtXtXpXjXiXiXjXrXiXiXjXjXhXhXpXjXiXjXjXjXkXfXjXjXjXlXzXkXhXhXkXrXiXiXaXiXrXfXhXtXiXpXrXkXjXzXkXfXkXjXrXkXzXjXjXjXhXkXjXfXkXjXhXrXrXjXjXiXiXiXiXrXfXtXhXtXrXpXpXiXiXiXjXjXfXkXjXzXvXvXzXhXjXlXhXzXjXzXjXjXjXzXhXkXjXrXhXhXjXhXiXj [...]
+"T R <X,X,X2X,XeXwX2XwX,X,XwX,XwXtXqX<XwX2XwXwXeXwXeXwXwXwXwXuXuXeX,XwXwX2XwXeXeXwXwXwXtXwXwXtXwXtXwXeXtXwXwXwXwX,XuXwXwXwXuXeXeXwXuXuXuXrXrXeXuXwXtXuXrXrXrXwXtXrXwXtXtXqXtXtXqXrXtXwXtXtXtXtXtXuXaXrXtXeXwXeXpXuXuXuXiXiXeXuXiXrXuXiXeXrXtXtXtXtXtXtXeXeXeXtXwXuXtXeXrXtXeXtXpXjXjXhXhXrXkXpXiXjXjXrXkXjXjXjXjXkXfXrXjXjXjXjXlXzXhXjXhXhXtXiXiXhXhXjXfXpXhXjXhXhXkXkXjXkXzXjXjXjXkXhXhXlXkXkXvXhXkXjXzXjXjXrXkXjXjXiXvXiXtXpXtXhXtXjXjXhXjXjXiXjXjXjXhXkXzXlXlXzXkXlXjXzXdXhXkXjXzXjXzXkXjXpXiXfXjXjXaXiXi [...]
+"Q Y wX,X,XeX<X,XeXeX,X,X2XwX,X,XqXtXeX<XwXeXwX<XwXwXwXwXwXwXwXwXqXuX,XwXuX,XwXtXeXtXtXeXwXqXtXtXwXtXwXtXrXtX,XeXwXwXuXtXwXrXtXqXwXuXiXwXrXeXrXeXtXeXrXeXtXeXtXwXwXrXtXwXwXtXtXtXwXeXtXtXtXtXtXqXeXwXeXeXtXwXtXaXuXiXwX2XwXiXwXuXiXuXeXaXuXrXtXtXpXtXrXeXtXtXwXtXtXtXtXuXaXrXtXtXjXjXjXjXkXjXhXhXkXjXtXjXjXjXiXjXjXjXjXjXjXjXzXjXzXlXiXiXhXrXiXtXiXiXrXkXhXjXtXhXrXhXhXkXjXdXfXzXjXjXjXjXkXhXhXrXhXhXzXjXdXkXrXrXfXpXiXiXjXiXrXaXpXpXhXpXpXhXjXiXjXjXhXjXjXlXkXhXhXzXjXkXjXfXpXfXfXjXjXfXjXjXhXhXhXhXiXjXjXh [...]
+"G T wXwXeXqXwXeX,X<X,XuX,XeX,XeXwX<XeX<XwX2XeXwX,XwX2XwXwXwXwXeX,XwX,XwXwXtXwXwXtXrXwXuXeXeXuXwXeXuXuXuXwXrXwXwXiXiXiXwXtXpXtXtXtXtXtXtXqXtXtXwXrXeXeXwXtXwXwXrXwXrXwXwXtXtX0XtXwXtXwXwXwXrXwXtXwXeXeXtXtXtXtXeXwXtXtXrXeXiXwXrXeXaXuXrXtXtXtXrXeXpXtXwXwXeXtXtXtXtXtXtXtXtXaXpXjXpXiXjXjXiXjXjXjXjXjXkXfXjXjXkXjXjXhXhXrXkXlXlXzXkXiXvXiXiXtXtXuXiXtXhXdXkXrXkXjXjXzXjXkXkXjXfXrXdXrXkXfXlXrXzXjXvXhXhXrXkXrXrXfXtXrXjXpXpXtXpXhXjXvXjXjXhXjXrXzXjXlXjXkXrXkXkXjXfXjXrXkXhXkXhXjXjXpXkXhXhXjXhXkXhXjXpXjXh [...]
+"P T <X,XeXwX<XwX,X,X,X,X0X,XeXwXqX,XwXwX,XwX,XwXuXwXuXwXwXwXwXeXeX,XwXrXwXtXqXwXwXwXwXwXeX,XwX,XwXwX7XwXuXuXuXwXiXwXwXwXwXtXwXwXqXwXwXtXtXtXtXtXuXrXpXtXtXtXtXwXwXtXwXwXwXwXtXqXwXqXtXrXtXtXtXeXeXrXtXwXtXeXtXtXuXrXeXtXtXtXrXuXrXeXwXtXtXwXtXuXrXrXtXwXtXtXtXtXtXwXtXtXtXaXpXiXhXjXjXiXjXjXiXjXjXjXzXpXjXjXkXrXrXzXhXhXhXhXfXjXhXkXiXhXiXiXhXaXrXhXrXpXrXkXrXrXdXdXhXjXhXhXtXjXzXkXzXhXrXrXkXjXhXtXiXpXjXfXfXpXdXpXrXpXrXpXrXpXtXfXrXpXjXjXjXjXkXjXjXfXrXkXkXrXhXjXrXkXjXhXrXjXjXjXiXhXrXkXrXfXjXiXjXhXfXk [...]
+"Q T ,XwXqX<X,XuXwXwXwXqXwX,X2X,XeX,X,XqX,X<X,XeXtXqXqXwXwXtX7XuXeXwXwXwXwXeXwXeX<X<XqXtXeXwXeXeXwXwX2XiXwXwXwXiXiXwXwXwXwXtXtXwXtXtXtXwXtXtXtXwXrXwXrXrXtXtXrXwXtXrXqXwXqXtX0XrXwX0XwXtXtXqXtXwXtXtXuXwXeXrXeXtXrXuXeXtXrXtXpXuXaXeXtXtXtXtXtXtXtXrXeXtXtXaXtXtXaXtXuXeXtXpXjXjXvXaXjXiXjXpXjXjXfXjXkXjXpXhXfXjXjXjXjXrXkXkXzXzXjXhXiXiXiXiXiXiXiXiXiXjXjXrXhXkXjXjXkXhXrXrXpXvXfXkXkXhXvXhXjXdXfXkXrXjXtXdXfXrXtXjXfXrXtXfXjXjXjXkXjXkXkXhXkXzXjXkXfXrXrXkXjXjXjXzXzXfXhXpXhXiXhXtXhXhXrXhXjXhXiXjXaXiXkXl [...]
+"T T ,XuX<X,X,XwXwX,X<XwX,XwXwX0X,XwXwXqXwXwXwXeXwX<X,XwXwX,XwXwX,XwX,X,XwXeXwXeXeXwXtXqXwXwXwXrXwX,XwXwXwXwXwX<X2XwXuXuXwXtXwXeXwXwXwXtX0XqXtXwXrXuXwXwXuXwXuXrXwXwXrXrXqXwXtXtXqXtXtXqXtXwXwXtXwXtXrXtXrXuXeXiXuXuXtXrXeXtXrXtXrXtXwXrXtXpXrXtXtXtXpXtXtXtXeXtXiXrXwXiXtXpXpXhXpXjXjXhXhXiXjXjXhXiXfXjXhXjXhXrXrXhXjXjXfXhXhXzXlXdXtXiXiXiXhXiXiXiXfXhXrXkXrXrXhXrXrXkXrXkXiXvXhXhXhXlXiXkXjXjXhXrXhXrXrXtXpXpXpXtXpXrXtXtXtXjXrXjXhXhXrXrXkXrXhXkXrXkXjXiXiXhXhXrXhXkXjXhXpXiXdXfXhXtXjXkXhXtXhXaXhXiXhXh [...]
+"H T <X,XwX,X,X,X,X,X<XwXwX,XuXwXwXeXqX<XqX<XqXeXeXwXwXwX<X,XwXwXeX,X,X,XwX,XwXwXwXwXqXtXwXwXeXtXuXrXwXwXeXwXwXwXwXwXwXtXeXeXeXrXtXtXwXwXqXtXwXtXwXuXwXiXrXwXeXwXqXqXrXwXwXqXrXwXqXqXqXwXwXwXtXwXqXeXwXtXeXrXwXrXuXrXuXwXtXrXtXtXwXtXrXwXpXtXtXfXtXtXtXrXwXtXaXtXwXiXiXwXpXiXiXaXhXjXkXrXkXrXfXfXjXtXjXfXjXtXhXhXrXhXkXhXrXjXlXhXfXrXfXpXtXtXiXiXiXiXhXtXrXhXdXlXrXtXtXiXhXhXpXiXhXiXhXhXdXdXfXhXhXrXrXhXrXtXeXrXtXtXtXrXpXrXhXjXjXjXhXhXjXrXkXrXfXrXjXiXhXiXfXjXrXhXhXjXrXrXiXiXiXhXiXtXrXjXhXhXpXvXiXvXjXh [...]
+"Y T wX,XwX,XwXwX,X,X2X<XwXwXrXqXqXqXeXwXwXtXqXqXqX<X<XuX,XeX,XwXwXuXwXwX,XwXwXwXeXwXrXwXtXwXqXqXwXwXwXwXtXwXtXwXwXwXwXwXrXuXwXtXwXwX0XtXtXtXtXrXwXwXwX2XeXwXuXrXtXrXwXqXwXrX,XwXrXrXtXwXtXqXqXtXtXtXtXrXuXuXtXeXtXrXiXrXtXwXaXtXtXtXfXtXtXtXwXtXtXtXtXwXtXeXrXeXuXuXiXiXiXpXhXiXhXjXfXhXkXkXdXjXhXhXfXjXjXjXrXtXiXtXrXkXzXhXjXhXdXtXdXpXaXtXiXhXiXpXtXhXhXrXtXrXfXjXiXhXpXhXhXjXiXpXiXjXdXjXdXdXrXhXyXhXrXrXtXtXiXiXtXiXrXtXiXiXjXvXhXfXlXkXrXpXjXjXjXiXiXjXhXhXrXkXjXrXrXkXiXrXpXtXpXiXjXrXdXjXiXiXiXpXhXh [...]
+"Y T ,XwX,X,X,X,XwX,X,X,X<XuXqXqXwXeXqXqXeXtXqXwXqXqXqXwXwXeXwX2XwXwX,XwXwXwX,XwXwX0XwXwXwXqXwXqXwXwXuXrXwXeXwXtXrXuXwXwXuXwXwXwXwXwXwXwXwXtXtXwXwXwXwXwXwXtXwXwXwX0XwXwXwXwXrXqX0X0XwXtXtXwXwXtXtXtXrXqXrXeXtXtXtXtXtXtXuXrXtXrXpXpXrXrXpXtXtXwXwXtXuXrXwXrXuXrXuXrXiXiXjXhXfXfXjXjXhXkXhXrXjXhXhXkXhXhXkXrXhXhXiXaXiXhXfXrXhXtXrXrXtXtXrXrXrXiXrXhXiXyXrXrXiXiXiXiXiXhXhXiXhXhXiXhXpXtXpXtXrXiXrXrXrXtXeXrXaXrXrXrXtXiXiXiXiXiXtXhXjXhXfXfXiXhXjXiXhXjXjXhXhXtXhXhXrXhXfXiXiXiXiXhXhXhXhXtXfXpXaXvXiXiXpXi [...]
+"T H >XqX,XeX,X,XwXwXqXqXqX,X,XqXqXtXqXqXqXqXwXwXwXwXwXqX,XwXuX7XwXwXuX,XwXeXeX,XwXqXwXwXtXtXwXwX,XwXwXwXuXwXtXwXeXwXrXwXrXtXtXwXeXtXqXwXwXwXwXrXrXwXwXuXtXtXwXwXwXwXwXrXqXrXqXwXtXtXtXtXtXwXtXtXtXtXtXtXeXtXrXeXrXeXrXrXrXwXtXrXrXtXpXtXrXtXrXtXtXtXuXrXrXuXrXrXiXiXiXrXfXjXdXkXjXiXpXrXdXrXrXkXrXrXkXrXfXhXrXpXiXiXrXtXhXjXiXtXpXfXrXpXtXrXaXrXrXtXhXrXhXiXiXiXtXiXhXtXtXiXiXiXtXtXrXrXrXrXrXhXjXdXrXrXrXuXrXrXrXrXhXtXiXtXpXhXhXiXtXjXhXtXhXpXtXiXiXiXjXpXpXhXjXjXjXpXtXiXiXiXtXpXtXhXrXhXiXtXiXiXhXiXhXi [...]
+"Y T wXwX<X,X,X0XwXwXwXwXwX0XwX<XqXqXwXqXwXwXqXqXwXwX0XqX,XeX,X,XwX<XwX,XwXqXwXwXwXwXwXtXwXwXwX<X<X,XwXuXwXwXeXwXwXwXtXwXeXrXwXtXwXtXtXwXtXtXwXwXwXwXwXwXwXwXwX,XwXqXwXwXwXqXtXtXtXwXtXwXtXtXtXwXrXwXtXtXtXtXtXwXtXtXtXtXtXwXtXtXrXwXtXtXtXwXuXwXeXrXtXtXiXrXrXiXtXiXhXhXrXhXrXhXhXiXpXiXfXtXpXtXkXrXrXkXrXrXrXtXtXtXiXiXhXiXiXrXrXtXtXrXrXtXtXtXpXtXiXtXiXrXrXrXiXiXiXiXiXiXiXtXrXrXrXpXrXrXiXuXiXwXrXuXrXeXtXtXtXrXiXtXiXiXiXiXhXhXiXiXiXhXiXhXhXrXrXhXjXhXtXhXiXtXhXiXiXiXiXiXiXyXiXrXiXiXiXrXhXtXiXiXtXi [...]
+"Y Q >X=X,X,X,XqXuXwXqXwXwXwXwXqX0XwXwXrXwXtXwXwXwXrXwXwX,XwX,X0XwX,XwX0XqXwXtXwXeXwXwXwXwXwX0XwXwX0XwXtXwXwXwXwXwXwXwXwXuXeXwXwXtXwXqX0XwXwXwXwXwXwXtXwXtX<XwX,XqXtXwXwXqXtXqXqXqXrXtXrXtXtXwXwXqXtXwXfXtXwXtXtXrXwXtXwXwXtXtXpXtXtXtXwXwXtXrXtXrXwXuXtXrXuXiXrXiXtXhXhXrXdXhXtXjXtXiXiXrXrXpXrXfXtXhXrXpXiXhXhXiXhXhXiXtXtXiXiXrXiXrXrXtXrXrXiXtXrXiXiXrXrXrXtXrXiXhXrXiXiXhXiXtXrXrXrXrXtXeXrXtXrXrXrXwXtXtXrXjXrXtXpXiXiXrXaXrXtXpXtXtXiXiXpXiXhXrXtXtXiXhXpXhXhXiXtXiXiXiXiXiXrXiXrXtXiXiXhXhXtXiXhXiXi [...]
+"Y Y Y R R P T Y Y W W P W P P Y G Q T P Q Q G Q W P P Q P W Q T T Q T W P W T Y Q Q T Q W T Q T Q Y P T P P T W Q Q P Q Y W Y Q I T Q Q T P Q Y W Y T W W P T T W T Q T T Q ! Y Q Q P Q I Q Q W Q Q W Q P Q Q Y P Q Q W W Q Q Q Q P Q W Q W W W W W T P Q W T Q W Q Q Q / P / ! W ! W W W W W Q Y W W ( W W ! ( W ( W W W W Q W Y W W W W W Y W Y W ! ( W W W W W T ! ( Q W T ( W ( Q ( P W T W W W W W W Q W W ! W W W W Q W ( ( / Q W ( W W W / W W Q ! ! ! P ( ! ( / ( T W W W W Q ! W W W ! W W W ! ! W [...]
+"T Y T Y R T T Y W P Y Q Q T Q T T Q T T Y T Y P T Q T Q Y T P T W T W T T T Y Y P T P T T T Q P Y W T W W T W T T P Y W W T W T P T H Q Q T Q P T W W P Q W W W Q P Q Y W T P T T Q Q Q / Q P Q P Q Q I Q T Q Q T Q Q Q W W Q W Q T W Q Y W T Q Q W ( / W W Q ( Q W W W W / T W ( Y W W W W Q W Q W W / Q Q W P W W W W W Q W W ! Y W T W T W W Q Q W W W W W W W ! Q T W W W W T ! Q W Q Q Q W ( W T Q ! ( ! ( W Q W Q Q W T ! W W ! ! ! ! W ! W ( ! W / W ! / P ! W W W W W ( W ( W W W W W W ! W W W ! W [...]
+};
diff --git a/src/hawkeye/icons/fontdecrease.xpm b/src/hawkeye/icons/fontdecrease.xpm
new file mode 100644
index 0000000..64a8c94
--- /dev/null
+++ b/src/hawkeye/icons/fontdecrease.xpm
@@ -0,0 +1,23 @@
+/* XPM */
+static const char * fontdecrease_xpm[] = {
+"18 18 2 1",
+" c None",
+". c #000000",
+" ",
+" ",
+" ",
+" ",
+" .. ..",
+" .. ..",
+" ... ",
+" .... ",
+" . .. ",
+" . .. ",
+" . .. ",
+" . ... ",
+" .. ... ",
+" ........ ",
+" . .. ",
+" . .. ",
+" . ... ",
+" ... ... "};
diff --git a/src/hawkeye/icons/fontincrease.xpm b/src/hawkeye/icons/fontincrease.xpm
new file mode 100644
index 0000000..508beca
--- /dev/null
+++ b/src/hawkeye/icons/fontincrease.xpm
@@ -0,0 +1,23 @@
+/* XPM */
+static const char * fontincrease_xpm[] = {
+"18 18 2 1",
+" c None",
+". c #000000",
+" ",
+" ",
+" . ",
+" .. . ",
+" .. ..... ",
+" ... . ",
+" .... . ",
+" . .. ",
+" . .. ",
+" . .. ",
+" . ... ",
+" .. ... ",
+" ........ ",
+" . .. ",
+" . .. ",
+" . ... ",
+" ... ... ",
+" ..... ..... "};
diff --git a/src/hawkeye/icons/pointer_tool.xpm b/src/hawkeye/icons/pointer_tool.xpm
new file mode 100644
index 0000000..97d59cb
--- /dev/null
+++ b/src/hawkeye/icons/pointer_tool.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static const char *pointer_tool[]={
+"16 16 2 1",
+". c None",
+"# c #000000",
+".....#..........",
+".....##.........",
+".....###........",
+".....####.......",
+".....#####......",
+".....######.....",
+".....#######....",
+".....########...",
+".....#########..",
+".....#####......",
+".....##.###.....",
+".....#..###.....",
+".........###....",
+".........###....",
+"..........###...",
+"..........###..."};
diff --git a/src/hawkeye/icons/rangearrow_down.png b/src/hawkeye/icons/rangearrow_down.png
new file mode 100644
index 0000000..103f999
Binary files /dev/null and b/src/hawkeye/icons/rangearrow_down.png differ
diff --git a/src/hawkeye/icons/rangearrow_down.xpm b/src/hawkeye/icons/rangearrow_down.xpm
new file mode 100644
index 0000000..1317d40
--- /dev/null
+++ b/src/hawkeye/icons/rangearrow_down.xpm
@@ -0,0 +1,47 @@
+/* XPM */
+static const char *rangearrow_down[] = {
+/* columns rows colors chars-per-pixel */
+"15 15 26 1",
+" c #222222",
+". c #232323",
+"X c #504F4E",
+"o c #5D5C5B",
+"O c #62615F",
+"+ c #636260",
+"@ c #767472",
+"# c #787775",
+"$ c #837867",
+"% c #837968",
+"& c #8A806F",
+"* c #DFDCD7",
+"= c #E0DDD9",
+"- c #E7E2DA",
+"; c #E6E2DC",
+": c #E8E3DB",
+"> c #E9E5DF",
+", c #EAE5DD",
+"< c #E9E6E1",
+"1 c #EBE7E0",
+"2 c #EDE9E3",
+"3 c #EFEBE5",
+"4 c #EEEBE6",
+"5 c #F1EDE8",
+"6 c #F1EEE9",
+"7 c #F2EFEA",
+/* pixels */
+"$$$$$$$$$$$$$$$",
+"$77777777311,:$",
+"$77777773321,:$",
+"$77777777321,:$",
+"$77777777221,:$",
+"$77777777321,-$",
+"$777# @1,:$",
+"$7774+ O>>,-$",
+"$7777>X X-2>,:$",
+"$77777=o=321,-$",
+"$77777777321,:$",
+"$77777777321,:$",
+"$77777773321,:$",
+"$7777777732,,:%",
+"%%%%%%%$$$$$$$$"
+};
diff --git a/src/hawkeye/icons/rangearrow_left.png b/src/hawkeye/icons/rangearrow_left.png
new file mode 100644
index 0000000..c041204
Binary files /dev/null and b/src/hawkeye/icons/rangearrow_left.png differ
diff --git a/src/hawkeye/icons/rangearrow_left.xpm b/src/hawkeye/icons/rangearrow_left.xpm
new file mode 100644
index 0000000..ce9a4b9
--- /dev/null
+++ b/src/hawkeye/icons/rangearrow_left.xpm
@@ -0,0 +1,47 @@
+/* XPM */
+static const char *rangearrow_left[] = {
+/* columns rows colors chars-per-pixel */
+"15 15 26 1",
+" c #222222",
+". c #232323",
+"X c #504F4E",
+"o c #5D5C5B",
+"O c #62615F",
+"+ c #636260",
+"@ c #767472",
+"# c #787775",
+"$ c #837867",
+"% c #837968",
+"& c #8A806F",
+"* c #DFDCD7",
+"= c #E0DDD9",
+"- c #E7E2DA",
+"; c #E6E2DC",
+": c #E8E3DB",
+"> c #E9E5DF",
+", c #EAE5DD",
+"< c #E9E6E1",
+"1 c #EBE7E0",
+"2 c #EDE9E3",
+"3 c #EFEBE5",
+"4 c #EEEBE6",
+"5 c #F1EDE8",
+"6 c #F1EEE9",
+"7 c #F2EFEA",
+/* pixels */
+"&%$$$$$$$$$$$$$",
+"%7777777775777$",
+"$7777777777777$",
+"$7777777777777$",
+"$7777744#77777$",
+"$77777<O.77777$",
+"$7777*X..77777$",
+"$7777o...77777$",
+"$7557*X..37373$",
+"$43433-O.43433$",
+"$222222, at 22222$",
+"$11,111<111111$",
+"$,,,,,,,,,:,,,$",
+"$::::-:-:::-::$",
+"$%$$$$$$$$$$$$$"
+};
diff --git a/src/hawkeye/icons/rangearrow_right.png b/src/hawkeye/icons/rangearrow_right.png
new file mode 100644
index 0000000..7d0073d
Binary files /dev/null and b/src/hawkeye/icons/rangearrow_right.png differ
diff --git a/src/hawkeye/icons/rangearrow_right.xpm b/src/hawkeye/icons/rangearrow_right.xpm
new file mode 100644
index 0000000..e131a71
--- /dev/null
+++ b/src/hawkeye/icons/rangearrow_right.xpm
@@ -0,0 +1,47 @@
+/* XPM */
+static const char *rangearrow_right[] = {
+/* columns rows colors chars-per-pixel */
+"15 15 26 1",
+" c #222222",
+". c #232323",
+"X c #504F4E",
+"o c #5D5C5B",
+"O c #62615F",
+"+ c #636260",
+"@ c #767472",
+"# c #787775",
+"$ c #837867",
+"% c #837968",
+"& c #8A806F",
+"* c #DFDCD7",
+"= c #E0DDD9",
+"- c #E7E2DA",
+"; c #E6E2DC",
+": c #E8E3DB",
+"> c #E9E5DF",
+", c #EAE5DD",
+"< c #E9E6E1",
+"1 c #EBE7E0",
+"2 c #EDE9E3",
+"3 c #EFEBE5",
+"4 c #EEEBE6",
+"5 c #F1EDE8",
+"6 c #F1EEE9",
+"7 c #F2EFEA",
+/* pixels */
+"$$$$$$$$$$$$$$%",
+"$7777777777777$",
+"$7777777777777$",
+"$7777777777777$",
+"$77777 at 4777777$",
+"$77777.+>77777$",
+"$77777..X=7777$",
+"$77777...o7777$",
+"$37337. X*3737$",
+"$43444.O-43334$",
+"$22242@>222222$",
+"$,2>1,2,,2>,2>$",
+"$,,,,,,,,,,,,,$",
+"$::::-:-::::::$",
+"$$$$$$$$$$$$$$$"
+};
diff --git a/src/hawkeye/icons/rangearrow_up.png b/src/hawkeye/icons/rangearrow_up.png
new file mode 100644
index 0000000..94b862a
Binary files /dev/null and b/src/hawkeye/icons/rangearrow_up.png differ
diff --git a/src/hawkeye/icons/rangearrow_up.xpm b/src/hawkeye/icons/rangearrow_up.xpm
new file mode 100644
index 0000000..905117f
--- /dev/null
+++ b/src/hawkeye/icons/rangearrow_up.xpm
@@ -0,0 +1,47 @@
+/* XPM */
+static const char *rangearrow_up[] = {
+/* columns rows colors chars-per-pixel */
+"15 15 26 1",
+" c #222222",
+". c #232323",
+"X c #504F4E",
+"o c #5D5C5B",
+"O c #62615F",
+"+ c #636260",
+"@ c #767472",
+"# c #787775",
+"$ c #837867",
+"% c #837968",
+"& c #8A806F",
+"* c #DFDCD7",
+"= c #E0DDD9",
+"- c #E7E2DA",
+"; c #E6E2DC",
+": c #E8E3DB",
+"> c #E9E5DF",
+", c #EAE5DD",
+"< c #E9E6E1",
+"1 c #EBE7E0",
+"2 c #EDE9E3",
+"3 c #EFEBE5",
+"4 c #EEEBE6",
+"5 c #F1EDE8",
+"6 c #F1EEE9",
+"7 c #F2EFEA",
+/* pixels */
+"&%$$$$$$$$$$$$$",
+"%7777777732>,:$",
+"$7777777332,,:$",
+"$77777777322,:$",
+"$7777777742>,:$",
+"$77777*o*32,,-$",
+"$7777<X.X-2,,:$",
+"$7774O...O>>,-$",
+"$477 at .....@>,:$",
+"$7777777442>,:$",
+"$77777777322,:$",
+"$7777777332,,:$",
+"$7777777732>,>$",
+"$7777777732,,:$",
+"$$$$$$$$$$$$$$$"
+};
diff --git a/src/hawkeye/icons/rangebar_horiz.png b/src/hawkeye/icons/rangebar_horiz.png
new file mode 100644
index 0000000..a98002a
Binary files /dev/null and b/src/hawkeye/icons/rangebar_horiz.png differ
diff --git a/src/hawkeye/icons/rangebar_horiz.xpm b/src/hawkeye/icons/rangebar_horiz.xpm
new file mode 100644
index 0000000..5cf3da0
--- /dev/null
+++ b/src/hawkeye/icons/rangebar_horiz.xpm
@@ -0,0 +1,37 @@
+/* XPM */
+static const char *rangebar_horiz[] = {
+/* columns rows colors chars-per-pixel */
+"15 15 16 1",
+" c #517191",
+". c #517192",
+"X c #527293",
+"o c #527294",
+"O c #537394",
+"+ c #537395",
+"@ c #55799F",
+"# c #557BA1",
+"$ c #567CA2",
+"% c #567DA4",
+"& c #577FA6",
+"* c #577FA7",
+"= c #648BB3",
+"- c #658AB2",
+"; c #658BB3",
+": c #837867",
+/* pixels */
+":::::::::::::::",
+"--=-=-=-=-=-=-=",
+"&&&&**&***&&***",
+"&$&$&$$&&$$$$$&",
+"$$$$$$$$$$$$$$$",
+"##@@$$@@$@$@##$",
+"@@@@@@@@@@@@@@#",
+".. ..... ....",
+"....XXX........",
+"XXXXXXXXXXXXXXX",
+"XXXXXXXX+XXXXX+",
+"+++++++++++X+++",
+"++X++++++X+++++",
+"====-;-;======-",
+":::::::::::::::"
+};
diff --git a/src/hawkeye/icons/rangebar_vert.png b/src/hawkeye/icons/rangebar_vert.png
new file mode 100644
index 0000000..ba9e1e2
Binary files /dev/null and b/src/hawkeye/icons/rangebar_vert.png differ
diff --git a/src/hawkeye/icons/rangebar_vert.xpm b/src/hawkeye/icons/rangebar_vert.xpm
new file mode 100644
index 0000000..aad2a16
--- /dev/null
+++ b/src/hawkeye/icons/rangebar_vert.xpm
@@ -0,0 +1,37 @@
+/* XPM */
+static const char *rangebar_vert[] = {
+/* columns rows colors chars-per-pixel */
+"15 15 16 1",
+" c #517191",
+". c #517192",
+"X c #527293",
+"o c #527294",
+"O c #537394",
+"+ c #537395",
+"@ c #55799F",
+"# c #557BA1",
+"$ c #567CA2",
+"% c #567DA4",
+"& c #577FA6",
+"* c #577FA7",
+"= c #648BB3",
+"- c #658AB2",
+"; c #658BB3",
+": c #837867",
+/* pixels */
+":;&&$@@ .XoOO=:",
+":;*$$$@ .XooO=:",
+":;&$&@@ .ooOO-:",
+":;&&$@@ oooOO=:",
+":=&%$@@..XoOO;:",
+":=&%$@@..XooO;:",
+":=&%$#@..XoOO;:",
+":;&&$#@.XooOO;:",
+":;&$$#@..oooO;:",
+":;&&$#@..oooO;:",
+":=&$$@@ Xooo+;:",
+":=*$$@@ Xoo++=:",
+":=&$$$@ XXoo+;:",
+":;*$$$@ .Xooo=:",
+":;&$$$@ .Xoo+=:"
+};
diff --git a/src/hawkeye/icons/rangegrip_down.png b/src/hawkeye/icons/rangegrip_down.png
new file mode 100644
index 0000000..a8a4cde
Binary files /dev/null and b/src/hawkeye/icons/rangegrip_down.png differ
diff --git a/src/hawkeye/icons/rangegrip_down.xpm b/src/hawkeye/icons/rangegrip_down.xpm
new file mode 100644
index 0000000..584692f
--- /dev/null
+++ b/src/hawkeye/icons/rangegrip_down.xpm
@@ -0,0 +1,25 @@
+/* XPM */
+static const char *rangegrip_down[] = {
+/* columns rows colors chars-per-pixel */
+"15 5 14 1",
+" c #517192",
+". c #527293",
+"X c #527294",
+"o c #537395",
+"O c #55799F",
+"+ c #557BA1",
+"@ c #567CA2",
+"# c #567DA4",
+"$ c #577FA6",
+"% c #648BB3",
+"& c #658AB2",
+"* c #658BB3",
+"= c #79A6D6",
+"- c #837867",
+/* pixels */
+"-*$@@@O= XXXX*-",
+"-*$$@@=== XXo*-",
+"-*$@@=====XXo*-",
+"-***=======&**-",
+"---------------"
+};
diff --git a/src/hawkeye/icons/rangegrip_left.png b/src/hawkeye/icons/rangegrip_left.png
new file mode 100644
index 0000000..536013c
Binary files /dev/null and b/src/hawkeye/icons/rangegrip_left.png differ
diff --git a/src/hawkeye/icons/rangegrip_left.xpm b/src/hawkeye/icons/rangegrip_left.xpm
new file mode 100644
index 0000000..23b7020
--- /dev/null
+++ b/src/hawkeye/icons/rangegrip_left.xpm
@@ -0,0 +1,35 @@
+/* XPM */
+static const char *rangegrip_left[] = {
+/* columns rows colors chars-per-pixel */
+"5 15 14 1",
+" c #517192",
+". c #527293",
+"X c #527294",
+"o c #537395",
+"O c #55799F",
+"+ c #557BA1",
+"@ c #567CA2",
+"# c #567DA4",
+"$ c #577FA6",
+"% c #648BB3",
+"& c #658AB2",
+"* c #658BB3",
+"= c #79A6D6",
+"- c #837867",
+/* pixels */
+"-----",
+"-&*&*",
+"-*$$$",
+"-&###",
+"-=@@@",
+"-==+@",
+"-===O",
+"-====",
+"-===.",
+"-==.X",
+"-=XXX",
+"-*XXo",
+"-*ooo",
+"-*&*&",
+"-----"
+};
diff --git a/src/hawkeye/icons/rangegrip_right.png b/src/hawkeye/icons/rangegrip_right.png
new file mode 100644
index 0000000..9105a2f
Binary files /dev/null and b/src/hawkeye/icons/rangegrip_right.png differ
diff --git a/src/hawkeye/icons/rangegrip_right.xpm b/src/hawkeye/icons/rangegrip_right.xpm
new file mode 100644
index 0000000..e0a0dae
--- /dev/null
+++ b/src/hawkeye/icons/rangegrip_right.xpm
@@ -0,0 +1,35 @@
+/* XPM */
+static const char *rangegrip_right[] = {
+/* columns rows colors chars-per-pixel */
+"5 15 14 1",
+" c #517192",
+". c #527293",
+"X c #527294",
+"o c #537395",
+"O c #55799F",
+"+ c #557BA1",
+"@ c #567CA2",
+"# c #567DA4",
+"$ c #577FA6",
+"% c #648BB3",
+"& c #658AB2",
+"* c #658BB3",
+"= c #79A6D6",
+"- c #837867",
+/* pixels */
+"-----",
+"&&*&-",
+"$$$*-",
+"###*-",
+"@@@=-",
+"+@==-",
+"O===-",
+"====-",
+" ===-",
+" .==-",
+"...=-",
+"oo.*-",
+"oo.*-",
+"****-",
+"-----"
+};
diff --git a/src/hawkeye/icons/rangegrip_up.png b/src/hawkeye/icons/rangegrip_up.png
new file mode 100644
index 0000000..77a08a6
Binary files /dev/null and b/src/hawkeye/icons/rangegrip_up.png differ
diff --git a/src/hawkeye/icons/rangegrip_up.xpm b/src/hawkeye/icons/rangegrip_up.xpm
new file mode 100644
index 0000000..acdd0df
--- /dev/null
+++ b/src/hawkeye/icons/rangegrip_up.xpm
@@ -0,0 +1,25 @@
+/* XPM */
+static const char *rangegrip_up[] = {
+/* columns rows colors chars-per-pixel */
+"15 5 14 1",
+" c #517192",
+". c #527293",
+"X c #527294",
+"o c #537395",
+"O c #55799F",
+"+ c #557BA1",
+"@ c #567CA2",
+"# c #567DA4",
+"$ c #577FA6",
+"% c #648BB3",
+"& c #658AB2",
+"* c #658BB3",
+"= c #79A6D6",
+"- c #837867",
+/* pixels */
+"---------------",
+"-&**=======%%%-",
+"-&$#+=====XXX&-",
+"-&$#++===XXXX*-",
+"-&&##+O= &-"
+};
diff --git a/src/hawkeye/icons/rangegroove_horiz.png b/src/hawkeye/icons/rangegroove_horiz.png
new file mode 100644
index 0000000..1ca098a
Binary files /dev/null and b/src/hawkeye/icons/rangegroove_horiz.png differ
diff --git a/src/hawkeye/icons/rangegroove_horiz.xpm b/src/hawkeye/icons/rangegroove_horiz.xpm
new file mode 100644
index 0000000..ed3cda7
--- /dev/null
+++ b/src/hawkeye/icons/rangegroove_horiz.xpm
@@ -0,0 +1,29 @@
+/* XPM */
+static const char *rangegroove_horiz[] = {
+/* columns rows colors chars-per-pixel */
+"15 15 8 1",
+" c #837968",
+". c #C7BEB1",
+"X c #CCC3B6",
+"o c #D1C8BA",
+"O c #D2C9BB",
+"+ c #D6CEC1",
+"@ c #DBD3C7",
+"# c #DCD4C8",
+/* pixels */
+" ",
+".........X.....",
+"XXXXXXXXXXXXXXX",
+"OOOOOoOoOOOOOXO",
+"++++O+++++++++O",
+"###############",
+"###############",
+"###############",
+"###############",
+"###############",
+"###############",
+"###############",
+"###############",
+"######@#@#@#@#@",
+" "
+};
diff --git a/src/hawkeye/icons/rangegroove_vert.png b/src/hawkeye/icons/rangegroove_vert.png
new file mode 100644
index 0000000..0913903
Binary files /dev/null and b/src/hawkeye/icons/rangegroove_vert.png differ
diff --git a/src/hawkeye/icons/rangegroove_vert.xpm b/src/hawkeye/icons/rangegroove_vert.xpm
new file mode 100644
index 0000000..9448a7c
--- /dev/null
+++ b/src/hawkeye/icons/rangegroove_vert.xpm
@@ -0,0 +1,29 @@
+/* XPM */
+static const char *rangegroove_vert[] = {
+/* columns rows colors chars-per-pixel */
+"15 15 8 1",
+" c #837968",
+". c #C7BEB1",
+"X c #CCC3B6",
+"o c #D1C8BA",
+"O c #D2C9BB",
+"+ c #D6CEC1",
+"@ c #DBD3C7",
+"# c #DCD4C8",
+/* pixels */
+" .XO+########@ ",
+" .Xo+######### ",
+" .Xo+########@ ",
+" .Xo+######### ",
+" .XO+########@ ",
+" .Xo+######### ",
+" .XO+########@ ",
+" .Xo+######### ",
+" .XO+########@ ",
+" .Xo+######### ",
+" .XO+########@ ",
+" .Xo+######### ",
+" .XO+######### ",
+" .Xo+######### ",
+" .XO+########@ "
+};
diff --git a/src/hawkeye/icons/zoom_in.xpm b/src/hawkeye/icons/zoom_in.xpm
new file mode 100644
index 0000000..f005455
--- /dev/null
+++ b/src/hawkeye/icons/zoom_in.xpm
@@ -0,0 +1,22 @@
+/* XPM */
+static const char *zoom_in[]={
+"16 16 3 1",
+". c None",
+"# c #000000",
+"a c #ffffff",
+"....####........",
+"..##aaaa##......",
+".#aaaaaaaa#.....",
+".#aaa##aaa#.....",
+"#aaaa##aaaa#....",
+"#aa######aa#....",
+"#aa######aa#....",
+"#aaaa##aaaa#....",
+".#aaa##aaa#.....",
+".#aaaaaaaa#.....",
+"..##aaaa###.....",
+"....####.###....",
+"..........###...",
+"...........###..",
+"............##..",
+"................"};
diff --git a/src/hawkeye/icons/zoom_out.xpm b/src/hawkeye/icons/zoom_out.xpm
new file mode 100644
index 0000000..dcbdb0a
--- /dev/null
+++ b/src/hawkeye/icons/zoom_out.xpm
@@ -0,0 +1,22 @@
+/* XPM */
+static const char *zoom_out[]={
+"16 16 3 1",
+". c None",
+"# c #000000",
+"a c #ffffff",
+".....####.......",
+"...##aaaa##.....",
+"..#aaaaaaaa#....",
+"..#aaaaaaaa#....",
+".#aaaaaaaaaa#...",
+".#aa######aa#...",
+".#aa######aa#...",
+".#aaaaaaaaaa#...",
+"..#aaaaaaaa#....",
+"..#aaaaaaaa#....",
+"...##aaaa###....",
+".....####.###...",
+"...........###..",
+"............###.",
+".............##.",
+"................"};
diff --git a/src/hawkeye/main.cc b/src/hawkeye/main.cc
new file mode 100644
index 0000000..bd04d02
--- /dev/null
+++ b/src/hawkeye/main.cc
@@ -0,0 +1,145 @@
+#include <iostream>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QtGui>
+
+#include "LaunchPad.hh"
+#include "InsertWindow.hh"
+#include "icons/AAI.xpm"
+#include "icons/Hawkeye.xpm"
+#include <qcursor.h>
+
+#include "foundation_AMOS.hh"
+
+#include "config.h"
+
+#ifdef HAVE_QT_333
+#include <qsplashscreen.h>
+#else
+#include "SplashScreen.hh"
+#endif
+
+using namespace std;
+
+int main( int argc, char **argv )
+{
+ try
+ {
+ for (int i = 0; i < argc; i++)
+ {
+ if (!strcmp(argv[i], "-h"))
+ {
+ cerr << "Usage: hawkeye [options] [bankname [contigid [position]]]" << endl;
+ cerr << "Options:" << endl
+ << " -c <path> Add a chromatogram path" << endl
+ << " -D <DB> Set the chromatogram DB" << endl
+ << " -T Enable Trace Fetch cmd" << endl
+ << " -p <port> Initialize Server on this port" << endl
+ << " -K <kmer> Load File of kmers" << endl
+ << " -h Display this help" << endl;
+
+ exit (1);
+ }
+ }
+
+ QApplication a( argc, argv );
+
+
+ QPixmap pixmap((const char **)Hawkeye_xpm);
+
+ int texttop =210;
+ int textleft = 160;
+ QPainter p (&pixmap);
+
+ p.drawText(textleft, texttop, 200, 48,
+ Qt::AlignLeft | Qt::AlignBottom,
+ PACKAGE_STRING);
+
+ if (a.argc() > 1)
+ {
+ p.drawText(textleft, texttop+20, 200, 48,
+ Qt::AlignLeft | Qt::AlignBottom,
+ "Loading assembly...");
+ }
+ p.end();
+
+#ifdef HAVE_QT_333
+ QSplashScreen * splash = new QSplashScreen(pixmap);
+ splash->show();
+#else
+ SplashScreen * splash = new SplashScreen(pixmap);
+#endif
+
+ splash->setCursor(Qt::waitCursor);
+
+ LaunchPad w(NULL, "launchpad");
+ a.setMainWidget( &w );
+
+
+ int state = 0;
+
+ for (int i = 1; i < a.argc(); i++)
+ {
+ string v = a.argv()[i];
+
+ if (v == "-c" && i+1 < a.argc())
+ {
+ i++; v = a.argv()[i];
+ w.addChromoPath(QString(v.c_str()));
+ }
+ else if (v == "-p" && i+1 < a.argc())
+ {
+ i++; v = a.argv()[i];
+ int port = atoi(v.c_str());
+ w.initializeSimpleServer(port);
+ }
+ else if (v == "-D" && i+1 < a.argc())
+ {
+ i++; v = a.argv()[i];
+ w.setChromoDB(QString(v.c_str()));
+ }
+ else if (v == "-K" && i+1 < a.argc())
+ {
+ i++; v = a.argv()[i];
+ w.loadKmers(v);
+ }
+ else if (v == "-T")
+ {
+ w.enableTraceFetch(true);
+ }
+ else if (v[0] == '-')
+ {
+ cerr << "Option " << v << " not understood, ignoring" << endl;
+ }
+ else
+ {
+ switch (state)
+ {
+ case 0: w.setBankname(v); break;
+ case 1: w.setContigId(atoi(v.c_str())); break;
+ case 2: w.setGindex(atoi(v.c_str())); break;
+ default: cerr << "Value " << v << " not understood, ignoring" << endl;
+ };
+
+ state++;
+ }
+ }
+
+ splash->finish(&w);
+ delete splash;
+ w.show();
+ w.initDisplay();
+
+ return a.exec();
+ }
+ catch (AMOS::Exception_t & e)
+ {
+ cerr << "ERROR: " << e << endl;
+ }
+ catch (...)
+ {
+ cerr << "Unexpected error" << endl;
+ }
+
+ return 1;
+}
diff --git a/test/minimus/influenza-A/influenza-A.afg b/test/minimus/influenza-A/influenza-A.afg
new file mode 100644
index 0000000..0d2440b
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-A.afg
@@ -0,0 +1,6002 @@
+{UNV
+iid:1
+com:
+Generated by dsommer with tarchive2amos on Fri Dec 1 11:57:40 2006
+.
+}
+{LIB
+iid:80
+eid:1099575910886
+{DST
+mea:823
+std:246
+}
+}
+{LIB
+iid:81
+eid:1099575910538
+{DST
+mea:383
+std:114
+}
+}
+{LIB
+iid:82
+eid:1099575910572
+{DST
+mea:460
+std:138
+}
+}
+{LIB
+iid:83
+eid:1099575910461
+{DST
+mea:659
+std:197
+}
+}
+{LIB
+iid:84
+eid:1099575910431
+{DST
+mea:568
+std:170
+}
+}
+{LIB
+iid:85
+eid:1099575910620
+{DST
+mea:574
+std:172
+}
+}
+{LIB
+iid:86
+eid:1099575910631
+{DST
+mea:559
+std:167
+}
+}
+{LIB
+iid:87
+eid:1099575910960
+{DST
+mea:822
+std:246
+}
+}
+{LIB
+iid:88
+eid:1099575910951
+{DST
+mea:875
+std:262
+}
+}
+{LIB
+iid:89
+eid:1099575910532
+{DST
+mea:568
+std:170
+}
+}
+{LIB
+iid:90
+eid:1099575910865
+{DST
+mea:771
+std:231
+}
+}
+{LIB
+iid:91
+eid:1099575910482
+{DST
+mea:429
+std:128
+}
+}
+{LIB
+iid:92
+eid:1099575910511
+{DST
+mea:619
+std:185
+}
+}
+{LIB
+iid:93
+eid:1099575910954
+{DST
+mea:810
+std:243
+}
+}
+{LIB
+iid:94
+eid:1099575910578
+{DST
+mea:523
+std:156
+}
+}
+{LIB
+iid:95
+eid:1099575910637
+{DST
+mea:676
+std:202
+}
+}
+{LIB
+iid:96
+eid:1099575910427
+{DST
+mea:521
+std:156
+}
+}
+{LIB
+iid:97
+eid:1099575910628
+{DST
+mea:726
+std:217
+}
+}
+{LIB
+iid:98
+eid:1099575910575
+{DST
+mea:559
+std:167
+}
+}
+{LIB
+iid:99
+eid:1099575910452
+{DST
+mea:665
+std:199
+}
+}
+{LIB
+iid:100
+eid:1099575910847
+{DST
+mea:404
+std:121
+}
+}
+{LIB
+iid:101
+eid:1099575910464
+{DST
+mea:599
+std:179
+}
+}
+{LIB
+iid:102
+eid:1099575910589
+{DST
+mea:554
+std:166
+}
+}
+{LIB
+iid:103
+eid:1099575910508
+{DST
+mea:530
+std:159
+}
+}
+{LIB
+iid:104
+eid:1099575910668
+{DST
+mea:366
+std:109
+}
+}
+{LIB
+iid:105
+eid:1099575910479
+{DST
+mea:550
+std:165
+}
+}
+{LIB
+iid:106
+eid:1099575910623
+{DST
+mea:524
+std:157
+}
+}
+{LIB
+iid:107
+eid:1099575910868
+{DST
+mea:829
+std:248
+}
+}
+{LIB
+iid:108
+eid:1099575910569
+{DST
+mea:588
+std:176
+}
+}
+{LIB
+iid:109
+eid:1099575910761
+{DST
+mea:549
+std:164
+}
+}
+{LIB
+iid:110
+eid:1099575910957
+{DST
+mea:826
+std:247
+}
+}
+{LIB
+iid:111
+eid:1099575910595
+{DST
+mea:401
+std:120
+}
+}
+{LIB
+iid:112
+eid:1099575910529
+{DST
+mea:561
+std:168
+}
+}
+{LIB
+iid:113
+eid:1099575910495
+{DST
+mea:588
+std:176
+}
+}
+{LIB
+iid:114
+eid:1099575910780
+{DST
+mea:570
+std:171
+}
+}
+{LIB
+iid:115
+eid:1099575910446
+{DST
+mea:667
+std:200
+}
+}
+{LIB
+iid:116
+eid:1099575910856
+{DST
+mea:765
+std:229
+}
+}
+{LIB
+iid:117
+eid:1099575910643
+{DST
+mea:471
+std:141
+}
+}
+{LIB
+iid:118
+eid:1099575910862
+{DST
+mea:771
+std:231
+}
+}
+{LIB
+iid:119
+eid:1099575910777
+{DST
+mea:549
+std:164
+}
+}
+{LIB
+iid:120
+eid:1099575910526
+{DST
+mea:633
+std:189
+}
+}
+{LIB
+iid:121
+eid:1099575910437
+{DST
+mea:558
+std:167
+}
+}
+{LIB
+iid:122
+eid:1099575910492
+{DST
+mea:467
+std:140
+}
+}
+{LIB
+iid:123
+eid:1099575910611
+{DST
+mea:566
+std:169
+}
+}
+{LIB
+iid:124
+eid:1099575910434
+{DST
+mea:520
+std:156
+}
+}
+{LIB
+iid:125
+eid:1099575910874
+{DST
+mea:823
+std:246
+}
+}
+{LIB
+iid:126
+eid:1099575910498
+{DST
+mea:469
+std:140
+}
+}
+{LIB
+iid:127
+eid:1099575910517
+{DST
+mea:672
+std:201
+}
+}
+{LIB
+iid:128
+eid:1099575910443
+{DST
+mea:511
+std:153
+}
+}
+{LIB
+iid:129
+eid:1099575910601
+{DST
+mea:479
+std:143
+}
+}
+{LIB
+iid:130
+eid:1099575910617
+{DST
+mea:635
+std:190
+}
+}
+{LIB
+iid:131
+eid:1099575910640
+{DST
+mea:385
+std:115
+}
+}
+{LIB
+iid:132
+eid:1099575910608
+{DST
+mea:519
+std:155
+}
+}
+{LIB
+iid:133
+eid:1099575910853
+{DST
+mea:481
+std:144
+}
+}
+{LIB
+iid:134
+eid:1099575910504
+{DST
+mea:501
+std:150
+}
+}
+{LIB
+iid:135
+eid:1099575910485
+{DST
+mea:642
+std:192
+}
+}
+{LIB
+iid:136
+eid:1099575910838
+{DST
+mea:477
+std:143
+}
+}
+{LIB
+iid:137
+eid:1099575910520
+{DST
+mea:546
+std:163
+}
+}
+{LIB
+iid:138
+eid:1099575910544
+{DST
+mea:482
+std:144
+}
+}
+{LIB
+iid:139
+eid:1099575910514
+{DST
+mea:608
+std:182
+}
+}
+{LIB
+iid:140
+eid:1099575910614
+{DST
+mea:631
+std:189
+}
+}
+{LIB
+iid:141
+eid:1099575910783
+{DST
+mea:546
+std:163
+}
+}
+{LIB
+iid:142
+eid:1099575910440
+{DST
+mea:696
+std:208
+}
+}
+{LIB
+iid:143
+eid:1099575910535
+{DST
+mea:441
+std:132
+}
+}
+{LIB
+iid:144
+eid:1099575910790
+{DST
+mea:520
+std:156
+}
+}
+{LIB
+iid:145
+eid:1099575910473
+{DST
+mea:680
+std:204
+}
+}
+{LIB
+iid:146
+eid:1099575910828
+{DST
+mea:506
+std:151
+}
+}
+{LIB
+iid:147
+eid:1099575910672
+{DST
+mea:502
+std:150
+}
+}
+{LIB
+iid:148
+eid:1099575910470
+{DST
+mea:428
+std:128
+}
+}
+{LIB
+iid:149
+eid:1099575910458
+{DST
+mea:787
+std:236
+}
+}
+{LIB
+iid:150
+eid:1099575910598
+{DST
+mea:524
+std:157
+}
+}
+{LIB
+iid:151
+eid:1099575910936
+{DST
+mea:848
+std:254
+}
+}
+{LIB
+iid:152
+eid:1099575910476
+{DST
+mea:408
+std:122
+}
+}
+{LIB
+iid:153
+eid:1099575910592
+{DST
+mea:524
+std:157
+}
+}
+{LIB
+iid:154
+eid:1099575910892
+{DST
+mea:846
+std:253
+}
+}
+{LIB
+iid:155
+eid:1099575910859
+{DST
+mea:855
+std:256
+}
+}
+{LIB
+iid:156
+eid:1099575910881
+{DST
+mea:781
+std:234
+}
+}
+{LIB
+iid:157
+eid:1099575910523
+{DST
+mea:621
+std:186
+}
+}
+{LIB
+iid:158
+eid:1099575910581
+{DST
+mea:508
+std:152
+}
+}
+{FRG
+iid:7
+eid:1099575910956
+lib:110
+typ:I
+}
+{FRG
+iid:55
+eid:1099575910959
+lib:87
+typ:I
+}
+{FRG
+iid:33
+eid:1099575910451
+lib:99
+typ:I
+rds:305,166
+}
+{FRG
+iid:20
+eid:1099575910472
+lib:145
+typ:I
+rds:194,171
+}
+{FRG
+iid:74
+eid:1099575910935
+lib:151
+typ:I
+rds:288,290
+}
+{FRG
+iid:13
+eid:1099575910671
+lib:147
+typ:I
+}
+{FRG
+iid:68
+eid:1099575910519
+lib:137
+typ:I
+rds:203,184
+}
+{FRG
+iid:73
+eid:1099575910481
+lib:91
+typ:I
+rds:206,174
+}
+{FRG
+iid:21
+eid:1099575910861
+lib:118
+typ:I
+rds:281,265
+}
+{FRG
+iid:10
+eid:1099575910475
+lib:152
+typ:I
+rds:205,172
+}
+{FRG
+iid:66
+eid:1099575910577
+lib:94
+typ:I
+}
+{FRG
+iid:25
+eid:1099575910494
+lib:113
+typ:I
+rds:197,177
+}
+{FRG
+iid:19
+eid:1099575910436
+lib:121
+typ:I
+rds:302,162
+}
+{FRG
+iid:5
+eid:1099575910442
+lib:128
+typ:I
+rds:303,164
+}
+{FRG
+iid:22
+eid:1099575910568
+lib:108
+typ:I
+rds:207,211
+}
+{FRG
+iid:43
+eid:1099575910639
+lib:131
+typ:I
+rds:248,231
+}
+{FRG
+iid:1
+eid:1099575910852
+lib:133
+typ:I
+rds:278,262
+}
+{FRG
+iid:47
+eid:1099575910460
+lib:83
+typ:I
+rds:193,168
+}
+{FRG
+iid:39
+eid:1099575910782
+lib:141
+typ:I
+rds:273,257
+}
+{FRG
+iid:40
+eid:1099575910588
+lib:102
+typ:I
+rds:233,216
+}
+{FRG
+iid:75
+eid:1099575910439
+lib:142
+typ:I
+}
+{FRG
+iid:64
+eid:1099575910516
+lib:127
+typ:I
+rds:202,183
+}
+{FRG
+iid:69
+eid:1099575910872
+lib:125
+typ:I
+}
+{FRG
+iid:57
+eid:1099575910855
+lib:116
+typ:I
+rds:279,263
+}
+{FRG
+iid:65
+eid:1099575910610
+lib:123
+typ:I
+rds:239,222
+}
+{FRG
+iid:51
+eid:1099575910636
+lib:95
+typ:I
+rds:247,230
+}
+{FRG
+iid:58
+eid:1099575910622
+lib:106
+typ:I
+rds:244,227
+}
+{FRG
+iid:14
+eid:1099575910600
+lib:129
+typ:I
+rds:237,220
+}
+{FRG
+iid:67
+eid:1099575910463
+lib:101
+typ:I
+rds:309,169
+}
+{FRG
+iid:28
+eid:1099575910846
+lib:100
+typ:I
+rds:277,261
+}
+{FRG
+iid:78
+eid:1099575910878
+lib:156
+typ:I
+rds:285,268
+}
+{FRG
+iid:9
+eid:1099575910832
+lib:136
+typ:I
+rds:276,260
+}
+{FRG
+iid:17
+eid:1099575910445
+lib:115
+typ:I
+rds:304,165
+}
+{FRG
+iid:37
+eid:1099575910630
+lib:86
+typ:I
+rds:289,291
+}
+{FRG
+iid:38
+eid:1099575910619
+lib:85
+typ:I
+rds:242,225
+}
+{FRG
+iid:76
+eid:1099575910537
+lib:81
+typ:I
+}
+{FRG
+iid:34
+eid:1099575910528
+lib:112
+typ:I
+rds:296,187
+}
+{FRG
+iid:30
+eid:1099575910594
+lib:111
+typ:I
+rds:235,218
+}
+{FRG
+iid:11
+eid:1099575910430
+lib:84
+typ:I
+rds:192,160
+}
+{FRG
+iid:48
+eid:1099575910642
+lib:117
+typ:I
+rds:249,232
+}
+{FRG
+iid:23
+eid:1099575910760
+lib:109
+typ:I
+rds:251,254
+}
+{FRG
+iid:35
+eid:1099575910507
+lib:103
+typ:I
+}
+{FRG
+iid:24
+eid:1099575910543
+lib:138
+typ:I
+rds:299,191
+}
+{FRG
+iid:70
+eid:1099575910525
+lib:120
+typ:I
+rds:295,186
+}
+{FRG
+iid:3
+eid:1099575910950
+lib:88
+typ:I
+rds:306,292
+}
+{FRG
+iid:56
+eid:1099575910789
+lib:144
+typ:I
+rds:274,258
+}
+{FRG
+iid:42
+eid:1099575910591
+lib:153
+typ:I
+rds:234,217
+}
+{FRG
+iid:79
+eid:1099575910574
+lib:98
+typ:I
+rds:209,213
+}
+{FRG
+iid:2
+eid:1099575910469
+lib:148
+typ:I
+}
+{FRG
+iid:46
+eid:1099575910478
+lib:105
+typ:I
+rds:195,173
+}
+{FRG
+iid:4
+eid:1099575910597
+lib:150
+typ:I
+rds:236,219
+}
+{FRG
+iid:29
+eid:1099575910825
+lib:146
+typ:I
+rds:275,259
+}
+{FRG
+iid:61
+eid:1099575910884
+lib:80
+typ:I
+rds:286,269
+}
+{FRG
+iid:16
+eid:1099575910534
+lib:143
+typ:I
+rds:298,189
+}
+{FRG
+iid:18
+eid:1099575910867
+lib:107
+typ:I
+rds:283,267
+}
+{FRG
+iid:31
+eid:1099575910457
+lib:149
+typ:I
+rds:308,167
+}
+{FRG
+iid:41
+eid:1099575910627
+lib:97
+typ:I
+rds:245,228
+}
+{FRG
+iid:44
+eid:1099575910616
+lib:130
+typ:I
+rds:241,224
+}
+{FRG
+iid:49
+eid:1099575910953
+lib:93
+typ:I
+}
+{FRG
+iid:36
+eid:1099575910531
+lib:89
+typ:I
+rds:297,188
+}
+{FRG
+iid:77
+eid:1099575910522
+lib:157
+typ:I
+rds:204,185
+}
+{FRG
+iid:6
+eid:1099575910491
+lib:122
+typ:I
+}
+{FRG
+iid:59
+eid:1099575910776
+lib:119
+typ:I
+rds:271,255
+}
+{FRG
+iid:53
+eid:1099575910571
+lib:82
+typ:I
+rds:208,212
+}
+{FRG
+iid:45
+eid:1099575910497
+lib:126
+typ:I
+rds:198,178
+}
+{FRG
+iid:62
+eid:1099575910426
+lib:96
+typ:I
+rds:300,159
+}
+{FRG
+iid:12
+eid:1099575910484
+lib:135
+typ:I
+rds:196,175
+}
+{FRG
+iid:27
+eid:1099575910513
+lib:139
+typ:I
+rds:201,182
+}
+{FRG
+iid:63
+eid:1099575910510
+lib:92
+typ:I
+rds:200,181
+}
+{FRG
+iid:15
+eid:1099575910864
+lib:90
+typ:I
+rds:282,266
+}
+{FRG
+iid:26
+eid:1099575910503
+lib:134
+typ:I
+rds:199,179
+}
+{FRG
+iid:60
+eid:1099575910580
+lib:158
+typ:I
+rds:210,215
+}
+{FRG
+iid:72
+eid:1099575910779
+lib:114
+typ:I
+rds:272,256
+}
+{FRG
+iid:71
+eid:1099575910667
+lib:104
+typ:I
+rds:250,252
+}
+{FRG
+iid:32
+eid:1099575910433
+lib:124
+typ:I
+rds:301,161
+}
+{FRG
+iid:8
+eid:1099575910607
+lib:132
+typ:I
+rds:238,221
+}
+{FRG
+iid:54
+eid:1099575910858
+lib:155
+typ:I
+rds:280,264
+}
+{FRG
+iid:50
+eid:1099575910890
+lib:154
+typ:I
+rds:287,270
+}
+{FRG
+iid:52
+eid:1099575910613
+lib:140
+typ:I
+rds:240,223
+}
+{RED
+iid:159
+eid:1086975905
+seq:
+TGGAAATCCGTCTCGAATGGAGGTCTAGTGCGTTTCCGCTTCAACCCGATGATTGTCGAA
+CTTGCAGAAAAAGCAATGAAAGAGTATGGAGAGGATCTGAAAATTGAAACAAACAAATTT
+GCAGCAATATGCACCCACTTGGAGGTATGTTTCATGTATTCAGATTTTCATTTCATCAAT
+GAACAAGGCGAATCAATAATGGTAGAACTTGATGATCCAAATGCACTGTTAAAGCACAGA
+TTTGAAATAATCGAGGGGAGAGACAGAACAATGGCCTGGACAGTAGTAAACAGTATCTGC
+AACACTACTGGAGCTGAAAAACCGAAGTTTCTACCAGATTTGTATGATTACAAGGAGAAC
+AGATTCATCGAAATTGGAGTGACAAGAAGAGAAGTCCACATATATTACCTTGAAAAGGCC
+AATAAAATTAAATCTGAGAACACACACATTCACATTTTCTCATTCACTGGGGAGGAAATG
+GCCACAAAGGCAGACTACACTCTCGACGAGGAGGTCATAGCTGTTTACTGAGGGACCCAT
+TTAAAATTCTAATACCCAGCTTTGAACGTGACCATGCCAAACAAGGACAACCTGACCACA
+CAAGAGGTCAA
+.
+qlt:
+666696677779::88766>777777<<777<777678869=DDEQSSVMMHLHGKKKMK
+HQNNMKSRSKHLJH@=;;9;;JBELHGGMRaaMQQMMGMVQ\\\VV_VVSSMRRRSRLPJ
+KPMXPXTX___Y_V\VSRQ]\VVVVVV\\\V\VVVV__RJJFIGL]]]V_WRRSSSVRRX
+VV\\RSLKLCCGIJGGJaTVNKNKMRWX_YaT_TTSRMSRRa]__T____T_T_TTWXSP
+aaLXWX]_VX]LLaPaTXTLHJJHLRRVVXXXaaaaaTVXXRXXPLLXWXTXR\XVXXXR
+PXXRP]VVV]]XTaXV__VVSKROXXXX]]XRRKHG at BWWY____VV]TXXXX_TaLGXW
+GGLWXPPPLLMMLQQKMMMJMMISMXaaKKaXLLX]]XRPXXTXXRTVV\\\\]V_VVVR
+RSMaXRPPRXRXXXPPaPL]PX]XR]aaV\RPXXX\]]VVVSSRPSPXXaXTXXLPXX__
+________TWXXKLKGMOSMVXPGDG<<MACMMMWA;DCGAKDXCC999:<999;9;99=
+99:;?=@=;99<:9::9 at 9;9::9:==:999999<::A=:998;999;9979:::9:;99
+77999799;97
+.
+frg:62
+clr:38,489
+}
+{RED
+iid:160
+eid:1086975821
+seq:
+GACAGGACATATATTAGTATGGAAGATAAAAGAACTACGGAATCTGATGTCGCAGTCTCG
+CACTCGCGAGATACTGACAAAAACCACAGTGGACCATATGGCCATAATTAAGAAGTACAC
+ATCGGGGAGACAGGAAAAGAACCCGTCACTTAGGATGAAATGGATGATGGCAATGAAATA
+CCCAATCACTGCTGACAAAAGGATAACAGAAATGGTTCCGGAGAGAAATGAACAAGGACA
+AACTCTATGGAGTAAAATGAGTGATGCTGGATCAGATCGAGTGATGGTATCACCTTTGGC
+TGTAACATGGTGGAATAGAAATGGACCCGTGACAAGTACGGTCCATTACCCAAAAGTATA
+CAAGACTTATTTTGACAAAGTCGAAAGGTTAAAACATGGAACCTTTGGCCCTGTTCATTT
+TAGAAATCAAGTCAAGATACGCAGAAGAGTAGACATAAACCCTGGTCATGCAGACCTCAG
+TGCCAAAGAGGCACAAGATGTAATTATGGAAGTTGTTTTTCCCAATGAAGTGGGAGCCAG
+GATACTAACGTCGGAATCGGGTCATAGCTGGTTTCCTA
+.
+qlt:
+7676777666766777<<@@>GKKHJMHVMXOPPPOHJOHGHHHMKNJOOOZSS\\_VZS
+SZ\\V_]RGGEH>CIISS\V\_\]VMZSSSSZZZ\]SS\VSS\\V\_Y__\WMMMRRV\V
+VRS__]VRRR\\V____Y_Y____YVV\\OS]SQQQVVYY_\\S\\\Y_Y_YY_______
+_YTV\RRPPMR]\V\_____V\V\V\_Y__\V__YY_______T_V\\\\\___\RRSSS
+\]a__YY___Y________VaV\V\\V_VVVVVVPRVWVaaVV\\\\__]____aa_aaa
+_]__]_Y__]aY__V\YY_________Y\VV\VV_YY___VV\VV\\_____]____]__
+____V__\Y__YYV\\V\\_\XRaa]_]___]______Y_____aaa_aaYaY_T_____
+_YYY___YYY____________aaTVXR]VV_____a]aaaa]_Y_____a___]VVX]]
+____________________Y___\X\V\\\V___Y____\\V\\\aaa_a_a_a_____
+Y_____WWA>W>>GGLVRS\V\\SJBBBBDEGEPA::8
+.
+frg:11
+clr:10,535
+}
+{RED
+iid:161
+eid:1086975860
+seq:
+AAAGTCTGATTCGAAATGGAAGATTTTGTGCGACAATGCTTCAACCCGATGATTGTCGAA
+CTTGCAGAAAAAGCAATGAAAGAGTATGGAGAGGATCTGAAAATTGAAACAAACAAATTT
+GCAGCAATATGCACCCACTTGGAGGTATGTTTCATGTATTCAGATTTTCATTTCATCAAT
+GAACAAGGCGAATCAATAATGGTAGAACTTGATGATCCAAATGCACTGTTAAAGCACAGA
+TTTGAAATAATCGAGGGGAGAGACAGAACAATGGCCTGGACAGTAGTAAACAGTATCTGC
+AACACTACTGGAGCTGAAAAACCGAAGTTTCTACCAGATTTGTATGATTACAAGGAGAAC
+AGATTCATCGAAATTGGAGTGACAAGAAGAGAAGTCCACATATATTACCTTGAAAAGGCC
+AATAAAATTAAATCTGAGAACACACACATTCACATTTTCTCATTCACTGGGGAGGAAATG
+GCCACAAAGGCAGACTACACTCTCGACGAGGAGGTCATACCTGGTTTCCTAATAAGAGTA
+GAAGGAGATAACAACACACTTTCAAGAAAAATGACAATAAAAGACAACCTGACCAAAAAA
+ATGGTCACACATTAACAATAGGAGGGTTTTATTTTGTTTTTTTT
+.
+qlt:
+6866966:::<;;9867?A?=??=??GGGLGEGMGDBJSGHCECDRQIOCCOHQFHHVVV
+VXQQNNLLROXCCRKCCSSRXRRRGJGGMRaaEGKLGG\\X_____Y\VVV\SVX\RSVV
+VVVXX\]XXXPRXRVXXXRPSRSVVV\RSV\VVVRRXXVQKHCCTWVXVXRXVRVMS\TR
+XTVT_YVWaRRWXT]XX]]MMPNJLLXW___VXPRVVV\RMXPWTXPPWW_\XRRXXPLK
+aaTXRVTXPXPPLLT]]aLLJJJLLJLXXWTGLa]]RXXXWX]PLPLP]XXVXRTXRPXX
+XPRTXVaaPPXLPXXPXX]]X]XPPWLL]XXRTXNKCCWWV_VTMSRVMVRRMMJHFFKK
+LJLWXRXPXaXXXPTPXPPLMSKLLLKaKILL]LLTXX]PPXPXLXPXXa_VXVVVOVVV
+SV\_]]XT]]RRXXPaKDDNNSMPXXXLLWPXLPXXa]RSRRSRXXXPPaWRXXRSVVMR
+RX___]]XTTPPIIPXX\XXXaaDDGM>DADLMXML@?;77:787@;::9669699::66
+77:9:779:;:999999=?@:@9799;99999A9==<=<<>A@@999999:;;:A979>9
+=@@>C<@:<:9999999:999<:::78679999;;999999997
+.
+frg:32
+clr:6,489
+}
+{RED
+iid:162
+eid:1086975884
+seq:
+GGCCCGGATCAGATTGAGATTTTGTGCGACAATGCTTCAACCCGATGATTGTCGAACTTG
+CAGAAAAAGCAATGAAAGAGTATGGAGAGGATCTGAAAATTGAAACAAACAAATTTGCAG
+CAATATGCACCCACTTGGAGGTATGTTTCATGTATTCAGATTTTCATTTCATCAATGAAC
+AAGGCGAATCAATAATGGTAGAACTTGATGATCCAAATGCACTGTTAAAGCACAGATTTG
+AAATAATCGAGGGGAGAGACAGAACAATGGCCTGGACAGTAGTAAACAGTATCTGCAACA
+CTACTGGAGCTGAAAAACCGAAGTTTCTACCAGATTTGTATGATTACAAGGAGAACAGAT
+TCATCGAAATTGGAGTGACAAGAAGAGAAGTCCACATATATTACCTTGAAAAGGCCAATA
+AAATTAAATCTGAGAACACACACATTCACATTTTCTCATTCACTGGGGAGGAAATGGCCA
+CAAAGGCAGACTACACTCTCGACGAGGAAAGCAGAGCTAGGATTAAAACCAGGCTGTTCA
+CCATAAGGCAAGGTCATAGCTGTTTACTAACGATCCCTAAACGAAACTTATCAACGCGGA
+GACTGTTAAAAGTGCATAAATTTGGTATCACCTGTTGTCAAGGAAGCAAATAGTCCTATA
+ATTGCCGAAGTTTCTCCTTA
+.
+qlt:
+?7669779:9766667968<<?>>AA@@H at BEEIH=<<<<<GIIOEHHEKGHJJMM\VVM
+SLLMOQGIKHGFJJDC>>>@HHKMNV_aMQRIKGRVQSQQSRRRVV\V\_]_V\VXXLLL
+LLLPX\___V\OOOQ__a__\\\R\VVVVVSM\XV_XVXX\XVMR\\\VRVVV]\PVX_T
+_VSVXSR\]TIIHIEHJFXPXPXTVVV]]\_____V\TXXXVXTVV_Y__V]XRXXWXV_
+VYV__SVSVMVV__XTRXX____VXXXXTaaaaV__]TPPLPXX]__T___\VTT\XX\X
+XXVTXRaaTaXRXVV_____aTPXTT]XXXWPLL]X_____T_VVVXRRVXXRSWWVXXV
+XRWXVTTVW\VPaTaRV\\VVRaPLK]T_VVXX\PX]]_Y______Y__Y______]__a
+___]]_____VXXXXVV_]TXRR\X____Y__aaVVV\\V_\XVVa_____V\VVVV___
+___a_]a]aR]]_____a___XWXXVP]V_]XPLL]aaaVRV\VV__]]XXTWXLLXXVX
+XGGPGG@@WWVVXXXXXPLEHLK at B99966969997799979999799:779::867969
+9:99799:99:9;79;:9:99=:9999999999::899999799:9777;999999:9D9
+7999::99999;79799999
+.
+frg:19
+clr:17,528
+}
+{RED
+iid:163
+eid:1086975887
+seq:
+ACGGAGGAGGATCAATATATTACCTTGAAAAGGCCAATAAAATTAAATCTGAGAACACAC
+ACATTCACATTTTCTCATTCACTGGGGAGGAAATGGCCACAAAGGCAGACTACACTCTCG
+ACGAGGAAAGCAGAGCTAGGATTAAAACCAGGCTATTTACCATAAGACAAGAAATGGCCA
+ACAGAGGCCTCTGGGATTCCTTTCGTCAGTCCGAAAGAGGCGAAGAAACAATTGAAGAAA
+AATTTGAAATCTCAGGAACTATGCGTAGGCTTGCCGACCAAAGTCTCCCACCGAACTTCT
+CCTGCCTTGAGAATTTTAGAGCCTATGTGGATGGATTCGAACCGAACGGCTGCATTGAGG
+GCAAGCTTTCTCAAATGTCCAAAGAAGTGAATGCCAAAATTGAACCTTTTCTGAAGACAA
+CACCAAGACCAATCAAACTTCCTAATGGACCTCCTTGTTATCAGCGGTCCAAATTCCTCC
+TGATGGATGCTTTGAAATTGAGCATTGAAGACCCAAGTCACGAAGGAGAAGGGATTCCAT
+TATATGATGCGATCAAGTGCATGAAAACATTCTTTGGATGGAAAGAACCTTATATAGTCA
+AACCACACGAAAAGGGAATAAATTCAAATTACCTGCTGTCATGGAAGCAAGTATTGTCAG
+AATTGCAGGACGTTGAAACTGAGGAGAAGGTCATAGTTGTTTTACTG
+.
+qlt:
+966977666677:77<<>=====@@<<:977<<AICEETMVVRVVNNIIGPHLPPPPPPP
+PRRRSRRSSSIREC:9>7;:@?FL]RR_YTPPLLLOS\]VV__Y______\\V\MOaPHJ
+HMMVVV____________\V\\VV]]]SRRRRRVVVVV\\\\\VYVVVV\VVVVV\VY_Y
+____T_____a]KGBDNN\Y_VV_______]____]__T_TXVX_______Y_V\XPVV_
+____Y___YYYXVVVV__]_Y_V_XVXPVVVY______Y__]_VVX_V_____VV__YYa
+a_aaa_]aa]SS\\\\\TXXV\Y__VT_VVV\V\\R\MXX]TT____YV]XT\VXXVa__
+Y__]]aaaaR\\S\V___Y__]_]__T___Y_____]_]]]_Y_Y_Yaaa__X]]XX]]_
+___YX\SSVV________]a_________________________]a\\\]VVaaaaaaa
+____Y_____a_______V__V___a_]VRX]\____Y__Y___\VTXX]WVXX]T]XXV
+V_______V____V_________a________aaaV\\\\\aa_\V\X\\___X\\\V\_
+___Y_T___aaaa_____]__]_]]]________V_T__Y_YYYY_YY____T_YY_V__
+_TT_]TKEMGACWWWD==B at GG<<WGSVHPPHE>:77=98<>877:6
+.
+frg:75
+clr:15,664
+}
+{RED
+iid:164
+eid:1086975771
+seq:
+CTTTTTTTCTTACTGGGGAGGAAATGGCCACAAAGGCAGACTACACTCTCGACGAGGAAA
+GCAGAGCTAGGATTAAAACCAGGCTATTTACCATAAGACAAGAAATGGCCAACAGAGGCC
+TCTGGGATTCCTTTCGTCAGTCCGAAAGAGGCGAAGAAACAATTGAAGAAAAATTTGAAA
+TCTCAGGAACTATGCGTAGGCTTGCCGACCAAAGTCTCCCACCGAACTTCTCCTGCCTTG
+AGAATTTTAGAGCCTATGTGGATGGATTCGAACCGAACGGCTGCATTGAGGGCAAGCTTT
+CTCAAATGTCCAAAGAAGTGAATGCCAAAATTGAACCTTTTCTGAAGACAACACCAAGAC
+CAATCAAACTTCCTAATGGACCTCCTTGTTATCAGCGGTCCAAATTCCTCCTGATGGATG
+CTTTGAAATTGAGCATTGAAGACCCAAGTCACGAAGGAGAAGGGATTCCATTATATGATG
+CAATCAAATGCATGAGAACATTGGTCATACTGATTTTCCTGAAAGTTCAACAAGGCCTGC
+AAGCTGACTGATTCGTCTGGATAGAGCTCGATGAAATTGGAAAGGACGTACCCCCAATTG
+AATACATTGCAAGCATGAGGAGGAATTATTTCACAGCAGAGGTGTCCCATTGCAGGTCAA
+AAAGGTGTCCCCGGAGATGGATA
+.
+qlt:
+88:BC=<877777<AM<<<<<:977<<>?@@A?@LOLJRRVLLKDDDRRR\V\__\V\MP
+MPPPXV\_YNIIEEGSRQIIIJNR_]___RRRRIL]OOS\\\\QQRRMIPPPP_____Y_
+_]_]SOR\\V__X]_\V\\VV__YY\]XTTVVPPXSMSRV\\Y_]aTPR]XVVSSS\VV_
+_VV\V\V_VY_]V\]]\V_____aa__\V\\]Sa]]___]__T____]_aaaaaa_a]__
+T_TTTVVRRSSWW__VXX_V___R\VROMLLWXY_VXXRV]aVVXTTT______]Vaaa]
+VS\\\\TV\VVVVOaXTTXVV______]YYYY_____aaaaVRX\TMR\VS\YY_]VPPV
+\__V]]a_aaaT__XVX_____TaaaV_V_______aa_T____YaaaaaaXXXV_____
+___a]________Y__Yaa\RX\]Y_____VXXR]]XRRXV]\\\\VVY_________\K
+K<>K<<ID;MDKDDH;99DD]TXVQQB at 9786668:88=67766:9;9999;;:>?D;99
+89779799>@D:=B;:;:;<;>;>>>?EB?>::FB<=9<D;=;>@C=:;997;;>>>DBC
+=<<@;<;>;@;;9>=BBDD=?GDD==@CDF=BA@<<==:>;9<@IA=AA@=97999;=>9
+767>98=9999799967999998
+.
+frg:5
+clr:12,473
+}
+{RED
+iid:165
+eid:1086975785
+seq:
+GGATCACGACGCTGCATTGAGGGCAAGCTTTCTCAAATGTCCAAAGAAGTGAATGCCAAA
+ATTGAACCTTTTCTGAAGACAACACCAAGACCAATCAAACTTCCTAATGGACCTCCTTGT
+TATCAGCGGTCCAAATTCCTCCTGATGGATGCTTTGAAATTGAGCATTGAAGACCCAAGT
+CACGAAGGAGAAGGGATTCCATTATATGATGCGATCAAGTGCATGAAAACATTCTTTGGA
+TGGAAAGAACCTTATATAGTCAAACCACACGAAAAGGGAATAAATTCAAATTACCTGCTG
+TCATGGAAGCAAGTATTGTCAGAATTGCAGGACATTGAAAATGAGGAGAAGATCCCAAGG
+ACTAAAAACATGAAGAAAACGAGTCAACTAAAGTGGGCTCTTGGTGAAAACATGGCACCA
+GAGAAAGTAGACTTTGACAACTGCAGAGACATAAGCGATTTGAAGCAATATGATAGTGAC
+GAACCTGAATTAAGGTCACTTTCAAGCTGGATACAGAATGAGTTCAACAAGGCCTGCGAG
+CTAACTGATTCAATCTGGATAGAGCTCGATGAAATTGGAGAGGACGTAGCCCCAATTGAG
+TACATTGCAAGCATGAGGAGGAATTATTTCACAGCAGAGGTGTCCCATTGCAGGTCAAC
+.
+qlt:
+66869697986?:@>A>>EV at HE@@@@HLSQGBBFCCGGCCEEBD\OIIGKDCDDDDMIH
+JGIEHR_Y_]NCCFFMGIHNHROIMKNJGKQV\\VV\V\__]\VRLKQMV\VXPXa]TVV
+\\QQQQPV]VVSVVVV___a]aXPXXR\\VVVY_______V__V_]__aaWPPR]VV\V_
+VXXXR]XTXPPTa\RS\RV\VVV__VVVVVVVS____VXRX]__V__X]]XRVaa]aRXT
+PXVX\VRR\V\V_____XVRX]___]_XXWPPTXXXVVVVS\\TV\VV\S]__VXPaaTM
+\RRMSa]]V_____VVVXWWTLLOOVVVXXPXVV_____V\VXRaaaaa]JJOOVV_XXP
+PTW__]___XXTTWLLWWVVPPVT_____\VXPaP]V_YV]aT]a___]_VXXVVX_]XT
+LLaa]]]WPLLX]______]]Ta]aLLXPVV_V_XXPP\]_a]XV_______X]XVRTWT
+LLX]_____\___V___Y______XXa]]XXTTXWXRXXXXaX________]aaaTaaaX
+X_______\V___VXVRVV\\Saaa__aaaa]]___VTaaaXXWXWXLLLaW____]TXX
+X]X___\\__T]\__VXXXWRSS\]\YV\V\OV\WOHHOO\__OMMILJJHL]M><996
+.
+frg:17
+clr:11,630
+}
+{RED
+iid:166
+eid:1086975858
+seq:
+CCTTAAGCAATCAGTGCATGAAACATTCTTTGGATGGAAAGAACCTTATATAGTCAAACC
+ACACGAAAAGGGAATAAATTCAAATTACCTGCTGTCATGGAAGCAAGTATTGTCAGAATT
+GCAGGACATTGAAAATGAGGAGAAGATCCCAAGGACTAAAAACATGAAGAAAACGAGTCA
+ACTAAAGTGGGCTCTTGGTGAAAACATGGCACCAGAGAAAGTAGACTTTGACAACTGCAG
+AGACATAAGCGATTTGAAGCAATATGATAGTGACGAACCTGAATTAAGGTCACTTTCAAG
+CTGGATACAGAATGAGTTCAACAAGGCCTGCGAGCTAACTGATTCAATCTGGATAGAGCT
+CGATGAAATTGGAGAGGACGTAGCCCCAATTGAGTACATTGCAAGCATGAGGAGGAATTA
+TTTCACAGCAGAGGTGTCCCATTGTAGAGCCACTGAGTACATAATGAAGGGGGTATACAT
+TAATACTGCCCTGCTCAATGCATCCTGTGCAGCAATGGACGATTTTCAACTAATCCCCAT
+GATAAGCAAGTGCAGAACTAAAGAGGGAAGGCGAAAAACCAATTTATATGGGTTCATCAT
+AAAGGGAAGATCCCATTTAAGGAATGACACAGATGTGGTAAACTTTGTGAGCATGGAGGT
+CATACT
+.
+qlt:
+97766996877:88:>=AA>@<>?D<<CGEJ<>>?D?@HFNVMIRS]X]SSQIGGMKRJP
+OMMJJV_____OPFNDDGNFPPPP___\\V]\\PPPPMJ_V\VVV\\V\\VV\VVRRX\V
+___\VV\\\\\Y\\\VVVaRXVV\SRV\V]\QQQQRO\__\\\\R\aVPX]V___VVV\V
+VVY__]a]\V_VV_]]_]TY__V\\VVVY_VVT]XRTTS\\RSJXXX_Y\VV\\OXX]aP
+SSMVVV]MRRMP\___]]_]___V__XVTVR\SOSST]_YYY____________VV\\RV
+]aV\VVRVXRXXV__aV_______Yaaa]a]Pa\\_]_Y___\_____YaV\VV\VYY_Y
+Ya]a]VVOVOVaPXXVVVVORXRRW]_Y_Y]VXXXV____Taaa_]___V\RXT______
+_______V]TLLaaaaa____Y_]]aXXXX__Y____T____]]Raaaa_aa_]_____Y
+Y___V]_Vaaaaa_______a_aaa_aV____V]Xa\W\XXX]__YY_______a____Y
+__TTY_T___aaaaLLW]__aaaaaaa_V]aaaa]SS]]]\____TTSS\\_R___T___
+TVTVVTaRRRRR\_Y__Y_VVJM\V\MV_TVPRTTVOMKHJ:<KK\VMMNNGLX]]T]TS
+\GC876
+.
+frg:33
+clr:36,633
+}
+{RED
+iid:167
+eid:1086975799
+seq:
+GTGTACTCCGGTGAACTGGCACCAGAGAAAGTAGACTTTGACAACTGCAGAGACATAAGC
+GATTTGAAGCAATATGATAGTGACGAACCTGAATTAAGGTCACTTTCAAGCTGGATACAG
+AATGAGTTCAACAAGGCCTGCGAGCTAACTGATTCAATCTGGATAGAGCTCGATGAAATT
+GGAGAGGACGTAGCCCCAATTGAGTACATTGCAAGCATGAGGAGGAATTATTTCACAGCA
+GAGGTGTCCCATTGTAGAGCCACTGAGTACATAATGAAGGGGGTATACATTAATACTGCC
+CTGCTCAATGCATCCTGTGCAGCAATGGACGATTTTCAACTAATCCCCATGATAAGCAAG
+TGCAGAACTAAAGAGGGAAGGCGAAAAACCAATTTATATGGGTTCATCATAAAGGGAAGA
+TCCCATTTAAGGAATGACACAGATGTGGTAAACTTTGTGAGCATGGAATTTTCTCTCACT
+GACCCGAGACTAGAGCCACATAAATGGGAGAAATACTGTGTCCTTGAGATAGGAGATATG
+TTACTAAGAAGTGCCATAGGCCAAATTTCAAGGCCTATGTTCTTGTATGTGAGGACAAAC
+GGAACATCAAAGGTCAAAATGAAATGGGGAATGGAGATGAGACGTTGCCTCCTTCAGTCA
+CTCCAGCAGATCGAGAGCATGATTGAAGCCGAGTCCTCGATTAAAGAGAAAGACATGACC
+AAAGAGTTTTTTGAGAATAAATCAGAAGCATGGCCCATTGGGGAGTCCCCCAAGAGAGTG
+GAGGTCATAGCTGTTTTTCCTGA
+.
+qlt:
+66666666666666667 at 99>;978=>>>?BLGGGLJISBBBBEEILMLRNMPPPMMORP
+MOOSZ\\SV\VXJMGIIMQQQIMFSV]_SSSRRSSQQQQSV\VVXV\\VVV_V\\V\\VV
+V]VX\aVV\]SS___a_Yaa___\RV\VOOQRMMOPNPaY\\V\\V___Y______Y_VV
+V___]\\\VRRWRR\]_Y_Ya]VVV\\VV_Y__Y_]WPVXVRXT______Y____T_XXT
+LL]W__YV\VVVVXWWXX]]_Y\V]\\\V]__XXaPaaa]X__]_]]\PPT\__]VTTa]
+a___\_\]XT]XV]]aPTT]XRXTXRXVTWLLaaXV\\VMVXXXX\]___VTXVV_V_V_
+_WWPXXWTT]XXPaa]___TXTXXVVVVV\VPR\V_____VY___V____Ta]__]WXSS
+]]__YVVR\VV________]WXRaaa]____]_a_aaaVXR]]XaX__\_V]aaV_____
+_____a___WWVPXXV_____aVPaaTaaRR\V\\VT_aa]aaaWXLLLWXRXVRRT\_Y
+_V_YTTVRRV]___T_________________]a_aaaaaaa____V_TY__MVV\VV__
+_T___VVTTTT_Y__Y_____TKKGGSV_YYTV_RVVRRRXT_VT_aV]]]YVTXWPXTT
+TXWXTHPPGLXX_aTV_TT_V_TTHHHXVXX\VVXV\QQPQQ\\VPP\\WPRP]XHHT__
+V__THHHTTVTXTVRHJMHGHHPIPHXXXXHHT\KKMVV]T\THTHHHLTH]CD77DCTW
+LGTPGSK@><97999@>?8877@
+.
+frg:31
+clr:17,761
+}
+{RED
+iid:168
+eid:1086975819
+seq:
+GGCGGAGGTACTAACCCTGGTCTGCAGACCTCAGTGCCAAAGAGGCACAAGATGTAATTA
+TGGAAGTTGTTTTTCCCAATGAAGTGGGAGCCAGGATACTAACATCAGAATCGCAATTAA
+CAATAACTAAAGAGAAAAAAGAAGAACTCCGAGATTGCAAAATTTCTCCCTTGATGGTTG
+CATACATGTTAGAGAGAGAACTTGTACGAAAAACAAGATTTCTCCCAGTTGCTGGCGGAA
+CAAGCAGTATATACATTGAAGTTTTACATTTGACTCAAGGAACGTGTTGGGAACAAATGT
+ACACTCCAGGTGGAGAAGTGAGGAATGACGATGTTGACCAAAGCCTAATTATTGCGGCCA
+GGAACATAGTAAGAAGAGCAGCAGTATCAGCAGATCCACTAGCATCTTTATTGGAGATGT
+GCCACAGCACACAAATTGGCGGGACAAGGATGGTGGACATTCTTAGACAGAACCCGACTG
+AAGAACAAGCTGTGGATATATGCAAGGCTGCAATGGGATTGAGAATCAGCTCATCCTTCA
+GCTTTGGTGGGTTTACATTTAAAAGAACAAGCGGGTCATCAGTCAAAAAAGAGGAAGAAG
+TGCTTACAGGCAATCTCCAAACACTGAAGGTCATAGCGTGTTTCCA
+.
+qlt:
+669776676669=<977<<>F:8B=EEEMDEEDD@?D at GCFKQQVPPPLJEEEELGJVJK
+EEJGNNQQNSQVPPMIEFFDJNKMFKNMRRVV\VSSVV\VV\VVSMXLLWXXXWXPP]SV
+V\VV_\]XXXXLLLL]]]]XLL]HHMLRSaPPLL]XP]]___]_VTXX\XXRXPRXVVTX
+]VPVTPLXXPLIIaaaRXX]XPXXXXTLLW]V]\LLHJNLVTPSRMHHDPXXXXWTXPRR
+MVVRRaXPXTX]WTXXTaVVXX]]XXPXR]XTTV]PPLLXXXRXXXTaaTRRRRVRXRXP
+XXPXXPVRXXPXTPSPPXLPTXXRWRPXXGGWWVVTVTT\V]RaRRTXRVXVPXTXX\XX
+XPPWTXTLPIa]LLaLLLXPLLaXLXXPTRXXGGPXXPXPLLLPPXXTTWWPLPXGLXXX
+XTPPRXXXXTT_X]RaPPXXXVVRMVRRXXXXXPRSMMMRWXaPLEDXXLLTX]TSPPPX
+LWGGXW\RXaaaRSSSVVMVXXXTRX]RXXWXLLaNSMRKLLLL]NXXLLXXVXXa]TXX
+XLaaP]XPPXa__]]RS]XX_XWaEEWKXTXaaaVVRJMMXXLXX]]_aaKKLLXXLIXX
+LXWXXVXPPTXXXXXRXX]VTWPGGLLMIMMMMF at 886668<@=:<
+.
+frg:47
+clr:12,605
+}
+{RED
+iid:169
+eid:1086975885
+seq:
+GCGTTTGAAAAATAAGGGGGGTATACATTAATACTGCCCTGCTCAATGCATCCTGTGCAG
+CAATGGACGATTTTCAACTAATCCCCATGATAAGCAAGTGCAGAACTAAAGAGGGAAGGC
+GAAAAACCAATTTATATGGGTTCATCATAAAGGGAAGATCCCATTTAAGGAATGACACAG
+ATGTGGTAAACTTTGTGAGCATGGAATTTTCTCTCACTGACCCGAGACTAGAGCCACATA
+AATGGGAGAAATACTGTGTCCTTGAGATAGGAGATATGTTACTAAGAAGTGCCATAGGCC
+AAATTTCAAGGCCTATGTTCTTGTATGTGAGGACAAACGGAACATCAAAGGTCAAAATGA
+AATGGGGAATGGAGATGAGACGTTGCCTCCTTCAGTCACTCCAGCAGATCGAGAGCATGA
+TTGAAGCCGAGTCCTCGATTAAAGAGAAAGACATGACCAAAGAGTTTTTTGAGAATAAAT
+CAGAAGCATGGCCCATTGGGGAGTCCCCCAAGGGAGTGGAAGAAGGTTCCATTGGGAAAG
+TCTGTAGGACTCTATTGGCTAAGTCAGTGTTCAATAGCTTGTATGCATCTCCACGGTCAT
+AGCTGTTTACTGA
+.
+qlt:
+8666666688<866997>>C<==><<>>BMC_CEIHCHTVT>>D<@@LJLHQ\__EMHFF
+FIKIPMPLVV\KIJLJGG\X_VVOPPPIMV]\YY_Y__\VV\VV\]V\V\__V___\VVV
+VV_\]V\V\VVVV\RR]VS]\VVV\\__Y_Ya__V\SS\S\__\\V\VVV\\\\V_\V]R
+M\V_____Y___YaaaY_____YRVV\\\a_____Y_______VQNQNLMRPVVV\OVV_
+]VTa]aTXR]]VVV_Yaa_]__VXPLLXXXXVSSVO\VPXVVXTWXPa]RT]]__V_V\\
+V\\aV\VVV\__]V____aT]RP]]_VVXRXXYY__Y__V__Y_________________
+V___X__V_VXTXXXWWXXP\V___aa_a__]]]XXVX__]V]_WMJJOOV_V\_]__Y_
+Y__aaaa]aRPa]\VVXXXX_VTXRXX]XRR]\________VXXX]]aaaaPRRVV]V]V
+]]LLW]]VX_aYY____aa_______]_______T]RXXaaRaTTVV__\]XV]]VHXH_
+]VaaaaPPWX___Y___TYV\XTa]aaaT]]_]VVPDD<;IKV\TRXRVXTRTWPKWB>I
+EXCHIEBB99>DK
+.
+frg:67
+clr:17,570
+}
+{RED
+iid:170
+eid:1086975768
+seq:
+GGGGGCTGTGCCCTTCGTCCTCCAGCAGATCGAGAGCATGATTGAAGCCGAGTCCTCGAT
+TAAAGAGAAAGACATGACCAAAGAGTTTTTTGAGAATAAATCAGAAGCATGGCCCATTGG
+GGAGTCCCCCAAGGGAGTGGAAGAAGGTTCCATTGGGAAAGTCTGTAGGACTCTATTGGC
+TAAGTCAGTGTTCAATAGCCTGTATGCATCACCACAATTGGAAGGATTTTCAGCGGAGTC
+AAGAAAACTGCTTCTTGTTGTTCAGGCTCTTAGGGACAATCTCGAACCTGGGACCTTTGA
+TCTCGGGGGGCTATATGAAGCAATTGAGGAGTGCCTGATTAATGATCCCTGGGTTTTGCT
+CAATGCATCTTGGTTCAACTCCTTCCTGACACATGCATTAAAATAGTTATGGCAGTGCTA
+CTATTTGCTATCCATACTGTCCAAAAGGTCATAGC
+.
+qlt:
+=999867677777=<77<9:@<99;;=@BGGGQSPNKKIIJHQQJNQQ\\SR_T_VTTTV
+MRHRISRXRH\]SOMQGGNNMM\\\\V\_]VXVMMPPSS_\]\\\]____Y_\VSSSR__
+_______]V\\\R\\\V\_____]____]X\\SS_\VXY]____Y__VV\\V\Y___a_Y
+__YY__Y___\XV\\\Va]T________Y_____Y_Y\]___YVVVXX\_Y__VV___V_
+__V___]YY_YYYYYY___]_]___Y____V__V____Y_Ya]YY___Y_Y___YY____
+Y__aa]V___Y_]_T__Y______Yaa__YYY_____Y__Y_______aYTY_____Y\V
+S\V\______YY______Y_aaaaa]VV\\\\Y____Y_]]____T\]V______a____
+________Y_YY_Y_V__a_____Y__WWA;D@:7
+.
+frg:2
+clr:12,419
+}
+{RED
+iid:171
+eid:1086975788
+seq:
+GCGGTAAACAACGACTGAAGAACAAGCTGTGGATATATGCAAGGCTGCAATGGGATTGAG
+AATCAGCTCATCCTTCAGCTTTGGTGGGTTTACATTTAAAAGAACAAGCGGGTCATCAGT
+CAAAAAAGAGGAAGAAGTGCTTACAGGCAATCTCCAAACATTGAAGATAAGAGTACATGA
+GGGGTATGAGGAGTTCACAATGGTGGGGAAAAGAGCAACAGCTATACTCAGAAAAGCAAC
+CAGAAGATTGGTTCAGCTCATAGTGAGTGGAAGAGACGAACAGTCAATAGCTGAAGCAAT
+AATCGTGGCCATGGTGTTTTCACAAGAGGATTGCATGATAAAAGCAGTTAGAGGTGACCT
+GAATTTCGTCAACAGAGCAAATCAGCGGTTGAACCCCATGCATCAGCTTTTAAGGCATTT
+TCAGAAAGATGCGAAAGTGCTTTTTCAAAATTGGGGAATTGAACACATCGACAGTGTGAT
+GGGAATGGTTGGAGTATTACCAGATATGACTCCAAGCACAGAGATGTCAATGAGAGGAAT
+AAGAGTCAGCAAAATGGGTGTGGATGAATACTCCAGTACAGAGAGGGTGGTGGTTAGCAT
+TGATCGGTTTTTGAGAGTTCGAGACCAACGTGGGAATGTATTATTATCTCCTGAGGAGGT
+CAGCGAAACAGGTCATAGTGTGTTTTCCTGACGGGATTTTTTTATGAAAATCACTGTACG
+TTTTCGGATTGGTATGAAAATCAAAAAACGAATGATGTCTCACCACCCCCCTTCTACTGG
+AAATATTTCCCCCACCCTTTTGCCTGACTTTTATTCCTCTCGTGGCTTCGTGGCTCTGGA
+GTCAAACTGGTAATACTCCACTTCCACATTTGTCAGTCTGTTGAATTCCATCTATGAAAT
+AGCATAGAACTTTTGAAAATGCCATAATGCTGAAGAGGGGGGGATCGCGATAAATGCCTA
+TAGACAAGGTATAGGTACTCAAGGCTTTAAAGGGTTCCAAGGGGAACACAGGCCAACGAT
+GTGC
+.
+qlt:
+8666976668<:<<<78;>DEFNKINOMRJ>>B?I<BB???MCSIEECEGEC@@IILCMM
+FOKNJJJLVMMHTC at 99F@a]ORSRZTRX\VV\\V\_Y__Y_\\RSRR\]Y___XWXLMM
+VV\V_]]PR]]]]XT]]_TTV\\\\\__Y__YVVVV]]__Y_a]VXP]T]RP\\\\RR\]
+____VXWHJLJOOVVVV\V\\V]_]aT__\___Y__]_YY_T\V___VWXLXW]___]]]
+XXaaVRS\VV_VV\RRR\V\\RXRTa]_a]a]PMMMVMRVVY_Y__VTX]aTT\V__YY_
+Y_Y_V_VV\\VV\aaaaa\VV\\ST__VV\\V\Y____YY_]__YY_V\XPT]V______
+_____VYY_Y__\\XP\\_T_V\VTXVV___YY____Y____\\TVXa\_Y___Y_____
+_XXPSaSSRQQRV\\V_Y___\a________Y__aY_]_Y_Y_Y____TXX_XXaa____
+_______V]a__________V]XX]V____]\\V___TVVV]V\______X\VaaaVV\\
+\Vaa_]Y_____X]T_V___YV\\\\\_]__Y_________Xaa_]_______V______
+_______________________VV_V__aaVV\H\M\\T__T____Y_VVRNKJEHDDP
+BCPFP]V]\\RKHRS@>6697>A>>=::67:976977<97679>::9;8:9978977997
+97778;6689967777986667778:<=:;B<;79899977988??<<<7997678799:
+977999777779877==7788999977=7;9:7;97988777797779777769677<97
+977977778897787798:87799997979797797766:87787789777767779897
+7:97977989998697=8:9898797:797888:777<<H<C797799669;@9989899
+66777799:777997766966679998777778999987779979897788999977779
+7766
+.
+frg:20
+clr:12,648
+}
+{RED
+iid:172
+eid:1086975781
+seq:
+CAGGTTGACGAGTCTCGAATTAAAGAGAAGACATGACCAAAGAGTTTTTTGAGAATAAAT
+CAAAAGCATGGCCCATTGGGGAGTCCCCCAAGGGAGTGGAAGAAGGTTCCATTGGGAAAG
+TCTGTAGGACTCTATTGGCTAAGTCAGTGTTCAATAGCCTGTATGCATCACCACAATTGG
+AAGGATTTTCAGCGGAGTCAAAAAAACTGCTTCTTGTTGTTCAGGCTCTTAGGGACAATC
+TCGAACCTGGGACCTTTGATCTCGGGGGGCTATATGAAGCAATTGAGGAGTGCCTGATTA
+ATGATCCCTGGGTTTTGCTCAATGCATCTTGGTTCAACTCCTTCCTGACACATGCATTAA
+AATAGTTATGGCAGTGCTGCTATTTGCTATCCGTACTGTCGGTAATA
+.
+qlt:
+6667777777667::<88<<<<<<;;A at 88??=<=<<<>>=?=?CCCGE at EE>EGMMFNF
+BB::==ACCEFENNHCAAB>@BIJMROSMMLJWLGJHHEHHDDHHRRRMMHHJKWLKKCC
+ECKJMFHBGGIMXLLPLLHLNDDDIKDBKIMRVIIGKKKHMMSMXLXLLMMLMMRHHKEI
+I]KLMOORXKKCBKGCLGCJ<9CJKXPPPPaaRVPRXXPXXXWTLPPXLLPPKIISMLLG
+KKCCMMXXPWGLXPXXXPSPPXaa]]]XPPPPPKKEKMKLPLXPLLKICGELKXPLPXPM
+MLLMSPXPKKaLXXXPRTPXWLLLPPLaaLLXXXX]LLLL]]PaaLLPNMSLLMaPLP]]
+]PXLGLKKLLPPXLGKKLLXPXXWaLGGLJJ@>DJKLKLLPED:9=<
+.
+frg:10
+clr:45,375
+}
+{RED
+iid:173
+eid:1086975818
+seq:
+AGTCAGCGCATGGGATTGAGAATCAGCTCATCCTTCAGCTTTGGTGGGTTTACATTTAAA
+AGAACAAGCGGGTCATCAGTCAAAAAAGAGGAAGAAGTGCTTACAGGCAATCTCCAAACA
+TTGAAGATAAGAGTACATGAGGGGTATGAGGAGTTCACAATGGTGGGGAAAAGAGCAACA
+GCTATACTCAGAAAAGCAACCAGAAGATTGGTTCAGCTCATAGTGAGTGGAAGAGACGAA
+CAGTCAATAGCTGAAGCAATAATCGTGGCCATGGTGTTTTCACAAGAGGATTGCATGATA
+AAAGCAGTTAGAGGTGACCTGAATTTCGTCAACAGAGCAAATCAGCGGTTGAACCCCATG
+CATCAGCTTTTAAGGCATTTTCAGAAAGATGCGAAAGTGCTTTTTCAAAATTGGGGAATT
+GAACACATCGACAGTGTGATGGGAATGGTTGGAGTATTACCAGATATGACTCCAAGCACA
+GAGATGTCAATGAGAGGAATAAGAGTCAGCAAAATGGGTGTGGATGAATACTCCAGCACA
+GAGGTCATAGCTGTTTCCTGGGGACCAGTGATTAAGAACAACATGATAAACAATGACTCT
+TGGACAAACAACAGCCCATGTGGACCTTGGAATTAAGGAGGGAAAAAGGGGCC
+.
+qlt:
+96676678><=A@@:87 at AE@<==><<?@A>DIDDBCCCPMBBBBFGHPJRGCEB<>FHC
+COCEIPGKVVKQIRVMQKCCCCCG\\PXTHWWLL]MRSVV\\\V\\\_VXXXPPRRQMVV
+\\WXLLMNROLLSSRRRIV\]]_\VV\VV]____V\]VRMRX]X_a\_VWXXXTT_____
+______V\MKLLWOV\SVVTWWRPLJLRMV_VVV\RR\VVVMXLaa]PXXXXLHJJOLLX
+]]]__]XXPXPaaX]XX]T__VVRRSSXW]XPVVTTV]\VV\VOWPaMMVVVV]VRTXXV
+VV_XTVXXXXPPXX__]__V____W]XVXX]VXXLLXXP]XVXXRRTW__YTY___]VXV
+XXXXWPSaX___V__V___]VPPGGWWPXWXXXX]aRXX_Y\_______\___]aTXV\_
+_V_]XRXXTXXXLLXaXTVXR]XVVXRVV__a__V____]XWLLXXV__aMMMOVRX\XX
+XXTX\V]_\\XXaLLaXX]XT]LLXX_____]X]RXTaaTaRVVVV\T_V\XXWXXRX]T
+LLXTVSMD=<<====>D7977989::999::8;999@:;799797998899899997888
+?>9999997:9999<=;9979<89977;:@99999:99:9999999::76966
+.
+frg:46
+clr:10,518
+}
+{RED
+iid:174
+eid:1086975882
+seq:
+GTTTTACGGGTCTCGATTAAGAGATGACATGACCAAAGAGTTTTTTGAGAATAAATCAGA
+AGCATGGCCCATTGGGGAGTCCCCCAAGGGAGTGGAAGAAGGTTCCATTGGGAAAGTCTG
+TAGGACTCTATTGGCTAAGTCAGTGTTCAATAGCCTGTATGCATCACCACAATTGGAAGG
+ATTTTCAGCGGAGTCAAGAAAACTGCTTCTTGTTGTTCAGGCTCTTAGGGACAATCTCGA
+ACCTGGGACCTTTGATCTCGGGGGGCTATATGAAGCAATTGAGGAGTGCCTGATTAATGA
+TCCCTGGGTTTTGCTCAATGCATCTTGGTTCAACTCCTTCCTGACACATGCATTAAAATA
+GTTATGGCAGTGCTACTATTTGTTATCCGTACTGTCCAAAAAAGTACCTTGTTTCTACTG
+GTCATAGCTGTTTCCTG
+.
+qlt:
+976799976687788=>>A>>;96669>@@A>>A??@JJHX\\PBBBBEIISSIKGFBBD
+HMJLGKJM\VSRR]_VQPOS\]VVVVRQ\V\\__WXWLLMMOPNRV\QOXSOO\VVQQOV
+MMLLOOVV___V_\V\\VSX\XTPXR\\XQQRSR]XY_VVXVX_______T_V]P]]]\V
+SXX\\V\SMOMMRRVOOLLOOVVV\a_]__aaYT_\\V\VV_\_TTXXRRRV\VXPaWPP
+XW_]a\SRVVVY\\V\VORRaa]a____XVVRRXW__XVX]aXPXXXTXXXRV\VVV___
+_YV]aaa]Y__Y____\VXT]V_Vaaa]\V\\SRVaaaa___TX\X___V_TVXXX]\XX
+XXWXXVXXXXPXX_______V___YV____]\_V\RX]]______V\_YaaaaXLLXPSX
+XXGDE=B at JFSMMHDD<
+.
+frg:73
+clr:34,396
+}
+{RED
+iid:175
+eid:1086975779
+seq:
+CGCATCAGAGATGTCAATGAGAGGAATAAGAGTCAGCAAAATGGGTGTGGATGAATACTC
+CAGTACAGAGAGGGTGGTGGTTAGCATTGATCGGTTTTTGAGAGTTCGAGACCAACGTGG
+GAATGTATTATTATCTCCTGAGGAGGTCAGTGAAACACAGGGAACTGAGAGACTGACAAT
+AACTTATTCATCGTCGATGATGTGGGAGATTAACGGTCCTGAGTCGGTTTTGGTCAATAC
+CTATCAATGGATCATCAGAAATTGGGAAGCTGTCAAAATTCAATGGTCTCAGAATCCTGC
+AATGTTGTACAACAAAATGGAATTTGAACCATTTCAATCTTTAGTCCCCAAGGCCATTAG
+AAGCCAATACAGTGGGTTTGTCAGAACTCTATTCCAACAAATGAGAGACGTACTTGGGAC
+ATTTGACACCACCCAGATAATAAAGCTTCTCCCTTTTGCAGCCGCTCCACCAAAGCAAAG
+CAGAATGCAGTTCTCTTCACTGACTGTAAATGTGAGGGGATCAGGGATGAGAATACTTGT
+AAGGGGCAATTCTCCTGTATTCAACTACAACAAGACAACTAAAAGACTAACAATTCTCGG
+AAAAGATGCCGGCACTTTAATTGAAGACCCAGATGGTCATAGTGGGTTTCCTGA
+.
+qlt:
+669696668::::;CCCCCCCCGCDERRTHGG>FDDGM_GKGHLEJK at HH@>GFARMILL
+MMLHIIGGGNPVOVVQPPPQN\VVSV\VVRRRRV]____XWRSRMVRXRRSVVVVOVV_\
+QQVVVV__TVVV\VVTaaXXXXYVVV\\VVMXVVVV\VVQSLJONVRTPMMS\VMV\VV\
+__Y]a]]]_V__]aXLLWXXVV\VXVNMM\V\VVaaa_]]aRRaTTPXV_]_OVV\VVY_
+___]]]XPRRV\VVWXPLLXX_V__XVVX__V_TT___]_]XXXXaa_WTPLLWX__XT\
+VVPX]]______]Y_VVXPMR\VVV_______X__V__V_]XXXPTR\VOVV__Y_XWLG
+GaXR]]_TV_XXPPWV___XWPTEEWX__TVY\VV\\]_]]TaaLLXPVV_\\aa_VVVV
+VV_VVVXXXVX_WWXGGXPVXVVa__a]_V_______XWXXX]XaVXV]]__]VXR\VVX
+MKCCMMX]aaaa]aaXX\VXXVVXTXX_]]aaaaaa]\XT]]_]]TXXXLLLXW_____a
+_aaa____T_a_aa____YV\VV\VV_____\\RP\V__XaTaLLWX]______a]aaaR
+X]]\SHM\VaVR\\RV\V_X\XXXHGGE>]MLL]THDBG>=998777>@C99:A
+.
+frg:12
+clr:6,610
+}
+{RED
+iid:176
+eid:1086975772
+seq:
+GCGGTTGATCTCAGTAAGAGAGGGTGGTGGTTAGCATTGATCGGTTTTTGAGAGTTCGAG
+ACCAACGTGGGAATGTATTATTATCTCCTGAGGAGGTCAGTGAAACACAGGGAACTGAGA
+GACTGACAATAACTTATTCATCGTCGATGATGTGGGAGATTAACGGTCCTGAGTCGGTTT
+TGGTCAATACCTATCAATGGATCATCAGAAATTGGGAAGCTGTCAAAATTCAATGGTCTC
+AGAATCCTGCAATGTTGTACAACAAAATGGAATTTGAACCATTTCAATCTTTAGTCCCCA
+AGGCCATTAGAAGCCAATACAGTGGGTTTGTCAGAACTCTATTCCAACAAATGAGAGACG
+TACTTGGGACATTTGACACCACCCAGATAATAAAGCTTCTCCCTTTTGCAGCCGCTCCAC
+CAAAGCAAAGCAGAATGCAGTTCTCTTCATTGACTGTAAGGTCATAGCTGTTTCCTAATG
+TCGACGACAAGACTTTATGGATTACTTCGACCGTGATACTAACCAACAGCAGTTTAATGG
+GAAGAAATTGTTGTTGAATGCCTTAAAAACAAACTTGTGGTGTGGCTATACTGCC
+.
+qlt:
+86666666666<;><77<DKK>>@>>A at C@ECIMIIEKEJIPOSZSOOOPPJPPPONROM
+KIINIG]__\KGGGGMMZ\\____Y____Y__YOOOOOPR\V\\\]SSZPPOMOL\\VVP
+PPPMM\V\V_Y___YYMNPOOMaa\XR\\\V\V___RVVS\\____]]____YY___]aa
+__\V\VV\__Y_Y_____VVVVV\VV\XR\]\V\\]\____Y_]]___V\]VVVaa_V\V
+\SS]]___Y___]____Y_]]YY___Y_YY_____YYVVVV\\VV\VVa___V__VV]\V
+\\__T_WXXLLWOVV\V\__VV_aaa]____XXRPWXY____V\\X\V___TaRRRVVV\
+V_YVV_\]V___YY_Y______\WXLPXX___Ya_]a_]Y_Y______\__\\Xa__YRV
+V\\\YY_YY_XWLLWWX\\TXaa]]V\VVVVXXRXXP]\WWXXXLC@=AEGJFDD97697
+7799:;9:9:999999997999>99999<<9998;9<:99:999::9999999:::9<<A
+=D;9999779999999::999997<9999;7999:?<;99999999989999996
+.
+frg:6
+clr:12,435
+}
+{RED
+iid:177
+eid:1086975793
+seq:
+CGGAGACTTTCATCTTTAGTCCCCAAGGCCATTAGAAGCCAATACAGTGGGTTTGTCAGA
+ACTCTATTCCAACAAATGAGAGACGTACTTGGGACATTTGACACCACCCAGATAATAAAG
+CTTCTCCCTTTTGCAGCCGCTCCACCAAAGCAAAGCAGAATGCAGTTCTCTTCACTGACT
+GTAAATGTGAGGGGATCAGGGATGAGAATACTTGTAAGGGGCAATTCTCCTGTATTCAAC
+TACAACAAGACAACTAAAAGACTAACAATTCTCGGAAAAGATGCCGGCACTTTAATTGAA
+GACCCAGATGAAAGCACATCCGGAGTGGAGTCTGCCGTCTTGAGAGGGTTTCTCATTATA
+GGTAAGGAAGACAGAAGATACGGACCAGCATTAAGCATCAATGAACTGAGTAACCTTGCA
+AAAGGGGAAAAGGCTAATGTGCTAATCGGGCAAGGAGACGTGGTGTTGGTAATGAAACGA
+AAACGGGACTCTAGCATACTTACTGACAGCCAGACAGCGACCAAAAGAATTCGGATGGCC
+ATCAATTAATGTTGAATAGTTTAAAAACGACCTTGTGGTCATAGCTGGTTTCCGAA
+.
+qlt:
+66866777::<<<<<>>>BBE<<<<<<@BCBF>IHJJEEIPOOJMJLMRZZZSZPOOKHH
+]TV\\\VFGFD?@@?BFPV_JMMPPMV_VV_SSSR\\V\\\XVV\VV\OSNMOMX]\Y__
+_V____Y__Y_V\VJSV\V_\\VVSV___Y_Y__VXTLLW]_V___aaaa\\\\VV____
+_____Y__a_a_XV\\V\VV]\\V_____Y______T__Y_Y__YYY_______\SVX\\
+______YYY_Y_______TT____]_]__aa_a_T___]VVVV\_YY_V__X____Y_\O
+MMVSR]RSWXVT\_]]_YYaa_YT___V______Y_YV]aVXVV_VV______Y_Y__Y_
+YY__T_V]]RX]]TaVRRV\\_YY_V_aa]Taa]__YY______]aa]a]Y_]_______
+__]_a____]]____Y___YY__]Y_Y__________VV__]]aa____Y________aa
+_____X\V\V\aa]__\__________________VVVTXXT_\]aRR\VVVRSV\V\__
+_]_____V]\]\V__\WM>;W]___]]aRa]a_aaXXMSLLFFDD?<GFK?A<<<<
+.
+frg:25
+clr:29,552
+}
+{RED
+iid:178
+eid:1086975843
+seq:
+GGGGATAGGGCTTGGAACACCCAGATAATAAAGCTTCTCCCTTTTGCAGCCGCTCCACCA
+AAGCAAAGCAGAATGCAGTTCTCTTCACTGACTGTAAATGTGAGGGGATCAGGGATGAGA
+ATACTTGTAAGGGGCAATTCTCCTGTATTCAACTACAACAAGACAACTAAAAGACTAACA
+ATTCTCGGAAAAGATGCCGGCACTTTAATTGAAGACCCAGATGAAAGCACATCCGGAGTG
+GAGTCTGCCGTCTTGAGAGGGTTTCTCATTATAGGTAAGGAAGACAGAAGATACGGACCA
+GCATTAAGCATCAATGAACTGAGTAACCTTGCAAAAGGGGAAAAGGCTAATGTGCTAATC
+GGGCAAGGAGACGTGGTGTTGGTAATGAAACGAAAACGGGACTCTAGCATACTTACTGAC
+AGCCAGACAGCGACCAAAAGAATTCGGATGGCCATCAATTAATGTCGAATAGTTTAAAAA
+CGACCTTGGGTCATAGCTGTTTCCTGA
+.
+qlt:
+99967776786677878@@<<<<<<D=HGCFMJNEKRIMMRSSSLLDGGLQV_DDFHIIM
+MO\\SSRRRJRKKMQQQPQ]XaaPPPPPP_______\QQOOOR_aPORPPMVQQOQN\RR
+V\VV\SP]\Y__________]____Y_V\\\VVVV\VRVXTRX]VY____]]XX]]_V__
+_Y_Y]_\V\\]VMR\\\aY_______Y____a]PPROMOLLTX_V____V______XVRX
+XVV_VT___YT_VXVV__]T____]]__Y_______X_VT]OHJMMRPSLLSM\_TV\VV
+MR\\_V\XRT]_VXXVV___VXPR\V__YV____Y__aV______]]_XVXXVTY____a
+a__Y]S]MSSRVXXTXaPaV_TVVVVSVXXVRRV]Y__VVV\VVXXV__]]]]a]aTTVX
+VVXVXXRVXXWXXXX]]]aRMRMVMRRRRS\\_]__]___\\XTXXRXXXRTWXXV]_WW
+LLXPLLPTTWWA<GDLLPaVRPMG>K]
+.
+frg:45
+clr:18,462
+}
+{RED
+iid:179
+eid:1086975794
+seq:
+GGGGGGCATTTGAACCACCCAGATAATAAAGCTTCTCCCTTTTGCAGCCGCTCCACCAAA
+GCAAAGCAGAATGCAGTTCTCTTCACTGACTGTAAATGTGAGGGGATCAGGGATGAGAAT
+ACTTGTAAGGGGCAATTCTCCTGTATTCAACTACAACAAGACAACTAAAAGACTAACAAT
+TCTCGGAAAAGATGCCGGCACTTTAATTGAAGACCCAGATGAAAGCACATCCGGAGTGGA
+GTCTGCCGTCTTGAGAGGGTTTCTCATTATAGGTAAGGAAGACAGAAGATACGGACCAGC
+ATTAAGCATCAATGAACTGAGTAACCTTGCAAAAGGGGAAAAGGCTAATGTGCTAATCGG
+GCAAGGAGACGTGGTGTTGGTAATGAAACGAAAACGGGACTCTAGCATACTTACTGACAG
+CCAGACAGCGACCAAAAGAATTCGGATGGCCATCAATTAATGTTGAATAGTTTAAAAACG
+ACCTTGTTTCTACTGGTCATAGCTGTTTCCTGA
+.
+qlt:
+9967966898:;77;?D@?<<<ACEHCIHLJMIV\M]\\]RJFGFFGMVX_JKKHIKOMO
+SMRRSQMFQQQQNHCAAEIXTNIPPOP\_____VSSRRSSZ_aUOSPMP]MJOMJFDGJM
+R\__Y__Y__VV\VV\YYaaa___YOSSNMNV\V\VVY_V\\VV\__________V_T_Y
+_]]_\\VX]VRRV\\a___Y____\__TaaY]_______Y__T________a___Y___Y
+_]_a]_Y____Y_YYYV\\XVS__Y__YT_______Y]]VS\VMVa\VV\\V___Y_Y_Y
+______YOV\\VVaa]aaaT__]___Y_Y__]___]aV_]___Y_______YY_]TYYY_
+_________Y__Y_Y_Y_Y___________Y_]_Y____Y_\\V\______Y____Y___
+_Y__Y____YYYY\___VV\\\\___Y_______________Y_Y____\VXX____a]a
+a]a]aa_aWLLWWPPWMD=D?GEHLPJGHHDD]
+.
+frg:26
+clr:3,470
+}
+{RED
+iid:180
+eid:1086975805
+seq:
+AGCAGCCACATTTGATGGATGTCATCCGACTCTACTGTTCCTAAAGGTTCCAGCGCAAAA
+TGCCATAAGCACCACATTCCCTTATACTGGAGATCCTCCATACAGCCATGGAACAGGAAC
+AGGGTACACCATGGACACAGTCAACAGAACACACCAATATTCAGAGAAGGGGAAGTGGAC
+GACAAATACAGAAACTGGGGCACCCCAACTCAACCCAATTGATGGACCACTACCTGAGGA
+TAATGAGCCGAGTGGATATGCACAAACAGACTGTGTCCTGGAGGCTATGGCCTTCCTTGA
+AGAATCCCACCCAGGTATCTTTGAGAACTCATGCCTTGAAACAATGGAAGTCGTTCAACA
+AACAAGGGTGGACAAACTAACCCAAGGTCGCCAGACTTATGATTGGACATTAAACAGAAA
+TCAACCGGCAGCAACTGCATTAGCCAACACCATAGAAGTTTTTAGATCGAATGGACTAAC
+AGCTAATGAATCAGGAAGGCTAATAGATTTCCTCAAGGATGTGATGGAATCAATGGATAA
+GGTCATAGCTGTTTCCTAA
+.
+qlt:
+66666666789>==CC=D<DA>LLJPIQV\___SSRRSJQQMQQSRSSIFAF at AIMMRNG
+MEIIJPO_TVJOQLFCDLPS__VVV\RR\VOOV]VV]]]V]\VVV\VOOQSSMVVVRVVV
+\\Y\V\OV\VORRSSSR\\____VVTRROOV\\\V__T_\SQQKQ]a]aaY_____VTXV
+RXV]]_____T__V\VV_V\____Y]]__V]VYV\VVVVVV\\VVV\\\VV___a]a\VV
+\\VT_V]]aTaaaVVVVVV_____]___VVXXVTTV\VRP\VYY_____]_Y_Y_Y__XX
+TLLOMVVV__Y_V]XXV__YaaaPLL]]]____]aaY_____VTXaa]VRXVVXV]_]__
+________\_VXV]Y__Y_____Y___aaV_]]aRa]_YY_Y\VV___TYY_\YXXaSX]
+YY_____]a___]]_____X]PMLMOV\__Y]]XaPPP]a__XXRRXXVaaa________
+_____V___TTaaPX\]____\_WXXXWW_a_____Y______________VV\\V\S__
+___XXMHCCEFQNJD=9<<
+.
+frg:35
+clr:10,515
+}
+{RED
+iid:181
+eid:1086975904
+seq:
+GGAAGGACACATTTTGATGGATGTCATCCGACTCTACTGTTCCTAAAGGTTCCAGCGCAA
+AATGCCATAAGCACCACATTCCCTTATACTGGAGATCCTCCATACAGCCATGGAACAGGA
+ACAGGGTACACCATGGACACAGTCAACAGAACACACCAATATTCAGAGAAGGGGAAGTGG
+ACGACAAATACAGAAACTGGGGCACCCCAACTCAACCCAATTGATGGACCACTACCTGAG
+GATAATGAGCCGAGTGGATATGCACAAACAGACTGTGTCCTGGAGGCTATGGCCTTCCTT
+GAAGAATCCCACCCAGGTATCTTTGAGAACTCATGCCTTGAAACAATGGAAGTCGTTCAA
+CAAACAAGGGTGGACAAACTAACCCAAGGTCGCCAGACTTATGATTGGACATTAAACAGA
+AATCAACCGGCAGCAACTGCATTAGCCAACACCATAGAAGTTTTTAGATCGAATGGACTA
+ACAGCTAATGAATCAGGAAGGCTAATAGATTTCCTCAAGGATGTGATGGAATCAATGGAT
+AAAGAGGAAATGGAGATAACAACACACTTTCAAAGAAAAAGGAGAGTAAGAGACAACATG
+ACCAAGAAAATGGTCACACAAAGAACAATAGGAGGGTCATAGCTTGTTTACTGA
+.
+qlt:
+969778666788<D>>AN<<<@?>BCQPFRMS_Y_SSRRMMSS\RRNLOOIFHDFAJMM\
+MMLEJKSMKPQNGGFFFCHPPVSY\\\RSR\_ONRSSSVV\\VSSRRRR\RR\RRR\\V\
+\\VV\X\\\VV__\\RRSS\V\V____T_________Y_Y_Y]\XRXXV__VTVX]\YYY
+_____\T_]]XRPX]V\V\_VV____]Y_____YY\\VV\VVV\\OV\V\\\\___]aa\
+\RV\\VXTa_a_a]aVVVV\V_______Y__V_XVaa_a]aPV]_____Y_a]aa]]_a_
+]\V_T]T__Y_____\\XV___aaaTPP]]]____]Y_Y_YT_____a_a_]___V\V\\
+\_______aaaV\VVV]Y___YRV\\VSaT_______V_______YV\\\VVYY_V]]XX
+\]YY_____aaa]___Y__]a]]aXX_V_Y_Y_VWXLLPTT___WXLLXXY]\X______
+______V______V____aaaa]_\V______a___]Y____YVVV\VV_______\\V\
+\MaaaaY___Y_____\]__a__________Y____Y__Y___V__Y]\PPV]]_]]VSR
+\\S____YTT__T___V]TT\aPR]T_TT__KTB?HJ\ML=@:668;;?7;;>H
+.
+frg:63
+clr:13,610
+}
+{RED
+iid:182
+eid:1086975795
+seq:
+CATGATGCAGTCATCCGACTCTACTGTTCCTAAAGGTTCCAGCGCAAAATGCCATAAGCA
+CCACATTCCCTTATACTGGAGATCCTCCATACAGCCATGGAACAGGAACAGGGTACACCA
+TGGACACAGTCAACAGAACACACCAATATTCAGAGAAGGGGAAGTGGACGACAAATACAG
+AAACTGGGGCACCCCAACTCAACCCAATTGATGGACCACTACCTGAGGATAATGAGCCGA
+GTGGATATGCACAAACAGACTGTGTCCTGGAGGCTATGGCCTTCCTTGAAGAATCCCACC
+CAGGTATCTTTGAGAACTCATGCCTTGAAACAATGGAAGTCGTTCAACAAACAAGGGTGG
+ACAAACTAACCCAAGGTCGCCAGACTTATGATTGGACATTAAACAGAAATCAACCGGCAG
+CAACTGCATTAGCCAACACCATAGAAGTTTTTAGATCGAATGGACTAACAGCTAATGAAT
+CAGGAAGGCTAATAGATTTCCTCAAGGATGTGATGGAATCAATGGATAAAGAGGAAATGG
+AGATAACAACACACTTTCAAAGAAAAAGGAGAGTAAGAGACAACATGACCAAGAAAATGG
+TCACACAAAGAACAATAGGAAGGTCATAGTTG
+.
+qlt:
+77768;6667@>>@>GJEJGGMKEHSKHQQQNOKNNPHGHHHDLQNNBBGGEEMJJSOOP
+\VXVZISXX]\QNPQQOR_PPZSORRRRMSPV\VV\\RSXSSS\V\\\\V\V\VV\\V__
+\\SSSSV\V\V\\VTY\X\\VV\\V\O_\SSRRRV___Y_Y___YTYYVVV\V\__\___
+____YY_Y_____]]]__]_]Y\\VV\VVV\VVXV\\\\V__S\VVRR\\\V_Y__a___
+_Y\V\\V\YY_YY___Y__V___]aaa]__YY______Ya]V]aa_Y__]\V]\\S___Y
+_______Y__a_a_____Y__Yaaa_Y__T]___Y________T_]_Y___Y_______T
+_T___T__Y__Y___aY_______Y_____Y\YY_Y_YYYY______\______]_____
+]___Y_____YVVVV\\Y____VTXXX___]]aaaaaY___________a______Y___
+__V________________]______Y__YX\\XXV_Y___________aa________Y
+\\\V\\_______a]V\V\\]a_____Taa____\_a___V]____________\V\VVV
+_V_V\\\__RRGCCCG\DC77ED;8B=87686
+.
+frg:27
+clr:13,597
+}
+{RED
+iid:183
+eid:1086975890
+seq:
+ACCCAGGCCTAAGCTAATGAATCAGGAAGGCTAATAGATTTCCTCAAGGATGTGATGGAA
+TCAATGGATAAAGAGGAAATGGAGATAACAACACACTTTCAAAGAAAAAGGAGAGTAAGA
+GACAACATGACCAAGAAAATGGTCACACAAAGAACAATAGGGAAGAAAAAACAAAGAGTG
+AATAAGAGAGGCTATCTAATAAGAGCTTTGACATTGAACACGATGACCAAAGATGCAGAG
+AGAGGTAAATTAAAAAGAAGGGCTATTGCAACACCAGGGATGCAAATTAGAGGGTTCGTG
+TACTTCGTTGAAACTTTAGCTAGAAGCATTTGCGAAAAGCTTGAACAGTCTGGACTTCCG
+GTTGGGGGTAATGAAAAGAAGGCCAAACTGGCAAATGTTGTGAGAAAAATGATGACTAAT
+TCACAAGACACTGAGCTTTCTTTCACAATCACTGGGGACAACACTAAGTGGAATGAAAAT
+CAAAACCCTCGAATGTTTTTGGCGATGATTACATATATCACAAAAAATCAACCTGAGTGG
+TTCAGAAACATCCTGAGCATCGCACCAATAATGTTCTCAAACAAAATGGCAAGACTAGGA
+AAAGGATACATGTTCGAGAGTAAGAGAATGAAGCTCCGAACACAAATACCCGCAGAAATG
+CTAGCGGTCATAGTGGGTTTTCCTGA
+.
+qlt:
+666668767:778<<<ALOC><<<<<CHKMMS\KKEEEFMO\MOIILLHHGFHNKNKNNO
+MOOJIOMMOSS]SRMRRQNQNSMHRRRR\VV]_V\]VOMPOMO\_______a_____VVV
+VV]\\__Y_\VVV\\V\\\VVVVV\\\]_Y__Y_Y__VVVV]]\RR]]____Y__Ya]a_
+___V__aa_V\VVPPPLT]_V________VV\\\S__Y____________V\VVRRXXRa
+aa_Y___\_YYY__T_Y___________V_]___T_V\V\\\]___WWSPPTT___Y___
+_Y__Vaaa____]__VTXXX\X____Y_Y_YV\PRT\__Y________Ya_Y_____]_]
+Y_Y__Y________aa_a____Y_Y_]__V\VV_Y____YY_Y_Y_________Y_____
+_YY____Y__\VV]]Xaaa_a_____Y_____Y_a__________a]]a]V_Y____]__
+]_______aa]aV]]___a____Y_________Y____Y____]]a____Y_aaa]a_VT
+YT\XXP]]___YYaaa________Y____________________________Y______
+___\\\\V\___]aaa\XX__]]Xa]\\\\\___V\RPV\_______]XEDWW]SJSOVV
+VVS]LXTO\V>>9988@;<<A=999;
+.
+frg:64
+clr:12,641
+}
+{RED
+iid:184
+eid:1086975875
+seq:
+CACAATATAGTAGCTATAGATTTCCTCAAGGATGTGATGGAATCAATGGATAAAGAGGAA
+ATGGAGATAACAACACACTTTCAAAGAAAAAGGAGAGTAAGAGACAACATGACCAAGAAA
+ATGGTCACACAAAGAACAATAGGGAAGAAAAAACAAAGAGTGAATAAGAGAGGCTATCTA
+ATAAGAGATTTGACATTGAACACGATGACCAAAGATGCAGAGAGAGGTAAATTAAAAAGA
+AGGGCTATTGCAACACCAGGGATGCAAATTAGAGGGTTCGTGTACTTCGTTGAAACTTTA
+GCTAGAAGCATTTGCGAAAAGCTTGAACAGTCTGGACTTCCGGTTGGGGGTAATGAAAAG
+AAGGCCAAACTGGCAAATGTTGTGAGAAAAATGATGACTAATTCACAAGACACTGAGCTT
+TCTTTCACAATCACTGGGGACAACACTAAGTGGAATGAAAATCAAAACCCTCGAATGTTT
+TTGGCGATGATTACATATATCACAAAAAATCAACCTGAGTGGTTCAGAAACATCCTGAGC
+ATCGCCCCCATAATGTTCGGTCATAGTGGTTTTTCAATGACAACCGTCTCGCCGATATTT
+AGAAGTGACAGAGTTGAAAAGAGCATAAGAGTAACAAAGAATTGTAGTATTAGCTACAGA
+TTTGTCAAGTTGAGAAGTAAAACATACAATCATACATTGATTTTGACATTTGACA
+.
+qlt:
+666677799677<=<>FADGIMLRRBBBB???FHDA@@E at HIJILKEGEECOOVVRKKXR
+RRRSIA?;77:76877<>QCCNPIIMMV\\\\__V\]\V\_V\\]SVR]PPC=E:89=FX
+XRXTV\\VS\Y_YV\VV]VVS]V\\VPR]]___]_Y__V___Y__T\XaaX_________
+_\\K=8666787;<GJXXW_\XPXX___YY__VVV\\RXXXTaTY_T_Y_______a_a_
+TV___Y___Y_Y_TYV__\SQOOQ\__]RRRRSR]_Y________V\]VV\V_____aaa
+XT\PPXVX_V__Y]aPRVV_________V_V_a__YYY_aaaaaa_a\_YOOQQQQ]VXR
+X\VY___Y__]X\\_]VX_V]aaaaPX]]____Y__Vaa]a_Y___V\XX\]VV\RRRXa
+]____RV\VVV]aaV]]\V\\\\_____VVaaX___YY_________\_\aaVPXT__aa
+]aaa_______V____]V\\\]]___\______V_\\VVSX\_VXXIGKK\\V\a_VXXX
+\VXMMGGFDEHLLLXX__PHCDJ<;6699<<<>877666668;9989999899:9<9989
+9==;<9999989999788999::9999::897779797<:=9<<;;<;@:9<:999999<
+99799:99797799998799<=98997::977967999:989797;@;=:99997
+.
+frg:68
+clr:16,535
+}
+{RED
+iid:185
+eid:1086975902
+seq:
+GAGAAAAGAGCTTTCTTTCCAATCACTGGGGACAACACTAAGTGGAATGAAAATCAAAAC
+CCTCGAATGTTTTTGGCGATGATTACATATATCACAAAAAATCAACCTGAGTGGTTCAGA
+AACATCCTGAGCATCGCACCAATAATGTTCTCAAACAAAATGGCAAGACTAGGAAAAGGA
+TACATGTTCGAGAGTAAGAGAATGAAGCTCCGAACACAAATACCCGCAGAAATGCTAGCA
+AGCATTGACCTGAAGTATTTCAATGAATCAACAAGGAAGAAAATTGAGAAAATAAGGCCT
+CTTCTAATAGATGGCACAGCATCATTGAGCCCTGGGATGATGATGGGCATGTTCAACATG
+CTAAGTACGGTTTTAGGAGTCTCAATACTGAATCTTGGGCAAAAGAAATACACCAAGACA
+ACATACTGGTGGGATGGGCTCCAATCCTCCGACGATTTTGCCCTCATAGTGAATGCACCA
+AATCATGAGGGAATACAAGCAGGAGTGGATAGATTCTACAGGACCTGCAAGTTAGTGGGA
+ATCAACATGAGCAAAAAGAAGTCCTATATAAATAAAACAGGGACATTTGAATTCACAAGC
+TTTTTTTATCGCTATGGATTTGTAGCCAATTTGGTCATAGCTGTTTCCTA
+.
+qlt:
+669::7677<;<77<<<9999:<>;>BADGAEFGGEFFFFFGFMEEEEEEEIKMGEEFPP
+RMXMLKG@<99BH?>>=@AEGGEFFENQQRNKMFFHJMMMMSMLXXLLLLKAAAG at D9:B
+EIILLPXXLGLLLLLJJJLMMXPLMJJMMLHJJJJJJJLXXMMRRRRRLLFGGLKQRRSR
+MOMMKKHHHKKLNPJJHJLLLPXPXLXXaaXXXTMMSLLSPW]PRLHMJJXXXXPXLLLP
+]PLLLPXXWXLTXLMMRSSRMVRRRPXTTX]X]XXPaLLXNRRRGGKGLNNMMMMLLLLX
+aa]V]TLLLLKKLLWMPLGLLLTLLXPLLLaPaaSLLSS\OQNQJQVVVXXXLL]]XPLP
+XTWXGLXPWXXXPLLXPPPPLL]PXRPXXXTVXRRTRR]XPKLCKKXPLLMSVSMSSSXX
+XSPPPTRSRMMSM\VV\XXRROVVMaRR]RPXLLPWLPRPXXXXIIEHHJLP]XXRX]TX
+XRTaLLTLLLMMVV\MXRaaLLXPPRTTTXXPIXXXXLLXLPWXSPXPPXRLPLLX]\_V
+\TRX]]VXaRXX\\]aaa]XX]]T_________aaXRVTSVVVSS\V___TWWLJGGGFM
+]]aa_]]HHRMSHTV_T_TTPCB;9C<>KKPPTPKGDNECEIHHAC<99<
+.
+frg:77
+clr:8,585
+}
+{RED
+iid:186
+eid:1086975872
+seq:
+GGGGTTTATGTTCTCAAACAAAATGGCAAGACTAGGAAAAGGATACATGTTCGAGAGTAA
+GAGAATGAAGCTCCGAACACAAATACCCGCAGAAATGCTAGCAAGCATTGACCTGAAGTA
+TTTCAATGAATCAACAAGGAAGAAAATTGAGAAAATAAGGCCTCTTCTAATAGATGGCAC
+AGCATCATTGAGCCCTGGGATGATGATGGGCATGTTCAACATGCTAAGTACGGTTTTAGG
+AGTCTCAATACTGAATCTTGGGCAAAAGAAATACACCAAGACAACATACTGGTGGGATGG
+GCTCCAATCCTCCGACGATTTTGCCCTCATAGTGAATGCACCAAATCATGAGGGAATACA
+AGCAGGAGTGGATAGATTCTACAGGACCTGCAAGTTAGTGGGAATCAACATGAGCAAAAA
+GAAGTCCTATATAAATAAAACAGGGACATTTGAATTCACAAGCTTTTTTTATCGATATGG
+ATTTGTGGCTAATTTTAGCATGGAGCTTCCCAGTTTTGGAGTGTCTGGAATAAACGAGTC
+AGCTGATATGAGCATTGGAGTAACAGTGATAAAGAACAACATGATAAACAATGACCTTGG
+ACCAGCAACAGCCCAAATGGCCCTTGGTCATAGTGTGTTTATACGAGA
+.
+qlt:
+999766678>>>>AA@@A>?@@BBBBBIPMGIIIJJIPSS?D?AA=KNKOM\V\MOPMOP
+\VIDADHFOMSSVTXRRIT\\V\__VVSSSRV\SSSSSSS\VV_S\\X\\\\\\___V\]
+\\\\\\VY_\VV\VS__Y]VVX_XXSSSOV\_X_]\VSSSS\Va_Y_]SVVVV\V\\_Y_
+_Y________]aaY\\SSSZSSVVVV\V\_____XVVV\\___Y_YY]Y__Y]]V\\\VV
+Y_]_]__]__Y_Y____]a]RV\]XX]__]]___YY__________Y_]]___]XV\\V\
+aaV]\VV\aaa]]]a________________Y____Y__YVYY____YT__aV\\\V\VY
+Y_aaaY_T_\\V\\\_\_]_______Y_Y_____aa]_]aT\\VS\\Y___T__T\__Y_
+_Y_]________]_________]\V]X]____________Y_aaaaa_______Y___V\
+\VV\_____Y____Yaa]_____aaaa_______a__a_Y____aaa________aaY__
+__X]\_______________________Y_________]_____________aaaaa___
+XVV\VV_____]]IG:<FFKWGLXXHMJE@=877767986677777<<
+.
+frg:70
+clr:8,603
+}
+{RED
+iid:187
+eid:1086975832
+seq:
+GGCCTAGGAGCAGGAGTGGAAGATTCTACAGGACCTGCAAGTTAGTGGGAATCAACATGA
+GCAAAAAGAAGTCCTATATAAATAAAACAGGGACATTTGAATTCACAAGCTTTTTTTATC
+GATATGGATTTGTGGCTAATTTTAGCATGGAGCTTCCCAGTTTTGGAGTGTCTGGAATAA
+ACGAGTCAGCTGATATGAGCATTGGAGTAACAGTGATAAAGAACAACATGATAAACAATG
+ACCTTGGACCAGCAACAGCCCAGATGGCTCTCCAATTGTTCATCAAAGACTACAGATATA
+CATATAGGTGCCATAGAGGAGACACACAAATTCAGACGAGAAGATCATTCGAGCTAAAGA
+AGCTGTGGGATCAAACCCAATCAAGGGCAGGACTATTGGTATCAGATGGGGGACCAAACT
+TATACAATATCCGGAACCTTCACATCCCTGAAGTCTGCTTAAAGTGGGAGCTAATGGATG
+AGAATTATCGGGGAAGACTTTGTAACCCCCTGAATCCCTTTGTCAGCCATAAAGAAATTG
+AGTCTGTAAACAATGCTGTAGTGATGCCAGCTCATGGTCCAGCCAAGAGCATGGAAGGTC
+ATAGCTGTTTACTG
+.
+qlt:
+9696769:668777:8;@A;9BBOPPKFFHDDKIEIIIEFNS\RRRMIHBKJHNJKHSSR
+RR\\\VV\OJPCJCY_TTX]]____]SSRPOPOHJSS\RRROOPPNPRVP]]\_\\]V\V
+__\VTV___Y_aY_VVV\\V_VVVXXWRSV\\V__\VRRRR]\_YYV\PX\VRRVV\V\V
+V]PRXXXGH<HMLWX\VXTXVVV\\V\___YV_____VT\XXT]__Y___Y_____VVPa
+]a_aaV\V\VVRX]]V___\XXRXWX___TVVVVVVXa\VV\RRVXXXXVXPWWRP]W__
+____T__V_VV_TTLPaaaMRSRRS]]_aT_TPXGGWLGPPNJRRRVVWPLLXT_VV___
+VXTVVa]VVMVV\\V___Y_YV\RX\]_XXXVXVXXPXXVYVWPSRXWaT\VS\\V_]aV
+__]]]]_____XaXXV__X___V__Ya_a]]XXXXT____\\RXRX\XTXRTX\TXVXXX
+LLL]]_TV\_]VRT]RPXX_a]______a_]V\\]__aaaa_]_XTXT]_X]]XX]]__Y
+V__XVXX\]__V\TaaaaaaaXW]_M\\VVRXXVXXaXXXXXLLWMA?KBCNNVaT]]XR
+WLCA>AAG=;><D<
+.
+frg:34
+clr:9,574
+}
+{RED
+iid:188
+eid:1086975806
+seq:
+GGGCCAAGGGGTCAGCTTTTTTTATCGATATGGATTTGTGGCTAATTTTAGCATGGAGCT
+TCCCAGTTTTGGAGTGTCTGGAATAAACGAGTCAGCTGATATGAGCATTGGAGTAACAGT
+GATAAAGAACAACATGATAAACAATGACCTTGGACCAGCAACAGCCCAGATGGCTCTCCA
+ATTGTTCATCAAAGACTACAGATATACATATAGGTGCCATAGAGGAGACACACAAATTCA
+GACGAGAAGATCATTCGAGCTAAAGAAGCTGTGGGATCAAACCCAATCAAGGGCAGGACT
+ATTGGTATCAGATGGGGGACCAAACTTATACAATATCCGGAACCTTCACATCCCTGAAGT
+CTGCTTAAAGTGGGAGCTAATGGATGAGAATTATCGGGGAAGACTTTGTAACCCCCTGAA
+TCCCTTTGTCAGCCATAAAGAAATTGAGTCTGTAAACAATGCTGTAGTGATGCCAGCTCA
+TGGTCCAGCCAAAAGTATGGAATATGATGCCGTTGCAACTACACACTCCTGGATTCCCAA
+GAGGAACCGCTCTATCCTGGTCATAGCTGGTTTCCTGA
+.
+qlt:
+99976668666997AARIHR<>><=<CEGGGBAABAAIJIIIO\\\XIIKNLJRSSSSVY
+YMPMMIL__VVQNKVMQQOSSIM\]SS]\\RV\\\V\\\XV\___Y_\V\]\]R\\\\RR
+RRSSX_Y\VV\V\\]SV\V\\\\\V____V_SRRQ\VVV__Y____V\XR]Taa__\S\V
+V\]_______]_V____]V\\\V\_]_Y_Y]_aaa___\XXPXTaVVVVV\___YaVVMS
+LLWPLTTVVV\V\\\RRaV]___]TV_______\VV\VVVVRVVVRVY_T_YY__\VR\V
+\______\\XRXTX__\\VVV]YY_Y_YV]]\V\Y___aYY___________]Yaa__]_
+____Y__Y_]]________Y_V\VRRRJR\\V\Y__YaVV\SSVVX__]Y_Y__aa]Y__
+__]________V_V\Y__]___]___]]aa_]___]]__Y_aYVV____________YY_
+_____________]_____Y___Y_Y____aaa_____________Taaa\\V\VO]LL]
+XX]]_Y__\XXXX]]DDMMV\V]OI@?=;=<<<I==GH
+.
+frg:36
+clr:14,534
+}
+{RED
+iid:189
+eid:1086975856
+seq:
+GGGGCATGGATGAGATATCGGGGAGACTTTGTAACCCCCTGAATCCCTTTGTCAGCCATA
+AAGAAATTGAGTCTGTAAACAATGCTGTAGTGATGCCAGCTCATGGTCCAGCCAAAAGTA
+TGGAATATGATGCCGTTGCAACTACACACTCCTGGATTCCCAAGAGGAACCGCTCTATTC
+TCAACACAAGCCAAAGGGGAATTCTTGAGGATGAACAGATGTACCAAAAGTGCTGCAACT
+TGTTCGAGAAATTTTTCCCTAGTAGTTCATATAGGAGACCGATTGGAATTTCTAGCATGG
+TGGAGGCCATGGTGTCTAGGGCCCGGATTGATGCCAGAATTGACTTCGAGTCTGGACGGA
+TTAAGAAGGAAGAGTTCTCTGAGATCATGAAGATCTGTTCCACCATTGAAGAACTCAGAC
+GGCAAAAATAATGAATTTAGCTTGTCCTTCATGAAAAGGTCATAGCTGTTTCCTAAAGAA
+GGACGAGCTACATTTAGTATTTTTGCCGTCAGAGTTCTACAATGGTGGAACACATTTGCA
+TGATCTCGAGCAATCTGCGATCAAAAGCCCGAAACTAAATGATTCTGGCATAATCGGGGC
+CCTAAAACCAGGGCTCCACCAGGCTAAAAATTTCCGACGGTCTCCTTATAAACTAGGAGG
+GAAGAATTTAGGAAAAGTGCGCGGTTTGGGTACTCTTTTATCGGGGAAATTCCCTGGGGG
+CTTGTTTGAGAAAACCCGGGTTCCCTGTGGAGACGGGGAGTCTGTGGTTTACAAAGGGCG
+GGGCGGTTTTTGGGGGGCCGGAGCGGCCTCATACGCTTTTTTAATAAACCACTATTTAAA
+TATACGCAAAAAGGGGTTCCTGGAAACTCCCCCCCCTTTCCCCCATTTCGTGCTCGGGGG
+TCGCTGT
+.
+qlt:
+::96667887778879>>>AGQM<<<??@MJIIVVXX_ROKJJKSORSS\IIIGLIORSO
+]VRSRLPMLLELNKLNQSSSKLN\\V\\\_PMMMPPS\\V\VV\\YVVV\PMPOOS_VRR
+RRRR\RRRRSRRS\Y____Y__]____Y_Y]__RRRS\\\\\VS__V\\\SS\V\VYY_V
+VR\\VV\\T\VSVX\aa]\V\O\Raa]aVV\V\\T__Y__________a]___Y______
+_aaaPa]TSVVVXS____V______\\\]VV_XaaRRP\V_____OVVSXVYY__V\T_V
+aT__YY______aaY_Y___]a_aVVV\\V_TV\VVMM\TY__Y_\aRaaa]aY_Y___Y
+_\]]XP]aa_aTT_VY___a]XXT____YaVRS\\\aa__Y______aaaXX]]]XWXPX
+W_____]___Y__Y__]_VXX]aa_aYY__XVRX\]__]]LLH?ECEESVIE<:77986:
+:99999;=<9:9999669:99:9=9:==@989:::9;97<=>>??:99=8:997:79::9
+99:999:97799<:9::;88898=<98<;;;<997979979<?7779<<>9799;;<::=
+B:997979866:77<99 at 8::;;979:<::=9;;8978977:8;99777::977977898
+866779<99979798?99=9979;7<998::778999999977999;;879778999:C?
+:999979:979:99987777787797779777778;<7977779768:989988797777
+<:9997779777<<977988899:8;889::97798786989977779877778978899
+9969777999::=;:99799977:87666889887766799979778996977799:778
+7999997
+.
+frg:16
+clr:30,431
+}
+{RED
+iid:190
+eid:1086975895
+seq:
+CCTTATACTACCAAAGAAGATTGAAGTCTGTAAACATGCTGTAGTGATGCCAGCTCATGG
+TCCAGCCAAAAGTATGGAATATGATGCCGTTGCAACTACACACTCCTGGATTCCCAAGAG
+GAACCGCTCTATTCTCAACACAAGCCAAAGGGGAATTCTTGAGGATGAACAGATGTACCA
+AAAGTGCTGCAACTTGTTCGAGAAATTTTTCCCTAGTAGTTCATATAGGAGACCGATTGG
+AATTTCTAGCATGGTGGAGGCCATGGTGTCTAGGGCCCGGATTGATGCCAGAATTGACTT
+CGAGTCTGGACGGATTAAGAAGGAAGAGTTCTCTGAGATCATGAAGATCTGTTCCACCAT
+TGAAGGGCTCAGACGGCAGGTAATA
+.
+qlt:
+C=8797999989897799869><9:87797<<<:79@@CC>>9?>??=>A99>>@>FFEM
+=EHG@@CCCADC at AAEBBKEHGJHLNKQVRHH>AEHMLPPLGGHLLLKMQQMSRORSSTP
+SSSRK\XXMSROHJNKSSMMLKJHJJOSSXPaSVRSVN]VVVIGMFMELMHHMMMMSOSJ
+JGLXXXXRRXXLL]XaKKKKaIBFKMOMXTXXMKEBAMBCIFLLFIIHHNIFMMMaT]RL
+JJP]]XKLEEKWPPTRRRXTWWLLXPXVXV__WWPXMRRMSVX\VPLGGABGPNXPXSKM
+EEWWKLaLHGGDHXXTXLLLGXKMIDDIGLGaLXMKBBKIMXPWDDKLLKRMIJGHDGXX
+XTFE;<AAGHBCEKKLTKK::9::>
+.
+frg:76
+clr:57,355
+}
+{RED
+iid:191
+eid:1086975857
+seq:
+GGGGCATGGATGAGAATTATCGGGGAAGACTTTGTAACCCCCTGAATCCCTTTGTCAGCC
+ATAAAGAAATTGAGTCTGTAAACAATGCTGTAGTGATGCCAGCTCATGGTCCAGCCAAAA
+GTATGGAATATGATGCCGTTGCAACTACACACTCCTGGATTCCCAAGAGGAACCGCTCTA
+TTCTCAACACAAGCCAAAGGGGAATTCTTGAGGATGAACAGATGTACCAAAAGTGCTGCA
+ACTTGTTCGAGAAATTTTTCCCTAGTAGTTCATATAGGAGACCGATTGGAATTTCTAGCA
+TGGTGGAGGCCATGGTGTCTAGGGCCCGGATTGATGCCAGAATTGACTTCGAGTCTGGAC
+GGATTAAGAAGGAAGAGTTCTCTGAGATCATGAAGATCTGTTCCACCATTGAAGAACTCA
+GACGGCAAAAATAATGAATTTAGCTTGTCCTTCATGAAAAAATGCCTTGTTTCTACTGGT
+CATAGCTGTTTCCTGA
+.
+qlt:
+6986667666988<9777@>AAGGCA@>>>@IHGEEIHM\VRNEEECMMSRVSLHIGIDL
+RRI\\]NLJNIJOQKHGFJCGHNJPP]\V\\\XHKLPMORVVJOPMPPaNPPPPPVV]RX
+PXV__VVVRRRRR\\V\_Y\\V\VV\\V\SV_Y]aaVO\VV\V\\VSR]V\VXRR_]V\_
+__]V\\VVV\\OVVV\V\Y]aVVR\V\YT_VVV\ORVV__Y_Y___]____a]aaVV_Y_
+YY__a]aaaPXSVV]\]]___\VVXTVRX]]]_V]VVXRMR\\V____XVX]_Taa]_]W
+XP\TXVV______Y_a]]]a_aaa_aaVV\\VV____XXXX\\_T__VXPRRWX____V_
+____VWWLLa]]aaXR]]]__aaaXXXT\_Y_]VXX]V___\S\\V\__Yaa]PPXXVXT
+LLT]_______]VV\]VV____VTaVYY_____VVXT\____Y____]a_\\RX]RXRRS
+MPMJPJJEK?=<<DD]
+.
+frg:24
+clr:6,456
+}
+{RED
+iid:192
+eid:1086975778
+seq:
+GCCGAGAAAATCTGGGCTCCACTTCATTGGGAAAACAACTTCCATAATTACATCTTGTGC
+CTCTTTGGCACTGAGGCCTGCATGACCAGGGTTTATGTCTACTCTTCTGCGTATCTTGAC
+TTGATTTCTAAAATGAACAGGGCCAAAGGTTCCATGTTTTAACCTTTCGACTTTGTCAAA
+ATAAGTCTTGTATACTTTTGGGTAATGGACCGTACTTGTCACGGGTCCATTTCTATTCCA
+CCATGTTACAGCCAAAGGTGATACCATCACTCGATCTGATCCAGCATCACTCATTTTACT
+CCATAGAGTTTGTCCTTGTTCATTTCTCTCCGGAACCATTTCTGTTATCCTTTTGTCAGC
+AGTGATTGGGTATTTCATTGCCATCATCCATTTCATCCTAAGTGACGGGTTCTTTTCCTG
+TCTCCCCGATGTGTACTTCTTAATTATGGCCATATGGTCCACTGTGGTTTTTGTCAGTAT
+CTCGCGAGTGCGAGACTGCGACATCAGATTCCGTAGTTCTTTTATTCTTTCCATACTGAA
+TATAATTGACCTGCTTTCGCTACTGGCCGTCGTTTTACAA
+.
+qlt:
+6677666677788<<C><<<<<>:>:9:CD?77>>EEEAHC???ABXVKLBFFDHVIIQO
+O____RRRMHB<997668;;CCGHFFGHKO]YVRSRROOVSOMX]]\RKVKKA at ABGGRR
+MR___]\SM]]\VXXPT\___\V\V\VT__VV\SMVa\\\V\\Y_WWXLLTX__V\\\XS
+]XXXXPaaVXR]V_V_]_a__V_X]RXXT____TVX__V_VV_XV_VXPX]]___TV\\\
+V\_TTV]VXTSRRRVVV\RSRRRV_V_V_XXXXXWXVTTVMRRRRW]]_______]Y__V
+VVPKDLLXP]TT____aa\VVRR\aaaaa]a]LMORVS_\aTRXXV__V_a_]Y_WXXXR
+XXLXWVXR]X___]]___TV\VVV\_]___V___]X]XXWXXSTXVV_]aaaV_____X]
+aaXX]XWLPWX_______]____]_______]__\V\MSV\NQRRVVV_a]Y_XW]LLX]
+WTRaTXXVXXPLLGGXXLPHHPP]XPLLXXXaPXPLLWX____T___a_______XXXXX
+XRXV_aXXR\X_aaXWW==JGXXXXaaXMG>>CB=DBBQP
+.
+frg:11
+clr:36,548
+}
+{RED
+iid:193
+eid:1086975867
+seq:
+GGGGGTGGATGCTGTAAGCACTTCTTCCTCTTTTTTGACTGATGACCCGCTTGTTCTTTT
+AAATGTAAACCCACCAAAGCTGAAGGATGAGCTGATTCTCAATCCCATTGCAGCCTTGCA
+TATATCCACAGCTTGTTCTTCAGTCGGGTTCTGTCTAAGAATGTCCACCATCCTTGTCCC
+GCCAATTTGTGTGCTGTGGCACATCTCCAATAAAGATGCTAGTGGATCTGCTGATACTGC
+TGCTCTTCTTACTATGTTCCTGGCCGCAATAATTAGGCTTTGGTCAACATCGTCATTCCT
+CACTTCTCCACCTGGAGTGTACATTTGTTCCCAACACGTTCCTTGAGTCAAATGTAAAAC
+TTCAATGTATATACTGCTTGTTCCGCCAGCAACTGGGAGAAATCTTGTTTTTCGTACAAG
+TTCTCTCTCTAACATGTATGCAACCATCAAGGGAGAAATTTTGCAATCTCGGAGTTCTTC
+TTTTTTCTCTTTAGTTATTGTTAATTGCGATTCTGATGTTAGTATCCTGGCTCCCACTTC
+ATTGGGAAAAACAACTTCCATAATTACATCTTGTGCCTCTTTGGCACTGAGGTCTGCATG
+ACCAGGGTTTATGTCCACTCTTCGGCGTAACTGGCCGTCGTTTTACAA
+.
+qlt:
+<:7797778<<:=<7778>>A>@KKCCCKGHMMC at AD@BGGGEGIJMJV____VTYYMJM
+OLKQQSSV_V\VV\HD99==HJMVGGLGEEVTPPPMOPV\]V\RPOPMPRRRRRXW\XXX
+]]__V\\VV\TXXV_Y__VO\VVVaaa____Y_VVMNNDDNKVV____Y___aaa_____
+V\\VRVaaTaXX\V____VVV\VV_\\OXVST]RSMRRV_TTXMMRV\Va]\VV\\VSRa
+a_____________]_aa]aaa]a_]_]]RXTTVXWT]WV]\V]V_Y_T_VTXVV__X__
+___Y_aVS\VVJR\XXXRMRMVRR\\a__V___]XVRRRTaaaVVXXXX]_V________
+__Y_________\VRaaaaaaa___T]RX]]]V\]OJJLGWXY__aaaa]\XXRX]]V]X
+aaTVa_XXV____Y_Y_______Y_Y___VTXPLLLXX______Y____aWPLXXV_Y__
+__]_______]]]]XXW_YY_____]]WLLXW]XPVV_WTXLLTW]]aa]\_V_V_YY__
+___aXRRXW_____aa_VV_]_a______VaRP]a___________VVVX\XVXT_\VRX
+\HTPXRTXXX\TGF>>@GIPPPPPPPPHHHCEHH?><<77:>=GBBGG
+.
+frg:47
+clr:12,605
+}
+{RED
+iid:194
+eid:1086975871
+seq:
+GAGAACCACCTCCGGAAAAAATAATACATTCCCACGTTGGTCTCGAACTCTCAAAAACCG
+ATCAATGCTAACCACCACCCACTCTGTACTGGAGTATTCATCCACACCCATTTTGCTGAC
+TCTTATTCCTCTCATTGACATCTCTGTGCTTGGAGTCATATCTGGTAATACTCCAACCAT
+TCCCATCACACTGTCGATGTGTTCAATTCCCCAATTTTGAAAAAGCACTTTCTCATCTTT
+CTGAAAATGCCTTAAAATCTGATGCATGGGGTTCAACCGCTGATTTGCTCTGTTGACAAA
+ATTCAGGTCACCTCTAACTGTTTTTATCATGCAATCCTCTTGTGAAAACACCATGGTCAC
+AAATATTGCTTTAGATATTGACTGTTATTCTCTTCCACTCTTTTTGACCTGAACCAATCT
+TCTGGTTGCTTTTCTGAGTATAGCTGTTGCTCTTTCTCCTTTTTCTTTGAACTCCTGTTA
+CCCCTCCCGTTTCCTCTTTATCCATTGATTCAAATTGCCTCTTAACAAATCCTCTTCTTC
+TTTGACAGTCAACCCCTGTTGACTGTTTAAATGTAAACCCACCAAAGCTGAAGGATGAGC
+TGATTCTCAATCCCATTGCAGCCTTGCATATATCCCACAACTTGTTCTTCAGTCGGGTTC
+TGGCCTAAGAATGTCACTGGCCGTCGTTTTAAAA
+.
+qlt:
+96997966779799;;:<A;7778<88<<=<<=><:=CCFF at B=>=AEGACCCCLMKGFD
+?EFE>CMKHD at BBC<<9778<<:<?ADADHE@;:;B>?=>=AAABBDIBBEHKPII=<<9
+9B at AFEDCCGID>?DDJL]XWGEKKKaaLKK=>EWGDDGE at D<<:99:<DHGGEG>==>A
+ at GGBA>H@=<B=9:999::BD=@<<>=HGLGEBB@?F>@BHKEBBBABGG@::;=@HMAA
+A<;==?=>ABBCCIG]E;9:@ABBMWICKKK at AHL@B99<A?CMMIDAA<>>@>?;>77:
+:A::9999;=:=9<:::9=:=HDD><AD;==H;;;9<DDCHKAA at A?=;;;@HHA===:9
+<<:;@>@:;>9;9D<DD<9:BGGAB at 999::C;=99:=@;;999:99<9:99;=9977:C
+;8?9:98;<>HLVG=979<798899<B=;?E<99<7999999;:977@@B?:=9:999C<
+9;999:::::9:@A at 99999C:9;999999999999D<:9999::;9999999<=<<:=:
+;H9=:9@<999999?::=BH99999;89><CA@@;;:<97C at TKLCE@BB<:8<>A@@B>
+GKaHHPKLGGGD@:9:<<B;;<<;;BBKCFCDA>B<<=<97998:FBPGH@@99=@>;<;
+;;;:==:899<==?==@==>>G>?9=B=?CI99G
+.
+frg:20
+clr:96,190
+}
+{RED
+iid:195
+eid:1086975917
+seq:
+GAGCCTATTCTCACACCCATTTTGCTGACTCTTATTCCTCTCATTGACATCTCTGTGCTT
+GGAGTCATATCTGGTAATACTCCAACCATTCCCATCACACTGTCGATGTGTTCAATTCCC
+CAATTTTGAAAAAGCACTTTCGCATCTTTCTGAAAATGCCTTAAAAGCTGATGCATGGGG
+TTCAACCGCTGATTTGCTCTGTTGACGAAATTCAGGTCACCTCTAACTGCTTTTATCATG
+CAATCCTCTTGTGAAAACACCATGGCCACGATTATTGCTTCAGCTATTGACTGTTCGTCT
+CTTCCACTCACTATGAGCTGAACCAATCTTCTGGTTGCTTTTCTGAGTATAGCTGTTGCT
+CTTTTCCCCACCATTGTGAACTCCTCATACCCCTCATGTACTCTTATCTTCAATGTTTGG
+AGATTGCCTGTAAGCACTTCTTCCTCTTTTTTGACTGATGACCCGCTTGTTCTTTTAAAT
+GTAAACCCACCAAAGCTGAAGGATGAGCTGATTCTCAATCCCATTGCAGCCTTGCATATG
+TACTGGCCGTCGTTTTACAA
+.
+qlt:
+6666666669877<<<<<<?<CCCCEAB=CCCHSMCGGGEBDFIGGEEDDER]]PSV\\]
+]]VQ\RROQNMF?@@::B<>DBGMJPMMMPPMOMPPV\V\VTaRRSRRV_PNHEDCXXRV
+VVRSaVXX\\____]___W]XRX]_____\VPXV\\V\S____]___XVX_]VVPRVX_\
+RV]VV\XPPXXX__]a_aaaaaVRNNJJX]VV\VVRVVVVVV_V_]]XaaaVVV]\VYVV
+V\VV]a]__]aXP]]]_YVV\VRSVV\XPLLTTVXRX]V\VSSLXXVVVVRRVa]TXRWW
+__\V\VVV____VSVSSMXPX\\_]__]aaaVV___VVV_\WWPPWPPT]XTPaa]aaaa
+TTa___]]__V_]VXRaRTV____XT]RRV\]_WXXRWXX_____Y_____X]RRaa]aP
+SLL]XX]aRXXXXRXWW__aa__XXXX_]aT______\\XR]XPPSPWRPXaa]]__XXR
+XXVTTY_____V\VaP]XRWJSOMIKaPTaaaa___]VXVVVMMVGG;<G?GPWPRRMMC
+CTIJJMOLDB<><D=LEETT
+.
+frg:46
+clr:12,518
+}
+{RED
+iid:196
+eid:1086975829
+seq:
+GCAACCTCAGGTGCCGGCATCTTTTCCGAGAATTGTTAGTCTTTTAGTTGTCTTGTTGTA
+GTTGAATACAGGAGAATTGCCCCTTACAAGTATTCTCATCCCTGATCCCCTCACATTTAC
+AGTCAGTGAAGAGAACTGCATTCTGCTTTGCTTTGGTGGAGCGGCTGCAAAAGGGAGAAG
+CTTTATTATCTGGGTGGTGTCAAATGTCCCAAGTACGTCTCTCATTTGTTGGAATAGAGT
+TCTGACAAACCCACTGTATTGGCTTCTAATGGCCTTGGGGACTAAAGATTGAAATGGTTC
+AAATTCCATTTTGTTGTACAACATTGCAGGATTCTGAGACCATTGAATTTTGACAGCTTC
+CCAATTTCTGATGATCCATTGATAGGTATTGACCAAAACCGACTCAGGACCGTTAATCTC
+CCACATCATCGACGATGAATAAGTTATTGTCAGTCTCTCAGTTCCCTGTGTTTCACTGAC
+CTCCTCAGGAGATAATAATACATTCCCACGTTGGTCTCGAACTCTCAAAAACCGATCAAT
+GCTAACCACCACCCTCTCTGTACTGGAGTATTCATCCACACCCATTTTGCTGACTCTTAT
+TCCTCTCATTGACATCTCTGTGCTGGGAGTCATACTGGCCGTCGTTTTACAA
+.
+qlt:
+66668666668<@<G at AG>C at BCCCLGC@E777@@KKRSVVY\\\VJGKKKNPV\SSSSS
+SRSSSZ_ZOHH@;:99BAG\\___MMOMOPV\V\\VSVO\_\RRRRS\_\VSMMSSRO\V
+\V\\VVVTW]LLMMV\\\____YaYa_____]a_________Y____]__Y_YV\VXXVV
+___YVV\VVRVV\_VV__VV\\V\_aa\\]\\VY_XXXaa__V____a__Y__WXLXXV_
+]]_X]]]TVV_____VY___T____Y_]\V_aaaaa]a\VVVV\]VMS\VV_________
+____YY_Y___aaY]_V\\\\\__Y]aaVRVVVR]aLXX]W____YYY___XV\VVT__V
+\\VVVa]_T___________Y_Y__Y_________\_]a_aa_VXX]XV\_________T
+T]______\VRXWLL]MS]R____VV_____\]Xa]_]]\]X]a]_______Y______a
+aaaVXTRRRKQK\\\_________________VYYV\XVXV]_____]__YT__a__]_V
+_aa_]a_____YY___Y_TYVVXRTa]RRMVMV__TTTVV_TTTTTaa_a__Y_T_T_TV
+_]]___VTYTMMVMRRTPaTaTTPPPXTPRPPPTPLLTCGB<::;@;DHKKK
+.
+frg:12
+clr:11,611
+}
+{RED
+iid:197
+eid:1086975914
+seq:
+TTGGGCAATTAACATTCACATTAATTGATGGCCATCCGAATTCTTTTGGTCGCTGTCTGG
+CTGTCAGTAAGTATGCAAGAGTCCCGTTTTCGTTTCATTACCAACACCACGTCTCCTTGC
+CCGATTAGCACATTAGCCTTTTCCCCTTTTGCAAGGTTACTCAGTTCATTGATGCTTAAT
+GCTGGTCCGTATCTTCTGTCTTCCTTACCTATAATGAGAAACCCTCTCAAGACGGCAGAC
+TCCACTCCGGATGTGCTTTCATCTGGGTCTTCAATTAAAGTGCCGGCATCTTTTCCGAGA
+ATTGTTAGTCTTTTAGTTGTCTTGTTGTAGTTGAATACAGGAGAATTGCCCCTTACAAGT
+ATTCTCATCCCTGATCCCCTCACATTTACAGTCAGTGAAGAGAACTGCATTCTGCTTTGC
+TTTGGTGGAGCGGCTGCAAAAGGGAGAAGCTTTATTATCTGGGTGGTGTCAAATGTCCCA
+AGTACGTCTCTCATTTGTTGGAATAGAGTTCTGACAAACCCACTGTATTGGCTTCTAATG
+GCCTTGGGGACTAAAGATTGAAATGGTTCAAATTCCATTACTGGCCGTCGTTTTAC
+.
+qlt:
+66677866666666<>::::::@@@@AAB@<<<<<<HEIIIJIYIMKKGGEPPJPRRRRM
+RRJIJPPJT_KF=:76667;=DGGXX\______OSRRRSSRRRRS\V\QOQVMHKIIIEJ
+]RR\NMMMRVV\V\XTX]]]_Y____YY_Y\\\SV]VVV\\\V_V\VV\V______Y___
+___a_a]aXXVVV___a]___V__Y______]\\PXXXR]]___Y___YVVV\V\XXRX\
+X___T____V___]___VV_Y\\Xa]___VVVV\V________aa__TWXX_]YWWLLLL
+O]\Vaaaaaa]_]]TVV]\YYY____VV__aa]]____]XRSMRRRV\_a_____V____
+__________\]\\SV_______________Y_a]aa]aLLXX]]____V__]aa__Y__
+Ya____TV_Y_______\____XXPSSWXXV\___V_VVaaaaaaaa___]_________
+__VT_VTVX____T_aVTTTT_TWXLLTTT]RRWW_____TTV\\\HHT_aT___TVVRX
+Va____TVXPVVXXTPRWW_TV___TTTHABTWT_W]LXHHRWTNEC>778>???9
+.
+frg:25
+clr:37,554
+}
+{RED
+iid:198
+eid:1086975817
+seq:
+TGGGGCATCAACAATTCGACATTAATTGATGGCCATCCGAATTCTTTTGGTCGCTGTCTG
+GCTGTCAGTAAGTATGCTAGAGTCCCGTTTTCGTTTCATTACCAACACCACGTCTCCTTG
+CCCGATTAGCACATTAGCCTTTTCCCCTTTTGCAAGGTTACTCAGTTCATTGATGCTTAA
+TGCTGGTCCGTATCTTCTGTCTTCCTTACCTATAATGAGAAACCCTCTCAAGACGGCAGA
+CTCCACTCCGGATGTGCTTTCATCTGGGTCTTCAATTAAAGTGCCGGCATCTTTTCCGAG
+AATTGTTAGTCTTTTAGTTGTCTTGTTGTAGTTGAATACAGGAGAATTGCCCCTTACAAG
+TATTCTCATCCCTGATCCCCTCACATTTACAGTCAGTGAAGAGAACTGCATTCTGCTTTG
+CTTTGGTGGAGCGGCTGCAAAAGGGAGAAGCTTTATTATCTGGGTGGTATCAAATGTCCC
+CAGCACATACTGGCCGTCGTTTTACAA
+.
+qlt:
+679<6666666777777>877<<<>B<::<<<<>@<>HCCMHIM\GGN at GCEPVV\KK\\
+RSTNJNFEJXHMC>;:9799 at GLPXX______Y_IOLLPPRSSRMPV\\PQQXXTaaaP]
+]]XXRKRRMS\\\V\RXX]]_______Y\Y_V\]\\]]___]RRSQSQV\V\\VVV____
+___aY\__V_V_T______a___]_V\VXVV__\\PXRXRRRXXVaV\VV]MX\V]XRSS
+XTX\X___a_V___]TV_RR\RSVaaV_Y_\VVVVMXV\PXXXVV___TTXX]_XWLLXP
+P\VY_VVVWPXX_X]X]]aaaa_]]__\VRXPWXT]VXXXXJJGGMM__a]aaYV\\\\M
+__VYVVV\VV\\\\\VV_____\\PT]XVVV_Y_XXXPaaKKLL]WY_____aV_a____
+__a]a]VTXVXT_aaa]_____aXXLLLTXXV\_____WXLLaaaaMSSVVV__a]aMWA
+>JHJLMXXPTLLTLJKIA at FFEEHEEM
+.
+frg:45
+clr:38,465
+}
+{RED
+iid:199
+eid:1086975906
+seq:
+CGCCAATCGTTTTTTAACTATTCACATTAATTGATGGCCATCCGAATTCTTTTGGTCGCT
+GTCTGGCTGTCAGAAAGCGAGCTAGAGTCCCGTTTTCGTTTCATTACCAACACCACGCCT
+CCTTGCCCGATTAGCACATTAGCCTTTTCCCCTTTTGCAAGGTTACTCAGTTCATTGATG
+CTTAATGCTGGTCCGTATCTTCTGTCTTCCTTACCTATAATGAGAAACCCTCTCAAGACG
+GCAGACTCCACTCCGGATGTGCTTTCATCTGGGTCTTCAATTAAAGTGCCGGCATCTTTT
+CCGAGAATTGTTAGTCTTTTAGTTGTCTTGTTGTAGTTGAATACAGGAGAATTGCCCCTT
+ACAAGTATTCTCATCCCTGATCCCCTCACATTTACAGTCAGTGAAGAGAACTGCATTCTG
+CTTTGCTTTGGTGGAGCGGCTGCAAAAGGGAGAAGCTTTATTATCTGGGTGGTATCAAAT
+GTCCCCAGCACATACTGGCCGTCGTTTTACAA
+.
+qlt:
+6666666689B>>77877<<<<<<<<<ACCC><<<<@<>>A at OBCA<:DHHKGCCKKN\M
+V]]SSRRVNH>:6676667666879=>RLGHLO]\]VXVPSRSQQQRRSRIN?<:76<<<
+D>=>WW\\RXW]]T\SSVROXXVa_YY___Y____\\\\\\_]]YSSRRMVV_YSRQRRR
+V__VXPLLLLLPaVYY_____aaaa]_]__RM\\VV_]VXXLLGL]]__\aR\V\VRXXT
+]XLGLWX]VPPTV]QQNNMVX__X\\\SRaaWW__V\V\VSV\VXTRV\\V___V__Y__
+WXLILLXW__VVPXX\\_V]]XV]VY]\aaa]PX]XL]T_VXXWXXXLJJNN\Vaa]a__
+T]]]XRV\_____V_aa_T___\_VXXX]___VVX\__a]TaP]WGLLLXX_Va_a]aaa
+aaaaaTaaaa_TXXVV__aaa____]_]XPLXPXT__V_____VVaaaaaTRRVV\VaaT
+]_WWBAWKLP]]XWMS]]]RGD==FBAILL]]
+.
+frg:26
+clr:88,470
+}
+{RED
+iid:200
+eid:1086975852
+seq:
+AGACTTTTGTGTGACATTTTCTTGGTCTGTTGTCTCTTACTCTCCTTTTTCTTTGAAAGT
+GTGTTGTTATCTCCATTTCCTCTTTATCCATTGATTCCATCACATCCTTGAGGAAATCTA
+TTAGCCTTCCTGATTCATTAGCTGTTAGTCCATTCGATCTAAAAACTTCTATGGTGTTGG
+CTAATGCAGTTGCTGCCGGTTGATTTCTGTTTAATGTCCAATCATAAGTCTGGCGACCTT
+GGGTTAGTTTGTCCACCCTTGTTTGTTGAACGACTTCCATTGTTTCAAGGCATGAGTTCT
+CAAAGATACCTGGGTGGGATTCTTCAAGGAAGGCCATAGCCTCCAGGACACAGTCTGTTT
+GTGCATATCCACTCGGCTCATTATCCTCAGGTAGTGGTCCATCAATTGGGTTGAGTTGGG
+GTGCCCCAGTTTCTGTATTTGTCGTCCACTTCCCCTTCTCTGAATATTGGTGTGTTCTGT
+TGACTGTGTCCATGGTGTACCCTGTTCCTGTTCCATGGCTGTATGGAGGATCTCCAGTAT
+AAGGGAATGTGGTGCTTATGGCATTTTGCGCTGGAACCTTTAGGAACAGTAGAGTCGGAT
+TGACATCCATTCAAATGGTTTGCCTGCTTTCGCTACTGGCCGTCGTTTTACAA
+.
+qlt:
+6666677:77<:8877:BCCGCGBB@::GFI\HMRMHLIQNHRLMJJNJPPIHMSSMKIN
+JKIKPOPMIG;;666677;999999;99=::<AEF at IE@@FLLXXXa_]]><8667689:
+::899D?GKLJLN\VVRHNMLHXLN\\OSNNRMOPSPWXR]]_]VXPWRR\V\\aRT]SS
+SR]TWD9998DDLLXXPSXXV\\\X\RaaXV]\VVTRRSRRRSSMS]aaaaa]RRMRRSa
+]__WXRXX\VYLLHHNLXX]]__Y____X]LLWXLRSRSVV]TPMNHJJWXXV]aPXPJM
+SNRRSRRRVaaaaaaaOMHRRSMSMSVVV_TH\TXTWPKKKKXPLMLGKHNCNFMMV___
+TRRSMNR]TGEMNVSRSMSRVSV]XMMSMRVVXPILTRVJQQPQOQ__]]_TTPaaaaX_
+THHHXTH<WHTaLLXX___TVRJGHGGGTPTT\_VVCMHRJL]TTHHCCKFGHH]T____
+TVXTXXTVV\VXRVXRVTHVVSSRTTPPTWT_VVPPWXaHTTTXRTaPLTHIIGD;E?KL
+CGJRLCQIOCLPHPCRHHHNCAAGGGHGHLHLPCCHCCRKGG?;DGHGCCB>=CC>=GDH
+CMCECHIPXGGJPFGIIQCC<<97<<=HCCAA:>@==A==79877:<<<;<AA
+.
+frg:63
+clr:29,615
+}
+{RED
+iid:201
+eid:1086975876
+seq:
+AAGATCTTGTGTGACCATTTTCTTGGTCTGTTGTCTCTTACTCTCCTTTTTCTTTGAAAG
+TGTGTTGTTATCTCCATTTCCTCTTTATCCATTGATTCCATCACATCCTTGAGGAAATCT
+ATTAGCCTTCCTGATTCATTAGCTGTTAGTCCATTCGATCTAAAAACTTCTATGGTGTTG
+GCTAATGCAGTTGCTGCCGGTTGATTTCTGTTTAATGTCCAATCATAAGTCTGGCGACCT
+TGGGTTAGTTTGTCCACCCTTGTTTGTTGAACGACTTCCATTGTTTCAAGGCATGAGTTC
+TCAAAGATACCTGGGTGGGATTCTTCAAGGAAGGCCATAGCCTCCAGGACACAGTCTGTT
+TGTGCATATCCACTCGGCTCATTATCCTCAGGTAGTGGTCCATCAATTGGGTTGAGTTGG
+GGTGCCCCAGTTTCTGTATTTGTCGTCCACTTCCCCTTCTCTGAATATTGGTGTGTTCTG
+TTGACTGTGTCCATGGTGTACCCTGTTCCTGTTCCATGGCTGTATGGAGGATCTCCAGTA
+TAAGGGAATGTGGTGCTTATGGCATTTTGCGCTGGAACCTTTAGGAACAGTAGAGTCGGA
+TTGACATCCATTCAAATGGTTTGCACTGGCCGC
+.
+qlt:
+9666666777<<<7777>@B at CBDD@B9:HCNKIKPXRIQHQQ]\\\WTXXWKVMGPLHK
+JEKLPOOOPV\\BB;:DH__Y__Y\\\MMGGIISSXMRRRRSVVVV\]_VVRRKLLMRSV
+_XXXRRTX__Y__YPSJMMJWXXaX]V]XS\V\VOXLLOMVV\\]____Y___Y_]aa__
+VVV\\\\VVVTWX_Y___Ya]\\\V\\aaa\V\V\\_V\\VVV____]aaTXV_RRVVV\
+VT__]]XLL]]__]]RRVV________YVV\\JRXV\\\VVVTa\V\\\\_]_]VTXRX]
+V_]XLHHKN\XPaa]RaVVVV\\Y__TTXPXXVV_X]XLPaaXV]W]PXW]\]Waaaa]a
+a______YV\\RRVPaVV_____]Y____V_]aaaSXX______]XX]X_____a]aa]_
+_Y___]VVVRXV]___YY___aaaaM\VVV\a_a_a_aaaaaXX]X____aaaaaVaaaa
+_VV\\VVaa____T_a___V__V__VV\___aV]\VV\aaa__XVXXWRXXX__VT\XXX
+T]XaaMVMVV\TT__________V__________VVV\V\WWXWJLNR\RaaKGWXXRX\
+\VV\V\V______TXWXPVX_VV\VRMHS@<9>
+.
+frg:27
+clr:7,601
+}
+{RED
+iid:202
+eid:1086975855
+seq:
+GGATCGGCTCATTGTGTTCGGAGCTTCATTCTCTTACTCTCGAACATGTATCCTTTTCCT
+AGTCTTGCCATTTTGTTTGAGAACATTATTGGTGCGATGCTCAGGATGTTTCTGAACCAC
+TCAGGTTGATTTTTTGTGATATATGTAATCATCGCCAAAAACATTCGAGGGTTTTGATTT
+TCATTCCACTTAGTGTTGTCCCCAGTGATTGTGAAAGAAAGCTCAGTGTCTTGTGAATTA
+GTCATCATTTTTCTCACAACATTTGCCAGTTTGGCCTTCTTTTCATTACCCCCAACCGGA
+AGTCCAGACTGTTCAAGCTTTTCGCAAATGCTTCTAGCTAAAGTTTCAACGAAGTACACG
+AACCCTCTAATTTGCATCCCTGGTGTTGCAATAGCCCTTCTTTTTAATTTACCTCTCTCT
+GCATCTTTGGTCATCGTGTTCAATGTCAAAGCTCTTATTAGATAGCCTCTCTTATTCACT
+CTTTGTTTTTTCTTCCCTATTGTTCTTTGTGTGACCATTTTCTTGGTCATGTTGTCTCTT
+ACTCTCCTTTTTCTTTGAAAGTGTGTTGTTATCTCCATTTCCTCTTTATCCATTGATTCC
+ATCACATCCTTGAGGAAATCTATTAGCCTTCCTGATTCATTAGCTGTTAGACCATTCGAT
+CTAACTGGCCG
+.
+qlt:
+669786966667>@HCAAG>AECSB@@@A?GSTVVOV\HVPNGJFIFGQQRRRVVRRRV\
+VVRVSSLGIJG?F99GDIE==BILPPVV\\VQQRRRVV\VMSRMJNNPO__aWEBAKLMP
+J__V_a\\\\\\a_WXRSRR_RVVV\\__TV\_VVVVSV]VJSNWVRP\VYY__MSV\VV
+VVVV\\VRRMWPXLTa_Y_]S\VVOQONSQRSSXW]LL]TVVMMLKDP]T]TaXV]_]]L
+XX]]]__TT__VVVRMVV]XRV\aV\\VRMaPRTV_V_YY_XVVVV\____VY____TXV
+]XX]XLGIPX_VV\\\Vaa_a]PXP]]]VX_a_VVXXPPP\XXRV]]]WWPXXWXT]XXP
+Paaa]TXPRVXY__]TRX\aaaTLL]]___XTXXPXWaaa_T\\SVSSVX___XaaRaa]
+]RX]V_V\\]\\XXRXX\VVV\VRXXVRRXXaaRXXV]KG@@WKLXaV_V\RXXV\V\RS
+]a_aaaaa______TVV_]\X_a]___aaa]]XP]]_]__aaaaV\_TVXXVaaa_aXRX
+]VTXaaaaa_]]XR]aPa]WXXTXVXT____________aa_aaVTT\V__VVVa]]V\V
+VRS_V_XXaPPPTPLLNOVRVVKKCKKT]aa]LLXWVRXTTXXLTHKKTEE]PTTXRJSH
+HD;;MDMM>>9
+.
+frg:64
+clr:12,641
+}
+{RED
+iid:203
+eid:1086975865
+seq:
+TATGAGGCAGCTAGATGTTTCTGAACCACTCAGGTTGATTTTTTGTGATATATGTAATCA
+TCGCCAAAAACATTAGAGGGTTTTGATTTTCATTCCACTTAGTGTTGTCCCCAGTGATTG
+TGAAAGAAAGCTCAGTGTCTTGTGAATTAGTCATCATTTTTCTCACAACATTTGCCAGTT
+TGGCCTTCTTTTCATTACCCCCAACCGGAAGTCCAGACTGTTCAAGCTTTTCGCAAATGC
+TTCTAGCTAAAGTTTCAACGAAGTACACGAACCCTCTAATTTGCATCCCTGGTGTTGCAA
+TAGCCCTTCTTTTTAATTTACCTCTCTCTGCATCTTTGGTCATCGTGTTCAATGTCAAAG
+CTCTTATTAGATAGCCTCTCTTATTCACTCTTTGTTTTTTCTTCCCTATTGTTCTTTGTG
+TGACCATTTTCTTGGTCATGTTGTCTCTTACTCTCCTTTTTCTTTGAAAGTGTGTTGTTA
+TCTCCATTTCCTCTTTATCCATTGATTCCATCACATCCTTGAGGAAATCTATTAGCCTTC
+CTGACTCACTAGCTGTTAACTGGCCG
+.
+qlt:
+6696888779<999A<=?VCMHG=<<>>?>ICAG]CGGBBBSDEHFHKK\DHDIIIRRRR
+IRIIIONHC>9877999:FTTS]QRMM]SOPPMKKKIKI]PLIXX___\]D?977>ANQS
+XXXX]LLOMVVRRLLEaa__aa___T]]]LL]]_Y_Y__Y_VVVVVVVVVV\aV\\VRR]
+]aa__V____\\V\VVV\_X\]\VVaaXXXXXXXXLLTTT\\\S\VP]\XXXSP]]]VX_
+a_XXXTXX]V]XR\VVVOMLLWXLXWTPLLTX_V__V___]]__]__\aaa]PR]]__T]
+TLLL]W__VV____]TY____VTaVaa]___V___aa____V\RPRP]T_\VXXVVX]]P
+aa]XXR]KEDAKKP]aaP]XXR\\______V__Y____]a]__V_T___V__]aaaaaaP
+VRR\VV__]aaaaa\V____aa_______XVXRaaaaaaa_aaaaRR]TVXXXRVa____
+___V____aa]aa__Y____VV\\V\OV\\RV__Y___aXXXXLLNOVVV\XXPLLaaaa
+TSJJGBJ]>DMGDKLQIKLJFIIFC>
+.
+frg:68
+clr:14,534
+}
+{RED
+iid:204
+eid:1086975901
+seq:
+GCACCATTCAAATTCCATCAAAAATCTCGTGATTGCAATGTCCCTGTTTTATTTAGATAG
+GACTTCTTTTTGCTCAAGTTGATTCCCACTAACTTGCAGGTCCTGTAGAATCTATCCTCT
+CCTGCTTGTATTCCCTCATGATTTGGTGCATTCACTATGAGGGCAAAATCGTCGGAGGAT
+TGGAGCCCATCCCACCAGTATGTTGTCTTGGTGTATTTCTTTTGCCCAAAATTCAGTATT
+GAGACTCCTAAAACCGTACTTAGCATGTTGAACATGCCCATCATCATCCCAGGGCTCAAT
+GATGCTGTGCCATCTATTAAAAGAGGCCTTATTTTCTCAATTTTCTTCCTTGTTGATTCA
+TTGAAATACTTCAGGTCAATGCTTGCTAACATTTCTGCGGGTATTTGTGTTCGGAGCTTC
+ATTCTCTTACTCTCGAACATGTATCCTTTTCCTATTCTTGCCATTTTGTTTGACAACATT
+ATTGGTGCTATGCTCATGATGTTTCAGAACCATTCAGGTTGATTTTTTGTGATATATGTA
+ATCATCTCCAAAAACATTCGAGGGTTTCGATTTACATTCCACTTATTGTTGTCCCCATTG
+ATTGTGAAAGAAAGCTCTGTGTCTTGTGAGTTACTACTGGCCTTCAATCCAACAAC
+.
+qlt:
+97996967977799999798:99899;9=9998:9987:9=<::=99999;@:9:97899
+9@>AACNCD?C886666666999::<<;:<EBBD>>:;;>DLEF<<999>>:7966699:
+<<<?FBB>>@@GGD?@B???AB<<@EBDA>>B>????<>FH>=<A==:<9;:><<>>@AC
+AAC<=9:<78:<:>>:999=>@GKB>><99;>KKILGCKKaBDG<=9:77>:=9999<=>
+A?=:@;>J?A>A?DA@<>:;<=<<?>BD99;:;;EFADDDGDB?==<BH>@=9@@@<<<>
+KEB@>:=>>:999C9;9999>999;;=BEHHDGEB==<<;>GKKAAGJLGGMHDDDJIDD
+EDBBA;;==:;99;;@>>;<=BDKKHH>>AGKCC>?@=BAABBB at G==@>>;::@FEG@=
+<;;9;=;?BBI?>9<@BBWWCDaGBAGEGCJ@><<<<9<@::AA<:779A=:99==DE@<
+99<@@=9999=>@=ID?;;;;EE;;;=EG>;9:9=@=:>BA@<<@HKGBGMMB<>AAAWE
+BBBJEC>;?=;:::;:9<@BBCA>>HH==<=BD>>?>:;?<==A=AA>;9999<@=8::<
+ at F=899<<:<9>?99=:999889:<99:=@;99;9:>@@:<;::8:79999;;>99
+.
+frg:77
+clr:36,632
+}
+{RED
+iid:205
+eid:1086975776
+seq:
+GGCCCAATTCAAAAAGTAGGCACTGCCATAACTATTTTAATGCATGTGTCAGGAAGGAGT
+TGAACCAAGATGCATTGAGCAAAACCCAGGGATCATTAATCAGGCACTCCTCAATTGCTT
+CATATAGCCCCCCGAGATCAAAGGTCCCAGGTTCGAGATTGTCCCTAAGAGCCTGAACAA
+CAAGAAGCAGTTTTCTTGACTCCGCTGAAAATCCTTCCAATTGTGGTGATGCATACAGGC
+TATTGAACACTGACTTAGCCAATAGAGTCCTACAGACTTTCCCAATGGAACCTTCTTCCA
+CTCCCTTGGGGGACTCCCCAATGGGCCATGCTTCTGATTTATTCTCAAAAAACTCTTTGG
+TCATGTCTTTCTCTTTAATCGAGGACTCGGCTTCAATCATGACTGGCCGTCGTTTTACA
+.
+qlt:
+8666666666:8;7;7777777<><<<<:?==CCECAE@>GA>ABAKDCCEICKRSRXVS
+SCHCCOMMGNHQRRRMHCB at D>IKNNQQGEGGKGIV\_SQQRRRV]XVXVRVVVV_a_RL
+JJJKNSLL]X_VVRRRR\V___Y_____V\V_]]PPXP]]__a___XXLLPXVa_V\VVV
+RRRSRRSXRRX]a_a]\VVVV\\YV\SROQVVVV_\\V\VVXa]a]_Y_____]XXV_V_
+____YY___VV\V\]]RSRVOOMLLLXX___TVXPPXX_V_Y___Ta___Y__aa_VV\S
+SRPa]]aa]aVVS\SS]]_]XPRa\YY__Y__a]XPRV\_Y]\VXX\\_]__Y_]]____
+_Y__XVRR\V____VVVRRRSaWPXWX__aaV\V]V]XWXEEKCCKKKHH<<HGCE==<
+.
+frg:10
+clr:33,379
+}
+{RED
+iid:206
+eid:1086975881
+seq:
+ACGATCTTTTTTGGCGTACGGATAACAAATAGTAGCACTGCCATAACTATTTTAATGCAT
+GTGTCAGGAAGGAGTTGAACCAAGATGCATTGAGCAAAACCCAGGGATCATTAATCAGGC
+ACTCCTCAATTGCTTCATATAGCCCCCCGAGATCAAAGGTCCCAGGTTCGAGATTGTCCC
+TAAGAGCCTGAACAACAAGAAGCAGTTTTCTTGACTCCGCTGAAAATCCTTCCAATTGTG
+GTGATGCATACAGGCTATTGAACACTGACTTAGCCAATAGAGTCCTACAGACTTTCCCAA
+TGGAACCTTCTTCCACTCCCTTGGGGGACTCCCCAATGGGCCATGCTTCTGATTTATTCT
+CAAAAAACTCTTTGGTCATGTCTTTCTCTTTAATCGAGGACTCGGCTTCAATCATGACTG
+GCCGTCGTTTTACAA
+.
+qlt:
+6666698=77B<<8778>=>>A?@ECEN?EE at QEHNHFGEICGQR]_\]\X\SKIGKGGK
+NRGLIIIEMXXLJJNNRRR]\\VNPQORRRS]\RV\VVV]\\_QLKIKKPV\XRNNQQL]
+PPXXVMVVVV\V_\VV\V\WXRX]X_T]aRSRRR\____Y\\\\V\_a]LJJJRR\_]aa
+a]aLLaP]V\V]]___RRRRRRXXRPaTa_]VVV\VV]aaXRXV\VVVVaVV\\VVXXXR
+]VVV\V\YVOQQMNSX___VVX\_\\VV\HWXLLSLOMLLLPa]__]XXXRaaa__Y_\\
+PRVV_V___aa]]]TXXV_]__a_aVVV\SRa]TVTXX]V\MVVVT]aaXTVMV\VVVVR
+RVX\_VVTaaaaV___T__X]aaaaaaaPTXPW]XXaXXXXXPaa]\\MVVVHXPLPPLL
+P]IHHDHDGGEBBBT
+.
+frg:73
+clr:16,394
+}
+{RED
+iid:207
+eid:1086975790
+seq:
+ACGTAACGGTTCAATGCTGGGTATTTGAATTTTAAATGGGTCAACCAATTCAATCTACTA
+AAGAAACTGTTATTAGATCTCCTTTTGCAAGCAGAGCTTGTTCCATTTTGAGTGACTCCA
+GTCCAATTGAAGCTTTCATTGTTAAACTCCAGTGTGCCGGATGAGGCAACTAGTGACCTA
+AGGGAGGCATAATCCGGCACATCATAAGGGTAACAGTTGCTGTAGGCTTTGCTGCGTTCA
+ACAAAAAGGTCCCATTTCTTATTTTGGAAGCCATCACACTGAGGGTCTCCCAATAGAGCA
+TCTATTAGTGTGCAGTTTTCTCCATCAAGGATCTGATGAGGACTGTCGCATATTCCACCT
+GTTGAGGAACTCTGAACCAGCTCAGTAGCATTAGTAACTTCAATTTGGTCATTCGTGATT
+GTTTTCACTATCGTTCCGTTTGGTACTGCATGGTGCCCAAGGCACAGCGTTGCCGTGCTG
+TTGTCATTTCCGGGAAGTTTTTGAGCGAAAACCAGACATAGAATGTAGCTCAAAGCAATG
+ATAGTCTTCATGGTTAATAGAATTATCCCCTGCTTTTGCACTGGCCGTCGTTTTACAA
+.
+qlt:
+66666677<<<==<<<CCCB<>BH?B\SSSCBA99<??@@AB at HOKGGII@@IHKKGHHS
+GHGZSSSRGRSVLHABBHKRaa_a\V\\VV\V]XX]aaa__OPPJNPaa]aaV\V\VVQQ
+RRSS\VV___Y___\V\V\VV\V\V\_YVVRRRRR_aa___\XV__Y_YV\]\NO\OSVY
+_______YY___YVV\\VV__]__]_aV__Y______]aaYV]T\X\\\a]__Y__\\\X
+\\________V\VRRXa__]]]__Y_VVVVV\V\\___V\\S\VVX___]]_]XLaPWW_
+__X\XXPXGXWX\XXXaa]]\\\V\\_VRRRSR\Y_VV_VMV\VV]V____]_\V\\\\a
+aa___YV\\V\\]___WVVRPV]VPRTT]]]]aaXV\Y______aa______YV]XV\Y_
+_aVVV\V\\aa]Y______aa_______V____aa_____Y_____V_]aa_a]a__aaa
+a]__]____aaa__________aVa\XXV]V\WTLLWW\XXXTVVVWRXXWT__]__YYY
+__Y_aa_____VV_XVXPLLL]WY__Y_]_aaa__]_VVVVRSXJJ<>88;@<HNGGP
+.
+frg:22
+clr:9,558
+}
+{RED
+iid:208
+eid:1086975830
+seq:
+GAAGCCATAGTTCATGCTGGGTATTTGAATTTTAAATGGGTCAACCAATTCAATCTACTA
+AAGAAACTGTTATTAGATCTCCTTTTGCAAGCAGAGCTTGTTCCATTTTGAGTGACTCCA
+GTCCAATTGAAGCTTTCATTGTTAAACTCCAGTGTGCCGGATGAGGCAACTAGTGACCTA
+AGGGAGGCATAATCCGGCACATCATAAGGGTAACAGTTGCTGTAGGCTTTGCTGCGTTCA
+ACAAAAAGGTCCCATTTCTTATTTTGGAAGCCATCACACTGAGGGTCTCCCAATAGAGCA
+TCTATTAGTGTGCAGTTTTCTCCATCAAGGATCTGATGAGGACTGTCGCATATTCCACCT
+GTTGAGGAACTCTGAACCAGCTCAGTAGCATTAGTAACTTCAATTTGGTCATTCGTGATT
+GTTTTCACTATCGTTCCGTTTGGCACCGCATGATGACTGGCCGTCGTTTTACAA
+.
+qlt:
+6666666667888<B<;88@<:<<<<<<<<<?C@<=D?@?@DEEFFFFBDFAFEPRR_]T
+TMJSVLLLJIEG=<787@=SV\_SSPOMPPPOXLL]W____OSSMPOYT__WIFFGDFKV
+\VVV\V\_YYY]]_\\VVVVV\\VVV_\VVVVMWXX\VVRR\VV______VXXLSRXVV_
+_YV]XVVSRVVV______V__]]]XVXT____]V___]aa_\V_\\\\_a]__aa_____
+]]______]_______a__]YT___VX\X_]]]]___V]VV\\]]VRXX]]]WXLPPX]V
+_YXVTXXLLWXV\V_X\V_________\QOQRRV__V__VMVVM\aPXTV]_Y_Y____a
+a]a]a___________V\XXXW]XXXaXXWXWRRXW]Y____T__aa____T]TTNQQRR
+\aa______Va_aaaaaaa_]WCCMMBKa]I@=GFXXRXaWPGB::9@=LLL]]
+.
+frg:53
+clr:37,435
+}
+{RED
+iid:209
+eid:1086975915
+seq:
+GGGACTTCGTCGGAGTGTGCATTCAGAATTGCATTTGCCAATGGGTGCATCTGATCTCAT
+TATTGAGCTTTTCCCACTTCGTATTTTGAAGTAACCCCGAGGAGCAATTAGATTCCCTGT
+GCTGTTAATCAAAAGTATGTCTCCCGGTTTTACTATTGTCCAATAGATGCTTATTCTGCT
+GGGGATATCCCTTACCCTGGGTCTAGATCCGATATTCGGGATTACAGTTTGTTGGCTTCT
+TTTGGTAGAGACTGTGATTCTTCCTGATGCTTGAGCATATAGGCTGATTTGGTCATTGTT
+CGTACCCGGGTGGTGAACCCCCCAAATGTACAATTTGTCAAATTTTTCATTGTTTGGCAT
+AGTCACGTTCAATGCTGGGTATTTGAATTTTAAATGGGTCAACCAATTCAATCTACTAAA
+GAAACTGTTATTAGATCTCCTTTTGCAAGCAGAGCTTGTTCCATTTTGAGTGACTCCAGT
+CCAATTGAAGCTTTCATTGTTAAACTCCAGTGTGCCGGATGAGGCAACTAGTGACCTAAG
+GGAGGCATAACTGGCCGCGTTTTTACAA
+.
+qlt:
+66966:86666689<@;7?@CG at A=;789=BFG at AH@@@ICCMRMOJIKIIEGGOICCNG
+JRMVKVVVXTPPCCADFFXXVV\\SSRRSRVVV\\\MVRSMKQQQVV\XMLLOO\Y_TV_
+__\V\\]VV\]VX_\RRRRRV___Y_Y_VVV\\V_VV_\V\\KKNGLNN\______T]__
+aaVVVV\]__Y____V_aaVV\PXWPRWXLLPX]\\Va\VV\\V____aaa]V\\VVV__
+_TVXPPWDDIIOMPQORRRV_Y_V_T____a\XRXX]TX\X_]]XTV_____T__Y__]a
+VORVOVVa]]aa]XXXX\]YXVVX\V___V]_V_a]__]]]V__aV\VSSVVa]VXVXX]
+LXLXWXXR\\VVRX]aaaVVVVV\VRV\\___\VXRa]__Y_______V____X___a]X
+LLWX______XWLIGaPaaaaa]V\]]VRMKCCWMVa___]VXRVaaaaVXVW_XXXXRX
+XX___a]aRaaa\V____________V\XTLaaaaaXXXXXXVXY_YV]WXLXW____aa
+XXWXVVVRVSPLXXB97669<<DDDLLM
+.
+frg:79
+clr:12,526
+}
+{RED
+iid:210
+eid:1086975896
+seq:
+CACTTGCTCGAGGTCCTGAATTCTCCCTTCTACTTCTGAGAATTCTTTTTCAATCTGATG
+GAATTTCTCGTTGGTTTTCCCGATCAACCTATTCAGCTTCCCATTGATTTGGTTGATTGC
+TGCTTGAGTGCTTTTGAGATCTGCTGCTTGTCCTATTCCCTCAGAATTTTGATGCCTGAA
+ACCGTACCAACCATCCACCATTCCCTCCCAACCATTTTCTATGAAACCCGCGATTGCGCC
+AAATATGCCTCTAGTTTGTTTCTCTGGTACATTTCGCATCCCTGTTGCCAATTTCAGAGT
+GTTTTGCTTAACATATCTGGGACAGGCCCCATATGTGATCCTGTTTACATTTTGAAATGG
+TTTGTCATTGGGAATGCTTCCATTTGGAGTGATGCATTCAGAATTGCATTTGCCAATGGG
+TGCATCTGATCTCATTATTGAGCTTTTCCCACTTCGTATTTTGAAGTAACCCCGAGGAGC
+AATTAGATTCCCGGTGCTACTGGCCG
+.
+qlt:
+6688687:8879=BBEHECA?>SISMJHJJLROPMRMRM at DBBBBVVTHFD?BDMHENCH
+OOPOOPSSKVF?:99EDV_V__JJMOPO__YPPPJPP__VVV\\VVVV\\_Y]OMLONV_
+___Y______TY_aVVVRRMQR\\S_Y_____Y__]__Y\RMOJHOOXX\\VV\VV\\\]
+\_____Y___Y___Y__Y_Y__aYY_\VVO\VVVV\aVV\\VV_Y_]__a__XTX]aV\V
+\VVYY______VV__aa_______a_VV\VVVWXRTXW]_Y_aa__R\\\MV_XXXLLPP
+Va_]aYR\VVV\_Y_aaaa___V___a_____Yaa___Y_Taa__VV\PR\V_V___Y__
+_______\V]]RRV\V\___V________R\V\\V__VXTLLX]____YYa_Y_]XPaaa
+____YVV_V_Y____Y_YTVTVX\V_______\aVXRVV_aaaa]TT]]_]]RRMOMLMM
+]\TXFD<<FIXXLLPLSRSMHLM@@9
+.
+frg:60
+clr:7,475
+}
+{RED
+iid:211
+eid:1086975891
+seq:
+ATAGGGCATCTATTACATGAAGACTATCATTGCTTTGAGCTACATTCTATGTCTGGTTTT
+CGCTCAAAAACTTCCCGGAAATGACAACAGCACGGCAACGCTGTGCCTTGGGCACCATGC
+AGTACCAAACGGAACGATAGTGAAAACAATCACGAATGACCAAATTGAAGTTACTAATGC
+TACTGAGCTGGTTCAGAGTTCCTCAACAGGTGGAATATGCGACAGTCCTCATCAGATCCT
+TGATGGAGAAAACTGCACACTAATAGATGCTCTATTGGGAGACCCTCAGTGTGATGGCTT
+CCAAAATAAGAAATGGGACCTTTTTGTTGAACGCAGCAAAGCCTACAGCAACTGTTACCC
+TTATGATGTGCCGGATTATGCCTCCCTTAGGTCACTAGTTGCCTCATCCGGCACACTGGA
+GTTTAACAATGAAAGCTTCAATTGGACTGGAGTCACTCAAAATGGAACAAGCTCTGCTTG
+CAAAAGGAGATCTAATAACAGTTTCTTTAGTAGATTGAATTGGTTGACCCATTTAAAATT
+CAAATACCCAGCATTGAACGTGACTATGCCAAACAAGGTCATAGTT
+.
+qlt:
+6667866668:H??C99EBOHBOUF????>?MMOZSPJMSPSMOPP\VV]]SSOPJPZTO
+OMIIIILLSR\VV\\\\SSVVVPOPTOPSZSV_SVV\V\Y__Y_____]V\V\\\V\VV_
+_Y]V\\V\V_Y\\V\V\YY__Y\\S]\\]_YYYY____\SV]\\_Y___Y\VSVVX\VY_
+_YY_V__Y___\VVVRS]]_____]_______V\V\VS]\\\VYT_YY___V]XXX\]]a
+_Y__VV_____YY___Y]____]V___VV____YY_a_Y_YY__]__XXXa]Y_Y___YV
+\]\\X]]]]aSV\V\V_____]a__Y__Y_Y__]_T]__Y_V____YY_Y_Y___YY__Y
+_YYVVVV\\aYa____Y_Y__aa_a__YY__________aaa]Y____Y__Y___V\VSV
+SV\\\\\____aaaYY\_____a__Y_Y_aa_]Y_______a]]_______aaaaaaaY_
+___Xa]a\XX]]_aaa__Y__Yaa]_____T]RXVV_____aaa__Y___a_________
+____a__a_aa]aaa_aaa__\HD99FH___VVVSRQNQQN?A966
+.
+frg:22
+clr:16,554
+}
+{RED
+iid:212
+eid:1086975848
+seq:
+AGACTGGGGTCACGGAACGATAGTGAAAACAATCACGAATGACCAAATTGAAGTTACTAA
+TGCTACTGAGCTGGTTCAGAGTTCCTCAACAGGTGGAATATGCGACAGTCCTCATCAGAT
+CCTTGATGGAGAAAACTGCACACTAATAGATGCTCTATTGGGAGACCCTCAGTGTGATGG
+CTTCCAAAATAAGAAATGGGACCTTTTTGTTGAACGCAGCAAAGCCTACAGCAACTGTTA
+CCCTTATGATGTGCCGGATTATGCCTCCCTTAGGTCACTAGTTGCCTCATCCGGCACACT
+GGAGTTTAACAATGAAAGCTTCAATTGGACTGGAGTCACTCAAAATGGAACAAGCTCTGC
+TTGCAAAAGGAGATCTAATAACAGTTTCTTTAGTAGATTGAATTGGTTGACCCATTTAAA
+ATTCAAATACCCAGCATTGAACGTGACCATGCCAAACAAGGTAATAGCTGTTTCCTAATA
+ATCCTAAGAGGGAGGCCCACGGTGGGGAAGGCATGTCAGTCTGCTGCACTTCAAAAGCAA
+GCATTGCCAATGTTCCTATAAGGGACGGAAGTATCTCCACGGGGGAAACTGTCAACTAGA
+CGAGTACAAATTGCTTCAATGTGATGGTCTCACGCGAGGCTCAGGAAGGGACATTGTTGT
+ATTAGTGCCGGATTTTTCCATTG
+.
+qlt:
+666999:8779777777<<??A>EHECCELD=@?@;=CJHHGDGGGDRQJRQV\\\\\SS
+RRSR\\\]___RNSHFJCC>FWX_VV\SKNNLK__\\\MOOMNJRSVOV_VVP]XXXXXW
+]_]VVR\\VXRM\\\\V\Y___TT_XXXXX\\___Y____]aROV\\\VVWPLaWV_Y__
+__\\\\VV_\TXPMLKRRRRVVVVa]_a______YV\RRVXTRTV__V_V__VVVa____
+_Y_Y___Y_Y___V______T_T___]a_\VV___V]T\PaRWWY__T___aYY____SV
+VV\ST]]____Y_a___TVX\VVVV]RVX\VX\XXXX]V___]_a_aY_V__\TRaaTaa
+]_____]VTXSLLOMV_____\TXXaa__\]TXLLLLXX_Y____]aO\\\VVY_Y__Y_
+________YY\_]VXX\Y_______WXLL]]]XXVV___]HD;9@<G at CBD@99<98699
+9:9966>9667877799:6799997999979;9999999;9:<;<::9<99<<9999@<9
+9;C<=99;C997999997799;;>=999797:9:99999997=@BB=<=?;=@=<99678
+99<<9<9:<>;<A==>;9979;779998999::999:97767:797999969;899999:
+8::89967799;:;<99999997
+.
+frg:53
+clr:12,437
+}
+{RED
+iid:213
+eid:1086975911
+seq:
+TGGGCCTTAAGTATAGTTGCCTCATCCGGCACACTGGAGTTTAACAATGAAAGCTTCAAT
+TGGACTGGAGTCACTCAAAATGGAACAAGCTCTGCTTGCAAAAGGAGATCTAATAACAGT
+TTCTTTAGTAGATTGAATTGGTTGACCCATTTAAAATTCAAATACCCAGCATTGAACGTG
+ACTATGCCAAACAATGAAAAATTTGACAAATTGTACATTTGGGGGGTTCACCACCCGGGT
+ACGAACAATGACCAAATCAGCCTATATGCTCAAGCATCAGGAAGAATCACAGTCTCTACC
+AAAAGAAGCCAACAAACTGTAATCCCGAATATCGGATCTAGACCCAGGGTAAGGGATATC
+CCCAGCAGAATAAGCATCTATTGGACAATAGTAAAACCGGGAGACATACTTTTGATTAAC
+AGCACAGGGAATCTAATTGCTCCTCGGGGTTACTTCAAAATACGAAGTGGGAAAAGCTCA
+ATAATGAGATCAGATGCACCCATTGGCAAATGCAATTCTGAATGCATCACTCCAAATGGA
+AGCATTTCCAATGAGGTAATAGTGGTTTCCTGATCTCGCGCGCATCTGTCACTAGAGAGT
+ACAAATTGCTTCAAATGATGGTCTTACGTTGTACTTTAAAAAAAATTTTATTTTAAAAAA
+AAAGTTTTTCAAATCCAGAAAACACACCACCCCGTAAGGTTATTTTTTCAAATCAATTTA
+GTGTGGGAGTTTGTTGGGGGGTTTCAAAACGGTGAA
+.
+qlt:
+666769;8778966::>HLSKKEGLESHG?DAFA>ICHCFMOJJ@@@@HHCGGGEHMPCJ
+SPPOOPOSSO\VOOMDGABIPRVRSVVV\_]_a]]_\\\\VXY__PJNPPO___VSQOPQ
+]aaVVOVVV\VRV_Y__V\\VVR\\\\\_Y_YY_Y_V\\V\V_a_\____a_aYY__Y__
+_Y____YY_\Y____aYYY______YY__________XVaaaT__Y__Y__Y__Yaa__V
+]VXX\]]YYa_Y_]__XXVX____YY__________\VRXXa]SSVV\VY___]V__Y__
+_\T\XRV]________]___YYYYTaV_____]VXT]]______]______V_\\V\\\_
+]T_VVTPLLWX__XXVXT_V______]]XRXTV___YY_TXRMRRRV___]____V___Y
+__Y___VaVV____T_Y_YY]__Y]___Y\VVV\V\\\X__VV__XWXa]Y_____]_]_
+_____]VRRRRRXRX]_________Y__]___Y_Y__Y_Y__________\\V]VVV_\_
+___]HD99DDOMPSKE?99A>778877<<B999977>9:967:667B@<<9798999;8?
+B==B@=:=::?;:@::99=999:9999979799997799:>999;:;:999:9979:998
+99999977979779797999:99=;:77777::9669999799;:999999997999999
+988799999877997777999767797999999996
+.
+frg:79
+clr:14,530
+}
+{RED
+iid:214
+eid:1086975861
+seq:
+AGGTGTGCCTGGGTCCTCAAAATGGAACAAGCTCTGCTTGCAAAAGGAGATCTAATAACA
+GTTTCTTTAGTAGATTGAATTGGTTGACCCATTTAAAATTCAAATACCCAGCATTGAACG
+TGACTATGCCAAACAATGAAAAATTTGACAAATTGTACATTTGGGGGGTTCACCACCCGG
+GTACGAACAATGACCAAATCAGCCTATATGCTCAAGCATCAGGAAGAATCACAGTCTCTA
+CCAAAAGAAGCCAACAAACTGTAATCCCGAATATCGGATCTAGACCCAGGGTAAGGGATA
+TCCCCAGCAGAATAAGCATCTATTGGACAATAGTAAAACCGGGAGACATACTTTTGATTA
+ACAGCACAGGGAATCTAATTGCTCCTCGGGGTTACTTCAAAATACGAAGTGGGAAAAGCT
+CAATAATGAGATCAGATGCACCCATTGGCAAATGCAATTCTGAATGCATCACTCCAAATG
+GAAGCATTCCCAATGACAAACCCTTTCAAAAGGTCATAGCTGTTTCCTGAAGCCCCGGAG
+ACCCTTTCACCAGACCTACTCTTCATGTCATAGCTGTTAGACAAATAAACATGATACGTA
+TCTGACCTTGAATACGAACATCCCATATGGAGGTTGGTCATATT
+.
+qlt:
+86777966668:9888A>=<77<<?><DBA<L at KVRHMHMRRSRRR\IIGNKJ___PJIE
+ENS]]_V\XRRNMLLDC?CFFEKKQQSQ\SZMIMSVVVMSV\\\]_\RRRRRVV_YV__V
+\XRSV\ROMJOMS___Y_Y_VVM\\\VVVVVVY_____Y_\_]__V_YV\\\\\___]a_
+RSRSMV\_YY__YY____\\WRPWXY____V\\S\V___YT\Xa]SR\VVVVV_a]V__V
+V\]\Vaa___V]]_____Y_Y__Y__Y_Y_____V__VV\VVOV____XVXT___\\V\V
+SY_]VXXXPMSVV\V_T_V__YVTVV\VVVVaaa]]TYY____VRSVOV_Ya]TVVVV\\
+_____Y__\\\]V\YV_____a]Y_Y___a______Y_T___VVSSR]aaaaY_\__Y__
+_____]aa\RX]XRXXWXY___Y______________Y]a]_Y_________V\VVVVaa
+a]_V__Y_Y__V\VXVWKD99HHKNMVV]]_]]LLPFFE<>;CBBKK8<676;:668997
+9:9967778889:99798779999>99:99B::::9699988966999:97999999999
+97:;777979999:9779977997<;;@@;9967=999899;;9
+.
+frg:66
+clr:9,488
+}
+{RED
+iid:215
+eid:1086975845
+seq:
+CCGGAACTACTGCTCCTCGGGGTTACTTCAAAATACGAAGTGGGAAAAGCTCAATAATGA
+GATCAGATGCACCCATTGGCAAATGCAATTCTGAATGCATCACTCCAAATGGAAGCATTC
+CCAATGACAAACCATTTCAAAATGTAAACAGGATCACATATGGGGCCTGTCCCAGATATG
+TTAAGCAAAACACTCTGAAATTGGCAACAGGGATGCGAAATGTACCAGAGAAACAAACTA
+GAGGCATATTTGGCGCAATCGCGGGTTTCATAGAAAATGGTTGGGAGGGAATGGTGGATG
+GTTGGTACGGTTTCAGGCATCAAAATTCTGAGGGAATAGGACAAGCAGCAGATCTCAAAA
+GCACTCAAGCAGCAATCAACCAAATCAATGGGAAGCTGAATAGGTTGATCGGGAAAACCA
+ACGAGAAATTCCATCAGATTGAAAAAGAATTCTCAGAAGTAGAAGGGAGAATTCAGGACC
+TCGAGAAATATGTTGAGGACAGGTAATGTAATAGGACAACGAGATGACTTCGACAAGGCC
+TGCGAGCTAACTGATTCAATCTGGATAGAGCTCGATGAAATTGGAAAGGACGTATCCCCA
+TTTGAATACATTGCAAGCATGAGGAGGAATTATTTCAGAGCGAGGTGTCGCATTGGAGGT
+CAAAAATTTTTCCAAAGACCCAAGACCAATAAGTTGAGAGCTGAGGAGTAAGTG
+.
+qlt:
+69977767667=>@@@@@@@@=>>>?AGBBCNMMEGHOMQRIMJSXV\VOOPPPSPPIOF
+FNMMLGGMMPM\\OKKHFHNQRRRRSRVX\VV]V]VV\VVVVRPPPOPPXV\VVOVV\VM
+PPPPPVOOVV\____OOPOOPV_Y_____V\XX___Y__YYSXS]]\_]_V\]WRXWXYY
+_____YT__]_YYYaY_____Y_____YYQMLJMM\__V]]___XXWLGXX_VY___XXP
+XXWW__Y_____Y_X]XXRVaTVV_Y\\\OMLXPVLMMMV\RXTaR]aVV\SSVXRVXV_
+_____V__YY________]__]___]aaaaaaaVV\VV\RXV___aaTaXLLXXYYY_V_
+V_T_VXV\VT\XP\]__]_]aaa___\\Paaa_V__TV_]V______YY__aV___]_Y_
+VXRPXX\\YV___XWXIGXWVX\]]]RM\VV\WWWGLWXXXaR]a]VRTT____\\RV\\
+XXSSSFEGKIG\XHEFCCHGGH?=797666666666676676;=OXDH999996:@9;DH
+DD;;<A=;9:?;=K>=<:::;=CBIGBG><9>:BBB=CKHD<9<<99;;@B>>89999;:
+>9>>;<;>BGB==B;::99??@GGGIBB;=;<=C at 99997998;;@;9999;C997999=
+<::9999:77:997999:9699799799997:9999:::989979999997766
+.
+frg:60
+clr:11,477
+}
+{RED
+iid:216
+eid:1086975811
+seq:
+GCCCATTAAAGTCGATGCACCCATTGGCAAATGCAATTCTGAATGCATCACTCCAAATGG
+AAGCATTCCCAATGACAAACCATTTCAAAATGTAAACAGGATCACATATGGGGCCTGTCC
+CAGATATGTTAAGCAAAACACTCTGAAATTGGCAACAGGGATGCGAAATGTACCAGAGAA
+ACAAACTAGAGGCATATTTGGCGCAATCGCGGGTTTCATAGAAAATGGTTGGGAGGGAAT
+GGTGGATGGTTGGTACGGTTTCAGGCATCAAAATTCTGAGGGAATAGGACAAGCAGCAGA
+TCTCAAAAGCACTCAAGCAGCAATCAACCAAATCAATGGGAAGCTGAATAGGTTGATCGG
+GAAAACCAACGAGAAATTCCATCAGATTGAAAAAGAATTCTCAGAAGTAGAAGGGAGAAT
+TCAGGACCTCGAGAAATATGTTGAGGACACTAAAATAGATCTCTGGTCATACAACGCGGA
+GCTTCTTGTTGCCCTGGAGAACCAACATACAATTCATCTAACTGACTGGTCATAGCTGTT
+TCCTGATGAACTTCTGAAAGATGGACCCCGAATAAGCAAGTTAGGAGGGTTCTACATAAA
+GGTAAGATCCCATTTGCTGAAGGACACACATATGGTAAAGATTATGATCGTGAAGGTCAT
+ATTATTCCTGGTCTATAGAAACTT
+.
+qlt:
+66666699777777<88>>>?<<<<CJHJLCABADGCCGDHIHNLKGIMMPGGIGHGRSS
+OR\\\V\OPNMJ at B:999999 at BFFFMQIRRRS\\SRRHKPPPM\\RS__\\\_VVXXRL
+LJSM]V_R\\RVVV\\VV\V\Va______________RPMPPJVVV_____Y]XWPSWSV
+\SV\___XXKMKSPXWY____Y__YY____Y_a_VVVRRJXVVO\VV\____VV__V\V\
+VV_VV\VV\a__\\VV\V_RV\V\SX\_V]____aaaaaa_V_\VXVVV\\V_VVRXXXR
+V\_Y___Y__YV\V\VVV_TXV]___]]RX]T___Y_Y___Y_Y__Y____T_VVVV\\_
+_Y\\VOVV_\XPXV_V_]VX]WXPGGXWY___]______]aaaaP]TVXXaaaaaa\SVV
+VVaV__XXXLLLPMVV\\\V__V]RR\V\\_T__]WRXXXW_aaaV\V\\]Y___]___Y
+_______a___]__a_VVXX\\_]Y__]____WXGLWDC=;GDRVRR\W]IIJGGJLK\V
+MPG>D9997:79998769999999A=9999999999999=<;:9;;?<;9;9:99<;<=9
+99779988:;;9<;;9999:;98999:9978;99799 at 9::8989999979<::<9=977
+999799779897996998699797
+.
+frg:40
+clr:14,501
+}
+{RED
+iid:217
+eid:1086975897
+seq:
+TGGCGGAATAGTATCGGGAACCAACGAGAAATTCCATCAGATTGAAAAAGAATTCTCAGA
+AGTAGAAGGGAGAATTCAGGACCTCGAGAAATATGTTGAGGACACTAAAATAGATCTCTG
+GTCATACAACGCGGAGCTTCTTGTTGCCCTGGAGAACCAACATACAATTGATCTAACTGA
+CTCAGAAATGAACAAACTGTTTGAAAGAACAAAGAAGCAACTGAGGGAAAATGCTGAGGA
+TATGGGCAATGGTTGTTTCAAAATATACCACAAATGTGACAATGCCTGCATAGGGTCAAT
+CAGAAATGGAACTTATGACCATGATGTATACAGAGATGAAGCATTAAACAACCGGTTCCA
+GATCAAAGGTGTTGAGCTGAAGTCAGGATACAAAGATTGGATCCTATGGATTTCCTTTGC
+CATATCATGTTTTTTGCTTTGTGTTGCTTTGTTGGGGTTCATCATGTGGGCCTGCCAAAA
+AGGCAACATTAGGTGCAACATTTGCATTTGAGTGCATTAATTAAAAACACCCTTGTTTGG
+TAAAGCTGTTAAAAAAGCGATACAAAAAACCTATTTAGCTGGTTTCTTCATAAAGAGAAT
+ATCCCATTTGTAGAAGGACACATTGTAGCAAACTTGATGCTCGTGGAGGTCATATGTTTC
+TTGATCAAAAGAAAATCCTCCAATCCCCGGAGTCAGAATGCGTTTGTATCAATGGAACTT
+GTACA
+.
+qlt:
+66666666666:<<CC=:77::>>AHME<<??>ECE<>GFGEEGEGRRRGGIHIIKIGGG
+LQQPQX\_TWD;9=C at CEEHL\RLRRMQLJJMMHV\\__\\VVVV\___VXWLLWXXa]V
+VVVV\V\V\\aa__VTXXT___a_Y__\V\\VRNSV\\\\V]VV\XVV_____Y_VV___
+_XXWLLXXT___Y__\XVX]_Y__]TXXT]_V\RPXPXXX_XaPa\__\\\VV\V__VSV
+VVV__T_]XRXVaaa_VV\\VV___YVVOVRVXVX_VM\\OVSa]]XTTX__VV___Y_\
+XPLLXWY_________Y\\VNNQV\\]_]VVVRSRRVRRWX_V]________aa_VVVMO
+LLWXY__VVXPV]_V___TX]V_W]RRRR\V\\VXRVV__TV________Y]V___Y_\\
+VVV]_]TRX]a_______Ya__]]__aaaa]aaaYY__Y___V____________]___\
+_Y__Y__YX\aaaVX_______]____\V\RXXVT___YV]VS]VTT\TTMKIIMMGKE=
+=<<<<6667977677769 at 886999@CG<;99999999999:BBB::9799999979:89
+79;:<A;9=9977:99<::8997999999;8799979:99:99>99999;9999999:=:
+9::88899<:@=?C=?==>999899<<9979998;:9987997999799999;:8=:<99
+9::96
+.
+frg:42
+clr:34,512
+}
+{RED
+iid:218
+eid:1086975849
+seq:
+TGGGACCAGGGGAAACGTTGGAGGAACTAAAATAGATCTCTGGTCATACAACGCGGAGCT
+TCTTGTTGCCCTGGAGAACCAACATACAATTGATCTAACTGACTCAGAAATGAACAAACT
+GTTTGAAAGAACAAAGAAGCAACTGAGGGAAAATGCTGAGGATATGGGCAATGGTTGTTT
+CAAAATATACCACAAATGTGACAATGCCTGCATAGGGTCAATCAGAAATGGAACTTATGA
+CCATGATGTATACAGAGATGAAGCATTAAACAACCGGTTCCAGATCAAAGGTGTTGAGCT
+GAAGTCAGGATACAAAGATTGGATCCTATGGATTTCCTTTGCCATATCATGTTTTTTGCT
+TTGTGTTGCTTTGTTGGGTTTCATCATGTGGGGGTCATAGCTGTTTCC
+.
+qlt:
+8<788676666678778?::88:>89@@CCNHEAEBHIAAICG at NPP]PLNP]_]\\\__
+_\\]\OOMMOK\\]SDHMKJMSS\\]\VRMRRRR\\______OHFFFFLLVVMJNQQPTX
+Xa____V]SS\]\\VXXXXT]V_Va_TVVVVSSRRRQVaV\V\\V__V_VSVS\VV__]\
+VV\\__Y_T_OOMLLMa]SS\VVV__aa]__VY__Y\V\SVV]VXXXTY___Y___YYY\
+\\STS\\V]_VXWXPXWTTPXX]]]X_]V\VVV\]a__\VSRMMXTX]RX]__Y]___V\
+aV]]]_V]PXV]_Y_VVV\V\MMV\\___VRVVVR_____Y_]___XWTX_a]_a_____
+_aaa_]aaVYY____\FD99HG__V_VT]]aYYXXXKKGG?KHPDD<<
+.
+frg:30
+clr:21,373
+}
+{RED
+iid:219
+eid:1086975809
+seq:
+CATAACAAGGGAATTCTCAGAAGTAGAGGGAGATTCAGGACCTCGAGAAATATGTTGAGG
+ACACTAAAATAGATCTCTGGTCATACAACGCGGAGCTTCTTGTTGCCCTGGAGAACCAAC
+ATACAATTGATCTAACTGACTCAGAAATGAACAAACTGTTTGAAAGAACAAAGAAGCAAC
+TGAGGGAAAATGCTGAGGATATGGGCAATGGTTGTTTCAAAATATACCACAAATGTGACA
+ATGCCTGCATAGGGTCAATCAGAAATGGAACTTATGACCATGATGTATACAGAGATGAAG
+CATTAAACAACCGGTTCCAGATCAAAGGTGTTGAGCTGAAGTCAGGATACAAAGATTGGA
+TCCTATGGATTTCCTTTGCCATATCATGTTTTTTGCTTTGTGTTGCTTTGTTGGGGTTCA
+TCATGTGGGCCTGCCAAAAAGGCAACATTAGGTGCAACATTTGCATTTGAGTGCATTAAT
+TAAAAACACCCTTGTTTCTACTGGTCATAGCTGTTTCCTAA
+.
+qlt:
+9997666667:88><8:987789::87:?>==HAA=@=<=AACGCCGLGH@@@@BGGMGN
+NIRJPRMRIFFEEHMIVQNQQQR\]\\VV_]VSS\R\_\\XX\VV\\VXPTPRS]]VV\V
+_V\V\RV\VVVVVVVVXXX\LKKABKHV\VVVVVVXXVaaVV\PPHHPMVRRPPPXRXW\
+VVX]SXX]\\VV\TVXJPPPMPV\_V\XR\a_aa_\\VV\\]PTVVVVVV\VXXV_XV_V
+TXXVVXXXTXPXV\V__]]MKCDWWRRXR]]]__TVV\\VVVRPVXVXTXPLJJJNHKXP
+RXW_______YaaV_VSKKDDX]XXXRXXR\WRPXXTVXTRX]XMSSSRSTXMJJOMRXX
+V]]]_XVKR\\V_T___VRVVSV]\]RXV]_a___T_\V___V______VaRR\V____V
+__Va]aaaaaaaVXXX]]aa]_]____XTRPTXX_____Y_V___XWaaaaP]RXXXaaX
+V___YT___V_____VVRXPXLLTPRXXLGBIP\RGD;9<<
+.
+frg:4
+clr:41,481
+}
+{RED
+iid:220
+eid:1086975837
+seq:
+GCCTTAAAAACGTTGAGGAACTAAAATAGATCTCTGGTCATACAACGCGGAGCTTCTTGT
+TGCCCTGGAGAACCAACATACAATTGATCTAACTGACTCAGAAATGAACAAACTGTTTGA
+AAGAACAAAGAAGCAACTGAGGGAAAATGCTGAGGATATGGGCAATGGTTGTTTCAAAAT
+ATACCACAAATGTGACAATGCCTGCATAGGGTCAATCAGAAATGGAACTTATGACCATGA
+TGTATACAGAGATGAAGCATTAAACAACCGGTTCCAGATCAAAGGTGTTGAGCTGAAGTC
+AGGATACAAAGATTGGATCCTATGGATTTCCTTTGCCATATCATGTTTTTTGCTTTGTGT
+TGCTTTGTTGGGGTTCATCATGTGGGCCTGCCAAAAAGGCAACATTAGGTGCAACATTTG
+CATTTGAGTGCATTAATTAAAAACACCCTTGTTTCTACTGGTCATAGCTGTTTACTAA
+.
+qlt:
+99799:678778<AAAC>77AAHOHH at CGGHIBIIO@AFKEMOOKN\a\\\\___\LLPM
+PZTZS]V\QFCHDDIPRV\V\\ZSSSZS\VY_YY_Y\\RRRRRRVVV\\VVV_Y___Y_Y
+\]\\V\\\V_VVV]V\VVV__\__]YV\VVVVYOJPOMO\\_____Ya]aa_]\VX\\]_
+_______]___]__Y__Y_]aaY___Y___VVV\]RWXGGWX_____]___YY___VV\]
+\V____XTXRVVSVVVX__]___]____a]a]\VRRRSTW__V__Y____Taa]]X]]V\
+VXPTVY__\VMRVOV_T______VMVX\V_aa]_\]\]VV]\XPR]aa_\_____]__YY
+__YYT_____YY__]__]_Y__Y_Y___YVVV\\\]_Y__Y]_aaaa_aT__]_]a]___
+Y___aaaRX]]]_______________aY_a]]VXR]XVXXLSPNFACBFE at B<9:<<
+.
+frg:14
+clr:12,438
+}
+{RED
+iid:221
+eid:1086975774
+seq:
+TAAAAGATTATTATTCACTCACTGAGTGACATCAAAATCATGGCGTCCCAAGGCACCAAA
+CGGTCTTATGAACAGATGGAAACTGATGGGGATCGCCAGAATGCAACTGAGATTAGGGCA
+TCCGTCGGGAAGATGATTGATGGAATTGGGAGATTCTACATCCAAATGTGCACTGAACTT
+AAACTCAGTGATCATGAAGGGCGATTGATCCAGAACAGCTTGACAATAGAGAAAATGGTG
+CTCTCTGCTTTTGATGAAAGAAGGAATAAATACCTGGAAGAACACCCCAGCGCGGGGAAA
+GATCCCAAGAAAACTGGGGGACCCATATACAGGAGAGTAGATGGAAAATGGATGAGGGAA
+CTCGTCCTTTATGACAAAGAAGAAATAAGGCGAATCTGGCGCCAAGCCAACAATGGTGAG
+GATGCGACAGCTGGTCTAACTCACATAATGATCTGGCATTCCAATTTGAATGATGCAACA
+TACCAGAGGACAAGAGCTCTTGTTCGCACCGGAAGGTCATAGCTGTTTCCGGACAAT
+.
+qlt:
+6666766679789:898;977;>>=<:<<=><;77<@A==>GHEIEEIIIHJMMMHEDDF
+PT]]OSQQQKKF@:99>76787:;HHRV]HPMJGDGGBDDWWTLLLJRPEGFIH??9799
+?@KKEDIFLNJGGLIRRSMXPLLSMRR\aPHDDFFGPXLIEFFEHHLaXXJHHJJMMSXR
+XXRMKFB;;;:C=9BBJLJLLLLRWTPSK@@9<@HBABAaKHJLHEHGCCFIMMMMJJLL
+WXRXRXRaaPLLHGB?GHLPXXLLLLPXXLLPPSMPLJGLJIHDDPHKEKHHHKLPPXXX
+LLXTTXKKCCWTWLLLGKHKLKEBGGLLLLLLPXGLLKBBBIKMVPPEHJCHFJHXPPXR
+XMKBBIKLMM\SMRSNJEIEAIDKKMJDDJJJDJLLXXLGGG>@@ADIILIIXPLGIIA?
+GGDDDEKGAAAIKLLXPPLLLLGIKBAG@>MMLLGGPXPGDGGDGKK====AABFADEIA
+AEA@=<;?=GKKGGE;<JGKKC>?=>99<:=DAALKLLLGE?ACCC;;<D:;9:9:7
+.
+frg:8
+clr:18,492
+}
+{RED
+iid:222
+eid:1086975909
+seq:
+CGGGACAATGACGATGGACTGATGGGGATCGCCAGAATGCAACTGAGATTAGGGCATCCG
+TCGGGAAGATGATTGATGGAATTGGGAGATTCTACATCCAAATGTGCACTGAACTTAAAC
+TCAGTGATCATGAAGGGCGATTGATCCAGAACAGCTTGACAATAGAGAAAATGGTGCTCT
+CTGCTTTTGATGAAAGAAGGAATAAATACCTGGAAGAACACCCCAGCGCGGGGAAAGATC
+CCAAGAAAACTGGGGGACCCATATACAGGAGAGTAGATGGAAAATGGATGAGGGAACTCG
+TCCTTTATGACAAAGAAGAAATAAGGCGAATCTGGCGCCAAGCCAACAATGGTGAGGATG
+CGACAGCTGGTCTAACTCACATAATGATCTGGCATTCCAATTTGAATGATGCAACATACC
+AGAGGACAAGAGCTCTTGTTCGAACTGGAATGGATCCCAGAATGTGCTCTCTGATGCAGG
+GCTCGACTCTCCCTAGAAGGTCCGGAGCTGCAGGTGCTGCAGTCAAAGGAATCGGGACAA
+TGGTGATGGAACTGATCAGGTCATAGTGTTTTTACTAAAATCAGTGCCATCACGATTGGT
+CCCGAATGCCTGGAAGGCAGCACCTGCGCTCCGAACTTTCGGGGGAAGTCAAGCCCTGCA
+TCAAAAGCAATTCGGGGATCATTCCGTTCGAAAAGAGCTCTTGTTCTCTGGTATGTTGCA
+CACTCAAATAGGAATGCAATAATATGTGAGTTAGACCATCTCTCGCACCCATTGTGGCGT
+GGCGCGAGTACCTAATACTCTGTGTCTATGGACAGATCCTCTCCTTTGTCATCTCACTCG
+AGTAATTGGTCACGTTGTCTCGAGATCGTTCCGACATGGGGTGTTTCTACGGTCTTTTAT
+ACATACTTCCCAAGCAAAGGCATTTCTCTTGCTAGGCGGGTCATGATATTACCTCCAACT
+CACGGAGTTGAGTCTCGATGGAGATAATATCATGCCTCTCTCACAGCCAAAAATTAGACC
+GCCTGTTCTCATGA
+.
+qlt:
+696:976668:77;=<<>E>>@C at I===<<=B?BBE@@C at IGGL]FDFGDHEEMQVRHS\
+\]MISQLFELLLMMHOQNIGGMML\VGGJMML\\VVJPMMMGS\QQ\VQQVVVRV\VV]R
+MMMSRRRVOQ\V\___T_T_Y___TWXXLLW]VVS]VQVV\VSWPSPPXVVVVV__Y___
+_____]a_YYY_\T]XRV]V]\\V]]____Ya]aWLL]T__VWVXXRa]]_\S\VQRR\]
+V_\TXPVV\\RRaaV\V\X\]_____VXRRRXWTJJJNK\_Y]_____]TXaTVVR\VMP
+R\X__VVRR\SMNNGLWGI]]]__VVXXRVV__T]XP\V]_T_____VVRXTVXXRSVRV
+VXRVVVXaaa___Y__YY__T_]VT_______T_]_]__T_a]_VVVV\\\V______WW
+WCCKHRNLRPXXXTVaaa]a]LL]WXTPXVXVV\\\OXPGL]aa]]aa]_a___X]VX_V
+VXVXXXWTV___W]XLLXW_Y]VXXWXT__V_VVa_aaaaaXR]]__a_____V\VV\VR
+_a_\VVVMGJ<>I at DKK\XXRRM>=667779<77866666799977=979777799=:==
+=7779<878977:88999;8779997::9778:<<979777<><:77787788?:8798:
+877;;8:99=88877C<:<778:8777:<==9<88;=79<<;798977:<<8<;<979;7
+97669;FD>8;;:8:97777:89966777:::777:877:>8996689999788889779
+989777666666877766988779997777666686969666698968768897777969
+7779777;9876666666676677866667>7997677;899969866669966699979
+96779966779799779666686889;999996689997976669999768699976777
+666879797799666666699:76666666666969966666966679799998988776
+999667:9989988
+.
+frg:65
+clr:18,536
+}
+{RED
+iid:223
+eid:1086975828
+seq:
+GGGGGAACTGGAATCAATTTGAATGATGCAACATACCAGAGGACAAGAGCTCTTGTTCGA
+ACTGGAATGGATCCCAGAATGTGCTCTCTGATGCAGGGCTCGACTCTCCCTAGAAGGTCC
+GGAGCTGCAGGTGCTGCAGTCAAAGGAATCGGGACAATGGTGATGGAACTGATCAGAATG
+GTCAAACGGGGGATCAACGATCGAAATTTCTGGAGAGGTGAGAATGGGCGGAAAACAAGA
+AGTGCTTATGAGAGAATGTGCAACATTCTTAAAGGAAAATTTCAAACAGCTGCACAAAGA
+GCAATGGTGGATCAAGTGAGAGAAAGTCGGAACCCAGGAAATGCTGAGATCGAAGATCTC
+ATATTTTTGGCAAGATCTGCATTGATATTGAGAGGGTCAGTTGCTCACAAATCTTGCCTA
+CCTGCCTGTGCGTATGGACCTGCAGTATCCAGTGGGTACGACTTCGAAAAAGAGGGATAT
+TCCTTGGTGGGAATAGACCCTTTCAAACTACTTCAAAATAGCCAAATATACAGCCTAATC
+AGACCTAACGAGAATCCAGCACACAAGAGTCAGCTGGTGTGGATGGCATGCCATTCTGCT
+GCATTTGAAGATTTAAGATTGTTAAGCTTCATCAGAGGGACAAAAGTGGTCATAGCTGGG
+TTTACTGA
+.
+qlt:
+877987779=8797<77@@BAGH?>@???ELLJIDAADBCEEGGFDCGJQSR_]__SVVV
+QQ\\MOOPPMMMMJF@=<FGLORSV_aa\V\V\V\VV___VVVVV\__VRRRSRV]___V
+VVV__XV\\Y___Y____VV\V\V_\\VRRRRSSV\\VV___Y____YVV\V\ST\MOSV
+V__]Y____a\VVV\VV]Ra]aVVV]]__]a_Y_______Y_T\V____YY__]__Y__V
+__V_____]VPVXSV\V\VY_VT_V___T_Y___Y_____S\SV\V_Y_______Y__Y_
+Y_VT__V_VRR\V\\VV\RXPXX_]_YY_____Y_\VR]V_Y_YV\OMRVVVaTPR]]__
+__T__aVRV\VVVRMO\V_VXPV\\\\\_YVaa______V\aa__Y_VV_____a___Y_
+_Y_aa]_Y___Y____Y____________YV\Xa]V\V\RRXWWaaW]]]]RaaVY____
+Y_aa]]aa]__Y\\__Y__Ya____]]_____Y__________________aaaaaaaaa
+]PPV\Y__Y______]]Ta__]]_\\XaVV_]]Xaaaaaa_________________a__
+______aaRJGRR\VPPT]_Y_TT__T__T_T____FH99J99HH___VVSMLA==<;<<
+<>:9;CCT
+.
+frg:52
+clr:15,624
+}
+{RED
+iid:224
+eid:1086975816
+seq:
+GGGTAAAATGTGCTCTCTGATGCAGGGCTCGACTCTCCCTAGAAGGTCCGGAGCTGCAGG
+TGCTGCAGTCAAAGGAATCGGGACAATGGTGATGGAACTGATCAGAATGGTCAAACGGGG
+GATCAACGATCGAAATTTCTGGAGAGGTGAGAATGGGCGGAAAACAAGAAGTGCTTATGA
+GAGAATGTGCAACATTCTTAAAGGAAAATTTCAAACAGCTGCACAAAGAGCAATGGTGGA
+TCAAGTGAGAGAAAGTCGGAACCCAGGAAATGCTGAGATCGAAGATCTCATATTTTTGGC
+AAGATCTGCATTGATATTGAGAGGGTCAGTTGCTCACAAATCTTGCCTACCTGCCTGTGC
+GTATGGACCTGCAGTATCCAGTGGGTACGACTTCGAAAAAGAGGGATATTCCTTGGTGGG
+AATAGACCCTTTCAAACTACTTCAAAATAGCCAAATATACAGCCTAATCAGACCTAACGA
+GAATCCAGCACACAAGAGTCAGCTGGTGTGGATGGCATGCCATTCTGCTGCATTTGAAGA
+TTTAAGATTGTTAAGCTTCATCAGAGGGACAAAAGTATCTCCTCGGGGGAAACTGTCAAC
+TAGAGGAGTACAAATTGCTTCAAATGAGGGTCATAC
+.
+qlt:
+766688<<<<<<ACCCC=DA>><>>>EL\GPJIPP___\TVRRIKKGDARIRRRQMQSVV
+]]\QQQQMPJMMJNFCCFFNMLLPJLNS\ORRRRRRR\VV\OMSMHPHNMQRVRV____X
+VVVV\\\PPTXXXXX_]V]RP]MPMMOVVRMMOMR\\VV__\V\\V\RPaXXTRVV\MMa
+LLMMRRV\V__TVXT____X___V_____]_____VVPR\\_TV_\VRPXV]XXX]aRVV
+\VVXTTaLLLPP]]TXXWMMMV\VTXPVO\MRVXXLJJOMMaKDDPNV]RXXX__aXXVV
+XWRXXXVVVXRVV__XXTTaaRXX_]XVRR]XXXRX]_XXRaaa]V___XVPaa]aaa]X
+XVTX__V__VaaaXX]]VVTPLaaVVWXLLWWXaDEX]]XLKaLVVVVX__]aRa]RaVX
+XWXXPPWXY\\__]]T]aaa___Y_VWWXXXXXX________Vaaa]XPXGIWWVXWXXX
+XXWWXXXLXX]_\XXLLXXWRPPaaaaaaRXXTXV]__XXVV\XTaaaV]]_T\TPWLLX
+W]XXIIXWX_\WWXSSXW__XWPEEWNRS\V\VXXT]X__aaaaaaaVV_V___\V_XVT
+TTGLKKTMRVR\MXWMMRHHCCGKLHGTHH>=B?97
+.
+frg:44
+clr:7,603
+}
+{RED
+iid:225
+eid:1086975808
+seq:
+GGGTACGCTATCAGACCTAACGAGAATCCAGCACACAAGAGTCAGCTGGTGTGGATGGCA
+TGCCATTCTGCTGCATTTGAAGATTTAAGATTGTTAAGCTTCATCAGAGGGACAAAAGTA
+TCTCCTCGGGGGAAACTGTCAACTAGAGGGGTACAAATTGCTTCAAATGAGAACATGGAT
+AATATGGGATCGAGCACTCTTGAACTGAGAAGCGGGTACTGGGCCATAAGGACCAGGAGT
+GGAGGAAACACTAATCAACAGAGGGCCTCCGCAGGCCAAACCAGTGTGCAACCTACGTTT
+TCTGTACAAAGAAACCTCCCATTTGAAAAGTCAACCATCATGGCAGCATTCACTGGAAAT
+ACGGAGGGAAGAACTTCAGACATGAGGGCAGAAATCATAAGAATGATGGAAGGTGCAAAA
+CCAGAAGAAGTGTCATTCCGGGGGAGGGGAGTTTTCGAGCTCTCAGACGAGAAGGCAGCG
+AACCCGATCGTGCCCTCTTTTGATATGAGTAATGAAGGATCTTATTTCTTCGGAGACAAT
+GCAGAAGAGTACGACAATTAAGGTCATACTGGTTTTCCTGATTATTGCAGATGACGTATT
+TTACAATTGAATTCTTTGCCGCCGTGAGGAGGATTTATGTCACAGCGAAGGTTGTCCCAT
+GTGAGGTCAAACTGTTTTTTTCG
+.
+qlt:
+999967769=87@;:<>ABGMKILKJ=====>@MOBBDHEHKEGCCOJIGEOD@@>HDJC
+GCMICNECCNMFCEJNGGVQNRVKKO\PQQQQRSS\Y__POPJPNVXR]NMOMRP__V\V
+VVRY_VYY_aXVRV\V_V\VV\O_TXRT\_\\VVS\____a\\VV\R_aaMSVV\RV\V\
+V_V\\VSR\VVVaYTYT______Y_______V___Y____V_V\RV\V___Y_____XVR
+VV__YVV\VVV_\R\\\VVV__]aaaaaa]_]]VVVV\V\_VTTX]V_]____X\XXa]a
+]___V__Y_T_TVX_____]___Y_T__Y]___Y_YaaaaTaaaaT___V_VVV\\\\Y\
+VVVMX]aaa]MR\VV\WXXRXX__T___XXXX]]____VXXX]X_____]__________
+_VVRa]PR]RR]]____a___a_Y_________aa]Paa]a_]WXLLWPPaa]]___XVX
+X____aa]]]a]aa_aa]aa_____VV\X______aVV\VVM__YY____\\RXX__\_V
+X]XSLWLLXXXLLWXHH9=GDV]_\B at 8888877778:66668769797:667?;;;:67
+866=99999:;99:<8899979698>;;JE::799999=999;99869899999:@999;
+>698::89999999999:89999
+.
+frg:38
+clr:10,538
+}
+{RED
+iid:226
+eid:1086975868
+seq:
+TCCGTCGGCTTGAGATTTAAGATTGTTAAGCTTCATCAGAGGGACAAAAGTATCTCCTCG
+GGGGAAACTGTCAACTAGAGGGGTACAAATTGCTTCAAATGAGAACATGGATAATATGGG
+ATCGAGCACTCTTGAACTGAGAAGCGGGTACTGGGCCATAAGGACCAGGAGTGGAGGAAA
+CACTAATCAACAGAGGGCCTCCGCAGGCCAAACCAGTGTGCAACCTACGTTTTCTGTACA
+AAGAAACCTCCCATTTGAAAAGTCAACCATCATGGCAGCATTCACTGGAAATACGGAGGG
+AAGAACTTCAGACATGAGGGCAGAAATCATAAGAATGATGGAAGGTGCAAAACCAGAAGA
+AGTGTCATTCCGGGGGAGGGGAGTTTTCGAGCTCTCAGACGAGAAGGCAGCGAACCCGAT
+CGTGCCCTCTTTTGATATGAGTAATGAAGGATCTTATTTCTTCGGAGACAATGCAGAAGA
+GTACGACAATTAAGGAAAAAATACCCTTGTTTCTACTGGTCATACTGTTTTCCTGAACCA
+TAAGGTATGACCCTTCGTCATGAAAGATCCCGGAGAAATTACATGGAATATCGATATTGG
+AAATCTTCGCCCCTGTTGGTTGCATGGTTTTTAGG
+.
+qlt:
+6667777788<88::?:<>A<<<@AA at HDDE?BGE>CAAFRILIKMGORKIJIIKR\___
+__SVPOIJGEEHA@<:99 at GNOPPQSSPO\\SVLPPMKLQVVQROQMRRSM\VVHJLLII
+PJJP_VVVVVVa__Y_]]TVPXVVY__VVVQQO_OSV\VV_\\VV\VVVXVXVX__V___
+__YY_R\\\VVV_Yaa_aaaaY_]Y_VVV\\V__XVRX\Y______V]Xa\X_YVVV\\V
+V\PMVV\\\VV\\VVY__\V\\V\\_Y___V]RXWXVXPVT_V\XXT____S\RRSSV_]
+\VMM\VVRXTLLWWRVXV_\VXXX]]___VXTLLOMOONPO\_____]____VWRaPaLL
+XXXVXPX]\]]]aa______YYY_]RVRRSVXY_X]]LLXLLPX\\_XVXaXT_V__aVa
+aaaa]aaaaa_]_____\VXaXXV_XVa__V____YY__a]aa______\]_aaaaP]aa
+]]WXXXaa]aaaaXX\\__]_]____]aa]]]XR]]RRRR\H>877779 at 88;7776869
+9:6679999>999:869:8;97:999<=;97:9999;9988797999997998999997:
+99779999997979799::<;:;;<999999:99<
+.
+frg:58
+clr:13,495
+}
+{RED
+iid:227
+eid:1086975842
+seq:
+CCTTCCTTCTTGAGATTTAAGATTGTTAAGCTTCATCAGAGGGACAAAAGTATCTCCTCG
+GGGGAAACTGTCAACTAGAGGGGTACAAATTGCTTCAAATGAGAACATGGATAATATGGG
+ATCGAGCACTCTTGAACTGAGAAGCGGGTACTGGGCCATAAGGACCAGGAGTGGAGGAAA
+CACTAATCAACAGAGGGCCTCCGCAGGCCAAACCAGTGTGCAACCTACGTTTTCTGTACA
+AAGAAACCTCCCATTTGAAAAGTCAACCATCATGGCAGCATTCACTGGAAATACGGAGGG
+AAGAACTTCAGACATGAGGGCAGAAATCATAAGAATGATGGAAGGTGCAAAACCAGAAGA
+AGTGTCATTCCGGGGGAGGGGAGTTTTCGAGCTCTCAGACGAGAAGGCAGCGAACCCGAT
+CGTGCCCTCTTTTGATATGAGTAATGAAGGATCTTATTTCTTCGGAGACAATGCAGAAGA
+GTACGACAATTAAGGAAAAAATACCCTTGTTTCTACTGGTAATAGCTGGTTTACTGAAGA
+TCGGTATTACCGATTTCCCGGAGTCGATCATAGAAAGATAAAGTGAGCACGTTTCTGTAA
+CGGGGTAATGTTTCAATT
+.
+qlt:
+87797776867>:<<AA>====<??>>>>>><>>B><HHFCMIIIOIMNI at IKKNRVV\V
+\\NMPPPORHIHFF>D>=CIMOPPRSSOQ]V\\LPPOPPV]\RS]NQOOSRSR_V\VVOI
+IJJP_V\VV\V]_____V\XVVOVVVXV\\\VV]\VVV\\YYT\\VRRRV]S_]a__VVV
+SRR\V\]]V\\\VVVT_YTY_____Y___]YVV\RRRaX_]Y___VVVRP]]____\OV\
+\OXXVXTT____Y____Y_]__]_____Y_X\RXWXVXPVV\VVSV\_Y__V_TXXa]aa
+a]XX]V_\WXLL]XXVa]__WTXXXW___TXTLLOMVV___TV\\VV\_]Y_]TPPPWPR
+]XXTXPV\\]]]aa_____Y_____X]aPaaa__]]]LLXLTXRVV\VXX]TX____V__
+__aa]______a_]_]_\XPRRV]__aa__V_Y____Yaaaa]]RXV__V\XWaaaP]PS
+XX\\RXaa_Y_V\XX]]_]_]__\__]]__VVXPV]XXGC99=;>><<<<@?<<:D<666
+79:9999999:999698797<<A>999D<<<999967889779999;99;:<<9<<7977
+789979799876798897
+.
+frg:58
+clr:13,495
+}
+{RED
+iid:228
+eid:1086975898
+seq:
+AACCGGAAATAGGTGATCCAAATCAAAAGATAATAACGATTGGCTCTGTTTCTCTCACCA
+TTTCCACAATATGCTTCTTTATGCAAATTGCCATCTTGATAACTACTGTAACATTGCATT
+TCAAGCAATATGAATTCAACTCCCCCCCAAACAACCAAGTGATGCTGTGTGAACCAACAA
+TAATAGAAAGAAACATAACAGAGATAGTGTATCTGACCAACACCACCATAGAGAAGGAAA
+TATGCCCCAAACTAGCAGAATACAGAAATTGGTCAAAGCCGCAATGTGACATTACAGGAT
+TTGCACCTTTTTCTAAGGACAATTCGATTAGGCTTTCCGCTGGTGGGGACATCTGGGTGA
+CAAGAGAACCTTATGTGTCATGCGATCCTGACAAATGTTATCAATTTGCCCTTGGACAGG
+GAACAACACTAAACAACGTGCATTCAAATGACACAGTACATGATAGGACCCCTTATCGGA
+CCCTATTGATGAATGAGTTAGGTGTTCCATTTCATCTGGGGACTAAGCAAGTGTGCATAG
+CATGGTCCAGCTCAAGTTGTCACGATGGAAAAGCATGGCTGCATGTTTGTGTAACGGGGG
+ATGATAAAAATGCAACTGCTAGCTTCATTTACAATGGGAGGCTTGTAGATAGTATTGTTT
+CATGGTCCAAAGAAATCCTCAGAACCCAGGAGTCAGAATGCGTTTGTATCAATGGAACTT
+GTACAGTGGTAATGACTGATGGAAGGTCATACCTGTGTTTTCCAGA
+.
+qlt:
+66678778766A67>>B@;::<<@<A=B>>?AALEQSRGGGKKKKR\\VZ\\NLC at GGIM
+OOLIIIHLPKMQHN at C99@@QHHNN\RRVPOLMOO_\\V\\\_______V\\VVOMLLOO
+VV\\\__]_Y_Y__\VRVRRTV__]\\\V\V\]SO\\VV________a_YV\\\\V____
+___Y__Y_V_____]___YVVQOQSQVXXV__YVV\VVVV\TX\X_\WTLPPXPVT_V__
+Y__________]XLPXPJJNLMOXXRV]YY_VVV\VO___Y_T_V__________\VRV\
+___]_T__a__S\V\VRR\O\V\\VRRT\VXX\T_____VXV]aa]\__Y____aa]\RS
+RR\XaRR]VY_Y_________T___a]a__T__Y____YY_____Y_____a]VVV\VQ\
+\\\\_____________]_Y___VYY_Y_____V____V___V_X\X]\_Y_____V]XX
+V__YY__VVXR\VVVVV___]\a]_VV\VVV_Y____a_VVVVVX\___V_aY____T__
+_aaaaVV\VVS\]________\\XX]]__\\_______V_____aa_aa________a\V
+RSRV\_________]_a_VVWTLTWX_]__]_TSVXVVSYY___WXWRXXXSV\\\V___
+]Y__a_____________aaaLLTTTTTTHXWT\VISH\KKH_aT_TTV_TTHHTTT___
+V_TYXXGGTW__\\\VVVVREH99EJS\DF9999979777:86679
+.
+frg:41
+clr:16,722
+}
+{RED
+iid:229
+eid:1086975823
+seq:
+GGCGGAGGAAGAGATCCAAATCAAAAGATAATAACGATTGGCTCTGTTTCTCTCACCATT
+TCCACAATATGCTTCTTTATGCAAATTGCCATCTTGATAACTACTGTAACATTGCATTTC
+AAGCAATATGAATTCAACTCCCCCCCAAACAACCAAGTGATGCTGTGTGAACCAACAATA
+ATAGAAAGAAACATAACAGAGATAGTGTATCTGACCAACACCACCATAGAGAAGGAAATA
+TGCCCCAAACTAGCAGAATACAGAAATTGGTCAAAGCCGCAATGTGACATTACAGGATTT
+GCACCTTTTTCTAAGGACAATTCGATTAGGCTTTCCGCTGGTGGGGACATCTGGGTGACA
+AGAGAACCTTATGTGTCATGCGATCCTGACAAATGTTATCAATTTGCCCTTGGACAGGGA
+ACAACACTAAACAACGTGCATTCAAATGACACAGTACATGATAGGACCCCTTATCGGACC
+CTATTGATGAATGAGTTAGGTGTTCCATTTCATCTGGGGACTAAGCAAGTGTGCATAGCA
+TGGTCCAGCTCAAGTTGTCACGACGTCATAGCTGG
+.
+qlt:
+6666877787<78CBB>>>DBCCCC>A@?@ASGIIRJMLJLIR\]\\\___RRRPNIIIH
+LIJIKJPNSSSRVaPXRNSRRSSVRS\LOPPJM_RRSS\\_]V]\V\RVOOVV\VVV\\\
+V\VY__V\SV\\\VRVRRPX\T_VVV\V\]\VV]___T_______]__YY\]]\V\_Y__
+_Yaa_a]_YV]V\]\_\VXRRR\\VXXV__Y_T\SVVVOVO\VVVXXLLLPaaXT_]_V\
+VSV]T___]XXGPLLDDWPPXXPRRR\VV________T_Y\]XVX___]____V\XXV__
+YYXVXXaT\]XP]XTMVV\VRaTXXWXWXXa]V]__XVTT]XR\\VVVVV_TT]aVRRMM
+RLPSSWX_Y__Y_______XTRPVX___V__T__a_VVTT_Y___aYa_TaXXXV_VVSS
+\\___V_____Y___aV____VV__V___V]_\VXV]___aa]\X]\__Y____X\XX\]
+_V___X]XXV\XXVa_aaaaaaa___Y_\Y_VT__a]VV\VMRW_X\X_VV___V___XX
+XX\XVVWTPTW\Y__a__WW<<KDDJJXF==<896
+.
+frg:37
+clr:14,541
+}
+{RED
+iid:230
+eid:1086975827
+seq:
+AAGGGCTTGGACAGTACACACTAAACAACGTGCATTCAAATGACACAGTACATGATAGGA
+CCCCTTATCGGACCCTATTGATGAATGAGTTAGGTGTTCCATTTCATCTGGGGACTAAGC
+AAGTGTGCATAGCATGGTCCAGCTCAAGTTGTCACGATGGAAAAGCATGGCTGCATGTTT
+GTGTAACGGGGGATGATAAAAATGCAACTGCTAGCTTCATTTACAATGGGAGGCTTGTAG
+ATAGTATTGTTTCATGGTCCAAAGAAATCCTCAGAACCCAGGAGTCAGAATGCGTTTGTA
+TCAATGGAACTTGTACAGTAGTAATGACTGATGGGAGTGCTTCAGGAAAAGCTGATACTA
+AAATACTATTCATTGAGGAGGGGAAAATCGTTCATACTAGCACATTGTCAGGAAGTGCCC
+AGCATGTCGAGGAGTGCTCCTGCTATCCTCGATATCCTGGTGTCAGATGTGTCTGCAGAG
+ACAACTGGAAAGGCTCCAATAGGCCCATCGTAGATATAAACATAAAGGATTATAGCATTG
+TTTCCAGTTATGTGTGCTCAGGACTTGTTGGAGACACACCCAGAAAAAACGACAGCTCCA
+GCAGTAGCCATTGCTTGGATCCTAACAATGAAGAAGGTGGTCATGGAGTGAAAGGCTGGG
+CCTTTGATGATGGAAATGACGTGTGGATGGGAGGTCATAGCTGGTTTCCTGA
+.
+qlt:
+766666>776666666>><<@?M@@B?B at RMLLLBBBG?CIEHMNKNILLHPOMPMRMRS
+SXZ\RRRQQGD>:99;KK\RSRRSSQOQQSSRRSRRROOOMOPMNOPO_]]NJGECFKV\
+\V\a___YY____YYY_\\\VVRM\VVV__YVR\VVV]__Y_S\\\\VV_]_____Y__]
+a_]]XLGGL]O\V\V\_]]__Y_YY_____\V___\\VRVVVV\VVVaT__YYY__\XXP
+XWX_TV\YY_V_\VXVTVVVVVV_VXV___XXXXRX]]_XVXX\VVTRXWRVVS\X____
+V]__V__YY__Y__]_V\VRXRTW___Y___T_\__Y__a_]_T___VS\VVVVY_Y]_]
+______]aVV]____a]aaa]_Y_____YYS\R\\\]V]TTV]__a_____Y__Y____Y
+Y_XVVVVTTP\V___Y______YY_______V____]]____V\XRXVV_a]___WXXRX
+X\__VV\]]\______Y___Y_____Y__a]PSS]]________aaV_____________
+aa\\\V\\__________________aaaa]\X_T__Y_\aaLLXWTTTXRT\____V_T
+_Y]VVV__\]YYVVTTHHH\VOT\_____]]TTTT__TTT_TTT__a_]aVVV_TTT\YV
+VVaYV\VSOOSQRK_TLHDALNXTTTYYT_VTTTLJEHB<B88><=IKCEGH
+.
+frg:51
+clr:18,670
+}
+{RED
+iid:231
+eid:1086975815
+seq:
+GGGAGACAGCTCTTTACAATGGGAGGCTTGTAGATAGTATTGTTTCATGGTCCAAAGAAA
+TCCTCAGAACCCAGGAGTCAGAATGCGTTTGTATCAATGGAACTTGTACAGTAGTAATGA
+CTGATGGGAGTGCTTCAGGAAAAGCTGATACTAAAATACTATTCATTGAGGAGGGGAAAA
+TCGTTCATACTAGCACATTGTCAGGAAGTGCCCAGCATGTCGAGGAGTGCTCCTGCTATC
+CTCGATATCCTGGTGTCAGATGTGTCTGCAGAGACAACTGGAAAGGCTCCAATAGGCCCA
+TCGTAGATATAAACATAAAGGATTATAGCATTGTTTCCAGCTATGTGTGCTCAGGACTTG
+GTCATAGCAGTTTCCTGAAGAGGCGGTGGGGACTGACTTTATGACTGTCCTTTACATGAA
+TTGCACAAAGACCTTTAGGAGCCTTTCGATGACTATACAAACAAGGAAAACAAAAAGGCG
+GGGGGACTGGAGAAGACCAATGGGCGGATTCGACATAAGAGTAATAGGTTAGAATATTCC
+TCCCAGTAAGGGTAATTTGGATAACTTGGGCCAACCAACAAAATTCATTAAACGTACGGT
+AAACGGGACAAAAAATCTAACCGGGTTTGAACATAAATTAAACGCTGAAAGTAGTTTTCG
+CCTCCATTGTGTTTGAGGGCTGGCGATTGGTTTTGAAAACCTTCTTGTGAAGAGC
+.
+qlt:
+779776669::88>>>>=<>CC at EERKMRS]DFFDDFKFFGFKBIHEDFSHNNIIISMOM
+MOMPOJGGI\SSNNKMGJJNNKSSSS\]]_\\\]\VRR]\S\___YMMPPMKSVX]]V]]
+\YYV\V]VVV\V\\VVVOR__]____V____T______Y__\\\VVVYaY_____Y_\Y]
+\VVRS\VVV\VXX_VV_SVRRRSVV___]__Y__YTa]a]aTTWW__V____aaY_____
+_a___VV_Y_]]_aY_]]XP]]_aaY_]TXSMRR\V\_Va]]a_____]___________
+__aTLLLT]]Y_]]_______Y_]__VVXVV_aa_\SSJI><WW___Y___]_HH=9GGW
+NEDHA<<869;:9<<89699;99666767979999=8>99;<97977999;HBB9<:997
+678979:9:976:7999886798:;:99;99989>=;;99=97:7799<89987779777
+7<;79877896=9866998997679779999;977799967799999779::86777777
+799:8999797999988999979989979999979<77769779979979:969897799
+97987998779<<9899:79777697998999999999986999779999997997778:
+66677779:<89<979766778;89878779999979:<;988889789666668
+.
+frg:43
+clr:13,338
+}
+{RED
+iid:232
+eid:1086975835
+seq:
+AACAAATGGCGGAGAAACTGGAAAGGCTCCAATAGGCCCATCGTAGATATAAACATAAAG
+GATTATAGCATTGTTTCCAGTTATGTGTGCTCAGGACTTGTTGGAGACACACCCAGAAAA
+AACGACAGCTCCAGCAGTAGCCATTGCTTGGATCCTAACAATGAAGAAGGTGGTCATGGA
+GTGAAAGGCTGGGCCTTTGATGATGGAAATGACGTGTGGATGGGAAGAACGATCAGCGAG
+AAGTTACGCTCAGGATATGAAACCTTCAAAGTCATTGAGGGCTGGTCCAACCCTAATTCC
+AAATTGCAGATAAATAGGCAAGTCATAGTTGACAGAGGTAATAGGTCCGGTTATTCTGGT
+ATTTTCTCTGTTGAAGGCAAAAGCTGCATCAATCGGTGCTTTTATGTGGAGTTGATAAGG
+GGAAGAAAAGAGGAAACTGAAGTCTTGTGGACCTCAAACAGTATTGTGTTTATAGCTGTT
+TCCTGA
+.
+qlt:
+6666666879797978799<;98<77>;B@=:@DGJ>?BBBEMMBDGDJJPKIKKLDRND
+FGJJDQJHJLMLRSSD@<899C<>FFJOQQQVVV\\VV\_TTXWPPPQQQVVVVSSSXMK
+GGCGMKXX\V\VV\V]RXRSSVVVVaaaaVMRV\\__]]YXXPaPLLOMRVVVV_V___a
+a_______WTKKIKKLXKVVV\V__Y\\\\VVXXXTW\V\OVRXXVXRVV__W]XRX]a_
+____VTVTRVVV\V\\V\YYY___\\\RRV]__\VXaa_______________Y___V\\
+VVMXVXXXPLXT_\_VVRXXRXWXWXXXXXWW]XRXTX______V\X_a__YY_______
+_Y_Y______Y_]\\__VVXXPRX]X]VRRVRRPPLPXX____Y___aTV_____T__aa
+aaaTPX]]]Xa]\V\___a]TaRaa__a_XMK>BKKVSPaaaaTRHB><899D;CLKLPC
+A99DDH
+.
+frg:48
+clr:12,445
+}
+{RED
+iid:233
+eid:1086975870
+seq:
+GGGCTATTATTGAATGTTGGTTCTCCAGGGCAACAAGAAGCTCCGCGTTGTATGACCAGA
+GATCTATTTTAGTGTCCTCAACATATTTCTCGAGGTCCTGAATTCTCCCTTCTACTTCTG
+AGAATTCTTTTTCAATCTGATGGAATTTCTCGTTGGTTTTCCCGATCAACCTATTCAGCT
+TCCCATTGATTTGGTTGATTGCTGCTTGAGTGCTTTTGAGATCTGCTGCTTGTCCTATTC
+CCTCAGAATTTTGATGCCTGAAACCGTACCAACCATCCACCATTCCCTCCCAACCATTTT
+CTATGAAACCCGCGATTGCGCCAAATATGCCTCTAGTTTGTTTCTCTGGTACATTTCGCA
+TCCCTGTTGCCAATTTCAGAGTGTTTTGCTTAACATATCTGGGACAGGCCCCATATGTGA
+TCCTGTTTACATTTTGAAATGGTTTGTCATTGGGAATGCTTCCATTTGGAGTGATGCATT
+CAGAATTGCATTTGCCAATGGGTGCATCTGATCTCATTATCGAGCTTACTGGCCGTCGTT
+TTACAA
+.
+qlt:
+F96776799997779<77<@==A<>::BA=><<<<?@MCJHHNCMMMVHNGEGG@@DAGB
+CEDEL_YS\\QK at D==:866779>9FDLXMSSSVVVVVJQQNMSST__VXRRSRL?C==9
+9=BLNRV__VVVVVVQQ\SVV_VV\V\\aaaa]]a_Y__]]\\XSVSVV\__aVRRKQN\
+]S\VVQKNSS]Taa]_]__X____a_VVPWPP]aa]MMSMRRW_V\XRa]aP]]RX]]__
+_VMLKDDWX__VVVVVX]aY___Y__Y_\]XPVV_Y_YVXTX_Vaaa_X]]__T_T__a_
+__]XXR\XTVTXVRS]MTPMSSO\\_______VVRPXWTRX\\VXVXR\V_]__]WPPP]
+]_____TVVV\\RV]]WXLLPaRa]aaa__VWXXXXPMRRR]MRXVV____VVXXVX__V
+]\Raa\______Va__VXXXRX\\PX]XXMMMRRJVXRVVXXPPPWD;679?DHNNMPXK
+LIGIaa]TXRRT]Y__TXRR]]PXT]XXHLLIGXWVXXWJ@>KaaXXX]LLaaTXHDDEI
+BDEENP
+.
+frg:40
+clr:38,504
+}
+{RED
+iid:234
+eid:1086975814
+seq:
+AAGAGGGGAATTTATTATGCACTCAAATGCAAATGTTGCACCTAATGTTGCCTTTTTGGC
+AGGCCCACATGATGAACCCCAACAAAGCAACACAAAGCAAAAAACATGATATGGCAAAGG
+AAATCCATAGGATCCAATCTTTGTATCCTGACTTCAGCTCAACACCTTTGATCTGGAACC
+GGTTGTTTAATGCTTCATCTCTGTATACATCATGGTCATAAGTTCCATTTCTGATTGACC
+CTATGCAGGCATTGTCACATTTGTGGTATATTTTGAAACAACCATTGCCCATATCCTCAG
+CATTTTCCCTCAGTTGCTTCTTTGTTCTTTCAAACAGTTTGTTCATTTCTGAGTCAGTTA
+GATCAATTGTATGTTGGTTCTCCAGGGCAACAAGAAGCTCCGCGTTGTATGACCAGAGAT
+CTATTTTAGTGTCCTCAACATATTTCTCGAGGTCCTGAATTCTCCCTTCTACTTCTGAGA
+ATTCTTTTTCAATCTGATGGAATTTCTCGTTGGTTTTCCCGATTAACCTATTCAGTTTCC
+CGTACTGGCCGTCGTTTTACAA
+.
+qlt:
+66766;:9766;>97798<<?A=AGCCCCCIHCBCI>@B at HHTMMJQGEGGGMVKRLNJI
+PPPRORRLKSSRQF>:9::7699799G??IK]]\\V___]_XV\\V\\VQOQQQ\PHA99
+689>>EGGGFHMPPO\R\_]]VVVV\VY____\VRRSVVVVVVVV\_aVVV\VV]VVSSR
+R]]XaVV\VMRXRRRSSSV]a_________\TPXVXYY_]]_aVRVRS\aaXXXV___Y_
+____T__YV__VT]]]]RX\aaRXTXPXTTX\V]RX\]]Y____T_]\VVV\\]Ta]aTX
+TTWT__V_]___XTaa_aaaaaaaYY_YVVR]T___a]]_]\\VVV\aaaaLX]]VXXPL
+LLXX__\]XXVXTV________VV__]_]]_XWLLWPPXXaRRaa__TXTX\XXLDAFFN
+KRV__TVXPLPXX__]_]____Y_aT]XPXV\V_VVXX\]]aaRa]]]XPXLLWaLLXLL
+TKPXaaa\\V\VRXXRXW_______aaT_________WWLLWXX]WGIXWW\XVXPWTPW
+DELPXLLTXXHD<<FDBLXLL]
+.
+frg:42
+clr:17,518
+}
+{RED
+iid:235
+eid:1086975798
+seq:
+GAGGTGTCACCACAAGCAACACAAAGCAAAAAACATGATATGGCAAAGGAAATCCATAGG
+ATCCAATCTTTGTATCCTGACTTCAGCTCAACACCTTTGATCTGGAACCGGTTGTTTAAT
+GCTTCATCTCTGTATACATCATGGTCATAAGTTCCATTTCTGATTGACCCTATGCAGGCA
+TTGTCACATTTGTGGTATATTTTGAAACAACCATTGCCCATATCCTCAGCATTTTCCCTC
+AGTTGCTTCTTTGTTCTTTCAAACAGTTTGTTCATTTCTGAGTCAGTTAGATCAATTGTA
+TGTTGGTTCTCCAGGGCAACAAGAAGCTCCGCGTTGTATGACCAGAGATCTATTTTAGTG
+TCCTCAACGTATTTCTCGAGGTCCTGAAACTGGCCGTCGTTTTACAA
+.
+qlt:
+9667966777>7778=@@@@E@@MCECCGHSEI at D<@B>>@CDCEMIRRHLGIIIKNG at A
+DBBBMHIQ\SRRQQSMQKQQQELGJGEMKQQOVOR]_RRVQQQ\OQ\\\VV___]VVQNQ
+Q\QVSVSVXa_VVVV]\VVMWLLWW_Y]]]XRRR\MVSVXXXRX]]_______]_V___T
+\\VVVOVSSVaaPPSROSMV\V___\_]TV\VVVOX_____TVVVTX]XXXX]]_V_\XW
+TLLWW_TTTT__VTTT_\\VVV\WWXXaaaT]XXXVV]aaLXP]WXLXGEEXX]XXaRVX
+TT_aaaaaaRXWXXV]T__]TTLLXLLXTaaPXV___WWSPXXLEDLLXPPa]VTXLLLa
+aa]VT]WM@@HW]]TTXRXXXXTTXXRXTRXX]MSGE<;>GCLLL]]
+.
+frg:30
+clr:14,366
+}
+{RED
+iid:236
+eid:1086975770
+seq:
+GTTGGAAGGGTGTTTTATTATGCACTCAAATGCAAATGTTGCACCTAATGTTGCCTTTTT
+GGCAGGCCCACATGATGAACCCCAACAAAGCAACACAAAGCAAAAAACATGATATGGCAA
+AGGAAATCCATAGGATCCAATCTTTGTATCCTGACTTCAGCTCAACACCTTTGATCTGGA
+ACCGGTTGTTTAATGCTTCATCTCTGTATACATCATGGTCATAAGTTCCATTTCTGATTG
+ACCCTATGCAGGCATTGTCACATTTGTGGTATATTTTGAAACAACCATTGCCCATATCCT
+CAGCATTTTCCCTCAGTTGCTTCTTTGTTCTTTCAAACAGTTTGTTCATTTCTGAGTCAG
+TTAGATCAATTGTATGTTGGTTCTCCAGGGCAACAAGAAGCTCCGCGTTGTATGACCAGA
+GATCTATTTTAGTGTCCTCAACATATTTCTCGAGGTCCTGAATTCTCCCTTCTACTTCTG
+AGAATTCCTTTTCAATCTGATGGAACTGGCCGTCGTTTTACAA
+.
+qlt:
+:776667766668>778;7788<<=<<79999<==AFCNEJGCCCCCCCQCCSSS_aHTG
+MGGPHGA>>=:;98999<?HEKKMKQR\RRTHTa______YT_V]]HMKFKHQQGLJGMP
+XPLRR\V\SH\OSMMMJVHVVVVa\T]XXVVHKNEEKHILDIHMMMRRRT]QQOIFRRXT
+XXTT____TTXXVTVTI\MSRVVaTX_TVVRRSSXPXMVVVSISXXRLSSHHaaXLXXXX
+RVVXRXRMRRRIXXHWRRHRMSTXPaVVTXLPPXTPMLLMOVV\V_TTTTXXPPTXXTXX
+PLLLWW]TRa]RHCCCDNMaTaTXVV_W]XPTMRRMRMSMMaaaVSRRR\aaaPXLLXGL
+LMG?AMHXXXTRFGHHFHMHMCHFHFFECTXKCHFB;;?AGHLMHLHHMLPLXGGHF><<
+97CDLXXXXLGXGPLMGKB at GWPSTHPPPJJHDMJLLHJMMHNE;;7788A99??D]KKG
+K==FDC>>>KKB==>@:?>?@DBCGLEA>::;<==CGFDGGGH
+.
+frg:4
+clr:20,480
+}
+{RED
+iid:237
+eid:1086975782
+seq:
+AAACCATTTGTTTTTTATTAATGCACTCAAATGCAAATGTTGCACCTAATGTTGCCTTTT
+TGGCAGGCCCACATGATGAACCCCAACAAAGCAACACAAAGCAAAAAACATGATATGGCA
+AAGGAAATCCATAGGATCCAATCTTTGTATCCTGACTTCAGCTCAACACCTTTGATCTGG
+AACCGGTTGTTTAATGCTTCATCTCTGTATACATCATGGTCATAAGTTCCATTTCTGATT
+GACCCTATGCAGGCATTGTCACATTTGTGGTATATTTTGAAACAACCATTGCCCATATCC
+TCAGCATTTTCCCTCAGTTGCTTCTTTGTTCTTTCAAACAGTTTGTTCATTTCTGAGTCA
+GTTAGATCAATTGTATGTTGGTTCTCCAGGGCAACAAGAAGCTCCGCGTTGTATGACCAG
+AGATCTATTTTAGTGTCCTCAACGTATTTCTCGAGGTCCTGAAACTGGCCGTCGTTTTAC
+AA
+.
+qlt:
+:76666666777<<==;=<<<<<<<=>?A79<<?A?BEE@>EEAVM\C@@@JLEHHTTGG
+KKKJHP\PPSIPFHD:<>>><9?@HJJHMIVV\\V]\V\\____]VV]RRSRRSQNIE=;
+==>GK\VVVVRRSVVVJOZSSPaaa_V\\]\\VVRM\V\RLLLLSM\__TY_____Y__V
+\\\VVYVV__]WRSRR\SS\VRVa___VVVVVV\\aa__V__]__Y__\__YY]\VPXVV
+OV\VV_Y_XVVX_YY_______Y__a]__\TX]T____Y__]___]_Y__aVTX]V____
+TXXXXWW______XXXXVa]aaa]_YY____]RRS]RHRVa]a]aV\VVVVaaaaa_XVT
+XTXLLGWX_Y__VV______aaaa_____V__]]_XXLLaKKaaaaaaaaV]XWLPMMTL
+HJJOMV__VX]VXXVV___V]GEENW_V]PPPWPXV__VXXXXTRXVTHLGG??@KKJJJ
+JM
+.
+frg:14
+clr:17,441
+}
+{RED
+iid:238
+eid:1086975850
+seq:
+TGCCGGTGGGGGTCTTGCTAATCTGGTATGTTGCATCATTCAAATTGGAATGCCAGATCA
+TTATGTGAGTTAGACCAGCTGTCGCATCCTCACCATTGTTGGCTTGGCGCCAGATTCGCC
+TTATTTCTTCTTTGTCATAAAGGACGAGTTCCCTCATCCATTTTCCATCTACTCTCCTGT
+ATATGGGTCCCCCAGTTTTCTTGGGATCTTTCCCCGCGCTGGGGTGTTCTTCCAGGTATT
+TATTCCTTCTTTCATCAAAAGCAGAGAGCACCATTTTCTCTATTGTCAAGCTGTTCTGGA
+TCAATCGCCCTTCATGATCACTGAGTTTAAGTTCAGTGCACATTTGGATGTAGAATCTCC
+CAATTCCATCAATCATCTTCCCGACGGATGCCCTAATCTCAGTTGCATTCTGGCGATCCC
+CATCAGTTTCCATCTGTTCATAAGACCGTTTGGTGCCTTGGGACGCCATGATTTTGATGT
+CACTCAGTGAGTGATTATTAACCCTGCTTTTGCACTGGCCGTCGTTTTACAA
+.
+qlt:
+67667966666698777:76688==<<><;;==>CC>EADBAEBEEGGADDDFFGDFKMO
+PLQNNQQQQXWPGEE=776=?C>GLXPRSMRNNPJHJaa]__Y____WLLDDDEE>9>>;
+=MW\XPXLLTTXXVVVVSSV\VRMRRO]Y_______VVV\RV_VV\\\R_YYXaaaLLXX
+__VV__a]LEEE?EaLTXV___a\VV\\VY____Y_a\XT\_VVPXXVRXMRRMSSXV\_
+YY__]]aaaY____T__]_TXaaLLLLMMRMMMPXaa]]__VVPX]\__Y_aa_aTaSV\
+\VV___a]aaVV__________VVaX]T____XWLLXW]T_V_VaV\R\LLGLPXX____
+]__________]\]X__a]a]]__\VVV\VT_X\RR]RPLGLLXW_T_TY_\XXPTVV_Y
+_YHXXW_a\]V\\VaaXR]TXWMAAKKPPLLTLLPWPXRRJROMCA777777EHTLLHLG
+LGIDJFHHLXRRVMV\]__YTXaRaaTPXXLLLTLLPaGGE<:>?GDCCCK]
+.
+frg:8
+clr:22,490
+}
+{RED
+iid:239
+eid:1086975859
+seq:
+GAACGTTAATGTGTCCCGATTCCTTTGACTGCAGCACCTGCAGCTCCGGACCTTCTAGGG
+AGAGTCGAGCCCTGCATCAGAGAGCACATTCTGGGATCCATTCCAGTTCGAACAAGAGCT
+CTTGTCCTCTGGTATGTTGCATCATTCAAATTGGAATGCCAGATCATTATGTGAGTTAGA
+CCAGCTGTCGCATCCTCACCATTGTTGGCTTGGCGCCAGATTCGCCTTATTTCTTCTTTG
+TCATAAAGGACGAGTTCCCTCATCCATTTTCCATCTACTCTCCTGTATATGGGTCCCCCA
+GTTTTCTTGGGATCTTTCCCCGCGCTGGGGTGTTCTTCCAGGTATTTATTCCTTCTTTCA
+TCAAAAGCAGAGAGCACCATTTTCTCTATTGTCAAGCTGTTCTGGATCAATCGCCCTTCA
+TGATCACTGAGTTTAAGTTCAGTGCACATTTGGATGTAGAATCTCCTTATTCCATCAATC
+CTCTTCCCGACGGATGCCCTAATCTCAGTTGCATTCTGGCGATCCCCATCAGTTTCCATC
+TGTTCATAAGACCGTTTACTGGCCGTCGTTTTACAG
+.
+qlt:
+?966667977669889789<;=>=C==A=?AC?CEEAEACKFLMHHHNK@@OCTHGGMNI
+CHCCNPCHTXHG=<<8777977:>BKHQJNRXVMEGPPPRRJIMPJGRSJMNHC:;8<<C
+HaaXXXPRW]T\H\V\VY______V\VVVR\V\S\\_]TWKE>FINNJRT]TaaXJKHHG
+KMRMJaMK>@HGP_TXXXRXW]Xaa]_aaaXXVXPXHH at BKJLLKT]__V__aaaVTRTV
+RRVVV___TXXLLPPTTVXTVXXXRRR]\VVHSRSV___TaTaPXPLPPRRPRX]]]WXP
+SSa]]aaaXWSPXX]]RPTXPPLLXXXXPXVV_VVPXPLLLLXT_]__TVXPXXRaRONH
+HLILLHHIIFACCEEE at IGGCSGHHVRHaa]]RRPLLPTTMLLLMMXLHLLPHLPTTTP]
+GEEGCCEGMSRHK at B@>ECH>>@<>GEGDIC?CB><<=@@DCCA99766:976999<978
+99C<AIHPXRRLGHEHTCHHCJJGB>:?;;<=;>B at AAKKCPHGJHHDB@:@GWKRSVRR
+aTXMJJ?B;;=G?GG==<><?@A;99=>>;9:9:77
+.
+frg:65
+clr:12,463
+}
+{RED
+iid:240
+eid:1086975880
+seq:
+GAAGGTTAAGGAAGAGTCCTTACATCTTAAATCTTCAATGCAGCAGAATGGCATGCCATC
+CACACCAGCTGACTCTTGTGTGCTGGATTCTCGTTAGGTCTGATTAGGCTGTATATTTGG
+CTATTTTGAAGTAGTTTGAAAGGGTCTATTCCCACCAAGGAATATCCCTCTTTTTCGAAG
+TCGTACCCACTGGATACTGCAGGTCCATACGCACAGGCAGGTAGGCAAGATTTGTGAGCA
+ACTGACCCTCTCAATATCAATGCAGATCTTGCCAAAAATATGAAATCTTCGATCTGAGCA
+TTTCCTGGGTTCCGACTTTCTCGCACTTGATCCACCATTGCTCTTTGTGCAGCTGTTTGA
+AATTTTACTTTAACAATGTTGCACATTCTCTCATCAGCACTTCTTGTTTTCCGCCCATTC
+TCACCTCTCCAGAAATTTCCATCGTTGATCCCCCGTTTGACCACTCTCATTTTTTCCATC
+CCCATTGTCCCGATTCCTTTGACTGCAGCAGATGCAGCTCCGGACCTTCTAGGGAGAGTC
+CCGCCCTGCATGACAGAGCACATTGTGGCACCCATTCCATTTAGGAAAAGAGCTCCCGTG
+CTCTGGAGAGTTGCATCAGGGAAATTGCAGTGGCAGATCATCATGTGAACTGGCCGTCGT
+TTTACAA
+.
+qlt:
+9666779799979799767777778;=A@=E?F><8:99<<:;?:<BCDD=EEAFELHFF
+CCFC<AAA at CCFMBC787<789;=@CEFFJBBGGLKK><@;;CCDH??HHDCDB@:>9>7
+9;C at E>@=9:9<=CBBENHPLEDJIMNPGGKKDBBBHHKIKQKMJLXPLLLIM?AAAIGE
+ELLLWHK?=9=99::>AEKLLLGHHJGDFG;;F;:==999=B@<=?BDDLBBIDEEBBDI
+ECCCBFCCD>>BA<@BDGDEBGA>A;C;:HB><GFD?;===:99999==<9:@@97<9:<
+<@AEA==CGHDFLHFJLGGHH99B<>DBEEG@=BAABD;;HHaKGGD=<B@<;B;<>B;;
+<<ME?B<;KCG?A;><<AAHKA>DGHH@<<::;;99<9=;9:DBAAAHWH<:9999<=BG
+E>G@?:D;99:;:@GGGE>@;?BBB;;??@GGDB:;79<;8777=8777>8BC@;9777=
+;>999;;::BD@<9;:>9:<9:99::999:9999999>999:9<989:8877<BB=:979
+66<::9999999::9997998<997998:99<999999999<9899::@<9998;997=9
+9879>@:9999::;9 at 997997998:::999:97999;;99=:=9797;;::==9979:9
+997999@
+.
+frg:52
+clr:123,275
+}
+{RED
+iid:241
+eid:1086975912
+seq:
+GTTCATCGTCTCATCTAGTTGACAGTTTCCCCCGAGGAGATACTTTTGTCCCTCTGATGA
+AGCTTAACAATCTTAAATCTTCAAATGCAGCAGAATGGCATGCCATCCACACCAGCTGAC
+TCTTGTGTGCTGGATTCTCGTTAGGTCTGATTAGGCTGTATATTTGGCTATTTTGAAGTA
+GTTTGAAAGGGTCTATTCCCACCAAGGAATATCCCTCTTTTTCGAAGTCGTACCCACTGG
+ATACTGCAGGTCCATACGCACAGGCAGGTAGGCAAGATTTGTGAGCAACTGACCCTCTCA
+ATATCAATGCAGATCTTGCCAAAAATATGAGATCTTCGATCTCAGCATTTCCTGGGTTCC
+GACTTTCTCTCACTTGATCCACCATTGCTCTTTGTGCAGCTGTTTGAAATTTTCCTTTAA
+GAATGTTGCACATTCTCTCATAAGCACTTCTTGTTTTCCGCCCATTCTCACCTCTCCAGA
+AATTTCGATCGTTGATCCCCCGTTTGACCATTCTGATCAGTTCCATCACCATTGTCCCGA
+TTCCTTTGACTGCAGCACCTGCAGCTCCGGACCTTCTAGGGAGAGTCGAGCCCTGCATCA
+GAGAGCACATTCTGGGATCCATTCACTGGCCGC
+.
+qlt:
+66668666779787>>>>>A@@>AADMLLSRGIIRGJGGGHBBOKSRRPM\VRRKIMPOP
+RVVVVMJRJFFHAD99?FXHHHPHKVV\]_XXLLLLQOVV_\\VVVV\VRVKLDDDPXV_
+Y_a]_VVSR\VVV\\\\__VVV\VV_VVSVOO\V_a___Y_____]___Y_\YY__VXXX
+V]aW______Y_]____Y__RVV\QOQQRRVOYYVaaaa_W]XXXXX_\\XX]]_TVSSV
+\V]VXX]a]]\\V\VVRXRVV__Vaaa]aa]__XRMMRRVaTXPX]_\_______aM\VX
+\V]__]TXPaXLLTX_aVVVX\\___VWXLLLWW\aTPRWRRR\MMXXV\]aaaaX_]]]
+XXXX_]aTSVS\VV______]__\_Va]]a_V__TXXXXXVV]__T_VV__a_a]__XXX
+LI]XTV\_Y_]__]aa____XT]PXVX___aaaa___]\XXV]__XXPXVV\XaVWXXLL
+]]_XXLLTaa___________aaa__]]__\\aRR\W_VVRV\V\VV______aa]aVPR
+VV____\VR\VRWXXR]V_VXTVXXaaa\XXXV]a_]VTaaPXX]XTSPWX_aa_]_]]K
+DKKKMR]VVXXTXPSMRMQPFJFKKEGFF?;96
+.
+frg:44
+clr:14,601
+}
+{RED
+iid:242
+eid:1086975894
+seq:
+GAGAAACGTCTGATTGTCTCGAGATAAGATCCTTCATTACTCATATCAAAAGAGGGCACG
+ATCGGGTTCGCTGCCTTCTCGTCTGAGAGCTCGAAAACTCCCCTCCCCCGGAATGACACT
+TCTTCTGGTTTTGCACCTTCCATCATTCTTATGATTTCTGCCCTCATGTCTGAAGTTCTT
+CCCTCCGTATTTCCAGTGAATGCTGCCATGATGGTTGACTTTTCAAATGGGAGGTTTCTT
+TGTACAGAAAACGTAGGTTGCACACTGGTTTGGCCTGCGGAGGCCCTCTGTTGATTAGTG
+TTTCCTCCACTCCTGGTCCTTATGGCCCAGTACCCGCTTCTCAGTTCAAGAGTGCTCGAT
+CCCATATTATCCATGTTCTCATTTGAAGCAATTTGTACCCCTCTAGTTGACAGTTTCCCC
+CGAGGAGATACTTTTGTCCCTCTGATGAAGCTTAACAATCTTAAATCTTCAAATGCAGCA
+GAATGGCATGCCATCCACACCAGCTGACTCTTGTGTGCTGGATTCTCGTTAGGTCTGATT
+AGGCTGTACACCTGACTACTGGCCGC
+.
+qlt:
+888666667>;77<B at CLC><9769?=BCDD at ADG@JG\GGGG at GGGLKER\\SMMMIHR
+R]\SS]JH::6967;DMPX]]V]XWWRSRR\VTRVVV\V___Y____]XKB>BKHVV\V_
+_aaa_____Y_]V]VVVV\VV\\O______]_________\____TV__a_XTVX_V___
+Y____VY__Y]V\\VVMV]___Y_Y__\\VVVV___V____\\\VRRRP]V_YY__Y__a
+___]TPLLXW__]Xaaa]X____]SRT]]_T___\Xa]VRV\SV__aa__]\V\ROMPLT
+]____]]]X_TVaPX\\_Y______YVVXTPTXYVaVa__]TXPXV\W]XaRaa]aRRRV
+V__V_T_]_VVVPXXaa___]__]]XX]]]PX\V_____aa_XVVRXWXRV]XXa]]_aa
+XRMNJFFFLNV__]_]a]Y_____T_XV\RXa]___________]_a_V__V\Vaaaaaa
+CCMM\Vaaa__V]XXVX__WWXXXXX__V_______aa]VV_X_Xa]a___\TXWRXVXV
+XXXXTTXXHH<<;C<<MMLHTRB<96
+.
+frg:38
+clr:24,533
+}
+{RED
+iid:243
+eid:1086975893
+seq:
+ACAGCATTTTCCTTAATTGTCGTACTCTTCTGCATTGTCTCCGAAGAAATAAGATCCTTC
+ATTACTCATATCAAAAGAGGGCACGATCGGGTTCGCTGCCTTCTCGTCTGAGAGCTCGAA
+AACTCCCCTCCCCCGGAATGACACTTCTTCTGGTTTTGCACCTTCCATCATTCTTATGAT
+TTCTGCCCTCATGTCTGAAGTTCTTCCCTCCGTATTTCCAGTGAATGCTGCCATGATGGT
+TGACTTTTCAAATGGGAGGTTTCTTTGTACAGAAAACGTAGGTTGCACACTGGTTTGGCC
+TGCGGAGGCCCTCTGTTGATTAGTGTTTCCTCCACTCCTGGTCCTTATGGCCCAGTACCC
+GCTTCTCAGTTCAAGAGTGCTCGATCCCATATTATCCATGTTCTCATTTGAAGCAATTTG
+TACCCCTCTAGTTGACAGTTTCCCCCGAGGAGATACTTTTGTCCCTCTGATGAAGCTTAA
+CAATCTTAAATCTTCAAATGCAGCAGAATGGCAACTGGCCGC
+.
+qlt:
+6666667>BGGGGGSKCCCCJLLCHHIVLGEGGGKOR\\_TTKMVQGIIHJGGGMLKMMH
+HKM\MV\VKE=9999DDaVV\\VVVVV\V]]V\SMV\\___Y___]__VWWEDLXPPR]\
+VV\V\__YY___V\\RRRV\\V\V\Y_Y__TV____]VVRRRRRR\\\\_Y______Y_\
+__YY__YYT___V_TaV]T]_T__YY____Y___Y]V\\RSVV\____VVV\QPQ\\\__
+\V\VM\VV\\RRXaVV___Y__YYXVYV]TPLLXWY_VV_VT\V____]SVTT_]_aaaa
+V_a______aaYa_aY___]\PXLaa_aaa]____VV_____T__Y______\VPRVV__
+aaaY_]VX___\\VPRXRV\\_______Y_Y_Y_____VV]_V____Y_____]____V_
+____aa_\V\XX]XV\V_VaX__]V\RRIKLLLOX___]_Y__YY______X\\____Y_
+Y________]_a_V__]VVTWXXKMBAHGMMXXXLLXKB<99
+.
+frg:58
+clr:9,490
+}
+{RED
+iid:244
+eid:1086975886
+seq:
+CACGAGGTATTTTTTCTTAATTGTCGTACTCTTCTGCATTGTCTCCGAAGAAATAAGATC
+CTTCATTACTCATATCAAAAGAGGGCACGATCGGGTTCGCTGCCTTCTCGTCTGAGAGCT
+CGAAAACTCCCCTCCCCCGGAATGACACTTCTTCTGGTTTTGCACCTTCCATCATTCTTA
+TGATTTCTGCCCTCATGTCTGAAGTTCTTCCCTCCGTATTTCCAGTGAATGCTGCCATGA
+TGGTTGACTTTTCAAATGGGAGGTTTCTTTGTACAGAAAACGTAGGTTGCACACTGGTTT
+GGCCTGCGGAGGCCCTCTGTTGATTAGTGTTTCCTCCACTCCTGGTCCTTATGGCCCAGT
+ACCCGCTTCTCAGTTCAAGAGTGCTCGATCCCATATTATCCATGTTCTCATTTGAAGCAA
+TTTGTACCCCTCTAGTTGACAGTTTCCCCCGAGGAGATACTTTTGTCCCTCTGATGAAGC
+TTAACAATCTTAAATCTTCAAATGCAGCAAAATGGCAACTGGCCGTCGTTTTACAA
+.
+qlt:
+6666797877<777788<<==CCAD>>CDACHGC===<=DGGHHTPHPWMEGI at BFD@CC
+AICACGMXGFE>=77776677<;EGMRVRQXRT]]_]PRRR]_aT]HLLLLPC;99899;
+>>KNXX]PPXX______\\QKMNMMMVM]VVTTaaaTT__TRRRVVVVO\RRHKDGGXXX
+X__VTWG???@CDJJJJaLLLLLL]XTRRV\_XTaXPPPXSMKHAAHFMLMMaSIMQKQR
+VV_aV\PXXXMMJMMLXX]PLLPTTXLLaXXKFF==CIPPXXPXLLTPHMJFMFHLMSXM
+PLXPPPaPLLXLXaPLLaaRSSRKB@=@FJPPPPJJJIDJKXGGLGGXXLIIIGILXLLG
+LLHLLaTPPHLLLDIISIIDDED at KAGGGGCHMMIXHGDIDACFLHCD>C=>KPLLJMHJ
+JLHDHBDCPTHMCCCACKMHHGLLGGWHLLHXGGLGGHEFKHGLF at 8:::;<B at I>=<><
+<<;;=AADDLJDLDDKLLEIBBGD>>K?B>==?F@>;<<;;?>>:<>HD at D=>>?G
+.
+frg:58
+clr:16,494
+}
+{RED
+iid:245
+eid:1086975813
+seq:
+AAACTCCCCCACTGTACAGTTCATTGATACAAACGCATTCTGACTCCTGGGTTCTGAGGA
+TTTCTTTGGACCATGAAACAATACTATCTACAAGCCTCCCATTGTAAATGAAGCTAGCAG
+TTGCATTTTTATCATCCCCCGTTACACAAACATGCAGCCATGCTTTTCCATCGTGACAAC
+TTGAGCTGGACCATGCTATGCACACTTGCTTAGTCCCCAGATGAAATGGAACACCTAACT
+CATTCATCAATAGGGTCCGATAAGGGGTCCTATCATGTACTGTGTCATTTGAATGCACGT
+TGTTTAGTGTTGTTCCCTGTCCAAGGGCAAATTGATAACATTTGTCAGGATCGCATGACA
+CATAAGGTTCTCTTGTCACCCAGATGTCCCCACCAGCGGAAAGCCTAATCGAATTGTCCT
+TAGAAAAAGGTGCAAATCCTGTAATGTCACATTGCGGCTTTGACCAATTTCTGTATTCTG
+CTAGTTTGGGGCATATTTCCTTCTCTATGGTGGTGTTGGTCAGATACACTATCTCTGTTA
+TGTTTCTTTCTATTATTGTTGGTTCACACAGCATCACTTGGTTGTTTGGGGGGGAGTTGA
+ATTCATATTGCTTGAAATGCAATGTTACAGTAGTTATCAAGATGGCAATTTGCATAAAGA
+AGCATATTGTGGAAATGGTGAGAGAAACAGAGCCAATCGTTATTATCTTTTGATTTGGAT
+TCATCTTTACTCCTGCTTTCGCTACTGGCCGTCGTTTTACAA
+.
+qlt:
+96679766667786669:9<<99DB=><<===AGGHQICECCEEHHHHRVSORMSSSBGB
+BDFaV\SMEIAB999999<;EKT____TPPNNJJaa_\V\\VV___XWXT]PMEF;;><K
+KWXXPX\V__VVVVSVaa__VRRRX_\____V\V\VOSVVVVa_Y_\VV\MQRSSV__TV
+___]aLaSVV\VV_____________a__X]PRRWWXMNGGMMVV\TX\X___T__Y_VV
+SVV\__]___V_aa]a]aRX]X_V__T\\XXP]W_YV\VVSRaXY__V]XX]V\XVVVVX
+_TVMMJJGXXT__T_aa]_V\\V\\RXXX___VVVVRRXRXXV_a]aWRT]XXRTW__V_
+]_____aaa_T]a]\VVVVRXPLLWX_a____VVXPHLLRVS_WWXXXXaXLT]]__aVX
+PLLLXX_V_____V_________XXX]]_V_V_aaaaa_VXXXWPLGGTXLLPPV]]PRP
+WPLPXaa_TTTXPX\TT_aa_aaTXXXRXXLLWXXVXTTPaLLLXP]]_aa_aa_a__Y_
+___]aaaa\_V]XV_VTXaVa]RH\V\RTPLGPXTXXW]aT___VVRRa]TaXXLTWXXX
+TTTTPMRMHMTTTT_TV]_____T_TT\]TTPT]TPTHXTGGXXVV__TY]\PX\XXLLH
+PHIKKTTHGLLPHGCKKNCGLTMBBHDKBBGMWTHHVTHTX]_H____T_HHTTTTLPHH
+\HHHHHHVPRHHHHHHXHKC?H==CDHXHXDB;;?B<>99DD
+.
+frg:41
+clr:33,730
+}
+{RED
+iid:246
+eid:1086975807
+seq:
+AAAATAAACTGGACCATGCTATGCACACTTGCTTAGTCCCCAGATGAAATGGAACACCTA
+ACTCATTCATCAATAGGGTCCGATAAGGGGTCCTATCATGTACTGTGTCATTTGAATGCA
+CGTTGTTTAGTGTTGTTCCCTGTCCAAGGGCAAATTGATAACATTTGTCAGGATCGCATG
+ACACATAAGGTTCTCTTGTCACCCAGATGTCCCCACCAGCGGAAAGCCTAATCGAATTGT
+CCTTAGAAAAAGGTGCAAATCCTGTAATGTCACATTGCGGCTTTGACCAATTTCTGTATT
+CTGCTAGTTTGGGGCATATTTCCTTCTCTATGGTGGTGTTGGTCAGATACACTATCTCTG
+TTATGTTTCTTTCTATTATTGTTGGTTCACACAGCATCACTTGGTTGTTTGGGGGGGAGT
+TGAATTCATATTGCTTGAAATGCAATGTTACAGTAGTTATCAAGATGGCAATTTGCATAA
+AGAAGCATATTGTGGAAATGGTGAGAGAAACAGAGCCAATCGTTATTATCTTTTGATTTG
+GATTCATCTTCACTCCTGCTTTTGCACTGGCCGTCGTTTTACAA
+.
+qlt:
+969779777:=99777>:<<<>>>>>>D?GGAC at FHCK@BBBBBKIGCEEEEDHJKCE_]
+]IHHKOOPPPJO@@9799<>CGLMRR\\V\___]]_______\_Y_VV\VVVOLJGGCAM
+WRPaaV\VOMLTaa]____Y_YOOMMJP____]____________aV\V\VS\VSVV___
+__Y__WNGCKKaaaaa__VVYVOMOLLXX]_____]\X_XWXTVV_____]WXLL]]_]Y
+_\WMEII]]YVVVVV\]___aa___V__XXLLLXPXaY__Y__\\O\\VJM]]a______
+___TXXXPaaTV__Y_]___aaa]aa_]___VVPXVTTV\__XNGCCNN\X___a_aaa_
+___Y__TY_Y_V\VV\V_V_VaT____YY_]RRSRRR_____]_____V_a_T__VXRR\
+VRX\\_]]XX]V_aa_____________VT_VXPaXGXWVWXGEDE:97789FJXXLLGI
+KKEAIMTT__aaaaTT]\VXVPXXGLGGLLNKBBMMVTX\aV_________aa_TV_VXS
+RHVKKTTTTTGGXPXPaaaa]aX]]XWXLPPPG@;??B at EBDHK
+.
+frg:37
+clr:9,543
+}
+{RED
+iid:247
+eid:1086975907
+seq:
+GACGCCTATTTCATCATCAAAGGCCCAGCCTTTCACTCCATGACCACCTTCTTCATTGTT
+AGGATCCAAGCAATGGCTACTGCTGGAGCTGTCGTTTTTTCTGGGTGTGTCTCCAACAAG
+TCCTGAGCACACATAACTGGAAACAATGCTATAATCCTTTATGTTTATATCTACGATGGG
+CCTATTGGAGCCTTTCCAGTTGTCTCTGCAGACACATCTGACACCAGGATATCGAGGATA
+GCAGGAGCACTCCTCGACATGCTGGGCACTTCCTGACAATGTGCTAGTATGAACGATTTT
+CCCCTCCTCAATGAATAGTATTTTAGTATCAGCTTTTCCTGAAGCACTCCCATCAGTCAT
+TACTACTGTACAAGTTCCATTGATACAAACGCATTCTGACTCCTGGGTTCTGAGGATTTC
+TTTGGACCATGAAACAATACTATCTACAAGCCTCCCATTGTAAATGAAGCTAGCAGTTGC
+ATTTTTATCATCCCCCGTTACACAAACATGCAGCCATGCTTTTCCATCGTGACAACTTGA
+GCTGGACCATGCTATGCACACTTGCTTAGTCCCCAGATGAAATGGAACACCTAACTCATT
+CATCAATAGGGTCCGATAAGGGGTCCTATCATGTACTGTGTCATTTGAATGCACGTTGTT
+TAGTGTTGTTCCCTGCCCAAGTGCAAATTGATAACTGGCCGTCGTTTTACAA
+.
+qlt:
+66669777698978;:<98<<=A====C=GGDG====AC=DD<EG>>BTT_HKPGCCIIH
+\FFJJKNJKGTM@=7=7:=GGST_V\VV_________]_V\\\VSVVV\\VHD at 999<DK
+TVVXPXMVVV\\___\VTOOSSV\\\V___]________Y___RVV\V\_YTW]PP]W_]
+_Y____VXRXV\__V\O\\V_V___]]]XORRVVV__V______T_VVVVVVSVaVVRRV
+VXTXT_V]XVVV\XXLLX]__YaYYVR\\VSa]_V_]XRX]]_TVXXXWWTX\XRRV]__
+___XTVVV\VOSVXXXPMM\\VRa]]XV\TTTLXW\____]WXLLTX_____________
+________VVR\\\a_T_Y_Y________VV__V\RXX]__]aaR\]_VVXXVMRVXO\V
+_\_OOQQ]OXXa\YY___VV__T___V]XXaaa___Y_VXXR\V_]VXRXX]TTT_V\]Y
+____________aTaa_TXVPPTTTTTV_Va]aaaVaaaaaaVVVVV\a__YT__HYTT_
+aa]HHVVHH____H_HVVHCCQ]__WTHHGHT]XXHLXX]TH__HVVV\KH_TT_V_H_T
+_____THCSRRRHLLTTSVVHKHHTHHH_aVaHaTTLLXTTHHHTHHXHH_HVTH\TVWT
+IAH?CHSTTH_TPHGDKHE at 97CCHHVVXMMKKCHLLICA@<778@@CC::D
+.
+frg:51
+clr:41,670
+}
+{RED
+iid:248
+eid:1086975834
+seq:
+GAGCGTATAACTGGAAACAATGCTATAATCCTTTATGTTTATATCTACGATGGGCCTATT
+GGAGCCTTTCCAGTTGTCTCTGCAGACACATCTGACACCAGGATATCGAGGATAGCAGGA
+GCACTCCTCGACATGCTGGGCACTTCCTGACAATGTGCTAGTATGAACGATTTTCCCCTC
+CTCAATGAATAGTATTTTAGTATCAGCTTTTCCTGAAGCACTCCCATCAGTCATTACTAC
+TGTACAAGTTCCATTGATACAAACGCATTCTGACTCCTGGGTTCTGAGGATTTCTTTGGA
+CCATGAAACAATACTATCTACAAGCCTCCCATTGTAAATGAAGCTGGCAGTTGCATTTTA
+CTGGCCGTCGTTTTACAA
+.
+qlt:
+6667666678977==>>97:>AACEVEEEEEGNHBCHHJMXPMJPMR_VQOQSMSY\SSR
+RRRR____JHMGGDOXRVV_\\VVRRXX\V\__VVXMKNPHNRSSVMSaPMPOMQ_X\PX
+VVVVVV]]_VVVVV\_aa_\\\\\V]]\VV\\\\_]Y]VPVSV\\\__T__Y_Y____Y]
+\\\\\VY_VVXXR\V__V______VXXa]YY_____VVSV\V\__]__YY___Y__Y__Y
+___Y____]VV\VRRRSQR\___a_a]aa_____XXaPaaW__V__TVJOXV\Y__a___
+__VXXVVV]]__Y_Y__VMM\RRSa]a_V_______\\_X]]aaWEAWWRaa]aaa\X_X
+XRRaRXXKBCCIBGGGPP
+.
+frg:43
+clr:7,336
+}
+{RED
+iid:249
+eid:1086975822
+seq:
+AGATTTTTTAGGTAAAAGACTTCAGTTTCCTCTTTTCTTCCCCTTATCAACTCCACATAA
+AAGCACCGATTGATGCAGCTTTTGCCTTCAACAGAGAAAATACCAGAATAACCGGACCTA
+TTACCTCTGTCAACTATGACTTGCCTATTTATCTGCAATTTGGAATTAGGGTTGGACCAG
+CCCTCAATGACTTTGAAGGTTTCATATCCTGAGCGTAACTTCTCGCTGATCGTTCTTCCC
+ATCCACACGTCATTTCCATCATCAAAGGCCCAGCCTTTCACTCCATGACCACCTTCTTCA
+TTGTTAGGATCCAAGCAATGGCTACTGCTGGAGCTGTCGTTTTTTCTGGGTGTGTCTCCA
+ACAAGTCCTGAGCACACATAACTGGAAACAATGCTATAATCCTTTATGTTTATATCTACA
+ATGGGCCTATTGGAGCCTTTCCAGTTGTCTCGGCAAACACATCTGAATTGTTTTGTCTTT
+TTCACAAC
+.
+qlt:
+666677777797779787798><;;;>B===@BHBACCCCHICQIA<D<>>III at JEVV\
+\RRRRGGGGHHHCKAA888DHCCHHLFFJKCFIEBLCSR_VVNHHHFLNVHRHHHHNBB=
+<HERXXLLLLPLLXPPRTX___TXXTV\VVSRRPXV___V]RPQO\QQSSVR\VSSNXLL
+XXPJRHHFB>@JFMMVVRXXV\SVVV]TaT]PaX]TV___W]PaaaWXXXPRaaa]]HSR
+R\VVVMMMSXTX__MPPPPMXXX\\WXPRNKHDDPPRRVVNLJHLJJMOMRSVTaaXXPX
+LXLLLGKEJLMM]TRRXRXVPXPPLPaaRaaKKLXLXLLL]W__]XRPXPXRTHPLXTLL
+XXXRXPPaPaLLGMLLPXPPLLLXPRMM]XLLLLA;78:9:KCHHLLPaTMLHGDDKHH;
+<GGHHTPaTLLLHHLLTHTJCCA@?JBGBBGC=@==AEGWPLHC><@:;99;966;799<
+:9999>99
+.
+frg:48
+clr:16,445
+}
+{RED
+iid:250
+eid:1086975873
+seq:
+CCGGGTGCTATTTCTAAATTGCGAAAGCTTATATAGGCATGAGATTGATGTCCGCCCCAT
+CAGGCCATGAGCCTGTTCCATATGTACCTGAGGTGCCACAAAACACAACAATACTGTTTG
+AGGTCCACAAGACTTCAGTTTCCTCTTTTCTTCCCCTTATCAACTCCACATAAAAGCACC
+GATTGATGCAGCTTTTGCCTTCAACAGAGAAAATACCAGAATAACCGGACCTATTACCTC
+TGTCAACTATGACTTGCCTATTTATCTGCAATTTGGAATTAGGGTTGGACCAGCCCTCAA
+TGACTTTGAAGGTTTCATATCCTGAGCGTAACTTCTCGCTGATCGTTCTTCCCATCCACA
+CATCAACTGGCCGTCGTTTTACAA
+.
+qlt:
+666686667868>B at ADBLIEGGDXJFNSSSSGNEIGGGGJ@@DAHBHHC at CHIHPOMIH
+HGGEMFCEBHHMTPHHMGGIGLV\\V]\VVV]\V\\\\]\]\V]\V\______VXRTaaa
+T]VPNQSQJXPP]OVVVSR]W___]]]_____]T__Y_VVV\VVVVV\VVVY]V__]_\V
+\VVSRVTXXLLL]]__Y_Y\\\\VLXLLLLSO\\VNPLIIXT___Y__Y___V__T_V__
+_\V\XVV___V______V____Y__YY______aaMR\SVRRVaaa__XXWXLG]XV_VX
+XTXTV_a____________\VTSMRRV\V_Y___aaRVTWPXXW_V_V__V___X]XXXM
+IAAWWPXLLaMJ@@:9<BDIIII]
+.
+frg:71
+clr:14,343
+}
+{RED
+iid:251
+eid:1086975802
+seq:
+GGGGGACCGGAGGGGGGTTGTACATTTGCCTATGAGACCTGTGCTGGGAGTCAGCAATCT
+GTTCACATGTTGCACATACCAGGCCAAATGCCACTTCAGTGGTTACAGCCCCCATTCTAT
+TGTATATGAGGCCCATGCAACTGGCAAGTGCACCAGCAGAATAACTGAGAGCTATTTCTT
+TGGCCCCATGGAACGTTATCTCCCTCTTAAGTTTCCTATACAGTTTAACTGCTTTGTCCA
+TGTTATTTGGATCTCCATTCCCATTGAGGGCATTTTGGACAAAGCGTCTACGCTGCAGTC
+CTCGCTCACTGGGCACGGTGAGCGTGAACACAAACCCCAAAATCCCTTTAGTCAGAGGTG
+ACAGAATTGGTCTTGTCTTTAGCCATTCCATGAGAGCCTCAAGATCTGTGTTTTTCCCAG
+CAAAGACATCTTCAAGTCTCTGCGCGATCTCGGCTTTGAGGGGGCCTGATGGAACGATAG
+AGAGAACATACGTTTCGACCTCGGTTAGAAGGCTCATCTTTAAATATCTACCTGCTTACT
+GGCCGTCGTTTTACAA
+.
+qlt:
+6667796767778966>>@=7777 at AGC==D=<@@@=>@=IHHIIHEGGLHLHHLHMIQQ
+PGIJJHIHKVLGPBA77776888:>CIFXGGENJJNLHGFLMQOVOMLLXMMMJHMGHDB
+IBBKCKMMVRXVLMKJMJMMRSRRVVRRRVSSOOKKECBBCFSSMMNHJDLLXXX]Vaaa
+XX_TRRRRKKNJHDIPPLSSP]aaaXPLXLLLXPXLLPLMSSRSVXXPPSaPa]VXSVRS
+VRRVXXXPXLLXXJJNLRRSV\VVLTLLPHSRRMMaLLLXHLPXKLPXLJBDDMFGBGBD
+GLHHDINMJJLaJLJGGKLLKGGLLXPXX]PLLXPXLLLLLLLLXaPKG=BAGBB;@CEC
+B?<>>GIJHJEDLaPPPPDDA=9CDPIEGEB?==>BALGHMHCCKIEKKKaaTIIH?<=:
+GGCBBBDDLHHAACADAIGPKLKKAADFFHEHDDCJLHPPGLLGLLLPLPGLGG;<=<@<
+@?@G=BBEBGCLIaaBB>D?BDDGEFPBBDB>;<MJLLHH=?@=;;DBMEGKKBEDGDDD
+D at A><<;<>HBGD==H
+.
+frg:23
+clr:23,513
+}
+{RED
+iid:252
+eid:1086975878
+seq:
+GGGGGGAGGGTAGACGATCAGCGAGAAGTTACGCTCAGGATATGAAACCTTCAAAGTCAT
+TGAGGGCTGGTCCAACCCTAATTCCAAATTGCAGATAAATAGGCAAGTCATAGTTGACAG
+AGGTAATAGGTCCGGTTATTCTGGTATTTTCTCTGTTGAAGGCAAAAGCTGCATCAATCG
+GTGCTTTTATGTGGAGTTGATAAGGGGAAGAAAAGAGGAAACTGAAGTCTTGTGGACCTC
+AAACAGTATTGTTGTGTTTTGTGGCACCTCAGGTACATATGGAACAGGCTCATGGCCTGA
+TGGGGCGGACATCAATCTCATGCCTATATAAGCTTTCGCAATTTTAGAAAAAACTCCTTG
+TTTCTACTGGTCATACTGTTTCCTAAAAAGCGATAGAAGTGCGGTAAATAAGGTAATGGG
+AATGGACAATTGTTCTTGAGGTGCCACAGGAAGATATCAAACCCCCTAAAATAAAAGGGC
+TTAGTGGCGTCATTTCGTCTATTTATCGGATGCACATAAGATCACCGATAGATGCAGATT
+TAGCCTTAAACAGAGAAAACACAAGAACAACCGGACCTCTACGCGCGGTCCACTATAACT
+TGCGAGTTTATCTGCAATATCGAATTAGGGTTGGACCAGG
+.
+qlt:
+99;8:9979667:<<A<<><<<ACAABBBAHDGBBGHFGHBCBHDP_\VILIIIIRSRLM
+JM]PRSSRHRBEMMJGWPXPX\MONSNKSSNNFGMOa]\\\RRR\\VV]VVSXXVVVRRR
+RXX__]\\\\\____Y___Y_a_VROVXV____T___VXTVVV\XX__T__YY_]__Y_a
+aaa_V\\\VVVVVX__V_]___T_]a]a]LLWWWLLXPV\VV\\aTaa]]aYY_Y_____
+]]___XTX\__Y_YTY____________WXXVVV\VVMV\\\\\VY___V_V__]]]___
+V___T\\MS\V\_V_____]_________\\RPV]XTXP\]__TPXGIW]]___Yaaaaa
+]]]]PXWRXXSSA<>9<@LLID<76798999><?;<=99=<?D==:;;;=99<99;:9==
+9<<99979:<979799:=99:999799999799999999::9776799966999:99999
+9977997799::776999999:99999:99999979999999999B>99:><;AAJ@;<B
+<;A9>A9999:89999;:99977;;=;;99998=@AFB@;979799:77999989:<:=9
+9999999:99779::;=9969799<97<;9997998;:97
+.
+frg:71
+clr:14,347
+}
+{RED
+iid:253
+eid:1086975780
+seq:
+GGCACGATAAATTTGAAAGATGAGCCTTCTAACCGAGGTCGAAACGTATGTTCTCTCTAT
+CGTTCCATCAGGCCCCCTCAAAGCCGAGATCGCGCAGAGACTTGAAGATGTCTTTGCTGG
+GAAAAACACAGATCTTGAGGCTCTCATGGAATGGCTAAAGACAAGACCAATTCTGTCACC
+TCTGACTAAAGGGATTTTGGGGTTTGTGTTCACGCTCACCGTGCCCAGTGAGCGAGGACT
+GCAGCGTAGACGCTTTGTCCAAAATGCCCTCAATGGGAATGGAGATCCAAATAACATGGA
+CAAAGCAGTTAAACTGTATAGGAAACTTAAGAGGGAGATAACGTTCCATGGGGCCAAAGA
+AATAGCTCTCAGTTATTCTGCTGGTGCACTTGCCAGTTGCATGGGCCTCATATACAATAG
+AATGGGGGCTGTAACCACTGAAGTGGCATTTGGCCTGGTATGTGCAACATGTGAACAGAT
+TGCTGACTCCCAGCAGGTCATAGCTGTTTCCTAATGTCATGCCATTCTGCTGCAGGTTAA
+AATTTAACATTGTTAACCTTCATCTTACGTACAAAATGATCTCCTCGAGACAAACTGTCA
+ACTATACGATTCCAAATTGTTTCATTTGTTGTTTTACCTTTTTT
+.
+qlt:
+869669979:977898688899:;>>BA<=?B>?ACCBB<<@BCEFF??CFGMXLGEDHH
+FJLFFEGCCAAAHJAC:977999<ABJEEIEECABBBD at CFCFDD@@=DGGQMaPaLKKE
+EJHGFDGC>=DEXaTTaLLLPPJJMLLMWRRRRXX]VRRRRGGBBKKPXRWXRaRRRMHM
+XaXRSOOMJLaKIJMRRPaPXXXTXaaRPMMSLLMXXRXXXaXLLNLLLXXTSXPMJJLI
+JPKKC?D>BADDGXTNCBDGMMVTTX_XXXSRPXWLLLMMLLJGELLLJJLWMLLOMNLM
+LJPPLIGAAKKXPXLILLPPXLXXXTXTPWPLaXWJJJMMRRRPXXXPXXaaMSSMMKKI
+]MXDDGaXKWCCGKW_VNNQQQKRLMMRMRVXXXLPPWXRXXPPaaXXXXXXXXPXPXXL
+LXKPLLPXXXXPLLLLLLXaPIGXPHJJJLSPXTPXPLPXTPXRXTXXRPMMLMFILEEP
+PXTJRRRSSXWPXLGXTMMPPSHL]XX]]G=9689899>;C at 9>998;>9:999:99999
+99CC<9;;<>:::9;<9999799;999<A99 at 998=>9::?;:;99<>=:::>:=B<<9<
+9:96977899?>:>:<><?<<::9:9997799:97999997789
+.
+frg:13
+clr:23,474
+}
+{RED
+iid:254
+eid:1086975791
+seq:
+GGAAAATTTTAAGATGAGCCTTCTAACCGAGGTCGAAACGTATGTTCTCTCTATCGTTCC
+ATCAGGCCCCCTCAAAGCCGAGATCGCGCAGAGACTTGAAGATGTCTTTGCTGGGAAAAA
+CACAGATCTTGAGGCTCTCATGGAATGGCTAAAGACAAGACCAATTCTGTCACCTCTGAC
+TAAAGGGATTTTGGGGTTTGTGTTCACGCTCACCGTGCCCAGTGAGCGAGGACTGCAGCG
+TAGACGCTTTGTCCAAAATGCCCTCAATGGGAATGGAGATCCAAATAACATGGACAAAGC
+AGTTAAACTGTATAGGAAACTTAAGAGGGAGATAACGTTCCATGGGGCCAAAGAAATAGC
+TCTCAGTTATTCTGCTGGTGCACTTGCCAGTTGCATGGGCCTCATATACAATAGAATGGG
+GGCTGTAACCACTGAAGTGGCATTTGGCCTGGTATGTGCAACATGTGAACAGATTGCTGA
+CTCCCAGCACAGGTCTCATAGGCAAATGGTGACAACAACCAATCCACTGATAAGGGTCAT
+ACTGAATTTCCTGAAACACGTCATGGGTTGATCCCTATGCAAAAACTTTAAAAGCTTTTA
+CATTGCGATATTTCTCCGCTGATGGTAGCTTGGTGAAATGGACAATCTTCTATGAGATGC
+AAAATTTTGGAGTATTACTAGATATGACTCAAATATACATATGTCATTGAGATGAACACG
+AGTCACCAGAATGGGTGTGGATGAATACTCGAGTACAGAGAGGGTGGTGGTTAGCATTGA
+TCGGTTTTTGAGAGTTCGAGACCAACGTGGGAATGTATTATTATCTCCTGAGGAGGTAGC
+GAACACAGGGGTCTACTAGTTGTCTCTGA
+.
+qlt:
+987:9997877778<<<CGHVGGGHGCCCHIIIEEGGMGNHFEJIK\__\V\SSRRRBHH
+DEGQOR\___PNFE;;>7DDJJJMKLRQNNLLMM\\\_VVSS\\\V\____VV_V\V_]]
+]VVVXR\\_aY\\VVV\VVVSRVV_XT\T__]RSRNKRSMRO\VV]\\OQQVV\_]\VM\
+\VVVa\VV\VXaa____]__a_]VVRNNQVVRXVX_V\VVRRMXXXT_VVV\\VR]XVVW
+XLLLWLX]a__\\\V]V]__]a]Y_WTPPWSSVVRRSSSO\\\V\__]]_TVT_____]a
+aPX]]Y_V_T_VVPXRX]__]]aPLLaTaRSR\\\T__V\VVRMVTVVRROOLLMNVSRR
+]WXXWPP]]___aTaaa_TT]V__YV\\VRSWX]VXVa_aV__V______WWaXXWXR\a
+a]a________VS]]RRaV]]___a]aaaaTV\\\V\a]______]\V\\XRX\\Ya__X
+]XXXXXXRXX_Vaa___]]YaaaVX\XV\XTX\VV]T___V__XWWLLPPWTTRMVNQD@
+:786666;8:86666676999:98799999BA<<99976977689=9799CBEBD?;99=
+<8:8799999:;779:=>=;;9999999799:;:;97988679999:999::>:::8:99
+99=997:999DD:99;;A;:<997998:;99999:;@9989887779D=999:9977989
+799799779999=<====::;:79:;799999999;<99:9<;=:8<99?97:79<<<:9
+79=A<9<=:78899896767788:88879;9===<<79:9>::A>=8989;9=;;:9799
+9;<998779<8:7999999897966999:
+.
+frg:23
+clr:17,511
+}
+{RED
+iid:255
+eid:1086975844
+seq:
+CGAAAGCCTTTGTCCAAAATGCCCTCAATGGGAATGGAGATCCAAATAACATGGACAAAG
+CAGTTAAACTGTATAGGAAACTTAAGAGGGAGATAACGTTCCATGGGGCCAAAGAAATAG
+CTCTCAGTTATTCTGCTGGTGCACTTGCCAGTTGCATGGGCCTCATATACAATAGAATGG
+GGGCTGTAACCACTGAAGTGGCATTTGGCCTGGTATGTGCAACATGTGAACAGATTGCTG
+ACTCCCAGCACAGGTCTCATAGGCAAATGGTGACAACAACCAATCCATTAATAAAACATG
+AGAACAGAATGGTTTTGGCCAGCACTACAGCTAAGGCTATGGAGCAAATGGCTGGATCAA
+GTGAGCAGGCAGCGGAGGCCATGGAAATTGCTAGTCAGGCCAGGCAAATGGTGCAGGCAA
+TGAGAGCCGTTGGGACTCATCCTAGCTCCAGTACTGGTCTAAGAGATGATCTTCTTGAAA
+ATTTGCAGACCTATCAGAAACGAATGGGGGTGCAGATGCAACGGTTCAAGTGACCCGCTT
+GGGTCATAGCTTATAAAAAGGTTGATCCCAATGCAACAATCTTTTAAGGCATTTTCACAA
+AGATGCGAACTGCCTTTTGAAGATTGCTGAATTAAAAAATTTCACTATTTGATTCGAATG
+TTTCATTATTACTAGATATGACTCCTAACACAGAGATCCCATGAGAGGAGTAACAGGCAC
+C
+.
+qlt:
+?999999:9>89>>?@AJCHGIOBB>CFGEC>>>>??@GHIJGKKLVSHCMFJHFLKOO\
+QQQOQ\_QQQHH<=9<7 at ASMHHPXPX\_VNQQQMMRRRKNPPPP\_PPPQQQXLJFKFL
+MRVMMJJMORVV\____VVXR\OVV\\V\VRRV]_____a_V\\\\V]\SVOVPXXXPV\
+_Y___YY]VVRQQQVVVVV__Y__S]]\X\VV\VV\VV__Y______Y__VT___V_]_Y
+__Y\R\VRRVXYY______VVV___\TXV]VR\\\\\]__Y_____]]_]___]Y__YWW
+XLLXX_XTWT__a]__Y\OV\SR___Y_____Y__Y____Y_____]_VVVXY______]
+_aY_Y_YYY__YXVX__T__Y_T______________YY____]_]______V_V____Y
+___V_V____V_Y_Y_]Y___]]aaR\V\VV\\X_a]__]XWLJMM\V\___aa_]____
+_____WXLLaaa]a]]KIXX_TXWX______\]WRPXX_]VXXaR]]]WLGWXXMPHIX]
+\]PCCHE@<98866666666666679:;999999997;76::9:898;<;9999999977
+=:;97999=9887;=@99::;77999999;:9999989:;999999999:9:;;897988
+::97977:<::899999<9<=?;9999999:999778999997:<899979<9977777:
+9
+.
+frg:59
+clr:8,520
+}
+{RED
+iid:256
+eid:1086975877
+seq:
+GAAGGCTTCAGTTATTCTGCTGGTGCACTTGCCAGTTGCATGGGCCTCATATACAATAGA
+ATGGGGGCTGTAACCACTGAAGTGGCATTTGGCCTGGTATGTGCAACATGTGAACAGATT
+GCTGACTCCCAGCACAGGTCTCATAGGCAAATGGTGACAACAACCAATCCATTAATAAAA
+CATGAGAACAGAATGGTTTTGGCCAGCACTACAGCTAAGGCTATGGAGCAAATGGCTGGA
+TCAAGTGAGCAGGCAGCGGAGGCCATGGAAATTGCTAGTCAGGCCAGGCAAATGGTGCAG
+GCAATGAGAGCCGTTGGGACTCATCCTAGCTCCAGTACTGGTCTAAGAGATGATCTTCTT
+GAAAATTTGCAGACCTATCAGAAACGAATGGGGGTGCAGATGCAACGATTCAAGTGACCC
+GCTTGTTGTTACCGCGAGTATCATTGGGATCTTGCACTTGATATTGTGGATTCTTGATCG
+TCTTTTTTTCAAATGCGTCTATCGACTCTTCAAACACGGCCTTAAAAGAGGCCCTTCTAC
+GGAAGGAGTACCTGAGTCGGTCATAGCTGGTTTACATG
+.
+qlt:
+799997777788::<<EAACCPGD>BA?@M@?@G@@KKNKFMNPPJOPPPZSSOPIIMLM
+MMNPS\\\]PNCBBDFJM\\\\\\V\VSSTSZSSVVVV\VS\V\V\\VVVY_YY_Y____
+__VVV\RJNJMJNVV\\VaVV\\V\_______Y_V\SV\\_YV\\VV\V\\\V_T__]\\
+\\VVaXP\\V_V\X_Y]_a_Y_______YY____Y_Y__Y__V\\V\\__\VXX__Y\\V
+\VV___a_Y_____]_a__V_V__Y_Y___Y_]]aaa_Y_YYVV\\O\Y_V_Y___T\V_
+Y_V_______V_T_Y_VV\\\\_Y_]VXPXV\V___T___]Y_]]]RSMRVV\VVVaaaT
+_V\\\\X\VTWSRa]a_WXXGLWWT_V\Ta]aa]_]\\RXVV_Y___Y__]]____Y___
+__Y______]__YV]S\VV__Y___a___Y___Y_YYVV\V\V___a____Y_]______
+____aa]\\]\VVVVV_Y_Y____V]VY__________a_a___\\VaXX]___a_____
+_____Y_\\V\\VVTT__\VKEA@<<=?:=:;776::9
+.
+frg:72
+clr:8,538
+}
+{RED
+iid:257
+eid:1086975810
+seq:
+GGCAGCTGATCAGCAAGGTCTCATAGGCAAATGGTGACAACAACCAATCCATTAATAAAA
+CATGAGAACAGAATGGTTTTGGCCAGCACTACAGCTAAGGCTATGGAGCAAATGGCTGGA
+TCAAGTGAGCAGGCAGCGGAGGCCATGGAAATTGCTAGTCAGGCCAGGCAAATGGTGCAG
+GCAATGAGAGCCGTTGGGACTCATCCTAGCTCCAGTACTGGTCTAAGAGATGATCTTCTT
+GAAAATTTGCAGACCTATCAGAAACGAATGGGGGTGCAGATGCAACGATTCAAGTGACCC
+GCTTGTTGTTACCGCGAGTATCATTGGGATCTTGCACTTGATATTGTGGATTCTTGATCG
+TCTTTTTTTCAAATGCGTCTATCGACTCTTCAAACACGGCCTTAAAAGAGGCCCTTCTAC
+GGAAGGAGTACCTGAGTCTATGAGGGAAGAATATCGAAAGGAACAGCAGAATGCTGTGGA
+TGCTGACGACAGTCATTTTGTCAGCATAGAGTTGGAGTAAAAAACTACCTTGTTTCGGTA
+ATATAACTGGCTGGTGTTTGTTGAGTTTAGGGAGCAGGTTAGGGGAAAAGGGGACCAGGC
+AAAATGGAGGAGGTTGCAACAGAGGGAAGAGGGGCCCGGAGGGAATATGACAGGTCGTGA
+AGAAAAGCCCT
+.
+qlt:
+66667:;<97D>>?79ACP?>FB??BB<;:BBDFIABAEJBEBBH>>@@H at BHHGKK]ZZ
+KNN at GSNMJG=:99=BINSZSPPOPMPY_\V\V\R____V\\SSSVRS\\V\\TVVSOOO
+MPO\RY]__YY__Y___V___V]\R\VY\\\\SV\\\V\V\\R__]]__]__Y____Y_Y
+_Y_YY________aaaX\V\\\______V_\\\\\V____aV\]X\MRVVV\VYY_aaa_
+]_SV\\XV_\]XPV]__]WPLLWW_VXXRaa\Y__V]\PXV]]___Y_V\VVV\______
+aaaaa_________]a_____Y_Y_]_____Y__Y___________]\VVS\Va______
+]T]T___\V\\\\_aaT_Y___Yaa_aa____]]______aY_____Taaaa_]a]____
+_Y______Y__Y_aaaV__Y_Y_VVVVVRRV\QR]\__aa__Y___aaPXWW___a]___
+____V\XX\V_______aa___Y_Y_V__Xaaa________]_]_TMVR>><=BBPRDC9
+9:67666666666666669;9999999<<9999:9876::99999979<9;9:7:9:7;<
+<;999<>799799779;9999999999<99;99:9999;999;999999979=:999999
+:8:;99988<<
+.
+frg:39
+clr:11,512
+}
+{RED
+iid:258
+eid:1086975836
+seq:
+AACCAAAGTTGCCAGGACTAATGGATTCCAACACTGTGTCAAGTTTCCAGGTAGATTGCT
+TTCTTTGGCATATCCGGAAACAAGTTGTAGACCAAGAACTGAGTGATGCCCCATTCCTTG
+ATCGGCTTCGCCGAGATCAGAGGTCCCTAAGGGGAAGAGGCAATACTCTCGGTCTAGACA
+TCAAAGCAGCCACCCATGTTGGAAAGCAAATTGTAGAAAAGATTCTGAAAGAAGAATCTG
+ATGAGGCACTTAAAATGACCATGGTCTCCACACCTGCTTCGCGATACATAACTGACATGA
+CTATTGAGGAATTGTCAAGAAACTGGTTCATGCTAATGCCCAAGCAGAAAGTGGAAGGAC
+CTCTTTGCATCAGAATGGACCAGGCAATCATGGAGAAAAACATCATGTTGAAAGCGAATT
+TCAGTGTGATTTTTGACCGACTAGAGACCATAGTATTACTAAGGGCTTTCACCGAAGAGG
+GAGCAATTGTTGGCGAAATTTCACCATTGCCTTGGT
+.
+qlt:
+99887776666869798779@=@@@BB<999<BGBT_DEL at AAAEDG==?==PPGGGISS
+_\Y\\MMMONNVRSVQOOOO\VVR\\\\QSM\QRIQ\]___aaPOOOPOS\]XP\T___Y
+YVSRRSQ\_]XXXSRRRRSSSWX____T_____V\VRPV\Y____YY_a]a]Y___]]PS
+V\VV\__YVV\\\R_V\\__VV__]]XXVV__XXPXPV]V\V\\\_Y___XX]]VVX__Y
+_T_____VY_T_________TYY___\\VV\VYY__Y__T]]VVV\\\_]___V_____Y
+__V___Y_VVVV\V___Y__Y\___aV_]Y___VXXXa]__]XRaaaa]]___Y_____V
+__Y]___Y_\VVXR\VY__Y__VXVX__Y_VW]aPR]]_______Y_aY____YY_YY__
+T__]_aV_____]V\V\\VVOORSRXX_____Y_V________a]a]VVVVVVaaLGXXW
+V________a_]aXXX]____XXLPW]_aa]aaGG<
+.
+frg:56
+clr:19,492
+}
+{RED
+iid:259
+eid:1086975797
+seq:
+AAGCACGATGCATGACTAATGGATTCCAACACTGTGTCAAGTTTCCAGGTAGATTGCTTT
+CTTTGGCATATCCGGAAACAAGTTGTAGACCAAGAACTGAGTGATGCCCCATTCCTTGAT
+CGGCTTCGCCGAGATCAGAGGTCCCTAAGGGGAAGAGGCAATACTCTCGGTCTAGACATC
+AAAGCAGCCACCCATGTTGGAAAGCAAATTGTAGAAAAGATTCTGAAAGAAGAATCTGAT
+GAGGCACTTAAAATGACCATGGTCTCCACACCTGCTTCGCGATACATAACTGACATGACT
+ATTGAGGAATTGTCAAGAAACTGGTTCATGCTAATGCCCAAGCAGAAAGTGGAAGGACCT
+CTTTGCATCAGAATGGACCAGGCAATCATGGAGAAAAACATCATGTTGAAAGCGAATTTC
+AGTGTGATTTTTGACCGACTAGAGACCATAGTATTACTAAGGGCTTTCACCGAAGAGGGA
+GCAATTGTTGGCGAAATCTGGTAATAGCTGTTTCCTGA
+.
+qlt:
+96866666669666987<<A<<>><<?<??@GCH_ at A?BBBS\F@@@EE]HPHJKNMPVY
+Y]\SRRROVOKKLLHCAADBML___VVSJNNOPPXVVVV\aHKJLNMQRRSSRTTXMLLO
+OVY_T___V\XRVV\\VPP\]____Y_Y_]]]XXSS]]__Y]___V]_\VRQOMSMOO\\
+\VVVVRKHGDJJLPX\V_Y______V_Y_YXV\RRX]\SS\VV__\]TXXTRR\\VVVVV
+VV_Y_V_V___YYY_YY]]XX]a]VSVVVV___a_V\VRR]VV\\\\_aa______T_Y_
+VXXRa\Y_____]______]WXR]XY__V_T__V___V]_Y_XaPR]]XXPPX]MR\\\V
+VY__YY]]TPLLWXY______V__]]__VVVRSR]\______]aa]____V]\\\\___V
+XXX]]]YY__________TW]XRVV\VVV]]LT]V___Y__aa___VXXXXXaaLLaW\X
+V]_____a__]XPPPXXVVXHD99DAPHKJ]XPKKKKa
+.
+frg:29
+clr:17,476
+}
+{RED
+iid:260
+eid:1086975777
+seq:
+CCAACTGTTAATGCTTTCTTTGGCATATCCGGAACAAGTTGTAGACCAAGAACTGAGTGA
+TGCCCCATTCCTTGATCGGCTTCGCCGAGATCAGAGGTCCCTAAGGGGAAGAGGCAATAC
+TCTCGGTCTAGACATCAAAGCAGCCACCCATGTTGGAAAGCAAATTGTAGAAAAGATTCT
+GAAAGAAGAATCTGATGAGGCACTTAAAATGACCATGGTCTCCACACCTGCTTCGCGATA
+CATAACTGACATGACTATTGAGGAATTGTCAAGAAACTGGTTCATGCTAATGCCCAAGCA
+GAAAGTGGAAGGACCTCTTTGCATCAGAATGGACCAGGCAATCATGGAGAAAAACATCAT
+GTTGAAAGCGAATTTCAGTGTGATTTTTGACCGACTAGAGACCATAGTATTACTAAGGGC
+TTTCACCGAAGAGGGAGCAATTGTTGGCGAAATCTCACCATTGCCTTGGTAATAGCTGTT
+TCCTG
+.
+qlt:
+966779:66998 at C@@@@C>><<<<@@CCEA at 88>=BEZSMSOJGJMPIIRSSSS\\PKK
+IJJKPOPMO__\\SRQQRRRQ\_____]\V\VVV\\VR\\_____]__V_VV\\VV]__Y
+_Y_S]]SS\VVV\\\__YY_X\XX]]_Y_V\VVSSY_Y__]_____XXTXLXTVVV\VSa
+_Y__]Y_\\V\VSa]_a__VV\\VV_Y___YVVVOV\a]Y____YYYY_Y__________
+_YY_YV\\V\\_YY__Y__aa___Y__]TXV\Y__]SSVVSS\\\\_Y_____Y____VX
+XX]WVV__]a\\V\V\aaa___]]WXPPTWY__Y___Y_____Y_V\PXP]]Y_Y____Y
+_a]_____YYYYYY__VVRaV______Y_Y__YY]\RaX]]__]\V______Y__Y__Y_
+_Y___Y_\aTXXWXY__]_VV_V]a]VXR\\]]II]]XRVV_aT\XXWGD;9D>LJKPXD
+A<<D<
+.
+frg:9
+clr:37,445
+}
+{RED
+iid:261
+eid:1086975801
+seq:
+GAAACTGACGGACTCGTGTGATTTTTGACCGACTAGAGACCATAGTATTACTAAGGGCTT
+TCACCGAAGAGGGAGCAATTGTTGGCGAAATCTCACCATTGCCTTCTTTTCCAGGACATA
+CTATTGAGGATGTCAAAAATGCAATTGGGGTCCTCATCGGAGGACTTGAATGGAATGATA
+ACACAGTTCGAGTCTCTAAAAATCTACAGAGATTCGCTTGGAGAAGCAGTAATGAGAATG
+GGGGACCTCCACTTACTCCAAAACAGAAACGGAAAATGGCGAGAACAGCTAGGTCAAAAG
+TTTGAAGAGATAAGATGGCTGATTGAAGAAGTGAGACACAGACTAAAAACAACTGAAAAT
+AGCTTTGAACAAATAACATTCATGCAAGCCTTACAGCGGTCATAGCTGTTTCCTGA
+.
+qlt:
+86667766768=7799 at D<>>>><J@@@@NN\QSRROOFEFEC at LMMO\\_XSSRRSS_N
+EENIG_____aWWB::67>=<FFJNHOXXXVMOMOPPX\\a_aaaaa__SPJOJFHGBG=
+>AMMT]]\\\\\V\\XXV\\VV]_VV_]\\__]_TV]____VV\VR\____________]
+]_Y___]aaKCGMGDIIRV\_]]____V_VVVV\Va]TaTXPXX___]_V]]XaPXXTXR
+\]VVVVRVVVVV\YYTV\\\VV_VTPPVVYaY___V_XV\RPXX__Y_Y_______Y__V
+TV_VXXLLMMVSOPPWW_]VXXVXWWXXXTT_\TXP]X__VXXX___V_]_\TVaa_YV\
+RXR]a___YY________TWCCKKXaTWGGXXVXVVRaV]VXXKJDJMVWPK?<DM
+.
+frg:28
+clr:16,375
+}
+{RED
+iid:262
+eid:1086975767
+seq:
+GGGATAAGACTCGTGTGATTTTTGACCGACTAGAGACCATAGTATTACTAAGGGCTTTCA
+CCGAAGAGGGAGCAATTGTTGGCGAAATCTCACCATTGCCTTCTTTTCCAGGACATACTA
+TTGAGGATGTCAAAAATGCAATTGGGGTCCTCATCGGAGGACTTGAATGGAATGATAACA
+CAGTTCGAGTCTCTAAAAATCTACAGAGATTCGCTTGGAGAAGCAGTAATGAGAATGGGG
+GACCTCCACTTACTCCAAAACAGAAACGGAAAATGGCGAGAACAGCTAGGTCAAAAGTTT
+GAAGAGATAAGATGGCTGATTGAAGAAGTGAGACACAGACTAAAAACAACTGAAAATAGC
+TTTGAACAAATAACATTCATGCAAGCATTACAACTGCTGTTTGAAGTGGAACAGGAGATA
+AGAACTTTCTCATTTCAGCTTATTTAATGATAAAAAGCACCCTTGTTTCTACTGGTCATA
+CTG
+.
+qlt:
+996667789<<77 at C<<<<<=CBBB at IFFCKACCEHHJDHDJLPSSR\SRRSRR\\OOPO
+PI\\\\_aW_XMH>=GIO]ORSMRSRV\\\\\\VVV\a_]aa]VX\IGGGILQVVVV___
+__T_ORSR\V\\\\___V_VV\V__V]Y__VYY]\\VVMPPPMP___Y__Y_Y__Y_Y__
+Y___]YaaaaaV\R\\\_Y_YV___T___\V_VaaaXV\TXVV_V]RX\XTXXTWXPV]V
+V\\\\_V__V___VO\\\\]\VPPV\Y_Y____XX]a_aV_____Y________]___Y_
+VWWLLSMRRVXRXT_V_V__TV]]XXTVVVVRRVVVXPRVTV_]]__]__Y____XV\__
+_V___V__]_______V__T_]___Y_YY_Y_\VaV]TT__YV]]XRXXV\_]WXMLLNL
+RRRTX__aVVVVV\V_TTXXW____XVMSVVV\WWLLXXV__YYY_\\XR]]PXSMSAC8
+786
+.
+frg:1
+clr:13,450
+}
+{RED
+iid:263
+eid:1086975838
+seq:
+CGAACTTTTTATTAGTATGGAAGATAAAAGAACTACGGAATCTGATGTCGCAGTCTCGCA
+CTCGCGAGATACTGACAAAAACCACAGTGGACCATATGGCCATAATTAAGAAGTACACAT
+CGGGGAGACAGGAAAAGAACCCGTCACTTAGGATGAAATGGATGATGGCAATGAAATACC
+CAATCACTGCTGACAAAAGGATAACAGAAATGGTTCCGGAGAGAAATGAACAAGGACAAA
+CTCTATGGAGTAAAATGAGTGATGCTGGATCAGATCGAGTGATGGTATCACCTTTGGCTG
+TAACATGGTGGAATAGAAATGGACCCGTGACAAGTACGGTCCATTACCCAAAAGTATACA
+AGACTTATTTTGACAAAGTCGAAAGGTTAAAACATGGAACCTTTGGCCCTGTTCATTTTA
+GAAATCAAGTCAAGATACGCAGAAGAGTAGACATAAACCCTGGTCATGCAGACCTCAGTG
+CCAAAGAGGCACAAGATGTAATTATGGAAGTTGTTTTTCCCAATGAAGTGGGAGCCAGGA
+TACTAACATCAGAATCGCAATTAACAATAACTAAAGAGAAAAAAGAAGAACTCCGAGATT
+GCAAAATTTCTCCCTTGATGGTTGCATACATGTTAGAGAGAGAACTTGTACGAAAAACAA
+GATTTCTCCCAGTTGCTGGCGGAACAAGCAGTATATACATTGAAGTTTTACATTTGACTC
+AAGGAACGTGTTGGGAACAGATGTACACTCCAGGGGTCTATTCGTTTTGATACTCGAGAT
+AAAAGTTCGGTTTTTTGAGACTTCGAGTCCACGTGGGAATGTTTATTTTCTCCCTGAGGA
+GGCGGCGGAACCCCAGGGTTGAGAAGATATCTTTTGTGTACAAA
+.
+qlt:
+66666697777<77<<>>>LKKGHGCCCCEPCMHC at EHCFHHDHFDIIJSSQVO_VV\VX
+VV\_\]LFF@<::98?<QNTQQRPPOV\RRMMPPOOV\OPNPIP_Y___TXVMRSXRRYS
+\__\\QQQ\VV_____\VV\XVV\\VR\_]VSVOVVYY_V\V\\\_Y____T__Y_____
+Y__YVVPTVV_V\VV]Xa\V\\\\__VVWXRX\_a]aXXVPR\V_____]]_VRRRSS]_
+a____Y___T_]]]VXVX]RV\V______WWWLLXW_aaVT_V_________aaaaaa_]
+__]_V__TaVXXWXPRXXX_____Y_VRRRRRVYY___Y__V_____________T___T
+]XPXX_V__YYV\\V\\_\XRaa]_]___]__]_Y_]aaaVYS]\]V]_aaV\VVV\VV]
+XX]]_______YY__VV_aaaaPWLL]WRXX]]_a]aaaaa]___Y_VXVXRV]\\\\X]
+V__V\XX\\___\\RR\\____\\]]\]aaaaaa_aaaX]V\RR\\XVXX]V________
+_________WXXXXX______a__]________VTaXXX_____T\XP]]\__aT__TTT
+VVV_____Y_____T_Y_TTTY___T_____TTXXRPaa__T]]X___XWLLWW____VV
+MROOV]_VMVMJRa]TVTTTTVMSXXV]TT______TTTTTVTTTT___]_______V]]
+__X\O\VV\____YPSEE99CJNQCCCCIELPIHMDA77997:9998:666666666666
+7::899669;@97977899989:9979797999:7797:8899998<;88:<97777987
+897779899:997;79797797979977799999989:76999<
+.
+frg:57
+clr:10,732
+}
+{RED
+iid:264
+eid:1086975892
+seq:
+CTGGGAAGTTACTCAGGTGGAGAGTGAGGAATGACGATGTTGACCAAAGCCTAATTATTG
+CGGCCAGGAACATAGTAAGAAGAGCAGCAGTATCAGCAGATCCACTAGCATCTTTATTGG
+AGATGTGCCACAGCACACAAATTGGCGGGACAAGGATGGTGGACATTCTTAGACAGAACC
+CGACTGAAGAACAAGCTGTGGATATATGCAAGGCTGCAATGGGATTGAGAATCAGCTCAT
+CCTTCAGCTTTGGTGGGTTTACATTTAAAAGAACAAGCGGGTCATCAGTCAAAAAAGAGG
+AAGAAGTGCTTACAGGCAATCTCCAAACATTGAAGATAAGAGTACATGAGGGGTATGAGG
+AGTTCACAATGGTGGGGAAAAGAGCAACAGCTATACTCAGAAAAGCAACCAGAAGATTGG
+TTCAGCTCATAGTGAGTGGAAGAGACGAACAGTCAATAGCTGAAGCAATAATCGTGGCCA
+TGGTGTTTTCACAAGAGGATTGCATGATAAAAGCAGTTAGAGGTGACCTGAATTTCGTCA
+ACAGAGCAAATCAGCGGTTGAACCCCATGCATCAGCTTTTAAGGCATTTTCAGAAAGATG
+CGAAAGTGCTTTTTCAAAATTGGGGAATTGAACACATCGACAGTGTGATGGGAATGGTTG
+GAGTATTACCAGATATGACTCCAAGCACAGAGATGTCAATGAGAGGAATAAGAGTCAGCA
+AAATGGGTGTGGATGAATACTCCAGTACAGAGAGGGTGGTGGTTAGCATTGATCGGTTTT
+TGAGAGTTCGAGACCAACGTGGGAATGTATTATTATCTCCTGAGGAGGTCAGCGAAACAC
+AAGGGTCATACACGCGTGGTCTATGAGAGA
+.
+qlt:
+66697787777BD7:;@CCPJ>B>>>CC?><>><@GIIJOMM@@DBBBR\\_Y_VSMLNO
+MMMOVSRLMCI>>99DDT__YVVVVVV\VV_VSRRRRRVV\\V\QQSSSV\____VV\\V
+IPNPPPVXV\\VY__Y]____\\V\V\\V\\VRRRRRR\Y_______Y____Y_Y_Y__Y
+_Y_____Y_S]V\\\Y]__\]]V_____T___aa_Y_____SV\VV\Y____VV_____Y
+_aVVV\\RaaY___YY___]_Y__YY___YYY____Yaaa__]____VVTT__]]]RRVX
+______Y___Y___Y___YY_VV\V\S_Y_____T_\]_Y__]___Y_]a_______YaT
+T__Y___VVV_____V______Y_]_Y____Y_Y___]XRP\V______YVVXVVV\\VY
+__Y__Y___YX]RXV_Y_aaaaXVV_____Y__Y_________Y___Y_Y_Y_Y____Y_
+____aaa_____Y___\\VX\\_____________________Y_______Y\\_a__YV
+___________a_aa__a_YYYT_aaaaaa______a____________aaaaaaVV\\\
+\aa_a]aa_aa_\VVVVVYaaa]_VVVVVV_Y]_TTTY_T_XXTTOVMMMOVVRIISVR_
+aT__VVV_____VSSRRS]___Y_______\VV\\\______\\XV_T____________
+]VXT______V\V\\\OVV\\\\\\\T_T_MSSSSSXYV\\]\\_____TT__M\\\\\a
+aa________\\\\\\\V__a_\\VV\\]\\]\]________\\]]\RRLJQDJHGIMVI
+G7999B=C=99:98879=78:98:967799
+.
+frg:54
+clr:36,823
+}
+{RED
+iid:265
+eid:1086975853
+seq:
+CCGAAAATGCGAACCAGGGTACTGAGAGACTGACAATAACTTATTCATCGTCGATGATGT
+GGGAGATTAACGGTCCTGAGTCGGTTTTGGTCAATACCTATCAATGGATCATCAGAAATT
+GGGAAGCTGTCAAAATTCAATGGTCTCAGAATCCTGCAATGTTGTACAACAAAATGGAAT
+TTGAACCATTTCAATCTTTAGTCCCCAAGGCCATTAGAAGCCAATACAGTGGGTTTGTCA
+GAACTCTATTCCAACAAATGAGAGACGTACTTGGGACATTTGACACCACCCAGATAATAA
+AGCTTCTCCCTTTTGCAGCCGCTCCACCAAAGCAAAGCAGAATGCAGTTCTCTTCACTGA
+CTGTAAATGTGAGGGGATCAGGGATGAGAATACTTGTAAGGGGCAATTCTCCTGTATTCA
+ACTACAACAAGACAACTAAAAGACTAACAATTCTCGGAAAAGATGCCGGCACTTTAATTG
+AAGACCCAGATGAAAGCACATCCGGAGTGGAGTCTGCCGTCTTGAGAGGGTTTCTCATTA
+TAGGTAAGGAAGACAGAAGATACGGACCAGCATTAAGCATCAATGAACTGAGTAACCTTG
+CAAAAGGGGAAAAGGCTAATGTGCTAATCGGGCAAGGAGACGTGGTGTTGGTAATGAAAC
+GAAAACGGGACTCTAGCATACTTACTGACAGCCAGACAGCGACCAAAAGAATTCGGATGG
+CCATCAATTAATGTTGAATAGTTTAAAAACGACCTTGTTTCTACTGGTCATACTTGTTTT
+CTTGA
+.
+qlt:
+669666699979;7867786<;;CAC?C??E@?@BHHV\\VVR@@E at EBSSRRSPKKIJI
+OPRHEMMPLSRMMHJBH>>BWNVV\VSOPOPPRVV\___\\V\VVMPPPPOSRRMMMMSR
+RV]\____V\VVVV]V\\\\Raaa\\\\VVT_YY_Y_TT_V___V]\]S\_]___Y_Y\\
+_____]__WRSSMMR____Y_Y__]__T_VV\V\VVV__V\V\\\V_XXXaaaa___\]V
+XX]]_]__YMPPSRR]_VWXXaRV]]_]____a___Y______YVT___VVRXRXV]]__
+a]]]____Y_aa__]]XPXaT_______________]]PRSWXVV\Xaaa]_________
+Y_Y_]]_Vaa]aa]Y__VV_VRSQSOV______VXX\X__aY_Y__YY___Y________
+__Y_Y___aY_Y__V____Y_______]_Y_a]]a___V__Y_Y___Y______Y_Y___
+\VXX\]VXXP]]V_________a______]_Y____aaaaY]________Y_________
+___aa]a_VaXR]VY__VVV\VV_a______aaaaa]Y__YT__YYY__\a_TY__YV__
+__YTYTYTYTTTT_TY_T___YTTTTTTTTTTYVV\VIHRRRSVTV__VVYVTT__TTV_
+YYYYYYYTT_HY]]TPXTTYYT_VVV__TY_T_T____T_Y_____TaSOV\VMXR\TT_
+H_TTTVVVV_TT__TT_]]]]]]]]_TT]X]HH]__T_TTRSHMHCNEEBF977778<<8
+778<<
+.
+frg:21
+clr:15,741
+}
+{RED
+iid:266
+eid:1086975783
+seq:
+CAGGGCACATTTGATGCATGTCATCCGACTCTACTGTTCCTAAAGGTTCCAGCGCAAAAT
+GCCATAAGCACCACATTCCCTTATACTGGAGATCCTCCATACAGCCATGGAACAGGAACA
+GGGTACACCATGGACACAGTCAACAGAACACACCAATATTCAGAGAAGGGGAAGTGGACG
+ACAAATACAGAAACTGGGGCACCCCAACTCAACCCAATTGATGGACCACTACCTGAGGAT
+AATGAGCCGAGTGGATATGCACAAACAGACTGTGTCCTGGAGGCTATGGCCTTCCTTGAA
+GAATCCCACCCAGGTATCTTTGAGAACTCATGCCTTGAAACAATGGAAGTCGTTCAACAA
+ACAAGGGTGGACAAACTAACCCAAGGTCGCCAGACTTATGATTGGACATTAAACAGAAAT
+CAACCGGCAGCAACTGCATTAGCCAACACCATAGAAGTTTTTAGATCGAATGGACTAACA
+GCTAATGAATCAGGAAGGCTAATAGATTTCCTCAAGGATGTGATGGAATCAATGGATAAA
+GAGGAAATGGAGATAACAACACACTTTCAAAGAAAAAGGAGAGTAAGAGACAACATGACC
+AAGAAAATGGTCACACAAAGAACAATAGGGAAGAAAAAACAAAGAGTGAATAAGAGAGGC
+TATCTAATAAGAGCTTTGACATTGAACACGATGACCAAAGATGCAGAGAGAGGTAAATTA
+AAAAGAAGGGCTATTGCAACACCAGGGATGCAGATCAGAGGGGTCATAG
+.
+qlt:
+6666667788<==:9669><AC=>D=@GEHHPHIJHLHGGHIIIRRREDDDHDFLDHNN]
+PPOPMMRQQHNC?999 at DV\VQSS\RR\VRRVVVVPOOPRM\VVSV\OQ\RSR\VV\\\\
+V\V\V\VV__V]S\SQVVVVVV\\______YVV\VV\Y__\VXPVV_____Y_T_\VVVV
+V___]YYVT___]V__]_VVRVX\___Y_____]_]_Y__Y_VV\VV\__Y____YVVVV
+R\___aaV____VV\\V\YTYYY___V_XVX__T_a]PPa\Y]_____]]Y__Y____\V
+RP]TV\VVV\Y_YVV\VV\]a]aXX]]__]___Y_Y_Y\__TS\__T\__________]_
+]a]_aaa_VVVVV\_T______Y__]aaTTVVXX]]__________Y_____]VVRPV\_
+____aaaaY__]]_a___\\PRS\X\V_Y_VVTRXXX__]_]TRRVX_____________
+Y_____Y____T____Y_aV_XVVXX]\Y__YY__Y______Y_Y__Y____YV\\X\\a
+aa________Y__T____Y____aY______a__Y__Y_aY____TTK\VV\]_YTT___
+TYYYTTT_________T__T__T_YTT__a_a___]]___Y_T__YYYYYTYY__TH\]V
+]_TTTTT_V\PPTT]aV\VOVMYT_Y_____VV\\VX\\\\\\\____Y___________
+____]_V]]]]____Y____T]XPRRRVVGG99AE99<<NLVKA=:>:8
+.
+frg:15
+clr:9,740
+}
+{RED
+iid:267
+eid:1086975786
+seq:
+TCAAACCGGGGGGAAGCAAATTAGAGGGTTCGTGTACTTCGTTGAAACTTTAGCTAGAAG
+CATTTGCGAAAAGCTTGAACAGTCTGGACTTCCGGTTGGGGGTAATGAAAAGAAGGCCAA
+ACTGGCAAATGTTGTGAGAAAAATGATGACTAATTCACAAGACACTGAGCTTTCTTTCAC
+AATCACTGGGGACAACACTAAGTGGAATGAAAATCAAAACCCTCGAATGTTTTTGGCGAT
+GATTACATATATCACAAAAAATCAACCTGAGTGGTTCAGAAACATCCTGAGCATCGCACC
+AATAATGTTCTCAAACAAAATGGCAAGACTAGGAAAAGGATACATGTTCGAGAGTAAGAG
+AATGAAGCTCCGAACACAAATACCCGCAGAAATGCTAGCAAGCATTGACCTGAAGTATTT
+CAATGAATCAACAAGGAAGAAAATTGAGAAAATAAGGCCTCTTCTAATAGATGGCACAGC
+ATCATTGAGCCCTGGGATGATGATGGGCATGTTCAACATGCTAAGTACGGTTTTAGGAGT
+CTCAATACTGAATCTTGGGCAAAAGAAATACACCAAGACAACATACTGGTGGGATGGGCT
+CCAATCCTCCGACGATTTTGCCCTCATAGTGAATGCACCAAATCATGAGGGAATACAAGC
+AGGAGTGGATAGATTCTACAGGACCTGCAAGTTAGTGGGAATCAACATGAGCAAAAAGAA
+GTCCTATATAAATAAAACAGGGACATTTGAATTCACAAGCTTTTTTTATCGATATGGATT
+TGTGGCTAATTTTAGCATGGAGCTTCCCAGCTTTGGGAGTGTCTGGGGTCATAGCTGTTT
+TACTAA
+.
+qlt:
+8<<996::?@<8779997::88789;<B<<::<<A>BC@>99>>@99<>BBAC?B<?<?C
+CF?@;9>BKGJFFHFGFJIMGGHGKKQOS]V_____Y_a\VMSKLNNKMWTVRRRNQQKK
+HaaXWXXXXVVVVRPJGLJMMNOOQOVV\XXR]V\\\VV\MXPXRJJLLRWWTPXVVVO\
+V]RXXPJP]QQVSMSXXLLLJJLHJXTTT_VVVRXXXP]]aaaLGGXPX]]__TXXKJJL
+LM\]XPTX]XRRRRMRTPXPPXX]V_aa]PPLXXRPXPSPW]PPSTWXRXXX]XLLLXT]
+TRXXPPXX]MRSMPJLLL]XVXPPWTXXRRXPTXXXTSVSMMMPXTPaaLWGLPXXGLLP
+XXTVTaPR\]X___T_TTTVXXS\\LNJLTXT__XVPXLLPPXRVQQSQORaaXXXWX]X
+P]VTX_V____V_VVP]VXRVVVVOOPLLOM\QPQVVVXV_VVRRMLKHDKWKPXXXPLG
+PKVVRRRaaRaaaaT____H____T______HH\VVV__]VVTaXPXW__aTT]\XX\VH
+____TTT__aaaaPaaaaaVV\OMJL]TRHTHHTTXLLX]T_Taa_VKHGVCCHH\\aa_
+_____HTH]HaTTLLWTTTHV\SVVMMJHGHWHVXRHTHHTHXHHTLK]PVOKMHGHLLH
+MHQHNKNHINCCPHXXPHGGPLHHHVaXHHRHPM\HOMQQHCCMGLPJB;B?HHCC==;B
+CHHWLLGLPHWHDELHCCH at D>;CBEGCCCCFHDFFHRSS\]aaT]HLGB:<<A@@@>CN
+LIGGB>@IE=@77779==97777AAHB<877::66697777 at 8==MK>;;A<998877>>
+977667
+.
+frg:18
+clr:68,746
+}
+{RED
+iid:268
+eid:1086975903
+seq:
+TAAGCTAAATTGATTGGAGATTTTGTGCGACAATGCTTCAACCCGATGATTGTCGAACTT
+GCAGAAAAAGCAATGAAAGAGTATGGAGAGGATCTGAAAATTGAAACAAACAAATTTGCA
+GCAATATGCACCCACTTGGAGGTATGTTTCATGTATTCAGATTTTCATTTCATCAATGAA
+CAAGGCGAATCAATAATGGTAGAACTTGATGATCCAAATGCACTGTTAAAGCACAGATTT
+GAAATAATCGAGGGGAGAGACAGAACAATGGCCTGGACAGTAGTAAACAGTATCTGCAAC
+ACTACTGGAGCTGAAAAACCGAAGTTTCTACCAGATTTGTATGATTACAAGGAGAACAGA
+TTCATCGAAATTGGAGTGACAAGAAGAGAAGTCCACATATATTACCTTGAAAAGGCCAAT
+AAAATTAAATCTGAGAACACACACATTCACATTTTCTCATTCACTGGGGAGGAAATGGCC
+ACAAAGGCAGACTACACTCTCGACGAGGAAAGCAGAGCTAGGATTAAAACCAGGCTATTT
+ACCATAAGACAAGAAATGGCCAACAGAGGCCTCTGGGATTCCTTTCGTCAGTCCGAAAGA
+GGCGAAGAAACAATTGAAGAAAAATTTGAAATCTCAGGAACTATGCGTAGGCTTGCCGAC
+CAAAGTCTCCCACCGAACTTCTCCTGCCTTGAGAATTTTAGAGCCTATGTGGATGGATTC
+GAACCGAACGGCTGCATTGAGGGCAAGCTTTCTCAGATGTCCAAAGAAGTGAATGGGTCA
+TAGCTGTTTCCTGA
+.
+qlt:
+67767766669977668668;<====B<88:::>H_BC>@A>FXHXCCLJMGSKMLMMRV
+OMLMLMDF<;<9:99:8777=:<<>EKXPGGLEEDKKGHSVMVXPMFF;;9999<=D9>>
+<9:99;<=999;999<>>E=9?<=;>99?AGGLPWLMMCCAIKGDBIDELLLLIGGGLIG
+LGCCCKIIGD:=9=DGPaKKKKKaKPPLLXLP]]TPXLILCAFECBFBGGGGKABBHPMP
+LLXLLPEHMMKEKKKGEAFFKKKSMLLLHLLXRaXXLLIEEAGGKMXGGIGCLWJINGGK
+LRSRMMLLPWLGIMKLXXPLGKKKKLLXXRFF=?>FJGGLLLXXPPPLGECIXMMXLEGG
+JJMMWCCKMWXPLaaa\VOVVMXLPXLDE]LLXLLLXTXXXXXXTVaXXTTX_XTTPXTV
+V_V]TX]]_aaVTRRRXX]PPLLLKGWXRVSSVV\VOMLLSSVVVaaPRXRXXXVXXLLL
+LXXXT]XXPLLTW\RSRMHPLPXXXHJJHPMLLPXXXTVTTXXXX]TTTTVVXPXXPXVW
+TTPXTSLPXPRXPaaaaaXRWXLJHPVNNXXTR\RNNHHVVaaaTRRHX]XXTaXPX]TR
+PaXHGGECCCCCCWXPaaKKaGHS\RSRPHIKaGHKKLH]]HXHOSGHKPIXPXHHXXTP
+HHTHDA88>BFTHGGHHHLPLGHLLGGHME>=@<?99??JJDJPHCLCKQSRRGTPPK at 9
+9<F>GXPHHXHTLC9979<<?FHHJAGGHGI=;>99@>>===@C;99=9;GAD<<77=:8
+76799>>@<8:89@
+.
+frg:78
+clr:18,749
+}
+{RED
+iid:269
+eid:1086975846
+seq:
+CGGCCGAATCTCTGCTTGAGAATTTTAGAGCCTATGTGGATGGATTCGAACCGAACGGCT
+GCATTGAGGGCAAGCTTTCTCAAATGTCCAAAGAAGTGAATGCCAAAATTGAACCTTTTC
+TGAAGACAACACCAAGACCAATCAAACTTCCTAATGGACCTCCTTGTTATCAGCGGTCCA
+AATTCCTCCTGATGGATGCTTTGAAATTGAGCATTGAAGACCCAAGTCACGAAGGAGAAG
+GGATTCCATTATATGATGCGATCAAGTGCATGAAAACATTCTTTGGATGGAAAGAACCTT
+ATATAGTCAAACCACACGAAAAGGGAATAAATTCAAATTACCTGCTGTCATGGAAGCAAG
+TATTGTCAGAATTGCAGGACATTGAAAATGAGGAGAAGATCCCAAGGACTAAAAACATGA
+AGAAAACGAGTCAACTAAAGTGGGCTCTTGGTGAAAACATGGCACCAGAGAAAGTAGACT
+TTGACAACTGCAGAGACATAAGCGATTTGAAGCAATATGATAGTGACGAACCTGAATTAA
+GGTCACTTTCAAGCTGGATACAGAATGAGTTCAACAAGGCCTGCGAGCTAACTGATTCAA
+TCTGGATAGAGCTCGATGAAATTGGAGAGGACGTAGCCCCAATTGAGTACATTGCAAGCA
+TGAGGAGGAATTATTTCACAGCAGAGGTGTCCCATTGTAGAGCCACTGAGTACATAATGA
+AGGGGGTATACATTAATACTGCCCTGCTCAATGCATCCTGTGCAGCAATGGACGATTTTC
+AACTAATCCCCATGATAAGCAATTGCAGGACTAAAGAGGTCATAGCTTGTTTTCCTGAA
+.
+qlt:
+6667966777;7778<<<<<<<>A>A>??BEOEJEGR@>>>>?BHGDRRSX\______aV
+V\SSZT_Z\V\HSKHD@>8<>FEHMXMMSPMO_\VVV\ZSSOOPOMR_________]TWG
+LWWJRRSSS\VV\\\\\\\X\VV\V\YY_V\\VSRRSSSS\_____Y_______]VMMSS
+RRa]YY____Y_Y_Y_Y______Y__Y___Y___T_aVMVV\RV\\Y___T_a\XPXV__
+\\\]V\Y_Y_YY___YY___Y______V__T____]____]aa_VVV\R\__YV\\V\V_
+______Y__TYY__Y___aa_]___YY___]___]___]_Y_Yaa]Y__YT____]__]_
+___Y__VVMVV\R\Y__Y__Y_____Y___]]aRV]________VSRRSR\__]__YY]a
+aX_________]_]__Y__a_a_a]aa_YY_____Y_________\VPXXX_V]]]__V_
+__Y__Y]_aa]\XXVVY__YV\X]\___________________________________
+T____YTV\MV\\aaV\VVV\_T_____aY__]__Y___aaVa______________T_Y
+YY_Y_T_TTYaaaTT___TTTT_TVaa]T_TT_VaaaTTVTT__aa_______aaaaa_a
+aaaXRVXVVVX\\____T____]V________Y___aaaa]_]____aa______V]\S\
+_\\\\__________Y_____a_]]_YY__________aa___________]\SSX\\\\
+\\\_____\\]XVV_\____]]DD]DE99KDP]X__\_MJHIIFC<999:@A?::66=>
+.
+frg:61
+clr:15,792
+}
+{RED
+iid:270
+eid:1086975854
+seq:
+CCCGGAATTGAGGGGGGTAACTTTAATACTGCCCTGCTCAATGCATCCTGTGCAGCAATG
+GACGATTTTCAACTAACCCCCATGATAAGCAAGTGCAGAACTAAAGAGGGAAGGCGAAAA
+ACCAATTTATATGGGTTCATCATAAAGGGAAGATCCCATTTAAGGAATGACACAGATGTG
+GTAAACTTTGTGAGCATGGAATTTTCTCTCACTGACCCGAGACTAGAGCCACATAAATGG
+GAGAAATACTGTGTCCTTGAGATAGGAGATATGTTACTAAGAAGTGCCATAGGCCAAATT
+TCAAGGCCTATGTTCTTGTATGTGAGGACAAACGGAACATCAAAGGTCAAAATGAAATGG
+GGAATGGAGATGAGACGTTGCCTCCTTCAGTCACTCCAGCAGATCGAGAGCATGATTGAA
+GCCGAGTCCTCGATTAAAGAGAAAGACATGACCAAAGAGTTTTTTGAGAATAAATCAGAA
+GCATGGCCCATTGGGGAGTCCCCCAAGGGAGTGGAAGAAGGTTCCATTGGGAAAGTCTGT
+AGGACTCTATTGGCTAAGTCAGTGTTCAATAGCCTGTATGCATCACCACAATTGGAAGGA
+TTTTCAGCGGAGTCAAGAAAACTGCTTCTTGTTGTTCAGGCTCTTAGGGACAATCTCGAA
+CCTGGGACCTTTGATCTCGGGGGGCTATATGAAGCAATTGAGGAGTGCCTGATTAATGAT
+CCCTGGGTTTTGCTCAATGCATCTTGGTTCAACTCCTTCCTGACACATGCATTAAAATAG
+TTATGGCAGTGCTACTATTTGTTATCCGTACTGTCCAAAAAAGTACCTTGTTTCTACTGG
+TCATAGCTGTTTCCTGA
+.
+qlt:
+79;79;9787777<>BB99:889AA=B===CECGGH?>DA?<EEEEEGMMEEHFEIEEGK
+JJSQQQOGG@@999777<;:BDKLV\\\V\VVV\QQPOQQ\OMGGEDLLPXC>:97:79;
+CJMMV\___\\\\\\V\\\\\__]_V__XWJLNQQPV\V\\VVSIVV\VR]PLLXX]_VV
+\VVVTTD?<<999DGXXRMMV\V\_aaVSRVVVV_T__a\MRRRRRPSRVVV\]_VTaTa
+TaTVSS\\\__VTY_YY\XRXRVXTXSSMRRVXVXXTXXLLLWXXXTWXPRXRVV____]
+_____VVPVX___aTTPLTX_VV____Y___T___Y_]_]_a]____Y]____VVPXVXT
+aY___XWRRRSMR]VXX\a_aaY_YV]WXSPX]XXXTXVXXXXXXPaaPT]VRSVVVVVX
+R\XVXXRXX]RXPPXTWVPPXXXXRP]XRXVX_]VXPPPaaaa\XPLGIXX]]_NLJJLM
+T_____aY_____a__Y___]__]T_TXXaaaaXXPLLXW__\]XPVVRSVVT___XXPP
+WLLWX___]aaa__V_T_V_________TXRPa]XX]X________Y_V_aaaaaaa\\V
+XK\THXXXXHXHHTTHHHVVTT_YaYTTYT____H]V]XXTXVTHHHHWXTTPHaTCEEL
+KHVTGGGGCOTXLPTHHHHTTT_T]SPXGGMGVSTVX_HTGGLPXT_THCCCCGVHCCCC
+GJ]_TTHGTH_HTTCCNCNCSVHTTMRMRRHOMYT]aTTHKGGHHKXPWLLKMGCMCG>H
+7;@GGCA=ACEBAAD9988<=NGHEJHEGGA=?A=<787979<@BB==CCCHC:=9=<<=
+;798987979799966:
+.
+frg:50
+clr:31,813
+}
+{RED
+iid:271
+eid:1086975900
+seq:
+GAGAATTGACGTTGCATCTGCACCCCCATTCGTTTCTGATAGGTCTGCAAATTTTCAAGA
+AGATCATCTCTTAGACCAGTACTGGAGCTAGGATGAGTCCCAACGGCTCTCATTGCCTGC
+ACCATTTGCCTGGCCTGACTAGCAATTTCCATGGCCTCCGCTGCCTGCTCACTTGATCCA
+GCCATTTGCTCCATAGCCTTAGCTGTAGTGCTGGCCAAAACCATTCTGTTCTCATGTTTT
+ATTAATGGATTGGTTGTTGTCACCATTTGCCTATGAGACCTGTGCTGGGAGTCAGCAATC
+TGTTCACATGTTGCACATACCAGGCCAAATGCCACTTCAGTGGTTACAGCCCCCATTCTA
+TTGTATATGAGGCCCATGCAACTGGCAAGTGCACCAGCAGAATAACTGAGAGCTATTTCT
+TTGGCCCCATGGAACGTTATCTCCCTCTTAAGTTTCCTATACAGTTTAACTGCTTTGTCC
+ATGTTATTTGGATCTCCATTCCCATTGAGGGCATTTTGGACAAAGCGTCTACGCTGCAGT
+ACTGGCCGTCGTTTTACAA
+.
+qlt:
+666777778<?<<<<<<<@EGKRSGKGGEIXX]QKNBGBBGDKIJNKJEJHKRBBCA@@G
+DEGLEIRRVVHD99997:8=>BEAIIQXX\MPPJNNX_\]]\\\_aaYV\O\LGGBAAGG
+\VVVV\aaaaTV___\VVMMMXT]]_]SRSPPJ]aa____V___Y_Y_VVVVQSRRSQ\V
+SSTX__]__VV\MMMX_V]VXXXX]XP]PaT__Y_Y_V]__YY__]]__Y______a]__
+_]_X\XTX____a__a]______T___a_]__]TPLLL]X__aa]]aVV\\V\_]]]X__
+_aVR\\]V___]_______\V_VOVVV\]YV\\VVVVVXXLaW_______a___]Y__Y_
+V______V__aa___Y__Y___V]\________V\RXXaGGWX___WMJLLOM]X____a
+_]_______VVVV]V__V____aV_____V]XX]]____]V_______T_a]a__T_VV\
+VV\_____]XXRVX___________VXRV\T_Y___]VXKNCCWW_KH;<HHH<>KKWLL
+WPRV\NJ<?99;>CLLL]]
+.
+frg:59
+clr:10,519
+}
+{RED
+iid:272
+eid:1086975910
+seq:
+ATGGCTCGTCGTAGACGCCTCTTTTAAGGCCGTGTTTGAAGAGTCGATAGACGCATTTGA
+AAAAAAGACGATCAAGAATCCACAATATCAAGTGCAAGATCCCAATGATACTCGCGGTAA
+CAACAAGCGGGTCACTTGAATCGTTGCATCTGCACCCCCATTCGTTTCTGATAGGTCTGC
+AAATTTTCAAGAAGATCATCTCTTAGACCAGTACTGGAGCTAGGATGAGTCCCAACGGCT
+CTCATTGCCTGCACCATTTGCCTGGCCTGACTAGCAATTTCCATGGCCTCCGCTGCCTGC
+TCACTTGATCCAGCCATTTGCTCCATAGCCTTAGCTGTAGTGCTGGCCAAAACCATTCTG
+TTCTCATGTTTTATTAATGGATTGGTTGTTGTCACCATTTGCCTATGAGACCTGTGCTGG
+GAGTCAGCAATCTGTTCACATGTTGCACATACCAGGCCAAATGCCACTTCAGTGGTTACA
+GCCCCCATTCTATTGTATATGAGGCCCATGCAACTGGCAAGTGCACCAGCAGAATAACTG
+AGTGCTATTTCTTTGGCCACTGGCCGC
+.
+qlt:
+98666666668<886667:>RR_JHHHHJMRSV__VSOQQHPKKKHNOPMV\\\_X\SRR
+SX_\\VSSRGKD;;7799?AFFHN_VHMRRSVTM\VPJJPPOVXVV____VWGKKADEKP
+V\SS___aa_VSRSRRR\VVV__V\T__VVVVRRS\T__Y_Taa__\_OVVOV\___Y__
+__]YYMOJLMEaNJJPPR_Ya_XPKEGLK\VMXXVT]a____\VVVVRXROX]\VVaaaa
+_V_____aa]___]\X___]]aaaaaaT__WX]XTWXX\\\\VRVaa_]a]___Y___YV
+VV\VV____\]VTTXPPV\a]VVVRRRXTaaaRaaWTWXPLXXT__________Y_Y]a_
+]_____]TTVV\\\SVVSS\VV\VVVV__YVXR]X__YYaa]__VXXLLLWW_aaTa_VV
+V__X___]VT___a___YY___aa_________Y_________YV_VV]]XLLWX___\X
+XXaV___X\PXXV______\VR\X_______YVXaa]V_______]\V]aaDDNK\VV]a
+DD8=D9:W]]_____VSRRRRRRC<96
+.
+frg:72
+clr:17,536
+}
+{RED
+iid:273
+eid:1086975879
+seq:
+TGACCAATTTTCTCCACTCTATGCTGACAAAATGACTGTCGTCAGCATCCACAGCATTCT
+GCTGTTCCTTTCGATATTCTTCCCTCATAGACTCAGGTACTCCTTCCGTAGAAGGGCCTC
+TTTTAAGGCCGTGTTTGAAGAGTCGATAGACGCATTTGAAAAAAAGACGATCAAGAATCC
+ACAATATCAAGTGCAAGATCCCAATGATACTCGCGGTAACAACAAGCGGGTCACTTGAAT
+CGTTGCATCTGCACCCCCATTCGTTTCTGATAGGTCTGCAAATTTTCAAGAAGATCATCT
+CTTAGACCAGTACTGGAGCTAGGATGAGTCCCAACGGCTCTCATTGCCTGCACCATTTGC
+CTGGCCTGACTAGCAATTTCCATGGCCTCCGCTGCCTGCTCACTTGATCCAGCCATTTGC
+TCCATAGCCTTAGCTGTAGTGCTGGCCAAAACCATTCTGTTCTCATGTTTTATTAATGGA
+TTGGTTGTTGTCACCATTTGCCTATGAGACCTGTGCTGGGAGTCAGCAATCTGCTCACAC
+TGGCCG
+.
+qlt:
+666666:8<777<<<=<<>CCGCKKBE::XAAEEHINLSRPPPOOMVNKJNIIRR\SV\_
+_V]RIS\VVNW><9 at 9=FGTT__]\\\\VRRMMKNII\]___a____TXWPXPGGIKSMa
+a\VVVOV\V\\aaaa_]X]RX]X\RPVX_V\V_Y_________]\SRRRM\ROOLLXR\\
+\V\Y__Y_____VVT\SS\O\RV\V____VXPa]]_RV\V\S_]XXaaaY\\OVRR\VV\
+]_a___Y_T_VVPP]]_YYVVXRX\]]]XPXT_____T_V]RXaVV]RRJLPJHPPV___
+VXPGDDNL\RMXX_X\T__VVV_VXX]aa]]____Y_]____YY_aaaY]YVV\OVVaaa
+aVaa_]VVVRRRXT]X____]]TV]____Y__YaYY____V_V____Y]___VVX___aa
+___]XRXTaaaaaa]aaaaLTaa_Y___________]aaa]YV]__Y___Y_V_XXPT]_
+V\V\\]__a]_____Y_aa___Y]XPLLLWW_aVaa_aVXRVW]]XRXX_XNaCCMMXXX
+R\M?>9
+.
+frg:39
+clr:16,517
+}
+{RED
+iid:274
+eid:1086975908
+seq:
+CGGATTGTGAATTTCCGCCAACAATTGCTCCCTCTTCGGTGAAAGCCCTTAGTAATACTA
+TGGTCTCTAGTCGGTCAAAAATCACACTGAAATTCGCTTTCAACATGATGTTTTTCTCCA
+TGATTGCCTGGTCCATTCTGATGCAAAGAGGTCCTTCCACTTTCTGCTTGGGCATTAGCA
+TGAACCAGTTTCTTGACAATTCCTCAATAGTCATGTCAGTTATGTATCGCGAAGCAGGTG
+TGGAGACCATGGTCATTTTAAGTGCCTCATCAGATTCTTCTTTCAGAATCTTTTCTACAA
+TTTGCTTTCCAACATGGGTGGCTGCTTTGATGTCTAGACCGAGAGTATTGCCTCTTCCCC
+TTAGGGACCTCTGATCTCGGCGAAGCCGATCAAGGAATGGGGCATCACTCAGTTCTTGGT
+CTACAACTTGTTTCCGGATATGCCAAAGAAAGCAATCTACCTGGAAACTTGACACAGTGT
+TGGAATCCATTATGTCTTTGTCACCCTGCTTTCGCTACTGGCCGTCGTTTTACAA
+.
+qlt:
+866676666::<;;9879?>;9:88<?C at FF?ACFGLJA=>779<BHFGH<BBJKMMVQH
+JOMLITTXRRNGC>A9><<77?<GHEEELGIJGNCQNQNPPOQNVV\____aaT_TKKED
+DFX__X\]Y__\MVVV\V\RRVR\X_VXXTXVVTTPCPMPP]TaT_aaV__VOHMNMLHM
+XXRRJJLJMTW_Y_VVRSRRXXRRVHIOLHGHILM]WXSSXX_Y_WXLLaPXXWXXTXXX
+]XWPLLTXVX__VVV\V\H]PXPWX___]XMBBBNHRRV]PGFIFCAMKR]WXVVVRSS_
+TVXaVTVPJGKEEMLMa]aa]RPXV\VGGLGFEDHH at BKKFFCDFFV\VMVaaRaRRXPT
+MWGGBICRRHVCMMSCCTWPPLLXXXPLGXPXRVVVVTPRTVRMMJHLHI at IGaPHGGGE
+EHDHCPHPTTTHXLLLGLPXPXRLLHH@@HGTLLPXDGJGJMPXPTPXXRHMJDB<::BB
+LPPRVTTLLMCCHGDDHLHGJGDDEJGGJFKDH>DDIDEHHJFGBCCE?<=::<F
+.
+frg:56
+clr:28,503
+}
+{RED
+iid:275
+eid:1086975826
+seq:
+GGGGGACTGCTCGTCTTCGGTGAAAGCCCTTAGTAATACTATGGTCTCTAGTCGGTCAAA
+AATCACACTGAAATTCGCTTTCAACATGATGTTTTTCTCCATGATTGCCTGGTCCATTCT
+GATGCAAAGAGGTCCTTCCACTTTCTGCTTGGGCATTAGCATGAACCAGTTTCTTGACAA
+TTCCTCAATAGTCATGTCAGTTATGTATCGCGAAGCAGGTGTGGAGACCATGGTCATTTT
+AAGTGCCTCATCAGATTCTTCTTTCAGAATCTTTTCTACAATTTGCTTTCCAACATGGGT
+GGCTGCTTTGATGTCTAGACCGAGAGTATTGCCTCTTCCCCTTAGGGACCTCTGATCTCG
+GCGAAGCCGATCAAGGAATGGGGCATCACTCAGTTCTTGGTCTACAACTTGTTTCCGGAT
+ATGCCAAAGAAAGCAATCTACCTGGAAACTTGACACAGTGTTGGAATCCATTATGTCTTT
+GTCACCCTGCTTTTGCACTGGCCGTCGTTTTACAA
+.
+qlt:
+86666666688777<?CECC<=9999<<GMMMGECMOJOOOMOKNKRR\_\VSSIIKJKP
+POPPO\XOMNFBCAA=9CFIIJILKMJLRRRSX__Y_RRRPJO\\VVYVV\RHKJJNN_R
+S\VV\\\\V_T____YPPPPPP_aY__________VVRXX\V_Y\V\VVVaa]a\V\V]\
+\]____Y__T__]V___T_______YV\\V\V_VV__aaaa]]aRSS]\VYYVV\VRVS\
+VVVRT]____]TKJHNLVYTY_\MKNDD]]__aa]_V\\\RVa_Y___\\\\\S\MVVV\
+VY___Y__V\VVV\XTPPP]WXSXPXV____a]a]_Y____T_VXVVVVV\__VVV_Y_Y
+]VXRXW]XRVV_]V\\\V\V_________V]VXXaaa_____VVV\\Va]aY_____TV\
+\V\V__W]LL]]_]________]\V\]\Y_____TVVSMVV_____]Y__Y_]aa]aaaa
+____XVXXVX_aaXVX]RRXaXRHB;;BB at LLLX]
+.
+frg:29
+clr:14,475
+}
+{RED
+iid:276
+eid:1086975775
+seq:
+CCAGCATAATCGCAAATTGCTCCCTCTTCGGTGAAAGCCCTTAGTAATACTATGGTCTCT
+AGTCGGTCAAAAATCACACTGAAATTCGCTTTCAACATGATGTTTTTCTCCATGATTGCC
+TGGTCCATTCTGATGCAAAGAGGTCCTTCCACTTTCTGCTTGGGCATTAGCATGAACCAG
+TTTCTTGACAATTCCTCAATAGTCATGTCAGTTATGTATCGCGAAGCAGGTGTGGAGACC
+ATGGTCATTTTAAGTGCCTCATCAGATTCTTCTTTCAGAATCTTTTCTACAATTTGCTTT
+CCAACATGGGTGGCTGCTTTGATGTCTAGACCGAGAGTATTGCCTCTTCCCCTTAGGGAC
+CTCTGATCTCGGCGAAGCCGATCAAGGAATGGGGCATCACTCAGTTCTTGGTCTACAACT
+TGTTTCCGGATATGCCAAAGAAAGCAATCTACCTGAAAACTTGACTGGCCGTCGTTTTAC
+AA
+.
+qlt:
+66<6667787689GECGOGLIMEGSO_RFHBBCEIGEP\V_]XRCMRRGROMBBHJPR\_
+TVRQQIIGHKSHFH==GHHHHQQRSQQNNQMPOMQNNPPXYYYY____QQQFFHX]X___
+TXVPPJJPP\RR\\V\\RRRPXX___TPPJPJP_]]PRVX___Y__WTXXPW]__YWTXX
+RWX_Y\VVV\\\]__]]]]TP]T]W__VV\XX\V__YTXXVaXXVPXXPTPPaTPLMMRR
+\XX]VVXX\]VVRXXXXX]V]]MIEEWT_YYY_VKGHBBW]YY_]____T\XVV____VV
+\]]]RXXX]aaa]aaaaa_VVVVVVXPLLLXWXLLLLLV\V\a]aT\X____V\RXSSMV
+VVaXXTVXV__XWLLXXXXLLXX_VXXWXRX\a__]]XVVXPaaaa]aaaa_____Y\\a
+aaa_aa]XXVV_____\WXLLX]]]]BBWW__\Ka;;D;>WMTWPPXXWMB at 9:@D at LLL
+]]
+.
+frg:9
+clr:14,441
+}
+{RED
+iid:277
+eid:1086975796
+seq:
+TGAGCGGCAGATGTTATTTGTTCAAAGCTATTTTCAGTTGTTTTTAGTCTGTGTCTCACT
+TCTTCAATCAGCCATCTTATCTCTTCAAACTTTTGACCTAGCTGTTCTCGCCATTTTCCG
+TTTCTGTTTTGGAGTAAGTGGAGGTCCCCCATTCTCATTACTGCTTCTCCAAGCGAATCT
+CTGTAGATTTTTAGAGACTCGAACTGTGTTATCATTCCATTCAAGTCCTCCGATGAGGAC
+CCCAATTGCATTTTTGACATCCTCAATAGTATGTCCTGGAAAAGAAGGCAATGGTGAGAT
+TTCGCCAACAATTGCTCCCTCTTCGGTGAAAGCCCTTAGTAATACTATGGTCTCTAGTCG
+GTCAAAAATCACACTGAAATTCGCTTTCAACATGAACTGGCCGTCGTTTTACAA
+.
+qlt:
+86667668777<=<<<D<@C@@@N@@@BCCEG><<>>>GEIIMEEKEFHIIKISINNNJK
+__IGKJKGQSGFF<@;=DCNN\_JJMRQO\_aa\VVX\\XXP\V_YVVVPPPPPPWVXRV
+]______YT_V_O\\VVVRX\_Y_Y________VVV\\V]VT_]a__V\\\V\_V_____
+__VXXXX]T\\OOLLMMRRM_XWXXVa________V\V\VV\\OV____aV_XVTX\RVV
+VS__Y__V__T\aa___V_YYV\\X\VXXXV\_YaaaRVV\\]PX]V__VVMS]SRXXX]
+XVXTX_______aaaa_V_Y___aV\VXX\VT__VV]RSRXW____\__]___V___Y__
+__V]TXV\\VV_Y__]aaKK]KaaaV\VMJDGXXaaaaaaJJAA::ABDLLL]]
+.
+frg:28
+clr:11,372
+}
+{RED
+iid:278
+eid:1086975839
+seq:
+GGCGGTGTGCCTTTTTATCATTAAATAAGCTGAAATGAGAAAGTTCTTATCTCCTGTTCC
+ACTTCAAACAGCAGTTGTAATGCTTGCATGAATGTTATTTGTTCAAAGCTATTTTCAGTT
+GTTTTTAGTCTGTGTCTCACTTCTTCAATCAGCCATCTTATCTCTTCAAACTTTTGACCT
+AGCTGTTCTCGCCATTTTCCGTTTCTGTTTTGGAGTAAGTGGAGGTCCCCCATTCTCATT
+ACTGCTTCTCCAAGCGAATCTCTGTAGATTTTTAGAGACTCGAACTGTGTTATCATTCCA
+TTCAAGTCCTCCGATGAGGACCCCAATTGCATTTTTGACATCCTCAATAGTATGTCCTGG
+AAAAGAAGGCAATGGTGAGATTTCGCCAACAATTGCTCCCTCTTCGGTGAAAGCCCTTAG
+TAATACTATGGTCTCTAGTCGGTCAAAAATCACACTGAAATTCGCTTTTAATATGAACTG
+GCCGTCGTTTTACAA
+.
+qlt:
+666666678877B<<<::8:8:<=A;BBCCGB>@A>=BACBAEEHB\VKV\S]]TTMEKE
+GHCMGMPJNKKK\VTXJHCCEIJJLLVVV\V\RVVV\SSRVMMMMOJV_Y__TPJPPJKa
+TT]]_YY__VV__XVRX\V____VVVVVRRRSSVV____Y__aaVVV\V\\]a]____X\
+XTTaaa]TaaXXXRVV______Y__VVa_]VXXXXP]XXPaaX_Y______aaa_T____
+V__aaaVRVX]T_VXXXT]XXRaaaPLL]]]XXXGILLWPLPKaKLTa___V__VV\V\R
+SV\___T]aaVXXXPXTXXX\______V_V___aaXPPWXRVXVY]]PLPPXTVTaaaRX
+VVW]PSX]]]]RXXXXXRRRRMRXXRV]_V_VTXaaaa]TaTT\VY]XLXX]_T_aXWPL
+LT]_X]RRX]]__aaaTaR]]VRX]]____YT_TXXPHMDD]]PL>;9699:=GKRTRPR
+aTPHE=FEHAGHJJS
+.
+frg:1
+clr:38,453
+}
+{RED
+iid:279
+eid:1086975916
+seq:
+TAAGCATCTGTTCACACGTTCCTTGAGTCAAATGTAAAACTTCAATGTATATACTGCTTG
+TTCCGCCAGCAACTGGGAGAAATCTTGTTTTTCGTACAAGTTCTCTCTCTAACATGTATG
+CAACCATCAAGGGAGAAATTTTGCAATCTCGGAGTTCTTCTTTTTTCTCTTTAGTTATTG
+TTAATTGCGATTCTGATGTTAGTATCCTGGCTCCCACTTCATTGGGAAAAACAACTTCCA
+TAATTACATCTTGTGCCTCTTTGGCACTGAGGTCTGCATGACCAGGGTTTATGTCTACTC
+TTCTGCGTATCTTGACTTGATTTCTAAAATGAACAGGGCCAAAGGTTCCATGTTTTAACC
+TTTCGACTTTGTCAAAATAAGTCTTGTATACTTTTGGGTAATGGACCGTACTTGTCACGG
+GTCCATTTCTATTCCACCATGTTACAGCCAAAGGTGATACCATCACTCGATCTGATCCAG
+CATCACTCATTTTACTCCATAGAGTTTGTCCTTGTTCATTTCTCTCCGGAACCATTTCTG
+TTATCCTTTTGTCAGCAGTGATTGGGTATTTCATTGCCATCATCCATTTCATCCTAAGTG
+ACGGGTTCTTTTCCTGTCTCCCCGATGTGTACTTCTTAATTATGGCCATATGGTCCACTG
+TGGTTTTTGTCAGTATCTCGCGAGTGCGAGACTGCGACATCAGATTCCGTAGTTCTTTTA
+TTCTTTCCATACTGAATATAATTGACCTGCTTTCGACTGGCGC
+.
+qlt:
+66666666688<:87<<>BAACMHEHCELEIGEIIG\\\IA at GBGEGMHRRRKIQQQM\\
+\\\VV\V\K>;7987667;:A=@LF]\\]_\SRRRSVSVV_____aa\\SQCI=<99 at HN
+OV]S\\VV__X\WPPJMQJPPVV\\\\T]_V\SVV__Y_______]___VSVV\V_\___
+_Y__Y_]XRX\\TVVVVV\_]]X]V__Va]]VVVSRROVV\\TX_T________YY\VV\
+\\]_]]__VVaaa]a________Y___V__VY_________V\RRV]__Y_Y______VV
+]aVV______V__________V]XR]]V_T_____________aaa]]]]V_a__Y____
+_]TRLPXW_TVV\\\\_]]]Raaaa__T_T_Yaaa]_____V____Y__YY_a___Y__Y
+YVV\VVVVXXX]V\VV\V__Y_____VVVVV\aaV___V___aaa]]aaR]a___V\\SR
+V]]Y___Y__________]XPLLaTaaa]aaY]T_V_____aaaa]aaPT]____Taa_T
+_V]VTTVV_Y_TTVHXXPPTX__TV____T______Y_YY__T___YT_Y___aTTTaPT
+VVVSKVY_YY]_]aTTTTPPTTTHTTTTTYTYYYVHYTT_THYYTTH_HHTTTHTKHGMS
+HHHHTT_TT_TTMHRRHVVXRX\_TXLLWX__aaLLX]TV\]XXV]_aaaTa_____V\\
+V\\____V__]XXS\V\]\\\\V\VVVVX]T]MEDKH>@:997
+.
+frg:57
+clr:14,731
+}
+{RED
+iid:280
+eid:1086975831
+seq:
+TACCACAAACTCTAGAGAAATAATACATTCCCACGTTGGTCTCGAACTCTCAAAAACCGA
+TCAATGCTAACCACCACCCTCTCTGTACTGGAGTATTCATCCACACCCATTTTGCTGACT
+CTTATTCCTCTCATTGACATCTCTGTGCTTGGAGTCATATCTGGTAATACTCCAACCATT
+CCCATCACACTGTCGATGTGTTCAATTCCCCAATTTTGAAAAAGCACTTTCGCATCTTTC
+TGAAAATGCCTTAAAAGCTGATGCATGGGGTTCAACCGCTGATTTGCTCTGTTGACGAAA
+TTCAGGTCACCTCTAACTGCTTTTATCATGCAATCCTCTTGTGAAAACACCATGGCCACG
+ATTATTGCTTCAGCTATTGACTGTTCGTCTCTTCCACTCACTATGAGCTGAACCAATCTT
+CTGGTTGCTTTTCTGAGTATAGCTGTTGCTCTTTTCCCCACCATTGTGAACTCCTCATAC
+CCCTCATGTACTCTTATCTTCAATGTTTGGAGATTGCCTGTAAGCACTTCTTCCTCTTTT
+TTGACTGATGACCCGCTTGTTCTTTTAAATGTAAACCCACCAAAGCTGAAGGATGAGCTG
+ATTCTCAATCCCATTGCAGCCTTGCATATATCCACAGCTTGTTCTTCAGTCGGGTTCTGT
+CTAAGAATGTCCACCATCCTTGTCCCGCCAATTTGTGTGCTGTGGCACATCTCCAATAAA
+GATGCTAGTGGATCTGCTGATACTGCTGCTCTTCTTACTATGTTCCTGGCCGCAATAATT
+AGGCTTTGGTCAACATCGTCATTCCTCACTTCTCCACCTGGAGTGTACATCTGTTCCCAG
+CAACTGGCCTCCTTTTTACA
+.
+qlt:
+66666677778 at 7669877<<>>@A>A?>>CB@@@HRHSMITMVV\VVIMJJJ\\VVRRL
+LOKINRSHTDD>:>>;?MPRPaa_\V\SRQV\LPPOMPVOPMMPPV\\SKLMK=@CIKV_
+_]__YY___VV\VVV\V\\\\aaaa]a]]__T_V___Y_V\_V\\_____V_Y_Y__TY_
+_\VPXXRXVV\]]]SRTV_]\\V\\VYV\\\VVV]YY_____]_XWX_XWPSXWX__a_a
+]PX]]_Y_Y_YY_V__T_____]]TPXaaY_Y___YY_VQOOSSV_YY___aSRLHHHX]
+__V_\VVVYY_Y____]_a_______YY__Y__Y__]__aa\PX]]]__TV_V___]XPL
+LWX_Y_a____XXPXX____V__aaaaaaaa_]V\VVVT___aVXRTXXXX\]____a_a
+aXP\V___]aaaaXPTTXXWP]X]aaaaaa]]aa__]]______Yaa_V__YY_______
+_aaT___Y____aY______]____aaaaaXXX]]_a___]]\XR\V__aa_a_aaa_\T
+Y_V__OVVVV\_____a__Y_Y_X\VVVV___T_Y_YYTTVTa]aT]TTTJGJGMJTTVV
+\VVVVTTTTVTVTTTTTPPTT]VTTTTTTTMMM\\MTTTTVVVVT]TTTTTTTTT_VVaT
+HHHHAALFHHMM_TTTTTVVVVHHTTTTTTTH_YTTTVTVTRMSQQMK\V_MMMQ\RT_Y
+TTTTHWPPPLIVMVVYTSRMRRV__a]VVY___TT___H__TT_HHHHTXHH_TTTTTHH
+HHHHTT_YHHM\\VS\SVQNVV\MMV\RIVTTPJJOGGPHTT_]QQCIGM_XVX_\CD at 7
+7D?MVVAF9::996998:<<
+.
+frg:54
+clr:15,820
+}
+{RED
+iid:281
+eid:1086975789
+seq:
+AAGGGTCCCCTTTTTAACTATTCCACATTAATTGATGGCCATCCGAATTCTTTTGGTCGC
+TGTCTGGCTGTCAGTAAGAAAGCTAGAGTCCCGTTTTCGTTTCATTACCAACACCACGTC
+TCCTTGCCCGATTAGCACATTAGCCTTTTCCCCTTTTGCAAGGTTACTCAGTTCATTGAT
+GCTTAATGCTGGTCCGTATCTTCTGTCTTCCTTACCTATAATGAGAAACCCTCTCAAGAC
+GGCAGACTCCACTCCGGATGTGCTTTCATCTGGGTCTTCAATTAAAGTGCCGGCATCTTT
+TCCGAGAATTGTTAGTCTTTTAGTTGTCTTGTTGTAGTTGAATACAGGAGAATTGCCCCT
+TACAAGTATTCTCATCCCTGATCCCCTCACATTTACAGTCAGTGAAGAGAACTGCATTCT
+GCTTTGCTTTGGTGGAGCGGCTGCAAAAGGGAGAAGCTTTATTATCTGGGTGGTGTCAAA
+TGTCCCAAGTACGTCTCTCATTTGTTGGAATAGAGTTCTGACAAACCCACTGTATTGGCT
+TCTAATGGCCTTGGGGACTAAAGATTGAAATGGTTCAAATTCCATTTTGTTGTACAACAT
+TGCAGGATTCTGAGACCATTGAATTTTGACAGCTTCCCAATTTCTGATGATCCATTGATA
+GGTATTGACCAAAAACCGACTCAGGACCGTTAATCTCCCACATCATCGACGATGAATAAG
+TTATTGTCAGTCTCTCAGTTCCCTGTGTTTTCGCTAACCTCTTCAAACTGGCCGTATTTT
+TACAA
+.
+qlt:
+767666:9988;79:;7779>:879<98::>>><<<<=<@<@<C>CCMMMTIHABA at DBD
+LEHJEKQQKIC;:8776666677=;BIKLPXXXXXXXXKKCBDD at CFD@@BBSDD>999;
+;IGPPRPXXXLKIB=EGBDGJGEIa]VXXXRXXXXIJJKHHLKHGEKAF;;:<;EEJDDM
+MJJJLH>AHKAJGGBIBBIIKKKGGXPXIK]LSXMKKEDHMEEAEBGGHGGNILJNJHJJ
+JF@:9:FBMFFKKKXPRPXSXWXLDGDBBHFHJHHLMIF@@IIAFCGEGKGBBIBCGLLD
+DBB;;>?DEDBCC>GGKKXH?:99@=GLGIIIIBBIEEWKLKGA;>>DBA>B?EE]XDCF
+FF at CAG>BFCAF>>ADLLLPLLLLLLH@<<@@CEDHC??:;:BHH=;9>DA<CKKKKTKK
+KaKaKKHHH>BEBBBEGGBKaHGA==GMLHHHD<<<DCCLIILHGGKHHDDH?CLGLGE@
+?;;HEKA?A=?;<>GHDDEHDCI@<AAEIEBBCBEBCA==A at DCG?B<<=>BHGH<<HHK
+EEDDEG>>BDHEBKE@@=;?BB>>BGEEKFFFFCGHKLGLGCCBBGKPTJJCJCC==AAA
+E@?==>IHPG at A;9;??=BDA;;DCPHE>>>>=AIPLEEILHB==>BBGEEI@@99@<><
+::>HKDGA<<98A>A97<;<87:8AGK@>9979<BEDCC=>??D::<999:888:=8998
+8<<===?B8:8<>@==978=?C:999<97<999988999:767899:77899:98877<:
+7777>
+.
+frg:21
+clr:44,651
+}
+{RED
+iid:282
+eid:1086975812
+seq:
+ATCAGATTCGTCGACTGGAGCAGCTCAGAGGTTCTTTTTATGTTACCTCGTCTCTGCATC
+TTTGGTCATCGTGTTCAAGAAAAACTCTTATTAGATAGCCTCTCTTATTCACTCTTTGTT
+TTTTCTTCCCTATTGTTCTTTGTGTGACCATTTTCTTGGTCATGTTGTCTCTTACTCTCC
+TTTTTCTTTGAAAGTGTGTTGTTATCTCCATTTCCTCTTTATCCATTGATTCCATCACAT
+CCTTGAGGAAATCTATTAGCCTTCCTGATTCATTAGCTGTTAGTCCATTCGATCTAAAAA
+CTTCTATGGTGTTGGCTAATGCAGTTGCTGCCGGTTGATTTCTGTTTAATGTCCAATCAT
+AAGTCTGGCGACCTTGGGTTAGTTTGTCCACCCTTGTTTGTTGAACGACTTCCATTGTTT
+CAAGGCATGAGTTCTCAAAGATACCTGGGTGGGATTCTTCAAGGAAGGCCATAGCCTCCA
+GGACACAGTCTGTTTGTGCATATCCACTCGGCTCATTATCCTCAGGTAGTGGTCCATCAA
+TTGGGTTGAGTTGGGGTGCCCCAGTTTCTGTATTTGTCGTCCACTTCCCCTTCTCTGAAT
+ATTGGTGTGTTCTGTTGACTGTGTCCATGGTGTACCCTGTTCCTGTTCCATGGCTGTATG
+GAGGATCTCCAGTATAAGGGAATGTGGTGCTTATGGCATTTTGCGCTGGAACCTTTAGGA
+ACAGTAGAGTCGGATTGACATCCATCCAAATGGTTTGCCTGCTTTCGACTGGCCGTCGTT
+TTACAA
+.
+qlt:
+66666666666666668:8788B6677;89777<>CHEB;??>@=<=><?::ABGGGRRV
+V]RMEFFGGGWaXIH;=667798<<<<<9??GC=:B999FHPXRRM\JRMNHJVW?:666
+789;9 at DBFKVVRR_XXTTTXXRXVSRVSV\V__\\XRVSRVV\YaaXTPRRSVRMPSPX
+XY_X]RXWD;9>9?ELPaaRVPRVTRSMRRRV]aaaPVVSRRRXRRTX_TVVSVRSXT__
+Va]aaaXLMMSRJSSWWLIIaKaVRMRRVVVXXXXXLaPWPLPL]]_WTBBBIIRXX]XX
+PPXXXXXXaaTaV_XXRXRRXXXXX]aTXXXX_TaX___]_T_TVVVVVRPRRRRMRRXX
+PaKKaPaPJJHLKQSRSQHKLIM]]aMSVMMSXPXXXXWVWXLLXLLLPXMSSSSO]XTX
+XXXXWXXTXPSPXXRP]XXGLXXVRaaaaLLMMRVVRVRSRJNLXPXPXPKWLKGKKXPX
+LLPXXXXPLaPaTV__TVVXXTXXXRXTPaPPPXXPXWTT_CMMFFLLXLXLSXXXRXaL
+LaXLLXXXLLLM]VV\____]XPLLXXRXWRXTVTaaLLJLNSSRXTV\HPHPaPLMSRS
+IKWPPHTaTTTPPXaVMRSROa_\\\VV\_aX]XM\\V\\_aaaa]]RPSSRH\VPHHHT
+HLGGPPHXHPH]GHPHHHHAACECCPHHHHMMMHOCGGTTTHTHHGPPHVHCCKGCBD>D
+ at CDCDA99CAGC=CGXXHTH_HHHCDELKCHTHRHHHHHHGGHG?>>=GCCCCC<879;<
+<>:99D
+.
+frg:15
+clr:53,745
+}
+{RED
+iid:283
+eid:1086975874
+seq:
+GGGGCAGGCTTGGCAGCTACATGCTAAATTAGCGACAAATCCATATCGATAAAAAAAGCT
+TGTGAATTCAAATGTCCCTGTTTTATTTATATAGGACTTCTTTTTGCTCATGTTGATTCC
+CACTAACTTGCAGGTCCTGTAGAATCTATCCACTCCTGCTTGTATTCCCTCATGATTTGG
+TGCATTCACTATGAGGGCAAAATCGTCGGAGGATTGGAGCCCATCCCACCAGTATGTTGT
+CTTGGTGTATTTCTTTTGCCCAAGATTCAGTATTGAGACTCCTAAAACCGTACTTAGCAT
+GTTGAACATGCCCATCATCATCCCAGGGCTCAATGATGCTGTGCCATCTATTAGAAGAGG
+CCTTATTTTCTCAATTTTCTTCCTTGTTGATTCATTGAAATACTTCAGGTCAATGCTTGC
+TAGCATTTCTGCGGGTATTTGTGTTCGGAGCTTCATTCTCTTACTCTCGAACATGTATCC
+TTTTCCTAGTCTTGCCATTTTGTTTGAGAACATTATTGGTGCGATGCTCAGGATGTTTCT
+GAACCACTCAGGTTGATTTTTTGTGATATATGTAATCATCGCCAAAAACATTCGAGGGTT
+TTGATTTTCATTCCACTTAGTGTTGTCCCCAGTGATTGTGAAAGAAAGCTCAGTGTCTTG
+TGAATTAGTCATCATTTTTCTCACAACATTTGCCAGTTTGGCCTTCTTTTCATTACCCCC
+AACCGGAAGTCCAGACTGTTCAAGCTTTTCGCAAATGCTTCTAGCTAAAGTTTCAACGAA
+GTACACGAACCCTCTAATTTGCATCCCTGGGTGTTGCAATTGACTGGCCGTCGTTTTACA
+A
+.
+qlt:
+76666666779666696777;=C<<99<<=<<877<;CFBEEC?@B<:@@FFGGHGGGBB
+==FACIPOPOILCFDEDHNLMQMV]\\\]SMQQOQOX_Y_aaa\\VJPKMEH]OSRVVVR
+SVVV__VaVXVX__]aaRXXLDDPNSVVSSQKKKM]aaVVVVV\V\__VRRVSMTX_VaV
+XP\\VVVRSVVVRRVVY____\XXV]]SMMMSV\VSVPX\]]XP\SVVRRRSSXTV____
+V\PPXXMRMVVOPP\VV_]V\NLGGNKR]XSXXXTPLLXXT]RX]]_______]]TPX]X
+X]a__]XXPVVV]_]__VX]XVXXXX]a_VXXXRRXXXVPaLHPPVVIXRKJA<:D;DM]
+\________TXT____aaa__VVRRTV___]]V_V]X____V_]_____Y_XXPXXaV_X
+XWXPXX_\XPXVV_V___V]XXXWaaaaaaa____VVaaT__]VRaTLLWWTVVX__Y_Y
+a____WTRXXWWTTV\YX]Taa_TTPLEDNLV\VW]aaaPaXXXXXTTT]XLPTTTaTTT
+LRWT_TTHHR]aaTTTTTTTTHPHPPRXTT_VTTTHHHPHPHHTTV]]XHHXHLLTTVVT
+TTTTTTTTPTHVTV\THHaGGHPHHHHTT_HGEHGSHHHHHTTGGTTLLHGCHBJNHTHG
+GCCCLHHKEKTTTTTTT]PHPTTT_HHHHTHPHHHHPPCCCCCCHTTTMHCCCHHHTTTH
+HHHGHCCEECKXHTPLLTMEE99 at ATTTTHGGHHHHHHHHKG>>@==GCGHHA<97:<>G
+C;BBAG99ADCCKHGGBBHAACEHD?766<:<CKHHCDD;;9;B=AKDCA:776788;77
+@
+.
+frg:18
+clr:70,800
+}
+{RED
+iid:284
+eid:1086975866
+seq:
+CAACGGACAATTTTTTTCTGAAGGACAGCTAAATTCATTATTTTTGCCGTCTGAGTTCTT
+CAATGGTGGAACAGATCTTCATGATCTCAGAGAACTCTTCCTTCTTAATCCGTCCAGACT
+CGAAGTCAATTCTGGCATCAATCCGGGCCCTAGACACCATGGCCTCCACCATGCTAGAAA
+TTCCAATCGGTCTCCTATATGAACTACTAGGGAAAAATTTCTCGAACAAGTTGCAGCACT
+TTTGGTACATCTGTTCATCCTCAAGAATTCCCCTTTGGCTTGTGTTGAGAATAGAGCGGT
+TCCTCTTGGGAATCCAGGAGTGTGTAGTTGCAACGGCATCATATTCCATACTTTTGGCTG
+GACCATGAGCTGGCATCACTACAGCATTGTTTACAGACTCAATTTCTTTATGGCTGACAA
+AGGGATTCAGGGGGTTACAAAGTCTTCCCCGATAATTCTCATCCATTAGCTCCCACTTTA
+AGCAGACTTCAGGGATGTGAAGGTTCCGGATATTGTATAAGTTTGGTCCCCCATCTGATA
+CCAATAGTCCTGCCCTTGATTGGGTTTGATCCCACAGCTTCTTTAGCTCGAATGATCTTC
+TCGTCTGAATTTGTGTGTCTCCTCTATGGCACCTATATGTATATCTGTAGTCTTTGATGA
+ACAATTGGAGAGCCATCTGGGCTGTTGCTGGTCCAAGGTCATTGTTTATCATGTTGTTCT
+TTATCACTGTTACTCCAATGCTCATATCAGCTGACTCGTTTATTCCAGACACTCCAAAAC
+TGGGAAGCTCCATGCTAAAATTGGCCACAAATCCATAACTGGCCGTCGTTTTAAAA
+.
+qlt:
+<6666976666A<CA<<888B@:<<<88@@77BBBC>DAKRSC@@BIIOQGNCGHTT_JP
+PFFEFORMKKFB<97=99:87::MHKHNJHKEEMGPJaa]aaa\V]]]\___VNHE=;CC
+D?LWK\VVV\\\V\\\VVV]\V]_aa_YX\HNDDNN\VRVVaV_RSV\V\VRSWXWLJOO
+VRRJOPPaaa__YY__Y_T__X\SRVMVXXXV\_VVRS\VaaRRRRV\\\a_]]RRTXX_
+__VV\VVVVV__aVVVRS\VVVMNDDNPS\_TY___VVXXXLPPWWPLJJPMGJLTXXV_
+T___aT_aTT_TV\\ROMPXPXPa]XXV__________]]]PTVV_V]___aaa__WXPX
+XW__\VVSX]WX]\V_T___VXT_XVX__Y__XTWPPXX]]XXaaa]XV\VV\]VMSRRV
+_aV\\\VV___]]____]]__aaaaaaTa]RRRX]\_Y_Y_____]]aLKaW]_V___TT
+TPXXLLXXT__XT]XV__aa]]_Y\\PPLLW]___]]XPXaT]R\\\\T]___aTTXPPP
+T]_WXa]LaTTT_____VVRXTTT_]THHHXTT_THHXTHT]XHHHPaLLXTLRXXXVRa
+aaVaaaX]]T___HH__TTPHaHVVRGHRSHTTHHPTTHTVHHHVRHXHaaaHTHHHHHT
+THHHHMGLLGTXGGDBIH\TT__aHHHHRGGNSCHXH\TTHT_T__VTTHPLaTTHVY_T
+]HHTXXLX]XHTXKKHRRSXT\V]PGGGHGEHHXHHHHCC98>><>;==CCEECCLTWHG
+E==?;AAHAACGHPX@>99@@==C>>::>DHFC?<7888877<8977767=;>;>B
+.
+frg:69
+clr:19,793
+}
+{RED
+iid:285
+eid:1086975913
+seq:
+TAACTTTGGGAATCTGAATAAGCTTGCCACACTGCCCCGTTCGGTTCGAGTCCATCCTGT
+AGGCTCACAAAAGAGGGTAGGAGAAGTCGGCGGAATATTTTGGTCGGAAAAAAAACAGAG
+AATTGCTGAGATTTCAAAAATTTCTTCAATTGTTTCTTCGCCTCTTTCGGACTGACGAAT
+GTAAACAAGGGAGCCTCTGTTGGCCATTTCTTGTCTTATGGTAAATAGCCTGGTTTTAAT
+CCTAGCTCTGCTTTCCTCGTCGAGAGTGTAGTCTGCCTTTGTGGCCATTTCCTCCCCAGT
+GAATGAGAAAATGTGAATGTGTGTGTTCTCAGATTTAATTTTATTGGCCTTTTCAAGGTA
+ATATATGTGGACTTCTCTTCTTGTCACTCCAATTTCGATGAATCTGTTCTCCTTGTAATC
+ATACAAATCTGGTAGAAACTTCGGTTTTTCAGCTCCAGTAGTGTTGCAGATACTGTTTAC
+TACTGTCCAGGCCATTGTTCTGTCTCTCCCCTCGATTATTTCAAATCTGTGCTTTAACAG
+TGCATTTGGATCATCAAGTTCTACCATTATTGATTCGCCTTGTTCATTGATGAAATGAAA
+ATCTGAATACATGAAACATACCTCCAAGTGGGTGCATATTGCTGCAAATTTGTTTGTTTC
+AATTTTCAGATCCTCTCCATACTCTTTCATTGCTTTTTCTGCAAGTTCGACAATCATCGG
+GTTGAAGCATTGTCGCACAAAATCTTCCATTTCAAATCAGTACCTGCTACTGGCCGTCGT
+TTTACAAA
+.
+qlt:
+6666;777799977787777997778799777777;:;:;D777767:7>9899999799
+:B<>9999:96666666676:869999:999999999999;9@;7986666686966977
+99999=;=997;<B;9;999FHV]SSOQPGaaTaa_]]LXPWW__WXXRM\V\VXXG?:7
+66666676667:<DDaaPP]\VVTRRPXaa]]T_V\VVSSPRX]XXPVPT]_V\SS\\VV
+_W]WPPWW_______]]RPMKBAIILLNKGLLPXVXT_TXRXRSRVRM\V___V\]WLLX
+PWXWXGLLPLVVRV_WWRXXTaPXVTXLWXLPPXX___]a____V___Y__V\VROMLTX
+]LXXX___VV____VaaaaaaPXPXXXXTXX_]aaK=BWKSXWVVPXXXX\_____]]]X
+XPXRP\VaaaaXLGGLWWXPXPa]a__M\RSIRTWXLPKJ>=KWLKWEDHGHXXLPPPXX
+____a\VVVVR]PXRXXX\a_HTaaaPPXWXRRMMMN_XTPPR]WWLLaaa]PRXWT]XR
+PTPX\VRXXXVVVTXVX_T___]]TXX\XTV_TXHLLPWW_VTTXPRMKHHKP\VVVVT]
+XXPXXVX]PLHMKSRSLLGLTTMMISMKMVVGRXHT__TXWXMSIRVV_HHHHWMJLHKS
+MRR]HBB;<@IJTGGLLHMMMHSXXHTGGLHHC>B<:D at C>8>F:=DGA=@@:<ABBGKP
+TIKDFC@=7:B<FGIA<<77CCPHOE@@:77789<><@9999C@?IABCDAAFCHAAAC=
+CC@<99:;
+.
+frg:78
+clr:194,746
+}
+{RED
+iid:286
+eid:1086975863
+seq:
+AAAACGAGACTTGGCTTATCTGGGGATAGTTGAAATCGTCCATTGCTGCACAGGATGCAT
+TGAGCAGGGCAGTATTAATGTATACCCCCTTCATTATGTACTCAGTGGCTCTACAATGGG
+ACACCTCTGCTGTGAAATAATTCCTCCTCATGCTTGCAATGTACTCAATTGGGGCTACGT
+CCTCTCCAATTTCATCGAGCTCTATCCAGATTGAATCAGTTAGCTCGCAGGCCTTGTTGA
+ACTCATTCTGTATCCAGCTTGAAAGTGACCTTAATTCAGGTTCGTCACTATCATATTGCT
+TCAAATCGCTTATGTCTCTGCAGTTGTCAAAGTCTACTTTCTCTGGTGCCATGTTTTCAC
+CAAGAGCCCACTTTAGTTGACTCGTTTTCTTCATGTTTTTAGTCCTTGGGATCTTCTCCT
+CATTTTCAATGTCCTGCAATTCTGACAAAAATTGCTTCCATGACAGCAGTTAATTTGAAC
+TTATTCCCCTTTTCGTGTGGTTTGACTATATAGGGCTCGTTC
+.
+qlt:
+9697666668:9977777697799B77788@@@@799<<<=<?CB=:<>>=E at BDGDEQQ
+GNMHHLLIG@;778779779@;BIJMaaVMNMJQGMMMFFL>FAE at DKDCHNE?<9<=:<
+>IGMMXLXXXXXSRSRRRMLLTWRPPMMMMRJPXXPXPXLLLLXPRTHXVaTXXHJIFKK
+XPHHLKHEGGDGG><<?BFFKFMMLKKECCMMLLK<<:::>=;<>>GD<<BEAHA>AAAK
+KLJJLKIKKIHJEDGGIAGKLXJRIIGDGGIEDGDCCFDDPaGXPKKDGWMLHGLMMMLL
+GGAAAGILGPKXDEMGGXIJJJCCD?B>@@=ABLIILLPXXIGBAGDDLJMMaWXPGDEE
+A@?;;?>A at D>=;;978;=EG@;=<<GMXEDDDDDPNKAC==<@BGA=MEBLGLLDEMKI
+AA?AFDEFEAA=:<<?BCBBH=;79::97999=DKLFEAF==<:9966666667::<999
+98<9?@CEEAA?@AC<<8997@;=<@=C;8868999;668=<
+.
+frg:61
+clr:52,459
+}
+{RED
+iid:287
+eid:1086975825
+seq:
+CAACGAGTACCTTTTTTTTGGACGTACGGGATACAAATAGTAGCACTGCCATAACTATTT
+TAATGCATGTGTCAGGAAGGAGATGAACCAAAATGCATTGAGCAAAACCCAGGGATCATT
+AATCAGGCACCCCTCAATTGCTTCGTATAGCCCCCCGAGATCAAAGGTCCCAGGTTCGAG
+ATTGTCCCTAAGAGCCTGAACAACAAGAAGCAGTTTTCTTGACTCCGCTGAAAATCCTTC
+CAATTGTGGTGATGCATACAGGCTATTGAACACTGACTTAGCCAAAAGAGTCCTACTTAC
+TTTCCCAATGGAACTGTCTTCCATTCCCTTGGGGGACTCCCCAATGGGCCATGCTTCTGA
+TTTATTCTCAAAAAACTCTTTGGTCAGGTCTTTCTCTTTATTCGAGGACTCGGCTTCAAT
+CATGCTCGCGATCTGCTGGAGTGACTGAAAGAGGCAACCTCGCACTCCTTTTTCCATTTC
+ATTTCGACCTTTGAGGTTCCGTTTGCCACAAATACCAG
+.
+qlt:
+666767677999;;99<;99999999:9=77999:=:77<<::=;<>?LCB@:@AGHMJJ
+C?B<<@@>BA>@@;99<87666699=:><@@:?@@AACHHC?AGJLMMHMD>><:<;:97
+79::<<@F<?9=:@=@BEIKC::9=??@<ABFKKC<===:BHDDHHLLLKLBBA<C;<<G
+HCCKGLGHB9789999>;D at BGGEGGGGKEGLLLa]]KKGGG><BH::@@DFEBBGDGDB
+BGBBLCCKGAHFAB:<9;=ACEBBCHHDADDLLELLLMGAA=:;99:7;A at DB<<:99:B
+DLGB@<<<;9<=;999;=LB;9999@=>:9>@LLPLLHG><CFDABG@?<=CA@;@9=<B
+>@??;<9999?DBGGGI at B:<=99<979:;EGLLILGB:99::87:9:9979<DAD><:9
+79:GDB:@=B=;;;:>:B<:9;<;@:;:;9<;;;<<>;9;99:::><=?9<97669<<CC
+<999999;=999=B<9999=:<=B=999977:99:998
+.
+frg:50
+clr:161,280
+}
+{RED
+iid:288
+eid:1086975888
+seq:
+GGGGGAGTGTTAGATTCCCTGTGCTGTTATCAAAAGTATGTCTCCCGGTTTTACTATTGT
+CCAATAGATGCTTATTCTGCTGGGGATATCCCTTACCCTGGGTCTAGATCCGATATTCGG
+GATTACAGTTTGTTGGCTTCTTTTGGTAGAGACTGTGATTCTTCCTGATGCTTGAGCATA
+TAGGCTGATTTGGTCATTGTTCGTACCCGGGTGGTGAACCCCCCAAATGTACAATTTGTC
+AAATTTTTCATTGTTTGGCATAGTCACGTTCAATGCTGGGTATTTGAATTTTAAATGGGT
+CAACCAATTCAATCTACTAAAGAAACTGTTATTAGATCTCCTTTTGCAAGCAGAGCTTGT
+TCCATTTTGAGTGACTCCAGTCCAATTGAAGCTTTCATTGTTAAACTCCAGTGTGCCGGA
+TGAGGCAACTAGTGACCTAAGGGAGGCATAATCCGGCACATCATAAGGGTAACAGTTGCT
+GTAGGCTTTGCTGCGTTCAACAAAAAGGTCCCATTTCTTATTTTGGAAGCCATCACACTG
+AGGGTCTCCCAATAGAGCATCTATTAGTGTGCAGTTTTCTCCATCAAGGATCTGATGAGG
+ACTGTCGCATATTCCACCTGTTGAGGAACTCTGAACCAGCTCAGTAGCATTAGTAACTTC
+AATTTGGTCATTCGTGATTGTTTTCACTATCGTTCCGTTTGGTACTGCATGGTGCCCAAG
+GCACAGCGTTGCCGTGCTGTTGTCATTTCCGGGAAGTTTTTGAGCGAAAACCAGACATAG
+AATGTAGCTCAAAGCAATGATAGTCTTCATGGTTAATAAAATTATCCCCTGCTTTCGACT
+GGCCGTCGTTTTACAA
+.
+qlt:
+66667776677779;8B77=ACC at AAC?<><?<>FE?C at EA@EIMMMS]GMHSRPMMHJD
+AIHGEQNQNNRLMMIHJJLNRXaJMPSSRROa\V\\V\RR\\V\\VRRVNMLLOMV\VaL
+GGJNPVVV\aa_]VVVVVVV__]__XP]LGJKRSMXXX\_]_]V___V___a]]PPM\VV
+VVV_]XT_____VVVVVVV]a]]RV]__a\\RP\XT]]_______T_VTX]]___]]VV\
+RRRV]]\\\SSVRa]___T]XLXLPXPTX__]]LX]aR]MVRR\VRRVVVMSVOOPXXXY
+_____Y_V__\VXPXXXXXW]LL]XXRXX_TWKCCGWXVaaa]VXR]]RRPXGGPPTPXX
+VTXX\\\WXPPLMMVMMOMMSVV\VVVXTPPLWSRSRMRXVXX\]RTXXTXLaaa]aTLL
+XXPTX_X_TTXLLMNVSSaaa]TX\X__]XXa]aTa_TXXR]XPXLLXXXTV]VRR]]RP
+XXXXXTa]a]a]]a____]]XRV\]_XX_XTXSS]aPR]TT]\TPXTLPT]]]]XPXPPR
+MSV]RXXXXXT]XLGGXXTVTTVHPaKBKWWRXXWTWWRPXT__]]RHXWTRSRXWPLMC
+HMILaPPPHHV__VTPPXXTHTPPPSHIHHVRPVXXWHLL]HGaCBHHHTXGLHPPRTWT
+THXXaT]VRHGSHPEGXTHTTTXMJQQNMQVaV]KCCRRXTHXHHPPHHLLTPaWWHHHH
+RRCKLCHHTHGHCC;AADWHECCCECH?8<77<<B;77EDFCA;;=F77@<@9=8<8:9>
+AB@?<7<=><?D@>99<AGCD?77;?BBG=GHLHGABBHGE==B<>LA=A=?=DA9:BB?
+?=<<897777787767
+.
+frg:74
+clr:35,813
+}
+{RED
+iid:289
+eid:1086975841
+seq:
+CAATATGAAGTTACTTGTAAATGCTATGCAACTTGCTTAGTCCCCAGATGAAATGGAACA
+CCTAACTCATTCATCAATAGGGACCGATAAGGGGTCCTATCATGTACTGTGTCATTTGAA
+TGCACGTTGTTTAGTGTTGTTCCCTGTCCAAGGGCAAATTGATAACATTTGTCAGGATCG
+CATGACACATAAGGTTCTCTTGTCACCCAGATGTCCCCACCAGCGGAAAGCCTAATCGAA
+TTGTCCTTAGAAAAAGGTGCAAATCCTGTAATGTCACATTGCGGCTTTGACCAATTTCTG
+TATTCTGCTAGTTTGGGGCATATTTCCTTCTCTATGGTGGTGTTGGTCAGATACACTATC
+TCTGTTATGTTTCTTTCTATTATTGTTGGTTCACACAGCATCACTTGGTTGTTTGGGGGG
+GAGTTGAATTCATATTGCTTGAAATGCAATGTTACAGTAGTTATCAAGATGGCAATTTGC
+ATAAAGAAGCATATTGTGGAAATGGTGAGAGAAACAGAGCCAATCGTTATTATCTTTTGA
+TTTGGATTCATCTTTACTCCTGCTTTTGCACTGGCCGTCGTTTTACAA
+.
+qlt:
+6677776777699797666789:88<?>B77<DHGCCCFFFKCCKCCGQJCAA at BHJPSJ
+JOVVVMMHILMPJB at 9998<7:679:>CHHLLPXVVVV\SNQQOSV_\\RJNNMHFDB::
+799:@EJLSQMOHHAHPR_]]VX\\VKMHPJIXPXXV]____Y___\VVaXXX]TPVVRS
+SVQQKMGJJIKB at BHHW_T_VVSSSRMPLGGPP__]]XXPWKBBKFJPTVMRRVLHLXXP
+X\X_X]XXXLLXWXSSSRSMXRXXVXa]VXVRR]XRR\\V]XXVXXVVVVVVVRRV]TLL
+PX]XXPXKKWKLaaaVTXXX]W_TaaaaXXIRHLGGLLPTTTXPPXPGB;;JJXPXVT__
+__XWLLTX_WWRPRPR]]TVXVWPXXW__VV\\\VKMJJJJTXXR]XXRXaaaaaaaRaX
+PLXPXXPWMMMLLNMSRXXa_VRRRMHPX\XIMKHKDLKKCKKXJJ<<GMGLPLLLXPTX
+\PRXXLLGLLPXPPXLaLLXXXXTHHGEGLEDHHPLLLLPPKGLCGGLPLLWWXXVT_Y_
+TTTJHJKLSMLCE::=@HXLLaaaTLLXPIHHGMMLHMED at B<<@CFF
+.
+frg:37
+clr:21,547
+}
+{RED
+iid:290
+eid:1086975883
+seq:
+TGGCAGCATTTTTATTACCATGAGACTATCATTGCTTTGAGCTACATTCTATGTCTGGTT
+TTCGCTCAAAAAATTCCCGGAAATGACAACAGCACGGCAACGCTGTGCCTTGGGAACATG
+CAGTACCAAACGGAACGATAGTGAAAACAATCACGAATGACCAAATTGAAGTTACTAATG
+CTACTGAGATGGTTCAGAGTTCCTCAACAGGTGGAATATGCGACAGTCCTCATCAGATCC
+TTGATGGAGAAAACTGCACACTAATAGATGCTCTATTGGGAGACCCTCAGTGTGATGGCT
+TCCAAAATAAGAAATGGGACCTTTTTGTTGAACGCAGCAAAGCCTACAGCAACTGTTACC
+CTTATGATGTGCCGGATTATGCCTCCCTTAGGTCACTAGTTGCCTCATCCGGCACACTGG
+AGTTTAACAATGAAAGCTTCAATTGGACTGGAGTCACTCAAAATGGAACAAGCTCTGCTT
+GCAAAAGGAGATCTAATAACAGTTTCTTTAGTAGATTGAATTGGTTGACCCATTTAAAAT
+TCAAATACCCAGCATTGAACGTGACTATGCCAAACAATGAAAAATTTGACAAATTGTACA
+TTTGGGGGGTTCACCACCCGGGTACGAACAATGACCAAATCAGCCTATATGCTCAAGCAT
+CAGGAAGAATCACAGTCTCTACCAAAAGAAGCCAACAAACTGTAATCCCGAATATCGGAT
+CTAGACCCAGGGTAAGGGATATCCCCAGCAGAATAAGCATCTATTGGACAATAGTAAAAC
+CGGGAGACATACTTTTGATTAACAGCACAGGGAATCTAATCGCTCCTCGGGGTTAGGTCA
+ACTGTGTGTTTCCTGGA
+.
+qlt:
+6666666689?:::==:>:<:A>>>?GAA>?EBJSSa]TRC@=9CBMQQMMFMNNIIGER
+SMOOMJEC996666777666<9?CEHLD>999>JX___Y_Y__aaaa_XK=86668699;
+9>GHV\\\S\aVV\\\VV_YY____X\]VV\_VVXaTVVVVV\S\Va]aaV\\\\\XRVV
+RCF::66669::;9;9>DWX______V_YTV\VRRS\V\__YY___Y_____VXTRRWX_
+aY_TYXVVX______YY___YY_VXXXRV\_Y_____VaaVS\\\\VVTTLaXV_Y__a_
+\V\\X]_VWTXXXW_Y______a]]]a]___________]___V_______V_T______
+_\_______Y__V_VV________]a__Y_______V__Vaaa_________Y____V\\
+\]]__]]Y___aaaaVa____\\aXV\_Y_aa_________VV_________a_]a]aa_
+____]]aT]XR]]__________aa__]]VXXXLLXX_Y______V\\\V\_________
+__Y_________Y]____Y_________Y___YY_Y_aaaaXVVKSM___VVTaa_____
+HHVVTV__________VVV__RORLLMWVY_Y_______V\RRRPX___T___V____YV
+VVVXW]RRRRV\YT_T]a_Y_YYTTT_VTT_V_VYYTTHT_TTY]THHHTRMVKKHHPXT
+H]VYT_TTH___THH_V\VO\\\V\X]]VTMPOOPMTSP]]____VVV\V\____Y___\
+S\QQS\VSR\VV\_aV\VMKVV\VVV_____V\\VX\MHG<=GHVVVLKDGNHVVS\E?9
+8:9899999::7667:>
+.
+frg:74
+clr:13,814
+}
+{RED
+iid:291
+eid:1086975864
+seq:
+CCCCAGAAATTAAATGATCCAAATCAAAAGATAATAACGATTGGCTCTGTTTCTCTCACC
+ATTTCCACAATATGCTTCTTTATGCAAATTGCCATCTTGATAACTACTGTAACATTGCAT
+TTCAAGCAATATGAATTCAACTCCCCCCCAAACAACCAAGTGATGCTGTGTGAACCAACA
+ATAATAGAAAGAAACATAACAGAGATAGTGTATCTGACCAACACCACCATAGAGAAGGAA
+ATATGCCCCAAACTAGCAGAATACAGAAATTGGTCAAAGCCGCAATGTGACATTACAGGA
+TTTGCACCTTTTTCTAAGGACAATTCGATTAGGCTTTCCGCTGGTGGGGACATCTGGGTG
+ACAAGAGAACCTTATGTGTCATGCGATCCTGACAAATGTTATCAATTTGCCCTTGGACAG
+GGAACAACACTAAACAACGTGCATTCAAATGACACAGTACATGATAGGACCCCTTATCGG
+ACCCTATTGATGAATGAGTTAGGTGTTCCATTTCATCTGGGGACTAAGCAAGTGTGCATA
+GCATGGTCCAGCTCAAGTTGTCACGAGGTCATAGCTGTTTACTGACT
+.
+qlt:
+66699999998>;77:<<<<<<:8:877=<EGF>LEHHGGEGGGJJVX__V_VXJJMLGG
+GLGGGIGGGQGIOAC766667=:=>@HFRSKHHPJJaVVMVVVVVMS\aVRRVMMDC:9;
+A?GEEHPXXXVV___VOMLJMaaT_]RVVVRRRXRXXXKKCLKLLXTTaaXXVTXRMMSR
+RMWXPGGCD>9999:=DGKLKKCEEKLPLPPXXVVRPXXXXRXXLLLXXXLLLLaLLKNL
+SVSMTVXPRXXMD@=;9??IXXTWRRPWXXTPPRXPPLLXXXRPXXXRXXTVRTXPLLJL
+NVVXRP]PPPXPKDDKGHHJJSMKJKK at MMLLEaaPHJJSRRRPPLaSMRSRMXPaTXXL
+PWPLLGPPWWVPXXVRPXXXLLWPLLPPXXPPWXTXPXRPXPLLXXPaPLLPaTSLIGDJ
+JKKMKJLLLPPSSTXXTPaRRXTXXXWVXPXLLKKLLGXXLHRHJC=9>>AABDKJLGLG
+LTXXRPPPPXPSRWXXLLGLLLXTXXXPPXXXWRRXPLLaHJSVMMLPaaPaaaKL]WWL
+IIXWXRXXXGGMKKLLGLXPSKKB=GCC<=?CEBDMKKD:=9::7:7
+.
+frg:37
+clr:17,544
+}
+{RED
+iid:292
+eid:1086975889
+seq:
+ATCCAACGTGGATCTTAATAACCAAGTGGGAAGCCTCATAATGAGATCCGATGCACCCAT
+TGGCAAATGCAATTTTGAAAGCATCACTCCAAATGGAACCATTCCCAATGACAAACCATT
+TCAAAATGTAAACACGATCTCATAAGGGGCCTGTCCCATATATGTTAAACAAAACACTCC
+GAAATTGGCAACATGGATGCGAAATGTACCTTAGAAAAAAACTAGAGGCATATTTGGCGC
+AATCGCGGGTTTCATAGAAAATGGTTGGCAGGGAATGGTGGATGGTAGTCACTGCTTCAG
+GCATCAAAATTCTGAGGGAAAATCAATTCAGCTGATCTCATAAGCACTCAGGCTGCCTAA
+ACCCAAATCAATGGGAAGCTGAAAACGTTGATCGGAAAAACCACCGAAAAATTCCCTCTA
+ATTGAAAAATAATTTTCAAAAGAATAATGGAAAATTCAGACCTCCACAATTATGTTGAGG
+ACACTATAATAAATCTCTTTTCATACAATGCGGATCTTCTTGATACCCTGGAGAACCACC
+ATCCAATTCATCTAACTGACTCAAAAATGAACAAACTGTTACATAGAACAAATAAGCAAC
+TGAGGGAAAATGCTGAGGATTTGGGCAATGGTAGTTTCCAAATATACCACAAATGTGACA
+ATGCCTGCATAGGGTCAATCAGAAATGGAACTTATGACCATGATGTATACAGAGATGAAG
+CATTAAACAACCGGTTCCAGATCAAAGGTGTTGAGCTGAAGTCAGGATACAAAGATTGGA
+TCCTATGGATTTCCTTTGCCATATCATGTTTTTTGCTTTGTGTTGCTTTGTTGGGGTTCA
+TCATGTGGGCCTGCCAGAGAGGCAACATGGGTCATAGCTTGTATAATGCCCTC
+.
+qlt:
+68976667989776679<9999997667:9<7799;9997:<9989<7999;<::<<==;
+9<9:<:9:9;9:798997768=:@ABLCFCF@@:;<<99@??A<<:<;<@><<<A=;9=@
+;=<DELIGDEDCGG@@<:9999999<>@CGGHA=?;:999<B=AGD?>>D?<=>B:999<
+;=@G?A::9:7999999999999;99C;:999999:9=9>=?=>A=<<@==9999:99>>
+<;99999=EH;;>99999;99<>99999<<HH=>DDBDIBGC<:9:;=;9:99979;999
+;<9=<:;>DDGG;;989=<=99799999::99799?;<9=79999:@=;99979999999
+99>99999:9<;B=BAAF@;<<;<99<<9<HHH:9;>>;89:999<<BBGA==A<::969
+9>>CBH<9:::<:9999<@:9999::9899999@<<:::<:;:99999:<<=::::<B==
+C==?>=99;AAAAA><997999:=??:999999979::<;=9999<;:=999;:>:99;9
+99999=@<:=99=<:99:==99999;:<@99799D>B:99999:<;:9999979=:<88B
+<;?;>AA>ABBA>@999<=;<9778<99@::<::<>:8:9999:9;;<@AJSaPTGGLCC
+EGKKGKKCCB at B;?@GGLKG=9;9:<<ACF=<>=?9=B at CECAHHHABDK>I>>?::99=
+=BED?99BBHGGBBGGGE<=78;@=;=9:8;77779<87;:>=>B=?>>><<:98;;777
+ at G@@>97<98<89A=D<77;777:897877?87789:>=>97;;<;@?:99=?G>8:888
+:79989;>=:999979766679:87999:699999:9799999979<<<6996
+.
+frg:3
+clr:650,689
+}
+{RED
+iid:293
+eid:1086975824
+seq:
+AACCAAGTTTTAATCCTCACTGAGTGACATCAAAATCATGGCGTCCCAAGGCACCAAACG
+GTCTTATGAACAGATGGAAACTGATGGGGATCGCCAGAATGCAACTGAGATTAGGGCATC
+CGTCGGGAAGATGATTGATGGAATTGGGAGATTCTACATCCAAATGTGCACTGAACTTAA
+ACTCAGTGATCATGAAGGGCGATTGATCCAGAACAGCTTGACAATAGAGAAAATGGTGCT
+CTCTGCTTTTGATGAAAGAAGGAATAAATACCTGGAAGAACACCCCAGCGCGGGGAAAGA
+TCCCAAGAAAACTGGGGGACCCATATACAGGAGAGTAGATGGAAAATGGATGAGGGAACT
+CGTCCTTTATGACAAAGAAGAAATAAGGCGAATCTGGCGCCAAGCCAACAATGGTGAGGA
+TGCGACAGCTGGTCTAACTCACATAATGATCTGGCATTCCAATTTGAATGATGCAACATA
+CCAGAGGACAAGAGCTCTTGTTCGAACTGGAATGGATCCCAGAATGTGCTCTCTGATGCA
+GGGCTCGACTCTCCCTAGAAGGTCCGGAGCTGCAGGTGCTGCAGTCAAAGGAATCGGGAC
+AATGGTGATGGAACTGATCAGAATGGTCAAACGGGGGATCAACGATCGAAATTTCTGGAG
+AGGTGAGAATGGGCGGAAAACAAGAAGTGCTTATGAGAGAATGTGCAACATTCTTAAAGG
+AAAATTTCAAACAGCTGCACAAAGAGCAATGGTGGATCAAGTGAGAGAAAGTCGGAACCC
+AGGAAAGGTGAAAATCAAAAACCGGTAATACCGGTTTCCAGGG
+.
+qlt:
+:66666766777888:::<<=F>>>B>@<?@@D@@DBB?>LJQQLMPPLLRRNLQQGK__
+S\\SMMLLJKMFFA<<99>>MHQQQRSHKKJNK\SRVV\VVVVVOV\QQQQQKMGMXRVV
+_aaYa__V\RRV\\V\VVXPV\\\\V_aVMSSVVVV\VVV\V\V___YVVPXV__XT__Y
+_ROMJMMXTV]TTVaaTaa_______\XWPPLX]X__a_OVVVRSLPa]X]]_VV\PRXV
+___YYVYY_____]____V]T\VVV\\___Y_]YVXPSMVVRM_\aPaLTT]a_YVTPPP
+]]_TXVRXXX]__V__\VV\VVRR]]\PPX\VXTTVRRR\VV_VO\RRVVXVXaWXT_XT
+LaP]T___XVXP]]]]LKMD?JJVMST_VTV]\T_V\XRXTTVRPXT__TVXTaaPRRVV
+RRRX____]]]]T_]XVXXXXXXT]aVTT__TXWXRWRVVVV\aaXRVV\VVVVXX]_VR
+IMKLFMLXX]XXLLLX]__aaXPXLLJMMRSVXSMV\VLXIILXTV____VX_T\\XTX]
+]aaLLLLPXTTT__XWTXPXT_VVTTaPTXT__V_aaaaV\TTPPTTTTT\KSHIVCVVO
+VR_T_OVVVVM_TTTT_TTLLWWXT____T___aaHHKKHHH\\VKHHPTV__TTaTTTT
+HTTHTRRHKHHKHV_YY]TPXTHHXPXTTT\HHTXLPPTX__T_TT\HHXTT]Y]TTHHH
+TKHHKVVTHXHHHaPXWWLPTWVHHHCHCEGNTVHHHHV_GRSLMSSKKHVVTTECHKKH
+HH>?<<=99;99:87777<<99:::79779:99777=7666:8
+.
+frg:49
+clr:16,781
+}
+{RED
+iid:294
+eid:1086975773
+seq:
+GGGGTCCCGCTGCCAAAGAGCAATGGTGGATCAAGTGAGAGAAAGTCGGAACCCAGGAAA
+TGCTGAGATCGAAGATCTCATATTTTTGGCAAGATCTGCATTGATATTGAGAGGGTCAGT
+TGCTCACAAATCTTGCCTACCTGCCTGTGCGTATGGACCTGCAGTATCCAGTGGGTACGA
+CTTCGAAAAAGAGGGATATTCCTTGGTGGGAATAGACCCTTTCAAACTACTTCAAAATAG
+CCAAATATACAGCCTAATCAGACCTAACGAGAATCCAGCACACAAGAGTCAGCTGGTGTG
+GATGGCATGCCATTCTGCTGCATTTGAAGATTTAAGATTGTTAAGCTTCATCAGAGGGAC
+AAAAGTATCTCCTCGGGGGAAACTGTCAACTAGAGGGGTACAAATTGCTTCAAATGAGAA
+CATGGATAATATGGGATCGAGCACTCTTGAACTGAGAAGCGGGTACTGGGCCATAAGGAC
+CAGGAGTGGAGGAAACACTAATCAACAGAGGGCCTCCGCAGGCCAAACCAGTGTGCAACC
+TACGTTTTCTGTACAAAGAAACCTCCCATTTGAAAAGTCAACCATCATGGCAGCATTCAC
+TGGAAATACGGAGGGAAGAACTTCAGACATGAGGGCAGAAATCATAAGAATGATGGAAGG
+TGCAAAACCAGAAGAAGTGTCATTCCGGGGGAGGGGAGTTTTCGAGCTCTCAGACGAGAA
+GGCAGCGAACCCGATCGTGCCCTCTTTTGATATGAGTAATGAAGGATCTTATTTCTTCGG
+AGACAATGCAGAAGAGTACGACAATTAAGGAAAAAGGTCATTTGAACGACTAAGAATCGG
+AATTGCGGAGCTTGCCCTTGATCTCTTGTATTGTCATTTCTCTTCTTCCT
+.
+qlt:
+66997666:<B<88<@>E\MJJJHHMMEBBFHHNNPSSZ_POGGHFFDIJGZPPMOJPMO
+PNKSZNEPNNBJ<<>HBPPOMR\_]_TSSS\\\\ZZS\VV_XV\\VV\\a]a\V\\\V\V
+__\\V\\\]Vaaaaa___Y__Yaa]aa]]YS\\V\\Y_YYY_YYY_\\\\\Va_YY___Y
+YTY__Y_____TaVVV\VV__aaa]aa]_\V\V\V___Ya\\S\V\V\SV\V\X\X__Y\
+VVX\\_]]Y_Y______]__T_\]____a]\\\VVV_Y__Y]___Y_YV____]]V__VV
+_______YSS\\V\]aaa__YY___YT__V_]______V____________]XPX]V___
+__]__Y__T_aaaaa]a_YVX\\VV____V]\VS___VVV\S\YY_Y]VVV\X\_]__]_
+]_VSRRSSV___aX\V\V\]____Y_aY____Y_________Y________Y__Ya__\_
+_\\\\]V__a\__\____________Y___Y_Y_Ta__]____Y___T____a_______
+____]aaa____________V___T___T____VVVVVVV_VVaaaaV__T_TVa_____
+_aaV\OSM\______aa_]_]_]a___T\\XVVX________]____\VVVSRRRSSY_Y
+______]Y__]__YV_V______T__a_aOVXV\\____T___TTaaa]\]X]X_V\SRS
+S\Vaa____T\\V\\\_a_T______a_______Ya____Y_aY_____________a__
+\V\\\]\]\\]____\\]XVV\]\XQGEEEGMIMRGI99976667666666666669799
+78:67799687769767979766697976669996799:97677679996
+.
+frg:7
+clr:9,792
+}
+{RED
+iid:295
+eid:1086975869
+seq:
+GGGGGCTTGGGCTTTGCTGGTCACGTCATTGTTTATCATGTTGTTCTTTATCACTGTTAC
+TCCAATGCTCATATCATCTGACTCGTTTATTCCAGACACTCCAAAACTGGGAAGCTCCAT
+GCTAAAATTAGCCACAAATCCATATCGATAAAAAAAGCTTGTGAATTCAAATGTCCCTGT
+TTTATTTATATAGGACTTCTTTTTGCTCATGTTGATTCCCACTAACTTGCAGGTCCTGTA
+GAATCTATCCACTCCTGCTTGTATTCCCTCATGATTTGGTGCATTCACTATGAGGGCAAA
+ATCGTCGGAGGATTGGAGCCCATCCCACCAGTATGTTGTCTTGGTGTATTTCTTTTGCCC
+AAGATTCAGTATTGAGACTCCTAAAACCGTACTTAGCATGTTGAACATGCCCATCATCAT
+CCCAGGGCTCAATGATGCTGTGCCATCTATTAGAAGAGGCCTTATTTTCTCAATTTTCTT
+CCTTGTTGATTCATTGAAATACTTCAGGTCAATGCTTGCTAGCATTTCTGCGGGTATTTG
+TGTTCGGAGCTTCATTCTCTTACTCTCGAACATGTATCCTTTTCCTAGTCTTGCCATTTT
+GTTTGAGAACATTATTGGTGCCATGCTACTGGCCGTCTTTAAACAACCC
+.
+qlt:
+966896697;77977778>=777668;=>=C=?=?EC>@CEIHMMSIFGEDEEEDMEKLO
+GGGCBFaIFFFFB=;8999>;=BAGDJGKDC at A===ADNFGFHFFPMSMMFFBBCDD:==
+BDLLLLLPJEFBBIHJJPJJEDJNXLGGGILXPLTLGGPXWXLLLKPNGGJXXXPLLMRM
+MNMJJGGHHFFEB?HHLLMTPaPTXPLLIGXKGLLLLLLLGGKEDBKGHKDD at KHGGA?>
+;>JAW=;DDTXXLKLLKKKGCGDI]LKKIEECIWHEC??AABHGLGLECC==D9=>>>>I
+>A:99<==@=BDADBEBCE@<@AJEGWAD=;9<<BGWGGLJKKKHHLXWLLKKKXWWEEA
+>;<>W>=<;;>=IILLGEEGCBIIGGAAEKHG=;;;<>GHHEA>GWEEHHKHE==<>@=C
+D at B?;;AAAHCBBIKEEBCGCG==E@==>;:99999:>HH?E?AGTEEB at B::<C at D;;A
+JGAAA?GHGAAKWT@>AGGGEG>:>:;=E>>@<DHHHD>=9:;G?HA=<<<;<<<H><B<
+;<>;9::999<>BBF><D==H<A<:;?99D==;;>>AAAEJPB?<>99>9;;:99B at E:;
+99=:;:>>=9999:A at G@>?AA@<:7?<?:;9:<DA=:<<999::8666
+.
+frg:70
+clr:36,582
+}
+{RED
+iid:296
+eid:1086975804
+seq:
+AAGATTGGGGCTGGACCATGAGCTGGCATCACTACAGCATTGTTTACAGACTCAATTTCT
+TTATGGCTGACAAAGGGATTCAGGGGGTTACAAAGTCTTCCCCGATAATTCTCATCCATT
+AGCTCCCACTTTAAGCAGACTTCAGGGATGTGAAGGTTCCGGATATTGTATAAGTTTGGT
+CCCCCATCTGATACCAATAGTCCTGCCCTTGATTGGGTTTGATCCCACAGCTTCTTTAGC
+TCGAATGATCTTCTCGTCTGAATTTGTGTGTCTCCTCTATGGCACCTATATGTATATCTG
+TAGTCTTTGATGAACAATTGGAGAGCCATCTGGGCTGTTGCTGGTCCAAGGTCATTGTTT
+ATCATGTTGTTCTTTATCACTGTTACTCCAATGCTCATATCAGCTGACTCGTTTATTCCA
+GACACTCCAAAACTGGGAAGCTCCATGCTAAAATTAGCCACAAATCCATATCGATAAAAA
+AAGCTTGTGAATTCAAATGTCCCTGTTTTATTTATATAGGACTTCTTTTTGCTCATGTTG
+ATTCCCACTAACTTGCAGGTCCTGTAGAATCTATCCACTCCTGCTTGTATTCCCTCATGA
+CTGGCCGTCGTTTTACAA
+.
+qlt:
+6677977698788877779;::=CA>AACACC@>A>>@CCEGECJADFDFEGGHHJSSSY
+\GJINJRRKLIOOOKFCD at B9999>CJFNQQPP\__]_____V\V\VV__\V\V\]MMEG
+>;AMPVVVV\VV\VV]XLLWN\\RQQQORR\_YRV\VRRV\\\_______V\__aaV___
+Y___Y__VVVVVVV_]XTXX_]V___Y_Y_____YY__]_____]_____aaaa_]V\XR
+]XPX]RVV\\Va]]XVPXXX\T_]_aa__]____a___________Y___Y__Y____Y_
+__XXaaa__T]XXVV___]aaLXX]]____aaa___]__Y________________a_Y_
+VVVVVVa]_aa]_____]]XT\____V\VVVVVV___YYXWPLLTX\TPL]WV_T__VWT
+LLOMVVVVX___a_aaa__XX]]T]_]V_____WWPRXWX___aV\ORSMPHHJNNV_YT
+TLLTWaaVRX]T_]]VVX_aa_]aaa___]TTT]PPTXXLPTTTVVVaTaRX]]__VT__
+TTT_]\\VV\S_a\VTXPPaTTTaKCEEWK_TTTTVTTXTTRaTXTXPLTTVaHXHPXGG
+TXXTLLGB>>BB at CBBHH
+.
+frg:34
+clr:9,576
+}
+{RED
+iid:297
+eid:1086975847
+seq:
+CGGTCTTCTCTGGGATCATGAGTGTGTAGTTGCAACGGCATCATATTCCATACTTTTGGC
+TGGACCATGAGAGGGCATCACTACAGCATTGTTTACAGACTCAATTTCTTTATGGCTGAC
+AAAGGGATTCAGGGGGTTACAAAGTCTTCCCCGATAATTCTCATCCATTAGCTCCCACTT
+TAAGCAGACTTCAGGGATGTGAAGGTTCCGGATATTGTATAAGTTTGGTCCCCCATCTGA
+TACCAATAGTCCTGCCCTTGATTGGGTTTGATCCCACAGCTTCTTTAGCTCGAATGATCT
+TCTCGTCTGAATTTGTGTGTCTCCTCTATGGCACCTATATGTATATCTGTAGTCTTTGAT
+GAACAATTGGAGAGCCATCTGGGCTGTTGCTGGTCCAAGGTCATTGTTTATCATGTTGTT
+CTTTATCACTGTTACTCCAATGCTCATATCAGCTGACTCGTTTATTCCAGACACTCCAAA
+ACTGGGAAGCTCCATGCTAAAATTAGCCACAAATCCATATCGATAAAAAAAGCTTGTGAA
+CTCAAATGTCCCTGTACTGGCCGTCGTTTTACAA
+.
+qlt:
+9666666>8:<<778996669;>CKHHHFCCECECIMJEGHH>?FIDHFFKI\V]\NNPO
+LMROPHE9967666679999=CKMRRRXW\TM\R\V\VVMMVVVV_a]G>:99<7:>KMM
+SSVV\V\VVV_]\]]SRV\\V\\aV__Y__\VSRVV_]]____V\\\RRTPXWO\RRRR]
+V\TPLLGLXLVOOLLMMNLV__YY__YY]]PVV__Y___]VVRaaa__Y________T__
+_V\V]RRaaR]T_Y__Y_VRV\RSXV__VVRVVV]__\XXaa__]]PRPXRPR]V_YYY_
+aa]a_]aX______V__V____TVV______Y_______V_V____Y_]VVRXXX_V___
+XX]]]__a]aaLLXW_____Vaaaaaa]aaaaaY________Y__]_________a_a_]
+a___Y____V___Y_V\VVSSa______XX\XPW]_\]Va_\\__T]XXGGWXVXXXV__
+___]]SV\XX\]TT_____TY_]XXXLXX___a____VV\VXRX]____\__TWXPVXWW
+AA]]]]XaaKKaPRVVRSRTRR>>77<@>ELJJP
+.
+frg:36
+clr:20,530
+}
+{RED
+iid:298
+eid:1086975784
+seq:
+GGGTACTTGGCTAATTCTTATTTTTGCCGTCTGAGTTCTTCAATGGTGGAACAGATCTTC
+ATGATCTCAGAGAACTCTTCCTTCTTAATCCGTCCAGACTCGAAGTCAATTCTGGCATCA
+ATCCGGGCCCTAGACACCATGGCCTCCACCATGCTAGAAATTCCAATCGGTCTCCTATAT
+GAACTACTAGGGAAAAATTTCTCGAACAAGTTGCAGCACTTTTGGTACATCTGTTCATCC
+TCAAGAATTCCCCTTTGGCTTGTGTTGAGAATAGAGCGGTTCCTCTTGGGAATCCAGGAG
+TGTGTAGTTGCAACGGCATCATATTCCATACTTTTGGCTGGACCATGAGCTGGCATCACT
+ACAGCATTGTTTACAGACTCAATTTCTTTATGGCTGACAAAGGGATTCAGGGGGTTACAA
+AGTCTTCCCCGATAATCCTCATCCATTAGCTCCCACTACTGGCCGTCGTTTTACAA
+.
+qlt:
+996666666668>@@C::>>>BG@@@@BQCCQHIIHMVCCE at ABGRIGJKJMPHHSSOOL
+LHKQR\\RMC>:99=@DLXPXV\VO\VV\\__OOMOPP______VVVSRMRPHHJLLVV\
+V\]aaa___]VXRS\V\\VOS__THOPPPPOOSR\VXR\\]\VV\\VYa]a]a_____Y_
+______VVVVV]V\\\\\VVa]a___]___V_V___XVX__aa_V\V]VV_aa\VR\V\_
+Y_XWLLOR\\_Y_Y____V]TRXV]]XaLLPLLMPXW_______a]a_aVV\\SV_VVPX
+LXWXXTTXV]_____YY__V______TV]VaTaa_V___VVVVVR\\VX]]a_______V
+\V__VVXY____V\XXRVX___YTaa_V____]aXRX]X__a\V\\\V___aa_Y_]_]_
+aTaaaa_aa]XRXV______Y\VVVSMLaLaXTJJ@=GFL]TRXHH=@BJFLXLL]
+.
+frg:16
+clr:13,435
+}
+{RED
+iid:299
+eid:1086975792
+seq:
+ACGACTTTTTTCTGACGACAGCTAAATTCATTATTTTTGCCGTCTGAGTTCTTCAATGGT
+GGAACAGATCTTCATGATCTCAGAGAACTCTTCCTTCTTAATCCGTCCAGACTCGAAGTC
+AATTCTGGCATCAATCCGGGCCCTAGACACCATGGCCTCCACCATGCTAGAAATTCCAAT
+CGGTCTCCTATATGAACTACTAGGGAAAAATTTCTCGAACAAGTTGCAGCACTTTTGGTA
+CATCTGTTCATCCTCAAGAATTCCCCTTTGGCTTGTGTTGAGAATAGAGCGGTTCCTCTT
+GGGAATCCAGGAGTGTGTAGTTGCAACGGCATCATATTCCATACTTTTGGCTGGACCATG
+AGCTGGCATCACTACAGCATTGTTTACAGACTCAATTTCTTTATGGCTGACAAAGGGATT
+CAGGGGGTTACAAAGTCTTCCCCGATAATCCTCATCCATTAGCTCCCATTACTGGCCGTC
+GTTTTACAA
+.
+qlt:
+666666:DCC?<89666;;=>EBRRLF>CFAAGMSMHDHDIMJLJRRRV\\NKIFGFGQO
+RRSS\\LLHLFB<:DBNQV\RRRRJNNJJP___Y_Y_VVVV\V__\\SOJJIIIKP\V\\
+VV\V_\\]\V\\\V\aa_a]a_]W]PMOS\V\VVaaYVV]\\]___X]WSMOO\V\\SV\
+aaaVXXVTV__________XXTTV]V_\\\XVVTTa_V_]___Y__]]RPXT__a_____
+VV__V____T__Y__]]LLT]_____]a]aa]]aRVVVWPLPPXXLXXVX_\Y__]_a]a
+a]VV\]VVXTPRXRPXWVT_]_T_YY_Y___________Y]_V___a__V_V_____Y_V
+aaa]VYY_Y___]]\]__a_aa_YTVXTSRX]XVXXaTa_______\VXRVTY_VVVVV\
+Saa__\____V__Y]aaaaaaaaXX\V__Y_aaa____TXWLLaXXMGD;JJLW]EEB at 9
+9:@=GJJMP
+.
+frg:24
+clr:20,448
+}
+{RED
+iid:300
+eid:1086975851
+seq:
+CGGCGAGTAGTCTGCATTCGCTACTGTTTGTCGCCCTTACGAATGAGAAAATGTGAATGT
+GTGTGTTCTCAGATTTAATTTTATTGGCCTTTTCAAGGTAATATATGTGGACTTCTCTTC
+TTGTCACTCCAATTTCGATGAATCTGTTCTCCTTGTAATCATACAAATCTGGTAGAAACT
+TCGGTTTTTCAGCTCCAGTAGTGTTGCAGATACTGTTTACTACTGTCCAGGCCATTGTTC
+TGTCTCTCCCCTCGATTATTTCAAATCTGTGCTTTAACAGTGCATTTGGATCATCAAGTT
+CTACCATTATTGATTCGCCTTGTTCATTGATGAAATGAAAATCTGAATACATGAAACATA
+CCTCCAAGTGGGTGCATATTGCTGCAAATTTGTTTGTTTCAATTTTCAGATCCTCTCCAT
+ACTCTTTCATTGCTTTTTCTGCAAGTTCGACAATCATCGGGTTGAAGCATTGTCGCACAA
+AATCTTCCATTTCGAATCAGTACCTGCTTTCGCTACTGGCCGTCGTTTTACAA
+.
+qlt:
+7:999777777<??666977>7799997999;99999;:99;;BBHEJEBBABAJEBEGC
+EPHGSXSVVLHEBD=BBBHHVVQQCGV]\_YFFNMPCHV\\S\S\\V_RRRR\R]aRPWX
+T_VV\\V\S\V\\aaXGLXXXVVVV__V__T______________Y_____MMWIIXW_V
+\___]T_\NLGEJWX\VVXPPLaW\XXXDDXWY_TV\\\VV___a\V\RVVV\VVVY___
+__VXXXR]\_V]XXXXW]]]__]_]\aaPaaa____]\XXRXW_TV_V__________a_
+_______Y__Y__]WLPXW]__V\VVVV_VXXRV\\RTV]__VVPXVXT]VVTX]\____
+aaVVV\SRaaaa________aY_______Y___Y_a_]VSVSR_]WXLDDXWV_TVVV\V
+\V_]a_____Xaaaaaaa_______aaLGXW\____V\___]VPP]TXVV_VaaXX]]__
+__V__VVVVVSXXLLWXXXXLXX__aaaaG@@JGXPSTWVSB@:9:@<GLL]]
+.
+frg:62
+clr:41,501
+}
+{RED
+iid:301
+eid:1086975800
+seq:
+GAGCAAAGGAAATCTGCCTTTGTGGCCATTTCCTCCCCAGTGAATGAGAAAATGTGAATG
+TGTGTGTTCTCAGATTTAATTTTATTGGCCTTTTCAAGGTAATATATGTGGACTTCTCTT
+CTTGTCACTCCAATTTCGATGAATCTGTTCTCCTTGTAATCATACAAATCTGGTAGAAAC
+TTCGGTTTTTCAGCTCCAGTAGTGTTGCAGATACTGTTTACTACTGTCCAGGCCATTGTT
+CTGTCTCTCCCCTCGATTATTTCAAATCTGTGCTTTAACAGTGCATTTGGATCATCAAGT
+TCTACCATTATTGATTCGCCTTGTTCATTGATGAAATGAAAATCTGAATACATGAAACAT
+ACCTCCAAGTGGGTGCATATTGCTGCAAATTTGTTTGTTTCAATTTTCAGATCCTCTCCA
+TACTCTTTCATTGCTTTTTCTGCAAGTTCGACAATCATCGGGTTGAAGCATTGTCGCACA
+AAATCTTCCATTTCGAATCAGTACCTGCTTTTGCACTGGCCGTCGTTTTACAA
+.
+qlt:
+766777777767777AAA@==BA<<777<>ECJIK@@@>@=?@BAAAEFLABBBBGEEBF
+HDJHLNLOVRMMECB;>;<GIMNQQOPQQRV_PPPPPPRXV\\\MLJQQLRRRVNTLLXX
+PaTLQJJPPPMPMP]aXGITISOSVRa_]TaT_V]XXT\XP]XV]]_____]]XLEE]W_
+VV_VV]]_RKHBBGWWXTWXPPGXWVXWMCCWWPXPX]__VVVVMRQNQRM\\VV\RXW]
+XVXTPXWXX]]]VXXPVX__\S\\VSXaaa]]aVVVV\VPPLPXPXWT\RRV\S______
+]_]]PX\V____V_XXLLLaaTXXWXXXXXXPLX]WXXXV]]\RRSRRPX\]XXPWX___
+XVaXTX]PXPa]aTX]V___T_a]VPX]]__aaa]XXX\\V\\M]VLLCCFMX\TTTXVT
+_\V_T_XVXX]Xa_aaaa___TWXSSPaLLLXT__VVVXa]]aXXXPPGLPWLaaLLXWX
+\TXXTTVVSSRNaPIGWTXLLGXXXXaaaaVPXPPJDDLJMGD;;>C;>>>]]
+.
+frg:32
+clr:13,492
+}
+{RED
+iid:302
+eid:1086975787
+seq:
+GACAAGGCGGCCTGGTTTTAATCCTAGCTCTGCTTTCCTCGTCGAGAGTGTAGTCTGCCT
+TTGTGGCCATTTCCTCCCCAGTGAATGAGAAAATGTGAATGTGTGTGTTCTCAGATTTAA
+TTTTATTGGCCTTTTCAAGGTAATATATGTGGACTTCTCTTCTTGTCACTCCAATTTCGA
+TGAATCTGTTCTCCTTGTAATCATACAAATCTGGTAGAAACTTCGGTTTTTCAGCTCCAG
+TAGTGTTGCAGATACTGTTTACTACTGTCCAGGCCATTGTTCTGTCTCTCCCCTCGATTA
+TTTCAAATCTGTGCTTTAACAGTGCATTTGGATCATCAAGTTCTACCATTATTGATTCGC
+CTTGTTCATTGATGAAATGAAAATCTGAATACATGAAACATACCTCCAAGTGGGTGCATA
+TTGCTGCAAATTTGTTTGTTTCAATTTTCAGATCCTCTCCATACTCTTTCATTGCTTTTT
+CTGCAAGTTCGACAATCATCGGGTTGAAGCATTGTCGCACAAAATCTTCCATCTCGAATC
+AGTACCTGCTACTGGCCGTCGTTTTACAA
+.
+qlt:
+6666666697877<=<CCKTNHCCJCCEGHHHMKTMMH?A??@EPWT\MIMMRNLGJNL\
+a]_HHMMKPNMTXDD98=>G>BHKRLMMLLOO\RRRRQQRM________]VKKBBNPVPR
+]VR\RQO\\\YY_PNPPNQXXR]]]__V\_\\SV_V_V__VY__V\VV\VV\VVVT]aLL
+XXXVVTXRaXXT__VVVV\\V___]____aaaVPXPGGXWYXSVRR]\_]]]WLLMMRRS
+RPXLTa_WMLCCWW_VVOVV\\VV_TTVXT___Y__T_Vaaa]aTXXXRX\\VXXXXXWY
+V\VV\\VVVRaaa_____]\RRXTXT__]]RP]]_]_]]Va______________WXLPT
+XXT_\\___V_VXXXV]V___]__V]XX\]__XXXT\V]]____VV\\RRaaa]XX]]__
+____\______T_____aa\\\]RRaO\KKDDa]aaaXXX]V_\_aaMVVRSVaaaaaa]
+a_]]____XXLLXW__Y_V\__]]_TXX_X\V_VaaXX]V__T__Y_\\OID:<H at AAGG
+XLLPWXXXXPWTLLXFP>>99=@@LIITT
+.
+frg:19
+clr:10,527
+}
+{RED
+iid:303
+eid:1086975820
+seq:
+GGGCCGGCATTGAATCGCATCATATAATGGAATCCCTTCTCCTTCGTGACTTGGGTCTTC
+AATGCTCAATTTCAAAGCATCCATCAGGAGGAATTTGGACCGCTGATAACAAGGAGGTCC
+ATTAGGAAGTTTGATTGGTCTTGGTGTTGTCTTCAGAAAAGGTTCAATTTTGGCATTCAC
+TTCTTTGGACATTTGAGAAAGCTTGCCCTCAATGCAGCCGTTCGGTTCGAATCCATCCAC
+ATAGGCTCTAAAATTCTCAAGGCAGGAGAAGTTCGGTGGGAGACTTTGGTCGGCAAGCCT
+ACGCATAGTTCCTGAGATTTCAAATTTTTCTTCAATTGTTTCTTCGCCTCTTTCGGACTG
+ACGAAAGGAATCCCAGAGGCCTCTGTTGGCCATTTCTTGTCTTATGGTAAATAGCCTGGT
+TTTAATCCTAGCTCTGCTTTCCTCGTCGAGAGTGTAGTCTGCCTTTGTGGCCATTTCCTC
+CCCAGTGAATGAAAAAATGTGAATGACTGGCCGTCGTTTTACAA
+.
+qlt:
+99996776698877877<<@@CCAG=A=E=<=A=>JINRQQ\RRFC=ALJKKLMJJVHJJ
+EDEMMKHHFJJJJKH at 9:>CBBBBDGKLPPHGJHCDQPQQ\HTHEEEJSHKMRXWTGJMD
+GHKGHLMMMS\\VV\VHVVX]TTVXR]]__]VRKHBBWW\\S\\V___]a_____V\VSR
+M\aaaaVVVSR\VPPXGGWX]RXaa]a___]TLX]PSPaTa]___XWLLLWO\RSRSXXV
+XXX]aRRXRX]]]]TRRRSSR]XPKJGEDLLLWXXXPLWLJJJLLL]\\\\__WXLLXXX
+TXLL]]WXXXTTXKDBBKIVV\VS]aaa_a]XX]RXXaaaVaPaKKCKMXXXXXLLWPTK
+LMEEPXPMMVRRKNKCCKNVaTPLLaXX]W___\VaaR]a]XXPPPXXX]WXLLLaKLa]
+\VV\RSVPPLLGPPXXXVVPa]aLPKI>?KKTHDGGDJPPLaaTRTXXXTHLGGTaT]RP
+]HXPGGHGF==EHPTTTLRPPIIPXLTLLaLLDA:::><LEE]]
+.
+frg:5
+clr:24,480
+}
+{RED
+iid:304
+eid:1086975840
+seq:
+GTGCTCTGCTGTGAAATAATTCCTCCTCATGCTTGCAATGTACTCAATTGGGGCTACGTC
+CTCTCCAATTTCATCGAGCTCTATCCAGATTGAATCAGTTAGCTCGCAGGCCTTGTTGAA
+CTCATTCTGTATCCAGCTTGAAAGTGACCTTAATTCAGGTTCGTCACTATCATATTGCTT
+CAAATCGCTTATGTCTCTGCAGTTGTCAAAGTCTACTTTCTCTGGTGCCATGTTTTCACC
+AAGAGCCCACTTTAGTTGACTCGTTTTCTTCATGTTTTTAGTCCTTGGGATCTTCTCCTC
+ATTTTCAATGTCCTGCAATTCTGACAATACTTGCTTCCATGACAGCAGGTAATTTGAATT
+TATTCCCTTTTCGTGTGGTTTGACTATATAAGGTTCTTTCCATCCAAAGAATGTTTTCAT
+GCACTTGATCGCATCATATAATGGAATCCCTTCTCCTTCGTGACTTGGGTCTTCAATGCT
+CAATTTCAAAGCATCCATCAGGAGGAATTTGGACCGCTGATAACAAGGAGGTCCATTAGG
+AAGTTTGATTGGTCTTGGTGTTGTCTTCAGAAAAGGTTCAATTTTGGCATTCACTTCTTT
+GGACATTTGAGAAAGCTTGCCCTCAATGCAGCCGTTCGGTTCGAATCCATCTACACTGGC
+GC
+.
+qlt:
+66677::<<<<=<<<<<@DHGCCCG at AIBHDSYEDLDDDGQJGGGIKIMVPLORQV\RSa
+aa_KJNIKHGCD::7<<D>XX]]QPNMJJRRV\\QQQQN\VVX\]____T\VWWLLXKV\
+V\VVVVa____QPJJPJVX_____V\VVV\Y__\\\\\V____VO\VVVV__T___]_VV
+\\\\_a]XRRX\__]]]a]____V\V\VS\___V\VVVV__VT__TVVVVVV__VOVVVV
+RSLLXP]]___WXWPPOMVVVMPP\V_Y_]]XXXaa]]]]XXaaaPaOLLOMVTVV____
+VV____\]PXaa]_V_TY_YX]XXV]_]___aaaaVV]VVSPWWV__XXXRVV__T____
+_____a___]VPPLXPRVaa_X]RX]VV____aa]a_a\VVVOVVVOOLLXXT_a_____
+]aaaa__VXRTT_]]TXRXX\aaMS\VV\a]___V__VXXXXTVV____aa__]]XXa]_
+____Y__Y_________V_]KCIIKV\VQQ\V]]__aXRRXX]\__VaaaaXRV\XXaTL
+WPR]]]_V_VTaaVTTV__T]_aaaT]WKCCWWYVV_______]____T_TVVXV]__a]
+RRMMSMTXPLKI]]XXTTV__]__T_TTTTTTTTT_RVMGD99DHTXXNAC;;DDH>@99
+98
+.
+frg:17
+clr:4,631
+}
+{RED
+iid:305
+eid:1086975803
+seq:
+GGGACTGATTACACATCTGTGTCTTCCTTAAATGGGATCTTCCCTTTATGATGAACCCAT
+ATAAATTGGTTTTTCGCCTTCCCTCTTTAGTTCTGCACTTGCTTATCATGGGGATTAGTT
+GAAAATCGTCCATTGCTGCACAGGATGCATTGAGCAGGGCAGTATTAATGTATACCCCCT
+TCATTATGTACTCAGTGGCTCTACAATGGGACACCTCTGCTGTGAAATAATTCCTCCTCA
+TGCTTGCAATGTACTCAATTGGGGCTACGTCCTCTCCAATTTCATCGAGCTCTATCCAGA
+TTGAATCAGTTAGCTCGCAGGCCTTGTTGAACTCATTCTGTATCCAGCTTGAAAGTGACC
+TTAATTCAGGTTCGTCACTATCATATTGCTTCAAATCGCTTATGTCTCTGCAGTTGTCAA
+AGTCTACTTTCTCTGGTGCCATGTTTTCACCAAGAGCCCACTTTAGTTGACTCGTTTTCT
+TCATGTTTTTAGTCCTTGGGATCTTCTCCTCATTTTCAATGTCCTGCAATTCTGACAATA
+CTTGCTTCCATGACAGCAGGTAATTTGAATTTATTCCCTTTTCGTGTGGTTTGACTATAT
+AAGGTTCTTTCCATCCAAAGAATGTTTTCATGCACTTGATCGCATCATATAACGGACTGG
+CCGTCGTTTTACAA
+.
+qlt:
+66666667877669888=@=;;88BBCCCCCCCC<<@?>>HHKHGRCCGAAB>AGRCFPH
+FTHTCOHHIGA;:86678<HHHTPPKHVSVSKMRQQOMV_]___\VMQQFG@=@FCDGLX
+PXV_XXXXSRVM\VTVV__T_QMNOOL\T_X]aa____VVXXRXW_VVXX\______aaO
+VVVCKDDHKXTPMLMS]NXPXWWTXSPT\___T___]aaTaTHHVVVVVVXX]aR]VVVS
+RVV____]VXPVX_]VXRXVaV___TWLLLaaTXX\]XX]]_VXXRXPLLTXRVRHKGBB
+KKPX]PNHDDPMXGXLXXLLPaPa]aRXPXRXRXXVT_VRVVRKLJJHNRSVSS]____T
+T__VXTTTXLXWPXRWHXXWWT__XTXaT\XX]TXVaaXTX_HTVVTXXHWPPSHX__X]
+XXLLTTTTTaaPTTTTLLHPLLXT_X_VHPHTWLLPMNNRJ@?6677BCBGJLIKGHKB?
+BGGGJaaWKLBGGXTPLLTHHHTPLLPTaPLLLTMRMJJJLaTTLLPPSSXXHLHRPHGG
+HHTPHHHTHGJFAHHCCEDIEFKKTTXXXTTHHPHHTHPPHLCLEJJPXHLPHHHHHHHH
+GRRGRRTLHDDCGCKLCCCCCHHHHTFHGFF@=?=GGCC>BEIPPPSGF@;;:B?AF>?F
+>><<777<8:@@CC
+.
+frg:33
+clr:12,630
+}
+{RED
+iid:306
+eid:1086975769
+seq:
+GGGGGACTTTGGCAGACACTTGTATGAACCCCAACATAGCAACACAAAGCAAAAAACATG
+ATATGGCAAAGGAAATCCACAGGAACCAATCTTTGTATCCTGACTTCAGCTCAACACCTT
+GGAACTGGAACCGGTTGTTTAATGCTTCATCTCTGTATACATCATGGTCATAAGTTCCAT
+TTCTGATTGACCCTATGCAGGCATTGTCACATTTGTGGTATATTTTGAAACAACCATTGC
+CCATATCCTCAGCATTTTCCCTCAGTTGCTTCTTTGTTCTTTCAAACAGTTTGTTCATTT
+CTGAGTCAGTTAGATCAATTGTATGTTGGTTCTCCAGGGCAACAAGAAGCTCCGCGTTGT
+ATGACCAGAGATCTATTTTAGTGTCCTCAACATATTTCTCGAGGTCCTGAATTCTCCCTT
+CTACTTCTGAGAATTCTTTTTCAATCTGATGGAATTTCTCGTTGGTTTTCCCGATCAACC
+TATTCAGCTTCCCATTGATTTGGTTGATTGCTGCTTGAGTGCTTTTGAGATCTGCTGCTT
+GTCCTATTCCCTCAGAATTTTGATGCCTGAAACCGTACCAACCATCCACCATTCCCTCCC
+AACCATTTTCTATGAAACCCGCGATTGCGCCAAATATGCCTCTAGTTTGTTTCTCTGGTA
+CATTTCGCATCCCTGTTGCCAATTTCAGAGTGTTTTGCTTAACATATCTGGGACAGGCCC
+CATATGTGATCCTGTTTACATTTTGAAATGGTTTGTCATTGGGAATGCTTCCATTTGGAG
+TGATGCATTCAGAATTGCATTTGCCAATGGGGTGCATCTGATCTCATTATTGAGCTTTTC
+CCACTTCGTATTTTAAAATAACCCCGAGGAGCACTGGCCGTCTTTTTACAA
+.
+qlt:
+:9::99999:9997666967778:<<<=CB?<=;:8999<<BFA=<>@??FEDDAH at CCE
+EEFEECCAGGGKKGHMC8:666897677789?JLGJEI>>HIQQLFC@==KHMJIJE=<7
+8:76699BABIGXPaKLHHJLMLLLJJJLLJLLKHNQKMDDELLLLLGLLLJGKKGGSMO
+OaaXPPLJD@<9999AALGGLGGLLPLIGGGGNKHLJJJHLPWLLLLLGJDDEKLGLPPM
+MMLLMWNCCD at D<GGXWPXLLGGA@=JJLL]WVTPXXLLL]PSMNEDBABKHa@@G at BIK
+PIGB@>;99=AG<:IGEGGLLECEHPBEKKPLLPEBBCBBLLL@>=<FBLPKGB?BEHNP
+KGDD>>:=;<9IGBBHW@@:9@<@XIDEKJGJJHMLLKKCCCELLLHJJMKPDDKKLLLW
+LLLLLPaKHHA;EEMSaKKBBHNNKGG;AGILGLLKWGG@@IGJIGLXLD>99:=;CBGB
+BB=:=99;@DLIGPLLLLXPXPKGAGJAAEEXKKA;D?GJW at CGGEHDCHHBGKaaKILG
+W=>AGDDLKKICC999@?GHCCGIIXLLCMNIIBGB at BBTW?>>?GEHG;<<GHGAAGAE
+EIABWWWM==HAB=EGGHGTK>==GJKCCWWHCGLBHLLGG;;::;DDILLPMGBEEKMP
+TLHWaC<;DDGHXW_aaTV]T__TWDB;>@BTTTTVaHTRPTLLCOLLaTTVCCCCAHHH
+XHHWHF?=DFCHTHKLDBIWVHKG at CCCEMaTYa]TXHHHCC=<<<==>@99=>77=BCA
+GG=>BBC@=9:77?AG?<<?IHCAB88@<C999 at A>H at A:89<99B9977<<<=99A>;:
+ at 8888A@8787777@>G?8889<<98787677;9:8<7797779:777767
+.
+frg:3
+clr:51,786
+}
+{RED
+iid:307
+eid:1086975833
+seq:
+TCTCAAATGGCGAAGCTTATATAGGCATGAGATGATGTCCGCCCCATCAGGCCATGAGCC
+TGTTCCATATGTACCAGAGGTGCCACAAAACACAACAATACTGTTTGAGGTCCACAAGAC
+TTCAGTTTCCTCTTTTCTTCCCCTTATCAACTCCACATAAAAGCACCGATTGATGCAGCT
+TTTGCCTTCAACAGAGAAAATACCAGAATAACCGGACCTATTACCTCTGTCAACTATGAC
+TTGCCTATTTATCTGCAATTTGGAATTAGGGTTGGACCAGCCCTCAATGACTTTGAAGGT
+TTCATATCCTGAGCGTAACTTCTCGCTGATCGTTCTTCCCATCCACACGTCATTTCCATC
+ATCAAAGGCCCAGCCTTTCACTCCATGACCACCTTCTTCATTGTTAGGATCCAAGCAATG
+GCTACTGCTGGAGCTGTCGTTTTTTCTGGGTGTGTCTCCAACAAGTCCTGAGCACACATA
+ACTGGAAACAATGCTATAATCCTTTATGTTTATATCTACGATGGGCCTATTGGAGCCTTT
+CCAGTTGTCTCTGCAGACACATCTGACACCAGGATATCGAGGATAGCAGGAGCACTCCTC
+GACATGCTGGGCACTTCCTGACAATGTGCTAGTATGAACGATTTTCCCCTCCTCAATGAA
+TAATATTTTAGTATCAGCTTTTCCTGAAGCACTCCCATCAGTCATTACTACTGTACAAGT
+TCCATTGATACAAACGCATTCTGACTCCTGGGTTCTGAGGATTTCTTTGGACCATGAAAA
+CAATACTATTCTACAAAGCCTC
+.
+qlt:
+8677778666677779;;8;777<=8=<<88788:<B>CFFKLRCICACGCFF?>ACJE]
+LLTJNJEHCH>;77666667::==LDLLSSSVVVRRRSRRaaV]_X]XXXLKLD;966:9
+9>=HGMXPPRRXW___]_T]T_VV\LFDDDHJMHLLJJXMXPLGXLMMMMMXXSCF at CCK
+X]PRaXLDA;999;BDGNN\MMID<DEXX]XRRVXVTXXRXXRPXRaaMGFFFGHLLSPX
+X___VVPMSR\OGLLXPTXXaLGGXHHLJJNNMKKMGHGGG]IS]RSSRMRRMPLLPPRR
+CLHMMVVVTXPPSPXXPPXXVaPWWLMMMSRRRXX_XSMSMSMLXPTSPLPLL]XXLLXL
+LLLMLHKKLFGGGLXPTVRXRTSLLKNHMEGGXHaLLXLGGXPaaKKBGKHHLGGJLPa]
+RXRXPXa]aXXRXRVaaaXPTXXRXXXaaaPPPLLLK]LII at B::>BEMB<::@DCCWKX
+LLMMLLMTTTLLXHXII]PaPLLXPXRXPXGLLHHDJHEDKLaaPLLLTHHGGLD;??CC
+MLWXGLXPLLaPJHDAAAAFADCBCF?@MJHHHHAABBBF@@CHCDD?F@=<<>>CFKGC
+<<===;IBF>=D>GLPGEAA>>=A??C=:<9999<;;978;@GHG<<77<<CHHC@>??<
+:8:::ACBDB?;==AEJHMMKMCFF at A9999:@::><AC=97::99==FFG@@<<E>=G=
+ at 888A<AAB@<=99<<::>B at B?>=9:==;79?;777788;=>9787;=;B99;<:A779
+99;8::989998=:9=897876
+.
+frg:55
+clr:37,686
+}
+{RED
+iid:308
+eid:1086975899
+seq:
+CACATGGGATCCATGGGCCATGCTTCTGATTTATTCTCAAAAAACTCTTTGGTCATGTCT
+TTCTCTTTAATCGAGGACTCGGCTTCAATCATGCTCTCGATCTGCTGGAGTGACTGAAGG
+AGGCAACGTCTCATCTCCATTCCCCATTTCATTTTGACCTTTGATGTTCCGTTTGTCCTC
+ACATACAAGAACATAGGCCTTGAAATTTGGCCTATGGCACTTCTTAGTAACATATCTCCT
+ATCTCAAGGACACAGTATTTCTCCCATTTATGTGGCTCTAGTCTCGGGTCAGTGAGAGAA
+AATTCCATGCTCACAAAGTTTACCACATCTGTGTCATTCCTTAAATGGGATCTTCCCTTT
+ATGATGAACCCATATAAATTGGTTTTTCGCCTTCCCTCTTTAGTTCTGCACTTGCTTATC
+ATGGGGATTAGTTGAAAATCGTCCATTGCTGCACAGGATGCATTGAGCAGGGCAGTATTA
+ATGTATACCCCCTTCATTATGTACTCAGTGGCTCTACAATGGGACACCTCTGCTGTGAAA
+TAATTCCTCCTCATGCTTGCAATGTACTCAATTGGGGCTACGTCCTCTCCAATTTCATCG
+AGCTCTATCCAGATTGAATCAGTTAGCTCGCAGGCCTTGTTGAACTCATTCTGTATCCAG
+CTTGAAAGTGACCTTAATTCAGGTTCGTCACTATCATATTGCTTCAAATCGCTTATGTCT
+CTGCAGTTGTCAAAGTCTACTTTCTCTGGTGCCATGTTCTCACCAAGTACCCACTTACTG
+GCCG
+.
+qlt:
+877767669:=789>@::<<<<G\\\>>@@BBIEEIDHEIJMSRRRVSVINJLGHHKQ_a
+YY___VKHDA;;7<?=JEFHM]VHPMPOQVVRVa]a]SVVRRS_V_OHL?=;9<@JTXHV
+SVV\____\VSS\VVPPPPPPVX____VV\VV\_VO\V\VVRRRRR\_Y___a__]_]]X
+]]XX_WWXGGWX__T_aa_\]VV\\______Y____V____TVMMMLLXX]__TV_a___
+V_____VXXXVWVVMMMMVV__MVVRRV]]PX]aaa_]XVXPXV__VYV]PHJJJHHLLP
+PVO\\\VRVVX_V____a_____]_V_VaaaaX]______VXRXVXPVX____a__a__V
+VVSSSS\X_VXXPPTXT__V_aaa_a]aaP]X__Y____]]]XX]X_V__V_V___YV]]
+VRX]RSSNNSPXWXX\]__T_XXVV_VaaX____V]XXXV_a_]__V\_V__VVPXVV_]
+\RXX____aaaa____________VVTTLaaaY___]]XXaVXX\T___aaaa_aaaR\\
+\V\___a_a]]]XXXaa___V\TXXV__Y_TTVTa_a_]XXXRTa]_V\SVS\___TXXP
+LaPa]YYVNLGGJXXX\]T]]aPa]PP]TVT_XTTVY_\TRHVMMMJPTTTT_HT\HVHI
+MTTPTMRHHHMTTT_YT_TTTTTTTTHLPTPPTT_T_TTVaTHMMKMH\PTPPPWT_Y__
+__\\]]X]]________]XTXVV___XV]_V\\RVSWWBA]KIB<9 at 99@@INJHMXTEE
+HC?9
+.
+frg:31
+clr:13,755
+}
+{RED
+iid:309
+eid:1086975862
+seq:
+GCGCAGGCCATTTGAAACTGACTTAGCCATAGAGTCCTACAGACTTTCCCAATGGAACCT
+TCTTCCACTCCCTTGGGGGACTCCCCAATGGGCCATGCTTCTGATTTATTCTCAAAAAAC
+TCTTTGGTCATGTCTTTCTCTTTAATCGAGGACTCGGCTTCAATCATGCTCTCGATCTGC
+TGGAGTGACTGAAGGAGGCAACGTCTCATCTCCATTCCCCATTTCATTTTGACCTTTGAT
+GTTCCGTTTGTCCTCACATACAAGAACATAGGCCTTGAAATTTGGCCTATGGCACTTCTT
+AGTAACATATCTCCTATCTCAAGGACACAGTATTTCTCCCATTTATGTGGCTCTAGTCTC
+GGGTCAGTGAGAGAAAATTCCATGCTCACAAAGTTTACCACATCTGTGTCATTCCTTAAA
+TGGGATCTTCCCTTTATGATGAACCCATATAAATTGGTTTTTCGCCTTCCCTCTTTAGTT
+CTGCACTTGCTTATCATGGGGATTAGTTGAAAATCGTCCATTGCTGCACAGGATGCATTG
+AGCAGGGCAGTATTAATGTATACCCCCTTCATTATGTATTCAGTGGCCACTGGCCGTCGT
+TTTACAA
+.
+qlt:
+66666769997><7877<<>A>ACA;;97E>AEEEMHGCGEGG\HRICBHGIBHMSSRI]
+V\]GKLKEEHHDB:9<CDGIJJJVV\VVVV_V\\V\VY___\V\\V\\MSFCA@@A]]_]
+_Yaa__VV\\\R_aYY__]Y\VVVMVVXaOMRRSV_a_V\\\]\]___aaaa_T____Y]
+aXWXLLOM\VSTV\___VY___Y____V__VV\VO\TX\VRMXVT____YY__T__VVV\
+V\____aV_]__]]]]XXX]XXWGGXXTTX]]]VV\XX\V__________YVVVVV\_XX
+W]S]T_____Va_________VXXTXX\]VRXXV_aa___YY___Y__aa]Y]___Ta]a
+a_YV]RLLMJGGLLWT]_VVVVV\__Y___]]Ra]]_______Yaa]V__Y____\XXT\
+VV______a]aaVTX\XPVT_____V\XXX]_]_V\\\\Ta]aKKKKXW___a_]]XRRX
+a]]\]V\\_Y________]NKQHHLaaaPXWX_]VaXVX___V_TV___T\PRXTH__]V
+aaaY_]VTPVPX\VTaHa]]_YT\a_a_TT___TTXMG<;MDGGPCC<<EEXTTLGB:??
+D<EHEEH
+.
+frg:67
+clr:30,564
+}
diff --git a/test/minimus/influenza-A/influenza-A.qual b/test/minimus/influenza-A/influenza-A.qual
new file mode 100644
index 0000000..10f69c0
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-A.qual
@@ -0,0 +1,4979 @@
+>gnl|ti|1086975905 name:1099575910428
+ 6 6 6 6 9 6 6 7 7 7 7 9 10 10 8 8 7 6 6 14
+ 7 7 7 7 7 7 12 12 7 7 7 12 7 7 7 6 7 8 8 6
+ 9 13 20 20 21 33 35 35 38 29 29 24 28 24 23 27 27 27 29 27
+24 33 30 30 29 27 35 34 35 27 24 28 26 24 16 13 11 11 9 11
+11 26 18 21 28 24 23 23 29 34 49 49 29 33 33 29 29 23 29 38
+33 44 44 44 38 38 47 38 38 35 35 29 34 34 34 35 34 28 32 26
+27 32 29 40 32 40 36 40 47 47 47 41 47 38 44 38 35 34 33 45
+44 38 38 38 38 38 38 44 44 44 38 44 38 38 38 38 47 47 34 26
+26 22 25 23 28 45 45 45 38 47 39 34 34 35 35 35 38 34 34 40
+38 38 44 44 34 35 28 27 28 19 19 23 25 26 23 23 26 49 36 38
+30 27 30 27 29 34 39 40 47 41 49 36 47 36 36 35 34 29 35 34
+34 49 45 47 47 36 47 47 47 47 36 47 36 47 36 36 39 40 35 32
+49 49 28 40 39 40 45 47 38 40 45 28 28 49 32 49 36 40 36 28
+24 26 26 24 28 34 34 38 38 40 40 40 49 49 49 49 49 36 38 40
+40 34 40 40 32 28 28 40 39 40 36 40 34 44 40 38 40 40 40 34
+32 40 40 34 32 45 38 38 38 45 45 40 36 49 40 38 47 47 38 38
+35 27 34 31 40 40 40 40 45 45 40 34 34 27 24 23 16 18 39 39
+41 47 47 47 47 38 38 45 36 40 40 40 40 47 36 49 28 23 40 39
+23 23 28 39 40 32 32 32 28 28 29 29 28 33 33 27 29 29 29 26
+29 29 25 35 29 40 49 49 27 27 49 40 28 28 40 45 45 40 34 32
+40 40 36 40 40 34 36 38 38 44 44 44 44 45 38 47 38 38 38 34
+34 35 29 49 40 34 32 32 34 40 34 40 40 40 32 32 49 32 28 45
+32 40 45 40 34 45 49 49 38 44 34 32 40 40 40 44 45 45 38 38
+38 35 35 34 32 35 32 40 40 49 40 36 40 40 28 32 40 40 47 47
+47 47 47 47 47 47 47 47 36 39 40 40 27 28 27 23 29 31 35 29
+38 40 32 23 20 23 12 12 29 17 19 29 29 29 39 17 11 20 19 23
+17 27 20 40 19 19 9 9 9 10 12 9 9 9 11 9 11 9 9 13
+ 9 9 10 11 15 13 16 13 11 9 9 12 10 9 10 10 9 16 9 11
+ 9 10 10 9 10 13 13 10 9 9 9 9 9 9 12 10 10 17 13 10
+ 9 9 8 11 9 9 9 11 9 9 7 9 10 10 10 9 10 11 9 9
+ 7 7 9 9 9 7 9 9 11 9 7
+>gnl|ti|1086975821 name:1099575910432
+ 7 6 7 6 7 7 7 6 6 6 7 6 6 7 7 7 12 12 16 16
+14 23 27 27 24 26 29 24 38 29 40 31 32 32 32 31 24 26 31 24
+23 24 24 24 29 27 30 26 31 31 31 42 35 35 44 44 47 38 42 35
+35 42 44 44 38 47 45 34 23 23 21 24 14 19 25 25 35 35 44 38
+44 47 44 45 38 29 42 35 35 35 35 42 42 42 44 45 35 35 44 38
+35 35 44 44 38 44 47 41 47 47 44 39 29 29 29 34 34 38 44 38
+38 34 35 47 47 45 38 34 34 34 44 44 38 47 47 47 47 41 47 41
+47 47 47 47 41 38 38 44 44 31 35 45 35 33 33 33 38 38 41 41
+47 44 44 35 44 44 44 41 47 41 47 41 41 47 47 47 47 47 47 47
+47 41 36 38 44 34 34 32 32 29 34 45 44 38 44 47 47 47 47 47
+38 44 38 44 38 44 47 41 47 47 44 38 47 47 41 41 47 47 47 47
+47 47 47 36 47 38 44 44 44 44 44 47 47 47 44 34 34 35 35 35
+44 45 49 47 47 41 41 47 47 47 41 47 47 47 47 47 47 47 47 38
+49 38 44 38 44 44 38 47 38 38 38 38 38 38 32 34 38 39 38 49
+49 38 38 44 44 44 44 47 47 45 47 47 47 47 49 49 47 49 49 49
+47 45 47 47 45 47 41 47 47 45 49 41 47 47 38 44 41 41 47 47
+47 47 47 47 47 47 47 41 44 38 38 44 38 38 47 41 41 47 47 47
+38 38 44 38 38 44 44 47 47 47 47 47 45 47 47 47 47 45 47 47
+47 47 47 47 38 47 47 44 41 47 47 41 41 38 44 44 38 44 44 47
+44 40 34 49 49 45 47 45 47 47 47 45 47 47 47 47 47 47 41 47
+47 47 47 47 49 49 49 47 49 49 41 49 41 47 36 47 47 47 47 47
+47 41 41 41 47 47 47 41 41 41 47 47 47 47 47 47 47 47 47 47
+47 47 49 49 36 38 40 34 45 38 38 47 47 47 47 47 49 45 49 49
+49 49 45 47 41 47 47 47 47 47 49 47 47 47 45 38 38 40 45 45
+47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47
+41 47 47 47 44 40 44 38 44 44 44 38 47 47 47 41 47 47 47 47
+44 44 38 44 44 44 49 49 49 47 49 47 49 47 49 47 47 47 47 47
+41 47 47 47 47 47 39 39 17 14 39 14 14 23 23 28 38 34 35 44
+38 44 44 35 26 18 18 18 18 20 21 23 21 32 17 10 10 8
+>gnl|ti|1086975860 name:1099575910435
+ 6 8 6 6 9 6 6 10 10 10 12 11 11 9 8 6 7 15 17 15
+13 15 15 13 15 15 23 23 23 28 23 21 23 29 23 20 18 26 35 23
+24 19 21 19 20 34 33 25 31 19 19 31 24 33 22 24 24 38 38 38
+38 40 33 33 30 30 28 28 34 31 40 19 19 34 27 19 19 35 35 34
+40 34 34 34 23 26 23 23 29 34 49 49 21 23 27 28 23 23 44 44
+40 47 47 47 47 47 41 44 38 38 38 44 35 38 40 44 34 35 38 38
+38 38 38 40 40 44 45 40 40 40 32 34 40 34 38 40 40 40 34 32
+35 34 35 38 38 38 44 34 35 38 44 38 38 38 34 34 40 40 38 33
+27 24 19 19 36 39 38 40 38 40 34 40 38 34 38 29 35 44 36 34
+40 36 38 36 47 41 38 39 49 34 34 39 40 36 45 40 40 45 45 29
+29 32 30 26 28 28 40 39 47 47 47 38 40 32 34 38 38 38 44 34
+29 40 32 39 36 40 32 32 39 39 47 44 40 34 34 40 40 32 28 27
+49 49 36 40 34 38 36 40 32 40 32 32 28 28 36 45 45 49 28 28
+26 26 26 28 28 26 28 40 40 39 36 23 28 49 45 45 34 40 40 40
+39 40 45 32 28 32 28 32 45 40 40 38 40 34 36 40 34 32 40 40
+40 32 34 36 40 38 49 49 32 32 40 28 32 40 40 32 40 40 45 45
+40 45 40 32 32 39 28 28 45 40 40 34 36 40 30 27 19 19 39 39
+38 47 38 36 29 35 34 38 29 38 34 34 29 29 26 24 22 22 27 27
+28 26 28 39 40 34 40 32 40 49 40 40 40 32 36 32 40 32 32 28
+29 35 27 28 28 28 27 49 27 25 28 28 45 28 28 36 40 40 45 32
+32 40 32 40 28 40 32 40 40 49 47 38 40 38 38 38 31 38 38 38
+35 38 44 47 45 45 40 36 45 45 34 34 40 40 32 49 27 20 20 30
+30 35 29 32 40 40 40 28 28 39 32 40 28 32 40 40 49 45 34 35
+34 34 35 34 40 40 40 32 32 49 39 34 40 40 34 35 38 38 29 34
+34 40 47 47 47 45 45 40 36 36 32 32 25 25 32 40 40 44 40 40
+40 49 49 20 20 23 29 14 20 17 20 28 29 40 29 28 16 15 11 7
+ 7 10 7 8 7 16 11 10 10 9 6 6 9 6 9 9 10 10 6 6
+ 7 7 10 9 10 7 7 9 10 11 10 9 9 9 9 9 9 13 15 16
+10 16 9 7 9 9 11 9 9 9 9 9 17 9 13 13 12 13 12 12
+14 17 16 16 9 9 9 9 9 9 10 11 11 10 17 9 7 9 14 9
+13 16 16 14 19 12 16 10 12 10 9 9 9 9 9 9 9 10 9 9
+ 9 12 10 10 10 7 8 6 7 9 9 9 9 11 11 9 9 9 9 9
+ 9 9 9 7
+>gnl|ti|1086975884 name:1099575910438
+15 7 6 6 9 7 7 9 10 9 7 6 6 6 6 7 9 6 8 12
+12 15 14 14 17 17 16 16 24 16 18 21 21 25 24 13 12 12 12 12
+12 23 25 25 31 21 24 24 21 27 23 24 26 26 29 29 44 38 38 29
+35 28 28 29 31 33 23 25 27 24 23 22 26 26 20 19 14 14 14 16
+24 24 27 29 30 38 47 49 29 33 34 25 27 23 34 38 33 35 33 33
+35 34 34 34 38 38 44 38 44 47 45 47 38 44 38 40 40 28 28 28
+28 28 28 32 40 44 47 47 47 38 44 31 31 31 33 47 47 49 47 47
+44 44 44 34 44 38 38 38 38 38 35 29 44 40 38 47 40 38 40 40
+44 40 38 29 34 44 44 44 38 34 38 38 38 45 44 32 38 40 47 36
+47 38 35 38 40 35 34 44 45 36 25 25 24 25 21 24 26 22 40 32
+40 32 40 36 38 38 38 45 45 44 47 47 47 47 47 38 44 36 40 40
+40 38 40 36 38 38 47 41 47 47 38 45 40 34 40 40 39 40 38 47
+38 41 38 47 47 35 38 35 38 29 38 38 47 47 40 36 34 40 40 47
+47 47 47 38 40 40 40 40 36 49 49 49 49 38 47 47 45 36 32 32
+28 32 40 40 45 47 47 36 47 47 47 44 38 36 36 44 40 40 44 40
+40 40 38 36 40 34 49 49 36 49 40 34 40 38 38 47 47 47 47 47
+49 36 32 40 36 36 45 40 40 40 39 32 28 28 45 40 47 47 47 47
+47 36 47 38 38 38 40 34 34 38 40 40 34 35 39 39 38 40 40 38
+40 34 39 40 38 36 36 38 39 44 38 32 49 36 49 34 38 44 44 38
+38 34 49 32 28 27 45 36 47 38 38 40 40 44 32 40 45 45 47 41
+47 47 47 47 47 47 41 47 47 41 47 47 47 47 47 47 45 47 47 49
+47 47 47 45 45 47 47 47 47 47 38 40 40 40 40 38 38 47 45 36
+40 34 34 44 40 47 47 47 47 41 47 47 49 49 38 38 38 44 44 38
+47 44 40 38 38 49 47 47 47 47 47 38 44 38 38 38 38 47 47 47
+47 47 47 49 47 45 49 45 49 34 45 45 47 47 47 47 47 49 47 47
+47 40 39 40 40 38 32 45 38 47 45 40 32 28 28 45 49 49 49 38
+34 38 44 38 38 47 47 45 45 40 40 36 39 40 28 28 40 40 38 40
+40 23 23 32 23 23 16 16 39 39 38 38 40 40 40 40 40 32 28 21
+24 28 27 16 18 9 9 9 6 6 9 6 9 9 9 7 7 9 9 9
+ 7 9 9 9 9 7 9 9 10 7 7 9 10 10 8 6 7 9 6 9
+ 9 10 9 9 7 9 9 10 9 9 10 9 11 7 9 11 10 9 10 9
+ 9 13 10 9 9 9 9 9 9 9 9 9 9 10 10 8 9 9 9 9
+ 9 7 9 9 10 9 7 7 7 11 9 9 9 9 9 9 10 9 20 9
+ 7 9 9 9 10 10 9 9 9 9 9 11 7 9 7 9 9 9 9 9
+>gnl|ti|1086975887 name:1099575910441
+ 9 6 6 9 7 7 6 6 6 6 7 7 10 7 7 12 12 14 13 13
+13 13 13 16 16 12 12 10 9 7 7 12 12 17 25 19 21 21 36 29
+38 38 34 38 38 30 30 25 25 23 32 24 28 32 32 32 32 32 32 32
+32 34 34 34 35 34 34 35 35 35 25 34 21 19 10 9 14 7 11 10
+16 15 22 28 45 34 34 47 41 36 32 32 28 28 28 31 35 44 45 38
+38 47 47 41 47 47 47 47 47 47 44 44 38 44 29 31 49 32 24 26
+24 29 29 38 38 38 47 47 47 47 47 47 47 47 47 47 47 47 44 38
+44 44 38 38 45 45 45 35 34 34 34 34 34 38 38 38 38 38 44 44
+44 44 44 38 41 38 38 38 38 44 38 38 38 38 38 44 38 41 47 41
+47 47 47 47 36 47 47 47 47 47 49 45 27 23 18 20 30 30 44 41
+47 38 38 47 47 47 47 47 47 47 45 47 47 47 47 45 47 47 36 47
+36 40 38 40 47 47 47 47 47 47 47 41 47 38 44 40 32 38 38 47
+47 47 47 47 41 47 47 47 41 41 41 40 38 38 38 38 47 47 45 47
+41 47 38 47 40 38 40 32 38 38 38 41 47 47 47 47 47 47 41 47
+47 45 47 38 38 40 47 38 47 47 47 47 47 38 38 47 47 41 41 49
+49 47 49 49 49 47 45 49 49 45 35 35 44 44 44 44 44 36 40 40
+38 44 41 47 47 38 36 47 38 38 38 44 38 44 44 34 44 29 40 40
+45 36 36 47 47 47 47 41 38 45 40 36 44 38 40 40 38 49 47 47
+41 47 47 45 45 49 49 49 49 34 44 44 35 44 38 47 47 47 41 47
+47 45 47 45 47 47 36 47 47 47 41 47 47 47 47 47 45 47 45 45
+45 47 41 47 41 47 41 49 49 49 47 47 40 45 45 40 40 45 45 47
+47 47 47 41 40 44 35 35 38 38 47 47 47 47 47 47 47 47 45 49
+47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47
+47 47 47 47 47 45 49 44 44 44 45 38 38 49 49 49 49 49 49 49
+47 47 47 47 41 47 47 47 47 47 49 47 47 47 47 47 47 47 38 47
+47 38 47 47 47 49 47 45 38 34 40 45 44 47 47 47 47 41 47 47
+41 47 47 47 44 38 36 40 40 45 39 38 40 40 45 36 45 40 40 38
+38 47 47 47 47 47 47 47 38 47 47 47 47 38 47 47 47 47 47 47
+47 47 47 49 47 47 47 47 47 47 47 47 49 49 49 38 44 44 44 44
+44 49 49 47 44 38 44 40 44 44 47 47 47 40 44 44 44 38 44 47
+47 47 47 41 47 36 47 47 47 49 49 49 49 47 47 47 47 47 45 47
+47 45 47 45 45 45 47 47 47 47 47 47 47 47 38 47 36 47 47 41
+47 41 41 41 41 47 41 41 47 47 47 47 36 47 41 41 47 38 47 47
+47 36 36 47 45 36 27 21 29 23 17 19 39 39 39 20 13 13 18 16
+23 23 12 12 39 23 35 38 24 32 32 24 21 14 10 7 7 13 9 8
+12 14 8 7 7 10 6
+>gnl|ti|1086975771 name:1099575910444
+ 8 8 10 18 19 13 12 8 7 7 7 7 7 12 17 29 12 12 12 12
+12 10 9 7 7 12 12 14 15 16 16 17 15 16 28 31 28 26 34 34
+38 28 28 27 20 20 20 34 34 34 44 38 44 47 47 44 38 44 29 32
+29 32 32 32 40 38 44 47 41 30 25 25 21 21 23 35 34 33 25 25
+25 26 30 34 47 45 47 47 47 34 34 34 34 25 28 45 31 31 35 44
+44 44 44 33 33 34 34 29 25 32 32 32 32 47 47 47 47 47 41 47
+47 45 47 45 35 31 34 44 44 38 47 47 40 45 47 44 38 44 44 38
+38 47 47 41 41 44 45 40 36 36 38 38 32 32 40 35 29 35 34 38
+44 44 41 47 45 49 36 32 34 45 40 38 38 35 35 35 44 38 38 47
+47 38 38 44 38 44 38 47 38 41 47 45 38 44 45 45 44 38 47 47
+47 47 47 49 49 47 47 44 38 44 44 45 35 49 45 45 47 47 47 45
+47 47 36 47 47 47 47 45 47 49 49 49 49 49 49 47 49 45 47 47
+36 47 36 36 36 38 38 34 34 35 35 39 39 47 47 38 40 40 47 38
+47 47 47 34 44 38 34 31 29 28 28 39 40 41 47 38 40 40 34 38
+45 49 38 38 40 36 36 36 47 47 47 47 47 47 45 38 49 49 49 45
+38 35 44 44 44 44 36 38 44 38 38 38 38 31 49 40 36 36 40 38
+38 47 47 47 47 47 47 45 41 41 41 41 47 47 47 47 47 49 49 49
+49 38 34 40 44 36 29 34 44 38 35 44 41 41 47 45 38 32 32 38
+44 47 47 38 45 45 49 47 49 49 49 36 47 47 40 38 40 47 47 47
+47 47 36 49 49 49 38 47 38 47 47 47 47 47 47 47 49 49 47 36
+47 47 47 47 41 49 49 49 49 49 49 40 40 40 38 47 47 47 47 47
+47 47 47 49 45 47 47 47 47 47 47 47 47 41 47 47 41 49 49 44
+34 40 44 45 41 47 47 47 47 47 38 40 40 34 45 45 40 34 34 40
+38 45 44 44 44 44 38 38 41 47 47 47 47 47 47 47 47 47 44 27
+27 12 14 27 12 12 25 20 11 29 20 27 20 20 24 11 9 9 20 20
+45 36 40 38 33 33 18 16 9 7 8 6 6 6 8 10 8 8 13 6
+ 7 7 6 6 10 9 11 9 9 9 9 11 11 10 14 15 20 11 9 9
+ 8 9 7 7 9 7 9 9 14 16 20 10 13 18 11 10 11 10 11 12
+11 14 11 14 14 14 15 21 18 15 14 10 10 22 18 12 13 9 12 20
+11 13 11 14 16 19 13 10 11 9 9 7 11 11 14 14 14 20 18 19
+13 12 12 16 11 12 11 14 11 16 11 11 9 14 13 18 18 20 20 13
+15 23 20 20 13 13 16 19 20 22 13 18 17 16 12 12 13 13 10 14
+11 9 12 16 25 17 13 17 17 16 13 9 7 9 9 9 11 13 14 9
+ 7 6 7 14 9 8 13 9 9 9 9 7 9 9 9 6 7 9 9 9
+ 9 9 8
+>gnl|ti|1086975785 name:1099575910447
+ 6 6 8 6 9 6 9 7 9 8 6 15 10 16 14 17 14 14 21 38
+16 24 21 16 16 16 16 24 28 35 33 23 18 18 22 19 19 23 23 19
+19 21 21 18 20 44 31 25 25 23 27 20 19 20 20 20 20 29 25 24
+26 23 25 21 24 34 47 41 47 45 30 19 19 22 22 29 23 25 24 30
+24 34 31 25 29 27 30 26 23 27 33 38 44 44 38 38 44 38 44 47
+47 45 44 38 34 28 27 33 29 38 44 38 40 32 40 49 45 36 38 38
+44 44 33 33 33 33 32 38 45 38 38 35 38 38 38 38 47 47 47 49
+45 49 40 32 40 40 34 44 44 38 38 38 41 47 47 47 47 47 47 47
+38 47 47 38 47 45 47 47 49 49 39 32 32 34 45 38 38 44 38 47
+38 40 40 40 34 45 40 36 40 32 32 36 49 44 34 35 44 34 38 44
+38 38 38 47 47 38 38 38 38 38 38 38 35 47 47 47 47 38 40 34
+40 45 47 47 38 47 47 40 45 45 40 34 38 49 49 45 49 34 40 36
+32 40 38 40 44 38 34 34 44 38 44 38 47 47 47 47 47 40 38 34
+40 45 47 47 47 45 47 40 40 39 32 32 36 40 40 40 38 38 38 38
+35 44 44 36 38 44 38 38 44 35 45 47 47 38 40 32 49 49 36 29
+44 34 34 29 35 49 45 45 38 47 47 47 47 47 38 38 38 40 39 39
+36 28 28 31 31 38 38 38 40 40 32 40 38 38 47 47 47 47 47 38
+44 38 40 34 49 49 49 49 49 45 26 26 31 31 38 38 47 40 40 32
+32 36 39 47 47 45 47 47 47 40 40 36 36 39 28 28 39 39 38 38
+32 32 38 36 47 47 47 47 47 44 38 40 32 49 32 45 38 47 41 38
+45 49 36 45 49 47 47 47 45 47 38 40 40 38 38 40 47 45 40 36
+28 28 49 49 45 45 45 39 32 28 28 40 45 47 47 47 47 47 47 45
+45 36 49 45 49 28 28 40 32 38 38 47 38 47 40 40 32 32 44 45
+47 49 45 40 38 47 47 47 47 47 47 47 40 45 40 38 34 36 39 36
+28 28 40 45 47 47 47 47 47 44 47 47 47 38 47 47 47 41 47 47
+47 47 47 47 40 40 49 45 45 40 40 36 36 40 39 40 34 40 40 40
+40 49 40 47 47 47 47 47 47 47 47 45 49 49 49 36 49 49 49 40
+40 47 47 47 47 47 47 47 44 38 47 47 47 38 40 38 34 38 38 44
+44 35 49 49 49 47 47 49 49 49 49 45 45 47 47 47 38 36 49 49
+49 40 40 39 40 39 40 28 28 28 49 39 47 47 47 47 45 36 40 40
+40 45 40 47 47 47 44 44 47 47 36 45 44 47 47 38 40 40 40 39
+34 35 35 44 45 44 41 38 44 38 44 31 38 44 39 31 24 24 31 31
+44 47 47 31 29 29 25 28 26 26 24 28 45 29 14 12 9 9 6
+>gnl|ti|1086975858 name:1099575910453
+ 9 7 7 6 6 9 9 6 8 7 7 10 8 8 10 14 13 17 17 14
+16 12 14 15 20 12 12 19 23 21 26 12 14 14 15 20 15 16 24 22
+30 38 29 25 34 35 45 40 45 35 35 33 25 23 23 29 27 34 26 32
+31 29 29 26 26 38 47 47 47 47 47 31 32 22 30 20 20 23 30 22
+32 32 32 32 47 47 47 44 44 38 45 44 44 32 32 32 32 29 26 47
+38 44 38 38 38 44 44 38 44 44 38 38 44 38 38 34 34 40 44 38
+47 47 47 44 38 38 44 44 44 44 44 41 44 44 44 38 38 38 49 34
+40 38 38 44 35 34 38 44 38 45 44 33 33 33 33 34 31 44 47 47
+44 44 44 44 34 44 49 38 32 40 45 38 47 47 47 38 38 38 44 38
+38 38 41 47 47 45 49 45 44 38 47 38 38 47 45 45 47 45 36 41
+47 47 38 44 44 38 38 38 41 47 38 38 36 45 40 34 36 36 35 44
+44 34 35 26 40 40 40 47 41 44 38 38 44 44 31 40 40 45 49 32
+35 35 29 38 38 38 45 29 34 34 29 32 44 47 47 47 45 45 47 45
+47 47 47 38 47 47 40 38 36 38 34 44 35 31 35 35 36 45 47 41
+41 41 47 47 47 47 47 47 47 47 47 47 47 47 38 38 44 44 34 38
+45 49 38 44 38 38 34 38 40 34 40 40 38 47 47 49 38 47 47 47
+47 47 47 47 41 49 49 49 45 49 45 32 49 44 44 47 45 47 41 47
+47 47 44 47 47 47 47 47 41 49 38 44 38 38 44 38 41 41 47 41
+41 49 45 49 45 38 38 31 38 31 38 49 32 40 40 38 38 38 38 31
+34 40 34 34 39 45 47 41 47 41 45 38 40 40 40 38 47 47 47 47
+36 49 49 49 47 45 47 47 47 38 44 34 40 36 47 47 47 47 47 47
+47 47 47 47 47 47 47 38 45 36 28 28 49 49 49 49 49 47 47 47
+47 41 47 45 45 49 40 40 40 40 47 47 41 47 47 47 47 36 47 47
+47 47 45 45 34 49 49 49 49 47 49 49 47 45 47 47 47 47 47 41
+41 47 47 47 38 45 47 38 49 49 49 49 49 47 47 47 47 47 47 47
+49 47 49 49 49 47 49 38 47 47 47 47 38 45 40 49 44 39 44 40
+40 40 45 47 47 41 41 47 47 47 47 47 47 47 49 47 47 47 47 41
+47 47 36 36 41 47 36 47 47 47 49 49 49 49 28 28 39 45 47 47
+49 49 49 49 49 49 49 47 38 45 49 49 49 49 45 35 35 45 45 45
+44 47 47 47 47 36 36 35 35 44 44 47 34 47 47 47 36 47 47 47
+36 38 36 38 38 36 49 34 34 34 34 34 44 47 41 47 47 41 47 38
+38 26 29 44 38 44 29 38 47 36 38 32 34 36 36 38 31 29 27 24
+26 10 12 27 27 44 38 29 29 30 30 23 28 40 45 45 36 45 36 35
+44 23 19 8 7 6
+>gnl|ti|1086975799 name:1099575910459
+ 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 16 9 9
+14 11 9 7 8 13 14 14 14 15 18 28 23 23 23 28 26 25 35 18
+18 18 18 21 21 25 28 29 28 34 30 29 32 32 32 29 29 31 34 32
+29 31 31 35 42 44 44 35 38 44 38 40 26 29 23 25 25 29 33 33
+33 25 29 22 35 38 45 47 35 35 35 34 34 35 35 33 33 33 33 35
+38 44 38 38 40 38 44 44 38 38 38 47 38 44 44 38 44 44 38 38
+38 45 38 40 44 49 38 38 44 45 35 35 47 47 47 49 47 41 49 49
+47 47 47 44 34 38 44 38 31 31 33 34 29 29 31 32 30 32 49 41
+44 44 38 44 44 38 47 47 47 41 47 47 47 47 47 47 41 47 38 38
+38 47 47 47 45 44 44 44 38 34 34 39 34 34 44 45 47 41 47 41
+49 45 38 38 38 44 44 38 38 47 41 47 47 41 47 45 39 32 38 40
+38 34 40 36 47 47 47 47 47 47 41 47 47 47 47 36 47 40 40 36
+28 28 45 39 47 47 41 38 44 38 38 38 38 40 39 39 40 40 45 45
+47 41 44 38 45 44 44 44 38 45 47 47 40 40 49 32 49 49 49 45
+40 47 47 45 47 45 45 44 32 32 36 44 47 47 45 38 36 36 49 45
+49 47 47 47 44 47 44 45 40 36 45 40 38 45 45 49 32 36 36 45
+40 34 40 36 40 34 40 38 36 39 28 28 49 49 40 38 44 44 38 29
+38 40 40 40 40 44 45 47 47 47 38 36 40 38 38 47 38 47 38 47
+47 39 39 32 40 40 39 36 36 45 40 40 32 49 49 45 47 47 47 36
+40 36 40 40 38 38 38 38 38 44 38 32 34 44 38 47 47 47 47 47
+38 41 47 47 47 38 47 47 47 47 36 49 45 47 47 45 39 40 35 35
+45 45 47 47 41 38 38 34 44 38 38 47 47 47 47 47 47 47 47 45
+39 40 34 49 49 49 45 47 47 47 47 45 47 49 47 49 49 49 38 40
+34 45 45 40 49 40 47 47 44 47 38 45 49 49 38 47 47 47 47 47
+47 47 47 47 47 49 47 47 47 39 39 38 32 40 40 38 47 47 47 47
+47 49 38 32 49 49 36 49 49 34 34 44 38 44 44 38 36 47 49 49
+45 49 49 49 39 40 28 28 28 39 40 34 40 38 34 34 36 44 47 41
+47 38 47 41 36 36 38 34 34 38 45 47 47 47 36 47 47 47 47 47
+47 47 47 47 47 47 47 47 47 47 47 47 45 49 47 49 49 49 49 49
+49 49 47 47 47 47 38 47 36 41 47 47 29 38 38 44 38 38 47 47
+47 36 47 47 47 38 38 36 36 36 36 47 41 47 47 41 47 47 47 47
+47 36 27 27 23 23 35 38 47 41 41 36 38 47 34 38 38 34 34 34
+40 36 47 38 36 47 49 38 45 45 45 41 38 36 40 39 32 40 36 36
+36 40 39 40 36 24 32 32 23 28 40 40 47 49 36 38 47 36 36 47
+38 47 36 36 24 24 24 40 38 40 40 44 38 38 40 38 44 33 33 32
+33 33 44 44 38 32 32 44 44 39 32 34 32 45 40 24 24 36 47 47
+38 47 47 36 24 24 24 36 36 38 36 40 36 38 34 24 26 29 24 23
+24 24 32 25 32 24 40 40 40 40 24 24 36 44 27 27 29 38 38 45
+36 44 36 24 36 24 24 24 28 36 24 45 19 20 7 7 20 19 36 39
+28 23 36 32 23 35 27 16 14 12 9 7 9 9 9 16 14 15 8 8
+ 7 7 16
+>gnl|ti|1086975819 name:1099575910462
+ 6 6 9 7 7 6 6 7 6 6 6 9 13 12 9 7 7 12 12 14
+22 10 8 18 13 21 21 21 29 20 21 21 20 20 16 15 20 16 23 19
+22 27 33 33 38 32 32 32 28 26 21 21 21 21 28 23 26 38 26 27
+21 21 26 23 30 30 33 33 30 35 33 38 32 32 29 25 21 22 22 20
+26 30 27 29 22 27 30 29 34 34 38 38 44 38 35 35 38 38 44 38
+38 44 38 38 35 29 40 28 28 39 40 40 40 39 40 32 32 45 35 38
+38 44 38 38 47 44 45 40 40 40 40 28 28 28 28 45 45 45 45 40
+28 28 45 24 24 29 28 34 35 49 32 32 28 28 45 40 32 45 45 47
+47 47 45 47 38 36 40 40 44 40 40 34 40 32 34 40 38 38 36 40
+45 38 32 38 36 32 28 40 40 32 28 25 25 49 49 49 34 40 40 45
+40 32 40 40 40 40 36 28 28 39 45 38 45 44 28 28 24 26 30 28
+38 36 32 35 34 29 24 24 20 32 40 40 40 40 39 36 40 32 34 34
+29 38 38 34 34 49 40 32 40 36 40 45 39 36 40 40 36 49 38 38
+40 40 45 45 40 40 32 40 34 45 40 36 36 38 45 32 32 28 28 40
+40 40 34 40 40 40 36 49 49 36 34 34 34 34 38 34 40 34 40 32
+40 40 32 40 40 32 38 34 40 40 32 40 36 32 35 32 32 40 28 32
+36 40 40 34 39 34 32 40 40 23 23 39 39 38 38 36 38 36 36 44
+38 45 34 49 34 34 36 40 34 38 40 38 32 40 36 40 40 44 40 40
+40 32 32 39 36 40 36 28 32 25 49 45 28 28 49 28 28 28 40 32
+28 28 49 40 28 40 40 32 36 34 40 40 23 23 32 40 40 32 40 32
+28 28 28 32 32 40 40 36 36 39 39 32 28 32 40 23 28 40 40 40
+40 36 32 32 34 40 40 40 40 36 36 47 40 45 34 49 32 32 40 40
+40 38 38 34 29 38 34 34 40 40 40 40 40 32 34 35 29 29 29 34
+39 40 49 32 28 21 20 40 40 28 28 36 40 45 36 35 32 32 32 40
+28 39 23 23 40 39 44 34 40 49 49 49 34 35 35 35 38 38 29 38
+40 40 40 36 34 40 45 34 40 40 39 40 28 28 49 30 35 29 34 27
+28 28 28 28 45 30 40 40 28 28 40 40 38 40 40 49 45 36 40 40
+40 28 49 49 32 45 40 32 32 40 49 47 47 45 45 34 35 45 40 40
+47 40 39 49 21 21 39 27 40 36 40 49 49 49 38 38 34 26 29 29
+40 40 28 40 40 45 45 47 49 49 27 27 28 28 40 40 28 25 40 40
+28 40 39 40 40 38 40 32 32 36 40 40 40 40 40 34 40 40 45 38
+36 39 32 23 23 28 28 29 25 29 29 29 29 22 16 8 8 6 6 6
+ 8 12 16 13 10 12
+>gnl|ti|1086975885 name:1099575910465
+ 8 6 6 6 6 6 6 6 8 8 12 8 6 6 9 9 7 14 14 19
+12 13 13 14 12 12 14 14 18 29 19 47 19 21 25 24 19 24 36 38
+36 14 14 20 12 16 16 28 26 28 24 33 44 47 47 21 29 24 22 22
+22 25 27 25 32 29 32 28 38 38 44 27 25 26 28 26 23 23 44 40
+47 38 38 31 32 32 32 25 29 38 45 44 41 41 47 41 47 47 44 38
+38 44 38 38 44 45 38 44 38 44 47 47 38 47 47 47 44 38 38 38
+38 38 47 44 45 38 44 38 44 38 38 38 38 44 34 34 45 38 35 45
+44 38 38 38 44 44 47 47 41 47 41 49 47 47 38 44 35 35 44 35
+44 47 47 44 44 38 44 38 38 38 44 44 44 44 38 47 44 38 45 34
+29 44 38 47 47 47 47 47 41 47 47 47 41 49 49 49 41 47 47 47
+47 47 41 34 38 38 44 44 44 49 47 47 47 47 47 41 47 47 47 47
+47 47 47 38 33 30 33 30 28 29 34 32 38 38 38 44 31 38 38 47
+45 38 36 49 45 49 36 40 34 45 45 38 38 38 47 41 49 49 47 45
+47 47 38 40 32 28 28 40 40 40 40 38 35 35 38 31 44 38 32 40
+38 38 40 36 39 40 32 49 45 34 36 45 45 47 47 38 47 38 44 44
+38 44 44 49 38 44 38 38 38 44 47 47 45 38 47 47 47 47 49 36
+45 34 32 45 45 47 38 38 40 34 40 40 41 41 47 47 41 47 47 38
+47 47 41 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47
+38 47 47 47 40 47 47 38 47 38 40 36 40 40 40 39 39 40 40 32
+44 38 47 47 47 49 49 47 49 47 47 45 45 45 40 40 38 40 47 47
+45 38 45 47 39 29 26 26 31 31 38 47 38 44 47 45 47 47 41 47
+41 47 47 49 49 49 49 45 49 34 32 49 45 44 38 38 40 40 40 40
+47 38 36 40 34 40 40 45 40 34 34 45 44 47 47 47 47 47 47 47
+47 38 40 40 40 45 45 49 49 49 49 32 34 34 38 38 45 38 45 38
+45 45 28 28 39 45 45 38 40 47 49 41 41 47 47 47 47 49 49 47
+47 47 47 47 47 47 45 47 47 47 47 47 47 47 36 45 34 40 40 49
+49 34 49 36 36 38 38 47 47 44 45 40 38 45 45 38 24 40 24 47
+45 38 49 49 49 49 32 32 39 40 47 47 47 41 47 47 47 36 41 38
+44 40 36 49 45 49 49 49 36 45 45 47 45 38 38 32 20 20 12 11
+25 27 38 44 36 34 40 34 38 40 36 34 36 39 32 27 39 18 14 25
+21 40 19 24 25 21 18 18 9 9 14 20 27
+>gnl|ti|1086975768 name:1099575910471
+13 9 9 9 8 6 7 6 7 7 7 7 7 13 12 7 7 12 9 10
+16 12 9 9 11 11 13 16 18 23 23 23 33 35 32 30 27 27 25 25
+26 24 33 33 26 30 33 33 44 44 35 34 47 36 47 38 36 36 36 38
+29 34 24 34 25 35 34 40 34 24 44 45 35 31 29 33 23 23 30 30
+29 29 44 44 44 44 38 44 47 45 38 40 38 29 29 32 32 35 35 47
+44 45 44 44 44 45 47 47 47 47 41 47 44 38 35 35 35 34 47 47
+47 47 47 47 47 47 47 45 38 44 44 44 34 44 44 44 38 44 47 47
+47 47 47 45 47 47 47 47 45 40 44 44 35 35 47 44 38 40 41 45
+47 47 47 47 41 47 47 38 38 44 44 38 44 41 47 47 47 49 47 41
+47 47 41 41 47 47 41 47 47 47 44 40 38 44 44 44 38 49 45 36
+47 47 47 47 47 47 47 47 41 47 47 47 47 47 41 47 41 44 45 47
+47 47 41 38 38 38 40 40 44 47 41 47 47 38 38 47 47 47 38 47
+47 47 38 47 47 47 45 41 41 47 41 41 41 41 41 41 47 47 47 45
+47 45 47 47 47 41 47 47 47 47 38 47 47 38 47 47 47 47 41 47
+41 49 45 41 41 47 47 47 41 47 41 47 47 47 41 41 47 47 47 47
+41 47 47 49 49 45 38 47 47 47 41 47 45 47 36 47 47 41 47 47
+47 47 47 47 41 49 49 47 47 41 41 41 47 47 47 47 47 41 47 47
+41 47 47 47 47 47 47 47 49 41 36 41 47 47 47 47 47 41 44 38
+35 44 38 44 47 47 47 47 47 47 41 41 47 47 47 47 47 47 41 47
+49 49 49 49 49 45 38 38 44 44 44 44 41 47 47 47 47 41 47 45
+45 47 47 47 47 36 44 45 38 47 47 47 47 47 47 49 47 47 47 47
+47 47 47 47 47 47 47 47 41 47 41 41 47 41 47 38 47 47 49 47
+47 47 47 47 41 47 47 39 39 17 11 20 16 10 7
+>gnl|ti|1086975788 name:1099575910474
+ 8 6 6 6 9 7 6 6 6 8 12 10 12 12 12 7 8 11 14 20
+21 22 30 27 25 30 31 29 34 26 14 14 18 15 25 12 18 18 15 15
+15 29 19 35 25 21 21 19 21 23 21 19 16 16 25 25 28 19 29 29
+22 31 27 30 26 26 26 28 38 29 29 24 36 19 16 9 9 22 16 49
+45 31 34 35 34 42 36 34 40 44 38 38 44 44 38 44 47 41 47 47
+41 47 44 44 34 35 34 34 44 45 41 47 47 47 40 39 40 28 29 29
+38 38 44 38 47 45 45 32 34 45 45 45 45 40 36 45 45 47 36 36
+38 44 44 44 44 44 47 47 41 47 47 41 38 38 38 38 45 45 47 47
+41 47 49 45 38 40 32 45 36 45 34 32 44 44 44 44 34 34 44 45
+47 47 47 47 38 40 39 24 26 28 26 31 31 38 38 38 38 44 38 44
+44 38 45 47 45 49 36 47 47 44 47 47 47 41 47 47 45 47 41 41
+47 36 44 38 47 47 47 38 39 40 28 40 39 45 47 47 47 45 45 45
+40 40 49 49 38 34 35 44 38 38 47 38 38 44 34 34 34 44 38 44
+44 34 40 34 36 49 45 47 49 45 49 45 32 29 29 29 38 29 34 38
+38 41 47 41 47 47 38 36 40 45 49 36 36 44 38 47 47 41 41 47
+41 47 41 47 38 47 38 38 44 44 38 38 44 49 49 49 49 49 44 38
+38 44 44 35 36 47 47 38 38 44 44 38 44 41 47 47 47 47 41 41
+47 45 47 47 41 41 47 38 44 40 32 36 45 38 47 47 47 47 47 47
+47 47 47 47 47 38 41 41 47 41 47 47 44 44 40 32 44 44 47 36
+47 38 44 38 36 40 38 38 47 47 47 41 41 47 47 47 47 41 47 47
+47 47 44 44 36 38 40 49 44 47 41 47 47 47 41 47 47 47 47 47
+47 40 40 32 35 49 35 35 34 33 33 34 38 44 44 38 47 41 47 47
+47 44 49 47 47 47 47 47 47 47 47 41 47 47 49 41 47 45 47 41
+47 41 47 41 47 47 47 47 36 40 40 47 40 40 49 49 47 47 47 47
+47 47 47 47 47 47 47 38 45 49 47 47 47 47 47 47 47 47 47 47
+38 45 40 40 45 38 47 47 47 47 45 44 44 38 47 47 47 36 38 38
+38 45 38 44 47 47 47 47 47 47 40 44 38 49 49 49 38 38 44 44
+44 38 49 49 47 45 41 47 47 47 47 47 40 45 36 47 38 47 47 47
+41 38 44 44 44 44 44 47 45 47 47 41 47 47 47 47 47 47 47 47
+47 40 49 49 47 45 47 47 47 47 47 47 47 38 47 47 47 47 47 47
+47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47
+47 47 47 38 38 47 38 47 47 49 49 38 38 44 24 44 29 44 44 36
+47 47 36 47 47 47 47 41 47 38 38 34 30 27 26 21 24 20 20 32
+18 19 32 22 32 45 38 45 44 44 34 27 24 34 35 16 14 6 6 9
+ 7 14 17 14 14 13 10 10 6 7 10 9 7 6 9 7 7 12 9 7
+ 6 7 9 14 10 10 9 11 8 10 9 9 7 8 9 7 7 9 9 7
+ 9 7 7 7 8 11 6 6 8 9 9 6 7 7 7 7 9 8 6 6
+ 6 7 7 7 8 10 12 13 10 11 18 12 11 7 9 8 9 9 9 7
+ 7 9 8 8 15 15 12 12 12 7 9 9 7 6 7 8 7 9 9 10
+ 9 7 7 9 9 9 7 7 7 7 7 9 8 7 7 13 13 7 7 8
+ 8 9 9 9 9 7 7 13 7 11 9 10 7 11 9 7 9 8 8 7
+ 7 7 7 9 7 7 7 9 7 7 7 7 6 9 6 7 7 12 9 7
+ 9 7 7 9 7 7 7 7 8 8 9 7 7 8 7 7 9 8 10 8
+ 7 7 9 9 9 9 7 9 7 9 7 9 7 7 9 7 7 6 6 10
+ 8 7 7 8 7 7 8 9 7 7 7 7 6 7 7 7 9 8 9 7
+ 7 10 9 7 9 7 7 9 8 9 9 9 8 6 9 7 13 8 10 9
+ 8 9 8 7 9 7 10 7 9 7 8 8 8 10 7 7 7 12 12 24
+12 19 7 9 7 7 9 9 6 6 9 11 16 9 9 8 9 8 9 9
+ 6 6 7 7 7 7 9 9 10 7 7 7 9 9 7 7 6 6 9 6
+ 6 6 7 9 9 9 8 7 7 7 7 7 8 9 9 9 9 8 7 7
+ 7 9 9 7 9 8 9 7 7 8 8 9 9 9 9 7 7 7 7 9
+ 7 7 6 6
+>gnl|ti|1086975781 name:1099575910477
+ 6 6 6 7 7 7 7 7 7 7 6 6 7 10 10 12 8 8 12 12
+12 12 12 12 11 11 17 16 8 8 15 15 13 12 13 12 12 12 14 14
+13 15 13 15 19 19 19 23 21 16 21 21 14 21 23 29 29 22 30 22
+18 18 10 10 13 13 17 19 19 21 22 21 30 30 24 19 17 17 18 14
+16 18 25 26 29 34 31 35 29 29 28 26 39 28 23 26 24 24 21 24
+24 20 20 24 24 34 34 34 29 29 24 24 26 27 39 28 27 27 19 19
+21 19 27 26 29 22 24 18 23 23 25 29 40 28 28 32 28 28 24 28
+30 20 20 20 25 27 20 18 27 25 29 34 38 25 25 23 27 27 27 24
+29 29 35 29 40 28 40 28 28 29 29 28 29 29 34 24 24 27 21 25
+25 45 27 28 29 31 31 34 40 27 27 19 18 27 23 19 28 23 19 26
+12 9 19 26 27 40 32 32 32 32 49 49 34 38 32 34 40 40 32 40
+40 40 39 36 28 32 32 40 28 28 32 32 27 25 25 35 29 28 28 23
+27 27 19 19 29 29 40 40 32 39 23 28 40 32 40 40 40 32 35 32
+32 40 49 49 45 45 45 40 32 32 32 32 32 27 27 21 27 29 27 28
+32 28 40 32 28 28 27 25 19 23 21 28 27 40 32 28 32 40 32 29
+29 28 28 29 35 32 40 32 27 27 49 28 40 40 40 32 34 36 32 40
+39 28 28 28 32 32 28 49 49 28 28 40 40 40 40 45 28 28 28 28
+45 45 32 49 49 28 28 32 30 29 35 28 28 29 49 32 28 32 45 45
+45 32 40 28 23 28 27 27 28 28 32 32 40 28 23 27 27 28 28 40
+32 40 40 39 49 28 23 23 28 26 26 16 14 20 26 27 28 27 28 28
+32 21 20 10 9 13 12
+>gnl|ti|1086975818 name:1099575910480
+ 9 6 6 7 6 6 7 8 14 12 13 17 16 16 10 8 7 16 17 21
+16 12 13 13 14 12 12 15 16 17 14 20 25 20 20 18 19 19 19 32
+29 18 18 18 18 22 23 24 32 26 34 23 19 21 18 12 14 22 24 19
+19 31 19 21 25 32 23 27 38 38 27 33 25 34 38 29 33 27 19 19
+19 19 19 23 44 44 32 40 36 24 39 39 28 28 45 29 34 35 38 38
+44 44 44 38 44 44 44 47 38 40 40 40 32 32 34 34 33 29 38 38
+44 44 39 40 28 28 29 30 34 31 28 28 35 35 34 34 34 25 38 44
+45 45 47 44 38 38 44 38 38 45 47 47 47 47 38 44 45 38 34 29
+34 40 45 40 47 49 44 47 38 39 40 40 40 36 36 47 47 47 47 47
+47 47 47 47 47 47 38 44 29 27 28 28 39 31 38 44 35 38 38 36
+39 39 34 32 28 26 28 34 29 38 47 38 38 38 44 34 34 44 38 38
+38 29 40 28 49 49 45 32 40 40 40 40 28 24 26 26 31 28 28 40
+45 45 45 47 47 45 40 40 32 40 32 49 49 40 45 40 40 45 36 47
+47 38 38 34 34 35 35 40 39 45 40 32 38 38 36 36 38 45 44 38
+38 44 38 31 39 32 49 29 29 38 38 38 38 45 38 34 36 40 40 38
+38 38 47 40 36 38 40 40 40 40 32 32 40 40 47 47 45 47 47 38
+47 47 47 47 39 45 40 38 40 40 45 38 40 40 28 28 40 40 32 45
+40 38 40 40 34 34 36 39 47 47 41 36 41 47 47 47 45 38 40 38
+40 40 40 40 39 32 35 49 40 47 47 47 38 47 47 38 47 47 47 45
+38 32 32 23 23 39 39 32 40 39 40 40 40 40 45 49 34 40 40 47
+41 44 47 47 47 47 47 47 47 44 47 47 47 45 49 36 40 38 44 47
+47 38 47 45 40 34 40 40 36 40 40 40 28 28 40 49 40 36 38 40
+34 45 40 38 38 40 34 38 38 47 47 49 47 47 38 47 47 47 47 45
+40 39 28 28 40 40 38 47 47 49 29 29 29 31 38 34 40 44 40 40
+40 40 36 40 44 38 45 47 44 44 40 40 49 28 28 49 40 40 45 40
+36 45 28 28 40 40 47 47 47 47 47 45 40 45 34 40 36 49 49 36
+49 34 38 38 38 38 44 36 47 38 44 40 40 39 40 40 34 40 45 36
+28 28 40 36 38 35 29 20 13 12 12 13 13 13 13 14 20 7 9 7
+ 7 9 8 9 10 10 9 9 9 10 10 8 11 9 9 9 16 10 11 7
+ 9 9 7 9 7 9 9 8 8 9 9 8 9 9 9 9 7 8 8 8
+15 14 9 9 9 9 9 9 7 10 9 9 9 9 12 13 11 9 9 7
+ 9 12 8 9 9 7 7 11 10 16 9 9 9 9 9 10 9 9 10 9
+ 9 9 9 9 9 9 10 10 7 6 9 6 6
+>gnl|ti|1086975882 name:1099575910483
+ 9 7 6 7 9 9 9 7 6 6 8 7 7 8 8 13 14 14 17 14
+14 11 9 6 6 6 9 14 16 16 17 14 14 17 15 15 16 26 26 24
+40 44 44 32 18 18 18 18 21 25 25 35 35 25 27 23 22 18 18 20
+24 29 26 28 23 27 26 29 44 38 35 34 34 45 47 38 33 32 31 35
+44 45 38 38 38 38 34 33 44 38 44 44 47 47 39 40 39 28 28 29
+29 31 32 30 34 38 44 33 31 40 35 31 31 44 38 38 33 33 31 38
+29 29 28 28 31 31 38 38 47 47 47 38 47 44 38 44 44 38 35 40
+44 40 36 32 40 34 44 44 40 33 33 34 35 34 45 40 41 47 38 38
+40 38 40 47 47 47 47 47 47 47 36 47 38 45 32 45 45 45 44 38
+35 40 40 44 44 38 44 35 29 31 29 29 34 34 38 31 31 28 28 31
+31 38 38 38 44 49 47 45 47 47 49 49 41 36 47 44 44 38 44 38
+38 47 44 47 36 36 40 40 34 34 34 38 44 38 40 32 49 39 32 32
+40 39 47 45 49 44 35 34 38 38 38 41 44 44 38 44 38 31 34 34
+49 49 45 49 47 47 47 47 40 38 38 34 34 40 39 47 47 40 38 40
+45 49 40 32 40 40 40 36 40 40 40 34 38 44 38 38 38 47 47 47
+47 41 38 45 49 49 49 45 41 47 47 41 47 47 47 47 44 38 40 36
+45 38 47 38 49 49 49 45 44 38 44 44 35 34 38 49 49 49 49 47
+47 47 36 40 44 40 47 47 47 38 47 36 38 40 40 40 45 44 40 40
+40 40 39 40 40 38 40 40 40 40 32 40 40 47 47 47 47 47 47 47
+38 47 47 47 41 38 47 47 47 47 45 44 47 38 44 34 40 45 45 47
+47 47 47 47 47 38 44 47 41 49 49 49 49 40 28 28 40 32 35 40
+40 40 23 20 21 13 18 16 26 22 35 29 29 24 20 20 12
+>gnl|ti|1086975779 name:1099575910486
+ 6 6 9 6 9 6 6 6 8 10 10 10 10 11 19 19 19 19 19 19
+19 19 23 19 20 21 34 34 36 24 23 23 14 22 20 20 23 29 47 23
+27 23 24 28 21 26 27 16 24 24 16 14 23 22 17 34 29 25 28 28
+29 29 28 24 25 25 23 23 23 30 32 38 31 38 38 33 32 32 32 33
+30 44 38 38 35 38 44 38 38 34 34 34 34 38 45 47 47 47 47 40
+39 34 35 34 29 38 34 40 34 34 35 38 38 38 38 31 38 38 47 44
+33 33 38 38 38 38 47 47 36 38 38 38 44 38 38 36 49 49 40 40
+40 40 41 38 38 38 44 44 38 38 29 40 38 38 38 38 44 38 38 33
+35 28 26 31 30 38 34 36 32 29 29 35 44 38 29 38 44 38 38 44
+47 47 41 45 49 45 45 45 47 38 47 47 45 49 40 28 28 39 40 40
+38 38 44 38 40 38 30 29 29 44 38 44 38 38 49 49 49 47 45 45
+49 34 34 49 36 36 32 40 38 47 45 47 31 38 38 44 38 38 41 47
+47 47 47 45 45 45 40 32 34 34 38 44 38 38 39 40 32 28 28 40
+40 47 38 47 47 40 38 38 40 47 47 38 47 36 36 47 47 47 45 47
+45 40 40 40 40 49 49 47 39 36 32 28 28 39 40 47 47 40 36 44
+38 38 32 40 45 45 47 47 47 47 47 47 45 41 47 38 38 40 32 29
+34 44 38 38 38 47 47 47 47 47 47 47 40 47 47 38 47 47 38 47
+45 40 40 40 32 36 34 44 38 31 38 38 47 47 41 47 40 39 28 23
+23 49 40 34 45 45 47 36 38 47 40 40 32 32 39 38 47 47 47 40
+39 32 36 21 21 39 40 47 47 36 38 41 44 38 38 44 44 45 47 45
+45 36 49 49 28 28 40 32 38 38 47 44 44 49 49 47 38 38 38 38
+38 38 47 38 38 38 40 40 40 38 40 47 39 39 40 23 23 40 32 38
+40 38 38 49 47 47 49 45 47 38 47 47 47 47 47 47 47 40 39 40
+40 40 45 40 49 38 40 38 45 45 47 47 45 38 40 34 44 38 38 40
+29 27 19 19 29 29 40 45 49 49 49 49 45 49 49 40 40 44 38 40
+40 38 38 40 36 40 40 47 45 45 49 49 49 49 49 49 45 44 40 36
+45 45 47 45 45 36 40 40 40 28 28 28 40 39 47 47 47 47 47 49
+47 49 49 49 47 47 47 47 36 47 49 47 49 49 47 47 47 47 41 38
+44 38 38 44 38 38 47 47 47 47 47 44 44 34 32 44 38 47 47 40
+49 36 49 28 28 39 40 45 47 47 47 47 47 47 49 45 49 49 49 34
+40 45 45 44 35 24 29 44 38 49 38 34 44 44 34 38 44 38 47 40
+44 40 40 40 24 23 23 21 14 45 29 28 28 45 36 24 20 18 23 14
+13 9 9 8 7 7 7 14 16 19 9 9 10 17
+>gnl|ti|1086975772 name:1099575910493
+ 8 6 6 6 6 6 6 6 6 6 6 12 11 14 12 7 7 12 20 27
+27 14 14 16 14 14 17 16 19 16 21 19 25 29 25 25 21 27 21 26
+25 32 31 35 42 35 31 31 31 32 32 26 32 32 32 31 30 34 31 29
+27 25 25 30 25 23 45 47 47 44 27 23 23 23 23 29 29 42 44 44
+47 47 47 47 41 47 47 47 47 41 47 47 41 31 31 31 31 31 32 34
+44 38 44 44 44 45 35 35 42 32 32 31 29 31 28 44 44 38 38 32
+32 32 32 29 29 44 38 44 38 47 41 47 47 47 41 41 29 30 32 31
+31 29 49 49 44 40 34 44 44 44 38 44 38 47 47 47 34 38 38 35
+44 44 47 47 47 47 45 45 47 47 47 47 41 41 47 47 47 45 49 49
+47 47 44 38 44 38 38 44 47 47 41 47 41 47 47 47 47 47 38 38
+38 38 38 44 38 38 44 40 34 44 45 44 38 44 44 45 44 47 47 47
+47 41 47 45 45 47 47 47 38 44 45 38 38 38 49 49 47 38 44 38
+44 35 35 45 45 47 47 47 41 47 47 47 45 47 47 47 47 41 47 45
+45 41 41 47 47 47 41 47 41 41 47 47 47 47 47 41 41 38 38 38
+38 44 44 38 38 44 38 38 49 47 47 47 38 47 47 38 38 45 44 38
+44 44 47 47 36 47 39 40 40 28 28 39 31 38 38 44 38 44 47 47
+38 38 47 49 49 49 45 47 47 47 47 40 40 34 32 39 40 41 47 47
+47 47 38 44 44 40 44 38 47 47 47 36 49 34 34 34 38 38 38 44
+38 47 41 38 38 47 44 45 38 47 47 47 41 41 47 41 47 47 47 47
+47 47 44 39 40 28 32 40 40 47 47 47 41 49 47 45 49 47 45 41
+47 41 47 47 47 47 47 47 44 47 47 44 44 40 49 47 47 41 34 38
+38 44 44 44 41 41 47 41 41 47 40 39 28 28 39 39 40 44 44 36
+40 49 49 45 45 38 44 38 38 38 38 40 40 34 40 40 32 45 44 39
+39 40 40 40 28 19 16 13 17 21 23 26 22 20 20 9 7 6 9 7
+ 7 7 9 9 10 11 9 10 9 10 9 9 9 9 9 9 9 9 7 9
+ 9 9 14 9 9 9 9 9 12 12 9 9 9 8 11 9 12 10 9 9
+10 9 9 9 10 10 9 9 9 9 9 9 9 10 10 10 9 12 12 17
+13 20 11 9 9 9 9 7 7 9 9 9 9 9 9 9 10 10 9 9
+ 9 9 9 7 12 9 9 9 9 11 7 9 9 9 10 15 12 11 9 9
+ 9 9 9 9 9 9 9 8 9 9 9 9 9 9 6
+>gnl|ti|1086975793 name:1099575910496
+ 6 6 8 6 6 7 7 7 10 10 12 12 12 12 12 14 14 14 18 18
+21 12 12 12 12 12 12 16 18 19 18 22 14 25 24 26 26 21 21 25
+32 31 31 26 29 26 28 29 34 42 42 42 35 42 32 31 31 27 24 24
+45 36 38 44 44 44 38 22 23 22 20 15 16 16 15 18 22 32 38 47
+26 29 29 32 32 29 38 47 38 38 47 35 35 35 34 44 44 38 44 44
+44 40 38 38 44 38 38 44 31 35 30 29 31 29 40 45 44 41 47 47
+47 38 47 47 47 47 41 47 47 41 47 38 44 38 26 35 38 44 38 47
+44 44 38 38 35 38 47 47 47 41 47 41 47 47 38 40 36 28 28 39
+45 47 38 47 47 47 49 49 49 49 44 44 44 44 38 38 47 47 47 47
+47 47 47 47 47 41 47 47 49 47 49 47 40 38 44 44 38 44 38 38
+45 44 44 38 47 47 47 47 47 41 47 47 47 47 47 47 36 47 47 41
+47 41 47 47 41 41 41 47 47 47 47 47 47 47 44 35 38 40 44 44
+47 47 47 47 47 47 41 41 41 47 41 47 47 47 47 47 47 47 36 36
+47 47 47 47 45 47 45 47 47 49 49 47 49 47 36 47 47 47 45 38
+38 38 38 44 47 41 41 47 38 47 47 40 47 47 47 47 41 47 44 31
+29 29 38 35 34 45 34 35 39 40 38 36 44 47 45 45 47 41 41 49
+49 47 41 36 47 47 47 38 47 47 47 47 47 47 41 47 41 38 45 49
+38 40 38 38 47 38 38 47 47 47 47 47 47 41 47 41 47 47 41 47
+41 41 47 47 36 47 38 45 45 34 40 45 45 36 49 38 34 34 38 44
+44 47 41 41 47 38 47 49 49 45 36 49 49 45 47 47 41 41 47 47
+47 47 47 47 45 49 49 45 49 45 41 47 45 47 47 47 47 47 47 47
+47 47 45 47 49 47 47 47 47 45 45 47 47 47 47 41 47 47 47 41
+41 47 47 45 41 47 41 47 47 47 47 47 47 47 47 47 47 38 38 47
+47 45 45 49 49 47 47 47 47 41 47 47 47 47 47 47 47 47 49 49
+47 47 47 47 47 40 44 38 44 38 44 49 49 45 47 47 44 47 47 47
+47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 38 38 38 36 40
+40 36 47 44 45 49 34 34 44 38 38 38 34 35 38 44 38 44 47 47
+47 45 47 47 47 47 47 38 45 44 45 44 38 47 47 44 39 29 14 11
+39 45 47 47 47 45 45 49 34 49 45 49 47 49 49 40 40 29 35 28
+28 22 22 20 20 15 12 23 22 27 15 17 12 12 12 12
+>gnl|ti|1086975843 name:1099575910499
+ 9 9 9 6 7 7 7 6 7 8 6 6 7 7 8 7 8 16 16 12
+12 12 12 12 12 20 13 24 23 19 22 29 26 30 21 27 34 25 29 29
+34 35 35 35 28 28 20 23 23 28 33 38 47 20 20 22 24 25 25 29
+29 31 44 44 35 35 34 34 34 26 34 27 27 29 33 33 33 32 33 45
+40 49 49 32 32 32 32 32 32 47 47 47 47 47 47 47 44 33 33 31
+31 31 34 47 49 32 31 34 32 32 29 38 33 33 31 33 30 44 34 34
+38 44 38 38 44 35 32 45 44 41 47 47 47 47 47 47 47 47 47 47
+45 47 47 47 47 41 47 38 44 44 44 38 38 38 38 44 38 34 38 40
+36 34 40 45 38 41 47 47 47 47 45 45 40 40 45 45 47 38 47 47
+47 41 47 41 45 47 44 38 44 44 45 38 29 34 44 44 44 49 41 47
+47 47 47 47 47 47 41 47 47 47 47 49 45 32 32 34 31 29 31 28
+28 36 40 47 38 47 47 47 47 38 47 47 47 47 47 47 40 38 34 40
+40 38 38 47 38 36 47 47 47 41 36 47 38 40 38 38 47 47 45 36
+47 47 47 47 45 45 47 47 41 47 47 47 47 47 47 47 40 47 38 36
+45 31 24 26 29 29 34 32 35 28 28 35 29 44 47 36 38 44 38 38
+29 34 44 44 47 38 44 40 34 36 45 47 38 40 40 38 38 47 47 47
+38 40 32 34 44 38 47 47 41 38 47 47 47 47 41 47 47 49 38 47
+47 47 47 47 47 45 45 47 40 38 40 40 38 36 41 47 47 47 47 49
+49 47 47 41 45 35 45 29 35 35 34 38 40 40 36 40 49 32 49 38
+47 36 38 38 38 38 35 38 40 40 38 34 34 38 45 41 47 47 38 38
+38 44 38 38 40 40 38 47 47 45 45 45 45 49 45 49 36 36 38 40
+38 38 40 38 40 40 34 38 40 40 39 40 40 40 40 45 45 45 49 34
+29 34 29 38 29 34 34 34 34 35 44 44 47 45 47 47 45 47 47 47
+44 44 40 36 40 40 34 40 40 40 34 36 39 40 40 38 45 47 39 39
+28 28 40 32 28 28 32 36 36 39 39 17 12 23 20 28 28 32 49 38
+34 32 29 23 14 27 45
+>gnl|ti|1086975794 name:1099575910505
+ 9 9 6 7 9 6 6 8 9 8 10 11 7 7 11 15 20 16 15 12
+12 12 17 19 21 24 19 25 24 28 26 29 25 38 44 29 45 44 44 45
+34 26 22 23 22 22 23 29 38 40 47 26 27 27 24 25 27 31 29 31
+35 29 34 34 35 33 29 22 33 33 33 33 30 24 19 17 17 21 25 40
+36 30 25 32 32 31 32 44 47 47 47 47 47 38 35 35 34 34 35 35
+42 47 49 37 31 35 32 29 32 45 29 26 31 29 26 22 20 23 26 29
+34 44 47 47 41 47 47 41 47 47 38 38 44 38 38 44 41 41 49 49
+49 47 47 47 41 31 35 35 30 29 30 38 44 38 44 38 38 41 47 38
+44 44 38 38 44 47 47 47 47 47 47 47 47 47 47 38 47 36 47 41
+47 45 45 47 44 44 38 40 45 38 34 34 38 44 44 49 47 47 47 41
+47 47 47 47 44 47 47 36 49 49 41 45 47 47 47 47 47 47 47 41
+47 47 36 47 47 47 47 47 47 47 47 49 47 47 47 41 47 47 47 41
+47 45 47 49 45 47 41 47 47 47 47 41 47 41 41 41 38 44 44 40
+38 35 47 47 41 47 47 41 36 47 47 47 47 47 47 47 41 45 45 38
+35 44 38 29 38 49 44 38 38 44 44 38 47 47 47 41 47 41 47 41
+47 47 47 47 47 47 41 31 38 44 44 38 38 49 49 45 49 49 49 36
+47 47 45 47 47 47 41 47 41 47 47 45 47 47 47 45 49 38 47 45
+47 47 47 41 47 47 47 47 47 47 47 41 41 47 45 36 41 41 41 47
+47 47 47 47 47 47 47 47 47 41 47 47 41 47 41 47 41 47 41 47
+47 47 47 47 47 47 47 47 47 47 41 47 45 47 41 47 47 47 47 41
+47 44 44 38 44 47 47 47 47 47 47 41 47 47 47 47 41 47 47 47
+47 41 47 47 41 47 47 47 47 41 41 41 41 44 47 47 47 38 38 44
+44 44 44 47 47 47 41 47 47 47 47 47 47 47 47 47 47 47 47 47
+47 47 41 47 41 47 47 47 47 44 38 40 40 47 47 47 47 49 45 49
+49 45 49 45 49 49 47 49 39 28 28 39 39 32 32 39 29 20 13 20
+15 23 21 24 28 32 26 23 24 24 20 20 45
+>gnl|ti|1086975805 name:1099575910509
+ 6 6 6 6 6 6 6 6 7 8 9 14 13 13 19 19 13 20 12 20
+17 14 28 28 26 32 25 33 38 44 47 47 47 35 35 34 34 35 26 33
+33 29 33 33 35 34 35 35 25 22 17 22 16 17 25 29 29 34 30 23
+29 21 25 25 26 32 31 47 36 38 26 31 33 28 22 19 20 28 32 35
+47 47 38 38 38 44 34 34 44 38 31 31 38 45 38 38 45 45 45 38
+45 44 38 38 38 44 38 31 31 33 35 35 29 38 38 38 34 38 38 38
+44 44 41 44 38 44 31 38 44 38 31 34 34 35 35 35 34 44 44 47
+47 47 47 38 38 36 34 34 31 31 38 44 44 44 38 47 47 36 47 44
+35 33 33 27 33 45 49 45 49 49 41 47 47 47 47 47 38 36 40 38
+34 40 38 45 45 47 47 47 47 47 36 47 47 38 44 38 38 47 38 44
+47 47 47 47 41 45 45 47 47 38 45 38 41 38 44 38 38 38 38 38
+38 44 44 38 38 38 44 44 44 38 38 47 47 47 49 45 49 44 38 38
+44 44 38 36 47 38 45 45 49 36 49 49 49 38 38 38 38 38 38 47
+47 47 47 47 45 47 47 47 38 38 40 40 38 36 36 38 44 38 34 32
+44 38 41 41 47 47 47 47 47 45 47 41 47 41 47 41 47 47 40 40
+36 28 28 31 29 38 38 38 47 47 41 47 38 45 40 40 38 47 47 41
+49 49 49 32 28 28 45 45 45 47 47 47 47 45 49 49 41 47 47 47
+47 47 38 36 40 49 49 45 38 34 40 38 38 40 38 45 47 45 47 47
+47 47 47 47 47 47 47 47 44 47 38 40 38 45 41 47 47 41 47 47
+47 47 47 41 47 47 47 49 49 38 47 45 45 49 34 49 45 47 41 41
+47 41 44 38 38 47 47 47 36 41 41 47 44 41 40 40 49 35 40 45
+41 41 47 47 47 47 47 45 49 47 47 47 45 45 47 47 47 47 47 40
+45 32 29 28 29 31 38 44 47 47 41 45 45 40 49 32 32 32 45 49
+47 47 40 40 34 34 40 40 38 49 49 49 47 47 47 47 47 47 47 47
+47 47 47 47 47 38 47 47 47 36 36 49 49 32 40 44 45 47 47 47
+47 44 47 39 40 40 40 39 39 47 49 47 47 47 47 47 41 47 47 47
+47 47 47 47 47 47 47 47 47 47 47 38 38 44 44 38 44 35 47 47
+47 47 47 40 40 29 24 19 19 21 22 33 30 26 20 13 9 12 12
+>gnl|ti|1086975904 name:1099575910512
+ 9 6 9 7 7 8 6 6 6 7 8 8 12 20 14 14 17 30 12 12
+12 16 15 14 18 19 33 32 22 34 29 35 47 41 47 35 35 34 34 29
+29 35 35 44 34 34 30 28 31 31 25 22 24 20 22 17 26 29 29 44
+29 29 28 21 26 27 35 29 27 32 33 30 23 23 22 22 22 19 24 32
+32 38 35 41 44 44 44 34 35 34 44 47 31 30 34 35 35 35 38 38
+44 44 38 35 35 34 34 34 34 44 34 34 44 34 34 34 44 44 38 44
+44 44 38 38 44 40 44 44 44 38 38 47 47 44 44 34 34 35 35 44
+38 44 38 47 47 47 47 36 47 47 47 47 47 47 47 47 47 41 47 41
+47 41 45 44 40 34 40 40 38 47 47 38 36 38 40 45 44 41 41 41
+47 47 47 47 47 44 36 47 45 45 40 34 32 40 45 38 44 38 44 47
+38 38 47 47 47 47 45 41 47 47 47 47 47 41 41 44 44 38 38 44
+38 38 38 44 44 31 38 44 38 44 44 44 44 47 47 47 45 49 49 44
+44 34 38 44 44 38 40 36 49 47 49 47 49 45 49 38 38 38 38 44
+38 47 47 47 47 47 47 47 41 47 47 38 47 40 38 49 49 47 49 45
+49 32 38 45 47 47 47 47 47 41 47 49 45 49 49 45 45 47 49 47
+45 44 38 47 36 45 36 47 47 41 47 47 47 47 47 44 44 40 38 47
+47 47 49 49 49 36 32 32 45 45 45 47 47 47 47 45 41 47 41 47
+41 36 47 47 47 47 47 49 47 49 47 45 47 47 47 38 44 38 44 44
+44 47 47 47 47 47 47 47 49 49 49 38 44 38 38 38 45 41 47 47
+47 41 34 38 44 44 38 35 49 36 47 47 47 47 47 47 47 38 47 47
+47 47 47 47 47 41 38 44 44 44 38 38 41 41 47 38 45 45 40 40
+44 45 41 41 47 47 47 47 47 49 49 49 45 47 47 47 41 47 47 45
+49 45 45 49 40 40 47 38 47 41 47 41 47 38 39 40 28 28 32 36
+36 47 47 47 39 40 28 28 40 40 41 45 44 40 47 47 47 47 47 47
+47 47 47 47 47 47 38 47 47 47 47 47 47 38 47 47 47 47 49 49
+49 49 45 47 44 38 47 47 47 47 47 47 49 47 47 47 45 41 47 47
+47 47 41 38 38 38 44 38 38 47 47 47 47 47 47 47 44 44 38 44
+44 29 49 49 49 49 41 47 47 47 41 47 47 47 47 47 44 45 47 47
+49 47 47 47 47 47 47 47 47 47 47 41 47 47 47 47 41 47 47 41
+47 47 47 38 47 47 41 45 44 32 32 38 45 45 47 45 45 38 35 34
+44 44 35 47 47 47 47 41 36 36 47 47 36 47 47 47 38 45 36 36
+44 49 32 34 45 36 47 36 36 47 47 27 36 18 15 24 26 44 29 28
+13 16 10 6 6 8 11 11 15 7 11 11 14 24
+>gnl|ti|1086975795 name:1099575910515
+ 7 7 7 6 8 11 6 6 6 7 16 14 14 16 14 23 26 21 26 23
+23 29 27 21 24 35 27 24 33 33 33 30 31 27 30 30 32 24 23 24
+24 24 20 28 33 30 30 18 18 23 23 21 21 29 26 26 35 31 31 32
+44 38 40 38 42 25 35 40 40 45 44 33 30 32 33 33 31 34 47 32
+32 42 35 31 34 34 34 34 29 35 32 38 44 38 38 44 44 34 35 40
+35 35 35 44 38 44 44 44 44 38 44 38 44 38 38 44 44 38 47 47
+44 44 35 35 35 35 38 44 38 44 38 44 44 38 36 41 44 40 44 44
+38 38 44 44 38 44 31 47 44 35 35 34 34 34 38 47 47 47 41 47
+41 47 47 47 41 36 41 41 38 38 38 44 38 44 47 47 44 47 47 47
+47 47 47 47 41 41 47 41 47 47 47 47 47 45 45 45 47 47 45 47
+45 41 44 44 38 38 44 38 38 38 44 38 38 40 38 44 44 44 44 38
+47 47 35 44 38 38 34 34 44 44 44 38 47 41 47 47 49 47 47 47
+47 41 44 38 44 44 38 44 41 41 47 41 41 47 47 47 41 47 47 38
+47 47 47 45 49 49 49 45 47 47 41 41 47 47 47 47 47 47 41 49
+45 38 45 49 49 47 41 47 47 45 44 38 45 44 44 35 47 47 47 41
+47 47 47 47 47 47 47 41 47 47 49 47 49 47 47 47 47 47 41 47
+47 41 49 49 49 47 41 47 47 36 45 47 47 47 41 47 47 47 47 47
+47 47 47 36 47 45 47 41 47 47 47 41 47 47 47 47 47 47 47 36
+47 36 47 47 47 36 47 47 41 47 47 41 47 47 47 49 41 47 47 47
+47 47 47 47 41 47 47 47 47 47 41 44 41 41 47 41 47 41 41 41
+41 47 47 47 47 47 47 44 47 47 47 47 47 47 45 47 47 47 47 47
+45 47 47 47 41 47 47 47 47 47 41 38 38 38 38 44 44 41 47 47
+47 47 38 36 40 40 40 47 47 47 45 45 49 49 49 49 49 41 47 47
+47 47 47 47 47 47 47 47 47 49 47 47 47 47 47 47 41 47 47 47
+47 47 38 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 45
+47 47 47 47 47 47 41 47 47 41 40 44 44 40 40 38 47 41 47 47
+47 47 47 47 47 47 47 47 47 49 49 47 47 47 47 47 47 47 47 41
+44 44 44 38 44 44 47 47 47 47 47 47 47 49 45 38 44 38 44 44
+45 49 47 47 47 47 47 36 49 49 47 47 47 47 44 47 49 47 47 47
+38 45 47 47 47 47 47 47 47 47 47 47 47 47 44 38 44 38 38 38
+47 38 47 38 44 44 44 47 47 34 34 23 19 19 19 23 44 20 19 7
+ 7 21 20 11 8 18 13 8 7 6 8 6
+>gnl|ti|1086975890 name:1099575910518
+ 6 6 6 6 6 8 7 6 7 10 7 7 8 12 12 12 17 28 31 19
+14 12 12 12 12 12 19 24 27 29 29 35 44 27 27 21 21 21 22 29
+31 44 29 31 25 25 28 28 24 24 23 22 24 30 27 30 27 30 30 31
+29 31 31 26 25 31 29 29 31 35 35 45 35 34 29 34 34 33 30 33
+30 35 29 24 34 34 34 34 44 38 38 45 47 38 44 45 38 31 29 32
+31 29 31 44 47 47 47 47 47 47 47 49 47 47 47 47 47 38 38 38
+38 38 45 44 44 47 47 41 47 44 38 38 38 44 44 38 44 44 44 38
+38 38 38 38 44 44 44 45 47 41 47 47 41 47 41 47 47 38 38 38
+38 45 45 44 34 34 45 45 47 47 47 47 41 47 47 41 49 45 49 47
+47 47 47 38 47 47 49 49 47 38 44 38 38 32 32 32 28 36 45 47
+38 47 47 47 47 47 47 47 47 38 38 44 44 44 35 47 47 41 47 47
+47 47 47 47 47 47 47 47 47 47 38 44 38 38 34 34 40 40 34 49
+49 49 47 41 47 47 47 44 47 41 41 41 47 47 36 47 41 47 47 47
+47 47 47 47 47 47 47 47 38 47 45 47 47 47 36 47 38 44 38 44
+44 44 45 47 47 47 39 39 35 32 32 36 36 47 47 47 41 47 47 47
+47 41 47 47 38 49 49 49 47 47 47 47 45 47 47 38 36 40 40 40
+44 40 47 47 47 47 41 47 41 47 41 38 44 32 34 36 44 47 47 41
+47 47 47 47 47 47 47 47 41 49 47 41 47 47 47 47 47 45 47 45
+41 47 41 47 47 41 47 47 47 47 47 47 47 47 49 49 47 49 47 47
+47 47 41 47 41 47 45 47 47 38 44 38 38 47 41 47 47 47 47 41
+41 47 41 47 41 47 47 47 47 47 47 47 47 47 41 47 47 47 47 47
+47 41 41 47 47 47 47 41 47 47 44 38 38 45 45 40 49 49 49 47
+49 47 47 47 47 47 41 47 47 47 47 47 41 47 49 47 47 47 47 47
+47 47 47 47 47 49 45 45 49 45 38 47 41 47 47 47 47 45 47 47
+45 47 47 47 47 47 47 47 49 49 45 49 38 45 45 47 47 47 49 47
+47 47 47 41 47 47 47 47 47 47 47 47 47 41 47 47 47 47 41 47
+47 47 47 45 45 49 47 47 47 47 41 47 49 49 49 45 49 47 38 36
+41 36 44 40 40 32 45 45 47 47 47 41 41 49 49 49 47 47 47 47
+47 47 47 47 41 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47
+47 47 47 47 47 47 47 47 47 47 47 47 47 41 47 47 47 47 47 47
+47 47 47 44 44 44 44 38 44 47 47 47 45 49 49 49 44 40 40 47
+47 45 45 40 49 45 44 44 44 44 44 47 47 47 38 44 34 32 38 44
+47 47 47 47 47 47 47 45 40 21 20 39 39 45 35 26 35 31 38 38
+38 38 35 45 28 40 36 31 44 38 14 14 9 9 8 8 16 11 12 12
+17 13 9 9 9 11
+>gnl|ti|1086975875 name:1099575910521
+ 6 6 6 6 7 7 7 9 9 6 7 7 12 13 12 14 22 17 20 23
+25 29 28 34 34 18 18 18 18 15 15 15 22 24 20 17 16 16 21 16
+24 25 26 25 28 27 21 23 21 21 19 31 31 38 38 34 27 27 40 34
+34 34 34 35 25 17 15 11 7 7 10 7 6 8 7 7 12 14 33 19
+19 30 32 25 25 29 29 38 44 44 44 44 47 47 38 44 45 44 38 44
+47 38 44 44 45 35 38 34 45 32 32 19 13 21 10 8 9 13 22 40
+40 34 40 36 38 44 44 38 35 44 41 47 41 38 44 38 38 45 38 38
+35 45 38 44 44 38 32 34 45 45 47 47 47 45 47 41 47 47 38 47
+47 47 41 47 47 36 44 40 49 49 40 47 47 47 47 47 47 47 47 47
+47 44 44 27 13 8 6 6 6 7 8 7 11 12 23 26 40 40 39 47
+44 40 32 40 40 47 47 47 41 41 47 47 38 38 38 44 44 34 40 40
+40 36 49 36 41 47 36 47 41 47 47 47 47 47 47 47 49 47 49 47
+36 38 47 47 47 41 47 47 47 41 47 41 47 36 41 38 47 47 44 35
+33 31 31 33 44 47 47 45 34 34 34 34 35 34 45 47 41 47 47 47
+47 47 47 47 47 38 44 45 38 38 44 38 47 47 47 47 47 49 49 49
+40 36 44 32 32 40 38 40 47 38 47 47 41 45 49 32 34 38 38 47
+47 47 47 47 47 47 47 47 38 47 38 47 49 47 47 41 41 41 47 49
+49 49 49 49 49 47 49 44 47 41 31 31 33 33 33 33 45 38 40 34
+40 44 38 41 47 47 47 41 47 47 45 40 44 44 47 45 38 40 47 38
+45 49 49 49 49 32 40 45 45 47 47 47 47 41 47 47 38 49 49 45
+49 47 41 47 47 47 38 44 40 40 44 45 38 38 44 34 34 34 40 49
+45 47 47 47 47 34 38 44 38 38 38 45 49 49 38 45 45 44 38 44
+44 44 44 47 47 47 47 47 38 38 49 49 40 47 47 47 41 41 47 47
+47 47 47 47 47 47 47 44 47 44 49 49 38 32 40 36 47 47 49 49
+45 49 49 49 47 47 47 47 47 47 47 38 47 47 47 47 45 38 44 44
+44 45 45 47 47 47 44 47 47 47 47 47 47 38 47 44 44 38 38 35
+40 44 47 38 40 40 25 23 27 27 44 44 38 44 49 47 38 40 40 40
+44 38 40 29 29 23 23 22 20 21 24 28 28 28 40 40 47 47 32 24
+19 20 26 12 11 6 6 9 9 12 12 12 14 8 7 7 6 6 6 6
+ 6 8 11 9 9 8 9 9 9 9 8 9 9 10 9 12 9 9 8 9
+ 9 13 13 11 12 9 9 9 9 9 8 9 9 9 9 7 8 8 9 9
+ 9 10 10 9 9 9 9 10 10 8 9 7 7 7 9 7 9 7 12 10
+13 9 12 12 11 11 12 11 16 10 9 12 10 9 9 9 9 9 9 12
+ 9 9 7 9 9 10 9 9 7 9 7 7 9 9 9 9 8 7 9 9
+12 13 9 8 9 9 7 10 10 9 7 7 9 6 7 9 9 9 10 9
+ 8 9 7 9 7 11 16 11 13 10 9 9 9 9 7
+>gnl|ti|1086975902 name:1099575910524
+ 6 6 9 10 10 7 6 7 7 12 11 12 7 7 12 12 12 9 9 9
+ 9 10 12 14 11 14 18 17 20 23 17 21 22 23 23 21 22 22 22 22
+22 23 22 29 21 21 21 21 21 21 21 25 27 29 23 21 21 22 32 32
+34 29 40 29 28 27 23 16 12 9 9 18 24 15 14 14 13 16 17 21
+23 23 21 22 22 21 30 33 33 34 30 27 29 22 22 24 26 29 29 29
+29 35 29 28 40 40 28 28 28 28 27 17 17 17 23 16 20 9 10 18
+21 25 25 28 28 32 40 40 28 23 28 28 28 28 28 26 26 26 28 29
+29 40 32 28 29 26 26 29 29 28 24 26 26 26 26 26 26 26 28 40
+40 29 29 34 34 34 34 34 28 28 22 23 23 28 27 33 34 34 35 34
+29 31 29 29 27 27 24 24 24 27 27 28 30 32 26 26 24 26 28 28
+28 32 40 32 40 28 40 40 49 49 40 40 40 36 29 29 35 28 28 35
+32 39 45 32 34 28 24 29 26 26 40 40 40 40 32 40 28 28 28 32
+45 32 28 28 28 32 40 40 39 40 28 36 40 28 29 29 34 35 35 34
+29 38 34 34 34 32 40 36 36 40 45 40 45 40 40 32 49 28 28 40
+30 34 34 34 23 23 27 23 28 30 30 29 29 29 29 28 28 28 28 40
+49 49 45 38 45 36 28 28 28 28 27 27 28 28 39 29 32 28 23 28
+28 28 36 28 28 40 32 28 28 28 49 32 49 49 35 28 28 35 35 44
+31 33 30 33 26 33 38 38 38 40 40 40 28 28 45 45 40 32 28 32
+40 36 39 40 23 28 40 32 39 40 40 40 32 28 28 40 32 32 32 32
+28 28 45 32 40 34 32 40 40 40 36 38 40 34 34 36 34 34 45 40
+32 27 28 19 27 27 40 32 28 28 29 35 38 35 29 35 35 35 40 40
+40 35 32 32 32 36 34 35 34 29 29 35 29 44 38 38 44 40 40 34
+34 31 38 38 29 49 34 34 45 34 32 40 28 28 32 39 28 32 34 32
+40 40 40 40 25 25 21 24 24 26 28 32 45 40 40 34 40 45 36 40
+40 34 36 49 28 28 36 28 28 28 29 29 38 38 44 29 40 34 49 49
+28 28 40 32 32 34 36 36 36 40 40 32 25 40 40 40 40 28 28 40
+28 32 39 40 35 32 40 32 32 40 34 28 32 28 28 40 45 44 47 38
+44 36 34 40 45 45 38 40 49 34 40 40 44 44 45 49 49 49 45 40
+40 45 45 36 47 47 47 47 47 47 47 47 47 49 49 40 34 38 36 35
+38 38 38 35 35 44 38 47 47 47 36 39 39 28 26 23 23 23 22 29
+45 45 49 49 47 45 45 24 24 34 29 35 24 36 38 47 36 47 36 36
+32 19 18 11 9 19 12 14 27 27 32 32 36 32 27 23 20 30 21 19
+21 25 24 24 17 19 12 9 9 12
+>gnl|ti|1086975872 name:1099575910527
+ 9 9 9 7 6 6 6 7 8 14 14 14 14 17 17 16 16 17 14 15
+16 16 18 18 18 18 18 25 32 29 23 25 25 25 26 26 25 32 35 35
+15 20 15 17 17 13 27 30 27 31 29 44 38 44 29 31 32 29 31 32
+44 38 25 20 17 20 24 22 31 29 35 35 38 36 40 34 34 25 36 44
+44 38 44 47 47 38 38 35 35 35 34 38 44 35 35 35 35 35 35 35
+44 38 38 47 35 44 44 40 44 44 44 44 44 44 47 47 47 38 44 45
+44 44 44 44 44 44 38 41 47 44 38 38 44 38 35 47 47 41 45 38
+38 40 47 40 40 35 35 35 31 38 44 47 40 47 45 44 38 35 35 35
+35 44 38 49 47 41 47 45 35 38 38 38 38 44 38 44 44 47 41 47
+47 41 47 47 47 47 47 47 47 47 45 49 49 41 44 44 35 35 35 42
+35 35 38 38 38 38 44 38 44 47 47 47 47 47 40 38 38 38 44 44
+47 47 47 41 47 41 41 45 41 47 47 41 45 45 38 44 44 44 38 38
+41 47 45 47 45 47 47 45 47 47 41 47 41 47 47 47 47 45 49 45
+34 38 44 45 40 40 45 47 47 45 45 47 47 47 41 41 47 47 47 47
+47 47 47 47 47 47 41 47 45 45 47 47 47 45 40 38 44 44 38 44
+49 49 38 45 44 38 38 44 49 49 49 45 45 45 49 47 47 47 47 47
+47 47 47 47 47 47 47 47 47 47 47 41 47 47 47 47 41 47 47 41
+38 41 41 47 47 47 47 41 36 47 47 49 38 44 44 44 38 44 38 41
+41 47 49 49 49 41 47 36 47 44 44 38 44 44 44 47 44 47 45 47
+47 47 47 47 47 47 41 47 41 47 47 47 47 47 49 49 45 47 45 49
+36 44 44 38 35 44 44 41 47 47 47 36 47 47 36 44 47 47 41 47
+47 41 47 45 47 47 47 47 47 47 47 47 45 47 47 47 47 47 47 47
+47 47 45 44 38 45 40 45 47 47 47 47 47 47 47 47 47 47 47 47
+41 47 49 49 49 49 49 47 47 47 47 47 47 47 41 47 47 47 38 44
+44 38 38 44 47 47 47 47 47 41 47 47 47 47 41 49 49 45 47 47
+47 47 47 49 49 49 49 47 47 47 47 47 47 47 49 47 47 49 47 41
+47 47 47 47 49 49 49 47 47 47 47 47 47 47 47 49 49 41 47 47
+47 47 40 45 44 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47
+47 47 47 47 47 47 47 47 41 47 47 47 47 47 47 47 47 47 45 47
+47 47 47 47 47 47 47 47 47 47 47 47 49 49 49 49 49 47 47 47
+40 38 38 44 38 38 47 47 47 47 47 45 45 25 23 10 12 22 22 27
+39 23 28 40 40 24 29 26 21 16 13 8 7 7 7 6 7 9 8 6
+ 6 7 7 7 7 7 12 12
+>gnl|ti|1086975832 name:1099575910530
+ 9 6 9 6 7 6 9 10 6 6 8 7 7 7 10 8 11 16 17 11
+ 9 18 18 31 32 32 27 22 22 24 20 20 27 25 21 25 25 25 21 22
+30 35 44 34 34 34 29 25 24 18 27 26 24 30 26 27 24 35 35 34
+34 34 44 44 44 38 38 44 31 26 32 19 26 19 41 47 36 36 40 45
+45 47 47 47 47 45 35 35 34 32 31 32 31 24 26 35 35 44 34 34
+34 31 31 32 32 30 32 34 38 32 45 45 44 47 44 44 45 38 44 38
+47 47 44 38 36 38 47 47 47 41 47 49 41 47 38 38 38 44 44 38
+47 38 38 38 40 40 39 34 35 38 44 44 38 47 47 44 38 34 34 34
+34 45 44 47 41 41 38 44 32 40 44 38 34 34 38 38 44 38 44 38
+38 45 32 34 40 40 40 23 24 12 24 29 28 39 40 44 38 40 36 40
+38 38 38 44 44 38 44 47 47 47 41 38 47 47 47 47 47 38 36 44
+40 40 36 45 47 47 41 47 47 47 41 47 47 47 47 47 38 38 32 49
+45 49 47 49 49 38 44 38 44 38 38 34 40 45 45 38 47 47 47 44
+40 40 34 40 39 40 47 47 47 36 38 38 38 38 38 38 40 49 44 38
+38 44 34 34 38 40 40 40 40 38 40 32 39 39 34 32 45 39 47 47
+47 47 47 47 36 47 47 38 47 38 38 47 36 36 28 32 49 49 49 29
+34 35 34 34 35 45 45 47 49 36 47 36 32 40 23 23 39 28 23 32
+32 30 26 34 34 34 38 38 39 32 28 28 40 36 47 38 38 47 47 47
+38 40 36 38 38 49 45 38 38 29 38 38 44 44 38 47 47 47 41 47
+41 38 44 34 40 44 45 47 40 40 40 38 40 38 40 40 32 40 40 38
+41 38 39 32 35 34 40 39 49 36 44 38 35 44 44 38 47 45 49 38
+47 47 45 45 45 45 47 47 47 47 47 40 49 40 40 38 47 47 40 47
+47 47 38 47 47 41 49 47 49 45 45 40 40 40 40 36 47 47 47 47
+44 44 34 40 34 40 44 40 36 40 34 36 40 44 36 40 38 40 40 40
+28 28 28 45 45 47 36 38 44 47 45 38 34 36 45 34 32 40 40 47
+49 45 47 47 47 47 47 47 49 47 45 38 44 44 45 47 47 49 49 49
+49 47 45 47 40 36 40 36 45 47 40 45 45 40 40 45 45 47 47 41
+38 47 47 40 38 40 40 44 45 47 47 38 44 36 49 49 49 49 49 49
+49 40 39 45 47 29 44 44 38 38 34 40 40 38 40 40 49 40 40 40
+40 40 28 28 39 29 17 15 27 18 19 30 30 38 49 36 45 45 40 34
+39 28 19 17 14 17 17 23 13 11 14 12 20 12
+>gnl|ti|1086975806 name:1099575910533
+ 9 9 9 7 6 6 6 8 6 6 6 9 9 7 17 17 34 25 24 34
+12 14 14 12 13 12 19 21 23 23 23 18 17 17 18 17 17 25 26 25
+25 25 31 44 44 44 40 25 25 27 30 28 26 34 35 35 35 35 38 41
+41 29 32 29 29 25 28 47 47 38 38 33 30 27 38 29 33 33 31 35
+35 25 29 44 45 35 35 45 44 44 34 38 44 44 44 38 44 44 44 40
+38 44 47 47 47 41 47 44 38 44 45 44 45 34 44 44 44 44 34 34
+34 34 35 35 40 47 41 44 38 38 44 38 44 44 45 35 38 44 38 44
+44 44 44 44 38 47 47 47 47 38 47 35 34 34 33 44 38 38 38 47
+47 41 47 47 47 47 38 44 40 34 45 36 49 49 47 47 44 35 44 38
+38 44 45 47 47 47 47 47 47 47 45 47 38 47 47 47 47 45 38 44
+44 44 38 44 47 45 47 41 47 41 45 47 49 49 49 47 47 47 44 40
+40 32 40 36 49 38 38 38 38 38 44 47 47 47 41 49 38 38 29 35
+28 28 39 32 28 36 36 38 38 38 44 38 44 44 44 34 34 49 38 45
+47 47 47 45 36 38 47 47 47 47 47 47 47 44 38 38 44 38 38 38
+38 34 38 38 38 34 38 41 47 36 47 41 41 47 47 44 38 34 44 38
+44 47 47 47 47 47 47 44 44 40 34 40 36 40 47 47 44 44 38 38
+38 45 41 41 47 41 47 41 38 45 45 44 38 44 41 47 47 47 49 41
+41 47 47 47 47 47 47 47 47 47 47 47 45 41 49 49 47 47 45 47
+47 47 47 47 41 47 47 41 47 45 45 47 47 47 47 47 47 47 47 41
+47 38 44 38 34 34 34 26 34 44 44 38 44 41 47 47 41 49 38 38
+44 35 35 38 38 40 47 47 45 41 47 41 47 47 49 49 45 41 47 47
+47 47 45 47 47 47 47 47 47 47 47 38 47 38 44 41 47 47 45 47
+47 47 45 47 47 47 45 45 49 49 47 45 47 47 47 45 45 47 47 41
+47 49 41 38 38 47 47 47 47 47 47 47 47 47 47 47 47 41 41 47
+47 47 47 47 47 47 47 47 47 47 47 47 47 45 47 47 47 47 47 41
+47 47 47 41 47 41 47 47 47 47 49 49 49 47 47 47 47 47 47 47
+47 47 47 47 47 47 36 49 49 49 44 44 38 44 38 31 45 28 28 45
+40 40 45 45 47 41 47 47 44 40 40 40 40 45 45 20 20 29 29 38
+44 38 45 31 25 16 15 13 11 13 12 12 12 25 13 13 23 24
+>gnl|ti|1086975856 name:1099575910536
+10 10 9 6 6 6 7 8 8 7 7 7 8 8 7 9 14 14 14 17
+23 33 29 12 12 12 15 15 16 29 26 25 25 38 38 40 40 47 34 31
+27 26 26 27 35 31 34 35 35 44 25 25 25 23 28 25 31 34 35 31
+45 38 34 35 34 28 32 29 28 28 21 28 30 27 28 30 33 35 35 35
+27 28 30 44 44 38 44 44 44 47 32 29 29 29 32 32 35 44 44 38
+44 38 38 44 44 41 38 38 38 44 32 29 32 31 31 35 47 38 34 34
+34 34 34 34 44 34 34 34 34 35 34 34 35 44 41 47 47 47 47 41
+47 47 45 47 47 47 47 41 47 41 45 47 47 34 34 34 35 44 44 44
+44 44 38 35 47 47 38 44 44 44 35 35 44 38 44 38 41 41 47 38
+38 34 44 44 38 38 44 44 36 44 38 35 38 40 44 49 49 45 44 38
+44 31 44 34 49 49 45 49 38 38 44 38 44 44 36 47 47 41 47 47
+47 47 47 47 47 47 47 47 49 45 47 47 47 41 47 47 47 47 47 47
+47 49 49 49 32 49 45 36 35 38 38 38 40 35 47 47 47 47 38 47
+47 47 47 47 47 44 44 44 45 38 38 47 40 49 49 34 34 32 44 38
+47 47 47 47 47 31 38 38 35 40 38 41 41 47 47 38 44 36 47 38
+49 36 47 47 41 41 47 47 47 47 47 47 49 49 41 47 41 47 47 47
+45 49 47 49 38 38 38 44 44 38 47 36 38 44 38 38 29 29 44 36
+41 47 47 41 47 44 49 34 49 49 49 45 49 41 47 41 47 47 47 41
+47 44 45 45 40 32 45 49 49 47 49 36 36 47 38 41 47 47 47 49
+45 40 40 36 47 47 47 47 41 49 38 34 35 44 44 44 49 49 47 47
+41 47 47 47 47 47 47 49 49 49 40 40 45 45 45 40 39 40 32 40
+39 47 47 47 47 47 45 47 47 47 41 47 47 41 47 47 45 47 38 40
+40 45 49 49 47 49 41 41 47 47 40 38 34 40 44 45 47 47 45 45
+28 28 24 15 21 19 21 21 35 38 25 21 12 10 7 7 9 8 6 10
+10 9 9 9 9 9 11 13 12 9 10 9 9 9 9 6 6 9 10 9
+ 9 10 9 13 9 10 13 13 16 9 8 9 10 10 10 9 11 9 7 12
+13 14 14 15 15 10 9 9 13 8 10 9 9 7 10 7 9 10 10 9
+ 9 9 10 9 9 9 10 9 7 7 9 9 12 10 9 10 10 11 8 8
+ 8 9 8 13 12 9 8 12 11 11 11 12 9 9 7 9 7 9 9 7
+ 9 12 15 7 7 7 9 12 12 14 9 7 9 9 11 11 12 10 10 13
+18 10 9 9 7 9 7 9 8 6 6 10 7 7 12 9 9 16 8 10
+10 11 11 9 7 9 10 12 10 10 13 9 11 11 8 9 7 8 9 7
+ 7 10 8 11 9 9 7 7 7 10 10 9 7 7 9 7 7 8 9 8
+ 8 6 6 7 7 9 12 9 9 9 7 9 7 9 8 15 9 9 13 9
+ 9 7 9 11 7 12 9 9 8 10 10 7 7 8 9 9 9 9 9 9
+ 9 7 7 9 9 9 11 11 8 7 9 7 7 8 9 9 9 10 19 15
+10 9 9 9 9 7 9 10 9 7 9 10 9 9 9 8 7 7 7 7
+ 7 8 7 7 9 7 7 7 9 7 7 7 7 7 8 11 12 7 9 7
+ 7 7 7 9 7 6 8 10 9 8 9 9 8 8 7 9 7 7 7 7
+12 10 9 9 9 7 7 7 9 7 7 7 12 12 9 7 7 9 8 8
+ 8 9 9 10 8 11 8 8 9 10 10 9 7 7 9 8 7 8 6 9
+ 8 9 9 7 7 7 7 9 8 7 7 7 7 8 9 7 8 8 9 9
+ 9 9 6 9 7 7 7 9 9 9 10 10 13 11 10 9 9 7 9 9
+ 9 7 7 10 8 7 6 6 6 8 8 9 8 8 7 7 6 6 7 9
+ 9 9 7 9 7 7 8 9 9 6 9 7 7 7 9 9 10 7 7 8
+ 7 9 9 9 9 9 7
+>gnl|ti|1086975895 name:1099575910539
+19 13 8 7 9 7 9 9 9 9 8 9 8 9 7 7 9 9 8 6
+ 9 14 12 9 10 8 7 7 9 7 12 12 12 10 7 9 16 16 19 19
+14 14 9 15 14 15 15 13 14 17 9 9 14 14 16 14 22 22 21 29
+13 21 24 23 16 16 19 19 19 17 20 19 16 17 17 21 18 18 27 21
+24 23 26 24 28 30 27 33 38 34 24 24 14 17 21 24 29 28 32 32
+28 23 23 24 28 28 28 27 29 33 33 29 35 34 31 34 35 35 36 32
+35 35 35 34 27 44 40 40 29 35 34 31 24 26 30 27 35 35 29 29
+28 27 26 24 26 26 31 35 35 40 32 49 35 38 34 35 38 30 45 38
+38 38 25 23 29 22 29 21 28 29 24 24 29 29 29 29 35 31 35 26
+26 23 28 40 40 40 40 34 34 40 40 28 28 45 40 49 27 27 27 27
+49 25 18 22 27 29 31 29 40 36 40 40 29 27 21 18 17 29 18 19
+25 22 28 28 22 25 25 24 24 30 25 22 29 29 29 49 36 45 34 28
+26 26 32 45 45 40 27 28 21 21 27 39 32 32 36 34 34 34 40 36
+39 39 28 28 40 32 40 38 40 38 47 47 39 39 32 40 29 34 34 29
+35 38 40 44 38 32 28 23 23 17 18 23 32 30 40 32 40 35 27 29
+21 21 39 39 27 28 49 28 24 23 23 20 24 40 40 36 40 28 28 28
+23 40 27 29 25 20 20 25 23 28 23 49 28 40 29 27 18 18 27 25
+29 40 32 39 20 20 27 28 28 27 34 29 25 26 23 24 20 23 40 40
+40 36 22 21 11 12 17 17 23 24 18 19 21 27 27 28 36 27 27 10
+10 9 10 10 14
+>gnl|ti|1086975857 name:1099575910545
+ 6 9 8 6 6 6 7 6 6 6 9 8 8 12 9 7 7 7 16 14
+17 17 23 23 19 17 16 14 14 14 16 25 24 23 21 21 25 24 29 44
+38 34 30 21 21 21 19 29 29 35 34 38 35 28 24 25 23 25 20 28
+34 34 25 44 44 45 30 28 26 30 25 26 31 33 27 24 23 22 26 19
+23 24 30 26 32 32 45 44 38 44 44 44 40 24 27 28 32 29 31 34
+38 38 26 31 32 29 32 32 49 30 32 32 32 32 32 38 38 45 34 40
+32 40 38 47 47 38 38 38 34 34 34 34 34 44 44 38 44 47 41 44
+44 38 44 38 38 44 44 38 44 35 38 47 41 45 49 49 38 31 44 38
+38 44 38 44 44 38 35 34 45 38 44 38 40 34 34 47 45 38 44 47
+47 47 45 38 44 44 38 38 38 44 44 31 38 38 38 44 38 44 41 45
+49 38 38 34 44 38 44 41 36 47 38 38 38 44 31 34 38 38 47 47
+41 47 41 47 47 47 45 47 47 47 47 49 45 49 49 38 38 47 41 47
+41 41 47 47 49 45 49 49 49 32 40 35 38 38 45 44 45 45 47 47
+47 44 38 38 40 36 38 34 40 45 45 45 47 38 45 38 38 40 34 29
+34 44 44 38 47 47 47 47 40 38 40 45 47 36 49 49 45 47 45 39
+40 32 44 36 40 38 38 47 47 47 47 47 47 41 47 49 45 45 45 49
+47 49 49 49 47 49 49 38 38 44 44 38 38 47 47 47 47 40 40 40
+40 44 44 47 36 47 47 38 40 32 34 34 39 40 47 47 47 47 38 47
+47 47 47 47 38 39 39 28 28 49 45 45 49 49 40 34 45 45 45 47
+47 49 49 49 40 40 40 36 44 47 41 47 45 38 40 40 45 38 47 47
+47 44 35 44 44 38 44 47 47 41 49 49 45 32 32 40 40 38 40 36
+28 28 36 45 47 47 47 47 47 47 47 45 38 38 44 45 38 38 47 47
+47 47 38 36 49 38 41 41 47 47 47 47 47 38 38 40 36 44 47 47
+47 47 41 47 47 47 47 45 49 47 44 44 34 40 45 34 40 34 34 35
+29 32 29 26 32 26 26 21 27 15 13 12 12 20 20 45
+>gnl|ti|1086975778 name:1099575910546
+ 6 6 7 7 6 6 6 6 7 7 7 8 8 12 12 19 14 12 12 12
+12 12 14 10 14 10 9 10 19 20 15 7 7 14 14 21 21 21 17 24
+19 15 15 15 17 18 40 38 27 28 18 22 22 20 24 38 25 25 33 31
+31 47 47 47 47 34 34 34 29 24 18 12 9 9 7 6 6 8 11 11
+19 19 23 24 22 22 23 24 27 31 45 41 38 34 35 34 34 31 31 38
+35 31 29 40 45 45 44 34 27 38 27 27 17 16 17 18 23 23 34 34
+29 34 47 47 47 45 44 35 29 45 45 44 38 40 40 32 36 44 47 47
+47 44 38 44 38 44 38 36 47 47 38 38 44 35 29 38 49 44 44 44
+38 44 44 41 47 39 39 40 28 28 36 40 47 47 38 44 44 44 40 35
+45 40 40 40 40 32 49 49 38 40 34 45 38 47 38 47 45 47 49 47
+47 38 47 40 45 34 40 40 36 47 47 47 47 36 38 40 47 47 38 47
+38 38 47 40 38 47 38 40 32 40 45 45 47 47 47 36 38 44 44 44
+38 44 47 36 36 38 45 38 40 36 35 34 34 34 38 38 38 44 34 35
+34 34 34 38 47 38 47 38 47 40 40 40 40 40 39 40 38 36 36 38
+29 34 34 34 34 39 45 45 47 47 47 47 47 47 47 45 41 47 47 38
+38 38 32 27 20 28 28 40 32 45 36 36 47 47 47 47 49 49 44 38
+38 34 34 44 49 49 49 49 49 45 49 45 28 29 31 34 38 35 47 44
+49 36 34 40 40 38 47 47 38 47 49 47 45 41 47 39 40 40 40 34
+40 40 28 40 39 38 40 34 45 40 47 47 47 45 45 47 47 47 36 38
+44 38 38 38 44 47 45 47 47 47 38 47 47 47 45 40 45 40 40 39
+40 40 35 36 40 38 38 47 45 49 49 49 38 47 47 47 47 47 40 45
+49 49 40 40 45 40 39 28 32 39 40 47 47 47 47 47 47 47 45 47
+47 47 47 45 47 47 47 47 47 47 47 45 47 47 44 38 44 29 35 38
+44 30 33 34 34 38 38 38 47 49 45 41 47 40 39 45 28 28 40 45
+39 36 34 49 36 40 40 38 40 40 32 28 28 23 23 40 40 28 32 24
+24 32 32 45 40 32 28 28 40 40 40 49 32 40 32 28 28 39 40 47
+47 47 47 36 47 47 47 49 47 47 47 47 47 47 47 40 40 40 40 40
+40 34 40 38 47 49 40 40 34 44 40 47 49 49 40 39 39 13 13 26
+23 40 40 40 40 49 49 40 29 23 14 14 19 18 13 20 18 18 33 32
+>gnl|ti|1086975867 name:1099575910549
+12 10 7 7 9 7 7 7 8 12 12 10 13 12 7 7 7 8 14 14
+17 14 16 27 27 19 19 19 27 23 24 29 29 19 16 17 20 16 18 23
+23 23 21 23 25 26 29 26 38 47 47 47 47 38 36 41 41 29 26 29
+31 28 27 33 33 35 35 38 47 38 44 38 38 44 24 20 9 9 13 13
+24 26 29 38 23 23 28 23 21 21 38 36 32 32 32 29 31 32 38 44
+45 38 44 34 32 31 32 29 32 34 34 34 34 34 40 39 44 40 40 40
+45 45 47 47 38 44 44 38 38 44 36 40 40 38 47 41 47 47 38 31
+44 38 38 38 49 49 49 47 47 47 47 41 47 38 38 29 30 30 20 20
+30 27 38 38 47 47 47 47 41 47 47 47 49 49 49 47 47 47 47 47
+38 44 44 38 34 38 49 49 36 49 40 40 44 38 47 47 47 47 38 38
+38 44 38 38 47 44 44 31 40 38 35 36 45 34 35 29 34 34 38 47
+36 36 40 29 29 34 38 44 38 49 45 44 38 38 44 44 38 35 34 49
+49 47 47 47 47 47 47 47 47 47 47 47 47 47 45 47 49 49 45 49
+49 49 45 49 47 45 47 45 45 34 40 36 36 38 40 39 36 45 39 38
+45 44 38 45 38 47 41 47 36 47 38 36 40 38 38 47 47 40 47 47
+47 47 47 41 47 49 38 35 44 38 38 26 34 44 40 40 40 34 29 34
+29 38 34 34 44 44 49 47 47 38 47 47 47 45 40 38 34 34 34 36
+49 49 49 38 38 40 40 40 40 45 47 38 47 47 47 47 47 47 47 47
+47 47 41 47 47 47 47 47 47 47 47 47 44 38 34 49 49 49 49 49
+49 49 47 47 47 36 45 34 40 45 45 45 38 44 45 31 26 26 28 23
+39 40 41 47 47 49 49 49 49 45 44 40 40 34 40 45 45 38 45 40
+49 49 36 38 49 47 40 40 38 47 47 47 47 41 47 41 47 47 47 47
+47 47 47 41 47 41 47 47 47 38 36 40 32 28 28 28 40 40 47 47
+47 47 47 47 41 47 47 47 47 49 39 32 28 40 40 38 47 41 47 47
+47 47 45 47 47 47 47 47 47 47 45 45 45 45 40 40 39 47 41 41
+47 47 47 47 47 45 45 39 28 28 40 39 45 40 32 38 38 47 39 36
+40 28 28 36 39 45 45 49 49 45 44 47 38 47 38 47 41 41 47 47
+47 47 47 49 40 34 34 40 39 47 47 47 47 47 49 49 47 38 38 47
+45 47 49 47 47 47 47 47 47 38 49 34 32 45 49 47 47 47 47 47
+47 47 47 47 47 47 38 38 38 40 44 40 38 40 36 47 44 38 34 40
+44 24 36 32 40 34 36 40 40 40 44 36 23 22 14 14 16 23 25 32
+32 32 32 32 32 32 32 24 24 24 19 21 24 24 15 14 12 12 7 7
+10 14 13 23 18 18 23 23
+>gnl|ti|1086975871 name:1099575910551
+ 9 6 9 9 7 9 6 6 7 7 9 7 9 9 11 11 10 12 17 11
+ 7 7 7 8 12 8 8 12 12 13 12 12 13 14 12 10 13 19 19 22
+22 16 18 13 14 13 17 21 23 17 19 19 19 19 28 29 27 23 22 20
+15 21 22 21 14 19 29 27 24 20 16 18 18 19 12 12 9 7 7 8
+12 12 10 12 15 17 20 17 20 24 21 16 11 10 11 18 14 15 13 14
+13 17 17 17 18 18 20 25 18 18 21 24 27 32 25 25 13 12 12 9
+ 9 18 16 17 22 21 20 19 19 23 25 20 14 15 20 20 26 28 45 40
+39 23 21 27 27 27 49 49 28 27 27 13 14 21 39 23 20 20 23 21
+16 20 12 12 10 9 9 10 12 20 24 23 23 21 23 14 13 13 14 17
+16 23 23 18 17 14 24 16 13 12 18 13 9 10 9 9 9 10 10 18
+20 13 16 12 12 14 13 24 23 28 23 21 18 18 16 15 22 14 16 18
+24 27 21 18 18 18 17 18 23 23 16 10 10 11 13 16 24 29 17 17
+17 12 11 13 13 15 13 14 17 18 18 19 19 25 23 45 21 11 9 10
+16 17 18 18 29 39 25 19 27 27 27 16 17 24 28 16 18 9 9 12
+17 15 19 29 29 25 20 17 17 12 14 14 16 14 15 11 14 7 7 10
+10 17 10 10 9 9 9 9 11 13 10 13 9 12 10 10 10 9 13 10
+13 24 20 20 14 12 17 20 11 13 13 24 11 11 11 9 12 20 20 19
+24 27 17 17 16 17 15 13 11 11 11 16 24 24 17 13 13 13 10 9
+12 12 10 11 16 14 16 10 11 14 9 11 9 20 12 20 20 12 9 10
+18 23 23 17 18 16 9 9 9 10 10 19 11 13 9 9 10 13 16 11
+11 9 9 9 10 9 9 12 9 10 9 9 11 13 9 9 7 7 10 19
+11 8 15 9 10 9 8 11 12 14 24 28 38 23 13 9 7 9 12 7
+ 9 8 8 9 9 12 18 13 11 15 21 12 9 9 12 7 9 9 9 9
+ 9 9 11 10 9 7 7 16 16 18 15 10 13 9 10 9 9 9 19 12
+ 9 11 9 9 9 10 10 10 10 10 9 10 16 17 16 9 9 9 9 9
+19 10 9 11 9 9 9 9 9 9 9 9 9 9 9 9 20 12 10 9
+ 9 9 9 10 10 11 9 9 9 9 9 9 9 12 13 12 12 10 13 10
+11 24 9 13 10 9 16 12 9 9 9 9 9 9 15 10 10 13 18 24
+ 9 9 9 9 9 11 8 9 14 12 19 17 16 16 11 11 10 12 9 7
+19 16 36 27 28 19 21 16 18 18 12 10 8 12 14 17 16 16 18 14
+23 27 49 24 24 32 27 28 23 23 23 20 16 10 9 10 12 12 18 11
+11 12 12 11 11 18 18 27 19 22 19 20 17 14 18 12 12 13 12 9
+ 7 9 9 8 10 22 18 32 23 24 16 16 9 9 13 16 14 11 12 11
+11 11 11 10 13 13 10 8 9 9 12 13 13 15 13 13 16 13 13 14
+14 23 14 15 9 13 18 13 15 19 25 9 9 23
+>gnl|ti|1086975917 name:1099575910552
+ 6 6 6 6 6 6 6 6 6 9 8 7 7 12 12 12 12 12 12 15
+12 19 19 19 19 21 17 18 13 19 19 19 24 35 29 19 23 23 23 21
+18 20 22 25 23 23 21 21 20 20 21 34 45 45 32 35 38 44 44 45
+45 45 38 33 44 34 34 31 33 30 29 22 15 16 16 10 10 18 12 14
+20 18 23 29 26 32 29 29 29 32 32 29 31 29 32 32 38 44 38 44
+38 36 49 34 34 35 34 34 38 47 32 30 24 21 20 19 40 40 34 38
+38 38 34 35 49 38 40 40 44 44 47 47 47 47 45 47 47 47 39 45
+40 34 40 45 47 47 47 47 47 44 38 32 40 38 44 44 38 44 35 47
+47 47 47 45 47 47 47 40 38 40 47 45 38 38 32 34 38 40 47 44
+34 38 45 38 38 44 40 32 32 40 40 40 47 47 45 49 47 49 49 49
+49 49 38 34 30 30 26 26 40 45 38 38 44 38 38 34 38 38 38 38
+38 38 47 38 47 45 45 40 49 49 49 38 38 38 45 44 38 41 38 38
+38 44 38 38 45 49 45 47 47 45 49 40 32 45 45 45 47 41 38 38
+44 38 34 35 38 38 44 40 32 28 28 36 36 38 40 34 40 45 38 44
+38 35 35 28 40 40 38 38 38 38 34 34 38 49 45 36 40 34 39 39
+47 47 44 38 44 38 38 38 47 47 47 47 38 35 38 35 35 29 40 32
+40 44 44 47 45 47 47 45 49 49 49 38 38 47 47 47 38 38 38 47
+44 39 39 32 32 39 32 32 36 45 40 36 32 49 49 45 49 49 49 49
+36 36 49 47 47 47 45 45 47 47 38 47 45 38 40 34 49 34 36 38
+47 47 47 47 40 36 45 34 34 38 44 45 47 39 40 40 34 39 40 40
+47 47 47 47 47 41 47 47 47 47 47 40 45 34 34 49 49 45 49 32
+35 28 28 45 40 40 45 49 34 40 40 40 40 34 40 39 39 47 47 49
+49 47 47 40 40 40 40 47 45 49 36 47 47 47 47 47 47 44 44 40
+34 45 40 32 32 35 32 39 34 32 40 49 49 45 45 47 47 40 40 34
+40 40 38 36 36 41 47 47 47 47 47 38 44 38 49 32 45 40 34 39
+26 35 31 29 25 27 49 32 36 49 49 49 49 47 47 47 45 38 40 38
+38 38 29 29 38 23 23 11 12 23 15 23 32 39 32 34 34 29 29 19
+19 36 25 26 26 29 31 28 20 18 12 14 12 20 13 28 21 21 36 36
+>gnl|ti|1086975829 name:1099575910553
+ 6 6 6 6 8 6 6 6 6 6 8 12 16 12 23 16 17 23 14 19
+16 18 19 19 19 28 23 19 16 21 7 7 7 16 16 27 27 34 35 38
+38 41 44 44 44 38 26 23 27 27 27 30 32 38 44 35 35 35 35 35
+35 34 35 35 35 42 47 42 31 24 24 16 11 10 9 9 18 17 23 44
+44 47 47 47 29 29 31 29 31 32 38 44 38 44 44 38 35 38 31 44
+47 44 34 34 34 34 35 44 47 44 38 35 29 29 35 35 34 31 44 38
+44 38 44 44 38 38 38 36 39 45 28 28 29 29 38 44 44 44 47 47
+47 47 41 49 41 49 47 47 47 47 47 45 49 47 47 47 47 47 47 47
+47 47 41 47 47 47 47 45 47 47 41 47 41 38 44 38 40 40 38 38
+47 47 47 41 38 38 44 38 38 34 38 38 44 47 38 38 47 47 38 38
+44 44 38 44 47 49 49 44 44 45 44 44 38 41 47 40 40 40 49 49
+47 47 38 47 47 47 47 49 47 47 41 47 47 39 40 28 40 40 38 47
+45 45 47 40 45 45 45 36 38 38 47 47 47 47 47 38 41 47 47 47
+36 47 47 47 47 41 47 45 44 38 47 49 49 49 49 49 45 49 44 38
+38 38 38 44 45 38 29 35 44 38 38 47 47 47 47 47 47 47 47 47
+47 47 47 47 41 41 47 41 47 47 47 49 49 41 45 47 38 44 44 44
+44 44 47 47 41 45 49 49 38 34 38 38 38 34 45 49 28 40 40 45
+39 47 47 47 47 41 41 41 47 47 47 40 38 44 38 38 36 47 47 38
+44 44 38 38 38 49 45 47 36 47 47 47 47 47 47 47 47 47 47 47
+41 47 41 47 47 41 47 47 47 47 47 47 47 47 47 44 47 45 49 47
+49 49 47 38 40 40 45 40 38 44 47 47 47 47 47 47 47 47 47 36
+36 45 47 47 47 47 47 47 44 38 34 40 39 28 28 45 29 35 45 34
+47 47 47 47 38 38 47 47 47 47 47 44 45 40 49 45 47 45 45 44
+45 40 45 49 45 47 47 47 47 47 47 47 41 47 47 47 47 47 47 49
+49 49 49 38 40 36 34 34 34 27 33 27 44 44 44 47 47 47 47 47
+47 47 47 47 47 47 47 47 47 47 47 47 38 41 41 38 44 40 38 40
+38 45 47 47 47 47 47 45 47 47 41 36 47 47 49 47 47 45 47 38
+47 49 49 47 45 49 47 47 47 47 47 41 41 47 47 47 41 47 36 41
+38 38 40 34 36 49 45 34 34 29 38 29 38 47 47 36 36 36 38 38
+47 36 36 36 36 36 49 49 47 49 47 47 41 47 36 47 36 47 36 38
+47 45 45 47 47 47 38 36 41 36 29 29 38 29 34 34 36 32 49 36
+49 36 36 32 32 32 40 36 32 34 32 32 32 36 32 28 28 36 19 23
+18 12 10 10 11 16 11 20 24 27 27 27
+>gnl|ti|1086975914 name:1099575910555
+ 6 6 6 7 7 8 6 6 6 6 6 6 6 6 12 14 10 10 10 10
+10 10 16 16 16 16 17 17 18 16 12 12 12 12 12 12 24 21 25 25
+25 26 25 41 25 29 27 27 23 23 21 32 32 26 32 34 34 34 34 29
+34 34 26 25 26 32 32 26 36 47 27 22 13 10 7 6 6 6 7 11
+13 20 23 23 40 40 44 47 47 47 47 47 47 31 35 34 34 34 35 35
+34 34 34 34 35 44 38 44 33 31 33 38 29 24 27 25 25 25 21 26
+45 34 34 44 30 29 29 29 34 38 38 44 38 44 40 36 40 45 45 45
+47 41 47 47 47 47 41 41 47 41 44 44 44 35 38 45 38 38 38 44
+44 44 38 47 38 44 38 38 44 38 47 47 47 47 47 47 41 47 47 47
+47 47 47 49 47 49 45 49 40 40 38 38 38 47 47 47 49 45 47 47
+47 38 47 47 41 47 47 47 47 47 47 45 44 44 32 40 40 40 34 45
+45 47 47 47 41 47 47 47 41 38 38 38 44 38 44 40 40 34 40 44
+40 47 47 47 36 47 47 47 47 38 47 47 47 45 47 47 47 38 38 47
+41 44 44 40 49 45 47 47 47 38 38 38 38 44 38 47 47 47 47 47
+47 47 47 49 49 47 47 36 39 40 40 47 45 41 39 39 28 28 28 28
+31 45 44 38 49 49 49 49 49 49 45 47 45 45 36 38 38 45 44 41
+41 41 47 47 47 47 38 38 47 47 49 49 45 45 47 47 47 47 45 40
+34 35 29 34 34 34 38 44 47 49 47 47 47 47 47 38 47 47 47 47
+47 47 47 47 47 47 47 47 47 47 44 45 44 44 35 38 47 47 47 47
+47 47 47 47 47 47 47 47 47 47 47 41 47 49 45 49 49 45 49 28
+28 40 40 45 45 47 47 47 47 38 47 47 45 49 49 47 47 41 47 47
+41 49 47 47 47 47 36 38 47 41 47 47 47 47 47 47 47 44 47 47
+47 47 40 40 32 35 35 39 40 40 38 44 47 47 47 38 47 38 38 49
+49 49 49 49 49 49 49 47 47 47 45 47 47 47 47 47 47 47 47 47
+47 47 38 36 47 38 36 38 40 47 47 47 47 36 47 49 38 36 36 36
+36 47 36 39 40 28 28 36 36 36 45 34 34 39 39 47 47 47 47 47
+36 36 38 44 44 44 24 24 36 47 49 36 47 47 47 36 38 38 34 40
+38 49 47 47 47 47 36 38 40 32 38 38 40 40 36 32 34 39 39 47
+36 38 47 47 47 36 36 36 24 17 18 36 39 36 47 39 45 28 40 24
+24 34 39 36 30 21 19 14 7 7 8 14 15 15 15 9
+>gnl|ti|1086975817 name:1099575910556
+ 6 7 9 12 6 6 6 6 6 6 6 7 7 7 7 7 7 14 8 7
+ 7 12 12 12 14 18 12 10 10 12 12 12 12 14 16 12 14 24 19 19
+29 24 25 29 44 23 23 30 16 23 19 21 32 38 38 44 27 27 44 44
+34 35 36 30 26 30 22 21 26 40 24 29 19 14 11 10 9 7 9 9
+16 23 28 32 40 40 47 47 47 47 47 47 41 47 25 31 28 28 32 32
+34 35 35 34 29 32 38 44 44 32 33 33 40 40 36 49 49 49 32 45
+45 45 40 40 34 27 34 34 29 35 44 44 44 38 44 34 40 40 45 45
+47 47 47 47 47 47 47 41 44 41 47 38 44 45 44 44 45 45 47 47
+47 45 34 34 35 33 35 33 38 44 38 44 44 38 38 38 47 47 47 47
+47 47 47 49 41 44 47 47 38 47 38 47 36 47 47 47 47 47 47 49
+47 47 47 45 47 38 44 38 40 38 38 47 47 44 44 32 40 34 40 34
+34 34 40 40 38 49 38 44 38 38 45 29 40 44 38 45 40 34 35 35
+40 36 40 44 40 47 47 47 49 47 38 47 47 47 45 36 38 47 34 34
+44 34 35 38 49 49 38 47 41 47 44 38 38 38 38 29 40 38 44 32
+40 40 40 38 38 47 47 47 36 36 40 40 45 47 40 39 28 28 40 32
+32 44 38 41 47 38 38 38 39 32 40 40 47 40 45 40 45 45 49 49
+49 49 47 45 45 47 47 44 38 34 40 32 39 40 36 45 38 40 40 40
+40 26 26 23 23 29 29 47 47 49 45 49 49 41 38 44 44 44 44 29
+47 47 38 41 38 38 38 44 38 38 44 44 44 44 44 38 38 47 47 47
+47 47 44 44 32 36 45 40 38 38 38 47 41 47 40 40 40 32 49 49
+27 27 28 28 45 39 41 47 47 47 47 47 49 38 47 49 47 47 47 47
+47 47 49 45 49 45 38 36 40 38 40 36 47 49 49 49 45 47 47 47
+47 47 49 40 40 28 28 28 36 40 40 38 44 47 47 47 47 47 39 40
+28 28 49 49 49 49 29 35 35 38 38 38 47 47 49 45 49 29 39 17
+14 26 24 26 28 29 40 40 32 36 28 28 36 28 26 27 25 17 16 22
+22 21 21 24 21 21 29
+>gnl|ti|1086975906 name:1099575910558
+ 6 6 6 6 6 6 6 6 8 9 18 14 14 7 7 8 7 7 12 12
+12 12 12 12 12 12 12 17 19 19 19 14 12 12 12 12 16 12 14 14
+17 16 31 18 19 17 12 10 20 24 24 27 23 19 19 27 27 30 44 29
+38 45 45 35 35 34 34 38 30 24 14 10 6 6 7 6 6 6 7 6
+ 6 6 8 7 9 13 14 34 28 23 24 28 31 45 44 45 38 40 38 32
+35 34 35 33 33 33 34 34 35 34 25 30 15 12 10 7 6 12 12 12
+20 14 13 14 39 39 44 44 34 40 39 45 45 36 44 35 35 38 34 31
+40 40 38 49 47 41 41 47 47 47 41 47 47 47 47 44 44 44 44 44
+44 47 45 45 41 35 35 34 34 29 38 38 47 41 35 34 33 34 34 34
+38 47 47 38 40 32 28 28 28 28 28 32 49 38 41 41 47 47 47 47
+47 49 49 49 49 45 47 45 47 47 34 29 44 44 38 38 47 45 38 40
+40 28 28 23 28 45 45 47 47 44 49 34 44 38 44 38 34 40 40 36
+45 40 28 23 28 39 40 45 38 32 32 36 38 45 33 33 30 30 29 38
+40 47 47 40 44 44 44 35 34 49 49 39 39 47 47 38 44 38 44 38
+35 38 44 38 40 36 34 38 44 44 38 47 47 47 38 47 47 41 47 47
+39 40 28 25 28 28 40 39 47 47 38 38 32 40 40 44 44 47 38 45
+45 40 38 45 38 41 45 44 49 49 49 45 32 40 45 40 28 45 36 47
+38 40 40 39 40 40 40 28 26 26 30 30 44 38 49 49 45 49 47 47
+36 45 45 45 40 34 38 44 47 47 47 47 47 38 47 49 49 47 36 47
+47 47 44 47 38 40 40 40 45 47 47 47 38 38 40 44 47 47 49 45
+36 49 32 45 39 23 28 28 28 40 40 47 38 49 47 49 45 49 49 49
+49 49 49 49 49 36 49 49 49 49 47 36 40 40 38 38 47 47 49 49
+49 47 47 47 47 45 47 45 40 32 28 40 32 40 36 47 47 38 47 47
+47 47 47 38 38 49 49 49 49 49 36 34 34 38 38 44 38 49 49 36
+45 47 39 39 18 17 39 27 28 32 45 45 40 39 29 35 45 45 45 34
+23 20 13 13 22 18 17 25 28 28 45 45
+>gnl|ti|1086975852 name:1099575910560
+ 6 6 6 6 6 7 7 10 7 7 12 10 8 8 7 7 10 18 19 19
+23 19 23 18 18 16 10 10 23 22 25 44 24 29 34 29 24 28 25 33
+30 24 34 28 29 26 26 30 26 32 32 25 24 29 35 35 29 27 25 30
+26 27 25 27 32 31 32 29 25 23 11 11 6 6 6 6 7 7 11 9
+ 9 9 9 9 9 11 9 9 13 10 10 12 17 21 22 16 25 21 16 16
+22 28 28 40 40 40 49 47 45 45 14 12 8 6 6 7 6 8 9 10
+10 10 8 9 9 20 15 23 27 28 26 28 30 44 38 38 34 24 30 29
+28 24 40 28 30 44 44 31 35 30 30 34 29 31 32 35 32 39 40 34
+45 45 47 45 38 40 32 39 34 34 44 38 44 44 49 34 36 45 35 35
+35 34 45 36 39 20 9 9 9 8 20 20 28 28 40 40 32 35 40 40
+38 44 44 44 40 44 34 49 49 40 38 45 44 38 38 36 34 34 35 34
+34 34 35 35 29 35 45 49 49 49 49 49 45 34 34 29 34 34 35 49
+45 47 47 39 40 34 40 40 44 38 41 28 28 24 24 30 28 40 40 45
+45 47 47 41 47 47 47 47 40 45 28 28 39 40 28 34 35 34 35 38
+38 45 36 32 29 30 24 26 26 39 40 40 38 45 49 32 40 32 26 29
+35 30 34 34 35 34 34 34 38 49 49 49 49 49 49 49 31 29 24 34
+34 35 29 35 29 35 38 38 38 47 36 24 44 36 40 36 39 32 27 27
+27 27 40 32 28 29 28 23 27 24 30 19 30 22 29 29 38 47 47 47
+36 34 34 35 29 30 34 45 36 23 21 29 30 38 35 34 35 29 35 34
+38 35 38 45 40 29 29 35 29 34 38 38 40 32 25 28 36 34 38 26
+33 33 32 33 31 33 47 47 45 45 47 36 36 32 49 49 49 49 40 47
+36 24 24 24 40 36 24 12 39 24 36 49 28 28 40 40 47 47 47 36
+38 34 26 23 24 23 23 23 36 32 36 36 44 47 38 38 19 29 24 34
+26 28 45 36 36 24 24 19 19 27 22 23 24 24 45 36 47 47 47 47
+36 38 40 36 40 40 36 38 38 44 38 40 34 38 40 34 38 36 24 38
+38 35 35 34 36 36 32 32 36 39 36 47 38 38 32 32 39 40 49 24
+36 36 36 40 34 36 49 32 28 36 24 25 25 23 20 11 21 15 27 28
+19 23 26 34 28 19 33 25 31 19 28 32 24 32 19 34 24 24 24 30
+19 17 17 23 23 23 24 23 24 28 24 28 32 19 19 24 19 19 34 27
+23 23 15 11 20 23 24 23 19 19 18 14 13 19 19 14 13 23 20 24
+19 29 19 21 19 24 25 32 40 23 23 26 32 22 23 25 25 33 19 19
+12 12 9 7 12 12 13 24 19 19 17 17 10 14 16 13 13 17 13 13
+ 7 9 8 7 7 10 12 12 12 11 12 17 17
+>gnl|ti|1086975876 name:1099575910561
+ 9 6 6 6 6 6 6 7 7 7 12 12 12 7 7 7 7 14 16 18
+16 19 18 20 20 16 18 9 10 24 19 30 27 25 27 32 40 34 25 33
+24 33 33 45 44 44 44 39 36 40 40 39 27 38 29 23 32 28 24 27
+26 21 27 28 32 31 31 31 32 38 44 44 18 18 11 10 20 24 47 47
+41 47 47 41 44 44 44 29 29 23 23 25 25 35 35 40 29 34 34 34
+34 35 38 38 38 38 44 45 47 38 38 34 34 27 28 28 29 34 35 38
+47 40 40 40 34 34 36 40 47 47 41 47 47 41 32 35 26 29 29 26
+39 40 40 49 40 45 38 45 40 35 44 38 44 38 31 40 28 28 31 29
+38 38 44 44 45 47 47 47 47 41 47 47 47 41 47 45 49 49 47 47
+38 38 38 44 44 44 44 38 38 38 36 39 40 47 41 47 47 47 41 49
+45 44 44 44 38 44 44 49 49 49 44 38 44 38 44 44 47 38 44 44
+38 38 38 47 47 47 47 45 49 49 36 40 38 47 34 34 38 38 38 44
+38 36 47 47 45 45 40 28 28 45 45 47 47 45 45 34 34 38 38 47
+47 47 47 47 47 47 47 41 38 38 44 44 26 34 40 38 44 44 44 38
+38 38 36 49 44 38 44 44 44 44 47 45 47 45 38 36 40 34 40 45
+38 47 45 40 28 24 24 27 30 44 40 32 49 49 45 34 49 38 38 38
+38 44 44 41 47 47 36 36 40 32 40 40 38 38 47 40 45 40 28 32
+49 49 40 38 45 39 45 32 40 39 45 44 45 39 49 49 49 49 45 49
+49 47 47 47 47 47 47 41 38 44 44 34 34 38 32 49 38 38 47 47
+47 47 47 45 41 47 47 47 47 38 47 45 49 49 49 35 40 40 47 47
+47 47 47 47 45 40 40 45 40 47 47 47 47 47 49 45 49 49 45 47
+47 41 47 47 47 45 38 38 38 34 40 38 45 47 47 47 41 41 47 47
+47 49 49 49 49 29 44 38 38 38 44 49 47 49 47 49 47 49 49 49
+49 49 40 40 45 40 47 47 47 47 49 49 49 49 49 38 49 49 49 49
+47 38 38 44 44 38 38 49 49 47 47 47 47 36 47 49 47 47 47 38
+47 47 38 47 47 38 38 44 47 47 47 49 38 45 44 38 38 44 49 49
+49 47 47 40 38 40 40 39 34 40 40 40 47 47 38 36 44 40 40 40
+36 45 40 49 49 29 38 29 38 38 44 36 36 47 47 47 47 47 47 47
+47 47 47 38 47 47 47 47 47 47 47 47 47 47 38 38 38 44 38 44
+39 39 40 39 26 28 30 34 44 34 49 49 27 23 39 40 40 34 40 44
+44 38 38 44 38 44 38 47 47 47 47 47 47 36 40 39 40 32 38 40
+47 38 38 44 38 34 29 24 35 16 12 9 14
+>gnl|ti|1086975855 name:1099575910562
+ 6 6 9 7 8 6 9 6 6 6 6 7 14 16 24 19 17 17 23 14
+17 21 19 35 18 16 16 16 17 15 23 35 36 38 38 31 38 44 24 38
+32 30 23 26 22 25 22 23 33 33 34 34 34 38 38 34 34 34 38 44
+38 38 34 38 35 35 28 23 25 26 23 15 22 9 9 23 20 25 21 13
+13 18 25 28 32 32 38 38 44 44 38 33 33 34 34 34 38 38 44 38
+29 35 34 29 26 30 30 32 31 47 47 49 39 21 18 17 27 28 29 32
+26 47 47 38 47 49 44 44 44 44 44 44 49 47 39 40 34 35 34 34
+47 34 38 38 38 44 44 47 47 36 38 44 47 38 38 38 38 35 38 45
+38 26 35 30 39 38 34 32 44 38 41 41 47 47 29 35 38 44 38 38
+38 38 38 38 44 44 38 34 34 29 39 32 40 28 36 49 47 41 47 45
+35 44 38 38 31 33 31 30 35 33 34 35 35 40 39 45 28 28 45 36
+38 38 29 29 28 27 20 32 45 36 45 36 49 40 38 45 47 45 45 28
+40 40 45 45 45 47 47 36 36 47 47 38 38 38 34 29 38 38 45 40
+34 38 44 49 38 44 44 38 34 29 49 32 34 36 38 47 38 47 41 41
+47 40 38 38 38 38 44 47 47 47 47 38 41 47 47 47 47 36 40 38
+45 40 40 45 40 28 23 25 32 40 47 38 38 44 44 44 38 49 49 47
+49 45 32 40 32 45 45 45 38 40 47 49 47 38 38 40 40 32 32 32
+44 40 40 34 38 45 45 45 39 39 32 40 40 39 40 36 45 40 40 32
+32 49 49 49 45 36 40 32 34 38 40 41 47 47 45 36 34 40 44 49
+49 49 36 28 28 45 45 47 47 47 40 36 40 40 32 40 39 49 49 49
+47 36 44 44 35 38 35 35 38 40 47 47 47 40 49 49 34 49 49 45
+45 34 40 45 38 47 38 44 44 45 44 44 40 40 34 40 40 44 38 38
+38 44 38 34 40 40 38 34 34 40 40 49 49 34 40 40 38 45 27 23
+16 16 39 27 28 40 49 38 47 38 44 34 40 40 38 44 38 44 34 35
+45 49 47 49 49 49 49 49 47 47 47 47 47 47 36 38 38 47 45 44
+40 47 49 45 47 47 47 49 49 49 45 45 40 32 45 45 47 45 47 47
+49 49 49 49 38 44 47 36 38 40 40 38 49 49 49 47 49 40 34 40
+45 38 36 40 49 49 49 49 49 47 45 45 40 34 45 49 32 49 45 39
+40 40 36 40 38 40 36 47 47 47 47 47 47 47 47 47 47 47 47 49
+49 47 49 49 38 36 36 44 38 47 47 38 38 38 49 45 45 38 44 38
+38 34 35 47 38 47 40 40 49 32 32 32 36 32 28 28 30 31 38 34
+38 38 27 27 19 27 27 36 45 49 49 45 28 28 40 39 38 34 40 36
+36 40 40 28 36 24 27 27 36 21 21 45 32 36 36 40 34 26 35 24
+24 20 11 11 29 20 29 29 14 14 9
+>gnl|ti|1086975865 name:1099575910563
+ 6 6 9 6 8 8 8 7 7 9 12 9 9 9 17 12 13 15 38 19
+29 24 23 13 12 12 14 14 15 14 25 19 17 23 45 19 23 23 18 18
+18 35 20 21 24 22 24 27 27 44 20 24 20 25 25 25 34 34 34 34
+25 34 25 25 25 31 30 24 19 14 9 8 7 7 9 9 9 10 22 36
+36 35 45 33 34 29 29 45 35 31 32 32 29 27 27 27 25 27 25 45
+32 28 25 40 40 47 47 47 44 45 20 15 9 7 7 14 17 30 33 35
+40 40 40 40 45 28 28 31 29 38 38 34 34 28 28 21 49 49 47 47
+49 49 47 47 47 36 45 45 45 28 28 45 45 47 41 47 41 47 47 41
+47 38 38 38 38 38 38 38 38 38 38 44 49 38 44 44 38 34 34 45
+45 49 49 47 47 38 47 47 47 47 44 44 38 44 38 38 38 44 47 40
+44 45 44 38 38 49 49 40 40 40 40 40 40 40 40 28 28 36 36 36
+44 44 44 35 44 38 32 45 44 40 40 40 35 32 45 45 45 38 40 47
+49 47 40 40 40 36 40 40 45 38 45 40 34 44 38 38 38 31 29 28
+28 39 40 28 40 39 36 32 28 28 36 40 47 38 47 47 38 47 47 47
+45 45 47 47 45 47 47 44 49 49 49 45 32 34 45 45 47 47 36 45
+36 28 28 28 45 39 47 47 38 38 47 47 47 47 45 36 41 47 47 47
+47 38 36 49 38 49 49 45 47 47 47 38 47 47 47 49 49 47 47 47
+47 38 44 34 32 34 32 45 36 47 44 38 40 40 38 38 40 45 45 32
+49 49 45 40 40 34 45 27 21 20 17 27 27 32 45 49 49 32 45 40
+40 34 44 44 47 47 47 47 47 47 38 47 47 41 47 47 47 47 45 49
+45 47 47 38 47 36 47 47 47 38 47 47 45 49 49 49 49 49 49 32
+38 34 34 44 38 38 47 47 45 49 49 49 49 49 44 38 47 47 47 47
+49 49 47 47 47 47 47 47 47 40 38 40 34 49 49 49 49 49 49 49
+47 49 49 49 49 34 34 45 36 38 40 40 40 34 38 49 47 47 47 47
+47 47 47 38 47 47 47 47 49 49 45 49 49 47 47 41 47 47 47 47
+38 38 44 44 38 44 31 38 44 44 34 38 47 47 41 47 47 47 49 40
+40 40 40 28 28 30 31 38 38 38 44 40 40 32 28 28 49 49 49 49
+36 35 26 26 23 18 26 45 14 20 29 23 20 27 28 33 25 27 28 26
+22 25 25 22 19 14
+>gnl|ti|1086975901 name:1099575910564
+ 9 7 9 9 6 9 6 7 9 7 7 7 9 9 9 9 9 7 9 8
+10 9 9 8 9 9 11 9 13 9 9 9 8 10 9 9 8 7 10 9
+13 12 10 10 13 9 9 9 9 9 11 16 10 9 10 9 7 8 9 9
+ 9 16 14 17 17 19 30 19 20 15 19 8 8 6 6 6 6 6 6 6
+ 9 9 9 10 10 12 12 11 10 12 21 18 18 20 14 14 10 11 11 14
+20 28 21 22 12 12 9 9 9 14 14 10 7 9 6 6 6 9 9 10
+12 12 12 15 22 18 18 14 14 16 16 23 23 20 15 16 18 15 15 15
+17 18 12 12 16 21 18 20 17 14 14 18 14 15 15 15 15 12 14 22
+24 14 13 12 17 13 13 10 12 9 11 10 14 12 12 14 14 16 17 19
+17 17 19 12 13 9 10 12 7 8 10 12 10 14 14 10 9 9 9 13
+14 16 23 27 18 14 14 12 9 9 11 14 27 27 25 28 23 19 27 27
+49 18 20 23 12 13 9 10 7 7 14 10 13 9 9 9 9 12 13 14
+17 15 13 10 16 11 14 26 15 17 14 17 15 20 17 16 12 14 10 11
+12 13 12 12 15 14 18 20 9 9 11 10 11 11 21 22 17 20 20 20
+23 20 18 15 13 13 12 18 24 14 16 13 9 16 16 16 12 12 12 14
+27 21 18 16 14 10 13 14 14 10 9 9 9 19 9 11 9 9 9 9
+14 9 9 9 11 11 13 18 21 24 24 20 23 21 18 13 13 12 12 11
+14 23 27 27 17 17 23 26 28 23 23 29 24 20 20 20 26 25 20 20
+21 20 18 18 17 11 11 13 13 10 11 9 9 11 11 16 14 14 11 12
+13 18 20 27 27 24 24 14 14 17 23 27 19 19 14 15 16 13 18 17
+17 18 18 18 16 23 13 13 16 14 14 11 10 10 16 22 21 23 16 13
+12 11 11 9 11 13 11 15 18 18 25 15 14 9 12 16 18 18 39 39
+19 20 49 23 18 17 23 21 23 19 26 16 14 12 12 12 12 9 12 16
+10 10 17 17 12 10 7 7 9 17 13 10 9 9 13 13 20 21 16 12
+ 9 9 12 16 16 13 9 9 9 9 13 14 16 13 25 20 15 11 11 11
+11 21 21 11 11 11 13 21 23 14 11 9 10 9 13 16 13 10 14 18
+17 16 12 12 16 24 27 23 18 23 29 29 18 12 14 17 17 17 39 21
+18 18 18 26 21 19 14 11 15 13 11 10 10 10 11 10 9 12 16 18
+18 19 17 14 14 24 24 13 13 12 13 18 20 14 14 15 14 10 11 15
+12 13 13 17 13 17 17 14 11 9 9 9 9 12 16 13 8 10 10 12
+16 22 13 8 9 9 12 12 10 12 9 14 15 9 9 13 10 9 9 9
+ 8 8 9 10 12 9 9 10 13 16 11 9 9 11 9 10 14 16 16 10
+12 11 10 10 8 10 7 9 9 9 9 11 11 14 9 9
+>gnl|ti|1086975776 name:1099575910565
+ 8 6 6 6 6 6 6 6 6 6 10 8 11 7 11 7 7 7 7 7
+ 7 7 12 14 12 12 12 12 10 15 13 13 19 19 21 19 17 21 16 14
+23 17 14 17 18 17 27 20 19 19 21 25 19 27 34 35 34 40 38 35
+35 19 24 19 19 31 29 29 23 30 24 33 34 34 34 29 24 19 18 16
+20 14 25 27 30 30 33 33 23 21 23 23 27 23 25 38 44 47 35 33
+33 34 34 34 38 45 40 38 40 38 34 38 38 38 38 47 49 47 34 28
+26 26 26 27 30 35 28 28 45 40 47 38 38 34 34 34 34 44 38 47
+47 47 41 47 47 47 47 47 38 44 38 47 45 45 32 32 40 32 45 45
+47 47 49 47 47 47 40 40 28 28 32 40 38 49 47 38 44 38 38 38
+34 34 34 35 34 34 35 40 34 34 40 45 49 47 49 45 44 38 38 38
+38 44 44 41 38 44 35 34 31 33 38 38 38 38 47 44 44 38 44 38
+38 40 49 45 49 45 47 41 47 47 47 47 47 45 40 40 38 47 38 47
+47 47 47 47 41 41 47 47 47 38 38 44 38 44 45 45 34 35 34 38
+31 31 29 28 28 28 40 40 47 47 47 36 38 40 32 32 40 40 47 38
+47 41 47 47 47 36 49 47 47 47 41 47 47 49 49 47 38 38 44 35
+35 34 32 49 45 45 49 49 45 49 38 38 35 44 35 35 45 45 47 45
+40 32 34 49 44 41 41 47 47 41 47 47 49 45 40 32 34 38 44 47
+41 45 44 38 40 40 44 44 47 45 47 47 41 47 45 45 47 47 47 47
+47 41 47 47 40 38 34 34 44 38 47 47 47 47 38 38 38 34 34 34
+35 49 39 32 40 39 40 47 47 49 49 38 44 38 45 38 45 40 39 40
+21 21 27 19 19 27 27 27 24 24 12 12 24 23 19 21 13 13 12
+>gnl|ti|1086975881 name:1099575910566
+ 6 6 6 6 6 9 8 13 7 7 18 12 12 8 7 7 8 14 13 14
+14 17 15 16 21 19 21 30 15 21 21 16 33 21 24 30 24 22 23 21
+25 19 23 33 34 45 47 44 45 44 40 44 35 27 25 23 27 23 23 27
+30 34 23 28 25 25 25 21 29 40 40 28 26 26 30 30 34 34 34 45
+44 44 38 30 32 33 31 34 34 34 35 45 44 34 38 44 38 38 38 45
+44 44 47 33 28 27 25 27 27 32 38 44 40 34 30 30 33 33 28 45
+32 32 40 40 38 29 38 38 38 38 44 38 47 44 38 38 44 38 44 39
+40 34 40 45 40 47 36 45 49 34 35 34 34 34 44 47 47 47 47 41
+44 44 44 44 38 44 47 49 45 28 26 26 26 34 34 44 47 45 49 49
+49 45 49 28 28 49 32 45 38 44 38 45 45 47 47 47 34 34 34 34
+34 34 40 40 34 32 49 36 49 47 45 38 38 38 44 38 38 45 49 49
+40 34 40 38 44 38 38 38 38 49 38 38 44 44 38 38 40 40 40 34
+45 38 38 38 44 38 44 41 38 31 33 33 29 30 35 40 47 47 47 38
+38 40 44 47 44 44 38 38 44 24 39 40 28 28 35 28 31 29 28 28
+28 32 49 45 47 47 45 40 40 40 34 49 49 49 47 47 41 47 44 44
+32 34 38 38 47 38 47 47 47 49 49 45 45 45 36 40 40 38 47 45
+47 47 49 47 49 38 38 38 44 35 34 49 45 36 38 36 40 40 45 38
+44 29 38 38 38 36 45 49 49 40 36 38 29 38 44 38 38 38 38 34
+34 38 40 44 47 38 38 36 49 49 49 49 38 47 47 47 36 47 47 40
+45 49 49 49 49 49 49 49 32 36 40 32 39 45 40 40 49 40 40 40
+40 40 32 49 49 45 44 44 29 38 38 38 24 40 32 28 32 32 28 28
+32 45 25 24 24 20 24 20 23 23 21 18 18 18 36
+>gnl|ti|1086975790 name:1099575910570
+ 6 6 6 6 6 6 7 7 12 12 12 13 13 12 12 12 19 19 19 18
+12 14 18 24 15 18 44 35 35 35 19 18 17 9 9 12 15 15 16 16
+17 18 16 24 31 27 23 23 25 25 16 16 25 24 27 27 23 24 24 35
+23 24 23 42 35 35 35 34 23 34 35 38 28 24 17 18 18 24 27 34
+49 49 47 49 44 38 44 44 38 38 44 38 45 40 40 45 49 49 49 47
+47 31 32 32 26 30 32 49 49 45 49 49 38 44 38 44 38 38 33 33
+34 34 35 35 44 38 38 47 47 47 41 47 47 47 44 38 44 38 44 38
+38 44 38 44 38 44 47 41 38 38 34 34 34 34 34 47 49 49 47 47
+47 44 40 38 47 47 41 47 41 38 44 45 44 30 31 44 31 35 38 41
+47 47 47 47 47 47 47 41 41 47 47 47 41 38 38 44 44 38 38 47
+47 45 47 47 45 47 49 38 47 47 41 47 47 47 47 47 47 45 49 49
+41 38 45 36 44 40 44 44 44 49 45 47 47 41 47 47 44 44 44 40
+44 44 47 47 47 47 47 47 47 47 38 44 38 34 34 40 49 47 47 45
+45 45 47 47 41 47 38 38 38 38 38 44 38 44 44 47 47 47 38 44
+44 35 44 38 38 40 47 47 47 45 45 47 45 40 28 49 32 39 39 47
+47 47 40 44 40 40 32 40 23 40 39 40 44 40 40 40 49 49 45 45
+44 44 44 38 44 44 47 38 34 34 34 35 34 44 41 47 38 38 47 38
+29 38 44 38 38 45 38 47 47 47 47 45 47 44 38 44 44 44 44 49
+49 49 47 47 47 41 38 44 44 38 44 44 45 47 47 47 39 38 38 34
+32 38 45 38 32 34 36 36 45 45 45 45 49 49 40 38 44 41 47 47
+47 47 47 47 49 49 47 47 47 47 47 47 41 38 45 40 38 44 41 47
+47 49 38 38 38 44 38 44 44 49 49 45 41 47 47 47 47 47 47 49
+49 47 47 47 47 47 47 47 38 47 47 47 47 49 49 47 47 47 47 47
+41 47 47 47 47 47 38 47 45 49 49 47 49 45 49 47 47 49 49 49
+49 45 47 47 45 47 47 47 47 49 49 49 47 47 47 47 47 47 47 47
+47 47 49 38 49 44 40 40 38 45 38 44 39 36 28 28 39 39 44 40
+40 40 36 38 38 38 39 34 40 40 39 36 47 47 45 47 47 41 41 41
+47 47 41 47 49 49 47 47 47 47 47 38 38 47 40 38 40 32 28 28
+28 45 39 41 47 47 41 47 45 47 49 49 49 47 47 45 47 38 38 38
+38 34 35 40 26 26 12 14 8 8 11 16 12 24 30 23 23 32
+>gnl|ti|1086975830 name:1099575910573
+ 6 6 6 6 6 6 6 6 6 7 8 8 8 12 18 12 11 8 8 16
+12 10 12 12 12 12 12 12 12 12 12 15 19 16 12 13 20 15 16 15
+16 20 21 21 22 22 22 22 18 20 22 17 22 21 32 34 34 47 45 36
+36 29 26 35 38 28 28 28 26 25 21 23 13 12 7 8 7 16 13 35
+38 44 47 35 35 32 31 29 32 32 32 31 40 28 28 45 39 47 47 47
+47 31 35 35 29 32 31 41 36 47 47 39 25 22 22 23 20 22 27 38
+44 38 38 38 44 38 44 47 41 41 41 45 45 47 44 44 38 38 38 38
+38 44 44 38 38 38 47 44 38 38 38 38 29 39 40 40 44 38 38 34
+34 44 38 38 47 47 47 47 47 47 38 40 40 28 35 34 40 38 38 47
+47 41 38 45 40 38 38 35 34 38 38 38 47 47 47 47 47 47 38 47
+47 45 45 45 40 38 40 36 47 47 47 47 45 38 47 47 47 45 49 49
+47 44 38 47 44 44 44 44 47 49 45 47 47 49 49 47 47 47 47 47
+45 45 47 47 47 47 47 47 45 47 47 47 47 47 47 47 49 47 47 45
+41 36 47 47 47 38 40 44 40 47 45 45 45 45 47 47 47 38 45 38
+38 44 44 45 45 38 34 40 40 45 45 45 39 40 28 32 32 40 45 38
+47 41 40 38 36 40 40 28 28 39 40 38 44 38 47 40 44 38 47 47
+47 47 47 47 47 47 47 44 33 31 33 34 34 38 47 47 38 47 47 38
+29 38 38 29 44 49 32 40 36 38 45 47 41 47 41 47 47 47 47 49
+49 45 49 45 49 47 47 47 47 47 47 47 47 47 47 47 38 44 40 40
+40 39 45 40 40 40 49 40 40 39 40 39 34 34 40 39 45 41 47 47
+47 47 36 47 47 49 49 47 47 47 47 36 45 36 36 30 33 33 34 34
+44 49 49 47 47 47 47 47 47 38 49 47 49 49 49 49 49 49 49 47
+45 39 19 19 29 29 18 27 49 45 25 16 13 23 22 40 40 34 40 49
+39 32 23 18 10 10 9 16 13 28 28 28 45 45
+>gnl|ti|1086975915 name:1099575910576
+ 6 6 9 6 6 10 8 6 6 6 6 6 8 9 12 16 11 7 15 16
+19 23 16 17 13 11 7 8 9 13 18 22 23 16 17 24 16 16 16 25
+19 19 29 34 29 31 26 25 27 25 25 21 23 23 31 25 19 19 30 23
+26 34 29 38 27 38 38 38 40 36 32 32 19 19 17 20 22 22 40 40
+38 38 44 44 35 35 34 34 35 34 38 38 38 44 44 44 29 38 34 35
+29 27 33 33 33 38 38 44 40 29 28 28 31 31 44 41 47 36 38 47
+47 47 44 38 44 44 45 38 38 44 45 38 40 47 44 34 34 34 34 34
+38 47 47 47 41 47 41 47 38 38 38 44 44 38 47 38 38 47 44 38
+44 44 27 27 30 23 28 30 30 44 47 47 47 47 47 47 36 45 47 47
+49 49 38 38 38 38 44 45 47 47 41 47 47 47 47 38 47 49 49 38
+38 44 32 40 39 32 34 39 40 28 28 32 40 45 44 44 38 49 44 38
+38 44 44 38 47 47 47 47 49 49 49 45 38 44 44 38 38 38 47 47
+47 36 38 40 32 32 39 20 20 25 25 31 29 32 33 31 34 34 34 38
+47 41 47 38 47 36 47 47 47 47 49 44 40 34 40 40 45 36 40 44
+40 47 45 45 40 36 38 47 47 47 47 47 36 47 47 41 47 47 45 49
+38 31 34 38 31 38 38 49 45 45 49 49 45 40 40 40 40 44 45 41
+40 38 38 40 44 38 47 47 47 38 45 47 38 47 49 45 47 47 45 45
+45 38 47 47 49 38 44 38 35 35 38 38 49 45 38 40 38 40 40 45
+28 40 28 40 39 40 40 34 44 44 38 38 34 40 45 49 49 49 38 38
+38 38 38 44 38 34 38 44 44 47 47 47 44 38 40 34 49 45 47 47
+41 47 47 47 47 47 47 47 38 47 47 47 47 40 47 47 47 49 45 40
+28 28 39 40 47 47 47 47 47 47 40 39 28 25 23 49 32 49 49 49
+49 49 45 38 44 45 45 38 34 29 27 19 19 39 29 38 49 47 47 47
+45 38 40 34 38 49 49 49 49 38 40 38 39 47 40 40 40 40 34 40
+40 40 47 47 47 49 45 49 34 49 49 49 44 38 47 47 47 47 47 47
+47 47 47 47 47 47 38 44 40 36 28 49 49 49 49 49 40 40 40 40
+40 40 38 40 41 47 41 38 45 39 40 28 40 39 47 47 47 47 49 49
+40 40 39 40 38 38 38 34 38 35 32 28 40 40 18 9 7 6 6 9
+12 12 20 20 20 28 28 29
+>gnl|ti|1086975896 name:1099575910582
+ 6 6 8 8 6 8 7 10 8 8 7 9 13 18 18 21 24 21 19 17
+15 14 35 25 35 29 26 24 26 26 28 34 31 32 29 34 29 34 29 16
+20 18 18 18 18 38 38 36 24 22 20 15 18 20 29 24 21 30 19 24
+31 31 32 31 31 32 35 35 27 38 22 15 10 9 9 21 20 38 47 38
+47 47 26 26 29 31 32 31 47 47 41 32 32 32 26 32 32 47 47 38
+38 38 44 44 38 38 38 38 44 44 47 41 45 31 29 28 31 30 38 47
+47 47 47 41 47 47 47 47 47 47 36 41 47 49 38 38 38 34 34 29
+33 34 44 44 35 47 41 47 47 47 47 47 41 47 47 45 47 47 41 44
+34 29 31 26 24 31 31 40 40 44 44 38 38 44 38 38 44 44 44 45
+44 47 47 47 47 47 41 47 47 47 41 47 47 47 41 47 47 41 47 41
+47 47 49 41 41 47 44 38 38 31 44 38 38 38 38 44 49 38 38 44
+44 38 38 47 41 47 45 47 47 49 47 47 40 36 40 45 49 38 44 38
+44 38 38 41 41 47 47 47 47 47 47 38 38 47 47 49 49 47 47 47
+47 47 47 47 49 47 38 38 44 38 38 38 39 40 34 36 40 39 45 47
+41 47 49 49 47 47 34 44 44 44 29 38 47 40 40 40 28 28 32 32
+38 49 47 45 49 41 34 44 38 38 38 44 47 41 47 49 49 49 49 47
+47 47 38 47 47 47 49 47 47 47 47 47 41 49 49 47 47 47 41 47
+36 49 49 47 47 38 38 44 32 34 44 38 47 38 47 47 47 41 47 47
+47 47 47 47 47 47 47 44 38 45 45 34 34 38 44 38 44 47 47 47
+38 47 47 47 47 47 47 47 47 34 44 38 44 44 38 47 47 38 40 36
+28 28 40 45 47 47 47 47 41 41 49 47 41 47 45 40 32 49 49 49
+47 47 47 47 41 38 38 47 38 47 41 47 47 47 47 41 47 41 36 38
+36 38 40 44 38 47 47 47 47 47 47 47 44 49 38 40 34 38 38 47
+49 49 49 49 45 36 36 45 45 47 45 45 34 34 29 31 29 28 29 29
+45 44 36 40 22 20 12 12 22 25 40 40 28 28 32 28 35 34 35 29
+24 28 29 16 16 9
+>gnl|ti|1086975891 name:1099575910583
+ 6 6 6 7 8 6 6 6 6 8 10 24 15 15 19 9 9 21 18 31
+24 18 31 37 22 15 15 15 15 14 15 29 29 31 42 35 32 26 29 35
+32 35 29 31 32 32 44 38 38 45 45 35 35 31 32 26 32 42 36 31
+31 29 25 25 25 25 28 28 35 34 44 38 38 44 44 44 44 35 35 38
+38 38 32 31 32 36 31 32 35 42 35 38 47 35 38 38 44 38 44 41
+47 47 41 47 47 47 47 47 45 38 44 38 44 44 44 38 44 38 38 47
+47 41 45 38 44 44 38 44 38 47 41 44 44 38 44 38 44 41 41 47
+47 41 44 44 35 45 44 44 45 47 41 41 41 41 47 47 47 47 44 35
+38 45 44 44 47 41 47 47 47 41 44 38 35 38 38 40 44 38 41 47
+47 41 41 47 38 47 47 41 47 47 47 44 38 38 38 34 35 45 45 47
+47 47 47 47 45 47 47 47 47 47 47 47 38 44 38 44 38 35 45 44
+44 44 38 41 36 47 41 41 47 47 47 38 45 40 40 40 44 45 45 49
+47 41 47 47 38 38 47 47 47 47 47 41 41 47 47 47 41 45 47 47
+47 47 45 38 47 47 47 38 38 47 47 47 47 41 41 47 49 47 41 47
+41 41 47 47 45 47 47 40 40 40 49 45 41 47 41 47 47 47 41 38
+44 45 44 44 40 45 45 45 45 49 35 38 44 38 44 38 47 47 47 47
+47 45 49 47 47 41 47 47 41 47 41 47 47 45 47 36 45 47 47 41
+47 38 47 47 47 47 41 41 47 41 47 41 47 47 47 41 41 47 47 41
+47 41 41 38 38 38 38 44 44 49 41 49 47 47 47 47 41 47 41 47
+47 49 49 47 49 47 47 41 41 47 47 47 47 47 47 47 47 47 47 49
+49 49 45 41 47 47 47 47 41 47 47 41 47 47 47 38 44 38 35 38
+35 38 44 44 44 44 44 47 47 47 47 49 49 49 41 41 44 47 47 47
+47 47 49 47 47 41 47 41 47 49 49 47 45 41 47 47 47 47 47 47
+47 49 45 45 47 47 47 47 47 47 47 49 49 49 49 49 49 49 41 47
+47 47 47 40 49 45 49 44 40 40 45 45 47 49 49 49 47 47 41 47
+47 41 49 49 45 47 47 47 47 47 36 45 34 40 38 38 47 47 47 47
+47 49 49 49 47 47 41 47 47 47 49 47 47 47 47 47 47 47 47 47
+47 47 47 47 49 47 47 49 47 49 49 45 49 49 49 47 49 49 49 47
+47 44 24 20 9 9 22 24 47 47 47 38 38 38 35 34 33 30 33 33
+30 15 17 9 6 6
+>gnl|ti|1086975848 name:1099575910584
+ 6 6 6 9 9 9 10 8 7 7 9 7 7 7 7 7 7 12 12 15
+15 17 14 21 24 21 19 19 21 28 20 13 16 15 16 11 13 19 26 24
+24 23 20 23 23 23 20 34 33 26 34 33 38 44 44 44 44 44 35 35
+34 34 35 34 44 44 44 45 47 47 47 34 30 35 24 22 26 19 19 14
+22 39 40 47 38 38 44 35 27 30 30 28 27 47 47 44 44 44 29 31
+31 29 30 26 34 35 38 31 38 47 38 38 32 45 40 40 40 40 40 39
+45 47 45 38 38 34 44 44 38 40 34 29 44 44 44 44 38 44 41 47
+47 47 36 36 47 40 40 40 40 40 44 44 47 47 47 41 47 47 47 47
+45 49 34 31 38 44 44 44 38 38 39 32 28 49 39 38 47 41 47 47
+47 47 44 44 44 44 38 38 47 44 36 40 32 29 28 27 34 34 34 34
+38 38 38 38 49 45 47 49 47 47 47 47 47 47 41 38 44 34 34 38
+40 36 34 36 38 47 47 38 47 38 47 47 38 38 38 49 47 47 47 47
+47 41 47 41 47 47 47 41 47 41 47 47 47 38 47 47 47 47 47 47
+36 47 36 47 47 47 45 49 47 44 38 38 47 47 47 38 45 36 44 32
+49 34 39 39 41 47 47 36 47 47 47 49 41 41 47 47 47 47 35 38
+38 38 44 35 36 45 45 47 47 47 47 41 47 49 47 47 47 36 38 40
+44 38 38 38 38 45 34 38 40 44 38 40 44 40 40 40 40 45 38 47
+47 47 45 47 49 47 49 41 47 38 47 47 44 36 34 49 49 36 49 49
+45 47 47 47 47 47 45 38 36 40 35 28 28 31 29 38 47 47 47 47
+47 44 36 40 40 49 49 47 47 44 45 36 40 28 28 28 28 40 40 47
+41 47 47 47 47 45 49 31 44 44 44 38 38 41 47 41 47 47 41 47
+47 47 47 47 47 47 47 47 41 41 44 47 45 38 40 40 44 41 47 47
+47 47 47 47 47 39 40 28 28 45 45 45 40 40 38 38 47 47 47 45
+24 20 11 9 16 12 23 16 19 18 20 16 9 9 12 9 8 6 9 9
+ 9 10 9 9 6 6 14 9 6 6 7 8 7 7 7 9 9 10 6 7
+ 9 9 9 9 7 9 9 9 9 7 9 11 9 9 9 9 9 9 9 11
+ 9 10 12 11 12 10 10 9 12 9 9 12 12 9 9 9 9 16 12 9
+ 9 11 19 12 13 9 9 11 19 9 9 7 9 9 9 9 9 7 7 9
+ 9 11 11 14 13 9 9 9 7 9 7 10 9 10 9 9 9 9 9 9
+ 9 7 13 16 18 18 13 12 13 15 11 13 16 13 12 9 9 6 7 8
+ 9 9 12 12 9 12 9 10 12 14 11 12 17 13 13 14 11 9 9 7
+ 9 11 7 7 9 9 9 8 9 9 9 10 10 9 9 9 10 9 7 7
+ 6 7 10 7 9 7 9 9 9 9 6 9 11 8 9 9 9 9 9 10
+ 8 10 10 8 9 9 6 7 7 9 9 11 10 11 12 9 9 9 9 9
+ 9 9 7
+>gnl|ti|1086975911 name:1099575910585
+ 6 6 6 7 6 9 11 8 7 7 8 9 6 6 10 10 14 24 28 35
+27 27 21 23 28 21 35 24 23 15 20 17 22 17 14 25 19 24 19 22
+29 31 26 26 16 16 16 16 24 24 19 23 23 23 21 24 29 32 19 26
+35 32 32 31 31 32 31 35 35 31 44 38 31 31 29 20 23 17 18 25
+32 34 38 34 35 38 38 38 44 47 45 47 49 45 45 47 44 44 44 44
+38 40 41 47 47 32 26 30 32 32 31 47 47 47 38 35 33 31 32 33
+45 49 49 38 38 31 38 38 38 44 38 34 38 47 41 47 47 38 44 44
+38 38 34 44 44 44 44 44 47 41 47 41 41 47 41 47 38 44 44 38
+44 38 47 49 47 44 47 47 47 47 49 47 49 41 41 47 47 41 47 47
+47 41 47 47 47 47 41 41 47 44 41 47 47 47 47 49 41 41 41 47
+47 47 47 47 47 41 41 47 47 47 47 47 47 47 47 47 47 40 38 49
+49 49 36 47 47 41 47 47 41 47 47 41 47 47 41 49 49 47 47 38
+45 38 40 40 44 45 45 41 41 49 47 41 47 45 47 47 40 40 38 40
+47 47 47 47 41 41 47 47 47 47 47 47 47 47 47 47 44 38 34 40
+40 49 45 35 35 38 38 44 38 41 47 47 47 45 38 47 47 41 47 47
+47 44 36 44 40 34 38 45 47 47 47 47 47 47 47 47 45 47 47 47
+41 41 41 41 36 49 38 47 47 47 47 47 45 38 40 36 45 45 47 47
+47 47 47 47 45 47 47 47 47 47 47 38 47 44 44 38 44 44 44 47
+45 36 47 38 38 36 32 28 28 39 40 47 47 40 40 38 40 36 47 38
+47 47 47 47 47 47 45 45 40 34 40 36 38 47 47 47 41 41 47 36
+40 34 29 34 34 34 38 47 47 47 45 47 47 47 47 38 47 47 47 41
+47 47 41 47 47 47 38 49 38 38 47 47 47 47 36 47 41 47 41 41
+45 47 47 41 45 47 47 47 41 44 38 38 38 44 38 44 44 44 40 47
+47 38 38 47 47 40 39 40 49 45 41 47 47 47 47 47 45 47 45 47
+47 47 47 47 47 45 38 34 34 34 34 34 40 34 40 45 47 47 47 47
+47 47 47 47 47 41 47 47 45 47 47 47 41 47 41 47 47 41 47 41
+47 47 47 47 47 47 47 47 47 47 44 44 38 45 38 38 38 47 44 47
+47 47 47 45 24 20 9 9 20 20 31 29 32 35 27 21 15 9 9 17
+14 7 7 8 8 7 7 12 12 18 9 9 9 9 7 7 14 9 10 9
+ 6 7 10 6 6 7 18 16 12 12 9 7 9 8 9 9 9 11 8 15
+18 13 13 18 16 13 10 13 10 10 15 11 10 16 10 10 9 9 13 9
+ 9 9 10 9 9 9 9 9 7 9 7 9 9 9 9 7 7 9 9 10
+14 9 9 9 11 10 11 10 9 9 9 10 9 9 7 9 10 9 9 8
+ 9 9 9 9 9 9 7 7 9 7 9 7 7 9 7 9 7 9 9 9
+10 9 9 13 11 10 7 7 7 7 7 10 10 9 6 6 9 9 9 9
+ 7 9 9 11 10 9 9 9 9 9 9 9 9 7 9 9 9 9 9 9
+ 9 8 8 7 9 9 9 9 9 8 7 7 9 9 7 7 7 7 9 9
+ 9 7 6 7 7 9 7 9 9 9 9 9 9 9 9 6
+>gnl|ti|1086975861 name:1099575910586
+ 8 6 7 7 7 9 6 6 6 6 8 10 9 8 8 8 17 14 13 12
+ 7 7 12 12 15 14 12 20 18 17 12 28 16 27 38 34 24 29 24 29
+34 34 35 34 34 34 44 25 25 23 30 27 26 47 47 47 32 26 25 21
+21 30 35 45 45 47 38 44 40 34 34 30 29 28 28 20 19 15 19 22
+22 21 27 27 33 33 35 33 44 35 42 29 25 29 35 38 38 38 29 35
+38 44 44 44 45 47 44 34 34 34 34 34 38 38 47 41 38 47 47 38
+44 40 34 35 38 44 34 31 29 26 31 29 35 47 47 47 41 47 41 47
+38 38 29 44 44 44 38 38 38 38 38 38 41 47 47 47 47 47 41 47
+44 47 45 47 47 38 47 41 38 44 44 44 44 44 47 47 47 45 49 47
+34 35 34 35 29 38 44 47 41 41 47 47 41 41 47 47 47 47 44 44
+39 34 32 39 40 41 47 47 47 47 38 44 44 35 44 38 47 47 47 41
+36 44 40 49 45 35 34 44 38 38 38 38 38 47 49 45 38 47 47 38
+38 44 45 44 38 49 49 47 47 47 38 45 45 47 47 47 47 47 41 47
+41 47 47 41 47 47 41 47 41 47 47 47 47 47 38 47 47 38 38 44
+38 38 31 38 47 47 47 47 40 38 40 36 47 47 47 44 44 38 44 38
+35 41 47 45 38 40 40 40 32 29 35 38 38 44 38 47 36 47 38 47
+47 41 38 36 38 38 44 38 38 38 38 49 49 49 45 45 36 41 41 47
+47 47 47 38 34 35 38 31 38 47 41 49 45 36 38 38 38 38 44 44
+47 47 47 47 47 41 47 47 44 44 44 45 38 44 41 38 47 47 47 47
+47 49 45 41 47 41 47 47 47 49 47 47 47 47 47 47 41 47 36 47
+47 47 38 38 35 35 34 45 49 49 49 49 41 47 44 47 47 41 47 47
+47 47 47 47 47 45 49 49 44 34 40 45 40 34 40 40 39 40 41 47
+47 47 41 47 47 47 47 47 47 47 47 47 47 47 47 47 47 41 45 49
+45 47 41 47 47 47 47 47 47 47 47 47 38 44 38 38 38 38 49 49
+49 45 47 38 47 47 41 47 41 47 47 38 44 38 40 38 39 27 20 9
+ 9 24 24 27 30 29 38 38 45 45 47 45 45 28 28 32 22 22 21 12
+14 11 19 18 18 27 27 8 12 6 7 6 11 10 6 6 8 9 9 7
+ 9 10 9 9 6 7 7 7 8 8 8 9 10 9 9 7 9 8 7 7
+ 9 9 9 9 14 9 9 10 9 9 18 10 10 10 10 9 6 9 9 9
+ 8 8 9 6 6 9 9 9 10 9 7 9 9 9 9 9 9 9 9 9
+ 9 7 10 11 7 7 7 9 7 9 9 9 9 10 9 7 7 9 9 7
+ 7 9 9 7 12 11 11 16 16 11 9 9 6 7 13 9 9 9 8 9
+ 9 11 11 9
+>gnl|ti|1086975845 name:1099575910587
+ 6 9 9 7 7 7 6 7 6 6 7 13 14 16 16 16 16 16 16 16
+16 13 14 14 14 15 17 23 18 18 19 30 29 29 21 23 24 31 29 33
+34 25 29 26 35 40 38 44 38 31 31 32 32 32 35 32 32 25 31 22
+22 30 29 29 28 23 23 29 29 32 29 44 44 31 27 27 24 22 24 30
+33 34 34 34 34 35 34 38 40 44 38 38 45 38 45 38 38 44 38 38
+38 38 34 32 32 32 31 32 32 40 38 44 38 38 31 38 38 44 38 29
+32 32 32 32 32 38 31 31 38 38 44 47 47 47 47 31 31 32 31 31
+32 38 47 41 47 47 47 47 47 38 44 40 40 47 47 47 41 47 47 41
+41 35 40 35 45 45 44 47 45 47 38 44 45 39 34 40 39 40 41 41
+47 47 47 47 47 41 36 47 47 45 47 41 41 41 49 41 47 47 47 47
+47 41 47 47 47 47 47 41 41 33 29 28 26 29 29 44 47 47 38 45
+45 47 47 47 40 40 39 28 23 40 40 47 38 41 47 47 47 40 40 32
+40 40 39 39 47 47 41 47 47 47 47 47 41 47 40 45 40 40 34 38
+49 36 38 38 47 41 44 44 44 31 29 28 40 32 38 28 29 29 29 38
+44 34 40 36 49 34 45 49 38 38 44 35 35 38 40 34 38 40 38 47
+47 47 47 47 47 38 47 47 41 41 47 47 47 47 47 47 47 47 45 47
+47 45 47 47 47 45 49 49 49 49 49 49 49 38 38 44 38 38 44 34
+40 38 47 47 47 49 49 36 49 40 28 28 40 40 41 41 41 47 38 47
+38 47 36 47 38 40 38 44 38 36 44 40 32 44 45 47 47 45 47 45
+49 49 49 47 47 47 44 44 32 49 49 49 47 38 47 47 36 38 47 45
+38 47 47 47 47 47 47 41 41 47 47 49 38 47 47 47 45 47 41 47
+38 40 34 32 40 40 44 44 41 38 47 47 47 40 39 40 25 23 40 39
+38 40 44 45 45 45 34 29 44 38 38 44 39 39 39 23 28 39 40 40
+40 49 34 45 49 45 38 34 36 36 47 47 47 47 44 44 34 38 44 44
+40 40 35 35 35 22 21 23 27 25 23 44 40 24 21 22 19 19 24 23
+23 24 15 13 7 9 7 6 6 6 6 6 6 6 6 6 6 7 6 6
+ 7 6 11 13 31 40 20 24 9 9 9 9 9 6 10 16 9 11 20 24
+20 20 11 11 12 17 13 11 9 10 15 11 13 27 14 13 12 10 10 10
+11 13 19 18 25 23 18 23 14 12 9 14 10 18 18 18 13 19 27 24
+20 12 9 12 12 9 9 11 11 16 18 14 14 8 9 9 9 9 11 10
+14 9 14 14 11 12 11 14 18 23 18 13 13 18 11 10 10 9 9 15
+15 16 23 23 23 25 18 18 11 13 11 12 13 19 16 9 9 9 9 7
+ 9 9 8 11 11 16 11 9 9 9 9 11 19 9 9 7 9 9 9 13
+12 10 10 9 9 9 9 10 7 7 10 9 9 7 9 9 9 10 9 6
+ 9 9 7 9 9 7 9 9 9 9 7 10 9 9 9 9 10 10 10 9
+ 8 9 9 7 9 9 9 9 9 9 7 7 6 6
+>gnl|ti|1086975811 name:1099575910590
+ 6 6 6 6 6 6 9 9 7 7 7 7 7 7 12 8 8 14 14 14
+15 12 12 12 12 19 26 24 26 28 19 17 18 17 20 23 19 19 23 20
+24 25 24 30 28 27 23 25 29 29 32 23 23 25 23 24 23 34 35 35
+31 34 44 44 44 38 44 31 32 30 29 26 16 18 10 9 9 9 9 9
+ 9 16 18 22 22 22 29 33 25 34 34 34 35 44 44 35 34 34 24 27
+32 32 32 29 44 44 34 35 47 47 44 44 44 47 38 38 40 40 34 28
+28 26 35 29 45 38 47 34 44 44 34 38 38 38 44 44 38 38 44 38
+44 38 49 47 47 47 47 47 47 47 47 47 47 47 47 47 47 34 32 29
+32 32 26 38 38 38 47 47 47 47 47 41 45 40 39 32 35 39 35 38
+44 35 38 44 47 47 47 40 40 27 29 27 35 32 40 39 41 47 47 47
+47 41 47 47 41 41 47 47 47 47 41 47 49 47 38 38 38 34 34 26
+40 38 38 31 44 38 38 44 47 47 47 47 38 38 47 47 38 44 38 44
+38 38 47 38 38 44 38 38 44 49 47 47 44 44 38 38 44 38 47 34
+38 44 38 44 35 40 44 47 38 45 47 47 47 47 49 49 49 49 49 49
+47 38 47 44 38 40 38 38 38 44 44 38 47 38 38 34 40 40 40 34
+38 44 47 41 47 47 47 41 47 47 41 38 44 38 44 38 38 38 47 36
+40 38 45 47 47 47 45 45 34 40 45 36 47 47 47 41 47 41 47 47
+47 41 47 41 47 47 41 47 47 47 47 36 47 38 38 38 38 44 44 47
+47 41 44 44 38 31 38 38 47 44 40 32 40 38 47 38 47 45 38 40
+45 39 40 32 23 23 40 39 41 47 47 47 45 47 47 47 47 47 47 45
+49 49 49 49 32 45 36 38 40 40 49 49 49 49 49 49 44 35 38 38
+38 38 49 38 47 47 40 40 40 28 28 28 32 29 38 38 44 44 44 38
+47 47 38 45 34 34 44 38 44 44 47 36 47 47 45 39 34 40 40 40
+39 47 49 49 49 38 44 38 44 44 45 41 47 47 47 45 47 47 47 41
+47 47 47 47 47 47 47 49 47 47 47 45 47 47 49 47 38 38 40 40
+44 44 47 45 41 47 47 45 47 47 47 47 39 40 23 28 39 20 19 13
+11 23 20 34 38 34 34 44 39 45 25 25 26 23 23 26 28 27 44 38
+29 32 23 14 20 9 9 9 7 10 7 9 9 9 8 7 6 9 9 9
+ 9 9 9 9 17 13 9 9 9 9 9 9 9 9 9 9 9 9 9 13
+12 11 10 9 11 11 15 12 11 9 11 9 10 9 9 12 11 12 13 9
+ 9 9 7 7 9 9 8 8 10 11 11 9 12 11 11 9 9 9 9 10
+11 9 8 9 9 9 10 9 9 7 8 11 9 9 7 9 9 16 9 10
+10 8 9 8 9 9 9 9 9 7 9 12 10 10 12 9 13 9 7 7
+ 9 9 9 7 9 9 7 7 9 8 9 7 9 9 6 9 9 8 6 9
+ 9 7 9 7
+>gnl|ti|1086975897 name:1099575910593
+ 6 6 6 6 6 6 6 6 6 6 6 10 12 12 19 19 13 10 7 7
+10 10 14 14 17 24 29 21 12 12 15 15 14 21 19 21 12 14 23 22
+23 21 21 23 21 23 34 34 34 23 23 25 24 25 25 27 25 23 23 23
+28 33 33 32 33 40 44 47 36 39 20 11 9 13 19 16 19 21 21 24
+28 44 34 28 34 34 29 33 28 26 26 29 29 24 38 44 44 47 47 44
+44 38 38 38 38 44 47 47 47 38 40 39 28 28 39 40 40 49 45 38
+38 38 38 38 44 38 44 38 44 44 49 49 47 47 38 36 40 40 36 47
+47 47 49 47 41 47 47 44 38 44 44 38 34 30 35 38 44 44 44 44
+38 45 38 38 44 40 38 38 47 47 47 47 47 41 47 38 38 47 47 47
+47 40 40 39 28 28 40 40 36 47 47 47 41 47 47 44 40 38 40 45
+47 41 47 47 45 36 40 40 36 45 47 38 44 34 32 40 32 40 40 40
+47 40 49 32 49 44 47 47 44 44 44 38 38 44 38 47 47 38 35 38
+38 38 38 47 47 36 47 45 40 34 40 38 49 49 49 47 38 38 44 44
+38 38 47 47 47 41 38 38 31 38 34 38 40 38 40 47 38 29 44 44
+31 38 35 49 45 45 40 36 36 40 47 47 38 38 47 47 47 41 47 44
+40 32 28 28 40 39 41 47 47 47 47 47 47 47 47 47 41 44 44 38
+30 30 33 38 44 44 45 47 45 38 38 38 34 35 34 34 38 34 34 39
+40 47 38 45 47 47 47 47 47 47 47 47 49 49 47 38 38 38 29 31
+28 28 39 40 41 47 47 38 38 40 32 38 45 47 38 47 47 47 36 40
+45 38 47 39 45 34 34 34 34 44 38 44 44 38 40 34 38 38 47 47
+36 38 47 47 47 47 47 47 47 47 41 45 38 47 47 47 41 47 44 44
+38 38 38 45 47 45 36 34 40 45 49 47 47 47 47 47 47 47 41 49
+47 47 45 45 47 47 49 49 49 49 45 49 49 49 41 41 47 47 41 47
+47 47 38 47 47 47 47 47 47 47 47 47 47 47 47 45 47 47 47 44
+47 41 47 47 41 47 47 41 40 44 49 49 49 38 40 47 47 47 47 47
+47 47 45 47 47 47 47 44 38 44 34 40 40 38 36 47 47 47 41 38
+45 38 35 45 38 36 36 44 36 36 29 27 25 25 29 29 23 27 21 13
+13 12 12 12 12 6 6 6 7 9 7 7 6 7 7 7 6 9 16 8
+ 8 6 9 9 9 16 19 23 12 11 9 9 9 9 9 9 9 9 9 9
+ 9 10 18 18 18 10 10 9 7 9 9 9 9 9 9 7 9 10 8 9
+ 7 9 11 10 12 17 11 9 13 9 9 7 7 10 9 9 12 10 10 8
+ 9 9 7 9 9 9 9 9 9 11 8 7 9 9 9 7 9 10 9 9
+10 9 9 14 9 9 9 9 9 11 9 9 9 9 9 9 9 10 13 10
+ 9 10 10 8 8 8 9 9 12 10 16 13 15 19 13 15 13 13 14 9
+ 9 9 8 9 9 12 12 9 9 7 9 9 9 8 11 10 9 9 8 7
+ 9 9 7 9 9 9 7 9 9 9 9 9 11 10 8 13 10 12 9 9
+ 9 10 10 9 6
+>gnl|ti|1086975849 name:1099575910596
+ 8 12 7 8 8 6 7 6 6 6 6 6 7 8 7 7 8 15 10 10
+ 8 8 10 14 8 9 16 16 19 19 30 24 21 17 21 18 24 25 17 17
+25 19 23 16 30 32 32 45 32 28 30 32 45 47 45 44 44 44 47 47
+47 44 44 45 44 31 31 29 29 31 27 44 44 45 35 20 24 29 27 26
+29 35 35 44 44 45 44 38 34 29 34 34 34 34 44 44 47 47 47 47
+47 47 31 24 22 22 22 22 28 28 38 38 29 26 30 33 33 32 36 40
+40 49 47 47 47 47 38 45 35 35 44 45 44 44 38 40 40 40 40 36
+45 38 47 38 49 47 36 38 38 38 38 35 35 34 34 34 33 38 49 38
+44 38 44 44 38 47 47 38 47 38 35 38 35 44 38 38 47 47 45 44
+38 38 44 44 47 47 41 47 36 47 31 31 29 28 28 29 49 45 35 35
+44 38 38 38 47 47 49 49 45 47 47 38 41 47 47 41 44 38 44 35
+38 38 45 38 40 40 40 36 41 47 47 47 41 47 47 47 41 41 41 44
+44 44 35 36 35 44 44 38 45 47 38 40 39 40 32 40 39 36 36 32
+40 40 45 45 45 40 47 45 38 44 38 38 38 44 45 49 47 47 44 38
+35 34 29 29 40 36 40 45 34 40 45 47 47 41 45 47 47 47 38 44
+49 38 45 45 45 47 38 45 32 40 38 45 47 41 47 38 38 38 44 38
+44 29 29 38 44 44 47 47 47 38 34 38 38 38 34 47 47 47 47 47
+41 47 45 47 47 47 40 39 36 40 47 49 45 47 49 47 47 47 47 47
+47 49 49 49 47 45 49 49 38 41 41 47 47 47 47 44 22 20 9 9
+24 23 47 47 38 47 38 36 45 45 49 41 41 40 40 40 27 27 23 23
+15 27 24 32 20 20 12 12
+>gnl|ti|1086975809 name:1099575910599
+ 9 9 9 7 6 6 6 6 6 7 10 8 8 14 12 8 10 9 8 7
+ 7 8 9 10 10 8 7 10 15 14 13 13 24 17 17 13 16 13 12 13
+17 17 19 23 19 19 23 28 23 24 16 16 16 16 18 23 23 29 23 30
+30 25 34 26 32 34 29 34 25 22 22 21 21 24 29 25 38 33 30 33
+33 33 34 44 45 44 44 38 38 47 45 38 35 35 44 34 44 47 44 44
+40 40 44 38 38 44 44 38 40 32 36 32 34 35 45 45 38 38 44 38
+47 38 44 38 44 34 38 44 38 38 38 38 38 38 38 38 40 40 40 44
+28 27 27 17 18 27 24 38 44 38 38 38 38 38 38 40 40 38 49 49
+38 38 44 32 32 24 24 32 29 38 34 34 32 32 32 40 34 40 39 44
+38 38 40 45 35 40 40 45 44 44 38 38 44 36 38 40 26 32 32 32
+29 32 38 44 47 38 44 40 34 44 49 47 49 49 47 44 44 38 38 44
+44 45 32 36 38 38 38 38 38 38 44 38 40 40 38 47 40 38 47 38
+36 40 40 38 38 40 40 40 36 40 32 40 38 44 38 47 47 45 45 29
+27 19 20 39 39 34 34 40 34 45 45 45 47 47 36 38 38 44 44 38
+38 38 34 32 38 40 38 40 36 40 32 28 26 26 26 30 24 27 40 32
+34 40 39 47 47 47 47 47 47 47 41 49 49 38 47 38 35 27 27 20
+20 40 45 40 40 40 34 40 40 34 44 39 34 32 40 40 36 38 40 36
+34 40 45 40 29 35 35 35 34 35 36 40 29 26 26 31 29 34 40 40
+38 45 45 45 47 40 38 27 34 44 44 38 47 36 47 47 47 38 34 38
+38 35 38 45 44 45 34 40 38 45 47 49 47 47 47 36 47 44 38 47
+47 47 38 47 47 47 47 47 47 38 49 34 34 44 38 47 47 47 47 38
+47 47 38 49 45 49 49 49 49 49 49 49 38 40 40 40 45 45 49 49
+45 47 45 47 47 47 47 40 36 34 32 36 40 40 47 47 47 47 47 41
+47 38 47 47 47 40 39 49 49 49 49 32 45 34 40 40 40 49 49 40
+38 47 47 47 41 36 47 47 47 38 47 47 47 47 47 38 38 34 40 32
+40 28 28 36 32 34 40 40 28 23 18 25 32 44 34 23 20 11 9 12
+12
+>gnl|ti|1086975837 name:1099575910602
+ 9 9 7 9 9 10 6 7 8 7 7 8 12 17 17 17 19 14 7 7
+17 17 24 31 24 24 16 19 23 23 24 25 18 25 25 31 16 17 22 27
+21 29 31 31 27 30 44 49 44 44 44 44 47 47 47 44 28 28 32 29
+32 42 36 42 35 45 38 44 33 22 19 24 20 20 25 32 34 38 44 38
+44 44 42 35 35 35 42 35 44 38 41 47 41 41 47 41 44 44 34 34
+34 34 34 34 38 38 38 44 44 38 38 38 47 41 47 47 47 41 47 41
+44 45 44 44 38 44 44 44 38 47 38 38 38 45 38 44 38 38 38 47
+47 44 47 47 45 41 38 44 38 38 38 38 41 31 26 32 31 29 31 44
+44 47 47 47 47 47 41 49 45 49 49 47 45 44 38 40 44 44 45 47
+47 47 47 47 47 47 47 45 47 47 47 45 47 47 41 47 47 41 47 45
+49 49 41 47 47 47 41 47 47 47 38 38 38 44 45 34 39 40 23 23
+39 40 47 47 47 47 47 45 47 47 47 41 41 47 47 47 38 38 44 45
+44 38 47 47 47 47 40 36 40 34 38 38 35 38 38 38 40 47 47 45
+47 47 47 45 47 47 47 47 49 45 49 45 44 38 34 34 34 35 36 39
+47 47 38 47 47 41 47 47 47 47 36 49 49 45 45 40 45 45 38 44
+38 40 32 36 38 41 47 47 44 38 29 34 38 31 38 47 36 47 47 47
+47 47 47 38 29 38 40 44 38 47 49 49 45 47 44 45 44 45 38 38
+45 44 40 32 34 45 49 49 47 44 47 47 47 47 47 45 47 47 41 41
+47 47 41 41 36 47 47 47 47 47 41 41 47 47 45 47 47 45 47 41
+47 47 41 47 41 47 47 47 41 38 38 38 44 44 44 45 47 41 47 47
+41 45 47 49 49 49 49 47 49 36 47 47 45 47 45 49 45 47 47 47
+41 47 47 47 49 49 49 34 40 45 45 45 47 47 47 47 47 47 47 47
+47 47 47 47 47 47 47 49 41 47 49 45 45 38 40 34 45 40 38 40
+40 28 35 32 30 22 17 19 18 22 21 16 18 12 9 10 12 12
+>gnl|ti|1086975774 name:1099575910609
+ 6 6 6 6 7 6 6 6 7 9 7 8 9 10 8 9 8 11 9 7
+ 7 11 14 14 13 12 10 12 12 13 14 12 11 7 7 12 16 17 13 13
+14 23 24 21 25 21 21 25 25 25 24 26 29 29 29 24 21 20 20 22
+32 36 45 45 31 35 33 33 33 27 27 22 16 10 9 9 14 7 6 7
+ 8 7 10 11 24 24 34 38 45 24 32 29 26 23 20 23 23 18 20 20
+39 39 36 28 28 28 26 34 32 21 23 22 25 24 15 15 9 7 9 9
+15 16 27 27 21 20 25 22 28 30 26 23 23 28 25 34 34 35 29 40
+32 28 28 35 29 34 34 44 49 32 24 20 20 22 22 23 32 40 28 25
+21 22 22 21 24 24 28 49 40 40 26 24 24 26 26 29 29 35 40 34
+40 40 34 29 27 22 18 11 11 11 10 19 13 9 18 18 26 28 26 28
+28 28 28 34 39 36 32 35 27 16 16 9 12 16 24 18 17 18 17 49
+27 24 26 28 24 21 24 23 19 19 22 25 29 29 29 29 26 26 28 28
+39 40 34 40 34 40 34 49 49 32 28 28 24 23 18 15 23 24 28 32
+40 40 28 28 28 28 32 40 40 28 28 32 32 35 29 32 28 26 23 28
+26 25 24 20 20 32 24 27 21 27 24 24 24 27 28 32 32 40 40 40
+28 28 40 36 36 40 27 27 19 19 39 36 39 28 28 28 23 27 24 27
+28 27 21 18 23 23 28 28 28 28 28 28 32 40 23 28 28 27 18 18
+18 25 27 29 38 32 32 21 24 26 19 24 22 26 24 40 32 32 40 34
+40 29 27 18 18 25 27 28 29 29 44 35 29 34 35 30 26 21 25 21
+17 25 20 27 27 29 26 20 20 26 26 26 20 26 28 28 40 40 28 23
+23 23 14 16 16 17 20 25 25 28 25 25 40 32 28 23 25 25 17 15
+23 23 20 20 20 21 27 23 17 17 17 25 27 28 28 40 32 32 28 28
+28 28 23 25 27 18 17 23 16 14 29 29 28 28 23 23 32 40 32 23
+20 23 23 20 23 27 27 13 13 13 13 17 17 18 22 17 20 21 25 17
+17 21 17 16 13 12 11 15 13 23 27 27 23 23 21 11 12 26 23 27
+27 19 14 15 13 14 9 9 12 10 13 20 17 17 28 27 28 28 28 23
+21 15 17 19 19 19 11 11 12 20 10 11 9 10 9 10 7
+>gnl|ti|1086975909 name:1099575910612
+ 6 9 6 10 9 7 6 6 6 8 10 7 7 11 13 12 12 14 21 14
+14 16 19 16 25 13 13 13 12 12 13 18 15 18 18 21 16 16 19 16
+25 23 23 28 45 22 20 22 23 20 24 21 21 29 33 38 34 24 35 44
+44 45 29 25 35 33 28 22 21 28 28 28 29 29 24 31 33 30 25 23
+23 29 29 28 44 38 23 23 26 29 29 28 44 44 38 38 26 32 29 29
+29 23 35 44 33 33 44 38 33 33 38 38 38 34 38 44 38 38 45 34
+29 29 29 35 34 34 34 38 31 33 44 38 44 47 47 47 36 47 36 47
+41 47 47 47 36 39 40 40 28 28 39 45 38 38 35 45 38 33 38 38
+44 38 35 39 32 35 32 32 40 38 38 38 38 38 47 47 41 47 47 47
+47 47 47 47 47 45 49 47 41 41 41 47 44 36 45 40 34 38 45 38
+45 44 44 38 45 45 47 47 47 47 41 49 45 49 39 28 28 45 36 47
+47 38 39 38 40 40 34 49 45 45 47 44 35 44 38 33 34 34 44 45
+38 47 44 36 40 32 38 38 44 44 34 34 49 49 38 44 38 44 40 44
+45 47 47 47 47 47 38 40 34 34 34 40 39 36 26 26 26 30 27 44
+47 41 45 47 47 47 47 47 45 36 40 49 36 38 38 34 44 38 29 32
+34 44 40 47 47 38 38 34 34 44 35 29 30 30 23 28 39 23 25 45
+45 45 47 47 38 38 40 40 34 38 38 47 47 36 45 40 32 44 38 45
+47 36 47 47 47 47 47 38 38 34 40 36 38 40 40 34 35 38 34 38
+38 40 34 38 38 38 40 49 49 49 47 47 47 41 47 47 41 41 47 47
+36 47 45 38 36 47 47 47 47 47 47 47 36 47 45 47 45 47 47 36
+47 49 45 47 38 38 38 38 44 44 44 38 47 47 47 47 47 47 39 39
+39 19 19 27 24 34 30 28 34 32 40 40 40 36 38 49 49 49 45 49
+45 28 28 45 39 40 36 32 40 38 40 38 38 44 44 44 31 40 32 23
+28 45 49 49 45 45 49 49 45 47 49 47 47 47 40 45 38 40 47 38
+38 40 38 40 40 40 39 36 38 47 47 47 39 45 40 28 28 40 39 47
+41 45 38 40 40 39 40 36 47 47 38 47 38 38 49 47 49 49 49 49
+49 40 34 45 45 47 47 49 47 47 47 47 47 38 44 38 38 44 38 34
+47 49 47 44 38 38 38 29 23 26 12 14 25 16 20 27 27 44 40 40
+34 34 29 14 13 6 6 7 7 7 9 12 7 7 8 6 6 6 6 6
+ 7 9 9 9 7 7 13 9 7 9 7 7 7 7 9 9 13 10 13 13
+13 7 7 7 9 12 8 7 8 9 7 7 10 8 8 9 9 9 11 8
+ 7 7 9 9 9 7 10 10 9 7 7 8 10 12 12 9 7 9 7 7
+ 7 12 14 12 10 7 7 7 8 7 7 8 8 15 10 8 7 9 8 10
+ 8 7 7 11 11 8 10 9 9 13 8 8 8 7 7 19 12 10 12 7
+ 7 8 10 8 7 7 7 10 12 13 13 9 12 8 8 11 13 7 9 12
+12 11 7 9 8 9 7 7 10 12 12 8 12 11 12 9 7 9 11 7
+ 9 7 6 6 9 11 22 20 14 8 11 11 10 8 10 9 7 7 7 7
+10 8 9 9 6 6 7 7 7 10 10 10 7 7 7 10 8 7 7 10
+14 8 9 9 6 6 8 9 9 9 9 7 8 8 8 8 9 7 7 9
+ 9 8 9 7 7 7 6 6 6 6 6 6 8 7 7 7 6 6 9 8
+ 8 7 7 9 9 9 7 7 7 7 6 6 6 6 8 6 9 6 9 6
+ 6 6 6 9 8 9 6 8 7 6 8 8 9 7 7 7 7 9 6 9
+ 7 7 7 9 7 7 7 11 9 8 7 6 6 6 6 6 6 6 6 7
+ 6 6 7 7 8 6 6 6 6 7 14 7 9 9 7 6 7 7 11 8
+ 9 9 9 6 9 8 6 6 6 6 9 9 6 6 6 9 9 9 7 9
+ 9 6 7 7 9 9 6 6 7 7 9 7 9 9 7 7 9 6 6 6
+ 6 8 6 8 8 9 11 9 9 9 9 9 6 6 8 9 9 9 7 9
+ 7 6 6 6 9 9 9 9 7 6 8 6 9 9 9 7 6 7 7 7
+ 6 6 6 8 7 9 7 9 7 7 9 9 6 6 6 6 6 6 6 9
+ 9 10 7 6 6 6 6 6 6 6 6 6 6 9 6 9 9 6 6 6
+ 6 6 9 6 6 6 7 9 7 9 9 9 9 8 9 8 8 7 7 6
+ 9 9 9 6 6 7 10 9 9 8 9 9 8 8
+>gnl|ti|1086975828 name:1099575910615
+ 8 7 7 9 8 7 7 7 9 13 8 7 9 7 12 7 7 16 16 18
+17 23 24 15 14 16 15 15 15 21 28 28 26 25 20 17 17 20 18 19
+21 21 23 23 22 20 19 23 26 33 35 34 47 45 47 47 35 38 38 38
+33 33 44 44 29 31 31 32 32 29 29 29 29 26 22 16 13 12 22 23
+28 31 34 35 38 47 49 49 44 38 44 38 44 38 44 38 38 47 47 47
+38 38 38 38 38 44 47 47 38 34 34 34 35 34 38 45 47 47 47 38
+38 38 38 47 47 40 38 44 44 41 47 47 47 41 47 47 47 47 38 38
+44 38 44 38 47 44 44 38 34 34 34 34 35 35 38 44 44 38 38 47
+47 47 41 47 47 47 47 41 38 38 44 38 44 35 36 44 29 31 35 38
+38 47 47 45 41 47 47 47 47 49 44 38 38 38 44 38 38 45 34 49
+45 49 38 38 38 45 45 47 47 45 49 47 41 47 47 47 47 47 47 47
+41 47 36 44 38 47 47 47 47 41 41 47 47 45 47 47 41 47 47 38
+47 47 38 47 47 47 47 47 45 38 32 38 40 35 38 44 38 44 38 41
+47 38 36 47 38 47 47 47 36 47 41 47 47 47 41 47 47 47 47 47
+35 44 35 38 44 38 47 41 47 47 47 47 47 47 47 41 47 47 41 47
+41 47 38 36 47 47 38 47 38 34 34 44 38 44 44 38 38 44 34 40
+32 40 40 47 45 47 41 41 47 47 47 47 47 41 47 44 38 34 45 38
+47 41 47 41 38 44 31 29 34 38 38 38 49 36 32 34 45 45 47 47
+47 47 36 47 47 49 38 34 38 44 38 38 38 34 29 31 44 38 47 38
+40 32 38 44 44 44 44 44 47 41 38 49 49 47 47 47 47 47 47 38
+44 49 49 47 47 41 47 38 38 47 47 47 47 47 49 47 47 47 41 47
+47 41 47 49 49 45 47 41 47 47 47 41 47 47 47 47 41 47 47 47
+47 47 47 47 47 47 47 47 47 41 38 44 40 49 45 38 44 38 44 34
+34 40 39 39 49 49 39 45 45 45 45 34 49 49 38 41 47 47 47 47
+41 47 49 49 45 45 49 49 45 47 47 41 44 44 47 47 41 47 47 41
+49 47 47 47 47 45 45 47 47 47 47 47 41 47 47 47 47 47 47 47
+47 47 47 47 47 47 47 47 47 47 47 49 49 49 49 49 49 49 49 49
+45 32 32 38 44 41 47 47 41 47 47 47 47 47 47 45 45 36 49 47
+47 45 45 47 44 44 40 49 38 38 47 45 45 40 49 49 49 49 49 49
+47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 49 47 47
+47 47 47 47 47 47 49 49 34 26 23 34 34 44 38 32 32 36 45 47
+41 47 36 36 47 47 36 47 47 36 47 36 47 47 47 47 22 24 9 9
+26 9 9 24 24 47 47 47 38 38 35 29 28 17 13 13 12 11 12 12
+12 14 10 9 11 19 19 36
+>gnl|ti|1086975816 name:1099575910618
+ 7 6 6 6 8 8 12 12 12 12 12 12 17 19 19 19 19 13 20 17
+14 14 12 14 14 14 21 28 44 23 32 26 25 32 32 47 47 47 44 36
+38 34 34 25 27 27 23 20 17 34 25 34 34 34 33 29 33 35 38 38
+45 45 44 33 33 33 33 29 32 26 29 29 26 30 22 19 19 22 22 30
+29 28 28 32 26 28 30 35 44 31 34 34 34 34 34 34 34 44 38 38
+44 31 29 35 29 24 32 24 30 29 33 34 38 34 38 47 47 47 47 40
+38 38 38 38 44 44 44 32 32 36 40 40 40 40 40 47 45 38 45 34
+32 45 29 32 29 29 31 38 38 34 29 29 31 29 34 44 44 38 38 47
+47 44 38 44 44 38 44 34 32 49 40 40 36 34 38 38 44 29 29 49
+28 28 29 29 34 34 38 44 38 47 47 36 38 40 36 47 47 47 47 40
+47 47 47 38 47 47 47 47 47 45 47 47 47 47 47 38 38 32 34 44
+44 47 36 38 47 44 38 34 32 40 38 45 40 40 40 45 49 34 38 38
+44 38 38 40 36 36 49 28 28 28 32 32 45 45 36 40 40 39 29 29
+29 38 44 38 36 40 32 38 31 44 29 34 38 40 40 28 26 26 31 29
+29 49 27 20 20 32 30 38 45 34 40 40 40 47 47 49 40 40 38 38
+40 39 34 40 40 40 38 38 38 40 34 38 38 47 47 40 40 36 36 49
+49 34 40 40 47 45 40 38 34 34 45 40 40 40 34 40 45 47 40 40
+34 49 49 49 45 38 47 47 47 40 38 32 49 49 45 49 49 49 45 40
+40 38 36 40 47 47 38 47 47 38 49 49 49 40 40 45 45 38 38 36
+32 28 49 49 38 38 39 40 28 28 39 39 40 49 20 21 40 45 45 40
+28 27 49 28 38 38 38 38 40 47 47 45 49 34 49 45 34 49 38 40
+40 39 40 40 32 32 39 40 41 44 44 47 47 45 45 36 45 49 49 49
+47 47 47 41 47 38 39 39 40 40 40 40 40 40 47 47 47 47 47 47
+47 47 38 49 49 49 45 40 32 40 23 25 39 39 38 40 39 40 40 40
+40 40 39 39 40 40 40 28 40 40 45 47 44 40 40 28 28 40 40 39
+34 32 32 49 49 49 49 49 49 34 40 40 36 40 38 45 47 47 40 40
+38 38 44 40 36 49 49 49 38 45 45 47 36 44 36 32 39 28 28 40
+39 45 40 40 25 25 40 39 40 47 44 39 39 40 35 35 40 39 47 47
+40 39 32 21 21 39 30 34 35 44 38 44 38 40 40 36 45 40 47 47
+49 49 49 49 49 49 49 38 38 47 38 47 47 47 44 38 47 40 38 36
+36 36 23 28 27 27 36 29 34 38 34 44 29 40 39 29 29 34 24 24
+19 19 23 27 28 24 23 36 24 24 14 13 18 15 9 7
+>gnl|ti|1086975808 name:1099575910621
+ 9 9 9 9 6 7 7 6 9 13 8 7 16 11 10 12 14 17 18 23
+29 27 25 28 27 26 13 13 13 13 13 14 16 29 31 18 18 20 24 21
+24 27 21 23 19 19 31 26 25 23 21 31 20 16 16 14 24 20 26 19
+23 19 29 25 19 30 21 19 19 30 29 22 19 21 26 30 23 23 38 33
+30 34 38 27 27 31 44 32 33 33 33 33 34 35 35 44 41 47 47 32
+31 32 26 32 30 38 40 34 45 30 29 31 29 34 32 47 47 38 44 38
+38 38 34 41 47 38 41 41 47 49 40 38 34 38 44 38 47 38 44 38
+38 44 31 47 36 40 34 36 44 47 44 44 38 38 35 44 47 47 47 47
+49 44 44 38 38 44 34 47 49 49 29 35 38 38 44 34 38 44 38 44
+38 47 38 44 44 38 35 34 44 38 38 38 49 41 36 41 36 47 47 47
+47 47 47 41 47 47 47 47 47 47 47 38 47 47 47 41 47 47 47 47
+38 47 38 44 34 38 44 38 47 47 47 41 47 47 47 47 47 40 38 34
+38 38 47 47 41 38 38 44 38 38 38 47 44 34 44 44 44 38 38 38
+47 47 45 49 49 49 49 49 49 45 47 45 45 38 38 38 38 44 38 44
+47 38 36 36 40 45 38 47 45 47 47 47 47 40 44 40 40 49 45 49
+45 47 47 47 38 47 47 41 47 36 47 36 38 40 47 47 47 47 47 45
+47 47 47 41 47 36 47 47 41 45 47 47 47 41 47 41 49 49 49 49
+36 49 49 49 49 36 47 47 47 38 47 38 38 38 44 44 44 44 41 44
+38 38 38 29 40 45 49 49 49 45 29 34 44 38 38 44 39 40 40 34
+40 40 47 47 36 47 47 47 40 40 40 40 45 45 47 47 47 47 38 40
+40 40 45 40 47 47 47 47 47 45 47 47 47 47 47 47 47 47 47 47
+47 38 38 34 49 45 32 34 45 34 34 45 45 47 47 47 47 49 47 47
+47 49 47 41 47 47 47 47 47 47 47 47 47 49 49 45 32 49 49 45
+49 47 45 39 40 28 28 39 32 32 49 49 45 45 47 47 47 40 38 40
+40 47 47 47 47 49 49 45 45 45 49 45 49 49 47 49 49 45 49 49
+47 47 47 47 47 38 38 44 40 47 47 47 47 47 47 49 38 38 44 38
+38 29 47 47 41 41 47 47 47 47 44 44 34 40 40 47 47 44 47 38
+40 45 40 35 28 39 28 28 40 40 40 28 28 39 40 24 24 9 13 23
+20 38 45 47 44 18 16 8 8 8 8 8 7 7 7 7 8 10 6 6
+ 6 6 8 7 6 9 7 9 7 10 6 6 7 15 11 11 11 10 6 7
+ 8 6 6 13 9 9 9 9 9 10 11 9 9 10 12 8 8 9 9 9
+ 7 9 6 9 8 14 11 11 26 21 10 10 7 9 9 9 9 9 13 9
+ 9 9 11 9 9 8 6 9 8 9 9 9 9 9 10 16 9 9 9 11
+14 6 9 8 10 10 8 9 9 9 9 9 9 9 9 9 9 10 8 9
+ 9 9 9
+>gnl|ti|1086975868 name:1099575910624
+ 6 6 6 7 7 7 7 7 8 8 12 8 8 10 10 15 10 12 14 17
+12 12 12 16 17 17 16 24 20 20 21 15 18 23 21 14 19 17 17 22
+34 25 28 25 27 29 23 31 34 27 25 26 25 25 27 34 44 47 47 47
+47 47 35 38 32 31 25 26 23 21 21 24 17 16 12 10 9 9 16 23
+30 31 32 32 33 35 35 32 31 44 44 35 38 28 32 32 29 27 28 33
+38 38 33 34 31 33 29 34 34 35 29 44 38 38 24 26 28 28 25 25
+32 26 26 32 47 38 38 38 38 38 38 49 47 47 41 47 45 45 36 38
+32 40 38 38 41 47 47 38 38 38 33 33 31 47 31 35 38 44 38 38
+47 44 44 38 38 44 38 38 38 40 38 40 38 40 47 47 38 47 47 47
+47 47 41 41 47 34 44 44 44 38 38 38 47 41 49 49 47 49 49 49
+49 41 47 45 41 47 38 38 38 44 44 38 47 47 40 38 34 40 44 41
+47 47 47 47 47 47 38 45 40 49 44 40 47 41 38 38 38 44 44 38
+38 44 32 29 38 38 44 44 44 38 38 44 44 38 38 41 47 47 44 38
+44 44 38 44 44 47 41 47 47 47 38 45 34 40 39 40 38 40 32 38
+36 47 38 44 40 40 36 47 47 47 47 35 44 34 34 35 35 38 47 45
+44 38 29 29 44 38 38 34 40 36 28 28 39 39 34 38 40 38 47 44
+38 40 40 40 45 45 47 47 47 38 40 36 28 28 31 29 31 31 30 32
+31 44 47 47 47 47 47 45 47 47 47 47 38 39 34 49 32 49 28 28
+40 40 40 38 40 32 40 45 44 45 45 45 49 49 47 47 47 47 47 47
+41 41 41 47 45 34 38 34 34 35 38 40 41 47 40 45 45 28 28 40
+28 28 32 40 44 44 47 40 38 40 49 40 36 47 38 47 47 49 38 49
+49 49 49 49 45 49 49 49 49 49 47 45 47 47 47 47 47 44 38 40
+49 40 40 38 47 40 38 49 47 47 38 47 47 47 47 41 41 47 47 49
+45 49 49 47 47 47 47 47 47 44 45 47 49 49 49 49 32 45 49 49
+45 45 39 40 40 40 49 49 45 49 49 49 49 40 40 44 44 47 47 45
+47 45 47 47 47 47 45 49 49 45 45 45 40 34 45 45 34 34 34 34
+44 24 14 8 7 7 7 7 9 16 8 8 11 7 7 7 6 8 6 9
+ 9 10 6 6 7 9 9 9 9 14 9 9 9 10 8 6 9 10 8 11
+ 9 7 10 9 9 9 12 13 11 9 7 10 9 9 9 9 11 9 9 8
+ 8 7 9 7 9 9 9 9 9 7 9 9 8 9 9 9 9 9 7 10
+ 9 9 7 7 9 9 9 9 9 9 7 9 7 9 7 9 9 10 10 12
+11 10 11 11 12 9 9 9 9 9 9 10 9 9 12
+>gnl|ti|1086975842 name:1099575910625
+ 8 7 7 9 7 7 7 6 8 6 7 14 10 12 12 17 17 14 13 13
+13 13 12 15 15 14 14 14 14 14 14 12 14 14 18 14 12 24 24 22
+19 29 25 25 25 31 25 29 30 25 16 25 27 27 30 34 38 38 44 38
+44 44 30 29 32 32 32 31 34 24 25 24 22 22 14 20 14 13 19 25
+29 31 32 32 34 35 35 31 33 45 38 44 44 28 32 32 31 32 32 38
+45 44 34 35 45 30 33 31 31 35 34 35 34 47 38 44 38 38 31 25
+25 26 26 32 47 38 44 38 38 44 38 45 47 47 47 47 47 38 44 40
+38 38 31 38 38 38 40 38 44 44 44 38 38 45 44 38 38 38 44 44
+41 41 36 44 44 38 34 34 34 38 45 35 47 45 49 47 47 38 38 38
+35 34 34 44 38 44 45 45 38 44 44 44 38 38 38 36 47 41 36 41
+47 47 47 47 47 41 47 47 47 45 41 38 38 44 34 34 34 49 40 47
+45 41 47 47 47 38 38 38 34 32 45 45 47 47 47 47 44 31 38 44
+44 31 40 40 38 40 36 36 47 47 47 47 41 47 47 47 47 41 47 45
+47 47 45 47 47 47 47 47 41 47 40 44 34 40 39 40 38 40 32 38
+38 44 38 38 35 38 44 47 41 47 47 38 47 36 40 40 49 45 49 49
+49 45 40 40 45 38 47 44 39 40 28 28 45 40 40 38 49 45 47 47
+39 36 40 40 40 39 47 47 47 36 40 36 28 28 31 29 38 38 47 47
+47 36 38 44 44 38 38 44 47 45 41 47 45 36 32 32 32 39 32 34
+45 40 40 36 40 32 38 44 44 45 45 45 49 49 47 47 47 47 47 41
+47 47 47 47 47 40 45 49 32 49 49 49 47 47 45 45 45 28 28 40
+28 36 40 34 38 38 44 38 40 40 45 36 40 47 47 47 47 38 47 47
+47 47 49 49 45 47 47 47 47 47 47 49 47 45 47 45 47 44 40 32
+34 34 38 45 47 47 49 49 47 47 38 47 41 47 47 47 47 41 49 49
+49 49 45 45 34 40 38 47 47 38 44 40 39 49 49 49 32 45 32 35
+40 40 44 44 34 40 49 49 47 41 47 38 44 40 40 45 45 47 45 47
+45 47 47 44 47 47 45 45 47 47 38 38 40 32 38 45 40 40 23 19
+ 9 9 13 11 14 14 12 12 12 12 16 15 12 12 10 20 12 6 6 6
+ 7 9 10 9 9 9 9 9 9 9 10 9 9 9 6 9 8 7 9 7
+12 12 17 14 9 9 9 20 12 12 12 9 9 9 9 6 7 8 8 9
+ 7 7 9 9 9 9 11 9 9 11 10 12 12 9 12 12 7 9 7 7
+ 7 8 9 9 7 9 7 9 9 8 7 6 7 9 8 8 9 7
+>gnl|ti|1086975898 name:1099575910629
+ 6 6 6 7 8 7 7 8 7 6 6 17 6 7 14 14 18 16 11 10
+10 12 12 16 12 17 13 18 14 14 15 17 17 28 21 33 35 34 23 23
+23 27 27 27 27 34 44 44 38 42 44 44 30 28 19 16 23 23 25 29
+31 31 28 25 25 25 24 28 32 27 29 33 24 30 16 19 9 9 16 16
+33 24 24 30 30 44 34 34 38 32 31 28 29 31 31 47 44 44 38 44
+44 44 47 47 47 47 47 47 47 38 44 44 38 38 31 29 28 28 31 31
+38 38 44 44 44 47 47 45 47 41 47 41 47 47 44 38 34 38 34 34
+36 38 47 47 45 44 44 44 38 44 38 44 45 35 31 44 44 38 38 47
+47 47 47 47 47 47 47 49 47 41 38 44 44 44 44 38 47 47 47 47
+47 47 47 41 47 47 41 47 38 47 47 47 47 47 45 47 47 47 41 38
+38 33 31 33 35 33 38 40 40 38 47 47 41 38 38 44 38 38 38 38
+44 36 40 44 40 47 44 39 36 28 32 32 40 32 38 36 47 38 47 47
+41 47 47 47 47 47 47 47 47 47 47 45 40 28 32 40 32 26 26 30
+28 29 31 40 40 34 38 45 41 41 47 38 38 38 44 38 31 47 47 47
+41 47 36 47 38 47 47 47 47 47 47 47 47 47 47 44 38 34 38 44
+47 47 47 45 47 36 47 47 49 47 47 35 44 38 44 38 34 34 44 31
+44 38 44 44 38 34 34 36 44 38 40 40 44 36 47 47 47 47 47 38
+40 38 45 49 49 45 44 47 47 41 47 47 47 47 49 49 45 44 34 35
+34 34 44 40 49 34 34 45 38 41 47 41 47 47 47 47 47 47 47 47
+47 36 47 47 47 49 45 49 47 47 36 47 47 41 47 47 47 47 41 41
+47 47 47 47 47 41 47 47 47 47 47 49 45 38 38 38 44 38 33 44
+44 44 44 44 47 47 47 47 47 47 47 47 47 47 47 47 47 45 47 41
+47 47 47 38 41 41 47 41 47 47 47 47 47 38 47 47 47 47 38 47
+47 47 38 47 40 44 40 45 44 47 41 47 47 47 47 47 38 45 40 40
+38 47 47 41 41 47 47 38 38 40 34 44 38 38 38 38 38 47 47 47
+45 44 49 45 47 38 38 44 38 38 38 47 41 47 47 47 47 49 47 38
+38 38 38 38 40 44 47 47 47 38 47 49 41 47 47 47 47 36 47 47
+47 49 49 49 49 38 38 44 38 38 35 44 45 47 47 47 47 47 47 47
+47 44 44 40 40 45 45 47 47 44 44 47 47 47 47 47 47 47 38 47
+47 47 47 47 49 49 47 49 49 47 47 47 47 47 47 47 47 49 44 38
+34 35 34 38 44 47 47 47 47 47 47 47 47 47 45 47 49 47 38 38
+39 36 28 36 39 40 47 45 47 47 45 47 36 35 38 40 38 38 35 41
+41 47 47 47 39 40 39 34 40 40 40 35 38 44 44 44 38 47 47 47
+45 41 47 47 49 47 47 47 47 47 47 47 47 47 47 47 47 47 49 49
+49 28 28 36 36 36 36 36 36 24 40 39 36 44 38 25 35 24 44 27
+27 24 47 49 36 47 36 36 38 47 36 36 24 24 36 36 36 47 47 47
+38 47 36 41 40 40 23 23 36 39 47 47 44 44 44 38 38 38 38 34
+21 24 9 9 21 26 35 44 20 22 9 9 9 9 9 7 9 7 7 7
+10 8 6 6 7 9
+>gnl|ti|1086975823 name:1099575910632
+ 6 6 6 6 8 7 7 7 8 7 12 7 8 19 18 18 14 14 14 20
+18 19 19 19 19 14 17 16 15 16 17 35 23 25 25 34 26 29 28 26
+28 25 34 44 45 44 44 44 47 47 47 34 34 34 32 30 25 25 25 24
+28 25 26 25 27 26 32 30 35 35 35 34 38 49 32 40 34 30 35 34
+34 35 35 38 34 35 44 28 31 32 32 26 29 47 34 34 35 35 44 44
+47 45 38 45 44 38 44 34 38 31 31 38 38 44 38 38 38 44 44 44
+38 44 38 41 47 47 38 44 35 38 44 44 44 38 34 38 34 34 32 40
+44 36 47 38 38 38 44 38 44 45 44 38 38 45 47 47 47 36 47 47
+47 47 47 47 47 45 47 47 41 41 44 45 45 44 38 44 47 41 47 47
+47 41 49 49 47 49 45 47 41 38 45 38 44 45 44 47 44 38 40 34
+34 34 44 44 38 40 40 38 47 47 41 47 36 44 35 38 38 38 31 38
+31 44 38 38 38 40 40 28 28 28 32 49 49 40 36 47 45 47 38 44
+38 35 38 45 36 47 47 47 45 40 40 23 32 28 28 20 20 39 32 32
+40 40 32 34 34 34 44 38 38 47 47 47 47 47 47 47 47 36 47 41
+44 45 40 38 40 47 47 47 45 47 47 47 47 38 44 40 40 38 47 47
+41 41 40 38 40 40 49 36 44 45 40 32 45 40 36 29 38 38 44 38
+34 49 36 40 40 39 40 39 40 40 49 45 38 45 47 47 40 38 36 36
+45 40 34 44 44 38 38 38 38 38 47 36 36 45 49 38 34 34 29 29
+34 28 32 35 35 39 40 47 41 47 47 41 47 47 47 47 47 47 47 40
+36 34 32 38 40 47 47 47 38 47 47 36 47 47 49 47 38 38 36 36
+47 41 47 47 47 49 41 49 47 36 49 40 40 40 38 47 38 38 35 35
+44 44 47 47 47 38 47 47 47 47 47 41 47 47 47 49 38 47 47 47
+47 38 38 47 47 38 47 47 47 38 45 47 44 38 40 38 45 47 47 47
+49 49 45 44 40 45 44 47 47 41 47 47 47 47 40 44 40 40 44 45
+47 38 47 47 47 40 45 40 40 38 44 40 40 38 49 47 49 49 49 49
+49 49 49 47 47 47 41 47 44 41 47 38 36 47 47 49 45 38 38 44
+38 29 34 39 47 40 44 40 47 38 38 47 47 47 38 47 47 47 40 40
+40 40 44 40 38 38 39 36 32 36 39 44 41 47 47 49 47 47 39 39
+12 12 27 20 20 26 26 40 22 13 13 12 8 9 6
+>gnl|ti|1086975827 name:1099575910638
+ 7 6 6 6 6 6 14 7 7 6 6 6 6 6 6 6 14 14 12 12
+16 15 29 16 16 18 15 18 16 34 29 28 28 28 18 18 18 23 15 19
+25 21 24 29 30 27 30 25 28 28 24 32 31 29 32 29 34 29 34 35
+35 40 42 44 34 34 34 33 33 23 20 14 10 9 9 11 27 27 44 34
+35 34 34 35 35 33 31 33 33 35 35 34 34 35 34 34 34 31 31 31
+29 31 32 29 30 31 32 31 47 45 45 30 26 23 21 19 22 27 38 44
+44 38 44 49 47 47 47 41 41 47 47 47 47 41 41 41 47 44 44 44
+38 38 34 29 44 38 38 38 47 47 41 38 34 44 38 38 38 45 47 47
+41 47 35 44 44 44 44 38 38 47 45 47 47 47 47 47 41 47 47 45
+49 47 45 45 40 28 23 23 28 45 31 44 38 44 38 44 47 45 45 47
+47 41 47 41 41 47 47 47 47 47 44 38 47 47 47 44 44 38 34 38
+38 38 38 44 38 38 38 49 36 47 47 41 41 41 47 47 44 40 40 32
+40 39 40 47 36 38 44 41 41 47 38 47 44 38 40 38 36 38 38 38
+38 38 38 47 38 40 38 47 47 47 40 40 40 40 34 40 45 45 47 40
+38 40 40 44 38 38 36 34 40 39 34 38 38 35 44 40 47 47 47 47
+38 45 47 47 38 47 47 41 41 47 47 41 47 47 45 47 38 44 38 34
+40 34 36 39 47 47 47 41 47 47 47 36 47 44 47 47 41 47 47 49
+47 45 47 36 47 47 47 38 35 44 38 38 38 38 41 47 41 45 47 45
+47 47 47 47 47 47 45 49 38 38 45 47 47 47 47 49 45 49 49 49
+45 47 41 47 47 47 47 47 41 41 35 44 34 44 44 44 45 38 45 36
+36 38 45 47 47 49 47 47 47 47 47 41 47 47 41 47 47 47 47 41
+41 47 40 38 38 38 38 36 36 32 44 38 47 47 47 41 47 47 47 47
+47 47 41 41 47 47 47 47 47 47 47 38 47 47 47 47 45 45 47 47
+47 47 38 44 40 34 40 38 38 47 49 45 47 47 47 39 40 40 34 40
+40 44 47 47 38 38 44 45 45 44 47 47 47 47 47 47 41 47 47 47
+41 47 47 47 47 47 41 47 47 49 45 32 35 35 45 45 47 47 47 47
+47 47 47 47 49 49 38 47 47 47 47 47 47 47 47 47 47 47 47 47
+49 49 44 44 44 38 44 44 47 47 47 47 47 47 47 47 47 47 47 47
+47 47 47 47 47 47 49 49 49 49 45 44 40 47 36 47 47 41 47 44
+49 49 28 28 40 39 36 36 36 40 34 36 44 47 47 47 47 38 47 36
+47 41 45 38 38 38 47 47 44 45 41 41 38 38 36 36 24 24 24 44
+38 31 36 44 47 47 47 47 47 45 45 36 36 36 36 47 47 36 36 36
+47 36 36 36 47 47 49 47 45 49 38 38 38 47 36 36 36 44 41 38
+38 38 49 41 38 44 38 35 31 31 35 33 34 27 47 36 28 24 20 17
+28 30 40 36 36 36 41 41 36 47 38 36 36 36 28 26 21 24 18 12
+18 8 8 14 12 13 25 27 19 21 23 24
+>gnl|ti|1086975815 name:1099575910641
+ 7 7 9 7 7 6 6 6 9 10 10 8 8 14 14 14 14 13 12 14
+19 19 16 21 21 34 27 29 34 35 45 20 22 22 20 20 22 27 22 22
+23 22 27 18 25 24 21 20 22 35 24 30 30 25 25 25 35 29 31 29
+29 31 29 32 31 26 23 23 25 44 35 35 30 30 27 29 23 26 26 30
+30 27 35 35 35 35 44 45 45 47 44 44 44 45 44 38 34 34 45 44
+35 44 47 47 47 41 29 29 32 32 29 27 35 38 40 45 45 38 45 45
+44 41 41 38 44 38 45 38 38 38 44 38 44 44 38 38 38 31 34 47
+47 45 47 47 47 47 38 47 47 47 47 36 47 47 47 47 47 47 41 47
+47 44 44 44 38 38 38 41 49 41 47 47 47 47 47 41 47 44 41 45
+44 38 38 34 35 44 38 38 38 44 38 40 40 47 38 38 47 35 38 34
+34 34 35 38 38 47 47 47 45 47 47 41 47 47 41 36 49 45 49 45
+49 36 36 39 39 47 47 38 47 47 47 47 49 49 41 47 47 47 47 47
+47 49 47 47 47 38 38 47 41 47 45 45 47 49 41 47 45 45 40 32
+45 45 47 49 49 41 47 45 36 40 35 29 34 34 44 38 44 47 38 49
+45 45 49 47 47 47 47 47 45 47 47 47 47 47 47 47 47 47 47 47
+47 47 49 36 28 28 28 36 45 45 41 47 45 45 47 47 47 47 47 47
+47 41 47 45 47 47 38 38 40 38 38 47 49 49 47 44 35 35 26 25
+14 12 39 39 47 47 47 41 47 47 47 45 47 24 24 13 9 23 23 39
+30 21 20 24 17 12 12 8 6 9 11 10 9 12 12 8 9 6 9 9
+11 9 9 6 6 6 7 6 7 9 7 9 9 9 9 13 8 14 9 9
+11 12 9 7 9 7 7 9 9 9 11 24 18 18 9 12 10 9 9 7
+ 6 7 8 9 7 9 10 9 10 9 7 6 10 7 9 9 9 8 8 6
+ 7 9 8 10 11 10 9 9 11 9 9 9 8 9 14 13 11 11 9 9
+13 9 7 10 7 7 9 9 12 8 9 9 8 7 7 7 9 7 7 7
+ 7 12 11 7 9 8 7 7 8 9 6 13 9 8 6 6 9 9 8 9
+ 9 7 6 7 9 7 7 9 9 9 9 11 9 7 7 7 9 9 9 6
+ 7 7 9 9 9 9 9 7 7 9 10 10 8 6 7 7 7 7 7 7
+ 7 9 9 10 8 9 9 9 7 9 7 9 9 9 9 8 8 9 9 9
+ 9 7 9 9 8 9 9 7 9 9 9 9 9 7 9 12 7 7 7 6
+ 9 7 7 9 9 7 9 9 7 9 10 9 6 9 8 9 7 7 9 9
+ 9 7 9 8 7 9 9 8 7 7 9 12 12 9 8 9 9 10 7 9
+ 7 7 7 6 9 7 9 9 8 9 9 9 9 9 9 9 9 9 9 8
+ 6 9 9 9 7 7 9 9 9 9 9 9 7 9 9 7 7 7 8 10
+ 6 6 6 7 7 7 7 9 10 12 8 9 12 9 7 9 7 6 6 7
+ 7 8 11 8 9 8 7 8 7 7 9 9 9 9 9 7 9 10 12 11
+ 9 8 8 8 8 9 7 8 9 6 6 6 6 6 8
+>gnl|ti|1086975835 name:1099575910644
+ 6 6 6 6 6 6 6 8 7 9 7 9 7 9 7 8 7 9 9 12
+11 9 8 12 7 7 14 11 18 16 13 10 16 20 23 26 14 15 18 18
+18 21 29 29 18 20 23 20 26 26 32 27 25 27 27 28 20 34 30 20
+22 23 26 26 20 33 26 24 26 28 29 28 34 35 35 20 16 12 8 9
+ 9 19 12 14 22 22 26 31 33 33 33 38 38 38 44 44 38 38 44 47
+36 36 40 39 32 32 32 33 33 33 38 38 38 38 35 35 35 40 29 27
+23 23 19 23 29 27 40 40 44 38 44 38 38 44 38 45 34 40 34 35
+35 38 38 38 38 49 49 49 49 38 29 34 38 44 44 47 47 45 45 41
+40 40 32 49 32 28 28 31 29 34 38 38 38 38 47 38 47 47 47 49
+49 47 47 47 47 47 47 47 39 36 27 27 25 27 27 28 40 27 38 38
+38 44 38 47 47 41 44 44 44 44 38 38 40 40 40 36 39 44 38 44
+31 38 34 40 40 38 40 34 38 38 47 47 39 45 40 34 40 45 49 47
+47 47 47 47 38 36 38 36 34 38 38 38 44 38 44 44 38 44 41 41
+41 47 47 47 44 44 44 34 34 38 45 47 47 44 38 40 49 49 47 47
+47 47 47 47 47 47 47 47 47 47 47 47 47 41 47 47 47 38 44 44
+38 38 29 40 38 40 40 40 32 28 40 36 47 44 47 38 38 34 40 40
+34 40 39 40 39 40 40 40 40 40 39 39 45 40 34 40 36 40 47 47
+47 47 47 47 38 44 40 47 49 47 47 41 41 47 47 47 47 47 47 47
+47 41 47 41 47 47 47 47 47 47 41 47 45 44 44 47 47 38 38 40
+40 32 34 40 45 40 45 38 34 34 38 34 34 32 32 28 32 40 40 47
+47 47 47 41 47 47 47 49 36 38 47 47 47 47 47 36 47 47 49 49
+49 49 49 36 32 40 45 45 45 40 49 45 44 38 44 47 47 47 49 45
+36 49 34 49 49 47 47 49 47 40 29 27 14 18 27 27 38 35 32 49
+49 49 49 36 34 24 18 14 12 8 9 9 20 11 19 28 27 28 32 19
+17 9 9 20 20 24
+>gnl|ti|1086975870 name:1099575910645
+22 9 6 7 7 6 7 9 9 9 9 7 7 7 9 12 7 7 12 16
+13 13 17 12 14 10 10 18 17 13 14 12 12 12 12 15 16 29 19 26
+24 24 30 19 29 29 29 38 24 30 23 21 23 23 16 16 20 17 23 18
+19 21 20 21 28 47 41 35 44 44 33 27 16 20 13 13 10 8 6 6
+ 7 7 9 14 9 22 20 28 40 29 35 35 35 38 38 38 38 38 26 33
+33 30 29 35 35 36 47 47 38 40 34 34 35 34 28 15 19 13 13 9
+ 9 13 18 28 30 34 38 47 47 38 38 38 38 38 38 33 33 44 35 38
+38 47 38 38 44 38 44 44 49 49 49 49 45 45 49 47 41 47 47 45
+45 44 44 40 35 38 35 38 38 44 47 47 49 38 34 34 27 33 30 44
+45 35 44 38 38 33 27 30 35 35 45 36 49 49 45 47 45 47 47 40
+47 47 47 47 49 47 38 38 32 39 32 32 45 49 49 45 29 29 35 29
+34 34 39 47 38 44 40 34 49 45 49 32 45 45 34 40 45 45 47 47
+47 38 29 28 27 20 20 39 40 47 47 38 38 38 38 38 40 45 49 41
+47 47 47 41 47 47 41 47 44 45 40 32 38 38 47 41 47 41 38 40
+36 40 47 38 49 49 49 47 40 45 45 47 47 36 47 36 47 47 49 47
+47 47 45 40 40 34 44 40 36 38 36 40 38 34 35 45 29 36 32 29
+35 35 31 44 44 47 47 47 47 47 47 47 38 38 34 32 40 39 36 34
+40 44 44 38 40 38 40 34 44 38 47 45 47 47 45 39 32 32 32 45
+45 47 47 47 47 47 36 38 38 38 44 44 34 38 45 45 39 40 28 28
+32 49 34 49 45 49 49 49 47 47 38 39 40 40 40 40 32 29 34 34
+34 45 29 34 40 38 38 47 47 47 47 38 38 40 40 38 40 47 47 38
+45 44 34 49 49 44 47 47 47 47 47 47 38 49 47 47 38 40 40 40
+34 40 44 44 32 40 45 40 40 29 29 29 34 34 26 38 40 34 38 38
+40 40 32 32 32 39 20 11 6 7 9 15 20 24 30 30 29 32 40 27
+28 25 23 25 49 49 45 36 40 34 34 36 45 41 47 47 36 40 34 34
+45 45 32 40 36 45 40 40 24 28 28 25 23 40 39 38 40 40 39 26
+16 14 27 49 49 40 40 40 45 28 28 49 49 36 40 24 20 20 21 25
+18 20 21 21 30 32
+>gnl|ti|1086975814 name:1099575910646
+ 6 6 7 6 6 11 10 9 7 6 6 11 14 9 7 7 9 8 12 12
+15 17 13 17 23 19 19 19 19 19 25 24 19 18 19 25 14 16 18 16
+24 24 36 29 29 26 33 23 21 23 23 23 29 38 27 34 28 30 26 25
+32 32 32 34 31 34 34 28 27 35 35 34 33 22 14 10 9 10 10 7
+ 6 9 9 7 9 9 23 15 15 25 27 45 45 44 44 38 47 47 47 45
+47 40 38 44 44 38 44 44 38 33 31 33 33 33 44 32 24 17 9 9
+ 6 8 9 14 14 21 23 23 23 22 24 29 32 32 31 44 34 44 47 45
+45 38 38 38 38 44 38 41 47 47 47 47 44 38 34 34 35 38 38 38
+38 38 38 38 38 44 47 49 38 38 38 44 38 38 45 38 38 35 35 34
+34 45 45 40 49 38 38 44 38 29 34 40 34 34 34 35 35 35 38 45
+49 47 47 47 47 47 47 47 47 47 44 36 32 40 38 40 41 41 47 45
+45 47 49 38 34 38 34 35 44 49 49 40 40 40 38 47 47 47 41 47
+47 47 47 47 36 47 47 41 38 47 47 38 36 45 45 45 45 34 40 44
+49 49 34 40 36 40 32 40 36 36 40 44 38 45 34 40 44 45 45 41
+47 47 47 47 36 47 45 44 38 38 38 44 44 45 36 49 45 49 36 40
+36 36 39 36 47 47 38 47 45 47 47 47 40 36 49 49 47 49 49 49
+49 49 49 49 41 41 47 41 38 38 34 45 36 47 47 47 49 45 45 47
+45 44 44 38 38 38 44 49 49 49 49 28 40 45 45 38 40 40 32 28
+28 28 40 40 47 47 44 45 40 40 38 40 36 38 47 47 47 47 47 47
+47 47 38 38 47 47 45 47 45 45 47 40 39 28 28 39 32 32 40 40
+49 34 34 49 49 47 47 36 40 36 40 44 40 40 28 20 17 22 22 30
+27 34 38 47 47 36 38 40 32 28 32 40 40 47 47 45 47 45 47 47
+47 47 41 47 49 36 45 40 32 40 38 44 38 47 38 38 40 40 44 45
+45 49 49 34 49 45 45 45 40 32 40 28 28 39 49 28 28 40 28 28
+36 27 32 40 49 49 49 44 44 38 44 38 34 40 40 34 40 39 47 47
+47 47 47 47 47 49 49 36 47 47 47 47 47 47 47 47 47 39 39 28
+28 39 40 40 45 39 23 25 40 39 39 44 40 38 40 32 39 36 32 39
+20 21 28 32 40 28 28 36 40 40 24 20 12 12 22 20 18 28 40 28
+28 45
+>gnl|ti|1086975798 name:1099575910647
+ 9 6 6 7 9 6 6 7 7 7 14 7 7 7 8 13 16 16 16 16
+21 16 16 29 19 21 19 19 23 24 35 21 25 16 20 12 16 18 14 14
+16 19 20 19 21 29 25 34 34 24 28 23 25 25 25 27 30 23 16 17
+20 18 18 18 29 24 25 33 44 35 34 34 33 33 35 29 33 27 33 33
+33 21 28 23 26 23 21 29 27 33 33 31 38 31 34 45 47 34 34 38
+33 33 33 44 31 33 44 44 44 38 38 47 47 47 45 38 38 33 30 33
+33 44 33 38 35 38 35 38 40 49 47 38 38 38 38 45 44 38 38 29
+39 28 28 39 39 47 41 45 45 45 40 34 34 34 44 29 38 35 38 40
+40 40 34 40 45 45 47 47 47 47 47 47 47 45 47 38 47 47 47 36
+44 44 38 38 38 31 38 35 35 38 49 49 32 32 35 34 31 35 29 38
+44 38 47 47 47 44 47 45 36 38 44 38 38 38 31 40 47 47 47 47
+47 36 38 38 38 36 40 45 40 40 40 40 45 45 47 38 47 44 40 39
+36 28 28 39 39 47 36 36 36 36 47 47 38 36 36 36 47 44 44 38
+38 38 44 39 39 40 40 49 49 49 36 45 40 40 40 38 38 45 49 49
+28 40 32 45 39 40 28 40 23 21 21 40 40 45 40 40 49 34 38 40
+36 36 47 49 49 49 49 49 49 34 40 39 40 40 38 45 36 47 47 45
+36 36 28 28 40 28 28 40 36 49 49 32 40 38 47 47 47 39 39 35
+32 40 40 28 21 20 28 28 40 32 32 49 45 38 36 40 28 28 28 49
+49 49 45 38 36 45 39 29 16 16 24 39 45 45 36 36 40 34 40 40
+40 40 36 36 40 40 34 40 36 34 40 40 45 29 35 23 21 12 11 14
+23 19 28 28 28 45 45
+>gnl|ti|1086975770 name:1099575910648
+10 7 7 6 6 6 7 7 6 6 6 6 8 14 7 7 8 11 7 7
+ 8 8 12 12 13 12 12 7 9 9 9 9 12 13 13 17 22 19 30 21
+26 23 19 19 19 19 19 19 19 33 19 19 35 35 35 47 49 24 36 23
+29 23 23 32 24 23 17 14 14 13 10 11 9 8 9 9 9 12 15 24
+21 27 27 29 27 33 34 44 34 34 36 24 36 49 47 47 47 47 47 47
+41 36 47 38 45 45 24 29 27 22 27 24 33 33 23 28 26 23 29 32
+40 32 28 34 34 44 38 44 35 24 44 31 35 29 29 29 26 38 24 38
+38 38 38 49 44 36 45 40 40 38 38 24 27 30 21 21 27 24 25 28
+20 25 24 29 29 29 34 34 34 36 45 33 33 31 25 22 34 34 40 36
+40 40 36 36 47 47 47 47 36 36 40 40 38 36 38 36 25 44 29 35
+34 38 38 49 36 40 47 36 38 38 34 34 35 35 40 32 40 29 38 38
+38 35 25 35 40 40 34 28 35 35 24 24 49 49 40 28 40 40 40 40
+34 38 38 40 34 40 34 29 34 34 34 25 40 40 24 39 34 34 24 34
+29 35 36 40 32 49 38 38 36 40 28 32 32 40 36 32 29 28 28 29
+31 38 38 44 38 47 36 36 36 36 40 40 32 32 36 40 40 36 40 40
+32 28 28 28 39 39 45 36 34 49 45 34 24 19 19 19 20 30 29 49
+36 49 36 40 38 38 47 39 45 40 32 36 29 34 34 29 34 29 35 29
+29 49 49 49 38 35 34 34 34 44 49 49 49 32 40 28 28 40 23 28
+28 29 23 15 17 29 24 40 40 40 36 34 22 23 24 24 22 24 29 24
+29 19 24 22 24 22 22 21 19 36 40 27 19 24 22 18 11 11 15 17
+23 24 28 29 24 28 24 24 29 28 32 28 40 23 23 24 22 14 12 12
+ 9 7 19 20 28 40 40 40 40 28 23 40 23 32 28 29 23 27 18 16
+23 39 32 35 36 24 32 32 32 26 26 24 20 29 26 28 28 24 26 29
+29 24 30 21 11 11 7 7 8 8 17 9 9 15 15 20 45 27 27 23
+27 13 13 22 20 19 14 14 14 27 27 18 13 13 14 16 10 15 14 15
+16 20 18 19 23 28 21 17 14 10 10 11 12 13 13 19 23 22 20 23
+23 23 24
+>gnl|ti|1086975782 name:1099575910649
+10 7 6 6 6 6 6 6 6 7 7 7 12 12 13 13 11 13 12 12
+12 12 12 12 12 13 14 15 17 7 9 12 12 15 17 15 18 21 21 16
+14 21 21 17 38 29 44 19 16 16 16 26 28 21 24 24 36 36 23 23
+27 27 27 26 24 32 44 32 32 35 25 32 22 24 20 10 12 14 14 14
+12 9 15 16 24 26 26 24 29 25 38 38 44 44 38 45 44 38 44 44
+47 47 47 47 45 38 38 45 34 34 35 34 34 35 33 30 25 21 13 11
+13 13 14 23 27 44 38 38 38 38 34 34 35 38 38 38 26 31 42 35
+35 32 49 49 49 47 38 44 44 45 44 44 38 38 34 29 44 38 44 34
+28 28 28 28 35 29 44 47 47 36 41 47 47 47 47 47 41 47 47 38
+44 44 44 38 38 41 38 38 47 47 45 39 34 35 34 34 44 35 35 44
+38 34 38 49 47 47 47 38 38 38 38 38 38 44 44 49 49 47 47 38
+47 47 45 47 47 41 47 47 44 47 47 41 41 45 44 38 32 40 38 38
+31 38 44 38 38 47 41 47 40 38 38 40 47 41 41 47 47 47 47 47
+47 47 41 47 47 49 45 47 47 44 36 40 45 36 47 47 47 47 41 47
+47 45 47 47 47 45 47 41 47 47 49 38 36 40 45 38 47 47 47 47
+36 40 40 40 40 39 39 47 47 47 47 47 47 40 40 40 40 38 49 45
+49 49 49 45 47 41 41 47 47 47 47 45 34 34 35 45 34 24 34 38
+49 45 49 45 49 38 44 38 38 38 38 49 49 49 49 49 47 40 38 36
+40 36 40 28 28 23 39 40 47 41 47 47 38 38 47 47 47 47 47 47
+49 49 49 49 47 47 47 47 47 38 47 47 45 45 47 40 40 28 28 49
+27 27 49 49 49 49 49 49 49 49 38 45 40 39 28 32 29 29 36 28
+24 26 26 31 29 38 47 47 38 40 45 38 40 40 38 38 47 47 47 38
+45 23 21 21 30 39 47 38 45 32 32 32 39 32 40 38 47 47 38 40
+40 40 40 36 34 40 38 36 24 28 23 23 15 15 16 27 27 26 26 26
+26 29
+>gnl|ti|1086975850 name:1099575910651
+ 6 7 6 6 7 9 6 6 6 6 6 6 9 8 7 7 7 10 7 6
+ 6 8 8 13 13 12 12 14 12 11 11 13 13 14 19 19 14 21 17 20
+18 17 21 18 21 21 23 23 17 20 20 20 22 22 23 20 22 27 29 31
+32 28 33 30 30 33 33 33 33 40 39 32 23 21 21 13 7 7 6 13
+15 19 14 23 28 40 32 34 35 29 34 30 30 32 26 24 26 49 49 45
+47 47 41 47 47 47 47 39 28 28 20 20 20 21 21 14 9 14 14 11
+13 29 39 44 40 32 40 28 28 36 36 40 40 38 38 38 38 35 35 38
+44 38 34 29 34 34 31 45 41 47 47 47 47 47 47 47 38 38 38 44
+34 38 47 38 38 44 44 44 34 47 41 41 40 49 49 49 28 28 40 40
+47 47 38 38 47 47 49 45 28 21 21 21 15 21 49 28 36 40 38 47
+47 47 49 44 38 38 44 44 38 41 47 47 47 47 41 47 49 44 40 36
+44 47 38 38 32 40 40 38 34 40 29 34 34 29 35 35 40 38 44 47
+41 41 47 47 45 45 49 49 49 41 47 47 47 47 36 47 47 45 47 36
+40 49 49 28 28 28 28 29 29 34 29 29 29 32 40 49 49 45 45 47
+47 38 38 32 40 45 44 47 47 41 47 49 49 47 49 36 49 35 38 44
+44 38 38 47 47 47 49 45 49 49 38 38 47 47 47 47 47 47 47 47
+47 47 38 38 49 40 45 36 47 47 47 47 40 39 28 28 40 39 45 36
+47 38 47 38 49 38 44 34 44 28 28 23 28 32 40 40 47 47 47 47
+45 47 47 47 47 47 47 47 47 47 47 45 44 45 40 47 47 49 45 49
+45 45 47 47 44 38 38 38 44 38 36 47 40 44 34 34 45 34 32 28
+23 28 28 40 39 47 36 47 36 41 47 44 40 40 32 36 38 38 47 41
+47 41 24 40 40 39 47 49 44 45 38 44 44 38 49 49 40 34 45 36
+40 39 29 17 17 27 27 32 32 28 28 36 28 28 32 39 32 40 34 34
+26 34 31 29 19 17 7 7 7 7 7 7 21 24 36 28 28 24 28 23
+28 23 25 20 26 22 24 24 28 40 34 34 38 29 38 44 45 47 47 41
+36 40 49 34 49 49 36 32 40 40 28 28 28 36 28 28 32 49 23 23
+21 12 10 14 15 23 20 19 19 19 27 45
+>gnl|ti|1086975859 name:1099575910652
+15 9 6 6 6 6 7 9 7 7 6 6 9 8 8 9 7 8 9 12
+11 13 14 13 19 13 13 17 13 15 17 19 15 19 21 21 17 21 17 19
+27 22 28 29 24 24 24 30 27 16 16 31 19 36 24 23 23 29 30 25
+19 24 19 19 30 32 19 24 36 40 24 23 13 12 12 8 7 7 7 9
+ 7 7 10 14 18 27 24 33 26 30 34 40 38 29 21 23 32 32 32 34
+34 26 25 29 32 26 23 34 35 26 29 30 24 19 10 11 8 12 12 19
+24 49 49 40 40 40 32 34 39 45 36 44 24 44 38 44 38 41 47 47
+47 47 47 47 38 44 38 38 38 34 44 38 44 35 44 44 47 45 36 39
+27 21 14 22 25 30 30 26 34 36 45 36 49 49 40 26 27 24 24 23
+27 29 34 29 26 49 29 27 14 16 24 23 32 47 36 40 40 40 34 40
+39 45 40 49 49 45 47 49 49 49 40 40 38 40 32 40 24 24 16 18
+27 26 28 28 27 36 45 47 47 38 47 47 49 49 49 38 36 34 36 38
+34 34 38 38 38 47 47 47 36 40 40 28 28 32 32 36 36 38 40 36
+38 40 40 40 34 34 34 45 44 38 38 24 35 34 35 38 47 47 47 36
+49 36 49 32 40 32 28 32 32 34 34 32 34 40 45 45 45 39 40 32
+35 35 49 45 45 49 49 49 40 39 35 32 40 40 45 45 34 32 36 40
+32 32 28 28 40 40 40 40 32 40 38 38 47 38 38 32 40 32 28 28
+28 28 40 36 47 45 47 47 36 38 40 32 40 40 34 49 34 31 30 24
+24 28 25 28 28 24 24 25 25 22 17 19 19 21 21 21 16 25 23 23
+19 35 23 24 24 38 34 24 49 49 45 45 34 34 32 28 28 32 36 36
+29 28 28 28 29 29 40 28 24 28 28 32 24 28 32 36 36 36 32 45
+23 21 21 23 19 19 21 23 29 35 34 24 27 16 18 16 14 21 19 24
+14 14 16 12 14 23 21 23 20 25 19 15 19 18 14 12 12 13 16 16
+20 19 19 17 9 9 7 6 6 10 9 7 6 9 9 9 12 9 7 8
+ 9 9 19 12 17 25 24 32 40 34 34 28 23 24 21 24 36 19 24 24
+19 26 26 23 18 14 10 15 11 11 12 13 11 14 18 16 17 17 27 27
+19 32 24 23 26 24 24 20 18 16 10 16 23 39 27 34 35 38 34 34
+49 36 40 29 26 26 15 18 11 11 13 23 15 23 23 13 13 12 14 12
+15 16 17 11 9 9 13 14 14 11 9 10 9 10 7 7
+>gnl|ti|1086975880 name:1099575910653
+ 9 6 6 6 7 7 9 7 9 9 9 7 9 7 9 9 7 6 7 7
+ 7 7 7 7 8 11 13 17 16 13 21 15 22 14 12 8 10 9 9 12
+12 10 11 15 10 12 18 19 20 20 13 21 21 17 22 21 28 24 22 22
+19 19 22 19 12 17 17 17 16 19 19 22 29 18 19 7 8 7 12 7
+ 8 9 11 13 16 19 21 22 22 26 18 18 23 23 28 27 27 14 12 16
+11 11 19 19 20 24 15 15 24 24 20 19 20 18 16 10 14 9 14 7
+ 9 11 19 16 21 14 16 13 9 10 9 12 13 19 18 18 21 30 24 32
+28 21 20 26 25 29 30 32 23 23 27 27 20 18 18 18 24 24 27 25
+27 33 27 29 26 28 40 32 28 28 28 25 29 15 17 17 17 25 23 21
+21 28 28 28 39 24 27 15 13 9 13 9 9 10 10 14 17 21 27 28
+28 28 23 24 24 26 23 20 22 23 11 11 22 11 10 13 13 9 9 9
+13 18 16 12 13 15 18 20 20 28 18 18 25 20 21 21 18 18 20 25
+21 19 19 19 18 22 19 19 20 14 14 18 17 12 16 18 20 23 20 21
+18 23 17 14 17 11 19 11 10 24 18 14 12 23 22 20 15 11 13 13
+13 10 9 9 9 9 9 13 13 12 9 10 16 16 9 7 12 9 10 12
+12 16 17 21 17 13 13 19 23 24 20 22 28 24 22 26 28 23 23 24
+24 9 9 18 12 14 20 18 21 21 23 16 13 18 17 17 18 20 11 11
+24 24 49 27 23 23 20 13 12 18 16 12 11 18 11 12 14 18 11 11
+12 12 29 21 15 18 12 11 27 19 23 15 17 11 14 12 12 17 17 24
+27 17 14 20 23 24 24 16 12 12 10 10 11 11 9 9 12 9 13 11
+ 9 10 20 18 17 17 17 24 39 24 12 10 9 9 9 9 12 13 18 23
+21 14 23 16 15 10 20 11 9 9 10 11 10 16 23 23 23 21 14 16
+11 15 18 18 18 11 11 15 15 16 23 23 20 18 10 11 7 9 12 11
+ 8 7 7 7 13 8 7 7 7 14 8 18 19 16 11 9 7 7 7 13
+11 14 9 9 9 11 11 10 10 18 20 16 12 9 11 10 14 9 10 12
+ 9 10 9 9 10 10 9 9 9 10 9 9 9 9 9 9 9 14 9 9
+ 9 10 9 12 9 8 9 10 8 8 7 7 12 18 18 13 10 9 7 9
+ 6 6 12 10 10 9 9 9 9 9 9 9 10 10 9 9 9 7 9 9
+ 8 12 9 9 7 9 9 8 10 9 9 12 9 9 9 9 9 9 9 9
+ 9 12 9 8 9 9 10 10 16 12 9 9 9 8 11 9 9 7 13 9
+ 9 8 7 9 14 16 10 9 9 9 9 10 10 11 9 16 9 9 7 9
+ 9 7 9 9 8 10 10 10 9 9 9 10 9 7 9 9 9 11 11 9
+ 9 13 10 13 9 7 9 7 11 11 10 10 13 13 9 9 7 9 10 9
+ 9 9 7 9 9 9 16
+>gnl|ti|1086975912 name:1099575910654
+ 6 6 6 6 8 6 6 6 7 7 9 7 8 7 14 14 14 14 14 17
+16 16 14 17 17 20 29 28 28 35 34 23 25 25 34 23 26 23 23 23
+24 18 18 31 27 35 34 34 32 29 44 38 34 34 27 25 29 32 31 32
+34 38 38 38 38 29 26 34 26 22 22 24 17 20 9 9 15 22 40 24
+24 24 32 24 27 38 38 44 45 47 40 40 28 28 28 28 33 31 38 38
+47 44 44 38 38 38 38 44 38 34 38 27 28 20 20 20 32 40 38 47
+41 47 49 45 47 38 38 35 34 44 38 38 38 44 44 44 44 47 47 38
+38 38 44 38 38 47 38 38 35 38 31 31 44 38 47 49 47 47 47 41
+47 47 47 47 47 45 47 47 47 41 47 44 41 41 47 47 38 40 40 40
+38 45 49 39 47 47 47 47 47 47 41 47 45 47 47 47 47 41 47 47
+34 38 38 44 33 31 33 33 34 34 38 31 41 41 38 49 49 49 49 47
+39 45 40 40 40 40 40 47 44 44 40 40 45 45 47 36 38 35 35 38
+44 38 45 38 40 40 45 49 45 45 44 44 38 44 38 38 34 40 34 38
+38 47 47 38 49 49 49 45 49 49 45 47 47 40 34 29 29 34 34 38
+49 36 40 32 40 45 47 44 47 47 47 47 47 47 47 49 29 44 38 40
+44 38 45 47 47 45 36 40 32 49 40 28 28 36 40 47 49 38 38 38
+40 44 44 47 47 47 38 39 40 28 28 28 39 39 44 49 36 32 34 39
+34 34 34 44 29 29 40 40 38 44 45 49 49 49 49 40 47 45 45 45
+40 40 40 40 47 45 49 36 35 38 35 44 38 38 47 47 47 47 47 47
+45 47 47 44 47 38 49 45 45 49 47 38 47 47 36 40 40 40 40 40
+38 38 45 47 47 36 47 38 38 47 47 49 47 49 45 47 47 40 40 40
+28 25 45 40 36 38 44 47 41 47 45 47 47 45 49 49 47 47 47 47
+40 36 45 32 40 38 40 47 47 47 49 49 49 49 47 47 47 45 44 40
+40 38 45 47 47 40 40 32 40 38 38 44 40 49 38 39 40 40 28 28
+45 45 47 40 40 28 28 36 49 49 47 47 47 47 47 47 47 47 47 47
+47 49 49 49 47 47 45 45 47 47 44 44 49 34 34 44 39 47 38 38
+34 38 44 38 44 38 38 47 47 47 47 47 47 49 49 45 49 38 32 34
+38 38 47 47 47 47 44 38 34 44 38 34 39 40 40 34 45 38 47 38
+40 36 38 40 40 49 49 49 44 40 40 40 38 45 49 47 45 38 36 49
+49 32 40 40 45 40 36 35 32 39 40 47 49 49 47 45 47 45 45 27
+20 27 27 27 29 34 45 38 38 40 40 36 40 32 35 29 34 29 33 32
+22 26 22 27 27 21 23 22 22 15 11 9 6
+>gnl|ti|1086975894 name:1099575910655
+ 8 8 8 6 6 6 6 6 7 14 11 7 7 12 18 16 19 28 19 14
+12 9 7 6 9 15 13 18 19 20 20 16 17 20 23 16 26 23 44 23
+23 23 23 16 23 23 23 28 27 21 34 44 44 35 29 29 29 25 24 34
+34 45 44 35 35 45 26 24 10 10 6 9 6 7 11 20 29 32 40 45
+45 38 45 40 39 39 34 35 34 34 44 38 36 34 38 38 38 44 38 47
+47 47 41 47 47 47 47 45 40 27 18 14 18 27 24 38 38 44 38 47
+47 49 49 49 47 47 47 47 47 41 47 45 38 45 38 38 38 38 44 38
+38 44 44 31 47 47 47 47 47 47 45 47 47 47 47 47 47 47 47 47
+44 47 47 47 47 36 38 47 47 49 47 40 36 38 40 47 38 47 47 47
+41 47 47 47 47 38 41 47 47 41 45 38 44 44 38 38 29 38 45 47
+47 47 41 47 41 47 47 44 44 38 38 38 38 47 47 47 38 47 47 47
+47 44 44 44 38 34 34 34 32 45 38 47 41 41 47 47 41 47 47 49
+47 47 47 45 36 32 28 28 40 39 47 47 45 40 49 49 49 45 40 47
+47 47 47 45 35 34 36 45 45 47 36 47 47 47 44 40 49 45 38 34
+38 44 35 38 47 47 49 49 47 47 45 44 38 44 34 31 29 32 28 36
+45 47 47 47 47 45 45 45 40 47 36 38 49 32 40 44 44 47 41 47
+47 47 47 47 47 41 38 38 40 36 32 36 40 41 38 49 38 49 47 47
+45 36 40 32 40 38 44 39 45 40 49 34 49 49 45 49 34 34 34 38
+38 47 47 38 47 36 47 45 47 38 38 38 32 40 40 49 49 47 47 47
+45 47 47 45 45 40 40 45 45 45 32 40 44 38 47 47 47 47 47 49
+49 47 40 38 38 34 40 39 40 34 38 45 40 40 49 45 45 47 49 49
+40 34 29 30 26 22 22 22 28 30 38 47 47 45 47 45 49 45 41 47
+47 47 47 47 36 47 40 38 44 34 40 49 45 47 47 47 47 47 47 47
+47 47 47 47 45 47 49 47 38 47 47 38 44 38 49 49 49 49 49 49
+19 19 29 29 44 38 49 49 49 47 47 38 45 40 40 38 40 47 47 39
+39 40 40 40 40 40 47 47 38 47 47 47 47 47 47 47 49 49 45 38
+38 47 40 47 40 49 45 49 47 47 47 44 36 40 39 34 40 38 40 38
+40 40 40 40 36 36 40 40 24 24 12 12 11 19 12 12 29 29 28 24
+36 34 18 12 9 6
+>gnl|ti|1086975893 name:1099575910656
+ 6 6 6 6 6 6 7 14 18 23 23 23 23 23 35 27 19 19 19 19
+26 28 28 19 24 24 25 38 28 23 21 23 23 23 27 31 34 44 44 47
+36 36 27 29 38 33 23 25 25 24 26 23 23 23 29 28 27 29 29 24
+24 27 29 44 29 38 44 38 27 21 13 9 9 9 9 20 20 49 38 38
+44 44 38 38 38 38 38 44 38 45 45 38 44 35 29 38 44 44 47 47
+47 41 47 47 47 45 47 47 38 39 39 21 20 28 40 32 32 34 45 44
+38 38 44 38 44 47 47 41 41 47 47 47 38 44 44 34 34 34 38 44
+44 38 44 38 44 41 47 41 47 47 36 38 47 47 47 47 45 38 38 34
+34 34 34 34 34 44 44 44 44 47 41 47 47 47 47 47 47 41 47 44
+47 47 41 41 47 47 41 41 36 47 47 47 38 47 36 49 38 45 36 45
+47 36 47 47 41 41 47 47 47 47 41 47 47 47 41 45 38 44 44 34
+35 38 38 44 47 47 47 47 38 38 38 44 33 32 33 44 44 44 47 47
+44 38 44 38 29 44 38 38 44 44 34 34 40 49 38 38 47 47 47 41
+47 47 41 41 40 38 41 38 45 36 32 28 28 40 39 41 47 38 38 47
+38 36 44 38 47 47 47 47 45 35 38 36 36 47 45 47 49 49 49 49
+38 47 49 47 47 47 47 47 47 49 49 41 49 47 49 41 47 47 47 45
+44 32 40 28 49 49 47 49 49 49 45 47 47 47 47 38 38 47 47 47
+47 47 36 47 47 41 47 47 47 47 47 47 44 38 32 34 38 38 47 47
+49 49 49 41 47 45 38 40 47 47 47 44 44 38 32 34 40 34 38 44
+44 47 47 47 47 47 47 47 41 47 41 47 41 47 47 47 47 47 38 38
+45 47 38 47 47 47 47 41 47 47 47 47 47 45 47 47 47 47 38 47
+47 47 47 47 49 49 47 44 38 44 40 40 45 40 38 44 38 47 38 49
+40 47 47 45 38 44 34 34 25 27 28 28 28 31 40 47 47 47 45 47
+41 47 47 41 41 47 47 47 47 47 47 40 44 44 47 47 47 47 41 47
+41 47 47 47 47 47 47 47 47 45 47 49 47 38 47 47 45 38 38 36
+39 40 40 27 29 18 17 24 23 29 29 40 40 40 28 28 40 27 18 12
+ 9 9
+>gnl|ti|1086975886 name:1099575910657
+ 6 6 6 6 7 9 7 8 7 7 12 7 7 7 7 8 8 12 12 13
+13 19 19 17 20 14 14 19 20 17 19 24 23 19 13 13 13 12 13 20
+23 23 24 24 36 32 24 32 39 29 21 23 25 16 18 22 20 16 19 19
+17 25 19 17 19 23 29 40 23 22 21 14 13 7 7 7 7 6 6 7
+ 7 12 11 21 23 29 34 38 34 33 40 34 36 45 45 47 45 32 34 34
+34 45 47 49 36 45 24 28 28 28 28 32 19 11 9 9 8 9 9 11
+14 14 27 30 40 40 45 32 32 40 40 47 47 47 47 47 47 44 44 33
+27 29 30 29 29 29 38 29 45 38 38 36 36 49 49 49 36 36 47 47
+36 34 34 34 38 38 38 38 31 44 34 34 24 27 20 23 23 40 40 40
+40 47 47 38 36 39 23 15 15 15 16 19 20 26 26 26 26 49 28 28
+28 28 28 28 45 40 36 34 34 38 44 47 40 36 49 40 32 32 32 40
+35 29 27 24 17 17 24 22 29 28 29 29 49 35 25 29 33 27 33 34
+38 38 47 49 38 44 32 40 40 40 29 29 26 29 29 28 40 40 45 32
+28 28 32 36 36 40 28 28 49 40 40 27 22 22 13 13 19 25 32 32
+40 40 32 40 28 28 36 32 24 29 26 22 29 22 24 28 29 35 40 29
+32 28 40 32 32 32 49 32 28 28 40 28 40 49 32 28 28 49 49 34
+35 35 34 27 18 16 13 16 22 26 32 32 32 32 26 26 26 25 20 26
+27 40 23 23 28 23 23 40 40 28 25 25 25 23 25 28 40 28 28 23
+28 28 24 28 28 49 36 32 32 24 28 28 28 20 25 25 35 25 25 20
+20 21 20 16 27 17 23 23 23 23 19 24 29 29 25 40 24 23 20 25
+20 17 19 22 28 24 19 20 14 19 13 14 27 32 28 28 26 29 24 26
+26 28 24 20 24 18 20 19 32 36 24 29 19 19 19 17 19 27 29 24
+24 23 28 28 23 23 39 24 28 28 24 40 23 23 28 23 23 24 21 22
+27 24 23 28 22 16 8 10 10 10 11 12 18 16 25 14 13 12 14 12
+12 12 11 11 13 17 17 20 20 28 26 20 28 20 20 27 28 28 21 25
+18 18 23 20 14 14 27 15 18 14 13 13 15 22 16 14 11 12 12 11
+11 15 14 14 10 12 14 24 20 16 20 13 14 14 15 23
+>gnl|ti|1086975813 name:1099575910658
+ 9 6 6 7 9 7 6 6 6 6 7 7 8 6 6 6 9 10 9 12
+12 9 9 20 18 13 14 12 12 13 13 13 17 23 23 24 33 25 19 21
+19 19 21 21 24 24 24 24 34 38 35 31 34 29 35 35 35 18 23 18
+18 20 22 49 38 44 35 29 21 25 17 18 9 9 9 9 9 9 12 11
+21 27 36 47 47 47 47 36 32 32 30 30 26 26 49 49 47 44 38 44
+44 38 38 47 47 47 40 39 40 36 45 32 29 21 22 11 11 14 12 27
+27 39 40 40 32 40 44 38 47 47 38 38 38 38 35 38 49 49 47 47
+38 34 34 34 40 47 44 47 47 47 47 38 44 38 44 38 31 35 38 38
+38 38 49 47 41 47 44 38 38 44 29 33 34 35 35 38 47 47 36 38
+47 47 47 45 49 28 49 35 38 38 44 38 38 47 47 47 47 47 47 47
+47 47 47 47 47 47 49 47 47 40 45 32 34 34 39 39 40 29 30 23
+23 29 29 38 38 44 36 40 44 40 47 47 47 36 47 47 41 47 38 38
+35 38 38 44 47 47 45 47 47 47 38 47 49 49 45 49 45 49 34 40
+45 40 47 38 47 47 36 44 44 40 40 32 45 39 47 41 38 44 38 38
+35 34 49 40 41 47 47 38 45 40 40 45 38 44 40 38 38 38 38 40
+47 36 38 29 29 26 26 23 40 40 36 47 47 36 47 49 49 45 47 38
+44 44 38 44 44 34 40 40 40 47 47 47 38 38 38 38 34 34 40 34
+40 40 38 47 49 45 49 39 34 36 45 40 40 34 36 39 47 47 38 47
+45 47 47 47 47 47 49 49 49 47 36 45 49 45 44 38 38 38 38 34
+40 32 28 28 39 40 47 49 47 47 47 47 38 38 40 32 24 28 28 34
+38 35 47 39 39 40 40 40 40 49 40 28 36 45 45 47 47 49 38 40
+32 28 28 28 40 40 47 38 47 47 47 47 47 38 47 47 47 47 47 47
+47 47 47 40 40 40 45 45 47 38 47 38 47 49 49 49 49 49 47 38
+40 40 40 39 32 28 23 23 36 40 28 28 32 32 38 45 45 32 34 32
+39 32 28 32 40 49 49 47 36 36 36 40 32 40 44 36 36 47 49 49
+47 49 49 36 40 40 40 34 40 40 28 28 39 40 40 38 40 36 36 32
+49 28 28 28 40 32 45 45 47 49 49 47 49 49 47 49 47 47 41 47
+47 47 47 45 49 49 49 49 44 47 38 45 40 38 47 38 36 40 49 38
+49 45 34 24 44 38 44 34 36 32 28 23 32 40 36 40 40 39 45 49
+36 47 47 47 38 38 34 34 49 45 36 49 40 40 28 36 39 40 40 40
+36 36 36 36 32 29 34 29 24 29 36 36 36 36 47 36 38 45 47 47
+47 47 47 36 47 36 36 44 45 36 36 32 36 45 36 32 36 24 40 36
+23 23 40 40 38 38 47 47 36 41 45 44 32 40 44 40 40 28 28 24
+32 24 25 27 27 36 36 24 23 28 28 32 24 23 19 27 27 30 19 23
+28 36 29 18 18 24 20 27 18 18 23 29 39 36 24 24 38 36 24 36
+40 45 47 24 47 47 47 47 36 47 24 24 36 36 36 36 28 32 24 24
+44 24 24 24 24 24 24 38 32 34 24 24 24 24 24 24 40 24 27 19
+15 24 13 13 19 20 24 40 24 40 20 18 11 11 15 18 12 14 9 9
+20 20
+>gnl|ti|1086975807 name:1099575910659
+ 9 6 9 7 7 9 7 7 7 10 13 9 9 7 7 7 14 10 12 12
+12 14 14 14 14 14 14 20 15 23 23 17 19 16 22 24 19 27 16 18
+18 18 18 18 27 25 23 19 21 21 21 21 20 24 26 27 19 21 47 45
+45 25 24 24 27 31 31 32 32 32 26 31 16 16 9 7 9 9 12 14
+19 23 28 29 34 34 44 44 38 44 47 47 47 45 45 47 47 47 47 47
+47 47 44 47 41 47 38 38 44 38 38 38 31 28 26 23 23 19 17 29
+39 34 32 49 49 38 44 38 31 29 28 36 49 49 45 47 47 47 47 41
+47 41 31 31 29 29 26 32 47 47 47 47 45 47 47 47 47 47 47 47
+47 47 47 47 47 49 38 44 38 44 38 35 44 38 35 38 38 47 47 47
+47 47 41 47 47 39 30 23 19 27 27 49 49 49 49 49 47 47 38 38
+41 38 31 29 31 28 28 40 40 45 47 47 47 47 47 45 44 40 47 40
+39 40 36 38 38 47 47 47 47 47 45 39 40 28 28 45 45 47 45 41
+47 44 39 29 21 25 25 45 45 41 38 38 38 38 38 44 45 47 47 47
+49 49 47 47 47 38 47 47 40 40 28 28 28 40 32 40 49 41 47 47
+41 47 47 44 44 31 44 44 38 26 29 45 45 49 47 47 47 47 47 47
+47 47 47 36 40 40 40 32 49 49 36 38 47 47 41 47 45 47 47 47
+49 49 49 45 49 49 47 45 47 47 47 38 38 32 40 38 36 36 38 44
+47 47 40 30 23 19 19 30 30 44 40 47 47 47 49 47 49 49 49 47
+47 47 47 41 47 47 36 41 47 41 47 38 44 38 38 44 38 47 38 47
+38 49 36 47 47 47 47 41 41 47 45 34 34 35 34 34 34 47 47 47
+47 47 45 47 47 47 47 47 38 47 49 47 36 47 47 38 40 34 34 44
+38 34 40 44 44 47 45 45 40 40 45 38 47 49 49 47 47 47 47 47
+47 47 47 47 47 47 47 47 38 36 47 38 40 32 49 40 23 40 39 38
+39 40 23 21 20 21 10 9 7 7 8 9 22 26 40 40 28 28 23 25
+27 27 21 17 25 29 36 36 47 47 49 49 49 49 36 36 45 44 38 40
+38 32 40 40 23 28 23 23 28 28 30 27 18 18 29 29 38 36 40 44
+49 38 47 47 47 47 47 47 47 47 47 49 49 47 36 38 47 38 40 35
+34 24 38 27 27 36 36 36 36 36 23 23 40 32 40 32 49 49 49 49
+45 49 40 45 45 40 39 40 28 32 32 32 23 16 11 15 15 18 16 21
+18 20 24 27
+>gnl|ti|1086975907 name:1099575910661
+ 6 6 6 6 9 7 7 7 6 9 8 9 7 8 11 10 12 9 8 12
+12 13 17 13 13 13 13 19 13 23 23 20 23 13 13 13 13 17 19 13
+20 20 12 21 23 14 14 18 36 36 47 24 27 32 23 19 19 25 25 24
+44 22 22 26 26 27 30 26 27 23 36 29 16 13 7 13 7 10 13 23
+23 35 36 47 38 44 38 38 47 47 47 47 47 47 47 47 47 45 47 38
+44 44 44 38 35 38 38 38 44 44 38 24 20 16 9 9 9 12 20 27
+36 38 38 40 32 40 29 38 38 38 44 44 47 47 47 44 38 36 31 31
+35 35 38 44 44 44 38 47 47 47 45 47 47 47 47 47 47 47 47 41
+47 47 47 34 38 38 44 38 44 47 41 36 39 45 32 32 45 39 47 45
+47 41 47 47 47 47 38 40 34 40 38 44 47 47 38 44 31 44 44 38
+47 38 47 47 47 45 45 45 40 31 34 34 38 38 38 47 47 38 47 47
+47 47 47 47 36 47 38 38 38 38 38 38 35 38 49 38 38 34 34 38
+38 40 36 40 36 47 38 45 40 38 38 38 44 40 40 28 28 40 45 47
+47 41 49 41 41 38 34 44 44 38 35 49 45 47 38 47 45 40 34 40
+45 45 47 36 38 40 40 40 39 39 36 40 44 40 34 34 38 45 47 47
+47 47 47 40 36 38 38 38 44 38 31 35 38 40 40 40 32 29 29 44
+44 38 34 49 45 45 40 38 44 36 36 36 28 40 39 44 47 47 47 47
+45 39 40 28 28 36 40 47 47 47 47 47 47 47 47 47 47 47 47 47
+47 47 47 47 47 47 47 47 38 38 34 44 44 44 49 47 36 47 41 47
+41 47 47 47 47 47 47 47 47 38 38 47 47 38 44 34 40 40 45 47
+47 45 49 49 34 44 45 47 38 38 40 40 38 29 34 38 40 31 44 38
+47 44 47 31 31 33 33 45 31 40 40 49 44 41 41 47 47 47 38 38
+47 47 36 47 47 47 38 45 40 40 49 49 49 47 47 47 41 47 38 40
+40 34 44 38 47 45 38 40 34 40 40 45 36 36 36 47 38 44 45 41
+47 47 47 47 47 47 47 47 47 47 47 47 49 36 49 49 47 36 40 38
+32 32 36 36 36 36 36 38 47 38 49 45 49 49 49 38 49 49 49 49
+49 49 38 38 38 38 38 44 49 47 47 41 36 47 47 24 41 36 36 47
+49 49 45 24 24 38 38 24 24 47 47 47 47 24 47 24 38 38 24 19
+19 33 45 47 47 39 36 24 24 23 24 36 45 40 40 24 28 40 40 45
+36 24 47 47 24 38 38 38 44 27 24 47 36 36 47 38 47 24 47 36
+47 47 47 47 47 36 24 19 35 34 34 34 24 28 28 36 36 35 38 38
+24 27 24 24 36 24 24 24 47 49 38 49 24 49 36 36 28 28 40 36
+36 24 24 24 36 24 24 40 24 24 47 24 38 36 24 44 36 38 39 36
+25 17 24 15 19 24 35 36 36 24 47 36 32 24 23 20 27 24 21 16
+ 9 7 19 19 24 24 38 38 40 29 29 27 27 19 24 28 28 25 19 17
+16 12 7 7 8 16 16 19 19 10 10 20
+>gnl|ti|1086975834 name:1099575910662
+ 6 6 6 7 6 6 6 6 7 8 9 7 7 13 13 14 14 9 7 10
+14 17 17 19 21 38 21 21 21 21 21 23 30 24 18 19 24 24 26 29
+40 32 29 26 32 29 34 47 38 33 31 33 35 29 35 41 44 35 35 34
+34 34 34 34 47 47 47 47 26 24 29 23 23 20 31 40 34 38 38 47
+44 44 38 38 34 34 40 40 44 38 44 47 47 38 38 40 29 27 30 32
+24 30 34 35 35 38 29 35 49 32 29 32 31 29 33 47 40 44 32 40
+38 38 38 38 38 38 45 45 47 38 38 38 38 38 44 47 49 49 47 44
+44 44 44 44 38 45 45 44 38 38 44 44 44 44 47 45 41 45 38 32
+38 35 38 44 44 44 47 47 36 47 47 41 47 41 47 47 47 47 41 45
+44 44 44 44 44 38 41 47 38 38 40 40 34 44 38 47 47 38 47 47
+47 47 47 47 38 40 40 49 45 41 41 47 47 47 47 47 38 38 35 38
+44 38 44 47 47 45 47 47 41 41 47 47 47 41 47 47 41 47 47 41
+47 47 47 41 47 47 47 47 45 38 38 44 38 34 34 34 35 33 34 44
+47 47 47 49 47 49 45 49 49 47 47 47 47 47 40 40 49 32 49 49
+39 47 47 38 47 47 36 38 26 31 40 38 44 41 47 47 49 47 47 47
+47 47 38 40 40 38 38 38 45 45 47 47 41 47 41 47 47 38 29 29
+44 34 34 35 49 45 49 47 38 47 47 47 47 47 47 47 44 44 47 40
+45 45 49 49 39 21 17 39 39 34 49 49 45 49 49 49 44 40 47 40
+40 34 34 49 34 40 40 27 18 19 19 25 18 23 23 23 32 32
+>gnl|ti|1086975822 name:1099575910663
+ 6 6 6 6 7 7 7 7 7 7 9 7 7 7 9 7 8 7 7 9
+ 8 14 12 11 11 11 14 18 13 13 13 16 18 24 18 17 19 19 19 19
+24 25 19 33 25 17 12 20 12 14 14 25 25 25 16 26 21 38 38 44
+44 34 34 34 34 23 23 23 23 24 24 24 19 27 17 17 8 8 8 20
+24 19 19 24 24 28 22 22 26 27 19 22 25 21 18 28 19 35 34 47
+38 38 30 24 24 24 22 28 30 38 24 34 24 24 24 24 30 18 18 13
+12 24 21 34 40 40 28 28 28 28 32 28 28 40 32 32 34 36 40 47
+47 47 36 40 40 36 38 44 38 38 35 34 34 32 40 38 47 47 47 38
+45 34 32 33 31 44 33 33 35 35 38 34 44 38 35 35 30 40 28 28
+40 40 32 26 34 24 24 22 18 14 16 26 22 29 29 38 38 34 40 40
+38 44 35 38 38 38 45 36 49 36 45 32 49 40 45 36 38 47 47 47
+39 45 32 49 49 49 39 40 40 40 32 34 49 49 49 45 45 24 35 34
+34 44 38 38 38 29 29 29 35 40 36 40 47 47 29 32 32 32 32 29
+40 40 40 44 44 39 40 32 34 30 27 24 20 20 32 32 34 34 38 38
+30 28 26 24 28 26 26 29 31 29 34 35 38 36 49 49 40 40 32 40
+28 40 28 28 28 23 27 21 26 28 29 29 45 36 34 34 40 34 40 38
+32 40 32 32 28 32 49 49 34 49 49 27 27 28 40 28 40 28 28 28
+45 39 47 47 45 40 34 32 40 32 40 34 36 24 32 28 40 36 28 28
+40 40 40 34 40 32 32 49 32 49 28 28 23 29 28 28 32 40 32 32
+28 28 28 40 32 34 29 29 45 40 28 28 28 28 17 11 7 8 10 9
+10 27 19 24 24 28 28 32 49 36 29 28 24 23 20 20 27 24 24 11
+12 23 23 24 24 36 32 49 36 28 28 28 24 24 28 28 36 24 36 26
+19 19 17 16 15 26 18 23 18 18 23 19 13 16 13 13 17 21 23 39
+32 28 24 19 14 12 16 10 11 9 9 11 9 6 6 11 7 9 9 12
+10 9 9 9 9 14 9 9
+>gnl|ti|1086975873 name:1099575910669
+ 6 6 6 6 8 6 6 6 7 8 6 8 14 18 16 17 20 18 28 25
+21 23 23 20 40 26 22 30 35 35 35 35 23 30 21 25 23 23 23 23
+26 16 16 20 17 24 18 24 24 19 16 19 24 25 24 32 31 29 25 24
+24 23 23 21 29 22 19 21 18 24 24 29 36 32 24 24 29 23 23 25
+23 28 38 44 44 38 45 44 38 38 38 45 44 38 44 44 44 44 45 44
+45 44 38 45 44 38 44 47 47 47 47 47 47 38 40 34 36 49 49 49
+36 45 38 32 30 33 35 33 26 40 32 32 45 31 38 38 38 35 34 45
+39 47 47 47 45 45 45 47 47 47 47 47 45 36 47 47 41 47 38 38
+38 44 38 38 38 38 38 44 38 38 38 41 45 38 47 47 45 47 44 38
+44 38 38 35 34 38 36 40 40 28 28 28 45 45 47 47 41 47 41 44
+44 44 44 38 28 40 28 28 28 28 35 31 44 44 38 30 32 28 25 25
+40 36 47 47 47 41 47 47 41 47 47 47 38 47 47 36 47 38 47 47
+47 44 38 44 40 38 38 47 47 47 38 47 47 47 47 47 47 38 47 47
+47 47 41 47 47 41 41 47 47 47 47 47 47 49 49 29 34 44 35 38
+34 34 38 49 49 49 47 47 40 40 39 40 28 23 45 40 38 47 38 40
+40 36 40 36 38 47 49 47 47 47 47 47 47 47 47 47 47 47 47 44
+38 36 35 29 34 34 38 44 38 47 41 47 47 47 49 49 34 38 36 39
+32 40 40 39 47 38 47 38 47 47 38 47 47 47 40 45 40 40 40 29
+25 17 17 39 39 32 40 28 28 49 29 26 16 16 10 9 12 18 20 25
+25 25 25 45
+>gnl|ti|1086975802 name:1099575910762
+ 6 6 6 7 7 9 6 7 6 7 7 7 8 9 6 6 14 14 16 13
+ 7 7 7 7 16 17 23 19 13 13 20 13 12 16 16 16 13 14 16 13
+25 24 24 25 25 24 21 23 23 28 24 28 24 24 28 24 29 25 33 33
+32 23 25 26 26 24 25 24 27 38 28 23 32 18 17 7 7 7 7 6
+ 8 8 8 10 14 19 25 22 40 23 23 21 30 26 26 30 28 24 23 22
+28 29 33 31 38 31 29 28 28 40 29 29 29 26 24 29 23 24 20 18
+25 18 18 27 19 27 29 29 38 34 40 38 28 29 27 26 29 26 29 29
+34 35 34 34 38 38 34 34 34 38 35 35 31 31 27 27 21 19 18 18
+19 22 35 35 29 29 30 24 26 20 28 28 40 40 40 45 38 49 49 49
+40 40 47 36 34 34 34 34 27 27 30 26 24 20 25 32 32 28 35 35
+32 45 49 49 49 40 32 28 40 28 28 28 40 32 40 28 28 32 28 29
+35 35 34 35 38 40 40 32 32 35 49 32 49 45 38 40 35 38 34 35
+38 34 34 38 40 40 40 32 40 28 28 40 40 26 26 30 28 34 34 35
+38 44 38 38 28 36 28 28 32 24 35 34 34 29 29 49 28 28 28 40
+24 28 32 40 27 28 32 40 28 26 18 20 20 29 22 23 18 23 18 20
+23 28 24 24 20 25 30 29 26 26 28 49 26 28 26 23 23 27 28 28
+27 23 23 28 28 40 32 40 40 45 32 28 28 40 32 40 28 28 28 28
+28 28 28 28 40 49 32 27 23 13 18 17 23 18 18 11 16 19 21 19
+18 15 12 14 14 23 25 26 24 26 21 20 28 49 32 32 32 32 20 20
+17 13 9 19 20 32 25 21 23 21 18 15 13 13 14 18 17 28 23 24
+29 24 19 19 27 25 21 27 27 27 49 49 36 25 25 24 15 12 13 10
+23 23 19 18 18 18 20 20 28 24 24 17 17 19 17 20 17 25 23 32
+27 28 27 27 17 17 20 22 22 24 21 24 20 20 19 26 28 24 32 32
+23 28 28 23 28 28 28 32 28 32 23 28 23 23 11 12 13 12 16 12
+16 15 16 23 13 18 18 21 18 23 19 28 25 49 49 18 18 14 20 15
+18 20 20 23 21 22 32 18 18 20 18 14 11 12 29 26 28 28 24 24
+13 15 16 13 11 11 20 18 29 21 23 27 27 18 21 20 23 20 20 20
+20 16 17 14 12 12 11 12 14 24 18 23 20 13 13 24
+>gnl|ti|1086975878 name:1099575910765
+ 9 9 11 8 10 9 9 7 9 6 6 7 10 12 12 17 12 12 14 12
+12 12 17 19 17 17 18 18 18 17 24 20 23 18 18 23 24 22 23 24
+18 19 18 24 20 32 47 44 38 25 28 25 25 25 25 34 35 34 28 29
+26 29 45 32 34 35 35 34 24 34 18 21 29 29 26 23 39 32 40 32
+40 44 29 31 30 35 30 27 35 35 30 30 22 23 29 31 49 45 44 44
+44 34 34 34 44 44 38 38 45 38 38 35 40 40 38 38 38 34 34 34
+34 40 40 47 47 45 44 44 44 44 44 47 47 47 47 41 47 47 47 41
+47 49 47 38 34 31 38 40 38 47 47 47 47 36 47 47 47 38 40 36
+38 38 38 44 40 40 47 47 36 47 47 41 41 47 45 47 47 41 47 49
+49 49 49 47 38 44 44 44 38 38 38 38 38 40 47 47 38 47 45 47
+47 47 36 47 45 49 45 49 45 28 28 39 39 39 28 28 40 32 38 44
+38 38 44 44 49 36 49 49 45 45 49 41 41 47 41 47 47 47 47 47
+45 45 47 47 47 40 36 40 44 47 47 41 47 41 36 41 47 47 47 47
+47 47 47 47 47 47 47 47 39 40 40 38 38 38 44 38 38 29 38 44
+44 44 44 44 38 41 47 47 47 38 47 38 47 47 45 45 45 47 47 47
+38 47 47 47 36 44 44 29 35 44 38 44 47 38 47 47 47 47 47 45
+47 47 47 47 47 47 47 47 47 44 44 34 32 38 45 40 36 40 32 44
+45 47 47 36 32 40 23 25 39 45 45 47 47 47 41 49 49 49 49 49
+45 45 45 45 32 40 39 34 40 40 35 35 17 12 14 9 12 16 28 28
+25 20 12 7 6 7 9 8 9 9 9 14 12 15 11 12 13 9 9 13
+12 15 20 13 13 10 11 11 11 13 9 9 12 9 9 11 10 9 13 13
+ 9 12 12 9 9 9 7 9 10 12 9 7 9 7 9 9 10 13 9 9
+10 9 9 9 7 9 9 9 9 9 7 9 9 9 9 9 9 9 9 10
+10 9 7 7 6 7 9 9 9 6 6 9 9 9 10 9 9 9 9 9
+ 9 9 7 7 9 9 7 7 9 9 10 10 7 7 6 9 9 9 9 9
+ 9 10 9 9 9 9 9 10 9 9 9 9 9 9 7 9 9 9 9 9
+ 9 9 9 9 9 18 14 9 9 10 14 12 11 17 17 26 16 11 12 18
+12 11 17 9 14 17 9 9 9 9 10 8 9 9 9 9 11 10 9 9
+ 9 7 7 11 11 13 11 11 9 9 9 9 8 13 16 17 22 18 16 11
+ 9 7 9 7 9 9 10 7 7 9 9 9 9 8 9 10 12 10 13 9
+ 9 9 9 9 9 9 9 10 9 9 7 7 9 10 10 11 13 9 9 6
+ 9 7 9 9 12 9 7 12 11 9 9 9 7 9 9 8 11 10 9 7
+>gnl|ti|1086975780 name:1099575910766
+ 8 6 9 6 6 9 9 7 9 10 9 7 7 8 9 8 6 8 8 8
+ 9 9 10 11 14 14 18 17 12 13 15 18 14 15 17 19 19 18 18 12
+12 16 18 19 21 22 22 15 15 19 22 23 29 40 28 23 21 20 24 24
+22 26 28 22 22 21 23 19 19 17 17 17 24 26 17 19 10 9 7 7
+ 9 9 9 12 17 18 26 21 21 25 21 21 19 17 18 18 18 20 16 19
+22 19 22 20 20 16 16 13 20 23 23 33 29 49 32 49 28 27 27 21
+21 26 24 23 22 20 23 19 14 13 20 21 40 49 36 36 49 28 28 28
+32 32 26 26 29 28 28 29 39 34 34 34 34 40 40 45 38 34 34 34
+34 23 23 18 18 27 27 32 40 34 39 40 34 49 34 34 34 29 24 29
+40 49 40 34 35 31 31 29 26 28 49 27 25 26 29 34 34 32 49 32
+40 40 40 36 40 49 49 34 32 29 29 35 28 28 29 40 40 34 40 40
+40 49 40 28 28 30 28 28 28 40 40 36 35 40 32 29 26 26 28 25
+26 32 27 27 19 15 20 14 18 17 20 20 23 40 36 30 19 18 20 23
+29 29 38 36 36 40 47 40 40 40 35 34 32 40 39 28 28 28 29 29
+28 28 26 23 21 28 28 28 26 26 28 39 29 28 28 31 29 30 28 29
+28 26 32 32 28 25 23 17 17 27 27 40 32 40 28 25 28 28 32 32
+40 28 40 40 40 36 40 36 32 39 32 28 49 40 39 26 26 26 29 29
+34 34 34 32 40 40 40 32 40 40 49 49 29 35 35 29 29 27 27 25
+45 29 40 20 20 23 49 40 27 39 19 19 23 27 39 47 38 30 30 33
+33 33 27 34 28 29 29 34 29 34 38 40 40 40 28 32 32 39 40 34
+40 40 32 32 49 49 40 40 40 40 40 40 40 40 32 40 32 40 40 28
+28 40 27 32 28 28 32 40 40 40 40 32 28 28 28 28 28 28 40 49
+32 25 23 40 32 24 26 26 26 28 35 32 40 36 32 40 32 28 32 40
+36 32 40 34 40 36 40 40 34 32 29 29 28 29 22 25 28 21 21 32
+32 40 36 26 34 34 34 35 35 40 39 32 40 28 23 40 36 29 29 32
+32 35 24 28 45 40 40 45 45 23 13 9 6 8 9 8 9 9 14 11
+19 16 9 14 9 9 8 11 14 9 10 9 9 9 10 9 9 9 9 9
+ 9 9 19 19 12 9 11 11 12 14 10 10 10 9 11 12 9 9 9 9
+ 7 9 9 11 9 9 9 12 17 9 9 16 9 9 8 13 14 9 10 10
+15 11 10 11 9 9 12 14 13 10 10 10 14 10 13 18 12 12 9 12
+ 9 10 9 6 9 7 7 8 9 9 15 14 10 14 10 12 14 12 15 12
+12 10 10 9 10 9 9 9 7 7 9 9 10 9 7 9 9 9 9 9
+ 7 7 8 9
+>gnl|ti|1086975791 name:1099575910773
+ 9 8 7 10 9 9 9 7 8 7 7 7 7 8 12 12 12 19 23 24
+38 23 23 23 24 23 19 19 19 24 25 25 25 21 21 23 23 29 23 30
+24 22 21 26 25 27 44 47 47 44 38 44 35 35 34 34 34 18 24 24
+20 21 23 33 31 34 44 47 47 47 32 30 22 21 11 11 14 7 20 20
+26 26 26 29 27 28 34 33 30 30 28 28 29 29 44 44 44 47 38 38
+35 35 44 44 44 38 44 47 47 47 47 38 38 47 38 44 38 47 45 45
+45 38 38 38 40 34 44 44 47 49 41 44 44 38 38 38 44 38 38 38
+35 34 38 38 47 40 36 44 36 47 47 45 34 35 34 30 27 34 35 29
+34 31 44 38 38 45 44 44 31 33 33 38 38 44 47 45 44 38 29 44
+44 38 38 38 49 44 38 38 44 38 40 49 49 47 47 47 47 45 47 47
+49 47 45 38 38 34 30 30 33 38 38 34 40 38 40 47 38 44 38 38
+34 34 29 40 40 40 36 47 38 38 38 44 44 38 34 45 40 38 38 39
+40 28 28 28 39 28 40 45 49 47 47 44 44 44 38 45 38 45 47 47
+45 49 45 41 47 39 36 32 32 39 35 35 38 38 34 34 35 35 35 31
+44 44 44 38 44 47 47 45 45 47 36 38 36 47 47 47 47 47 45 49
+49 32 40 45 45 41 47 38 47 36 47 38 38 32 40 34 40 45 47 47
+45 45 49 32 28 28 49 36 49 34 35 34 44 44 44 36 47 47 38 44
+38 38 34 29 38 36 38 38 34 34 31 31 28 28 29 30 38 35 34 34
+45 39 40 40 39 32 32 45 45 47 47 47 49 36 49 49 49 47 36 36
+45 38 47 47 41 38 44 44 38 34 35 39 40 45 38 40 38 49 47 49
+38 47 47 38 47 47 47 47 47 47 39 39 49 40 40 39 40 34 44 49
+49 45 49 47 47 47 47 47 47 47 47 38 35 45 45 34 34 49 38 45
+45 47 47 47 49 45 49 49 49 49 36 38 44 44 44 38 44 49 45 47
+47 47 47 47 47 45 44 38 44 44 40 34 40 44 44 41 49 47 47 40
+45 40 40 40 40 40 40 34 40 40 47 38 49 49 47 47 47 45 45 41
+49 49 49 38 40 44 40 38 44 40 36 40 44 38 38 45 36 47 47 47
+38 47 47 40 39 39 28 28 32 32 39 36 36 34 29 38 30 33 20 16
+10 7 8 6 6 6 6 11 8 10 8 6 6 6 6 6 7 6 9 9
+ 9 10 9 8 7 9 9 9 9 9 18 17 12 12 9 9 9 7 6 9
+ 7 7 6 8 9 13 9 7 9 9 19 18 21 18 20 15 11 9 9 13
+12 8 10 8 7 9 9 9 9 9 10 11 7 7 9 10 13 14 13 11
+11 9 9 9 9 9 9 9 7 9 9 10 11 10 11 9 7 9 8 8
+ 6 7 9 9 9 9 10 9 9 9 10 10 14 10 10 10 8 10 9 9
+ 9 9 13 9 9 7 10 9 9 9 20 20 10 9 9 11 11 17 11 10
+12 9 9 7 9 9 8 10 11 9 9 9 9 9 10 11 16 9 9 8
+ 9 8 8 7 7 7 9 20 13 9 9 9 10 9 9 7 7 9 8 9
+ 7 9 9 7 9 9 7 7 9 9 9 9 13 12 13 13 13 13 10 10
+11 10 7 9 10 11 7 9 9 9 9 9 9 9 9 11 12 9 9 10
+ 9 12 11 13 10 8 12 9 9 15 9 7 10 7 9 12 12 12 10 9
+ 7 9 13 17 12 9 12 13 10 7 8 8 9 9 8 9 6 7 6 7
+ 7 8 8 10 8 8 8 7 9 11 9 13 13 13 12 12 7 9 10 9
+14 10 10 17 14 13 8 9 8 9 11 9 13 11 11 10 9 7 9 9
+ 9 11 12 9 9 8 7 7 9 12 8 10 7 9 9 9 9 9 9 8
+ 9 7 9 6 6 9 9 9 10
+>gnl|ti|1086975844 name:1099575910778
+15 9 9 9 9 9 9 10 9 14 8 9 14 14 15 16 17 26 19 24
+23 25 31 18 18 14 19 22 23 21 19 14 14 14 14 15 15 16 23 24
+25 26 23 27 27 28 38 35 24 19 29 22 26 24 22 28 27 31 31 44
+33 33 33 31 33 44 47 33 33 33 24 24 12 13 9 12 7 16 17 35
+29 24 24 32 40 32 40 44 47 38 30 33 33 33 29 29 34 34 34 27
+30 32 32 32 32 44 47 32 32 32 33 33 33 40 28 26 22 27 22 28
+29 34 38 29 29 26 26 29 31 34 38 38 44 47 47 47 47 38 38 40
+34 44 31 38 38 44 44 38 44 38 34 34 38 45 47 47 47 47 47 49
+47 38 44 44 44 44 38 45 44 35 38 31 38 32 40 40 40 32 38 44
+47 41 47 47 47 41 41 45 38 38 34 33 33 33 38 38 38 38 38 47
+47 41 47 47 35 45 45 44 40 44 38 38 44 38 38 44 38 38 47 47
+41 47 47 47 47 47 47 41 47 47 38 36 47 47 47 38 47 45 47 41
+47 47 41 44 34 44 38 34 34 38 40 41 41 47 47 47 47 47 47 38
+38 38 47 47 47 44 36 40 38 45 38 34 44 44 44 44 44 45 47 47
+41 47 47 47 47 47 45 45 47 45 47 47 47 45 41 47 47 41 39 39
+40 28 28 40 40 47 40 36 39 36 47 47 49 45 47 47 41 44 31 38
+44 35 34 47 47 47 41 47 47 47 47 47 41 47 47 41 47 47 47 47
+41 47 47 47 47 47 45 47 38 38 38 40 41 47 47 47 47 47 47 45
+47 49 41 47 41 47 41 41 41 47 47 41 40 38 40 47 47 36 47 47
+41 47 36 47 47 47 47 47 47 47 47 47 47 47 47 47 47 41 41 47
+47 47 47 45 47 45 47 47 47 47 47 47 38 47 38 47 47 47 47 41
+47 47 47 38 47 38 47 47 47 47 38 47 41 47 41 47 45 41 47 47
+47 45 45 49 49 34 44 38 44 38 38 44 44 40 47 49 45 47 47 45
+40 39 28 26 29 29 44 38 44 47 47 47 49 49 47 45 47 47 47 47
+47 47 47 47 47 39 40 28 28 49 49 49 45 49 45 45 27 25 40 40
+47 36 40 39 40 47 47 47 47 47 47 44 45 39 34 32 40 40 47 45
+38 40 40 49 34 45 45 45 39 28 23 39 40 40 29 32 24 25 40 45
+44 45 32 19 19 24 21 16 12 9 8 8 6 6 6 6 6 6 6 6
+ 6 6 6 6 7 9 10 11 9 9 9 9 9 9 9 9 7 11 7 6
+10 10 9 10 8 9 8 11 12 11 9 9 9 9 9 9 9 9 7 7
+13 10 11 9 7 9 9 9 13 9 8 8 7 11 13 16 9 9 10 10
+11 7 7 9 9 9 9 9 9 11 10 9 9 9 9 9 8 9 10 11
+ 9 9 9 9 9 9 9 9 9 10 9 10 11 11 8 9 7 9 8 8
+10 10 9 7 9 7 7 10 12 10 10 8 9 9 9 9 9 12 9 12
+13 15 11 9 9 9 9 9 9 9 10 9 9 9 7 7 8 9 9 9
+ 9 9 7 10 12 8 9 9 9 7 9 12 9 9 7 7 7 7 7 10
+ 9
+>gnl|ti|1086975877 name:1099575910781
+ 7 9 9 9 9 7 7 7 7 7 8 8 10 10 12 12 21 17 17 19
+19 32 23 20 14 18 17 15 16 29 16 15 16 23 16 16 27 27 30 27
+22 29 30 32 32 26 31 32 32 32 42 35 35 31 32 25 25 29 28 29
+29 29 30 32 35 44 44 44 45 32 30 19 18 18 20 22 26 29 44 44
+44 44 44 44 38 44 38 35 35 36 35 42 35 35 38 38 38 38 44 38
+35 44 38 44 38 44 44 38 38 38 41 47 41 41 47 41 47 47 47 47
+47 47 38 38 38 44 34 26 30 26 29 26 30 38 38 44 44 38 49 38
+38 44 44 38 44 47 47 47 47 47 47 47 41 47 38 44 35 38 44 44
+47 41 38 44 44 38 38 44 38 44 44 44 38 47 36 47 47 45 44 44
+44 44 38 38 49 40 32 44 44 38 47 38 44 40 47 41 45 47 49 47
+41 47 47 47 47 47 47 47 41 41 47 47 47 47 41 47 41 47 47 41
+47 47 38 44 44 38 44 44 47 47 44 38 40 40 47 47 41 44 44 38
+44 38 38 47 47 47 49 47 41 47 47 47 47 47 45 47 49 47 47 38
+47 38 47 47 41 47 41 47 47 47 41 47 45 45 49 49 49 47 41 47
+41 41 38 38 44 44 31 44 41 47 38 47 41 47 47 47 36 44 38 47
+41 47 38 47 47 47 47 47 47 47 38 47 36 47 41 47 38 38 44 44
+44 44 47 41 47 45 38 40 32 40 38 44 38 47 47 47 36 47 47 47
+45 41 47 45 45 45 34 35 29 34 38 38 44 38 38 38 49 49 49 36
+47 38 44 44 44 44 40 44 38 36 39 35 34 49 45 49 47 39 40 40
+23 28 39 39 36 47 38 44 36 49 45 49 49 45 47 45 44 44 34 40
+38 38 47 41 47 47 47 41 47 47 45 45 47 47 47 47 41 47 47 47
+47 47 41 47 47 47 47 47 47 45 47 47 41 38 45 35 44 38 38 47
+47 41 47 47 47 49 47 47 47 41 47 47 47 41 47 41 41 38 38 44
+38 44 38 47 47 47 49 47 47 47 47 41 47 45 47 47 47 47 47 47
+47 47 47 47 49 49 45 44 44 45 44 38 38 38 38 38 47 41 47 41
+47 47 47 47 38 45 38 41 47 47 47 47 47 47 47 47 47 47 49 47
+49 47 47 47 44 44 38 49 40 40 45 47 47 47 49 47 47 47 47 47
+47 47 47 47 47 41 47 44 44 38 44 44 38 38 36 36 47 47 44 38
+27 21 17 16 12 12 13 15 10 13 10 11 7 7 6 10 10 9
+>gnl|ti|1086975810 name:1099575910784
+ 6 6 6 6 7 10 11 12 9 7 20 14 14 15 7 9 17 19 32 15
+14 22 18 15 15 18 18 12 11 10 18 18 20 22 25 17 18 17 21 26
+18 21 18 18 24 14 14 16 16 24 16 18 24 24 23 27 27 45 42 42
+27 30 30 16 23 35 30 29 26 23 13 10 9 9 13 18 25 30 35 42
+35 32 32 31 32 29 32 41 47 44 38 44 38 44 34 47 47 47 47 38
+44 44 35 35 35 38 34 35 44 44 38 44 44 36 38 38 35 31 31 31
+29 32 31 44 34 41 45 47 47 41 41 47 47 41 47 47 47 38 47 47
+47 38 45 44 34 44 38 41 44 44 44 44 35 38 44 44 44 38 44 38
+44 44 34 47 47 45 45 47 47 45 47 47 41 47 47 47 47 41 47 41
+47 41 47 41 41 47 47 47 47 47 47 47 47 49 49 49 40 44 38 44
+44 44 47 47 47 47 47 47 38 47 44 44 44 44 44 38 47 47 47 47
+49 38 44 45 40 44 29 34 38 38 38 44 38 41 41 47 49 49 49 47
+45 47 35 38 44 44 40 38 47 44 45 40 32 38 45 47 47 45 39 32
+28 28 39 39 47 38 40 40 34 49 49 44 41 47 47 38 45 44 32 40
+38 45 45 47 47 47 41 47 38 44 38 38 38 44 47 47 47 47 47 47
+49 49 49 49 49 47 47 47 47 47 47 47 47 47 45 49 47 47 47 47
+47 41 47 41 47 45 47 47 47 47 47 41 47 47 41 47 47 47 47 47
+47 47 47 47 47 47 45 44 38 38 35 44 38 49 47 47 47 47 47 47
+45 36 45 36 47 47 47 44 38 44 44 44 44 47 49 49 36 47 41 47
+47 47 41 49 49 47 49 49 47 47 47 47 45 45 47 47 47 47 47 47
+49 41 47 47 47 47 47 36 49 49 49 49 47 45 49 45 47 47 47 47
+47 41 47 47 47 47 47 47 41 47 47 41 47 49 49 49 38 47 47 41
+47 41 47 38 38 38 38 38 34 34 38 44 33 34 45 44 47 47 49 49
+47 47 41 47 47 47 49 49 32 40 39 39 47 47 47 49 45 47 47 47
+47 47 47 47 38 44 40 40 44 38 47 47 47 47 47 47 47 49 49 47
+47 47 41 47 41 47 38 47 47 40 49 49 49 47 47 47 47 47 47 47
+47 45 47 45 47 36 29 38 34 14 14 12 13 18 18 32 34 20 19 9
+ 9 10 6 7 6 6 6 6 6 6 6 6 6 6 6 6 6 6 9 11
+ 9 9 9 9 9 9 9 12 12 9 9 9 9 10 9 8 7 6 10 10
+ 9 9 9 9 9 9 7 9 12 9 11 9 10 7 10 9 10 7 11 12
+12 11 9 9 9 12 14 7 9 9 7 9 9 7 7 9 11 9 9 9
+ 9 9 9 9 9 9 9 12 9 9 11 9 9 10 9 9 9 9 11 9
+ 9 9 11 9 9 9 9 9 9 9 7 9 13 10 9 9 9 9 9 9
+10 8 10 11 9 9 9 8 8 12 12
+>gnl|ti|1086975836 name:1099575910791
+ 9 9 8 8 7 7 7 6 6 6 6 8 6 9 7 9 8 7 7 9
+16 13 16 16 16 18 18 12 9 9 9 12 18 23 18 36 47 20 21 28
+16 17 17 17 21 20 23 13 13 15 13 13 32 32 23 23 23 25 35 35
+47 44 41 44 44 29 29 29 31 30 30 38 34 35 38 33 31 31 31 31
+44 38 38 34 44 44 44 44 33 35 29 44 33 34 25 33 44 45 47 47
+47 49 49 32 31 31 31 32 31 35 44 45 40 32 44 36 47 47 47 41
+41 38 35 34 34 35 33 44 47 45 40 40 40 35 34 34 34 34 35 35
+35 39 40 47 47 47 47 36 47 47 47 47 47 38 44 38 34 32 38 44
+41 47 47 47 47 41 41 47 49 45 49 45 41 47 47 47 45 45 32 35
+38 44 38 38 44 47 47 41 38 38 44 44 44 34 47 38 44 44 47 47
+38 38 47 47 45 45 40 40 38 38 47 47 40 40 32 40 32 38 45 38
+44 38 44 44 44 47 41 47 47 47 40 40 45 45 38 38 40 47 47 41
+47 36 47 47 47 47 47 38 41 47 36 47 47 47 47 47 47 47 47 47
+36 41 41 47 47 47 44 44 38 38 44 38 41 41 47 47 41 47 47 36
+45 45 38 38 38 44 44 44 47 45 47 47 47 38 47 47 47 47 47 41
+47 47 38 47 47 47 41 47 38 38 38 38 44 38 47 47 47 41 47 47
+41 44 47 47 47 49 38 47 45 41 47 47 47 38 40 40 40 49 45 47
+47 45 40 34 49 49 49 49 45 45 47 47 47 41 47 47 47 47 47 38
+47 47 41 45 47 47 47 41 47 44 38 38 40 34 44 38 41 47 47 41
+47 47 38 40 38 40 47 47 41 47 38 39 45 49 32 34 45 45 47 47
+47 47 47 47 47 41 47 49 41 47 47 47 47 41 41 47 41 41 47 47
+36 47 47 45 47 49 38 47 47 47 47 47 45 38 44 38 44 44 38 38
+31 31 34 35 34 40 40 47 47 47 47 47 41 47 38 47 47 47 47 47
+47 47 47 49 45 49 45 38 38 38 38 38 38 49 49 28 23 40 40 39
+38 47 47 47 47 47 47 47 47 49 47 45 49 40 40 40 45 47 47 47
+47 40 40 28 32 39 45 47 49 49 45 49 49 23 23 12
+>gnl|ti|1086975797 name:1099575910829
+ 9 6 8 6 6 6 6 6 6 6 9 6 6 6 9 8 7 12 12 17
+12 12 14 14 12 12 15 12 15 15 16 23 19 24 47 16 17 15 18 18
+18 35 44 22 16 16 16 21 21 45 24 32 24 26 27 30 29 32 38 41
+41 45 44 35 34 34 34 31 38 31 27 27 28 28 24 19 17 17 20 18
+29 28 47 47 47 38 38 35 26 30 30 31 32 32 40 38 38 38 38 44
+49 24 27 26 28 30 29 33 34 34 35 35 34 36 36 40 29 28 28 31
+31 38 41 47 36 47 47 47 38 44 40 34 38 38 44 44 38 32 32 44
+45 47 47 47 47 41 47 41 47 45 45 45 40 40 35 35 45 45 47 47
+41 45 47 47 47 38 45 47 44 38 34 33 31 29 35 29 31 31 44 44
+44 38 38 38 38 34 27 24 23 20 26 26 28 32 40 44 38 47 41 47
+47 47 47 47 47 38 47 41 47 41 40 38 44 34 34 40 45 44 35 35
+44 38 38 47 47 44 45 36 40 40 36 34 34 44 44 38 38 38 38 38
+38 38 47 41 47 38 47 38 47 47 47 41 41 41 47 41 41 45 45 40
+40 45 49 45 38 35 38 38 38 38 47 47 47 49 47 38 44 38 34 34
+45 38 38 44 44 44 44 47 49 49 47 47 47 47 47 47 36 47 41 47
+38 40 40 34 49 44 41 47 47 47 47 47 45 47 47 47 47 47 47 45
+39 40 34 45 40 41 47 47 38 47 36 47 47 38 47 47 47 38 45 47
+41 47 40 49 32 34 45 45 40 40 32 32 40 45 29 34 44 44 44 38
+38 41 47 47 41 41 45 45 36 32 28 28 39 40 41 47 47 47 47 47
+47 38 47 47 45 45 47 47 38 38 38 34 35 34 45 44 47 47 47 47
+47 47 45 49 49 45 47 47 47 47 38 45 44 44 44 44 47 47 47 38
+40 40 40 45 45 45 41 41 47 47 47 47 47 47 47 47 47 47 36 39
+45 40 34 38 38 44 38 38 38 45 45 28 36 45 38 47 47 47 41 47
+47 49 49 47 47 47 38 40 40 40 40 40 49 49 28 28 49 39 44 40
+38 45 47 47 47 47 47 49 47 47 45 40 32 32 32 40 40 38 38 40
+24 20 9 9 20 17 32 24 27 26 45 40 32 27 27 27 27 49
+>gnl|ti|1086975777 name:1099575910839
+ 9 6 6 7 7 9 10 6 6 9 9 8 16 19 16 16 16 16 19 14
+14 12 12 12 12 16 16 19 19 21 17 16 8 8 14 13 18 21 42 35
+29 35 31 26 23 26 29 32 25 25 34 35 35 35 35 44 44 32 27 27
+25 26 26 27 32 31 32 29 31 47 47 44 44 35 34 33 33 34 34 34
+33 44 47 47 47 47 47 45 44 38 44 38 38 38 44 44 38 34 44 44
+47 47 47 47 47 45 47 47 38 47 38 38 44 44 38 38 45 47 47 41
+47 41 47 35 45 45 35 35 44 38 38 38 44 44 44 47 47 41 41 47
+40 44 40 40 45 45 47 41 47 38 44 38 38 35 35 41 47 41 47 47
+45 47 47 47 47 47 40 40 36 40 28 40 36 38 38 38 44 38 35 49
+47 41 47 47 45 41 47 44 44 38 44 38 35 49 45 47 49 47 47 38
+38 44 44 38 38 47 41 47 47 47 41 38 38 38 31 38 44 49 45 41
+47 47 47 47 41 41 41 41 47 41 47 47 47 47 47 47 47 47 47 47
+47 41 41 47 41 38 44 44 38 44 44 47 41 41 47 47 41 47 47 49
+49 47 47 47 41 47 47 45 36 40 38 44 41 47 47 45 35 35 38 38
+35 35 44 44 44 44 47 41 47 47 47 47 47 41 47 47 47 47 38 40
+40 40 45 39 38 38 47 47 45 49 44 44 38 44 38 44 49 49 49 47
+47 47 45 45 39 40 32 32 36 39 41 47 47 41 47 47 47 41 47 47
+47 47 47 41 47 38 44 32 40 32 45 45 41 47 41 47 47 47 47 41
+47 49 45 47 47 47 47 47 41 41 41 41 41 41 47 47 38 38 34 49
+38 47 47 47 47 47 47 41 47 41 47 47 41 41 45 44 34 49 40 45
+45 47 47 45 44 38 47 47 47 47 47 47 41 47 47 41 47 47 41 47
+47 41 47 47 47 41 47 44 49 36 40 40 39 40 41 47 47 45 47 38
+38 47 38 45 49 45 38 40 34 44 44 45 45 25 25 45 45 40 34 38
+38 47 49 36 44 40 40 39 23 20 11 9 20 14 28 26 27 32 40 20
+17 12 12 20 12
+>gnl|ti|1086975801 name:1099575910848
+ 8 6 6 6 7 7 6 6 7 6 8 13 7 7 9 9 16 20 12 14
+14 14 14 12 26 16 16 16 16 30 30 44 33 35 34 34 31 31 22 21
+22 21 19 16 28 29 29 31 44 44 47 40 35 35 34 34 35 35 47 30
+21 21 30 25 23 47 47 47 47 47 49 39 39 18 10 10 6 7 14 13
+12 22 22 26 30 24 31 40 40 40 38 29 31 29 31 32 32 40 44 44
+49 47 49 49 49 49 49 47 47 35 32 26 31 26 22 24 23 18 23 13
+14 17 29 29 36 45 45 44 44 44 44 44 38 44 44 40 40 38 44 44
+38 38 45 47 38 38 47 45 44 44 47 47 45 47 36 38 45 47 47 47
+47 38 38 44 38 34 44 47 47 47 47 47 47 47 47 47 47 47 47 45
+45 47 41 47 47 47 45 49 49 27 19 23 29 23 20 25 25 34 38 44
+47 45 45 47 47 47 47 38 47 38 38 38 38 44 38 49 45 36 49 36
+40 32 40 40 47 47 47 45 47 38 45 45 40 49 32 40 40 36 40 34
+44 45 38 38 38 38 34 38 38 38 38 38 44 41 41 36 38 44 44 44
+38 38 47 38 36 32 32 38 38 41 49 41 47 47 47 38 47 40 38 44
+34 32 40 40 47 47 41 47 41 47 47 47 47 47 47 47 41 47 47 38
+36 38 47 38 40 40 28 28 29 29 38 35 31 32 32 39 39 47 45 38
+40 40 38 40 39 39 40 40 40 36 36 47 44 36 40 32 45 40 47 47
+38 40 40 40 47 47 47 38 47 45 47 44 36 38 49 49 47 41 38 44
+34 40 34 45 49 47 47 47 41 41 47 47 47 47 47 47 47 47 36 39
+19 19 27 27 40 49 36 39 23 23 40 40 38 40 38 38 34 49 38 45
+38 40 40 27 26 20 26 29 38 39 32 27 15 12 20 29
+>gnl|ti|1086975767 name:1099575910854
+ 9 9 6 6 6 7 7 8 9 12 12 7 7 16 19 12 12 12 12 12
+13 19 18 18 18 16 25 22 22 19 27 17 19 19 21 24 24 26 20 24
+20 26 28 32 35 35 34 44 35 34 34 35 34 34 44 44 31 31 32 31
+32 25 44 44 44 44 47 49 39 47 40 29 24 14 13 23 25 31 45 31
+34 35 29 34 35 34 38 44 44 44 44 44 44 38 38 38 44 49 47 45
+49 49 45 38 40 44 25 23 23 23 25 28 33 38 38 38 38 47 47 47
+47 47 36 47 31 34 35 34 44 38 44 44 44 44 47 47 47 38 47 38
+38 44 38 47 47 38 45 41 47 47 38 41 41 45 44 44 38 38 29 32
+32 32 29 32 47 47 47 41 47 47 41 47 41 47 47 41 47 41 47 47
+41 47 47 47 45 41 49 49 49 49 49 38 44 34 44 44 44 47 41 47
+41 38 47 47 47 36 47 47 47 44 38 47 38 49 49 49 40 38 44 36
+40 38 38 47 38 45 34 40 44 40 36 40 40 36 39 40 32 38 45 38
+38 44 44 44 44 47 38 47 47 38 47 47 47 38 31 44 44 44 44 45
+44 38 32 32 38 44 41 47 41 47 47 47 47 40 40 45 49 47 49 38
+47 47 47 47 47 41 47 47 47 47 47 47 47 47 45 47 47 47 41 47
+38 39 39 28 28 35 29 34 34 38 40 34 40 36 47 38 47 38 47 47
+36 38 45 45 40 40 36 38 38 38 38 34 34 38 38 38 40 32 34 38
+36 38 47 45 45 47 47 45 47 47 41 47 47 47 47 40 38 44 47 47
+47 38 47 47 47 38 47 47 45 47 47 47 47 47 47 47 38 47 47 36
+47 45 47 47 47 41 47 41 41 47 41 47 44 38 49 38 45 36 36 47
+47 41 38 45 45 40 34 40 40 38 44 47 45 39 40 29 28 28 30 28
+34 34 34 36 40 47 47 49 38 38 38 38 38 44 38 47 36 36 40 40
+39 47 47 47 47 40 38 29 35 38 38 38 44 39 39 28 28 40 40 38
+47 47 41 41 41 47 44 44 40 34 45 45 32 40 35 29 35 17 19 8
+ 7 8 6
+>gnl|ti|1086975838 name:1099575910857
+ 6 6 6 6 6 6 9 7 7 7 7 12 7 7 12 12 14 14 14 28
+27 27 23 24 23 19 19 19 19 21 32 19 29 24 19 16 21 24 19 22
+24 24 20 24 22 20 25 25 26 35 35 33 38 31 47 38 38 44 38 40
+38 38 44 47 44 45 28 22 22 16 12 10 10 9 8 15 12 33 30 36
+33 33 34 32 32 31 38 44 34 34 29 29 32 32 31 31 38 44 31 32
+30 32 25 32 47 41 47 47 47 36 40 38 29 34 35 40 34 34 41 35
+44 47 47 44 44 33 33 33 44 38 38 47 47 47 47 47 44 38 38 44
+40 38 38 44 44 38 34 44 47 45 38 35 38 31 38 38 41 41 47 38
+44 38 44 44 44 47 41 47 47 47 47 36 47 47 41 47 47 47 47 47
+41 47 47 41 38 38 32 36 38 38 47 38 44 38 38 45 40 49 44 38
+44 44 44 44 47 47 38 38 39 40 34 40 44 47 49 45 49 40 40 38
+32 34 44 38 47 47 47 47 47 45 45 47 38 34 34 34 35 35 45 47
+49 47 47 47 47 41 47 47 47 36 47 45 45 45 38 40 38 40 45 34
+38 44 38 47 47 47 47 47 47 39 39 39 28 28 40 39 47 49 49 38
+36 47 38 47 47 47 47 47 47 47 47 47 49 49 49 49 49 49 47 45
+47 47 45 47 38 47 47 36 49 38 40 40 39 40 32 34 40 40 40 47
+47 47 47 47 41 47 38 34 34 34 34 34 38 41 41 47 47 47 41 47
+47 38 47 47 47 47 47 47 47 47 47 47 47 47 47 36 47 47 47 36
+45 40 32 40 40 47 38 47 47 41 41 38 44 44 38 44 44 47 44 40
+34 49 49 45 47 45 47 47 47 45 47 47 45 47 41 47 45 49 49 49
+38 41 35 45 44 45 38 45 47 49 49 38 44 38 38 38 44 38 38 45
+40 40 45 45 47 47 47 47 47 47 47 41 41 47 47 38 38 47 49 49
+49 49 32 39 28 28 45 39 34 40 40 45 45 47 49 45 49 49 49 49
+49 45 47 47 47 41 47 38 40 38 40 34 38 45 44 44 44 44 40 45
+38 47 47 38 44 40 40 44 44 47 47 47 44 44 34 34 44 44 47 47
+47 47 44 44 45 45 44 45 49 49 49 49 49 49 47 49 49 49 40 45
+38 44 34 34 44 44 40 38 40 40 45 38 47 47 47 47 47 47 47 47
+47 47 47 47 47 47 47 47 47 39 40 40 40 40 40 47 47 47 47 47
+47 49 47 47 45 47 47 47 47 47 47 47 47 38 36 49 40 40 40 47
+47 47 47 47 36 44 40 32 45 45 44 47 47 49 36 47 47 36 36 36
+38 38 38 47 47 47 47 47 41 47 47 47 47 47 36 47 41 47 36 36
+36 41 47 47 47 36 47 47 47 47 47 36 36 40 40 34 32 49 49 47
+47 36 45 45 40 47 47 47 40 39 28 28 39 39 47 47 47 47 38 38
+29 34 31 31 38 45 47 38 29 38 29 26 34 49 45 36 38 36 36 36
+36 38 29 35 40 40 38 45 36 36 47 47 47 47 47 47 36 36 36 36
+36 38 36 36 36 36 47 47 47 45 47 47 47 47 47 47 47 38 45 45
+47 47 40 44 31 44 38 38 44 47 47 47 47 41 32 35 21 21 9 9
+19 26 30 33 19 19 19 19 25 21 28 32 25 24 29 20 17 7 7 9
+ 9 7 10 9 9 9 8 10 6 6 6 6 6 6 6 6 6 6 6 6
+ 7 10 10 8 9 9 6 6 9 11 16 9 7 9 7 7 8 9 9 9
+ 8 9 10 9 9 7 9 7 9 7 9 9 9 10 7 7 9 7 10 8
+ 8 9 9 9 9 8 12 11 8 8 10 12 9 7 7 7 7 9 8 7
+ 8 9 7 7 7 9 8 9 9 10 9 9 7 11 7 9 7 9 7 7
+ 9 7 9 7 9 9 7 7 7 9 9 9 9 9 9 8 9 10 7 6
+ 9 9 9 12
+>gnl|ti|1086975892 name:1099575910860
+ 6 6 6 9 7 7 8 7 7 7 7 18 20 7 10 11 16 19 19 32
+26 14 18 14 14 14 19 19 15 14 12 14 14 12 16 23 25 25 26 31
+29 29 16 16 20 18 18 18 34 44 44 47 41 47 38 35 29 28 30 31
+29 29 29 31 38 35 34 28 29 19 25 14 14 9 9 20 20 36 47 47
+41 38 38 38 38 38 38 44 38 38 47 38 35 34 34 34 34 34 38 38
+44 44 38 44 33 33 35 35 35 38 44 47 47 47 47 38 38 44 44 38
+25 32 30 32 32 32 38 40 38 44 44 38 41 47 47 41 45 47 47 47
+47 44 44 38 44 38 44 44 38 44 44 38 34 34 34 34 34 34 44 41
+47 47 47 47 47 47 47 41 47 47 47 47 41 47 41 47 41 47 47 41
+47 41 47 47 47 47 47 41 47 35 45 38 44 44 44 41 45 47 47 44
+45 45 38 47 47 47 47 47 36 47 47 47 49 49 47 41 47 47 47 47
+47 35 38 44 38 38 44 41 47 47 47 47 38 38 47 47 47 47 47 41
+47 49 38 38 38 44 44 34 49 49 41 47 47 47 41 41 47 47 47 45
+47 41 47 47 41 41 47 47 47 41 41 41 47 47 47 47 41 49 49 49
+47 47 45 47 47 47 47 38 38 36 36 47 47 45 45 45 34 34 38 40
+47 47 47 47 47 47 41 47 47 47 41 47 47 47 41 47 47 47 41 41
+47 38 38 44 38 44 35 47 41 47 47 47 47 47 36 47 44 45 47 41
+47 47 45 47 47 47 41 47 45 49 47 47 47 47 47 47 47 41 49 36
+36 47 47 41 47 47 47 38 38 38 47 47 47 47 47 38 47 47 47 47
+47 47 41 47 45 47 41 47 47 47 47 41 47 41 47 47 47 45 40 34
+32 44 38 47 47 47 47 47 47 41 38 38 40 38 38 38 44 44 38 41
+47 47 41 47 47 41 47 47 47 41 40 45 34 40 38 47 41 47 49 49
+49 49 40 38 38 47 47 47 47 47 41 47 47 41 47 47 47 47 47 47
+47 47 47 41 47 47 47 41 47 41 47 41 47 41 47 47 47 47 41 47
+47 47 47 47 49 49 49 47 47 47 47 47 41 47 47 47 44 44 38 40
+44 44 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47
+47 47 47 41 47 47 47 47 47 47 47 41 44 44 47 49 47 47 41 38
+47 47 47 47 47 47 47 47 47 47 47 49 47 49 49 47 47 49 47 41
+41 41 36 47 49 49 49 49 49 49 47 47 47 47 47 47 49 47 47 47
+47 47 47 47 47 47 47 47 47 49 49 49 49 49 49 38 38 44 44 44
+44 49 49 47 49 45 49 49 47 49 49 47 44 38 38 38 38 38 41 49
+49 49 45 47 38 38 38 38 38 38 47 41 45 47 36 36 36 41 47 36
+47 40 40 36 36 31 38 29 29 29 31 38 38 34 25 25 35 38 34 47
+49 36 47 47 38 38 38 47 47 47 47 47 38 35 35 34 34 35 45 47
+47 47 41 47 47 47 47 47 47 47 44 38 38 44 44 44 47 47 47 47
+47 47 44 44 40 38 47 36 47 47 47 47 47 47 47 47 47 47 47 47
+45 38 40 36 47 47 47 47 47 47 38 44 38 44 44 44 31 38 38 44
+44 44 44 44 44 44 36 47 36 47 29 35 35 35 35 35 40 41 38 44
+44 45 44 44 47 47 47 47 47 36 36 47 47 29 44 44 44 44 44 49
+49 49 47 47 47 47 47 47 47 47 44 44 44 44 44 44 44 38 47 47
+49 47 44 44 38 38 44 44 45 44 44 45 44 45 47 47 47 47 47 47
+47 47 44 44 45 45 44 34 34 28 26 33 20 26 24 23 25 29 38 25
+23 7 9 9 9 18 13 19 13 9 9 10 9 8 8 7 9 13 7 8
+10 9 8 10 9 6 7 7 9 9
+>gnl|ti|1086975853 name:1099575910863
+ 6 6 9 6 6 6 6 9 9 9 7 9 11 7 8 6 7 7 8 6
+12 11 11 19 17 19 15 19 15 15 21 16 15 16 18 24 24 38 44 44
+38 38 34 16 16 21 16 21 18 35 35 34 34 35 32 27 27 25 26 25
+31 32 34 24 21 29 29 32 28 35 34 29 29 24 26 18 24 14 14 18
+39 30 38 38 44 38 35 31 32 31 32 32 34 38 38 44 47 47 47 44
+44 38 44 38 38 29 32 32 32 32 31 35 34 34 29 29 29 29 35 34
+34 38 45 44 47 47 47 47 38 44 38 38 38 38 45 38 44 44 44 44
+34 49 49 49 44 44 44 44 38 38 36 47 41 41 47 41 47 36 36 47
+38 47 47 47 38 45 44 45 35 44 47 45 47 47 47 41 47 41 44 44
+47 47 47 47 47 45 47 47 39 34 35 35 29 29 34 47 47 47 47 41
+47 41 47 47 45 47 47 36 47 38 38 44 38 44 38 38 38 47 47 38
+44 38 44 44 44 38 47 40 40 40 49 49 49 49 47 47 47 44 45 38
+40 40 45 45 47 45 47 47 41 29 32 32 35 34 34 45 47 38 39 40
+40 49 34 38 45 45 47 45 47 47 47 47 49 47 47 47 41 47 47 47
+47 47 47 41 38 36 47 47 47 38 38 34 40 34 40 38 45 45 47 47
+49 45 45 45 47 47 47 47 41 47 49 49 47 47 45 45 40 32 40 49
+36 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 45 45 32 34
+35 39 40 38 38 44 40 49 49 49 45 47 47 47 47 47 47 47 47 47
+41 47 41 47 45 45 47 38 49 49 45 49 49 45 41 47 47 38 38 47
+38 34 35 33 35 31 38 47 47 47 47 47 47 38 40 40 44 40 47 47
+49 41 47 41 47 47 41 41 47 47 47 41 47 47 47 47 47 47 47 47
+47 47 41 47 41 47 47 47 49 41 47 41 47 47 38 47 47 47 47 41
+47 47 47 47 47 47 47 45 47 41 47 49 45 45 49 47 47 47 38 47
+47 41 47 41 47 47 47 41 47 47 47 47 47 47 41 47 41 47 47 47
+44 38 40 40 44 45 38 40 40 32 45 45 38 47 47 47 47 47 47 47
+47 47 49 47 47 47 47 47 47 45 47 41 47 47 47 47 49 49 49 49
+41 45 47 47 47 47 47 47 47 47 41 47 47 47 47 47 47 47 47 47
+47 47 47 49 49 45 49 47 38 49 40 34 45 38 41 47 47 38 38 38
+44 38 38 47 49 47 47 47 47 47 47 49 49 49 49 49 45 41 47 47
+41 36 47 47 41 41 41 47 47 44 49 47 36 41 47 47 41 38 47 47
+47 47 41 36 41 36 41 36 41 36 36 36 36 47 36 41 47 36 47 47
+47 41 36 36 36 36 36 36 36 36 36 36 41 38 38 44 38 25 24 34
+34 34 35 38 36 38 47 47 38 38 41 38 36 36 47 47 36 36 38 47
+41 41 41 41 41 41 41 36 36 47 24 41 45 45 36 32 40 36 36 41
+41 36 47 38 38 38 47 47 36 41 47 36 47 36 47 47 47 47 36 47
+41 47 47 47 47 47 36 49 35 31 38 44 38 29 40 34 44 36 36 47
+24 47 36 36 36 38 38 38 38 47 36 36 47 47 36 36 47 45 45 45
+45 45 45 45 45 47 36 36 45 40 45 24 24 45 47 47 36 47 36 36
+34 35 24 29 24 19 30 21 21 18 22 9 7 7 7 7 8 12 12 8
+ 7 7 8 12 12
+>gnl|ti|1086975783 name:1099575910866
+ 6 6 6 6 6 6 7 7 8 8 12 13 13 10 9 6 6 9 14 12
+17 19 13 14 20 13 16 23 21 24 24 32 24 25 26 24 28 24 23 23
+24 25 25 25 34 34 34 21 20 20 20 24 20 22 28 20 24 30 30 45
+32 32 31 32 29 29 34 33 33 24 30 19 15 9 9 9 16 20 38 44
+38 33 35 35 44 34 34 44 38 34 34 38 38 38 38 32 31 31 32 34
+29 44 38 38 35 38 44 31 33 44 34 35 34 44 38 38 44 44 44 44
+38 44 38 44 38 44 38 38 47 47 38 45 35 44 35 33 38 38 38 38
+38 38 44 44 47 47 47 47 47 47 41 38 38 44 38 38 44 41 47 47
+44 38 40 32 38 38 47 47 47 47 47 41 47 36 47 44 38 38 38 38
+38 47 47 47 45 41 41 38 36 47 47 47 45 38 47 47 45 47 38 38
+34 38 40 44 47 47 47 41 47 47 47 47 47 45 47 45 47 41 47 47
+41 47 38 38 44 38 38 44 47 47 41 47 47 47 47 41 38 38 38 38
+34 44 47 47 47 49 49 38 47 47 47 47 38 38 44 44 38 44 41 36
+41 41 41 47 47 47 38 47 40 38 40 47 47 36 47 49 45 32 32 49
+44 41 45 47 47 47 47 47 45 45 41 47 47 41 47 47 47 47 44 38
+34 32 45 36 38 44 38 38 38 44 41 47 41 38 38 44 38 38 44 45
+49 45 49 40 40 45 45 47 47 45 47 47 47 41 47 41 47 41 44 47
+47 36 35 44 47 47 36 44 47 47 47 47 47 47 47 47 47 47 45 47
+45 49 45 47 49 49 49 47 38 38 38 38 38 44 47 36 47 47 47 47
+47 47 41 47 47 45 49 49 36 36 38 38 40 40 45 45 47 47 47 47
+47 47 47 47 47 47 41 47 47 47 47 47 45 38 38 34 32 38 44 47
+47 47 47 47 49 49 49 49 41 47 47 45 45 47 49 47 47 47 44 44
+32 34 35 44 40 44 38 47 41 47 38 38 36 34 40 40 40 47 47 45
+47 45 36 34 34 38 40 47 47 47 47 47 47 47 47 47 47 47 47 47
+41 47 47 47 47 47 41 47 47 47 47 36 47 47 47 47 41 47 49 38
+47 40 38 38 40 40 45 44 41 47 47 41 41 47 47 41 47 47 47 47
+47 47 41 47 41 47 47 41 47 47 47 47 41 38 44 44 40 44 44 49
+49 49 47 47 47 47 47 47 47 47 41 47 47 36 47 47 47 47 41 47
+47 47 47 49 41 47 47 47 47 47 47 49 47 47 41 47 47 41 47 49
+41 47 47 47 47 36 36 27 44 38 38 44 45 47 41 36 36 47 47 47
+36 41 41 41 36 36 36 47 47 47 47 47 47 47 47 47 36 47 47 36
+47 47 36 47 41 36 36 47 47 49 47 49 47 47 47 45 45 47 47 47
+41 47 36 47 47 41 41 41 41 41 36 41 41 47 47 36 24 44 45 38
+45 47 36 36 36 36 36 47 38 44 32 32 36 36 45 49 38 44 38 31
+38 29 41 36 47 41 47 47 47 47 47 38 38 44 44 38 40 44 44 44
+44 44 44 44 47 47 47 47 41 47 47 47 47 47 47 47 47 47 47 47
+47 47 47 47 45 47 38 45 45 45 45 47 47 47 47 41 47 47 47 47
+36 45 40 32 34 34 34 38 38 23 23 9 9 17 21 9 9 12 12 30
+28 38 27 17 13 10 14 10 8
+>gnl|ti|1086975786 name:1099575910869
+ 8 12 12 9 9 6 10 10 15 16 12 8 7 7 9 9 9 7 10 10
+ 8 8 7 8 9 11 12 18 12 12 10 10 12 12 17 14 18 19 16 14
+ 9 9 14 14 16 9 9 12 14 18 18 17 19 15 18 12 15 12 15 19
+19 22 15 16 11 9 14 18 27 23 26 22 22 24 22 23 22 26 25 29
+23 23 24 23 27 27 33 31 35 45 38 47 47 47 47 47 41 47 49 44
+38 29 35 27 28 30 30 27 29 39 36 38 34 34 34 30 33 33 27 27
+24 49 49 40 39 40 40 40 40 38 38 38 38 34 32 26 23 28 26 29
+29 30 31 31 33 31 38 38 44 40 40 34 45 38 44 44 44 38 38 44
+29 40 32 40 34 26 26 28 28 34 39 39 36 32 40 38 38 38 31 44
+38 45 34 40 40 32 26 32 45 33 33 38 35 29 35 40 40 28 28 28
+26 26 28 24 26 40 36 36 36 47 38 38 38 34 40 40 40 32 45 45
+49 49 49 28 23 23 40 32 40 45 45 47 47 36 40 40 27 26 26 28
+28 29 44 45 40 32 36 40 45 40 34 34 34 34 29 34 36 32 40 32
+32 40 40 45 38 47 49 49 45 32 32 28 40 40 34 32 40 32 35 32
+39 45 32 32 35 36 39 40 34 40 40 40 45 40 28 28 28 40 36 45
+36 34 40 40 32 32 40 40 45 29 34 35 29 32 26 28 28 28 45 40
+38 40 32 32 39 36 40 40 34 34 40 32 36 40 40 40 36 35 38 35
+29 29 29 32 40 36 32 49 49 28 39 23 28 32 40 40 23 28 28 32
+40 40 36 38 36 49 32 34 44 45 40 47 47 47 36 47 36 36 36 38
+40 40 35 44 44 28 30 26 28 36 40 36 47 47 40 38 32 40 28 28
+32 32 40 34 38 33 33 35 33 31 34 49 49 40 40 40 39 40 45 40
+32 45 38 36 40 47 38 47 47 47 47 38 47 38 38 32 45 38 40 34
+38 38 38 38 31 31 32 28 28 31 29 44 33 32 33 38 38 38 40 38
+47 38 38 34 34 29 28 27 24 20 27 39 27 32 40 40 40 32 28 23
+32 27 38 38 34 34 34 49 49 34 49 49 49 49 36 47 47 47 47 24
+47 47 47 47 36 47 47 47 47 47 47 24 24 44 38 38 38 47 47 45
+38 38 36 49 40 32 40 39 47 47 49 36 36 45 44 40 40 44 38 24
+47 47 47 47 36 36 36 47 47 49 49 49 49 32 49 49 49 49 49 38
+38 44 31 29 26 28 45 36 34 24 36 24 24 36 36 40 28 28 40 45
+36 47 36 49 49 47 38 27 24 23 38 19 19 24 24 44 44 49 49 47
+47 47 47 47 47 24 36 24 45 24 49 36 36 28 28 39 36 36 36 24
+38 44 35 38 38 29 29 26 24 23 24 39 24 38 40 34 24 36 24 24
+36 24 40 24 24 36 28 27 45 32 38 31 27 29 24 23 24 28 28 24
+29 24 33 24 30 27 30 24 25 30 19 19 32 24 40 40 32 24 23 23
+32 28 24 24 24 38 49 40 24 24 34 24 32 29 44 24 31 29 33 33
+24 19 19 29 23 28 32 26 18 11 18 15 24 24 19 19 13 13 11 18
+19 24 24 39 28 28 23 28 32 24 39 24 20 21 28 24 19 19 24 16
+20 14 11 19 18 21 23 19 19 19 19 22 24 20 22 22 24 34 35 35
+44 45 49 49 36 45 24 28 23 18 10 12 12 17 16 16 16 14 19 30
+28 25 23 23 18 14 16 25 21 13 16 7 7 7 7 9 13 13 9 7
+ 7 7 7 17 17 24 18 12 8 7 7 10 10 6 6 6 9 7 7 7
+ 7 16 8 13 13 29 27 14 11 11 17 12 9 9 8 8 7 7 14 14
+ 9 7 7 6 6 7
+>gnl|ti|1086975903 name:1099575910882
+ 6 7 7 6 7 7 6 6 6 6 9 9 7 7 6 6 8 6 6 8
+11 12 13 13 13 13 18 12 8 8 10 10 10 14 24 47 18 19 14 16
+17 14 22 40 24 40 19 19 28 26 29 23 35 27 29 28 29 29 34 38
+31 29 28 29 28 29 20 22 12 11 12 9 10 9 9 10 8 7 7 7
+13 10 12 12 14 21 27 40 32 23 23 28 21 21 20 27 27 23 24 35
+38 29 38 40 32 29 22 22 11 11 9 9 9 9 12 13 20 9 14 14
+12 9 10 9 9 11 12 13 9 9 9 11 9 9 9 12 14 14 21 13
+ 9 15 12 13 11 14 9 9 15 17 23 23 28 32 39 28 29 29 19 19
+17 25 27 23 20 18 25 20 21 28 28 28 28 25 23 23 23 28 25 23
+28 23 19 19 19 27 25 25 23 20 10 13 9 13 20 23 32 49 27 27
+27 27 27 49 27 32 32 28 28 40 28 32 45 45 36 32 40 28 25 28
+19 17 22 21 19 18 22 18 23 23 23 23 27 17 18 18 24 32 29 32
+28 28 40 28 28 32 21 24 29 29 27 21 27 27 27 23 21 17 22 22
+27 27 27 35 29 28 28 28 24 28 28 40 34 49 40 40 28 28 25 21
+21 17 23 23 27 29 40 23 23 25 23 19 28 39 26 25 30 23 23 27
+28 34 35 34 29 29 28 28 32 39 28 23 25 29 27 28 40 40 32 28
+23 27 27 27 27 28 28 40 40 34 22 22 13 15 14 22 26 23 23 28
+28 28 40 40 32 32 32 28 23 21 19 25 40 29 29 40 28 21 23 23
+26 26 29 29 39 19 19 27 29 39 40 32 28 49 49 49 44 38 31 38
+38 29 40 28 32 40 28 20 21 45 28 28 40 28 28 28 40 36 40 40
+40 40 40 40 36 38 49 40 40 36 36 40 47 40 36 36 32 40 36 38
+38 47 38 45 36 40 45 45 47 49 49 38 36 34 34 34 40 40 45 32
+32 28 28 28 27 23 39 40 34 38 35 35 38 38 44 38 31 29 28 28
+35 35 38 38 38 49 49 32 34 40 34 40 40 40 38 40 40 28 28 28
+28 40 40 40 36 45 40 40 32 28 28 36 39 44 34 35 34 29 24 32
+28 32 40 40 40 24 26 26 24 32 29 28 28 32 40 40 40 36 38 36
+36 40 40 40 40 45 36 36 36 36 38 38 40 32 40 40 32 40 38 39
+36 36 32 40 36 35 28 32 40 32 34 40 32 49 49 49 49 49 40 34
+39 40 28 26 24 32 38 30 30 40 40 36 34 44 34 30 30 24 24 38
+38 49 49 49 36 34 34 24 40 45 40 40 36 49 40 32 40 45 36 34
+32 49 40 24 23 23 21 19 19 19 19 19 19 39 40 32 49 49 27 27
+49 23 24 35 44 34 35 34 32 24 25 27 49 23 24 27 27 28 24 45
+45 24 40 24 31 35 23 24 27 32 25 40 32 40 24 24 40 40 36 32
+24 24 36 24 20 17 8 8 14 18 22 36 24 23 23 24 24 24 28 32
+28 23 24 28 28 23 23 24 29 21 14 13 16 12 15 9 9 15 15 26
+26 20 26 32 24 19 28 19 27 33 35 34 34 23 36 32 32 27 16 9
+ 9 12 22 14 23 40 32 24 24 40 24 36 28 19 9 9 7 9 12 12
+15 22 24 24 26 17 23 23 24 23 25 13 11 14 9 9 16 14 14 13
+13 13 16 19 11 9 9 13 9 11 23 17 20 12 12 7 7 13 10 8
+ 7 6 7 9 9 14 14 16 12 8 10 8 9 16
+>gnl|ti|1086975846 name:1099575910887
+ 6 6 6 7 9 6 6 7 7 7 11 7 7 7 8 12 12 12 12 12
+12 12 14 17 14 17 14 15 15 18 21 31 21 26 21 23 34 16 14 14
+14 14 15 18 24 23 20 34 34 35 40 44 47 47 47 47 47 47 49 38
+38 44 35 35 42 36 47 42 44 38 44 24 35 27 24 20 16 14 8 12
+14 22 21 24 29 40 29 29 35 32 29 31 47 44 38 38 38 44 42 35
+35 31 31 32 31 29 34 47 47 47 47 47 47 47 47 47 45 36 39 23
+28 39 39 26 34 34 35 35 35 44 38 38 44 44 44 44 44 44 44 40
+44 38 38 44 38 44 41 41 47 38 44 44 38 35 34 34 35 35 35 35
+44 47 47 47 47 47 41 47 47 47 47 47 47 47 45 38 29 29 35 35
+34 34 49 45 41 41 47 47 47 47 41 47 41 47 41 47 41 47 47 47
+47 47 47 41 47 47 41 47 47 47 41 47 47 47 36 47 49 38 29 38
+38 44 34 38 44 44 41 47 47 47 36 47 49 44 40 32 40 38 47 47
+44 44 44 45 38 44 41 47 41 47 41 41 47 47 47 41 41 47 47 47
+41 47 47 47 47 47 47 38 47 47 36 47 47 47 47 45 47 47 47 47
+45 49 49 47 38 38 38 44 34 44 47 47 41 38 44 44 38 44 38 47
+47 47 47 47 47 47 41 47 47 36 41 41 47 47 41 47 47 47 49 49
+47 45 47 47 47 41 41 47 47 47 45 47 47 47 45 47 47 47 45 47
+41 47 41 49 49 45 41 47 47 41 36 47 47 47 47 45 47 47 45 47
+47 47 47 41 47 47 38 38 29 38 38 44 34 44 41 47 47 41 47 47
+41 47 47 47 47 47 41 47 47 47 45 45 49 34 38 45 47 47 47 47
+47 47 47 47 38 35 34 34 35 34 44 47 47 45 47 47 41 41 45 49
+49 40 47 47 47 47 47 47 47 47 47 45 47 45 47 47 41 47 47 49
+47 49 47 49 45 49 49 47 41 41 47 47 47 47 47 41 47 47 47 47
+47 47 47 47 47 44 38 32 40 40 40 47 38 45 45 45 47 47 38 47
+47 47 41 47 47 41 45 47 49 49 45 44 40 40 38 38 41 47 47 41
+38 44 40 45 44 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47
+47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47
+36 47 47 47 47 41 36 38 44 29 38 44 44 49 49 38 44 38 38 38
+44 47 36 47 47 47 47 47 49 41 47 47 45 47 47 41 47 47 47 49
+49 38 49 47 47 47 47 47 47 47 47 47 47 47 47 47 47 36 47 41
+41 41 47 41 47 36 47 36 36 41 49 49 49 36 36 47 47 47 36 36
+36 36 47 36 38 49 49 45 36 47 36 36 47 38 49 49 49 36 36 38
+36 36 47 47 49 49 47 47 47 47 47 47 47 49 49 49 49 49 47 49
+49 49 49 40 34 38 40 38 38 38 40 44 44 47 47 47 47 36 47 47
+47 47 45 38 47 47 47 47 47 47 47 47 41 47 47 47 49 49 49 49
+45 47 45 47 47 47 47 49 49 47 47 47 47 47 47 38 45 44 35 44
+47 44 44 44 44 47 47 47 47 47 47 47 47 47 47 41 47 47 47 47
+47 49 47 45 45 47 41 41 47 47 47 47 47 47 47 47 47 47 49 49
+47 47 47 47 47 47 47 47 47 47 47 45 44 35 35 40 44 44 44 44
+44 44 44 47 47 47 47 47 44 44 45 40 38 38 47 44 47 47 47 47
+45 45 20 20 45 20 21 9 9 27 20 32 45 40 47 47 44 47 29 26
+24 25 25 22 19 12 9 9 9 10 16 17 15 10 10 6 6 13 14
+>gnl|ti|1086975854 name:1099575910893
+ 7 9 11 7 9 11 9 7 8 7 7 7 7 12 14 18 18 9 9 10
+ 8 8 9 17 17 13 18 13 13 13 19 21 19 23 23 24 15 14 20 17
+15 12 21 21 21 21 21 23 29 29 21 21 24 22 21 25 21 21 23 27
+26 26 35 33 33 33 31 23 23 16 16 9 9 9 7 7 7 12 11 10
+18 20 27 28 38 44 44 44 38 44 38 38 38 44 33 33 32 31 33 33
+44 31 29 23 23 21 20 28 28 32 40 19 14 10 9 7 10 7 9 11
+19 26 29 29 38 44 47 47 47 44 44 44 44 44 44 38 44 44 44 44
+44 47 47 45 47 38 47 47 40 39 26 28 30 33 33 32 38 44 38 44
+44 38 38 35 25 38 38 44 38 34 45 32 28 28 40 40 45 47 38 38
+44 38 38 38 36 36 20 15 12 12 9 9 9 20 23 40 40 34 29 29
+38 44 38 44 47 49 49 38 35 34 38 38 38 38 47 36 47 47 49 44
+29 34 34 34 34 34 32 35 34 38 38 38 44 45 47 38 36 49 36 49
+36 49 36 38 35 35 44 44 44 47 47 38 36 41 47 41 41 44 40 34
+40 34 38 40 36 40 35 35 29 34 34 38 40 38 40 40 36 40 40 28
+28 28 39 40 40 40 36 39 40 32 34 40 34 38 38 47 47 47 47 45
+47 47 47 47 47 38 38 32 38 40 47 47 47 49 36 36 32 28 36 40
+47 38 38 47 47 47 47 41 47 47 47 36 47 47 47 41 47 45 47 45
+47 49 45 47 47 47 47 41 45 47 47 47 47 38 38 32 40 38 40 36
+49 41 47 47 47 40 39 34 34 34 35 29 34 45 38 40 40 44 49 47
+49 49 41 47 41 38 45 39 40 35 32 40 45 40 40 40 36 40 38 40
+40 40 40 40 40 32 49 49 32 36 45 38 34 35 38 38 38 38 38 40
+34 44 40 38 40 40 34 40 40 45 34 40 32 32 40 36 39 38 32 32
+40 40 40 40 34 32 45 40 34 40 38 40 47 45 38 40 32 32 32 49
+49 49 49 44 40 32 28 23 25 40 40 45 45 47 30 28 26 26 28 29
+36 47 47 47 47 47 49 41 47 47 47 47 47 49 47 47 41 47 47 47
+45 47 47 45 36 47 36 40 40 49 49 49 49 40 40 32 28 28 40 39
+47 47 44 45 40 32 38 38 34 35 38 38 36 47 47 47 40 40 32 32
+39 28 28 39 40 47 47 47 45 49 49 49 47 47 38 47 36 47 38 47
+47 47 47 47 47 47 47 47 36 40 34 32 49 45 40 40 45 40 47 47
+47 47 47 47 47 47 41 47 38 47 49 49 49 49 49 49 49 44 44 38
+40 27 44 36 24 40 40 40 40 24 40 24 24 36 36 24 24 24 38 38
+36 36 47 41 49 41 36 36 41 36 47 47 47 47 24 45 38 45 40 40
+36 40 38 36 24 24 24 24 39 40 36 36 32 24 49 36 19 21 21 28
+27 24 38 36 23 23 23 23 19 31 36 40 28 32 36 24 24 24 24 36
+36 36 47 36 45 35 32 40 23 23 29 23 38 35 36 38 40 47 24 36
+23 23 28 32 40 36 47 36 24 19 19 19 19 23 38 24 19 19 19 19
+23 26 45 47 36 36 24 23 36 24 47 24 36 36 19 19 30 19 30 19
+35 38 24 36 36 29 34 29 34 34 24 31 29 41 36 45 49 36 36 24
+27 23 23 24 24 27 40 32 39 28 28 27 29 23 19 29 19 23 14 24
+ 7 11 16 23 23 19 17 13 17 19 21 18 17 17 20 9 9 8 8 12
+13 30 23 24 21 26 24 21 23 23 17 13 15 17 13 12 7 8 7 9
+ 7 9 12 16 18 18 13 13 19 19 19 24 19 10 13 9 13 12 12 13
+11 7 9 8 9 8 7 9 7 9 7 9 9 9 6 6 10
+>gnl|ti|1086975900 name:1099575910896
+ 6 6 6 7 7 7 7 7 8 12 15 12 12 12 12 12 12 12 16 21
+23 27 34 35 23 27 23 23 21 25 40 40 45 33 27 30 18 23 18 18
+23 20 27 25 26 30 27 26 21 26 24 27 34 18 18 19 17 16 16 23
+20 21 23 28 21 25 34 34 38 38 24 20 9 9 9 9 7 10 8 13
+14 18 21 17 25 25 33 40 40 44 29 32 32 26 30 30 40 47 44 45
+45 44 44 44 47 49 49 41 38 44 31 44 28 23 23 18 17 17 23 23
+44 38 38 38 38 44 49 49 49 49 36 38 47 47 47 44 38 38 29 29
+29 40 36 45 45 47 45 35 34 35 32 32 26 45 49 49 47 47 47 47
+38 47 47 47 41 47 41 47 38 38 38 38 33 35 34 34 35 33 44 38
+35 35 36 40 47 47 45 47 47 38 38 44 29 29 29 40 47 38 45 38
+40 40 40 40 45 40 32 45 32 49 36 47 47 41 47 41 47 38 45 47
+47 41 41 47 47 45 45 47 47 41 47 47 47 47 47 47 49 45 47 47
+47 45 47 40 44 40 36 40 47 47 47 47 49 47 47 49 45 47 47 47
+47 47 47 36 47 47 47 49 47 45 47 47 45 36 32 28 28 28 45 40
+47 47 49 49 45 45 49 38 38 44 44 38 44 47 45 45 45 40 47 47
+47 49 38 34 44 44 45 38 47 47 47 45 47 47 47 47 47 47 47 44
+38 47 38 31 38 38 38 44 45 41 38 44 44 38 38 38 38 38 40 40
+28 49 39 47 47 47 47 47 47 47 49 47 47 47 45 41 47 47 41 47
+38 47 47 47 47 47 47 38 47 47 49 49 47 47 47 41 47 47 41 47
+47 47 38 45 44 47 47 47 47 47 47 47 47 38 44 34 40 40 49 23
+23 39 40 47 47 47 39 29 26 28 28 31 29 45 40 47 47 47 47 49
+47 45 47 47 47 47 47 47 47 38 38 38 38 45 38 47 47 38 47 47
+47 47 49 38 47 47 47 47 47 38 45 40 40 45 45 47 47 47 47 45
+38 47 47 47 47 47 47 47 36 47 49 45 49 47 47 36 47 38 38 44
+38 38 44 47 47 47 47 47 45 40 40 34 38 40 47 47 47 47 47 47
+47 47 47 47 47 38 40 34 38 44 36 47 41 47 47 47 45 38 40 27
+30 19 19 39 39 47 27 24 11 12 24 24 24 12 14 27 27 39 28 28
+39 32 34 38 44 30 26 12 15 9 9 11 14 19 28 28 28 45 45
+>gnl|ti|1086975910 name:1099575910900
+ 9 8 6 6 6 6 6 6 6 6 8 12 8 8 6 6 6 7 10 14
+34 34 47 26 24 24 24 24 26 29 34 35 38 47 47 38 35 31 33 33
+24 32 27 27 27 24 30 31 32 29 38 44 44 44 47 40 44 35 34 34
+35 40 47 44 44 38 35 35 34 23 27 20 11 11 7 7 9 9 15 17
+22 22 24 30 47 38 24 29 34 34 35 38 36 29 44 38 32 26 26 32
+32 31 38 40 38 38 47 47 47 47 38 39 23 27 27 17 20 21 27 32
+38 44 35 35 47 47 47 49 49 47 38 35 34 35 34 34 34 44 38 38
+38 47 47 38 44 36 47 47 38 38 38 38 34 34 35 44 36 47 47 41
+47 36 49 49 47 47 44 47 31 38 38 31 38 44 47 47 47 41 47 47
+47 47 45 41 41 29 31 26 28 29 21 49 30 26 26 32 32 34 47 41
+49 47 40 32 27 21 23 28 27 44 38 29 40 40 38 36 45 49 47 47
+47 47 44 38 38 38 38 34 40 34 31 40 45 44 38 38 49 49 49 49
+47 38 47 47 47 47 47 49 49 45 47 47 47 45 44 40 47 47 47 45
+45 49 49 49 49 49 49 36 47 47 39 40 45 40 36 39 40 40 44 44
+44 44 38 34 38 49 49 47 45 49 45 47 47 47 41 47 47 47 41 38
+38 38 44 38 38 47 47 47 47 44 45 38 36 36 40 32 32 38 44 49
+45 38 38 38 34 34 34 40 36 49 49 49 34 49 49 39 36 39 40 32
+28 40 40 36 47 47 47 47 47 47 47 47 47 47 41 47 41 45 49 47
+45 47 47 47 47 47 45 36 36 38 38 44 44 44 35 38 38 35 35 44
+38 38 44 38 38 38 38 47 47 41 38 40 34 45 40 47 47 41 41 49
+49 45 47 47 38 40 40 28 28 28 39 39 47 49 49 36 49 47 38 38
+38 47 47 40 47 47 47 45 38 36 47 47 47 49 47 47 47 41 41 47
+47 47 49 49 47 47 47 47 47 47 47 47 47 41 47 47 47 47 47 47
+47 47 47 41 38 47 38 38 45 45 40 28 28 39 40 47 47 47 44 40
+40 40 49 38 47 47 47 40 44 32 40 40 38 47 47 47 47 47 47 44
+38 34 44 40 47 47 47 47 47 47 47 41 38 40 49 49 45 38 47 47
+47 47 47 47 47 45 44 38 45 49 49 20 20 30 27 44 38 38 45 49
+20 20 8 13 20 9 10 39 45 45 47 47 47 47 47 38 35 34 34 34
+34 34 34 19 12 9 6
+>gnl|ti|1086975879 name:1099575910903
+ 6 6 6 6 6 6 10 8 12 7 7 7 12 12 12 13 12 12 14 19
+19 23 19 27 27 18 21 10 10 40 17 17 21 21 24 25 30 28 35 34
+32 32 32 31 31 29 38 30 27 26 30 25 25 34 34 44 35 38 44 47
+47 38 45 34 25 35 44 38 38 30 39 14 12 9 16 9 13 22 23 36
+36 47 47 45 44 44 44 44 38 34 34 29 29 27 30 25 25 44 45 47
+47 47 49 47 47 47 47 36 40 39 32 40 32 23 23 25 27 35 29 49
+49 44 38 38 38 31 38 44 38 44 44 49 49 49 49 47 45 40 45 34
+40 45 40 44 34 32 38 40 47 38 44 38 47 41 47 47 47 47 47 47
+47 47 47 45 44 35 34 34 34 29 44 34 31 31 28 28 40 34 44 44
+44 38 44 41 47 47 41 47 47 47 47 47 38 38 36 44 35 35 44 31
+44 34 38 44 38 47 47 47 47 38 40 32 49 45 45 47 34 38 44 38
+44 35 47 45 40 40 49 49 49 41 44 44 31 38 34 34 44 38 38 44
+45 47 49 47 47 47 41 47 36 47 38 38 32 32 45 45 47 41 41 38
+38 40 34 40 44 45 45 45 40 32 40 36 47 47 47 47 47 36 47 38
+45 34 40 49 38 38 45 34 34 26 28 32 26 24 32 32 38 47 47 47
+38 40 32 23 20 20 30 28 44 34 29 40 40 47 40 44 36 47 47 38
+38 38 47 38 40 40 45 49 49 45 45 47 47 47 47 41 47 45 47 47
+47 47 41 41 47 49 49 49 41 45 41 38 38 44 31 38 38 49 49 49
+49 38 49 49 47 45 38 38 38 34 34 34 40 36 45 40 47 47 47 47
+45 45 36 38 45 47 47 47 47 41 47 47 41 49 41 41 47 47 47 47
+38 47 38 47 47 47 47 41 45 47 47 47 38 38 40 47 47 47 49 49
+47 47 47 45 40 34 40 36 49 49 49 49 49 49 45 49 49 49 49 28
+36 49 49 47 41 47 47 47 47 47 47 47 47 47 47 47 45 49 49 49
+45 41 38 45 47 47 41 47 47 47 41 47 38 47 40 40 32 36 45 47
+38 44 38 44 44 45 47 47 49 45 47 47 47 47 47 41 47 49 49 47
+47 47 41 45 40 32 28 28 28 39 39 47 49 38 49 49 47 49 38 40
+34 38 39 45 45 40 34 40 40 47 40 30 49 19 19 29 29 40 40 40
+34 44 29 15 14 9
+>gnl|ti|1086975908 name:1099575910912
+ 8 6 6 6 7 6 6 6 6 10 10 12 11 11 9 8 7 9 15 14
+11 9 10 8 8 12 15 19 16 22 22 15 17 19 22 23 28 26 17 13
+14 7 7 9 12 18 24 22 23 24 12 18 18 26 27 29 29 38 33 24
+26 31 29 28 25 36 36 40 34 34 30 23 19 14 17 9 14 12 12 7
+ 7 15 12 23 24 21 21 21 28 23 25 26 23 30 19 33 30 33 30 32
+32 31 33 30 38 38 44 47 47 47 47 49 49 36 47 36 27 27 21 20
+20 22 40 47 47 40 44 45 41 47 47 44 29 38 38 38 44 38 44 34
+34 38 34 44 40 47 38 40 40 36 40 38 38 36 36 32 19 32 29 32
+32 45 36 49 36 47 49 49 38 47 47 38 31 24 29 30 29 28 24 29
+40 40 34 34 26 26 28 26 29 36 39 47 41 47 38 38 34 35 34 34
+40 40 34 34 38 24 25 31 28 24 23 24 25 28 29 45 39 40 35 35
+40 40 47 41 47 39 40 28 28 49 32 40 40 39 40 40 36 40 40 40
+45 40 39 32 28 28 36 40 38 40 47 47 38 38 38 44 38 44 24 45
+32 40 32 39 40 47 47 47 45 40 29 18 18 18 30 24 34 34 38 45
+32 23 22 25 22 19 17 29 27 34 45 39 40 38 38 38 34 35 35 47
+36 38 40 49 38 36 38 32 26 23 27 21 21 29 28 29 49 45 49 49
+45 34 32 40 38 44 38 23 23 28 23 22 21 20 24 24 16 18 27 27
+22 22 19 20 22 22 38 44 38 29 38 49 49 34 49 34 34 40 32 36
+29 39 23 23 18 25 19 34 34 24 38 19 29 29 35 19 19 36 39 32
+32 28 28 40 40 40 32 28 23 40 32 40 34 38 38 38 38 36 32 34
+36 38 34 29 29 26 24 28 24 25 16 25 23 49 32 24 23 23 23 21
+21 24 20 24 19 32 24 32 36 36 36 24 40 28 28 28 23 28 32 40
+32 40 34 28 28 24 24 16 16 24 23 36 28 28 32 40 20 23 26 23
+26 29 32 40 32 36 32 40 40 34 24 29 26 20 18 12 10 10 18 18
+28 32 32 34 38 36 36 28 28 29 19 19 24 23 20 20 24 28 24 23
+26 23 20 20 21 26 23 23 26 22 27 20 24 14 20 20 25 20 21 24
+24 26 22 23 18 19 19 21 15 12 13 10 10 12 22
+>gnl|ti|1086975826 name:1099575910916
+ 8 6 6 6 6 6 6 6 6 8 8 7 7 7 12 15 19 21 19 19
+12 13 9 9 9 9 12 12 23 29 29 29 23 21 19 29 31 26 31 31
+31 29 31 27 30 27 34 34 44 47 44 38 35 35 25 25 27 26 27 32
+32 31 32 32 31 44 40 31 29 30 22 18 19 17 17 13 9 19 22 25
+25 26 25 28 27 29 26 28 34 34 34 35 40 47 47 41 47 34 34 34
+32 26 31 44 44 38 38 41 38 38 44 34 24 27 26 26 30 30 47 34
+35 44 38 38 44 44 44 44 38 47 36 47 47 47 47 41 32 32 32 32
+32 32 47 49 41 47 47 47 47 47 47 47 47 47 47 38 38 34 40 40
+44 38 47 41 44 38 44 38 38 38 49 49 45 49 44 38 44 38 45 44
+44 45 47 47 47 47 41 47 47 36 47 47 45 38 47 47 47 36 47 47
+47 47 47 47 47 41 38 44 44 38 44 38 47 38 38 47 47 49 49 49
+49 45 45 49 34 35 35 45 44 38 41 41 38 38 44 38 34 38 35 44
+38 38 38 34 36 45 47 47 47 47 45 36 27 26 24 30 28 38 41 36
+41 47 44 29 27 30 20 20 45 45 47 47 49 49 45 47 38 44 44 44
+34 38 49 47 41 47 47 47 44 44 44 44 44 35 44 29 38 38 38 44
+38 41 47 47 47 41 47 47 38 44 38 38 38 44 40 36 32 32 32 45
+39 40 35 40 32 40 38 47 47 47 47 49 45 49 45 47 41 47 47 47
+47 36 47 38 40 38 38 38 38 38 44 47 47 38 38 38 47 41 47 41
+45 38 40 34 40 39 45 40 34 38 38 47 45 38 44 44 44 38 44 38
+47 47 47 47 47 47 47 47 47 38 45 38 40 40 49 49 49 47 47 47
+47 47 38 38 38 44 44 38 49 45 49 41 47 47 47 47 47 36 38 44
+44 38 44 38 47 47 39 45 28 28 45 45 47 45 47 47 47 47 47 47
+47 47 45 44 38 44 45 44 41 47 47 47 47 47 36 38 38 35 29 38
+38 47 47 47 47 47 45 41 47 47 41 47 45 49 49 45 49 49 49 49
+47 47 47 47 40 38 40 40 38 40 47 49 49 40 38 40 45 34 34 40
+49 40 34 24 18 11 11 18 18 16 28 28 28 40 45
+>gnl|ti|1086975775 name:1099575910920
+ 6 6 12 6 6 6 7 7 8 7 6 8 9 23 21 19 23 31 23 28
+25 29 21 23 35 31 47 34 22 24 18 18 19 21 25 23 21 32 44 38
+47 45 40 34 19 29 34 34 23 34 31 29 18 18 24 26 32 34 44 47
+36 38 34 33 33 25 25 23 24 27 35 24 22 24 13 13 23 24 24 24
+24 33 33 34 35 33 33 30 30 33 29 32 31 29 33 30 30 32 32 40
+41 41 41 41 47 47 47 47 33 33 33 22 22 24 40 45 40 47 47 47
+36 40 38 32 32 26 26 32 32 44 34 34 44 44 38 44 44 34 34 34
+32 40 40 47 47 47 36 32 32 26 32 26 32 47 45 45 32 34 38 40
+47 47 47 41 47 47 39 36 40 40 32 39 45 47 47 41 39 36 40 40
+34 39 40 47 41 44 38 38 38 44 44 44 45 47 47 45 45 45 45 36
+32 45 36 45 39 47 47 38 38 44 40 40 44 38 47 47 41 36 40 40
+38 49 40 40 38 32 40 40 32 36 32 32 49 36 32 28 29 29 34 34
+44 40 40 45 38 38 40 40 44 45 38 38 34 40 40 40 40 40 45 38
+45 45 29 25 21 21 39 36 47 41 41 41 47 38 27 23 24 18 18 39
+45 41 41 47 45 47 47 47 47 36 44 40 38 38 47 47 47 47 38 38
+44 45 45 45 34 40 40 40 45 49 49 49 45 49 49 49 49 49 47 38
+38 38 38 38 38 40 32 28 28 28 40 39 40 28 28 28 28 28 38 44
+38 44 49 45 49 36 44 40 47 47 47 47 38 44 34 40 35 35 29 38
+38 38 49 40 40 36 38 40 38 47 47 40 39 28 28 40 40 40 40 28
+28 40 40 47 38 40 40 39 40 34 40 44 49 47 47 45 45 40 38 38
+40 32 49 49 49 49 45 49 49 49 49 47 47 47 47 47 41 44 44 49
+49 49 49 47 49 49 45 40 40 38 38 47 47 47 47 47 44 39 40 28
+28 40 45 45 45 45 18 18 39 39 47 47 44 27 49 11 11 20 11 14
+39 29 36 39 32 32 40 40 39 29 18 16 9 10 16 20 16 28 28 28
+45 45
+>gnl|ti|1086975796 name:1099575910923
+ 8 6 6 6 7 6 6 8 7 7 7 12 13 12 12 12 20 12 16 19
+16 16 16 30 16 16 16 18 19 19 21 23 14 12 12 14 14 14 23 21
+25 25 29 21 21 27 21 22 24 25 25 27 25 35 25 30 30 30 26 27
+47 47 25 23 27 26 27 23 33 35 23 22 22 12 16 11 13 20 19 30
+30 44 47 26 26 29 34 33 31 44 47 49 49 44 38 38 40 44 44 40
+40 32 44 38 47 41 38 38 38 32 32 32 32 32 32 39 38 40 34 38
+45 47 47 47 47 47 47 41 36 47 38 47 31 44 44 38 38 38 34 40
+44 47 41 47 41 47 47 47 47 47 47 47 47 38 38 38 44 44 38 45
+38 36 47 45 49 47 47 38 44 44 44 38 44 47 38 47 47 47 47 47
+47 47 38 40 40 40 40 45 36 44 44 31 31 28 28 29 29 34 34 29
+47 40 39 40 40 38 49 47 47 47 47 47 47 47 47 38 44 38 44 38
+38 44 44 31 38 47 47 47 47 49 38 47 40 38 36 40 44 34 38 38
+38 35 47 47 41 47 47 38 47 47 36 44 49 49 47 47 47 38 47 41
+41 38 44 44 40 44 38 40 40 40 38 44 47 41 49 49 49 34 38 38
+44 44 45 32 40 45 38 47 47 38 38 29 35 45 35 34 40 40 40 45
+40 38 40 36 40 47 47 47 47 47 47 47 49 49 49 49 47 38 47 41
+47 47 47 49 38 44 38 40 40 44 38 36 47 47 38 38 45 34 35 34
+40 39 47 47 47 47 44 47 47 45 47 47 47 38 47 47 47 41 47 47
+47 47 38 45 36 40 38 44 44 38 38 47 41 47 47 45 49 49 27 27
+45 27 49 49 49 38 44 38 29 26 20 23 40 40 49 49 49 49 49 49
+26 26 17 17 10 10 17 18 20 28 28 28 45 45
+>gnl|ti|1086975839 name:1099575910925
+ 6 6 6 6 6 6 6 7 8 8 7 7 18 12 12 12 10 10 8 10
+ 8 10 12 13 17 11 18 18 19 19 23 18 14 16 17 14 13 18 17 19
+18 17 21 21 24 18 44 38 27 38 44 35 45 45 36 36 29 21 27 21
+23 24 19 29 23 29 32 26 30 27 27 27 44 38 36 40 26 24 19 19
+21 25 26 26 28 28 38 38 38 44 38 44 34 38 38 38 44 35 35 34
+38 29 29 29 29 31 26 38 47 41 47 47 36 32 26 32 32 26 27 49
+36 36 45 45 47 41 41 47 47 38 38 47 47 40 38 34 40 44 38 47
+47 47 47 38 38 38 38 38 34 34 34 35 35 38 38 47 47 47 47 41
+47 47 49 49 38 38 38 44 38 44 44 45 49 45 47 47 47 47 40 44
+40 36 36 49 49 49 45 36 49 49 40 40 40 34 38 38 47 47 47 47
+47 47 41 47 47 38 38 49 47 45 38 40 40 40 40 32 45 40 40 32
+49 49 40 47 41 47 47 47 47 47 47 49 49 49 47 36 47 47 47 47
+38 47 47 49 49 49 38 34 38 40 45 36 47 38 40 40 40 36 45 40
+40 34 49 49 49 32 28 28 45 45 45 40 40 40 23 25 28 28 39 32
+28 32 27 49 27 28 36 49 47 47 47 38 47 47 38 38 44 38 44 34
+35 38 44 47 47 47 36 45 49 49 38 40 40 40 32 40 36 40 40 40
+44 47 47 47 47 47 47 38 47 38 47 47 47 49 49 40 32 32 39 40
+34 38 40 38 41 45 45 32 28 32 32 40 36 38 36 49 49 49 34 40
+38 38 39 45 32 35 40 45 45 45 45 34 40 40 40 40 40 34 34 34
+34 29 34 40 40 34 38 45 47 38 47 38 36 40 49 49 49 49 45 36
+49 36 36 44 38 41 45 40 28 40 40 45 47 36 47 49 40 39 32 28
+28 36 45 47 40 45 34 34 40 45 45 47 47 49 49 49 36 49 34 45
+45 38 34 40 45 45 47 47 47 47 41 36 47 36 40 40 32 24 29 20
+20 45 45 32 28 14 11 9 6 9 9 10 13 23 27 34 36 34 32 34
+49 36 32 24 21 13 22 21 24 17 23 24 26 26 35
+>gnl|ti|1086975916 name:1099575910926
+ 6 6 6 6 6 6 6 6 6 8 8 12 10 8 7 12 12 14 18 17
+17 19 29 24 21 24 19 21 28 21 25 23 21 25 25 23 44 44 44 25
+17 16 23 18 23 21 23 29 24 34 34 34 27 25 33 33 33 29 44 44
+44 44 44 38 38 44 38 44 27 14 11 7 9 8 7 6 6 7 11 10
+17 13 16 28 22 45 44 44 45 47 44 35 34 34 34 35 38 35 38 38
+47 47 47 47 47 49 49 44 44 35 33 19 25 13 12 9 9 16 24 30
+31 38 45 35 44 44 38 38 47 47 40 44 39 32 32 26 29 33 26 32
+32 38 38 44 44 44 44 36 45 47 38 44 35 38 38 47 47 41 47 47
+47 47 47 47 47 45 47 47 47 38 35 38 38 44 38 47 44 47 47 47
+47 41 47 47 41 47 45 40 34 40 44 44 36 38 38 38 38 38 44 47
+45 45 40 45 38 47 47 38 49 45 45 38 38 38 35 34 34 31 38 38
+44 44 36 40 47 36 47 47 47 47 47 47 47 47 41 41 44 38 38 44
+44 44 45 47 45 45 47 47 38 38 49 49 49 45 49 47 47 47 47 47
+47 47 47 41 47 47 47 38 47 47 38 41 47 47 47 47 47 47 47 47
+47 38 44 34 34 38 45 47 47 41 47 41 47 47 47 47 47 47 38 38
+45 49 38 38 47 47 47 47 47 47 38 47 47 47 47 47 47 47 47 47
+47 38 45 40 34 45 45 38 47 36 47 47 47 47 47 47 47 47 47 47
+47 47 47 49 49 49 45 45 45 45 38 47 49 47 47 41 47 47 47 47
+47 45 36 34 28 32 40 39 47 36 38 38 44 44 44 44 47 45 45 45
+34 49 49 49 49 47 47 36 47 36 47 41 49 49 49 45 47 47 47 47
+47 38 47 47 47 47 41 47 47 41 41 47 49 47 47 47 41 47 47 41
+41 38 38 44 38 38 38 38 40 40 40 45 38 44 38 38 44 38 47 47
+41 47 47 47 47 47 38 38 38 38 38 44 49 49 38 47 47 47 38 47
+47 47 49 49 49 45 45 49 49 34 45 49 47 47 47 38 44 44 35 34
+38 45 45 41 47 47 47 41 47 47 47 47 47 47 47 47 47 47 45 40
+32 28 28 49 36 49 49 49 45 49 49 41 45 36 47 38 47 47 47 47
+47 49 49 49 49 45 49 49 32 36 45 47 47 47 47 36 49 49 47 36
+47 38 45 38 36 36 38 38 47 41 47 36 36 38 24 40 40 32 32 36
+40 47 47 36 38 47 47 47 47 36 47 47 47 47 47 47 41 47 41 41
+47 47 36 47 47 47 41 36 47 41 47 47 47 49 36 36 36 49 32 36
+38 38 38 35 27 38 41 47 41 41 45 47 45 49 36 36 36 36 32 32
+36 36 36 24 36 36 36 36 36 41 36 41 41 41 38 24 41 36 36 47
+36 24 41 41 36 36 24 47 24 24 36 36 36 24 36 27 24 23 29 35
+24 24 24 24 36 36 47 36 36 47 36 36 29 24 34 34 24 38 38 40
+34 40 44 47 36 40 28 28 39 40 47 47 49 49 28 28 40 45 36 38
+44 45 40 40 38 45 47 49 49 49 36 49 47 47 47 47 47 38 44 44
+38 44 44 47 47 47 47 38 47 47 45 40 40 35 44 38 44 45 44 44
+44 44 38 44 38 38 38 38 40 45 36 45 29 21 20 27 24 14 16 10
+ 9 9 7
+>gnl|ti|1086975831 name:1099575910927
+ 6 6 6 6 6 6 7 7 7 7 8 16 7 6 6 9 8 7 7 12
+12 14 14 16 17 14 17 15 14 14 19 18 16 16 16 24 34 24 35 29
+25 36 29 38 38 44 38 38 25 29 26 26 26 44 44 38 38 34 34 28
+28 31 27 25 30 34 35 24 36 20 20 14 10 14 14 11 15 29 32 34
+32 49 49 47 44 38 44 35 34 33 38 44 28 32 32 31 29 32 38 31
+32 29 29 32 32 38 44 44 35 27 28 29 27 13 16 19 25 27 38 47
+47 45 47 47 41 41 47 47 47 38 38 44 38 38 38 44 38 44 44 44
+44 49 49 49 49 45 49 45 45 47 47 36 47 38 47 47 47 41 47 38
+44 47 38 44 44 47 47 47 47 47 38 47 41 47 41 47 47 36 41 47
+47 44 38 32 40 40 34 40 38 38 44 45 45 45 35 34 36 38 47 45
+44 44 38 44 44 38 41 38 44 44 44 38 38 38 45 41 41 47 47 47
+47 47 45 47 40 39 40 47 40 39 32 35 40 39 40 47 47 49 47 49
+45 32 40 45 45 47 41 47 41 47 41 41 47 38 47 47 36 47 47 47
+47 47 45 45 36 32 40 49 49 41 47 41 47 47 47 41 41 47 38 33
+31 31 35 35 38 47 41 41 47 47 47 49 35 34 28 24 24 24 40 45
+47 47 38 47 44 38 38 38 41 41 47 41 47 47 47 47 45 47 49 47
+47 47 47 47 47 47 41 41 47 47 41 47 47 41 47 47 45 47 47 49
+49 44 32 40 45 45 45 47 47 36 38 47 38 47 47 47 45 40 32 28
+28 39 40 47 41 47 49 47 47 47 47 40 40 32 40 40 47 47 47 47
+38 47 47 49 49 49 49 49 49 49 49 47 45 38 44 38 38 38 36 47
+47 47 49 38 40 34 36 40 40 40 40 44 45 47 47 47 47 49 47 49
+49 40 32 44 38 47 47 47 45 49 49 49 49 40 32 36 36 40 40 39
+32 45 40 45 49 49 49 49 49 49 45 45 49 49 47 47 45 45 47 47
+47 47 47 47 41 49 49 47 38 47 47 41 41 47 47 47 47 47 47 47
+47 49 49 36 47 47 47 41 47 47 47 47 49 41 47 47 47 47 47 47
+45 47 47 47 47 49 49 49 49 49 40 40 40 45 45 47 49 47 47 47
+45 45 44 40 34 44 38 47 47 49 49 47 49 47 49 49 49 47 44 36
+41 47 38 47 47 31 38 38 38 38 44 47 47 47 47 47 49 47 47 41
+47 41 47 40 44 38 38 38 38 47 47 47 36 47 41 47 41 41 36 36
+38 36 49 45 49 36 45 36 36 36 26 23 26 23 29 26 36 36 38 38
+44 38 38 38 38 36 36 36 36 38 36 38 36 36 36 36 36 32 32 36
+36 45 38 36 36 36 36 36 36 36 29 29 29 44 44 29 36 36 36 36
+38 38 38 38 36 45 36 36 36 36 36 36 36 36 36 47 38 38 49 36
+24 24 24 24 17 17 28 22 24 24 29 29 47 36 36 36 36 36 38 38
+38 38 24 24 36 36 36 36 36 36 36 24 47 41 36 36 36 38 36 38
+36 34 29 35 33 33 29 27 44 38 47 29 29 29 33 44 34 36 47 41
+36 36 36 36 24 39 32 32 32 28 25 38 29 38 38 41 36 35 34 29
+34 34 38 47 47 49 45 38 38 41 47 47 47 36 36 47 47 47 24 47
+47 36 36 47 24 24 24 24 36 40 24 24 47 36 36 36 36 36 24 24
+24 24 24 24 36 36 47 41 24 24 29 44 44 38 35 44 35 38 33 30
+38 38 44 29 29 38 44 34 25 38 36 36 32 26 26 31 23 23 32 24
+36 36 47 45 33 33 19 25 23 29 47 40 38 40 47 44 19 20 16 7
+ 7 20 15 29 38 38 17 22 9 10 10 9 9 6 9 9 8 10 12 12
+>gnl|ti|1086975789 name:1099575910928
+ 7 6 7 6 6 6 10 9 9 8 8 11 7 9 10 11 7 7 7 9
+14 10 8 7 9 12 9 8 10 10 14 14 14 12 12 12 12 13 12 16
+12 16 12 19 14 19 19 29 29 29 36 25 24 17 18 17 16 20 18 20
+28 21 24 26 21 27 33 33 27 25 19 11 10 8 7 7 6 6 6 6
+ 6 7 7 13 11 18 25 27 28 32 40 40 40 40 40 40 40 40 27 27
+19 18 20 20 16 19 22 20 16 16 18 18 35 20 20 14 9 9 9 11
+11 25 23 32 32 34 32 40 40 40 28 27 25 18 13 21 23 18 20 23
+26 23 21 25 49 45 38 40 40 40 34 40 40 40 40 25 26 26 27 24
+24 28 27 24 23 21 27 17 22 11 11 10 12 11 21 21 26 20 20 29
+29 26 26 26 28 24 14 17 24 27 17 26 23 23 18 25 18 18 25 25
+27 27 27 23 23 40 32 40 25 27 45 28 35 40 29 27 27 21 20 24
+29 21 21 17 21 18 23 23 24 23 23 30 25 28 26 30 26 24 26 26
+26 22 16 10 9 10 22 18 29 22 22 27 27 27 40 32 34 32 40 35
+40 39 40 28 20 23 20 18 18 24 22 24 26 24 24 28 29 25 22 16
+16 25 25 17 22 19 23 21 23 27 23 18 18 25 18 19 23 28 28 20
+20 18 18 11 11 14 15 20 21 20 18 19 19 14 23 23 27 27 40 24
+15 10 9 9 16 13 23 28 23 25 25 25 25 18 18 25 21 21 39 27
+28 27 23 17 11 14 14 20 18 17 14 18 15 21 21 45 40 20 19 22
+22 22 16 19 17 23 14 18 22 19 17 22 14 14 17 20 28 28 28 32
+28 28 28 28 28 28 24 16 12 12 16 16 19 21 20 24 19 15 15 10
+11 10 18 24 24 13 11 9 14 20 17 12 19 27 27 27 27 36 27 27
+27 49 27 49 27 27 24 24 24 14 18 21 18 18 18 21 23 23 18 27
+49 24 23 17 13 13 23 29 28 24 24 24 20 12 12 12 20 19 19 28
+25 25 28 24 23 23 27 24 24 20 20 24 15 19 28 23 28 23 21 16
+15 11 11 24 21 27 17 15 17 13 15 11 12 14 23 24 20 20 21 24
+20 19 25 16 12 17 17 21 25 21 18 18 19 18 21 18 19 17 13 13
+17 16 20 19 23 15 18 12 12 13 14 18 24 23 24 12 12 24 24 27
+21 21 20 20 21 23 14 14 18 20 24 21 18 27 21 16 16 13 11 15
+18 18 14 14 18 23 21 21 27 22 22 22 22 19 23 24 27 28 23 28
+23 19 19 18 18 23 27 32 36 26 26 19 26 19 19 13 13 17 17 17
+21 16 15 13 13 14 25 24 32 23 16 17 11 9 11 15 15 13 18 20
+17 11 11 20 19 32 24 21 14 14 14 14 13 17 25 32 28 21 21 25
+28 24 18 13 13 14 18 18 23 21 21 25 16 16 9 9 16 12 14 12
+10 10 14 24 27 20 23 17 12 12 9 8 17 14 17 9 7 12 11 12
+ 8 7 10 8 17 23 27 16 14 9 9 7 9 12 18 21 20 19 19 13
+14 15 15 20 10 10 12 9 9 9 10 8 8 8 10 13 8 9 9 8
+ 8 12 12 13 13 13 15 18 8 10 8 12 14 16 13 13 9 7 8 13
+15 19 10 9 9 9 12 9 7 12 9 9 9 9 8 8 9 9 9 10
+ 7 6 7 8 9 9 10 7 7 8 9 9 10 9 8 8 7 7 12 10
+ 7 7 7 7 14
+>gnl|ti|1086975812 name:1099575910929
+ 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 8 10 8 7
+ 8 8 18 6 6 7 7 11 8 9 7 7 7 12 14 19 24 21 18 11
+15 15 14 16 13 12 13 14 12 15 10 10 17 18 23 23 23 34 34 38
+38 45 34 29 21 22 22 23 23 23 39 49 40 25 24 11 13 6 6 7
+ 7 9 8 12 12 12 12 12 9 15 15 23 19 13 10 18 9 9 9 22
+24 32 40 34 34 29 44 26 34 29 30 24 26 38 39 15 10 6 6 6
+ 7 8 9 11 9 16 20 18 22 27 38 38 34 34 47 40 40 36 36 36
+40 40 34 40 38 35 34 38 35 38 44 38 47 47 44 44 40 34 38 35
+34 38 38 44 41 49 49 40 36 32 34 34 35 38 34 29 32 35 32 40
+40 41 47 40 45 34 40 39 20 11 9 14 9 15 21 28 32 49 49 34
+38 32 34 38 36 34 35 29 34 34 34 38 45 49 49 49 32 38 38 35
+34 34 34 40 34 34 36 40 47 36 38 38 35 38 34 35 40 36 47 47
+38 49 45 49 49 49 40 28 29 29 35 34 26 35 35 39 39 28 25 25
+49 27 49 38 34 29 34 34 38 38 38 40 40 40 40 40 28 49 32 39
+32 28 32 28 45 45 47 39 36 18 18 18 25 25 34 40 40 45 40 40
+32 32 40 40 40 40 40 40 49 49 36 49 38 47 40 40 34 40 34 34
+40 40 40 40 40 45 49 36 40 40 40 40 47 36 49 40 47 47 47 45
+47 36 47 36 38 38 38 38 38 34 32 34 34 34 34 29 34 34 40 40
+32 49 27 27 49 32 49 32 26 26 24 28 27 33 35 34 35 33 24 27
+28 25 29 45 45 49 29 35 38 29 29 35 40 32 40 40 40 40 39 38
+39 40 28 28 40 28 28 28 32 40 29 35 35 35 35 31 45 40 36 40
+40 40 40 40 39 40 40 36 40 32 35 32 40 40 34 32 45 40 40 23
+28 40 40 38 34 49 49 49 49 28 28 29 29 34 38 38 34 38 34 35
+34 26 30 28 40 32 40 32 40 32 27 39 28 27 23 27 27 40 32 40
+28 28 32 40 40 40 40 32 28 49 32 49 36 38 47 47 36 38 38 40
+40 36 40 40 40 34 40 36 32 49 32 32 32 40 40 32 40 39 36 36
+47 19 29 29 22 22 28 28 40 28 40 28 35 40 40 40 34 40 49 28
+28 49 40 28 28 40 40 40 28 28 28 29 45 38 38 44 47 47 47 47
+45 40 32 28 28 40 40 34 40 39 34 40 36 38 36 49 49 28 28 26
+28 30 35 35 34 40 36 38 44 24 32 24 32 49 32 28 29 35 34 35
+25 27 39 32 32 24 36 49 36 36 36 32 32 40 49 38 29 34 35 34
+31 49 47 44 44 44 38 38 44 47 49 40 45 40 29 44 44 38 44 44
+47 49 49 49 49 45 45 34 32 35 35 34 24 44 38 32 24 24 24 36
+24 28 23 23 32 32 24 40 24 32 24 45 23 24 32 24 24 24 24 17
+17 19 21 19 19 32 24 24 24 24 29 29 29 24 31 19 23 23 36 36
+36 24 36 24 24 23 32 32 24 38 24 19 19 27 23 19 18 20 14 20
+16 19 20 19 20 17 9 9 19 17 23 19 13 19 23 40 40 24 36 24
+47 24 24 24 19 20 21 28 27 19 24 36 24 34 24 24 24 24 24 24
+23 23 24 23 15 14 14 13 23 19 19 19 19 19 12 8 7 9 11 12
+12 14 10 9 9 20
+>gnl|ti|1086975874 name:1099575910930
+ 7 6 6 6 6 6 6 6 7 7 9 6 6 6 6 9 6 7 7 7
+11 13 19 12 12 9 9 12 12 13 12 12 8 7 7 12 11 19 22 18
+21 21 19 15 16 18 12 10 16 16 22 22 23 23 24 23 23 23 18 18
+13 13 22 17 19 25 32 31 32 31 25 28 19 22 20 21 20 24 30 28
+29 33 29 38 45 44 44 44 45 35 29 33 33 31 33 31 40 47 41 47
+49 49 49 44 44 38 26 32 27 29 21 24 45 31 35 34 38 38 38 34
+35 38 38 38 47 47 38 49 38 40 38 40 47 47 45 49 49 34 40 40
+28 20 20 32 30 35 38 38 35 35 33 27 27 27 29 45 49 49 38 38
+38 38 38 44 38 44 47 47 38 34 34 38 35 29 36 40 47 38 49 38
+40 32 44 44 38 38 38 34 35 38 38 38 34 34 38 38 41 47 47 47
+47 44 40 40 38 45 45 35 29 29 29 35 38 44 38 35 38 32 40 44
+45 45 40 32 44 35 38 38 34 34 34 35 35 40 36 38 47 47 47 47
+38 44 32 32 40 40 29 34 29 38 38 31 32 32 44 38 38 47 45 38
+44 30 28 23 23 30 27 34 45 40 35 40 40 40 36 32 28 28 40 40
+36 45 34 40 45 45 47 47 47 47 47 47 47 45 45 36 32 40 45 40
+40 45 49 47 47 45 40 40 32 38 38 38 45 47 45 47 47 38 40 45
+40 38 40 40 40 40 45 49 47 38 40 40 40 34 34 40 40 40 38 32
+49 28 24 32 32 38 38 25 40 34 27 26 17 12 10 20 11 20 29 45
+44 47 47 47 47 47 47 47 47 36 40 36 47 47 47 47 49 49 49 47
+47 38 38 34 34 36 38 47 47 47 45 45 38 47 38 45 40 47 47 47
+47 38 47 45 47 47 47 47 47 41 47 40 40 32 40 40 49 38 47 40
+40 39 40 32 40 40 47 44 40 32 40 38 38 47 38 47 47 47 38 45
+40 40 40 39 49 49 49 49 49 49 49 47 47 47 47 38 38 49 49 36
+47 47 45 38 34 49 36 28 28 39 39 36 38 38 40 47 47 41 47 41
+49 47 47 47 47 39 36 34 40 40 39 39 36 36 38 44 41 40 45 36
+49 49 47 36 36 32 28 21 20 30 28 38 44 38 39 45 49 49 49 32
+49 40 40 40 40 40 36 36 36 45 40 28 32 36 36 36 49 36 36 36
+28 34 39 36 47 36 36 24 24 34 45 49 49 36 36 36 36 36 36 36
+36 24 32 24 32 32 34 40 36 36 47 38 36 36 36 24 24 24 32 24
+32 24 24 36 36 38 45 45 40 24 24 40 24 28 28 36 36 38 38 36
+36 36 36 36 36 36 36 36 32 36 24 38 36 38 44 36 24 24 49 23
+23 24 32 24 24 24 24 36 36 47 24 23 21 24 23 35 24 24 24 24
+24 36 36 23 23 36 36 28 28 24 23 19 24 18 26 30 24 36 24 23
+23 19 19 19 28 24 24 27 21 27 36 36 36 36 36 36 36 45 32 24
+32 36 36 36 47 24 24 24 24 36 24 32 24 24 24 24 32 32 19 19
+19 19 19 19 24 36 36 36 29 24 19 19 19 24 24 24 36 36 36 24
+24 24 24 23 24 19 19 21 21 19 27 40 24 36 32 28 28 36 29 21
+21 9 9 16 17 36 36 36 36 24 23 23 24 24 24 24 24 24 24 24
+27 23 14 14 16 13 13 23 19 23 24 24 17 12 9 7 10 12 14 23
+19 11 18 18 17 23 9 9 17 20 19 19 27 24 23 23 18 18 24 17
+17 19 21 24 20 15 7 6 6 12 10 12 19 27 24 24 19 20 20 11
+11 9 11 18 13 17 27 20 19 17 10 7 7 6 7 8 8 11 7 7
+16
+>gnl|ti|1086975866 name:1099575910931
+12 6 6 6 6 9 7 6 6 6 6 17 12 19 17 12 12 8 8 8
+18 16 10 12 12 12 8 8 16 16 7 7 18 18 18 19 14 20 17 27
+34 35 19 16 16 18 25 25 31 33 23 30 19 23 24 36 36 47 26 32
+32 22 22 21 22 31 34 29 27 27 22 18 12 9 7 13 9 9 10 8
+ 7 10 10 29 24 27 24 30 26 24 27 21 21 29 23 32 26 49 49 45
+49 49 49 44 38 45 45 45 44 47 47 47 38 30 24 21 13 11 19 19
+20 15 28 39 27 44 38 38 38 44 44 44 38 44 44 44 38 38 38 45
+44 38 45 47 49 49 47 41 40 44 24 30 20 20 30 30 44 38 34 38
+38 49 38 47 34 35 38 44 38 44 38 34 35 39 40 39 28 26 31 31
+38 34 34 26 31 32 32 49 49 49 47 47 41 41 47 47 41 47 36 47
+47 40 44 35 34 38 29 38 40 40 40 38 44 47 38 38 34 35 44 38
+49 49 34 34 34 34 38 44 44 44 49 47 45 45 34 34 36 40 40 47
+47 47 38 38 44 38 38 38 38 38 47 47 49 38 38 38 34 35 44 38
+38 38 29 30 20 20 30 32 35 44 47 36 41 47 47 47 38 38 40 40
+40 28 32 32 39 39 32 28 26 26 32 29 23 26 28 36 40 40 38 47
+36 47 47 47 49 36 47 49 36 36 47 36 38 44 44 34 31 29 32 40
+32 40 32 49 45 40 40 38 47 47 47 47 47 47 47 47 47 47 45 45
+45 32 36 38 38 47 38 45 47 47 47 49 49 49 47 47 39 40 32 40
+40 39 47 47 44 38 38 35 40 45 39 40 45 44 38 47 36 47 47 47
+38 40 36 47 40 38 40 47 47 41 47 47 40 36 39 32 32 40 40 45
+45 40 40 49 49 49 45 40 38 44 38 38 44 45 38 29 35 34 34 38
+47 49 38 44 44 44 38 38 47 47 47 45 45 47 47 47 47 45 45 47
+47 49 49 49 49 49 49 36 49 45 34 34 34 40 45 44 47 41 47 41
+47 47 47 47 47 45 45 49 28 27 49 39 45 47 38 47 47 47 36 36
+36 32 40 40 28 28 40 40 36 47 47 40 36 45 40 38 47 47 49 49
+45 45 47 41 44 44 32 32 28 28 39 45 47 47 47 45 45 40 32 40
+49 36 45 34 44 44 44 44 36 45 47 47 47 49 36 36 40 32 32 32
+36 45 47 39 40 49 45 28 49 36 36 36 47 47 47 47 47 38 38 34
+40 36 36 36 47 45 36 24 24 24 40 36 36 47 36 24 24 40 36 24
+36 45 40 24 24 24 32 49 28 28 40 36 28 34 40 40 40 38 34 49
+49 49 38 49 49 49 40 45 45 36 47 47 47 24 24 47 47 36 36 32
+24 49 24 38 38 34 23 24 34 35 24 36 36 24 24 32 36 36 24 36
+38 24 24 24 38 34 24 40 24 49 49 49 24 36 24 24 24 24 24 36
+36 24 24 24 24 29 23 28 28 23 36 40 23 23 20 18 25 24 44 36
+36 47 47 49 24 24 24 24 34 23 23 30 35 19 24 40 24 44 36 36
+24 36 47 36 47 47 38 36 36 24 32 28 49 36 36 24 38 41 47 36
+45 24 24 36 40 40 28 40 45 40 24 36 40 27 27 24 34 34 35 40
+36 44 38 45 32 23 23 23 24 23 21 24 24 40 24 24 24 24 19 19
+ 9 8 14 14 12 14 11 13 13 19 19 21 21 19 19 28 36 39 24 23
+21 13 13 15 11 17 17 24 17 17 19 23 24 32 40 16 14 9 9 16
+16 13 13 19 14 14 10 10 14 20 24 22 19 15 12 7 8 8 8 8
+ 7 7 12 8 9 7 7 7 6 7 13 11 14 11 14 18
+>gnl|ti|1086975913 name:1099575910932
+ 6 6 6 6 11 7 7 7 7 9 9 9 7 7 7 8 7 7 7 7
+ 9 9 7 7 7 8 7 9 9 7 7 7 7 7 7 11 10 11 10 11
+20 7 7 7 7 6 7 10 7 14 9 8 9 9 9 9 9 7 9 9
+10 18 12 14 9 9 9 9 10 9 6 6 6 6 6 6 6 6 7 6
+10 8 6 9 9 9 9 10 9 9 9 9 9 9 9 9 9 9 9 9
+11 9 16 11 7 9 8 6 6 6 6 6 8 6 9 6 6 9 7 7
+ 9 9 9 9 9 13 11 13 9 9 7 11 12 18 11 9 11 9 9 9
+22 24 38 45 35 35 31 33 32 23 49 49 36 49 49 47 45 45 28 40
+32 39 39 47 47 39 40 40 34 29 44 38 44 38 40 40 23 15 10 7
+ 6 6 6 6 6 6 7 6 6 6 7 10 12 20 20 49 49 32 32 45
+44 38 38 36 34 34 32 40 49 49 45 45 36 47 38 44 38 38 35 35
+32 34 40 45 40 40 32 38 32 36 45 47 38 44 35 35 44 44 38 38
+47 39 45 39 32 32 39 39 47 47 47 47 47 47 47 45 45 34 32 29
+27 18 17 25 25 28 28 30 27 23 28 28 32 40 38 40 36 47 36 40
+34 40 34 35 34 38 34 29 44 38 47 47 47 38 44 45 39 28 28 40
+32 39 40 39 40 23 28 28 32 28 38 38 34 38 47 39 39 34 40 40
+36 49 32 40 38 36 40 28 39 40 28 32 32 40 40 47 47 47 45 49
+47 47 47 47 38 47 47 47 41 47 47 38 44 38 34 31 29 28 36 40
+45 28 40 40 40 47 47 47 38 38 47 47 47 47 38 49 49 49 49 49
+49 32 40 32 40 40 40 40 36 40 40 47 45 49 49 27 13 18 39 27
+35 40 39 38 38 32 40 40 40 40 44 47 47 47 47 47 45 45 45 40
+40 32 40 34 32 44 38 49 49 49 49 40 28 23 23 28 39 39 40 32
+40 32 49 45 49 47 47 29 44 34 35 25 34 36 39 40 28 32 27 26
+14 13 27 39 28 27 39 21 20 24 23 24 40 40 28 32 32 32 40 40
+47 47 47 47 49 44 38 38 38 38 34 45 32 40 34 40 40 40 44 49
+47 24 36 49 49 49 32 32 40 39 40 34 34 29 29 29 30 47 40 36
+32 32 34 45 39 39 28 28 49 49 49 45 32 34 40 39 36 45 40 34
+32 36 32 40 44 38 34 40 40 40 38 38 38 36 40 38 40 47 36 47
+47 47 45 45 36 40 40 44 40 36 38 47 36 40 24 28 28 32 39 39
+47 38 36 36 40 32 34 29 27 24 24 27 32 44 38 38 38 38 36 45
+40 40 32 40 40 38 40 45 32 28 24 29 27 35 34 35 28 28 23 28
+36 36 29 29 25 35 29 27 29 38 38 23 34 40 24 36 47 47 36 40
+39 40 29 35 25 34 38 38 47 24 24 24 24 39 29 26 28 24 27 35
+29 34 34 45 24 18 18 11 12 16 25 26 36 23 23 28 28 24 29 29
+29 24 35 40 40 24 36 23 23 28 24 24 19 14 18 12 10 20 16 19
+14 8 14 22 10 13 20 23 17 13 16 16 10 12 17 18 18 23 27 32
+36 25 27 20 22 19 16 13 7 10 18 12 22 23 25 17 12 12 7 7
+19 19 32 24 31 21 16 16 10 7 7 7 8 9 12 14 12 16 9 9
+ 9 9 19 16 15 25 17 18 19 20 17 17 22 19 24 17 17 17 19 13
+19 19 16 12 9 9 10 11
+>gnl|ti|1086975863 name:1099575910933
+ 9 6 9 7 6 6 6 6 6 8 10 9 9 7 7 7 7 7 6 9
+ 7 7 9 9 18 7 7 7 8 8 16 16 16 16 7 9 9 12 12 12
+13 12 15 19 18 13 10 12 14 14 13 21 16 18 20 23 20 21 33 33
+23 30 29 24 24 28 28 25 23 16 11 7 7 8 7 7 9 7 7 9
+16 11 18 25 26 29 49 49 38 29 30 29 26 33 23 29 29 29 22 22
+28 14 22 17 21 16 20 27 20 19 24 30 21 15 12 9 12 13 10 12
+14 25 23 29 29 40 28 40 40 40 40 40 35 34 35 34 34 34 29 28
+28 36 39 34 32 32 29 29 29 29 34 26 32 40 40 32 40 32 40 28
+28 28 28 40 32 34 36 24 40 38 49 36 40 40 24 26 25 22 27 27
+40 32 24 24 28 27 24 21 23 23 20 23 23 14 12 12 15 18 22 22
+27 22 29 29 28 27 27 21 19 19 29 29 28 28 27 12 12 10 10 10
+14 13 11 12 14 14 23 20 12 12 18 21 17 24 17 14 17 17 17 27
+27 28 26 26 28 27 25 27 27 25 24 26 21 20 23 23 25 17 23 27
+28 40 26 34 25 25 23 20 23 23 25 21 20 23 20 19 19 22 20 20
+32 49 23 40 32 27 27 20 23 39 29 28 24 23 28 29 29 29 28 28
+23 23 17 17 17 23 25 28 23 32 27 40 20 21 29 23 23 40 25 26
+26 26 19 19 20 15 18 14 16 16 13 17 18 28 25 25 28 28 32 40
+40 25 23 18 17 23 20 20 28 26 29 29 49 39 40 32 23 20 21 21
+17 16 15 11 11 15 14 17 16 20 14 13 11 11 9 7 8 11 13 21
+23 16 11 13 12 12 23 29 40 21 20 20 20 20 20 32 30 27 17 19
+13 13 12 16 18 23 17 13 29 21 18 28 23 28 28 20 21 29 27 25
+17 17 15 17 22 20 21 22 21 17 17 13 10 12 12 15 18 19 18 18
+24 13 11 7 9 10 10 9 7 9 9 9 13 20 27 28 22 21 17 22
+13 13 12 10 9 9 6 6 6 6 6 6 6 7 10 10 12 9 9 9
+ 9 8 12 9 15 16 19 21 21 17 17 15 16 17 19 12 12 8 9 9
+ 7 16 11 13 12 16 13 19 11 8 8 6 8 9 9 9 11 6 6 8
+13 12
+>gnl|ti|1086975825 name:1099575910934
+ 6 6 6 7 6 7 6 7 7 9 9 9 11 11 9 9 12 11 9 9
+ 9 9 9 9 9 9 10 9 13 7 7 9 9 9 10 13 10 7 7 12
+12 10 10 13 11 12 14 15 28 19 18 16 10 16 17 23 24 29 26 26
+19 15 18 12 12 16 16 14 18 17 14 16 16 11 9 9 12 8 7 6
+ 6 6 6 9 9 13 10 14 12 16 16 10 15 16 16 17 17 19 24 24
+19 15 17 23 26 28 29 29 24 29 20 14 14 12 10 12 11 10 9 7
+ 7 9 10 10 12 12 16 22 12 15 9 13 10 16 13 16 18 21 25 27
+19 10 10 9 13 15 15 16 12 17 18 22 27 27 19 12 13 13 13 10
+18 24 20 20 24 24 28 28 28 27 28 18 18 17 12 19 11 12 12 23
+24 19 19 27 23 28 23 24 18 9 7 8 9 9 9 9 14 11 20 16
+18 23 23 21 23 23 23 23 27 21 23 28 28 28 49 45 45 27 27 23
+23 23 14 12 18 24 10 10 16 16 20 22 21 18 18 23 20 23 20 18
+18 23 18 18 28 19 19 27 23 17 24 22 17 18 10 12 9 11 13 17
+19 21 18 18 19 24 24 20 17 20 20 28 28 21 28 28 28 29 23 17
+17 13 10 11 9 9 10 7 11 17 16 20 18 12 12 10 9 9 10 18
+20 28 23 18 16 12 12 12 11 9 12 13 11 9 9 9 11 13 28 18
+11 9 9 9 9 16 13 14 10 9 14 16 28 28 32 28 28 24 23 14
+12 19 22 20 17 18 23 16 15 12 13 19 17 16 11 16 9 13 12 18
+14 16 15 15 11 12 9 9 9 9 15 20 18 23 23 23 25 16 18 10
+12 13 9 9 12 9 7 9 10 11 21 23 28 28 25 28 23 18 10 9
+ 9 10 10 8 7 10 9 10 9 9 7 9 12 20 17 20 14 12 10 9
+ 7 9 10 23 20 18 10 16 13 18 13 11 11 11 10 14 10 18 12 10
+ 9 11 12 11 16 10 11 10 11 9 12 11 11 11 12 12 14 11 9 11
+ 9 9 10 10 10 14 12 13 15 9 12 9 7 6 6 9 12 12 19 19
+12 9 9 9 9 9 9 11 13 9 9 9 13 18 12 9 9 9 9 13
+10 12 13 18 13 9 9 9 9 7 7 10 9 9 10 9 9 8
+>gnl|ti|1086975888 name:1099575910937
+ 6 6 6 6 7 7 7 6 6 7 7 7 7 9 11 8 18 7 7 13
+17 19 19 16 17 17 19 15 12 14 12 15 12 14 22 21 15 19 16 21
+17 16 21 25 29 29 29 35 45 23 29 24 35 34 32 29 29 24 26 20
+17 25 24 23 21 33 30 33 30 30 34 28 29 29 25 24 26 26 28 30
+34 40 49 26 29 32 35 35 34 34 31 49 44 38 44 44 38 44 34 34
+44 44 38 44 44 38 34 34 38 30 29 28 28 31 29 38 44 38 49 28
+23 23 26 30 32 38 38 38 44 49 49 47 45 38 38 38 38 38 38 38
+47 47 45 47 47 40 32 45 28 23 26 27 34 35 29 40 40 40 44 47
+45 47 45 38 47 47 47 38 47 47 47 49 45 45 32 32 29 44 38 38
+38 38 38 47 45 40 36 47 47 47 47 47 38 38 38 38 38 38 38 45
+49 45 45 34 38 45 47 47 49 44 44 34 32 44 40 36 45 45 47 47
+47 47 47 47 47 36 47 38 36 40 45 45 47 47 47 45 45 38 38 44
+34 34 34 38 45 45 44 44 44 35 35 38 34 49 45 47 47 47 36 45
+40 28 40 28 32 40 32 36 40 47 47 45 45 28 40 45 49 34 45 29
+38 34 34 44 38 34 34 38 38 38 29 35 38 31 31 32 40 40 40 41
+47 47 47 47 47 41 47 38 47 47 44 38 40 32 40 40 40 40 40 39
+45 28 28 45 40 40 34 40 40 47 36 39 27 19 19 23 39 40 38 49
+49 49 45 38 40 34 45 45 34 34 32 40 23 23 32 32 36 32 40 40
+38 36 40 40 44 44 44 39 40 32 32 28 29 29 38 29 29 31 29 29
+35 38 38 44 38 38 38 40 36 32 32 28 39 35 34 35 34 29 34 40
+38 40 40 44 45 34 36 40 40 36 40 28 49 49 49 45 49 36 28 28
+40 40 32 36 40 47 40 47 36 36 40 28 28 29 30 38 35 35 49 49
+49 45 36 40 44 40 47 47 45 40 40 49 45 49 36 49 47 36 40 40
+34 45 40 32 40 28 28 40 40 40 36 38 45 38 34 34 45 45 34 32
+40 40 40 40 40 36 49 45 49 45 49 45 45 49 47 47 47 47 45 45
+40 34 38 44 45 47 40 40 47 40 36 40 35 35 45 49 32 34 45 36
+36 45 44 36 32 40 36 28 32 36 45 45 45 45 40 32 40 32 32 34
+29 35 38 45 34 40 40 40 40 40 36 45 40 28 23 23 40 40 36 38
+36 36 38 24 32 49 27 18 27 39 39 34 40 40 39 36 39 39 34 32
+40 36 47 47 45 45 34 24 40 39 36 34 35 34 40 39 32 28 29 19
+24 29 25 28 49 32 32 32 24 24 38 47 47 38 36 32 32 40 40 36
+24 36 32 32 32 35 24 25 24 24 38 34 32 38 40 40 39 24 28 28
+45 24 23 49 19 18 24 24 24 36 40 23 28 24 32 32 34 36 39 36
+36 24 40 40 49 36 45 38 34 24 23 35 24 32 21 23 40 36 24 36
+36 36 40 29 26 33 33 30 29 33 38 49 38 45 27 19 19 34 34 40
+36 24 40 24 24 32 32 24 24 28 28 36 32 49 39 39 24 24 24 24
+34 34 19 27 28 19 24 24 36 24 23 24 19 19 11 17 17 20 39 24
+21 19 19 19 21 19 24 15 8 12 7 7 12 12 18 11 7 7 21 20
+22 19 17 11 11 13 22 7 7 16 12 16 9 13 8 12 8 10 9 14
+17 18 16 15 12 7 12 13 14 12 15 20 16 14 9 9 12 17 23 19
+20 15 7 7 11 15 18 18 23 13 23 24 28 24 23 17 18 18 24 23
+21 13 13 18 12 14 28 17 13 17 13 15 13 20 17 9 10 18 18 15
+15 13 12 12 8 9 7 7 7 7 7 8 7 7 6 7
+>gnl|ti|1086975841 name:1099575910939
+ 6 6 7 7 7 7 6 7 7 7 6 9 9 7 9 7 6 6 6 7
+ 8 9 10 8 8 12 15 14 18 7 7 12 20 24 23 19 19 19 22 22
+22 27 19 19 27 19 19 23 33 26 19 17 17 16 18 24 26 32 35 26
+26 31 38 38 38 29 29 24 25 28 29 32 26 18 16 9 9 9 8 12
+ 7 10 6 7 9 10 14 19 24 24 28 28 32 40 38 38 38 38 44 35
+30 33 33 31 35 38 47 44 44 34 26 30 30 29 24 22 20 18 10 10
+ 7 9 9 10 16 21 26 28 35 33 29 31 24 24 17 24 32 34 47 45
+45 38 40 44 44 38 27 29 24 32 26 25 40 32 40 40 38 45 47 47
+47 47 41 47 47 47 44 38 38 49 40 40 40 45 36 32 38 38 34 35
+35 38 33 33 27 29 23 26 26 25 27 18 16 18 24 24 39 47 36 47
+38 38 35 35 35 34 29 32 28 23 23 32 32 47 47 45 45 40 40 32
+39 27 18 18 27 22 26 32 36 38 29 34 34 38 28 24 28 40 40 32
+40 44 40 47 40 45 40 40 40 28 28 40 39 40 35 35 35 34 35 29
+40 34 40 40 38 40 49 45 38 40 38 34 34 45 40 34 34 44 44 38
+45 40 40 38 40 40 38 38 38 38 38 38 38 34 34 38 45 36 28 28
+32 40 45 40 40 32 40 27 27 39 27 28 49 49 49 38 36 40 40 40
+45 39 47 36 49 49 49 49 40 40 25 34 24 28 23 23 28 28 32 36
+36 36 40 32 32 40 32 23 18 11 11 26 26 40 32 40 38 36 47 47
+47 47 40 39 28 28 36 40 47 39 39 34 32 34 32 34 45 45 36 38
+40 38 39 32 40 40 39 47 47 38 38 44 44 44 38 27 29 26 26 26
+26 36 40 40 34 45 40 40 34 40 49 49 49 49 49 49 49 34 49 40
+32 28 40 32 40 40 32 39 29 29 29 28 28 30 29 35 34 40 40 49
+47 38 34 34 34 29 24 32 40 44 40 25 29 27 24 27 20 28 27 27
+19 27 27 40 26 26 12 12 23 29 23 28 32 28 28 28 40 32 36 40
+44 32 34 40 40 28 28 23 28 28 32 40 32 32 40 28 49 28 28 40
+40 40 40 36 24 24 23 21 23 28 21 20 24 24 32 28 28 28 28 32
+32 27 23 28 19 23 23 28 32 28 28 39 39 40 40 38 36 47 41 47
+36 36 36 26 24 26 27 28 35 29 28 19 21 10 10 13 16 24 40 28
+28 49 49 49 36 28 28 40 32 25 24 24 23 29 29 28 24 29 21 20
+16 18 12 12 16 19 22 22
+>gnl|ti|1086975883 name:1099575910942
+ 6 6 6 6 6 6 6 6 8 9 15 10 10 10 13 13 10 14 10 12
+10 17 14 14 14 15 23 17 17 14 15 21 18 26 35 35 49 45 36 34
+19 16 13 9 19 18 29 33 33 29 29 22 29 30 30 25 25 23 21 34
+35 29 31 31 29 26 21 19 9 9 6 6 6 6 7 7 7 6 6 6
+12 9 15 19 21 24 28 20 14 9 9 9 14 26 40 47 47 47 41 47
+41 47 47 49 49 49 49 47 40 27 13 8 6 6 6 8 6 9 9 11
+ 9 14 23 24 38 44 44 44 35 44 49 38 38 44 44 44 38 38 47 41
+41 47 47 47 47 40 44 45 38 38 44 47 38 38 40 49 36 38 38 38
+38 38 44 35 44 38 49 45 49 49 38 44 44 44 44 44 40 34 38 38
+34 19 22 10 10 6 6 6 6 9 10 10 11 9 11 9 14 20 39 40
+47 47 47 47 47 47 38 47 41 36 38 44 38 34 34 35 44 38 44 47
+47 41 41 47 47 47 41 47 47 47 47 47 38 40 36 34 34 39 40 47
+49 41 47 36 41 40 38 38 40 47 47 47 47 47 47 41 41 47 47 47
+41 41 47 38 40 40 40 34 38 44 47 41 47 47 47 47 47 38 49 49
+38 35 44 44 44 44 38 38 36 36 28 49 40 38 47 41 47 47 49 47
+44 38 44 44 40 45 47 38 39 36 40 40 40 39 47 41 47 47 47 47
+47 47 49 45 45 45 49 45 47 47 47 47 47 47 47 47 47 47 47 45
+47 47 47 38 47 47 47 47 47 47 47 38 47 36 47 47 47 47 47 47
+47 44 47 47 47 47 47 47 47 41 47 47 38 47 38 38 47 47 47 47
+47 47 47 47 45 49 47 47 41 47 47 47 47 47 47 47 38 47 47 38
+49 49 49 47 47 47 47 47 47 47 47 47 41 47 47 47 47 38 44 44
+44 45 45 47 47 45 45 41 47 47 47 49 49 49 49 38 49 47 47 47
+47 44 44 49 40 38 44 47 41 47 49 49 47 47 47 47 47 47 47 47
+47 38 38 47 47 47 47 47 47 47 47 47 49 47 45 49 45 49 49 47
+47 47 47 47 45 45 49 36 45 40 34 45 45 47 47 47 47 47 47 47
+47 47 47 49 49 47 47 45 45 38 40 40 40 28 28 40 40 47 41 47
+47 47 47 47 47 38 44 44 44 38 44 47 47 47 47 47 47 47 47 47
+47 47 41 47 47 47 47 47 47 47 47 47 41 45 47 47 47 47 41 47
+47 47 47 47 47 47 47 47 41 47 47 47 41 41 47 41 47 49 49 49
+49 40 38 38 27 35 29 47 47 47 38 38 36 49 49 47 47 47 47 47
+24 24 38 38 36 38 47 47 47 47 47 47 47 47 47 47 38 38 38 47
+47 34 31 34 28 28 29 39 38 41 47 41 47 47 47 47 47 47 47 38
+44 34 34 34 32 40 47 47 47 36 47 47 47 38 47 47 47 47 41 38
+38 38 38 40 39 45 34 34 34 34 38 44 41 36 47 36 45 49 47 41
+47 41 41 36 36 36 47 38 36 36 47 38 47 38 41 41 36 36 24 36
+47 36 36 41 45 36 24 24 24 36 34 29 38 27 27 24 24 32 40 36
+24 45 38 41 36 47 36 36 24 47 47 47 36 24 24 47 38 44 38 31
+44 44 44 38 44 40 45 45 38 36 29 32 31 31 32 29 36 35 32 45
+45 47 47 47 47 38 38 38 44 38 44 47 47 47 47 41 47 47 47 44
+35 44 33 33 35 44 38 35 34 44 38 38 44 47 49 38 44 38 29 27
+38 38 44 38 38 38 47 47 47 47 47 38 44 44 38 40 44 29 24 23
+12 13 23 24 38 38 38 28 27 20 23 30 24 38 38 35 44 21 15 9
+ 8 10 9 8 9 9 9 9 9 10 10 7 6 6 7 10 14
+>gnl|ti|1086975864 name:1099575910946
+ 6 6 6 9 9 9 9 9 9 9 8 14 11 7 7 10 12 12 12 12
+12 12 10 8 10 8 7 7 13 12 21 23 22 14 28 21 24 24 23 23
+21 23 23 23 26 26 38 40 47 47 38 47 38 40 26 26 29 28 23 23
+23 28 23 23 23 25 23 23 23 33 23 25 31 17 19 7 6 6 6 6
+ 7 13 10 13 14 16 24 22 34 35 27 24 24 32 26 26 49 38 38 29
+38 38 38 38 38 29 35 44 49 38 34 34 38 29 29 20 19 10 9 11
+17 15 23 21 21 24 32 40 40 40 38 38 47 47 47 38 31 29 28 26
+29 49 49 36 47 45 34 38 38 38 34 34 34 40 34 40 40 40 27 27
+19 28 27 28 28 40 36 36 49 49 40 40 38 36 40 34 29 29 35 34
+34 29 39 40 32 23 23 19 20 14 9 9 9 9 10 13 20 23 27 28
+27 27 19 21 21 27 28 32 28 32 32 40 40 38 38 34 32 40 40 40
+40 34 40 40 28 28 28 40 40 40 28 28 28 28 49 28 28 27 30 28
+35 38 35 29 36 38 40 32 34 40 40 29 20 16 13 11 9 15 15 25
+40 40 36 39 34 34 32 39 40 40 36 32 32 34 40 32 32 28 28 40
+40 40 34 32 40 40 40 34 40 40 36 38 34 36 40 32 28 28 26 28
+30 38 38 40 34 32 45 32 32 32 40 32 27 20 20 27 23 24 24 26
+26 35 29 27 26 27 27 16 29 29 28 28 21 49 49 32 24 26 26 35
+34 34 34 32 32 28 49 35 29 34 35 34 29 40 32 49 36 40 40 28
+32 39 32 28 28 23 32 32 39 39 38 32 40 40 38 34 32 40 40 40
+28 28 39 32 28 28 32 32 40 40 32 32 39 40 36 40 32 40 34 32
+40 32 28 28 40 40 32 49 32 28 28 32 49 36 35 28 25 23 20 26
+26 27 27 29 27 26 28 28 28 32 32 35 35 36 40 40 36 32 49 34
+34 40 36 40 40 40 39 38 40 32 40 28 28 27 27 28 28 23 40 40
+28 24 34 24 26 19 13 9 14 14 17 17 18 20 27 26 28 23 28 23
+28 36 40 40 34 32 32 32 32 40 32 35 34 39 40 40 28 28 23 28
+28 28 40 36 40 40 40 32 32 40 40 40 39 34 34 40 32 28 28 49
+24 26 35 38 29 29 28 32 49 49 32 49 49 49 27 28 45 39 39 28
+25 25 40 39 40 34 40 40 40 23 23 29 27 27 28 28 23 28 40 32
+35 27 27 18 13 23 19 19 12 13 15 19 21 18 20 29 27 27 20 10
+13 9 10 10 7 10 7
+>gnl|ti|1086975889 name:1099575910952
+ 6 8 9 7 6 6 6 7 9 8 9 7 7 6 6 7 9 12 9 9
+ 9 9 9 9 7 6 6 7 10 9 12 7 7 9 9 11 9 9 9 7
+10 12 9 9 8 9 12 7 9 9 9 11 12 10 10 12 12 13 13 11
+ 9 12 9 10 12 10 9 10 9 11 9 10 7 9 8 9 9 7 7 6
+ 8 13 10 16 17 18 28 19 22 19 22 16 16 10 11 12 12 9 9 16
+15 15 17 12 12 10 12 11 12 16 14 12 12 12 17 13 11 9 13 16
+11 13 12 20 21 28 25 23 20 21 20 19 23 23 16 16 12 10 9 9
+ 9 9 9 9 9 12 14 16 19 23 23 24 17 13 15 11 10 9 9 9
+12 18 13 17 23 20 15 14 14 20 15 12 13 14 18 10 9 9 9 12
+11 13 16 23 15 17 10 10 9 10 7 9 9 9 9 9 9 9 9 9
+ 9 9 9 11 9 9 19 11 10 9 9 9 9 9 9 10 9 13 9 14
+13 15 13 14 17 13 12 12 16 13 13 9 9 9 9 10 9 9 14 14
+12 11 9 9 9 9 9 13 21 24 11 11 14 9 9 9 9 9 11 9
+ 9 12 14 9 9 9 9 9 12 12 24 24 13 14 20 20 18 20 25 18
+23 19 12 10 9 10 11 13 11 9 10 9 9 9 7 9 11 9 9 9
+11 12 9 13 12 10 11 14 20 20 23 23 11 11 9 8 9 13 12 13
+ 9 9 7 9 9 9 9 9 10 10 9 9 7 9 9 15 11 12 9 13
+ 7 9 9 9 9 10 16 13 11 9 9 9 7 9 9 9 9 9 9 9
+ 9 9 14 9 9 9 9 9 10 9 12 11 18 13 18 17 17 22 16 11
+12 12 11 12 9 9 12 12 9 12 24 24 24 10 9 11 14 14 11 8
+ 9 10 9 9 9 12 12 18 18 23 17 13 13 17 12 10 10 9 6 9
+ 9 14 14 19 18 24 12 9 10 10 10 12 10 9 9 9 9 12 16 10
+ 9 9 9 9 10 10 9 8 9 9 9 9 9 16 12 12 10 10 10 12
+10 11 10 9 9 9 9 9 10 12 12 13 10 10 10 10 12 18 13 13
+19 13 13 15 14 13 9 9 11 17 17 17 17 17 14 12 9 9 7 9
+ 9 9 10 13 15 15 10 9 9 9 9 9 9 9 7 9 10 10 12 11
+13 9 9 9 9 12 11 10 13 9 9 9 11 10 14 10 9 9 11 9
+ 9 9 9 9 9 13 16 12 10 13 9 9 13 12 10 9 9 10 13 13
+ 9 9 9 9 9 11 10 12 16 9 9 7 9 9 20 14 18 10 9 9
+ 9 9 9 10 12 11 10 9 9 9 9 9 7 9 13 10 12 8 8 18
+12 11 15 11 14 17 17 14 17 18 18 17 14 16 9 9 9 12 13 11
+12 9 7 7 8 12 9 9 16 10 10 12 10 10 12 14 10 8 10 9
+ 9 9 9 10 9 11 11 12 16 17 26 35 49 32 36 23 23 28 19 19
+21 23 27 27 23 27 27 19 19 18 16 18 11 15 16 23 23 28 27 23
+13 9 11 9 10 12 12 17 19 22 13 12 14 13 15 9 13 18 16 19
+21 19 17 24 24 24 17 18 20 27 14 25 14 14 15 10 10 9 9 13
+13 18 21 20 15 9 9 18 18 24 23 23 18 18 23 23 23 21 12 13
+ 7 8 11 16 13 11 13 9 10 8 11 7 7 7 7 9 12 8 7 11
+10 14 13 14 18 13 15 14 14 14 12 12 10 9 8 11 11 7 7 7
+16 23 16 16 14 9 7 12 9 8 12 8 9 17 13 20 12 7 7 11
+ 7 7 7 10 8 9 7 8 7 7 15 8 7 7 8 9 10 14 13 14
+ 9 7 11 11 12 11 16 15 10 9 9 13 15 23 14 8 10 8 8 8
+10 7 9 9 8 9 11 14 13 10 9 9 9 9 7 9 7 6 6 6
+ 7 9 10 8 7 9 9 9 10 6 9 9 9 9 9 10 9 7 9 9
+ 9 9 9 9 7 9 12 12 12 6 9 9 6
+>gnl|ti|1086975824 name:1099575910955
+10 6 6 6 6 6 7 6 6 7 7 7 8 8 8 10 10 10 12 12
+13 22 14 14 14 18 14 16 12 15 16 16 20 16 16 20 18 18 15 14
+28 26 33 33 28 29 32 32 28 28 34 34 30 28 33 33 23 27 47 47
+35 44 44 35 29 29 28 28 26 27 29 22 22 17 12 12 9 9 14 14
+29 24 33 33 33 34 35 24 27 27 26 30 27 44 35 34 38 38 44 38
+38 38 38 38 31 38 44 33 33 33 33 33 27 29 23 29 40 34 38 38
+47 49 49 41 49 47 47 38 44 34 34 38 44 44 38 44 38 38 40 32
+38 44 44 44 44 38 47 49 38 29 35 35 38 38 38 38 44 38 38 38
+44 38 44 38 47 47 47 41 38 38 32 40 38 47 47 40 36 47 47 41
+47 34 31 29 26 29 29 40 36 38 45 36 36 38 49 49 36 49 49 47
+47 47 47 47 47 47 44 40 39 32 32 28 40 45 40 47 47 49 47 31
+38 38 38 34 35 28 32 49 45 40 45 45 47 38 38 44 32 34 40 38
+47 47 47 41 41 38 41 41 47 47 47 47 47 45 47 47 47 47 38 45
+36 44 38 38 38 44 44 47 47 47 41 47 45 41 38 40 32 35 29 38
+38 34 29 47 44 49 32 49 28 36 36 45 49 47 41 38 36 32 32 32
+45 45 47 36 40 38 34 40 40 40 45 47 47 38 47 47 44 38 38 44
+38 38 34 34 45 45 44 32 32 40 44 38 40 36 36 38 34 34 34 44
+38 38 47 38 31 44 34 34 38 38 40 38 40 49 39 40 36 47 40 36
+28 49 32 45 36 47 47 47 40 38 40 32 45 45 45 45 28 27 29 20
+15 26 26 38 29 35 36 47 38 36 38 45 44 36 47 38 44 40 34 40
+36 36 38 34 32 40 36 47 47 36 38 40 36 49 49 32 34 34 38 38
+34 34 34 40 47 47 47 47 45 45 45 45 36 47 45 40 38 40 40 40
+40 40 40 36 45 49 38 36 36 47 47 36 40 39 40 34 39 34 38 38
+38 38 44 49 49 40 34 38 38 44 38 38 38 38 40 40 45 47 38 34
+25 29 27 28 22 29 28 40 40 45 40 40 28 28 28 40 45 47 47 49
+49 40 32 40 28 28 26 29 29 34 35 38 40 35 29 38 44 38 28 40
+25 25 28 40 36 38 47 47 47 47 38 40 47 36 44 44 40 36 40 45
+45 49 49 28 28 28 28 32 40 36 36 36 47 47 40 39 36 40 32 40
+36 47 38 38 36 36 49 32 36 40 36 47 47 38 47 49 49 49 49 38
+44 36 36 32 32 36 36 36 36 36 44 27 35 24 25 38 19 38 38 31
+38 34 47 36 47 31 38 38 38 38 29 47 36 36 36 36 47 36 36 28
+28 39 39 40 36 47 47 47 47 36 47 47 47 49 49 24 24 27 27 24
+24 24 44 44 38 27 24 24 32 36 38 47 47 36 36 49 36 36 36 36
+24 36 36 24 36 34 34 24 27 24 24 27 24 38 47 41 41 45 36 32
+40 36 24 24 40 32 40 36 36 36 44 24 24 36 40 28 32 32 36 40
+47 47 36 47 36 36 44 24 24 40 36 36 45 41 45 36 36 24 24 24
+36 27 24 24 27 38 38 36 24 40 24 24 24 49 32 40 39 39 28 32
+36 39 38 24 24 24 19 24 19 21 23 30 36 38 24 24 24 24 38 47
+23 34 35 28 29 35 35 27 27 24 38 38 36 36 21 19 24 27 27 24
+24 24 14 15 12 12 13 9 9 11 9 9 10 8 7 7 7 7 12 12
+ 9 9 10 10 10 7 9 7 7 9 10 9 9 7 7 7 13 7 6 6
+ 6 10 8
+>gnl|ti|1086975773 name:1099575910958
+ 6 6 9 9 7 6 6 6 10 12 18 12 8 8 12 16 14 21 44 29
+26 26 26 24 24 29 29 21 18 18 22 24 24 30 30 32 35 35 42 47
+32 31 23 23 24 22 22 20 25 26 23 42 32 32 29 31 26 32 29 31
+32 30 27 35 42 30 21 32 30 30 18 26 12 12 14 24 18 32 32 31
+29 34 44 47 45 47 36 35 35 35 44 44 44 44 42 42 35 44 38 38
+47 40 38 44 44 38 38 44 44 49 45 49 44 38 44 44 44 38 44 38
+47 47 44 44 38 44 44 44 45 38 49 49 49 49 49 47 47 47 41 47
+47 41 49 49 45 49 49 45 45 41 35 44 44 38 44 44 41 47 41 41
+41 47 41 41 41 47 44 44 44 44 44 38 49 47 41 41 47 47 47 41
+41 36 41 47 47 41 47 47 47 47 47 36 49 38 38 38 44 38 38 47
+47 49 49 49 45 49 49 45 47 44 38 44 38 44 38 47 47 47 41 49
+44 44 35 44 38 44 38 44 35 38 44 38 44 40 44 40 47 47 41 44
+38 38 40 44 44 47 45 45 41 47 41 47 47 47 47 47 47 45 47 47
+36 47 44 45 47 47 47 47 49 45 44 44 44 38 38 38 47 41 47 47
+41 45 47 47 47 41 47 41 38 47 47 47 47 45 45 38 47 47 38 38
+47 47 47 47 47 47 47 41 35 35 44 44 38 44 45 49 49 49 47 47
+41 41 47 47 47 41 36 47 47 38 47 45 47 47 47 47 47 47 38 47
+47 47 47 47 47 47 47 47 47 47 47 45 40 32 40 45 38 47 47 47
+47 47 45 47 47 41 47 47 36 47 49 49 49 49 49 45 49 47 41 38
+40 44 44 38 38 47 47 47 47 38 45 44 38 35 47 47 47 38 38 38
+44 35 44 41 41 47 41 45 38 38 38 44 40 44 47 45 47 47 45 47
+45 47 38 35 34 34 35 35 38 47 47 47 49 40 44 38 44 38 44 45
+47 47 47 47 41 47 49 41 47 47 47 47 41 47 47 47 47 47 47 47
+47 47 41 47 47 47 47 47 47 47 47 41 47 47 41 49 47 47 44 47
+47 44 44 44 44 45 38 47 47 49 44 47 47 44 47 47 47 47 47 47
+47 47 47 47 47 47 41 47 47 47 41 47 41 47 36 49 47 47 45 47
+47 47 47 41 47 47 47 36 47 47 47 47 49 47 47 47 47 47 47 47
+47 47 47 47 45 49 49 49 47 47 47 47 47 47 47 47 47 47 47 47
+38 47 47 47 36 47 47 47 36 47 47 47 47 38 38 38 38 38 38 38
+47 38 38 49 49 49 49 38 47 47 36 47 36 38 49 47 47 47 47 47
+47 49 49 38 44 31 35 29 44 47 47 47 47 47 47 49 49 47 45 47
+45 47 45 49 47 47 47 36 44 44 40 38 38 40 47 47 47 47 47 47
+47 47 45 47 47 47 47 44 38 38 38 35 34 34 34 35 35 41 47 41
+47 47 47 47 47 47 45 41 47 47 45 47 47 41 38 47 38 47 47 47
+47 47 47 36 47 47 49 47 49 31 38 40 38 44 44 47 47 47 47 36
+47 47 47 36 36 49 49 49 45 44 45 40 45 40 47 38 44 35 34 35
+35 44 38 49 49 47 47 47 47 36 44 44 38 44 44 44 47 49 47 36
+47 47 47 47 47 47 49 47 47 47 47 47 47 47 41 49 47 47 47 47
+41 47 49 41 47 47 47 47 47 47 47 47 47 47 47 47 47 49 47 47
+44 38 44 44 44 45 44 45 44 44 45 47 47 47 47 44 44 45 40 38
+38 44 45 44 40 33 23 21 21 21 23 29 25 29 34 23 25 9 9 9
+ 7 6 6 6 7 6 6 6 6 6 6 6 6 6 6 6 9 7 9 9
+ 7 8 10 6 7 7 9 9 6 8 7 7 6 9 7 6 7 9 7 9
+ 7 6 6 6 9 7 9 7 6 6 6 9 9 9 6 7 9 9 10 9
+ 7 6 7 7 6 7 9 9 9 6
+>gnl|ti|1086975869 name:1099575910963
+ 9 6 6 8 9 6 6 9 7 11 7 7 9 7 7 7 7 8 14 13
+ 7 7 7 6 6 8 11 13 14 13 19 13 15 13 15 21 19 14 16 19
+21 25 24 29 29 35 25 22 23 21 20 21 21 21 20 29 21 27 28 31
+23 23 23 19 18 22 49 25 22 22 22 22 18 13 11 8 9 9 9 14
+11 13 18 17 23 20 26 23 27 20 19 16 17 13 13 13 17 20 30 22
+23 22 24 22 22 32 29 35 29 29 22 22 18 18 19 20 20 10 13 13
+18 20 28 28 28 28 28 32 26 21 22 18 18 25 24 26 26 32 26 26
+21 20 26 30 40 28 23 23 23 25 28 40 32 28 36 28 23 23 32 40
+39 40 28 28 28 27 32 30 23 23 26 40 40 40 32 28 28 29 34 29
+29 30 29 26 26 23 23 24 24 22 22 21 18 15 24 24 28 28 29 36
+32 49 32 36 40 32 28 28 25 23 40 27 23 28 28 28 28 28 28 28
+23 23 27 21 20 18 27 23 24 27 20 20 16 27 24 23 23 17 15 14
+11 14 26 17 39 13 11 20 20 36 40 40 28 27 28 28 27 27 27 23
+19 23 20 25 45 28 27 27 25 21 21 19 25 39 24 21 19 15 15 17
+17 18 24 23 28 23 28 21 19 19 13 13 20 9 13 14 14 14 14 25
+14 17 10 9 9 12 13 13 16 13 18 20 17 20 18 21 18 19 21 16
+12 16 17 26 21 23 39 17 20 13 11 9 12 12 18 23 39 23 23 28
+26 27 27 27 24 24 28 40 39 28 28 27 27 27 40 39 39 21 21 17
+14 11 12 14 39 14 13 12 11 11 14 13 25 25 28 28 23 21 21 23
+19 18 25 25 23 23 17 17 21 27 24 23 13 11 11 11 12 14 23 24
+24 21 17 14 23 39 21 21 24 24 27 24 21 13 13 12 14 16 13 19
+20 16 18 15 11 11 17 17 17 24 19 18 18 25 27 21 21 18 19 23
+19 23 13 13 21 16 13 13 14 11 10 9 9 9 9 9 10 14 24 24
+15 21 15 17 23 36 21 21 18 16 18 10 10 12 19 16 20 11 11 17
+26 23 17 17 17 15 23 24 23 17 17 27 39 36 16 14 17 23 23 23
+21 23 14 10 14 10 11 13 21 14 14 16 12 20 24 24 24 20 14 13
+ 9 10 11 23 15 24 17 13 12 12 12 11 12 12 12 24 14 12 18 12
+11 12 14 11 9 10 10 9 9 9 12 14 18 18 22 14 12 20 13 13
+24 12 17 12 10 11 15 9 9 20 13 13 11 11 14 14 17 17 17 21
+26 32 18 15 12 14 9 9 14 9 11 11 10 9 9 18 16 21 10 11
+ 9 9 13 10 11 10 14 14 13 9 9 9 9 10 17 16 23 16 14 15
+17 17 16 12 10 7 15 12 15 10 11 9 10 12 20 17 13 10 12 12
+ 9 9 9 10 10 8 6 6 6
+>gnl|ti|1086975804 name:1099575910965
+ 6 6 7 7 9 7 7 6 9 8 7 8 8 8 7 7 7 7 9 11
+10 10 13 19 17 14 17 17 19 17 19 19 16 14 17 14 14 16 19 19
+21 23 21 19 26 17 20 22 20 22 21 23 23 24 24 26 35 35 35 41
+44 23 26 25 30 26 34 34 27 28 25 31 31 31 27 22 19 20 16 18
+ 9 9 9 9 14 19 26 22 30 33 33 32 32 44 47 47 45 47 47 47
+47 47 38 44 38 44 38 38 47 47 44 38 44 38 44 45 29 29 21 23
+14 11 17 29 32 38 38 38 38 44 38 38 44 38 38 45 40 28 28 39
+30 44 44 34 33 33 33 31 34 34 44 47 41 34 38 44 38 34 34 38
+44 44 44 47 47 47 47 47 47 47 38 44 47 47 49 49 38 47 47 47
+41 47 47 47 41 47 47 38 38 38 38 38 38 38 47 45 40 36 40 40
+47 45 38 47 47 47 41 47 41 47 47 47 47 47 41 41 47 47 45 47
+47 47 47 47 45 47 47 47 47 47 49 49 49 49 47 45 38 44 40 34
+45 40 32 40 45 34 38 38 44 44 38 49 45 45 40 38 32 40 40 40
+44 36 47 45 47 49 49 47 47 45 47 47 47 47 49 47 47 47 47 47
+47 47 47 47 47 47 41 47 47 47 41 47 47 41 47 47 47 47 41 47
+47 47 40 40 49 49 49 47 47 36 45 40 40 38 38 47 47 47 45 49
+49 28 40 40 45 45 47 47 47 47 49 49 49 47 47 47 45 47 47 41
+47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 49 47 41 47
+38 38 38 38 38 38 49 45 47 49 49 45 47 47 47 47 47 45 45 40
+36 44 47 47 47 47 38 44 38 38 38 38 38 38 47 47 47 41 41 40
+39 32 28 28 36 40 44 36 32 28 45 39 38 47 36 47 47 38 39 36
+28 28 31 29 38 38 38 38 40 47 47 47 49 47 49 49 49 47 47 40
+40 45 45 36 45 47 45 38 47 47 47 47 47 39 39 32 34 40 39 40
+47 47 47 49 38 44 31 34 35 29 32 24 24 26 30 30 38 47 41 36
+36 28 28 36 39 49 49 38 34 40 45 36 47 45 45 38 38 40 47 49
+49 47 45 49 49 49 47 47 47 45 36 36 36 45 32 32 36 40 40 28
+32 36 36 36 38 38 38 49 36 49 34 40 45 45 47 47 38 36 47 47
+36 36 36 47 45 44 44 38 38 44 35 47 49 44 38 36 40 32 32 49
+36 36 36 49 27 19 21 21 39 27 47 36 36 36 36 38 36 36 40 36
+36 34 49 36 40 36 40 32 28 36 36 38 49 24 40 24 32 40 23 23
+36 40 40 36 28 28 23 18 14 14 18 18 16 19 18 18 24 24
+>gnl|ti|1086975847 name:1099575910969
+ 9 6 6 6 6 6 6 14 8 10 12 12 7 7 8 9 9 6 6 6
+ 9 11 14 19 27 24 24 24 22 19 19 21 19 21 19 25 29 26 21 23
+24 24 14 15 22 25 20 24 22 22 27 25 44 38 45 44 30 30 32 31
+28 29 34 31 32 24 21 9 9 6 7 6 6 6 6 7 9 9 9 9
+13 19 27 29 34 34 34 40 39 44 36 29 44 34 44 38 44 38 38 29
+29 38 38 38 38 47 49 45 23 14 10 9 9 12 7 10 14 27 29 29
+35 35 38 38 44 38 44 38 38 38 47 45 44 45 45 35 34 38 44 44
+38 44 44 49 38 47 47 41 47 47 44 38 35 34 38 38 47 45 45 47
+47 47 47 38 44 44 44 34 34 36 32 40 39 31 44 34 34 34 34 45
+38 44 36 32 28 28 23 28 40 28 38 31 31 28 28 29 29 30 28 38
+47 47 41 41 47 47 41 41 45 45 32 38 38 47 47 41 47 47 47 45
+38 38 34 49 49 49 47 47 41 47 47 47 47 47 47 47 47 36 47 47
+47 38 44 38 45 34 34 49 49 34 45 36 47 41 47 47 41 47 38 34
+38 44 34 35 40 38 47 47 38 38 34 38 38 38 45 47 47 44 40 40
+49 49 47 47 45 45 32 34 32 40 34 32 34 45 38 47 41 41 41 47
+49 49 45 49 47 45 49 40 47 47 47 47 47 47 38 47 47 38 47 47
+47 47 36 38 38 47 47 47 47 47 47 41 47 47 47 47 47 47 47 38
+47 38 47 47 47 47 41 47 45 38 38 34 40 40 40 47 38 47 47 47
+40 40 45 45 45 47 47 49 45 49 49 28 28 40 39 47 47 47 47 47
+38 49 49 49 49 49 49 45 49 49 49 49 49 41 47 47 47 47 47 47
+47 47 41 47 47 45 47 47 47 47 47 47 47 47 47 49 47 49 47 45
+49 47 47 47 41 47 47 47 47 38 47 47 47 41 47 38 44 38 38 35
+35 49 47 47 47 47 47 47 40 40 44 40 32 39 45 47 44 45 38 49
+47 44 44 47 47 36 45 40 40 23 23 39 40 38 40 40 40 38 47 47
+47 47 47 45 45 35 38 44 40 40 44 45 36 36 47 47 47 47 47 36
+41 47 45 40 40 40 28 40 40 47 47 47 49 47 47 47 47 38 38 44
+38 40 34 40 45 47 47 47 47 44 47 47 36 39 40 32 38 40 39 39
+17 17 45 45 45 45 40 49 49 27 27 49 32 34 38 38 34 35 34 36
+34 34 14 14 7 7 12 16 14 21 28 26 26 32
+>gnl|ti|1086975784 name:1099575911011
+ 9 9 6 6 6 6 6 6 6 6 6 8 14 16 16 19 10 10 14 14
+14 18 23 16 16 16 16 18 33 19 19 33 24 25 25 24 29 38 19 19
+21 16 17 18 23 34 25 23 26 27 26 29 32 24 24 35 35 31 31 28
+28 24 27 33 34 44 44 34 29 19 14 10 9 9 13 16 20 28 40 32
+40 38 44 38 31 44 38 38 44 44 47 47 31 31 29 31 32 32 47 47
+47 47 47 47 38 38 38 35 34 29 34 32 24 24 26 28 28 38 38 44
+38 44 45 49 49 49 47 47 47 45 38 40 34 35 44 38 44 44 38 31
+35 47 47 36 24 31 32 32 32 32 31 31 35 34 44 38 40 34 44 44
+45 44 38 38 44 44 38 41 49 45 49 45 49 47 47 47 47 47 41 47
+47 47 47 47 47 47 38 38 38 38 38 45 38 44 44 44 44 44 38 38
+49 45 49 47 47 47 45 47 47 47 38 47 38 47 47 47 40 38 40 47
+47 49 49 47 38 44 38 45 38 38 47 49 49 44 38 34 44 38 44 47
+41 47 40 39 28 28 31 34 44 44 47 41 47 41 47 47 47 47 38 45
+36 34 40 38 45 45 40 49 28 28 32 28 28 29 32 40 39 47 47 47
+47 47 47 47 49 45 49 47 49 38 38 44 44 35 38 47 38 38 32 40
+28 40 39 40 40 36 36 40 38 45 47 47 47 47 47 41 41 47 47 38
+47 47 47 47 47 47 36 38 45 38 49 36 49 49 47 38 47 47 47 38
+38 38 38 38 34 44 44 38 40 45 45 49 47 47 47 47 47 47 47 38
+44 38 47 47 38 38 40 41 47 47 47 47 38 44 40 40 34 38 40 47
+47 47 41 36 49 49 47 38 47 47 47 47 45 49 40 34 40 45 40 47
+47 49 44 38 44 44 44 38 47 47 47 49 49 47 41 47 45 47 45 47
+49 36 49 49 49 49 47 49 49 45 40 34 40 38 47 47 47 47 47 47
+41 44 38 38 38 35 29 28 49 28 49 40 36 26 26 16 13 23 22 28
+45 36 34 40 24 24 13 16 18 26 22 28 40 28 28 45
+>gnl|ti|1086975792 name:1099575911030
+ 6 6 6 6 6 6 10 20 19 19 15 12 8 9 6 6 6 11 11 13
+14 21 18 34 34 28 22 14 19 22 17 17 23 29 35 29 24 20 24 20
+25 29 26 28 26 34 34 34 38 44 44 30 27 25 22 23 22 23 33 31
+34 34 35 35 44 44 28 28 24 28 22 18 12 10 20 18 30 33 38 44
+34 34 34 34 26 30 30 26 26 32 47 47 47 41 47 41 47 38 38 38
+38 44 38 47 47 44 44 35 31 26 26 25 25 25 27 32 44 38 44 44
+38 38 44 38 47 44 44 45 44 38 44 44 44 38 44 49 49 47 49 45
+49 47 45 39 45 32 29 31 35 44 38 44 38 38 49 49 41 38 38 45
+44 44 45 47 47 47 40 45 39 35 29 31 31 44 38 44 44 35 38 44
+49 49 49 38 40 40 38 36 38 47 47 47 47 47 47 47 47 47 47 40
+40 36 36 38 45 38 47 44 44 44 40 38 38 36 36 49 47 38 47 45
+47 47 47 41 47 47 45 45 34 32 40 36 47 47 49 47 47 47 47 47
+38 38 47 47 38 47 47 47 47 36 47 47 41 47 47 45 45 28 28 36
+45 47 47 47 47 47 45 49 45 49 49 45 45 49 34 38 38 38 39 32
+28 32 32 40 40 28 40 40 38 40 47 44 41 47 47 45 47 49 45 49
+49 45 38 38 44 45 38 38 40 36 32 34 40 34 32 40 39 38 36 47
+45 47 36 47 41 41 47 41 47 47 47 47 47 47 47 47 47 47 47 41
+45 47 38 47 47 47 49 47 47 38 47 38 47 47 47 47 47 41 47 38
+49 49 49 45 38 41 41 47 41 47 47 47 45 45 44 45 47 47 49 47
+49 49 47 41 36 38 40 36 35 34 40 45 40 38 40 40 49 36 49 47
+47 47 47 47 47 47 44 38 40 34 38 36 41 47 38 38 38 38 38 44
+35 49 49 47 47 44 47 47 47 47 38 47 47 41 45 49 49 49 49 49
+49 49 49 40 40 44 38 47 47 41 47 49 49 49 47 47 47 47 36 40
+39 28 28 49 40 40 29 23 20 11 26 26 28 39 45 21 21 18 16 9
+ 9 10 16 13 23 26 26 29 32
+>gnl|ti|1086975851 name:1099575911034
+ 7 10 9 9 9 7 7 7 7 7 7 12 15 15 6 6 6 9 7 7
+14 7 7 9 9 9 9 7 9 9 9 11 9 9 9 9 9 11 10 9
+ 9 11 11 18 18 24 21 26 21 18 18 17 18 17 26 21 18 21 23 19
+21 32 24 23 35 40 35 38 38 28 24 21 18 20 13 18 18 18 24 24
+38 38 33 33 19 23 38 45 44 47 41 22 22 30 29 32 19 24 38 44
+44 35 44 35 44 44 38 47 34 34 34 34 44 34 45 49 34 32 39 40
+36 47 38 38 44 44 38 44 35 44 38 44 44 49 49 40 23 28 40 40
+40 38 38 38 38 47 47 38 47 47 36 47 47 47 47 47 47 47 47 47
+47 47 47 47 47 41 47 47 47 47 47 29 29 39 25 25 40 39 47 38
+44 47 47 47 45 36 47 44 30 28 23 21 26 39 40 44 38 38 40 32
+32 28 49 39 44 40 40 40 20 20 40 39 41 47 36 38 44 44 44 38
+38 47 47 47 49 44 38 44 34 38 38 38 44 38 38 38 41 47 47 47
+47 47 38 40 40 40 34 45 44 47 38 45 40 40 40 40 39 45 45 45
+47 47 45 47 45 44 49 49 32 49 49 49 47 47 47 47 45 44 40 40
+34 40 39 47 36 38 47 38 47 47 47 47 47 47 47 47 47 47 49 47
+47 47 47 47 47 47 47 41 47 47 41 47 47 45 39 28 32 40 39 45
+47 47 38 44 38 38 38 38 47 38 40 40 34 38 44 44 34 36 38 45
+47 47 38 38 32 40 38 40 36 45 38 38 36 40 45 44 47 47 47 47
+49 49 38 38 38 44 35 34 49 49 49 49 47 47 47 47 47 47 47 47
+49 41 47 47 47 47 47 47 47 41 47 47 47 41 47 49 47 45 38 35
+38 35 34 47 45 39 40 28 20 20 40 39 38 47 36 38 38 38 44 38
+44 38 47 45 49 47 47 47 47 47 40 49 49 49 49 49 49 49 47 47
+47 47 47 47 47 49 49 28 23 40 39 44 47 47 47 47 38 44 47 47
+47 45 38 32 32 45 36 40 38 38 47 38 49 49 40 40 45 45 47 47
+47 47 38 47 47 38 38 38 38 38 35 40 40 28 28 39 40 40 40 40
+28 40 40 47 47 49 49 49 49 23 16 16 26 23 40 32 35 36 39 38
+35 18 16 10 9 10 16 12 23 28 28 45 45
+>gnl|ti|1086975800 name:1099575911036
+ 7 6 6 7 7 7 7 7 7 7 6 7 7 7 7 17 17 17 16 13
+13 18 17 12 12 7 7 7 12 14 21 19 26 25 27 16 16 16 14 16
+13 15 16 18 17 17 17 21 22 28 17 18 18 18 18 23 21 21 18 22
+24 20 26 24 28 30 28 31 38 34 29 29 21 19 18 11 14 11 12 23
+25 29 30 33 33 31 32 33 33 34 38 47 32 32 32 32 32 32 34 40
+38 44 44 44 29 28 26 33 33 28 34 34 34 38 30 36 28 28 40 40
+32 49 36 28 33 26 26 32 32 32 29 32 29 32 45 49 40 23 25 36
+25 35 31 35 38 34 49 47 45 36 49 36 47 38 45 40 40 36 44 40
+32 45 40 38 45 45 47 47 47 47 47 45 45 40 28 21 21 45 39 47
+38 38 47 38 38 45 45 47 34 27 24 18 18 23 39 39 40 36 39 40
+32 32 23 40 39 38 40 39 29 19 19 39 39 32 40 32 40 45 47 47
+38 38 38 38 29 34 33 30 33 34 29 44 44 38 38 44 34 40 39 45
+40 38 40 36 32 40 39 40 40 45 45 45 38 40 40 32 38 40 47 47
+44 35 44 44 38 35 40 49 49 49 45 45 49 38 38 38 38 44 38 32
+32 28 32 40 32 40 39 36 44 34 34 38 44 35 47 47 47 47 47 47
+45 47 45 45 32 40 44 38 47 47 47 47 38 47 40 40 28 28 28 49
+49 36 40 40 39 40 40 40 40 40 40 32 28 40 45 39 40 40 40 38
+45 45 44 34 34 35 34 34 32 40 44 45 40 40 32 39 40 47 47 47
+40 38 49 40 36 40 45 32 40 32 49 45 49 36 40 45 38 47 47 47
+36 47 49 45 38 32 40 45 45 47 47 49 49 49 45 40 40 40 44 44
+38 44 44 29 45 38 28 28 19 19 22 29 40 44 36 36 36 40 38 36
+47 44 38 47 36 47 40 38 40 40 45 40 49 47 49 49 49 49 47 47
+47 36 39 40 35 35 32 49 28 28 28 40 36 47 47 38 38 38 40 49
+45 45 49 40 40 40 32 32 23 28 32 39 28 49 49 28 28 40 39 40
+44 36 40 40 36 36 38 38 35 35 34 30 49 32 25 23 39 36 40 28
+28 23 40 40 40 40 49 49 49 49 38 32 40 32 32 26 20 20 28 26
+29 23 20 11 11 14 19 11 14 14 14 45 45
+>gnl|ti|1086975787 name:1099575911038
+ 6 6 6 6 6 6 6 6 9 7 8 7 7 12 13 12 19 19 27 36
+30 24 19 19 26 19 19 21 23 24 24 24 29 27 36 29 29 24 15 17
+15 15 16 21 32 39 36 44 29 25 29 29 34 30 28 23 26 30 28 44
+49 45 47 24 24 29 29 27 32 30 29 36 40 20 20 9 8 13 14 23
+14 18 24 27 34 28 29 29 28 28 31 31 44 34 34 34 34 33 33 34
+29 47 47 47 47 47 47 47 47 45 38 27 27 18 18 30 32 38 32 34
+45 38 34 44 34 33 31 44 44 44 41 41 47 32 30 32 32 30 33 40
+40 34 45 45 45 47 47 38 44 47 44 44 35 38 47 38 47 38 47 47
+38 41 47 47 38 44 38 38 44 38 38 44 38 38 38 36 45 49 28 28
+40 40 40 38 38 36 40 34 49 40 40 36 47 47 38 38 38 38 44 44
+38 47 47 47 45 47 47 47 47 49 49 49 38 32 40 32 23 23 40 39
+41 40 35 38 34 34 45 44 47 45 45 45 39 28 28 29 29 34 34 35
+34 32 40 28 36 49 47 39 29 28 19 19 39 39 47 38 38 31 38 38
+44 44 38 38 47 36 36 38 40 36 47 47 47 41 47 47 36 47 38 49
+49 49 45 49 36 40 40 40 34 40 44 44 38 40 40 40 40 40 39 41
+38 44 38 38 44 44 38 38 38 34 49 49 49 47 47 47 47 47 45 44
+34 34 40 36 40 36 47 47 45 45 34 32 45 45 47 45 47 45 45 38
+49 47 47 47 47 47 47 47 47 47 47 47 47 47 47 39 40 28 32 36
+40 40 36 47 44 44 47 47 47 38 47 38 40 40 40 38 45 38 47 47
+47 45 47 47 38 45 40 40 44 45 47 47 40 40 40 36 44 38 45 45
+47 47 47 47 38 38 44 44 34 34 49 49 49 45 40 40 45 45 47 47
+47 47 47 47 44 47 47 47 47 47 47 36 47 47 47 47 47 49 49 44
+44 44 45 34 34 49 31 44 27 27 20 20 49 45 49 49 49 40 40 40
+45 38 47 44 47 49 49 29 38 38 34 35 38 49 49 49 49 49 49 45
+49 47 45 45 47 47 47 47 40 40 28 28 40 39 47 47 41 47 38 44
+47 47 45 45 47 36 40 40 47 40 44 38 47 38 49 49 40 40 45 38
+47 47 36 47 47 41 47 44 44 31 25 20 10 12 24 16 17 17 23 23
+40 28 28 32 39 40 40 40 40 32 39 36 28 28 40 22 32 14 14 9
+ 9 13 16 16 28 25 25 36 36
+>gnl|ti|1086975820 name:1099575911042
+ 9 9 9 9 6 7 7 6 6 9 8 8 7 7 8 7 7 12 12 16
+16 19 19 17 23 13 17 13 21 13 12 13 17 13 14 26 25 30 34 33
+33 44 34 34 22 19 13 17 28 26 27 27 28 29 26 26 38 24 26 26
+21 20 21 29 29 27 24 24 22 26 26 26 26 27 24 16 9 10 14 19
+18 18 18 18 20 23 27 28 32 32 24 23 26 24 19 20 33 32 33 33
+44 24 36 24 21 21 21 26 35 24 27 29 34 40 39 36 23 26 29 20
+23 24 27 23 24 28 29 29 29 35 44 44 38 38 44 38 24 38 38 40
+45 36 36 38 40 34 45 45 47 47 45 38 34 27 24 18 18 39 39 44
+44 35 44 44 38 47 47 47 45 49 47 47 47 47 47 38 44 38 35 34
+29 44 49 49 49 49 38 38 38 35 34 44 38 32 32 40 23 23 39 40
+45 34 40 49 49 45 49 47 47 47 45 36 28 40 45 32 35 32 49 36
+49 45 47 47 47 40 39 28 28 28 39 31 44 34 35 34 35 40 40 38
+40 40 40 45 49 34 34 40 34 40 45 45 45 45 36 34 34 34 35 35
+34 45 40 32 27 26 23 21 20 28 28 28 39 40 40 40 32 28 39 28
+26 26 26 28 28 28 45 44 44 44 44 47 47 39 40 28 28 40 40 40
+36 40 28 28 45 45 39 40 40 40 36 36 40 27 20 18 18 27 25 38
+38 44 38 35 45 49 49 49 47 49 45 40 40 45 34 40 40 49 49 49
+38 49 32 49 27 27 19 27 29 40 40 40 40 40 28 28 39 32 36 27
+28 29 21 21 32 40 32 29 29 38 34 34 27 30 27 19 19 27 30 38
+49 36 32 28 28 49 40 40 45 39 47 47 47 44 38 49 49 34 45 49
+45 40 40 32 32 32 40 40 40 45 39 40 28 28 28 49 27 28 49 45
+44 38 38 44 34 35 38 32 32 28 28 23 32 32 40 40 40 38 38 32
+49 45 49 28 32 27 25 14 15 27 27 36 24 20 23 23 20 26 32 32
+28 49 49 36 34 36 40 40 40 36 24 28 23 23 36 49 36 45 34 32
+45 24 40 32 23 23 24 23 22 13 13 21 24 32 36 36 36 28 34 32
+32 25 25 32 40 28 36 28 28 49 28 28 20 17 10 10 10 14 12 28
+21 21 45 45
+>gnl|ti|1086975840 name:1099575911044
+ 6 6 6 7 7 10 10 12 12 12 12 13 12 12 12 12 12 16 20 24
+23 19 19 19 23 16 17 25 18 24 20 35 41 21 20 28 20 20 20 23
+33 26 23 23 23 25 27 25 29 38 32 28 31 34 33 38 44 34 35 49
+49 49 47 27 26 30 25 27 24 23 19 20 10 10 7 12 12 20 14 40
+40 45 45 33 32 30 29 26 26 34 34 38 44 44 33 33 33 33 30 44
+38 38 40 44 45 47 47 47 47 36 44 38 39 39 28 28 40 27 38 44
+38 44 38 38 38 38 49 47 47 47 47 33 32 26 26 32 26 38 40 47
+47 47 47 47 38 44 38 38 38 44 41 47 47 44 44 44 44 44 38 47
+47 47 47 38 31 44 38 38 38 38 47 47 36 47 47 47 45 47 38 38
+44 44 44 44 47 49 45 40 34 34 40 44 47 47 45 45 45 49 45 47
+47 47 47 38 44 38 44 38 35 44 47 47 47 38 44 38 38 38 38 47
+47 38 36 47 47 36 38 38 38 38 38 38 47 47 38 31 38 38 38 38
+34 35 28 28 40 32 45 45 47 47 47 39 40 39 32 32 31 29 38 38
+38 29 32 32 44 38 47 41 47 45 45 40 40 40 49 49 45 45 45 45
+40 40 49 49 49 32 49 31 28 28 31 29 38 36 38 38 47 47 47 47
+38 38 47 47 47 47 44 45 32 40 49 49 45 47 38 47 36 41 47 41
+40 45 40 40 38 45 47 45 47 47 47 49 49 49 49 38 38 45 38 38
+35 32 39 39 38 47 47 40 40 40 34 38 38 47 47 36 47 47 47 47
+47 47 47 47 47 49 47 47 47 45 38 32 32 28 40 32 34 38 49 49
+47 40 45 34 40 45 38 38 47 47 47 47 49 49 45 49 47 49 44 38
+38 38 31 38 38 38 31 31 28 28 40 40 36 47 49 47 47 47 47 47
+45 49 49 49 49 47 47 38 40 34 36 36 47 45 45 36 40 34 40 40
+44 49 49 29 35 44 38 38 44 49 45 47 47 47 38 47 47 38 40 40
+40 40 36 38 38 47 47 47 47 49 49 47 47 45 45 40 40 49 45 47
+47 47 47 47 41 47 47 41 47 47 47 47 47 47 47 47 47 38 47 45
+27 19 25 25 27 38 44 38 33 33 44 38 45 45 47 47 49 40 34 34
+40 40 45 44 47 47 38 49 49 49 49 40 34 38 44 40 40 49 36 28
+39 32 34 45 45 45 47 38 47 38 36 49 49 38 36 36 38 47 47 36
+45 47 49 49 49 36 45 39 27 19 19 39 39 41 38 38 47 47 47 47
+47 47 47 45 47 47 47 47 36 47 36 38 38 40 38 45 47 47 49 45
+34 34 29 29 35 29 36 40 32 28 27 25 45 45 40 40 36 36 38 47
+47 45 47 47 36 47 36 36 36 36 36 36 36 36 36 47 34 38 29 23
+20 9 9 20 24 36 40 40 30 17 19 11 11 20 20 24 14 16 9 9
+ 9 8
+>gnl|ti|1086975803 name:1099575911046
+ 6 6 6 6 6 6 6 7 8 7 7 6 6 9 8 8 8 13 16 13
+11 11 8 8 18 18 19 19 19 19 19 19 19 19 12 12 16 15 14 14
+24 24 27 24 23 34 19 19 23 17 17 18 14 17 23 34 19 22 32 24
+22 36 24 36 19 31 24 24 25 23 17 11 10 8 6 6 7 8 12 24
+24 24 36 32 32 27 24 38 35 38 35 27 29 34 33 33 31 29 38 47
+45 47 47 47 44 38 29 33 33 22 23 16 13 16 22 19 20 23 28 40
+32 40 38 47 40 40 40 40 35 34 38 29 44 38 36 38 38 47 47 36
+47 33 29 30 31 31 28 44 36 47 40 45 49 49 47 47 47 47 38 38
+40 40 34 40 39 47 38 38 40 40 44 47 47 47 47 47 47 49 49 31
+38 38 38 19 27 20 20 24 27 40 36 32 29 28 29 35 45 30 40 32
+40 39 39 36 40 35 32 36 44 47 47 47 36 47 47 47 45 49 49 36
+49 36 24 24 38 38 38 38 38 38 40 40 45 49 34 45 38 38 38 35
+34 38 38 47 47 47 47 45 38 40 32 38 40 47 45 38 40 34 40 38
+49 38 47 47 47 36 39 28 28 28 49 49 36 40 40 44 45 40 40 45
+45 47 38 40 40 34 40 32 28 28 36 40 34 38 34 24 27 23 18 18
+27 27 32 40 45 32 30 24 20 20 32 29 40 23 40 28 40 40 28 28
+32 49 32 49 45 49 34 40 32 40 34 40 34 40 40 38 36 47 38 34
+38 38 34 27 28 26 26 24 30 34 35 38 35 35 45 47 47 47 47 36
+36 47 47 38 40 36 36 36 40 28 40 39 32 40 34 39 24 40 40 39
+39 36 47 47 40 36 40 49 36 44 40 40 45 36 40 38 49 49 40 36
+40 47 24 36 38 38 36 40 40 24 39 32 32 35 24 40 47 47 40 45
+40 40 28 28 36 36 36 36 36 49 49 32 36 36 36 36 28 28 24 32
+28 28 40 36 47 40 47 38 24 32 24 36 39 28 28 32 29 30 30 34
+26 16 15 6 6 7 7 18 19 18 23 26 28 25 27 23 24 27 18 15
+18 23 23 23 26 49 49 39 27 28 18 23 23 40 36 32 28 28 36 24
+24 24 36 32 28 28 32 36 49 32 28 28 28 36 29 34 29 26 26 26
+28 49 36 36 28 28 32 32 35 35 40 40 24 28 24 34 32 24 23 23
+24 24 36 32 24 24 24 36 24 23 26 22 17 24 24 19 19 21 20 25
+21 22 27 27 36 36 40 40 40 36 36 24 24 32 24 24 36 24 32 32
+24 28 19 28 21 26 26 32 40 24 28 32 24 24 24 24 24 24 24 24
+23 34 34 23 34 34 36 28 24 20 20 19 23 19 27 28 19 19 19 19
+19 24 24 24 24 36 22 24 23 22 22 16 13 15 13 23 23 19 19 14
+18 21 25 32 32 32 35 23 22 16 11 11 10 18 15 17 22 14 15 22
+14 14 12 12 7 7 7 12 8 10 16 16 19 19
+>gnl|ti|1086975769 name:1099575911052
+10 9 10 10 9 9 9 9 9 10 9 9 9 7 6 6 6 9 6 7
+ 7 7 8 10 12 12 12 13 19 18 15 12 13 11 10 8 9 9 9 12
+12 18 22 17 13 12 14 16 15 15 22 21 20 20 17 24 16 19 19 21
+21 21 22 21 21 19 19 17 23 23 23 27 27 23 24 29 19 8 10 6
+ 6 6 8 9 7 6 7 7 7 8 9 15 26 28 23 26 21 25 14 14
+24 25 33 33 28 22 19 16 13 13 27 24 29 26 25 26 21 13 12 7
+ 8 10 7 6 6 9 9 18 17 18 25 23 40 32 49 27 28 24 24 26
+28 29 28 28 28 26 26 26 28 28 26 28 28 27 24 30 33 27 29 20
+20 21 28 28 28 28 28 23 28 28 28 26 23 27 27 23 23 35 29 31
+31 49 49 40 32 32 28 26 20 16 12 9 9 9 9 17 17 28 23 23
+28 23 23 28 28 32 28 25 23 23 23 23 30 27 24 28 26 26 26 24
+28 32 39 28 28 28 28 28 23 26 20 20 21 27 28 23 28 32 32 29
+29 29 28 28 29 39 30 19 19 20 16 20 12 23 23 40 39 32 40 28
+28 23 23 17 16 13 26 26 28 28 45 39 38 36 32 40 40 28 28 28
+45 32 35 29 30 21 20 18 17 18 27 24 49 16 16 23 16 18 25 27
+32 25 23 18 16 14 11 9 9 13 17 23 12 10 25 23 21 23 23 28
+28 21 19 21 24 32 18 21 27 27 32 28 28 32 21 18 18 19 18 18
+28 28 28 16 14 13 12 22 18 28 32 27 23 18 15 18 21 24 30 32
+27 23 20 20 14 14 10 13 11 12 9 25 23 18 18 24 39 16 16 10
+ 9 16 12 16 40 25 20 21 27 26 23 26 26 24 29 28 28 27 27 19
+19 19 21 28 28 28 24 26 26 29 27 32 20 20 27 27 28 28 28 39
+28 28 28 28 28 32 49 27 24 24 17 11 21 21 29 35 49 27 27 18
+18 24 30 30 27 23 23 11 17 23 25 28 23 28 28 27 39 23 23 16
+16 25 23 26 25 23 28 40 28 20 14 9 9 10 13 11 19 18 23 18
+18 18 13 10 13 9 9 11 16 20 28 25 23 32 28 28 28 28 40 32
+40 32 27 23 17 23 26 17 17 21 21 40 27 27 17 11 20 15 23 26
+39 16 19 23 23 21 24 20 19 24 24 18 23 27 49 49 27 25 28 23
+39 13 14 17 23 20 20 28 27 27 25 19 19 9 9 9 16 15 23 24
+19 19 23 25 25 40 28 28 19 29 30 25 25 18 23 18 16 18 18 36
+39 15 14 14 15 23 21 24 23 11 12 12 23 24 23 17 17 23 17 21
+21 25 17 18 39 39 39 29 13 13 24 17 18 13 21 23 23 24 23 36
+27 14 13 13 23 26 27 19 19 39 39 24 19 23 28 18 24 28 28 23
+23 11 11 10 10 11 20 20 25 28 28 32 29 23 18 21 21 27 29 32
+36 28 24 39 49 19 12 11 20 20 23 24 40 39 47 49 49 36 38 45
+36 47 47 36 39 20 18 11 14 16 18 36 36 36 36 38 49 24 36 34
+32 36 28 28 19 31 28 28 49 36 36 38 19 19 19 19 17 24 24 24
+40 24 24 39 24 22 15 13 20 22 19 24 36 24 27 28 20 18 25 39
+38 24 27 23 16 19 19 19 21 29 49 36 41 49 45 36 40 24 24 24
+19 19 13 12 12 12 13 13 14 16 9 9 13 14 7 7 13 18 19 17
+23 23 13 14 18 18 19 16 13 9 10 7 7 15 17 23 15 12 12 15
+25 24 19 17 18 8 8 16 12 19 9 9 9 16 17 14 24 16 17 10
+ 8 9 12 9 9 18 9 9 7 7 12 12 12 13 9 9 17 14 11 10
+16 8 8 8 8 17 16 8 7 8 7 7 7 7 16 14 23 15 8 8
+ 8 9 12 12 9 8 7 8 7 6 7 7 11 9 10 8 12 7 7 9
+ 7 7 7 9 10 7 7 7 7 6 7
+>gnl|ti|1086975833 name:1099575911058
+ 8 6 7 7 7 7 8 6 6 6 6 7 7 7 7 9 11 11 8 11
+ 7 7 7 12 13 8 13 12 12 8 8 7 8 8 10 12 18 14 19 22
+22 27 28 34 19 25 19 17 19 23 19 22 22 15 14 17 19 26 21 45
+28 28 36 26 30 26 21 24 19 24 14 11 7 7 6 6 6 6 6 7
+10 10 13 13 28 20 28 28 35 35 35 38 38 38 34 34 34 35 34 34
+49 49 38 45 47 40 45 40 40 40 28 27 28 20 11 9 6 6 10 9
+ 9 14 13 24 23 29 40 32 32 34 34 40 39 47 47 47 45 47 36 45
+36 47 38 38 44 28 22 20 20 20 24 26 29 24 28 28 26 26 40 29
+40 32 28 23 40 28 29 29 29 29 29 40 40 35 19 22 16 19 19 27
+40 45 32 34 49 40 28 20 17 11 9 9 9 11 18 20 23 30 30 44
+29 29 25 20 12 20 21 40 40 45 40 34 34 38 40 38 36 40 40 34
+40 40 34 32 40 34 49 49 29 23 22 22 22 23 24 28 28 35 32 40
+40 47 47 47 38 38 32 29 35 34 44 31 23 28 28 40 32 36 40 40
+49 28 23 23 40 24 24 28 26 26 30 30 29 27 27 29 23 24 23 23
+23 45 25 35 45 34 35 35 34 29 34 34 29 32 28 28 32 32 34 34
+19 28 24 29 29 38 38 38 36 40 32 32 35 32 40 40 32 32 40 40
+38 49 32 39 39 28 29 29 29 35 34 34 34 40 40 47 40 35 29 35
+29 35 29 28 40 32 36 35 32 28 32 28 28 45 40 40 28 28 40 28
+28 28 28 29 28 24 27 27 28 22 23 23 23 28 40 32 36 38 34 40
+34 36 35 28 28 27 30 24 29 21 23 23 40 24 49 28 28 40 28 23
+23 40 32 49 49 27 27 18 23 27 24 24 28 23 23 26 28 32 49 45
+34 40 34 40 32 40 49 45 49 40 40 34 40 34 38 49 49 49 40 32
+36 40 40 34 40 40 40 49 49 49 32 32 32 28 28 28 27 45 28 25
+25 16 18 10 10 14 18 21 29 18 12 10 10 16 20 19 19 39 27 40
+28 28 29 29 28 28 29 36 36 36 28 28 40 24 40 25 25 45 32 49
+32 28 28 40 32 40 34 40 32 40 23 28 28 24 24 20 26 24 21 20
+27 28 49 49 32 28 28 28 36 24 24 23 23 28 20 11 15 15 19 19
+29 28 39 40 23 28 40 32 28 28 49 32 26 24 20 17 17 17 17 22
+17 20 19 18 19 22 15 16 29 26 24 24 24 24 17 17 18 18 18 22
+16 16 19 24 19 20 20 15 22 16 13 12 12 14 14 19 22 27 23 19
+12 12 13 13 13 11 25 18 22 14 13 20 14 23 28 32 23 21 17 17
+14 14 13 17 15 15 19 13 10 12 9 9 9 9 12 11 11 9 7 8
+11 16 23 24 23 12 12 7 7 12 12 19 24 24 19 16 14 15 15 12
+10 8 10 10 10 17 19 18 20 18 15 11 13 13 17 21 26 24 29 29
+27 29 19 22 22 16 17 9 9 9 9 10 16 10 10 14 12 17 19 13
+ 9 7 10 10 9 9 13 13 22 22 23 16 16 12 12 21 14 13 23 13
+16 8 8 8 17 12 17 17 18 16 12 13 9 9 12 12 10 10 14 18
+16 18 15 14 13 9 10 13 13 11 7 9 15 11 7 7 7 7 8 8
+11 13 14 9 7 8 7 11 13 11 18 9 9 11 12 10 17 7 7 9
+ 9 9 11 8 10 10 9 8 9 9 9 8 13 10 9 13 8 9 7 8
+ 7 6
+>gnl|ti|1086975899 name:1099575911061
+ 8 7 7 7 6 7 6 6 9 10 13 7 8 9 14 16 10 10 12 12
+12 12 23 44 44 44 14 14 16 16 18 18 25 21 21 25 20 24 21 25
+26 29 35 34 34 34 38 35 38 25 30 26 28 23 24 24 27 33 47 49
+41 41 47 47 47 38 27 24 20 17 11 11 7 12 15 13 26 21 22 24
+29 45 38 24 32 29 32 31 33 38 38 34 38 49 45 49 45 35 38 38
+34 34 35 47 38 47 31 24 28 15 13 11 9 12 16 26 36 40 24 38
+35 38 38 44 47 47 47 47 44 38 35 35 44 38 38 32 32 32 32 32
+32 38 40 47 47 47 47 38 38 44 38 38 44 47 38 31 44 38 44 38
+38 34 34 34 34 34 44 47 41 47 47 47 49 47 47 45 47 45 45 40
+45 45 40 40 47 39 39 40 23 23 39 40 47 47 36 47 49 49 47 44
+45 38 38 44 44 47 47 47 47 47 47 41 47 47 47 47 38 47 47 47
+47 36 38 29 29 29 28 28 40 40 45 47 47 36 38 47 49 47 47 47
+38 47 47 47 47 47 38 40 40 40 38 39 38 38 29 29 29 29 38 38
+47 47 29 38 38 34 34 38 45 45 32 40 45 49 49 49 47 45 40 38
+40 32 40 38 47 47 38 41 38 45 32 24 26 26 26 24 24 28 28 32
+32 38 31 44 44 44 38 34 38 38 40 47 38 47 47 47 47 49 47 47
+47 47 47 45 47 38 47 38 49 49 49 49 40 45 47 47 47 47 47 47
+38 40 34 40 38 40 32 38 40 47 47 47 47 49 47 47 49 47 47 38
+38 38 35 35 35 35 44 40 47 38 40 40 32 32 36 40 36 47 47 38
+47 49 49 49 47 49 45 49 49 32 45 40 47 47 41 47 47 47 47 45
+45 45 40 40 45 40 47 38 47 47 38 47 38 47 47 47 41 38 45 45
+38 34 40 45 34 35 35 30 30 35 32 40 39 40 40 44 45 47 47 36
+47 40 40 38 38 47 38 49 49 40 47 47 47 47 38 45 40 40 40 38
+47 49 47 45 47 47 38 44 47 38 47 47 38 38 32 40 38 38 47 45
+44 34 40 40 47 47 47 47 49 49 49 49 47 47 47 47 47 47 47 47
+47 47 47 47 38 38 36 36 28 49 49 49 41 47 47 47 45 45 40 40
+49 38 40 40 44 36 47 47 47 49 49 49 49 47 49 49 49 34 44 44
+44 38 44 47 47 47 49 47 49 45 45 45 40 40 40 49 49 47 47 47
+38 44 36 40 40 38 47 47 41 47 36 36 38 36 49 47 49 47 45 40
+40 40 34 36 49 45 47 38 44 35 38 35 44 47 47 47 36 40 40 32
+28 49 32 49 45 41 41 38 30 28 23 23 26 40 40 40 44 45 36 45
+45 49 32 49 45 32 32 45 36 38 36 47 40 36 36 38 41 47 44 36
+34 24 38 29 29 29 26 32 36 36 36 36 47 24 36 44 24 38 24 25
+29 36 36 32 36 29 34 24 24 24 29 36 36 36 47 41 36 47 36 36
+36 36 36 36 36 36 24 28 32 36 32 32 36 36 47 36 47 36 36 38
+49 36 24 29 29 27 29 24 44 32 36 32 32 32 39 36 47 41 47 47
+47 47 44 44 45 45 40 45 45 47 47 47 47 47 47 47 47 45 40 36
+40 38 38 47 47 47 40 38 45 47 38 44 44 34 38 35 39 39 18 17
+45 27 25 18 12 9 16 9 9 16 16 25 30 26 24 29 40 36 21 21
+24 19 15 9
+>gnl|ti|1086975862 name:1099575911063
+ 6 6 6 6 6 7 6 9 9 9 7 14 12 7 8 7 7 12 12 14
+17 14 17 19 17 11 11 9 7 21 14 17 21 21 21 29 24 23 19 23
+21 23 23 44 24 34 25 19 18 24 23 25 18 24 29 35 35 34 25 45
+38 44 45 23 27 28 27 21 21 24 24 20 18 10 9 12 19 20 23 25
+26 26 26 38 38 44 38 38 38 38 47 38 44 44 38 44 38 41 47 47
+47 44 38 44 44 38 44 44 29 35 22 19 17 16 16 17 45 45 47 45
+47 41 49 49 47 47 38 38 44 44 44 34 47 49 41 41 47 47 45 41
+44 38 38 38 29 38 38 40 49 31 29 34 34 35 38 47 49 47 38 44
+44 44 45 44 45 47 47 47 49 49 49 49 47 36 47 47 47 47 41 45
+49 40 39 40 28 28 31 29 44 38 35 36 38 44 47 47 47 38 41 47
+47 47 41 47 47 47 47 38 47 47 38 38 44 38 31 44 36 40 44 38
+34 29 40 38 36 47 47 47 47 41 41 47 47 36 47 47 38 38 38 44
+38 44 47 47 47 47 49 38 47 45 47 47 45 45 45 45 40 40 40 45
+40 40 39 23 23 40 40 36 36 40 45 45 45 38 38 44 40 40 44 38
+47 47 47 47 47 47 47 47 47 47 41 38 38 38 38 38 44 47 40 40
+39 45 35 45 36 47 47 47 47 47 38 49 47 47 47 47 47 47 47 47
+47 38 40 40 36 40 40 44 45 38 34 40 40 38 47 49 49 47 47 47
+41 41 47 47 47 41 47 47 49 49 45 41 45 47 47 47 36 49 45 49
+49 47 41 38 45 34 28 28 29 26 23 23 28 28 39 36 45 47 38 38
+38 38 38 44 47 47 41 47 47 47 45 45 34 49 45 45 47 47 47 47
+47 47 47 41 49 49 45 38 47 47 41 47 47 47 47 44 40 40 36 44
+38 38 47 47 47 47 47 47 49 45 49 49 38 36 40 44 40 32 38 36
+47 47 47 47 47 38 44 40 40 40 45 47 45 47 38 44 44 44 44 36
+49 45 49 27 27 27 27 40 39 47 47 47 49 47 45 45 40 34 34 40
+49 45 45 44 45 38 44 44 47 41 47 47 47 47 47 47 47 47 45 30
+27 33 24 24 28 49 49 49 32 40 39 40 47 45 38 49 40 38 40 47
+47 47 38 47 36 38 47 47 47 36 44 32 34 40 36 24 47 47 45 38
+49 49 49 41 47 45 38 36 32 38 32 40 44 38 36 49 24 49 45 45
+47 41 36 44 49 47 49 47 36 36 47 47 47 36 36 40 29 23 12 11
+29 20 23 23 32 19 19 12 12 21 21 40 36 36 28 23 18 10 15 15
+20 12 21 24 21 21 24
diff --git a/test/minimus/influenza-A/influenza-A.seq b/test/minimus/influenza-A/influenza-A.seq
new file mode 100644
index 0000000..37bfd09
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-A.seq
@@ -0,0 +1,1587 @@
+>gnl|ti|1086975905 name:1099575910428 mate_pair:1086975851
+TGGAAATCCGTCTCGAATGGAGGTCTAGTGCGTTTCCGCTTCAACCCGATGATTGTCGAACTTGCAGAAA
+AAGCAATGAAAGAGTATGGAGAGGATCTGAAAATTGAAACAAACAAATTTGCAGCAATATGCACCCACTT
+GGAGGTATGTTTCATGTATTCAGATTTTCATTTCATCAATGAACAAGGCGAATCAATAATGGTAGAACTT
+GATGATCCAAATGCACTGTTAAAGCACAGATTTGAAATAATCGAGGGGAGAGACAGAACAATGGCCTGGA
+CAGTAGTAAACAGTATCTGCAACACTACTGGAGCTGAAAAACCGAAGTTTCTACCAGATTTGTATGATTA
+CAAGGAGAACAGATTCATCGAAATTGGAGTGACAAGAAGAGAAGTCCACATATATTACCTTGAAAAGGCC
+AATAAAATTAAATCTGAGAACACACACATTCACATTTTCTCATTCACTGGGGAGGAAATGGCCACAAAGG
+CAGACTACACTCTCGACGAGGAGGTCATAGCTGTTTACTGAGGGACCCATTTAAAATTCTAATACCCAGC
+TTTGAACGTGACCATGCCAAACAAGGACAACCTGACCACACAAGAGGTCAA
+>gnl|ti|1086975821 name:1099575910432 mate_pair:1086975778
+GACAGGACATATATTAGTATGGAAGATAAAAGAACTACGGAATCTGATGTCGCAGTCTCGCACTCGCGAG
+ATACTGACAAAAACCACAGTGGACCATATGGCCATAATTAAGAAGTACACATCGGGGAGACAGGAAAAGA
+ACCCGTCACTTAGGATGAAATGGATGATGGCAATGAAATACCCAATCACTGCTGACAAAAGGATAACAGA
+AATGGTTCCGGAGAGAAATGAACAAGGACAAACTCTATGGAGTAAAATGAGTGATGCTGGATCAGATCGA
+GTGATGGTATCACCTTTGGCTGTAACATGGTGGAATAGAAATGGACCCGTGACAAGTACGGTCCATTACC
+CAAAAGTATACAAGACTTATTTTGACAAAGTCGAAAGGTTAAAACATGGAACCTTTGGCCCTGTTCATTT
+TAGAAATCAAGTCAAGATACGCAGAAGAGTAGACATAAACCCTGGTCATGCAGACCTCAGTGCCAAAGAG
+GCACAAGATGTAATTATGGAAGTTGTTTTTCCCAATGAAGTGGGAGCCAGGATACTAACGTCGGAATCGG
+GTCATAGCTGGTTTCCTA
+>gnl|ti|1086975860 name:1099575910435 mate_pair:1086975800
+AAAGTCTGATTCGAAATGGAAGATTTTGTGCGACAATGCTTCAACCCGATGATTGTCGAACTTGCAGAAA
+AAGCAATGAAAGAGTATGGAGAGGATCTGAAAATTGAAACAAACAAATTTGCAGCAATATGCACCCACTT
+GGAGGTATGTTTCATGTATTCAGATTTTCATTTCATCAATGAACAAGGCGAATCAATAATGGTAGAACTT
+GATGATCCAAATGCACTGTTAAAGCACAGATTTGAAATAATCGAGGGGAGAGACAGAACAATGGCCTGGA
+CAGTAGTAAACAGTATCTGCAACACTACTGGAGCTGAAAAACCGAAGTTTCTACCAGATTTGTATGATTA
+CAAGGAGAACAGATTCATCGAAATTGGAGTGACAAGAAGAGAAGTCCACATATATTACCTTGAAAAGGCC
+AATAAAATTAAATCTGAGAACACACACATTCACATTTTCTCATTCACTGGGGAGGAAATGGCCACAAAGG
+CAGACTACACTCTCGACGAGGAGGTCATACCTGGTTTCCTAATAAGAGTAGAAGGAGATAACAACACACT
+TTCAAGAAAAATGACAATAAAAGACAACCTGACCAAAAAAATGGTCACACATTAACAATAGGAGGGTTTT
+ATTTTGTTTTTTTT
+>gnl|ti|1086975884 name:1099575910438 mate_pair:1086975787
+GGCCCGGATCAGATTGAGATTTTGTGCGACAATGCTTCAACCCGATGATTGTCGAACTTGCAGAAAAAGC
+AATGAAAGAGTATGGAGAGGATCTGAAAATTGAAACAAACAAATTTGCAGCAATATGCACCCACTTGGAG
+GTATGTTTCATGTATTCAGATTTTCATTTCATCAATGAACAAGGCGAATCAATAATGGTAGAACTTGATG
+ATCCAAATGCACTGTTAAAGCACAGATTTGAAATAATCGAGGGGAGAGACAGAACAATGGCCTGGACAGT
+AGTAAACAGTATCTGCAACACTACTGGAGCTGAAAAACCGAAGTTTCTACCAGATTTGTATGATTACAAG
+GAGAACAGATTCATCGAAATTGGAGTGACAAGAAGAGAAGTCCACATATATTACCTTGAAAAGGCCAATA
+AAATTAAATCTGAGAACACACACATTCACATTTTCTCATTCACTGGGGAGGAAATGGCCACAAAGGCAGA
+CTACACTCTCGACGAGGAAAGCAGAGCTAGGATTAAAACCAGGCTGTTCACCATAAGGCAAGGTCATAGC
+TGTTTACTAACGATCCCTAAACGAAACTTATCAACGCGGAGACTGTTAAAAGTGCATAAATTTGGTATCA
+CCTGTTGTCAAGGAAGCAAATAGTCCTATAATTGCCGAAGTTTCTCCTTA
+>gnl|ti|1086975887 name:1099575910441
+ACGGAGGAGGATCAATATATTACCTTGAAAAGGCCAATAAAATTAAATCTGAGAACACACACATTCACAT
+TTTCTCATTCACTGGGGAGGAAATGGCCACAAAGGCAGACTACACTCTCGACGAGGAAAGCAGAGCTAGG
+ATTAAAACCAGGCTATTTACCATAAGACAAGAAATGGCCAACAGAGGCCTCTGGGATTCCTTTCGTCAGT
+CCGAAAGAGGCGAAGAAACAATTGAAGAAAAATTTGAAATCTCAGGAACTATGCGTAGGCTTGCCGACCA
+AAGTCTCCCACCGAACTTCTCCTGCCTTGAGAATTTTAGAGCCTATGTGGATGGATTCGAACCGAACGGC
+TGCATTGAGGGCAAGCTTTCTCAAATGTCCAAAGAAGTGAATGCCAAAATTGAACCTTTTCTGAAGACAA
+CACCAAGACCAATCAAACTTCCTAATGGACCTCCTTGTTATCAGCGGTCCAAATTCCTCCTGATGGATGC
+TTTGAAATTGAGCATTGAAGACCCAAGTCACGAAGGAGAAGGGATTCCATTATATGATGCGATCAAGTGC
+ATGAAAACATTCTTTGGATGGAAAGAACCTTATATAGTCAAACCACACGAAAAGGGAATAAATTCAAATT
+ACCTGCTGTCATGGAAGCAAGTATTGTCAGAATTGCAGGACGTTGAAACTGAGGAGAAGGTCATAGTTGT
+TTTACTG
+>gnl|ti|1086975771 name:1099575910444 mate_pair:1086975820
+CTTTTTTTCTTACTGGGGAGGAAATGGCCACAAAGGCAGACTACACTCTCGACGAGGAAAGCAGAGCTAG
+GATTAAAACCAGGCTATTTACCATAAGACAAGAAATGGCCAACAGAGGCCTCTGGGATTCCTTTCGTCAG
+TCCGAAAGAGGCGAAGAAACAATTGAAGAAAAATTTGAAATCTCAGGAACTATGCGTAGGCTTGCCGACC
+AAAGTCTCCCACCGAACTTCTCCTGCCTTGAGAATTTTAGAGCCTATGTGGATGGATTCGAACCGAACGG
+CTGCATTGAGGGCAAGCTTTCTCAAATGTCCAAAGAAGTGAATGCCAAAATTGAACCTTTTCTGAAGACA
+ACACCAAGACCAATCAAACTTCCTAATGGACCTCCTTGTTATCAGCGGTCCAAATTCCTCCTGATGGATG
+CTTTGAAATTGAGCATTGAAGACCCAAGTCACGAAGGAGAAGGGATTCCATTATATGATGCAATCAAATG
+CATGAGAACATTGGTCATACTGATTTTCCTGAAAGTTCAACAAGGCCTGCAAGCTGACTGATTCGTCTGG
+ATAGAGCTCGATGAAATTGGAAAGGACGTACCCCCAATTGAATACATTGCAAGCATGAGGAGGAATTATT
+TCACAGCAGAGGTGTCCCATTGCAGGTCAAAAAGGTGTCCCCGGAGATGGATA
+>gnl|ti|1086975785 name:1099575910447 mate_pair:1086975840
+GGATCACGACGCTGCATTGAGGGCAAGCTTTCTCAAATGTCCAAAGAAGTGAATGCCAAAATTGAACCTT
+TTCTGAAGACAACACCAAGACCAATCAAACTTCCTAATGGACCTCCTTGTTATCAGCGGTCCAAATTCCT
+CCTGATGGATGCTTTGAAATTGAGCATTGAAGACCCAAGTCACGAAGGAGAAGGGATTCCATTATATGAT
+GCGATCAAGTGCATGAAAACATTCTTTGGATGGAAAGAACCTTATATAGTCAAACCACACGAAAAGGGAA
+TAAATTCAAATTACCTGCTGTCATGGAAGCAAGTATTGTCAGAATTGCAGGACATTGAAAATGAGGAGAA
+GATCCCAAGGACTAAAAACATGAAGAAAACGAGTCAACTAAAGTGGGCTCTTGGTGAAAACATGGCACCA
+GAGAAAGTAGACTTTGACAACTGCAGAGACATAAGCGATTTGAAGCAATATGATAGTGACGAACCTGAAT
+TAAGGTCACTTTCAAGCTGGATACAGAATGAGTTCAACAAGGCCTGCGAGCTAACTGATTCAATCTGGAT
+AGAGCTCGATGAAATTGGAGAGGACGTAGCCCCAATTGAGTACATTGCAAGCATGAGGAGGAATTATTTC
+ACAGCAGAGGTGTCCCATTGCAGGTCAAC
+>gnl|ti|1086975858 name:1099575910453 mate_pair:1086975803
+CCTTAAGCAATCAGTGCATGAAACATTCTTTGGATGGAAAGAACCTTATATAGTCAAACCACACGAAAAG
+GGAATAAATTCAAATTACCTGCTGTCATGGAAGCAAGTATTGTCAGAATTGCAGGACATTGAAAATGAGG
+AGAAGATCCCAAGGACTAAAAACATGAAGAAAACGAGTCAACTAAAGTGGGCTCTTGGTGAAAACATGGC
+ACCAGAGAAAGTAGACTTTGACAACTGCAGAGACATAAGCGATTTGAAGCAATATGATAGTGACGAACCT
+GAATTAAGGTCACTTTCAAGCTGGATACAGAATGAGTTCAACAAGGCCTGCGAGCTAACTGATTCAATCT
+GGATAGAGCTCGATGAAATTGGAGAGGACGTAGCCCCAATTGAGTACATTGCAAGCATGAGGAGGAATTA
+TTTCACAGCAGAGGTGTCCCATTGTAGAGCCACTGAGTACATAATGAAGGGGGTATACATTAATACTGCC
+CTGCTCAATGCATCCTGTGCAGCAATGGACGATTTTCAACTAATCCCCATGATAAGCAAGTGCAGAACTA
+AAGAGGGAAGGCGAAAAACCAATTTATATGGGTTCATCATAAAGGGAAGATCCCATTTAAGGAATGACAC
+AGATGTGGTAAACTTTGTGAGCATGGAGGTCATACT
+>gnl|ti|1086975799 name:1099575910459 mate_pair:1086975899
+GTGTACTCCGGTGAACTGGCACCAGAGAAAGTAGACTTTGACAACTGCAGAGACATAAGCGATTTGAAGC
+AATATGATAGTGACGAACCTGAATTAAGGTCACTTTCAAGCTGGATACAGAATGAGTTCAACAAGGCCTG
+CGAGCTAACTGATTCAATCTGGATAGAGCTCGATGAAATTGGAGAGGACGTAGCCCCAATTGAGTACATT
+GCAAGCATGAGGAGGAATTATTTCACAGCAGAGGTGTCCCATTGTAGAGCCACTGAGTACATAATGAAGG
+GGGTATACATTAATACTGCCCTGCTCAATGCATCCTGTGCAGCAATGGACGATTTTCAACTAATCCCCAT
+GATAAGCAAGTGCAGAACTAAAGAGGGAAGGCGAAAAACCAATTTATATGGGTTCATCATAAAGGGAAGA
+TCCCATTTAAGGAATGACACAGATGTGGTAAACTTTGTGAGCATGGAATTTTCTCTCACTGACCCGAGAC
+TAGAGCCACATAAATGGGAGAAATACTGTGTCCTTGAGATAGGAGATATGTTACTAAGAAGTGCCATAGG
+CCAAATTTCAAGGCCTATGTTCTTGTATGTGAGGACAAACGGAACATCAAAGGTCAAAATGAAATGGGGA
+ATGGAGATGAGACGTTGCCTCCTTCAGTCACTCCAGCAGATCGAGAGCATGATTGAAGCCGAGTCCTCGA
+TTAAAGAGAAAGACATGACCAAAGAGTTTTTTGAGAATAAATCAGAAGCATGGCCCATTGGGGAGTCCCC
+CAAGAGAGTGGAGGTCATAGCTGTTTTTCCTGA
+>gnl|ti|1086975819 name:1099575910462 mate_pair:1086975867
+GGCGGAGGTACTAACCCTGGTCTGCAGACCTCAGTGCCAAAGAGGCACAAGATGTAATTATGGAAGTTGT
+TTTTCCCAATGAAGTGGGAGCCAGGATACTAACATCAGAATCGCAATTAACAATAACTAAAGAGAAAAAA
+GAAGAACTCCGAGATTGCAAAATTTCTCCCTTGATGGTTGCATACATGTTAGAGAGAGAACTTGTACGAA
+AAACAAGATTTCTCCCAGTTGCTGGCGGAACAAGCAGTATATACATTGAAGTTTTACATTTGACTCAAGG
+AACGTGTTGGGAACAAATGTACACTCCAGGTGGAGAAGTGAGGAATGACGATGTTGACCAAAGCCTAATT
+ATTGCGGCCAGGAACATAGTAAGAAGAGCAGCAGTATCAGCAGATCCACTAGCATCTTTATTGGAGATGT
+GCCACAGCACACAAATTGGCGGGACAAGGATGGTGGACATTCTTAGACAGAACCCGACTGAAGAACAAGC
+TGTGGATATATGCAAGGCTGCAATGGGATTGAGAATCAGCTCATCCTTCAGCTTTGGTGGGTTTACATTT
+AAAAGAACAAGCGGGTCATCAGTCAAAAAAGAGGAAGAAGTGCTTACAGGCAATCTCCAAACACTGAAGG
+TCATAGCGTGTTTCCA
+>gnl|ti|1086975885 name:1099575910465 mate_pair:1086975862
+GCGTTTGAAAAATAAGGGGGGTATACATTAATACTGCCCTGCTCAATGCATCCTGTGCAGCAATGGACGA
+TTTTCAACTAATCCCCATGATAAGCAAGTGCAGAACTAAAGAGGGAAGGCGAAAAACCAATTTATATGGG
+TTCATCATAAAGGGAAGATCCCATTTAAGGAATGACACAGATGTGGTAAACTTTGTGAGCATGGAATTTT
+CTCTCACTGACCCGAGACTAGAGCCACATAAATGGGAGAAATACTGTGTCCTTGAGATAGGAGATATGTT
+ACTAAGAAGTGCCATAGGCCAAATTTCAAGGCCTATGTTCTTGTATGTGAGGACAAACGGAACATCAAAG
+GTCAAAATGAAATGGGGAATGGAGATGAGACGTTGCCTCCTTCAGTCACTCCAGCAGATCGAGAGCATGA
+TTGAAGCCGAGTCCTCGATTAAAGAGAAAGACATGACCAAAGAGTTTTTTGAGAATAAATCAGAAGCATG
+GCCCATTGGGGAGTCCCCCAAGGGAGTGGAAGAAGGTTCCATTGGGAAAGTCTGTAGGACTCTATTGGCT
+AAGTCAGTGTTCAATAGCTTGTATGCATCTCCACGGTCATAGCTGTTTACTGA
+>gnl|ti|1086975768 name:1099575910471
+GGGGGCTGTGCCCTTCGTCCTCCAGCAGATCGAGAGCATGATTGAAGCCGAGTCCTCGATTAAAGAGAAA
+GACATGACCAAAGAGTTTTTTGAGAATAAATCAGAAGCATGGCCCATTGGGGAGTCCCCCAAGGGAGTGG
+AAGAAGGTTCCATTGGGAAAGTCTGTAGGACTCTATTGGCTAAGTCAGTGTTCAATAGCCTGTATGCATC
+ACCACAATTGGAAGGATTTTCAGCGGAGTCAAGAAAACTGCTTCTTGTTGTTCAGGCTCTTAGGGACAAT
+CTCGAACCTGGGACCTTTGATCTCGGGGGGCTATATGAAGCAATTGAGGAGTGCCTGATTAATGATCCCT
+GGGTTTTGCTCAATGCATCTTGGTTCAACTCCTTCCTGACACATGCATTAAAATAGTTATGGCAGTGCTA
+CTATTTGCTATCCATACTGTCCAAAAGGTCATAGC
+>gnl|ti|1086975788 name:1099575910474 mate_pair:1086975871
+GCGGTAAACAACGACTGAAGAACAAGCTGTGGATATATGCAAGGCTGCAATGGGATTGAGAATCAGCTCA
+TCCTTCAGCTTTGGTGGGTTTACATTTAAAAGAACAAGCGGGTCATCAGTCAAAAAAGAGGAAGAAGTGC
+TTACAGGCAATCTCCAAACATTGAAGATAAGAGTACATGAGGGGTATGAGGAGTTCACAATGGTGGGGAA
+AAGAGCAACAGCTATACTCAGAAAAGCAACCAGAAGATTGGTTCAGCTCATAGTGAGTGGAAGAGACGAA
+CAGTCAATAGCTGAAGCAATAATCGTGGCCATGGTGTTTTCACAAGAGGATTGCATGATAAAAGCAGTTA
+GAGGTGACCTGAATTTCGTCAACAGAGCAAATCAGCGGTTGAACCCCATGCATCAGCTTTTAAGGCATTT
+TCAGAAAGATGCGAAAGTGCTTTTTCAAAATTGGGGAATTGAACACATCGACAGTGTGATGGGAATGGTT
+GGAGTATTACCAGATATGACTCCAAGCACAGAGATGTCAATGAGAGGAATAAGAGTCAGCAAAATGGGTG
+TGGATGAATACTCCAGTACAGAGAGGGTGGTGGTTAGCATTGATCGGTTTTTGAGAGTTCGAGACCAACG
+TGGGAATGTATTATTATCTCCTGAGGAGGTCAGCGAAACAGGTCATAGTGTGTTTTCCTGACGGGATTTT
+TTTATGAAAATCACTGTACGTTTTCGGATTGGTATGAAAATCAAAAAACGAATGATGTCTCACCACCCCC
+CTTCTACTGGAAATATTTCCCCCACCCTTTTGCCTGACTTTTATTCCTCTCGTGGCTTCGTGGCTCTGGA
+GTCAAACTGGTAATACTCCACTTCCACATTTGTCAGTCTGTTGAATTCCATCTATGAAATAGCATAGAAC
+TTTTGAAAATGCCATAATGCTGAAGAGGGGGGGATCGCGATAAATGCCTATAGACAAGGTATAGGTACTC
+AAGGCTTTAAAGGGTTCCAAGGGGAACACAGGCCAACGATGTGC
+>gnl|ti|1086975781 name:1099575910477 mate_pair:1086975776
+CAGGTTGACGAGTCTCGAATTAAAGAGAAGACATGACCAAAGAGTTTTTTGAGAATAAATCAAAAGCATG
+GCCCATTGGGGAGTCCCCCAAGGGAGTGGAAGAAGGTTCCATTGGGAAAGTCTGTAGGACTCTATTGGCT
+AAGTCAGTGTTCAATAGCCTGTATGCATCACCACAATTGGAAGGATTTTCAGCGGAGTCAAAAAAACTGC
+TTCTTGTTGTTCAGGCTCTTAGGGACAATCTCGAACCTGGGACCTTTGATCTCGGGGGGCTATATGAAGC
+AATTGAGGAGTGCCTGATTAATGATCCCTGGGTTTTGCTCAATGCATCTTGGTTCAACTCCTTCCTGACA
+CATGCATTAAAATAGTTATGGCAGTGCTGCTATTTGCTATCCGTACTGTCGGTAATA
+>gnl|ti|1086975818 name:1099575910480 mate_pair:1086975917
+AGTCAGCGCATGGGATTGAGAATCAGCTCATCCTTCAGCTTTGGTGGGTTTACATTTAAAAGAACAAGCG
+GGTCATCAGTCAAAAAAGAGGAAGAAGTGCTTACAGGCAATCTCCAAACATTGAAGATAAGAGTACATGA
+GGGGTATGAGGAGTTCACAATGGTGGGGAAAAGAGCAACAGCTATACTCAGAAAAGCAACCAGAAGATTG
+GTTCAGCTCATAGTGAGTGGAAGAGACGAACAGTCAATAGCTGAAGCAATAATCGTGGCCATGGTGTTTT
+CACAAGAGGATTGCATGATAAAAGCAGTTAGAGGTGACCTGAATTTCGTCAACAGAGCAAATCAGCGGTT
+GAACCCCATGCATCAGCTTTTAAGGCATTTTCAGAAAGATGCGAAAGTGCTTTTTCAAAATTGGGGAATT
+GAACACATCGACAGTGTGATGGGAATGGTTGGAGTATTACCAGATATGACTCCAAGCACAGAGATGTCAA
+TGAGAGGAATAAGAGTCAGCAAAATGGGTGTGGATGAATACTCCAGCACAGAGGTCATAGCTGTTTCCTG
+GGGACCAGTGATTAAGAACAACATGATAAACAATGACTCTTGGACAAACAACAGCCCATGTGGACCTTGG
+AATTAAGGAGGGAAAAAGGGGCC
+>gnl|ti|1086975882 name:1099575910483 mate_pair:1086975881
+GTTTTACGGGTCTCGATTAAGAGATGACATGACCAAAGAGTTTTTTGAGAATAAATCAGAAGCATGGCCC
+ATTGGGGAGTCCCCCAAGGGAGTGGAAGAAGGTTCCATTGGGAAAGTCTGTAGGACTCTATTGGCTAAGT
+CAGTGTTCAATAGCCTGTATGCATCACCACAATTGGAAGGATTTTCAGCGGAGTCAAGAAAACTGCTTCT
+TGTTGTTCAGGCTCTTAGGGACAATCTCGAACCTGGGACCTTTGATCTCGGGGGGCTATATGAAGCAATT
+GAGGAGTGCCTGATTAATGATCCCTGGGTTTTGCTCAATGCATCTTGGTTCAACTCCTTCCTGACACATG
+CATTAAAATAGTTATGGCAGTGCTACTATTTGTTATCCGTACTGTCCAAAAAAGTACCTTGTTTCTACTG
+GTCATAGCTGTTTCCTG
+>gnl|ti|1086975779 name:1099575910486 mate_pair:1086975829
+CGCATCAGAGATGTCAATGAGAGGAATAAGAGTCAGCAAAATGGGTGTGGATGAATACTCCAGTACAGAG
+AGGGTGGTGGTTAGCATTGATCGGTTTTTGAGAGTTCGAGACCAACGTGGGAATGTATTATTATCTCCTG
+AGGAGGTCAGTGAAACACAGGGAACTGAGAGACTGACAATAACTTATTCATCGTCGATGATGTGGGAGAT
+TAACGGTCCTGAGTCGGTTTTGGTCAATACCTATCAATGGATCATCAGAAATTGGGAAGCTGTCAAAATT
+CAATGGTCTCAGAATCCTGCAATGTTGTACAACAAAATGGAATTTGAACCATTTCAATCTTTAGTCCCCA
+AGGCCATTAGAAGCCAATACAGTGGGTTTGTCAGAACTCTATTCCAACAAATGAGAGACGTACTTGGGAC
+ATTTGACACCACCCAGATAATAAAGCTTCTCCCTTTTGCAGCCGCTCCACCAAAGCAAAGCAGAATGCAG
+TTCTCTTCACTGACTGTAAATGTGAGGGGATCAGGGATGAGAATACTTGTAAGGGGCAATTCTCCTGTAT
+TCAACTACAACAAGACAACTAAAAGACTAACAATTCTCGGAAAAGATGCCGGCACTTTAATTGAAGACCC
+AGATGGTCATAGTGGGTTTCCTGA
+>gnl|ti|1086975772 name:1099575910493
+GCGGTTGATCTCAGTAAGAGAGGGTGGTGGTTAGCATTGATCGGTTTTTGAGAGTTCGAGACCAACGTGG
+GAATGTATTATTATCTCCTGAGGAGGTCAGTGAAACACAGGGAACTGAGAGACTGACAATAACTTATTCA
+TCGTCGATGATGTGGGAGATTAACGGTCCTGAGTCGGTTTTGGTCAATACCTATCAATGGATCATCAGAA
+ATTGGGAAGCTGTCAAAATTCAATGGTCTCAGAATCCTGCAATGTTGTACAACAAAATGGAATTTGAACC
+ATTTCAATCTTTAGTCCCCAAGGCCATTAGAAGCCAATACAGTGGGTTTGTCAGAACTCTATTCCAACAA
+ATGAGAGACGTACTTGGGACATTTGACACCACCCAGATAATAAAGCTTCTCCCTTTTGCAGCCGCTCCAC
+CAAAGCAAAGCAGAATGCAGTTCTCTTCATTGACTGTAAGGTCATAGCTGTTTCCTAATGTCGACGACAA
+GACTTTATGGATTACTTCGACCGTGATACTAACCAACAGCAGTTTAATGGGAAGAAATTGTTGTTGAATG
+CCTTAAAAACAAACTTGTGGTGTGGCTATACTGCC
+>gnl|ti|1086975793 name:1099575910496 mate_pair:1086975914
+CGGAGACTTTCATCTTTAGTCCCCAAGGCCATTAGAAGCCAATACAGTGGGTTTGTCAGAACTCTATTCC
+AACAAATGAGAGACGTACTTGGGACATTTGACACCACCCAGATAATAAAGCTTCTCCCTTTTGCAGCCGC
+TCCACCAAAGCAAAGCAGAATGCAGTTCTCTTCACTGACTGTAAATGTGAGGGGATCAGGGATGAGAATA
+CTTGTAAGGGGCAATTCTCCTGTATTCAACTACAACAAGACAACTAAAAGACTAACAATTCTCGGAAAAG
+ATGCCGGCACTTTAATTGAAGACCCAGATGAAAGCACATCCGGAGTGGAGTCTGCCGTCTTGAGAGGGTT
+TCTCATTATAGGTAAGGAAGACAGAAGATACGGACCAGCATTAAGCATCAATGAACTGAGTAACCTTGCA
+AAAGGGGAAAAGGCTAATGTGCTAATCGGGCAAGGAGACGTGGTGTTGGTAATGAAACGAAAACGGGACT
+CTAGCATACTTACTGACAGCCAGACAGCGACCAAAAGAATTCGGATGGCCATCAATTAATGTTGAATAGT
+TTAAAAACGACCTTGTGGTCATAGCTGGTTTCCGAA
+>gnl|ti|1086975843 name:1099575910499 mate_pair:1086975817
+GGGGATAGGGCTTGGAACACCCAGATAATAAAGCTTCTCCCTTTTGCAGCCGCTCCACCAAAGCAAAGCA
+GAATGCAGTTCTCTTCACTGACTGTAAATGTGAGGGGATCAGGGATGAGAATACTTGTAAGGGGCAATTC
+TCCTGTATTCAACTACAACAAGACAACTAAAAGACTAACAATTCTCGGAAAAGATGCCGGCACTTTAATT
+GAAGACCCAGATGAAAGCACATCCGGAGTGGAGTCTGCCGTCTTGAGAGGGTTTCTCATTATAGGTAAGG
+AAGACAGAAGATACGGACCAGCATTAAGCATCAATGAACTGAGTAACCTTGCAAAAGGGGAAAAGGCTAA
+TGTGCTAATCGGGCAAGGAGACGTGGTGTTGGTAATGAAACGAAAACGGGACTCTAGCATACTTACTGAC
+AGCCAGACAGCGACCAAAAGAATTCGGATGGCCATCAATTAATGTCGAATAGTTTAAAAACGACCTTGGG
+TCATAGCTGTTTCCTGA
+>gnl|ti|1086975794 name:1099575910505 mate_pair:1086975906
+GGGGGGCATTTGAACCACCCAGATAATAAAGCTTCTCCCTTTTGCAGCCGCTCCACCAAAGCAAAGCAGA
+ATGCAGTTCTCTTCACTGACTGTAAATGTGAGGGGATCAGGGATGAGAATACTTGTAAGGGGCAATTCTC
+CTGTATTCAACTACAACAAGACAACTAAAAGACTAACAATTCTCGGAAAAGATGCCGGCACTTTAATTGA
+AGACCCAGATGAAAGCACATCCGGAGTGGAGTCTGCCGTCTTGAGAGGGTTTCTCATTATAGGTAAGGAA
+GACAGAAGATACGGACCAGCATTAAGCATCAATGAACTGAGTAACCTTGCAAAAGGGGAAAAGGCTAATG
+TGCTAATCGGGCAAGGAGACGTGGTGTTGGTAATGAAACGAAAACGGGACTCTAGCATACTTACTGACAG
+CCAGACAGCGACCAAAAGAATTCGGATGGCCATCAATTAATGTTGAATAGTTTAAAAACGACCTTGTTTC
+TACTGGTCATAGCTGTTTCCTGA
+>gnl|ti|1086975805 name:1099575910509
+AGCAGCCACATTTGATGGATGTCATCCGACTCTACTGTTCCTAAAGGTTCCAGCGCAAAATGCCATAAGC
+ACCACATTCCCTTATACTGGAGATCCTCCATACAGCCATGGAACAGGAACAGGGTACACCATGGACACAG
+TCAACAGAACACACCAATATTCAGAGAAGGGGAAGTGGACGACAAATACAGAAACTGGGGCACCCCAACT
+CAACCCAATTGATGGACCACTACCTGAGGATAATGAGCCGAGTGGATATGCACAAACAGACTGTGTCCTG
+GAGGCTATGGCCTTCCTTGAAGAATCCCACCCAGGTATCTTTGAGAACTCATGCCTTGAAACAATGGAAG
+TCGTTCAACAAACAAGGGTGGACAAACTAACCCAAGGTCGCCAGACTTATGATTGGACATTAAACAGAAA
+TCAACCGGCAGCAACTGCATTAGCCAACACCATAGAAGTTTTTAGATCGAATGGACTAACAGCTAATGAA
+TCAGGAAGGCTAATAGATTTCCTCAAGGATGTGATGGAATCAATGGATAAGGTCATAGCTGTTTCCTAA
+>gnl|ti|1086975904 name:1099575910512 mate_pair:1086975852
+GGAAGGACACATTTTGATGGATGTCATCCGACTCTACTGTTCCTAAAGGTTCCAGCGCAAAATGCCATAA
+GCACCACATTCCCTTATACTGGAGATCCTCCATACAGCCATGGAACAGGAACAGGGTACACCATGGACAC
+AGTCAACAGAACACACCAATATTCAGAGAAGGGGAAGTGGACGACAAATACAGAAACTGGGGCACCCCAA
+CTCAACCCAATTGATGGACCACTACCTGAGGATAATGAGCCGAGTGGATATGCACAAACAGACTGTGTCC
+TGGAGGCTATGGCCTTCCTTGAAGAATCCCACCCAGGTATCTTTGAGAACTCATGCCTTGAAACAATGGA
+AGTCGTTCAACAAACAAGGGTGGACAAACTAACCCAAGGTCGCCAGACTTATGATTGGACATTAAACAGA
+AATCAACCGGCAGCAACTGCATTAGCCAACACCATAGAAGTTTTTAGATCGAATGGACTAACAGCTAATG
+AATCAGGAAGGCTAATAGATTTCCTCAAGGATGTGATGGAATCAATGGATAAAGAGGAAATGGAGATAAC
+AACACACTTTCAAAGAAAAAGGAGAGTAAGAGACAACATGACCAAGAAAATGGTCACACAAAGAACAATA
+GGAGGGTCATAGCTTGTTTACTGA
+>gnl|ti|1086975795 name:1099575910515 mate_pair:1086975876
+CATGATGCAGTCATCCGACTCTACTGTTCCTAAAGGTTCCAGCGCAAAATGCCATAAGCACCACATTCCC
+TTATACTGGAGATCCTCCATACAGCCATGGAACAGGAACAGGGTACACCATGGACACAGTCAACAGAACA
+CACCAATATTCAGAGAAGGGGAAGTGGACGACAAATACAGAAACTGGGGCACCCCAACTCAACCCAATTG
+ATGGACCACTACCTGAGGATAATGAGCCGAGTGGATATGCACAAACAGACTGTGTCCTGGAGGCTATGGC
+CTTCCTTGAAGAATCCCACCCAGGTATCTTTGAGAACTCATGCCTTGAAACAATGGAAGTCGTTCAACAA
+ACAAGGGTGGACAAACTAACCCAAGGTCGCCAGACTTATGATTGGACATTAAACAGAAATCAACCGGCAG
+CAACTGCATTAGCCAACACCATAGAAGTTTTTAGATCGAATGGACTAACAGCTAATGAATCAGGAAGGCT
+AATAGATTTCCTCAAGGATGTGATGGAATCAATGGATAAAGAGGAAATGGAGATAACAACACACTTTCAA
+AGAAAAAGGAGAGTAAGAGACAACATGACCAAGAAAATGGTCACACAAAGAACAATAGGAAGGTCATAGT
+TG
+>gnl|ti|1086975890 name:1099575910518 mate_pair:1086975855
+ACCCAGGCCTAAGCTAATGAATCAGGAAGGCTAATAGATTTCCTCAAGGATGTGATGGAATCAATGGATA
+AAGAGGAAATGGAGATAACAACACACTTTCAAAGAAAAAGGAGAGTAAGAGACAACATGACCAAGAAAAT
+GGTCACACAAAGAACAATAGGGAAGAAAAAACAAAGAGTGAATAAGAGAGGCTATCTAATAAGAGCTTTG
+ACATTGAACACGATGACCAAAGATGCAGAGAGAGGTAAATTAAAAAGAAGGGCTATTGCAACACCAGGGA
+TGCAAATTAGAGGGTTCGTGTACTTCGTTGAAACTTTAGCTAGAAGCATTTGCGAAAAGCTTGAACAGTC
+TGGACTTCCGGTTGGGGGTAATGAAAAGAAGGCCAAACTGGCAAATGTTGTGAGAAAAATGATGACTAAT
+TCACAAGACACTGAGCTTTCTTTCACAATCACTGGGGACAACACTAAGTGGAATGAAAATCAAAACCCTC
+GAATGTTTTTGGCGATGATTACATATATCACAAAAAATCAACCTGAGTGGTTCAGAAACATCCTGAGCAT
+CGCACCAATAATGTTCTCAAACAAAATGGCAAGACTAGGAAAAGGATACATGTTCGAGAGTAAGAGAATG
+AAGCTCCGAACACAAATACCCGCAGAAATGCTAGCGGTCATAGTGGGTTTTCCTGA
+>gnl|ti|1086975875 name:1099575910521 mate_pair:1086975865
+CACAATATAGTAGCTATAGATTTCCTCAAGGATGTGATGGAATCAATGGATAAAGAGGAAATGGAGATAA
+CAACACACTTTCAAAGAAAAAGGAGAGTAAGAGACAACATGACCAAGAAAATGGTCACACAAAGAACAAT
+AGGGAAGAAAAAACAAAGAGTGAATAAGAGAGGCTATCTAATAAGAGATTTGACATTGAACACGATGACC
+AAAGATGCAGAGAGAGGTAAATTAAAAAGAAGGGCTATTGCAACACCAGGGATGCAAATTAGAGGGTTCG
+TGTACTTCGTTGAAACTTTAGCTAGAAGCATTTGCGAAAAGCTTGAACAGTCTGGACTTCCGGTTGGGGG
+TAATGAAAAGAAGGCCAAACTGGCAAATGTTGTGAGAAAAATGATGACTAATTCACAAGACACTGAGCTT
+TCTTTCACAATCACTGGGGACAACACTAAGTGGAATGAAAATCAAAACCCTCGAATGTTTTTGGCGATGA
+TTACATATATCACAAAAAATCAACCTGAGTGGTTCAGAAACATCCTGAGCATCGCCCCCATAATGTTCGG
+TCATAGTGGTTTTTCAATGACAACCGTCTCGCCGATATTTAGAAGTGACAGAGTTGAAAAGAGCATAAGA
+GTAACAAAGAATTGTAGTATTAGCTACAGATTTGTCAAGTTGAGAAGTAAAACATACAATCATACATTGA
+TTTTGACATTTGACA
+>gnl|ti|1086975902 name:1099575910524 mate_pair:1086975901
+GAGAAAAGAGCTTTCTTTCCAATCACTGGGGACAACACTAAGTGGAATGAAAATCAAAACCCTCGAATGT
+TTTTGGCGATGATTACATATATCACAAAAAATCAACCTGAGTGGTTCAGAAACATCCTGAGCATCGCACC
+AATAATGTTCTCAAACAAAATGGCAAGACTAGGAAAAGGATACATGTTCGAGAGTAAGAGAATGAAGCTC
+CGAACACAAATACCCGCAGAAATGCTAGCAAGCATTGACCTGAAGTATTTCAATGAATCAACAAGGAAGA
+AAATTGAGAAAATAAGGCCTCTTCTAATAGATGGCACAGCATCATTGAGCCCTGGGATGATGATGGGCAT
+GTTCAACATGCTAAGTACGGTTTTAGGAGTCTCAATACTGAATCTTGGGCAAAAGAAATACACCAAGACA
+ACATACTGGTGGGATGGGCTCCAATCCTCCGACGATTTTGCCCTCATAGTGAATGCACCAAATCATGAGG
+GAATACAAGCAGGAGTGGATAGATTCTACAGGACCTGCAAGTTAGTGGGAATCAACATGAGCAAAAAGAA
+GTCCTATATAAATAAAACAGGGACATTTGAATTCACAAGCTTTTTTTATCGCTATGGATTTGTAGCCAAT
+TTGGTCATAGCTGTTTCCTA
+>gnl|ti|1086975872 name:1099575910527 mate_pair:1086975869
+GGGGTTTATGTTCTCAAACAAAATGGCAAGACTAGGAAAAGGATACATGTTCGAGAGTAAGAGAATGAAG
+CTCCGAACACAAATACCCGCAGAAATGCTAGCAAGCATTGACCTGAAGTATTTCAATGAATCAACAAGGA
+AGAAAATTGAGAAAATAAGGCCTCTTCTAATAGATGGCACAGCATCATTGAGCCCTGGGATGATGATGGG
+CATGTTCAACATGCTAAGTACGGTTTTAGGAGTCTCAATACTGAATCTTGGGCAAAAGAAATACACCAAG
+ACAACATACTGGTGGGATGGGCTCCAATCCTCCGACGATTTTGCCCTCATAGTGAATGCACCAAATCATG
+AGGGAATACAAGCAGGAGTGGATAGATTCTACAGGACCTGCAAGTTAGTGGGAATCAACATGAGCAAAAA
+GAAGTCCTATATAAATAAAACAGGGACATTTGAATTCACAAGCTTTTTTTATCGATATGGATTTGTGGCT
+AATTTTAGCATGGAGCTTCCCAGTTTTGGAGTGTCTGGAATAAACGAGTCAGCTGATATGAGCATTGGAG
+TAACAGTGATAAAGAACAACATGATAAACAATGACCTTGGACCAGCAACAGCCCAAATGGCCCTTGGTCA
+TAGTGTGTTTATACGAGA
+>gnl|ti|1086975832 name:1099575910530 mate_pair:1086975804
+GGCCTAGGAGCAGGAGTGGAAGATTCTACAGGACCTGCAAGTTAGTGGGAATCAACATGAGCAAAAAGAA
+GTCCTATATAAATAAAACAGGGACATTTGAATTCACAAGCTTTTTTTATCGATATGGATTTGTGGCTAAT
+TTTAGCATGGAGCTTCCCAGTTTTGGAGTGTCTGGAATAAACGAGTCAGCTGATATGAGCATTGGAGTAA
+CAGTGATAAAGAACAACATGATAAACAATGACCTTGGACCAGCAACAGCCCAGATGGCTCTCCAATTGTT
+CATCAAAGACTACAGATATACATATAGGTGCCATAGAGGAGACACACAAATTCAGACGAGAAGATCATTC
+GAGCTAAAGAAGCTGTGGGATCAAACCCAATCAAGGGCAGGACTATTGGTATCAGATGGGGGACCAAACT
+TATACAATATCCGGAACCTTCACATCCCTGAAGTCTGCTTAAAGTGGGAGCTAATGGATGAGAATTATCG
+GGGAAGACTTTGTAACCCCCTGAATCCCTTTGTCAGCCATAAAGAAATTGAGTCTGTAAACAATGCTGTA
+GTGATGCCAGCTCATGGTCCAGCCAAGAGCATGGAAGGTCATAGCTGTTTACTG
+>gnl|ti|1086975806 name:1099575910533 mate_pair:1086975847
+GGGCCAAGGGGTCAGCTTTTTTTATCGATATGGATTTGTGGCTAATTTTAGCATGGAGCTTCCCAGTTTT
+GGAGTGTCTGGAATAAACGAGTCAGCTGATATGAGCATTGGAGTAACAGTGATAAAGAACAACATGATAA
+ACAATGACCTTGGACCAGCAACAGCCCAGATGGCTCTCCAATTGTTCATCAAAGACTACAGATATACATA
+TAGGTGCCATAGAGGAGACACACAAATTCAGACGAGAAGATCATTCGAGCTAAAGAAGCTGTGGGATCAA
+ACCCAATCAAGGGCAGGACTATTGGTATCAGATGGGGGACCAAACTTATACAATATCCGGAACCTTCACA
+TCCCTGAAGTCTGCTTAAAGTGGGAGCTAATGGATGAGAATTATCGGGGAAGACTTTGTAACCCCCTGAA
+TCCCTTTGTCAGCCATAAAGAAATTGAGTCTGTAAACAATGCTGTAGTGATGCCAGCTCATGGTCCAGCC
+AAAAGTATGGAATATGATGCCGTTGCAACTACACACTCCTGGATTCCCAAGAGGAACCGCTCTATCCTGG
+TCATAGCTGGTTTCCTGA
+>gnl|ti|1086975856 name:1099575910536 mate_pair:1086975784
+GGGGCATGGATGAGATATCGGGGAGACTTTGTAACCCCCTGAATCCCTTTGTCAGCCATAAAGAAATTGA
+GTCTGTAAACAATGCTGTAGTGATGCCAGCTCATGGTCCAGCCAAAAGTATGGAATATGATGCCGTTGCA
+ACTACACACTCCTGGATTCCCAAGAGGAACCGCTCTATTCTCAACACAAGCCAAAGGGGAATTCTTGAGG
+ATGAACAGATGTACCAAAAGTGCTGCAACTTGTTCGAGAAATTTTTCCCTAGTAGTTCATATAGGAGACC
+GATTGGAATTTCTAGCATGGTGGAGGCCATGGTGTCTAGGGCCCGGATTGATGCCAGAATTGACTTCGAG
+TCTGGACGGATTAAGAAGGAAGAGTTCTCTGAGATCATGAAGATCTGTTCCACCATTGAAGAACTCAGAC
+GGCAAAAATAATGAATTTAGCTTGTCCTTCATGAAAAGGTCATAGCTGTTTCCTAAAGAAGGACGAGCTA
+CATTTAGTATTTTTGCCGTCAGAGTTCTACAATGGTGGAACACATTTGCATGATCTCGAGCAATCTGCGA
+TCAAAAGCCCGAAACTAAATGATTCTGGCATAATCGGGGCCCTAAAACCAGGGCTCCACCAGGCTAAAAA
+TTTCCGACGGTCTCCTTATAAACTAGGAGGGAAGAATTTAGGAAAAGTGCGCGGTTTGGGTACTCTTTTA
+TCGGGGAAATTCCCTGGGGGCTTGTTTGAGAAAACCCGGGTTCCCTGTGGAGACGGGGAGTCTGTGGTTT
+ACAAAGGGCGGGGCGGTTTTTGGGGGGCCGGAGCGGCCTCATACGCTTTTTTAATAAACCACTATTTAAA
+TATACGCAAAAAGGGGTTCCTGGAAACTCCCCCCCCTTTCCCCCATTTCGTGCTCGGGGGTCGCTGT
+>gnl|ti|1086975895 name:1099575910539
+CCTTATACTACCAAAGAAGATTGAAGTCTGTAAACATGCTGTAGTGATGCCAGCTCATGGTCCAGCCAAA
+AGTATGGAATATGATGCCGTTGCAACTACACACTCCTGGATTCCCAAGAGGAACCGCTCTATTCTCAACA
+CAAGCCAAAGGGGAATTCTTGAGGATGAACAGATGTACCAAAAGTGCTGCAACTTGTTCGAGAAATTTTT
+CCCTAGTAGTTCATATAGGAGACCGATTGGAATTTCTAGCATGGTGGAGGCCATGGTGTCTAGGGCCCGG
+ATTGATGCCAGAATTGACTTCGAGTCTGGACGGATTAAGAAGGAAGAGTTCTCTGAGATCATGAAGATCT
+GTTCCACCATTGAAGGGCTCAGACGGCAGGTAATA
+>gnl|ti|1086975857 name:1099575910545 mate_pair:1086975792
+GGGGCATGGATGAGAATTATCGGGGAAGACTTTGTAACCCCCTGAATCCCTTTGTCAGCCATAAAGAAAT
+TGAGTCTGTAAACAATGCTGTAGTGATGCCAGCTCATGGTCCAGCCAAAAGTATGGAATATGATGCCGTT
+GCAACTACACACTCCTGGATTCCCAAGAGGAACCGCTCTATTCTCAACACAAGCCAAAGGGGAATTCTTG
+AGGATGAACAGATGTACCAAAAGTGCTGCAACTTGTTCGAGAAATTTTTCCCTAGTAGTTCATATAGGAG
+ACCGATTGGAATTTCTAGCATGGTGGAGGCCATGGTGTCTAGGGCCCGGATTGATGCCAGAATTGACTTC
+GAGTCTGGACGGATTAAGAAGGAAGAGTTCTCTGAGATCATGAAGATCTGTTCCACCATTGAAGAACTCA
+GACGGCAAAAATAATGAATTTAGCTTGTCCTTCATGAAAAAATGCCTTGTTTCTACTGGTCATAGCTGTT
+TCCTGA
+>gnl|ti|1086975778 name:1099575910546 mate_pair:1086975821
+GCCGAGAAAATCTGGGCTCCACTTCATTGGGAAAACAACTTCCATAATTACATCTTGTGCCTCTTTGGCA
+CTGAGGCCTGCATGACCAGGGTTTATGTCTACTCTTCTGCGTATCTTGACTTGATTTCTAAAATGAACAG
+GGCCAAAGGTTCCATGTTTTAACCTTTCGACTTTGTCAAAATAAGTCTTGTATACTTTTGGGTAATGGAC
+CGTACTTGTCACGGGTCCATTTCTATTCCACCATGTTACAGCCAAAGGTGATACCATCACTCGATCTGAT
+CCAGCATCACTCATTTTACTCCATAGAGTTTGTCCTTGTTCATTTCTCTCCGGAACCATTTCTGTTATCC
+TTTTGTCAGCAGTGATTGGGTATTTCATTGCCATCATCCATTTCATCCTAAGTGACGGGTTCTTTTCCTG
+TCTCCCCGATGTGTACTTCTTAATTATGGCCATATGGTCCACTGTGGTTTTTGTCAGTATCTCGCGAGTG
+CGAGACTGCGACATCAGATTCCGTAGTTCTTTTATTCTTTCCATACTGAATATAATTGACCTGCTTTCGC
+TACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975867 name:1099575910549 mate_pair:1086975819
+GGGGGTGGATGCTGTAAGCACTTCTTCCTCTTTTTTGACTGATGACCCGCTTGTTCTTTTAAATGTAAAC
+CCACCAAAGCTGAAGGATGAGCTGATTCTCAATCCCATTGCAGCCTTGCATATATCCACAGCTTGTTCTT
+CAGTCGGGTTCTGTCTAAGAATGTCCACCATCCTTGTCCCGCCAATTTGTGTGCTGTGGCACATCTCCAA
+TAAAGATGCTAGTGGATCTGCTGATACTGCTGCTCTTCTTACTATGTTCCTGGCCGCAATAATTAGGCTT
+TGGTCAACATCGTCATTCCTCACTTCTCCACCTGGAGTGTACATTTGTTCCCAACACGTTCCTTGAGTCA
+AATGTAAAACTTCAATGTATATACTGCTTGTTCCGCCAGCAACTGGGAGAAATCTTGTTTTTCGTACAAG
+TTCTCTCTCTAACATGTATGCAACCATCAAGGGAGAAATTTTGCAATCTCGGAGTTCTTCTTTTTTCTCT
+TTAGTTATTGTTAATTGCGATTCTGATGTTAGTATCCTGGCTCCCACTTCATTGGGAAAAACAACTTCCA
+TAATTACATCTTGTGCCTCTTTGGCACTGAGGTCTGCATGACCAGGGTTTATGTCCACTCTTCGGCGTAA
+CTGGCCGTCGTTTTACAA
+>gnl|ti|1086975871 name:1099575910551 mate_pair:1086975788
+GAGAACCACCTCCGGAAAAAATAATACATTCCCACGTTGGTCTCGAACTCTCAAAAACCGATCAATGCTA
+ACCACCACCCACTCTGTACTGGAGTATTCATCCACACCCATTTTGCTGACTCTTATTCCTCTCATTGACA
+TCTCTGTGCTTGGAGTCATATCTGGTAATACTCCAACCATTCCCATCACACTGTCGATGTGTTCAATTCC
+CCAATTTTGAAAAAGCACTTTCTCATCTTTCTGAAAATGCCTTAAAATCTGATGCATGGGGTTCAACCGC
+TGATTTGCTCTGTTGACAAAATTCAGGTCACCTCTAACTGTTTTTATCATGCAATCCTCTTGTGAAAACA
+CCATGGTCACAAATATTGCTTTAGATATTGACTGTTATTCTCTTCCACTCTTTTTGACCTGAACCAATCT
+TCTGGTTGCTTTTCTGAGTATAGCTGTTGCTCTTTCTCCTTTTTCTTTGAACTCCTGTTACCCCTCCCGT
+TTCCTCTTTATCCATTGATTCAAATTGCCTCTTAACAAATCCTCTTCTTCTTTGACAGTCAACCCCTGTT
+GACTGTTTAAATGTAAACCCACCAAAGCTGAAGGATGAGCTGATTCTCAATCCCATTGCAGCCTTGCATA
+TATCCCACAACTTGTTCTTCAGTCGGGTTCTGGCCTAAGAATGTCACTGGCCGTCGTTTTAAAA
+>gnl|ti|1086975917 name:1099575910552 mate_pair:1086975818
+GAGCCTATTCTCACACCCATTTTGCTGACTCTTATTCCTCTCATTGACATCTCTGTGCTTGGAGTCATAT
+CTGGTAATACTCCAACCATTCCCATCACACTGTCGATGTGTTCAATTCCCCAATTTTGAAAAAGCACTTT
+CGCATCTTTCTGAAAATGCCTTAAAAGCTGATGCATGGGGTTCAACCGCTGATTTGCTCTGTTGACGAAA
+TTCAGGTCACCTCTAACTGCTTTTATCATGCAATCCTCTTGTGAAAACACCATGGCCACGATTATTGCTT
+CAGCTATTGACTGTTCGTCTCTTCCACTCACTATGAGCTGAACCAATCTTCTGGTTGCTTTTCTGAGTAT
+AGCTGTTGCTCTTTTCCCCACCATTGTGAACTCCTCATACCCCTCATGTACTCTTATCTTCAATGTTTGG
+AGATTGCCTGTAAGCACTTCTTCCTCTTTTTTGACTGATGACCCGCTTGTTCTTTTAAATGTAAACCCAC
+CAAAGCTGAAGGATGAGCTGATTCTCAATCCCATTGCAGCCTTGCATATGTACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975829 name:1099575910553 mate_pair:1086975779
+GCAACCTCAGGTGCCGGCATCTTTTCCGAGAATTGTTAGTCTTTTAGTTGTCTTGTTGTAGTTGAATACA
+GGAGAATTGCCCCTTACAAGTATTCTCATCCCTGATCCCCTCACATTTACAGTCAGTGAAGAGAACTGCA
+TTCTGCTTTGCTTTGGTGGAGCGGCTGCAAAAGGGAGAAGCTTTATTATCTGGGTGGTGTCAAATGTCCC
+AAGTACGTCTCTCATTTGTTGGAATAGAGTTCTGACAAACCCACTGTATTGGCTTCTAATGGCCTTGGGG
+ACTAAAGATTGAAATGGTTCAAATTCCATTTTGTTGTACAACATTGCAGGATTCTGAGACCATTGAATTT
+TGACAGCTTCCCAATTTCTGATGATCCATTGATAGGTATTGACCAAAACCGACTCAGGACCGTTAATCTC
+CCACATCATCGACGATGAATAAGTTATTGTCAGTCTCTCAGTTCCCTGTGTTTCACTGACCTCCTCAGGA
+GATAATAATACATTCCCACGTTGGTCTCGAACTCTCAAAAACCGATCAATGCTAACCACCACCCTCTCTG
+TACTGGAGTATTCATCCACACCCATTTTGCTGACTCTTATTCCTCTCATTGACATCTCTGTGCTGGGAGT
+CATACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975914 name:1099575910555 mate_pair:1086975793
+TTGGGCAATTAACATTCACATTAATTGATGGCCATCCGAATTCTTTTGGTCGCTGTCTGGCTGTCAGTAA
+GTATGCAAGAGTCCCGTTTTCGTTTCATTACCAACACCACGTCTCCTTGCCCGATTAGCACATTAGCCTT
+TTCCCCTTTTGCAAGGTTACTCAGTTCATTGATGCTTAATGCTGGTCCGTATCTTCTGTCTTCCTTACCT
+ATAATGAGAAACCCTCTCAAGACGGCAGACTCCACTCCGGATGTGCTTTCATCTGGGTCTTCAATTAAAG
+TGCCGGCATCTTTTCCGAGAATTGTTAGTCTTTTAGTTGTCTTGTTGTAGTTGAATACAGGAGAATTGCC
+CCTTACAAGTATTCTCATCCCTGATCCCCTCACATTTACAGTCAGTGAAGAGAACTGCATTCTGCTTTGC
+TTTGGTGGAGCGGCTGCAAAAGGGAGAAGCTTTATTATCTGGGTGGTGTCAAATGTCCCAAGTACGTCTC
+TCATTTGTTGGAATAGAGTTCTGACAAACCCACTGTATTGGCTTCTAATGGCCTTGGGGACTAAAGATTG
+AAATGGTTCAAATTCCATTACTGGCCGTCGTTTTAC
+>gnl|ti|1086975817 name:1099575910556 mate_pair:1086975843
+TGGGGCATCAACAATTCGACATTAATTGATGGCCATCCGAATTCTTTTGGTCGCTGTCTGGCTGTCAGTA
+AGTATGCTAGAGTCCCGTTTTCGTTTCATTACCAACACCACGTCTCCTTGCCCGATTAGCACATTAGCCT
+TTTCCCCTTTTGCAAGGTTACTCAGTTCATTGATGCTTAATGCTGGTCCGTATCTTCTGTCTTCCTTACC
+TATAATGAGAAACCCTCTCAAGACGGCAGACTCCACTCCGGATGTGCTTTCATCTGGGTCTTCAATTAAA
+GTGCCGGCATCTTTTCCGAGAATTGTTAGTCTTTTAGTTGTCTTGTTGTAGTTGAATACAGGAGAATTGC
+CCCTTACAAGTATTCTCATCCCTGATCCCCTCACATTTACAGTCAGTGAAGAGAACTGCATTCTGCTTTG
+CTTTGGTGGAGCGGCTGCAAAAGGGAGAAGCTTTATTATCTGGGTGGTATCAAATGTCCCCAGCACATAC
+TGGCCGTCGTTTTACAA
+>gnl|ti|1086975906 name:1099575910558 mate_pair:1086975794
+CGCCAATCGTTTTTTAACTATTCACATTAATTGATGGCCATCCGAATTCTTTTGGTCGCTGTCTGGCTGT
+CAGAAAGCGAGCTAGAGTCCCGTTTTCGTTTCATTACCAACACCACGCCTCCTTGCCCGATTAGCACATT
+AGCCTTTTCCCCTTTTGCAAGGTTACTCAGTTCATTGATGCTTAATGCTGGTCCGTATCTTCTGTCTTCC
+TTACCTATAATGAGAAACCCTCTCAAGACGGCAGACTCCACTCCGGATGTGCTTTCATCTGGGTCTTCAA
+TTAAAGTGCCGGCATCTTTTCCGAGAATTGTTAGTCTTTTAGTTGTCTTGTTGTAGTTGAATACAGGAGA
+ATTGCCCCTTACAAGTATTCTCATCCCTGATCCCCTCACATTTACAGTCAGTGAAGAGAACTGCATTCTG
+CTTTGCTTTGGTGGAGCGGCTGCAAAAGGGAGAAGCTTTATTATCTGGGTGGTATCAAATGTCCCCAGCA
+CATACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975852 name:1099575910560 mate_pair:1086975904
+AGACTTTTGTGTGACATTTTCTTGGTCTGTTGTCTCTTACTCTCCTTTTTCTTTGAAAGTGTGTTGTTAT
+CTCCATTTCCTCTTTATCCATTGATTCCATCACATCCTTGAGGAAATCTATTAGCCTTCCTGATTCATTA
+GCTGTTAGTCCATTCGATCTAAAAACTTCTATGGTGTTGGCTAATGCAGTTGCTGCCGGTTGATTTCTGT
+TTAATGTCCAATCATAAGTCTGGCGACCTTGGGTTAGTTTGTCCACCCTTGTTTGTTGAACGACTTCCAT
+TGTTTCAAGGCATGAGTTCTCAAAGATACCTGGGTGGGATTCTTCAAGGAAGGCCATAGCCTCCAGGACA
+CAGTCTGTTTGTGCATATCCACTCGGCTCATTATCCTCAGGTAGTGGTCCATCAATTGGGTTGAGTTGGG
+GTGCCCCAGTTTCTGTATTTGTCGTCCACTTCCCCTTCTCTGAATATTGGTGTGTTCTGTTGACTGTGTC
+CATGGTGTACCCTGTTCCTGTTCCATGGCTGTATGGAGGATCTCCAGTATAAGGGAATGTGGTGCTTATG
+GCATTTTGCGCTGGAACCTTTAGGAACAGTAGAGTCGGATTGACATCCATTCAAATGGTTTGCCTGCTTT
+CGCTACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975876 name:1099575910561 mate_pair:1086975795
+AAGATCTTGTGTGACCATTTTCTTGGTCTGTTGTCTCTTACTCTCCTTTTTCTTTGAAAGTGTGTTGTTA
+TCTCCATTTCCTCTTTATCCATTGATTCCATCACATCCTTGAGGAAATCTATTAGCCTTCCTGATTCATT
+AGCTGTTAGTCCATTCGATCTAAAAACTTCTATGGTGTTGGCTAATGCAGTTGCTGCCGGTTGATTTCTG
+TTTAATGTCCAATCATAAGTCTGGCGACCTTGGGTTAGTTTGTCCACCCTTGTTTGTTGAACGACTTCCA
+TTGTTTCAAGGCATGAGTTCTCAAAGATACCTGGGTGGGATTCTTCAAGGAAGGCCATAGCCTCCAGGAC
+ACAGTCTGTTTGTGCATATCCACTCGGCTCATTATCCTCAGGTAGTGGTCCATCAATTGGGTTGAGTTGG
+GGTGCCCCAGTTTCTGTATTTGTCGTCCACTTCCCCTTCTCTGAATATTGGTGTGTTCTGTTGACTGTGT
+CCATGGTGTACCCTGTTCCTGTTCCATGGCTGTATGGAGGATCTCCAGTATAAGGGAATGTGGTGCTTAT
+GGCATTTTGCGCTGGAACCTTTAGGAACAGTAGAGTCGGATTGACATCCATTCAAATGGTTTGCACTGGC
+CGC
+>gnl|ti|1086975855 name:1099575910562 mate_pair:1086975890
+GGATCGGCTCATTGTGTTCGGAGCTTCATTCTCTTACTCTCGAACATGTATCCTTTTCCTAGTCTTGCCA
+TTTTGTTTGAGAACATTATTGGTGCGATGCTCAGGATGTTTCTGAACCACTCAGGTTGATTTTTTGTGAT
+ATATGTAATCATCGCCAAAAACATTCGAGGGTTTTGATTTTCATTCCACTTAGTGTTGTCCCCAGTGATT
+GTGAAAGAAAGCTCAGTGTCTTGTGAATTAGTCATCATTTTTCTCACAACATTTGCCAGTTTGGCCTTCT
+TTTCATTACCCCCAACCGGAAGTCCAGACTGTTCAAGCTTTTCGCAAATGCTTCTAGCTAAAGTTTCAAC
+GAAGTACACGAACCCTCTAATTTGCATCCCTGGTGTTGCAATAGCCCTTCTTTTTAATTTACCTCTCTCT
+GCATCTTTGGTCATCGTGTTCAATGTCAAAGCTCTTATTAGATAGCCTCTCTTATTCACTCTTTGTTTTT
+TCTTCCCTATTGTTCTTTGTGTGACCATTTTCTTGGTCATGTTGTCTCTTACTCTCCTTTTTCTTTGAAA
+GTGTGTTGTTATCTCCATTTCCTCTTTATCCATTGATTCCATCACATCCTTGAGGAAATCTATTAGCCTT
+CCTGATTCATTAGCTGTTAGACCATTCGATCTAACTGGCCG
+>gnl|ti|1086975865 name:1099575910563 mate_pair:1086975875
+TATGAGGCAGCTAGATGTTTCTGAACCACTCAGGTTGATTTTTTGTGATATATGTAATCATCGCCAAAAA
+CATTAGAGGGTTTTGATTTTCATTCCACTTAGTGTTGTCCCCAGTGATTGTGAAAGAAAGCTCAGTGTCT
+TGTGAATTAGTCATCATTTTTCTCACAACATTTGCCAGTTTGGCCTTCTTTTCATTACCCCCAACCGGAA
+GTCCAGACTGTTCAAGCTTTTCGCAAATGCTTCTAGCTAAAGTTTCAACGAAGTACACGAACCCTCTAAT
+TTGCATCCCTGGTGTTGCAATAGCCCTTCTTTTTAATTTACCTCTCTCTGCATCTTTGGTCATCGTGTTC
+AATGTCAAAGCTCTTATTAGATAGCCTCTCTTATTCACTCTTTGTTTTTTCTTCCCTATTGTTCTTTGTG
+TGACCATTTTCTTGGTCATGTTGTCTCTTACTCTCCTTTTTCTTTGAAAGTGTGTTGTTATCTCCATTTC
+CTCTTTATCCATTGATTCCATCACATCCTTGAGGAAATCTATTAGCCTTCCTGACTCACTAGCTGTTAAC
+TGGCCG
+>gnl|ti|1086975901 name:1099575910564 mate_pair:1086975902
+GCACCATTCAAATTCCATCAAAAATCTCGTGATTGCAATGTCCCTGTTTTATTTAGATAGGACTTCTTTT
+TGCTCAAGTTGATTCCCACTAACTTGCAGGTCCTGTAGAATCTATCCTCTCCTGCTTGTATTCCCTCATG
+ATTTGGTGCATTCACTATGAGGGCAAAATCGTCGGAGGATTGGAGCCCATCCCACCAGTATGTTGTCTTG
+GTGTATTTCTTTTGCCCAAAATTCAGTATTGAGACTCCTAAAACCGTACTTAGCATGTTGAACATGCCCA
+TCATCATCCCAGGGCTCAATGATGCTGTGCCATCTATTAAAAGAGGCCTTATTTTCTCAATTTTCTTCCT
+TGTTGATTCATTGAAATACTTCAGGTCAATGCTTGCTAACATTTCTGCGGGTATTTGTGTTCGGAGCTTC
+ATTCTCTTACTCTCGAACATGTATCCTTTTCCTATTCTTGCCATTTTGTTTGACAACATTATTGGTGCTA
+TGCTCATGATGTTTCAGAACCATTCAGGTTGATTTTTTGTGATATATGTAATCATCTCCAAAAACATTCG
+AGGGTTTCGATTTACATTCCACTTATTGTTGTCCCCATTGATTGTGAAAGAAAGCTCTGTGTCTTGTGAG
+TTACTACTGGCCTTCAATCCAACAAC
+>gnl|ti|1086975776 name:1099575910565 mate_pair:1086975781
+GGCCCAATTCAAAAAGTAGGCACTGCCATAACTATTTTAATGCATGTGTCAGGAAGGAGTTGAACCAAGA
+TGCATTGAGCAAAACCCAGGGATCATTAATCAGGCACTCCTCAATTGCTTCATATAGCCCCCCGAGATCA
+AAGGTCCCAGGTTCGAGATTGTCCCTAAGAGCCTGAACAACAAGAAGCAGTTTTCTTGACTCCGCTGAAA
+ATCCTTCCAATTGTGGTGATGCATACAGGCTATTGAACACTGACTTAGCCAATAGAGTCCTACAGACTTT
+CCCAATGGAACCTTCTTCCACTCCCTTGGGGGACTCCCCAATGGGCCATGCTTCTGATTTATTCTCAAAA
+AACTCTTTGGTCATGTCTTTCTCTTTAATCGAGGACTCGGCTTCAATCATGACTGGCCGTCGTTTTACA
+>gnl|ti|1086975881 name:1099575910566 mate_pair:1086975882
+ACGATCTTTTTTGGCGTACGGATAACAAATAGTAGCACTGCCATAACTATTTTAATGCATGTGTCAGGAA
+GGAGTTGAACCAAGATGCATTGAGCAAAACCCAGGGATCATTAATCAGGCACTCCTCAATTGCTTCATAT
+AGCCCCCCGAGATCAAAGGTCCCAGGTTCGAGATTGTCCCTAAGAGCCTGAACAACAAGAAGCAGTTTTC
+TTGACTCCGCTGAAAATCCTTCCAATTGTGGTGATGCATACAGGCTATTGAACACTGACTTAGCCAATAG
+AGTCCTACAGACTTTCCCAATGGAACCTTCTTCCACTCCCTTGGGGGACTCCCCAATGGGCCATGCTTCT
+GATTTATTCTCAAAAAACTCTTTGGTCATGTCTTTCTCTTTAATCGAGGACTCGGCTTCAATCATGACTG
+GCCGTCGTTTTACAA
+>gnl|ti|1086975790 name:1099575910570 mate_pair:1086975891
+ACGTAACGGTTCAATGCTGGGTATTTGAATTTTAAATGGGTCAACCAATTCAATCTACTAAAGAAACTGT
+TATTAGATCTCCTTTTGCAAGCAGAGCTTGTTCCATTTTGAGTGACTCCAGTCCAATTGAAGCTTTCATT
+GTTAAACTCCAGTGTGCCGGATGAGGCAACTAGTGACCTAAGGGAGGCATAATCCGGCACATCATAAGGG
+TAACAGTTGCTGTAGGCTTTGCTGCGTTCAACAAAAAGGTCCCATTTCTTATTTTGGAAGCCATCACACT
+GAGGGTCTCCCAATAGAGCATCTATTAGTGTGCAGTTTTCTCCATCAAGGATCTGATGAGGACTGTCGCA
+TATTCCACCTGTTGAGGAACTCTGAACCAGCTCAGTAGCATTAGTAACTTCAATTTGGTCATTCGTGATT
+GTTTTCACTATCGTTCCGTTTGGTACTGCATGGTGCCCAAGGCACAGCGTTGCCGTGCTGTTGTCATTTC
+CGGGAAGTTTTTGAGCGAAAACCAGACATAGAATGTAGCTCAAAGCAATGATAGTCTTCATGGTTAATAG
+AATTATCCCCTGCTTTTGCACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975830 name:1099575910573 mate_pair:1086975848
+GAAGCCATAGTTCATGCTGGGTATTTGAATTTTAAATGGGTCAACCAATTCAATCTACTAAAGAAACTGT
+TATTAGATCTCCTTTTGCAAGCAGAGCTTGTTCCATTTTGAGTGACTCCAGTCCAATTGAAGCTTTCATT
+GTTAAACTCCAGTGTGCCGGATGAGGCAACTAGTGACCTAAGGGAGGCATAATCCGGCACATCATAAGGG
+TAACAGTTGCTGTAGGCTTTGCTGCGTTCAACAAAAAGGTCCCATTTCTTATTTTGGAAGCCATCACACT
+GAGGGTCTCCCAATAGAGCATCTATTAGTGTGCAGTTTTCTCCATCAAGGATCTGATGAGGACTGTCGCA
+TATTCCACCTGTTGAGGAACTCTGAACCAGCTCAGTAGCATTAGTAACTTCAATTTGGTCATTCGTGATT
+GTTTTCACTATCGTTCCGTTTGGCACCGCATGATGACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975915 name:1099575910576 mate_pair:1086975911
+GGGACTTCGTCGGAGTGTGCATTCAGAATTGCATTTGCCAATGGGTGCATCTGATCTCATTATTGAGCTT
+TTCCCACTTCGTATTTTGAAGTAACCCCGAGGAGCAATTAGATTCCCTGTGCTGTTAATCAAAAGTATGT
+CTCCCGGTTTTACTATTGTCCAATAGATGCTTATTCTGCTGGGGATATCCCTTACCCTGGGTCTAGATCC
+GATATTCGGGATTACAGTTTGTTGGCTTCTTTTGGTAGAGACTGTGATTCTTCCTGATGCTTGAGCATAT
+AGGCTGATTTGGTCATTGTTCGTACCCGGGTGGTGAACCCCCCAAATGTACAATTTGTCAAATTTTTCAT
+TGTTTGGCATAGTCACGTTCAATGCTGGGTATTTGAATTTTAAATGGGTCAACCAATTCAATCTACTAAA
+GAAACTGTTATTAGATCTCCTTTTGCAAGCAGAGCTTGTTCCATTTTGAGTGACTCCAGTCCAATTGAAG
+CTTTCATTGTTAAACTCCAGTGTGCCGGATGAGGCAACTAGTGACCTAAGGGAGGCATAACTGGCCGCGT
+TTTTACAA
+>gnl|ti|1086975896 name:1099575910582 mate_pair:1086975845
+CACTTGCTCGAGGTCCTGAATTCTCCCTTCTACTTCTGAGAATTCTTTTTCAATCTGATGGAATTTCTCG
+TTGGTTTTCCCGATCAACCTATTCAGCTTCCCATTGATTTGGTTGATTGCTGCTTGAGTGCTTTTGAGAT
+CTGCTGCTTGTCCTATTCCCTCAGAATTTTGATGCCTGAAACCGTACCAACCATCCACCATTCCCTCCCA
+ACCATTTTCTATGAAACCCGCGATTGCGCCAAATATGCCTCTAGTTTGTTTCTCTGGTACATTTCGCATC
+CCTGTTGCCAATTTCAGAGTGTTTTGCTTAACATATCTGGGACAGGCCCCATATGTGATCCTGTTTACAT
+TTTGAAATGGTTTGTCATTGGGAATGCTTCCATTTGGAGTGATGCATTCAGAATTGCATTTGCCAATGGG
+TGCATCTGATCTCATTATTGAGCTTTTCCCACTTCGTATTTTGAAGTAACCCCGAGGAGCAATTAGATTC
+CCGGTGCTACTGGCCG
+>gnl|ti|1086975891 name:1099575910583 mate_pair:1086975790
+ATAGGGCATCTATTACATGAAGACTATCATTGCTTTGAGCTACATTCTATGTCTGGTTTTCGCTCAAAAA
+CTTCCCGGAAATGACAACAGCACGGCAACGCTGTGCCTTGGGCACCATGCAGTACCAAACGGAACGATAG
+TGAAAACAATCACGAATGACCAAATTGAAGTTACTAATGCTACTGAGCTGGTTCAGAGTTCCTCAACAGG
+TGGAATATGCGACAGTCCTCATCAGATCCTTGATGGAGAAAACTGCACACTAATAGATGCTCTATTGGGA
+GACCCTCAGTGTGATGGCTTCCAAAATAAGAAATGGGACCTTTTTGTTGAACGCAGCAAAGCCTACAGCA
+ACTGTTACCCTTATGATGTGCCGGATTATGCCTCCCTTAGGTCACTAGTTGCCTCATCCGGCACACTGGA
+GTTTAACAATGAAAGCTTCAATTGGACTGGAGTCACTCAAAATGGAACAAGCTCTGCTTGCAAAAGGAGA
+TCTAATAACAGTTTCTTTAGTAGATTGAATTGGTTGACCCATTTAAAATTCAAATACCCAGCATTGAACG
+TGACTATGCCAAACAAGGTCATAGTT
+>gnl|ti|1086975848 name:1099575910584 mate_pair:1086975830
+AGACTGGGGTCACGGAACGATAGTGAAAACAATCACGAATGACCAAATTGAAGTTACTAATGCTACTGAG
+CTGGTTCAGAGTTCCTCAACAGGTGGAATATGCGACAGTCCTCATCAGATCCTTGATGGAGAAAACTGCA
+CACTAATAGATGCTCTATTGGGAGACCCTCAGTGTGATGGCTTCCAAAATAAGAAATGGGACCTTTTTGT
+TGAACGCAGCAAAGCCTACAGCAACTGTTACCCTTATGATGTGCCGGATTATGCCTCCCTTAGGTCACTA
+GTTGCCTCATCCGGCACACTGGAGTTTAACAATGAAAGCTTCAATTGGACTGGAGTCACTCAAAATGGAA
+CAAGCTCTGCTTGCAAAAGGAGATCTAATAACAGTTTCTTTAGTAGATTGAATTGGTTGACCCATTTAAA
+ATTCAAATACCCAGCATTGAACGTGACCATGCCAAACAAGGTAATAGCTGTTTCCTAATAATCCTAAGAG
+GGAGGCCCACGGTGGGGAAGGCATGTCAGTCTGCTGCACTTCAAAAGCAAGCATTGCCAATGTTCCTATA
+AGGGACGGAAGTATCTCCACGGGGGAAACTGTCAACTAGACGAGTACAAATTGCTTCAATGTGATGGTCT
+CACGCGAGGCTCAGGAAGGGACATTGTTGTATTAGTGCCGGATTTTTCCATTG
+>gnl|ti|1086975911 name:1099575910585 mate_pair:1086975915
+TGGGCCTTAAGTATAGTTGCCTCATCCGGCACACTGGAGTTTAACAATGAAAGCTTCAATTGGACTGGAG
+TCACTCAAAATGGAACAAGCTCTGCTTGCAAAAGGAGATCTAATAACAGTTTCTTTAGTAGATTGAATTG
+GTTGACCCATTTAAAATTCAAATACCCAGCATTGAACGTGACTATGCCAAACAATGAAAAATTTGACAAA
+TTGTACATTTGGGGGGTTCACCACCCGGGTACGAACAATGACCAAATCAGCCTATATGCTCAAGCATCAG
+GAAGAATCACAGTCTCTACCAAAAGAAGCCAACAAACTGTAATCCCGAATATCGGATCTAGACCCAGGGT
+AAGGGATATCCCCAGCAGAATAAGCATCTATTGGACAATAGTAAAACCGGGAGACATACTTTTGATTAAC
+AGCACAGGGAATCTAATTGCTCCTCGGGGTTACTTCAAAATACGAAGTGGGAAAAGCTCAATAATGAGAT
+CAGATGCACCCATTGGCAAATGCAATTCTGAATGCATCACTCCAAATGGAAGCATTTCCAATGAGGTAAT
+AGTGGTTTCCTGATCTCGCGCGCATCTGTCACTAGAGAGTACAAATTGCTTCAAATGATGGTCTTACGTT
+GTACTTTAAAAAAAATTTTATTTTAAAAAAAAAGTTTTTCAAATCCAGAAAACACACCACCCCGTAAGGT
+TATTTTTTCAAATCAATTTAGTGTGGGAGTTTGTTGGGGGGTTTCAAAACGGTGAA
+>gnl|ti|1086975861 name:1099575910586
+AGGTGTGCCTGGGTCCTCAAAATGGAACAAGCTCTGCTTGCAAAAGGAGATCTAATAACAGTTTCTTTAG
+TAGATTGAATTGGTTGACCCATTTAAAATTCAAATACCCAGCATTGAACGTGACTATGCCAAACAATGAA
+AAATTTGACAAATTGTACATTTGGGGGGTTCACCACCCGGGTACGAACAATGACCAAATCAGCCTATATG
+CTCAAGCATCAGGAAGAATCACAGTCTCTACCAAAAGAAGCCAACAAACTGTAATCCCGAATATCGGATC
+TAGACCCAGGGTAAGGGATATCCCCAGCAGAATAAGCATCTATTGGACAATAGTAAAACCGGGAGACATA
+CTTTTGATTAACAGCACAGGGAATCTAATTGCTCCTCGGGGTTACTTCAAAATACGAAGTGGGAAAAGCT
+CAATAATGAGATCAGATGCACCCATTGGCAAATGCAATTCTGAATGCATCACTCCAAATGGAAGCATTCC
+CAATGACAAACCCTTTCAAAAGGTCATAGCTGTTTCCTGAAGCCCCGGAGACCCTTTCACCAGACCTACT
+CTTCATGTCATAGCTGTTAGACAAATAAACATGATACGTATCTGACCTTGAATACGAACATCCCATATGG
+AGGTTGGTCATATT
+>gnl|ti|1086975845 name:1099575910587 mate_pair:1086975896
+CCGGAACTACTGCTCCTCGGGGTTACTTCAAAATACGAAGTGGGAAAAGCTCAATAATGAGATCAGATGC
+ACCCATTGGCAAATGCAATTCTGAATGCATCACTCCAAATGGAAGCATTCCCAATGACAAACCATTTCAA
+AATGTAAACAGGATCACATATGGGGCCTGTCCCAGATATGTTAAGCAAAACACTCTGAAATTGGCAACAG
+GGATGCGAAATGTACCAGAGAAACAAACTAGAGGCATATTTGGCGCAATCGCGGGTTTCATAGAAAATGG
+TTGGGAGGGAATGGTGGATGGTTGGTACGGTTTCAGGCATCAAAATTCTGAGGGAATAGGACAAGCAGCA
+GATCTCAAAAGCACTCAAGCAGCAATCAACCAAATCAATGGGAAGCTGAATAGGTTGATCGGGAAAACCA
+ACGAGAAATTCCATCAGATTGAAAAAGAATTCTCAGAAGTAGAAGGGAGAATTCAGGACCTCGAGAAATA
+TGTTGAGGACAGGTAATGTAATAGGACAACGAGATGACTTCGACAAGGCCTGCGAGCTAACTGATTCAAT
+CTGGATAGAGCTCGATGAAATTGGAAAGGACGTATCCCCATTTGAATACATTGCAAGCATGAGGAGGAAT
+TATTTCAGAGCGAGGTGTCGCATTGGAGGTCAAAAATTTTTCCAAAGACCCAAGACCAATAAGTTGAGAG
+CTGAGGAGTAAGTG
+>gnl|ti|1086975811 name:1099575910590 mate_pair:1086975870
+GCCCATTAAAGTCGATGCACCCATTGGCAAATGCAATTCTGAATGCATCACTCCAAATGGAAGCATTCCC
+AATGACAAACCATTTCAAAATGTAAACAGGATCACATATGGGGCCTGTCCCAGATATGTTAAGCAAAACA
+CTCTGAAATTGGCAACAGGGATGCGAAATGTACCAGAGAAACAAACTAGAGGCATATTTGGCGCAATCGC
+GGGTTTCATAGAAAATGGTTGGGAGGGAATGGTGGATGGTTGGTACGGTTTCAGGCATCAAAATTCTGAG
+GGAATAGGACAAGCAGCAGATCTCAAAAGCACTCAAGCAGCAATCAACCAAATCAATGGGAAGCTGAATA
+GGTTGATCGGGAAAACCAACGAGAAATTCCATCAGATTGAAAAAGAATTCTCAGAAGTAGAAGGGAGAAT
+TCAGGACCTCGAGAAATATGTTGAGGACACTAAAATAGATCTCTGGTCATACAACGCGGAGCTTCTTGTT
+GCCCTGGAGAACCAACATACAATTCATCTAACTGACTGGTCATAGCTGTTTCCTGATGAACTTCTGAAAG
+ATGGACCCCGAATAAGCAAGTTAGGAGGGTTCTACATAAAGGTAAGATCCCATTTGCTGAAGGACACACA
+TATGGTAAAGATTATGATCGTGAAGGTCATATTATTCCTGGTCTATAGAAACTT
+>gnl|ti|1086975897 name:1099575910593 mate_pair:1086975814
+TGGCGGAATAGTATCGGGAACCAACGAGAAATTCCATCAGATTGAAAAAGAATTCTCAGAAGTAGAAGGG
+AGAATTCAGGACCTCGAGAAATATGTTGAGGACACTAAAATAGATCTCTGGTCATACAACGCGGAGCTTC
+TTGTTGCCCTGGAGAACCAACATACAATTGATCTAACTGACTCAGAAATGAACAAACTGTTTGAAAGAAC
+AAAGAAGCAACTGAGGGAAAATGCTGAGGATATGGGCAATGGTTGTTTCAAAATATACCACAAATGTGAC
+AATGCCTGCATAGGGTCAATCAGAAATGGAACTTATGACCATGATGTATACAGAGATGAAGCATTAAACA
+ACCGGTTCCAGATCAAAGGTGTTGAGCTGAAGTCAGGATACAAAGATTGGATCCTATGGATTTCCTTTGC
+CATATCATGTTTTTTGCTTTGTGTTGCTTTGTTGGGGTTCATCATGTGGGCCTGCCAAAAAGGCAACATT
+AGGTGCAACATTTGCATTTGAGTGCATTAATTAAAAACACCCTTGTTTGGTAAAGCTGTTAAAAAAGCGA
+TACAAAAAACCTATTTAGCTGGTTTCTTCATAAAGAGAATATCCCATTTGTAGAAGGACACATTGTAGCA
+AACTTGATGCTCGTGGAGGTCATATGTTTCTTGATCAAAAGAAAATCCTCCAATCCCCGGAGTCAGAATG
+CGTTTGTATCAATGGAACTTGTACA
+>gnl|ti|1086975849 name:1099575910596 mate_pair:1086975798
+TGGGACCAGGGGAAACGTTGGAGGAACTAAAATAGATCTCTGGTCATACAACGCGGAGCTTCTTGTTGCC
+CTGGAGAACCAACATACAATTGATCTAACTGACTCAGAAATGAACAAACTGTTTGAAAGAACAAAGAAGC
+AACTGAGGGAAAATGCTGAGGATATGGGCAATGGTTGTTTCAAAATATACCACAAATGTGACAATGCCTG
+CATAGGGTCAATCAGAAATGGAACTTATGACCATGATGTATACAGAGATGAAGCATTAAACAACCGGTTC
+CAGATCAAAGGTGTTGAGCTGAAGTCAGGATACAAAGATTGGATCCTATGGATTTCCTTTGCCATATCAT
+GTTTTTTGCTTTGTGTTGCTTTGTTGGGTTTCATCATGTGGGGGTCATAGCTGTTTCC
+>gnl|ti|1086975809 name:1099575910599 mate_pair:1086975770
+CATAACAAGGGAATTCTCAGAAGTAGAGGGAGATTCAGGACCTCGAGAAATATGTTGAGGACACTAAAAT
+AGATCTCTGGTCATACAACGCGGAGCTTCTTGTTGCCCTGGAGAACCAACATACAATTGATCTAACTGAC
+TCAGAAATGAACAAACTGTTTGAAAGAACAAAGAAGCAACTGAGGGAAAATGCTGAGGATATGGGCAATG
+GTTGTTTCAAAATATACCACAAATGTGACAATGCCTGCATAGGGTCAATCAGAAATGGAACTTATGACCA
+TGATGTATACAGAGATGAAGCATTAAACAACCGGTTCCAGATCAAAGGTGTTGAGCTGAAGTCAGGATAC
+AAAGATTGGATCCTATGGATTTCCTTTGCCATATCATGTTTTTTGCTTTGTGTTGCTTTGTTGGGGTTCA
+TCATGTGGGCCTGCCAAAAAGGCAACATTAGGTGCAACATTTGCATTTGAGTGCATTAATTAAAAACACC
+CTTGTTTCTACTGGTCATAGCTGTTTCCTAA
+>gnl|ti|1086975837 name:1099575910602 mate_pair:1086975782
+GCCTTAAAAACGTTGAGGAACTAAAATAGATCTCTGGTCATACAACGCGGAGCTTCTTGTTGCCCTGGAG
+AACCAACATACAATTGATCTAACTGACTCAGAAATGAACAAACTGTTTGAAAGAACAAAGAAGCAACTGA
+GGGAAAATGCTGAGGATATGGGCAATGGTTGTTTCAAAATATACCACAAATGTGACAATGCCTGCATAGG
+GTCAATCAGAAATGGAACTTATGACCATGATGTATACAGAGATGAAGCATTAAACAACCGGTTCCAGATC
+AAAGGTGTTGAGCTGAAGTCAGGATACAAAGATTGGATCCTATGGATTTCCTTTGCCATATCATGTTTTT
+TGCTTTGTGTTGCTTTGTTGGGGTTCATCATGTGGGCCTGCCAAAAAGGCAACATTAGGTGCAACATTTG
+CATTTGAGTGCATTAATTAAAAACACCCTTGTTTCTACTGGTCATAGCTGTTTACTAA
+>gnl|ti|1086975774 name:1099575910609 mate_pair:1086975850
+TAAAAGATTATTATTCACTCACTGAGTGACATCAAAATCATGGCGTCCCAAGGCACCAAACGGTCTTATG
+AACAGATGGAAACTGATGGGGATCGCCAGAATGCAACTGAGATTAGGGCATCCGTCGGGAAGATGATTGA
+TGGAATTGGGAGATTCTACATCCAAATGTGCACTGAACTTAAACTCAGTGATCATGAAGGGCGATTGATC
+CAGAACAGCTTGACAATAGAGAAAATGGTGCTCTCTGCTTTTGATGAAAGAAGGAATAAATACCTGGAAG
+AACACCCCAGCGCGGGGAAAGATCCCAAGAAAACTGGGGGACCCATATACAGGAGAGTAGATGGAAAATG
+GATGAGGGAACTCGTCCTTTATGACAAAGAAGAAATAAGGCGAATCTGGCGCCAAGCCAACAATGGTGAG
+GATGCGACAGCTGGTCTAACTCACATAATGATCTGGCATTCCAATTTGAATGATGCAACATACCAGAGGA
+CAAGAGCTCTTGTTCGCACCGGAAGGTCATAGCTGTTTCCGGACAAT
+>gnl|ti|1086975909 name:1099575910612 mate_pair:1086975859
+CGGGACAATGACGATGGACTGATGGGGATCGCCAGAATGCAACTGAGATTAGGGCATCCGTCGGGAAGAT
+GATTGATGGAATTGGGAGATTCTACATCCAAATGTGCACTGAACTTAAACTCAGTGATCATGAAGGGCGA
+TTGATCCAGAACAGCTTGACAATAGAGAAAATGGTGCTCTCTGCTTTTGATGAAAGAAGGAATAAATACC
+TGGAAGAACACCCCAGCGCGGGGAAAGATCCCAAGAAAACTGGGGGACCCATATACAGGAGAGTAGATGG
+AAAATGGATGAGGGAACTCGTCCTTTATGACAAAGAAGAAATAAGGCGAATCTGGCGCCAAGCCAACAAT
+GGTGAGGATGCGACAGCTGGTCTAACTCACATAATGATCTGGCATTCCAATTTGAATGATGCAACATACC
+AGAGGACAAGAGCTCTTGTTCGAACTGGAATGGATCCCAGAATGTGCTCTCTGATGCAGGGCTCGACTCT
+CCCTAGAAGGTCCGGAGCTGCAGGTGCTGCAGTCAAAGGAATCGGGACAATGGTGATGGAACTGATCAGG
+TCATAGTGTTTTTACTAAAATCAGTGCCATCACGATTGGTCCCGAATGCCTGGAAGGCAGCACCTGCGCT
+CCGAACTTTCGGGGGAAGTCAAGCCCTGCATCAAAAGCAATTCGGGGATCATTCCGTTCGAAAAGAGCTC
+TTGTTCTCTGGTATGTTGCACACTCAAATAGGAATGCAATAATATGTGAGTTAGACCATCTCTCGCACCC
+ATTGTGGCGTGGCGCGAGTACCTAATACTCTGTGTCTATGGACAGATCCTCTCCTTTGTCATCTCACTCG
+AGTAATTGGTCACGTTGTCTCGAGATCGTTCCGACATGGGGTGTTTCTACGGTCTTTTATACATACTTCC
+CAAGCAAAGGCATTTCTCTTGCTAGGCGGGTCATGATATTACCTCCAACTCACGGAGTTGAGTCTCGATG
+GAGATAATATCATGCCTCTCTCACAGCCAAAAATTAGACCGCCTGTTCTCATGA
+>gnl|ti|1086975828 name:1099575910615 mate_pair:1086975880
+GGGGGAACTGGAATCAATTTGAATGATGCAACATACCAGAGGACAAGAGCTCTTGTTCGAACTGGAATGG
+ATCCCAGAATGTGCTCTCTGATGCAGGGCTCGACTCTCCCTAGAAGGTCCGGAGCTGCAGGTGCTGCAGT
+CAAAGGAATCGGGACAATGGTGATGGAACTGATCAGAATGGTCAAACGGGGGATCAACGATCGAAATTTC
+TGGAGAGGTGAGAATGGGCGGAAAACAAGAAGTGCTTATGAGAGAATGTGCAACATTCTTAAAGGAAAAT
+TTCAAACAGCTGCACAAAGAGCAATGGTGGATCAAGTGAGAGAAAGTCGGAACCCAGGAAATGCTGAGAT
+CGAAGATCTCATATTTTTGGCAAGATCTGCATTGATATTGAGAGGGTCAGTTGCTCACAAATCTTGCCTA
+CCTGCCTGTGCGTATGGACCTGCAGTATCCAGTGGGTACGACTTCGAAAAAGAGGGATATTCCTTGGTGG
+GAATAGACCCTTTCAAACTACTTCAAAATAGCCAAATATACAGCCTAATCAGACCTAACGAGAATCCAGC
+ACACAAGAGTCAGCTGGTGTGGATGGCATGCCATTCTGCTGCATTTGAAGATTTAAGATTGTTAAGCTTC
+ATCAGAGGGACAAAAGTGGTCATAGCTGGGTTTACTGA
+>gnl|ti|1086975816 name:1099575910618 mate_pair:1086975912
+GGGTAAAATGTGCTCTCTGATGCAGGGCTCGACTCTCCCTAGAAGGTCCGGAGCTGCAGGTGCTGCAGTC
+AAAGGAATCGGGACAATGGTGATGGAACTGATCAGAATGGTCAAACGGGGGATCAACGATCGAAATTTCT
+GGAGAGGTGAGAATGGGCGGAAAACAAGAAGTGCTTATGAGAGAATGTGCAACATTCTTAAAGGAAAATT
+TCAAACAGCTGCACAAAGAGCAATGGTGGATCAAGTGAGAGAAAGTCGGAACCCAGGAAATGCTGAGATC
+GAAGATCTCATATTTTTGGCAAGATCTGCATTGATATTGAGAGGGTCAGTTGCTCACAAATCTTGCCTAC
+CTGCCTGTGCGTATGGACCTGCAGTATCCAGTGGGTACGACTTCGAAAAAGAGGGATATTCCTTGGTGGG
+AATAGACCCTTTCAAACTACTTCAAAATAGCCAAATATACAGCCTAATCAGACCTAACGAGAATCCAGCA
+CACAAGAGTCAGCTGGTGTGGATGGCATGCCATTCTGCTGCATTTGAAGATTTAAGATTGTTAAGCTTCA
+TCAGAGGGACAAAAGTATCTCCTCGGGGGAAACTGTCAACTAGAGGAGTACAAATTGCTTCAAATGAGGG
+TCATAC
+>gnl|ti|1086975808 name:1099575910621 mate_pair:1086975894
+GGGTACGCTATCAGACCTAACGAGAATCCAGCACACAAGAGTCAGCTGGTGTGGATGGCATGCCATTCTG
+CTGCATTTGAAGATTTAAGATTGTTAAGCTTCATCAGAGGGACAAAAGTATCTCCTCGGGGGAAACTGTC
+AACTAGAGGGGTACAAATTGCTTCAAATGAGAACATGGATAATATGGGATCGAGCACTCTTGAACTGAGA
+AGCGGGTACTGGGCCATAAGGACCAGGAGTGGAGGAAACACTAATCAACAGAGGGCCTCCGCAGGCCAAA
+CCAGTGTGCAACCTACGTTTTCTGTACAAAGAAACCTCCCATTTGAAAAGTCAACCATCATGGCAGCATT
+CACTGGAAATACGGAGGGAAGAACTTCAGACATGAGGGCAGAAATCATAAGAATGATGGAAGGTGCAAAA
+CCAGAAGAAGTGTCATTCCGGGGGAGGGGAGTTTTCGAGCTCTCAGACGAGAAGGCAGCGAACCCGATCG
+TGCCCTCTTTTGATATGAGTAATGAAGGATCTTATTTCTTCGGAGACAATGCAGAAGAGTACGACAATTA
+AGGTCATACTGGTTTTCCTGATTATTGCAGATGACGTATTTTACAATTGAATTCTTTGCCGCCGTGAGGA
+GGATTTATGTCACAGCGAAGGTTGTCCCATGTGAGGTCAAACTGTTTTTTTCG
+>gnl|ti|1086975868 name:1099575910624 mate_pairs:1086975886,1086975893
+TCCGTCGGCTTGAGATTTAAGATTGTTAAGCTTCATCAGAGGGACAAAAGTATCTCCTCGGGGGAAACTG
+TCAACTAGAGGGGTACAAATTGCTTCAAATGAGAACATGGATAATATGGGATCGAGCACTCTTGAACTGA
+GAAGCGGGTACTGGGCCATAAGGACCAGGAGTGGAGGAAACACTAATCAACAGAGGGCCTCCGCAGGCCA
+AACCAGTGTGCAACCTACGTTTTCTGTACAAAGAAACCTCCCATTTGAAAAGTCAACCATCATGGCAGCA
+TTCACTGGAAATACGGAGGGAAGAACTTCAGACATGAGGGCAGAAATCATAAGAATGATGGAAGGTGCAA
+AACCAGAAGAAGTGTCATTCCGGGGGAGGGGAGTTTTCGAGCTCTCAGACGAGAAGGCAGCGAACCCGAT
+CGTGCCCTCTTTTGATATGAGTAATGAAGGATCTTATTTCTTCGGAGACAATGCAGAAGAGTACGACAAT
+TAAGGAAAAAATACCCTTGTTTCTACTGGTCATACTGTTTTCCTGAACCATAAGGTATGACCCTTCGTCA
+TGAAAGATCCCGGAGAAATTACATGGAATATCGATATTGGAAATCTTCGCCCCTGTTGGTTGCATGGTTT
+TTAGG
+>gnl|ti|1086975842 name:1099575910625 mate_pairs:1086975886,1086975893
+CCTTCCTTCTTGAGATTTAAGATTGTTAAGCTTCATCAGAGGGACAAAAGTATCTCCTCGGGGGAAACTG
+TCAACTAGAGGGGTACAAATTGCTTCAAATGAGAACATGGATAATATGGGATCGAGCACTCTTGAACTGA
+GAAGCGGGTACTGGGCCATAAGGACCAGGAGTGGAGGAAACACTAATCAACAGAGGGCCTCCGCAGGCCA
+AACCAGTGTGCAACCTACGTTTTCTGTACAAAGAAACCTCCCATTTGAAAAGTCAACCATCATGGCAGCA
+TTCACTGGAAATACGGAGGGAAGAACTTCAGACATGAGGGCAGAAATCATAAGAATGATGGAAGGTGCAA
+AACCAGAAGAAGTGTCATTCCGGGGGAGGGGAGTTTTCGAGCTCTCAGACGAGAAGGCAGCGAACCCGAT
+CGTGCCCTCTTTTGATATGAGTAATGAAGGATCTTATTTCTTCGGAGACAATGCAGAAGAGTACGACAAT
+TAAGGAAAAAATACCCTTGTTTCTACTGGTAATAGCTGGTTTACTGAAGATCGGTATTACCGATTTCCCG
+GAGTCGATCATAGAAAGATAAAGTGAGCACGTTTCTGTAACGGGGTAATGTTTCAATT
+>gnl|ti|1086975898 name:1099575910629 mate_pair:1086975813
+AACCGGAAATAGGTGATCCAAATCAAAAGATAATAACGATTGGCTCTGTTTCTCTCACCATTTCCACAAT
+ATGCTTCTTTATGCAAATTGCCATCTTGATAACTACTGTAACATTGCATTTCAAGCAATATGAATTCAAC
+TCCCCCCCAAACAACCAAGTGATGCTGTGTGAACCAACAATAATAGAAAGAAACATAACAGAGATAGTGT
+ATCTGACCAACACCACCATAGAGAAGGAAATATGCCCCAAACTAGCAGAATACAGAAATTGGTCAAAGCC
+GCAATGTGACATTACAGGATTTGCACCTTTTTCTAAGGACAATTCGATTAGGCTTTCCGCTGGTGGGGAC
+ATCTGGGTGACAAGAGAACCTTATGTGTCATGCGATCCTGACAAATGTTATCAATTTGCCCTTGGACAGG
+GAACAACACTAAACAACGTGCATTCAAATGACACAGTACATGATAGGACCCCTTATCGGACCCTATTGAT
+GAATGAGTTAGGTGTTCCATTTCATCTGGGGACTAAGCAAGTGTGCATAGCATGGTCCAGCTCAAGTTGT
+CACGATGGAAAAGCATGGCTGCATGTTTGTGTAACGGGGGATGATAAAAATGCAACTGCTAGCTTCATTT
+ACAATGGGAGGCTTGTAGATAGTATTGTTTCATGGTCCAAAGAAATCCTCAGAACCCAGGAGTCAGAATG
+CGTTTGTATCAATGGAACTTGTACAGTGGTAATGACTGATGGAAGGTCATACCTGTGTTTTCCAGA
+>gnl|ti|1086975823 name:1099575910632 mate_pairs:1086975807,1086975841
+GGCGGAGGAAGAGATCCAAATCAAAAGATAATAACGATTGGCTCTGTTTCTCTCACCATTTCCACAATAT
+GCTTCTTTATGCAAATTGCCATCTTGATAACTACTGTAACATTGCATTTCAAGCAATATGAATTCAACTC
+CCCCCCAAACAACCAAGTGATGCTGTGTGAACCAACAATAATAGAAAGAAACATAACAGAGATAGTGTAT
+CTGACCAACACCACCATAGAGAAGGAAATATGCCCCAAACTAGCAGAATACAGAAATTGGTCAAAGCCGC
+AATGTGACATTACAGGATTTGCACCTTTTTCTAAGGACAATTCGATTAGGCTTTCCGCTGGTGGGGACAT
+CTGGGTGACAAGAGAACCTTATGTGTCATGCGATCCTGACAAATGTTATCAATTTGCCCTTGGACAGGGA
+ACAACACTAAACAACGTGCATTCAAATGACACAGTACATGATAGGACCCCTTATCGGACCCTATTGATGA
+ATGAGTTAGGTGTTCCATTTCATCTGGGGACTAAGCAAGTGTGCATAGCATGGTCCAGCTCAAGTTGTCA
+CGACGTCATAGCTGG
+>gnl|ti|1086975827 name:1099575910638 mate_pair:1086975907
+AAGGGCTTGGACAGTACACACTAAACAACGTGCATTCAAATGACACAGTACATGATAGGACCCCTTATCG
+GACCCTATTGATGAATGAGTTAGGTGTTCCATTTCATCTGGGGACTAAGCAAGTGTGCATAGCATGGTCC
+AGCTCAAGTTGTCACGATGGAAAAGCATGGCTGCATGTTTGTGTAACGGGGGATGATAAAAATGCAACTG
+CTAGCTTCATTTACAATGGGAGGCTTGTAGATAGTATTGTTTCATGGTCCAAAGAAATCCTCAGAACCCA
+GGAGTCAGAATGCGTTTGTATCAATGGAACTTGTACAGTAGTAATGACTGATGGGAGTGCTTCAGGAAAA
+GCTGATACTAAAATACTATTCATTGAGGAGGGGAAAATCGTTCATACTAGCACATTGTCAGGAAGTGCCC
+AGCATGTCGAGGAGTGCTCCTGCTATCCTCGATATCCTGGTGTCAGATGTGTCTGCAGAGACAACTGGAA
+AGGCTCCAATAGGCCCATCGTAGATATAAACATAAAGGATTATAGCATTGTTTCCAGTTATGTGTGCTCA
+GGACTTGTTGGAGACACACCCAGAAAAAACGACAGCTCCAGCAGTAGCCATTGCTTGGATCCTAACAATG
+AAGAAGGTGGTCATGGAGTGAAAGGCTGGGCCTTTGATGATGGAAATGACGTGTGGATGGGAGGTCATAG
+CTGGTTTCCTGA
+>gnl|ti|1086975815 name:1099575910641 mate_pair:1086975834
+GGGAGACAGCTCTTTACAATGGGAGGCTTGTAGATAGTATTGTTTCATGGTCCAAAGAAATCCTCAGAAC
+CCAGGAGTCAGAATGCGTTTGTATCAATGGAACTTGTACAGTAGTAATGACTGATGGGAGTGCTTCAGGA
+AAAGCTGATACTAAAATACTATTCATTGAGGAGGGGAAAATCGTTCATACTAGCACATTGTCAGGAAGTG
+CCCAGCATGTCGAGGAGTGCTCCTGCTATCCTCGATATCCTGGTGTCAGATGTGTCTGCAGAGACAACTG
+GAAAGGCTCCAATAGGCCCATCGTAGATATAAACATAAAGGATTATAGCATTGTTTCCAGCTATGTGTGC
+TCAGGACTTGGTCATAGCAGTTTCCTGAAGAGGCGGTGGGGACTGACTTTATGACTGTCCTTTACATGAA
+TTGCACAAAGACCTTTAGGAGCCTTTCGATGACTATACAAACAAGGAAAACAAAAAGGCGGGGGGACTGG
+AGAAGACCAATGGGCGGATTCGACATAAGAGTAATAGGTTAGAATATTCCTCCCAGTAAGGGTAATTTGG
+ATAACTTGGGCCAACCAACAAAATTCATTAAACGTACGGTAAACGGGACAAAAAATCTAACCGGGTTTGA
+ACATAAATTAAACGCTGAAAGTAGTTTTCGCCTCCATTGTGTTTGAGGGCTGGCGATTGGTTTTGAAAAC
+CTTCTTGTGAAGAGC
+>gnl|ti|1086975835 name:1099575910644 mate_pair:1086975822
+AACAAATGGCGGAGAAACTGGAAAGGCTCCAATAGGCCCATCGTAGATATAAACATAAAGGATTATAGCA
+TTGTTTCCAGTTATGTGTGCTCAGGACTTGTTGGAGACACACCCAGAAAAAACGACAGCTCCAGCAGTAG
+CCATTGCTTGGATCCTAACAATGAAGAAGGTGGTCATGGAGTGAAAGGCTGGGCCTTTGATGATGGAAAT
+GACGTGTGGATGGGAAGAACGATCAGCGAGAAGTTACGCTCAGGATATGAAACCTTCAAAGTCATTGAGG
+GCTGGTCCAACCCTAATTCCAAATTGCAGATAAATAGGCAAGTCATAGTTGACAGAGGTAATAGGTCCGG
+TTATTCTGGTATTTTCTCTGTTGAAGGCAAAAGCTGCATCAATCGGTGCTTTTATGTGGAGTTGATAAGG
+GGAAGAAAAGAGGAAACTGAAGTCTTGTGGACCTCAAACAGTATTGTGTTTATAGCTGTTTCCTGA
+>gnl|ti|1086975870 name:1099575910645 mate_pair:1086975811
+GGGCTATTATTGAATGTTGGTTCTCCAGGGCAACAAGAAGCTCCGCGTTGTATGACCAGAGATCTATTTT
+AGTGTCCTCAACATATTTCTCGAGGTCCTGAATTCTCCCTTCTACTTCTGAGAATTCTTTTTCAATCTGA
+TGGAATTTCTCGTTGGTTTTCCCGATCAACCTATTCAGCTTCCCATTGATTTGGTTGATTGCTGCTTGAG
+TGCTTTTGAGATCTGCTGCTTGTCCTATTCCCTCAGAATTTTGATGCCTGAAACCGTACCAACCATCCAC
+CATTCCCTCCCAACCATTTTCTATGAAACCCGCGATTGCGCCAAATATGCCTCTAGTTTGTTTCTCTGGT
+ACATTTCGCATCCCTGTTGCCAATTTCAGAGTGTTTTGCTTAACATATCTGGGACAGGCCCCATATGTGA
+TCCTGTTTACATTTTGAAATGGTTTGTCATTGGGAATGCTTCCATTTGGAGTGATGCATTCAGAATTGCA
+TTTGCCAATGGGTGCATCTGATCTCATTATCGAGCTTACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975814 name:1099575910646 mate_pair:1086975897
+AAGAGGGGAATTTATTATGCACTCAAATGCAAATGTTGCACCTAATGTTGCCTTTTTGGCAGGCCCACAT
+GATGAACCCCAACAAAGCAACACAAAGCAAAAAACATGATATGGCAAAGGAAATCCATAGGATCCAATCT
+TTGTATCCTGACTTCAGCTCAACACCTTTGATCTGGAACCGGTTGTTTAATGCTTCATCTCTGTATACAT
+CATGGTCATAAGTTCCATTTCTGATTGACCCTATGCAGGCATTGTCACATTTGTGGTATATTTTGAAACA
+ACCATTGCCCATATCCTCAGCATTTTCCCTCAGTTGCTTCTTTGTTCTTTCAAACAGTTTGTTCATTTCT
+GAGTCAGTTAGATCAATTGTATGTTGGTTCTCCAGGGCAACAAGAAGCTCCGCGTTGTATGACCAGAGAT
+CTATTTTAGTGTCCTCAACATATTTCTCGAGGTCCTGAATTCTCCCTTCTACTTCTGAGAATTCTTTTTC
+AATCTGATGGAATTTCTCGTTGGTTTTCCCGATTAACCTATTCAGTTTCCCGTACTGGCCGTCGTTTTAC
+AA
+>gnl|ti|1086975798 name:1099575910647 mate_pair:1086975849
+GAGGTGTCACCACAAGCAACACAAAGCAAAAAACATGATATGGCAAAGGAAATCCATAGGATCCAATCTT
+TGTATCCTGACTTCAGCTCAACACCTTTGATCTGGAACCGGTTGTTTAATGCTTCATCTCTGTATACATC
+ATGGTCATAAGTTCCATTTCTGATTGACCCTATGCAGGCATTGTCACATTTGTGGTATATTTTGAAACAA
+CCATTGCCCATATCCTCAGCATTTTCCCTCAGTTGCTTCTTTGTTCTTTCAAACAGTTTGTTCATTTCTG
+AGTCAGTTAGATCAATTGTATGTTGGTTCTCCAGGGCAACAAGAAGCTCCGCGTTGTATGACCAGAGATC
+TATTTTAGTGTCCTCAACGTATTTCTCGAGGTCCTGAAACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975770 name:1099575910648 mate_pair:1086975809
+GTTGGAAGGGTGTTTTATTATGCACTCAAATGCAAATGTTGCACCTAATGTTGCCTTTTTGGCAGGCCCA
+CATGATGAACCCCAACAAAGCAACACAAAGCAAAAAACATGATATGGCAAAGGAAATCCATAGGATCCAA
+TCTTTGTATCCTGACTTCAGCTCAACACCTTTGATCTGGAACCGGTTGTTTAATGCTTCATCTCTGTATA
+CATCATGGTCATAAGTTCCATTTCTGATTGACCCTATGCAGGCATTGTCACATTTGTGGTATATTTTGAA
+ACAACCATTGCCCATATCCTCAGCATTTTCCCTCAGTTGCTTCTTTGTTCTTTCAAACAGTTTGTTCATT
+TCTGAGTCAGTTAGATCAATTGTATGTTGGTTCTCCAGGGCAACAAGAAGCTCCGCGTTGTATGACCAGA
+GATCTATTTTAGTGTCCTCAACATATTTCTCGAGGTCCTGAATTCTCCCTTCTACTTCTGAGAATTCCTT
+TTCAATCTGATGGAACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975782 name:1099575910649 mate_pair:1086975837
+AAACCATTTGTTTTTTATTAATGCACTCAAATGCAAATGTTGCACCTAATGTTGCCTTTTTGGCAGGCCC
+ACATGATGAACCCCAACAAAGCAACACAAAGCAAAAAACATGATATGGCAAAGGAAATCCATAGGATCCA
+ATCTTTGTATCCTGACTTCAGCTCAACACCTTTGATCTGGAACCGGTTGTTTAATGCTTCATCTCTGTAT
+ACATCATGGTCATAAGTTCCATTTCTGATTGACCCTATGCAGGCATTGTCACATTTGTGGTATATTTTGA
+AACAACCATTGCCCATATCCTCAGCATTTTCCCTCAGTTGCTTCTTTGTTCTTTCAAACAGTTTGTTCAT
+TTCTGAGTCAGTTAGATCAATTGTATGTTGGTTCTCCAGGGCAACAAGAAGCTCCGCGTTGTATGACCAG
+AGATCTATTTTAGTGTCCTCAACGTATTTCTCGAGGTCCTGAAACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975850 name:1099575910651 mate_pair:1086975774
+TGCCGGTGGGGGTCTTGCTAATCTGGTATGTTGCATCATTCAAATTGGAATGCCAGATCATTATGTGAGT
+TAGACCAGCTGTCGCATCCTCACCATTGTTGGCTTGGCGCCAGATTCGCCTTATTTCTTCTTTGTCATAA
+AGGACGAGTTCCCTCATCCATTTTCCATCTACTCTCCTGTATATGGGTCCCCCAGTTTTCTTGGGATCTT
+TCCCCGCGCTGGGGTGTTCTTCCAGGTATTTATTCCTTCTTTCATCAAAAGCAGAGAGCACCATTTTCTC
+TATTGTCAAGCTGTTCTGGATCAATCGCCCTTCATGATCACTGAGTTTAAGTTCAGTGCACATTTGGATG
+TAGAATCTCCCAATTCCATCAATCATCTTCCCGACGGATGCCCTAATCTCAGTTGCATTCTGGCGATCCC
+CATCAGTTTCCATCTGTTCATAAGACCGTTTGGTGCCTTGGGACGCCATGATTTTGATGTCACTCAGTGA
+GTGATTATTAACCCTGCTTTTGCACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975859 name:1099575910652 mate_pair:1086975909
+GAACGTTAATGTGTCCCGATTCCTTTGACTGCAGCACCTGCAGCTCCGGACCTTCTAGGGAGAGTCGAGC
+CCTGCATCAGAGAGCACATTCTGGGATCCATTCCAGTTCGAACAAGAGCTCTTGTCCTCTGGTATGTTGC
+ATCATTCAAATTGGAATGCCAGATCATTATGTGAGTTAGACCAGCTGTCGCATCCTCACCATTGTTGGCT
+TGGCGCCAGATTCGCCTTATTTCTTCTTTGTCATAAAGGACGAGTTCCCTCATCCATTTTCCATCTACTC
+TCCTGTATATGGGTCCCCCAGTTTTCTTGGGATCTTTCCCCGCGCTGGGGTGTTCTTCCAGGTATTTATT
+CCTTCTTTCATCAAAAGCAGAGAGCACCATTTTCTCTATTGTCAAGCTGTTCTGGATCAATCGCCCTTCA
+TGATCACTGAGTTTAAGTTCAGTGCACATTTGGATGTAGAATCTCCTTATTCCATCAATCCTCTTCCCGA
+CGGATGCCCTAATCTCAGTTGCATTCTGGCGATCCCCATCAGTTTCCATCTGTTCATAAGACCGTTTACT
+GGCCGTCGTTTTACAG
+>gnl|ti|1086975880 name:1099575910653 mate_pair:1086975828
+GAAGGTTAAGGAAGAGTCCTTACATCTTAAATCTTCAATGCAGCAGAATGGCATGCCATCCACACCAGCT
+GACTCTTGTGTGCTGGATTCTCGTTAGGTCTGATTAGGCTGTATATTTGGCTATTTTGAAGTAGTTTGAA
+AGGGTCTATTCCCACCAAGGAATATCCCTCTTTTTCGAAGTCGTACCCACTGGATACTGCAGGTCCATAC
+GCACAGGCAGGTAGGCAAGATTTGTGAGCAACTGACCCTCTCAATATCAATGCAGATCTTGCCAAAAATA
+TGAAATCTTCGATCTGAGCATTTCCTGGGTTCCGACTTTCTCGCACTTGATCCACCATTGCTCTTTGTGC
+AGCTGTTTGAAATTTTACTTTAACAATGTTGCACATTCTCTCATCAGCACTTCTTGTTTTCCGCCCATTC
+TCACCTCTCCAGAAATTTCCATCGTTGATCCCCCGTTTGACCACTCTCATTTTTTCCATCCCCATTGTCC
+CGATTCCTTTGACTGCAGCAGATGCAGCTCCGGACCTTCTAGGGAGAGTCCCGCCCTGCATGACAGAGCA
+CATTGTGGCACCCATTCCATTTAGGAAAAGAGCTCCCGTGCTCTGGAGAGTTGCATCAGGGAAATTGCAG
+TGGCAGATCATCATGTGAACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975912 name:1099575910654 mate_pair:1086975816
+GTTCATCGTCTCATCTAGTTGACAGTTTCCCCCGAGGAGATACTTTTGTCCCTCTGATGAAGCTTAACAA
+TCTTAAATCTTCAAATGCAGCAGAATGGCATGCCATCCACACCAGCTGACTCTTGTGTGCTGGATTCTCG
+TTAGGTCTGATTAGGCTGTATATTTGGCTATTTTGAAGTAGTTTGAAAGGGTCTATTCCCACCAAGGAAT
+ATCCCTCTTTTTCGAAGTCGTACCCACTGGATACTGCAGGTCCATACGCACAGGCAGGTAGGCAAGATTT
+GTGAGCAACTGACCCTCTCAATATCAATGCAGATCTTGCCAAAAATATGAGATCTTCGATCTCAGCATTT
+CCTGGGTTCCGACTTTCTCTCACTTGATCCACCATTGCTCTTTGTGCAGCTGTTTGAAATTTTCCTTTAA
+GAATGTTGCACATTCTCTCATAAGCACTTCTTGTTTTCCGCCCATTCTCACCTCTCCAGAAATTTCGATC
+GTTGATCCCCCGTTTGACCATTCTGATCAGTTCCATCACCATTGTCCCGATTCCTTTGACTGCAGCACCT
+GCAGCTCCGGACCTTCTAGGGAGAGTCGAGCCCTGCATCAGAGAGCACATTCTGGGATCCATTCACTGGC
+CGC
+>gnl|ti|1086975894 name:1099575910655 mate_pair:1086975808
+GAGAAACGTCTGATTGTCTCGAGATAAGATCCTTCATTACTCATATCAAAAGAGGGCACGATCGGGTTCG
+CTGCCTTCTCGTCTGAGAGCTCGAAAACTCCCCTCCCCCGGAATGACACTTCTTCTGGTTTTGCACCTTC
+CATCATTCTTATGATTTCTGCCCTCATGTCTGAAGTTCTTCCCTCCGTATTTCCAGTGAATGCTGCCATG
+ATGGTTGACTTTTCAAATGGGAGGTTTCTTTGTACAGAAAACGTAGGTTGCACACTGGTTTGGCCTGCGG
+AGGCCCTCTGTTGATTAGTGTTTCCTCCACTCCTGGTCCTTATGGCCCAGTACCCGCTTCTCAGTTCAAG
+AGTGCTCGATCCCATATTATCCATGTTCTCATTTGAAGCAATTTGTACCCCTCTAGTTGACAGTTTCCCC
+CGAGGAGATACTTTTGTCCCTCTGATGAAGCTTAACAATCTTAAATCTTCAAATGCAGCAGAATGGCATG
+CCATCCACACCAGCTGACTCTTGTGTGCTGGATTCTCGTTAGGTCTGATTAGGCTGTACACCTGACTACT
+GGCCGC
+>gnl|ti|1086975893 name:1099575910656 mate_pairs:1086975842,1086975868
+ACAGCATTTTCCTTAATTGTCGTACTCTTCTGCATTGTCTCCGAAGAAATAAGATCCTTCATTACTCATA
+TCAAAAGAGGGCACGATCGGGTTCGCTGCCTTCTCGTCTGAGAGCTCGAAAACTCCCCTCCCCCGGAATG
+ACACTTCTTCTGGTTTTGCACCTTCCATCATTCTTATGATTTCTGCCCTCATGTCTGAAGTTCTTCCCTC
+CGTATTTCCAGTGAATGCTGCCATGATGGTTGACTTTTCAAATGGGAGGTTTCTTTGTACAGAAAACGTA
+GGTTGCACACTGGTTTGGCCTGCGGAGGCCCTCTGTTGATTAGTGTTTCCTCCACTCCTGGTCCTTATGG
+CCCAGTACCCGCTTCTCAGTTCAAGAGTGCTCGATCCCATATTATCCATGTTCTCATTTGAAGCAATTTG
+TACCCCTCTAGTTGACAGTTTCCCCCGAGGAGATACTTTTGTCCCTCTGATGAAGCTTAACAATCTTAAA
+TCTTCAAATGCAGCAGAATGGCAACTGGCCGC
+>gnl|ti|1086975886 name:1099575910657 mate_pairs:1086975842,1086975868
+CACGAGGTATTTTTTCTTAATTGTCGTACTCTTCTGCATTGTCTCCGAAGAAATAAGATCCTTCATTACT
+CATATCAAAAGAGGGCACGATCGGGTTCGCTGCCTTCTCGTCTGAGAGCTCGAAAACTCCCCTCCCCCGG
+AATGACACTTCTTCTGGTTTTGCACCTTCCATCATTCTTATGATTTCTGCCCTCATGTCTGAAGTTCTTC
+CCTCCGTATTTCCAGTGAATGCTGCCATGATGGTTGACTTTTCAAATGGGAGGTTTCTTTGTACAGAAAA
+CGTAGGTTGCACACTGGTTTGGCCTGCGGAGGCCCTCTGTTGATTAGTGTTTCCTCCACTCCTGGTCCTT
+ATGGCCCAGTACCCGCTTCTCAGTTCAAGAGTGCTCGATCCCATATTATCCATGTTCTCATTTGAAGCAA
+TTTGTACCCCTCTAGTTGACAGTTTCCCCCGAGGAGATACTTTTGTCCCTCTGATGAAGCTTAACAATCT
+TAAATCTTCAAATGCAGCAAAATGGCAACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975813 name:1099575910658 mate_pair:1086975898
+AAACTCCCCCACTGTACAGTTCATTGATACAAACGCATTCTGACTCCTGGGTTCTGAGGATTTCTTTGGA
+CCATGAAACAATACTATCTACAAGCCTCCCATTGTAAATGAAGCTAGCAGTTGCATTTTTATCATCCCCC
+GTTACACAAACATGCAGCCATGCTTTTCCATCGTGACAACTTGAGCTGGACCATGCTATGCACACTTGCT
+TAGTCCCCAGATGAAATGGAACACCTAACTCATTCATCAATAGGGTCCGATAAGGGGTCCTATCATGTAC
+TGTGTCATTTGAATGCACGTTGTTTAGTGTTGTTCCCTGTCCAAGGGCAAATTGATAACATTTGTCAGGA
+TCGCATGACACATAAGGTTCTCTTGTCACCCAGATGTCCCCACCAGCGGAAAGCCTAATCGAATTGTCCT
+TAGAAAAAGGTGCAAATCCTGTAATGTCACATTGCGGCTTTGACCAATTTCTGTATTCTGCTAGTTTGGG
+GCATATTTCCTTCTCTATGGTGGTGTTGGTCAGATACACTATCTCTGTTATGTTTCTTTCTATTATTGTT
+GGTTCACACAGCATCACTTGGTTGTTTGGGGGGGAGTTGAATTCATATTGCTTGAAATGCAATGTTACAG
+TAGTTATCAAGATGGCAATTTGCATAAAGAAGCATATTGTGGAAATGGTGAGAGAAACAGAGCCAATCGT
+TATTATCTTTTGATTTGGATTCATCTTTACTCCTGCTTTCGCTACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975807 name:1099575910659 mate_pairs:1086975823,1086975864
+AAAATAAACTGGACCATGCTATGCACACTTGCTTAGTCCCCAGATGAAATGGAACACCTAACTCATTCAT
+CAATAGGGTCCGATAAGGGGTCCTATCATGTACTGTGTCATTTGAATGCACGTTGTTTAGTGTTGTTCCC
+TGTCCAAGGGCAAATTGATAACATTTGTCAGGATCGCATGACACATAAGGTTCTCTTGTCACCCAGATGT
+CCCCACCAGCGGAAAGCCTAATCGAATTGTCCTTAGAAAAAGGTGCAAATCCTGTAATGTCACATTGCGG
+CTTTGACCAATTTCTGTATTCTGCTAGTTTGGGGCATATTTCCTTCTCTATGGTGGTGTTGGTCAGATAC
+ACTATCTCTGTTATGTTTCTTTCTATTATTGTTGGTTCACACAGCATCACTTGGTTGTTTGGGGGGGAGT
+TGAATTCATATTGCTTGAAATGCAATGTTACAGTAGTTATCAAGATGGCAATTTGCATAAAGAAGCATAT
+TGTGGAAATGGTGAGAGAAACAGAGCCAATCGTTATTATCTTTTGATTTGGATTCATCTTCACTCCTGCT
+TTTGCACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975907 name:1099575910661 mate_pair:1086975827
+GACGCCTATTTCATCATCAAAGGCCCAGCCTTTCACTCCATGACCACCTTCTTCATTGTTAGGATCCAAG
+CAATGGCTACTGCTGGAGCTGTCGTTTTTTCTGGGTGTGTCTCCAACAAGTCCTGAGCACACATAACTGG
+AAACAATGCTATAATCCTTTATGTTTATATCTACGATGGGCCTATTGGAGCCTTTCCAGTTGTCTCTGCA
+GACACATCTGACACCAGGATATCGAGGATAGCAGGAGCACTCCTCGACATGCTGGGCACTTCCTGACAAT
+GTGCTAGTATGAACGATTTTCCCCTCCTCAATGAATAGTATTTTAGTATCAGCTTTTCCTGAAGCACTCC
+CATCAGTCATTACTACTGTACAAGTTCCATTGATACAAACGCATTCTGACTCCTGGGTTCTGAGGATTTC
+TTTGGACCATGAAACAATACTATCTACAAGCCTCCCATTGTAAATGAAGCTAGCAGTTGCATTTTTATCA
+TCCCCCGTTACACAAACATGCAGCCATGCTTTTCCATCGTGACAACTTGAGCTGGACCATGCTATGCACA
+CTTGCTTAGTCCCCAGATGAAATGGAACACCTAACTCATTCATCAATAGGGTCCGATAAGGGGTCCTATC
+ATGTACTGTGTCATTTGAATGCACGTTGTTTAGTGTTGTTCCCTGCCCAAGTGCAAATTGATAACTGGCC
+GTCGTTTTACAA
+>gnl|ti|1086975834 name:1099575910662 mate_pair:1086975815
+GAGCGTATAACTGGAAACAATGCTATAATCCTTTATGTTTATATCTACGATGGGCCTATTGGAGCCTTTC
+CAGTTGTCTCTGCAGACACATCTGACACCAGGATATCGAGGATAGCAGGAGCACTCCTCGACATGCTGGG
+CACTTCCTGACAATGTGCTAGTATGAACGATTTTCCCCTCCTCAATGAATAGTATTTTAGTATCAGCTTT
+TCCTGAAGCACTCCCATCAGTCATTACTACTGTACAAGTTCCATTGATACAAACGCATTCTGACTCCTGG
+GTTCTGAGGATTTCTTTGGACCATGAAACAATACTATCTACAAGCCTCCCATTGTAAATGAAGCTGGCAG
+TTGCATTTTACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975822 name:1099575910663 mate_pair:1086975835
+AGATTTTTTAGGTAAAAGACTTCAGTTTCCTCTTTTCTTCCCCTTATCAACTCCACATAAAAGCACCGAT
+TGATGCAGCTTTTGCCTTCAACAGAGAAAATACCAGAATAACCGGACCTATTACCTCTGTCAACTATGAC
+TTGCCTATTTATCTGCAATTTGGAATTAGGGTTGGACCAGCCCTCAATGACTTTGAAGGTTTCATATCCT
+GAGCGTAACTTCTCGCTGATCGTTCTTCCCATCCACACGTCATTTCCATCATCAAAGGCCCAGCCTTTCA
+CTCCATGACCACCTTCTTCATTGTTAGGATCCAAGCAATGGCTACTGCTGGAGCTGTCGTTTTTTCTGGG
+TGTGTCTCCAACAAGTCCTGAGCACACATAACTGGAAACAATGCTATAATCCTTTATGTTTATATCTACA
+ATGGGCCTATTGGAGCCTTTCCAGTTGTCTCGGCAAACACATCTGAATTGTTTTGTCTTTTTCACAAC
+>gnl|ti|1086975873 name:1099575910669 mate_pair:1086975878
+CCGGGTGCTATTTCTAAATTGCGAAAGCTTATATAGGCATGAGATTGATGTCCGCCCCATCAGGCCATGA
+GCCTGTTCCATATGTACCTGAGGTGCCACAAAACACAACAATACTGTTTGAGGTCCACAAGACTTCAGTT
+TCCTCTTTTCTTCCCCTTATCAACTCCACATAAAAGCACCGATTGATGCAGCTTTTGCCTTCAACAGAGA
+AAATACCAGAATAACCGGACCTATTACCTCTGTCAACTATGACTTGCCTATTTATCTGCAATTTGGAATT
+AGGGTTGGACCAGCCCTCAATGACTTTGAAGGTTTCATATCCTGAGCGTAACTTCTCGCTGATCGTTCTT
+CCCATCCACACATCAACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975802 name:1099575910762 mate_pair:1086975791
+GGGGGACCGGAGGGGGGTTGTACATTTGCCTATGAGACCTGTGCTGGGAGTCAGCAATCTGTTCACATGT
+TGCACATACCAGGCCAAATGCCACTTCAGTGGTTACAGCCCCCATTCTATTGTATATGAGGCCCATGCAA
+CTGGCAAGTGCACCAGCAGAATAACTGAGAGCTATTTCTTTGGCCCCATGGAACGTTATCTCCCTCTTAA
+GTTTCCTATACAGTTTAACTGCTTTGTCCATGTTATTTGGATCTCCATTCCCATTGAGGGCATTTTGGAC
+AAAGCGTCTACGCTGCAGTCCTCGCTCACTGGGCACGGTGAGCGTGAACACAAACCCCAAAATCCCTTTA
+GTCAGAGGTGACAGAATTGGTCTTGTCTTTAGCCATTCCATGAGAGCCTCAAGATCTGTGTTTTTCCCAG
+CAAAGACATCTTCAAGTCTCTGCGCGATCTCGGCTTTGAGGGGGCCTGATGGAACGATAGAGAGAACATA
+CGTTTCGACCTCGGTTAGAAGGCTCATCTTTAAATATCTACCTGCTTACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975878 name:1099575910765 mate_pair:1086975873
+GGGGGGAGGGTAGACGATCAGCGAGAAGTTACGCTCAGGATATGAAACCTTCAAAGTCATTGAGGGCTGG
+TCCAACCCTAATTCCAAATTGCAGATAAATAGGCAAGTCATAGTTGACAGAGGTAATAGGTCCGGTTATT
+CTGGTATTTTCTCTGTTGAAGGCAAAAGCTGCATCAATCGGTGCTTTTATGTGGAGTTGATAAGGGGAAG
+AAAAGAGGAAACTGAAGTCTTGTGGACCTCAAACAGTATTGTTGTGTTTTGTGGCACCTCAGGTACATAT
+GGAACAGGCTCATGGCCTGATGGGGCGGACATCAATCTCATGCCTATATAAGCTTTCGCAATTTTAGAAA
+AAACTCCTTGTTTCTACTGGTCATACTGTTTCCTAAAAAGCGATAGAAGTGCGGTAAATAAGGTAATGGG
+AATGGACAATTGTTCTTGAGGTGCCACAGGAAGATATCAAACCCCCTAAAATAAAAGGGCTTAGTGGCGT
+CATTTCGTCTATTTATCGGATGCACATAAGATCACCGATAGATGCAGATTTAGCCTTAAACAGAGAAAAC
+ACAAGAACAACCGGACCTCTACGCGCGGTCCACTATAACTTGCGAGTTTATCTGCAATATCGAATTAGGG
+TTGGACCAGG
+>gnl|ti|1086975780 name:1099575910766
+GGCACGATAAATTTGAAAGATGAGCCTTCTAACCGAGGTCGAAACGTATGTTCTCTCTATCGTTCCATCA
+GGCCCCCTCAAAGCCGAGATCGCGCAGAGACTTGAAGATGTCTTTGCTGGGAAAAACACAGATCTTGAGG
+CTCTCATGGAATGGCTAAAGACAAGACCAATTCTGTCACCTCTGACTAAAGGGATTTTGGGGTTTGTGTT
+CACGCTCACCGTGCCCAGTGAGCGAGGACTGCAGCGTAGACGCTTTGTCCAAAATGCCCTCAATGGGAAT
+GGAGATCCAAATAACATGGACAAAGCAGTTAAACTGTATAGGAAACTTAAGAGGGAGATAACGTTCCATG
+GGGCCAAAGAAATAGCTCTCAGTTATTCTGCTGGTGCACTTGCCAGTTGCATGGGCCTCATATACAATAG
+AATGGGGGCTGTAACCACTGAAGTGGCATTTGGCCTGGTATGTGCAACATGTGAACAGATTGCTGACTCC
+CAGCAGGTCATAGCTGTTTCCTAATGTCATGCCATTCTGCTGCAGGTTAAAATTTAACATTGTTAACCTT
+CATCTTACGTACAAAATGATCTCCTCGAGACAAACTGTCAACTATACGATTCCAAATTGTTTCATTTGTT
+GTTTTACCTTTTTT
+>gnl|ti|1086975791 name:1099575910773 mate_pair:1086975802
+GGAAAATTTTAAGATGAGCCTTCTAACCGAGGTCGAAACGTATGTTCTCTCTATCGTTCCATCAGGCCCC
+CTCAAAGCCGAGATCGCGCAGAGACTTGAAGATGTCTTTGCTGGGAAAAACACAGATCTTGAGGCTCTCA
+TGGAATGGCTAAAGACAAGACCAATTCTGTCACCTCTGACTAAAGGGATTTTGGGGTTTGTGTTCACGCT
+CACCGTGCCCAGTGAGCGAGGACTGCAGCGTAGACGCTTTGTCCAAAATGCCCTCAATGGGAATGGAGAT
+CCAAATAACATGGACAAAGCAGTTAAACTGTATAGGAAACTTAAGAGGGAGATAACGTTCCATGGGGCCA
+AAGAAATAGCTCTCAGTTATTCTGCTGGTGCACTTGCCAGTTGCATGGGCCTCATATACAATAGAATGGG
+GGCTGTAACCACTGAAGTGGCATTTGGCCTGGTATGTGCAACATGTGAACAGATTGCTGACTCCCAGCAC
+AGGTCTCATAGGCAAATGGTGACAACAACCAATCCACTGATAAGGGTCATACTGAATTTCCTGAAACACG
+TCATGGGTTGATCCCTATGCAAAAACTTTAAAAGCTTTTACATTGCGATATTTCTCCGCTGATGGTAGCT
+TGGTGAAATGGACAATCTTCTATGAGATGCAAAATTTTGGAGTATTACTAGATATGACTCAAATATACAT
+ATGTCATTGAGATGAACACGAGTCACCAGAATGGGTGTGGATGAATACTCGAGTACAGAGAGGGTGGTGG
+TTAGCATTGATCGGTTTTTGAGAGTTCGAGACCAACGTGGGAATGTATTATTATCTCCTGAGGAGGTAGC
+GAACACAGGGGTCTACTAGTTGTCTCTGA
+>gnl|ti|1086975844 name:1099575910778 mate_pair:1086975900
+CGAAAGCCTTTGTCCAAAATGCCCTCAATGGGAATGGAGATCCAAATAACATGGACAAAGCAGTTAAACT
+GTATAGGAAACTTAAGAGGGAGATAACGTTCCATGGGGCCAAAGAAATAGCTCTCAGTTATTCTGCTGGT
+GCACTTGCCAGTTGCATGGGCCTCATATACAATAGAATGGGGGCTGTAACCACTGAAGTGGCATTTGGCC
+TGGTATGTGCAACATGTGAACAGATTGCTGACTCCCAGCACAGGTCTCATAGGCAAATGGTGACAACAAC
+CAATCCATTAATAAAACATGAGAACAGAATGGTTTTGGCCAGCACTACAGCTAAGGCTATGGAGCAAATG
+GCTGGATCAAGTGAGCAGGCAGCGGAGGCCATGGAAATTGCTAGTCAGGCCAGGCAAATGGTGCAGGCAA
+TGAGAGCCGTTGGGACTCATCCTAGCTCCAGTACTGGTCTAAGAGATGATCTTCTTGAAAATTTGCAGAC
+CTATCAGAAACGAATGGGGGTGCAGATGCAACGGTTCAAGTGACCCGCTTGGGTCATAGCTTATAAAAAG
+GTTGATCCCAATGCAACAATCTTTTAAGGCATTTTCACAAAGATGCGAACTGCCTTTTGAAGATTGCTGA
+ATTAAAAAATTTCACTATTTGATTCGAATGTTTCATTATTACTAGATATGACTCCTAACACAGAGATCCC
+ATGAGAGGAGTAACAGGCACC
+>gnl|ti|1086975877 name:1099575910781 mate_pair:1086975910
+GAAGGCTTCAGTTATTCTGCTGGTGCACTTGCCAGTTGCATGGGCCTCATATACAATAGAATGGGGGCTG
+TAACCACTGAAGTGGCATTTGGCCTGGTATGTGCAACATGTGAACAGATTGCTGACTCCCAGCACAGGTC
+TCATAGGCAAATGGTGACAACAACCAATCCATTAATAAAACATGAGAACAGAATGGTTTTGGCCAGCACT
+ACAGCTAAGGCTATGGAGCAAATGGCTGGATCAAGTGAGCAGGCAGCGGAGGCCATGGAAATTGCTAGTC
+AGGCCAGGCAAATGGTGCAGGCAATGAGAGCCGTTGGGACTCATCCTAGCTCCAGTACTGGTCTAAGAGA
+TGATCTTCTTGAAAATTTGCAGACCTATCAGAAACGAATGGGGGTGCAGATGCAACGATTCAAGTGACCC
+GCTTGTTGTTACCGCGAGTATCATTGGGATCTTGCACTTGATATTGTGGATTCTTGATCGTCTTTTTTTC
+AAATGCGTCTATCGACTCTTCAAACACGGCCTTAAAAGAGGCCCTTCTACGGAAGGAGTACCTGAGTCGG
+TCATAGCTGGTTTACATG
+>gnl|ti|1086975810 name:1099575910784 mate_pair:1086975879
+GGCAGCTGATCAGCAAGGTCTCATAGGCAAATGGTGACAACAACCAATCCATTAATAAAACATGAGAACA
+GAATGGTTTTGGCCAGCACTACAGCTAAGGCTATGGAGCAAATGGCTGGATCAAGTGAGCAGGCAGCGGA
+GGCCATGGAAATTGCTAGTCAGGCCAGGCAAATGGTGCAGGCAATGAGAGCCGTTGGGACTCATCCTAGC
+TCCAGTACTGGTCTAAGAGATGATCTTCTTGAAAATTTGCAGACCTATCAGAAACGAATGGGGGTGCAGA
+TGCAACGATTCAAGTGACCCGCTTGTTGTTACCGCGAGTATCATTGGGATCTTGCACTTGATATTGTGGA
+TTCTTGATCGTCTTTTTTTCAAATGCGTCTATCGACTCTTCAAACACGGCCTTAAAAGAGGCCCTTCTAC
+GGAAGGAGTACCTGAGTCTATGAGGGAAGAATATCGAAAGGAACAGCAGAATGCTGTGGATGCTGACGAC
+AGTCATTTTGTCAGCATAGAGTTGGAGTAAAAAACTACCTTGTTTCGGTAATATAACTGGCTGGTGTTTG
+TTGAGTTTAGGGAGCAGGTTAGGGGAAAAGGGGACCAGGCAAAATGGAGGAGGTTGCAACAGAGGGAAGA
+GGGGCCCGGAGGGAATATGACAGGTCGTGAAGAAAAGCCCT
+>gnl|ti|1086975836 name:1099575910791 mate_pair:1086975908
+AACCAAAGTTGCCAGGACTAATGGATTCCAACACTGTGTCAAGTTTCCAGGTAGATTGCTTTCTTTGGCA
+TATCCGGAAACAAGTTGTAGACCAAGAACTGAGTGATGCCCCATTCCTTGATCGGCTTCGCCGAGATCAG
+AGGTCCCTAAGGGGAAGAGGCAATACTCTCGGTCTAGACATCAAAGCAGCCACCCATGTTGGAAAGCAAA
+TTGTAGAAAAGATTCTGAAAGAAGAATCTGATGAGGCACTTAAAATGACCATGGTCTCCACACCTGCTTC
+GCGATACATAACTGACATGACTATTGAGGAATTGTCAAGAAACTGGTTCATGCTAATGCCCAAGCAGAAA
+GTGGAAGGACCTCTTTGCATCAGAATGGACCAGGCAATCATGGAGAAAAACATCATGTTGAAAGCGAATT
+TCAGTGTGATTTTTGACCGACTAGAGACCATAGTATTACTAAGGGCTTTCACCGAAGAGGGAGCAATTGT
+TGGCGAAATTTCACCATTGCCTTGGT
+>gnl|ti|1086975797 name:1099575910829 mate_pair:1086975826
+AAGCACGATGCATGACTAATGGATTCCAACACTGTGTCAAGTTTCCAGGTAGATTGCTTTCTTTGGCATA
+TCCGGAAACAAGTTGTAGACCAAGAACTGAGTGATGCCCCATTCCTTGATCGGCTTCGCCGAGATCAGAG
+GTCCCTAAGGGGAAGAGGCAATACTCTCGGTCTAGACATCAAAGCAGCCACCCATGTTGGAAAGCAAATT
+GTAGAAAAGATTCTGAAAGAAGAATCTGATGAGGCACTTAAAATGACCATGGTCTCCACACCTGCTTCGC
+GATACATAACTGACATGACTATTGAGGAATTGTCAAGAAACTGGTTCATGCTAATGCCCAAGCAGAAAGT
+GGAAGGACCTCTTTGCATCAGAATGGACCAGGCAATCATGGAGAAAAACATCATGTTGAAAGCGAATTTC
+AGTGTGATTTTTGACCGACTAGAGACCATAGTATTACTAAGGGCTTTCACCGAAGAGGGAGCAATTGTTG
+GCGAAATCTGGTAATAGCTGTTTCCTGA
+>gnl|ti|1086975777 name:1099575910839 mate_pair:1086975775
+CCAACTGTTAATGCTTTCTTTGGCATATCCGGAACAAGTTGTAGACCAAGAACTGAGTGATGCCCCATTC
+CTTGATCGGCTTCGCCGAGATCAGAGGTCCCTAAGGGGAAGAGGCAATACTCTCGGTCTAGACATCAAAG
+CAGCCACCCATGTTGGAAAGCAAATTGTAGAAAAGATTCTGAAAGAAGAATCTGATGAGGCACTTAAAAT
+GACCATGGTCTCCACACCTGCTTCGCGATACATAACTGACATGACTATTGAGGAATTGTCAAGAAACTGG
+TTCATGCTAATGCCCAAGCAGAAAGTGGAAGGACCTCTTTGCATCAGAATGGACCAGGCAATCATGGAGA
+AAAACATCATGTTGAAAGCGAATTTCAGTGTGATTTTTGACCGACTAGAGACCATAGTATTACTAAGGGC
+TTTCACCGAAGAGGGAGCAATTGTTGGCGAAATCTCACCATTGCCTTGGTAATAGCTGTTTCCTG
+>gnl|ti|1086975801 name:1099575910848 mate_pair:1086975796
+GAAACTGACGGACTCGTGTGATTTTTGACCGACTAGAGACCATAGTATTACTAAGGGCTTTCACCGAAGA
+GGGAGCAATTGTTGGCGAAATCTCACCATTGCCTTCTTTTCCAGGACATACTATTGAGGATGTCAAAAAT
+GCAATTGGGGTCCTCATCGGAGGACTTGAATGGAATGATAACACAGTTCGAGTCTCTAAAAATCTACAGA
+GATTCGCTTGGAGAAGCAGTAATGAGAATGGGGGACCTCCACTTACTCCAAAACAGAAACGGAAAATGGC
+GAGAACAGCTAGGTCAAAAGTTTGAAGAGATAAGATGGCTGATTGAAGAAGTGAGACACAGACTAAAAAC
+AACTGAAAATAGCTTTGAACAAATAACATTCATGCAAGCCTTACAGCGGTCATAGCTGTTTCCTGA
+>gnl|ti|1086975767 name:1099575910854 mate_pair:1086975839
+GGGATAAGACTCGTGTGATTTTTGACCGACTAGAGACCATAGTATTACTAAGGGCTTTCACCGAAGAGGG
+AGCAATTGTTGGCGAAATCTCACCATTGCCTTCTTTTCCAGGACATACTATTGAGGATGTCAAAAATGCA
+ATTGGGGTCCTCATCGGAGGACTTGAATGGAATGATAACACAGTTCGAGTCTCTAAAAATCTACAGAGAT
+TCGCTTGGAGAAGCAGTAATGAGAATGGGGGACCTCCACTTACTCCAAAACAGAAACGGAAAATGGCGAG
+AACAGCTAGGTCAAAAGTTTGAAGAGATAAGATGGCTGATTGAAGAAGTGAGACACAGACTAAAAACAAC
+TGAAAATAGCTTTGAACAAATAACATTCATGCAAGCATTACAACTGCTGTTTGAAGTGGAACAGGAGATA
+AGAACTTTCTCATTTCAGCTTATTTAATGATAAAAAGCACCCTTGTTTCTACTGGTCATACTG
+>gnl|ti|1086975838 name:1099575910857 mate_pair:1086975916
+CGAACTTTTTATTAGTATGGAAGATAAAAGAACTACGGAATCTGATGTCGCAGTCTCGCACTCGCGAGAT
+ACTGACAAAAACCACAGTGGACCATATGGCCATAATTAAGAAGTACACATCGGGGAGACAGGAAAAGAAC
+CCGTCACTTAGGATGAAATGGATGATGGCAATGAAATACCCAATCACTGCTGACAAAAGGATAACAGAAA
+TGGTTCCGGAGAGAAATGAACAAGGACAAACTCTATGGAGTAAAATGAGTGATGCTGGATCAGATCGAGT
+GATGGTATCACCTTTGGCTGTAACATGGTGGAATAGAAATGGACCCGTGACAAGTACGGTCCATTACCCA
+AAAGTATACAAGACTTATTTTGACAAAGTCGAAAGGTTAAAACATGGAACCTTTGGCCCTGTTCATTTTA
+GAAATCAAGTCAAGATACGCAGAAGAGTAGACATAAACCCTGGTCATGCAGACCTCAGTGCCAAAGAGGC
+ACAAGATGTAATTATGGAAGTTGTTTTTCCCAATGAAGTGGGAGCCAGGATACTAACATCAGAATCGCAA
+TTAACAATAACTAAAGAGAAAAAAGAAGAACTCCGAGATTGCAAAATTTCTCCCTTGATGGTTGCATACA
+TGTTAGAGAGAGAACTTGTACGAAAAACAAGATTTCTCCCAGTTGCTGGCGGAACAAGCAGTATATACAT
+TGAAGTTTTACATTTGACTCAAGGAACGTGTTGGGAACAGATGTACACTCCAGGGGTCTATTCGTTTTGA
+TACTCGAGATAAAAGTTCGGTTTTTTGAGACTTCGAGTCCACGTGGGAATGTTTATTTTCTCCCTGAGGA
+GGCGGCGGAACCCCAGGGTTGAGAAGATATCTTTTGTGTACAAA
+>gnl|ti|1086975892 name:1099575910860 mate_pair:1086975831
+CTGGGAAGTTACTCAGGTGGAGAGTGAGGAATGACGATGTTGACCAAAGCCTAATTATTGCGGCCAGGAA
+CATAGTAAGAAGAGCAGCAGTATCAGCAGATCCACTAGCATCTTTATTGGAGATGTGCCACAGCACACAA
+ATTGGCGGGACAAGGATGGTGGACATTCTTAGACAGAACCCGACTGAAGAACAAGCTGTGGATATATGCA
+AGGCTGCAATGGGATTGAGAATCAGCTCATCCTTCAGCTTTGGTGGGTTTACATTTAAAAGAACAAGCGG
+GTCATCAGTCAAAAAAGAGGAAGAAGTGCTTACAGGCAATCTCCAAACATTGAAGATAAGAGTACATGAG
+GGGTATGAGGAGTTCACAATGGTGGGGAAAAGAGCAACAGCTATACTCAGAAAAGCAACCAGAAGATTGG
+TTCAGCTCATAGTGAGTGGAAGAGACGAACAGTCAATAGCTGAAGCAATAATCGTGGCCATGGTGTTTTC
+ACAAGAGGATTGCATGATAAAAGCAGTTAGAGGTGACCTGAATTTCGTCAACAGAGCAAATCAGCGGTTG
+AACCCCATGCATCAGCTTTTAAGGCATTTTCAGAAAGATGCGAAAGTGCTTTTTCAAAATTGGGGAATTG
+AACACATCGACAGTGTGATGGGAATGGTTGGAGTATTACCAGATATGACTCCAAGCACAGAGATGTCAAT
+GAGAGGAATAAGAGTCAGCAAAATGGGTGTGGATGAATACTCCAGTACAGAGAGGGTGGTGGTTAGCATT
+GATCGGTTTTTGAGAGTTCGAGACCAACGTGGGAATGTATTATTATCTCCTGAGGAGGTCAGCGAAACAC
+AAGGGTCATACACGCGTGGTCTATGAGAGA
+>gnl|ti|1086975853 name:1099575910863 mate_pair:1086975789
+CCGAAAATGCGAACCAGGGTACTGAGAGACTGACAATAACTTATTCATCGTCGATGATGTGGGAGATTAA
+CGGTCCTGAGTCGGTTTTGGTCAATACCTATCAATGGATCATCAGAAATTGGGAAGCTGTCAAAATTCAA
+TGGTCTCAGAATCCTGCAATGTTGTACAACAAAATGGAATTTGAACCATTTCAATCTTTAGTCCCCAAGG
+CCATTAGAAGCCAATACAGTGGGTTTGTCAGAACTCTATTCCAACAAATGAGAGACGTACTTGGGACATT
+TGACACCACCCAGATAATAAAGCTTCTCCCTTTTGCAGCCGCTCCACCAAAGCAAAGCAGAATGCAGTTC
+TCTTCACTGACTGTAAATGTGAGGGGATCAGGGATGAGAATACTTGTAAGGGGCAATTCTCCTGTATTCA
+ACTACAACAAGACAACTAAAAGACTAACAATTCTCGGAAAAGATGCCGGCACTTTAATTGAAGACCCAGA
+TGAAAGCACATCCGGAGTGGAGTCTGCCGTCTTGAGAGGGTTTCTCATTATAGGTAAGGAAGACAGAAGA
+TACGGACCAGCATTAAGCATCAATGAACTGAGTAACCTTGCAAAAGGGGAAAAGGCTAATGTGCTAATCG
+GGCAAGGAGACGTGGTGTTGGTAATGAAACGAAAACGGGACTCTAGCATACTTACTGACAGCCAGACAGC
+GACCAAAAGAATTCGGATGGCCATCAATTAATGTTGAATAGTTTAAAAACGACCTTGTTTCTACTGGTCA
+TACTTGTTTTCTTGA
+>gnl|ti|1086975783 name:1099575910866 mate_pair:1086975812
+CAGGGCACATTTGATGCATGTCATCCGACTCTACTGTTCCTAAAGGTTCCAGCGCAAAATGCCATAAGCA
+CCACATTCCCTTATACTGGAGATCCTCCATACAGCCATGGAACAGGAACAGGGTACACCATGGACACAGT
+CAACAGAACACACCAATATTCAGAGAAGGGGAAGTGGACGACAAATACAGAAACTGGGGCACCCCAACTC
+AACCCAATTGATGGACCACTACCTGAGGATAATGAGCCGAGTGGATATGCACAAACAGACTGTGTCCTGG
+AGGCTATGGCCTTCCTTGAAGAATCCCACCCAGGTATCTTTGAGAACTCATGCCTTGAAACAATGGAAGT
+CGTTCAACAAACAAGGGTGGACAAACTAACCCAAGGTCGCCAGACTTATGATTGGACATTAAACAGAAAT
+CAACCGGCAGCAACTGCATTAGCCAACACCATAGAAGTTTTTAGATCGAATGGACTAACAGCTAATGAAT
+CAGGAAGGCTAATAGATTTCCTCAAGGATGTGATGGAATCAATGGATAAAGAGGAAATGGAGATAACAAC
+ACACTTTCAAAGAAAAAGGAGAGTAAGAGACAACATGACCAAGAAAATGGTCACACAAAGAACAATAGGG
+AAGAAAAAACAAAGAGTGAATAAGAGAGGCTATCTAATAAGAGCTTTGACATTGAACACGATGACCAAAG
+ATGCAGAGAGAGGTAAATTAAAAAGAAGGGCTATTGCAACACCAGGGATGCAGATCAGAGGGGTCATAG
+>gnl|ti|1086975786 name:1099575910869 mate_pair:1086975874
+TCAAACCGGGGGGAAGCAAATTAGAGGGTTCGTGTACTTCGTTGAAACTTTAGCTAGAAGCATTTGCGAA
+AAGCTTGAACAGTCTGGACTTCCGGTTGGGGGTAATGAAAAGAAGGCCAAACTGGCAAATGTTGTGAGAA
+AAATGATGACTAATTCACAAGACACTGAGCTTTCTTTCACAATCACTGGGGACAACACTAAGTGGAATGA
+AAATCAAAACCCTCGAATGTTTTTGGCGATGATTACATATATCACAAAAAATCAACCTGAGTGGTTCAGA
+AACATCCTGAGCATCGCACCAATAATGTTCTCAAACAAAATGGCAAGACTAGGAAAAGGATACATGTTCG
+AGAGTAAGAGAATGAAGCTCCGAACACAAATACCCGCAGAAATGCTAGCAAGCATTGACCTGAAGTATTT
+CAATGAATCAACAAGGAAGAAAATTGAGAAAATAAGGCCTCTTCTAATAGATGGCACAGCATCATTGAGC
+CCTGGGATGATGATGGGCATGTTCAACATGCTAAGTACGGTTTTAGGAGTCTCAATACTGAATCTTGGGC
+AAAAGAAATACACCAAGACAACATACTGGTGGGATGGGCTCCAATCCTCCGACGATTTTGCCCTCATAGT
+GAATGCACCAAATCATGAGGGAATACAAGCAGGAGTGGATAGATTCTACAGGACCTGCAAGTTAGTGGGA
+ATCAACATGAGCAAAAAGAAGTCCTATATAAATAAAACAGGGACATTTGAATTCACAAGCTTTTTTTATC
+GATATGGATTTGTGGCTAATTTTAGCATGGAGCTTCCCAGCTTTGGGAGTGTCTGGGGTCATAGCTGTTT
+TACTAA
+>gnl|ti|1086975903 name:1099575910882 mate_pair:1086975913
+TAAGCTAAATTGATTGGAGATTTTGTGCGACAATGCTTCAACCCGATGATTGTCGAACTTGCAGAAAAAG
+CAATGAAAGAGTATGGAGAGGATCTGAAAATTGAAACAAACAAATTTGCAGCAATATGCACCCACTTGGA
+GGTATGTTTCATGTATTCAGATTTTCATTTCATCAATGAACAAGGCGAATCAATAATGGTAGAACTTGAT
+GATCCAAATGCACTGTTAAAGCACAGATTTGAAATAATCGAGGGGAGAGACAGAACAATGGCCTGGACAG
+TAGTAAACAGTATCTGCAACACTACTGGAGCTGAAAAACCGAAGTTTCTACCAGATTTGTATGATTACAA
+GGAGAACAGATTCATCGAAATTGGAGTGACAAGAAGAGAAGTCCACATATATTACCTTGAAAAGGCCAAT
+AAAATTAAATCTGAGAACACACACATTCACATTTTCTCATTCACTGGGGAGGAAATGGCCACAAAGGCAG
+ACTACACTCTCGACGAGGAAAGCAGAGCTAGGATTAAAACCAGGCTATTTACCATAAGACAAGAAATGGC
+CAACAGAGGCCTCTGGGATTCCTTTCGTCAGTCCGAAAGAGGCGAAGAAACAATTGAAGAAAAATTTGAA
+ATCTCAGGAACTATGCGTAGGCTTGCCGACCAAAGTCTCCCACCGAACTTCTCCTGCCTTGAGAATTTTA
+GAGCCTATGTGGATGGATTCGAACCGAACGGCTGCATTGAGGGCAAGCTTTCTCAGATGTCCAAAGAAGT
+GAATGGGTCATAGCTGTTTCCTGA
+>gnl|ti|1086975846 name:1099575910887 mate_pair:1086975863
+CGGCCGAATCTCTGCTTGAGAATTTTAGAGCCTATGTGGATGGATTCGAACCGAACGGCTGCATTGAGGG
+CAAGCTTTCTCAAATGTCCAAAGAAGTGAATGCCAAAATTGAACCTTTTCTGAAGACAACACCAAGACCA
+ATCAAACTTCCTAATGGACCTCCTTGTTATCAGCGGTCCAAATTCCTCCTGATGGATGCTTTGAAATTGA
+GCATTGAAGACCCAAGTCACGAAGGAGAAGGGATTCCATTATATGATGCGATCAAGTGCATGAAAACATT
+CTTTGGATGGAAAGAACCTTATATAGTCAAACCACACGAAAAGGGAATAAATTCAAATTACCTGCTGTCA
+TGGAAGCAAGTATTGTCAGAATTGCAGGACATTGAAAATGAGGAGAAGATCCCAAGGACTAAAAACATGA
+AGAAAACGAGTCAACTAAAGTGGGCTCTTGGTGAAAACATGGCACCAGAGAAAGTAGACTTTGACAACTG
+CAGAGACATAAGCGATTTGAAGCAATATGATAGTGACGAACCTGAATTAAGGTCACTTTCAAGCTGGATA
+CAGAATGAGTTCAACAAGGCCTGCGAGCTAACTGATTCAATCTGGATAGAGCTCGATGAAATTGGAGAGG
+ACGTAGCCCCAATTGAGTACATTGCAAGCATGAGGAGGAATTATTTCACAGCAGAGGTGTCCCATTGTAG
+AGCCACTGAGTACATAATGAAGGGGGTATACATTAATACTGCCCTGCTCAATGCATCCTGTGCAGCAATG
+GACGATTTTCAACTAATCCCCATGATAAGCAATTGCAGGACTAAAGAGGTCATAGCTTGTTTTCCTGAA
+>gnl|ti|1086975854 name:1099575910893 mate_pair:1086975825
+CCCGGAATTGAGGGGGGTAACTTTAATACTGCCCTGCTCAATGCATCCTGTGCAGCAATGGACGATTTTC
+AACTAACCCCCATGATAAGCAAGTGCAGAACTAAAGAGGGAAGGCGAAAAACCAATTTATATGGGTTCAT
+CATAAAGGGAAGATCCCATTTAAGGAATGACACAGATGTGGTAAACTTTGTGAGCATGGAATTTTCTCTC
+ACTGACCCGAGACTAGAGCCACATAAATGGGAGAAATACTGTGTCCTTGAGATAGGAGATATGTTACTAA
+GAAGTGCCATAGGCCAAATTTCAAGGCCTATGTTCTTGTATGTGAGGACAAACGGAACATCAAAGGTCAA
+AATGAAATGGGGAATGGAGATGAGACGTTGCCTCCTTCAGTCACTCCAGCAGATCGAGAGCATGATTGAA
+GCCGAGTCCTCGATTAAAGAGAAAGACATGACCAAAGAGTTTTTTGAGAATAAATCAGAAGCATGGCCCA
+TTGGGGAGTCCCCCAAGGGAGTGGAAGAAGGTTCCATTGGGAAAGTCTGTAGGACTCTATTGGCTAAGTC
+AGTGTTCAATAGCCTGTATGCATCACCACAATTGGAAGGATTTTCAGCGGAGTCAAGAAAACTGCTTCTT
+GTTGTTCAGGCTCTTAGGGACAATCTCGAACCTGGGACCTTTGATCTCGGGGGGCTATATGAAGCAATTG
+AGGAGTGCCTGATTAATGATCCCTGGGTTTTGCTCAATGCATCTTGGTTCAACTCCTTCCTGACACATGC
+ATTAAAATAGTTATGGCAGTGCTACTATTTGTTATCCGTACTGTCCAAAAAAGTACCTTGTTTCTACTGG
+TCATAGCTGTTTCCTGA
+>gnl|ti|1086975900 name:1099575910896 mate_pair:1086975844
+GAGAATTGACGTTGCATCTGCACCCCCATTCGTTTCTGATAGGTCTGCAAATTTTCAAGAAGATCATCTC
+TTAGACCAGTACTGGAGCTAGGATGAGTCCCAACGGCTCTCATTGCCTGCACCATTTGCCTGGCCTGACT
+AGCAATTTCCATGGCCTCCGCTGCCTGCTCACTTGATCCAGCCATTTGCTCCATAGCCTTAGCTGTAGTG
+CTGGCCAAAACCATTCTGTTCTCATGTTTTATTAATGGATTGGTTGTTGTCACCATTTGCCTATGAGACC
+TGTGCTGGGAGTCAGCAATCTGTTCACATGTTGCACATACCAGGCCAAATGCCACTTCAGTGGTTACAGC
+CCCCATTCTATTGTATATGAGGCCCATGCAACTGGCAAGTGCACCAGCAGAATAACTGAGAGCTATTTCT
+TTGGCCCCATGGAACGTTATCTCCCTCTTAAGTTTCCTATACAGTTTAACTGCTTTGTCCATGTTATTTG
+GATCTCCATTCCCATTGAGGGCATTTTGGACAAAGCGTCTACGCTGCAGTACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975910 name:1099575910900 mate_pair:1086975877
+ATGGCTCGTCGTAGACGCCTCTTTTAAGGCCGTGTTTGAAGAGTCGATAGACGCATTTGAAAAAAAGACG
+ATCAAGAATCCACAATATCAAGTGCAAGATCCCAATGATACTCGCGGTAACAACAAGCGGGTCACTTGAA
+TCGTTGCATCTGCACCCCCATTCGTTTCTGATAGGTCTGCAAATTTTCAAGAAGATCATCTCTTAGACCA
+GTACTGGAGCTAGGATGAGTCCCAACGGCTCTCATTGCCTGCACCATTTGCCTGGCCTGACTAGCAATTT
+CCATGGCCTCCGCTGCCTGCTCACTTGATCCAGCCATTTGCTCCATAGCCTTAGCTGTAGTGCTGGCCAA
+AACCATTCTGTTCTCATGTTTTATTAATGGATTGGTTGTTGTCACCATTTGCCTATGAGACCTGTGCTGG
+GAGTCAGCAATCTGTTCACATGTTGCACATACCAGGCCAAATGCCACTTCAGTGGTTACAGCCCCCATTC
+TATTGTATATGAGGCCCATGCAACTGGCAAGTGCACCAGCAGAATAACTGAGTGCTATTTCTTTGGCCAC
+TGGCCGC
+>gnl|ti|1086975879 name:1099575910903 mate_pair:1086975810
+TGACCAATTTTCTCCACTCTATGCTGACAAAATGACTGTCGTCAGCATCCACAGCATTCTGCTGTTCCTT
+TCGATATTCTTCCCTCATAGACTCAGGTACTCCTTCCGTAGAAGGGCCTCTTTTAAGGCCGTGTTTGAAG
+AGTCGATAGACGCATTTGAAAAAAAGACGATCAAGAATCCACAATATCAAGTGCAAGATCCCAATGATAC
+TCGCGGTAACAACAAGCGGGTCACTTGAATCGTTGCATCTGCACCCCCATTCGTTTCTGATAGGTCTGCA
+AATTTTCAAGAAGATCATCTCTTAGACCAGTACTGGAGCTAGGATGAGTCCCAACGGCTCTCATTGCCTG
+CACCATTTGCCTGGCCTGACTAGCAATTTCCATGGCCTCCGCTGCCTGCTCACTTGATCCAGCCATTTGC
+TCCATAGCCTTAGCTGTAGTGCTGGCCAAAACCATTCTGTTCTCATGTTTTATTAATGGATTGGTTGTTG
+TCACCATTTGCCTATGAGACCTGTGCTGGGAGTCAGCAATCTGCTCACACTGGCCG
+>gnl|ti|1086975908 name:1099575910912 mate_pair:1086975836
+CGGATTGTGAATTTCCGCCAACAATTGCTCCCTCTTCGGTGAAAGCCCTTAGTAATACTATGGTCTCTAG
+TCGGTCAAAAATCACACTGAAATTCGCTTTCAACATGATGTTTTTCTCCATGATTGCCTGGTCCATTCTG
+ATGCAAAGAGGTCCTTCCACTTTCTGCTTGGGCATTAGCATGAACCAGTTTCTTGACAATTCCTCAATAG
+TCATGTCAGTTATGTATCGCGAAGCAGGTGTGGAGACCATGGTCATTTTAAGTGCCTCATCAGATTCTTC
+TTTCAGAATCTTTTCTACAATTTGCTTTCCAACATGGGTGGCTGCTTTGATGTCTAGACCGAGAGTATTG
+CCTCTTCCCCTTAGGGACCTCTGATCTCGGCGAAGCCGATCAAGGAATGGGGCATCACTCAGTTCTTGGT
+CTACAACTTGTTTCCGGATATGCCAAAGAAAGCAATCTACCTGGAAACTTGACACAGTGTTGGAATCCAT
+TATGTCTTTGTCACCCTGCTTTCGCTACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975826 name:1099575910916 mate_pair:1086975797
+GGGGGACTGCTCGTCTTCGGTGAAAGCCCTTAGTAATACTATGGTCTCTAGTCGGTCAAAAATCACACTG
+AAATTCGCTTTCAACATGATGTTTTTCTCCATGATTGCCTGGTCCATTCTGATGCAAAGAGGTCCTTCCA
+CTTTCTGCTTGGGCATTAGCATGAACCAGTTTCTTGACAATTCCTCAATAGTCATGTCAGTTATGTATCG
+CGAAGCAGGTGTGGAGACCATGGTCATTTTAAGTGCCTCATCAGATTCTTCTTTCAGAATCTTTTCTACA
+ATTTGCTTTCCAACATGGGTGGCTGCTTTGATGTCTAGACCGAGAGTATTGCCTCTTCCCCTTAGGGACC
+TCTGATCTCGGCGAAGCCGATCAAGGAATGGGGCATCACTCAGTTCTTGGTCTACAACTTGTTTCCGGAT
+ATGCCAAAGAAAGCAATCTACCTGGAAACTTGACACAGTGTTGGAATCCATTATGTCTTTGTCACCCTGC
+TTTTGCACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975775 name:1099575910920 mate_pair:1086975777
+CCAGCATAATCGCAAATTGCTCCCTCTTCGGTGAAAGCCCTTAGTAATACTATGGTCTCTAGTCGGTCAA
+AAATCACACTGAAATTCGCTTTCAACATGATGTTTTTCTCCATGATTGCCTGGTCCATTCTGATGCAAAG
+AGGTCCTTCCACTTTCTGCTTGGGCATTAGCATGAACCAGTTTCTTGACAATTCCTCAATAGTCATGTCA
+GTTATGTATCGCGAAGCAGGTGTGGAGACCATGGTCATTTTAAGTGCCTCATCAGATTCTTCTTTCAGAA
+TCTTTTCTACAATTTGCTTTCCAACATGGGTGGCTGCTTTGATGTCTAGACCGAGAGTATTGCCTCTTCC
+CCTTAGGGACCTCTGATCTCGGCGAAGCCGATCAAGGAATGGGGCATCACTCAGTTCTTGGTCTACAACT
+TGTTTCCGGATATGCCAAAGAAAGCAATCTACCTGAAAACTTGACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975796 name:1099575910923 mate_pair:1086975801
+TGAGCGGCAGATGTTATTTGTTCAAAGCTATTTTCAGTTGTTTTTAGTCTGTGTCTCACTTCTTCAATCA
+GCCATCTTATCTCTTCAAACTTTTGACCTAGCTGTTCTCGCCATTTTCCGTTTCTGTTTTGGAGTAAGTG
+GAGGTCCCCCATTCTCATTACTGCTTCTCCAAGCGAATCTCTGTAGATTTTTAGAGACTCGAACTGTGTT
+ATCATTCCATTCAAGTCCTCCGATGAGGACCCCAATTGCATTTTTGACATCCTCAATAGTATGTCCTGGA
+AAAGAAGGCAATGGTGAGATTTCGCCAACAATTGCTCCCTCTTCGGTGAAAGCCCTTAGTAATACTATGG
+TCTCTAGTCGGTCAAAAATCACACTGAAATTCGCTTTCAACATGAACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975839 name:1099575910925 mate_pair:1086975767
+GGCGGTGTGCCTTTTTATCATTAAATAAGCTGAAATGAGAAAGTTCTTATCTCCTGTTCCACTTCAAACA
+GCAGTTGTAATGCTTGCATGAATGTTATTTGTTCAAAGCTATTTTCAGTTGTTTTTAGTCTGTGTCTCAC
+TTCTTCAATCAGCCATCTTATCTCTTCAAACTTTTGACCTAGCTGTTCTCGCCATTTTCCGTTTCTGTTT
+TGGAGTAAGTGGAGGTCCCCCATTCTCATTACTGCTTCTCCAAGCGAATCTCTGTAGATTTTTAGAGACT
+CGAACTGTGTTATCATTCCATTCAAGTCCTCCGATGAGGACCCCAATTGCATTTTTGACATCCTCAATAG
+TATGTCCTGGAAAAGAAGGCAATGGTGAGATTTCGCCAACAATTGCTCCCTCTTCGGTGAAAGCCCTTAG
+TAATACTATGGTCTCTAGTCGGTCAAAAATCACACTGAAATTCGCTTTTAATATGAACTGGCCGTCGTTT
+TACAA
+>gnl|ti|1086975916 name:1099575910926 mate_pair:1086975838
+TAAGCATCTGTTCACACGTTCCTTGAGTCAAATGTAAAACTTCAATGTATATACTGCTTGTTCCGCCAGC
+AACTGGGAGAAATCTTGTTTTTCGTACAAGTTCTCTCTCTAACATGTATGCAACCATCAAGGGAGAAATT
+TTGCAATCTCGGAGTTCTTCTTTTTTCTCTTTAGTTATTGTTAATTGCGATTCTGATGTTAGTATCCTGG
+CTCCCACTTCATTGGGAAAAACAACTTCCATAATTACATCTTGTGCCTCTTTGGCACTGAGGTCTGCATG
+ACCAGGGTTTATGTCTACTCTTCTGCGTATCTTGACTTGATTTCTAAAATGAACAGGGCCAAAGGTTCCA
+TGTTTTAACCTTTCGACTTTGTCAAAATAAGTCTTGTATACTTTTGGGTAATGGACCGTACTTGTCACGG
+GTCCATTTCTATTCCACCATGTTACAGCCAAAGGTGATACCATCACTCGATCTGATCCAGCATCACTCAT
+TTTACTCCATAGAGTTTGTCCTTGTTCATTTCTCTCCGGAACCATTTCTGTTATCCTTTTGTCAGCAGTG
+ATTGGGTATTTCATTGCCATCATCCATTTCATCCTAAGTGACGGGTTCTTTTCCTGTCTCCCCGATGTGT
+ACTTCTTAATTATGGCCATATGGTCCACTGTGGTTTTTGTCAGTATCTCGCGAGTGCGAGACTGCGACAT
+CAGATTCCGTAGTTCTTTTATTCTTTCCATACTGAATATAATTGACCTGCTTTCGACTGGCGC
+>gnl|ti|1086975831 name:1099575910927 mate_pair:1086975892
+TACCACAAACTCTAGAGAAATAATACATTCCCACGTTGGTCTCGAACTCTCAAAAACCGATCAATGCTAA
+CCACCACCCTCTCTGTACTGGAGTATTCATCCACACCCATTTTGCTGACTCTTATTCCTCTCATTGACAT
+CTCTGTGCTTGGAGTCATATCTGGTAATACTCCAACCATTCCCATCACACTGTCGATGTGTTCAATTCCC
+CAATTTTGAAAAAGCACTTTCGCATCTTTCTGAAAATGCCTTAAAAGCTGATGCATGGGGTTCAACCGCT
+GATTTGCTCTGTTGACGAAATTCAGGTCACCTCTAACTGCTTTTATCATGCAATCCTCTTGTGAAAACAC
+CATGGCCACGATTATTGCTTCAGCTATTGACTGTTCGTCTCTTCCACTCACTATGAGCTGAACCAATCTT
+CTGGTTGCTTTTCTGAGTATAGCTGTTGCTCTTTTCCCCACCATTGTGAACTCCTCATACCCCTCATGTA
+CTCTTATCTTCAATGTTTGGAGATTGCCTGTAAGCACTTCTTCCTCTTTTTTGACTGATGACCCGCTTGT
+TCTTTTAAATGTAAACCCACCAAAGCTGAAGGATGAGCTGATTCTCAATCCCATTGCAGCCTTGCATATA
+TCCACAGCTTGTTCTTCAGTCGGGTTCTGTCTAAGAATGTCCACCATCCTTGTCCCGCCAATTTGTGTGC
+TGTGGCACATCTCCAATAAAGATGCTAGTGGATCTGCTGATACTGCTGCTCTTCTTACTATGTTCCTGGC
+CGCAATAATTAGGCTTTGGTCAACATCGTCATTCCTCACTTCTCCACCTGGAGTGTACATCTGTTCCCAG
+CAACTGGCCTCCTTTTTACA
+>gnl|ti|1086975789 name:1099575910928 mate_pair:1086975853
+AAGGGTCCCCTTTTTAACTATTCCACATTAATTGATGGCCATCCGAATTCTTTTGGTCGCTGTCTGGCTG
+TCAGTAAGAAAGCTAGAGTCCCGTTTTCGTTTCATTACCAACACCACGTCTCCTTGCCCGATTAGCACAT
+TAGCCTTTTCCCCTTTTGCAAGGTTACTCAGTTCATTGATGCTTAATGCTGGTCCGTATCTTCTGTCTTC
+CTTACCTATAATGAGAAACCCTCTCAAGACGGCAGACTCCACTCCGGATGTGCTTTCATCTGGGTCTTCA
+ATTAAAGTGCCGGCATCTTTTCCGAGAATTGTTAGTCTTTTAGTTGTCTTGTTGTAGTTGAATACAGGAG
+AATTGCCCCTTACAAGTATTCTCATCCCTGATCCCCTCACATTTACAGTCAGTGAAGAGAACTGCATTCT
+GCTTTGCTTTGGTGGAGCGGCTGCAAAAGGGAGAAGCTTTATTATCTGGGTGGTGTCAAATGTCCCAAGT
+ACGTCTCTCATTTGTTGGAATAGAGTTCTGACAAACCCACTGTATTGGCTTCTAATGGCCTTGGGGACTA
+AAGATTGAAATGGTTCAAATTCCATTTTGTTGTACAACATTGCAGGATTCTGAGACCATTGAATTTTGAC
+AGCTTCCCAATTTCTGATGATCCATTGATAGGTATTGACCAAAAACCGACTCAGGACCGTTAATCTCCCA
+CATCATCGACGATGAATAAGTTATTGTCAGTCTCTCAGTTCCCTGTGTTTTCGCTAACCTCTTCAAACTG
+GCCGTATTTTTACAA
+>gnl|ti|1086975812 name:1099575910929 mate_pair:1086975783
+ATCAGATTCGTCGACTGGAGCAGCTCAGAGGTTCTTTTTATGTTACCTCGTCTCTGCATCTTTGGTCATC
+GTGTTCAAGAAAAACTCTTATTAGATAGCCTCTCTTATTCACTCTTTGTTTTTTCTTCCCTATTGTTCTT
+TGTGTGACCATTTTCTTGGTCATGTTGTCTCTTACTCTCCTTTTTCTTTGAAAGTGTGTTGTTATCTCCA
+TTTCCTCTTTATCCATTGATTCCATCACATCCTTGAGGAAATCTATTAGCCTTCCTGATTCATTAGCTGT
+TAGTCCATTCGATCTAAAAACTTCTATGGTGTTGGCTAATGCAGTTGCTGCCGGTTGATTTCTGTTTAAT
+GTCCAATCATAAGTCTGGCGACCTTGGGTTAGTTTGTCCACCCTTGTTTGTTGAACGACTTCCATTGTTT
+CAAGGCATGAGTTCTCAAAGATACCTGGGTGGGATTCTTCAAGGAAGGCCATAGCCTCCAGGACACAGTC
+TGTTTGTGCATATCCACTCGGCTCATTATCCTCAGGTAGTGGTCCATCAATTGGGTTGAGTTGGGGTGCC
+CCAGTTTCTGTATTTGTCGTCCACTTCCCCTTCTCTGAATATTGGTGTGTTCTGTTGACTGTGTCCATGG
+TGTACCCTGTTCCTGTTCCATGGCTGTATGGAGGATCTCCAGTATAAGGGAATGTGGTGCTTATGGCATT
+TTGCGCTGGAACCTTTAGGAACAGTAGAGTCGGATTGACATCCATCCAAATGGTTTGCCTGCTTTCGACT
+GGCCGTCGTTTTACAA
+>gnl|ti|1086975874 name:1099575910930 mate_pair:1086975786
+GGGGCAGGCTTGGCAGCTACATGCTAAATTAGCGACAAATCCATATCGATAAAAAAAGCTTGTGAATTCA
+AATGTCCCTGTTTTATTTATATAGGACTTCTTTTTGCTCATGTTGATTCCCACTAACTTGCAGGTCCTGT
+AGAATCTATCCACTCCTGCTTGTATTCCCTCATGATTTGGTGCATTCACTATGAGGGCAAAATCGTCGGA
+GGATTGGAGCCCATCCCACCAGTATGTTGTCTTGGTGTATTTCTTTTGCCCAAGATTCAGTATTGAGACT
+CCTAAAACCGTACTTAGCATGTTGAACATGCCCATCATCATCCCAGGGCTCAATGATGCTGTGCCATCTA
+TTAGAAGAGGCCTTATTTTCTCAATTTTCTTCCTTGTTGATTCATTGAAATACTTCAGGTCAATGCTTGC
+TAGCATTTCTGCGGGTATTTGTGTTCGGAGCTTCATTCTCTTACTCTCGAACATGTATCCTTTTCCTAGT
+CTTGCCATTTTGTTTGAGAACATTATTGGTGCGATGCTCAGGATGTTTCTGAACCACTCAGGTTGATTTT
+TTGTGATATATGTAATCATCGCCAAAAACATTCGAGGGTTTTGATTTTCATTCCACTTAGTGTTGTCCCC
+AGTGATTGTGAAAGAAAGCTCAGTGTCTTGTGAATTAGTCATCATTTTTCTCACAACATTTGCCAGTTTG
+GCCTTCTTTTCATTACCCCCAACCGGAAGTCCAGACTGTTCAAGCTTTTCGCAAATGCTTCTAGCTAAAG
+TTTCAACGAAGTACACGAACCCTCTAATTTGCATCCCTGGGTGTTGCAATTGACTGGCCGTCGTTTTACA
+A
+>gnl|ti|1086975866 name:1099575910931
+CAACGGACAATTTTTTTCTGAAGGACAGCTAAATTCATTATTTTTGCCGTCTGAGTTCTTCAATGGTGGA
+ACAGATCTTCATGATCTCAGAGAACTCTTCCTTCTTAATCCGTCCAGACTCGAAGTCAATTCTGGCATCA
+ATCCGGGCCCTAGACACCATGGCCTCCACCATGCTAGAAATTCCAATCGGTCTCCTATATGAACTACTAG
+GGAAAAATTTCTCGAACAAGTTGCAGCACTTTTGGTACATCTGTTCATCCTCAAGAATTCCCCTTTGGCT
+TGTGTTGAGAATAGAGCGGTTCCTCTTGGGAATCCAGGAGTGTGTAGTTGCAACGGCATCATATTCCATA
+CTTTTGGCTGGACCATGAGCTGGCATCACTACAGCATTGTTTACAGACTCAATTTCTTTATGGCTGACAA
+AGGGATTCAGGGGGTTACAAAGTCTTCCCCGATAATTCTCATCCATTAGCTCCCACTTTAAGCAGACTTC
+AGGGATGTGAAGGTTCCGGATATTGTATAAGTTTGGTCCCCCATCTGATACCAATAGTCCTGCCCTTGAT
+TGGGTTTGATCCCACAGCTTCTTTAGCTCGAATGATCTTCTCGTCTGAATTTGTGTGTCTCCTCTATGGC
+ACCTATATGTATATCTGTAGTCTTTGATGAACAATTGGAGAGCCATCTGGGCTGTTGCTGGTCCAAGGTC
+ATTGTTTATCATGTTGTTCTTTATCACTGTTACTCCAATGCTCATATCAGCTGACTCGTTTATTCCAGAC
+ACTCCAAAACTGGGAAGCTCCATGCTAAAATTGGCCACAAATCCATAACTGGCCGTCGTTTTAAAA
+>gnl|ti|1086975913 name:1099575910932 mate_pair:1086975903
+TAACTTTGGGAATCTGAATAAGCTTGCCACACTGCCCCGTTCGGTTCGAGTCCATCCTGTAGGCTCACAA
+AAGAGGGTAGGAGAAGTCGGCGGAATATTTTGGTCGGAAAAAAAACAGAGAATTGCTGAGATTTCAAAAA
+TTTCTTCAATTGTTTCTTCGCCTCTTTCGGACTGACGAATGTAAACAAGGGAGCCTCTGTTGGCCATTTC
+TTGTCTTATGGTAAATAGCCTGGTTTTAATCCTAGCTCTGCTTTCCTCGTCGAGAGTGTAGTCTGCCTTT
+GTGGCCATTTCCTCCCCAGTGAATGAGAAAATGTGAATGTGTGTGTTCTCAGATTTAATTTTATTGGCCT
+TTTCAAGGTAATATATGTGGACTTCTCTTCTTGTCACTCCAATTTCGATGAATCTGTTCTCCTTGTAATC
+ATACAAATCTGGTAGAAACTTCGGTTTTTCAGCTCCAGTAGTGTTGCAGATACTGTTTACTACTGTCCAG
+GCCATTGTTCTGTCTCTCCCCTCGATTATTTCAAATCTGTGCTTTAACAGTGCATTTGGATCATCAAGTT
+CTACCATTATTGATTCGCCTTGTTCATTGATGAAATGAAAATCTGAATACATGAAACATACCTCCAAGTG
+GGTGCATATTGCTGCAAATTTGTTTGTTTCAATTTTCAGATCCTCTCCATACTCTTTCATTGCTTTTTCT
+GCAAGTTCGACAATCATCGGGTTGAAGCATTGTCGCACAAAATCTTCCATTTCAAATCAGTACCTGCTAC
+TGGCCGTCGTTTTACAAA
+>gnl|ti|1086975863 name:1099575910933 mate_pair:1086975846
+AAAACGAGACTTGGCTTATCTGGGGATAGTTGAAATCGTCCATTGCTGCACAGGATGCATTGAGCAGGGC
+AGTATTAATGTATACCCCCTTCATTATGTACTCAGTGGCTCTACAATGGGACACCTCTGCTGTGAAATAA
+TTCCTCCTCATGCTTGCAATGTACTCAATTGGGGCTACGTCCTCTCCAATTTCATCGAGCTCTATCCAGA
+TTGAATCAGTTAGCTCGCAGGCCTTGTTGAACTCATTCTGTATCCAGCTTGAAAGTGACCTTAATTCAGG
+TTCGTCACTATCATATTGCTTCAAATCGCTTATGTCTCTGCAGTTGTCAAAGTCTACTTTCTCTGGTGCC
+ATGTTTTCACCAAGAGCCCACTTTAGTTGACTCGTTTTCTTCATGTTTTTAGTCCTTGGGATCTTCTCCT
+CATTTTCAATGTCCTGCAATTCTGACAAAAATTGCTTCCATGACAGCAGTTAATTTGAACTTATTCCCCT
+TTTCGTGTGGTTTGACTATATAGGGCTCGTTC
+>gnl|ti|1086975825 name:1099575910934 mate_pair:1086975854
+CAACGAGTACCTTTTTTTTGGACGTACGGGATACAAATAGTAGCACTGCCATAACTATTTTAATGCATGT
+GTCAGGAAGGAGATGAACCAAAATGCATTGAGCAAAACCCAGGGATCATTAATCAGGCACCCCTCAATTG
+CTTCGTATAGCCCCCCGAGATCAAAGGTCCCAGGTTCGAGATTGTCCCTAAGAGCCTGAACAACAAGAAG
+CAGTTTTCTTGACTCCGCTGAAAATCCTTCCAATTGTGGTGATGCATACAGGCTATTGAACACTGACTTA
+GCCAAAAGAGTCCTACTTACTTTCCCAATGGAACTGTCTTCCATTCCCTTGGGGGACTCCCCAATGGGCC
+ATGCTTCTGATTTATTCTCAAAAAACTCTTTGGTCAGGTCTTTCTCTTTATTCGAGGACTCGGCTTCAAT
+CATGCTCGCGATCTGCTGGAGTGACTGAAAGAGGCAACCTCGCACTCCTTTTTCCATTTCATTTCGACCT
+TTGAGGTTCCGTTTGCCACAAATACCAG
+>gnl|ti|1086975888 name:1099575910937 mate_pair:1086975883
+GGGGGAGTGTTAGATTCCCTGTGCTGTTATCAAAAGTATGTCTCCCGGTTTTACTATTGTCCAATAGATG
+CTTATTCTGCTGGGGATATCCCTTACCCTGGGTCTAGATCCGATATTCGGGATTACAGTTTGTTGGCTTC
+TTTTGGTAGAGACTGTGATTCTTCCTGATGCTTGAGCATATAGGCTGATTTGGTCATTGTTCGTACCCGG
+GTGGTGAACCCCCCAAATGTACAATTTGTCAAATTTTTCATTGTTTGGCATAGTCACGTTCAATGCTGGG
+TATTTGAATTTTAAATGGGTCAACCAATTCAATCTACTAAAGAAACTGTTATTAGATCTCCTTTTGCAAG
+CAGAGCTTGTTCCATTTTGAGTGACTCCAGTCCAATTGAAGCTTTCATTGTTAAACTCCAGTGTGCCGGA
+TGAGGCAACTAGTGACCTAAGGGAGGCATAATCCGGCACATCATAAGGGTAACAGTTGCTGTAGGCTTTG
+CTGCGTTCAACAAAAAGGTCCCATTTCTTATTTTGGAAGCCATCACACTGAGGGTCTCCCAATAGAGCAT
+CTATTAGTGTGCAGTTTTCTCCATCAAGGATCTGATGAGGACTGTCGCATATTCCACCTGTTGAGGAACT
+CTGAACCAGCTCAGTAGCATTAGTAACTTCAATTTGGTCATTCGTGATTGTTTTCACTATCGTTCCGTTT
+GGTACTGCATGGTGCCCAAGGCACAGCGTTGCCGTGCTGTTGTCATTTCCGGGAAGTTTTTGAGCGAAAA
+CCAGACATAGAATGTAGCTCAAAGCAATGATAGTCTTCATGGTTAATAAAATTATCCCCTGCTTTCGACT
+GGCCGTCGTTTTACAA
+>gnl|ti|1086975841 name:1099575910939 mate_pairs:1086975823,1086975864
+CAATATGAAGTTACTTGTAAATGCTATGCAACTTGCTTAGTCCCCAGATGAAATGGAACACCTAACTCAT
+TCATCAATAGGGACCGATAAGGGGTCCTATCATGTACTGTGTCATTTGAATGCACGTTGTTTAGTGTTGT
+TCCCTGTCCAAGGGCAAATTGATAACATTTGTCAGGATCGCATGACACATAAGGTTCTCTTGTCACCCAG
+ATGTCCCCACCAGCGGAAAGCCTAATCGAATTGTCCTTAGAAAAAGGTGCAAATCCTGTAATGTCACATT
+GCGGCTTTGACCAATTTCTGTATTCTGCTAGTTTGGGGCATATTTCCTTCTCTATGGTGGTGTTGGTCAG
+ATACACTATCTCTGTTATGTTTCTTTCTATTATTGTTGGTTCACACAGCATCACTTGGTTGTTTGGGGGG
+GAGTTGAATTCATATTGCTTGAAATGCAATGTTACAGTAGTTATCAAGATGGCAATTTGCATAAAGAAGC
+ATATTGTGGAAATGGTGAGAGAAACAGAGCCAATCGTTATTATCTTTTGATTTGGATTCATCTTTACTCC
+TGCTTTTGCACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975883 name:1099575910942 mate_pair:1086975888
+TGGCAGCATTTTTATTACCATGAGACTATCATTGCTTTGAGCTACATTCTATGTCTGGTTTTCGCTCAAA
+AAATTCCCGGAAATGACAACAGCACGGCAACGCTGTGCCTTGGGAACATGCAGTACCAAACGGAACGATA
+GTGAAAACAATCACGAATGACCAAATTGAAGTTACTAATGCTACTGAGATGGTTCAGAGTTCCTCAACAG
+GTGGAATATGCGACAGTCCTCATCAGATCCTTGATGGAGAAAACTGCACACTAATAGATGCTCTATTGGG
+AGACCCTCAGTGTGATGGCTTCCAAAATAAGAAATGGGACCTTTTTGTTGAACGCAGCAAAGCCTACAGC
+AACTGTTACCCTTATGATGTGCCGGATTATGCCTCCCTTAGGTCACTAGTTGCCTCATCCGGCACACTGG
+AGTTTAACAATGAAAGCTTCAATTGGACTGGAGTCACTCAAAATGGAACAAGCTCTGCTTGCAAAAGGAG
+ATCTAATAACAGTTTCTTTAGTAGATTGAATTGGTTGACCCATTTAAAATTCAAATACCCAGCATTGAAC
+GTGACTATGCCAAACAATGAAAAATTTGACAAATTGTACATTTGGGGGGTTCACCACCCGGGTACGAACA
+ATGACCAAATCAGCCTATATGCTCAAGCATCAGGAAGAATCACAGTCTCTACCAAAAGAAGCCAACAAAC
+TGTAATCCCGAATATCGGATCTAGACCCAGGGTAAGGGATATCCCCAGCAGAATAAGCATCTATTGGACA
+ATAGTAAAACCGGGAGACATACTTTTGATTAACAGCACAGGGAATCTAATCGCTCCTCGGGGTTAGGTCA
+ACTGTGTGTTTCCTGGA
+>gnl|ti|1086975864 name:1099575910946 mate_pairs:1086975807,1086975841
+CCCCAGAAATTAAATGATCCAAATCAAAAGATAATAACGATTGGCTCTGTTTCTCTCACCATTTCCACAA
+TATGCTTCTTTATGCAAATTGCCATCTTGATAACTACTGTAACATTGCATTTCAAGCAATATGAATTCAA
+CTCCCCCCCAAACAACCAAGTGATGCTGTGTGAACCAACAATAATAGAAAGAAACATAACAGAGATAGTG
+TATCTGACCAACACCACCATAGAGAAGGAAATATGCCCCAAACTAGCAGAATACAGAAATTGGTCAAAGC
+CGCAATGTGACATTACAGGATTTGCACCTTTTTCTAAGGACAATTCGATTAGGCTTTCCGCTGGTGGGGA
+CATCTGGGTGACAAGAGAACCTTATGTGTCATGCGATCCTGACAAATGTTATCAATTTGCCCTTGGACAG
+GGAACAACACTAAACAACGTGCATTCAAATGACACAGTACATGATAGGACCCCTTATCGGACCCTATTGA
+TGAATGAGTTAGGTGTTCCATTTCATCTGGGGACTAAGCAAGTGTGCATAGCATGGTCCAGCTCAAGTTG
+TCACGAGGTCATAGCTGTTTACTGACT
+>gnl|ti|1086975889 name:1099575910952 mate_pair:1086975769
+ATCCAACGTGGATCTTAATAACCAAGTGGGAAGCCTCATAATGAGATCCGATGCACCCATTGGCAAATGC
+AATTTTGAAAGCATCACTCCAAATGGAACCATTCCCAATGACAAACCATTTCAAAATGTAAACACGATCT
+CATAAGGGGCCTGTCCCATATATGTTAAACAAAACACTCCGAAATTGGCAACATGGATGCGAAATGTACC
+TTAGAAAAAAACTAGAGGCATATTTGGCGCAATCGCGGGTTTCATAGAAAATGGTTGGCAGGGAATGGTG
+GATGGTAGTCACTGCTTCAGGCATCAAAATTCTGAGGGAAAATCAATTCAGCTGATCTCATAAGCACTCA
+GGCTGCCTAAACCCAAATCAATGGGAAGCTGAAAACGTTGATCGGAAAAACCACCGAAAAATTCCCTCTA
+ATTGAAAAATAATTTTCAAAAGAATAATGGAAAATTCAGACCTCCACAATTATGTTGAGGACACTATAAT
+AAATCTCTTTTCATACAATGCGGATCTTCTTGATACCCTGGAGAACCACCATCCAATTCATCTAACTGAC
+TCAAAAATGAACAAACTGTTACATAGAACAAATAAGCAACTGAGGGAAAATGCTGAGGATTTGGGCAATG
+GTAGTTTCCAAATATACCACAAATGTGACAATGCCTGCATAGGGTCAATCAGAAATGGAACTTATGACCA
+TGATGTATACAGAGATGAAGCATTAAACAACCGGTTCCAGATCAAAGGTGTTGAGCTGAAGTCAGGATAC
+AAAGATTGGATCCTATGGATTTCCTTTGCCATATCATGTTTTTTGCTTTGTGTTGCTTTGTTGGGGTTCA
+TCATGTGGGCCTGCCAGAGAGGCAACATGGGTCATAGCTTGTATAATGCCCTC
+>gnl|ti|1086975824 name:1099575910955
+AACCAAGTTTTAATCCTCACTGAGTGACATCAAAATCATGGCGTCCCAAGGCACCAAACGGTCTTATGAA
+CAGATGGAAACTGATGGGGATCGCCAGAATGCAACTGAGATTAGGGCATCCGTCGGGAAGATGATTGATG
+GAATTGGGAGATTCTACATCCAAATGTGCACTGAACTTAAACTCAGTGATCATGAAGGGCGATTGATCCA
+GAACAGCTTGACAATAGAGAAAATGGTGCTCTCTGCTTTTGATGAAAGAAGGAATAAATACCTGGAAGAA
+CACCCCAGCGCGGGGAAAGATCCCAAGAAAACTGGGGGACCCATATACAGGAGAGTAGATGGAAAATGGA
+TGAGGGAACTCGTCCTTTATGACAAAGAAGAAATAAGGCGAATCTGGCGCCAAGCCAACAATGGTGAGGA
+TGCGACAGCTGGTCTAACTCACATAATGATCTGGCATTCCAATTTGAATGATGCAACATACCAGAGGACA
+AGAGCTCTTGTTCGAACTGGAATGGATCCCAGAATGTGCTCTCTGATGCAGGGCTCGACTCTCCCTAGAA
+GGTCCGGAGCTGCAGGTGCTGCAGTCAAAGGAATCGGGACAATGGTGATGGAACTGATCAGAATGGTCAA
+ACGGGGGATCAACGATCGAAATTTCTGGAGAGGTGAGAATGGGCGGAAAACAAGAAGTGCTTATGAGAGA
+ATGTGCAACATTCTTAAAGGAAAATTTCAAACAGCTGCACAAAGAGCAATGGTGGATCAAGTGAGAGAAA
+GTCGGAACCCAGGAAAGGTGAAAATCAAAAACCGGTAATACCGGTTTCCAGGG
+>gnl|ti|1086975773 name:1099575910958
+GGGGTCCCGCTGCCAAAGAGCAATGGTGGATCAAGTGAGAGAAAGTCGGAACCCAGGAAATGCTGAGATC
+GAAGATCTCATATTTTTGGCAAGATCTGCATTGATATTGAGAGGGTCAGTTGCTCACAAATCTTGCCTAC
+CTGCCTGTGCGTATGGACCTGCAGTATCCAGTGGGTACGACTTCGAAAAAGAGGGATATTCCTTGGTGGG
+AATAGACCCTTTCAAACTACTTCAAAATAGCCAAATATACAGCCTAATCAGACCTAACGAGAATCCAGCA
+CACAAGAGTCAGCTGGTGTGGATGGCATGCCATTCTGCTGCATTTGAAGATTTAAGATTGTTAAGCTTCA
+TCAGAGGGACAAAAGTATCTCCTCGGGGGAAACTGTCAACTAGAGGGGTACAAATTGCTTCAAATGAGAA
+CATGGATAATATGGGATCGAGCACTCTTGAACTGAGAAGCGGGTACTGGGCCATAAGGACCAGGAGTGGA
+GGAAACACTAATCAACAGAGGGCCTCCGCAGGCCAAACCAGTGTGCAACCTACGTTTTCTGTACAAAGAA
+ACCTCCCATTTGAAAAGTCAACCATCATGGCAGCATTCACTGGAAATACGGAGGGAAGAACTTCAGACAT
+GAGGGCAGAAATCATAAGAATGATGGAAGGTGCAAAACCAGAAGAAGTGTCATTCCGGGGGAGGGGAGTT
+TTCGAGCTCTCAGACGAGAAGGCAGCGAACCCGATCGTGCCCTCTTTTGATATGAGTAATGAAGGATCTT
+ATTTCTTCGGAGACAATGCAGAAGAGTACGACAATTAAGGAAAAAGGTCATTTGAACGACTAAGAATCGG
+AATTGCGGAGCTTGCCCTTGATCTCTTGTATTGTCATTTCTCTTCTTCCT
+>gnl|ti|1086975869 name:1099575910963 mate_pair:1086975872
+GGGGGCTTGGGCTTTGCTGGTCACGTCATTGTTTATCATGTTGTTCTTTATCACTGTTACTCCAATGCTC
+ATATCATCTGACTCGTTTATTCCAGACACTCCAAAACTGGGAAGCTCCATGCTAAAATTAGCCACAAATC
+CATATCGATAAAAAAAGCTTGTGAATTCAAATGTCCCTGTTTTATTTATATAGGACTTCTTTTTGCTCAT
+GTTGATTCCCACTAACTTGCAGGTCCTGTAGAATCTATCCACTCCTGCTTGTATTCCCTCATGATTTGGT
+GCATTCACTATGAGGGCAAAATCGTCGGAGGATTGGAGCCCATCCCACCAGTATGTTGTCTTGGTGTATT
+TCTTTTGCCCAAGATTCAGTATTGAGACTCCTAAAACCGTACTTAGCATGTTGAACATGCCCATCATCAT
+CCCAGGGCTCAATGATGCTGTGCCATCTATTAGAAGAGGCCTTATTTTCTCAATTTTCTTCCTTGTTGAT
+TCATTGAAATACTTCAGGTCAATGCTTGCTAGCATTTCTGCGGGTATTTGTGTTCGGAGCTTCATTCTCT
+TACTCTCGAACATGTATCCTTTTCCTAGTCTTGCCATTTTGTTTGAGAACATTATTGGTGCCATGCTACT
+GGCCGTCTTTAAACAACCC
+>gnl|ti|1086975804 name:1099575910965 mate_pair:1086975832
+AAGATTGGGGCTGGACCATGAGCTGGCATCACTACAGCATTGTTTACAGACTCAATTTCTTTATGGCTGA
+CAAAGGGATTCAGGGGGTTACAAAGTCTTCCCCGATAATTCTCATCCATTAGCTCCCACTTTAAGCAGAC
+TTCAGGGATGTGAAGGTTCCGGATATTGTATAAGTTTGGTCCCCCATCTGATACCAATAGTCCTGCCCTT
+GATTGGGTTTGATCCCACAGCTTCTTTAGCTCGAATGATCTTCTCGTCTGAATTTGTGTGTCTCCTCTAT
+GGCACCTATATGTATATCTGTAGTCTTTGATGAACAATTGGAGAGCCATCTGGGCTGTTGCTGGTCCAAG
+GTCATTGTTTATCATGTTGTTCTTTATCACTGTTACTCCAATGCTCATATCAGCTGACTCGTTTATTCCA
+GACACTCCAAAACTGGGAAGCTCCATGCTAAAATTAGCCACAAATCCATATCGATAAAAAAAGCTTGTGA
+ATTCAAATGTCCCTGTTTTATTTATATAGGACTTCTTTTTGCTCATGTTGATTCCCACTAACTTGCAGGT
+CCTGTAGAATCTATCCACTCCTGCTTGTATTCCCTCATGACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975847 name:1099575910969 mate_pair:1086975806
+CGGTCTTCTCTGGGATCATGAGTGTGTAGTTGCAACGGCATCATATTCCATACTTTTGGCTGGACCATGA
+GAGGGCATCACTACAGCATTGTTTACAGACTCAATTTCTTTATGGCTGACAAAGGGATTCAGGGGGTTAC
+AAAGTCTTCCCCGATAATTCTCATCCATTAGCTCCCACTTTAAGCAGACTTCAGGGATGTGAAGGTTCCG
+GATATTGTATAAGTTTGGTCCCCCATCTGATACCAATAGTCCTGCCCTTGATTGGGTTTGATCCCACAGC
+TTCTTTAGCTCGAATGATCTTCTCGTCTGAATTTGTGTGTCTCCTCTATGGCACCTATATGTATATCTGT
+AGTCTTTGATGAACAATTGGAGAGCCATCTGGGCTGTTGCTGGTCCAAGGTCATTGTTTATCATGTTGTT
+CTTTATCACTGTTACTCCAATGCTCATATCAGCTGACTCGTTTATTCCAGACACTCCAAAACTGGGAAGC
+TCCATGCTAAAATTAGCCACAAATCCATATCGATAAAAAAAGCTTGTGAACTCAAATGTCCCTGTACTGG
+CCGTCGTTTTACAA
+>gnl|ti|1086975784 name:1099575911011 mate_pair:1086975856
+GGGTACTTGGCTAATTCTTATTTTTGCCGTCTGAGTTCTTCAATGGTGGAACAGATCTTCATGATCTCAG
+AGAACTCTTCCTTCTTAATCCGTCCAGACTCGAAGTCAATTCTGGCATCAATCCGGGCCCTAGACACCAT
+GGCCTCCACCATGCTAGAAATTCCAATCGGTCTCCTATATGAACTACTAGGGAAAAATTTCTCGAACAAG
+TTGCAGCACTTTTGGTACATCTGTTCATCCTCAAGAATTCCCCTTTGGCTTGTGTTGAGAATAGAGCGGT
+TCCTCTTGGGAATCCAGGAGTGTGTAGTTGCAACGGCATCATATTCCATACTTTTGGCTGGACCATGAGC
+TGGCATCACTACAGCATTGTTTACAGACTCAATTTCTTTATGGCTGACAAAGGGATTCAGGGGGTTACAA
+AGTCTTCCCCGATAATCCTCATCCATTAGCTCCCACTACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975792 name:1099575911030 mate_pair:1086975857
+ACGACTTTTTTCTGACGACAGCTAAATTCATTATTTTTGCCGTCTGAGTTCTTCAATGGTGGAACAGATC
+TTCATGATCTCAGAGAACTCTTCCTTCTTAATCCGTCCAGACTCGAAGTCAATTCTGGCATCAATCCGGG
+CCCTAGACACCATGGCCTCCACCATGCTAGAAATTCCAATCGGTCTCCTATATGAACTACTAGGGAAAAA
+TTTCTCGAACAAGTTGCAGCACTTTTGGTACATCTGTTCATCCTCAAGAATTCCCCTTTGGCTTGTGTTG
+AGAATAGAGCGGTTCCTCTTGGGAATCCAGGAGTGTGTAGTTGCAACGGCATCATATTCCATACTTTTGG
+CTGGACCATGAGCTGGCATCACTACAGCATTGTTTACAGACTCAATTTCTTTATGGCTGACAAAGGGATT
+CAGGGGGTTACAAAGTCTTCCCCGATAATCCTCATCCATTAGCTCCCATTACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975851 name:1099575911034 mate_pair:1086975905
+CGGCGAGTAGTCTGCATTCGCTACTGTTTGTCGCCCTTACGAATGAGAAAATGTGAATGTGTGTGTTCTC
+AGATTTAATTTTATTGGCCTTTTCAAGGTAATATATGTGGACTTCTCTTCTTGTCACTCCAATTTCGATG
+AATCTGTTCTCCTTGTAATCATACAAATCTGGTAGAAACTTCGGTTTTTCAGCTCCAGTAGTGTTGCAGA
+TACTGTTTACTACTGTCCAGGCCATTGTTCTGTCTCTCCCCTCGATTATTTCAAATCTGTGCTTTAACAG
+TGCATTTGGATCATCAAGTTCTACCATTATTGATTCGCCTTGTTCATTGATGAAATGAAAATCTGAATAC
+ATGAAACATACCTCCAAGTGGGTGCATATTGCTGCAAATTTGTTTGTTTCAATTTTCAGATCCTCTCCAT
+ACTCTTTCATTGCTTTTTCTGCAAGTTCGACAATCATCGGGTTGAAGCATTGTCGCACAAAATCTTCCAT
+TTCGAATCAGTACCTGCTTTCGCTACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975800 name:1099575911036 mate_pair:1086975860
+GAGCAAAGGAAATCTGCCTTTGTGGCCATTTCCTCCCCAGTGAATGAGAAAATGTGAATGTGTGTGTTCT
+CAGATTTAATTTTATTGGCCTTTTCAAGGTAATATATGTGGACTTCTCTTCTTGTCACTCCAATTTCGAT
+GAATCTGTTCTCCTTGTAATCATACAAATCTGGTAGAAACTTCGGTTTTTCAGCTCCAGTAGTGTTGCAG
+ATACTGTTTACTACTGTCCAGGCCATTGTTCTGTCTCTCCCCTCGATTATTTCAAATCTGTGCTTTAACA
+GTGCATTTGGATCATCAAGTTCTACCATTATTGATTCGCCTTGTTCATTGATGAAATGAAAATCTGAATA
+CATGAAACATACCTCCAAGTGGGTGCATATTGCTGCAAATTTGTTTGTTTCAATTTTCAGATCCTCTCCA
+TACTCTTTCATTGCTTTTTCTGCAAGTTCGACAATCATCGGGTTGAAGCATTGTCGCACAAAATCTTCCA
+TTTCGAATCAGTACCTGCTTTTGCACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975787 name:1099575911038 mate_pair:1086975884
+GACAAGGCGGCCTGGTTTTAATCCTAGCTCTGCTTTCCTCGTCGAGAGTGTAGTCTGCCTTTGTGGCCAT
+TTCCTCCCCAGTGAATGAGAAAATGTGAATGTGTGTGTTCTCAGATTTAATTTTATTGGCCTTTTCAAGG
+TAATATATGTGGACTTCTCTTCTTGTCACTCCAATTTCGATGAATCTGTTCTCCTTGTAATCATACAAAT
+CTGGTAGAAACTTCGGTTTTTCAGCTCCAGTAGTGTTGCAGATACTGTTTACTACTGTCCAGGCCATTGT
+TCTGTCTCTCCCCTCGATTATTTCAAATCTGTGCTTTAACAGTGCATTTGGATCATCAAGTTCTACCATT
+ATTGATTCGCCTTGTTCATTGATGAAATGAAAATCTGAATACATGAAACATACCTCCAAGTGGGTGCATA
+TTGCTGCAAATTTGTTTGTTTCAATTTTCAGATCCTCTCCATACTCTTTCATTGCTTTTTCTGCAAGTTC
+GACAATCATCGGGTTGAAGCATTGTCGCACAAAATCTTCCATCTCGAATCAGTACCTGCTACTGGCCGTC
+GTTTTACAA
+>gnl|ti|1086975820 name:1099575911042 mate_pair:1086975771
+GGGCCGGCATTGAATCGCATCATATAATGGAATCCCTTCTCCTTCGTGACTTGGGTCTTCAATGCTCAAT
+TTCAAAGCATCCATCAGGAGGAATTTGGACCGCTGATAACAAGGAGGTCCATTAGGAAGTTTGATTGGTC
+TTGGTGTTGTCTTCAGAAAAGGTTCAATTTTGGCATTCACTTCTTTGGACATTTGAGAAAGCTTGCCCTC
+AATGCAGCCGTTCGGTTCGAATCCATCCACATAGGCTCTAAAATTCTCAAGGCAGGAGAAGTTCGGTGGG
+AGACTTTGGTCGGCAAGCCTACGCATAGTTCCTGAGATTTCAAATTTTTCTTCAATTGTTTCTTCGCCTC
+TTTCGGACTGACGAAAGGAATCCCAGAGGCCTCTGTTGGCCATTTCTTGTCTTATGGTAAATAGCCTGGT
+TTTAATCCTAGCTCTGCTTTCCTCGTCGAGAGTGTAGTCTGCCTTTGTGGCCATTTCCTCCCCAGTGAAT
+GAAAAAATGTGAATGACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975840 name:1099575911044 mate_pair:1086975785
+GTGCTCTGCTGTGAAATAATTCCTCCTCATGCTTGCAATGTACTCAATTGGGGCTACGTCCTCTCCAATT
+TCATCGAGCTCTATCCAGATTGAATCAGTTAGCTCGCAGGCCTTGTTGAACTCATTCTGTATCCAGCTTG
+AAAGTGACCTTAATTCAGGTTCGTCACTATCATATTGCTTCAAATCGCTTATGTCTCTGCAGTTGTCAAA
+GTCTACTTTCTCTGGTGCCATGTTTTCACCAAGAGCCCACTTTAGTTGACTCGTTTTCTTCATGTTTTTA
+GTCCTTGGGATCTTCTCCTCATTTTCAATGTCCTGCAATTCTGACAATACTTGCTTCCATGACAGCAGGT
+AATTTGAATTTATTCCCTTTTCGTGTGGTTTGACTATATAAGGTTCTTTCCATCCAAAGAATGTTTTCAT
+GCACTTGATCGCATCATATAATGGAATCCCTTCTCCTTCGTGACTTGGGTCTTCAATGCTCAATTTCAAA
+GCATCCATCAGGAGGAATTTGGACCGCTGATAACAAGGAGGTCCATTAGGAAGTTTGATTGGTCTTGGTG
+TTGTCTTCAGAAAAGGTTCAATTTTGGCATTCACTTCTTTGGACATTTGAGAAAGCTTGCCCTCAATGCA
+GCCGTTCGGTTCGAATCCATCTACACTGGCGC
+>gnl|ti|1086975803 name:1099575911046 mate_pair:1086975858
+GGGACTGATTACACATCTGTGTCTTCCTTAAATGGGATCTTCCCTTTATGATGAACCCATATAAATTGGT
+TTTTCGCCTTCCCTCTTTAGTTCTGCACTTGCTTATCATGGGGATTAGTTGAAAATCGTCCATTGCTGCA
+CAGGATGCATTGAGCAGGGCAGTATTAATGTATACCCCCTTCATTATGTACTCAGTGGCTCTACAATGGG
+ACACCTCTGCTGTGAAATAATTCCTCCTCATGCTTGCAATGTACTCAATTGGGGCTACGTCCTCTCCAAT
+TTCATCGAGCTCTATCCAGATTGAATCAGTTAGCTCGCAGGCCTTGTTGAACTCATTCTGTATCCAGCTT
+GAAAGTGACCTTAATTCAGGTTCGTCACTATCATATTGCTTCAAATCGCTTATGTCTCTGCAGTTGTCAA
+AGTCTACTTTCTCTGGTGCCATGTTTTCACCAAGAGCCCACTTTAGTTGACTCGTTTTCTTCATGTTTTT
+AGTCCTTGGGATCTTCTCCTCATTTTCAATGTCCTGCAATTCTGACAATACTTGCTTCCATGACAGCAGG
+TAATTTGAATTTATTCCCTTTTCGTGTGGTTTGACTATATAAGGTTCTTTCCATCCAAAGAATGTTTTCA
+TGCACTTGATCGCATCATATAACGGACTGGCCGTCGTTTTACAA
+>gnl|ti|1086975769 name:1099575911052 mate_pair:1086975889
+GGGGGACTTTGGCAGACACTTGTATGAACCCCAACATAGCAACACAAAGCAAAAAACATGATATGGCAAA
+GGAAATCCACAGGAACCAATCTTTGTATCCTGACTTCAGCTCAACACCTTGGAACTGGAACCGGTTGTTT
+AATGCTTCATCTCTGTATACATCATGGTCATAAGTTCCATTTCTGATTGACCCTATGCAGGCATTGTCAC
+ATTTGTGGTATATTTTGAAACAACCATTGCCCATATCCTCAGCATTTTCCCTCAGTTGCTTCTTTGTTCT
+TTCAAACAGTTTGTTCATTTCTGAGTCAGTTAGATCAATTGTATGTTGGTTCTCCAGGGCAACAAGAAGC
+TCCGCGTTGTATGACCAGAGATCTATTTTAGTGTCCTCAACATATTTCTCGAGGTCCTGAATTCTCCCTT
+CTACTTCTGAGAATTCTTTTTCAATCTGATGGAATTTCTCGTTGGTTTTCCCGATCAACCTATTCAGCTT
+CCCATTGATTTGGTTGATTGCTGCTTGAGTGCTTTTGAGATCTGCTGCTTGTCCTATTCCCTCAGAATTT
+TGATGCCTGAAACCGTACCAACCATCCACCATTCCCTCCCAACCATTTTCTATGAAACCCGCGATTGCGC
+CAAATATGCCTCTAGTTTGTTTCTCTGGTACATTTCGCATCCCTGTTGCCAATTTCAGAGTGTTTTGCTT
+AACATATCTGGGACAGGCCCCATATGTGATCCTGTTTACATTTTGAAATGGTTTGTCATTGGGAATGCTT
+CCATTTGGAGTGATGCATTCAGAATTGCATTTGCCAATGGGGTGCATCTGATCTCATTATTGAGCTTTTC
+CCACTTCGTATTTTAAAATAACCCCGAGGAGCACTGGCCGTCTTTTTACAA
+>gnl|ti|1086975833 name:1099575911058
+TCTCAAATGGCGAAGCTTATATAGGCATGAGATGATGTCCGCCCCATCAGGCCATGAGCCTGTTCCATAT
+GTACCAGAGGTGCCACAAAACACAACAATACTGTTTGAGGTCCACAAGACTTCAGTTTCCTCTTTTCTTC
+CCCTTATCAACTCCACATAAAAGCACCGATTGATGCAGCTTTTGCCTTCAACAGAGAAAATACCAGAATA
+ACCGGACCTATTACCTCTGTCAACTATGACTTGCCTATTTATCTGCAATTTGGAATTAGGGTTGGACCAG
+CCCTCAATGACTTTGAAGGTTTCATATCCTGAGCGTAACTTCTCGCTGATCGTTCTTCCCATCCACACGT
+CATTTCCATCATCAAAGGCCCAGCCTTTCACTCCATGACCACCTTCTTCATTGTTAGGATCCAAGCAATG
+GCTACTGCTGGAGCTGTCGTTTTTTCTGGGTGTGTCTCCAACAAGTCCTGAGCACACATAACTGGAAACA
+ATGCTATAATCCTTTATGTTTATATCTACGATGGGCCTATTGGAGCCTTTCCAGTTGTCTCTGCAGACAC
+ATCTGACACCAGGATATCGAGGATAGCAGGAGCACTCCTCGACATGCTGGGCACTTCCTGACAATGTGCT
+AGTATGAACGATTTTCCCCTCCTCAATGAATAATATTTTAGTATCAGCTTTTCCTGAAGCACTCCCATCA
+GTCATTACTACTGTACAAGTTCCATTGATACAAACGCATTCTGACTCCTGGGTTCTGAGGATTTCTTTGG
+ACCATGAAAACAATACTATTCTACAAAGCCTC
+>gnl|ti|1086975899 name:1099575911061 mate_pair:1086975799
+CACATGGGATCCATGGGCCATGCTTCTGATTTATTCTCAAAAAACTCTTTGGTCATGTCTTTCTCTTTAA
+TCGAGGACTCGGCTTCAATCATGCTCTCGATCTGCTGGAGTGACTGAAGGAGGCAACGTCTCATCTCCAT
+TCCCCATTTCATTTTGACCTTTGATGTTCCGTTTGTCCTCACATACAAGAACATAGGCCTTGAAATTTGG
+CCTATGGCACTTCTTAGTAACATATCTCCTATCTCAAGGACACAGTATTTCTCCCATTTATGTGGCTCTA
+GTCTCGGGTCAGTGAGAGAAAATTCCATGCTCACAAAGTTTACCACATCTGTGTCATTCCTTAAATGGGA
+TCTTCCCTTTATGATGAACCCATATAAATTGGTTTTTCGCCTTCCCTCTTTAGTTCTGCACTTGCTTATC
+ATGGGGATTAGTTGAAAATCGTCCATTGCTGCACAGGATGCATTGAGCAGGGCAGTATTAATGTATACCC
+CCTTCATTATGTACTCAGTGGCTCTACAATGGGACACCTCTGCTGTGAAATAATTCCTCCTCATGCTTGC
+AATGTACTCAATTGGGGCTACGTCCTCTCCAATTTCATCGAGCTCTATCCAGATTGAATCAGTTAGCTCG
+CAGGCCTTGTTGAACTCATTCTGTATCCAGCTTGAAAGTGACCTTAATTCAGGTTCGTCACTATCATATT
+GCTTCAAATCGCTTATGTCTCTGCAGTTGTCAAAGTCTACTTTCTCTGGTGCCATGTTCTCACCAAGTAC
+CCACTTACTGGCCG
+>gnl|ti|1086975862 name:1099575911063 mate_pair:1086975885
+GCGCAGGCCATTTGAAACTGACTTAGCCATAGAGTCCTACAGACTTTCCCAATGGAACCTTCTTCCACTC
+CCTTGGGGGACTCCCCAATGGGCCATGCTTCTGATTTATTCTCAAAAAACTCTTTGGTCATGTCTTTCTC
+TTTAATCGAGGACTCGGCTTCAATCATGCTCTCGATCTGCTGGAGTGACTGAAGGAGGCAACGTCTCATC
+TCCATTCCCCATTTCATTTTGACCTTTGATGTTCCGTTTGTCCTCACATACAAGAACATAGGCCTTGAAA
+TTTGGCCTATGGCACTTCTTAGTAACATATCTCCTATCTCAAGGACACAGTATTTCTCCCATTTATGTGG
+CTCTAGTCTCGGGTCAGTGAGAGAAAATTCCATGCTCACAAAGTTTACCACATCTGTGTCATTCCTTAAA
+TGGGATCTTCCCTTTATGATGAACCCATATAAATTGGTTTTTCGCCTTCCCTCTTTAGTTCTGCACTTGC
+TTATCATGGGGATTAGTTGAAAATCGTCCATTGCTGCACAGGATGCATTGAGCAGGGCAGTATTAATGTA
+TACCCCCTTCATTATGTATTCAGTGGCCACTGGCCGTCGTTTTACAA
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/CTG.0.fix b/test/minimus/influenza-A/influenza-output.bnk.old/CTG.0.fix
new file mode 100644
index 0000000..48a10a5
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk.old/CTG.0.fix differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/CTG.0.var b/test/minimus/influenza-A/influenza-output.bnk.old/CTG.0.var
new file mode 100644
index 0000000..caaa932
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk.old/CTG.0.var differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/CTG.ifo b/test/minimus/influenza-A/influenza-output.bnk.old/CTG.ifo
new file mode 100644
index 0000000..4c7e1a0
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk.old/CTG.ifo
@@ -0,0 +1,9 @@
+____CTG BANK INFORMATION____
+bank version = 2.8
+bank type = 4674627
+objects = 8
+indices = 8
+bytes/index = 22
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/CTG.map b/test/minimus/influenza-A/influenza-output.bnk.old/CTG.map
new file mode 100644
index 0000000..99a97f6
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk.old/CTG.map
@@ -0,0 +1,9 @@
+CTG 8
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/FRG.0.fix b/test/minimus/influenza-A/influenza-output.bnk.old/FRG.0.fix
new file mode 100644
index 0000000..4dbdadb
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk.old/FRG.0.fix differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/FRG.0.var b/test/minimus/influenza-A/influenza-output.bnk.old/FRG.0.var
new file mode 100644
index 0000000..971764d
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk.old/FRG.0.var differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/FRG.ifo b/test/minimus/influenza-A/influenza-output.bnk.old/FRG.ifo
new file mode 100644
index 0000000..69ddbc1
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk.old/FRG.ifo
@@ -0,0 +1,9 @@
+____FRG BANK INFORMATION____
+bank version = 2.8
+bank type = 4674118
+objects = 79
+indices = 79
+bytes/index = 39
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/FRG.map b/test/minimus/influenza-A/influenza-output.bnk.old/FRG.map
new file mode 100644
index 0000000..ed34f98
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk.old/FRG.map
@@ -0,0 +1,80 @@
+FRG 79
+17 1 1099575910852
+49 2 1099575910469
+45 3 1099575910950
+51 4 1099575910597
+14 5 1099575910442
+62 6 1099575910491
+1 7 1099575910956
+76 8 1099575910607
+32 9 1099575910832
+10 10 1099575910475
+39 11 1099575910430
+67 12 1099575910484
+6 13 1099575910671
+28 14 1099575910600
+70 15 1099575910864
+54 16 1099575910534
+33 17 1099575910445
+55 18 1099575910867
+13 19 1099575910436
+4 20 1099575910472
+9 21 1099575910861
+15 22 1099575910568
+41 23 1099575910760
+43 24 1099575910543
+12 25 1099575910494
+71 26 1099575910503
+68 27 1099575910513
+30 28 1099575910846
+52 29 1099575910825
+38 30 1099575910594
+56 31 1099575910457
+75 32 1099575910433
+3 33 1099575910451
+37 34 1099575910528
+42 35 1099575910507
+60 36 1099575910531
+34 37 1099575910630
+35 38 1099575910619
+19 39 1099575910782
+20 40 1099575910588
+57 41 1099575910627
+47 42 1099575910591
+16 43 1099575910639
+58 44 1099575910616
+65 45 1099575910497
+50 46 1099575910478
+18 47 1099575910460
+40 48 1099575910642
+59 49 1099575910953
+78 50 1099575910890
+26 51 1099575910636
+79 52 1099575910613
+64 53 1099575910571
+77 54 1099575910858
+2 55 1099575910959
+46 56 1099575910789
+24 57 1099575910855
+27 58 1099575910622
+63 59 1099575910776
+72 60 1099575910580
+53 61 1099575910884
+66 62 1099575910426
+69 63 1099575910510
+22 64 1099575910516
+25 65 1099575910610
+11 66 1099575910577
+29 67 1099575910463
+7 68 1099575910519
+23 69 1099575910872
+44 70 1099575910525
+74 71 1099575910667
+73 72 1099575910779
+8 73 1099575910481
+5 74 1099575910935
+21 75 1099575910439
+36 76 1099575910537
+61 77 1099575910522
+31 78 1099575910878
+48 79 1099575910574
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/LAY.0.fix b/test/minimus/influenza-A/influenza-output.bnk.old/LAY.0.fix
new file mode 100644
index 0000000..ef00227
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk.old/LAY.0.fix differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/LAY.0.var b/test/minimus/influenza-A/influenza-output.bnk.old/LAY.0.var
new file mode 100644
index 0000000..c2ad7ac
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk.old/LAY.0.var differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/LAY.ifo b/test/minimus/influenza-A/influenza-output.bnk.old/LAY.ifo
new file mode 100644
index 0000000..e529667
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk.old/LAY.ifo
@@ -0,0 +1,9 @@
+____LAY BANK INFORMATION____
+bank version = 2.8
+bank type = 5849420
+objects = 8
+indices = 8
+bytes/index = 18
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/LAY.map b/test/minimus/influenza-A/influenza-output.bnk.old/LAY.map
new file mode 100644
index 0000000..7692da8
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk.old/LAY.map
@@ -0,0 +1 @@
+LAY 0
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/LIB.0.fix b/test/minimus/influenza-A/influenza-output.bnk.old/LIB.0.fix
new file mode 100644
index 0000000..8bf6738
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk.old/LIB.0.fix differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/LIB.0.var b/test/minimus/influenza-A/influenza-output.bnk.old/LIB.0.var
new file mode 100644
index 0000000..414ff9e
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk.old/LIB.0.var differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/LIB.ifo b/test/minimus/influenza-A/influenza-output.bnk.old/LIB.ifo
new file mode 100644
index 0000000..8dcb162
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk.old/LIB.ifo
@@ -0,0 +1,9 @@
+____LIB BANK INFORMATION____
+bank version = 2.8
+bank type = 4344140
+objects = 79
+indices = 79
+bytes/index = 14
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/LIB.map b/test/minimus/influenza-A/influenza-output.bnk.old/LIB.map
new file mode 100644
index 0000000..a4eb886
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk.old/LIB.map
@@ -0,0 +1,80 @@
+LIB 79
+1 80 1099575910886
+2 81 1099575910538
+3 82 1099575910572
+4 83 1099575910461
+5 84 1099575910431
+6 85 1099575910620
+7 86 1099575910631
+8 87 1099575910960
+9 88 1099575910951
+10 89 1099575910532
+11 90 1099575910865
+12 91 1099575910482
+13 92 1099575910511
+14 93 1099575910954
+15 94 1099575910578
+16 95 1099575910637
+17 96 1099575910427
+18 97 1099575910628
+19 98 1099575910575
+20 99 1099575910452
+21 100 1099575910847
+22 101 1099575910464
+23 102 1099575910589
+24 103 1099575910508
+25 104 1099575910668
+26 105 1099575910479
+27 106 1099575910623
+28 107 1099575910868
+29 108 1099575910569
+30 109 1099575910761
+31 110 1099575910957
+32 111 1099575910595
+33 112 1099575910529
+34 113 1099575910495
+35 114 1099575910780
+36 115 1099575910446
+37 116 1099575910856
+38 117 1099575910643
+39 118 1099575910862
+40 119 1099575910777
+41 120 1099575910526
+42 121 1099575910437
+43 122 1099575910492
+44 123 1099575910611
+45 124 1099575910434
+46 125 1099575910874
+47 126 1099575910498
+48 127 1099575910517
+49 128 1099575910443
+50 129 1099575910601
+51 130 1099575910617
+52 131 1099575910640
+53 132 1099575910608
+54 133 1099575910853
+55 134 1099575910504
+56 135 1099575910485
+57 136 1099575910838
+58 137 1099575910520
+59 138 1099575910544
+60 139 1099575910514
+61 140 1099575910614
+62 141 1099575910783
+63 142 1099575910440
+64 143 1099575910535
+65 144 1099575910790
+66 145 1099575910473
+67 146 1099575910828
+68 147 1099575910672
+69 148 1099575910470
+70 149 1099575910458
+71 150 1099575910598
+72 151 1099575910936
+73 152 1099575910476
+74 153 1099575910592
+75 154 1099575910892
+76 155 1099575910859
+77 156 1099575910881
+78 157 1099575910523
+79 158 1099575910581
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/OVL.0.fix b/test/minimus/influenza-A/influenza-output.bnk.old/OVL.0.fix
new file mode 100644
index 0000000..c07af09
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk.old/OVL.0.fix differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/OVL.0.var b/test/minimus/influenza-A/influenza-output.bnk.old/OVL.0.var
new file mode 100644
index 0000000..33a7c31
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk.old/OVL.0.var differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/OVL.ifo b/test/minimus/influenza-A/influenza-output.bnk.old/OVL.ifo
new file mode 100644
index 0000000..8aa2faf
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk.old/OVL.ifo
@@ -0,0 +1,9 @@
+____OVL BANK INFORMATION____
+bank version = 2.8
+bank type = 5002831
+objects = 703
+indices = 703
+bytes/index = 34
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/OVL.map b/test/minimus/influenza-A/influenza-output.bnk.old/OVL.map
new file mode 100644
index 0000000..6dc3395
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk.old/OVL.map
@@ -0,0 +1 @@
+OVL 0
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/RED.0.fix b/test/minimus/influenza-A/influenza-output.bnk.old/RED.0.fix
new file mode 100644
index 0000000..66515fd
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk.old/RED.0.fix differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/RED.0.var b/test/minimus/influenza-A/influenza-output.bnk.old/RED.0.var
new file mode 100644
index 0000000..df51f6a
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk.old/RED.0.var differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/RED.ifo b/test/minimus/influenza-A/influenza-output.bnk.old/RED.ifo
new file mode 100644
index 0000000..2aa7bf5
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk.old/RED.ifo
@@ -0,0 +1,9 @@
+____RED BANK INFORMATION____
+bank version = 2.8
+bank type = 4474194
+objects = 151
+indices = 151
+bytes/index = 55
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/RED.map b/test/minimus/influenza-A/influenza-output.bnk.old/RED.map
new file mode 100644
index 0000000..69880cf
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk.old/RED.map
@@ -0,0 +1,152 @@
+RED 151
+1 159 1086975905
+2 160 1086975821
+3 161 1086975860
+4 162 1086975884
+5 163 1086975887
+6 164 1086975771
+7 165 1086975785
+8 166 1086975858
+9 167 1086975799
+10 168 1086975819
+11 169 1086975885
+12 170 1086975768
+13 171 1086975788
+14 172 1086975781
+15 173 1086975818
+16 174 1086975882
+17 175 1086975779
+18 176 1086975772
+19 177 1086975793
+20 178 1086975843
+21 179 1086975794
+22 180 1086975805
+23 181 1086975904
+24 182 1086975795
+25 183 1086975890
+26 184 1086975875
+27 185 1086975902
+28 186 1086975872
+29 187 1086975832
+30 188 1086975806
+31 189 1086975856
+32 190 1086975895
+33 191 1086975857
+34 192 1086975778
+35 193 1086975867
+36 194 1086975871
+37 195 1086975917
+38 196 1086975829
+39 197 1086975914
+40 198 1086975817
+41 199 1086975906
+42 200 1086975852
+43 201 1086975876
+44 202 1086975855
+45 203 1086975865
+46 204 1086975901
+47 205 1086975776
+48 206 1086975881
+49 207 1086975790
+50 208 1086975830
+51 209 1086975915
+52 210 1086975896
+53 211 1086975891
+54 212 1086975848
+55 213 1086975911
+56 214 1086975861
+57 215 1086975845
+58 216 1086975811
+59 217 1086975897
+60 218 1086975849
+61 219 1086975809
+62 220 1086975837
+63 221 1086975774
+64 222 1086975909
+65 223 1086975828
+66 224 1086975816
+67 225 1086975808
+68 226 1086975868
+69 227 1086975842
+70 228 1086975898
+71 229 1086975823
+72 230 1086975827
+73 231 1086975815
+74 232 1086975835
+75 233 1086975870
+76 234 1086975814
+77 235 1086975798
+78 236 1086975770
+79 237 1086975782
+80 238 1086975850
+81 239 1086975859
+82 240 1086975880
+83 241 1086975912
+84 242 1086975894
+85 243 1086975893
+86 244 1086975886
+87 245 1086975813
+88 246 1086975807
+89 247 1086975907
+90 248 1086975834
+91 249 1086975822
+92 250 1086975873
+93 251 1086975802
+94 252 1086975878
+95 253 1086975780
+96 254 1086975791
+97 255 1086975844
+98 256 1086975877
+99 257 1086975810
+100 258 1086975836
+101 259 1086975797
+102 260 1086975777
+103 261 1086975801
+104 262 1086975767
+105 263 1086975838
+106 264 1086975892
+107 265 1086975853
+108 266 1086975783
+109 267 1086975786
+110 268 1086975903
+111 269 1086975846
+112 270 1086975854
+113 271 1086975900
+114 272 1086975910
+115 273 1086975879
+116 274 1086975908
+117 275 1086975826
+118 276 1086975775
+119 277 1086975796
+120 278 1086975839
+121 279 1086975916
+122 280 1086975831
+123 281 1086975789
+124 282 1086975812
+125 283 1086975874
+126 284 1086975866
+127 285 1086975913
+128 286 1086975863
+129 287 1086975825
+130 288 1086975888
+131 289 1086975841
+132 290 1086975883
+133 291 1086975864
+134 292 1086975889
+135 293 1086975824
+136 294 1086975773
+137 295 1086975869
+138 296 1086975804
+139 297 1086975847
+140 298 1086975784
+141 299 1086975792
+142 300 1086975851
+143 301 1086975800
+144 302 1086975787
+145 303 1086975820
+146 304 1086975840
+147 305 1086975803
+148 306 1086975769
+149 307 1086975833
+150 308 1086975899
+151 309 1086975862
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/UNV.0.fix b/test/minimus/influenza-A/influenza-output.bnk.old/UNV.0.fix
new file mode 100644
index 0000000..404a59a
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk.old/UNV.0.fix differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/UNV.0.var b/test/minimus/influenza-A/influenza-output.bnk.old/UNV.0.var
new file mode 100644
index 0000000..ad0bd57
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk.old/UNV.0.var differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/UNV.ifo b/test/minimus/influenza-A/influenza-output.bnk.old/UNV.ifo
new file mode 100644
index 0000000..db2813a
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk.old/UNV.ifo
@@ -0,0 +1,9 @@
+____UNV BANK INFORMATION____
+bank version = 2.8
+bank type = 5656149
+objects = 1
+indices = 1
+bytes/index = 14
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/influenza-A/influenza-output.bnk.old/UNV.map b/test/minimus/influenza-A/influenza-output.bnk.old/UNV.map
new file mode 100644
index 0000000..96a76ba
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk.old/UNV.map
@@ -0,0 +1,2 @@
+UNV 1
+1 1
diff --git a/test/minimus/influenza-A/influenza-output.bnk/CTG.0.0.fix b/test/minimus/influenza-A/influenza-output.bnk/CTG.0.0.fix
new file mode 100644
index 0000000..f91ecc0
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk/CTG.0.0.fix differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk/CTG.0.0.var b/test/minimus/influenza-A/influenza-output.bnk/CTG.0.0.var
new file mode 100644
index 0000000..a96f3ec
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk/CTG.0.0.var differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk/CTG.0.map b/test/minimus/influenza-A/influenza-output.bnk/CTG.0.map
new file mode 100644
index 0000000..99a97f6
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk/CTG.0.map
@@ -0,0 +1,9 @@
+CTG 8
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
diff --git a/test/minimus/influenza-A/influenza-output.bnk/CTG.ifo b/test/minimus/influenza-A/influenza-output.bnk/CTG.ifo
new file mode 100644
index 0000000..08883cf
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk/CTG.ifo
@@ -0,0 +1,10 @@
+____CTG BANK INFORMATION____
+bank version = 3.0
+bank type = 4674627
+versions = 1
+objects = 8
+indices = 8
+bytes/index = 26
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/influenza-A/influenza-output.bnk/FRG.0.0.fix b/test/minimus/influenza-A/influenza-output.bnk/FRG.0.0.fix
new file mode 100644
index 0000000..4dbdadb
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk/FRG.0.0.fix differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk/FRG.0.0.var b/test/minimus/influenza-A/influenza-output.bnk/FRG.0.0.var
new file mode 100644
index 0000000..971764d
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk/FRG.0.0.var differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk/FRG.0.map b/test/minimus/influenza-A/influenza-output.bnk/FRG.0.map
new file mode 100644
index 0000000..ed34f98
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk/FRG.0.map
@@ -0,0 +1,80 @@
+FRG 79
+17 1 1099575910852
+49 2 1099575910469
+45 3 1099575910950
+51 4 1099575910597
+14 5 1099575910442
+62 6 1099575910491
+1 7 1099575910956
+76 8 1099575910607
+32 9 1099575910832
+10 10 1099575910475
+39 11 1099575910430
+67 12 1099575910484
+6 13 1099575910671
+28 14 1099575910600
+70 15 1099575910864
+54 16 1099575910534
+33 17 1099575910445
+55 18 1099575910867
+13 19 1099575910436
+4 20 1099575910472
+9 21 1099575910861
+15 22 1099575910568
+41 23 1099575910760
+43 24 1099575910543
+12 25 1099575910494
+71 26 1099575910503
+68 27 1099575910513
+30 28 1099575910846
+52 29 1099575910825
+38 30 1099575910594
+56 31 1099575910457
+75 32 1099575910433
+3 33 1099575910451
+37 34 1099575910528
+42 35 1099575910507
+60 36 1099575910531
+34 37 1099575910630
+35 38 1099575910619
+19 39 1099575910782
+20 40 1099575910588
+57 41 1099575910627
+47 42 1099575910591
+16 43 1099575910639
+58 44 1099575910616
+65 45 1099575910497
+50 46 1099575910478
+18 47 1099575910460
+40 48 1099575910642
+59 49 1099575910953
+78 50 1099575910890
+26 51 1099575910636
+79 52 1099575910613
+64 53 1099575910571
+77 54 1099575910858
+2 55 1099575910959
+46 56 1099575910789
+24 57 1099575910855
+27 58 1099575910622
+63 59 1099575910776
+72 60 1099575910580
+53 61 1099575910884
+66 62 1099575910426
+69 63 1099575910510
+22 64 1099575910516
+25 65 1099575910610
+11 66 1099575910577
+29 67 1099575910463
+7 68 1099575910519
+23 69 1099575910872
+44 70 1099575910525
+74 71 1099575910667
+73 72 1099575910779
+8 73 1099575910481
+5 74 1099575910935
+21 75 1099575910439
+36 76 1099575910537
+61 77 1099575910522
+31 78 1099575910878
+48 79 1099575910574
diff --git a/test/minimus/influenza-A/influenza-output.bnk/FRG.ifo b/test/minimus/influenza-A/influenza-output.bnk/FRG.ifo
new file mode 100644
index 0000000..892c548
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk/FRG.ifo
@@ -0,0 +1,10 @@
+____FRG BANK INFORMATION____
+bank version = 3.0
+bank type = 4674118
+versions = 1
+objects = 79
+indices = 79
+bytes/index = 39
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/influenza-A/influenza-output.bnk/LAY.0.0.fix b/test/minimus/influenza-A/influenza-output.bnk/LAY.0.0.fix
new file mode 100644
index 0000000..df334b7
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk/LAY.0.0.fix differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk/LAY.0.0.var b/test/minimus/influenza-A/influenza-output.bnk/LAY.0.0.var
new file mode 100644
index 0000000..a993d9b
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk/LAY.0.0.var differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk/LAY.0.map b/test/minimus/influenza-A/influenza-output.bnk/LAY.0.map
new file mode 100644
index 0000000..7692da8
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk/LAY.0.map
@@ -0,0 +1 @@
+LAY 0
diff --git a/test/minimus/influenza-A/influenza-output.bnk/LAY.ifo b/test/minimus/influenza-A/influenza-output.bnk/LAY.ifo
new file mode 100644
index 0000000..5baeaf7
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk/LAY.ifo
@@ -0,0 +1,10 @@
+____LAY BANK INFORMATION____
+bank version = 3.0
+bank type = 5849420
+versions = 1
+objects = 8
+indices = 8
+bytes/index = 18
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/influenza-A/influenza-output.bnk/LIB.0.0.fix b/test/minimus/influenza-A/influenza-output.bnk/LIB.0.0.fix
new file mode 100644
index 0000000..8bf6738
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk/LIB.0.0.fix differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk/LIB.0.0.var b/test/minimus/influenza-A/influenza-output.bnk/LIB.0.0.var
new file mode 100644
index 0000000..414ff9e
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk/LIB.0.0.var differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk/LIB.0.map b/test/minimus/influenza-A/influenza-output.bnk/LIB.0.map
new file mode 100644
index 0000000..a4eb886
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk/LIB.0.map
@@ -0,0 +1,80 @@
+LIB 79
+1 80 1099575910886
+2 81 1099575910538
+3 82 1099575910572
+4 83 1099575910461
+5 84 1099575910431
+6 85 1099575910620
+7 86 1099575910631
+8 87 1099575910960
+9 88 1099575910951
+10 89 1099575910532
+11 90 1099575910865
+12 91 1099575910482
+13 92 1099575910511
+14 93 1099575910954
+15 94 1099575910578
+16 95 1099575910637
+17 96 1099575910427
+18 97 1099575910628
+19 98 1099575910575
+20 99 1099575910452
+21 100 1099575910847
+22 101 1099575910464
+23 102 1099575910589
+24 103 1099575910508
+25 104 1099575910668
+26 105 1099575910479
+27 106 1099575910623
+28 107 1099575910868
+29 108 1099575910569
+30 109 1099575910761
+31 110 1099575910957
+32 111 1099575910595
+33 112 1099575910529
+34 113 1099575910495
+35 114 1099575910780
+36 115 1099575910446
+37 116 1099575910856
+38 117 1099575910643
+39 118 1099575910862
+40 119 1099575910777
+41 120 1099575910526
+42 121 1099575910437
+43 122 1099575910492
+44 123 1099575910611
+45 124 1099575910434
+46 125 1099575910874
+47 126 1099575910498
+48 127 1099575910517
+49 128 1099575910443
+50 129 1099575910601
+51 130 1099575910617
+52 131 1099575910640
+53 132 1099575910608
+54 133 1099575910853
+55 134 1099575910504
+56 135 1099575910485
+57 136 1099575910838
+58 137 1099575910520
+59 138 1099575910544
+60 139 1099575910514
+61 140 1099575910614
+62 141 1099575910783
+63 142 1099575910440
+64 143 1099575910535
+65 144 1099575910790
+66 145 1099575910473
+67 146 1099575910828
+68 147 1099575910672
+69 148 1099575910470
+70 149 1099575910458
+71 150 1099575910598
+72 151 1099575910936
+73 152 1099575910476
+74 153 1099575910592
+75 154 1099575910892
+76 155 1099575910859
+77 156 1099575910881
+78 157 1099575910523
+79 158 1099575910581
diff --git a/test/minimus/influenza-A/influenza-output.bnk/LIB.ifo b/test/minimus/influenza-A/influenza-output.bnk/LIB.ifo
new file mode 100644
index 0000000..391e75e
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk/LIB.ifo
@@ -0,0 +1,10 @@
+____LIB BANK INFORMATION____
+bank version = 3.0
+bank type = 4344140
+versions = 1
+objects = 79
+indices = 79
+bytes/index = 14
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/influenza-A/influenza-output.bnk/OVL.0.0.fix b/test/minimus/influenza-A/influenza-output.bnk/OVL.0.0.fix
new file mode 100644
index 0000000..c07af09
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk/OVL.0.0.fix differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk/OVL.0.0.var b/test/minimus/influenza-A/influenza-output.bnk/OVL.0.0.var
new file mode 100644
index 0000000..33a7c31
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk/OVL.0.0.var differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk/OVL.0.map b/test/minimus/influenza-A/influenza-output.bnk/OVL.0.map
new file mode 100644
index 0000000..6dc3395
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk/OVL.0.map
@@ -0,0 +1 @@
+OVL 0
diff --git a/test/minimus/influenza-A/influenza-output.bnk/OVL.ifo b/test/minimus/influenza-A/influenza-output.bnk/OVL.ifo
new file mode 100644
index 0000000..dfaaf6f
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk/OVL.ifo
@@ -0,0 +1,10 @@
+____OVL BANK INFORMATION____
+bank version = 3.0
+bank type = 5002831
+versions = 1
+objects = 703
+indices = 703
+bytes/index = 34
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/influenza-A/influenza-output.bnk/RED.0.0.fix b/test/minimus/influenza-A/influenza-output.bnk/RED.0.0.fix
new file mode 100644
index 0000000..6853bf3
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk/RED.0.0.fix differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk/RED.0.0.var b/test/minimus/influenza-A/influenza-output.bnk/RED.0.0.var
new file mode 100644
index 0000000..0fe0440
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk/RED.0.0.var differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk/RED.0.map b/test/minimus/influenza-A/influenza-output.bnk/RED.0.map
new file mode 100644
index 0000000..69880cf
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk/RED.0.map
@@ -0,0 +1,152 @@
+RED 151
+1 159 1086975905
+2 160 1086975821
+3 161 1086975860
+4 162 1086975884
+5 163 1086975887
+6 164 1086975771
+7 165 1086975785
+8 166 1086975858
+9 167 1086975799
+10 168 1086975819
+11 169 1086975885
+12 170 1086975768
+13 171 1086975788
+14 172 1086975781
+15 173 1086975818
+16 174 1086975882
+17 175 1086975779
+18 176 1086975772
+19 177 1086975793
+20 178 1086975843
+21 179 1086975794
+22 180 1086975805
+23 181 1086975904
+24 182 1086975795
+25 183 1086975890
+26 184 1086975875
+27 185 1086975902
+28 186 1086975872
+29 187 1086975832
+30 188 1086975806
+31 189 1086975856
+32 190 1086975895
+33 191 1086975857
+34 192 1086975778
+35 193 1086975867
+36 194 1086975871
+37 195 1086975917
+38 196 1086975829
+39 197 1086975914
+40 198 1086975817
+41 199 1086975906
+42 200 1086975852
+43 201 1086975876
+44 202 1086975855
+45 203 1086975865
+46 204 1086975901
+47 205 1086975776
+48 206 1086975881
+49 207 1086975790
+50 208 1086975830
+51 209 1086975915
+52 210 1086975896
+53 211 1086975891
+54 212 1086975848
+55 213 1086975911
+56 214 1086975861
+57 215 1086975845
+58 216 1086975811
+59 217 1086975897
+60 218 1086975849
+61 219 1086975809
+62 220 1086975837
+63 221 1086975774
+64 222 1086975909
+65 223 1086975828
+66 224 1086975816
+67 225 1086975808
+68 226 1086975868
+69 227 1086975842
+70 228 1086975898
+71 229 1086975823
+72 230 1086975827
+73 231 1086975815
+74 232 1086975835
+75 233 1086975870
+76 234 1086975814
+77 235 1086975798
+78 236 1086975770
+79 237 1086975782
+80 238 1086975850
+81 239 1086975859
+82 240 1086975880
+83 241 1086975912
+84 242 1086975894
+85 243 1086975893
+86 244 1086975886
+87 245 1086975813
+88 246 1086975807
+89 247 1086975907
+90 248 1086975834
+91 249 1086975822
+92 250 1086975873
+93 251 1086975802
+94 252 1086975878
+95 253 1086975780
+96 254 1086975791
+97 255 1086975844
+98 256 1086975877
+99 257 1086975810
+100 258 1086975836
+101 259 1086975797
+102 260 1086975777
+103 261 1086975801
+104 262 1086975767
+105 263 1086975838
+106 264 1086975892
+107 265 1086975853
+108 266 1086975783
+109 267 1086975786
+110 268 1086975903
+111 269 1086975846
+112 270 1086975854
+113 271 1086975900
+114 272 1086975910
+115 273 1086975879
+116 274 1086975908
+117 275 1086975826
+118 276 1086975775
+119 277 1086975796
+120 278 1086975839
+121 279 1086975916
+122 280 1086975831
+123 281 1086975789
+124 282 1086975812
+125 283 1086975874
+126 284 1086975866
+127 285 1086975913
+128 286 1086975863
+129 287 1086975825
+130 288 1086975888
+131 289 1086975841
+132 290 1086975883
+133 291 1086975864
+134 292 1086975889
+135 293 1086975824
+136 294 1086975773
+137 295 1086975869
+138 296 1086975804
+139 297 1086975847
+140 298 1086975784
+141 299 1086975792
+142 300 1086975851
+143 301 1086975800
+144 302 1086975787
+145 303 1086975820
+146 304 1086975840
+147 305 1086975803
+148 306 1086975769
+149 307 1086975833
+150 308 1086975899
+151 309 1086975862
diff --git a/test/minimus/influenza-A/influenza-output.bnk/RED.ifo b/test/minimus/influenza-A/influenza-output.bnk/RED.ifo
new file mode 100644
index 0000000..1dcbe38
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk/RED.ifo
@@ -0,0 +1,10 @@
+____RED BANK INFORMATION____
+bank version = 3.0
+bank type = 4474194
+versions = 1
+objects = 151
+indices = 151
+bytes/index = 55
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/influenza-A/influenza-output.bnk/UNV.0.0.fix b/test/minimus/influenza-A/influenza-output.bnk/UNV.0.0.fix
new file mode 100644
index 0000000..404a59a
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk/UNV.0.0.fix differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk/UNV.0.0.var b/test/minimus/influenza-A/influenza-output.bnk/UNV.0.0.var
new file mode 100644
index 0000000..ad0bd57
Binary files /dev/null and b/test/minimus/influenza-A/influenza-output.bnk/UNV.0.0.var differ
diff --git a/test/minimus/influenza-A/influenza-output.bnk/UNV.0.map b/test/minimus/influenza-A/influenza-output.bnk/UNV.0.map
new file mode 100644
index 0000000..96a76ba
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk/UNV.0.map
@@ -0,0 +1,2 @@
+UNV 1
+1 1
diff --git a/test/minimus/influenza-A/influenza-output.bnk/UNV.ifo b/test/minimus/influenza-A/influenza-output.bnk/UNV.ifo
new file mode 100644
index 0000000..fc82cba
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.bnk/UNV.ifo
@@ -0,0 +1,10 @@
+____UNV BANK INFORMATION____
+bank version = 3.0
+bank type = 5656149
+versions = 1
+objects = 1
+indices = 1
+bytes/index = 14
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/influenza-A/influenza-output.fasta b/test/minimus/influenza-A/influenza-output.fasta
new file mode 100644
index 0000000..393050e
--- /dev/null
+++ b/test/minimus/influenza-A/influenza-output.fasta
@@ -0,0 +1,234 @@
+>1
+CAATTATATTCAGTATGGAAAGAATAAAAGAACTACGGAATCTGATGTCGCAGTCTCGCA
+CTCGCGAGATACTGACAAAAACCACAGTGGACCATATGGCCATAATTAAGAAGTACACAT
+CGGGGAGACAGGAAAAGAACCCGTCACTTAGGATGAAATGGATGATGGCAATGAAATACC
+CAATCACTGCTGACAAAAGGATAACAGAAATGGTTCCGGAGAGAAATGAACAAGGACAAA
+CTCTATGGAGTAAAATGAGTGATGCTGGATCAGATCGAGTGATGGTATCACCTTTGGCTG
+TAACATGGTGGAATAGAAATGGACCCGTGACAAGTACGGTCCATTACCCAAAAGTATACA
+AGACTTATTTTGACAAAGTCGAAAGGTTAAAACATGGAACCTTTGGCCCTGTTCATTTTA
+GAAATCAAGTCAAGATACGCAGAAGAGTAGACATAAACCCTGGTCATGCAGACCTCAGTG
+CCAAAGAGGCACAAGATGTAATTATGGAAGTTGTTTTTCCCAATGAAGTGGGAGCCAGGA
+TACTAACATCAGAATCGCAATTAACAATAACTAAAGAGAAAAAAGAAGAACTCCGAGATT
+GCAAAATTTCTCCCTTGATGGTTGCATACATGTTAGAGAGAGAACTTGTACGAAAAACAA
+GATTTCTCCCAGTTGCTGGCGGAACAAGCAGTATATACATTGAAGTTTTACATTTGACTC
+AAGGAACGTGTTGGGAACAAATGTACACTCCAGGTGGAGAAGTGAGGAATGACGATGTTG
+ACCAAAGCCTAATTATTGCGGCCAGGAACATAGTAAGAAGAGCAGCAGTATCAGCAGATC
+CACTAGCATCTTTATTGGAGATGTGCCACAGCACACAAATTGGCGGGACAAGGATGGTGG
+ACATTCTTAGACAGAACCCGACTGAAGAACAAGCTGTGGATATATGCAAGGCTGCAATGG
+GATTGAGAATCAGCTCATCCTTCAGCTTTGGTGGGTTTACATTTAAAAGAACAAGCGGGT
+CATCAGTCAAAAAAGAGGAAGAAGTGCTTACAGGCAATCTCCAAACATTGAAGATAAGAG
+TACATGAGGGGTATGAGGAGTTCACAATGGTGGGGAAAAGAGCAACAGCTATACTCAGAA
+AAGCAACCAGAAGATTGGTTCAGCTCATAGTGAGTGGAAGAGACGAACAGTCAATAGCTG
+AAGCAATAATCGTGGCCATGGTGTTTTCACAAGAGGATTGCATGATAAAAGCAGTTAGAG
+GTGACCTGAATTTCGTCAACAGAGCAAATCAGCGGTTGAACCCCATGCATCAGCTTTTAA
+GGCATTTTCAGAAAGATGCGAAAGTGCTTTTTCAAAATTGGGGAATTGAACACATCGACA
+GTGTGATGGGAATGGTTGGAGTATTACCAGATATGACTCCAAGCACAGAGATGTCAATGA
+GAGGAATAAGAGTCAGCAAAATGGGTGTGGATGAATACTCCAGTACAGAGAGGGTGGTGG
+TTAGCATTGATCGGTTTTTGAGAGTTCGAGACCAACGTGGGAATGTATTATTATCTCCTG
+AGGAGGTCAGTGAAACACAGGGAACTGAGAGACTGACAATAACTTATTCATCGTCGATGA
+TGTGGGAGATTAACGGTCCTGAGTCGGTTTTGGTCAATACCTATCAATGGATCATCAGAA
+ATTGGGAAGCTGTCAAAATTCAATGGTCTCAGAATCCTGCAATGTTGTACAACAAAATGG
+AATTTGAACCATTTCAATCTTTAGTCCCCAAGGCCATTAGAAGCCAATACAGTGGGTTTG
+TCAGAACTCTATTCCAACAAATGAGAGACGTACTTGGGACATTTGACACCACCCAGATAA
+TAAAGCTTCTCCCTTTTGCAGCCGCTCCACCAAAGCAAAGCAGAATGCAGTTCTCTTCAC
+TGACTGTAAATGTGAGGGGATCAGGGATGAGAATACTTGTAAGGGGCAATTCTCCTGTAT
+TCAACTACAACAAGACAACTAAAAGACTAACAATTCTCGGAAAAGATGCCGGCACTTTAA
+TTGAAGACCCAGATGAAAGCACATCCGGAGTGGAGTCTGCCGTCTTGAGAGGGTTTCTCA
+TTATAGGTAAGGAAGACAGAAGATACGGACCAGCATTAAGCATCAATGAACTGAGTAACC
+TTGCAAAAGGGGAAAAGGCTAATGTGCTAATCGGGCAAGGAGACGTGGTGTTGGTAATGA
+AACGAAAACGGGACTCTAGCATACTTACTGACAGCCAGACAGCGACCAAAAGAATTCGGA
+TGGCCATCAATTAATGTTGAATAG
+>2
+TTTGATGGATGTCATCCGACTCTACTGTTCCTAAAGGTTCCAGCGCAAAATGCCATAAGC
+ACCACATTCCCTTATACTGGAGATCCTCCATACAGCCATGGAACAGGAACAGGGTACACC
+ATGGACACAGTCAACAGAACACACCAATATTCAGAGAAGGGGAAGTGGACGACAAATACA
+GAAACTGGGGCACCCCAACTCAACCCAATTGATGGACCACTACCTGAGGATAATGAGCCG
+AGTGGATATGCACAAACAGACTGTGTCCTGGAGGCTATGGCCTTCCTTGAAGAATCCCAC
+CCAGGTATCTTTGAGAACTCATGCCTTGAAACAATGGAAGTCGTTCAACAAACAAGGGTG
+GACAAACTAACCCAAGGTCGCCAGACTTATGATTGGACATTAAACAGAAATCAACCGGCA
+GCAACTGCATTAGCCAACACCATAGAAGTTTTTAGATCGAATGGACTAACAGCTAATGAA
+TCAGGAAGGCTAATAGATTTCCTCAAGGATGTGATGGAATCAATGGATAAAGAGGAAATG
+GAGATAACAACACACTTTCAAAGAAAAAGGAGAGTAAGAGACAACATGACCAAGAAAATG
+GTCACACAAAGAACAATAGGGAAGAAAAAACAAAGAGTGAATAAGAGAGGCTATCTAATA
+AGAGCTTTGACATTGAACACGATGACCAAAGATGCAGAGAGAGGTAAATTAAAAAGAAGG
+GCTATTGCAACACCAGGGATGCAAATTAGAGGGTTCGTGTACTTCGTTGAAACTTTAGCT
+AGAAGCATTTGCGAAAAGCTTGAACAGTCTGGACTTCCGGTTGGGGGTAATGAAAAGAAG
+GCCAAACTGGCAAATGTTGTGAGAAAAATGATGACTAATTCACAAGACACTGAGCTTTCT
+TTCACAATCACTGGGGACAACACTAAGTGGAATGAAAATCAAAACCCTCGAATGTTTTTG
+GCGATGATTACATATATCACAAAAAATCAACCTGAGTGGTTCAGAAACATCCTGAGCATC
+GCACCAATAATGTTCTCAAACAAAATGGCAAGACTAGGAAAAGGATACATGTTCGAGAGT
+AAGAGAATGAAGCTCCGAACACAAATACCCGCAGAAATGCTAGCAAGCATTGACCTGAAG
+TATTTCAATGAATCAACAAGGAAGAAAATTGAGAAAATAAGGCCTCTTCTAATAGATGGC
+ACAGCATCATTGAGCCCTGGGATGATGATGGGCATGTTCAACATGCTAAGTACGGTTTTA
+GGAGTCTCAATACTGAATCTTGGGCAAAAGAAATACACCAAGACAACATACTGGTGGGAT
+GGGCTCCAATCCTCCGACGATTTTGCCCTCATAGTGAATGCACCAAATCATGAGGGAATA
+CAAGCAGGAGTGGATAGATTCTACAGGACCTGCAAGTTAGTGGGAATCAACATGAGCAAA
+AAGAAGTCCTATATAAATAAAACAGGGACATTTGAATTCACAAGCTTTTTTTATCGATAT
+GGATTTGTGGCTAATTTTAGCATGGAGCTTCCCAGTTTTGGAGTGTCTGGAATAAACGAG
+TCAGCTGATATGAGCATTGGAGTAACAGTGATAAAGAACAACATGATAAACAATGACCTT
+GGACCAGCAACAGCCCAGATGGCTCTCCAATTGTTCATCAAAGACTACAGATATACATAT
+AGGTGCCATAGAGGAGACACACAAATTCAGACGAGAAGATCATTCGAGCTAAAGAAGCTG
+TGGGATCAAACCCAATCAAGGGCAGGACTATTGGTATCAGATGGGGGACCAAACTTATAC
+AATATCCGGAACCTTCACATCCCTGAAGTCTGCTTAAAGTGGGAGCTAATGGATGAGAAT
+TATCGGGGAAGACTTTGTAACCCCCTGAATCCCTTTGTCAGCCATAAAGAAATTGAGTCT
+GTAAACAATGCTGTAGTGATGCCAGCTCATGGTCCAGCCAAAAGTATGGAATATGATGCC
+GTTGCAACTACACACTCCTGGATTCCCAAGAGGAACCGCTCTATTCTCAACACAAGCCAA
+AGGGGAATTCTTGAGGATGAACAGATGTACCAAAAGTGCTGCAACTTGTTCGAGAAATTT
+TTCCCTAGTAGTTCATATAGGAGACCGATTGGAATTTCTAGCATGGTGGAGGCCATGGTG
+TCTAGGGCCCGGATTGATGCCAGAATTGACTTCGAGTCTGGACGGATTAAGAAGGAAGAG
+TTCTCTGAGATCATGAAGATCTGTTCCACCATTGAAGAACTCAGACGGCAAAAATAATGA
+ATTTAGCTTGTCCTTCATG
+>3
+ATTAACCATGAAGACTATCATTGCTTTGAGCTACATTCTATGTCTGGTTTTCGCTCAAAA
+ACTTCCCGGAAATGACAACAGCACGGCAACGCTGTGCCTTGGGCACCATGCAGTACCAAA
+CGGAACGATAGTGAAAACAATCACGAATGACCAAATTGAAGTTACTAATGCTACTGAGCT
+GGTTCAGAGTTCCTCAACAGGTGGAATATGCGACAGTCCTCATCAGATCCTTGATGGAGA
+AAACTGCACACTAATAGATGCTCTATTGGGAGACCCTCAGTGTGATGGCTTCCAAAATAA
+GAAATGGGACCTTTTTGTTGAACGCAGCAAAGCCTACAGCAACTGTTACCCTTATGATGT
+GCCGGATTATGCCTCCCTTAGGTCACTAGTTGCCTCATCCGGCACACTGGAGTTTAACAA
+TGAAAGCTTCAATTGGACTGGAGTCACTCAAAATGGAACAAGCTCTGCTTGCAAAAGGAG
+ATCTAATAACAGTTTCTTTAGTAGATTGAATTGGTTGACCCATTTAAAATTCAAATACCC
+AGCATTGAACGTGACTATGCCAAACAATGAAAAATTTGACAAATTGTACATTTGGGGGGT
+TCACCACCCGGGTACGAACAATGACCAAATCAGCCTATATGCTCAAGCATCAGGAAGAAT
+CACAGTCTCTACCAAAAGAAGCCAACAAACTGTAATCCCGAATATCGGATCTAGACCCAG
+GGTAAGGGATATCCCCAGCAGAATAAGCATCTATTGGACAATAGTAAAACCGGGAGACAT
+ACTTTTGATTAACAGCACAGGGAATCTAATTGCTCCTCGGGGTTACTTCAAAATACGAAG
+TGGGAAAAGCTCAATAATGAGATCAGATGCACCCATTGGCAAATGCAATTCTGAATGCAT
+CACTCCAAATGGAAGCATTCCCAATGACAAACCATTTCAAAATGTAAACAGGATCACATA
+TGGGGCCTGTCCCAGATATGTTAAGCAAAACACTCTGAAATTGGCAACAGGGATGCGAAA
+TGTACCAGAGAAACAAACTAGAGGCATATTTGGCGCAATCGCGGGTTTCATAGAAAATGG
+TTGGGAGGGAATGGTGGATGGTTGGTACGGTTTCAGGCATCAAAATTCTGAGGGAATAGG
+ACAAGCAGCAGATCTCAAAAGCACTCAAGCAGCAATCAACCAAATCAATGGGAAGCTGAA
+TAGGTTGATCGGGAAAACCAACGAGAAATTCCATCAGATTGAAAAAGAATTCTCAGAAGT
+AGAAGGGAGAATTCAGGACCTCGAGAAATATGTTGAGGACACTAAAATAGATCTCTGGTC
+ATACAACGCGGAGCTTCTTGTTGCCCTGGAGAACCAACATACAATTGATCTAACTGACTC
+AGAAATGAACAAACTGTTTGAAAGAACAAAGAAGCAACTGAGGGAAAATGCTGAGGATAT
+GGGCAATGGTTGTTTCAAAATATACCACAAATGTGACAATGCCTGCATAGGGTCAATCAG
+AAATGGAACTTATGACCATGATGTATACAGAGATGAAGCATTAAACAACCGGTTCCAGAT
+CAAAGGTGTTGAGCTGAAGTCAGGATACAAAGATTGGATCCTATGGATTTCCTTTGCCAT
+ATCATGTTTTTTGCTTTGTGTTGCTTTGTTGGGGTTCATCATGTGGGCCTGCCAAAAAGG
+CAACATTAGGTGCAACATTTGCATTTGAGTGCATTAATT
+>4
+TCCTTAATTGTCGTACTCTTCTGCATTGTCTCCGAAGAAATAAGATCCTTCATTACTCAT
+ATCAAAAGAGGGCACGATCGGGTTCGCTGCCTTCTCGTCTGAGAGCTCGAAAACTCCCCT
+CCCCCGGAATGACACTTCTTCTGGTTTTGCACCTTCCATCATTCTTATGATTTCTGCCCT
+CATGTCTGAAGTTCTTCCCTCCGTATTTCCAGTGAATGCTGCCATGATGGTTGACTTTTC
+AAATGGGAGGTTTCTTTGTACAGAAAACGTAGGTTGCACACTGGTTTGGCCTGCGGAGGC
+CCTCTGTTGATTAGTGTTTCCTCCACTCCTGGTCCTTATGGCCCAGTACCCGCTTCTCAG
+TTCAAGAGTGCTCGATCCCATATTATCCATGTTCTCATTTGAAGCAATTTGTACCCCTCT
+AGTTGACAGTTTCCCCCGAGGAGATACTTTTGTCCCTCTGATGAAGCTTAACAATCTTAA
+ATCTTCAAATGCAGCAGAATGGCATGCCATCCACACCAGCTGACTCTTGTGTGCTGGATT
+CTCGTTAGGTCTGATTAGGCTGTATATTTGGCTATTTTGAAGTAGTTTGAAAGGGTCTAT
+TCCCACCAAGGAATATCCCTCTTTTTCGAAGTCGTACCCACTGGATACTGCAGGTCCATA
+CGCACAGGCAGGTAGGCAAGATTTGTGAGCAACTGACCCTCTCAATATCAATGCAGATCT
+TGCCAAAAATATGAGATCTTCGATCTCAGCATTTCCTGGGTTCCGACTTTCTCTCACTTG
+ATCCACCATTGCTCTTTGTGCAGCTGTTTGAAATTTTCCTTTAAGAATGTTGCACATTCT
+CTCATAAGCACTTCTTGTTTTCCGCCCATTCTCACCTCTCCAGAAATTTCGATCGTTGAT
+CCCCCGTTTGACCATTCTGATCAGTTCCATCACCATTGTCCCGATTCCTTTGACTGCAGC
+ACCTGCAGCTCCGGACCTTCTAGGGAGAGTCGAGCCCTGCATCAGAGAGCACATTCTGGG
+ATCCATTCCAGTTCGAACAAGAGCTCTTGTCCTCTGGTATGTTGCATCATTCAAATTGGA
+ATGCCAGATCATTATGTGAGTTAGACCAGCTGTCGCATCCTCACCATTGTTGGCTTGGCG
+CCAGATTCGCCTTATTTCTTCTTTGTCATAAAGGACGAGTTCCCTCATCCATTTTCCATC
+TACTCTCCTGTATATGGGTCCCCCAGTTTTCTTGGGATCTTTCCCCGCGCTGGGGTGTTC
+TTCCAGGTATTTATTCCTTCTTTCATCAAAAGCAGAGAGCACCATTTTCTCTATTGTCAA
+GCTGTTCTGGATCAATCGCCCTTCATGATCACTGAGTTTAAGTTCAGTGCACATTTGGAT
+GTAGAATCTCCCAATTCCATCAATCATCTTCCCGACGGATGCCCTAATCTCAGTTGCATT
+CTGGCGATCCCCATCAGTTTCCATCTGTTCATAAGACCGTTTGGTGCCTTGGGACGCCAT
+GATTTTGATGTCACTCAGTGA
+>5
+CTAAAATTGCGAAAGCTTATATAGGCATGAGATTGATGTCCGCCCCATCAGGCCATGAGC
+CTGTTCCATATGTACCTGAGGTGCCACAAAACACAACAATACTGTTTGAGGTCCACAAGA
+CTTCAGTTTCCTCTTTTCTTCCCCTTATCAACTCCACATAAAAGCACCGATTGATGCAGC
+TTTTGCCTTCAACAGAGAAAATACCAGAATAACCGGACCTATTACCTCTGTCAACTATGA
+CTTGCCTATTTATCTGCAATTTGGAATTAGGGTTGGACCAGCCCTCAATGACTTTGAAGG
+TTTCATATCCTGAGCGTAACTTCTCGCTGATCGTTCTTCCCATCCACACGTCATTTCCAT
+CATCAAAGGCCCAGCCTTTCACTCCATGACCACCTTCTTCATTGTTAGGATCCAAGCAAT
+GGCTACTGCTGGAGCTGTCGTTTTTTCTGGGTGTGTCTCCAACAAGTCCTGAGCACACAT
+AACTGGAAACAATGCTATAATCCTTTATGTTTATATCTACGATGGGCCTATTGGAGCCTT
+TCCAGTTGTCTCTGCAGACACATCTGACACCAGGATATCGAGGATAGCAGGAGCACTCCT
+CGACATGCTGGGCACTTCCTGACAATGTGCTAGTATGAACGATTTTCCCCTCCTCAATGA
+ATAGTATTTTAGTATCAGCTTTTCCTGAAGCACTCCCATCAGTCATTACTACTGTACAAG
+TTCCATTGATACAAACGCATTCTGACTCCTGGGTTCTGAGGATTTCTTTGGACCATGAAA
+CAATACTATCTACAAGCCTCCCATTGTAAATGAAGCTAGCAGTTGCATTTTTATCATCCC
+CCGTTACACAAACATGCAGCCATGCTTTTCCATCGTGACAACTTGAGCTGGACCATGCTA
+TGCACACTTGCTTAGTCCCCAGATGAAATGGAACACCTAACTCATTCATCAATAGGGTCC
+GATAAGGGGTCCTATCATGTACTGTGTCATTTGAATGCACGTTGTTTAGTGTTGTTCCCT
+GTCCAAGGGCAAATTGATAACATTTGTCAGGATCGCATGACACATAAGGTTCTCTTGTCA
+CCCAGATGTCCCCACCAGCGGAAAGCCTAATCGAATTGTCCTTAGAAAAAGGTGCAAATC
+CTGTAATGTCACATTGCGGCTTTGACCAATTTCTGTATTCTGCTAGTTTGGGGCATATTT
+CCTTCTCTATGGTGGTGTTGGTCAGATACACTATCTCTGTTATGTTTCTTTCTATTATTG
+TTGGTTCACACAGCATCACTTGGTTGTTTGGGGGGGAGTTGAATTCATATTGCTTGAAAT
+GCAATGTTACAGTAGTTATCAAGATGGCAATTTGCATAAAGAAGCATATTGTGGAAATGG
+TGAGAGAAACAGAGCCAATCGTTATTATCTTTTGATTTGGATTCATCTTTAC
+>6
+ACTCTATGCTGACAAAATGACTGTCGTCAGCATCCACAGCATTCTGCTGTTCCTTTCGAT
+ATTCTTCCCTCATAGACTCAGGTACTCCTTCCGTAGAAGGGCCTCTTTTAAGGCCGTGTT
+TGAAGAGTCGATAGACGCATTTGAAAAAAAGACGATCAAGAATCCACAATATCAAGTGCA
+AGATCCCAATGATACTCGCGGTAACAACAAGCGGGTCACTTGAATCGTTGCATCTGCACC
+CCCATTCGTTTCTGATAGGTCTGCAAATTTTCAAGAAGATCATCTCTTAGACCAGTACTG
+GAGCTAGGATGAGTCCCAACGGCTCTCATTGCCTGCACCATTTGCCTGGCCTGACTAGCA
+ATTTCCATGGCCTCCGCTGCCTGCTCACTTGATCCAGCCATTTGCTCCATAGCCTTAGCT
+GTAGTGCTGGCCAAAACCATTCTGTTCTCATGTTTTATTAATGGATTGGTTGTTGTCACC
+ATTTGCCTATGAGACCTGTGCTGGGAGTCAGCAATCTGTTCACATGTTGCACATACCAGG
+CCAAATGCCACTTCAGTGGTTACAGCCCCCATTCTATTGTATATGAGGCCCATGCAACTG
+GCAAGTGCACCAGCAGAATAACTGAGAGCTATTTCTTTGGCCCCATGGAACGTTATCTCC
+CTCTTAAGTTTCCTATACAGTTTAACTGCTTTGTCCATGTTATTTGGATCTCCATTCCCA
+TTGAGGGCATTTTGGACAAAGCGTCTACGCTGCAGTCCTCGCTCACTGGGCACGGTGAGC
+GTGAACACAAACCCCAAAATCCCTTTAGTCAGAGGTGACAGAATTGGTCTTGTCTTTAGC
+CATTCCATGAGAGCCTCAAGATCTGTGTTTTTCCCAGCAAAGACATCTTCAAGTCTCTGC
+GCGATCTCGGCTTTGAGGGGGCCTGATGGAACGATAGAGAGAACATACGTTTCGACCTCG
+GTTAGAAGGC
+>7
+TCATTAAATAAGCTGAAATGAGAAAGTTCTTATCTCCTGTTCCACTTCAAACAGCAGTTG
+TAATGCTTGCATGAATGTTATTTGTTCAAAGCTATTTTCAGTTGTTTTTAGTCTGTGTCT
+CACTTCTTCAATCAGCCATCTTATCTCTTCAAACTTTTGACCTAGCTGTTCTCGCCATTT
+TCCGTTTCTGTTTTGGAGTAAGTGGAGGTCCCCCATTCTCATTACTGCTTCTCCAAGCGA
+ATCTCTGTAGATTTTTAGAGACTCGAACTGTGTTATCATTCCATTCAAGTCCTCCGATGA
+GGACCCCAATTGCATTTTTGACATCCTCAATAGTATGTCCTGGAAAAGAAGGCAATGGTG
+AGATTTCGCCAACAATTGCTCCCTCTTCGGTGAAAGCCCTTAGTAATACTATGGTCTCTA
+GTCGGTCAAAAATCACACTGAAATTCGCTTTCAACATGATGTTTTTCTCCATGATTGCCT
+GGTCCATTCTGATGCAAAGAGGTCCTTCCACTTTCTGCTTGGGCATTAGCATGAACCAGT
+TTCTTGACAATTCCTCAATAGTCATGTCAGTTATGTATCGCGAAGCAGGTGTGGAGACCA
+TGGTCATTTTAAGTGCCTCATCAGATTCTTCTTTCAGAATCTTTTCTACAATTTGCTTTC
+CAACATGGGTGGCTGCTTTGATGTCTAGACCGAGAGTATTGCCTCTTCCCCTTAGGGACC
+TCTGATCTCGGCGAAGCCGATCAAGGAATGGGGCATCACTCAGTTCTTGGTCTACAACTT
+GTTTCCGGATATGCCAAAGAAAGCAATCTACCTGGAAACTTGACACAGTGTTGGAATCCA
+TTATGTCTTTGTCA
+>8
+GACAGTACGGATAACAAATAGTAGCACTGCCATAACTATTTTAATGCATGTGTCAGGAAG
+GAGTTGAACCAAGATGCATTGAGCAAAACCCAGGGATCATTAATCAGGCACTCCTCAATT
+GCTTCATATAGCCCCCCGAGATCAAAGGTCCCAGGTTCGAGATTGTCCCTAAGAGCCTGA
+ACAACAAGAAGCAGTTTTCTTGACTCCGCTGAAAATCCTTCCAATTGTGGTGATGCATAC
+AGGCTATTGAACACTGACTTAGCCAATAGAGTCCTACAGACTTTCCCAATGGAACCTTCT
+TCCACTCCCTTGGGGGACTCCCCAATGGGCCATGCTTCTGATTTATTCTCAAAAAACTCT
+TTGGTCATGTCTTTCTCTTTAATCGAGGACTCGGCTTCAATCATGCTCTCGATCTGCTGG
+AGTGACTGAAGGAGGCAACGTCTCATCTCCATTCCCCATTTCATTTTGACCTTTGATGTT
+CCGTTTGTCCTCACATACAAGAACATAGGCCTTGAAATTTGGCCTATGGCACTTCTTAGT
+AACATATCTCCTATCTCAAGGACACAGTATTTCTCCCATTTATGTGGCTCTAGTCTCGGG
+TCAGTGAGAGAAAATTCCATGCTCACAAAGTTTACCACATCTGTGTCATTCCTTAAATGG
+GATCTTCCCTTTATGATGAACCCATATAAATTGGTTTTTCGCCTTCCCTCTTTAGTTCTG
+CACTTGCTTATCATGGGGATTAGTTGAAAATCGTCCATTGCTGCACAGGATGCATTGAGC
+AGGGCAGTATTAATGTATACCCCCTTCATTATGTACTCAGTGGCTCTACAATGGGACACC
+TCTGCTGTGAAATAATTCCTCCTCATGCTTGCAATGTACTCAATTGGGGCTACGTCCTCT
+CCAATTTCATCGAGCTCTATCCAGATTGAATCAGTTAGCTCGCAGGCCTTGTTGAACTCA
+TTCTGTATCCAGCTTGAAAGTGACCTTAATTCAGGTTCGTCACTATCATATTGCTTCAAA
+TCGCTTATGTCTCTGCAGTTGTCAAAGTCTACTTTCTCTGGTGCCATGTTTTCACCAAGA
+GCCCACTTTAGTTGACTCGTTTTCTTCATGTTTTTAGTCCTTGGGATCTTCTCCTCATTT
+TCAATGTCCTGCAATTCTGACAATACTTGCTTCCATGACAGCAGGTAATTTGAATTTATT
+CCCTTTTCGTGTGGTTTGACTATATAAGGTTCTTTCCATCCAAAGAATGTTTTCATGCAC
+TTGATCGCATCATATAATGGAATCCCTTCTCCTTCGTGACTTGGGTCTTCAATGCTCAAT
+TTCAAAGCATCCATCAGGAGGAATTTGGACCGCTGATAACAAGGAGGTCCATTAGGAAGT
+TTGATTGGTCTTGGTGTTGTCTTCAGAAAAGGTTCAATTTTGGCATTCACTTCTTTGGAC
+ATTTGAGAAAGCTTGCCCTCAATGCAGCCGTTCGGTTCGAATCCATCCACATAGGCTCTA
+AAATTCTCAAGGCAGGAGAAGTTCGGTGGGAGACTTTGGTCGGCAAGCCTACGCATAGTT
+CCTGAGATTTCAAATTTTTCTTCAATTGTTTCTTCGCCTCTTTCGGACTGACGAAAGGAA
+TCCCAGAGGCCTCTGTTGGCCATTTCTTGTCTTATGGTAAATAGCCTGGTTTTAATCCTA
+GCTCTGCTTTCCTCGTCGAGAGTGTAGTCTGCCTTTGTGGCCATTTCCTCCCCAGTGAAT
+GAGAAAATGTGAATGTGTGTGTTCTCAGATTTAATTTTATTGGCCTTTTCAAGGTAATAT
+ATGTGGACTTCTCTTCTTGTCACTCCAATTTCGATGAATCTGTTCTCCTTGTAATCATAC
+AAATCTGGTAGAAACTTCGGTTTTTCAGCTCCAGTAGTGTTGCAGATACTGTTTACTACT
+GTCCAGGCCATTGTTCTGTCTCTCCCCTCGATTATTTCAAATCTGTGCTTTAACAGTGCA
+TTTGGATCATCAAGTTCTACCATTATTGATTCGCCTTGTTCATTGATGAAATGAAAATCT
+GAATACATGAAACATACCTCCAAGTGGGTGCATATTGCTGCAAATTTGTTTGTTTCAATT
+TTCAGATCCTCTCCATACTCTTTCATTGCTTTTTCTGCAAGTTCGACAATCATCGGGTTG
+AAGCATTGTCGCACAAAATCTTCCATTTCGAATCAGT
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/CTG.0.fix b/test/minimus/zgene/zgene2-output.bnk.old/CTG.0.fix
new file mode 100644
index 0000000..87487d0
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk.old/CTG.0.fix differ
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/CTG.0.var b/test/minimus/zgene/zgene2-output.bnk.old/CTG.0.var
new file mode 100644
index 0000000..1b6c93a
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk.old/CTG.0.var differ
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/CTG.ifo b/test/minimus/zgene/zgene2-output.bnk.old/CTG.ifo
new file mode 100644
index 0000000..3c1fbae
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk.old/CTG.ifo
@@ -0,0 +1,9 @@
+____CTG BANK INFORMATION____
+bank version = 2.8
+bank type = 4674627
+objects = 16
+indices = 16
+bytes/index = 22
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/CTG.map b/test/minimus/zgene/zgene2-output.bnk.old/CTG.map
new file mode 100644
index 0000000..0da6b12
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk.old/CTG.map
@@ -0,0 +1,17 @@
+CTG 16
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/LAY.0.fix b/test/minimus/zgene/zgene2-output.bnk.old/LAY.0.fix
new file mode 100644
index 0000000..1b42f5e
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk.old/LAY.0.fix differ
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/LAY.0.var b/test/minimus/zgene/zgene2-output.bnk.old/LAY.0.var
new file mode 100644
index 0000000..7180a1d
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk.old/LAY.0.var differ
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/LAY.ifo b/test/minimus/zgene/zgene2-output.bnk.old/LAY.ifo
new file mode 100644
index 0000000..b28609f
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk.old/LAY.ifo
@@ -0,0 +1,9 @@
+____LAY BANK INFORMATION____
+bank version = 2.8
+bank type = 5849420
+objects = 16
+indices = 16
+bytes/index = 18
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/LAY.map b/test/minimus/zgene/zgene2-output.bnk.old/LAY.map
new file mode 100644
index 0000000..7692da8
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk.old/LAY.map
@@ -0,0 +1 @@
+LAY 0
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/OVL.0.fix b/test/minimus/zgene/zgene2-output.bnk.old/OVL.0.fix
new file mode 100644
index 0000000..41b188c
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk.old/OVL.0.fix differ
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/OVL.0.var b/test/minimus/zgene/zgene2-output.bnk.old/OVL.0.var
new file mode 100644
index 0000000..ceac492
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk.old/OVL.0.var differ
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/OVL.ifo b/test/minimus/zgene/zgene2-output.bnk.old/OVL.ifo
new file mode 100644
index 0000000..a4d40f8
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk.old/OVL.ifo
@@ -0,0 +1,9 @@
+____OVL BANK INFORMATION____
+bank version = 2.8
+bank type = 5002831
+objects = 779
+indices = 779
+bytes/index = 34
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/OVL.map b/test/minimus/zgene/zgene2-output.bnk.old/OVL.map
new file mode 100644
index 0000000..6dc3395
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk.old/OVL.map
@@ -0,0 +1 @@
+OVL 0
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/RED.0.fix b/test/minimus/zgene/zgene2-output.bnk.old/RED.0.fix
new file mode 100644
index 0000000..b554652
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk.old/RED.0.fix differ
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/RED.0.var b/test/minimus/zgene/zgene2-output.bnk.old/RED.0.var
new file mode 100644
index 0000000..706e854
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk.old/RED.0.var differ
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/RED.ifo b/test/minimus/zgene/zgene2-output.bnk.old/RED.ifo
new file mode 100644
index 0000000..7050544
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk.old/RED.ifo
@@ -0,0 +1,9 @@
+____RED BANK INFORMATION____
+bank version = 2.8
+bank type = 4474194
+objects = 153
+indices = 153
+bytes/index = 55
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/RED.map b/test/minimus/zgene/zgene2-output.bnk.old/RED.map
new file mode 100644
index 0000000..cc5798e
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk.old/RED.map
@@ -0,0 +1,154 @@
+RED 153
+1 1 zfishG-a2661d04.q1c
+2 2 zfishI-a72c06.p1c
+3 3 zfishC-a186h03.p1c
+4 4 zfishC-a186h03.q1c
+5 5 Z35723-a1108d01.q1c
+6 6 Z35723-a1166g11.q1c
+7 7 Z35723-a1386e10.q1c
+8 8 Z35723-a2265d03.q1c
+9 9 Z35723-a2670f01.q1c
+10 10 zfishB-a2363g12.p1c
+11 11 zfish-Ja871b12.p1c
+12 12 Z35723-a4033a11.p1c
+13 13 ZfishJ-a1224d01.p1c
+14 14 Z35724-a43c06.q1c
+15 15 Z35724-a939a11.q1c
+16 16 Z35725-a1624h06.q1c
+17 17 Z35725-a2451d04.q1c
+18 18 zfish35934-618c07.p1c
+19 19 zfish35935-867d02.p1c
+20 20 Z35725-a4990c08.q1c
+21 21 Z35725-a2723a07.q1c
+22 22 Z35725-a4262h12.p1c
+23 23 zfishJ-a1618g07.q1c
+24 24 Z35724-a4493f05.p1c
+25 25 Z37249-a879d08.p1c
+26 26 Z35724-a5018a04.p1c
+27 27 Z35724-a5061b04.q1c
+28 28 Zfish35936-361d06.p1c
+29 29 Zfish35936-498b08.q1c
+30 30 Z35725-a875b07.q1c
+31 31 Zfish35937-106h01.p1c
+32 32 zfish41359-578a11.p1c
+33 33 zfish41361-361g04.p1c
+34 34 Zfish37251-3543e11.p1k
+35 35 Zfish44625-1002a03.p1c
+36 36 Zfish44625-1390e06.q1c
+37 37 Zfish44625-1404f05.p1c
+38 38 Zfish44625-2317e06.q1c
+39 39 Zfish44625-3247c04.q1k
+40 40 zfish44906-116d04.p1k
+41 41 zfish44906-511d11.q1k
+42 42 zfish44907-178g11.q1k
+43 43 zfish44907-380d11.p1k
+44 44 zfish44907-1567g01.p1k
+45 45 zfish44907-916g10.p1k
+46 46 zfish44907-2086c11.p1k
+47 47 zfish44907-2216h07.p1k
+48 48 zfish44907-3109g10.p1k
+49 49 zfish44907-3066f07.p1k
+50 50 zfish44908-398f07.q1k
+51 51 zfish44908-1076a02.p1k
+52 52 zfish44910-670h12.p1k
+53 53 zfish44909-1485f11.q1k
+54 54 zfish44909-1711d01.p1k
+55 55 zfish44909-2083g05.p1k
+56 56 zfish45283-1667d08.p1k
+57 57 a-37250859e01.p1c
+58 58 zfish43795-610h09.p1c
+59 59 Zfish37251-2879h11.p1c
+60 60 zfish45283-535c05.q1k
+61 61 zfish43929-176n20.q1k
+62 62 ZfishFos603c08.p1k
+63 63 ZfishFos424g06.q1k
+64 64 zfish43929-321m23.p1k
+65 65 zfish43929-344a15.q1k
+66 66 zf37276-263e04.p1k
+67 67 zf37276-272b06.q1k
+68 68 ZfishFos1395g12.p1k
+69 69 zf37276-818p14.q1k
+70 70 ZfishFos2520c02.q1k
+71 71 ZfishFos2880g11.p1k
+72 72 zDH63-102m11.q1k
+73 73 zDH63-73k18.q1k
+74 74 zDH63-179j24.q1k
+75 75 zDH62-110i20.q1k
+76 76 zDH62-283b13.p1k
+77 77 zDH63-1230b14.p1k
+78 78 zDH63-1351g09.p1k
+79 79 zDH62-691d23.p1k
+80 80 zDH62-692b07.q1k
+81 81 zDH63-36j03.q1k
+82 82 ZDH88-152b21.p1k
+83 83 zDH62-917l23.q1k
+84 84 zDH63-621b07.p1k
+85 85 zDH62-1134p01.p1k
+86 86 zDH64-614i02.p1k
+87 87 Zdh24-61d24.p1k
+88 88 zDH22-213h20.q1k
+89 89 zDH22-229f07.q1k
+90 90 Zdh24-339i14.q1k
+91 91 Zdh24-84h24.q1k
+92 92 Zdh24-512a06.q1k
+93 93 zDH61-1372b03.p1k
+94 94 zDH25-155a18.q1k
+95 95 zDH77-77a21.q1k
+96 96 Zdh76-12n07.p1k
+97 97 zDH23-205m08.p1k
+98 98 ZDH51_49i11.q1k
+99 99 ZDH51_192d17.p1k
+100 100 ZDH51_6g24.p1k
+101 101 ZDH51_468l03.p1k
+102 102 ZDH51_901l16.p1k
+103 103 ZDH51_977d16.p1k
+104 104 ZDH51_470a08.p1k
+105 105 zDH53-234d09.p1k
+106 106 zDH54-171n05.p1k
+107 107 zDH52-513a01.q1ka
+108 108 zDH52-125e06.p1k
+109 109 zDH52-1022f08.q1k
+110 110 zDH52-940l03.q1k
+111 111 zDH52-1289d08.p1k
+112 112 zDH52-970g14.q1k
+113 113 zDH52-887e07.q1k
+114 114 zDH40-924o11.q1k
+115 115 zDH41-20f07.p1k
+116 116 zDH40-257l09.p1k
+117 117 zDH41-8i02.p1k
+118 118 zDH41-767i19.q1k
+119 119 zDH41-114b04.p1k
+120 120 zDH41-477l17.p1k
+121 121 ZDH42-47d24.p1k
+122 122 ZDH42-47h16.p1k
+123 123 ZDH42-44k03.p1k
+124 124 zDH41-119o22.q1k
+125 125 zDH41-1075i12.p1k
+126 126 zDH41-1238o07.p1k
+127 127 zDH41-1254i17.p1k
+128 128 zDH41-1106h04.p1k
+129 129 zDH41-1244f05.p1k
+130 130 zDH41-1123j17.q1k
+131 131 zDH41-1308f17.q1k
+132 132 zDH06-285a19.q1k
+133 133 zDH006-297n22.p1k
+134 134 zDH006-285n20.q1k
+135 135 zDH006-324p17.p1k
+136 136 zDH006-739g13.q1k
+137 137 zDH006-921d02.p1k
+138 138 zDH07-216b23.p1k
+139 139 zDH07-123j18.p1k
+140 140 zDH07-571c18.p1k
+141 141 zDH07-1270k22.q1k
+142 142 zDH07-1694m12.p1k
+143 143 zDH07-1683h21.q1k
+144 144 zDH07-1235p07.q1k
+145 145 zDH07-1264j06.q1k
+146 146 zDH07-1678a11.p1k
+147 147 zDH07-1376e20.q1k
+148 148 zDH07-857n22.q1k
+149 149 zDH07-1601l07.q1k
+150 150 zDH07-1865p03.p1k
+151 151 zDH07-1576k16.q1k
+152 152 zDH07-2164d11.q1k
+153 153 zDH07-2057n12.p1k
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/UNV.0.fix b/test/minimus/zgene/zgene2-output.bnk.old/UNV.0.fix
new file mode 100644
index 0000000..404a59a
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk.old/UNV.0.fix differ
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/UNV.0.var b/test/minimus/zgene/zgene2-output.bnk.old/UNV.0.var
new file mode 100644
index 0000000..9f3a5c2
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk.old/UNV.0.var differ
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/UNV.ifo b/test/minimus/zgene/zgene2-output.bnk.old/UNV.ifo
new file mode 100644
index 0000000..db2813a
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk.old/UNV.ifo
@@ -0,0 +1,9 @@
+____UNV BANK INFORMATION____
+bank version = 2.8
+bank type = 5656149
+objects = 1
+indices = 1
+bytes/index = 14
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/zgene/zgene2-output.bnk.old/UNV.map b/test/minimus/zgene/zgene2-output.bnk.old/UNV.map
new file mode 100644
index 0000000..96a76ba
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk.old/UNV.map
@@ -0,0 +1,2 @@
+UNV 1
+1 1
diff --git a/test/minimus/zgene/zgene2-output.bnk/CTG.0.0.fix b/test/minimus/zgene/zgene2-output.bnk/CTG.0.0.fix
new file mode 100644
index 0000000..eac3b0c
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk/CTG.0.0.fix differ
diff --git a/test/minimus/zgene/zgene2-output.bnk/CTG.0.0.var b/test/minimus/zgene/zgene2-output.bnk/CTG.0.0.var
new file mode 100644
index 0000000..5dfc972
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk/CTG.0.0.var differ
diff --git a/test/minimus/zgene/zgene2-output.bnk/CTG.0.map b/test/minimus/zgene/zgene2-output.bnk/CTG.0.map
new file mode 100644
index 0000000..0da6b12
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk/CTG.0.map
@@ -0,0 +1,17 @@
+CTG 16
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
diff --git a/test/minimus/zgene/zgene2-output.bnk/CTG.ifo b/test/minimus/zgene/zgene2-output.bnk/CTG.ifo
new file mode 100644
index 0000000..3f66d27
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk/CTG.ifo
@@ -0,0 +1,10 @@
+____CTG BANK INFORMATION____
+bank version = 3.0
+bank type = 4674627
+versions = 1
+objects = 16
+indices = 16
+bytes/index = 26
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/zgene/zgene2-output.bnk/LAY.0.0.fix b/test/minimus/zgene/zgene2-output.bnk/LAY.0.0.fix
new file mode 100644
index 0000000..200d227
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk/LAY.0.0.fix differ
diff --git a/test/minimus/zgene/zgene2-output.bnk/LAY.0.0.var b/test/minimus/zgene/zgene2-output.bnk/LAY.0.0.var
new file mode 100644
index 0000000..c4ee108
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk/LAY.0.0.var differ
diff --git a/test/minimus/zgene/zgene2-output.bnk/LAY.0.map b/test/minimus/zgene/zgene2-output.bnk/LAY.0.map
new file mode 100644
index 0000000..7692da8
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk/LAY.0.map
@@ -0,0 +1 @@
+LAY 0
diff --git a/test/minimus/zgene/zgene2-output.bnk/LAY.ifo b/test/minimus/zgene/zgene2-output.bnk/LAY.ifo
new file mode 100644
index 0000000..b64ba82
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk/LAY.ifo
@@ -0,0 +1,10 @@
+____LAY BANK INFORMATION____
+bank version = 3.0
+bank type = 5849420
+versions = 1
+objects = 16
+indices = 16
+bytes/index = 18
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/zgene/zgene2-output.bnk/OVL.0.0.fix b/test/minimus/zgene/zgene2-output.bnk/OVL.0.0.fix
new file mode 100644
index 0000000..41b188c
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk/OVL.0.0.fix differ
diff --git a/test/minimus/zgene/zgene2-output.bnk/OVL.0.0.var b/test/minimus/zgene/zgene2-output.bnk/OVL.0.0.var
new file mode 100644
index 0000000..ceac492
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk/OVL.0.0.var differ
diff --git a/test/minimus/zgene/zgene2-output.bnk/OVL.0.map b/test/minimus/zgene/zgene2-output.bnk/OVL.0.map
new file mode 100644
index 0000000..6dc3395
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk/OVL.0.map
@@ -0,0 +1 @@
+OVL 0
diff --git a/test/minimus/zgene/zgene2-output.bnk/OVL.ifo b/test/minimus/zgene/zgene2-output.bnk/OVL.ifo
new file mode 100644
index 0000000..68f4c8e
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk/OVL.ifo
@@ -0,0 +1,10 @@
+____OVL BANK INFORMATION____
+bank version = 3.0
+bank type = 5002831
+versions = 1
+objects = 779
+indices = 779
+bytes/index = 34
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/zgene/zgene2-output.bnk/RED.0.0.fix b/test/minimus/zgene/zgene2-output.bnk/RED.0.0.fix
new file mode 100644
index 0000000..8bf5030
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk/RED.0.0.fix differ
diff --git a/test/minimus/zgene/zgene2-output.bnk/RED.0.0.var b/test/minimus/zgene/zgene2-output.bnk/RED.0.0.var
new file mode 100644
index 0000000..1b5e086
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk/RED.0.0.var differ
diff --git a/test/minimus/zgene/zgene2-output.bnk/RED.0.map b/test/minimus/zgene/zgene2-output.bnk/RED.0.map
new file mode 100644
index 0000000..cc5798e
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk/RED.0.map
@@ -0,0 +1,154 @@
+RED 153
+1 1 zfishG-a2661d04.q1c
+2 2 zfishI-a72c06.p1c
+3 3 zfishC-a186h03.p1c
+4 4 zfishC-a186h03.q1c
+5 5 Z35723-a1108d01.q1c
+6 6 Z35723-a1166g11.q1c
+7 7 Z35723-a1386e10.q1c
+8 8 Z35723-a2265d03.q1c
+9 9 Z35723-a2670f01.q1c
+10 10 zfishB-a2363g12.p1c
+11 11 zfish-Ja871b12.p1c
+12 12 Z35723-a4033a11.p1c
+13 13 ZfishJ-a1224d01.p1c
+14 14 Z35724-a43c06.q1c
+15 15 Z35724-a939a11.q1c
+16 16 Z35725-a1624h06.q1c
+17 17 Z35725-a2451d04.q1c
+18 18 zfish35934-618c07.p1c
+19 19 zfish35935-867d02.p1c
+20 20 Z35725-a4990c08.q1c
+21 21 Z35725-a2723a07.q1c
+22 22 Z35725-a4262h12.p1c
+23 23 zfishJ-a1618g07.q1c
+24 24 Z35724-a4493f05.p1c
+25 25 Z37249-a879d08.p1c
+26 26 Z35724-a5018a04.p1c
+27 27 Z35724-a5061b04.q1c
+28 28 Zfish35936-361d06.p1c
+29 29 Zfish35936-498b08.q1c
+30 30 Z35725-a875b07.q1c
+31 31 Zfish35937-106h01.p1c
+32 32 zfish41359-578a11.p1c
+33 33 zfish41361-361g04.p1c
+34 34 Zfish37251-3543e11.p1k
+35 35 Zfish44625-1002a03.p1c
+36 36 Zfish44625-1390e06.q1c
+37 37 Zfish44625-1404f05.p1c
+38 38 Zfish44625-2317e06.q1c
+39 39 Zfish44625-3247c04.q1k
+40 40 zfish44906-116d04.p1k
+41 41 zfish44906-511d11.q1k
+42 42 zfish44907-178g11.q1k
+43 43 zfish44907-380d11.p1k
+44 44 zfish44907-1567g01.p1k
+45 45 zfish44907-916g10.p1k
+46 46 zfish44907-2086c11.p1k
+47 47 zfish44907-2216h07.p1k
+48 48 zfish44907-3109g10.p1k
+49 49 zfish44907-3066f07.p1k
+50 50 zfish44908-398f07.q1k
+51 51 zfish44908-1076a02.p1k
+52 52 zfish44910-670h12.p1k
+53 53 zfish44909-1485f11.q1k
+54 54 zfish44909-1711d01.p1k
+55 55 zfish44909-2083g05.p1k
+56 56 zfish45283-1667d08.p1k
+57 57 a-37250859e01.p1c
+58 58 zfish43795-610h09.p1c
+59 59 Zfish37251-2879h11.p1c
+60 60 zfish45283-535c05.q1k
+61 61 zfish43929-176n20.q1k
+62 62 ZfishFos603c08.p1k
+63 63 ZfishFos424g06.q1k
+64 64 zfish43929-321m23.p1k
+65 65 zfish43929-344a15.q1k
+66 66 zf37276-263e04.p1k
+67 67 zf37276-272b06.q1k
+68 68 ZfishFos1395g12.p1k
+69 69 zf37276-818p14.q1k
+70 70 ZfishFos2520c02.q1k
+71 71 ZfishFos2880g11.p1k
+72 72 zDH63-102m11.q1k
+73 73 zDH63-73k18.q1k
+74 74 zDH63-179j24.q1k
+75 75 zDH62-110i20.q1k
+76 76 zDH62-283b13.p1k
+77 77 zDH63-1230b14.p1k
+78 78 zDH63-1351g09.p1k
+79 79 zDH62-691d23.p1k
+80 80 zDH62-692b07.q1k
+81 81 zDH63-36j03.q1k
+82 82 ZDH88-152b21.p1k
+83 83 zDH62-917l23.q1k
+84 84 zDH63-621b07.p1k
+85 85 zDH62-1134p01.p1k
+86 86 zDH64-614i02.p1k
+87 87 Zdh24-61d24.p1k
+88 88 zDH22-213h20.q1k
+89 89 zDH22-229f07.q1k
+90 90 Zdh24-339i14.q1k
+91 91 Zdh24-84h24.q1k
+92 92 Zdh24-512a06.q1k
+93 93 zDH61-1372b03.p1k
+94 94 zDH25-155a18.q1k
+95 95 zDH77-77a21.q1k
+96 96 Zdh76-12n07.p1k
+97 97 zDH23-205m08.p1k
+98 98 ZDH51_49i11.q1k
+99 99 ZDH51_192d17.p1k
+100 100 ZDH51_6g24.p1k
+101 101 ZDH51_468l03.p1k
+102 102 ZDH51_901l16.p1k
+103 103 ZDH51_977d16.p1k
+104 104 ZDH51_470a08.p1k
+105 105 zDH53-234d09.p1k
+106 106 zDH54-171n05.p1k
+107 107 zDH52-513a01.q1ka
+108 108 zDH52-125e06.p1k
+109 109 zDH52-1022f08.q1k
+110 110 zDH52-940l03.q1k
+111 111 zDH52-1289d08.p1k
+112 112 zDH52-970g14.q1k
+113 113 zDH52-887e07.q1k
+114 114 zDH40-924o11.q1k
+115 115 zDH41-20f07.p1k
+116 116 zDH40-257l09.p1k
+117 117 zDH41-8i02.p1k
+118 118 zDH41-767i19.q1k
+119 119 zDH41-114b04.p1k
+120 120 zDH41-477l17.p1k
+121 121 ZDH42-47d24.p1k
+122 122 ZDH42-47h16.p1k
+123 123 ZDH42-44k03.p1k
+124 124 zDH41-119o22.q1k
+125 125 zDH41-1075i12.p1k
+126 126 zDH41-1238o07.p1k
+127 127 zDH41-1254i17.p1k
+128 128 zDH41-1106h04.p1k
+129 129 zDH41-1244f05.p1k
+130 130 zDH41-1123j17.q1k
+131 131 zDH41-1308f17.q1k
+132 132 zDH06-285a19.q1k
+133 133 zDH006-297n22.p1k
+134 134 zDH006-285n20.q1k
+135 135 zDH006-324p17.p1k
+136 136 zDH006-739g13.q1k
+137 137 zDH006-921d02.p1k
+138 138 zDH07-216b23.p1k
+139 139 zDH07-123j18.p1k
+140 140 zDH07-571c18.p1k
+141 141 zDH07-1270k22.q1k
+142 142 zDH07-1694m12.p1k
+143 143 zDH07-1683h21.q1k
+144 144 zDH07-1235p07.q1k
+145 145 zDH07-1264j06.q1k
+146 146 zDH07-1678a11.p1k
+147 147 zDH07-1376e20.q1k
+148 148 zDH07-857n22.q1k
+149 149 zDH07-1601l07.q1k
+150 150 zDH07-1865p03.p1k
+151 151 zDH07-1576k16.q1k
+152 152 zDH07-2164d11.q1k
+153 153 zDH07-2057n12.p1k
diff --git a/test/minimus/zgene/zgene2-output.bnk/RED.ifo b/test/minimus/zgene/zgene2-output.bnk/RED.ifo
new file mode 100644
index 0000000..b78d136
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk/RED.ifo
@@ -0,0 +1,10 @@
+____RED BANK INFORMATION____
+bank version = 3.0
+bank type = 4474194
+versions = 1
+objects = 153
+indices = 153
+bytes/index = 55
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/zgene/zgene2-output.bnk/UNV.0.0.fix b/test/minimus/zgene/zgene2-output.bnk/UNV.0.0.fix
new file mode 100644
index 0000000..404a59a
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk/UNV.0.0.fix differ
diff --git a/test/minimus/zgene/zgene2-output.bnk/UNV.0.0.var b/test/minimus/zgene/zgene2-output.bnk/UNV.0.0.var
new file mode 100644
index 0000000..9f3a5c2
Binary files /dev/null and b/test/minimus/zgene/zgene2-output.bnk/UNV.0.0.var differ
diff --git a/test/minimus/zgene/zgene2-output.bnk/UNV.0.map b/test/minimus/zgene/zgene2-output.bnk/UNV.0.map
new file mode 100644
index 0000000..96a76ba
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk/UNV.0.map
@@ -0,0 +1,2 @@
+UNV 1
+1 1
diff --git a/test/minimus/zgene/zgene2-output.bnk/UNV.ifo b/test/minimus/zgene/zgene2-output.bnk/UNV.ifo
new file mode 100644
index 0000000..fc82cba
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.bnk/UNV.ifo
@@ -0,0 +1,10 @@
+____UNV BANK INFORMATION____
+bank version = 3.0
+bank type = 5656149
+versions = 1
+objects = 1
+indices = 1
+bytes/index = 14
+partitions = 1
+indices/partition = 1000000
+locks =
diff --git a/test/minimus/zgene/zgene2-output.fasta b/test/minimus/zgene/zgene2-output.fasta
new file mode 100644
index 0000000..4d3f059
--- /dev/null
+++ b/test/minimus/zgene/zgene2-output.fasta
@@ -0,0 +1,373 @@
+>1
+AGAGTGCAGAGCAACAAAAACAGCATACAGAAGTATAAATGCACAGTTACGCGCAAGACA
+GGTGCTGTGGGTCACGGCAATCACTCGACACAGAAGTATAAACCAGCCCTAACCCCGGCA
+TCCTGGCCAAATTACCTCCGGTCCTTACCCATCATGGCCTCCCAATCATCCCCATCCACC
+AAATTAGCTGTATCACTTTCTCTTCACTCCACCTATAGCTGGTGTGTGGTGAGCGCACTG
+GCGCTGTTGTCATGTTGGTACGGTCACATCATCCAAGTGGATTCTGCACACTGGGGGTGG
+TGTGAAGGGATCCCTGTCATGATTGTGGAGCTCTTTGGGTGTATGGCCATACACGATAAA
+TGGGCTACATAAATACACACATATTACATTTCAGCACATTATCACTGTGGTGTTGAAATG
+TAACTAAAATCAAACTTTATAGTTACTCAATCTCTCTTTTCTGTCTTTTTTCAGAGGCTT
+TTGACATGGTGCTTCGTCTGGGCCGTAATTCCACTCTGATGGTGTTACGCGAGGAGTTTC
+CTGGTTTGGGGGCTGGAGCCAGTGGAGCCGTCACGCAGTTATTCCTGGATATGTCACTTT
+ACATTCTGGGCTCTGATGCCAATGTAAACGACATGGTCTCCACCTTCTTCTCTCGCCTTT
+TCCCTCTCACCTACCGTCGACTTCTGGGCAATGGGGCCGTGGCGGGCATCTCTGAAGAAT
+GCCTCCGCGGGGCCTGGAAAGGGAGCTCTGCGTATGGGTCATTTCCCAAGATGATGATGA
+CCCGACTATCCCGCTCACTCCTCGCCACTCGGGTCTTCCTGCAAGCGCTAAATTTGGGCA
+TAGAAGTGGTCAACACCACTCAGCATTTGCGGGCAGGTAGAGATTGTGGGCGCTCGCTTC
+TGAAACTGTGGTACTGCCCGCACTGTCAAAGCCTGCTGGAGGCCCGGCCGTGCCGTCCAC
+TGTGTATCAGCACCATGGGAGCATGTTTGGGGGGAACCACGGAGGTACAGCCTCATTGGA
+GAGCATATGTGGATGAACTGGGGTCACTCGCCGCTGCCATGAAGGGGGAACAGGACATCG
+AGGCTGTGGTGCTCCGACTGCACGTCATTATCAGACAGGCTCTCAAACAAGCCGTGGCAA
+GCAAGAGCAAAGTCAGCGCCCAGGTGAGTGACACATGGTCTCAGAAACAAGGTATGAATT
+CGAATGCTGTAGGCGACTGCAGCCATTTTGCTAACTTCAGCCATTTTTGCTAACGCCATC
+TCTCTCCAAAACTCAACCTCCAAAGACTTGTCAGCAAAGTCAGTGTCAGCAGACCCGAAC
+GAGTGAAATGAAGAGTGTTTCTGACTGGCTAGTTTTCTGATTGAGCCCAGGGCTATCAAA
+CTCAAAAAACTGTCGAGATTTCTCAGGACACCTTTTTTAGTTAGTACTTCAGTTTACATG
+AAAGTTCTTGTCAAGGTATTGCAGGTTTTTAATCACCAGGCTTTATTTTATCATTGATCT
+GTCAACATGATAACATAACATTTACTTTA
+>2
+TTTTTCTTATTTTTCCTTTGTTTTTTTTGATTGTTTGGGTTTTTACCAAAATCTGGTTTC
+ATTTCAAGCAGCTCCATTTTGAATATTTTCCCCAGAAAAACAAAAATAAAAAACAAGATA
+TGTTGAATGCTTATTTCCCCCACTGTAAGTAAGTTCTTTATGCAAACTTGACACATTTTT
+TCGACCAAATCAAAAGTAATGTTGTACAATGCATTCAATTGGTTGGACTCGTGTTATATT
+ACCATCAATCATATTTTCATCAGACACCACACTGAAAAATTCTTCCAACAGACAAAAATC
+CTTGGGAAAACATGAGCTTTGAAAATTAAATGTGACCTTAAGCTATTCCAAATTATTTAT
+CAGGCTATACTCATTCCCTTGTGCGCTCATTTTTATTTACACATGCCATGTACCTTGGCA
+AGGCTCCAAAGTAACCACAATGATGTGGAACAGTTATTCTGCACCGCTGCAAGCATACAG
+AAGAACTATTAATCTTAGTTTACATGTCTGCAAACTGAATGACGCCACCTAATGAACTTA
+CTCACGTTTTAATGAACATCAATGCCCTTACTTTGAGCTGTAGGAGTCCACAATGAAGGA
+ATGTAGAGGTTACATCGCATCAATGCTCCCACAAATGAATTACTCACTTGTCTGTCATCT
+CCTGTCCGTTCCAGCAGAGGGAGCTGTTCAGCGATGTCGGCTCTTTGCTGCACAAAGCTT
+CTCCGAGACCACTGTAGAACTGACTGAAGCCCCTTAGACCCGAGATAAACTCCCTGCATC
+AGACAGAGAGGAAATTGAGAATGTATTGAGTGCAGGCGAAAGAAGAAAGAGGAATGGGCT
+TCAGTGAAAATTGAAATTAGATGGTGTGCACAAAGAGACAAGATTAAGAATCCAAAATAC
+TTGGATTTATGAGAAAATGTAGAGGCTTAGAGAAAGAAGAACGACGAATCAGGAGAAAAA
+AATAGAGTTGGGGTCAAATGCAGTGTTAAGCACGATCTACTCCATTACATATCATTTCCT
+GTCGGGCTAAGTTGCTTTGAGATGCTTTGATTTTAATTGACATTACCTACACACACTCTC
+TCACCTGCTCATCAGAGCGAGGGAACGAGAGAGAGGAACCGTACAGGACAGAGGGGGCAG
+AAGGCAGCTCAATGTCACTCACACGGCAGGAGACAAAGCCTGTGTTAATGAGCTTCTCTC
+TGTCACCATCAGCCTGAACACACACTCACCTCAGCTAACAGCCCAAACACACAAACACAA
+CTCATACACAAACTGCCACACACAACGACTCAGACACCCACCTACTCAGACATGTGCCAC
+CTCAAAGTTTGAAAGCAACTTCCCTTAGTAACTATGTTTTAGATGATTCATATTTTATAA
+AGTCCTTTTAAAA
+>3
+GTCGAAATAACTTATTTCAGTATAGTAACTCATTTGTAATATATAGACATGTCGAAGTAA
+CTTATTTCAGCAAAGTAACGCATACCTAATATATCGGTATGTCAAAATAATGAGATATAT
+TGTCATAATAAGTTGTTCTTTTTTATTTTAGTATTTATACATCTATACATTTTTTTAGAT
+TTCTTCTTGGAGCTGCTGGAGAGCGCCGAGCGCTCTCTGAACGAGATGTTTGTCCGCACT
+TACGGTAAACCGTACCTGCAGAACGCAGAGGTCTTCCAGAGCCTGTTCTCGGAGCTGCGG
+CGTTTTTACACCGGCGGAAACGTCAACCTGGAGGAGATGCTAAAGGACTTCTGGACACGA
+TTACTAGAGCGCATGTTTCAGCTGCTCAACTCTCAGTTTCAGATCACGGACGAATATTTG
+GAGTGCATCGGTAAATACACGGAGCAGCTGCGGCCGTTTGGAGATGTGCCTAAAAAGCTG
+AAATCACAGGTGACTCGCGCGTTTATTGCGGCGCGCACATTCGTACAGGGACTTGCGGTC
+GGACGTGACGTCGCTAACAGAGTCGCTCAGGTGAGATGAAAAAACCCTAAATTGTGTTTG
+TGACTTTTTTTTTATATCATTTTATTTTATGACCCCCAACCTCTTCTTGAAATTTTTTTT
+TCTTCTCTAAATAATTTTTTTGTTCTCTAACTTTTTTTATTTATTTATTTATTTTTAAAA
+GTTATATTCAATTGTACGAATCAAAACTATGAGACATCCAGTGTCAGGCTGTAGCATCAC
+TACAAGTAGTGTGGTGACTGTTGTATTATTGCCGTGTGTGTGTGTGCGCAGGTCAGCATG
+AGCTCGTCGTGTGTCAGCGGCTTCACGAAGATGCTCTACTGCTCGTATTGTCAGGGTCTG
+TTCACACTGAAGCCCTGCAGAAACTACTGTCTGAATGTCATGAAGGGCTGCTTGGCAAAC
+CAGGCCGATCTCAACAACGAATGGAGCAAATTTATCGGTAAGAGGAACACACACACCTCG
+AGCACACACACATTTATACAGGGTTTTGATGAGGTCAGTAACCTGTATGCTTGGCTGTTC
+TGTATGTAAACTACAGCACAATTAACAAAAGCACAGATGCATCATAAAACAGTCTTCAGA
+CACAATGATTCTGACGGATGGATTGATGGACGGAGAGATGCATTGCTTGATAGAATTATG
+GATTGATTGATGGCTAGATTTATGGGTTGACAGATTTATGGATGAATGTATGGACGGATA
+GATGGATTAATTGATAGATTTATGGATGGATGGATGGATGGAGGGGTAGATAGATGTGGG
+GATGGATCGATGGATAGAATTATGGATAGATGGATGAATGGATTGGATGGATGGATGGAT
+TTATGGATGGACTGATGGATGCATTGATGGATAGATTTCTGGATGAATGGATACATTGGT
+TGACAGATGTTTGAATGGATTTATTGATGGACTGATTTATGGATAAATGTATGGACGGAT
+GGATTTATGGATAGATTTATGGATGGACTGATGGATGGATGGATGGATGGATGAATGGAT
+GGATGGATAGCTGTATGTATGGATAGATGTATGGACAGATAAATGGATTAAGGGATGGAC
+TAATGATGCGTCGACAAATGGATGGATGGATGGATGGATTGATGGATAGGTTTATGGATG
+AATGGATAGATGGATTTATGGATAGA
+>4
+GAACAGGAGCGGCAGCAGAACAGAGCGGGAACGCTTCACTGATACAGCTGATATGACATA
+TGTGTTATATGGGTGTCACATAGTCCTAACCCTTCCTCATATGTGTTTGTTTTGGTTCAT
+CTTCTAGAGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTTTTCTTCACC
+TTAGCAGAGATGCTGATGCTGTTCTCTTGCATGTTCATGATGCCTTCAGAAACCGTCACA
+GCGATGGCGTCCGCAGCCAGCTCAAAGTTAAACGGCCCGCCGAGTTTCTCCACCACCACT
+GTCAGAGCATCTGCAGGACACACACACACACATCAGACACACACACACATCAGACACACA
+CACACACACACACACACACACACACATCAGACACATAGCGGACACACACACACACACACA
+CACATCAGACACATAGCGGACATACACACACACACACACAGCGGACACACACACACACAC
+ACACACAGCGGACACACACACACACACACACACAGTAAATGAAGCAGAGGTGTTCTGTTC
+TCACCAATGAAGCTGTTCCACTCGCTGTTTAGATCCGCCTGATTGGCCAGACAGCCCTTC
+ATGATGTTCAGGCACAGCGAATGACAGGGCTTGAGTGACGGAAGACCCCGACACAGAGGA
+CAGAACCACTGACGCATGAGCGCGCGCACACACTCTGGCCCCGCGCGCAGCTACACACAC
+ATAGAGAGAGACACACACACACACACACACCAGTGGCTGTGAGTGAGGCTGCAGGAGCAC
+AGAGCTCTGCTGGATCTGACTGAAGATGGTGATGAAGATGGTGAAGCTCTGCATTAACCC
+TCCTCCTCCTCCTCCTCCTCCTCCTCCTCCTCATCACTCATTGATGCTCAGTAAATGCAG
+GAGTGATGGATTGTGGGATTGATGAGTTT
+>5
+AAAGCATATGCTGGATAAATTGCGGTTCATTCTGCTGTGGCAACCCCTGATTAATAAGGG
+GACTAAGCTGAAATTTTTTTTTTGTTAAATACCATCTGAACGTGGAAAACTTAATCAATA
+GCCAGCCCTAAAGCAAATTTGGCAAATCGTAGTTTTTAAGCGAGTCAGCAGAAATGAAAA
+GTAAAGGTTTTCTATCAGGTTATCAGTATGTGAAGGTGGACACCTGGATGGACCAATCAA
+GGCTTATCTTCTAGCATTAAAAGATCAGAGGCCAAGGCTTTCTCTTTCTCTGTGTGTGTG
+TGTTGTGAGTTAGCAGAAGCAATTGAACCTTCAATGATAAATTGAGCAAACACGAGTTCA
+GCAGTGACCTTATAAAAGGTGGTGGGGTCGCTAATGCTCTTTGTTCAGTGTTTTATCAGC
+AACATCAGGCATATGAATTAGGTTACGGACTCATTAACCTTTTCTGTCTGTTTTGCTGAC
+TCTGCTCAATTACTCTTCCTGTTCGTCCTTTTTCTCAGGTGAGCGCCTCACCGAGCTGTG
+TGCGCGCATCGATGAAGATGTTATACTGCCCGTACTGTAGCGGTCAGGTGGCGCTGAAGC
+CCTGCAAGAACTACTGTCTGAATGTCATGAGGGGCTGTCTGGCCAATCAGGCCGATCTGG
+ACACAGAGTGGAATAACTTCCTTGGTAAGAAAGACCTGCAGTATTAACATGCTTTAAATG
+TGTCCGCAATTATTAGCCCTCCTTAATTGTTAGTTCCTCTGTATATATTTTTTCCCACAT
+ATTCTCGTTTATCAGAAAGATTTTTTTTAACACTTTTCTAAATATAATAGTTTCAGTAAC
+TCATTTCTAATATCTGATATCTTTTATCTTTGCCATGATGACAGTAAATACATTTCTACT
+GAATATTCATCAACATCCAAGTATTCAGTCCTTAACTATGTTAACTAGGCAAGTTAGTGT
+TATTAGTAGGAATGTGATGTGATTTTTTCCAAGCTCAATGGGGTGACCCCTGTAATTTGC
+ATAAATCCAAAGTATTTTTTTTTTTTTTTGAGGTGGTGGGGTGTCTACATGCAGATGACC
+TGCTTCATTTCAGATGTCTTTCAGGGATGTAATTGTAGACTTACCTAGGCTACTGTGTTT
+TTAACATAATAATATTGTGTAGTGCTATAATGTGAGGAAGCCGCTGACAATATGCAAGAT
+AA
+>6
+GCTAATAATAAACCCCTTGCAGATAGAATAATCATAGGGCTTCGTTTTACACAATTTAGA
+ACTGAAAACTTTAGGCTAAAATGCGAATTTATACAAGTTATTTATTTTAGATTAAAGCCA
+AAACGTCTTAAATGTGCAAAACGGCAGCCTTGTAACTGCACAGACTACGATTGGTCGAGA
+CATTTGATATGCACCAGTCACCAAACATGCTGCTTCAAGTGCATGCCCACTAGAACTGAT
+TAGTCCAACACATGGTGCAGCTCGTTCGTGGAATAAAAATAAATGTGTTCTATGAATCAG
+AGAGTAGCATGACTCACCACGGCGCTAAGATGTGGCCCGTGCAGTTGCGCAGTGAGGATG
+GCATCATTAATTCTTTCCCGGATGCGTAGAAGTCCCAGTTCCACTTCATATCTCTCTGAT
+AATGCCCCACTCAGCTTCTCCAGAAGCGATACATAGTCTCGCCAGGGAGCATCCAGCTCA
+GCCACGCCTGCCAGGCAACCTCGCATCACGTTGAGACATAGGCCTCCACATGGCCGGATC
+AGGGTCAGTCCTCGACAGTGAGGACAGAACAACATGCGCACTAGTGCACGTCCACACACT
+CGTCCCATGCCCACAGACTCTGTGATGTTAAGTACATCTGCACCGACTGCCAGTGCCCGG
+CTGAGGGCACGACCAACCACAAGCGCCTTGGACAGTCCTTGAGCAAGTTCTTGTGGGTGA
+TGGCCAAAGGGATAGATATCATGCCGTGTGGCACGAAGGCACTCAGTTCCTTCGGCAGAC
+CAGGTTGAAACAGGTGAACCCAAGCCAGGATTGACCAGATGCTGGTACACCAATGGGAAG
+AGTTTGTCATAAAATCTGTAAACCGAGTGTTCCACAGAAACGTTATCATCGCCTCGAAGG
+TAGAGATCAAGGTCATTGAAGAGGGTGGACACCAGTGGTCTTGCATCTTGGGAGATTGTC
+TCGTAGGTGGTGTCGAAAAGTGAGTTGGTATGATTTAGAGTGAACGAGAGCAGGGAATGG
+AAGGTATCTGTGGGAAGAGGAAATAAAAGAAAGATTTTGGACTGAAGAAGCACTGAAAAA
+GACCTCCACGAACAGCTATTTCATAGTCATCTTAGATGGATAAACATTCGTAACATGAGA
+GACTAACAATTGCTGTAATTTTGTTTGACATTTACGAGAGGGTCAAAGATACTAGTCTGT
+CATGGTGCACCTCTGCCTTGTCTCGCATTGCTTACGACTCTTTCTTGTGTATCTAATCTC
+TCTTTCCATTGGGCTAATGGGAGCTGACAACACTTAATCCATGGATCTTTTGGGCTGGCG
+CTATTGGGCTGAAGGTTAGTTTGGAGATATGTGACACGTGTGACTAGCTTATTACCAATT
+TTAGCAGTCAGGGCGTCATTTTATACCTCACTATGCCTATGGTCTTCAAATGGAAGTTGA
+GGATCATAGTCTGTTGTGCCTTATACATTATTTACAATGGCATATTAACATTTGTGTGAC
+AAGTGACAGATGGGTGCTTAAGTAGACAGCTGGTAGAACCCTTCAAAGTACAGTTTGCTT
+TAGTGTCATCTCATTCATAATGGCCAAAACATTCCAGCTCTGTCTGGTTTCTCTGTGAAT
+GGCCCAAATGCTAAGAATGAATCGAAAGTTATGATTG
+>7
+ATATGCGATGCATTTGCTGCGAACGTACGGATTTTGCCTCACTCACATCTCCATGTTTGG
+TGTGAACCCAGCAGTGTTGACCAATCAGGAAGGAGAAAACAGCGCGCACACTGATGTCGT
+GAGTCGAAAACTCAGCTTATAGTGTCGATATGACCACGCTGCACAGTTTTGGAAAATAGT
+CACTCGGGTCGGAGTTTTCAGAAAGCATTGCTTTGTCACCTGACATTGCGTTTTTGGTGT
+GGACATTGCGTTTTGGTGTAGATAAAAAACCATGTGATCTGTGCAGTCCGACAAGTCGAC
+TTCAATAAAGCAAGCATCATGGCAGAGCATTATAGTCGGCTATTCTGTGCAGCCCTTAGT
+ATCAGTATATTTGATCTGTGAAAGCGTCTCTTGTACTTGAAAACAAGCAAACACAACTCA
+ATTCTTTCAGCCATGAATCATATAAACTCAAAATATTTTGAAATGTACATTTCTAGAAGA
+AAACTCTTGAGGCAATCTGGAAGAACTACAATTGAGCCTATTGAAAAGAGTTCAGAAACC
+CGCTTATAGCAGAAGAGGTCTTTGTGCTTCATAACTCTGTAGACCTTTTTTCATGCTACA
+ATACAAGCTAATGCTAGCTGTAAAAGCGTAAAAATGCTAGTACTCACTGTGGCAGTTAGC
+CTGGGCCCGTGAAGCTGAGCGTAGAGTATGGCCTCCTCGACCTGACCTCTGATCCCCAGT
+AAGGCCAGCTCTAAATTGTGAGCTCCGGCAACCATTTGCGTGAGGTCCTGCAATATGGTG
+ACATACTGTCTCCAGGGCTGGTGGAGCTCGGAGTAGCTCGCCAGGCACCCGCGCATGACA
+TTAAGACAGTAGTTGCTGCACGCATGGATCAGGGTGAGTCCACGGCAGTGAGAGCAGTAA
+TGCATGCGTACCAGAGCCCGTGTGCACTCTTTTGATAACCCTGCTGTTTCCGTAATGTTC
+ATCACCTCTGACCCTTCGGCAAGTGCCAAGCTGAGCACCCGCCCAGCCCGCAATGCGTCC
+GCCAGATCTTTTGCCATTGCTTTTGGGTGCGGACCAAAGGGGTTTACGTCCTGCCTGGTC
+ATTCGGAGACAGTCACCAAGCTGGTTGCCTTCAGAAGCATCTGTCCCAATACTTCCTTCC
+ATACCGGGATTGACAATCTGAGTGTGGACCAATGGGAAAAGGCTGTCGAAGAAACAGTGC
+ACAGCAGCTTCCACCGAGACGTTGCCGGTGCCCTGGAGGAAGCGAGAGAGGTCCGTGAAG
+AGGCAGACGATGTGAGGGGAGATGGACGACATGAGGGATGAGTATGTGGTCTCAAACAGA
+GAGGTCAGGTGGTTCTGGGAGAAGGATATTAGGGACTGGAACGTATCTGAAAAAGAAGAA
+AGATTTAAATGAGTGATAATGATAGAATGATCAGTGGTCTTAATCCTTCTCTGCTGTTCA
+AATTGACTACCCCTTCATTATGTTGGTGGCTGTTTTTGCCCCATTGACTTCCATCATAAT
+CACATTTTTTGATTACAAAGCCAAGACATATAATTATGCATTCTTGATTATTGTTGGTTT
+TCCTGTTGGGAAGAGGTCAAATGTTTAAGTTTTACTGTTGATCATCAGTTGTCACCATTA
+ACCCTTTATATAGGCCTATCATACAAGTTTCTGGCTTTTATATGGAGTTCTATGGAGCAA
+ACCAGCAGATTATAGTGTGTGTGTGTGTGTGTGTGTTTGTGTGTGTGTGTGTGTGTGTGT
+GTGTGTGTGTGTGTGTATATATATATACACTTACTGGGCCCTATCATACACCCGGCGCAA
+AGTGGCGCAAGGCACAGCGCAATAGTCTTTTGCTAGTTTCAGCTTGGCGCAAGAGTCGTT
+TTGAGGCCGTGCGCTACGCTGTTTAAATAGCAAATGCATTAGCGCTCATATGT
+>8
+GAGCCAATTGTCAGCAGTTTTTTGCTCCCCTCTTATTCACTGCTCTGTCAGCCACACCCT
+CTCCTCCCTCTGCTTGTAGCACTCCACGCCCATCACAGAGCATTTTTTTTTTAATTCTGT
+GGTAGACTTGACTCGAAAGAGGGGGATGTCATGGCCCTTTAAAATGGGACAAAAAACTGC
+TTTTATTCTAGCAGTTATAAAAAATAAAACAAAGACTTAATAGAAGATATATTGTAGAAA
+ATATCATTGGAGACACTGTAAAAATTTCCTTGCGCTGTTAAACATCATTTGGGAAACATT
+TGAAAAAGTAAAACAAAATCACAGGAGGGCGAATAATTTTGACATCAGTTGTAGGCATAC
+AGGTACAGTCCCTGTCACTGGCAAGGCTGTGATAAAAAATGAAACTATATTGGCTGTTTT
+TTGGGAGGAGCTACTGTATGTCCTGCTCTCTCTTTATGTTTCAGTTGGGATTACGTCAAA
+CTTTAAATAAAAAAAAATGCACATTTCAAAGCACATTTAACATCTGCCCATGTGTGTTTA
+TCCTGCAGGTCAATATTTCTCCAGGCTGCAGTAAAGCATTGACTAAAATGTGGTACTGCC
+CGTATTGTGGAGGAATGTCAGGACTCAAACCCTGCGCCAACTACTGCCAGAATGTGATGC
+GCGGCTGCCTGGCCAACCAAGCGGATCTGGACCCTGAGTGGAACCTCTTTATTGGTGAGA
+TGCGCTTGCTATTGTACCTTAAGCTGGGTTTTCTAATATAGATGTCCCCTATAAAGAACT
+TCCAGTTGGGTGCCTTTTTTCAATCAAAAACACTTTATTTTATTTATTATTTTATGTATT
+CTTTATTTAAACAATACTGGAAATGAGACTGTTTGAGTTGTTGCTCAAGTTTATTTTGTG
+TTTGACTGATTGATTGATTGATTGATTGATTGATTGATGGGTTGATTGATTGGTTGATTG
+ATTGATTGATTGGTTGATTGATTGATTGATTGATTGATTGATTGATTGAATGATTGATTG
+ATTGATTGATTGATTGATTGATTGATTGATTGATTGATTGATTGATTGATTGATTGATTG
+ATTCAACAGTTGGTAGGTTGGTTAGTAAGTTTATTGGTTGATTGGTCGAAAGGTTGCTTG
+GACACTTTGTTGCTTGGTTGATTAGGTGGTTACTTGGTTACTTGGTTGTTTGTTTGTTTG
+CTTGCTTGCTTATTTTTTGGTTGATTGGTCGGAAGGTTGCTTGGTTGATTAGTTGGTTGC
+TTAGTTCATTGATTGATTGATTGATTGATTGATTGATTGATTGATTGATTGATTGATTGA
+CCCGTCATAATGAACAATTCTACAAATCTATCTGAAGTGGGTCGCTTAGTTGATTTGTTG
+GTGGTTTGGTTGGTTGGTTGGTTGGTTGGTTGGTTGGTTAATTGATT
+>9
+TCTGATGTCTACAAAACACATTATTATTATTTTATTATTTTATTTTAGTTTAATAATTAA
+TAATAATCATTATTAATATTATTATTATTATTATTATTATTATTATTATTATTAATCTGC
+CTGCATTATTCAAAAGCAAAAACATTCAGAAAGCCATTATTTGCTTCACAAACCAAACCT
+GAAAAAATCTGCAAGAATATTACAAATATAACACTTTTTTTTTAGGTACACATATTGAAC
+CCTTGCCAATAACAAGGAAGCAAATATACCATAGAATGGTCTTCAATGGGGATATTTTTG
+TCCTGAGACAAACTTTTTAGTTCTTAGTGTAAAACAGATTTAAGACAGAAAATGAGTATT
+GCGAAACAATAATTCTAGTGTAGAGCTCATCAGTGAGGCTATTATGTGAAAAGCCTAAAT
+TAACACAGGAAAGAACTGAATTAAGCCCTTGGAGAGCCACCAGGGAACTCAATCACATAT
+TTTGAGTTTTAAAGAAAAATAAACACTGACAACACTGTACTGTACAACTAATGTCTGGAG
+ACAAACTGACATCATACTAAACAAGAGTACCGCAAACTACCAGCTTCACCAAGGCTGTAG
+ATAAACCACCCAAGCATGATTAACCAGCGCACCAACCTTGGAAAGCGGCCACATTTCGTG
+AGAAGAGGAACTTTAGGCTGGAGCTAGAGATCTGGAGAAGGTTCTGAATATCCCGCCGGG
+CCGCCACCTGGTAACGCTCCTCCATCTTTTTGGTGCAGCATGTTAGATTCCTGGATAAGC
+AAACCTGCAGGTCTGAACCTGAAAAAGAACAAATATTATTTGTTATCTAAAGTGGCAATG
+TAAAAAAACAACACTTAATACACAAATACACTCAATTGAACATGCACACATAGACATCAC
+CTATACTTGTTCATCACCTATACCTATACAACAGTACTTAGTCTCCCTTATCCATTCAAG
+GTTTTGGAGTCTCTTTTACTGATCTGATGAGTTCATTCAAGTGTGTTTGTATAGGAAGAG
+GTTGGGAAACACTGACCTATCCACTATATAGCTGCATGTTAATTAG
+>10
+TACTCCATATGACAGTACTCCATACCTACAAACCAACTGTGCTGCCCAAACAGTGTCCAA
+AGCTTAATTTTGCAGCAGAGGTGCGCACTTTTAAAAAAAACAGTGCAGATCCACTACACT
+AATATGATATCATCCACATCTCATTAAAGATCTTACCTTGGCCACCCTGTTGGCCACTTC
+TCGGCCCACCATAAGTCCCTGGACGAAGGATCTGGCCGCGATGAAAGCTTTGGTGACCTG
+CGCCTTGAGTTTTCGCGGCACGTCTCCGAACGGCTTGAGCTGGTCAGTGTATTTGCTGAT
+GCACTCCAGATAGTCGTCGCTGAAGGTGAACTGCGAGTTGAGCAGCTGGAACATTCTCTC
+CAGCAGACGCGACCAGAAGTCATTCAGCACCTCCTCCAGGTTGACGTTCCCACCGGTGTA
+GTAGCGCTTCAGCTCTGAGAACAGGTCCTCGAACATCTCCGAGTTGTGTGTGTAGAGTTT
+GCCATATGTGCGCACAAACATGTCGTTTAGAGACTTCTCAGAGTTGTCCAGCAACTCCAG
+GAAAAACTCTGGAAAAACAGAGAAATACTGATGTAAAAAAAATATGTAATTTGAGCATGT
+GTATATATATTTTAAATAATTACAAAAAAAAAAAAAAACGTAGTAGTTATTATTGTTATT
+ATTATTAATATTAATATTAATATTATATTAATATTGATATTATTATTATTATTATTATTA
+TTATTATTATTATTATTATTATCATCATTAGTGTCATAATCTACACATTATATATATATA
+TATATATATATATATATATATATATATATATATATATATATATATATATATAATTTGTAT
+ATTATGACCACTAATGATGATGATGATGATA
+>11
+CTCACTACTCCCTGCTGCTTTCCAAATGAAAGAGGGCCAATGGTACCTCTCTGTTCGTTA
+AGGAATTTCTTACAGAATTGGAATCTTGGTCTCCCGCTGCCAAACTCTCGAGAGATTCCT
+GCTAAGCAGACCTAAATTCTTGCTGATGTTGGGAATAGATCAGTTCAGAATATTGCGTGC
+CTTGTAAAAAACATCAGTAAAATCTGAATTCCACTGCATGGCACGTTCATAGGGATTAGC
+ATTCAACATGAATACGTTTAGTCATGGCCATATTCAAGTTTGTTGAGCAGCATGACAGGT
+TCACATTCTGTCAGAATAAAGCGATTCAACTGAAGATGCCTTCAGCTAATATACAAGCAT
+GATTACTCTGCCCTCCATACCTGGCTTTCCCAAAAGACTTCAAAGTTTGAAGTAGATGAC
+CTGAATCAACATGCAGGTAATAAGCAGGTACAATTCAGTAAATCAAGCTAACTCGCATCT
+AGTGTGTTTACCAGTGCTCTTATTTCAACTTCCAGTGTTTTTTTTTTTTATCAGGACAGC
+TTCCCTGAAGATATACTGAGTTAATTGCCTTGCTCACTGATAAATGCCATGGTTACTGTT
+TAACTTAATATTGTTATCTTAAAAAAAATGAACCCTTGGCAATGGTCACTCTTTCCACAG
+GTCCCACTGAGCCCAGAGTGCAATCGTGCCATTATGAAACTGGTGTACTGCCCTCATTGC
+AGAGGTCTGGGATCAGTCAAACCTTGCATCAACTACTGCAAAAATGTGATGAAGGGCTGC
+CTGGCTAATCAGGCTGACCTGGACACTGAGTGGCAGAGCCTCATAGGTAGGGCTTATAAC
+ACTAGAACTCTCAAGGCTGGTTTATACTTCTGCGTCGAGTGATTGTCGTGACCCACGGTG
+CCTGCCTAGCATGTAGTCATGCATTTATACTTCTGCGCGCTGTGTTGCTCTGCAGTAAAA
+CTTCCAAAACGCTAGCTAGCAGTAGGTTTTTATGATCCTGTGTCGAGTTTCTTCATGGAG
+ATTTTTCTGAACGCTACCTTAATGTACATGTAGCCACATCTTGCTTATTTAGAGGTGGAA
+ACCGGCGTACGTGCAACAACATTAATCATAAGGTGAACGCAAAACTTTTCAGCTGGTGCC
+CCTTCACAGGACTCAACACTTGTAAACATTGGCTCCATGGAGCTCGTAGCTCCACACTCG
+TCACAGCTACCAAGCCTACCAATCACACAGCTTGCGTTGTTGCGATGTGTAGTTAAATTT
+TTTGAGAGGTGCATGTCAGCATCGGCATTAGCCACGGCAAGGGCTATGTGACCGTGCGAA
+GGCTGCACCCGAGCATACATGTGCGCTTGATGCAGAAGTATAAATCAGCCTTTTTTTTTT
+TGTTGGTTTGCTTTTTCCTATTTTTGTTGCATCACCTCTTTTTTATTGCTTTGTAAAAA
+>12
+ATGCAATATACAGTAACTGACATTCAGCTTTGTGAAATTGTGTCAAAGTTACACGCCGCC
+GCTGCGACTGAATGCTTCACGCAGGCTAATGCAGTTGCAACTGAAAGAAAACAGTTGGAT
+TTACAGAAATCAAATGTCATGCTGTCTGCACCTATATTTACACCTAAACAAAACAGACTT
+TTTCTTTCAATATCCGTGAAATTAGATTCATTTAAACAACAAGCAAATGTCAAGTTCTAC
+TTTCCTTCCCGAACTGCATTGCTTTTCCCTGAGGGACCCTATAAACCCCCACGCTTTGAC
+ATCAGAGGGGTGGAGGTTCCTGATAAAGAGGAATGATTGTGAAAGACGTCTCAGAGAAGC
+ACCATGGGTATTCTTTTGCAAGAGTTGTACCAAACTGTACCATCCCACATCCTTGGACCT
+CTTGGGAAACTGTACTGACAAGCAATTATTTGCACAGTGCAATTATCGCATATTGTGTGT
+GACACAAAACAATTCACAGGGCTTTTTTTTTCTTGTTAAGTGATTCATTATGGTTGAGCT
+GTTCTTTAAATTGTGTTTTTTGTGTTTTGCAGGTTTCTCTGAGCACTGAATGTGTGCGTG
+CTGTCATGAAGCAGACGTATTGTCCTCACTGTAGTGGCGTGGCCTTGGCCAAACCCTGCT
+CAAACTACTGTCGAAATGTCTTAAAAGGCTGCCTCGCCAATCAAGCAGACCTGGACACTG
+AGTGGAGGAACCTTGCAGGTGGGCGGGACCAATAAACAACTCTATTTGCTTAAGTCTGAC
+ATCAAAAGTCACTGTTTCTTGGTACAAAAGCTCTAGCAGATGCCAAAAGCAAACAACAAA
+TTTAACAAAGCAGATTTTATAGTAGAATAACTATATATACACCAGGGGTTTCAAACTGTG
+GGGCTTGCCAGCACCTATTAAGAGGGACGCGAGACATTGAGGCGTGCACTTGAGTAAATT
+ATGATGTCGATTTTTATGCGTTTACTAGATGGAATAAAACGATTTATGTTAGCTCCACAG
+CTAATTATTAGGCACCTGTAGAGTTAATGTGTTCCAGTAAAATATATACAAATAAAATGG
+AAAGAGTGCTTTTTAAAACTAATGACGGTGAATAAATGAAAGTCAAACCGCTGAGCCATC
+TGACAAAAAAGTGCCCTTCTGAATCAAATCAGGAGAATGCCCATTTGGATCTTTCACGTA
+CTTTGAAGATACTGACTACATTTACATGGACATCAGT
+>13
+CTGGAGGTCCGGTGCCCTGCAATGGTTTAGCTCCAACTTGCCTCAACACACCTGCCTTGG
+TGTTTCAAGTATCCCTAGTAAGACCTTGATTAGCTTGTTCAGGTGTGTTTGATCAGGGTT
+GGAGCTAAATTCTTCAGGACACCGAACCTCCAAGTTTGTTGATCCCTGCTCTAGAGGAAG
+GCATTGCATGAAGATTAAAATTGTACGCATTACTAAACCATCCAATCTTCCAATTTACAA
+ACTCCAAATCTTCGATCAACCAAATATATAAGTTCATCCAATTTGTTTGTCCAAACTTGC
+TAAAAACCCCCTTTAGGTTTACATGTAAAAATGCTGTACAACTACTTTTAGTCGATGTAA
+ACAGTATGTCACTTGACTTTGCAAATTGCATTTACCACAGGAAAGCCATTCAGTGTTCAT
+AATCAGTTTGTTAGCTTGGAAAAAAAACTTTAGAGGAGGTATTGCATGAGGGTTAAAAAC
+TGTACTCAGAAATCCAACATATGAAAGTTATGAGACATGTGGTTTAAATAGGCACAAATG
+TTTCTACTTAAGTCACCTTCTATGATTAATCCATCACAGATGCAGAACTTCTCATCTGTA
+AACACCAGGGTCCCACATGCTGTACCCGCAAGATGGAGGAGAGCTACTACTCAGCTGCTC
+AAAGAGACACACTCCAAAACATTCTCTCCTATAGCTTCGAACTCAAGTATCTCATCCTGG
+GCCATGCTTCTTCCTTCCAGGGTATGTATTGAGATGGAGTGAAGCTTATTGGCCAAACAA
+ACACTAGGACATGTGCTTTTTGCATTCGCAGCAGCAGCAGTAGTAGGTCATGGGATCAAG
+TCCCTGCCACAGCAGGTGGGTCATATGACATGTTATTACTTTGTATGTATTGCATAGGAA
+ACACAGAGGTGGTGTTTAACATTTCTTACATTGTACATCATGACTTTCCAAGGTTACTTG
+GAGATTTGGCTTTTGTCCGCTGTTTTTCATGCTCACAGGATGATCCTTTATCTGCCTGAG
+GTCTCCTGTGAAGCAATACATGT
+>14
+CTCATTTTTAATCATTGATTTTTTTTATCTGTGCCATAATCACAGTAAATAATATTTTAC
+TAGATCCTTTTCAAGATACTAGTATTTAGCTTAGTGACATTTAAAGGCTTAACTAGGTTA
+ATTAGGAAAGTTAGGATAAATTAGGCAAGTTATTAACAATGGTTTGTTCTTTAGACAATC
+AAAAACAAAATTGCTAAAGGGGGGCTAATAATATTGACTTTAAAAGGGTTTAAAAAAAAT
+CAAAACTGCTTTTATTCTAGCTGAAATAAAACAAAAGACTTTCTCCAGAAGAAAAAATAT
+TATCAGACATTCTGTGAAAATTTCCTTGCTCTGTTAAACATCATTTGGGAAATACTTGAA
+GAAGAAAACATTACAAATCCAGAGAACATATGTTTCAAGTGTAGTTGGTTTGCTTATTTC
+AAGAATTATGTAATTCTAGATATATTTTTAATTTCTGTGAAGCAAGTCGACAGTGAGATT
+CCAGCGCATTTGCTGACCCCAGAAGGTCAATGAAGCTGCGGAAACTTCATAAAGAACGCG
+CATCTGTCTAACAAGCTACTGTTCTGTCTTTTACTGCAGATGTGGAACTGTCGGTGTGCA
+AGCATGCGGGGCCATCATGTTGTACACGAAGAATGGAAGACAGTTACAGAGCGGCGGTCC
+TGAGAGACACCACCCAGAACATCGGATCGTACAGCTATGAGCTCAAATTTCTCATTTCTG
+CACACGCCGCCGCCTTCCAGGGTACACAGATGCATGGATGATTGAATGGATGGTGGAAGG
+ATGAAATGGATGATTGATAAGTGAAACGAATGGGCAAATAGATGAAGTTGATTGATGTGT
+GAATGAATATATGTTGATGTAACAACAGAGGCTCATTTAGGGCCCTGTGATTTACACAAT
+GCTGACAAAACTGAGGAATCCAGACATAAATAGAATTTGGTGTATAACTGTGACAGAAAA
+TGCAAAAGATTGCATCATGGAGCCAGATCAATCTCAAAAATAATGCATTTATGATAAGCC
+AAAAGCGCAAAACCCAATTTCATTCATTTATTAATTTCCTTGTCAGCTTAGTCCCTTTAT
+TAATCCGGGGTCGCCAGCACGGAATGAACCGCCAACTTATCCAGCAGTGGATGCCCTTCC
+AGCAGCAACCTATCTCTGGGAAACATCCACACACACATTCACACATACACACTCATACAC
+TACTGACAATTTAGCCTACCCAATTCACCTGTACCGCTTGTCTTTGGACCTACTGCGCCA
+CTATGTTGCACAAAACCCAATTTGTAAATTGAAAACACAATTCATAAATGCACAAATCCA
+AAATACACACATCCAATTCATTGTTTTTCCTTTGGCTTAGTCACTTTACTC
+>15
+TGCTAATCATTTTGGCACAAGGCAACAAGATGAAATGCAATGTGTGGAAATGAAATTAAA
+TAACATGTTTCGATTAAGTTGCAGATATTTGTTTTGTGGCGTTCTTTGAAATTTGTACAA
+GTAGCGTAAACAATGTGTACTCTATAAAACAAACCATTTTCTGCAGCTCTCTTTGTTTTC
+GATTTACAAGCCAAGCTTCAGTTTATAAAATGCCGCGGTCTGTTTACTTGTTTATTGTGA
+CGGCTGTTAGAAATCTTCTCTCTGTTATTCTACAGGCTCAGATCTGCAGGTGTGCCAGCC
+AAAAGGCCTGACTTGCTGTTCTCGCAAAATGGAGGAGCGTTACCTGCTTATTGCCAAACA
+GAATATGGAGTCTAGCCTTCAGGCCACCAGCGCTCAGCTCAAAGGGCTCATCATCCAGAA
+TGCTGCCCTCTTTCAAGGTGAGTTTCTGCTACATTTCTGTTTGTGAAGCCATTTTTGGGT
+ACATTTTTGTCATAAGTTAAACCTTTAGCATCCCCTTGGGCGGAAAGCTGAAATGCTTAG
+AGTCAAGAACACATTAATTCTTAACACACTCTCAGAAATGTATGAAACCTGTCACTGGGG
+TGGTACCCTTTTAAAAGGTACACTTTTATGCTTAAAAGAGCATGCATTAGAACCAAGAGG
+ATCCATAGTGGTATCATATGGTAACTCTTATGTGTTGCTGGGGATGTTTTCATCCACTCT
+GGCGTGGTTTTGAATGTTATTTTGGTCTTAACTTTTTTTGTTTCAGCTAGCAGAATGGTG
+ACAAACGTTGTTTTAGGTGATAAATCTTATTTTAGCACTTATTTTGAGAAAATTCTTAAA
+TTTTTTCAATCCAAACAAAAGCCCTCTGGGCGTGCTTCCTCCTTTTTTGTTCGTTTCCCT
+AAAGGGTAAGATTTTTATTTTTTTTGCCTAATTTAGTGTTGGTGGCTG
+>16
+ATCACTGGGAAACATCCATACACTCTCACTTGGGGACTTGGGGAAACCGGAACACCCGAA
+GGAAATCCACGTCAACACGGGGAGAACATGCAAACTCCACACAGTAATGCTAACTGGCCC
+TGCCGGGGCTCGAACCAGTGACCTTCTTGCTGTGAGGTGACAGTGCTAACCACACACTCA
+TCCTCTCACCTGCGCATGTATCCTCGCTGTGCTCCTCTGAGCGTGCGCCACAGCGTCCCT
+CACCAGCTCATGCGCCCCCAGCAGCACCTGCTCCAGATCCAGCTCTCCGTGCATCCGTAC
+TGCCAGCGTCTCCAGCGAGCGTACAAACTCCCTCCAGTGGGCATCCACTTCAGCCAGGTT
+AGCCAGACACCCGCGCACCACGTTCAGGCAGTATCCCAAGCAGGGTTTGCTGGAGGTCAG
+AGCCTTGCAGTGCGGGCAGTAGCTCATCCTCAGTAGGCCACGTCTGCACTCGCGGCTCAG
+CTGGATGTGATCGGTCGTATTTATGATCTCGATGCCCAAATGGAGCGCTTGGAGAAACAC
+GCGAGCAGGTAGAGAAGCATGGGCGATTTGGGACGCCAGGCGGATTGGGGCTGCTCCGAA
+CGGTGCTAGATCTTGAGCAGACGAGCGCAGGCATTCGGCGTATGGAGGAGACAGACGGGA
+GTCAATCAGACGCTCGTATATTAAGGGGAAAAGAGCGTTGAAGAAGCTCTGAGAGGACTC
+TTCTAGACTGAGCTCAGAGCCCAGGATGAACAGAGCCACTTCTGTGAAAAACTCCCCGAC
+TGGTGCTGATGCTGCTGGGCTGGAGAGATCACGCTGGGACTGATGGAGGATGGAGAGGGT
+GTGGTTCTCCGCCTGACGCACCAGAGACTCCACGCTTTCTGAAAGAAATAATAGAGTAGA
+AAAAAGTTTATTAGTAAAGGATTAAAGTTTTGAAAGTTGTCTAACATAATAAAAAAATTA
+AGTCTTCTCAATAATTCCAGGTACATGCAAGCATGCATAGTTTCCCATTTAGAATGACTT
+AATATTTTGGGTTTTATTTTCAGCACATTATTAAAGGCAACCAAGTTGGCTACTTTATTA
+TTTTTTCAAATATAATTTTGTCAAAATATGGGTGGAATAAAATTCTTTAATAATCAATAA
+TGAATATTTAATTTTTAATATTATATTGTAATGAATTAATTAATTTATTTATTTATTTAT
+TTATTTATTTATTTATTAATTTGTTAATTTGTTAATTTATTTATTTATTTATTTATTTAT
+TTTATTT
diff --git a/test/minimus/zgene/zgene2.afg b/test/minimus/zgene/zgene2.afg
new file mode 100644
index 0000000..83ddabf
--- /dev/null
+++ b/test/minimus/zgene/zgene2.afg
@@ -0,0 +1,4987 @@
+{UNV
+iid:1
+com:
+Generated by dsommer with tarchive2amos on Wed Aug 30 13:10:59 2006
+.
+}
+{RED
+iid:1
+eid:zfishG-a2661d04.q1c
+seq:
+TAAAATAAATGTTATGTTATCATGTTGACAGATCAATGATAAAATAAAGCCTGGTGATTA
+AAAACCTGCAATACCTTGACAAGAACTTTCATGTAAACTAAAGTACTAACTAAAAAAGTG
+TCCTGAGAAATCTCGACAGTTTTTTGAGTTTGATAGCCCTGGGCTCAATCAGAAAACTAG
+CCAGTCAGAAACACTCTTCATTTCACTCGTTCGGGTCTGCTGACACTGACTTTGCTGACA
+AGTCTTTGGAGGTTGAGTTTTGGAGAGAGATGGCGTTAGCAAAAATGGCTGAAGTTAGCA
+AAATGGCTGCAGTCGCCTACAGCATTCGAATTCATACCTTGTTTCTGAGACCATGTGTCA
+CTCACCTGGGCGCTGACTTTGCTCTTGCTTGCCACGGCTTGTTTGAGAGCCTGTCTGATA
+ATGACATGCAGTCGGAGCACCACAGCCTCGATGTCCTGTTCCCCCTTCATGGCAGCGGCG
+AGTGACCCCAGTTCATCCACATATGCTCTCCAATGAGGCTGTACCTCCGTGGTTCCCCCC
+AAACATGCTCCCATGGTGCTGACACACAGTGGACGGCACGGCCGGGCCTTCAGCAGGCTT
+TGACAGTGCGGGCAGTACCACAGTTTCAGAAGTGAGCGCCCACAATCTCTACCTGCCCGC
+AAATGCTGAGT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXX
+.
+clr:0,671
+}
+{RED
+iid:2
+eid:zfishI-a72c06.p1c
+seq:
+CACCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGGGCTGGGCGGGTGCTCAGC
+TTGGCACTTGCCGAAGGGTCAGAGGTGATGAACATTACGGAAACAGCAGGGTTATCAAAA
+GAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCACTGCCGTGGACTCACCCTG
+ATCCATGCGTGCAGCAACTACTGTCTTAATGTCATGCGCGGGTGCCTGGCGAGCTACTCC
+GAGCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGCAGGACCTCACGCAAATGGTT
+GCCGGAGCTCACAATTTAGAGCTGGCCTTACTGGGGATCAGAGGTCAGGTCGAGGAGGCC
+ATACTCTACGCTCAGCTTCACGGGCCCAGGCTAACTGCCACAGTGAGTACTAGCATTTTT
+ACGCTTTTACAGCTAGCATTAGCTTGTATTGTAGCATGAAAAAAGGTCTACAGAGTTATG
+AAGCACAAAGACCTCTTCTGCTATAAGCGGGTTTCTGAA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,519
+}
+{RED
+iid:3
+eid:zfishC-a186h03.p1c
+seq:
+TTGATTGAAAAAAGGCACCCAAACTGGAAGTTCTTTATAGGGGACATCTATATTACAAAA
+CCCATCTTAAGGTACAATAGCAAGCGCATCTCACCAATAAAGAGGTTCCACTCAGGGTCC
+AGATCCGCTTGGTTGGCCAGGCAGCCGCGCATCACATTCTGGCAGTAGTTGGCGCAGGGT
+TTGAGTCCTGACATTTTTCCACAATACGGGCAGTACCACATTTTAGTCAATGCTTTACTG
+CAGCCTGGAGAAATATTGACCTGCAGGATAAACACACATGGGCAGATGTTAAATGTGCTT
+TGAAATGTGCATTTTTTTTTATTTAAAGTTTGACGTAATCCCAACTGAAACATAAAGAGA
+GAGCAGGACATACAGTAGCTCCTCCCAAAAAACAGCCAATATAGTTTCATTTTTTATCAC
+AGTCTTGCCAGTGACAGGGACTGTACCTGTATGCCTACAACTGATGTCAAAATTATTCGC
+CCTCCTGTGATTTTGTTTTACTTTTTCAAATGTTTCCCAAATGATGTTTAACAGCGCAAG
+GAAATTTTTACAGTGTCTCCAATGATATTTTCTACAATATATCTTCTATTAAGT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,594
+}
+{RED
+iid:4
+eid:zfishC-a186h03.q1c
+seq:
+AAATAAAGAATACATAAAATAATAAATAAAATAAAGTGTTTTTGATTGAAAAAAGGCACC
+CAACTGGAAGTTCTTTATAGGGGACATCTATATTAGAAAACCCAGCTTAAGGTACAATAG
+CAAGCGCATCTCACCAATAAAGAGGTTCCACTCAGGGTCCAGATCCGCTTGGTTGGCCAG
+GCAGCCGCGCATCACATTCTGGCAGTAGTTGGCGCAGGGTTTGAGTCCTGACATTCCTCC
+ACAATACGGGCAGTACCACATTTTAGTCAATGCTTTACTGCAGCCTGGAGAAATATTGAC
+CTGCAGGATAAACACACATGGGCAGATGTTAAATGTGCTTTGAAATGTGCATTTTTTTTT
+ATTTAAAGTTTGACGTAATCCCAACTGAAACATAAAGAGAGAGCAGGACATACAGTAGCT
+CCTCCCAAAAAACAGCCAATATAGTTTCATTTTTTATCACAGCCTTGCCAGTGACAGGGA
+CTGTACCTGTATGCCTACAACTGATGTCAAAATTATTCGCCCTCCTGTGATTTTGTTTTA
+CTTTTTCAAATGTTTCCCAAATGATGTTTAACAGCGCAAGGAAATTTTTACAGTGTCTCC
+AATGATATTTTCTACAATATATCTTCTATTAA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,632
+}
+{RED
+iid:5
+eid:Z35723-a1108d01.q1c
+seq:
+TCGCTTCCTCAGGGCACCGGCAACGTCTCGGTGGAAGCTGCTGTGCACTGTTTCTTCGAC
+AGCCTTTTCCCATTGGTCCACACTCAGATTGTCAATCCCGGTATGGAAGGAAGTATTGGG
+ACAGATGCTTCTGAAGGCAACCAGCTTGGTGACTGTCTCCGAATGACCAGGCAGGACGTA
+AACCCCTTTGGTCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGGGCT
+GGGCGGGTGCTCAGCTTGGCACTTGCCGAAGGGTCAGAGGTGATGAACATTACGGAAACA
+GCAGGGTTATCAAAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCACTGC
+CGTGGACTCACCCTGATCCATGCGTGCAGCAACTACTGTCTTAATGTCATGCGCGGGTGC
+CTGGCGAGCTACTCCGAGCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGCAGGAC
+CTCACGCAAATGGTTGCCGGAGCTCACAATTTAGAGCTGGCCTTACTGGGGATCAGAGGT
+CATGTCGAGGAGGCCATACTCTACGCTC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,568
+}
+{RED
+iid:6
+eid:Z35723-a1166g11.q1c
+seq:
+TATCCGTCCATACATTCATCCATAAATCTGTCAACCCATAAATCTAGCCATCAATCAATC
+CATAATTCTATCAAGCAATGCATCTCTCCGTCCATCAATCCATCCGTCAGAATCATTGTG
+TCTGAAGACTGTTTTATGATGCATCTGTGCTTTTGTTAATTGTGCTGTAGTTTACATACA
+GAACAGCCAAGCATACAGGTTACTGACCTCATCAAAACCCTGTATAAATGTGTGTGTGCT
+CGAAGTGTGTGTGTTCCTCTTACCGATAAATTTGCTCCATTCGTTGTTGAGATCGGCCTG
+GTTTGCCAAGCAGCCCTTCATGACATTCAGACAGTAGTTTCTGCAGGGCTTCAGTGTGAA
+CAGACCCTGACAATACGAGCAGTAGAGCATCTTCGTGAAGCCGCTGACACACGACGAGCT
+CATGCTGACCTGCGCACACACACACACGGCAATAATACAACAGTCACCACACTACTTGTA
+GTGATGCTACAGCCTGACACTGGATGTCTCATAGTTTTGATTCGTACAATTGAATA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,536
+}
+{RED
+iid:7
+eid:Z35723-a1386e10.q1c
+seq:
+TCTTTGTGCACACCATCTAATTTCAATTTTCACTGAAGCCCATTCCTCTTTCTTCTTTCG
+CCTGCACTCAATACATTCTCAATTTCCTCTCTGTCTGATGCAGGGAGTTTATCTCGGGTC
+TAAGGGGCTTCAGTCAGTTCTACAGTGGTCTCGGAGAAGCTTTGTGCAGCAAAGAGCCGA
+CATCGCTGAACAGCTCCCTCTGCTGGAACGGACAGGAGATGACAGACAAGTGAGTAATTC
+ATTTGTGGGAGCATTGATGCGATGTAACCTCTACATTCCTTCATTGTGGACTCCTACAGC
+TCAAAGTAAGGGCATTGATGTTCATTAAAACGTGAGTAAGTTCATTAGGTGGCGTCATTC
+AGTTTGCAGACATGTAAACTAAGATTAATAGTTCTTCTGTATGCTTGCAGCGGTGCAGAA
+TAACTGTTCCACATCATTGTGGTTACTTTGGAGCCTTGCCAAGGTACATGGCATGTGTAA
+ATAAAAATGAGCGCACAAGGGAATGAGTATAGCCTGATAAATAATTTGGAATAGCT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,536
+}
+{RED
+iid:8
+eid:Z35723-a2265d03.q1c
+seq:
+TTTAAGTGTAGTTGGTTTGCTTATTTCAAGAATTATGTAATTCTAGATATATTTTTAATT
+TCTGTGAAGCAAGTCGACAGTGAGATTCCAGCGCATTTGCTGACCCCAGAAGGTCAATGA
+AGCTGCGGAAACTTCATAAAGAACGCGCATCTGTCTAACAAGCTACTGTTCTGTCTTTTA
+CTGCAGATGTGGAACTGTCGGTGTGCAAGCATGCGGGGCCATCATGTTGTACACGAAGAA
+TGGAAGACAGTTACAGAGCGGCGGTCCTGAGAGACACCACCCAGAACATCGGATCGTACA
+GCTATGAGCTCAAATTTCTCATTTCTGCACACGCCGCCGCCTTCCAGGGTACACAGATGC
+ATGGATGATTGAATGGATGGTGGAAGGATGAAATGGATGATTGATAAGTGAAACGAATGG
+GCAAATAGATGAAGTTGATTGATGTGTGAATGAATATATGTTGATGTAACAACAGAGGCT
+CATTTAGGGCCCTGTGATTTACACAATGCTGACAAAACTGAGGAATCCAGACATAAATAG
+AATTTGGTGTATAACTGTGACAGAAAATG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,569
+}
+{RED
+iid:9
+eid:Z35723-a2670f01.q1c
+seq:
+TGGGTGAAAACATTCGCAGCTACACATAAGAGTTACGGTATGATACCACGATGGATCCTA
+TTGGTTATAATGCATGCGCTTTTAAGTATAAAAGTGTACCTTTTAAAAGGGTACCACCCC
+AGTGACAGGTAACATACATTTCTGAGAGTGTGTTAAAAATTAATGAGATGTTGACTCTAA
+GCATAACAGCTACTCGTCCGAAGGGATGCTAAAGGTTTAACTCATGACACAAATGTACCC
+AAAAATGGATTGACAAACCGAAATGTAACACAAACTTACCTTGAAAGAGGGCAGCATTCT
+GGATGATGAGCCCTCTGAGCTGAGCGCTGGTGGCCGGAAGGCTATACTTCATATTCTGCT
+TGGCAATAAGCAGGTGACGCTCCTCCATTTTGCGAGAACAGCAAGTCAGGCCTTTTGGCT
+GGCACACCTGCAGATCTGAGCCTGTAGAATAACAGAGAGAAGATTTCTAACAGCCGT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,477
+}
+{RED
+iid:10
+eid:zfishB-a2363g12.p1c
+seq:
+ACGGCCTGACTTGCTGTTCTCGCATTATGGAGGAGCGTTACCTGCTTATTGCCAAACAGA
+ATATGGAGTCTAGCCTTCAGGCCACCAGCGCTCAGCTCAAAGGGCTCATCATCCAGAATG
+CTGCCCTCTTTCAAGGTGAGTTTCTGCTACATTTCTGTTTGTGAAATCATTTT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,173
+}
+{RED
+iid:11
+eid:zfish-Ja871b12.p1c
+seq:
+TCATCCATGCATCTGTGTACCCTGGAAGGCGGCGGCGTGTGCAGAAATGAGAAATTTGAG
+CTCATAGCTGTACGATCCGATGTTCTGGGTGGTGTCTCTCATGACCGCCGCTCTGTAACT
+GTCTTCCATTCTTCGTGTACAACATGATGGCCCCGCATGCTTGCACACCGACAGTTCCAC
+ATCTGCAGTAAAAGACAGAACAGTAGCTTGTTAGACAGATGCGCGTTCTTTATGAAGTTT
+CCGCAGCTTCATTGACCTTCTGGGGTCAGCAAATGCGCTGGAATCTCACTGTCGACTTGC
+TTCACAGAAATTAAAAATATATCTAGAATTACATAATTCTTGAAATAAGCAAACCAACTA
+CACTTGAAACATATGTTCTCTGGATTTGTAATGTTTTCTTCTTCAAGTATTTCCCAAATG
+ATGTTTAACAGAGCAAGGAAATTTTCACAGAATGTCTGATAATATTTTTTCTTCTGGAGA
+AAGTCTTTTGTTTTATTTCAGCTAGAATAAAAGCAGTTTTGATTTTTTTTAAACCCTTTT
+AAAGTCAATATTATTAGCCCCCCTTTAGCAATTTTGTTTTTGATTGTCT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,589
+}
+{RED
+iid:12
+eid:Z35723-a4033a11.p1c
+seq:
+AAACTTATTGGCTGTTTTTTGGGAGGAGCTACTGTATGTCCTGCTCTCTCTTTATGTTTC
+AGTTGGGATTACGTCAAACTTTAAATAAAAAAAAATGCACATTTCAAAGCACATTTAACA
+TCTGCCCATGTGTGTTTATCCTGCAGGTCAATATTTCTCCAGGCTGCAGTAAAGCATTGA
+CTAAAATGTGGTACTGCCCGTATTGTGGAGGAATGTCAGGACTCAAACCCTGCGCCAACT
+ACTGCCAGAATGTGATGCGCGGCTGCCTGGCCAACCAAGCGGATCTGGACCCTGAGTGGA
+ACCTCTTTATTGGTGAGATGCGCTTGCTATTGTACCTTAAGCTGGGTTTTCTAATATAGA
+TGTCCCCTATAAAGAACTTCCAGTTGGGTGCCTTTTTTCAATCAAAAACACTTTATTTTA
+TTTATTATTTTATGTATTCTTTATTTAAACAATACTGGAAATGAGACTGTTTGAGTTGTT
+GCTCAAGTTTATTTTGTGTTTGACTGATTGATTGATTGATT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,521
+}
+{RED
+iid:13
+eid:ZfishJ-a1224d01.p1c
+seq:
+AAGAACGCGCATCTGTCTAACAAGCTACTGTTCTGTCTTTTACTGCAGATGTGGAACTGT
+CGGTGTGCAAGCATGCGGGGCCATCATGTTGTACACGAAGAATGGAAGACAGTTACAGAG
+CGGCGGTCCTGAGAGACACCACCCAGAACATCGGATCGTACAGCTATGAGCTCAAATTTC
+TCATTTCTGCACACGCCGCCGCCTTCCAGGGTACACAGATGCATGGATGATTGAATGGAT
+GGTGGAAGGATGAAATGGATGATTGATAAGTGAAACGAATGGGCAAATAGATGAAGTTGA
+TTGATGTGTGAATGAATATATGTTGATGTAACAACAGAGGCTCATTTAAGGCCCTGTGAT
+TTACACAATGCTGACAAAACTGAGGAATCCAGACATAAATAGAATTTGGTGTATAACTGT
+GACAGAAAATGCAAAAGATTGCATCATGGAGCCAGATCAATCTCAAAAATAATGCATTTA
+TGATAAGCCAAAAGCGCAAAACCCAATTTCATTCATTTATTAATTTCCTTGTCAGCTTAG
+TCCCTTTATTAATCCGGGGTCGCCAGCACGGAATGAACCGCCAACT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,586
+}
+{RED
+iid:14
+eid:Z35724-a43c06.q1c
+seq:
+CACCGCTGCAAGCATACAGAAGAACTATTAATCTTAGTTTACATGTCTGCAAACTGAATG
+ACGCCACCTAATGAACTTACTCACGTTTTAATGAACATCAATGCCCTTACTTTGAGCTGT
+AGGAGTCCACAATGAAGGAATGTAGAGGTTACATCGCATCAATGCTCCCACAAATGAATT
+ACTCACTTGTCTGTCATCTCCTGTCCGTTCCAGCAGAGGGAGCTGTTCAGCGATGTCGGC
+TCTTTGCTGCACAAAGCTTCTCCGAGACCACTGTAGAACTGACTGAAGCCCCTTAGACCC
+GAGATAAACTCCCTGCATCAGACAGAGAGGAAATTGAGAATGTATTGAGTGCAGGCGAAA
+GAAGAAAGAGGAATGGGCTTCAGTGAAAATTGAAATTAGATGGTGTGCACAAAGAGACAA
+GATTAAGAATCCAAAATACTTGGATTTATGAGAAAATGTAGAGGCTTAGAGAAAGAAGAA
+CGACGAATCAGGAGAAAAAAATAGAGTTGGGGTCAAATGCAGTGTTAAGCACGATCTACT
+CCATTACATATCATTTCCTGTCGG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,564
+}
+{RED
+iid:15
+eid:Z35724-a939a11.q1c
+seq:
+TAACATGTCATATGACCCACCTGCTGTGGCAGGGACTTGATCCCATGACCTACTACTGCT
+GCTGCTGCGAATGCAAAAAGCACATGTCCTAGTGTTTGTTTGGCCAATAAGCTTCACTCC
+ATCTCAATACATACCCTGGAAGGAAGAAGCATGGCCCAGGATGAGATACTTGAGTTCGAA
+GCTATAGGAGAGAATGTTTTGGAGTGTGTCTCTTTGAGCAGCTGAGTAGTAGCTCTCCTC
+CATCTTGCGGGTACAGCATGTGGGACCCTGGTGTTTACAGATGAGAAGTTCTGCATCTGT
+GATGGATTAATCATAGAAGGTGACTTAAGTAGAAACATTTGTGCCTATTTAAACCACATG
+TCTCATAACTTTCATATGTTGGATTTCTGAGTACAGTTTTTAACCCTCATGCAATACCTC
+CTCTAAAGTTTTTTTTCCAAGCTAACAAACTGATTATGAACACTGAATGGCTTTCCTGTG
+GTAAATGCAATTTGCAAAGTCAAGTGACATACTGTTTACATCGACTAAAAGTAGTTGTAC
+AGCATTTTTACATGTAAACCT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,561
+}
+{RED
+iid:16
+eid:Z35725-a1624h06.q1c
+seq:
+CTATCCGTCCATCATTCATTCTAAATCTGTCAACCCATAAATCTCGCCATCAATCAATCC
+ATAATTCTATCAAGCAATGCATCCCTCCGTCCATCAATCCATCCGTCAGAATCATTGTGT
+CTGAAGACTGTTTTATGATGCATCTGTGCTTTTGTTAATTGTGCTGTAGTTTACATACAG
+AACAGCCAAGCATACAGGTTACTGACCTCATCAAAACCCCGTATAAATGTGTGTGTGCTC
+GAGGTGTGTGTGTTCCTCTTACCGATATATTTGCTCCATTCGTTGTTGAGATCGGCCTGG
+TTTGCCAAGCAGCCCTTCATGACATTCAGACAGTAGTTTCTGCAGGGCTTCAGTGTGAAC
+AGACCCTGACAATACGAGCAGTAGAGCATCTTCGTGAAGCCGCTGACACACGACGAGCTC
+ATGCTGACCTGCGCACACACACACGCGGCAATAATACAACAGTCACCACACTACTTGTAG
+TGACGCTACAGCCTGACACTGGATGTCTCATAGTTTTGATTCGTACAATTGAATATAACT
+TTTAAAAATAAATAAATAAAAAAAGTTAGA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,570
+}
+{RED
+iid:17
+eid:Z35725-a2451d04.q1c
+seq:
+GAGTTGCTGGACACTCTGAGTAAGTCTCTAAACGACATGTTTGTGCGCACATATGGCAAA
+CTCTACACACACAACTCGGAGATGTTCGAGGACCTGTTCTCAGAGCTGAAGCGCTACTAC
+ACCGGTGGGAACGTCAACCTGGAGGAAGTGCTGAATGACTTCTGGTCGCGTCTGTTGGAG
+AGAATGTTCCAGCTGCTCAACTCGCAGTTCACCTTCAGCGACGACTATCTGGAGTGCATC
+AGCAAATACACTGACCAGCTCAAGCCGTTCGGAGACGTGCCGCGAAAACTCAAAGCGCAA
+GTCACCAAAGCTTTCATCGCGGCCAGATCCTTCGTCCAGGGACTTATGGTGGGCCGAGAA
+GTGGCCAACAGGGTGGCCAAAGTAAGATCTTTAATGAGATGTGGATGATATCATATTAGT
+GTAGTGGATCTGCACTGTTTTTTTTAAAAGGCGCACCTCTGCTGCAAAATTAAGCTTTGG
+ACACTGTTTGGGCAGCACAGTTGGTTTG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,508
+}
+{RED
+iid:18
+eid:zfish35934-618c07.p1c
+seq:
+TCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGGGCTGGGCGGGTGCT
+CAGCTTGGCACTTGCCGAAGGGTCAGAGGTGATGAACATTACGGAAACAGCAGGGGTATC
+AAAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCACTGCCGTGGACTCAC
+CCTGATCCATGCGTGCAGCAACTACTGGGTTAATGTCATGCGCGGGTGCCTGGCGAGCTA
+CTCCGAGCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGCAGGACCTCACGCAAAT
+GGTTGCCGGAGCTCACAATTTAGAGCTGGCCTTACTGGGGATCAGAGGTCAGGTCGAGGA
+GGCCATACTCTACGCTCAGCTTCACGGGCCCAGGCTAACTGCCACAGTGAGTACTAGCAT
+TTTTACGCTTTTACAGCTAGCATTAGCTTGTATTGTAGCATGAAAAAAGGTCTACAGAGT
+TATGAAGCACAAAGACCTCTTCTGCTATAAGCGGGTTTCTGAACTC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,526
+}
+{RED
+iid:19
+eid:zfish35935-867d02.p1c
+seq:
+TTTTAATGAACATCAATGCCCTTACTTTGAGCTGTAGGAGTCCACAATGAAGGAATGTAG
+AGGTTACATCGCATCAATGCTCCCACAAATGAATTACTCACTTGTCTGTCATCTCCTGTC
+CGTTCCAGCAGAGGGAGCTGTTCAGCGATGTCGGCTCTTTGCTGCACAAAGCTTCTTCGA
+GACCACTGTAGAACTGACTGAAGCCCCTTAGACCCGAGATAAACTCCCTGCATCAGACAG
+AGAGGAAATTGAGAATGTATTGAGTGCAGGCGAAAGAAGAAAGAGGAATGGGCTTCAGTG
+AAAATTGAAATTAGATGGTGTGCACAAAGAGACAAGATTAAGAATCCAAAATACTTGGAT
+TTATGAGAAAATGTAGAGGCTTAGAGAAAGAAGAACGACGAATCAGGAGAAAAAAATAGA
+GTTGGGGTCAAATGCAGTGTTAAGCACGATCTACTCCATTACATATCATTTCCTGTCGGG
+CTAAGTTGCTTTGAGATGCTTTGATTTTAATTGACATTACCTACACACACTCTCTCACCT
+GCTCATCAGAGCGAGGGAACGAGAG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,565
+}
+{RED
+iid:20
+eid:Z35725-a4990c08.q1c
+seq:
+TTAATTCTTTCCCGGATGCGTATAAGTCCCAGTTCCACTTCATATCTCTCTGATAATGCC
+CCACTCAGCTTCTCCAGAAGCGATACATAGTCTCGCCAGGGAGCATCCAGCTCAGCCACG
+CCTGCCAGGCAACCTCGCATCACGTTGAGACATAGGCCTCCACATGGCCGGATCAGGGTC
+AGTCCTCGACAGTGAGGACAGAACAACATGCGCACTAGTGCACGTCCACACACTCGTCCC
+ATGCCCACAGACTCTGTGATGTTAAGTACATCTGCACCGACTGCCAGTGCCCGGCTGAGG
+GCACGACCAACCACAAGCGCCTTGGACAGTCCTTGAGCAAGTTCTTGTGGGTGATGGCCA
+AAGGGATAGATATCATGCCGTGTGGCACGAAGGCACTCAGTTCCTTCGGCAGACCAGGTT
+GAAACAGGTGAACCCAAGCCAGGATTGACCAGATGCTGGTACACCAATGGGAAGAGTTTG
+TCATAAAATCTGTAAACCGAGTGTTCCACAGAAACGTTATCATCGCC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,527
+}
+{RED
+iid:21
+eid:Z35725-a2723a07.q1c
+seq:
+AAACTCATCAATCCCACAATCCATCACTCCTGCATTTACTGAGCATCAATGAGTGATGAG
+GAGGAGGAGGAGGAGGAGGAGGAGGAGGAGGGTTAATGCAGAGCTTCACCATCTTCATCA
+CCATCTTCAGTCAGATCCAGCAGAGCTCTGTGCTCCTGCAGCCTCACTCACAGCCACTGG
+TGTGTGTGTGTGTGTGTGTCTGTCTCTATGTGTGTGTAGCTGCGCGCGGGGCCAGAGTGT
+GTGCGCGCGCTCATGCGTCAGTGGTTCTGTCCTCTGTGTCGGGGTCTTCCGTCACTCAAG
+CCCTGTCATTCGCTGTGCCTGAACATCATGAAGGGCTGTCTGGCCAATCAGGCGGATCTA
+AACAGCGAGTGGAACAGCTTCATTGGTGAGAACAGAACACCTCTGCTTCATTTACTGTGT
+GTGTGTGTGTGTGTGTG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXX
+.
+clr:0,437
+}
+{RED
+iid:22
+eid:Z35725-a4262h12.p1c
+seq:
+AGCTGGATGTGATCGGTCGTCTTTATGATCTCGATGCCCAAATGGAGCGCTTGGAGAAAC
+ACGCGAGCAGGTAGAGAAGCATGGGCGATTTGGGACGCCAGGCGGATTGGGGCTGCTCCG
+AACGGTGCTAGATCTTGAGCAGACGAGCGCAGGCCTTCGGCGTATGGAGGAGACAGACGG
+GAGTCAATCAGACGCTCGTCTATTAAGGGGAAAAGAGCGTTGAAGAAGCTCTGAGAGGAC
+TCTTCTAGACTGAGCTCAGAGCCCAGGATGAACAGAGCCACTTCTGTGAAAAACTCCCCG
+ACTGGTGCTGATGCTGCTGGGCTGGAGAGATCACGCTGGGACTGATGGAGGATGGAGAGG
+GTGTGGTTCTCCGCCTGACGCACCATATACTCCACGCTTTCTGAAAGAAATAATAGAGTA
+GAAAAAAGTTTATTAGTAAAGGATTAAAGTGTTGAAAGTTGCCTAACATAATAAAAA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,477
+}
+{RED
+iid:23
+eid:zfishJ-a1618g07.q1c
+seq:
+TTATCTTGCATATTGTCAGCGGCTTCCTCACATTATAGCACTACACAATATTATTATGTT
+AAAAACACAGTAGCCTAGGTAAGTCTACAATTACATCCCTGAAAGACATCTGAAATGAAG
+CAGGTCATCTGCATGTAGACACCCCACCACCTCAAAAAAAAAAAAAAATACTTTGGATTT
+ATGCAAATTACAGGGGTCACCCCATTGAGCTTGGAAAAAATCACATCACATTCCTACTAA
+TAACACTAACTTGCCTAGTTAACATAGTTAAGGACTGAATACTTGGATGTTGATGAATAT
+TCAGTAGAAATGTATTTACTGTCATCATGGCAAAGATAAAAGATATCAGATATTAGAAAT
+GAGTTACTGAAACTATTATATTTAGAAAAGTGTTAAAAAAATCTTTCTGATAAACAGAAT
+ATGGGGAAAAAAATATATACAGAGGAACTAACAATTAAGGAGGGCTAATAATTGCGGACA
+CATTTAAAGCATGTTAATACTGCAGGTCTTTCTTACCAAGGAAGTTATTCCACTCTGTGT
+CCAGATCGGCCTGATTGGCCAGACAGCCCCTCATGACATTCAGACAGTAGTTCTTGCAGG
+GCTTCAGCGCCACCTGACCGCTACAGTACGGGCAGTATAACATCTTCATCGATG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,654
+}
+{RED
+iid:24
+eid:Z35724-a4493f05.p1c
+seq:
+TGCCTTATCATAAATGCATTATTTTTGAGATTGATCTGGCTCCATGATGCAATCTTTTGC
+ATTTTCTGTCACAGTTATACACCAAATTCTATTTATGTCTGGATTCCTCAGTTTTGTCAG
+CATTGTGTAAATCACAGGGCCCTAAATGAGCCTCTGTTGTTACATCAACATATATTCATT
+CACACATCAATCAACTTCATCTATTTGCCCATTCGTTTCACTTATCAATCATCCATTTCA
+TCCTTCCACCATCCATTCAATCATCCATGCATCTGTGTACCCTGGAAGGCGGCGGCGTGT
+GCAGAAATGAGAAATTTGAGCTCATAGCTGTACGATCCGATGTTCTGGGTGGTGTCTCTC
+AGGACCGCCGCTCTGTAACTGTCTTCCATTCTTCGTGTACAACATGATGGCCCCGCATGC
+TTGCACACCGACAGTTCCACATCTGC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,446
+}
+{RED
+iid:25
+eid:Z37249-a879d08.p1c
+seq:
+GATACATCCAGCTGAGCCGCGAGTGCAGACGTGGCCTACTGAGGATGAGCTACTGCCCGC
+ACTGCAAGGCTCTGACCTCCAGCAAACCCTGCTTGGGATACTGCCTGAACGTGGTGCGCG
+GGTGTCTGGCTAACCTGGCTGAAGTGGATGCCCACTGGAGGGAGTTTGTACGCTCGCTGG
+AGACGCTGGCAGTACGGATGCACGGAGAGCTGGATCTGGAGCAGGTGCTGCTGGGGGCGC
+ATGAGCTGGTGAGGGACGCTGTGGCGCACGCTCAGAGGAGCACAGCGAGGATACATGCGC
+AGGTGAGAGGATGAGTGTGTG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,321
+}
+{RED
+iid:26
+eid:Z35724-a5018a04.p1c
+seq:
+CTGCGTATGGGTCATTTCCCAAGATGATGATGACCCGACTATCCCGCTCACTCCTCGCCA
+CTCGGGTCTTCCTGCAAGCGCTAAATTTGGGCATAGAAGTGGTCAACACCACTCAGCATT
+TGCGGGCAGGTAGAGATTGTGGGCGCTCGCTTCTGAAACTGTGGTACTGCCCGCACTGTC
+AAAGCCTGCTGGAGGCCCGGCCGTGCCGTCCACTGTGTATCAGCACCATGGGAGCATG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,238
+}
+{RED
+iid:27
+eid:Z35724-a5061b04.q1c
+seq:
+AAAGTAATAACATGTCATATGACCCACCTGCTGTGGCAGGGACTTGATCCCATGACCTAC
+TACTGCCGCTGCTGCGAATGCAAAAAGCACATGTCCTAGTGTTTGTTTGGCCAATAAGCT
+TCACTCCATCTCAATACATACCCTGGAAGGAAGAAGCATGGCCCAGGATGAGATACTTGA
+GTTCGAAGCTATAGGAGAGAATGTTTTGGAGTGTGTCTCTTTGAGCAGCTGAGTAGTAGC
+TCTCCTCCATCTTGCGGGTACAGCATGTGGGACCCTGGTGTTTACAGATGAGAAGTTCTG
+CATCTGTGATGGATTAATCATAGAAGGTGACTTAAGTCGAAACATTTGTGCCTATTTAAA
+CCACATGTCTCATAACTTTCATATGTTGGATTTCTGAGTACAGGTGCTAACCCTCATGCA
+ATGCCTCCTCTAAAGTTCTCTTTCTAAGCTAACAAACTGATTATGAACACTGAATG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,476
+}
+{RED
+iid:28
+eid:Zfish35936-361d06.p1c
+seq:
+TACACACACACACACACACACACACACACACACACACACAAACACACACACACACACACA
+CACTATAATCTGCTGGTTTGCTCCATAGAACTCCATATAAAAGCCAGAAACTTGTATGAT
+AGGCCTATATAAAGGGTTAATGGTGACAACTGATGATCAACAGTAAAACTTAAACATTTG
+ACCTCTTCCCAACAGGAAAACCAACAATAATCAAGAATGCATAATTATATGTCTTGGCTT
+TGTAATCAAAAAATGTGATTATGATGGAAGTCAATGGGGCAAAAACAGCCACCAACATAA
+TGAAGGGGTAGTCAATTTGAACAGCAGAGAAGGATTAAGACCACTGATCATTCTATCATT
+ATCACTCATTTAAATCTTTCTTCTTTTTCAGATACGTTCCAGTCCCTAATATCCTTCTCC
+CAGAACCACCTGACCTCTCTGTTTGAGACCACATACTCATCCCTCATGTCGTCCATCTCC
+CCTCACATCGTCTGCCTCTTCACGGACCTCTCTCGCTTCCTCCAGGGCACCGGCAACGTC
+TCGGTGGAAGCTGCTGTGCACTGTTTCTTCGACAGCCTTTTCCCATTGGTCCACACTC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,598
+}
+{RED
+iid:29
+eid:Zfish35936-498b08.q1c
+seq:
+TCTGAGCGTGCGCCCAGCGTCCCTCACCAGCTCATGCGCCCCCAGCAGCACCTGCTCCAG
+ATCCAGCTCTCCGTGCATCCGTACTGCCAGCGTCTCCAGCGAGCGTACAAACTCCCTCCA
+GTGGGCATCCACTTCAGCCAGGTTAGCCAGACACCCGCGCACCACGTTCAGGCAGTATCC
+CAAGCAGGGTTTGCTGGAGGTCAGAGCCTTGCAGTGCGGGCAGTAGCTCATCCTCAGTAG
+GCCACGTCTGCACTCGCGGCTCAGCTGGATGTGATCGGTCGTATTTATGATCTCGATGCC
+CAAATGGAGCGCTTGGAGAAACACGCGAGCAGGTAGAGAAGCATGGGCGATTTGGGACGC
+CAGGCGGATTGGGGCTGCTCCGAACGGTGCTAGATCTTGAGCAGACGAGCGCAGGCATTC
+GGCGTATGGAGGAGACAGACGGGAGTCAATCAGACGCTCGTATATTAAGGGGAAAAGAGC
+GTTGAAGAAGCTCTGAGAGGACTCTTCTAAACTGAGCTGAAAGCCCAGGATGAACAGAGC
+CACTTATGTGAAAAAC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXX
+.
+clr:0,556
+}
+{RED
+iid:30
+eid:Z35725-a875b07.q1c
+seq:
+TGTTAGTCTCTCATGTTACGACCGTTTATCCATCTAAGATGACTATGAAATAGCTGTTCG
+TGGAGGTCTTTTTCAGTGCTTCTTCAGTCCAAAATCTTTCTTTTATTTCCTCTTCCCACA
+GATACCTTCCATTCCCTGCTCTCGTTCACTCTAAATCATACCAACTCACTTTTCGACACC
+ACCTACGAGACAATCTCCCAAGATGCAAGACCACTGGTGTCCACCCTCTTCAATGACCTT
+GATCTCTACCTTCGAGGCGATGATAACGTTTCTGTGGAACACTCGGTTTACAGATTTTAT
+GACAAACTCTTCCCATTGGTGTACCAGCATCTGGTCAATCCTGGCTTGGGTTCACCTGTT
+TCAACCTGGTCTGCCGAAGGAACTGAGTGCCTTCGTGCCACACGGCATGATATCTATCCC
+TTTGGCCATCACCCACAAGAACTTGCTCAAGGACTGTCCAAGGCGCTTGTGGTTGGTCGT
+GCCCTCAGCCGGGCACTGGCAGTCGGTGCAGATGTACTTAACATCACAGAGTCTGTGG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,538
+}
+{RED
+iid:31
+eid:Zfish35937-106h01.p1c
+seq:
+GCCAGCTTAGTTTATAAAATGCCGCGGTCTGTTTACTTGTTTATTGTGACGGCTGTTACA
+AATCTTCTCTCTGTTATTCTACAGGCTCAGATCTGCAGGTGTGCCAGCCAAAAGGCCTGA
+CTTGCTGTTCTCGCAAAATGGAGGAGCGTTACCTGCTTATTGCCAAACAGAATATGGAGT
+CTAGCCTTCAGGCCACCAGCGCTCAGCTCAAAGGGCTCATCATCCAGAATGCTGCCCTCT
+TTCAAGGTGAGTGGGTGCTACATTTCTGTTTGTGAAGCCATTTTTGGGTACATTTTTGTC
+ATAAGTTAAACCTTTAGCATCCCCTCGGGCGGAAAGCTGAAATGCTTACAGTCAAGAACA
+CATTAATTCTTAACA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXX
+.
+clr:0,375
+}
+{RED
+iid:32
+eid:zfish41359-578a11.p1c
+seq:
+GGATCTCTACCTTCGAGGCGATGATAACGTTTCTGTGGAACACTCGGTTTACAGATTTTA
+TGACAAACTCTTCCCATTGGTGTACCAGCATCTGGTCAATCCTGGCTTGGGTTCACCTGT
+TTCAACCTGGTCTGCCGAAGGAACTGAGTGCCTTCGTGCCACACGGCATGATATCTATCC
+CTTTGGCCATCACCCACAAGAACTTGCTCAAGGACTGTCCAAGGCGCTTGTGGTTGGTCG
+TGCCCTCAGCCGGGCACTGGCAGTCGGTGCAGATGTACTTAACATCACAGAGTCTGTGGG
+CATGGGACGAGTGTGTGGACGTGCACTAGTGCGCATGTTGTTCTGTCCTCACTGTCGAGG
+ACTGACCCTGATCCGGCCATGTGGAGGCCTATGTCTCAACGTGATGCGAGGTTGCCTGGC
+AGGCGTGGCTGAGCTGGATGCTCCCTGGCGAGACTATGTATCGCTTCTGGAGAAGCTGAG
+TGGGGCATTATCAGAGAGATATGAAGTGGAACTGGGACTTCTACGCATCCGGGAAAGAAT
+TAATGATGCCATCCTCACTGCGCAACTGCACGGG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,574
+}
+{RED
+iid:33
+eid:zfish41361-361g04.p1c
+seq:
+GGATCAGGGTGAGTCCACGGCAGTGAGAGCAGTAATGCATGCGTACCAGAGCCCGTGTGC
+ACTCTTTTGATAACCCTGCTGTTTCCGTAATGTTCATCACCTCTGACCCTTCGGCAAGTG
+CCAAGCTGAGCACCCGCCCAGCCCGCAATGCGTCCGCCAGATCTTTTGCCATTGCTTTTG
+GGTGCGGACCAAAGGGGTTTACGTCCTGCCTGGTCATTCGGAGACAGTCACCAAGCTGGT
+TGCCTTCAGAAGCATCTGTCCCAATACTTCCTTCCATACCGGGATTGACAATCTGAGTGT
+GGACCAATGGGAAAAGGCTGTCGAAGAAACAGTGCACAGCAGCTTCCACCGAGACGTTGC
+CGGTGCCCTGGAGGAAGCGAGAGAGGTCCGTGAAGAGGCAGACGATGTGAGGGGAGATGG
+ACGACATGAGGGATGAGTATGTGGTCTCAAACAGAGAGGTCAGGTGGTTCTGGGAGAAGG
+ATATTAGGGACTGGAACGTATCTGAAAAAGAAGAAAGATTTAAATGAGTGATAATGATAG
+AATGATCAGTGGTCTTA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXX
+.
+clr:0,557
+}
+{RED
+iid:34
+eid:Zfish37251-3543e11.p1k
+seq:
+TGAATGTGTGCGTGCTGTCATGAAGCAGACGTATTGTCCTCACTGTAGTGGCGTGGCCTT
+GGCCAAACCCTGCTCAAACTACTGTCGAAATGTCTTAAAAGGCTGCCTCGCCAATCAAGC
+AGACCTGGACACTGAGTGGAGGAACCTTGCAGGTGGGCGGGACCAATAAACAACTCTATT
+TGCTTAAGTCTGACATCAAAAGTCACTGTTTCTTGGTACAAAAGCTCTAGCAGATGCCAA
+AAGCAAACAACAAATTTAACAAAGCAGATTTTATAGTAGAATAACTATATATACACCAGG
+GGTTTCAAACTGTGGGGCTTGCCAGCACCTATTAAGAGGGACGCGAGACATTGAGGCGTG
+CACTTGAGTAAATTATGATGTCGATTTTTATGCGTTTACTAGATGGAATAAAACGATTTA
+TGTTAGCTCCACAGCTAATTATTAGGCACCTGTAGAGTTAATGTGTTCCAGTAAAATATA
+TACAAATAAAATGGAAAGAGTGCTTTTTAAAACTAATGACGGTGAATAAATGAAAGTCAA
+ACCGCTGAGCCATCTGACAAAAAAGTGCCCTTCTGAATCAAATCAGGAGAATGCCCATTT
+GGATCTTTCACGTACTTTGAAGATACTGACTACATTTACATGGACA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,646
+}
+{RED
+iid:35
+eid:Zfish44625-1002a03.p1c
+seq:
+CTAATTAACATGCAGCTATATAGTGGATAGGTCAGTGTTTCCCAACCTCTTCCTATACAA
+ACACACTTGAATGAACTCATCAGATCAGTAAAAGAGACTCCAAAACCTTGAATGGATAAG
+GGAGACTAAGTACTGTTGTATAGGTATAGGTGATGAACAAGTATAGGTGATGTCTATGTG
+TGCATGTTCAATTGAGTGTATTTGTGTATTAAGTGTTGTTTTTTTACATTGCCACTTTAG
+ATAACAAATAATATTTGTTCTTTTTCAGGTTCAGACCTGCAGGTTTGCTTATCCAGGAAT
+CTAACATGCTGCACCAAAAAGATGGAGGAGCGTTACCAGGTGGCGGCCCGGCGGGATATT
+CAAAACCTTCTCCAGATCTCTAGCTCCAGCCTAAAGTTCCTCTTCTCACGAAATGTGGCC
+GCTTTCCAAGGGTGGTGCGCTGGTTAATCATGCTTGGGTGGTTTATCTACAGCCTTGGTG
+AAGCTGGTAGTTTGCGGTACTCTTGTTTAGTATGAT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,516
+}
+{RED
+iid:36
+eid:Zfish44625-1390e06.q1c
+seq:
+ATTAACATGCAGCTATATAGTGGATAGGTCAGTGTTTCCCAACCTCTTCCTATACAAACA
+CACTTGAATGAACTCATCAGATCAGTAAAAGAGACTCCAAAACCTTGAATGGATAAGGGA
+GACTAAGTACTGTTGTATAGGTGTAGGTGATGAACAAGTATAGGTGATGTCTATGTGTGC
+ATGTTCAATTGAGTGTATTTGTGTATTAAGTGTGGTTTTTTTACATTGCCACTTTAGATA
+ACAAATAATATTTGTTCTTTTTCAAGTGCAGACCTGCAGGTGTGCTTATCCAAGAATCTA
+ACATGCTGCACCAAAAAGATGGAGGAGCGTTACCAAGTGGCGGCCCGGCGGGATATTCAC
+AACCTTCTCCAGATCTCTAGCTCCAGCCTAAAGTTCCTCTTCTC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,404
+}
+{RED
+iid:37
+eid:Zfish44625-1404f05.p1c
+seq:
+CTAAATCTGTCAACCCATAAATCTAGCCTCAATCAATCCATAATTCTATCAAGCAATGCA
+TCCCTCCGTCCATCAATCCATCCGTCATAATCATTGTGTCTGAAGACTGTTTTATGATGC
+ATCTGTGCTTTTGTTAATTGTGCTGTAGTTTACATACAGAACAGCCAAGCATACAGGTTA
+CTGACCTCATCAAAACCCCGTGTAAATGTGTGTGTGCTCTAGGTGTGTGTGTTCCTCTTA
+CCGATATATTTGCTCCATTCGTTGTTGAGATCGGCCTGGTTTGCCAAGCAGCCCTTCATG
+ACATTCAGACAGTAGTTTCTGCATGGCTTCAATGTGAACAGACCCTGACAATACTAGCAG
+TAGAGCATCTTCCTGAAGCCGCTGACACACGACGAGCTCATGCTGACCTGCGCACACACA
+CACGCGGCAATAATACAACAGTCACCACACTACTTGTAGTGACGCTACAGCCTGACACTG
+GATGTCTCATAGTTTTGATTCG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,502
+}
+{RED
+iid:38
+eid:Zfish44625-2317e06.q1c
+seq:
+CCCAAGGGGAGAGGTGCTGAACATTACCGAAACAGCAAGGGTATCAAAAGAGTGCACACG
+GGCTCTGGTACGCATGCATTACTGCTCTCACTGCCGTGGACTCACCCTGATCCATGCGTG
+CAGCAACTACTGTCTTAATGTCATGCCCGGGTGCCTGGCGAGCTACTCGGAGCTCCACCA
+TCCCTGGAGACAGTGTGTCACCATATTGCACGAGCTGACGCAAATGGGTGCCGGAGCTCA
+CAATTTAAAGCTGGCCTTACTGGGGATC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,268
+}
+{RED
+iid:39
+eid:Zfish44625-3247c04.q1k
+seq:
+CATTACAATATAATATTAAAAATTAAATATTCATTATTGATTATTAAAGAATTTTATTCC
+ACCCATATTTTGACAAAATTATATTCTGAAAAAATAATAAAGTAGCCAACTTGGTTGCCT
+TTAATAATGTGCTGAAAATAAAACCCAAAATATTAAGTCATTCTAAATGGGAAACTATGC
+ATGCTTGCATGTACCTGGAATTATTGAGAAGACTTAATTTTTTTATTATGTGAGACAACT
+TTCAAAACTTTAATCCTTTACTAATAAACTTTTTTCTACTCTATTATTTCTTTCAGAAAG
+CGTGGAGTCTCTGGAGCGTCAGGCGGAGAACCACACCCTCTCCATCCTCCATCAGTCCCA
+GCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTTTTTCACAGAAGTGGC
+TCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTTCTTCAACGC
+TCTTTTCCCCT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXX
+.
+clr:0,491
+}
+{RED
+iid:40
+eid:zfish44906-116d04.p1k
+seq:
+CGAAGGCAACCAGCTTGTTGACTGTCTCCGAATGACCAGGCAGGACGTAAACCCCTTTGG
+TCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGGGCTGGGCGGGTGCT
+CAGCTTGGCACTTGCCGAAGGGTCAGAGGTGATGAACATTACGGAAACAGCAGGGTTATC
+AAAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCACTGCCGTGGACTCAC
+CCTGATCCATGCGTGCAGCAACTACTGTCTTAATGTCATGCGCGGGTGCCTGGCGAGCTA
+CTCCGAGCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGCAGGACCTCACGCAAAT
+GGTTGCCGGAGCTCACAATTTAGAGCTGGCCTTACTGGGGATCAGAGGTCAGGTCGAGGA
+GGCCATACTCTACGCTCAGCTTCACGGGCCCAGGCTAACTGCCACAGTGAGTACTAGCAT
+TTTTACGCTTTTACAGCTAGCATTAGCTTGTATTGTAGCATGAA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,524
+}
+{RED
+iid:41
+eid:zfish44906-511d11.q1k
+seq:
+CCCTGATCCGGCCATGTGGAGGCCTATGTCTCAACGTGATGCGAGGTTGCCTGGCAGGCG
+TGGCTGAGCTGGATGCTCCCTGGCGAGACTATGTATCGCTTCTGGAGAAGCTGAGTGGGG
+CATTATCAGAGAGATATGAAGTGGAACTGGGACTTCTACGCATCCGGGAAAGAATTAATG
+ATGCCATCCTCACTGCGCAACTGCACGGGCCACATCTTAGCGCCGTGGTGAGTCATGCTA
+CTCTCTGATTCATAGAACACATTTATTTTTATTACACGAACGAGCTGCACCATGTGTTGG
+ACTAATCAATTCTAGTGGGGGTGCACTTGAAGCAGCATGTTTGGTGACTGGTGCATATCA
+AATGTCTCGACCAATCGTAGTCTGTGCAGTTACAAGGCTGCCGTTTTGCACATTTAAGAC
+GTTTTGGCTTTAATCTAAAATAAATAACTTGTATAAATTCGCATTTTAGCCTAAAGTTTT
+CAGTTCTAAATTGTGTAAAACAAAGCCCTATGATTATTCTATCT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,524
+}
+{RED
+iid:42
+eid:zfish44907-178g11.q1k
+seq:
+TACACACACACACACACACACACACACACACACACACACAAACACACACACACACACACA
+CACTATAATCTGCTGGTTTGCTCCATAGAACTCCATATAAAAGCCAGAAACTTGTATGAT
+AGGCCTATATAAAGGGTTAATGGTGACAACTGATGATCAACAGTAAAACTTAAACATTTG
+ACCTCTTCCCAACAGGAAAACCAACAATAATCAAGAATGCATAATTATATGTCTTGGCTT
+TGTAATCAAAAAATGTGATTATGATGGAAGTCAATGGGGCAAAAACAGCCACCAACATAA
+TGAAGGGGTAGTCAATTTGAACAGCAGAGAAGGATTAAGACCACTGATCATTCTATCATT
+ATCACTCATTTAAATCTTTCTTCTTTTTCAGATACGTTCCAGTCCCTAATATCCTTCTCC
+CAGAACCACCTGACCTCTCTGTTTGAGACCACATACTCATCCCTCATGTCGTCCATCTCC
+CCTCACATCGTCTGCCTCTTCACGGACCTCTCTCGCTTCCTCCAGGGCACCGGCAACGTC
+TCGGTGGAAGCTGCTGTGCACTGTTTCTTCGACAGCCTTTTCCCATTGGTCCACACTCAG
+ATTGTCAATCCCGGTAT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXX
+.
+clr:0,617
+}
+{RED
+iid:43
+eid:zfish44907-380d11.p1k
+seq:
+CAGGAAGTATTGGGACAGATGTTTCTGAAGGCAACCAGCTTGGTGACTGTCTCCGAATGA
+CCAGGCAGGACGTAAACTCCTTTGGTCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGG
+ACGCATTGCGGGCTGGGCGGGTGCTCAGCTTGGCACTTGCCGAAGGGTCAGAGGTGATGA
+ACATTACGGAAACAGCAGGGTTATCAAAAGAGTGCACACGGGCTCTGGTACGCATGCATT
+ACTGCTCTCACTGCCGTGGACTCACCCTGATCCATGCGTGCAGCAACTACTGTCTTAATG
+TCATGCGCGGGTGCCTGGCGAGCTACTCCGAGCTCCACCAGCCCTGGAGACAGTATGTCA
+CCATATTGCAGGACCTCACGCAAATGGTTGCCGGAGCTCACAATTTAGAGCTGGCCTTAC
+TGGGGATCAGAGGTCAGGTCGAGGAAGCCATACTCTACGCTCAGCTTCACGGGCCCAGGC
+TAACTGCCACAGTGAGTACTAGCATTTTTACGCTTTTA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,518
+}
+{RED
+iid:44
+eid:zfish44907-1567g01.p1k
+seq:
+CCACCAGACTGAAAAATTCTTCCAACAGACAAAAATCCTTGGGAAAACATGAGCTTTGAA
+AATTAAATGTGACCTTAAGCTATTCCAAATTATTTATCAGGCTATACTCATTCCCTTGTG
+CGCTCATTTTTATTTACACATGCCATGTACCTTGGCAAGGCTCCAAAGTAACCACAATGA
+TGTGGAACAGTTATTCTGCACCGCTGCAAGCATACAGAAGAACTATTAATCTTAGTTTAC
+ATGTCTGCAAACTGAATGACGCCACCTAATGAACTTACTCACGTTTTAATGAACATCAAT
+GCCCTTACTTTGAGCTGTAGGAGTCCACAATGAAGGAATGTAGAGGTTACATCGCATCAA
+TGCTCCCACAAATGAATTACTCACTTGTCTGTCATCTCCTGTCCGTTCCAGCAGAGGGAG
+CTGTTCAGCGATGTCGGCTCTTTGCTGCACAAAGCTTCTCCGAGAACACTGTAGAACTGA
+CTGAAGCCCCTTAGACCCGAGATAAACTCCCTGCATCAGACAGAGAGGAAATTGAGAATG
+TATTGAGTGC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXX
+.
+clr:0,550
+}
+{RED
+iid:45
+eid:zfish44907-916g10.p1k
+seq:
+CTATCCTTCTCCCGAACACCTGACCTCTCTGTTTGAGACCACATACTCATCCCTCATGTC
+GTCCATCTCCCCTCACATCGTCTGCCTCTTCACGGACCTCTCTCGCTTCCTCCAGGGCAC
+CGGCAACGTCTCGGTGGAAGCTGCTGTGCACTGTTTCTTCGACAGCCTTTTCCCATTGGT
+CCACACTCAGATTGTCAATCCCGGTATGGAAGGAAGTATTGGGACAGATGCTTCTGAAGG
+CAACCAGCTTGGTGACTGTCTCCGAATGACCAGGCAGGACGTAAACCCCTTTGGTCCGCA
+CCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGGGCTGGGCGGGTGCTCAGCTT
+GGCACTTGCCGAAGGGTCAGAGGTGATGAACATTACGGAAACAGCAGGGTTATCAAAAGA
+GTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCACTGCCGTGGACTCACCCTGAT
+CCATGCGTGCAGCAACTACTGTCTTAATGTCATGCGCGGGTGCCTGGCGAGCTACTCCGA
+GCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,578
+}
+{RED
+iid:46
+eid:zfish44907-2086c11.p1k
+seq:
+CATCAGGCTATACTCATTCCCTTGTGCGCTCATTTTTATTTACACATGCCATGTACCTTG
+GCAAGGCTCCAAAGTAACCACAATGATGTGGAACAGTTATTCTGCACCGCTGCAAGCATA
+CAGAAGAACTATTAATCTTAGTTTACATGTCTGCAAACTGAATGACGCCACCTAATGAAC
+TTACTCACGTTTTAATGAACATCAATGCCCTTACTTTGAGCTGTAGGAGTCCACAATGAA
+GGAATGTAGAGGTTACATCGCATCAATGCTCCCACAAATGAATTACTCACTTGTCTGTCA
+TCTCCTGTCCGTTCCAGCAGAGGGAGCTGTTCAGCGATGTCGGCTCTTTGCTGCACAAAG
+CTTCTCCGAGACCACTGTAGAACTGACTGAAGCCCCTTAGACCCGAGATAAACTCCCTGC
+ATCAGACAGAGAGGAAATTGAGAATGTATTGAGTGCAGGCGAAAGAAGAAAGAGGAATGG
+GCTTCAGTGAAAATTGAAATTAGATGGTGTGCACAAAGAGACAAGATTAAGAATCCAAAA
+TACTTGGATTTATGAGAAAATGTAGAGGCTTAGAGAAAGAAGAACGACGAATCAGGAGAA
+AAAAATAGAGTTGGGGTCAAATGCAGTGTTAAGCACGATCTACTCCATTACATATCATTT
+CCTGTCGGGCTAAGTTGCTTTGAGATGCTTTGATTTTAATTGACATTACCTACACACACT
+CTCTCACCTGCTCATCAGAGCGAGGGAACGAGAGAGAGGAACCGTGCAGGACAGAGGGGG
+CAGAAGGCAGCTCAATGTCACTCACACGGCAGGAGACAAAGCCTGTGTTAATGAGCTTCT
+CTCTGTCACCATCAGCCTGAACACACACTTACCTCAGCTAACAGCCCAAACACACAAACA
+CAACTCATACACAAACTGCCACACACAACGACTCAGACACCCACCTACTCAGACATGTGC
+CACCTCAAAGTTTGAAAGCAACTTCCCTTAGTAACTATGTTTTAGATGATTCAT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,1014
+}
+{RED
+iid:47
+eid:zfish44907-2216h07.p1k
+seq:
+CGCAACAACTCAAACAGTCTCATTTCCAGTATTGTTTAAATAAAGAATACATAAAATAAT
+AAATAAAATAAAGTGTTTTTGATTGAAAAAAGGCACCCAACTGGAAGTTCTTTATAGGGG
+ACATCTATATTAGAAAACCCAGCTTAAGGTACAATAGCAAGCGCATCTCACCAATAAAGA
+GGTTCCACTCAGGGTCCAGATCCGCTTGGTTGGCCAGGCAGCCGCGCATCACATTCTGGC
+AGTAGTTGGCGCAGGGTTTGAGTCCTGACATTCCTCCACAATACGGGCAGTACCACATTT
+TAGTCAATGCTTTACTGCAGCCTGGAGAAATATTGACCTGCAGGATAAACACACATGGGC
+AGATGTTAAATGTGCTTTGAAATGTGCATTTTTTTTTATTTAAAGTTTGACGTAATCCCA
+ACTGAAACATAAAGAGAGAGCAGGACATACAGTAGCTCCTCCCAAAAAACAGCCAATATA
+GTTTCATTTTTTATCACAGCCTTGCCAGTGACAGGGACTGTACCTGTATGCCTACAACTG
+ATGTCAAAATTATTCGCCCTCCTGTGATTTTGTTTTACTTTTTCAAAT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,588
+}
+{RED
+iid:48
+eid:zfish44907-3109g10.p1k
+seq:
+CCTGTTTGAGACCACATACTCATCCCTCATGTCGTCCATCTCCCCTCACATCGTCTGCCT
+CTTCACGGACCTCTCTCGCTTCCTCCAGGGCACCGGCAACGTCTCGGTGGAAGCTGCTGT
+GCACTGTTTCTTCGACAGCCTTTTCCCATTGGTCCACACTCAGATTGTCAATCCCGGTAT
+GGAAGGAAGTATTGGGACAGATGCTTCTGAAGGCAACCAGCTTGGTGACTGTCTCCGAAT
+GACCAGGCAGGACGTAAACCCCTTTGGTCCGCACCCAAAAGCAATGGCAAAAGATCTGGC
+GGACGCATTGCGGGCTGGGCGGGTGCTCAGCTTGGCACTTGCCGAAGGGTCAGAGGTGAT
+GAACATTACGGAAACAGCAGGGTTATCAAAAGAGTGCACACGGGCTCTGGTACGCATGCA
+TTACTGCTCTCACTGCCGTGGACTCACCCTGATCCATGCGTGCAGCAACTACTGTCTTAA
+TGTCATGCGCGGGTGCCTGGCGAGCTACTCCGAGCTCCACCAGCCCTGGAGACAGTATGT
+CACCATATTGCAGGACCTCACGCAAATGGTTGCCGGAGCTCACAATTTAGAGCTGGCCTT
+ACTGGGGA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXX
+.
+clr:0,608
+}
+{RED
+iid:49
+eid:zfish44907-3066f07.p1k
+seq:
+CCACTCGTTCGGGTCTGCTGACACTGACTTTGCTGACAAGTCTTTGGAGGTTGAGTTTTG
+GAGAGAGATGGCGTTAGCAAAAATGGCTGAAGTTAGCAAAATGGCTGCAGTCGCCTACAG
+CATTCGAATTCATACCTTGTTTCTGAGACCATGTGTCACTCACCTGGGCGCTGACTTTGC
+TCTTGCTTGCCACGGCTTGTTTGAGAGCCTGTCTGATAATGACATGCAGTCGGAGCACCA
+CAGCCTCGATGTCCTGTTCCCCCTTCATGGCAGCGGCGAGTGACCCCAGTTCATCCACAT
+ATGCTCTCCAATGAGGCTGTACCTCCGTGGTTCCCCCCAAACATGCTCCCATGGTGCTGA
+CACACAGTGGACGGCACGGCCGGGCCTCCAGCAGGCTTTGACAGTGCGGGCAGTACCACA
+GTTTCAGAAGTGAGCGCCCACAATCTCTACCTGCCCGCAAATGCTGAGTGGTGTTGACCA
+CTTCTATGCCCAAATTCAGCGCTTGCAGGAAGACCCGAGTGGCCAGGAGTGAGCGGGACA
+GTCGGGTCATCATCATCTTGGGAAATGACCCATAAGCAGAGCTCCCTTTCCAGGCCCCGC
+GGAGGCATTCTTCAGAGATGCCCGCCACGGCCCCATTGC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,639
+}
+{RED
+iid:50
+eid:zfish44908-398f07.q1k
+seq:
+TTTTGGAAGTTTTACTGCAGAGCAACACAGCGCGCAGAAGTATAAATGCATGACTACATG
+CTAGGCAGGCACCGTGGGTCACGACAATCACTCGACGCAGAAGTATAAACCAGCCTTGAG
+AGTTCTAGTGTTATAAGCCCTACCTATGAGGCTCTGCCACTCAGTGTCCAGGTCAGCCTG
+ATTAGCCAGGCAGCCCTTCATCACATTTTTGCAGTAGTTGATGCAAGGTTTGACTGATCC
+CAGACCTCTGCAATGAGGGCAGTACACCAGTTTCATAATGGCACGATTGCACTCTGGGCT
+CAGTGGGACCTGTGGAAAGAGTGACCATTGCCAAGGGTTCATTTTTTTTAAGATAACAAT
+ATTAAGTTAAACAGTAACCATGGCATTTATCAGTGAGCAAGGCAATTAACTCAGTATATC
+TTCAGGGAAGCTGTCCTGATAAAAAAAAAAAACACTGGAAGTTGAAATAAGAGCACTGGT
+AAACACACTAGATGCGAGTTAGCTTGATTTACTGAATTGTACCTGCTTATTACCTGCATG
+TTGATTCAGGTCATCTACTTCAAACTTTGA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,570
+}
+{RED
+iid:51
+eid:zfish44908-1076a02.p1k
+seq:
+CCGCCCATCACAGAGCATTTTTTTTTTAATTCTGTGGTAGACTTGACTCGAAAGAGGGGG
+ATGTCATGGCCCTTTAAAATGGGACAAAAAACTGCTTTTATTCTAGCAGTTATAAAAAAT
+AAAACAAAGACTTAATAGAAGATATATTGTAGAAAATATCATTGGAGACACTGTAAAAAT
+TTCCTTGCGCTGTTAAACATCATTTGGGAAACATTTGAAAAAGTAAAACAAAATCACAGG
+AGGGCGAATAATTTTGACATCAGTTGTAGGCATACAGGTACAGTCCCTGTCACTGGCAAG
+GCTGTGATAAAAAATGAAACTATATTGGCTGTTTTTTGGGAGGAGCTACTGTATGTCCTG
+CTCTCTCTTTATGTTTCAGTTGGGATTACGTCAAACTTTAAATAAAAAAAAATGCACATT
+TCAAAGCACATTTAACATCTGCCCATGTGTGTTTATCCTGCAGGTCAATATTTCTCCAGG
+CTGCAGTAAAGCATTGACTAAAATGTGGTACTGCCCGTATTGTGGAGGAATGTCAGGACT
+CAAACCCTGCGCCCACTACTGCCAGAATGTGATGCGCGGCTGCCTGGCCAACCAAGCGGA
+TCTGGACCCTGAGTGGA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXX
+.
+clr:0,617
+}
+{RED
+iid:52
+eid:zfish44910-670h12.p1k
+seq:
+CTATATATATATATAATGTGTAGATTATGACACTAATGATGATAATAATAATAATAATAA
+TAATAATAATAATAATAATAATAATATCAATATTAATATAATATTAATATTAATATTAAT
+AATAATAACAATAATAACTACTACGTTTTTTTTTTTTTTTGTAATTATTTAAAATATATA
+TACACATGCTCAAATTACATATTTTTTTTACATCAGTATTTCTCTGTTTTTCCAGAGTTT
+TTCCTGGAGTTGCTGGACAACTCTGAGAAGTCTCTAAACGACATGTTTGTGCGCACATAT
+GGCAAACTCTACACACACAACTCGGAGATGTTCGAGGACCTGTTCTCAGAGCTGAAGCGC
+TACTACACCGGTGGGAACGTCAACCTGGAGGAGGTGCTGAATGACTTCTGGTCGCGTCTG
+CTGGAGAGAATGAGCCAGCTGCTCAACTCGCAGTTCACCTTCAGCGACGACTATCTGGAG
+TGCATCAGCAAATACACTGACCAGCTCAAGCCGTTCGGAGACGTGCCGCGAAAACTCAAG
+GCGCAAGTCACCAAAGCTTTCATCGCGGCCAGATCCTTCGTCCAGGGACTTATGGTGGGC
+CGAGAAGTGGCCAACAGGGTGGCCAAGGTAAGATCTTTAATGAGATGTGGATGATAT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,657
+}
+{RED
+iid:53
+eid:zfish44909-1485f11.q1k
+seq:
+CATTCACTAAACAAGACGTTCCTGTCAATGTGTTGACTGCATTTCTGTTCATCCGTGTCT
+CTTTCATCCAACCCACACAGGGAGTTTCACTGTTTCAGACTTTAAATGGACAGATTTTGC
+ATAGCAGGAATCTCCTGGGGTCCGTCTTTACCGAGATGTTCTTCCTGATTATCTTGTTTT
+CCTTTTAATGAGTGTTTGTTCTCTGCTAATCATTTTGGCACAAGGCAACAAGATGAAATG
+CAATGCGTGGAAATGAAATTAAATAACATGTTTCGATTAAGTTGCAGATATTTGTTTTGT
+GGCGTTTTTTGAAATTTGTACAAGTAACGTAAACAATGTGTACTCTATAAAACAAACCAT
+TTTCTGCAGCTCTCTTTGTTTTCGATTTACAAGCCAAGCTTCAGTTTATAAAATGCCGCG
+GTCTGTTTACTTGTTTATTGTGACGGCTGTTAGAAATCTTCTCTCTGTTATTCTACAGGC
+TCAGATCTGCAGGTGTGCCAGCCAAAAGGCCTGACTTGCTGTTCTCGCAAAATGGAGGAG
+CGTTACCTGCTTATTGCCAAACAGAATATGGAGTCTAGCCT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,581
+}
+{RED
+iid:54
+eid:zfish44909-1711d01.p1k
+seq:
+CCTAATCAACCAAGCAACAAAGTGTCCAAGCAACCCCTCGACCAATCAACCAATAAACTT
+ACTAACCAACCTACCAACCGTTGAATCAATCAATCAATCAATCAATCAATCAATCAATCA
+ATCAATCAATCAATCAATCAATCAATCAATCAATCATTCAATCAATCAATCAATCAATCA
+ATCAATCAATCAACCAATCAATCAATCAATCAACCAATCAATCAACCCATCAATCAATCA
+ATCAATCAATCAATCAATCAGTCAAACACAAAATAAACTTGAGCAACAACTCAAACAGTC
+TCATTTCCAGTATTGTTTAAATAAAGAATACATAAAATAATAAATAAAATAAAGTGTTTT
+TGATTGAAAAAAGGCACCCAACTGGAAGTTCTTTATAGGGGACATCTATATTAGAAAACC
+CAGCTTAAGGTACAATAGCAAGCGCATCTCACCAATAAAGAGGTTCCACTCAGGGTCCAG
+ATCCGCTTGGTTGGCCAGGCAGCCGCGCATCACATTCTGGCAGTAGTTGGCGCAGGGTTT
+GAGTCCTGACATTCCTCCACAATACGGGCAGTACCACATTTTAGTCAATGCTTTACTGCA
+GCCTGGAGAAATATTGACCTGCAGGATAAACACACATGGGCAGATGTTAAATGTGCTTTG
+AAATGTGCATTTTTTTTTATTTAAAGTTTGACGTAATCCCAACTGAAACATAAAGAGAGA
+GCAGGACATACAGTAGCTCCTCCCAAAAAACAGCCAATATAGTTTCATTTTTTATCACAG
+CCTTGCCAGTGACAGGGACTGTACCTGTATG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,811
+}
+{RED
+iid:55
+eid:zfish44909-2083g05.p1k
+seq:
+CTAATTAACATGCAGCTATATACTGGATAGGTCAGTGTTTCCCAACCTCTTCCTATACAA
+ACACACTTGAATGAACTCATCAGATCAGTAAAAGAGACTCCAAAACCTTGAATGGATAAG
+GGAGACTAAGTACTGTTGTATAGGTATAGGTGATGAACAAGTATAGGTGATGTCTATGTG
+TGCATGTTCAATTGAGTGTATTTGTGTATTAAGTGTTGTTTTTTTACATTGCCACTTTAG
+ATAACAAATAATATTTGTTCTTTTTCAGGTTCAGACCTGCAGGTTTGCTTATCCAGGAAT
+CTAACATGCTGCACCAAAAAGATGGAGGAGCGTTACCAGGTGGCGGCCCGGCGGGATATT
+CAGAACCTTCTCCAGATCTCTAGCTCCAGCCTAAAGTTCCTCTTCTCACGAAATGTGGCC
+GCTTTCCAAGGTTGGTGCGCTGGTTAATCATGCTTGGGTGGTTTATCTACAGCCTTGGTG
+AAGCTGGTAGTTTGCGGTACTCTTGTTTAGTATGATGTCAGTTTGTCTCCA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,531
+}
+{RED
+iid:56
+eid:zfish45283-1667d08.p1k
+seq:
+CTAAAATAAGATTTATCACCAAAAAAACGTTTGTCACCATTCTGCTAGCTGAAACAAAAA
+AAGTTAAGACCAAAATAACATTCAAAACCACCCCAGAGTGGATGAAAACATCCCCAGCAA
+CACATAAGAGTTACCATATGATACCACTATGGATCCTCTTGGTTCTAATGCATGCTCTTT
+TAAGTATAAAAGTGTACCTTTTAAAAGGGTACCACCCCAGTGACAGGTTTCATACATTTC
+TGAGAGTGTGTTAAGAATTAATGTGTTCTTGACTCTAAGCATTTCAGCTTTCCGCCCAAG
+GGGATGCTAAAGGTTTAACTTATGACAAAAATGTACCCAAAAATGGTTTCACAAACAGAA
+ATGTAGCAGAAACTCACCTTGAAAGAGGGCAGCATTCTGGATGATGAGCCCTTTGAGCTG
+AGCGCTGGTGGCCTGAAGGCTAGACTCCATATTCTGTTTGGCAATAAGCAGGTAACGCTC
+CTCCATTTTGCGAGAACAGCAAGTCAGGCCTTTTGGCTGGCACACCTGCAGATCTGAGCC
+TGTAGAATAACAGAGAGAAGATTTCTAACAGCCGTCACAATAAACAAGTAAACAGACCGC
+GGCATTTTATAAACTGAAGCTTGGCTTGTAAATCGAAAACAAAGAGAGCTG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,651
+}
+{RED
+iid:57
+eid:a-37250859e01.p1c
+seq:
+AAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCACTGCCGTGGACTCACC
+CTGATCCATGCGTGCAGCAACTACTGTCTTAATGTCATGCGCGGGTGCCTGGCGAGCTAC
+TCCGAGCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGCAGGACCTCACGCAAATG
+GTTGCCGGAGCTCACAATTTACAGCTGGCCTTACTGGGGATC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,222
+}
+{RED
+iid:58
+eid:zfish43795-610h09.p1c
+seq:
+GGATCCATGGATTAAGTGTTGTCAGCTCCCATTAGCCCAATGGAAAGAGAGATTAGATAC
+ACAAGAAAGAGTCGTAAGCAATGCGAGACAAGGCAGAGGTGCACCATGACAGACTAGTAT
+CTTTGACCCTCTCGTAAATGTCAAACAAAATTACAGCAATTGTTAGTCTCTCATGTTACG
+AATGTTTATCCATCTAAGATGACTATGAAATAGCTGTTCGTGGAGGTCTTTTTCAGTGCT
+TCTTCAGTCCAAAATCTTTCTTTTATTTCCTCTTCCCACAGATACCTTCCATTCCCTGCT
+CTCGTTCACTCTAAATCATACCAACTCACTTTTCGACACCACCTACGAGACAATCTCCCA
+AGATGCAAGACCACTGGTGTCCACCCTCTTCAATGACCTTGATCTCTACCTTCGAGGCGA
+TGATAACGTTTCTGTGGAACACTCGGTTTACAGATTTTATGACAAACTCTTCCCATTGGT
+GTACCAGCATCTGGTCAATCCTGGCTTGGGTTCACCTGTTTCAACCTGGTC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,531
+}
+{RED
+iid:59
+eid:Zfish37251-2879h11.p1c
+seq:
+CCATCTAAGATGACTATGAAATAGCTGTTCGTGGAGGTCTTTTTCAGGGCTTCTTCAGTC
+CAAAATCTTTCTTTTATTTCCTCTTCCCACAGATACCTTCCATTCCCTGCTCTCGTTCAC
+TCTAAATCATACCAACTCACTTTTCGACACCACCTACGAGACAATCTCCCAAGATGCAAG
+ACCACTGGTGTCCACCCTCTTCAATGACCGGGATCTCTACCTTCGAGGCGATGATAACGT
+TTCTGTGGAACACTCGGGTTACAGATTTTATGACAAACTCTTCCCATTGGTGTACCAGCA
+TCTGGTCAATCCTGGCTTGGGTTCACCTGTTTCAACCTGGTCTGCCGAAGGAACTGAGTG
+CCTTCGTGCCACACGGCATGATATCTATCCCTTTGGCCATCACCCACAAGAACTTGCTCA
+AGGACTGTCCAAGGCGCTTGTGGTTGGTCGTGCCCTCATCCGGGCACTGGCAGTCGGTGC
+AGATGTACTTAACATCACAAAGTCTGTGGGCATGGGACGAGTGTGTGGA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,529
+}
+{RED
+iid:60
+eid:zfish45283-535c05.q1k
+seq:
+TATTGTTTAAATAAAGAATACATAAAATAATAAATAAAATAAAGTGTTTTTGATTGAAAA
+AAGGCACCCAACTGGAAGTTCTTTATAGGGGACATCTATATTAGAAAACCCAGCTTAAGG
+TACAATAGCAAGCGCATCTCACCAATAAAGAGGTTCCACTCAGGGTCCAGATCCGCTTGG
+TTGGCCAGGCAGCCGCGCATCACATTCTGGCAGTAGTTGGCGCAGGGTTTGAGTCCTGAC
+ATTCCTCCACAATACGGGCAGTACCACATTTTAGTCAATGCTTTACTGCAGCCTGGAGAA
+ATATTGACCTGCAGGATAAACACACATGGGCAGATGTTAAATGTGCTTTGAAATGTGCAT
+TTTTTTTTATTTAAAGTTTGACGTAATCCCAACTGAAACATAAAGAGAGAGCAGGACATA
+CAGTAGCTCCTCCCAAAAAACAGCCAATATAGTTTCATTTTTTATCACAGCCTTGCCAGT
+GACAGGGACTGTACCTGTATGCCTACAACTGATGTCAAAATTATTCGCCCTCCTGGGATT
+TTGGTTTACTTTTTCAAATGTTTCCCA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,567
+}
+{RED
+iid:61
+eid:zfish43929-176n20.q1k
+seq:
+CACCTGTTTCACCTGGTCTGCCGAAGGAACTGAGTGCCTTCGTGCCACACGGCATGATAT
+CTATCCCTTTGGCCATCACCCACAAGAACTTGCTCAAGGACTGTCCAAGGCGCTTGTGGT
+TGGTCGTGCCCTCAGCCGGGCACTGGCAGTCGGTGCAGATGTACTTAACATCACAGAGTC
+TGTGGGCATGGGACGAGTGTGTGGACGTGCACTAGTGCGCATGTTGTTCTGTCCTCACTG
+TCGAGGACTGACCCTGATCCGGCCATGTGGAGGCCTATGTCTCAACGTGATGCGAGGTTG
+CCTGGCAGGCGTGGCTGAGCTGGATGCTCCCTGGCGAGACTATGTATCGCTTCTGGAGAA
+GCTGAGTGGGGCATTATCAGAGAGATATGAAGTGGAACTGGGACTTCTACGCATCCGGGA
+AAGAATTAATGATGCCATCCTCACTGCGCAACTGCACGGGCCACATCTTAGCGCCGTGGT
+GAGTCATGCTACTCTCTGATTCATAGAACACATTTATTTTTATTCCACGAACGAGCTGCA
+CCATGTGTTGGACTAATCAGTTCTAGTGGGCATGCACTTGAAGCAGCATGTTTGGTGACT
+GGTGCATATCAAATGTCTCGACCAATCGTAGTCTGTGCAGTTACAACGCTGCCGTTTTGC
+ACA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXX
+.
+clr:0,663
+}
+{RED
+iid:62
+eid:ZfishFos603c08.p1k
+seq:
+CATACACGATAAATGCACTACATAAATACACACAATACATTTCAGCACATTATCACTGTG
+GTGTTGGAATGTAACTAAAATCAAACTTTATAGTTACTCAATCTCTCTTTTCTGTCTTTT
+TTCAGAGGCTTTTGACATGGTGCTTCGTCTGGGCCGTAATTCCACTCTGATGGTGTTACG
+CGAGGAGTTTCCTGGTTTGGGGGCTGGAGCCAGCGGAGCCGTCACGCAGTTATTCCTGGA
+TATGTCACTTTACATTCTGGGCTCTGATGCCAATGTAAACGACATGGTCTCCACCTTCTT
+CTCTCGCCTTTTCCCTCTCACCTACCGTCGACTTCTGGGCAATGGGGCCGTGGCGGGCAT
+CTCTGAAGAATGCCTCCGCGGGGCCTGGAAAGGGAGCTCTGCTTATGGGTCATTTCCCAA
+GATGATGATGACCCGACTGTCCCGCTCACTCCTGGCCACTCGGGTCTTCCTGCAAGCGCT
+GAATTTGGGCATAGAAGTGGTCAACACCACTCAGCATTTGCGGGCAGGTAGAGATTGTGG
+GCGCTCACTTCTGAAACTGTGGTACTGCCCGCACTGTCAAAGCCTGCTGGAGGCCCGGCC
+GTGCCGTCCACTGTGTGTCAGCACCATGGGAGCATGTTTGGGGGGAACCACGGAGGTACA
+GCCTCATTGGAGAGCATATGTGGATGAACTGGGGTCACTCGCCGCTGCCATGAAGGGGGA
+ACAGGACATCGAGGCTGTGGTGCTCCGACTGCATGTCATTATCAGACAGGCTCTCAAACA
+AGCCGTGGCAAGCAAGAGCAAAGTCAGCGCCCAGGTGAGTGACACATGGTCTCAGAAACA
+AGGTATGAATTCGAATGCTGTAGGCGACTGCAGCCATTTTGCTAACTTCAGCCATTTTTG
+CTAACGCCATCTCTCTCCAAAACTCAACCTCCAA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,934
+}
+{RED
+iid:63
+eid:ZfishFos424g06.q1k
+seq:
+CTTCTCGGCCCACCATAAGTCCCTGGACGAAGGATCTGGCCTTGATGAAAGCTTTGGTGA
+CCTGCGCCTTGAGTTTTCGCGGCACGTCTCCGAACGGCTTGAGCTGGTCAGTGTATTTGC
+TGATGCACTCCAGATAGTCGTCGCTGAAGGTGAACTGCGAGTTGAGCAGCTGGAACATTC
+TCTCCAGCAGACGCGACCAGAAGTCATTCAGCACCTCCTCCAGGTTGACGTTCCCACCGG
+TGTAGTAGCGCTTCAGCTCTGAGAACAGGTCCTCGAACATCTCCGAGTTGTGTGTGTAGA
+GTTTGCCATATGTGCGCACAAACATGTCGTTTAGAGACTTCTCAGAGTTGTCCAGCAACT
+CCAGGAAAAACTCTGGAAAAACAGAGAAATACTGATGTAAAAAAAATATGTAATTTGAGC
+ATGTGTATATATATTTTAAATAATTACAAAAAAAAAAAAAAACGTAGTAGTTATTATTGT
+TATTATTATTAATATTAATATTAATATTATATTAATATTGATATTATTATTATTATTATT
+ATTATTATTATTATTATTATTATTATCATCATTAGTGTCATAATCTACACATTATATATA
+TATATATATATATATATATATATATATATATATATATATATATATATATATATATAATTT
+GTATATTATGACCACTAATGATGATGATGATGATA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,695
+}
+{RED
+iid:64
+eid:zfish43929-321m23.p1k
+seq:
+ATATAGTGGATAGGTCAGTGTTTCCCAACCTCCTTCCTATACAAACCCATTTGAATGAAC
+TCATCAGATCAGTAAAAGAGACTCCAAAACCTTGAATGGATAAGGGAGACTAAGTACTGT
+TGTATAGGTATAGGTGATGAACAAGTATAGGTGATGTCTATGTGTGCATGTTCAATTGAG
+TGTATTTGTGTATTAAGTGTTGTTTTTTTACATTGCCACTTTAGATAACAAATAATATTT
+GTTCTTTTTCAGGTTCAGACCTGCAGGTTTGCTTATCCAGGAATCTAACATGCTGCACCA
+AAAAGATGGAGGAGCGTTACCAGGTGGCGGCCCGGCGGGATATTCAGAACCTTCTCCAGA
+TCTCTAGCTCCAGCCTAAAGTTCCTCTTCTCACGAAATGTGGCCGCTTTCCAAGGTTGGT
+GCGCTGGTTAATCATGCTTGGGTGGTTTATCTACAGCCTTGGTGAAGCTGGTAGTTTGCG
+GTACTCTTGTTTAGTATGATGTCAGTTTGTCTCCAGACATTAGTTGTACAGTACAGTGTT
+GTCAGTGTTTATTTTTCTTTACAACTCAAAATATGTGAT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,579
+}
+{RED
+iid:65
+eid:zfish43929-344a15.q1k
+seq:
+CAACGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTCTCCTCCATA
+CGCCGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGCCCCAATCCG
+CCTGGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCAAGCGCTCCA
+TTTGGGCATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGAGTGCAGACG
+TGGCCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAGCAAACCCTG
+CTTGGGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCTGAAGTGGATGC
+CCACTGGAGGGAGTTTGTACGCTCGCTGGAGACGCTGGCAGTACGGATGCACGGAGAGCT
+GGATCTGGAGCACGTGCTGCTGGGGGCGCATGAGCTGGTGAGGGACGCTGTGGCGCACGC
+TCAGAGGAGCACAGCGAGGATACATG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,506
+}
+{RED
+iid:66
+eid:zf37276-263e04.p1k
+seq:
+TGGCTACGTGTACATTAAGGTAGCGTTCTTACCTTCTACATGAAGAAACTCTACACAGGA
+TCATAAAAACCTACTGCTAGCTAGCGTTTTGGAAGTTTTACTGCAGAGCAACACAGCGCG
+CAGAAGTATAAATGCATGACTACATGCTAGGCAGGCACCCTGTGGTCACGACAATCACTC
+AACGCACAAGTATAAACCATCCTTAAGAGTTCTAGTGTTATAGGCCCTACCTATGAGGCT
+CTGCCACTCATTGTCCAGGTCAGCCTGATTACCCAGGCAGCCCTTCATCACATTTTTGCA
+GTACTTAATGCAAGGTTTGACTGATCCCAGACCTCTGCAATGAGGGCAGTACACCAGTTT
+CATAATGGCACGATTGCACTCTGGACTCAGTGGGACCTGTGGAAAGAGTGACCATTGCCA
+AGGGTTCATTTTTTTTAAGATAACAATATTAAGTTAAACAGTAACCATGGCATTTATCAC
+TGAGCAAGGCAATTAACTCAGTATATCTTCAGGAAAGCTGTCCTGATAAAAAAAAACACT
+GGAAGTTGAAATAAGAGCACTGGTAAACACACTAGATGCGAGTTAGCTTGATTTACTGAA
+TTGTACCTGCTTATTACCTGCATGTTGATTCAGGTCATCTACTTCAAACTTTGAAGTCTT
+TTGGGAAAAACAGGTATGGAGGGCAGAGTAATCATGCTTGTATATTAGCTGAAGGCATCT
+TCAGTTGAATCGCTTTATTCTGACAGAATGTGAACCTGTCACGCTGCTCA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,770
+}
+{RED
+iid:67
+eid:zf37276-272b06.q1k
+seq:
+ACTTTTTCTTTCATATCCGTGAATTTACATTCATTTAAACAACAAGCAAATGTCAAGTTC
+TACTTTCCTTCCCGAACTGCATTGCTTTTCCCTGAGGGACCCTATAAACCCCCACGCTTT
+GACATCAGAGGGGTGGAGGTTCCTGATAAAGAGGAATGATTGTGAAAGACGTCTCAGAGA
+AGCACCATGGGTATTCTTTTGCAAGAGTTGTACCAAACTGTACCATCCCACATCCTTGGA
+CCTCTTGGGAAACTGTACTGACAAGCAATTATTTGCACAGTGCAATTATCGCATATTGTG
+TGTGACACAAAACAATTCACAGGGCTTTTTTTTTCTTGTTAAGTGATTCATTATGGTTGA
+GCTGTTCTTTAAATTGTGTTTTTTGTGTTTTGCAGGTTTCTCTGAGCACTGAATGTGTGC
+GTGCTGTCATGAAGCAGACGTATTGTCCTCACTGTAGTGGCGTGGCCTTGGCCAAACCCT
+GCTCAAACTACTGTCGAAATGTCTTAAAAGGCTGCCTCGCCAATCAAGCAGACCTGGACA
+CTGAGTGGAGGAACCTTGCAGGTGGGCGGGACCAATAAACAACTCTATTTGCTTAAGTCT
+GACATCAAAAGTCACTGTTTCTTGGTACAAAAGCTCTAGCAGATGCCAAAAGCAAACAAC
+AAATTTAACAAAGCAGATTTTATAGTAGAATAACTATATATA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,702
+}
+{RED
+iid:68
+eid:ZfishFos1395g12.p1k
+seq:
+TGTGTGTGTGTCTCTCTCTATGTGTCTGTATCTGCGCGCGGGGCCAGAGTGTGTGCGCGC
+GCTCATGCTTCAGTGGTTCTGTCCTCTGTGTCGGGGTCTTCCGTCACTCAAGCCCTGTCA
+TTCGCTGTGCCTGAACATCATGAAGGGCTGTCTGGCCAATCAGGCGGATCTAAACAGCGA
+GTGGAACAGCTTCATTGGTGAGAACAGAACACCTCTGCTTCATTTACTGTGTGTGTGTGT
+GTGTGTGTGTCCGCTGTGTGTGTGTGTGTGTGTGTGTCCGCTGTGTGTGTGTGTGTGTAT
+GTCCGCTATGTGTCTGATGTGTGTGTGTGTGTGTGTGTGTCCCCTATGTGTCTGATGTGT
+GTGTGTGTGTGTGTGTGTGTGTGTGTGTCAGATGTGTGTGTGTGTCTGATGTGTGTGTGT
+GTGTCCTGCAAATGCTCTGACAGTGGTGGTGGAGAAACTCGGCGGGCCGTTTAACTTTGA
+GCTGGCTGCGGACGCCATCGCTGTGACGGTTTCTGAAGGCATCATGAACATGCAAGAGAA
+CAGCATCAGCATCTCTGCTAAGGTGAAGAAAACACACACACACACACACACACACACACA
+CACACACACACACTCTAGAAAATGAACCAAAACAAACACATATGAGGAAGGGTTAGGACT
+ATGTGACACACATATAACACATATGTCATATCAGCTGTATCAGTGAAGCGTTCCCGCTCT
+GTTCTGCTGCCG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXX
+.
+clr:0,732
+}
+{RED
+iid:69
+eid:zf37276-818p14.q1k
+seq:
+TTACATGCAGCTATATAGTGGATAGGTCAGTGTTTCCCAACTTCTTCCTATACAAACACA
+CTTGAATGAACTCATCAGATCTTTAAAAGAGACTCCAAAACCTTGAATGGATAAGGGAGA
+CTAAGTACTGTTGTATAGGTATAGGTGATGAACAAGTATAGGTGATGTCTATGTGTGCAT
+GTTCAATTGAGTGTATTTGTGTATTAAGTGTTGTTTTTTTACATTGCCACTTTAGATAAC
+AAATAATATTTGTTCTTTTTCAGGTTCAGACCTGCAGGTTTGCTTATCCAGGAATCTAAC
+ATGCTGCACCAAAAAGATGGAGGAGCGTTACCAGGTGGCGGCCCGGCGGGATATTCAGAA
+CCTTCTCCAGATCTCTAGCTCCAGCCTAAAGTTCCTCTTCTCACGAAATGTGGCCGCTTT
+CCAAGGTTGGTGCGCTGGTTAATCATGCTTGGGTGGTTTATCTACAGCCTTGGTGAAGCT
+GGTAGTTTGCGGTACTCTTGTTTAGTATGATGTCAGTTTGTCTCCAGACATTAGTTGTAC
+AGTACAGTGTTGTCAGTGTTTATTTTTCTTTAAAACTCAAAATATGTGATTGAGTTCCCT
+GGTGGCTCTCCAAGGGCTTAATTCAGTTCTTTCCTGTGTTAATTTAGGCTTTTCACATAA
+TAGCCTCACTGATGAGCTCTACACTACAATTATTGTTTCGCAATACTCATTTTCTGTCTT
+AAATC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXX
+.
+clr:0,725
+}
+{RED
+iid:70
+eid:ZfishFos2520c02.q1k
+seq:
+AGCTCCCATGAGCCCAAGGGAAATAGAGATTAGATACACAAGAAAGAGTCGTAAGCAATG
+CGAGACAAGGCAGAGGTGCACCATGACAGACTAGTATCTTTGACCCTCTCGTAAATGTCA
+AACAAAATTACAGCAATTGTTAGTCTCTCATGTTACGAATGTTTATCCATCTAAGATGAC
+TATGAAATAGCTGTTCGTGGAGGTCTTTTTCAGTGCTTCTTCAGTCCAAAATCTTTCTTT
+TATTTCCTCTTCCCACAGATACCTTCCATTCCCTGCTCTCGTTCACTCTAAATCATACCA
+ACTCACTTTTCGACACCACCTACGAGACAATCTCCCAAGATGCAAGACCACTGGTGTCCA
+CCCTCTTCAATGACCTTGATCTCTACCTTCGAGGCGATGATAACGTTTCTGTGGAACACT
+CGGTTTACAGATTTTATGACAAACTCTTCCCATTGGTGTACCAGCATCTGGTCAATCCTG
+GCTTGGGTTCACCTGTTTCAACCTGGTCTGCCGAAGGAACTGAGTGCCTTCGTGCCACAC
+GGCATGATATCTATCCCTTTGGCCATCACCCACAAGAACTTGCTCAAGGACTGTCCAAGG
+CGCTTGTGGTTGGTCGTGCCCTCAGCCGGGCACTGGCAGTCGGTGCAGATGTACTTAACA
+TCACAGAGTCTGTGGGCATGGGACGAGTGTGTGGACGTGCACTAGTGCGCATGTTGTTCT
+GTCCTCACTGTCGAGGACTG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXX
+.
+clr:0,740
+}
+{RED
+iid:71
+eid:ZfishFos2880g11.p1k
+seq:
+CACCGACTGCCAGGGCCCTGAAGAGGGCACGACCAACCACAAGCGCCTGGGACAGTCCTT
+GAGCAAGAACTTGGGGGGGAAGGCCAAAGGGATAGATATCATGCCGTGTGGCACGAAGGC
+ACTCAGTTCCTTCGGCAGACCAGGTTGAAACAGGTGAACCCAAGCCAGGATTGACCAGAT
+GCTGGTACACCAATGGGAAGAGTTTGTCATAAAATCTGTAAACCGAGTGTTCCACAGAAA
+CGTTATCATCGCCTCGAAGGTAGAGATCAAGGTCATTGAAGAGGGTGGACACCAGTGGTC
+TTGCATCTTGGGAGATTGTCTCGTAGGTGGTGTCGAAAAGTGAGTTGGTATGATTTAGAG
+TGAACGAGAGCAGGGAATGGAAGGTATCTGTGGGAAGAGGAAATAAAAGAAAGATTTTGG
+ACTGAAGAAGCACTGAAAAAGACCTCCACGAACAGCTATTTCATAGTCATCTTAGATGGA
+TAAACATTCGTAACATGAGAGACTAACAATTGCTGTAATTTTGTTTGACATTTACGAGAG
+GGTCAAAGATACTAGTCTGTCATGGTGCACCTCTGCCTTGTCTCGCATTGCTTACGACTC
+TTTCTTGTGTATCTAATCTCTCTTTCCATTGGGCTAATGGGAGCTGACAACACTTAATCC
+ATGGATCTTTTGGGCTGGCGCTATTGGGCTGAAGGTTAGTTTGGAGATATGTGACACGTG
+TGACTAGCTTATTACCAATTTTAGCAGTCAGGGCGTCATTTTATACCTCACTATGC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,776
+}
+{RED
+iid:72
+eid:zDH63-102m11.q1k
+seq:
+ACACACACAAACACGCACACTCACGCACACACTATAATCTGCCAGTTTGCTCCATAGAAC
+TCCATATAAAAGCCAGAAACTTGTATGATAGGCCTATATAAAGGGTTAATGGTGACAACT
+GATGATCAACAGTAAAACTTAAACATTTGACCTCTTCCCAACAGGAAAACCAACAATAAT
+CAAGAATGCATAATTATATGTCTTGGCTTTGTAATCAAAAAATGTGATTATGATGGAAGT
+CAATGGGGCAAAAACAGCCACCAACATAATGAAGGGGTAGTCAATTTGAACAGCAGAGAA
+GGATTAAGACCACTGATCATTCTATCATTATCACTCATTTAAATCTTTCTTCTTTTTCAG
+ATACGTTCCAGTCCCTAATATCCTTCTCCCAGAACCACCTGACCTCTCTGTTTGAGACCA
+CATACTCATCCCTCATGTCGTCCATCTCCCCTCACATCGTCTGCCTCTTCACGGACCTCT
+CTCGCTTCCTCCAGGGCACCGGCAACGTCTCGGTGGAAGCTGCTGTGCACTGTTTCTTCG
+ACAGCCTTTTCCCATTGGTCCACACTCAGATTGTCAATCCCGGTATGGAAGGAAGTATTG
+GGACAGATGCTTCTGAAGGCAACCAGCTTGGTGACTGTCTCCGAATGACCAGGCAGGACG
+TAAACCCCTTTGGTCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGGG
+CTGGGCGGGTGCTCAGCTTGGCACTTGCCGAAGGGTCAGAAGTGATGAACATTACGGAAA
+CAGCAGGGTTATCAAAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,838
+}
+{RED
+iid:73
+eid:zDH63-73k18.q1k
+seq:
+AGAGTCGTAAGCAATGCGAGACAAGGCAGAGGTGCACCATGACAGACTAGTATCTTTGAC
+CCTCTCGTAAATGTCAAACAAAATTACAGCAATTGTTAGTCTCTCATGTTACGAATGTTT
+ATCCATCTAAGATGACTATGAAATAGCTGTTCGTGGAGGTCTTTTTCAGTGCTTCTTCAG
+TCCAAAATCTTTCTTTTATTTCCTCTTCCCACAGATACCTTCCATTCCCTGCTCTCGTTC
+ACTCTAAATCATACCAACTCACTTTTCGACACCACCTACGAGACAATCTCCCAAGATGCA
+AGACCACTGGTGTCCACCCTCTTCAATGACCTTGATCTCTACCTTCGAGGCGATGATAAC
+GTTTCTGTGGAACACTCGGTTTACAGATTTTATGACAAACTCTTCCCATTGGTGTACCAG
+CATCTGGTCAATCCTGGCTTGGGTTCACCTGTTTCAACCTGGTCTGCCGAAGGAACTGAG
+TGCCTTCGTGCCACACGGCATGATATCTATCCCTTTGGCCATCACCCACAAGAACTTGCT
+CAAGGACTG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXX
+.
+clr:0,549
+}
+{RED
+iid:74
+eid:zDH63-179j24.q1k
+seq:
+GGGCGTTCTCCTGATTTGATTCAGAAGGGCACTTTTTTGTCAGATGGCTCAGCGGTTTGA
+CTTTCATTTATTCACCGTCATTAGTTTTAAAAAGCACTCTTTCCATTTTATTTGTATATA
+TTTTACTGGAACACATTAACTCTACAGGTGCCTAATAATTAGCTGTGGAGCTAACATAAA
+TCGTTTTATTCCATCTAGTAAACGCATAAAAATCGACATCATAATTTACTCAAGTGCACG
+CCTCAATGTCTCGCGTCCCTCTTAATAGGTGCTGGCAAGCCCCACAGTTTGAAACCCCTG
+GTGTATATATAGTTATTCTACTATAAAATCTGCTTTGTTAAATTTGTTGTTTGCTTTTGG
+CATCTGCTAGAGCTTTTGTACCAAGAAACAGTGACTTTTGATGTCAGACTTAAGCAAATA
+GAGTTGTTTATTGGTCCCGCCCACCTGCAAGGTTCCTCCACTCAGTGTCCAGGTCTGCTT
+GATTGGCGAGGCAGCCTTTTAAGACATTTCGACAGTAGTTTGAGCAGGGTTTGGCCAAGG
+CCACGCCACTACAGTGAGGACAATACGTCTGCTTCATGACAGCACGCACACATTCAGTGC
+TCAGAGAAACCTGCAAAACACAAAAAACACAATTTAAAGAACAGCTCAACCATAATGAAT
+CACTTAACAAGAAAAAAAAAGCCCTGTGAATTGTTTTGTGTCACACACAATATGCGATAA
+TTGCACTGTGCAAATAATTGCTTGTCAGTACAG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,753
+}
+{RED
+iid:75
+eid:zDH62-110i20.q1k
+seq:
+TTGCCTTTAATAATGTGCTGAAAATAAAACCCAAAATATTAAGTCATTCTAAATGGGAAA
+CTATGCATGCTTGCATGTACCTGGAATTATTGAGAAGACTTAATTTTTTTATTATGTTAG
+ACAACTTTCAAAACTTTAATCCTTTACTAATAAACTTTTTTCTACTCTATTATTTCTTTC
+AGAAAGCGTGGAGTCTCTGGTGCGTCAGGCGGAGAACCACACCCTCTCCATCCTCCATCA
+GTCCCAGCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTTTTTCACAGA
+AGTGGCTCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTTCTT
+CAACGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTCTCCTCCATA
+CGCCGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGCCCCAATCCG
+CCTGGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCAAGCGCTCCA
+TTTGGGCATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGAGTGCAGACG
+TGGCCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAGCAAACCCTG
+CTTGGGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCTGAAGTGGATG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,719
+}
+{RED
+iid:76
+eid:zDH62-283b13.p1k
+seq:
+CAGGCAACCTCGCATCACGTTGAGACATAGGCCTCCACATGGCCGGATCAGGGTCAGTCC
+TCGACAGTGAGGACAGAACAACATGCGCACTAGTGCACGTCCACACACTCGTCCCATGCC
+CACAGACTCTGTGATGTTAAGTACATCTGCACCGACTGCCAGTGCCCGGCTGAGGGCACG
+ACCAACCACAAGCGCCTTGGACAGTCCTTGAGCAAGTTCTTGTGGGTGATGGCCAAAGGG
+ATAGATATCATGCCGTGTGGCACGAAGGCACTCAGTTCCTTCGGCAGACCAGGTTGAAAC
+AGGTGAACCCAAGCCAGGATTGACCAGATGCTGGTACACCAATGGGAAGAGTTTGTCATA
+AAATCTGTAAACCGAGTGTTCCACAGAAACGTTATCATCGCCTCGAAGGTAGAGATCAAG
+GTCATTGAAGAGGGTGGACACCAGTGGTCTTGCATCTTGAGAGATTGTCTCGTAGGTGGT
+GTCGAAAAGTGAGTTGGTATGATTTAGAGTGAACGAGAGCAGGGAATGGAAGGTATCTGT
+GGGAAGAGGAAATAAAAGAAAGATTTTGGACTGAAGAAGCACTGAAAAAGACCTCCACGA
+ACAGCTATTTCATAGTCATCTTAGATGGATAAACATTCGTAACATG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,646
+}
+{RED
+iid:77
+eid:zDH63-1230b14.p1k
+seq:
+AACCATGTGATCTGTGCAGTCCGACAAGTCGACTTCAATAAAGCAAGCATCATGGCAGAG
+CATTATAGTCGGCTATTCTGTGCAGCCCTTAGTATCAGTATATTTGATCTGTGAAAGCGT
+CTCTTGTACTTGAAAACAAGCAAACACAACTCAATTCTTTCAGCCATGAATCATATAAAC
+TCAAAATATTTTGAAATGTACATTTCTAGAAGAAAACTCTTGAGGCAATCTGGAAGAACT
+ACAATTGAGCCTATTGAAAAGAGTTCAGAAACCCGCTTATAGCAGAAGAGGTCTTTGTGC
+TTCATAACTCTGTAGACCTTTTTTCATGCTACAATACAAGCTAATGCTAGCTGTAAAAGC
+GTAAAAATGCTAGTACTCACTGTGGCAGTTAGCCTGGGCCCGTGAAGCTGAGCGTAGAGT
+ATGGCCTCCTCGACCTGACCTCTGATCCCCAGTAAGGCCAGCTCTAAATTGTGAGCTCCG
+GCAACCATTTGCGTGAGGTCCTGCAATATGGTGACATACTGTCTCCAGGGCTGGTGGAGC
+TCGGAGTAGCTCGCCAGGCACCCGCGCATGACATTAAGACAGTAGTTGCTGCACGCATGG
+ATCAGGGTGAGTCCACGGCAGTGAGAGCAGTAATGCATGCGTACCAGAGCCCGTGTGCAC
+TCTTTTGATAACCCTGCTGTTTCCGTAATGTTCATCACCTCTGACCCTTCGGCAAGTGCC
+AAGCTGAGCACCCGCCCAGCCCGCAATGCGTCCGCCAGATCTTTTGCCATTGCTTTTGGG
+TGCGGACCAAAGGGGTTTACGTCCTGC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,807
+}
+{RED
+iid:78
+eid:zDH63-1351g09.p1k
+seq:
+CCTCTGCTTGTAGCACTCCACGCTCATCACAGAGCATTTTTTTTTTAATTCTGTGGTAGA
+CTTGACTCGAAAGAGGGGGATGTCATGGCCCTTTAAAATGGGACAAAAAACTGCTTTTAT
+TCTAGCAGTTATAAAAAATAAAACAAAGACTTAATAGAAGATATATTGTAGAAAATATCA
+TTGGAGACACTGTAAAAATTTCCTTGCGCTGTTAAACATCATTTGGGAAACATTTGAAAA
+AGTAAAACAAAATCACAGGAGGGCGAATAATTTTGACATCAGTTGTAGGCATACAGGTAC
+AGTCCCTGTCACTGGCAAGGCTGTGATAAAAAATGAAACTATATTGGCTGTTTTTTGGGA
+GGAGCTACTGTATGTCCTGCTCTCTCTTTATGTTTCAGTTGGGATTACGTCAAACTTTAA
+ATAAAAAAAAATGCACATTTCAAAGCACATTTAACATCTGCCCATGTGTGTTTATCCTGC
+AGGTCAATATTTCTCCAGGCTGCAGTAAAGCATTGACTAAAATGTGGTACTGCCCGTATT
+GTGGAGGAATGTCAGGACTCAAACCCTGCGCCAACTACTGCCAGAATGTGATGCGCGGCT
+GCCTGGCCAACCAAGCGGATCTGGACCCTGAGTGGAACCTCTTTATTGGTGAGATGCGCT
+TGCTATTGTACCTTAAGCTGGG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,682
+}
+{RED
+iid:79
+eid:zDH62-691d23.p1k
+seq:
+TCAATCAACCCATCAATCAATCAATCAATCAATCAATCAATCAGTCAAACACAAAATAAA
+CTTGAGCAACAACTCAAACAGTCTCATTTCCAGTATTGTTTAAATAAAGAATACATAAAA
+TAATAAATAAAATAAAGTGTTTTTGATTGAAAAAAGGCACCCAACTGGAAGTTCTTTATA
+GGGGACATCTATATTAGAAAACCCAGCTTAAGGTACAATAGCAAGCGCATCTCACCAATA
+AAGAGGTTCCACTCAGGGTCCAGATCCGCTTGGTTGGCCAGGCAGCCGCGCATCACATTC
+TGGCAGTAGTTGGCGCAGGGTTTGAGTCCTGACATTCCTCCACAATACGGGCAGTACCAC
+ATTTTAGTCAATGCTTTACTGCAGCCTGGAGAAATATTGACCTGCAGGATAAACACACAT
+GGGCAGATGTTAAATGTGCTTTGAAATGTGCATTTTTTTTTATTTAAAGTTTGACGTAAT
+CCCAACTGAAACATAAAGAGAGAGCAGGACATACAGTAGCTCCTCCCAAAAAACAGCCAA
+TATAGTTTCATTTTTTATCACAGCCTTGCCAGTGACAGGGACTGTACCTGTATGCCTACA
+ACTGATGTCAAAATTATTCGCCCTCCTGTGATTTTGTTTTACTTTTTCAAATGTTTCCCA
+AATGATGTTTAACAGCGCAAGGAAATTTTTACAGTGTCTCCAATGATATTTTCTACAATA
+TATCTTCTATTAAGTCTTTGTTTTATTTTTTATAACTGCTAGAATAAAAGCAGTTTTTTG
+TCCCATTTTAAAGGGCCATGACATCCCCCTCTTTCGAGTCAGGTCTACCACAGAATTAAA
+AAAAAAATGC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXX
+.
+clr:0,850
+}
+{RED
+iid:80
+eid:zDH62-692b07.q1k
+seq:
+TCTTTCCATTTTATTTGTATATATTTTACTGGAACACATTAACTCTACAGGTGCCTAATA
+ATTAGCTGTGGAGCTAACATAAATCGTTTTATTCCATCTAGTAAACGCATAAAAATCGAC
+ATCATAATTTACTCAAGTGCACGCCTCAATGTCTCGCGTCCCTCTTAATAGGTGCTGGCA
+AGCCCCACAGTTTGAAACCCCTGGTGTATATATAGTTATTCTACTATAAAATCTGCTTTG
+TTAAATTTGTTGTTTGCTTTTGGCATCTGCTAGAGCTTTTGTACCAAGAAACAGTGACTT
+TTGATGTCAGACTTAAGCAAATAGAGTTGTTTATTGGTCCCGCCCACCTGCAAGGTTCCT
+CCACTCAGTGTCCAGGTCTGCTTGATTGGCGAGGCAGCCTTTTAAGACATTTCGACAGTA
+GTTTGAGCAGGGTTTGGCCAAGGCCACGCCACTACAGTGAGGACAATACGTCTGCTTCAT
+GACAGCACGCACACATTCAGTGCTCAGAGAAACCTGCAAAACACAAAAAACACAATTTAA
+AGAACAGCTCAACCATAATGAATCACTTAACAAGAAAAAAAAAGCCCTGTGAATTGTTTT
+GTGTCACACACAATATGCGATAATTGCACTGTGCAAATAATTGCTTGTCAGTACAGTTTC
+CCAAGAGGTCCAAGGATGTGGGATGGTACAGTTTGGTACAACTCTTGCAAAAGAATACCC
+ATGGTGCTTCTCTGAGACGTCTTTCACAATCATTCCTCTTTATCAGGAACCTCCACCCCT
+CTGATGTCAAAGCGTGGG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXX
+.
+clr:0,798
+}
+{RED
+iid:81
+eid:zDH63-36j03.q1k
+seq:
+AAGTATAAATGCACAGTTACGCGCAAGACAGGTGCTGTGGGTCACGGCAATCACTCGACA
+CAGAAGTATAAACCAGCCCTAACCCCGGCATCCTGGCCAAATTACCTCCGGTCCTTACCC
+ATCATGGCCTCCCAATCATCCCCATCCACCAAATTAGCTGTATCACTTTCTCTTCACTCC
+ACCTATAGCTGGTGTGTGGTGAGCGCACTGGCGCTGTTGTCATGTTGGTACGGTCACATC
+ATCCAAGTGGATTCTGCACACTGGGGGTGGTGTGAAGGGATCCCTGTCATGATTGTGGAG
+CTCTTTGGGTGTATGGCCATACACGATAAATGGGCTACATAAATACACACATATTACATT
+TCAGCACATTATCACTGTGGTGTTGAAATGTAACTAAAATCAAACTTTATAGTTACTCAA
+TCTCTCTTTTCTGTCTTTTTTCAGAGGCTTTTGACATGGTGCTTCGTCTGGGCCGTAATT
+CCACTCTGATGGTGTTACGCGAGGAGTTTCCGTGGTTTGGGGGCTGGAGCCAGTGGAGCC
+GTCACGCAGTTATTCCTGGATATGTCACTTTACATTCTGGGCTCTGATGCCAATGTAAAC
+GACATGGTCTCCACCTTCTTCTCTCGCCTTTTCCCTCTCACCTACCGTCGACTTCT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,656
+}
+{RED
+iid:82
+eid:ZDH88-152b21.p1k
+seq:
+ACATGTATTGCTTCACAGGAGACCTCAGGCAGATAAAGGATCATCCTGTGAGCATGAAAA
+ACAGCGGACAAAAGCCAAATCTCCAAGTAACCTTGGAAAGTCATGATGTACAATGTAAGA
+AATGTTAAACACCACCTCTGTGTTTCCTATGCAATACATACAAAGTAATAACATGTCATA
+TGACCCACCTGCTGTGGCAGGGACTTGATCCCATGACCTACTACTGCTGCTGCTGCGAAT
+GCAAAAAGCACATGTCCTAGTGTTTGTTTGGCCAATAAGCTTCACTCCATCTCAATACAT
+ACCCTGGAAGGAAGAAGCATGGCCCAGGATGAGATACTTGAGTTCGAAGCTATAGGAGAG
+AATGTTTTGGAGTGTGTCTCTTTGAGCAGCTGAGTAGTAGCTCTCCTCCATCTTGCGGGT
+ACAGCATGTGGGACCCTGGTGTTTACAGATGAGAAGTTCTGCATCTGTGATGGATTAATC
+ATAGAAGGTGACTTAAGTAGAAACATTTGTGCCTATTTAAACCACATGTCTCATAACTTT
+CATATGTTGGATTTCTGAGTACAGTTTTTAACCCTCATGCAATACCTCCTCTAAAGTTTT
+TTTTCCAAGCTAACAAACTGATTATGAACACTGAATGGCTTTCCTGTGGTAAATGCAATT
+TGCAAAGTCAAGTGACATACTGTTTACATCGACTAAAAGTAGTTGTACAGCATTTTTACA
+TGTAAACCTAAAGGGGGTTTTTAGCAAGTTTGGACAAACAAATTGGATGAACTTATATAT
+TTGGTTGATCGAAGATTTGGAGTTTGTAATTGGAAGATTGGATGGTTTAGTAATGCGTAC
+AATTTTAATCTTCA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXX
+.
+clr:0,854
+}
+{RED
+iid:83
+eid:zDH62-917l23.q1k
+seq:
+AAAGGGACTAAGCTGACAAGGAAATTAATAAATGAATGAAATTGGGTTTTGCGCTTTTGG
+CTTATCATAAATGCATTATTTTTGAGATTGATCTGGCTCCATGATGCAATCTTTTGCATT
+TTCTGTCACAGTTATACACCAAATTCTATTTATGTCTGGATTCCTCAGTTTTGTCAGCAT
+TGTGTAAATCACAGGGCCCTAAATGAGCCTCTGTTGTTACATCAACATATATTCATTCAC
+ACATCAATCAACTTCATCTATTTGCCCATTCGTTTCACTTATCAATCATCCATTTCATCC
+TTCCACCATCCATTCAATCATCCATGCATCTGTGTACCCTGGAAGGCGGCGGCGTGTGCA
+GAAATGAGAAATTTGAGCTCATAGCTGTACGATCCGATGTTCTGGGTGGTGTCTCTCAGG
+ACCGCCGCTCTGTAACTGTCTTCCATTCTTCGTGTACAACATGATGGCCCCGCATGCTTG
+CACACCGACAGTTCCACATCTGCAGTAAAAGACAGAACAGTAGCTTGTTAGACAGATGCG
+CGTTCTTTATGAAGTTTCCGCAGCTTCATTGACCTTCTGGGGTCAGCAAATGCGCTGGAA
+TCTCACTGTCGACTTGCTTCACAGAAATTAAAAATATATCTAGAATTACATAATTCTTGA
+AATAAGCAAACCAACTACACTTGAAACATATGTTCTCTGGATTTGTAATGTTTTCTTCTT
+CAAGTATTTCCCAATGA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXX
+.
+clr:0,737
+}
+{RED
+iid:84
+eid:zDH63-621b07.p1k
+seq:
+CTCAATACATACCCTGGAAGGAAGAAGCATGGCCCAGGATGAGATACTTGAGTTCGAAGC
+TATAGGAGAGAATGTTTTGGAGTGTGTCTCTTTGAGCAGCTGAGTAGTAGCTCTCCTCCA
+TCTTGCGGGTACAGCATGTGGGACCCTGGTGTTTACAGATGAGAAGTTCTGCATCTGTGA
+TGGATTAATCATAGAAGGTGACTTAAGTAGAAACATTTGTGCCTATTTAAACCACATGTC
+TCATAACTTTCATATGTTGGATTTCTGAGTACAGTTTTTAACCCTCATGCAATACCTCCT
+CTAAAGTTTTTTTTCCAAGCTAACAAACTGATTATGAACACTGAATGGCTTTCCTGTGGT
+AAATGCAATTTGCAAAGTCAAGTGACATACTGTTTACATCGACTAAAAGTAGTTGTACAG
+CATTTTTACATGTAAACCTAAAGGGGGTTTTTAGCAAGTTTGGACAAACAAATTGGATGA
+ACTTATATATTTGGTTGATCGAAGATTTGGAGTTGTAAATTGGAAGATTGGATGGTTTAG
+TAATGCGTACAATTTTAATCTTCATGCAATGCCTTCCTCTAGAGCAGGGATCAACAAACT
+TGGAGGTTCGGTGTCCTGAAGAATTTAGCTCCAACCCTGATCAAACACACCTGAACAAGC
+TAATCAAGGTCTTACTAGGGATACTTGAAACACCAAGGCAGGTGTGTTGAGGCAAGTTGG
+AGCTAAACCATTGCAGGGCACCGGACCTCCAG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,752
+}
+{RED
+iid:85
+eid:zDH62-1134p01.p1k
+seq:
+CAGCCACCAACACTAAATTAGGCAAAAAAAATAAAAATCTTACCCTTTAGGGAAACGAAC
+AAAAAAGGAGGAAGCACGCCCAGAGGGCTTTTGTGGGGAAGGAAAAAATTTAAGAATTTT
+CACAAAAGAAGGGCGAAAAAAAGAATGATCACCTAAAACAACGTTTGTCACCATTCTGCT
+AGCTGAAACAAAAAAAGTTAAGACCAAAATAACATTCAAAACCACGCCAGAGTGGATGAA
+AACATCCCCAGCAACACATAAGAGTTACCATATGATACCACTATGGATCCTCTTGGTTCT
+AATGCATGCTCTTTTAAGCATAAAAGTGTACCTTTTAAAAGGGTACCACCCCAGTGACAG
+GTTTCATACATTTCTGAGAGTGTGTTAAGAATTAATGTGTTCTTGACTCTAAGCATTTCA
+GCTTTCCGCCCAAGGGGATGCTAAAGGTTTAACTTATGACAAAAATGTACCCAAAAATGG
+CTTCACAAACAGAAATGTAGCAGAAACTCACCTTGAAAGAGGGCAGCATTCTGGATGATG
+AGCCCTTTGAGCTGAGCGCTGGTGGCCTGAAGGCTAGACTCCATATTCTGTTTGGCAATA
+AGCAGGTAACGCTCCTCCATTTTGCGAGAACAGCAAGTCAGGCCTTTTGGCTGGCACACC
+TGCAGATCTGAGCCTGTAGAATAACAGAGAGAAGATTTCTAACAGCCGTCACAATAAACA
+AGTAAACAGACCGCGGCATTTTATAAACTGAAGCTT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,756
+}
+{RED
+iid:86
+eid:zDH64-614i02.p1k
+seq:
+AGCGCGCACACTGATGTCGTGAGTCGAAAACTCAGCTTATAGTGTCGATATGACCACGCT
+GCACAGTTTTGGAAAATAGTCACTCGGGTCGGAGTTTTCAGAAAGCATTGCTTTGTCACC
+TGACATTGCGTTTTTGGTGTGGACATTGCGTTTTGGTGTAGATAAAAAACCATGTGATCT
+GTGCAGTCCGACAAGTCGACTTCAATAAAGCAAGCATCATGGCAGAGCATTATAGTCGGC
+TATTCTGTGCAGCCCTTAGTATCAGTATATTTGATCTGTGAAAGCGTCTCTTGTACTTGA
+AAACAAGCAAACACAACTCAATTCTTTCAGCCATGAATCATATAAACTCAAAATATTTTG
+AAATGTACATTTCTAGAAGAAAACTCTTGAGGCAATCTGGAAGAACTACAATTGAGCCTA
+TTGAAAAGAGTTCAGAAACCCGCTTATAGCAGAAGAGGTCTTTGTGCTTCATAACTCTGT
+AGACCTTTTTTCATGCTACAATACAAGCTAATGCTAGCTGTAAAAGCGTAAAAATGCTAG
+TACTCACTGTGGCAGTTAGCCTGGGCCCGTGAAGCTGAGCGTAGAGTATGGCCTCCTCGA
+CCTGACCTCTGATCCCCAGTAAGGCCAGCTCTAAATTGTGAGCTCCGGCAACCATTTGCG
+TGAGGTCCTGCAATATGGTGACATACTGTCTCCAGGGCTGGTGGAGCTCGGAGTAGCTCG
+CCAGGCACCCGCGCATGACATTAAGACAGTAGTTGCTGCACGCATGGATCAGGGTGAGTC
+CACGGCAGTGAGAGCAGTAATGCATGCGTACCAGAGCCCGTGTGCACTCTTTTGATAACC
+CTGCTGTTT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXX
+.
+clr:0,849
+}
+{RED
+iid:87
+eid:Zdh24-61d24.p1k
+seq:
+ATGTTTACAGTGTTGAGTCCTGTGAAGGGGCACCAGCTGAAAAGTTTTGCGTTCACCTTA
+TGATTAATGTTGTTGCACGTACGCCGGTTTCCACCTCTAAATAAGCAAGATGTGGCTACA
+TGTACATTAAGGTAGCGTTCAGAAAAATCTCCATGAAGAAACTCGACACAGGATCATAAA
+AACCTACTGCTAGCTAGCGTTTTGGAAGTTTTACTGCAGAGCAACACAGCGCGCAGAAGT
+ATAAATGCATGACTACATGCTAGGCAGGCACCGTGGGTCACGACAATCACTCGACGCAGA
+AGTATAAACCAGCCTTGAGAGTTCTAGTGTTATAAGCCCTACCTATGAGGCTCTGCCACT
+CAGTGTCCAGGTCAGCCTGATTAGCCAGGCAGCCCTTCATCACATTTTTGCAGTAGTTGA
+TGCAAGGTTTGACTGATCCCAGACCTCTGCAATGAGGGCAGTACACCAGTTTCATAATGG
+CACGATTGCACTCTGGGCTCAGTGGGACCTGTGGAAAGAGTGACCATTGCCAAGGGTTCA
+TTTTTTTTAAGATAACAATATTAAGTTAAACAGTAACCATGGCATTTATCAGTGAGCAAG
+GCAATTAACTCAGTATATCTTCAGGGAAGCTGTCCTGATAAAAAAAAAAAACACTGGAAG
+TTGAAATAAGAGCACTGGTAAACACACTAGATGCGAGTTAGCTTGATTTACTGAATTGTA
+CCTGCTTATTACCTGCATGTTGATTCAGGTCATCTACTTCAAACTTTGAAGTCTTTTGGG
+AAAGCCAGGTATGGAGGGCAGA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,802
+}
+{RED
+iid:88
+eid:zDH22-213h20.q1k
+seq:
+CGCGCGGGGCCAGAGTGTGTGCGCGCGCTCATGCGTCAGTGGTTCTGTCCTCTGTGTCGG
+GGTCTTCCGTCACTCAAGCCCTGTCATTCGCTGTGCCTGAACATCATGAAGGGCTGTCTG
+GCCAATCAGGCGGATCTAAACAGCGAGTGGAACAGCTTCATTGGTGAGAACAGAACACCT
+CTGCTTCATTTACTGTGTGTGTGTGTGTGTGTGTGTCCGCTGTGTGTGTGTGTGTGTGTG
+TGTCCGCTGTGTGTGTGTGTGTGTATGTCCGCTATGTGTCTGATGTGTGTGTGTGTGTGT
+GTGTGTCCGCTATGTGTCTGATGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTCTGATG
+TGTGTGTGTGTCTGATGTGTGTGTGTGTGTCCTGCAGATGCTCTGACAGTGGTGGTGGAG
+AAACTCGGCGGGCCGTTTAACTTTGAGCTGGCTGCGGACGCCATCGCTGTGACGGTTTCT
+GAAGGCATCATGAACATGCAAGAGAACAGCATCAGCATCTCTGCTAAGGTGAAGAAAACA
+CACACACACACACACACACACACACACACACACACACACTCTAGAAGATGAACCAAAACA
+AACACAGATGAGGAAGGGTTAGGACGATGTGAAACCCATATAAAACAGATGTCAGATCAG
+CTGTATCAGTGAAGCGTTCCCGCTCTGTTCTGCTGCCGCTCCTGTTC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,707
+}
+{RED
+iid:89
+eid:zDH22-229f07.q1k
+seq:
+TGAACCCAAGCCAGGATTGACCAGATGCTGGTACACCAATGGGAAGAGTTTGTCATAAAA
+TCTGTAAACCGAGTGTTCCACAGAAACGTTATCATCGCCTCGAAGGTAGAGATCAAGGTC
+ATTGAAGAGGGTGGACACCAGTGGTCTTGCATCTTGGGAGATTGTCTCGTAGGTGGTGTC
+GAAAAGTGAGTTGGTATGATTTAGAGTGAACGAGAGCAGGGAATGGAAGGTATCTGTGGG
+AAGAGGAAATAAAAGAAAGATTTTGGACTGAAGAAGCACTGAAAAAGACCTCCACGAACA
+GCTATTTCATAGTCATCTTAGATGGATAAACATTCGTAACATGAGAGACTAACAATTGCT
+GTAATTTTGTTTGACATTTACGAGAGGGTCAAAGATACTAGTCTGTCATGGTGCACCTCT
+GCCTTGTCTCGCATTGCTTACGACTCTTTCTTGTGTATCTAATCTCTCTTTCCATTGGGC
+TAATGGGAGCTGACAACACTTAATCCATGGATCTTTTGGGCTGGCGCTATTGGGCTGAAG
+GTTAGTTTGGAGATATGTGACACGTGTGACTAGCTTATTACCAATTTTAGCAGTCAGGGC
+GTCATTTTATACCTCACTATGCCTATGGTCTTCAAATGGAAGTTGAGGATCATAGTCTGT
+TGTGCCTTATACATTATTTACAATGGCATATTAACATTTGTGTGACAAGTGACAGATGGG
+TGCTTAAGTAGACAGCTGGTAGAACCCTTCAAAGTACAGTTTGCTTTAGTGTCATCTCAT
+TCATAATGGCCAAAACATTCCAGCTCTGTCTGGTTTCTCTGTGAATGGCCCAAATGCTAA
+GAATGAATCGAAAGTTATGATTG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,863
+}
+{RED
+iid:90
+eid:Zdh24-339i14.q1k
+seq:
+AAGACTGTTTTATGATGCATCTGTGCTTTTGTTAATTGTGCTGTAGTTTACATACAGAAC
+AGCCAAGCATACAGGTTACTGACCTCATCAAAACCCTGTATAAATGTGTGTGTGCTCGAG
+GTGTGTGTGTTCCTCTTACCGATAAATTTGCTCCATTCGTTGTTGAGATCGGCCTGGTTT
+GCCAAGCAGCCCTTCATGACATTCAGACAGTAGTTTCTGCAGGGCTTCAGTGTGAACAGA
+CCCTGACAATACGAGCAGTAGAGCATCTTCGTGAAGCCGCTGACACACGACGAGCTCATG
+CTGACCTGCGCACACACACACACGGCAATAATACAACAGTCACCACACTACTTGTAGTGA
+TGCTACAGCCTGACACTGGATGTCTCATAGTTTTGATTCGTACAATTGAATATAACTTTT
+AAAAATAAATAAATAAATAAAAAAAGTTAGAGAACAAAAAAATTATTTAGAGAAGAAAAA
+AAAATTTCAAGAAGAGGTTGGGGGTCATAAAATAAAATGATATAAAAAAAAAGTCACAAA
+CACAATTTAGGGTTTTTTCATCTCACCTGAGCGACTCTGTTAGCGACGTCACGTCCGACC
+GCAAGTCCCTGTACGAATGTGCGCGCCGCAATAAACGCGCG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,641
+}
+{RED
+iid:91
+eid:Zdh24-84h24.q1k
+seq:
+ATCCAGAGAACATATGTTTCAAGTGTAGTTGGTTTGCTTATTTCAAGAATTATGTAATTC
+TAGATATATTTTTAATTTCTGTGAAGCAAGTCGACAGTGAGATTCCAGCGCATTTGCTGA
+CCCCAGAAGGTCAATGAAGCTGCGGAAACTTCATAAAGAACGCGCATCTGTCTAACAAGC
+TACTGTTCTGTCTTTTACTGCAGATGTGGAACTGTCGGTGTGCAAGCATGCGGGGCCATC
+ATGTTGTACACGAAGAATGGAAGACAGTTACAGAGCGGCGGTCCTGAGAGACACCACCCA
+GAACATCGGATCGTACAGCTATGAGCTCAAATTTCTCATTTCTGCACACGCCGCCGCCTT
+CCAGGGTACACAGATGCATGGATGATTGAATGGATGGTGGAAGGATGAAATGGATGATTG
+ATAAGTGAAACGAATGGGCAAATAGATGAAGTTGATTGATGTGTGAATGAATATATGTTG
+ATGTAACAACAGAGGCTCATTTAGGGCCCTGTGATTTACACAATGCTGACAAAACTGAGG
+AATCCAGACATAAATAGAATTTGGTGTATAACTGTGACAGAAAATGCAAAAGATTGCATC
+ATGGAGCCAGATCAATCTCAAAAATAATGCATTTATGATAAGCCAAAAGCGCAAAACCCA
+ATTTCATTCATTTATTAATTTCCTTGTCAGCTTAGTCCCTTTATTAATCCGGGGTCGCCA
+GCACGGAATGAACCGCCCAACTTATCCAGCAGTGGATGCCCTTCCAGC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,768
+}
+{RED
+iid:92
+eid:Zdh24-512a06.q1k
+seq:
+TTTTTACAAAGCAATAAAAAAGAGGTGATGCAACAAAAATAGGAAAAAGCAAACCAACAA
+AAAAAAAAAGGCTGATTTATACTTCTGCATCAAGCGCACATGTATGCTCGGGTGCAGCCT
+TCGCACGGTCACATAGCCCTTGCCGTGGCTAATGCCGATGCTGACATGCACCTCTCAAAA
+AATTTAACTACACATCGCAACAACGCAAGCTGTGTGATTGGTAGGCTTGGTAGCTGTGAC
+GAGTGTGGAGCTACGAGCTCCATGGAGCCAATGTTTACAAGTGTTGAGTCCTGTGAAGGG
+GCACCAGCTGAAAAGTTTTGCGTTCACCTTATGATTAATGTTGTTGCACGTACGCCGGTT
+TCCACCTCTAAATAAGCAAGATGTGGCTACATGTACATTAAGGTAGCGTTCAGAAAAATC
+TCCATGAAGAAACTCGACACAGGATCATAAAAACCTACTGCTAGCTAGCGTTTTGGAAGT
+TTTACTGCAGAGCAACACAGCGCGCAGAAGTATAAATGCATGACTACATGCTAGGCAGGC
+ACCGTGGGTCACGACAATCACTCGACGCAGAAGTATAAACCAGCCTTGAGAGTTCTAGTG
+TTATAAGCCCTACCTATGAGGCTCTGCCACTCAGTGTCCAGGTCAGCCTGATTAGCCAGG
+CAGCCCTTCATCACATTTTTGCAGTAGTTGATGCAAGGTTTGACTGATCCCAGACCTCTG
+CAATGAGGGCAGTACA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXX
+.
+clr:0,736
+}
+{RED
+iid:93
+eid:zDH61-1372b03.p1k
+seq:
+GCTGCGGAACTTCATAAAGAACGCGCATCTGTCTAACAAGCTACTGTTCTGTCTTTTACT
+GCAGATGTGGAACTGTCGGTGTGCAAGCATGCGGGGCCATCATGTTGTACACGAAGAATG
+GAAGACAGTTACAGAGCGGCGGTCCTGAGAGACACCACCCAGAACATCGGATCGTACAGC
+TATGAGCTCAAATTTCTCATTTCTGCACACGCCGCCGCCTTCCAGGGTACACAGATGCAT
+GGATGATTGAATGGATGGTGGAAGGATGAAATGGATGATTGATAAGTGAAACGAATGGGC
+AAATAGATGAAGTTGATTGATGTGTGAATGAATATATGTTGATGTAACAACAGAGGCTCA
+TTTAGGGCCCTGTGATTTACACAATGCTGACAAAACTGAGGAATCCAGACATAAATAGAA
+TTTGGTGTATAACTGTGACAGAAAATGCAAAAGATTGCATCATGGAGCCAGATCAATCTC
+AAAAATAATGCATTTATGATAAGCCAAAAGCGCAAAACCCAATTTCATTCATTTATTAAT
+TTCCTTGTCAGCTTAGTCCCTTTATTAATCCGGGGTCGCCAGCACGGAATGAACCGCCAA
+CTTATCCAGCAGTGGATGCCCTTCCAGCAGCAACCTATCTCTGGGAAACATCCACACACA
+CATTCACACATACACACTCATACACTACTGACAATTTAGCCTACCCAATTCACCTGTACC
+GCTTGTCTTTGGACCTACTGCGCCACTATGTTGCACAAAACCCAATTTGTAAATTGAAAA
+CACAATTCATAAATGCACAAATCCAAAATACACACATCCAATTCATTGTTTTTCCTTTGG
+CTTAGTCACTTTACTC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXX
+.
+clr:0,856
+}
+{RED
+iid:94
+eid:zDH25-155a18.q1k
+seq:
+TTTTAAAAGGACTTTATAAAATATGAATCATCTAAAACATAGTTACTAAGGGAAGTTGCT
+TTCAAACTTTGAGGTGGCACATGTCTGAGTAGGTGGGTGTCTGAGTCGTTGTGTGTGGCA
+GTTTGTGTATGAGTTGTGTTTGTGTGTTTGGGCTGTTAGCTGAGGTGAGTGTGTGTTCAG
+GCTGATGGTGACAGAGAGAAGCTCATTAACACAGGCTTTGTCTCCTGCCGTGTGAGTGAC
+ATTGAGCTGCCTTCTGCCCCCTCTGTCCTGTACGGTTCCTCTCTCTCGTTCCCTCGCTCT
+GATGAGCAGGTGAGAGAGTGTGTGTAGGTAATGTCAATTAAAATCAAAGCATCTCAAAGC
+AACTTAGCCCGACAGGAAATGATATGTAATGGAGTATATCGTGCTTAACACTGCATTTGA
+CCCCAACTCTATTTTTTTCTCCTGATTCGTCGTTCTTCTTTCTCTAAGCCTCTACATTTT
+CTCATAAATCCCAGTATTTTGGATTCTTAATCTTGTCTCTTTGTGCACACCATCTAATTT
+CAATTTTCACTGAAGCCCATTCCTCTTTCTTCTTTCGCCTGCACTCAATACATTCTCAAT
+TTCCTCTCTGTCTGCTGCAGGGAGTTTATCTCGGGTCTAAGGGGCTTCAGTCAGTTCTAC
+AGTGGTCTCGGAGAAGCTTTGTGCAGCAAAGAGCCGACATCGCTGAACAGCTCCCTCTGC
+TGGAACGGACAGGAGATGACAGACAAGTGAGTAATTCATTTGTGGGAGCATTGATGCGAT
+GTAACCTCTACATTCCTTCATTGTGGACTCCTACAGCTCAAAGTAAGGGCATTGATGTTC
+A
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+X
+.
+clr:0,841
+}
+{RED
+iid:95
+eid:zDH77-77a21.q1k
+seq:
+TATTTTTGAGATTGATCTGGCTCCTTGATGCTATCTTTTGCGTTTTCTGTCTCAGTTATA
+CGCCGGATTCTATTTATGTCTGGATTCCTCAGTTTTGTCAGCATTGTGTAAATCACAGGG
+CCCTAAATGAGCCTCTGTTGTTACATCAACATATATTCATTCACACATCAATCAACTTCA
+TCTATTTGCCCATTCGTTTCACTTATCAATCATCCATTTCATCCTTCCACCATCCATTCA
+ATCATCCATGCATCTGTGTACCCTGGAAGGCGGCGGCGTGTGCAGAAATGAGAAATTTGA
+GCTCATAGCTGTACGATCCGATGTTCTGGGTGGTGTCTCTCAGGACCGCCGCTCTGTAAC
+TGTCTTCCATTCTTCGTGTACAACATGATGGCCCCGCATGCTTGCACACCGACAGTTCCA
+CATCTGCAGTAAAAGACAGAACAGTAGCTTGTTAGACAGATGCGCGTTCTTTATGAAGTT
+TCCGCAGCTTCATTGACCTTCTGGGGTCAGCAAATGCGCTGGAATCTCACTGTCGACTTG
+CTTCACAGAAATTAAAAATATATCTAGAATTACATAATTCTTGAAATAAGCAAACCAACT
+ACACTTGAAACATATGTTCTCTGGATTTGTAATGTTTTCTTCTTCAAGTATTTCCCAAAT
+GATGTTTAACAGAGCAAGGAAATTTTCACAGAATGTCTGATAATATTTTTTCTTCTGGA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,719
+}
+{RED
+iid:96
+eid:Zdh76-12n07.p1k
+seq:
+GTTGGATTTACAGAAATCAAATGTCATGCTGTCTGCACCTATATTTACACCTAAACAAAA
+CAGACTTTTTCTTTCAATATCCGTGAAATTAGATTCATTTAAACAACAAGCAAATGTCAA
+GTTCTACTTTCCTTCCCGAACTGCATTGCTTTTCCCTGAGGGACCCTATAAACCCCCACG
+CTTTGACATCAGAGGGGTGGAGGTTCCTGATAAAGAGGAATGATTGTGAAAGACGTCTCA
+GAGAAGCACCATGGGTATTCTTTTGCAAGAGTTGTACCAAACTGTACCATCCCACATCCT
+TGGACCTCTTGGGAAACTGTACTGACAAGCAATTATTTGCACAGTGCAATTATCGCATAT
+TGTGTGTGACACAAAACAATTCACAGGGCTTTTTTTTTCTTGTTAAGTGATTCATTATGG
+TTGAGCTGTTCTTTAAATTGTGTTTTTTGTGTTTTGCAGGTTTCTCTGAGCACTGAATGT
+GTGCGTGCTGTCATGAAGCAGACGTATTGTCCTCACTGTAGTGGCGTGGCCTTGGCCAAA
+CCCTGCTCAAACTACTGTCGAAATGTCTTAAAAGGCTGCCTCGCCAATCAAGCAGACCTG
+GACACTGAGTGGAGGAACCTTGCAGGTGGGCGGGACCAATAAACAACTCTATTTGCTTAA
+GTCTGACATCAAAAGTCACTGTTTCTTGGTACAAAAGCTCTAGCAGATGCCAGAAGCAAA
+CAACAAATTTAACAAAGCAGATTTTATAGTAGAATAACTATATATACACCAGGGGTTTCA
+AACT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXX
+.
+clr:0,784
+}
+{RED
+iid:97
+eid:zDH23-205m08.p1k
+seq:
+CTCACTACTCCCTGCTGCTTTCCAAATGAAAGAGGGCCAATGGTACCTCTCTGTTCGTTA
+AGGAATTTCTTACAGAATTGGAATCTTGGTCTCCCGCTGCCAAACTCTCGAGAGATTCCT
+GCTAAGCAGACCTAAATTCTTGCTGATGTTGGGAATAGATCAGTTCAGAATATTGCGTGC
+CTTGTAAAAAACATCAGTAAAATCTGAATTCCACTGCATGGCACGTTCATAGGGATTAGC
+ATTCAACATGAATACGTTTAGTCATGGCCATATTCAAGTTTGTTGAGCAGCATGACAGGT
+TCACATTCTGTCAGAATAAAGCGATTCAACTGAAGATGCCTTCAGCTAATATACAAGCAT
+GATTACTCTGCCCTCCATACCTGGCTTTCCCAAAAGACTTCAAAGTTTGAAGTAGATGAC
+CTGAATCAACATGCAGGTAATAAGCAGGTACAATTCAGTAAATCAAGCTAACTCGCATCT
+AGTGTGTTTACCAGTGCTCTTATTTCAACTTCCAGTGTTTTTTTTTTTTATCAGGACAGC
+TTCCCTGAAGATATACTGAGTTAATTGCCTTGCTCACTGATAAATGCCATGGTTACTGTT
+TAACTTAATATTGTTATCTTAAAAAAAATGAACCCTTGGCAATGGTCACTCTTTCCACAG
+GTCCCACTGAGCCCAGAGTGCAATCGTGCCATTATGAAACTGGTGTACTGCCCTCATTGC
+AGAGGTCTGGGATCAGTCAAACCTTGCATCAACTACTGCAAAAATGTGATGAAGGGCTGC
+CTGGCTAATC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXX
+.
+clr:0,790
+}
+{RED
+iid:98
+eid:ZDH51_49i11.q1k
+seq:
+TCTACTTTCCTTCCCGAACTGCATTGCTTTTCCCTGAGGGACCCTATAAACCCCCACGCT
+TTGACATCAGAGGGGTGGAGGTTCCTGATAAAGAGGAATGATTGTGAAAGACGTCTCAGA
+GAAGCACCATTGGTATTCTTTTGCAAGAGTTGTACCAAACTGTACCATCCCACATCCTTG
+GACCTCTTGGGAAACTGTACTGACAAGCAATTATTTGCACAGTGCAATTATCGCATATTG
+TGTGTGACACAAAACAATTCACAGGGCTTTTTTTTTCTTGTTAAGTGATTCATTATGGTT
+GAGCTGTTCTTTAAATTGTGTTTTTTGTGTTTTGCAGGTTTCTCTGAGCACTGAATGTGT
+GCGTGCTGTCATGAAGCAGACGTATTGTCCTCACTGTAGTGGCGTGGCCTTGGCCAAACC
+CTGCTCAAACTACTGTCGAAATGTCTTAAAAGGCTGCCTCGCCAATCAAGCAGACCTGGA
+CACTGAGTGGAGGAACCTTGCAGGTGGGCGGGACCAATAAACAACTCTATTTGCTTAAGT
+CTGACATCAAAAGTCACTGTT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,561
+}
+{RED
+iid:99
+eid:ZDH51_192d17.p1k
+seq:
+TCTGATGTCTACAAAACACATTATTATTATTTTATTATTTTATTTTAGTTTAATAATTAA
+TAATAATCATTATTAATATTATTATTATTATTATTATTATTATTATTATTATTAATCTGC
+CTGCATTATTCAAAAGCAAAAACATTCAGAAAGCCATTATTTGCTTCACAAACCAAACCT
+GAAAAAATCTGCAAGAATATTACAAATATAACACTTTTTTTTTAGGTACACATATTGAAC
+CCTTGCCAATAACAAGGAAGCAAATATACCATAGAATGGTCTTCAATGGGGATATTTTTG
+TCCTGAGACAAACTTTTTAGTTCTTAGTGTAAAACAGATTTAAGACAGAAAATGAGTATT
+GCGAAACAATAATTCTAGTGTAGAGCTCATCAGTGAGGCTATTATGTGAAAAGCCTAAAT
+TAACACAGGAAAGAACTGAATTAAGCCCTTGGAGAGCCACCAGGGAACTCAATCACATAT
+TTTGAGTTTTAAAGAAAAATAAACACTGACAACACTGTACTGTACAACTAATGTCTGGAG
+ACAAACTGACATCATACTAAACAAGAGTACCGCAAACTACCAGCTTCACCAAGGCTGTAG
+ATAAACCACCCAAGCATGATTAACCAGCGCACCAACCTTGGAAAGCGGCCACATTTCGTG
+AGAAGAGGAACTTTAGGCTGGAGCTAGAGATCTGGAGAAGGTTCTGAATATCCCGCCGGG
+CCGCCACCTGGTAACGCTCCTCCATCTTTTTGGTGCAGCATGTTAGATTCCTGGATAAGC
+AAACCTGCAGGTCTGAACCTGAAAAAGAACAAATATTATTTGTTATCTAAAGTGGCAATG
+TAAAAAAACAACACTTAATACACAAATACACTCAATTGAACATGCACACATAGACATCAC
+CTATACTTTGTCATCACCTATACCTATACAACAGTACTTAGTCTCCCTT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,949
+}
+{RED
+iid:100
+eid:ZDH51_6g24.p1k
+seq:
+CTCATTTTTATCATTGATTTTTTTTATCTGTGCCATAATCACAGTAAATAATATTTTACT
+AGATCCTTTTCAAGATACTAGTATTTAGCTTAGTGACATTTAAAGGCTTAACTAGGTTAA
+TTAGGAAAGTTAGGATAAATTAGGCAAGTTATTAACAATGGTTTGTTCTTTAGACAATCA
+AAAACAAAATTGCTAAAGGGGGGCTAATAATATTGACTTTAAAAGGGTTTAAAAAAAATC
+AAAACTGCTTTTATTCTAGCTGAAATAAAACAAAAGACTTTCTCCAGAAGAAAAAATATT
+ATCAGACATTCTGTGAAAATTTCCTTGCTCTGTTAAACATCATTTGGGAAATACTTGAAG
+AAGAAAACATTACAAATCCAGAGAACATATGTTTCAAGTGTAGTTGGTTTGCTTATTTCA
+AGAATTATGTAATTCTAGATATATTTTTAATTTCTGTGAAGCAAGTCGACAGTGAGATTC
+CAGCGCATTTGCTGACCCCAGAAGGTCAATGAAGCTGCGGAAACTTCATAAAGAACGCGC
+ATCTGTCTAACAAGCTACTGTTCTGTCTTTTACTGCAGATGTGGAACTGTCGGTGTGCAA
+GCATGCGGGGCCATCATGTTGTACACGAAGAATGGAAGACAGTTACAGAGCGGCGGTCCT
+GAGAGACACCACCCAGAACATCGGATCGTACAGCTATGAGCTCAAATTTCTCATTTCTGC
+ACACGCCGCCGCCTTCCAGGGTACACAGATGCATGGATGATTGAATGGATGGTGGAAGGA
+TGAAATGGATGATTGATAAGTGAAACGAATGGGCAAATAGATGAAGTTGATTGATGTGTG
+AATGAATATATGTTGATGTAACAACAGAGGCTCATTTAGGGCCCTGTGATTTACACAATG
+CTGACAAAACTGA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXX
+.
+clr:0,913
+}
+{RED
+iid:101
+eid:ZDH51_468l03.p1k
+seq:
+TGAGAGACTTAATTTTTTTATTATGTTAGACAACTTTCAAAACTTTATTCCGTTACTAAT
+AAACTTTTTTCTACTCTATTATTTCTTTCAGAAAGCGTGGAGTCTCTGGTGCGTCAGGCG
+GAGAACCACACCCTCTCCATCCTCCATCAGTCCCAGCGTGATCTCTCCAGCCCAGCAGCA
+TCAGCACCAGTCGGGGAGTTTTTCACAGAAGTGGCTCTGTTCATCCTGGGCTCTGAGCTC
+AGTCTAGAAGAGTCCTCTCAGAGCTTCTTCAACGCTCTTTTCCCCTTAATATACGAGCGT
+CTGATTGACTCCCGTCTGTCTCCTCCATACGCCGAATGCCTGCGCTCGTCTGCTCAAGAT
+CTAGCACCGTTCGGAGCAGCCCCAATCCGCCTGGCGTCCCAAATCGCCCATGCTTCTCTA
+CCTGCTCGCGTGTTTCTCCAAGCGCTCCATTTGGGCATCGAGATCATAAATACGACCGAT
+CACATCCAGCTGAGCCGCGAGTGCAGACGTGGCCTACTGAGGATGAGCTACTGCCCGCAC
+TGCAAGGCTCTGACCTCCAGCAAACCCTGCTTGGGATACTGCCTGAACGTGGTGCGCGGG
+TGTCTGGCTAACCTGGCTGAAGTGGATGCCCACTGGAGGGAGTTTGTACGCTCGCTGGAG
+ACGCTGGCAGTACGGATGCACGGAGAGCTGGATCTGGAGCAGGTGCTGCTGGGGGCGCAT
+GAGCTGGTGAGGGACGCTGTGGCGCACGCTCAGAGGAGCACAGCGAGGATACATGCG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,777
+}
+{RED
+iid:102
+eid:ZDH51_901l16.p1k
+seq:
+ACATACTCATCCCTCATGTCGTCCATCTCCCCTCACATCGTCTGCCTCTTCACGGACCTC
+TCTCGCTTCCTCCAGGGCACCGGCAACGTCTCGGTGGAAGCTGCTGTGCACTGTTTCTTC
+GACAGCCTTTTCCCATTGGTCCACACTCAGATTGTCAATCCCGGTATGGAAGGAAGTATT
+GGGACAGATGCTTCTGAAGGCAACCAGCTTGGTGACTGTCTCCGAATGACCAGGCAGGAC
+GTAAACCCCTTTGGTCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGG
+GCTGGGCGGGTGCTCAGCTTGGCACTTGCCGAAGGGTCAGAGGTGATGAACATTACGGAA
+ACAGCAGGGTTATCAAAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCAC
+TGCCGTGGACTCACCCTGATCCATGCGTGCAGCAACTACTGTCTTAATGTCATGCGCGGG
+TGCCTGGCGAGCTACTCCGAGCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGCAG
+GACCTCACGCAAATGGTTGCCGGAGCTCACAATTTAGAGCTGGCCTTACTGGGGATCAGA
+GGTCAGGTCGAGGAGGCCATACTCTACGCTCAGCTTCACGGGCCCAGGCTAACTGCCACA
+GTGAGTACTAGCATTTTTACGCTTTTACAGCTAGCATTAGCTTGTATTGTAGCATGAAAA
+AAGGTCTACAGAGTTATGAAGCACAAAGACCTCTTCTGCTATAAGCGGGTTTCTGAACTC
+TTTTCAATAGGCTCAATTGTAGTTCT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,806
+}
+{RED
+iid:103
+eid:ZDH51_977d16.p1k
+seq:
+TTATTTGATATATTTTACTGGAAACATTAACTCTACAGGTGCCTAATAATTAGCTGTGGA
+GCTAACATAAATCGTTTTATTCCATCTAGTAAACGCATAAAAATCGACATCATAATTTAC
+TCAAGTGCACGCCTCAATGTCTCGCGTCCCTCTTAATAGGTGCTGGCAAGCCCCACAGTT
+TGAAACCCCTGGTGTATATATAGTTATTCTACTATAAAATCTGCTTTGTTAAATTTGTTG
+TTTGCTTTTGGCATCTGCTAGAGCTTTTGTACCAAGAAACAGTGACTTTTGATGTCAGAC
+TTAAGCAAATAGAGTTGTTTATTGGTCCCGCCCACCTGCAAGGTTCCTCCACTCAGTGTC
+CAGGTCTGCTTGATTGGCGAGGCAGCCTTTTAAGACATTTCGACAGTAGTTTGAGCAGGG
+TTTGGCCAAGGCCACGCCACTACAGTGAGGACAATACGTCTGCTTCATGACAGCACGCAC
+ACATTCAGTGCTCAGAGAAACCTGCAAAACACAAAAAACACAATTTAAAGAACAGCTCAA
+CCATAATGAATCACTTAACAAGAAAAAAAAAGCCCTGTGAATTGTTTTGTGTCACACACA
+ATATGCGATAATTGCACTGTGCAAATAATTGCTTGTCAGTACAGTTTCCCAAGAGGTCCA
+AGGATGTGGGATGGTACAGTTTGGTACAACTCTTGCAAAAGAATACCCATGGTGCTTCTC
+TGAGACGTCTTTCACAATCATTCCTCTTTATCAGGAACCTCCACCCCTCTGATGTCAAAG
+CGTGGGGGTTTATAGGGTCCCTCAGGGAAAAGCAATGCAGTTCGGGAAGGAAAGTAGAAC
+TTGACATTTGCTTGTTGTTTAAATGAATCTAATTTCACGGATATTGAA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,888
+}
+{RED
+iid:104
+eid:ZDH51_470a08.p1k
+seq:
+GAAAGGCGAGAGAAGAGGTGGAGACATGTCGTTTACATTGGCATCAGAGCCCAGAATGTA
+AAGTGACATATCCAGGAATAACTGCGTGACGGCTCCACTGGCTCCAGCCCCCAAACCAGG
+AAACTCCTCGCGTAACACCATCAGAGTGGAATTACGGCCCAGACGAAGCACCATGTCAAA
+AGCCTCTGAAAAAAGACAGAAAAGAGAGATTGAGTAACTATAAAGTTTGATTTTAGTTAC
+ATTTCAACACCACAGTGATAATGTGCTGAAATGTAATATGTGTGTATTTATGTAGCCCAT
+TTATCGTGTATGGCCATACACCCAAAGAGCTCCACAATCATGACAGGGATCCCTTCACAC
+CACCCCCAGTGTGCAGAATCCACTTGGATGATGTGACCGTACCAACATGACAACAGCGCC
+AGTGCGCTCACCACACACCAGCTATAGGTGGAGTGAAGAGAAAGTGATACAGCTAATTTG
+GTGGATGGGGATGATTGGGAGGCCATGATGGGTAAGGACCGGAGGTAATTTGGCCAGGAT
+GCCGGGGTTAGGGCTGGTTTATACTTCTGTGTCGAGTGATTGCCGTGACCCACAGCACCT
+GTCTTGCGCGTAACTGTGCATTTATACTTCTGTATGCTGTTTTTGTTGCTCTGCACTCT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,659
+}
+{RED
+iid:105
+eid:zDH53-234d09.p1k
+seq:
+CGCATCTCACCAATAAAGAGGTTCCACTCAGGGTCCAGATCCGCTTGGTTGGCCAGGCAG
+CCGCGCATCACATTCTGGCAGTAGTTGGCGCAGGGTTTGAGTCCTGACATTCCTCCACAA
+TACGGGCAGTACCACATTTTAGTCAATGCTTTACTGCAGCCTGGAGAAATATTGACCTGC
+AGGATAAACACACATGGGCAGATGTTAAATGTGCTTTGAAATGTGCATTTTTTTTTATTT
+AAAGTTTGACGTAATCCCAACTGAAACATAAAGAGAGAGCAGGACATACAGTAGCTCCTC
+CCAAAAAACAGCCAATATAGTTTCATTTTTTATCACAGCCTTGCCAGTGACAGGGACTGT
+ACCTGTATGCCTACAACTGATGTCAAAATTATTCGCCCTCCTGTGATTTTGTTTTACTTT
+TTCAAATGTTTCCCAAATGATGTTTAACAGCGCAAGGAAATTTTTTACAGTGTCTCCAAT
+GATATTTTCTACAATATATCTTCTATTAAGTCTTTGTTTTATTTTTTATAACTGCT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,536
+}
+{RED
+iid:106
+eid:zDH54-171n05.p1k
+seq:
+CCTTCAGCTAATATACAAGCATGATTACTCTGCCCTCCATACCTGGCTTTCCCAAAAGAC
+TTCAAAGTTTGAAGTAGATGACCTGAATCAACATGCAGGTAATAAGCAGGTACAATTCAG
+TAAATCAAGCTAACTCGCATCTAGTGTGTTTACCAGTGCTCTTATTTCAACTTCCAGTGT
+TTTTTTTTTTTATCAGGACAGCTTCCCTGAAGATATACTGAGTTAATTGCCTTGCTCACT
+GATAAATGCCATGGTTACTGTTTAACTTAATATTGTTATCTTAAAAAAAATGAACCCTTG
+GCAATGGTCACTCTTTCCACAGGTCCCACTGAGCCCAGAGTGCAATCGTGCCATTATGAA
+ACTGGTGTACTGCCCTCATTGCAGAGGTCTGGGATCAGTCAAACCTTGCATCAACTACTG
+CAAAAATGTGATGAAGGGCTGCCTGGCTAATCAGGCTGACCTGGACACTGAGTGGCAGAG
+CCTCATAGGTAGGGCTTATAACACTAGAACTCTCAAGGCTGGTTTATACTTCTGCGTCGA
+GTGATTGTCGTGACCCACGGTGCCTGCCTAGCATGTAGTCATGCATTTATACTTCTGCGC
+ACTGTGTTGCTCTGCAGTAAAACTTCCAAAACGCTAGCTAGCAGTAGGTTTTTATGATCC
+TGTGTCGAG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXX
+.
+clr:0,669
+}
+{RED
+iid:107
+eid:zDH52-513a01.q1ka
+seq:
+AAGGATCTCCTGTGAGCATGAAAAACAGCGGACAAAAGCCAAATCTCCAAGTAACCTTGG
+AAAGTCATGATGTACAATGTAAGAAATGTTAAACACCACCTCTGTGTTTCCTATGCAATA
+CATACAAAGTAATAACATGTCATATGACCCACCTGCTGTGGCAGGGACTTGATCCCATGA
+CCTACTACTGCTGCTGCTGCGAATGCAAAAAGCACATGTCCTAGTGTTTGTTTGGCCAAT
+AAGCTTCACTCCATCTCAATACATACCCTGGAAGGAAGAAGCATGGCCCAGGATGAGATA
+CTTGAGTTCGAAGCTATAGGAGAGAATGTTTTGGAGTGTGTCTCTTTGAGCAGCTGAGTA
+GTAGCTCTCCTCCATCTTGCGGGTACAGCATGTGGGACCCTGGTGTTTACAGATGAGAAG
+TTCTGCATCTGTGATGGATTAATCATAGAAGGTGACTTAAGTAGAAACATTTGTGCCTAT
+TTAAACCACCATGTCTCATAACTTTCATATGTTGGATTTCTGAGTACAGTTTTTAACCCT
+CATGCAAATACCTCCTCTAAAGTTTTTTTTTCCAAGCTAACAAACTGATTATGAACACCT
+GAATGGCTTTC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXX
+.
+clr:0,611
+}
+{RED
+iid:108
+eid:zDH52-125e06.p1k
+seq:
+TGCTCAGGACTGTCAAGGCGCTTGTGGTTGGTCGTGCCCTCAGCCGGGCACTGGCAGTCG
+GTGCAGATGTACTTAACATCACAGAGTCTGTGGGCATGGGACGAGTGTGTGGACGTGCAC
+TAGTGCGCATGTTGTTCTGTCCTCACTGTCGAGGACTGACCCTGATCCGGCCATGTGGAG
+GCCTATGTCTCAACGTGATGCGAGGTTGCCTGGCAGGCGTGGCTGAGCTGGATGCTCCCT
+GGCGAGACTATGTATCGCTTCTGGAGAAGCTGAGTGGGGCATTATCAGAGAGATATGAAG
+TGGAACTGGGACTTCTACGCATCCGGGAAAGAATTAATGATGCCATCCTCACTGCGCAAC
+TGCACGGGCCACATCTTAGCGCCGTGGTGAGTCATGCTACTCTCTGATTCATAGAACACA
+TTTATTTTTATTCCACGAACGAGCTGCACCATGTGTTGGACTAATCAGTTCTAGTGGGCA
+TGCACTTGAAGCAGCATGTTTGGTGACTGGTGCATATCAAATGTCTCGACCAATCGTAGT
+CTGTGCAGTTACAAGGCTGCCGTTTTGCACATTTAAGACAATTTGGCTTTAATCTAAAAT
+AAATAACTTGTATAAATTCGCATTTTAGCCTAAAGTTTTCAGTTCTAAATTGTGTAAAAC
+GAAGCCCTATGATTATTCTATCTGCAAGGGGTTTATTATTAGC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,703
+}
+{RED
+iid:109
+eid:zDH52-1022f08.q1k
+seq:
+CTATCAAGCAATGCATCTCTCCGTCCATCAATCCATCCGTCAGAATCATTGTGTCTGAAG
+ACTGTTTTATGATGCATCTGTGCTTTTGTTAATTGTGCTGTAGTTTACATACAGAACAGC
+CAAGCATACAGGTTACTGACCTCATCAAAACCCTGTATAAATGTGTGTGTGCTCGAGGTG
+TGTGTGTTCCTCTTACCGATAAATTTGCTCCATTCGTTGTTGAGATCGGCCTGGTTTGCC
+AAGCAGCCCTTCATGACATTCAGACAGTAGTTTCTGCAGGGCTTCAGTGTGAACAGACCC
+TGACAATACGAGCAGTAGAGCATCTTCGTGAAGCCGCTGACACACGACGAGCTCATGCTG
+ACCTGCGCACACACACACACGGCAATAATACAACAGTCACCACACTACTTGTAGTGATGC
+TACAGCCTGACACTGGATGTCTCATAGTTTTGATTCGTACAATTGAATATAACTTTTAAA
+AATAAATAAATAAATAAAAAAAGTTAGAGAACAAAAAAATTATTTAGAGAAGAAAAAAAA
+ATTTCAAGAAGAGGTTGGGGGTCATAAAATAAAATGATATAAAAAAAAAGTCACAAACAC
+AATTTAGGGTTTTTTCATCTCACCTGAGCGACTCTGTTAGCGACGTCACGTCCGACCGCA
+AGTCCCTGTACGAATGTGCGCGCCGCAATAAACGCGCGAGTCACCTGTGATTTCAGCTTT
+TTAGGCACATCTCCAAACGGCCGCAGCTGCTCCGTGTATTTACCGATGCACTCCAAATAT
+TCGTCCGTGATCTGAAACTGAGAGTTGAGCAGCTGAAACATGCGCTCTAGTAATCGTGTC
+CAGAAGTCCTTTAGCATCT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXX
+.
+clr:0,859
+}
+{RED
+iid:110
+eid:zDH52-940l03.q1k
+seq:
+TTGCATGTACATGATGCCTTCAGAAACCGTCACATTTATGGCGTCCGCAGCCAGCTCAAA
+GTTAAACGGCCCGCCGAGATTTCTCCACCACCACTGATCAGAGCATCTGCAGGACACACA
+CACACACATCAGACACACACACACATCAGACACACACACACACACACAAACACACACACA
+CATCAGACACATAGCGGACACACACACACACACACACACATCAGACACATAGCGGACATA
+CACACACACACACACAGCGGACACACACACACACACACACACAGCGGACACACACACACA
+CACACACACAGTAAATGAAGCAGAGGTGTTCTGTTCTCACCAATGAAGCTGTTCCACTCG
+CTGTTTAGATCCGCCTGATTGGCCAGACAGCCCTTCATGATGTTCAGGCACAGCGAATGA
+CAGGGCTTGAGTGACGGAAGACCCCGACACAGAGGACAGAACCACTGACGCATGAGCGCG
+CGCACACCACTCTGGCCCCGCGCGCAGCTACACACACGTAGAGAGAGACACACACACACA
+CACACACCAGTGGCTGTGAGTGAGGCTGCAGGAGCACAGAGCTCTGCTGGATCTGAC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,597
+}
+{RED
+iid:111
+eid:zDH52-1289d08.p1k
+seq:
+TACATTCATCCATAAATCTGTCAACCCATAAATCTAGCCATCAATCAATCCATAATTCTA
+TCAAGCAATGCATCTCTCCGTCCATCAATCCATCCGTCAGAATCATTGTGTCTGAAGACT
+GTTTTATGATGCATCTGTGCTTTTGTTAATTGTGCTGTAGTTTACATACAGAACAGCCAA
+GCATACAGGTTACTGACCTCATCAAAACCCTGTATAAATGTGTGTGTGCTCGAGGTGTGT
+GTGTTCCTCTTACCGATAAATTTGCTCCATTCGTTGTTGAGATCGGCCTGGTTTGCCAAG
+CAGCCCTTCATGACATTCAGACAGTAGTTTCTGCAGGGCTTCAGTGTGAACAGACCCTGA
+CAATACGAGCAGTAGAGCATCTTCGTGAAGCCGCTGACACACGACGAGCTCATGCTGACC
+TGCGCACACACACACACGGCAATAATACAACAGTCACCACACTACTTGTAGTGATGCTAC
+AGCCTGACACTGGATGTCTCATAGTTTTGATTCGTACAATTGAATATAACTTTTAAAAAT
+AAATAAATAAATAAAAAAAGTTAGAGAACAAAAAAATTATTTAGAGAAGAAAAAAAAATT
+TCAAGAAGAGGTTGGGGGTCATAAAATAAAATGATATAAAAAAAAAGTCACAAACACAAT
+TTAGGGTTTTTTCATCTCACCTGAGCGACTCTGTTAGCGACGTCACGTCCGACCGCAAGT
+CCCTGTACGAATGTGCGCGCCGCAATAAACGCGCGAGTCACCTGTGATTTCAGCTTTTTA
+GGCACATCTCCAAACGGCCGCAGCTGCTCCGTGTATTTACCGATGCACTCCAAATATTCG
+TCCGTGATCTGAAACTGAGAGTTGAGCAGCTGAAACAT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,878
+}
+{RED
+iid:112
+eid:zDH52-970g14.q1k
+seq:
+TAAAAGATATCAGATATTAGAAATGAGTTACTGAAACTATTATACTTAGAAAAGTGTTAA
+AAAAAATCTTTCTGATAAACGAGAATATGTGGGAAAAAATATATACAGAGGAACTAACAA
+TTAAGGAGGGCTAATAATTACGGACACATTTAAAGCATGTTAATACTGCAGGTCTTTCTT
+ACCAAGGAAGTTATTCCACTCTGTGTCCAGATCGGCCTGATTGGCCAGACAGCCCCTCAT
+GACATTCAGACAGTAGTTCTTGCAGGGCTTCAGCGCCACCTGACCGCTACAGTACGGGCA
+GTATAACATCTTCATCGATGCGCGCACACAGCTCGGTGAGGCGCTCACCTGAGAAAAAGG
+ACGAACAGGAAGAGTAATTGAGCAGAGTCAGCAAAACAGACAGAAAAGGTTAATGAGTCC
+GTAACCTAATTCATATGCCTGATGTTGCTGATAAAACACTGAACAAAGAGCATTAGCGAC
+CCCACCACCTTTTATAAGGTCACTGCTGAACTCGTGTTTGCTCAATTTATCATTGAAGGT
+TCAATTGCTTCTGCTAACTCACAACACACACACACAGAGAAAGAGAAAGCCTTGGCCTCT
+GATCTTTTAATGCTAGAAGATAAGCCTTGATTGGTCCATCCAGGTGTCCACCTTCACATA
+CTGATAACCTGATAGAAAACCTTTACTTTTCATTTCTGCTGACTCGCTTAAAAACTACGA
+TTTGCCAAATTTGCTTTAGGGCTGGCTATTGATTAAGTTTTCCACGTTCAGATGGTATTT
+AACAAAAAAAAAATTTCAGCTTAGTCCCCTTATTAATCAGGGGTTGCCACAGCAGAATGA
+ACCGCAATTTATCCAGCATATGCTTT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,866
+}
+{RED
+iid:113
+eid:zDH52-887e07.q1k
+seq:
+TGACAGATCAATGATAAAATAAAGCCTGGTGATTAAAAACCTGCAATACCTTGACAAGAA
+CTTTCATGTAAACTGAAGTACTAACTAAAAAAGGTGTCCTGAGAAATCTCGACAGTTTTT
+TGAGTTTGATAGCCCTGGGCTCAATCAGAAAACTAGCCAGTCAGAAACACTCTTCATTTC
+ACTCGTTCGGGTCTGCTGACACTGACTTTGCTGACAAGTCTTTGGAGGTTGAGTTTTGGA
+GAGAGATGGCGTTAGCAAAAATGGCTGAAGTTAGCAAAATGGCTGCAGTCGCCTACAGCA
+TTCGAATTCATACCTTGTTTCTGAGACCATGTGTCACTCACCTGGGCGCTGACTTTGCTC
+TTGCTTGCCACGGCTTGTTTGAGAGCCTGTCTGATAATGACGTGCAGTCGGAGCACCACA
+GCCTCGATGTCCTGTTCCCCCTTCATGGCAGCGGCGAGTGACCCCAGTTCATCCACATAT
+GCTCTCCAATGAGGCTGTACCTCCGTGGTTCCCCCCAAACATGCTCCCATGGTGCTGATA
+CACAGTGGACGGCACGGCCGGGCCTCCAGCAGGCTTTGACAGTGCGGGCAGTACCACAGT
+TTCAGAAGCGAGCGCCCACAATCTCTACCTGCCCGCAAATGCTGAGTGGTGTTGACCACT
+TCTATGCCCAAATTTAGCGCTTGCAGGAAGACCCGAGTGGCGAGGAGTGAGCGGGATAGT
+CGGGTCATCATCATCTTGGGAAATGACCCATACGCAGAGCTCCCTTTCCAGGCCCC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,776
+}
+{RED
+iid:114
+eid:zDH40-924o11.q1k
+seq:
+ACTGATGTCCATGTAAATGTAGTCAGTATCTTCAAAGTACGTGAAAGATCCAAATGGGCA
+TTCTCCTGATTTGATTCAGAAGGGCACTTTTTTGTCAGATGGCTCAGCGGTTTGACTTTC
+ATTTATTCACCGTCATTAGTTTTAAAAAGCACTCTTTCCATTTTATTTGTATATATTTTA
+CTGGAACACATTAACTCTACAGGTGCCTAATAATTAGCTGTGGAGCTAACATAAATCGTT
+TTATTCCATCTAGTAAACGCATAAAAATCGACATCATAATTTACTCAAGTGCACGCCTCA
+ATGTCTCGCGTCCCTCTTAATAGGTGCTGGCAAGCCCCACAGTTTGAAACCCCTGGTGTA
+TATATAGTTATTCTACTATAAAATCTGCTTTGTTAAATTTGTTGTTTGCTTTTGGCATCT
+GCTAGAGCTTTTGTACCAAGAAACAGTGACTTTTGATGTCAGACTTAAGCAAATAGAGTT
+GTTTATTGGTCCCGCCCACCTGCAAGGTTCCTCCACTCAGTGTCCAGGTCTGCTTGATTG
+GCGAGGCAGCCTTTTAAGACATTTCGACAGTAGTTTGAGCAGGGTTTGGCCAAGGCCACG
+CCACTACAGTGAGGACAATACGTCTGCTTCATGACAGCACGCACACATTCAGTGCTCAGA
+GAAACCTGCAAAACACAAAAAACACAATTTAAAGAACAGCTCAACCATAATGAATCACTT
+AACAAGAAAAAAAAAGCCCTGTGAATTGTTTTGTGTCACACACAATATGCGATAATTGCA
+CTGTGCAAATAA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXX
+.
+clr:0,792
+}
+{RED
+iid:115
+eid:zDH41-20f07.p1k
+seq:
+CCGGTCCTTACCCATCATGGCCTCCCAATCATCCCCATCCACCAAATTAGCTGTATCACT
+TTCTCTTCACTCCACCTATAGCTGGTGTGTGGTGAGCGCACTGGCGCTGTTGTCATGTTG
+GTACGGTCACATCATCCAAGTGGATTCTGCACACTGGGGGTGGTGTGAAGGGATCCCTGT
+CATGATTGTGGAGCTCTTTGGGTGTATGGCCATACACGATAAATGGGCTACATAAATACA
+CACATATTACATTTCAGCACATTATCACTGTGGTGTTGAAATGTAACTAAAATCAAACTT
+TATAGTTACTCAATCTCTCTTTTCTGTCTTTTTTCAGAGGCTTTTGACATGGTGCTTCGT
+CTGGGCCGTAATTCCACTCTGATGGTGTTACGCGAGGAGTTTCCTGGTTTGGGGGCTGGA
+GCCAGTGGAGCCGTCACGCAGTTATTCCTGGATATGTCACTTTACATTCTGGGCTCTGAT
+GCCAATGTAAACGACATGGTCTCCACCTTCTTCTCTCGCCTTTTCCCTCTCACCTACCGT
+CGACTTCTGGGCAATGGGGCCGTGGCGGGCATCTCTGAAGAATGCCTCCGCGGGGCCTGG
+AAAGGGAGCTCTGCGTATGGGTCATTTCCCAAGATGATGATGACCCGACTATCCCGCTCA
+CTCCTCGCCACTCGGGTCTTCCTGCAAGCGCTAAATTTGGGCATAGAAGTGGTCAACACC
+ACTCAGCATTTGCGGGCAGGTAGAGATTGTGGGCGCTCGCTTCTGAAACTGTGGTACTGC
+CCGCACTGTTCAAGCCTGCTGGAGGCCCGGCCGTGCCGTCCACTGTGTATCAGC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,834
+}
+{RED
+iid:116
+eid:zDH40-257l09.p1k
+seq:
+TTTTTCTTATTTTTCCTTTGTTTTTTTTGATTGTTTGGGTTTTTACCAAAATCTGGTTTC
+ATTTCAAGCAGCTCCATTTTGAATATTTTCCCCAGAAAAACAAAAATAAAAAACAAGATA
+TGTTGAATGCTTATTTCCCCCACTGTAAGTAAGTTCTTTATGCAAACTTGACACATTTTT
+TCGACCAAATCAAAAGTAATGTTGTACAATGCATTCAATTGGTTGGACTCGTGTTATATT
+ACCATCAATCATATTTTCATCAGACACCACACTGAAAAATTCTTCCAACAGACAAAAATC
+CTTGGGAAAACATGAGCTTTGAAAATTAAATGTGACCTTAAGCTATTCCAAATTATTTAT
+CAGGCTATACTCATTCCCTTGTGCGCTCATTTTTATTTACACATGCCATGTACCTTGACA
+AGGCTCCAAAGTAACCACAATGATGTGGAACAGTTATTCTGCACCGCTGCAAGCATACAG
+AAGAACTATTAATCTTAGTTTACATGTCTGCAAACTGAATGACGCCACCTAATGAATTTA
+CTCACGTTTTAATGAACATCAATGCCCTTACTTTGAGCTGTAGGAGTCCACAATGAAGGA
+ATGTAGAGGTTACATCGCATCAATGCTCCCACAAATGAATTACTCACTTGTCTGTCATCT
+CCTGTCCGTTCCAGCAGAGGGAGCTGTTCAGCGATGTCGGCTCTTTGCTGCACAAAGCTT
+CTCCGAGACCACTGTAGAACTGACTGAAGCCCCTTAGACCCGAGATAAACTCCCTGCAGC
+AGACAGAGAGGAAATTGAGAATGTATTGAGTG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,812
+}
+{RED
+iid:117
+eid:zDH41-8i02.p1k
+seq:
+CTTTGAATTGAAAAAAATTAAGAATTTTCTCAAAATAAGTGTTAAAATAAGATTTATCAC
+CTAAAACAACGTTTGTCACCATTCTGCTAGCTGAAACAAAAAAAGTTAAGACCAAAATAA
+CATTCAAAACCACGCCAGAGTGGATGAAAACATCCCCAGCAACACATAAGAGTTACCATA
+TGATACCACTATGGATCCTCTTGGTTCTAATGCATGCTCTTTTAAGCATAAAAGTGTACC
+TTTTAAAAGGGTACCACCCCAGTGACAGGTTTCATACATTTCTGAGAGTGTGTTAAGAAT
+TAATGTGTTCTTGACTCTAAGCATTTCAGCTTTCCGCCCAAGGGGATGCTAAAGGTTTAA
+CTTATGACAAAAATGTACCCAAAAATGGCTTCACAAACAGAAATGTAGCAGAAACTCACC
+TTGAAAGAGGGCAGCATTCTGGATGATGAGCCCTTTGAGCTGAGCGCTGGTGGCCTGAAG
+GCTAGACTCCATATTCTGTTTGGCAATAAGCAGGTAACGCTCCTCCATTTTGCGAGAACA
+GCAAGTCAGGCCTTTTGGCTGGCACACCTGCAGATCTGAGCCTGTAGAATAACAGAGAGA
+AGATTTCTAACAGCCGTCACAATAAACAAGTAAACAGACCGCGGCATTTTATAAACTGAA
+GCTTGGCTTGTAAATCGAAAACAAAGAGAGCTGCAGAAAATGGTTTGTTTTATAGAGTAC
+ACATTGTTTACGCTACTTGTACAAATTTCAAAGAACGCCACAAAACAAATATCTGCAACT
+TAATCGAAACATGTTATTTAATTTCATTTCCACACATTGCATTTCATCTTGTTGCCTTGT
+GCCAAAATGATTAGCA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXX
+.
+clr:0,856
+}
+{RED
+iid:118
+eid:zDH41-767i19.q1k
+seq:
+TAAAGTGTTTTTGATTGAAAAAAGGCACCCAACTGGAAGTTCTTTATAGGGGACATCTAT
+ATTAGAAAACCCAGCTTAAGGTACAATAGCAAGCGCATCTCACCAATAAAGAGGTTCCAC
+TCAGGGTCCAGATCCGCTTGGTTGGCCAGGCAGCCGCGCATCACATTCTGGCAGTAGTTG
+GCGCAGGGTTTGAGTCCTGACATTCCTCCACAATACGGGCAGTACCACATTTTAGTCAAT
+GCTTTACTGCAGCCTGGAGAAATATTGACCTGCAGGATAAACACACATGGGCAGATGTTA
+AATGTGCTTTGAAATGTGCATTTTTTTTTATTTAAAGTTTGACGTAATCCCAACTGAAAC
+ATAAAGAGAGAGCAGGACATACAGTAGCTCCTCCCAAAAAACAGCCAATATAGTTTCATT
+TTTTATCACAGCCTTGCCAGTGACAGGGACTGTACCTGTATGCCTACAACTGATGTCAAA
+ATTATTCGCCCTCCTGTGATTTTGTTTTACTTTTTCAAATGTTTCCCAAATGATGTTTAA
+CAGCGCAAGGAAATTTTTACAGTGTCTCCAATGATATTTTCTACAATATATCTTCTATTA
+AGTCTTTGTTTTATTTTTTATAACTGCTAGAATAAAAGCAGTTTTTT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,647
+}
+{RED
+iid:119
+eid:zDH41-114b04.p1k
+seq:
+GATTTCTTACAGAATTGGAATCTTGGTCTCCCGCTGCCAAACTCTCGAGAGATTCCTGCT
+AAGCAGACCTAAATTCTTGCTGATGTTGGGAATAGATCAGTTCAGAATATTGCGTGCCTT
+GTAAAAAACATCAGTAAAATCTGAATTCCACTGCATGGCACGTTCATAGGGATTAGCATT
+CAACATGAATACGTTTAGTCATGGCCATATTCAAGTTTGTTGAGCAGCATGACAGGTTCA
+CATTCTGTCAGAATAAAGCGATTCAACTGAAGATGCCTTCAGCTAATATACAAGCATGAT
+TACTCTGCCCTCCATACCTGGCTTTCCCAAAAGACTTCAAAGTTTGAAGTAGATGACCTG
+AATCAACATGCAGGTAATAAGCAGGTACAATTCAGTAAATCAAGCTAACTCGCATCTAGT
+GTGTTTACCAGTGCTCTTATTTCAACTTCCAGTGTTTTTTTTTTTTATCAGGACAGCTTC
+CCTGAAGATATACTGAGTTAATTGCCTTGCTCACTGATAAATGCCATGGTTACTGTTTAA
+CTTAATATTGTTATCTTAAAAAAAATGAACCCTTGGCAATGGTCACTCTTTCCACAGGTC
+CCACTGAGCCCAGAGTGCAATCGTGCCATTATGAAACTGGTGTACTGCCCTCATTGCAGA
+GGTCTGGGATCAGTCAAACCTTGCATCAACTACTGCAAAAATGTGATGAAGGGCTGCCTG
+GCTAATCAGGCTGACCTGGACACTGAGTGGCAGAGCCTCATAGGTAGGGCTTATAACACT
+AGAACTCTCAAGGCTGGTTTATACTTCTGCGTCGAGTGATTGTCGTG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,827
+}
+{RED
+iid:120
+eid:zDH41-477l17.p1k
+seq:
+CCCTGCTTGGGATCTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCTGAAGTGG
+ATGCCCACTGGAGGGAGTTTGTACGCTCGCTGGAGACGCTGGCAGTACGGATGCACGGAG
+AGCTGGATCTGGAGCAGGTGCTGCTGGGGGCGCATGAGCTGGTGAGGGACGCTGTGGCGC
+ACGCTCAGAGGAGCACAGCGAGGATACATGCGCAGGTGAGAGGATGAGTGTGTGGTTAGC
+ACTGTCACCTCACAGCAAGAAGGTCACTGGTTCGAGCCCCGGCAGGGCCAGTTAGCATTA
+CTGTGTGGAGTTTGCATGTTCTCCCCGTGTTGACGTGGATTTCCTTCGGGTGTTCCGGTT
+TCCCCAAGTCCCCAAGTGAGAGTGTATGGATGTTTCCCAGTGAT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,404
+}
+{RED
+iid:121
+eid:ZDH42-47d24.p1k
+seq:
+TCCTGCCTGGTCATTCGGAGACAGTCACCAAGCTGGTTGCCTTCAGAAGCATCTGTCCCA
+ATACTTCCTTCCATACCGGGATTGACAATCTGAGTGTGGACCAATGGGAAAAGGCTGTCG
+AAGAAACAGTGCACAGCAGCTTCCACCGAGACGTTGCCGGTGCCCTGGAGGAAGCGAGAG
+AGGTCCGTGAAGAGGCAGACGATGTGAGGGGAGATGGACGACATGAGGGATGAGTATGTG
+GTCTCAAACAGAGAGGTCAGGTGGTTCTGGGAGAAGGATATTAGGGACTGGAACGTATCT
+GAAAAAGAAGAAAGATTTAAATGAGTGATAATGATAGAATGATCAGTGGTCTTAATCCTT
+CTCTGCTGTTCAAATTGACTACCCCTTCATTATGTTGGTGGCTGTTTTTGCCCCATTGAC
+TTCCATCATAATCACATTTTTTGATTACAAAGCCAAGACATATAATTATGCATTCTTGAT
+TATTGTTGGTTTTCCTGTTGGGAAGAGGTCAAATGTTTAAGTTTTACTGTTGATCATCAG
+TTGTCACCATTAACCCTTTATATAGGCCTATCATACAAGTTTCTGGCTTTTATATGGAGT
+TCTATGGAGCAAACCAGCAGATTATAGTGTGTGTGTGTGTGTGTGTGTTTGTGTGTGTGT
+GTGTGTGTGTGTGTGTGTGTGTGTGTGTATATATATATACACTTACTGGGCCCTATCATA
+CACCCGGCGCAAAGTGGCGCAAGGCACAGCGCAATAGTCTTTTGCTAGTTTCAGCTTGGC
+GCAAGAGTCGTTTTGAGGCCGTGCGCTACGCTGTTTAAATAGCAAATGCATTAGCGCTCA
+TATGT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXX
+.
+clr:0,845
+}
+{RED
+iid:122
+eid:ZDH42-47h16.p1k
+seq:
+GTTTCGTCCTGCCTGGTCATTCGGAGACAGTCACCAAGCTGGTTGCCTTCAGAAGCATCT
+GTCCCAATACTTCCTTCCATACCGGGATTGACAATCTGAGTGTGGACCAATGGGAAAAGG
+CTGTCGAAGAAACAGTGCACAGCAGCTTCCACCGAGACGTTGCCGGTGCCCTGGAGGAAG
+CGAGAGAGGTCCGTGAAGAGGCAGACGATGTGAGGGGAGATGGACGACATGAGGGATGAG
+TATGTGGTCTCAAACAGAGAGGTCAGGTGGTTCTGGGAGAAGGATATTAGGGACTGGAAC
+GTATCTGAAAAAGAAGAAAGATTTAAATGAGTGATAATGATAGAATGATCAGTGGTCTTA
+ATCCTTCTCTGCTGTTCAAATTGACTACCCCTTCATTATGTTGGTGGCTGTTTTTGCCCC
+ATTGACTTCCATCATAATCACATTTTTTGATTACAAAGCCAAGACATATAATTATGCATT
+CTTGATTATTGTTGGTTTTCCTGTTGGGAAGAGGTCAAATGTTTAAGTTTTACTGTTGAT
+CATCAGTTGTCACCATTAACCCTTTATATAGGCCTATCATACAAGTTTCTGGCTTTTATA
+TGGAGTTCTATGGAGCAAACCAGCAGATTATAGTGTGTGTGTGTGTGTGTGTGTTTGTGT
+GTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTATATATATATACACTTACTGGGCCCT
+ATCATACACCCGGCGCAAAGTGGCGCAAGGCACAGCGCAATAGTCTTTTGCTAGTTTCAG
+CTTGGCGCAAGAGTCGTTTTGAGGCGTTGCGCT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,813
+}
+{RED
+iid:123
+eid:ZDH42-44k03.p1k
+seq:
+CATCCATTTTCTCCTTCCACCATCCATTTCATCATCCATGCATCTGTGTACCCTGGAAGG
+CGGCGGCGTGTGCAGAAATGAGAAATTTGAGCTCATAGCTGTACGATCCGATGTTCTGGG
+TGGTGTCTCTCAGGACCGCCGCTCTGTAACTGTCTTCCATTCTTCGTGTACAACATGATG
+GCCCCGCATGCTTGCACACCGACAGTTCCACATCTGCAGTAAAAGACAGAACAGTAGCTT
+GTTAGACAGATGCGCGTTCTTTATGAAGTTTCCGCAGCTTCATTGACCTTCTGGGGTCAG
+CAAATGCGCTGGAATCTCACTGTCGACTTGCTTCACAGAAATTAAAAATATATCTAGAAT
+TACATAATTCTTGAAATAAGCAAACCAACTACACTTGAAACATATGTTCTCTGGATTTGT
+AATGTTTTCTTCTTCAAGTATTTCCCAAATGATGTTTAACAGAGCAAGGAAATTTTCACA
+GAATGTCTGATAATATTTTTTCTTCTGGAGAAAGTCTTTTGTTTTATTTCAGCTAGAATA
+AAAGCAGTTTTGATTTTTTTTAAACCCTTTTAAAGTCAATATTATTAGCCCCCCTTTAGC
+AATTTTGTTTTTGATTGTCTAAAGAACAAACCATTGTTAATAACTTGCCTAATTTATCCT
+AACTTTCCTAATTAACCTAGTTAAGCCTTTAAATGTCACTAAGCTAAATACTAGTATCTT
+GAAAAGGATCTAGTAAAATATTATTTACTGTGATTATGGCACAGATAAAAAAAATCAATG
+ATTAAAAATG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXX
+.
+clr:0,790
+}
+{RED
+iid:124
+eid:zDH41-119o22.q1k
+seq:
+GCCAACTTGGTTGCCTTTACCTTGTGCTGAAAATACTTTCCAAAATATTAAGTCATTCTA
+AATGGGAAACTATGCATGCTTGCATGTACCTGGAATTATTGAGAAGACTTATTTTTTTTA
+TTATGTTAGACAACTTTCAAAACTTTAATCCTTTACTAATAAACTTTTTTCTACTCTATT
+ATTTCTTTCAGAAAGCGTGGAGTCTCTGGTGCGTCAGGCGGAGAACCACACCCTCTCCAT
+CCTCCATCAGTCCCAGCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTT
+TTTCACAGAAGTGGCTCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCA
+GAGCTTCTTCAACGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTC
+TCCTCCATACGCCGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGC
+CCCAATCCGCCTGGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCA
+AGCGCTCCATTTGGGCATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGA
+GTGCAGACGTGGCCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAG
+CAAACCCTGCTTGGGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,718
+}
+{RED
+iid:125
+eid:zDH41-1075i12.p1k
+seq:
+TCAGCCCAATAGCGCCAGCCCAAAAGATCCATGGATTAAGTGTTGTCAGCTCCCATTAGC
+CCAATGGAAAGAGAGATTAGATACACAAGAAAGAGTCGTAAGCAATGCGAGACAAGGCAG
+AGGTGCACCATGACAGACTAGTATCTTTGACCCTCTCGTAAATGTCAAACAAAATTACAG
+CAATTGTTAGTCTCTCATGTTACGAATGTTTATCCATCTAAGATGACTATGAAATAGCTG
+TTCGTGGAGGTCTTTTTCAGTGCTTCTTCAGTCCAAAATCTTTCTTTTATTTCCTCTTCC
+CACAGATACCTTCCATTCCCTGCTCTCGTTCACTCTAAATCATACCAACTCACTTTTCGA
+CACCACCTACGAGACAATCTCCCAAGATGCAAGACCACTGGTGTCCACCCTCTTCAATGA
+CCTTGATCTCTACCTTCGAGGCGATGATAACGTTTCTGTGGAACACTCGGTTTACAGATT
+TTATGACAAACTCTTCCCATTGGTGTACCAGCATCTGGTCAATCCTGGCTTGGGTTCACC
+TGTTTCAACCTGGTCTGCCGAAGGAACTGAGTGCCTTCGTGCCACACGGCATGATATCTA
+TCCCTTTGGCCATCACCCACAAGAACTTGCTCAAGGACTGTCCAAGGCGCTTGTGGTTGG
+TCGTGCCCTCAGCCGGGCACTGGCAGTCGGTGCAGATGTACTTAACATCACAGAGTCTGT
+GGGCATGGGACGAGTGTGTGGACGTGCACTAGTGCGCATGTTGTTCTGTCCTCACTGTCG
+AGGACTGACCCTGATCCGGCCATGTGGAGGCCTATGTCTCAACGTGATGCGAGGTTGCCT
+GGCAGGCGTGGCTGAGCTGGATGCTCCCTGGCGAGACTATGTATCGCTT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,889
+}
+{RED
+iid:126
+eid:zDH41-1238o07.p1k
+seq:
+AAATAAAATAAATAAATAAATAAATAAATAAATTAACAAATTAACAAATTAATAAATAAA
+TAAATAAATAAATAAATAAATAAATTAATTAATTAATTACAATATAATATTAAAAATTAA
+ATATTCATTATTGATTATTAAAGAATTTTATTCCACCCATATTTTGACAAAATTATATTT
+GAAAAAATAATAAAGTAGCCAACTTGGTTGCCTTTAATAATGTGCTGAAAATAAAACCCA
+AAATATTAAGTCATTCTAAATGGGAAACTATGCATGCTTGCATGTACCTGGAATTATTGA
+GAAGACTTAATTTTTTTATTATGTTAGACAACTTTCAAAACTTTAATCCTTTACTAATAA
+ACTTTTTTCTACTCTATTATTTCTTTCAGAAAGCGTGGAGTCTCTGGTGCGTCAGGCGGA
+GAACCACACCCTCTCCATCCTCCATCAGTCCCAGCGTGATCTCTCCAGCCCAGCAGCATC
+AGCACCAGTCGGGGAGTTTTTCACAGAAGTGGCTCTGTTCATCCTGGGCTCTGAGCTCAG
+TCTAGAAGAGTCCTCTCAGAGCTTCTTCAACGCTCTTTTCCCCTTAATATACGAGCGTCT
+GATTGACTCCCGTCTGTCTCCTCCATACGCCGAATGCCTGCGCTCGTCTGCTCAAGATCT
+AGCACCGTTCGGAGCAGCCCCAATCCGCCTGGCGTCCCAAATCGCCCATGCTTCTCTACC
+TGCTCGCGTGTTTCTCCAAGCGCTCCATTTGGGCATCGAGATCATAAATACGACCGATCA
+CATCCAGCTGAGCCGCGAGTGCAGACGTGGCCTACTGAGGATGAGCTACTGCCCGCACTG
+CAAGGCTCTGACCTCCCAGCAACCCTG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,867
+}
+{RED
+iid:127
+eid:zDH41-1254i17.p1k
+seq:
+CATAGAACTCCATATAAAAGCCAGAAACTTGTATGATAGGCCTATATAAAGGGTTAATGG
+TGACAACTGATGATCAACAGTAAAACTTAAACATTTGACCTCTTCCCAACAGGAAAACCA
+ACAATAATCAAGAATGCATAATTATATGTCTTGGCTTTGTAATCAAAAAATGTGATTATG
+ATGGAAGTCAATGGGGCAAAAACAGCCACCAACATAATGAAGGGGTAGTCAATTTGAACA
+GCAGAGAAGGATTAAGACCACTGATCATTCTATCATTATCACTCATTTAAATCTTTCTTC
+TTTTTCAGATACGTTCCAGTCCCTAATATCCTTCTCCCAGAACCACCTGACCTCTCTGTT
+TGAGACCACATACTCATCCCTCATGTCGTCCATCTCCCCTCACATCGTCTGCCTCTTCAC
+GGACCTCTCTCGCTTCCTCCAGGGCACCGGCAACGTCTCGGTGGAAGCTGCTGTGCACTG
+TTTCTTCGACAGCCTTTTCCCATTGGTCCACACTCAGATTGTCAATCCCGGTATGGAAGG
+AAGTATTGGGACAGATGCTTCTGAAGGCAACCAGCTTGGTGACTGTCTCCGAATGACCAG
+GCAGGACGTAAACCCCTTTGGTCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGGACGC
+ATTGCGGGCTGGGCGGGTGCTCAGCTTGGCACTTGCCGAAGGGTCAGAGGTGATGAACAT
+TACGGAAACAGCAGGGTTATCAAAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTG
+CTCTCACTGCCGTGGACTCACCCTGATCCATGCGTGCAGCAACTACTGTCTTAATGTCAT
+GCGCGGGTGCCTGGCGAGCTA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,861
+}
+{RED
+iid:128
+eid:zDH41-1106h04.p1k
+seq:
+TCTATCCATAAATCCATCTATCCATTCATCCATAAACCTATCCATCAATCCATCCATCCA
+TCCATCCATTTGTCGACGCATCATTAGTCCATCCCTTAATCCATTTATCTGTCCATACAT
+CTATCCATACATACAGCTATCCATCCATCCATTCATCCATCCATCCATCCATCCATCAGT
+CCATCCATAAATCTATCCATAAATCCATCCGTCCATACATTTATCCATAAATCAGTCCAT
+CAATAAATCCATTCAAACATCTGTCAACCAATGTATCCATTCATCCAGAAATCTATCCAT
+CAATGCATCCATCAGTCCATCCATAAATCCATCCATCCATCCAATCCATTCATCCATCTA
+TCCATAATTCTATCCATCGATCCATCCCCACATCTATCTACCCCTCCATCCATCCATCCA
+TCCATAAATCTATCAATTAATCCATCTATCCGTCCATACATTCATCCATAAATCTGTCAA
+CCCATAAATCTAGCCATCAATCAATCCATAATTCTATCAAGCAATGCATCTCTCCGTCCA
+TCAATCCATCCGTCAGAATCATTGTGTCTGAAGACTGTTTTATGATGCATCTGTGCTTTT
+GTTAATTGTGCTGTAGTTTACATACAGAACAGCCAAGCATACAGGTTACTGACCTCATCA
+AAACCCTGTATAAATGTGTGTGTGCTCGAGGTGTGTGTGTTCCTCTTACCGATAAATTTG
+CTCCATTCGTTGTTGAGATCGGCCTGGTTTGCCAAGCAGCCCTTCATGACATTCAGACAG
+TAGTTTCTGCAGGGCTTCAGTGTGAACAGACCCTGACAATACGAGCAGTAGAGCATCTTC
+GTGAAGCCGCTGACACACGACGAGCTCATGCTGACCTGCGCACACACACACACG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,894
+}
+{RED
+iid:129
+eid:zDH41-1244f05.p1k
+seq:
+GCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTTTTTCACAGAAGTGGC
+TCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTTCTTCAACGC
+TCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTCTCCTCCATACGCCGA
+ATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGCCCCAATCCGCCTGGC
+GTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCAAGCGCTCCATTTGGG
+CATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGAGTGCAGACGTGGCCT
+ACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAGCAAACCCTGCTTGGG
+ATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCTGAAGTGGATGCCCACTG
+GAGGGAGTTTGTACGCTCGCTGGAGACGCTGGCAGTACGGATGCACGGAGAGCTGGATCT
+GGAGCAGGTGCTGCTGGGGGCGCATGAGCTGGTGAGGGACGCTGTGGCGCACGCTCAGAG
+GAGCACAGCGAGGATACATGCGCAGGTGAGAGGATGAGTGTGTGGTTAGCACTGTCACCT
+CACAGCAAGAAGGTCACTGGTTCGAGCCCCGGCAGGGCCAGTTAGCATTACTGTGTGGAG
+TTTGCATGTTCTCCCCGTGTTGACGTGGATTTCCTTCGGGTGTTCCGGTTTCCCCAAGTC
+CCAAGTGAGAGTGTATGGATGTTCCCAGT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,809
+}
+{RED
+iid:130
+eid:zDH41-1123j17.q1k
+seq:
+TTCTACTATAAAATCTGCTTTGTAAATTTGTTGTTTGCTTTTGGCATCTGCTAGAGCTTT
+TGTACCAAGAAACAGTGACTTTTGATGTCAGACTTAAGCAAATAGAGTTGTTTATTGGTC
+CCGCCCACCTGCAAGGTTCCTCCACTCAGTGTCCAGGTCTGCTTGATTGGCGAGGCAGCC
+TTTTAAGACATTTCGACAGTAGTTTGAGCAGGGTTTGGCCAAGGCCACGCCACTACAGTG
+AGGACAATACGTCTGCTTCATGACAGCACGCACACATTCAGTGCTCAGAGAAACCTGCAA
+AACACAAAAAACACAATTTAAAGAACAGCTCAACCATAATGAATCACTTAACAAGAAAAA
+AAAAGCCCTGTGAATTGTTTTGTGTCACACACAATATGCGATAATTGCACTGTGCAAATA
+ATTGCTTGTCAGTACAGTTTCCCAAGAGGTCCAAGGATGTGGGATGGTACAGTTTGGTAC
+AACTCTTGCAAAAGAATACCCATGGTGCTTCTCTGAGACGTCTTTCACAATCATTCCTCT
+TTATCAGGAACCTCCACCCCTCTGATGTCAAAGCGTGGGGGTTTATAGGGTCCCTCAGGG
+AAAAGCAATGCAGTTCGGGAAGGAAAGTAGAACTTGACATTTGCTTGTTGTTTAAATGAA
+TCTAATTTCACGGATATTGAAAGAAAAAGTCTGTTTTGTTTAGGTGTAAATATAGGTGCA
+GACAGCATGACATTTGATTTCTGTAAATCCAACTGTTTTCTTTCAGTTGCAACTGCATTA
+GCCTGCGTGAAGCATTCAGTCGCAGCGGCGGCGTGTAACTTTGACACAATTTCACAAAGC
+TGAATGTCAGTTACTGTATATTGCAT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,866
+}
+{RED
+iid:131
+eid:zDH41-1308f17.q1k
+seq:
+CTGCATTATTCCAATCGAGAGCATTCAGAAAGCCATTATTTGCTTCACAAACCAAACCTG
+AAAAAATCTGCAAGAATATTACAAATATAACACTTTTTTTTTAGGTACACATATTGAACC
+CTTGCCAATAACAAGGAAGCAAATATACCATAGAATGGTCTTCAATGGGGATATTTTTGT
+CCTGAGACAAACTTTTTAGTTCTTAGTGTAAAACAGATTTAAGACAGAAAATGAGTATTG
+CGAAACAATAATTCTAGTGTAGAGCTCATCAGTGAGGCTATTATGTGAAAAGCCTAAATT
+AACACAGGAAAGAACTGAATTAAGCCCTTGGAGAGCCACCAGGGAACTCAATCACATATT
+TTGAGTTTTAAAGAAAAATAAACACTGACAACACTGTACTGTACAACTAATGTCTGGAGA
+CAAACTGACATCATACTAAACAAGAGTACCGCAAACTACCAGCTTCACCAAGGCTGTAGA
+TAAACCACCCAAGCATGATTAACCAGCGCACCAACCTTGGAAAGCGGCCACATTTCGTGA
+GAAGAGGAACTTTAGGCTGGAGCTAGAGATCTGGAGAAGGTTCTGAATATCCCGCCGGGC
+CGCCACCTGGTAACGCTCCTCCATCTTTTTGGTGCAGCATGTTAGATTCCTGGATAAGCA
+AACCTGCAGGTCTGAACCTGAAAAAGAACAAATATTATTTGTTATCTAAAGTGGCAATGG
+TAAAAAACAACACTTAATACACAAATACACTCAATTGAACATGCACACATAGACATCACC
+TATACTTGTTCATCACCTATACCTATACAACAGT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,814
+}
+{RED
+iid:132
+eid:zDH06-285a19.q1k
+seq:
+ATTTTATTCCCCCATATTTTGACAAAATTATATTTGAAAAAATAATAAAGTAGCCAACTT
+GGTTGCCTTTAATAATGTGCTGAAAATAAAACCCAAAATATTAAGTCATTCTAAATGGGA
+AACTATGCATGCTTGCATGTACCTGGAATTATTGAGAAGACTTAATTTTTTTATTATGTT
+AGACAACTTTCAAAACTTTAATCCTTTACTAATAAACTTTTTTCTACTCTATTATTTCTT
+TCAGAAAGCGTGGAGTCTCTGGTGCGTCAGGCGGAGAACCACACCCTCTCCATCCTCCAT
+CAGTCCCAGCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTTTTTCACA
+GAAGTGGCTCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTTC
+TTCAACGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTCTCCTCCA
+TACGCCGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGCCCCAATC
+CGCCTGGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCAAGCGCTC
+CATTTGGGCATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGAGTGCAGA
+CGTGGCCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAGCAAACCC
+TGCTTGGGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCTGAAGT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,776
+}
+{RED
+iid:133
+eid:zDH006-297n22.p1k
+seq:
+CATATTACATTTCAGCACATTATCACTGTGGTGTTGAAATGTAACTAACCTTAACTTTAT
+AGTTACTCAATCTCTCTTTTCTGTCTTTTTTCAGAGGCTTTTGACATGGTGCTTCGTCTG
+GGCCGTAATTCCACTCTGATGGTGTTACGCGAGGAGTTTCCTGGTTTGGGGGCTGGAGCC
+AGTGGAGCCGTCACGCAGTTATTCCTGGATATGTCACTTTACATTCTGGGCTCTGATGCC
+AATGTAAACGACATGGTCTCCACCTTCTTCTCTCGCCTTTTCCCTCTCACCTACCGTCGA
+CTTCTGGGCAATGGGGCCGTGGCGGGCATCTCTGAAGAATGCCTCCGCGGGGCCTGGAAA
+GGGAGCTCTGCGTATGGGTCATTTCCCAAGATGATGATGACCCGACTATCCCGCTCACTC
+CTCGCCACTCGGGTCTTCCTGCAAGCGCTAAATTTGGGCATAGAAGTGGTCAACACCACT
+CAGCATTTGCGGGCAGGTAGAGATTGTGGGCGCTCGCTTCTGAAACTGTGGTACTGCCCG
+CACTGTCAAAGCCTGCTGGAGGCCCGGCCGTGCCGTCCACTGTGTATCAGCACCATGGGA
+GCATGTTTGGGGGGAACCACGGAGGTACAGCCTCATTGGAGAGCATATGTGGATGAACTG
+GGGTCACTCGCCGCTGCCATGAAGGGGGAACAGGACATCGAGGCTGTGGTGCTCCGACTG
+CACGTCATTATCAG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXX
+.
+clr:0,734
+}
+{RED
+iid:134
+eid:zDH006-285n20.q1k
+seq:
+AATCAATTAACCAACCAACCAACCAACCAACCAACCAACCAAACCACCAACAAATCAACT
+AAGCGACCCACTTCAGATAGATTTGTAGAATTGTTCATTATGACGGGTCAATCAATCAAT
+CAATCAATCAATCAATCAATCAATCAATCAATCAATCAATGAACTAAGCAACCAACTAAT
+CAACCAAGCAACCTTCCGACCAATCAACCAAAAAATAAGCAAGCAAGCAAACAAACAAAC
+AACCAAGTAACCAAGTAACCAACTAATCAACCAAGCAACAAAGTGTCCAAGCAACCTTCC
+GACCAATCAACCAATAAACTTACTAACCAACCTACCAACTGATGAATCAATCAATCAATC
+AATCAATCAATCAATCAATCAATCAATCAATCAATCAATCAATCAATCAATCAATCAATC
+AATCAATCAATCAATCAATCAATCAATCAATCAACCAATCAATCAATCAATCAACCAATC
+AATCAACCCATCAATCAATCAATCAATCAATCAATCAATCAGTCAAACACAAAATAAACT
+TGAGCAACAACTCAAACAGTCTCATTTCCAGTATTGTTTAAATAAAGAATACATAAAATA
+ATAAATAAAATAAAGTGTTTTTGATTGAAAAAAGGCACCCAACTGGAAGTTCTTTATAGG
+GGACATCTATATTAGAAAACCCAGCTTAAGGTACAATAGCAAGCGCATCTCACCAATAAA
+GAGGTTCCACTCAGGGTCCAGATCCGCTTGGTTGGCCAGGCAGCCGCGCATCACATTCTG
+GCAGTAGTTGGCGCAGGGTTTGAGTCCTGACATTCCTCCACAATACGGGCAGTACCACAT
+TTTAGTCAATGCTTTACTGCAGCCTGGAGAAATATTGACCTGCAGGATAAACACACATGG
+GCAGATGTTAAATGTGCTTTGAAATGTGC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,929
+}
+{RED
+iid:135
+eid:zDH006-324p17.p1k
+seq:
+TACTCCATATGACAGTACTCCATACCTACAAACCAACTGTGCTGTCCAAACAGTGTCCAA
+AGCTTAATTTTGCATCATAGGTGCGCACTTTTAAAAAAAACATTGCAGATCCACTACACT
+AATATGATATCATCCACATCTCATTAAAGATCTTACCTTGGCCACCCTGTTGGCCACTTC
+TCGGCCCACCATAAGTCCCTGGACGAAGGATCTGGCCGCGATGAAAGCTTTGGTGACCTG
+CGCCTTGAGTTTTCGCGGCACGTCTCCGAACGGCTTGAGCTGGTCAGTGTATTTGCTGAT
+GCACTCCAGATAGTCGTCGCTGAAGGTGAACTGCGAGTTGAGCAGCTGGAACATTCTCTC
+CAGCAGACGCGACCAGAAGTCATTCAGCACCTCCTCCAGGTTGACGTTCCCACCGGTGTA
+GTAGCGCTTCAGCTCTGAGAACAGGTCCTCGAACATCTCCGAGTTGTGTGTGTAGAGTTT
+GCCATATGTGCGCACAAACATGTCGTTTAGAGACTTCTCAGAGTTGTCCAGCAACTCCAG
+GAAAAACTCTGGAAAAACAGAGAAATACTGATGTAAAAAAAATATGTAATTTGAGCATGT
+GTATATATATTTTAAATAATTACAAAAAAAAAAAAAAACGTAGTAGTTATTATTGTTATT
+ATTATTAATATTAATATTAATATTATATTAATATTGATATTATTATTATTATTATTATTA
+TTATTATTATTATTATTATTATCATCATTAGTGTCATAATCTACACATTATATATATATA
+TATATATATATATATATATATATATATATATATATATATAT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,821
+}
+{RED
+iid:136
+eid:zDH006-739g13.q1k
+seq:
+TAGACACTTTCAAACTTTAATCCTTTACTAATAAACTTTTTTCTACTCTATTATTTCTTT
+CAGAAAGCGTGGAGTCTCTGGTGCGTCAGGCGGAGAACCACACCCTCTCCATCCTCCATC
+AGTCCCAGCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTTTTTCACAG
+AAGTGGCTCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTTCT
+TCAACGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTCTCCTCCAT
+ACGCCGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGCCCCAATCC
+GCCTGGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCAAGCGCTCC
+ATTTGGGCATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGAGTGCAGAC
+GTGGCCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAGCAAACCCT
+GCTTGGGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCTGAAGTGGATG
+CCCACTGGAGGGAGTTTGTACGCTCGCTGGAGACGCTGGCAGTACGGATGCACGGAGAGC
+TGGATCTGGAGCAGGTGCTGCTGGGGGCGCATGAGCTGGTGAGGGACGCTGTGGCGCACG
+CTCAGAGGAGCACAGCGAGGATACATGCGCAGGTGAGAGGATGAGTGTGTGGGTAGCACT
+GTCACCTCACAGCAAGAAGG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXX
+.
+clr:0,800
+}
+{RED
+iid:137
+eid:zDH006-921d02.p1k
+seq:
+AAGACAAGCGGTACAGGTGAATTGGGTACGCTAAATTGTCAGTAGTGTATGAGTGTGTAT
+GTGTGAATGTGTGTGTGGATGTTTCCCAGAGATAGGTTGCTGCTGGAAGGGCATCCACTG
+CTGGATAAGTTGGCGGTTCATTCCGTGCTGGCGACCCCGGATTAATAAAGGGACTAAGCT
+GACAAGGAAATTAATAAATGAATGAAATTGGGTTTTGCGCTTTTGGCTTATCATAAATGC
+ATTATTTTTGAGATTGATCTGGCTCCATGATGCAATCTTTTGCATTTTCTGTCACAGTTA
+TACACCAAATTCTATTTATGTCTGGATTCCTCAGTTTTGTCAGCATTGTGTAAATCACAG
+GGCCCTAAATGAGCCTCTGTTGTTACATCAACATATATTCATTCACACATCAATCAACTT
+CATCTATTTGCCCATTCGTTTCACTTATCAATCATCCATTTCATCCTTCCACCATCCATT
+CAATCATCCATGCATCTGTGTACCCTGGAAGGCGGCGGCGTGTGCAGAAATGAGAAATTT
+GAGCTCATAGCTGTACGATCCGATGTTCTGGGTGGTGTCTCTCAGGACCGCCGCTCTGTA
+ACTGTCTTCCATTCTTCGTGTACAACATGATGGCCCCGCATGCTTGCACACCGACAGTTC
+CACATCTGCAGTAAAAGACAGAACAGTAGCTTGTTAGACAGATGCGCGTTCTTTATGAAG
+TTTCCGCAGCTTCATTGACCTTCTGGGGTCAGCAAATGCGCTGGAATCTCACTGTCGACT
+TGCTTCACAG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXX
+.
+clr:0,790
+}
+{RED
+iid:138
+eid:zDH07-216b23.p1k
+seq:
+GGATGATTGTGAAAGACGTCTCAGAGAAGCACCATGGGTATTCTTTTGCAATTAGTTGTA
+CCAAACTGTACCATCCCACATCCTTGGACCTCTTGGGAAACTGTACTGACAAGCAATTAT
+TTGCACAGTGCAATTATCGCATATTGTGTGTGACACAAAACAATTCACAGGGCTTTTTTT
+TTCTTGTTAAGTGATTCATTATGGTTGAGCTGTTCTTTAAATTGTGTTTTTTGTGTTTTG
+CAGGTTTCTCTGAGCACTGAATGTGTGCGTGCTGTCATGAAGCAGACGTATTGTCCTCAC
+TGTAGTGGCGTGGCCTTGGCCAAACCCTGCTCAAACTACTGTCGAAATGTCTTAAAAGGC
+TGCCTCGCCAATCAAGCAGACCTGGACACTGAGTGGAGGAACCTTGCAGGTGGGCGGGAC
+CAATAAACAACTCTATTTGCTTAAGTCTGACATCAAAAGTCACTGTTTCTTGGTACAAAA
+GCTCTAGCAGATGCCAAAAGCAAACAACAAATTTAACAAAGCAGATTTTATAGTAGAATA
+ACTATATATACACCAGGGGTTTCAAACTGTGGGGCTTGCCAGCACCTATTAAGAGGGACG
+CGAGACATTGAGGCGTGCACTTGAGTAAATTATGATGTCGATTTTTATGCGTTTACTAGA
+TGGAATAAAACGATTTATGTTAGCTCCACAGCTAATTATTAGGCACCTGTAGAGTTAATG
+TGTTCCAGTAAAATATATACAAATAAAATGGAAAGAGTGCTT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,762
+}
+{RED
+iid:139
+eid:zDH07-123j18.p1k
+seq:
+CATACAGCTATCCATCCATCCATTCATCCATCCATCCATCCATCCATCAGTCCATCCATA
+AATCTATCCATAAATCCATCCGTCCATACATTTATCCATAAATCAGTCCATCAATAAATC
+CATTCAAACATCTGTCAACCAATGTATCCATTCATCCAGAAATCTATCCATCAATGCATC
+CATCAGTCCATCCATAAATCCATCCATCCATCCAATCCATTCATCCATCTATCCATAATT
+CTATCCATCGATCCATCCCCACATCTATCTACCCCTCCATCCATCCATCCATCCATAAAT
+CTATCAATTAATCCATCTATCCGTCCATACATTCATCCATAAATCTGTCAACCCATAAAT
+CTAGCCATCAATCAATCCATAATTCTATCAAGCAATGCATCTCTCCGTCCATCAATCCAT
+CCGTCAGAATCATTGTGTCTGAAGACTGTTTTATGATGCATCTGTGCTTTTGTTAATTGT
+GCTGTAGTTTACATACAGAACAGCCAAGCATACAGGTTACTGACCTCATCAAAACCCTGT
+ATAAATGTGTGTGTGCTCGAGGTGTGTGTGTTCCTCTTACCGATAAATTTGCTCCATTCG
+TTGTTGAGATCGGCCTGGTTTGCCAAGCAGCCCTTCATGACATTCAGACAGTAGTTTCTG
+CAGGGCTTCAGTGTGAACAGACCCTGACAATACGAGCAGTAGAGCATCTTCGTGAAGCCG
+CTGACACACGACGAGCTCATGCTGACCTGCGCACACACACACACGGCAATAATACAACAG
+TCACCACACTACTTGTAGTGATGCTACAGCCTGACACTGGATGTCTCATAGTTTTG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,836
+}
+{RED
+iid:140
+eid:zDH07-571c18.p1k
+seq:
+TTTCTCTCTATTATTTCTTTCAGAAAGCGTGGAGTCTCTGGTGCGTCAGGCGGCGATCCA
+CACCCTCTCCATCCTCCATCAGTCCCAGCGTGATCTCTCCAGCCCAGCAGCATCAGCACC
+AGTCGGGGAGTTTTTCACAGAAGTGGCTCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGA
+AGAGTCCTCTCAGAGCTTCTTCAACGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGA
+CTCCCGTCTGTCTCCTCCATACGCCGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACC
+GTTCGGAGCAGCCCCAATCCGCCTGGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCG
+CGTGTTTCTCCAAGCGCTCCATTTGGGCATCGAGATCATAAATACGACCGATCACATCCA
+GCTGAGCCGCGAGTGCAGACGTGGCCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGC
+TCTGACCTCCAGCAAACCCTGCTTGGGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGC
+TAACCTGGCTGAAGTGGATGCCCACTGGAGGGAGTTTGTACGCTCGCTGGAGACGCTGGC
+AGTACGGATGCACGGAGAGCTGGATCTGGAGCAGGTGCTGCTGGGGGCGCATGAGCTGGT
+GAGGGACGCTGTGGCGCACGCTCAGAGGAGCACAGCGAGGATACATGCGCAGGTGAGAGG
+ATGAGTGTGTGGTTAGCACTGTCACCTCACAGCAAGAAGGTCACTGGTTCGAGCCCCGGC
+AGGCCCAGTTAGCATTACTGTGTGGAGTTTGCATGTTCTCCCCGTGTTGACGTGGATTTC
+CTTCGGGTG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXX
+.
+clr:0,849
+}
+{RED
+iid:141
+eid:zDH07-1270k22.q1k
+seq:
+ATTTTATTCCACCCATATTTTGACAAAATTATATTTGAAAAAATAATAAAGTAGCCAACT
+TGGTTGCCTTTAATAATGTGCTGAAAATAAAACCCAAAATATTAAGTCATTCTAAATGGG
+AAACTATGCATGCTTGCATGTACCTGGAATTATTGAGAAGACTTAATTTTTTTATTATGT
+TAGACAACTTTCAAAACTTTAATCCTTTACTAATAAACTTTTTTCTACTCTATTATTTCT
+TTCAGAAAGCGTGGAGTCTCTGGTGCGTCAGGCGGAGAACCACACCCTCTCCATCCTCCA
+TCAGTCCCAGCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTTTTTCAC
+AGAAGTGGCTCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTT
+CTTCAACGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTCTCCTCC
+ATACGCCGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGCCCCAAT
+CCGCCTGGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCAAGCGCT
+CCATTTGGGCATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGAGTGCAG
+ACGTGGCCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAGCAAACC
+CTGCTTGGGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCTGAAGTGGA
+TGCC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXX
+.
+clr:0,784
+}
+{RED
+iid:142
+eid:zDH07-1694m12.p1k
+seq:
+TCTTCTCTCGCCTTTTCCCTCTCACCTACCGTCGACTTCTGGGCAATGGGGCCGTGGCGG
+GCATCTCTGAAGAATGCCTCCGCGGGGCCTGGAAAGGGAGCTCTGCGTATGGGTCATTTC
+CCAAGATGATGATGACCCGACTATCCCGCTCACTCCTCGCCACTCGGGTCTTCCTGCAAG
+CGCTAAATTTGGGCATAGAAGTGGTCAACACCACTCAGCATTTGCGGGCAGGTAGAGATT
+GTGGGCGCTCGCTTCTGAAACTGTGGTACTGCCCGCACTGTCAAAGCCTGCTGGAGGCCC
+GGCCGTGCCGTCCACTGTGTATCAGCACCATGGGAGCATGTTTGGGGGGAACCACGGAGG
+TACAGCCTCATTGGAGAGCATATGTGGATGAACTGGGGTCACTCGCCGCTGCCATGAAGG
+GGGAACAGGACATCGAGGCTGTGGTGCTCCGACTGCACGTCATTATCAGACAGGCTCTCA
+AACAAGCCGTGGCAAGCAAGAGCAAAGTCAGCGCCCAGGTGAGTGACACATGGTCTCAGA
+AACAAGGTATGAATTCGAATGCTGTAGGCGACTGCAGCCATTTTGCTAACTTCAGCCATT
+TTTGCTAACGCCATCTCTCTCCAAAACTCAACCTCCAAAGACTTGTCAGCAAAGTCAGTG
+TCAGCAGACCCGAACGAGTGAAATGAAGAGTGTTTCTGACTGGCTAGTTTTCTGATTGAG
+CCCAGGGCTATCAAACTCAAAAAACTGTCGAGATTTCTCAGGACACCTTTTTTAGTTAGT
+ACTTCAGTTTACATGAGAGTTCTTGTCAAGGTATTGCAGGTTTTTAATCACCAGGCTTTA
+TTTTATCATTGATCTGTACACATGATAACATAACATTTAC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,880
+}
+{RED
+iid:143
+eid:zDH07-1683h21.q1k
+seq:
+AACCACAATGATGTGGAACAGTTATTCTGCACCGCTGCAAGCATACAGAAGAACTATTAA
+TCTTAGTTTACATGTCTGCAAACTGAATGACGCCACCTAATGAATTTACTCACGTTTTAA
+TGAACATCAATGCCCTTACTTTGAGCTGTAGGAGTCCACAATGAAGGAATGTAGAGGTTA
+CATCGCATCAATGCTCCCACAAATGAATTACTCACTTGTCTGTCATCTCCTGTCCGTTCC
+AGCAGAGGGAGCTGTTCAGCGATGTCGGCTCTTTGCTGCACAAAGCTTCTCCGAGACCAC
+TGTAGAACTGACTGAAGCCCCTTAGACCCGAGATAAACTCCCTGCAGCAGACAGAGAGGA
+AATTGAGAATGTATTGAGTGCAGGCGAAAGAAGAAAGAGGAATGGGCTTCAGTGAAAATT
+GAAATTAGATGGTGTGCACAAAGAGACAAGATTAAGAATCCAAAATACTGGGATTTATGA
+GAAAATGTAGAGGCTTAGAGAAAGAAGAACGACGAATCAGGAGAAAAAAATAGAGTTGGG
+GTCAAATGCAGTGTTAAGCACGATATACTCCATTACATATCATTTCCTGTCGGGCTAAGT
+TGCTTTGAGATGCTTTGATTTTAATTGACATTACCTACACACACTCTCTCACCTGCTCAT
+CAGAGCGAGGGAACGAGAGAGAGGAACCGTACAGGACAGAGGGGGCAGAAGGCAGCTCAA
+TGTCACTCACACGGCAGGAGACAAAGCCTGTGTTAATGAGCTTCTCTCTGTCACCATCAG
+CCTGAACACACACTC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXX
+.
+clr:0,795
+}
+{RED
+iid:144
+eid:zDH07-1235p07.q1k
+seq:
+CCATTCTGCTAGCTGAAATAAAAAAAGTTAAGACCAAAATAACATTCAAAACCACGCCAG
+AGTGGATGAAAACATCCCCAGCAACACATAAGAGTTACCATATGATACCACTATGGATCC
+TCTTGGTTCTAATGCATGCTCTTTTAAGCATAAAAGTGTACCTTTTAAAAGGGTACCACC
+CCAGTGACAGGTTTCATACATTTCTGAGAGTGTGTTAAGAATTAATGTGTTCTTGACTCT
+AAGCATTTCAGCTTTCCGCCCAAGGGGATGCTAAAGGTTTAACTTATGACAAAAATGTAC
+CCAAAAATGGCTTCACAAACAGAAATGTAGCAGAAACTCACCTTGAAAGAGGGCAGCATT
+CTGGATGATGAGCCCTTTGAGCTGAGCGCTGGTGGCCTGAAGGCTAGACTCCATATTCTG
+TTTGGCAATAAGCAGGTAACGCTCCTCCATTTTGCGAGAACAGCAAGTCAGGCCTTTTGG
+CTGGCACACCTGCAGATCTGAGCCTGTAGAATAACAGAGAGAAGATTTCTAACAGCCGTC
+ACAATAAACAAGTAAACAGACCGCGGCATTTTATAAACTGAAGCTTGGCTTGTAAATCGA
+AAACAAAGAGAGCTGCAGAAAATGGTTTGTTTTATAGAGTACACATTGTTTACCGCTACT
+TGTACAAATTTCAAAGAACGCCACAAAAACAAATATCTGCAACTTAAT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,708
+}
+{RED
+iid:145
+eid:zDH07-1264j06.q1k
+seq:
+AATGTGTGTGTGCTCGAGGTGTGTGTGTTCCTCTTACCGATAAATTTGCTCCATTCGTTG
+TTGAGATCGGCCTGGTTTGCCAAGCAGCCCTTCATGACATTCAGACAGTAGTTTCTGCAG
+GGCTTCAGTGTGAACAGACCCTGACAATACGAGCAGTAGAGCATCTTCGTGAAGCCGCTG
+ACACACGACGAGCTCATGCTGACCTGCGCACACACACACACGGCAATAATACAACAGTCA
+CCACACTACTTGTAGTGATGCTACAGCCTGACACTGGATGTCTCATAGTTTTGATTCGTA
+CAATTGAATATAACTTTTAAAAATAAATAAATAAATAAAAAAAGTTAGAGAACAAAAAAA
+TTATTTAGAGAAGAAAAAAAAATTTCAAGAAGAGGTTGGGGGTCATAAAATAAAATGATA
+TAAAAAAAAAGTCACAAACACAATTTAGGGTTTTTTCATCTCACCTGAGCGACTCTGTTA
+GCGACGTCACGTCCGACCGCAAGTCCCTGTACGAATGTGCGCGCCGCAATAAACGCGCGA
+GTCACCTGTGATTTCAGCTTTTTAGGCACATCTCCAAACGGCCGCAGCTGCTCCGTGTAT
+TTACCGATGCACTCCAAATATTCGTCCGTGATCTGAAACTGAGAGTTGAGCAGCTGAAAC
+ATGCGCTCTAGTAATCGTGTCCAGAAGTCCTTTAGCATCTCCTCCAGGTTGACGTTTCCG
+CCGGTGTAAAAACGCCGCAGCTCCGAGAACAGGCTCTGGAAGACCTCTGCGTTCTGCAGG
+TACGGTTTACCGTAAGTGCGGACAAACATCTCGTTCAGAGAGCGCTCGGCGCTCTCCAGC
+AGCTCCAAGAAGAAATCTAAAAAAATGTATAGAT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,874
+}
+{RED
+iid:146
+eid:zDH07-1678a11.p1k
+seq:
+ATGGTGACATACTGTCTCCAGGGCTGGTGGAGCTCGGAGTAGCTCGCCTTGCACCCGCGC
+ATGACATTAAGACAGTAGTTGCTGCACGCATGGATCAGGGTGAGTCCACGGCAGTGAGAG
+CAGTAATGCATGCGTACCAGAGCCCGTGTGCACTCTTTTGATAACCCTGCTGTTTCCGTA
+ATGTTCATCACCTCTGACCCTTCGGCAAGTGCCAAGCTGAGCACCCGCCCAGCCCGCAAT
+GCGTCCGCCAGATCTTTTGCCATTGCTTTTGGGTGCGGACCAAAGGGGTTTACGTCCTGC
+CTGGTCATTCGGAGACAGTCACCAAGCTGGTTGCCTTCAGAAGCATCTGTCCCAATACTT
+CCTTCCATACCGGGATTGACAATCTGAGTGTGGACCAATGGGAAAAGGCTGTCGAAGAAA
+CAGTGCACAGCAGCTTCCACCGAGACGTTGCCGGTGCCCTGGAGGAAGCGAGAGAGGTCC
+GTGAAGAGGCAGACGATGTGAGGGGAGATGGACGACATGAGGGATGAGTATGTGGTCTCA
+AACAGAGAGGTCAGGTGGTTCTGGGAGAAGGATATTAGGGACTGGAACGTATCTGAAAAA
+GAAGAAAGATTTAAATGAGTGATAATGATAGAATGATCAGTGGTCTTAATCCTTCTCTGC
+TGTTCAAATTGACTACCCCTTCATTATGTTGGTGGCTGTTTTTGCCCCATTGACTTCCAT
+CATAATCACATTTTTTGATTACAAAGCCAAGACATATAATTATGCATTCTTGATTATTGT
+TGGTTTTCCCTGTTGGGAAGAGGTCAAATGTTTAAGTTTTACTGTTGATCATCAGTTGTC
+ACCATTTACCCTTTATATAGGCCTATCATACAAGTTTCTGGCTCTTATATGGAGTTCTAT
+GGAGCAAACCAGCAGATTATAATGTGTGTGTGTGTGTGTGTGTTTGTGTGTGTGTGTGTG
+TGTGTGTGTGTGTGTGT
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXX
+.
+clr:0,977
+}
+{RED
+iid:147
+eid:zDH07-1376e20.q1k
+seq:
+ATATGCGATGCATTTGCTGCGAACGTACGGATTTTGCCTCACTCACATCTCCATGTTTGG
+TGTGAACCCAGCAGTGTTGACCAATCAGGAAGGAGAAAACAGCGCGCACACTGATGTCGT
+GAGTCGAAAACTCAGCTTATAGTGTCGATATGACCACGCTGCACAGTTTTGGAAAATAGT
+CACTCGGGTCGGAGTTTTCAGAAAGCATTGCTTTGTCACCTGACATTGCGTTTTTGGTGT
+GGACATTGCGTTTTGGTGTAGATAAAAAACCATGTGATCTGTGCAGTCCGACAAGTCGAC
+TTCAATAAAGCAAGCATCATGGCAGAGCATTATAGTCGGCTATTCTGTGCAGCCCTTAGT
+ATCAGTATATTTGATCTGTGAAAGCGTCTCTTGTACTTGAAAACAAGCAAACACAACTCA
+ATTCTTTCAGCCATGAATCATATAAACTCAAAATATTTTGAAATGTACATTTCTAGAAGA
+AAACTCTTGAGGCAATCTGGAAGAACTACAATTGAGCCTATTGAAAAGAGTTCAGAAACC
+CGCTTATAGCAGAAGAGGTCTTTGTGCTTCATAACTCTGTAGACCTTTTTTCATGCTACA
+ATACAAGCTAATGCTAGCTGTAAAAGCGTAAAAATGCTAGTACTCACTGTGGCAGTTAGC
+CTGGGCCCGTGAAGCTGAGCGTAGAGTATGGCCTCCTCGACCTGACCTCTGATCCCCAGT
+AAGGCCAGCTCTAAATTGTGAGCTCCGGCAACCATTTGCGTGAGGTCCTGCAATATGGTG
+ACATACTGTCTCCAGGGCTGGTGGAGCTCGGAGTAGCTCGCCAGGCACCCGCGCATGACA
+TTAAGACAGTAGTTGCTGCACGCATGGATCAGGGTGAGTCCACGGCAGTGAGAGCAGTAA
+TGCATGCG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXX
+.
+clr:0,908
+}
+{RED
+iid:148
+eid:zDH07-857n22.q1k
+seq:
+CGAGCTCATGCTGACCTGCGCACACACACACACGGCAATAATACAACAGTCACCACACTA
+CTTGTAGTGATGCTACAGCCTGACACTGGATGTCTCATAGTTTTGATTCGTACAATTGAA
+TATAACTTTTAAAAATAAATAAATAAATAAAAAAAGTTAGAGAACAAAAAAATTATTTAG
+AGAAGAAAAAAAAATTTCAAGAAGAGGTTGGGGGTCATAAAATAAAATGATATAAAAAAA
+AAGTCACAAACACAATTTAGGGTTTTTTCATCTCACCTGAGCGACTCTGTTAGCGACGTC
+ACGTCCGACCGCAAGTCCCTGTACGAATGTGCGCGCCGCAATAAACGCGCGAGTCACCTG
+TGATTTCAGCTTTTTAGGCACATCTCCAAACGGCCGCAGCTGCTCCGTGTATTTACCGAT
+GCACTCCAAATATTCGTCCGTGATCTGAAACTGAGAGTTGAGCAGCTGAAACATGCGCTC
+TAGTAATCGTGTCCAGAAGTCCTTTAGCATCTCCTCCAGGTTGACGTTTCCGCCGGTGTA
+AAAACGCCGCAGCTCCGAGAACAGGCTCTGGAAGACCTCTGCGTTCTGCAGGTACGGTTT
+ACCGTAAGTGCGGACAAACATCTCGTTCAGAGAGCGCTCGGCGCTCTCCAGCAGCTCCAA
+GAAGAAATCTAAAAAAATGTATAGATGTATAAATACTAAAATAAAAAAGAACAACTTATT
+ATGACAATATATCTCATTATTTTGACATACCGATATATTAGGTATGCGTTACTTTGCTGA
+AATAAGTTACTTCGACATGTCTATATATTACAAATGAGTTACTATACTGAAATAAGTTAT
+TTCGAC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXX
+.
+clr:0,846
+}
+{RED
+iid:149
+eid:zDH07-1601l07.q1k
+seq:
+TTCCACCCATATTTTGACAAAATTATATTTGAAAAAATAATAAAGTAGCCAACTTGGTTG
+CCTTTAATAATGTGCTGAAAATAAAACCCAAAATATTAAGTCATTCTAAATGGGAAACTA
+TGCATGCTTGCATGTACCTGGAATTATTGAGAAGACTTAATTTTTTTATTATGTTAGACA
+ACTTTCAAAACTTTAATCCTTTACTAATAAACTTTTTTCTACTCTATTATTTCTTTCAGA
+AAGCGTGGAGTCTCTGGTGCGTCAGGCGGAGAACCACACCCTCTCCATCCTCCATCAGTC
+CCAGCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTTTTTCACAGAAGT
+GGCTCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTTCTTCAA
+CGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTCTCCTCCATACGC
+CGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGCCCCAATCCGCCT
+GGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCAAGCGCTCCATTT
+GGGCATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGAGTGCAGACGTGG
+CCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAGCAAACCCTGCTT
+GAGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,765
+}
+{RED
+iid:150
+eid:zDH07-1865p03.p1k
+seq:
+GTTTGTCACCATTCTGCTAGCGTGAAACAAAAAAAGTTAAGACCAAAATAACATTCAAAA
+CCACGCCAGAGTGGATGAAAACATCCCCAGCAACACATAAGAGTTACCATATGATACCAC
+TATGGATCCTCTTGGTTCTAATGCATGCTCTTTTAAGCATAAAAGTGTACCTTTTAAAAG
+GGTACCACCCCAGTGACAGGTTTCATACATTTCTGAGAGTGTGTTAAGAATTAATGTGTT
+CTTGACTCTAAGCATTTCAGCTTTCCGCCCAAGGGGATGCTAAAGGTTTAACTTATGACA
+AAAATGTACCCAAAAATGGCTTCACAAACAGAAATGTAGCAGAAACTCACCTTGAAAGAG
+GGCAGCATTCTGGATGATGAGCCCTTTGAGCTGAGCGCTGGTGGCCTGAAGGCTAGACTC
+CATATTCTGTTTGGCAATAAGCAGGTAACGCTCCTCCATTTTGCGAGAACAGCAAGTCAG
+GCCTTTTGGCTGGCACACCTGCAGATCTGAGCCTGTAGAATAACAGAGAGAAGATTTCTA
+ACAGCCGTCACAATAAACAAGTAAACAGACCGCGGCATTTTATAAACTGAAGCTTGGCTT
+GTAAATCGAAAACAAAGAGAGCTGCAGAAAATGGTTTGTTTTATAGAGTACACATTGTTT
+ACGCTACTTGTACAAATTTCAAAGAACGCCACAAAACAAATATCTGCGACTTAATCGAAA
+CATGTTATTTAATTTCATTTCCACACATTGCATTTCATCTTGTTGCCTTGTG
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,772
+}
+{RED
+iid:151
+eid:zDH07-1576k16.q1k
+seq:
+ACTAATAAACTTTTTTCTACTCTATTATTTCTTTCAGAAAGCGTGGAGTCTCTGGTGCGT
+CAGGCGGAGAACCACACCCTCTCCATCCTCCATCAGTCCCAGCGTGATCTCTCCAGCCCA
+GCAGCATCAGCACCAGTCGGGGAGTTTTTCACAGAAGTGGCTCTGTTCATCCTGGGCTCT
+GAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTTCTTCAACGCTCTTTTCCCCTTAATATAC
+GAGCGTCTGATTGACTCCCGTCTGTCTCCTCCATACGCCGAATGCCTGCGCTCGTCTGCT
+CAAGATCTAGCACCGTTCGGAGCAGCCCCAATCCGCCTGGCGTCCCAAATCGCCCATGCT
+TCTCTACCTGCTCGCGTGTTTCTCCAAGCGCTCCATTTGGGCATCGAGATCATAAATACG
+ACCGATCACATCCAGCTGAGCCGCGAGTGCAGACGTGGCCTACTGAGGATGAGCTACTGC
+CCGCACTGCAAGGCTCTGACCTCCAGCAAACCCTGCTTGGGATACTGCCTGAACGTGGTG
+CGCGGGTGTCTGGCTAACCTGGCTGAAGTGGATGCCCACTGGAGGGAGTTTGTACGCTCG
+CTGGAGACGCTGGCAGTACGGAAGCACGGAGAGCTGGA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,638
+}
+{RED
+iid:152
+eid:zDH07-2164d11.q1k
+seq:
+ATGCATAATTATATGTCTTGGCTTTGTAATCAAAAAATGTGATTATGATGGAAGTCAATG
+GGGCAAAAACAGCCACCAACATAATGAAGGGGTAGTCAATTTGAACAGCAGAGAAGGATT
+AAGACCACTGATCATTCTATCATTATCACTCATTTAAATCTTTCTTCTTTTTCAGATACG
+TTCCAGTCCCTAATATCCTTCTCCCAGAACCACCTGACCTCTCTGTTTGAGACCACATAC
+TCATCCCTCATGTCGTCCATCTCCCCTCACATCGTCTGCCTCTTCACGGACCTCTCTCGC
+TTCCTCCAGGGCACCGGCAACGTCTCGGTGGAAGCTGCTGTGCACTGTTTCTTCGACAGC
+CTTTTCCCATTGGTCCACACTCAGATTGTCAATCCCGGTATGGAAGGAAGTATTGGGACA
+GATGCTTCTGAAGGCAACCAGCTTGGTGACTGTCTCCGAATGACCAGGCAGGACGTAAAC
+CCCTTTGGTCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGGGCTGGG
+CGGGTGCTCAGCTTGGCACTTGCCGAAGGGTCAGAGGTGATGAACATTACGGAAACAGCA
+GGGTTATCAAAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCACTGCCGT
+GGACTCACCCTGATCCATGCGTGCAGCAACTACTGTCTTAATGTCATGCGCGGGTGCCTG
+GCGAGCTACTCCGAGCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGCAGGACCTC
+ACGCAAATGGTTGCCGGAGCTCACAA
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,806
+}
+{RED
+iid:153
+eid:zDH07-2057n12.p1k
+seq:
+TATATTAGAAAACCCAGCTTAAGGTACAATAGCAAGCGCATCTCACCAATAAAGAGGTTC
+CACTCAGGGTCCAGATCCGCTTGGTTGGCCAGGCAGCCGCGCATCACATTCTGGCAGTAG
+TTGGCGCAGGGTTTGAGTCCTGACATTCCTCCACAATACGGGCAGTACCACATTTTAGTC
+AATGCTTTACTGCAGCCTGGAGAAATATTGACCTGCAGGATAAACACACATGGGCAGATG
+TTAAATGTGCTTTGAAATGTGCATTTTTTTTTATTTAAAGTTTGACGTAATCCCAACTGA
+AACATAAAGAGAGAGCAGGACATACAGTAGCTCCTCCCAAAAAACAGCCAATATAGTTTC
+ATTTTTTATCACAGCCTTGCCAGTGACAGGGACTGTACCTGTATGCCTACAACTGATGTC
+AAAATTATTCGCCCTCCTGTGATTTTGTTTTACTTTTTCAAATGTTTCCCAAATGATGTT
+TAACAGCGCAAGGAAATTTTTACAGTGTCTCCAATGATATTTTCTACAATATATCTTCTA
+TTAAGTCTTTGTTTTATTTTTTATAACTGCTAGAATAAAAGCAGTTTTTTGTCCCATTTT
+AAAGGGCCATGACATCCCCCTCTTTCGAGTCAAGTCTACCACAGAATTAAAAAAAAAATG
+CTCTGTGATGGGCGTGGAGTGCTACAAGCAGAGGGAGGAGAGGGTGTGGCTGACAGAGCA
+GTGAATAAGAGGGGAGCAAAAAACTGCTGACAATTGGCTC
+.
+qlt:
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+.
+clr:0,760
+}
diff --git a/test/minimus/zgene/zgene2.afg.runAmos.log.orig b/test/minimus/zgene/zgene2.afg.runAmos.log.orig
new file mode 100644
index 0000000..ae3a9f9
--- /dev/null
+++ b/test/minimus/zgene/zgene2.afg.runAmos.log.orig
@@ -0,0 +1,66 @@
+!!! 2006-08-30 13:11:10 Started by dsommer at flicker03.umiacs.umd.edu on Wed Aug 30 13:11:10 2006
+
+!!! 2006-08-30 13:11:10 Doing step 10: Building AMOS bank
+!!! 2006-08-30 13:11:10 Running: /fs/sz-user-supported/Linux-i686//bin/bank-transact -c -z -b zgene2.bank -m zgene2.afg
+START DATE: Wed Aug 30 13:11:10 2006
+Bank is: zgene2.bank
+ 0% 100%
+AFG ..................................................
+Messages read: 154
+Objects added: 154
+Objects deleted: 0
+Objects replaced: 0
+END DATE: Wed Aug 30 13:11:10 2006
+!!! 2006-08-30 13:11:10 Done! Elapsed time:0d 0h 0m 0s
+
+!!! 2006-08-30 13:11:10 Doing step 20: Running overlap
+!!! 2006-08-30 13:11:10 Running: /fs/sz-user-supported/Linux-i686//bin/hash-overlap -B zgene2.bank
+Starting on Wed Aug 30 13:11:11 2006
+
+Read bank is zgene2.bank
+Alignment error rate is 0.06
+Minimum overlap bases is 40
+!!! 2006-08-30 13:11:13 Done! Elapsed time:0d 0h 0m 3s
+
+!!! 2006-08-30 13:11:13 Doing step 30: Running contigger
+!!! 2006-08-30 13:11:13 Running: /fs/sz-user-supported/Linux-i686//bin/tigger -b zgene2.bank
+ Pulling reads from bank zgene2.bank
+Pulled 153 reads from bank
+ Pulling overlaps from bank zgene2.bank
+Pulled 779 overlaps from bank
+ total contained reads hidden 74
+ number of contigs 18
+this pass containment size is 74
+61 containment reads added back on this pass
+ sub-total contained reads unhidden 61
+this pass containment size is 13
+13 containment reads added back on this pass
+ sub-total contained reads unhidden 74
+ total contained reads unhidden 74
+ Writing layouts to bank zgene2.bank
+!!! 2006-08-30 13:11:13 Done! Elapsed time:0d 0h 0m 0s
+
+!!! 2006-08-30 13:11:13 Doing step 40: Running consensus
+!!! 2006-08-30 13:11:13 Running: /fs/sz-user-supported/Linux-i686//bin/make-consensus -B -b zgene2.bank
+Starting on Wed Aug 30 13:11:13 2006
+
+Read bank is zgene2.bank
+Alignment error rate is 0.06
+Minimum overlap bases is 5
+Output will be written to the bank
+Input is being read from the bank
+Processed 16 layouts
+!!! 2006-08-30 13:11:13 Done! Elapsed time:0d 0h 0m 0s
+
+!!! 2006-08-30 13:11:13 Doing step 50: Outputting contigs
+!!! 2006-08-30 13:11:13 Running: /fs/sz-user-supported/Linux-i686//bin/bank2contig zgene2.bank > zgene2.contig
+Processing zgene2.bank at Wed Aug 30 13:11:13 2006
+End: Wed Aug 30 13:11:13 2006
+!!! 2006-08-30 13:11:13 Done! Elapsed time:0d 0h 0m 0s
+
+!!! 2006-08-30 13:11:13 Doing step 60: Converting to FastA file
+!!! 2006-08-30 13:11:13 Running: /fs/sz-user-supported/Linux-i686//bin/bank2fasta -b zgene2.bank > zgene2.fasta
+!!! 2006-08-30 13:11:13 Done! Elapsed time:0d 0h 0m 0s
+
+!!! END - Elapsed time: 0d 0h 0m 3s
+
diff --git a/test/minimus/zgene/zgene2.seq b/test/minimus/zgene/zgene2.seq
new file mode 100644
index 0000000..f5deb47
--- /dev/null
+++ b/test/minimus/zgene/zgene2.seq
@@ -0,0 +1,1955 @@
+> zfishG-a2661d04.q1c R139767 uid=1146626
+TAAAATAAATGTTATGTTATCATGTTGACAGATCAATGATAAAATAAAGCCTGGTGATTA
+AAAACCTGCAATACCTTGACAAGAACTTTCATGTAAACTAAAGTACTAACTAAAAAAGTG
+TCCTGAGAAATCTCGACAGTTTTTTGAGTTTGATAGCCCTGGGCTCAATCAGAAAACTAG
+CCAGTCAGAAACACTCTTCATTTCACTCGTTCGGGTCTGCTGACACTGACTTTGCTGACA
+AGTCTTTGGAGGTTGAGTTTTGGAGAGAGATGGCGTTAGCAAAAATGGCTGAAGTTAGCA
+AAATGGCTGCAGTCGCCTACAGCATTCGAATTCATACCTTGTTTCTGAGACCATGTGTCA
+CTCACCTGGGCGCTGACTTTGCTCTTGCTTGCCACGGCTTGTTTGAGAGCCTGTCTGATA
+ATGACATGCAGTCGGAGCACCACAGCCTCGATGTCCTGTTCCCCCTTCATGGCAGCGGCG
+AGTGACCCCAGTTCATCCACATATGCTCTCCAATGAGGCTGTACCTCCGTGGTTCCCCCC
+AAACATGCTCCCATGGTGCTGACACACAGTGGACGGCACGGCCGGGCCTTCAGCAGGCTT
+TGACAGTGCGGGCAGTACCACAGTTTCAGAAGTGAGCGCCCACAATCTCTACCTGCCCGC
+AAATGCTGAGT
+> zfishI-a72c06.p1c R181142 uid=1190133
+CACCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGGGCTGGGCGGGTGCTCAGC
+TTGGCACTTGCCGAAGGGTCAGAGGTGATGAACATTACGGAAACAGCAGGGTTATCAAAA
+GAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCACTGCCGTGGACTCACCCTG
+ATCCATGCGTGCAGCAACTACTGTCTTAATGTCATGCGCGGGTGCCTGGCGAGCTACTCC
+GAGCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGCAGGACCTCACGCAAATGGTT
+GCCGGAGCTCACAATTTAGAGCTGGCCTTACTGGGGATCAGAGGTCAGGTCGAGGAGGCC
+ATACTCTACGCTCAGCTTCACGGGCCCAGGCTAACTGCCACAGTGAGTACTAGCATTTTT
+ACGCTTTTACAGCTAGCATTAGCTTGTATTGTAGCATGAAAAAAGGTCTACAGAGTTATG
+AAGCACAAAGACCTCTTCTGCTATAAGCGGGTTTCTGAA
+> zfishC-a186h03.p1c R463365 uid=1485861
+TTGATTGAAAAAAGGCACCCAAACTGGAAGTTCTTTATAGGGGACATCTATATTACAAAA
+CCCATCTTAAGGTACAATAGCAAGCGCATCTCACCAATAAAGAGGTTCCACTCAGGGTCC
+AGATCCGCTTGGTTGGCCAGGCAGCCGCGCATCACATTCTGGCAGTAGTTGGCGCAGGGT
+TTGAGTCCTGACATTTTTCCACAATACGGGCAGTACCACATTTTAGTCAATGCTTTACTG
+CAGCCTGGAGAAATATTGACCTGCAGGATAAACACACATGGGCAGATGTTAAATGTGCTT
+TGAAATGTGCATTTTTTTTTATTTAAAGTTTGACGTAATCCCAACTGAAACATAAAGAGA
+GAGCAGGACATACAGTAGCTCCTCCCAAAAAACAGCCAATATAGTTTCATTTTTTATCAC
+AGTCTTGCCAGTGACAGGGACTGTACCTGTATGCCTACAACTGATGTCAAAATTATTCGC
+CCTCCTGTGATTTTGTTTTACTTTTTCAAATGTTTCCCAAATGATGTTTAACAGCGCAAG
+GAAATTTTTACAGTGTCTCCAATGATATTTTCTACAATATATCTTCTATTAAGT
+> zfishC-a186h03.q1c R494727 uid=2018457
+AAATAAAGAATACATAAAATAATAAATAAAATAAAGTGTTTTTGATTGAAAAAAGGCACC
+CAACTGGAAGTTCTTTATAGGGGACATCTATATTAGAAAACCCAGCTTAAGGTACAATAG
+CAAGCGCATCTCACCAATAAAGAGGTTCCACTCAGGGTCCAGATCCGCTTGGTTGGCCAG
+GCAGCCGCGCATCACATTCTGGCAGTAGTTGGCGCAGGGTTTGAGTCCTGACATTCCTCC
+ACAATACGGGCAGTACCACATTTTAGTCAATGCTTTACTGCAGCCTGGAGAAATATTGAC
+CTGCAGGATAAACACACATGGGCAGATGTTAAATGTGCTTTGAAATGTGCATTTTTTTTT
+ATTTAAAGTTTGACGTAATCCCAACTGAAACATAAAGAGAGAGCAGGACATACAGTAGCT
+CCTCCCAAAAAACAGCCAATATAGTTTCATTTTTTATCACAGCCTTGCCAGTGACAGGGA
+CTGTACCTGTATGCCTACAACTGATGTCAAAATTATTCGCCCTCCTGTGATTTTGTTTTA
+CTTTTTCAAATGTTTCCCAAATGATGTTTAACAGCGCAAGGAAATTTTTACAGTGTCTCC
+AATGATATTTTCTACAATATATCTTCTATTAA
+> Z35723-a1108d01.q1c R1204890 uid=3250063
+TCGCTTCCTCAGGGCACCGGCAACGTCTCGGTGGAAGCTGCTGTGCACTGTTTCTTCGAC
+AGCCTTTTCCCATTGGTCCACACTCAGATTGTCAATCCCGGTATGGAAGGAAGTATTGGG
+ACAGATGCTTCTGAAGGCAACCAGCTTGGTGACTGTCTCCGAATGACCAGGCAGGACGTA
+AACCCCTTTGGTCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGGGCT
+GGGCGGGTGCTCAGCTTGGCACTTGCCGAAGGGTCAGAGGTGATGAACATTACGGAAACA
+GCAGGGTTATCAAAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCACTGC
+CGTGGACTCACCCTGATCCATGCGTGCAGCAACTACTGTCTTAATGTCATGCGCGGGTGC
+CTGGCGAGCTACTCCGAGCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGCAGGAC
+CTCACGCAAATGGTTGCCGGAGCTCACAATTTAGAGCTGGCCTTACTGGGGATCAGAGGT
+CATGTCGAGGAGGCCATACTCTACGCTC
+> Z35723-a1166g11.q1c R1224026 uid=3269589
+TATCCGTCCATACATTCATCCATAAATCTGTCAACCCATAAATCTAGCCATCAATCAATC
+CATAATTCTATCAAGCAATGCATCTCTCCGTCCATCAATCCATCCGTCAGAATCATTGTG
+TCTGAAGACTGTTTTATGATGCATCTGTGCTTTTGTTAATTGTGCTGTAGTTTACATACA
+GAACAGCCAAGCATACAGGTTACTGACCTCATCAAAACCCTGTATAAATGTGTGTGTGCT
+CGAAGTGTGTGTGTTCCTCTTACCGATAAATTTGCTCCATTCGTTGTTGAGATCGGCCTG
+GTTTGCCAAGCAGCCCTTCATGACATTCAGACAGTAGTTTCTGCAGGGCTTCAGTGTGAA
+CAGACCCTGACAATACGAGCAGTAGAGCATCTTCGTGAAGCCGCTGACACACGACGAGCT
+CATGCTGACCTGCGCACACACACACACGGCAATAATACAACAGTCACCACACTACTTGTA
+GTGATGCTACAGCCTGACACTGGATGTCTCATAGTTTTGATTCGTACAATTGAATA
+> Z35723-a1386e10.q1c R1383675 uid=3433549
+TCTTTGTGCACACCATCTAATTTCAATTTTCACTGAAGCCCATTCCTCTTTCTTCTTTCG
+CCTGCACTCAATACATTCTCAATTTCCTCTCTGTCTGATGCAGGGAGTTTATCTCGGGTC
+TAAGGGGCTTCAGTCAGTTCTACAGTGGTCTCGGAGAAGCTTTGTGCAGCAAAGAGCCGA
+CATCGCTGAACAGCTCCCTCTGCTGGAACGGACAGGAGATGACAGACAAGTGAGTAATTC
+ATTTGTGGGAGCATTGATGCGATGTAACCTCTACATTCCTTCATTGTGGACTCCTACAGC
+TCAAAGTAAGGGCATTGATGTTCATTAAAACGTGAGTAAGTTCATTAGGTGGCGTCATTC
+AGTTTGCAGACATGTAAACTAAGATTAATAGTTCTTCTGTATGCTTGCAGCGGTGCAGAA
+TAACTGTTCCACATCATTGTGGTTACTTTGGAGCCTTGCCAAGGTACATGGCATGTGTAA
+ATAAAAATGAGCGCACAAGGGAATGAGTATAGCCTGATAAATAATTTGGAATAGCT
+> Z35723-a2265d03.q1c R1551766 uid=4155258
+TTTAAGTGTAGTTGGTTTGCTTATTTCAAGAATTATGTAATTCTAGATATATTTTTAATT
+TCTGTGAAGCAAGTCGACAGTGAGATTCCAGCGCATTTGCTGACCCCAGAAGGTCAATGA
+AGCTGCGGAAACTTCATAAAGAACGCGCATCTGTCTAACAAGCTACTGTTCTGTCTTTTA
+CTGCAGATGTGGAACTGTCGGTGTGCAAGCATGCGGGGCCATCATGTTGTACACGAAGAA
+TGGAAGACAGTTACAGAGCGGCGGTCCTGAGAGACACCACCCAGAACATCGGATCGTACA
+GCTATGAGCTCAAATTTCTCATTTCTGCACACGCCGCCGCCTTCCAGGGTACACAGATGC
+ATGGATGATTGAATGGATGGTGGAAGGATGAAATGGATGATTGATAAGTGAAACGAATGG
+GCAAATAGATGAAGTTGATTGATGTGTGAATGAATATATGTTGATGTAACAACAGAGGCT
+CATTTAGGGCCCTGTGATTTACACAATGCTGACAAAACTGAGGAATCCAGACATAAATAG
+AATTTGGTGTATAACTGTGACAGAAAATG
+> Z35723-a2670f01.q1c R1570223 uid=4174433
+TGGGTGAAAACATTCGCAGCTACACATAAGAGTTACGGTATGATACCACGATGGATCCTA
+TTGGTTATAATGCATGCGCTTTTAAGTATAAAAGTGTACCTTTTAAAAGGGTACCACCCC
+AGTGACAGGTAACATACATTTCTGAGAGTGTGTTAAAAATTAATGAGATGTTGACTCTAA
+GCATAACAGCTACTCGTCCGAAGGGATGCTAAAGGTTTAACTCATGACACAAATGTACCC
+AAAAATGGATTGACAAACCGAAATGTAACACAAACTTACCTTGAAAGAGGGCAGCATTCT
+GGATGATGAGCCCTCTGAGCTGAGCGCTGGTGGCCGGAAGGCTATACTTCATATTCTGCT
+TGGCAATAAGCAGGTGACGCTCCTCCATTTTGCGAGAACAGCAAGTCAGGCCTTTTGGCT
+GGCACACCTGCAGATCTGAGCCTGTAGAATAACAGAGAGAAGATTTCTAACAGCCGT
+> zfishB-a2363g12.p1c R1592117 uid=4197289
+ACGGCCTGACTTGCTGTTCTCGCATTATGGAGGAGCGTTACCTGCTTATTGCCAAACAGA
+ATATGGAGTCTAGCCTTCAGGCCACCAGCGCTCAGCTCAAAGGGCTCATCATCCAGAATG
+CTGCCCTCTTTCAAGGTGAGTTTCTGCTACATTTCTGTTTGTGAAATCATTTT
+> zfish-Ja871b12.p1c R1770004 uid=4384136
+TCATCCATGCATCTGTGTACCCTGGAAGGCGGCGGCGTGTGCAGAAATGAGAAATTTGAG
+CTCATAGCTGTACGATCCGATGTTCTGGGTGGTGTCTCTCATGACCGCCGCTCTGTAACT
+GTCTTCCATTCTTCGTGTACAACATGATGGCCCCGCATGCTTGCACACCGACAGTTCCAC
+ATCTGCAGTAAAAGACAGAACAGTAGCTTGTTAGACAGATGCGCGTTCTTTATGAAGTTT
+CCGCAGCTTCATTGACCTTCTGGGGTCAGCAAATGCGCTGGAATCTCACTGTCGACTTGC
+TTCACAGAAATTAAAAATATATCTAGAATTACATAATTCTTGAAATAAGCAAACCAACTA
+CACTTGAAACATATGTTCTCTGGATTTGTAATGTTTTCTTCTTCAAGTATTTCCCAAATG
+ATGTTTAACAGAGCAAGGAAATTTTCACAGAATGTCTGATAATATTTTTTCTTCTGGAGA
+AAGTCTTTTGTTTTATTTCAGCTAGAATAAAAGCAGTTTTGATTTTTTTTAAACCCTTTT
+AAAGTCAATATTATTAGCCCCCCTTTAGCAATTTTGTTTTTGATTGTCT
+> Z35723-a4033a11.p1c R2055563 uid=5178960
+AAACTTATTGGCTGTTTTTTGGGAGGAGCTACTGTATGTCCTGCTCTCTCTTTATGTTTC
+AGTTGGGATTACGTCAAACTTTAAATAAAAAAAAATGCACATTTCAAAGCACATTTAACA
+TCTGCCCATGTGTGTTTATCCTGCAGGTCAATATTTCTCCAGGCTGCAGTAAAGCATTGA
+CTAAAATGTGGTACTGCCCGTATTGTGGAGGAATGTCAGGACTCAAACCCTGCGCCAACT
+ACTGCCAGAATGTGATGCGCGGCTGCCTGGCCAACCAAGCGGATCTGGACCCTGAGTGGA
+ACCTCTTTATTGGTGAGATGCGCTTGCTATTGTACCTTAAGCTGGGTTTTCTAATATAGA
+TGTCCCCTATAAAGAACTTCCAGTTGGGTGCCTTTTTTCAATCAAAAACACTTTATTTTA
+TTTATTATTTTATGTATTCTTTATTTAAACAATACTGGAAATGAGACTGTTTGAGTTGTT
+GCTCAAGTTTATTTTGTGTTTGACTGATTGATTGATTGATT
+> ZfishJ-a1224d01.p1c R2522544 uid=6161736
+AAGAACGCGCATCTGTCTAACAAGCTACTGTTCTGTCTTTTACTGCAGATGTGGAACTGT
+CGGTGTGCAAGCATGCGGGGCCATCATGTTGTACACGAAGAATGGAAGACAGTTACAGAG
+CGGCGGTCCTGAGAGACACCACCCAGAACATCGGATCGTACAGCTATGAGCTCAAATTTC
+TCATTTCTGCACACGCCGCCGCCTTCCAGGGTACACAGATGCATGGATGATTGAATGGAT
+GGTGGAAGGATGAAATGGATGATTGATAAGTGAAACGAATGGGCAAATAGATGAAGTTGA
+TTGATGTGTGAATGAATATATGTTGATGTAACAACAGAGGCTCATTTAAGGCCCTGTGAT
+TTACACAATGCTGACAAAACTGAGGAATCCAGACATAAATAGAATTTGGTGTATAACTGT
+GACAGAAAATGCAAAAGATTGCATCATGGAGCCAGATCAATCTCAAAAATAATGCATTTA
+TGATAAGCCAAAAGCGCAAAACCCAATTTCATTCATTTATTAATTTCCTTGTCAGCTTAG
+TCCCTTTATTAATCCGGGGTCGCCAGCACGGAATGAACCGCCAACT
+> Z35724-a43c06.q1c R2659611 uid=6302049
+CACCGCTGCAAGCATACAGAAGAACTATTAATCTTAGTTTACATGTCTGCAAACTGAATG
+ACGCCACCTAATGAACTTACTCACGTTTTAATGAACATCAATGCCCTTACTTTGAGCTGT
+AGGAGTCCACAATGAAGGAATGTAGAGGTTACATCGCATCAATGCTCCCACAAATGAATT
+ACTCACTTGTCTGTCATCTCCTGTCCGTTCCAGCAGAGGGAGCTGTTCAGCGATGTCGGC
+TCTTTGCTGCACAAAGCTTCTCCGAGACCACTGTAGAACTGACTGAAGCCCCTTAGACCC
+GAGATAAACTCCCTGCATCAGACAGAGAGGAAATTGAGAATGTATTGAGTGCAGGCGAAA
+GAAGAAAGAGGAATGGGCTTCAGTGAAAATTGAAATTAGATGGTGTGCACAAAGAGACAA
+GATTAAGAATCCAAAATACTTGGATTTATGAGAAAATGTAGAGGCTTAGAGAAAGAAGAA
+CGACGAATCAGGAGAAAAAAATAGAGTTGGGGTCAAATGCAGTGTTAAGCACGATCTACT
+CCATTACATATCATTTCCTGTCGG
+> Z35724-a939a11.q1c R2735144 uid=6379625
+TAACATGTCATATGACCCACCTGCTGTGGCAGGGACTTGATCCCATGACCTACTACTGCT
+GCTGCTGCGAATGCAAAAAGCACATGTCCTAGTGTTTGTTTGGCCAATAAGCTTCACTCC
+ATCTCAATACATACCCTGGAAGGAAGAAGCATGGCCCAGGATGAGATACTTGAGTTCGAA
+GCTATAGGAGAGAATGTTTTGGAGTGTGTCTCTTTGAGCAGCTGAGTAGTAGCTCTCCTC
+CATCTTGCGGGTACAGCATGTGGGACCCTGGTGTTTACAGATGAGAAGTTCTGCATCTGT
+GATGGATTAATCATAGAAGGTGACTTAAGTAGAAACATTTGTGCCTATTTAAACCACATG
+TCTCATAACTTTCATATGTTGGATTTCTGAGTACAGTTTTTAACCCTCATGCAATACCTC
+CTCTAAAGTTTTTTTTCCAAGCTAACAAACTGATTATGAACACTGAATGGCTTTCCTGTG
+GTAAATGCAATTTGCAAAGTCAAGTGACATACTGTTTACATCGACTAAAAGTAGTTGTAC
+AGCATTTTTACATGTAAACCT
+> Z35725-a1624h06.q1c R2786659 uid=6433041
+CTATCCGTCCATCATTCATTCTAAATCTGTCAACCCATAAATCTCGCCATCAATCAATCC
+ATAATTCTATCAAGCAATGCATCCCTCCGTCCATCAATCCATCCGTCAGAATCATTGTGT
+CTGAAGACTGTTTTATGATGCATCTGTGCTTTTGTTAATTGTGCTGTAGTTTACATACAG
+AACAGCCAAGCATACAGGTTACTGACCTCATCAAAACCCCGTATAAATGTGTGTGTGCTC
+GAGGTGTGTGTGTTCCTCTTACCGATATATTTGCTCCATTCGTTGTTGAGATCGGCCTGG
+TTTGCCAAGCAGCCCTTCATGACATTCAGACAGTAGTTTCTGCAGGGCTTCAGTGTGAAC
+AGACCCTGACAATACGAGCAGTAGAGCATCTTCGTGAAGCCGCTGACACACGACGAGCTC
+ATGCTGACCTGCGCACACACACACGCGGCAATAATACAACAGTCACCACACTACTTGTAG
+TGACGCTACAGCCTGACACTGGATGTCTCATAGTTTTGATTCGTACAATTGAATATAACT
+TTTAAAAATAAATAAATAAAAAAAGTTAGA
+> Z35725-a2451d04.q1c R3059214 uid=7214441
+GAGTTGCTGGACACTCTGAGTAAGTCTCTAAACGACATGTTTGTGCGCACATATGGCAAA
+CTCTACACACACAACTCGGAGATGTTCGAGGACCTGTTCTCAGAGCTGAAGCGCTACTAC
+ACCGGTGGGAACGTCAACCTGGAGGAAGTGCTGAATGACTTCTGGTCGCGTCTGTTGGAG
+AGAATGTTCCAGCTGCTCAACTCGCAGTTCACCTTCAGCGACGACTATCTGGAGTGCATC
+AGCAAATACACTGACCAGCTCAAGCCGTTCGGAGACGTGCCGCGAAAACTCAAAGCGCAA
+GTCACCAAAGCTTTCATCGCGGCCAGATCCTTCGTCCAGGGACTTATGGTGGGCCGAGAA
+GTGGCCAACAGGGTGGCCAAAGTAAGATCTTTAATGAGATGTGGATGATATCATATTAGT
+GTAGTGGATCTGCACTGTTTTTTTTAAAAGGCGCACCTCTGCTGCAAAATTAAGCTTTGG
+ACACTGTTTGGGCAGCACAGTTGGTTTG
+> zfish35934-618c07.p1c R3112128 uid=7269008
+TCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGGGCTGGGCGGGTGCT
+CAGCTTGGCACTTGCCGAAGGGTCAGAGGTGATGAACATTACGGAAACAGCAGGGGTATC
+AAAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCACTGCCGTGGACTCAC
+CCTGATCCATGCGTGCAGCAACTACTGGGTTAATGTCATGCGCGGGTGCCTGGCGAGCTA
+CTCCGAGCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGCAGGACCTCACGCAAAT
+GGTTGCCGGAGCTCACAATTTAGAGCTGGCCTTACTGGGGATCAGAGGTCAGGTCGAGGA
+GGCCATACTCTACGCTCAGCTTCACGGGCCCAGGCTAACTGCCACAGTGAGTACTAGCAT
+TTTTACGCTTTTACAGCTAGCATTAGCTTGTATTGTAGCATGAAAAAAGGTCTACAGAGT
+TATGAAGCACAAAGACCTCTTCTGCTATAAGCGGGTTTCTGAACTC
+> zfish35935-867d02.p1c R3139112 uid=7297019
+TTTTAATGAACATCAATGCCCTTACTTTGAGCTGTAGGAGTCCACAATGAAGGAATGTAG
+AGGTTACATCGCATCAATGCTCCCACAAATGAATTACTCACTTGTCTGTCATCTCCTGTC
+CGTTCCAGCAGAGGGAGCTGTTCAGCGATGTCGGCTCTTTGCTGCACAAAGCTTCTTCGA
+GACCACTGTAGAACTGACTGAAGCCCCTTAGACCCGAGATAAACTCCCTGCATCAGACAG
+AGAGGAAATTGAGAATGTATTGAGTGCAGGCGAAAGAAGAAAGAGGAATGGGCTTCAGTG
+AAAATTGAAATTAGATGGTGTGCACAAAGAGACAAGATTAAGAATCCAAAATACTTGGAT
+TTATGAGAAAATGTAGAGGCTTAGAGAAAGAAGAACGACGAATCAGGAGAAAAAAATAGA
+GTTGGGGTCAAATGCAGTGTTAAGCACGATCTACTCCATTACATATCATTTCCTGTCGGG
+CTAAGTTGCTTTGAGATGCTTTGATTTTAATTGACATTACCTACACACACTCTCTCACCT
+GCTCATCAGAGCGAGGGAACGAGAG
+> Z35725-a4990c08.q1c R3291350 uid=7454057
+TTAATTCTTTCCCGGATGCGTATAAGTCCCAGTTCCACTTCATATCTCTCTGATAATGCC
+CCACTCAGCTTCTCCAGAAGCGATACATAGTCTCGCCAGGGAGCATCCAGCTCAGCCACG
+CCTGCCAGGCAACCTCGCATCACGTTGAGACATAGGCCTCCACATGGCCGGATCAGGGTC
+AGTCCTCGACAGTGAGGACAGAACAACATGCGCACTAGTGCACGTCCACACACTCGTCCC
+ATGCCCACAGACTCTGTGATGTTAAGTACATCTGCACCGACTGCCAGTGCCCGGCTGAGG
+GCACGACCAACCACAAGCGCCTTGGACAGTCCTTGAGCAAGTTCTTGTGGGTGATGGCCA
+AAGGGATAGATATCATGCCGTGTGGCACGAAGGCACTCAGTTCCTTCGGCAGACCAGGTT
+GAAACAGGTGAACCCAAGCCAGGATTGACCAGATGCTGGTACACCAATGGGAAGAGTTTG
+TCATAAAATCTGTAAACCGAGTGTTCCACAGAAACGTTATCATCGCC
+> Z35725-a2723a07.q1c R3487433 uid=8155730
+AAACTCATCAATCCCACAATCCATCACTCCTGCATTTACTGAGCATCAATGAGTGATGAG
+GAGGAGGAGGAGGAGGAGGAGGAGGAGGAGGGTTAATGCAGAGCTTCACCATCTTCATCA
+CCATCTTCAGTCAGATCCAGCAGAGCTCTGTGCTCCTGCAGCCTCACTCACAGCCACTGG
+TGTGTGTGTGTGTGTGTGTCTGTCTCTATGTGTGTGTAGCTGCGCGCGGGGCCAGAGTGT
+GTGCGCGCGCTCATGCGTCAGTGGTTCTGTCCTCTGTGTCGGGGTCTTCCGTCACTCAAG
+CCCTGTCATTCGCTGTGCCTGAACATCATGAAGGGCTGTCTGGCCAATCAGGCGGATCTA
+AACAGCGAGTGGAACAGCTTCATTGGTGAGAACAGAACACCTCTGCTTCATTTACTGTGT
+GTGTGTGTGTGTGTGTG
+> Z35725-a4262h12.p1c R3918207 uid=9097582
+AGCTGGATGTGATCGGTCGTCTTTATGATCTCGATGCCCAAATGGAGCGCTTGGAGAAAC
+ACGCGAGCAGGTAGAGAAGCATGGGCGATTTGGGACGCCAGGCGGATTGGGGCTGCTCCG
+AACGGTGCTAGATCTTGAGCAGACGAGCGCAGGCCTTCGGCGTATGGAGGAGACAGACGG
+GAGTCAATCAGACGCTCGTCTATTAAGGGGAAAAGAGCGTTGAAGAAGCTCTGAGAGGAC
+TCTTCTAGACTGAGCTCAGAGCCCAGGATGAACAGAGCCACTTCTGTGAAAAACTCCCCG
+ACTGGTGCTGATGCTGCTGGGCTGGAGAGATCACGCTGGGACTGATGGAGGATGGAGAGG
+GTGTGGTTCTCCGCCTGACGCACCATATACTCCACGCTTTCTGAAAGAAATAATAGAGTA
+GAAAAAAGTTTATTAGTAAAGGATTAAAGTGTTGAAAGTTGCCTAACATAATAAAAA
+> zfishJ-a1618g07.q1c R4004095 uid=9185894
+TTATCTTGCATATTGTCAGCGGCTTCCTCACATTATAGCACTACACAATATTATTATGTT
+AAAAACACAGTAGCCTAGGTAAGTCTACAATTACATCCCTGAAAGACATCTGAAATGAAG
+CAGGTCATCTGCATGTAGACACCCCACCACCTCAAAAAAAAAAAAAAATACTTTGGATTT
+ATGCAAATTACAGGGGTCACCCCATTGAGCTTGGAAAAAATCACATCACATTCCTACTAA
+TAACACTAACTTGCCTAGTTAACATAGTTAAGGACTGAATACTTGGATGTTGATGAATAT
+TCAGTAGAAATGTATTTACTGTCATCATGGCAAAGATAAAAGATATCAGATATTAGAAAT
+GAGTTACTGAAACTATTATATTTAGAAAAGTGTTAAAAAAATCTTTCTGATAAACAGAAT
+ATGGGGAAAAAAATATATACAGAGGAACTAACAATTAAGGAGGGCTAATAATTGCGGACA
+CATTTAAAGCATGTTAATACTGCAGGTCTTTCTTACCAAGGAAGTTATTCCACTCTGTGT
+CCAGATCGGCCTGATTGGCCAGACAGCCCCTCATGACATTCAGACAGTAGTTCTTGCAGG
+GCTTCAGCGCCACCTGACCGCTACAGTACGGGCAGTATAACATCTTCATCGATG
+> Z35724-a4493f05.p1c R4157924 uid=9409408
+TGCCTTATCATAAATGCATTATTTTTGAGATTGATCTGGCTCCATGATGCAATCTTTTGC
+ATTTTCTGTCACAGTTATACACCAAATTCTATTTATGTCTGGATTCCTCAGTTTTGTCAG
+CATTGTGTAAATCACAGGGCCCTAAATGAGCCTCTGTTGTTACATCAACATATATTCATT
+CACACATCAATCAACTTCATCTATTTGCCCATTCGTTTCACTTATCAATCATCCATTTCA
+TCCTTCCACCATCCATTCAATCATCCATGCATCTGTGTACCCTGGAAGGCGGCGGCGTGT
+GCAGAAATGAGAAATTTGAGCTCATAGCTGTACGATCCGATGTTCTGGGTGGTGTCTCTC
+AGGACCGCCGCTCTGTAACTGTCTTCCATTCTTCGTGTACAACATGATGGCCCCGCATGC
+TTGCACACCGACAGTTCCACATCTGC
+> Z37249-a879d08.p1c R4307625 uid=10064021
+GATACATCCAGCTGAGCCGCGAGTGCAGACGTGGCCTACTGAGGATGAGCTACTGCCCGC
+ACTGCAAGGCTCTGACCTCCAGCAAACCCTGCTTGGGATACTGCCTGAACGTGGTGCGCG
+GGTGTCTGGCTAACCTGGCTGAAGTGGATGCCCACTGGAGGGAGTTTGTACGCTCGCTGG
+AGACGCTGGCAGTACGGATGCACGGAGAGCTGGATCTGGAGCAGGTGCTGCTGGGGGCGC
+ATGAGCTGGTGAGGGACGCTGTGGCGCACGCTCAGAGGAGCACAGCGAGGATACATGCGC
+AGGTGAGAGGATGAGTGTGTG
+> Z35724-a5018a04.p1c R4344357 uid=10102318
+CTGCGTATGGGTCATTTCCCAAGATGATGATGACCCGACTATCCCGCTCACTCCTCGCCA
+CTCGGGTCTTCCTGCAAGCGCTAAATTTGGGCATAGAAGTGGTCAACACCACTCAGCATT
+TGCGGGCAGGTAGAGATTGTGGGCGCTCGCTTCTGAAACTGTGGTACTGCCCGCACTGTC
+AAAGCCTGCTGGAGGCCCGGCCGTGCCGTCCACTGTGTATCAGCACCATGGGAGCATG
+> Z35724-a5061b04.q1c R4358298 uid=10117115
+AAAGTAATAACATGTCATATGACCCACCTGCTGTGGCAGGGACTTGATCCCATGACCTAC
+TACTGCCGCTGCTGCGAATGCAAAAAGCACATGTCCTAGTGTTTGTTTGGCCAATAAGCT
+TCACTCCATCTCAATACATACCCTGGAAGGAAGAAGCATGGCCCAGGATGAGATACTTGA
+GTTCGAAGCTATAGGAGAGAATGTTTTGGAGTGTGTCTCTTTGAGCAGCTGAGTAGTAGC
+TCTCCTCCATCTTGCGGGTACAGCATGTGGGACCCTGGTGTTTACAGATGAGAAGTTCTG
+CATCTGTGATGGATTAATCATAGAAGGTGACTTAAGTCGAAACATTTGTGCCTATTTAAA
+CCACATGTCTCATAACTTTCATATGTTGGATTTCTGAGTACAGGTGCTAACCCTCATGCA
+ATGCCTCCTCTAAAGTTCTCTTTCTAAGCTAACAAACTGATTATGAACACTGAATG
+> Zfish35936-361d06.p1c R4490357 uid=10253202
+TACACACACACACACACACACACACACACACACACACACAAACACACACACACACACACA
+CACTATAATCTGCTGGTTTGCTCCATAGAACTCCATATAAAAGCCAGAAACTTGTATGAT
+AGGCCTATATAAAGGGTTAATGGTGACAACTGATGATCAACAGTAAAACTTAAACATTTG
+ACCTCTTCCCAACAGGAAAACCAACAATAATCAAGAATGCATAATTATATGTCTTGGCTT
+TGTAATCAAAAAATGTGATTATGATGGAAGTCAATGGGGCAAAAACAGCCACCAACATAA
+TGAAGGGGTAGTCAATTTGAACAGCAGAGAAGGATTAAGACCACTGATCATTCTATCATT
+ATCACTCATTTAAATCTTTCTTCTTTTTCAGATACGTTCCAGTCCCTAATATCCTTCTCC
+CAGAACCACCTGACCTCTCTGTTTGAGACCACATACTCATCCCTCATGTCGTCCATCTCC
+CCTCACATCGTCTGCCTCTTCACGGACCTCTCTCGCTTCCTCCAGGGCACCGGCAACGTC
+TCGGTGGAAGCTGCTGTGCACTGTTTCTTCGACAGCCTTTTCCCATTGGTCCACACTC
+> Zfish35936-498b08.q1c R4556081 uid=10320758
+TCTGAGCGTGCGCCCAGCGTCCCTCACCAGCTCATGCGCCCCCAGCAGCACCTGCTCCAG
+ATCCAGCTCTCCGTGCATCCGTACTGCCAGCGTCTCCAGCGAGCGTACAAACTCCCTCCA
+GTGGGCATCCACTTCAGCCAGGTTAGCCAGACACCCGCGCACCACGTTCAGGCAGTATCC
+CAAGCAGGGTTTGCTGGAGGTCAGAGCCTTGCAGTGCGGGCAGTAGCTCATCCTCAGTAG
+GCCACGTCTGCACTCGCGGCTCAGCTGGATGTGATCGGTCGTATTTATGATCTCGATGCC
+CAAATGGAGCGCTTGGAGAAACACGCGAGCAGGTAGAGAAGCATGGGCGATTTGGGACGC
+CAGGCGGATTGGGGCTGCTCCGAACGGTGCTAGATCTTGAGCAGACGAGCGCAGGCATTC
+GGCGTATGGAGGAGACAGACGGGAGTCAATCAGACGCTCGTATATTAAGGGGAAAAGAGC
+GTTGAAGAAGCTCTGAGAGGACTCTTCTAAACTGAGCTGAAAGCCCAGGATGAACAGAGC
+CACTTATGTGAAAAAC
+> Z35725-a875b07.q1c R4953750 uid=11230112
+TGTTAGTCTCTCATGTTACGACCGTTTATCCATCTAAGATGACTATGAAATAGCTGTTCG
+TGGAGGTCTTTTTCAGTGCTTCTTCAGTCCAAAATCTTTCTTTTATTTCCTCTTCCCACA
+GATACCTTCCATTCCCTGCTCTCGTTCACTCTAAATCATACCAACTCACTTTTCGACACC
+ACCTACGAGACAATCTCCCAAGATGCAAGACCACTGGTGTCCACCCTCTTCAATGACCTT
+GATCTCTACCTTCGAGGCGATGATAACGTTTCTGTGGAACACTCGGTTTACAGATTTTAT
+GACAAACTCTTCCCATTGGTGTACCAGCATCTGGTCAATCCTGGCTTGGGTTCACCTGTT
+TCAACCTGGTCTGCCGAAGGAACTGAGTGCCTTCGTGCCACACGGCATGATATCTATCCC
+TTTGGCCATCACCCACAAGAACTTGCTCAAGGACTGTCCAAGGCGCTTGTGGTTGGTCGT
+GCCCTCAGCCGGGCACTGGCAGTCGGTGCAGATGTACTTAACATCACAGAGTCTGTGG
+> Zfish35937-106h01.p1c R5068449 uid=11347891
+GCCAGCTTAGTTTATAAAATGCCGCGGTCTGTTTACTTGTTTATTGTGACGGCTGTTACA
+AATCTTCTCTCTGTTATTCTACAGGCTCAGATCTGCAGGTGTGCCAGCCAAAAGGCCTGA
+CTTGCTGTTCTCGCAAAATGGAGGAGCGTTACCTGCTTATTGCCAAACAGAATATGGAGT
+CTAGCCTTCAGGCCACCAGCGCTCAGCTCAAAGGGCTCATCATCCAGAATGCTGCCCTCT
+TTCAAGGTGAGTGGGTGCTACATTTCTGTTTGTGAAGCCATTTTTGGGTACATTTTTGTC
+ATAAGTTAAACCTTTAGCATCCCCTCGGGCGGAAAGCTGAAATGCTTACAGTCAAGAACA
+CATTAATTCTTAACA
+> zfish41359-578a11.p1c R5151793 uid=11433709
+GGATCTCTACCTTCGAGGCGATGATAACGTTTCTGTGGAACACTCGGTTTACAGATTTTA
+TGACAAACTCTTCCCATTGGTGTACCAGCATCTGGTCAATCCTGGCTTGGGTTCACCTGT
+TTCAACCTGGTCTGCCGAAGGAACTGAGTGCCTTCGTGCCACACGGCATGATATCTATCC
+CTTTGGCCATCACCCACAAGAACTTGCTCAAGGACTGTCCAAGGCGCTTGTGGTTGGTCG
+TGCCCTCAGCCGGGCACTGGCAGTCGGTGCAGATGTACTTAACATCACAGAGTCTGTGGG
+CATGGGACGAGTGTGTGGACGTGCACTAGTGCGCATGTTGTTCTGTCCTCACTGTCGAGG
+ACTGACCCTGATCCGGCCATGTGGAGGCCTATGTCTCAACGTGATGCGAGGTTGCCTGGC
+AGGCGTGGCTGAGCTGGATGCTCCCTGGCGAGACTATGTATCGCTTCTGGAGAAGCTGAG
+TGGGGCATTATCAGAGAGATATGAAGTGGAACTGGGACTTCTACGCATCCGGGAAAGAAT
+TAATGATGCCATCCTCACTGCGCAACTGCACGGG
+> zfish41361-361g04.p1c R5716425 uid=13010525
+GGATCAGGGTGAGTCCACGGCAGTGAGAGCAGTAATGCATGCGTACCAGAGCCCGTGTGC
+ACTCTTTTGATAACCCTGCTGTTTCCGTAATGTTCATCACCTCTGACCCTTCGGCAAGTG
+CCAAGCTGAGCACCCGCCCAGCCCGCAATGCGTCCGCCAGATCTTTTGCCATTGCTTTTG
+GGTGCGGACCAAAGGGGTTTACGTCCTGCCTGGTCATTCGGAGACAGTCACCAAGCTGGT
+TGCCTTCAGAAGCATCTGTCCCAATACTTCCTTCCATACCGGGATTGACAATCTGAGTGT
+GGACCAATGGGAAAAGGCTGTCGAAGAAACAGTGCACAGCAGCTTCCACCGAGACGTTGC
+CGGTGCCCTGGAGGAAGCGAGAGAGGTCCGTGAAGAGGCAGACGATGTGAGGGGAGATGG
+ACGACATGAGGGATGAGTATGTGGTCTCAAACAGAGAGGTCAGGTGGTTCTGGGAGAAGG
+ATATTAGGGACTGGAACGTATCTGAAAAAGAAGAAAGATTTAAATGAGTGATAATGATAG
+AATGATCAGTGGTCTTA
+> Zfish37251-3543e11.p1k R6248149 uid=14053707
+TGAATGTGTGCGTGCTGTCATGAAGCAGACGTATTGTCCTCACTGTAGTGGCGTGGCCTT
+GGCCAAACCCTGCTCAAACTACTGTCGAAATGTCTTAAAAGGCTGCCTCGCCAATCAAGC
+AGACCTGGACACTGAGTGGAGGAACCTTGCAGGTGGGCGGGACCAATAAACAACTCTATT
+TGCTTAAGTCTGACATCAAAAGTCACTGTTTCTTGGTACAAAAGCTCTAGCAGATGCCAA
+AAGCAAACAACAAATTTAACAAAGCAGATTTTATAGTAGAATAACTATATATACACCAGG
+GGTTTCAAACTGTGGGGCTTGCCAGCACCTATTAAGAGGGACGCGAGACATTGAGGCGTG
+CACTTGAGTAAATTATGATGTCGATTTTTATGCGTTTACTAGATGGAATAAAACGATTTA
+TGTTAGCTCCACAGCTAATTATTAGGCACCTGTAGAGTTAATGTGTTCCAGTAAAATATA
+TACAAATAAAATGGAAAGAGTGCTTTTTAAAACTAATGACGGTGAATAAATGAAAGTCAA
+ACCGCTGAGCCATCTGACAAAAAAGTGCCCTTCTGAATCAAATCAGGAGAATGCCCATTT
+GGATCTTTCACGTACTTTGAAGATACTGACTACATTTACATGGACA
+> Zfish44625-1002a03.p1c R6638209 uid=14456113
+CTAATTAACATGCAGCTATATAGTGGATAGGTCAGTGTTTCCCAACCTCTTCCTATACAA
+ACACACTTGAATGAACTCATCAGATCAGTAAAAGAGACTCCAAAACCTTGAATGGATAAG
+GGAGACTAAGTACTGTTGTATAGGTATAGGTGATGAACAAGTATAGGTGATGTCTATGTG
+TGCATGTTCAATTGAGTGTATTTGTGTATTAAGTGTTGTTTTTTTACATTGCCACTTTAG
+ATAACAAATAATATTTGTTCTTTTTCAGGTTCAGACCTGCAGGTTTGCTTATCCAGGAAT
+CTAACATGCTGCACCAAAAAGATGGAGGAGCGTTACCAGGTGGCGGCCCGGCGGGATATT
+CAAAACCTTCTCCAGATCTCTAGCTCCAGCCTAAAGTTCCTCTTCTCACGAAATGTGGCC
+GCTTTCCAAGGGTGGTGCGCTGGTTAATCATGCTTGGGTGGTTTATCTACAGCCTTGGTG
+AAGCTGGTAGTTTGCGGTACTCTTGTTTAGTATGAT
+> Zfish44625-1390e06.q1c R6738044 uid=15058223
+ATTAACATGCAGCTATATAGTGGATAGGTCAGTGTTTCCCAACCTCTTCCTATACAAACA
+CACTTGAATGAACTCATCAGATCAGTAAAAGAGACTCCAAAACCTTGAATGGATAAGGGA
+GACTAAGTACTGTTGTATAGGTGTAGGTGATGAACAAGTATAGGTGATGTCTATGTGTGC
+ATGTTCAATTGAGTGTATTTGTGTATTAAGTGTGGTTTTTTTACATTGCCACTTTAGATA
+ACAAATAATATTTGTTCTTTTTCAAGTGCAGACCTGCAGGTGTGCTTATCCAAGAATCTA
+ACATGCTGCACCAAAAAGATGGAGGAGCGTTACCAAGTGGCGGCCCGGCGGGATATTCAC
+AACCTTCTCCAGATCTCTAGCTCCAGCCTAAAGTTCCTCTTCTC
+> Zfish44625-1404f05.p1c R6760679 uid=15081343
+CTAAATCTGTCAACCCATAAATCTAGCCTCAATCAATCCATAATTCTATCAAGCAATGCA
+TCCCTCCGTCCATCAATCCATCCGTCATAATCATTGTGTCTGAAGACTGTTTTATGATGC
+ATCTGTGCTTTTGTTAATTGTGCTGTAGTTTACATACAGAACAGCCAAGCATACAGGTTA
+CTGACCTCATCAAAACCCCGTGTAAATGTGTGTGTGCTCTAGGTGTGTGTGTTCCTCTTA
+CCGATATATTTGCTCCATTCGTTGTTGAGATCGGCCTGGTTTGCCAAGCAGCCCTTCATG
+ACATTCAGACAGTAGTTTCTGCATGGCTTCAATGTGAACAGACCCTGACAATACTAGCAG
+TAGAGCATCTTCCTGAAGCCGCTGACACACGACGAGCTCATGCTGACCTGCGCACACACA
+CACGCGGCAATAATACAACAGTCACCACACTACTTGTAGTGACGCTACAGCCTGACACTG
+GATGTCTCATAGTTTTGATTCG
+> Zfish44625-2317e06.q1c R6844006 uid=15166521
+CCCAAGGGGAGAGGTGCTGAACATTACCGAAACAGCAAGGGTATCAAAAGAGTGCACACG
+GGCTCTGGTACGCATGCATTACTGCTCTCACTGCCGTGGACTCACCCTGATCCATGCGTG
+CAGCAACTACTGTCTTAATGTCATGCCCGGGTGCCTGGCGAGCTACTCGGAGCTCCACCA
+TCCCTGGAGACAGTGTGTCACCATATTGCACGAGCTGACGCAAATGGGTGCCGGAGCTCA
+CAATTTAAAGCTGGCCTTACTGGGGATC
+> Zfish44625-3247c04.q1k R7150552 uid=15478788
+CATTACAATATAATATTAAAAATTAAATATTCATTATTGATTATTAAAGAATTTTATTCC
+ACCCATATTTTGACAAAATTATATTCTGAAAAAATAATAAAGTAGCCAACTTGGTTGCCT
+TTAATAATGTGCTGAAAATAAAACCCAAAATATTAAGTCATTCTAAATGGGAAACTATGC
+ATGCTTGCATGTACCTGGAATTATTGAGAAGACTTAATTTTTTTATTATGTGAGACAACT
+TTCAAAACTTTAATCCTTTACTAATAAACTTTTTTCTACTCTATTATTTCTTTCAGAAAG
+CGTGGAGTCTCTGGAGCGTCAGGCGGAGAACCACACCCTCTCCATCCTCCATCAGTCCCA
+GCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTTTTTCACAGAAGTGGC
+TCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTTCTTCAACGC
+TCTTTTCCCCT
+> zfish44906-116d04.p1k R7346283 uid=16179416
+CGAAGGCAACCAGCTTGTTGACTGTCTCCGAATGACCAGGCAGGACGTAAACCCCTTTGG
+TCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGGGCTGGGCGGGTGCT
+CAGCTTGGCACTTGCCGAAGGGTCAGAGGTGATGAACATTACGGAAACAGCAGGGTTATC
+AAAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCACTGCCGTGGACTCAC
+CCTGATCCATGCGTGCAGCAACTACTGTCTTAATGTCATGCGCGGGTGCCTGGCGAGCTA
+CTCCGAGCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGCAGGACCTCACGCAAAT
+GGTTGCCGGAGCTCACAATTTAGAGCTGGCCTTACTGGGGATCAGAGGTCAGGTCGAGGA
+GGCCATACTCTACGCTCAGCTTCACGGGCCCAGGCTAACTGCCACAGTGAGTACTAGCAT
+TTTTACGCTTTTACAGCTAGCATTAGCTTGTATTGTAGCATGAA
+> zfish44906-511d11.q1k R7357843 uid=16191300
+CCCTGATCCGGCCATGTGGAGGCCTATGTCTCAACGTGATGCGAGGTTGCCTGGCAGGCG
+TGGCTGAGCTGGATGCTCCCTGGCGAGACTATGTATCGCTTCTGGAGAAGCTGAGTGGGG
+CATTATCAGAGAGATATGAAGTGGAACTGGGACTTCTACGCATCCGGGAAAGAATTAATG
+ATGCCATCCTCACTGCGCAACTGCACGGGCCACATCTTAGCGCCGTGGTGAGTCATGCTA
+CTCTCTGATTCATAGAACACATTTATTTTTATTACACGAACGAGCTGCACCATGTGTTGG
+ACTAATCAATTCTAGTGGGGGTGCACTTGAAGCAGCATGTTTGGTGACTGGTGCATATCA
+AATGTCTCGACCAATCGTAGTCTGTGCAGTTACAAGGCTGCCGTTTTGCACATTTAAGAC
+GTTTTGGCTTTAATCTAAAATAAATAACTTGTATAAATTCGCATTTTAGCCTAAAGTTTT
+CAGTTCTAAATTGTGTAAAACAAAGCCCTATGATTATTCTATCT
+> zfish44907-178g11.q1k R8009313 uid=17356982
+TACACACACACACACACACACACACACACACACACACACAAACACACACACACACACACA
+CACTATAATCTGCTGGTTTGCTCCATAGAACTCCATATAAAAGCCAGAAACTTGTATGAT
+AGGCCTATATAAAGGGTTAATGGTGACAACTGATGATCAACAGTAAAACTTAAACATTTG
+ACCTCTTCCCAACAGGAAAACCAACAATAATCAAGAATGCATAATTATATGTCTTGGCTT
+TGTAATCAAAAAATGTGATTATGATGGAAGTCAATGGGGCAAAAACAGCCACCAACATAA
+TGAAGGGGTAGTCAATTTGAACAGCAGAGAAGGATTAAGACCACTGATCATTCTATCATT
+ATCACTCATTTAAATCTTTCTTCTTTTTCAGATACGTTCCAGTCCCTAATATCCTTCTCC
+CAGAACCACCTGACCTCTCTGTTTGAGACCACATACTCATCCCTCATGTCGTCCATCTCC
+CCTCACATCGTCTGCCTCTTCACGGACCTCTCTCGCTTCCTCCAGGGCACCGGCAACGTC
+TCGGTGGAAGCTGCTGTGCACTGTTTCTTCGACAGCCTTTTCCCATTGGTCCACACTCAG
+ATTGTCAATCCCGGTAT
+> zfish44907-380d11.p1k R8011488 uid=17359188
+CAGGAAGTATTGGGACAGATGTTTCTGAAGGCAACCAGCTTGGTGACTGTCTCCGAATGA
+CCAGGCAGGACGTAAACTCCTTTGGTCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGG
+ACGCATTGCGGGCTGGGCGGGTGCTCAGCTTGGCACTTGCCGAAGGGTCAGAGGTGATGA
+ACATTACGGAAACAGCAGGGTTATCAAAAGAGTGCACACGGGCTCTGGTACGCATGCATT
+ACTGCTCTCACTGCCGTGGACTCACCCTGATCCATGCGTGCAGCAACTACTGTCTTAATG
+TCATGCGCGGGTGCCTGGCGAGCTACTCCGAGCTCCACCAGCCCTGGAGACAGTATGTCA
+CCATATTGCAGGACCTCACGCAAATGGTTGCCGGAGCTCACAATTTAGAGCTGGCCTTAC
+TGGGGATCAGAGGTCAGGTCGAGGAAGCCATACTCTACGCTCAGCTTCACGGGCCCAGGC
+TAACTGCCACAGTGAGTACTAGCATTTTTACGCTTTTA
+> zfish44907-1567g01.p1k R8325036 uid=18178525
+CCACCAGACTGAAAAATTCTTCCAACAGACAAAAATCCTTGGGAAAACATGAGCTTTGAA
+AATTAAATGTGACCTTAAGCTATTCCAAATTATTTATCAGGCTATACTCATTCCCTTGTG
+CGCTCATTTTTATTTACACATGCCATGTACCTTGGCAAGGCTCCAAAGTAACCACAATGA
+TGTGGAACAGTTATTCTGCACCGCTGCAAGCATACAGAAGAACTATTAATCTTAGTTTAC
+ATGTCTGCAAACTGAATGACGCCACCTAATGAACTTACTCACGTTTTAATGAACATCAAT
+GCCCTTACTTTGAGCTGTAGGAGTCCACAATGAAGGAATGTAGAGGTTACATCGCATCAA
+TGCTCCCACAAATGAATTACTCACTTGTCTGTCATCTCCTGTCCGTTCCAGCAGAGGGAG
+CTGTTCAGCGATGTCGGCTCTTTGCTGCACAAAGCTTCTCCGAGAACACTGTAGAACTGA
+CTGAAGCCCCTTAGACCCGAGATAAACTCCCTGCATCAGACAGAGAGGAAATTGAGAATG
+TATTGAGTGC
+> zfish44907-916g10.p1k R8340556 uid=18194364
+CTATCCTTCTCCCGAACACCTGACCTCTCTGTTTGAGACCACATACTCATCCCTCATGTC
+GTCCATCTCCCCTCACATCGTCTGCCTCTTCACGGACCTCTCTCGCTTCCTCCAGGGCAC
+CGGCAACGTCTCGGTGGAAGCTGCTGTGCACTGTTTCTTCGACAGCCTTTTCCCATTGGT
+CCACACTCAGATTGTCAATCCCGGTATGGAAGGAAGTATTGGGACAGATGCTTCTGAAGG
+CAACCAGCTTGGTGACTGTCTCCGAATGACCAGGCAGGACGTAAACCCCTTTGGTCCGCA
+CCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGGGCTGGGCGGGTGCTCAGCTT
+GGCACTTGCCGAAGGGTCAGAGGTGATGAACATTACGGAAACAGCAGGGTTATCAAAAGA
+GTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCACTGCCGTGGACTCACCCTGAT
+CCATGCGTGCAGCAACTACTGTCTTAATGTCATGCGCGGGTGCCTGGCGAGCTACTCCGA
+GCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGC
+> zfish44907-2086c11.p1k R8504949 uid=18361907
+CATCAGGCTATACTCATTCCCTTGTGCGCTCATTTTTATTTACACATGCCATGTACCTTG
+GCAAGGCTCCAAAGTAACCACAATGATGTGGAACAGTTATTCTGCACCGCTGCAAGCATA
+CAGAAGAACTATTAATCTTAGTTTACATGTCTGCAAACTGAATGACGCCACCTAATGAAC
+TTACTCACGTTTTAATGAACATCAATGCCCTTACTTTGAGCTGTAGGAGTCCACAATGAA
+GGAATGTAGAGGTTACATCGCATCAATGCTCCCACAAATGAATTACTCACTTGTCTGTCA
+TCTCCTGTCCGTTCCAGCAGAGGGAGCTGTTCAGCGATGTCGGCTCTTTGCTGCACAAAG
+CTTCTCCGAGACCACTGTAGAACTGACTGAAGCCCCTTAGACCCGAGATAAACTCCCTGC
+ATCAGACAGAGAGGAAATTGAGAATGTATTGAGTGCAGGCGAAAGAAGAAAGAGGAATGG
+GCTTCAGTGAAAATTGAAATTAGATGGTGTGCACAAAGAGACAAGATTAAGAATCCAAAA
+TACTTGGATTTATGAGAAAATGTAGAGGCTTAGAGAAAGAAGAACGACGAATCAGGAGAA
+AAAAATAGAGTTGGGGTCAAATGCAGTGTTAAGCACGATCTACTCCATTACATATCATTT
+CCTGTCGGGCTAAGTTGCTTTGAGATGCTTTGATTTTAATTGACATTACCTACACACACT
+CTCTCACCTGCTCATCAGAGCGAGGGAACGAGAGAGAGGAACCGTGCAGGACAGAGGGGG
+CAGAAGGCAGCTCAATGTCACTCACACGGCAGGAGACAAAGCCTGTGTTAATGAGCTTCT
+CTCTGTCACCATCAGCCTGAACACACACTTACCTCAGCTAACAGCCCAAACACACAAACA
+CAACTCATACACAAACTGCCACACACAACGACTCAGACACCCACCTACTCAGACATGTGC
+CACCTCAAAGTTTGAAAGCAACTTCCCTTAGTAACTATGTTTTAGATGATTCAT
+> zfish44907-2216h07.p1k R8522644 uid=18379866
+CGCAACAACTCAAACAGTCTCATTTCCAGTATTGTTTAAATAAAGAATACATAAAATAAT
+AAATAAAATAAAGTGTTTTTGATTGAAAAAAGGCACCCAACTGGAAGTTCTTTATAGGGG
+ACATCTATATTAGAAAACCCAGCTTAAGGTACAATAGCAAGCGCATCTCACCAATAAAGA
+GGTTCCACTCAGGGTCCAGATCCGCTTGGTTGGCCAGGCAGCCGCGCATCACATTCTGGC
+AGTAGTTGGCGCAGGGTTTGAGTCCTGACATTCCTCCACAATACGGGCAGTACCACATTT
+TAGTCAATGCTTTACTGCAGCCTGGAGAAATATTGACCTGCAGGATAAACACACATGGGC
+AGATGTTAAATGTGCTTTGAAATGTGCATTTTTTTTTATTTAAAGTTTGACGTAATCCCA
+ACTGAAACATAAAGAGAGAGCAGGACATACAGTAGCTCCTCCCAAAAAACAGCCAATATA
+GTTTCATTTTTTATCACAGCCTTGCCAGTGACAGGGACTGTACCTGTATGCCTACAACTG
+ATGTCAAAATTATTCGCCCTCCTGTGATTTTGTTTTACTTTTTCAAAT
+> zfish44907-3109g10.p1k R8594759 uid=18453141
+CCTGTTTGAGACCACATACTCATCCCTCATGTCGTCCATCTCCCCTCACATCGTCTGCCT
+CTTCACGGACCTCTCTCGCTTCCTCCAGGGCACCGGCAACGTCTCGGTGGAAGCTGCTGT
+GCACTGTTTCTTCGACAGCCTTTTCCCATTGGTCCACACTCAGATTGTCAATCCCGGTAT
+GGAAGGAAGTATTGGGACAGATGCTTCTGAAGGCAACCAGCTTGGTGACTGTCTCCGAAT
+GACCAGGCAGGACGTAAACCCCTTTGGTCCGCACCCAAAAGCAATGGCAAAAGATCTGGC
+GGACGCATTGCGGGCTGGGCGGGTGCTCAGCTTGGCACTTGCCGAAGGGTCAGAGGTGAT
+GAACATTACGGAAACAGCAGGGTTATCAAAAGAGTGCACACGGGCTCTGGTACGCATGCA
+TTACTGCTCTCACTGCCGTGGACTCACCCTGATCCATGCGTGCAGCAACTACTGTCTTAA
+TGTCATGCGCGGGTGCCTGGCGAGCTACTCCGAGCTCCACCAGCCCTGGAGACAGTATGT
+CACCATATTGCAGGACCTCACGCAAATGGTTGCCGGAGCTCACAATTTAGAGCTGGCCTT
+ACTGGGGA
+> zfish44907-3066f07.p1k R8744180 uid=19104873
+CCACTCGTTCGGGTCTGCTGACACTGACTTTGCTGACAAGTCTTTGGAGGTTGAGTTTTG
+GAGAGAGATGGCGTTAGCAAAAATGGCTGAAGTTAGCAAAATGGCTGCAGTCGCCTACAG
+CATTCGAATTCATACCTTGTTTCTGAGACCATGTGTCACTCACCTGGGCGCTGACTTTGC
+TCTTGCTTGCCACGGCTTGTTTGAGAGCCTGTCTGATAATGACATGCAGTCGGAGCACCA
+CAGCCTCGATGTCCTGTTCCCCCTTCATGGCAGCGGCGAGTGACCCCAGTTCATCCACAT
+ATGCTCTCCAATGAGGCTGTACCTCCGTGGTTCCCCCCAAACATGCTCCCATGGTGCTGA
+CACACAGTGGACGGCACGGCCGGGCCTCCAGCAGGCTTTGACAGTGCGGGCAGTACCACA
+GTTTCAGAAGTGAGCGCCCACAATCTCTACCTGCCCGCAAATGCTGAGTGGTGTTGACCA
+CTTCTATGCCCAAATTCAGCGCTTGCAGGAAGACCCGAGTGGCCAGGAGTGAGCGGGACA
+GTCGGGTCATCATCATCTTGGGAAATGACCCATAAGCAGAGCTCCCTTTCCAGGCCCCGC
+GGAGGCATTCTTCAGAGATGCCCGCCACGGCCCCATTGC
+> zfish44908-398f07.q1k R9012328 uid=19376854
+TTTTGGAAGTTTTACTGCAGAGCAACACAGCGCGCAGAAGTATAAATGCATGACTACATG
+CTAGGCAGGCACCGTGGGTCACGACAATCACTCGACGCAGAAGTATAAACCAGCCTTGAG
+AGTTCTAGTGTTATAAGCCCTACCTATGAGGCTCTGCCACTCAGTGTCCAGGTCAGCCTG
+ATTAGCCAGGCAGCCCTTCATCACATTTTTGCAGTAGTTGATGCAAGGTTTGACTGATCC
+CAGACCTCTGCAATGAGGGCAGTACACCAGTTTCATAATGGCACGATTGCACTCTGGGCT
+CAGTGGGACCTGTGGAAAGAGTGACCATTGCCAAGGGTTCATTTTTTTTAAGATAACAAT
+ATTAAGTTAAACAGTAACCATGGCATTTATCAGTGAGCAAGGCAATTAACTCAGTATATC
+TTCAGGGAAGCTGTCCTGATAAAAAAAAAAAACACTGGAAGTTGAAATAAGAGCACTGGT
+AAACACACTAGATGCGAGTTAGCTTGATTTACTGAATTGTACCTGCTTATTACCTGCATG
+TTGATTCAGGTCATCTACTTCAAACTTTGA
+> zfish44908-1076a02.p1k R9148204 uid=20014565
+CCGCCCATCACAGAGCATTTTTTTTTTAATTCTGTGGTAGACTTGACTCGAAAGAGGGGG
+ATGTCATGGCCCTTTAAAATGGGACAAAAAACTGCTTTTATTCTAGCAGTTATAAAAAAT
+AAAACAAAGACTTAATAGAAGATATATTGTAGAAAATATCATTGGAGACACTGTAAAAAT
+TTCCTTGCGCTGTTAAACATCATTTGGGAAACATTTGAAAAAGTAAAACAAAATCACAGG
+AGGGCGAATAATTTTGACATCAGTTGTAGGCATACAGGTACAGTCCCTGTCACTGGCAAG
+GCTGTGATAAAAAATGAAACTATATTGGCTGTTTTTTGGGAGGAGCTACTGTATGTCCTG
+CTCTCTCTTTATGTTTCAGTTGGGATTACGTCAAACTTTAAATAAAAAAAAATGCACATT
+TCAAAGCACATTTAACATCTGCCCATGTGTGTTTATCCTGCAGGTCAATATTTCTCCAGG
+CTGCAGTAAAGCATTGACTAAAATGTGGTACTGCCCGTATTGTGGAGGAATGTCAGGACT
+CAAACCCTGCGCCCACTACTGCCAGAATGTGATGCGCGGCTGCCTGGCCAACCAAGCGGA
+TCTGGACCCTGAGTGGA
+> zfish44910-670h12.p1k R9786312 uid=21170218
+CTATATATATATATAATGTGTAGATTATGACACTAATGATGATAATAATAATAATAATAA
+TAATAATAATAATAATAATAATAATATCAATATTAATATAATATTAATATTAATATTAAT
+AATAATAACAATAATAACTACTACGTTTTTTTTTTTTTTTGTAATTATTTAAAATATATA
+TACACATGCTCAAATTACATATTTTTTTTACATCAGTATTTCTCTGTTTTTCCAGAGTTT
+TTCCTGGAGTTGCTGGACAACTCTGAGAAGTCTCTAAACGACATGTTTGTGCGCACATAT
+GGCAAACTCTACACACACAACTCGGAGATGTTCGAGGACCTGTTCTCAGAGCTGAAGCGC
+TACTACACCGGTGGGAACGTCAACCTGGAGGAGGTGCTGAATGACTTCTGGTCGCGTCTG
+CTGGAGAGAATGAGCCAGCTGCTCAACTCGCAGTTCACCTTCAGCGACGACTATCTGGAG
+TGCATCAGCAAATACACTGACCAGCTCAAGCCGTTCGGAGACGTGCCGCGAAAACTCAAG
+GCGCAAGTCACCAAAGCTTTCATCGCGGCCAGATCCTTCGTCCAGGGACTTATGGTGGGC
+CGAGAAGTGGCCAACAGGGTGGCCAAGGTAAGATCTTTAATGAGATGTGGATGATAT
+> zfish44909-1485f11.q1k R9993558 uid=21414183
+CATTCACTAAACAAGACGTTCCTGTCAATGTGTTGACTGCATTTCTGTTCATCCGTGTCT
+CTTTCATCCAACCCACACAGGGAGTTTCACTGTTTCAGACTTTAAATGGACAGATTTTGC
+ATAGCAGGAATCTCCTGGGGTCCGTCTTTACCGAGATGTTCTTCCTGATTATCTTGTTTT
+CCTTTTAATGAGTGTTTGTTCTCTGCTAATCATTTTGGCACAAGGCAACAAGATGAAATG
+CAATGCGTGGAAATGAAATTAAATAACATGTTTCGATTAAGTTGCAGATATTTGTTTTGT
+GGCGTTTTTTGAAATTTGTACAAGTAACGTAAACAATGTGTACTCTATAAAACAAACCAT
+TTTCTGCAGCTCTCTTTGTTTTCGATTTACAAGCCAAGCTTCAGTTTATAAAATGCCGCG
+GTCTGTTTACTTGTTTATTGTGACGGCTGTTAGAAATCTTCTCTCTGTTATTCTACAGGC
+TCAGATCTGCAGGTGTGCCAGCCAAAAGGCCTGACTTGCTGTTCTCGCAAAATGGAGGAG
+CGTTACCTGCTTATTGCCAAACAGAATATGGAGTCTAGCCT
+> zfish44909-1711d01.p1k R10007900 uid=21431124
+CCTAATCAACCAAGCAACAAAGTGTCCAAGCAACCCCTCGACCAATCAACCAATAAACTT
+ACTAACCAACCTACCAACCGTTGAATCAATCAATCAATCAATCAATCAATCAATCAATCA
+ATCAATCAATCAATCAATCAATCAATCAATCAATCATTCAATCAATCAATCAATCAATCA
+ATCAATCAATCAACCAATCAATCAATCAATCAACCAATCAATCAACCCATCAATCAATCA
+ATCAATCAATCAATCAATCAGTCAAACACAAAATAAACTTGAGCAACAACTCAAACAGTC
+TCATTTCCAGTATTGTTTAAATAAAGAATACATAAAATAATAAATAAAATAAAGTGTTTT
+TGATTGAAAAAAGGCACCCAACTGGAAGTTCTTTATAGGGGACATCTATATTAGAAAACC
+CAGCTTAAGGTACAATAGCAAGCGCATCTCACCAATAAAGAGGTTCCACTCAGGGTCCAG
+ATCCGCTTGGTTGGCCAGGCAGCCGCGCATCACATTCTGGCAGTAGTTGGCGCAGGGTTT
+GAGTCCTGACATTCCTCCACAATACGGGCAGTACCACATTTTAGTCAATGCTTTACTGCA
+GCCTGGAGAAATATTGACCTGCAGGATAAACACACATGGGCAGATGTTAAATGTGCTTTG
+AAATGTGCATTTTTTTTTATTTAAAGTTTGACGTAATCCCAACTGAAACATAAAGAGAGA
+GCAGGACATACAGTAGCTCCTCCCAAAAAACAGCCAATATAGTTTCATTTTTTATCACAG
+CCTTGCCAGTGACAGGGACTGTACCTGTATG
+> zfish44909-2083g05.p1k R10096558 uid=22037338
+CTAATTAACATGCAGCTATATACTGGATAGGTCAGTGTTTCCCAACCTCTTCCTATACAA
+ACACACTTGAATGAACTCATCAGATCAGTAAAAGAGACTCCAAAACCTTGAATGGATAAG
+GGAGACTAAGTACTGTTGTATAGGTATAGGTGATGAACAAGTATAGGTGATGTCTATGTG
+TGCATGTTCAATTGAGTGTATTTGTGTATTAAGTGTTGTTTTTTTACATTGCCACTTTAG
+ATAACAAATAATATTTGTTCTTTTTCAGGTTCAGACCTGCAGGTTTGCTTATCCAGGAAT
+CTAACATGCTGCACCAAAAAGATGGAGGAGCGTTACCAGGTGGCGGCCCGGCGGGATATT
+CAGAACCTTCTCCAGATCTCTAGCTCCAGCCTAAAGTTCCTCTTCTCACGAAATGTGGCC
+GCTTTCCAAGGTTGGTGCGCTGGTTAATCATGCTTGGGTGGTTTATCTACAGCCTTGGTG
+AAGCTGGTAGTTTGCGGTACTCTTGTTTAGTATGATGTCAGTTTGTCTCCA
+> zfish45283-1667d08.p1k R10515069 uid=23005902
+CTAAAATAAGATTTATCACCAAAAAAACGTTTGTCACCATTCTGCTAGCTGAAACAAAAA
+AAGTTAAGACCAAAATAACATTCAAAACCACCCCAGAGTGGATGAAAACATCCCCAGCAA
+CACATAAGAGTTACCATATGATACCACTATGGATCCTCTTGGTTCTAATGCATGCTCTTT
+TAAGTATAAAAGTGTACCTTTTAAAAGGGTACCACCCCAGTGACAGGTTTCATACATTTC
+TGAGAGTGTGTTAAGAATTAATGTGTTCTTGACTCTAAGCATTTCAGCTTTCCGCCCAAG
+GGGATGCTAAAGGTTTAACTTATGACAAAAATGTACCCAAAAATGGTTTCACAAACAGAA
+ATGTAGCAGAAACTCACCTTGAAAGAGGGCAGCATTCTGGATGATGAGCCCTTTGAGCTG
+AGCGCTGGTGGCCTGAAGGCTAGACTCCATATTCTGTTTGGCAATAAGCAGGTAACGCTC
+CTCCATTTTGCGAGAACAGCAAGTCAGGCCTTTTGGCTGGCACACCTGCAGATCTGAGCC
+TGTAGAATAACAGAGAGAAGATTTCTAACAGCCGTCACAATAAACAAGTAAACAGACCGC
+GGCATTTTATAAACTGAAGCTTGGCTTGTAAATCGAAAACAAAGAGAGCTG
+> a-37250859e01.p1c R10615637 uid=23108019
+AAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCACTGCCGTGGACTCACC
+CTGATCCATGCGTGCAGCAACTACTGTCTTAATGTCATGCGCGGGTGCCTGGCGAGCTAC
+TCCGAGCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGCAGGACCTCACGCAAATG
+GTTGCCGGAGCTCACAATTTACAGCTGGCCTTACTGGGGATC
+> zfish43795-610h09.p1c R10634329 uid=23127136
+GGATCCATGGATTAAGTGTTGTCAGCTCCCATTAGCCCAATGGAAAGAGAGATTAGATAC
+ACAAGAAAGAGTCGTAAGCAATGCGAGACAAGGCAGAGGTGCACCATGACAGACTAGTAT
+CTTTGACCCTCTCGTAAATGTCAAACAAAATTACAGCAATTGTTAGTCTCTCATGTTACG
+AATGTTTATCCATCTAAGATGACTATGAAATAGCTGTTCGTGGAGGTCTTTTTCAGTGCT
+TCTTCAGTCCAAAATCTTTCTTTTATTTCCTCTTCCCACAGATACCTTCCATTCCCTGCT
+CTCGTTCACTCTAAATCATACCAACTCACTTTTCGACACCACCTACGAGACAATCTCCCA
+AGATGCAAGACCACTGGTGTCCACCCTCTTCAATGACCTTGATCTCTACCTTCGAGGCGA
+TGATAACGTTTCTGTGGAACACTCGGTTTACAGATTTTATGACAAACTCTTCCCATTGGT
+GTACCAGCATCTGGTCAATCCTGGCTTGGGTTCACCTGTTTCAACCTGGTC
+> Zfish37251-2879h11.p1c R10656134 uid=23149309
+CCATCTAAGATGACTATGAAATAGCTGTTCGTGGAGGTCTTTTTCAGGGCTTCTTCAGTC
+CAAAATCTTTCTTTTATTTCCTCTTCCCACAGATACCTTCCATTCCCTGCTCTCGTTCAC
+TCTAAATCATACCAACTCACTTTTCGACACCACCTACGAGACAATCTCCCAAGATGCAAG
+ACCACTGGTGTCCACCCTCTTCAATGACCGGGATCTCTACCTTCGAGGCGATGATAACGT
+TTCTGTGGAACACTCGGGTTACAGATTTTATGACAAACTCTTCCCATTGGTGTACCAGCA
+TCTGGTCAATCCTGGCTTGGGTTCACCTGTTTCAACCTGGTCTGCCGAAGGAACTGAGTG
+CCTTCGTGCCACACGGCATGATATCTATCCCTTTGGCCATCACCCACAAGAACTTGCTCA
+AGGACTGTCCAAGGCGCTTGTGGTTGGTCGTGCCCTCATCCGGGCACTGGCAGTCGGTGC
+AGATGTACTTAACATCACAAAGTCTGTGGGCATGGGACGAGTGTGTGGA
+> zfish45283-535c05.q1k R10711745 uid=23214173
+TATTGTTTAAATAAAGAATACATAAAATAATAAATAAAATAAAGTGTTTTTGATTGAAAA
+AAGGCACCCAACTGGAAGTTCTTTATAGGGGACATCTATATTAGAAAACCCAGCTTAAGG
+TACAATAGCAAGCGCATCTCACCAATAAAGAGGTTCCACTCAGGGTCCAGATCCGCTTGG
+TTGGCCAGGCAGCCGCGCATCACATTCTGGCAGTAGTTGGCGCAGGGTTTGAGTCCTGAC
+ATTCCTCCACAATACGGGCAGTACCACATTTTAGTCAATGCTTTACTGCAGCCTGGAGAA
+ATATTGACCTGCAGGATAAACACACATGGGCAGATGTTAAATGTGCTTTGAAATGTGCAT
+TTTTTTTTATTTAAAGTTTGACGTAATCCCAACTGAAACATAAAGAGAGAGCAGGACATA
+CAGTAGCTCCTCCCAAAAAACAGCCAATATAGTTTCATTTTTTATCACAGCCTTGCCAGT
+GACAGGGACTGTACCTGTATGCCTACAACTGATGTCAAAATTATTCGCCCTCCTGGGATT
+TTGGTTTACTTTTTCAAATGTTTCCCA
+> zfish43929-176n20.q1k R10904360 uid=23421921
+CACCTGTTTCACCTGGTCTGCCGAAGGAACTGAGTGCCTTCGTGCCACACGGCATGATAT
+CTATCCCTTTGGCCATCACCCACAAGAACTTGCTCAAGGACTGTCCAAGGCGCTTGTGGT
+TGGTCGTGCCCTCAGCCGGGCACTGGCAGTCGGTGCAGATGTACTTAACATCACAGAGTC
+TGTGGGCATGGGACGAGTGTGTGGACGTGCACTAGTGCGCATGTTGTTCTGTCCTCACTG
+TCGAGGACTGACCCTGATCCGGCCATGTGGAGGCCTATGTCTCAACGTGATGCGAGGTTG
+CCTGGCAGGCGTGGCTGAGCTGGATGCTCCCTGGCGAGACTATGTATCGCTTCTGGAGAA
+GCTGAGTGGGGCATTATCAGAGAGATATGAAGTGGAACTGGGACTTCTACGCATCCGGGA
+AAGAATTAATGATGCCATCCTCACTGCGCAACTGCACGGGCCACATCTTAGCGCCGTGGT
+GAGTCATGCTACTCTCTGATTCATAGAACACATTTATTTTTATTCCACGAACGAGCTGCA
+CCATGTGTTGGACTAATCAGTTCTAGTGGGCATGCACTTGAAGCAGCATGTTTGGTGACT
+GGTGCATATCAAATGTCTCGACCAATCGTAGTCTGTGCAGTTACAACGCTGCCGTTTTGC
+ACA
+> ZfishFos603c08.p1k R11026409 uid=24052126
+CATACACGATAAATGCACTACATAAATACACACAATACATTTCAGCACATTATCACTGTG
+GTGTTGGAATGTAACTAAAATCAAACTTTATAGTTACTCAATCTCTCTTTTCTGTCTTTT
+TTCAGAGGCTTTTGACATGGTGCTTCGTCTGGGCCGTAATTCCACTCTGATGGTGTTACG
+CGAGGAGTTTCCTGGTTTGGGGGCTGGAGCCAGCGGAGCCGTCACGCAGTTATTCCTGGA
+TATGTCACTTTACATTCTGGGCTCTGATGCCAATGTAAACGACATGGTCTCCACCTTCTT
+CTCTCGCCTTTTCCCTCTCACCTACCGTCGACTTCTGGGCAATGGGGCCGTGGCGGGCAT
+CTCTGAAGAATGCCTCCGCGGGGCCTGGAAAGGGAGCTCTGCTTATGGGTCATTTCCCAA
+GATGATGATGACCCGACTGTCCCGCTCACTCCTGGCCACTCGGGTCTTCCTGCAAGCGCT
+GAATTTGGGCATAGAAGTGGTCAACACCACTCAGCATTTGCGGGCAGGTAGAGATTGTGG
+GCGCTCACTTCTGAAACTGTGGTACTGCCCGCACTGTCAAAGCCTGCTGGAGGCCCGGCC
+GTGCCGTCCACTGTGTGTCAGCACCATGGGAGCATGTTTGGGGGGAACCACGGAGGTACA
+GCCTCATTGGAGAGCATATGTGGATGAACTGGGGTCACTCGCCGCTGCCATGAAGGGGGA
+ACAGGACATCGAGGCTGTGGTGCTCCGACTGCATGTCATTATCAGACAGGCTCTCAAACA
+AGCCGTGGCAAGCAAGAGCAAAGTCAGCGCCCAGGTGAGTGACACATGGTCTCAGAAACA
+AGGTATGAATTCGAATGCTGTAGGCGACTGCAGCCATTTTGCTAACTTCAGCCATTTTTG
+CTAACGCCATCTCTCTCCAAAACTCAACCTCCAA
+> ZfishFos424g06.q1k R11064847 uid=24091921
+CTTCTCGGCCCACCATAAGTCCCTGGACGAAGGATCTGGCCTTGATGAAAGCTTTGGTGA
+CCTGCGCCTTGAGTTTTCGCGGCACGTCTCCGAACGGCTTGAGCTGGTCAGTGTATTTGC
+TGATGCACTCCAGATAGTCGTCGCTGAAGGTGAACTGCGAGTTGAGCAGCTGGAACATTC
+TCTCCAGCAGACGCGACCAGAAGTCATTCAGCACCTCCTCCAGGTTGACGTTCCCACCGG
+TGTAGTAGCGCTTCAGCTCTGAGAACAGGTCCTCGAACATCTCCGAGTTGTGTGTGTAGA
+GTTTGCCATATGTGCGCACAAACATGTCGTTTAGAGACTTCTCAGAGTTGTCCAGCAACT
+CCAGGAAAAACTCTGGAAAAACAGAGAAATACTGATGTAAAAAAAATATGTAATTTGAGC
+ATGTGTATATATATTTTAAATAATTACAAAAAAAAAAAAAAACGTAGTAGTTATTATTGT
+TATTATTATTAATATTAATATTAATATTATATTAATATTGATATTATTATTATTATTATT
+ATTATTATTATTATTATTATTATTATCATCATTAGTGTCATAATCTACACATTATATATA
+TATATATATATATATATATATATATATATATATATATATATATATATATATATATAATTT
+GTATATTATGACCACTAATGATGATGATGATGATA
+> zfish43929-321m23.p1k R11386150 uid=24420875
+ATATAGTGGATAGGTCAGTGTTTCCCAACCTCCTTCCTATACAAACCCATTTGAATGAAC
+TCATCAGATCAGTAAAAGAGACTCCAAAACCTTGAATGGATAAGGGAGACTAAGTACTGT
+TGTATAGGTATAGGTGATGAACAAGTATAGGTGATGTCTATGTGTGCATGTTCAATTGAG
+TGTATTTGTGTATTAAGTGTTGTTTTTTTACATTGCCACTTTAGATAACAAATAATATTT
+GTTCTTTTTCAGGTTCAGACCTGCAGGTTTGCTTATCCAGGAATCTAACATGCTGCACCA
+AAAAGATGGAGGAGCGTTACCAGGTGGCGGCCCGGCGGGATATTCAGAACCTTCTCCAGA
+TCTCTAGCTCCAGCCTAAAGTTCCTCTTCTCACGAAATGTGGCCGCTTTCCAAGGTTGGT
+GCGCTGGTTAATCATGCTTGGGTGGTTTATCTACAGCCTTGGTGAAGCTGGTAGTTTGCG
+GTACTCTTGTTTAGTATGATGTCAGTTTGTCTCCAGACATTAGTTGTACAGTACAGTGTT
+GTCAGTGTTTATTTTTCTTTACAACTCAAAATATGTGAT
+> zfish43929-344a15.q1k R11387939 uid=24422711
+CAACGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTCTCCTCCATA
+CGCCGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGCCCCAATCCG
+CCTGGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCAAGCGCTCCA
+TTTGGGCATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGAGTGCAGACG
+TGGCCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAGCAAACCCTG
+CTTGGGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCTGAAGTGGATGC
+CCACTGGAGGGAGTTTGTACGCTCGCTGGAGACGCTGGCAGTACGGATGCACGGAGAGCT
+GGATCTGGAGCACGTGCTGCTGGGGGCGCATGAGCTGGTGAGGGACGCTGTGGCGCACGC
+TCAGAGGAGCACAGCGAGGATACATG
+> zf37276-263e04.p1k R11721867 uid=25282400
+TGGCTACGTGTACATTAAGGTAGCGTTCTTACCTTCTACATGAAGAAACTCTACACAGGA
+TCATAAAAACCTACTGCTAGCTAGCGTTTTGGAAGTTTTACTGCAGAGCAACACAGCGCG
+CAGAAGTATAAATGCATGACTACATGCTAGGCAGGCACCCTGTGGTCACGACAATCACTC
+AACGCACAAGTATAAACCATCCTTAAGAGTTCTAGTGTTATAGGCCCTACCTATGAGGCT
+CTGCCACTCATTGTCCAGGTCAGCCTGATTACCCAGGCAGCCCTTCATCACATTTTTGCA
+GTACTTAATGCAAGGTTTGACTGATCCCAGACCTCTGCAATGAGGGCAGTACACCAGTTT
+CATAATGGCACGATTGCACTCTGGACTCAGTGGGACCTGTGGAAAGAGTGACCATTGCCA
+AGGGTTCATTTTTTTTAAGATAACAATATTAAGTTAAACAGTAACCATGGCATTTATCAC
+TGAGCAAGGCAATTAACTCAGTATATCTTCAGGAAAGCTGTCCTGATAAAAAAAAACACT
+GGAAGTTGAAATAAGAGCACTGGTAAACACACTAGATGCGAGTTAGCTTGATTTACTGAA
+TTGTACCTGCTTATTACCTGCATGTTGATTCAGGTCATCTACTTCAAACTTTGAAGTCTT
+TTGGGAAAAACAGGTATGGAGGGCAGAGTAATCATGCTTGTATATTAGCTGAAGGCATCT
+TCAGTTGAATCGCTTTATTCTGACAGAATGTGAACCTGTCACGCTGCTCA
+> zf37276-272b06.q1k R11879140 uid=25442822
+ACTTTTTCTTTCATATCCGTGAATTTACATTCATTTAAACAACAAGCAAATGTCAAGTTC
+TACTTTCCTTCCCGAACTGCATTGCTTTTCCCTGAGGGACCCTATAAACCCCCACGCTTT
+GACATCAGAGGGGTGGAGGTTCCTGATAAAGAGGAATGATTGTGAAAGACGTCTCAGAGA
+AGCACCATGGGTATTCTTTTGCAAGAGTTGTACCAAACTGTACCATCCCACATCCTTGGA
+CCTCTTGGGAAACTGTACTGACAAGCAATTATTTGCACAGTGCAATTATCGCATATTGTG
+TGTGACACAAAACAATTCACAGGGCTTTTTTTTTCTTGTTAAGTGATTCATTATGGTTGA
+GCTGTTCTTTAAATTGTGTTTTTTGTGTTTTGCAGGTTTCTCTGAGCACTGAATGTGTGC
+GTGCTGTCATGAAGCAGACGTATTGTCCTCACTGTAGTGGCGTGGCCTTGGCCAAACCCT
+GCTCAAACTACTGTCGAAATGTCTTAAAAGGCTGCCTCGCCAATCAAGCAGACCTGGACA
+CTGAGTGGAGGAACCTTGCAGGTGGGCGGGACCAATAAACAACTCTATTTGCTTAAGTCT
+GACATCAAAAGTCACTGTTTCTTGGTACAAAAGCTCTAGCAGATGCCAAAAGCAAACAAC
+AAATTTAACAAAGCAGATTTTATAGTAGAATAACTATATATA
+> ZfishFos1395g12.p1k R11933426 uid=25498032
+TGTGTGTGTGTCTCTCTCTATGTGTCTGTATCTGCGCGCGGGGCCAGAGTGTGTGCGCGC
+GCTCATGCTTCAGTGGTTCTGTCCTCTGTGTCGGGGTCTTCCGTCACTCAAGCCCTGTCA
+TTCGCTGTGCCTGAACATCATGAAGGGCTGTCTGGCCAATCAGGCGGATCTAAACAGCGA
+GTGGAACAGCTTCATTGGTGAGAACAGAACACCTCTGCTTCATTTACTGTGTGTGTGTGT
+GTGTGTGTGTCCGCTGTGTGTGTGTGTGTGTGTGTGTCCGCTGTGTGTGTGTGTGTGTAT
+GTCCGCTATGTGTCTGATGTGTGTGTGTGTGTGTGTGTGTCCCCTATGTGTCTGATGTGT
+GTGTGTGTGTGTGTGTGTGTGTGTGTGTCAGATGTGTGTGTGTGTCTGATGTGTGTGTGT
+GTGTCCTGCAAATGCTCTGACAGTGGTGGTGGAGAAACTCGGCGGGCCGTTTAACTTTGA
+GCTGGCTGCGGACGCCATCGCTGTGACGGTTTCTGAAGGCATCATGAACATGCAAGAGAA
+CAGCATCAGCATCTCTGCTAAGGTGAAGAAAACACACACACACACACACACACACACACA
+CACACACACACACTCTAGAAAATGAACCAAAACAAACACATATGAGGAAGGGTTAGGACT
+ATGTGACACACATATAACACATATGTCATATCAGCTGTATCAGTGAAGCGTTCCCGCTCT
+GTTCTGCTGCCG
+> zf37276-818p14.q1k R12151716 uid=26225825
+TTACATGCAGCTATATAGTGGATAGGTCAGTGTTTCCCAACTTCTTCCTATACAAACACA
+CTTGAATGAACTCATCAGATCTTTAAAAGAGACTCCAAAACCTTGAATGGATAAGGGAGA
+CTAAGTACTGTTGTATAGGTATAGGTGATGAACAAGTATAGGTGATGTCTATGTGTGCAT
+GTTCAATTGAGTGTATTTGTGTATTAAGTGTTGTTTTTTTACATTGCCACTTTAGATAAC
+AAATAATATTTGTTCTTTTTCAGGTTCAGACCTGCAGGTTTGCTTATCCAGGAATCTAAC
+ATGCTGCACCAAAAAGATGGAGGAGCGTTACCAGGTGGCGGCCCGGCGGGATATTCAGAA
+CCTTCTCCAGATCTCTAGCTCCAGCCTAAAGTTCCTCTTCTCACGAAATGTGGCCGCTTT
+CCAAGGTTGGTGCGCTGGTTAATCATGCTTGGGTGGTTTATCTACAGCCTTGGTGAAGCT
+GGTAGTTTGCGGTACTCTTGTTTAGTATGATGTCAGTTTGTCTCCAGACATTAGTTGTAC
+AGTACAGTGTTGTCAGTGTTTATTTTTCTTTAAAACTCAAAATATGTGATTGAGTTCCCT
+GGTGGCTCTCCAAGGGCTTAATTCAGTTCTTTCCTGTGTTAATTTAGGCTTTTCACATAA
+TAGCCTCACTGATGAGCTCTACACTACAATTATTGTTTCGCAATACTCATTTTCTGTCTT
+AAATC
+> ZfishFos2520c02.q1k R12572420 uid=27168929
+AGCTCCCATGAGCCCAAGGGAAATAGAGATTAGATACACAAGAAAGAGTCGTAAGCAATG
+CGAGACAAGGCAGAGGTGCACCATGACAGACTAGTATCTTTGACCCTCTCGTAAATGTCA
+AACAAAATTACAGCAATTGTTAGTCTCTCATGTTACGAATGTTTATCCATCTAAGATGAC
+TATGAAATAGCTGTTCGTGGAGGTCTTTTTCAGTGCTTCTTCAGTCCAAAATCTTTCTTT
+TATTTCCTCTTCCCACAGATACCTTCCATTCCCTGCTCTCGTTCACTCTAAATCATACCA
+ACTCACTTTTCGACACCACCTACGAGACAATCTCCCAAGATGCAAGACCACTGGTGTCCA
+CCCTCTTCAATGACCTTGATCTCTACCTTCGAGGCGATGATAACGTTTCTGTGGAACACT
+CGGTTTACAGATTTTATGACAAACTCTTCCCATTGGTGTACCAGCATCTGGTCAATCCTG
+GCTTGGGTTCACCTGTTTCAACCTGGTCTGCCGAAGGAACTGAGTGCCTTCGTGCCACAC
+GGCATGATATCTATCCCTTTGGCCATCACCCACAAGAACTTGCTCAAGGACTGTCCAAGG
+CGCTTGTGGTTGGTCGTGCCCTCAGCCGGGCACTGGCAGTCGGTGCAGATGTACTTAACA
+TCACAGAGTCTGTGGGCATGGGACGAGTGTGTGGACGTGCACTAGTGCGCATGTTGTTCT
+GTCCTCACTGTCGAGGACTG
+> ZfishFos2880g11.p1k R12646521 uid=27313724
+CACCGACTGCCAGGGCCCTGAAGAGGGCACGACCAACCACAAGCGCCTGGGACAGTCCTT
+GAGCAAGAACTTGGGGGGGAAGGCCAAAGGGATAGATATCATGCCGTGTGGCACGAAGGC
+ACTCAGTTCCTTCGGCAGACCAGGTTGAAACAGGTGAACCCAAGCCAGGATTGACCAGAT
+GCTGGTACACCAATGGGAAGAGTTTGTCATAAAATCTGTAAACCGAGTGTTCCACAGAAA
+CGTTATCATCGCCTCGAAGGTAGAGATCAAGGTCATTGAAGAGGGTGGACACCAGTGGTC
+TTGCATCTTGGGAGATTGTCTCGTAGGTGGTGTCGAAAAGTGAGTTGGTATGATTTAGAG
+TGAACGAGAGCAGGGAATGGAAGGTATCTGTGGGAAGAGGAAATAAAAGAAAGATTTTGG
+ACTGAAGAAGCACTGAAAAAGACCTCCACGAACAGCTATTTCATAGTCATCTTAGATGGA
+TAAACATTCGTAACATGAGAGACTAACAATTGCTGTAATTTTGTTTGACATTTACGAGAG
+GGTCAAAGATACTAGTCTGTCATGGTGCACCTCTGCCTTGTCTCGCATTGCTTACGACTC
+TTTCTTGTGTATCTAATCTCTCTTTCCATTGGGCTAATGGGAGCTGACAACACTTAATCC
+ATGGATCTTTTGGGCTGGCGCTATTGGGCTGAAGGTTAGTTTGGAGATATGTGACACGTG
+TGACTAGCTTATTACCAATTTTAGCAGTCAGGGCGTCATTTTATACCTCACTATGC
+> zDH63-102m11.q1k R12806768 uid=28035964
+ACACACACAAACACGCACACTCACGCACACACTATAATCTGCCAGTTTGCTCCATAGAAC
+TCCATATAAAAGCCAGAAACTTGTATGATAGGCCTATATAAAGGGTTAATGGTGACAACT
+GATGATCAACAGTAAAACTTAAACATTTGACCTCTTCCCAACAGGAAAACCAACAATAAT
+CAAGAATGCATAATTATATGTCTTGGCTTTGTAATCAAAAAATGTGATTATGATGGAAGT
+CAATGGGGCAAAAACAGCCACCAACATAATGAAGGGGTAGTCAATTTGAACAGCAGAGAA
+GGATTAAGACCACTGATCATTCTATCATTATCACTCATTTAAATCTTTCTTCTTTTTCAG
+ATACGTTCCAGTCCCTAATATCCTTCTCCCAGAACCACCTGACCTCTCTGTTTGAGACCA
+CATACTCATCCCTCATGTCGTCCATCTCCCCTCACATCGTCTGCCTCTTCACGGACCTCT
+CTCGCTTCCTCCAGGGCACCGGCAACGTCTCGGTGGAAGCTGCTGTGCACTGTTTCTTCG
+ACAGCCTTTTCCCATTGGTCCACACTCAGATTGTCAATCCCGGTATGGAAGGAAGTATTG
+GGACAGATGCTTCTGAAGGCAACCAGCTTGGTGACTGTCTCCGAATGACCAGGCAGGACG
+TAAACCCCTTTGGTCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGGG
+CTGGGCGGGTGCTCAGCTTGGCACTTGCCGAAGGGTCAGAAGTGATGAACATTACGGAAA
+CAGCAGGGTTATCAAAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCA
+> zDH63-73k18.q1k R12882234 uid=28112628
+AGAGTCGTAAGCAATGCGAGACAAGGCAGAGGTGCACCATGACAGACTAGTATCTTTGAC
+CCTCTCGTAAATGTCAAACAAAATTACAGCAATTGTTAGTCTCTCATGTTACGAATGTTT
+ATCCATCTAAGATGACTATGAAATAGCTGTTCGTGGAGGTCTTTTTCAGTGCTTCTTCAG
+TCCAAAATCTTTCTTTTATTTCCTCTTCCCACAGATACCTTCCATTCCCTGCTCTCGTTC
+ACTCTAAATCATACCAACTCACTTTTCGACACCACCTACGAGACAATCTCCCAAGATGCA
+AGACCACTGGTGTCCACCCTCTTCAATGACCTTGATCTCTACCTTCGAGGCGATGATAAC
+GTTTCTGTGGAACACTCGGTTTACAGATTTTATGACAAACTCTTCCCATTGGTGTACCAG
+CATCTGGTCAATCCTGGCTTGGGTTCACCTGTTTCAACCTGGTCTGCCGAAGGAACTGAG
+TGCCTTCGTGCCACACGGCATGATATCTATCCCTTTGGCCATCACCCACAAGAACTTGCT
+CAAGGACTG
+> zDH63-179j24.q1k R12903628 uid=29020166
+GGGCGTTCTCCTGATTTGATTCAGAAGGGCACTTTTTTGTCAGATGGCTCAGCGGTTTGA
+CTTTCATTTATTCACCGTCATTAGTTTTAAAAAGCACTCTTTCCATTTTATTTGTATATA
+TTTTACTGGAACACATTAACTCTACAGGTGCCTAATAATTAGCTGTGGAGCTAACATAAA
+TCGTTTTATTCCATCTAGTAAACGCATAAAAATCGACATCATAATTTACTCAAGTGCACG
+CCTCAATGTCTCGCGTCCCTCTTAATAGGTGCTGGCAAGCCCCACAGTTTGAAACCCCTG
+GTGTATATATAGTTATTCTACTATAAAATCTGCTTTGTTAAATTTGTTGTTTGCTTTTGG
+CATCTGCTAGAGCTTTTGTACCAAGAAACAGTGACTTTTGATGTCAGACTTAAGCAAATA
+GAGTTGTTTATTGGTCCCGCCCACCTGCAAGGTTCCTCCACTCAGTGTCCAGGTCTGCTT
+GATTGGCGAGGCAGCCTTTTAAGACATTTCGACAGTAGTTTGAGCAGGGTTTGGCCAAGG
+CCACGCCACTACAGTGAGGACAATACGTCTGCTTCATGACAGCACGCACACATTCAGTGC
+TCAGAGAAACCTGCAAAACACAAAAAACACAATTTAAAGAACAGCTCAACCATAATGAAT
+CACTTAACAAGAAAAAAAAAGCCCTGTGAATTGTTTTGTGTCACACACAATATGCGATAA
+TTGCACTGTGCAAATAATTGCTTGTCAGTACAG
+> zDH62-110i20.q1k R13485274 uid=30110188
+TTGCCTTTAATAATGTGCTGAAAATAAAACCCAAAATATTAAGTCATTCTAAATGGGAAA
+CTATGCATGCTTGCATGTACCTGGAATTATTGAGAAGACTTAATTTTTTTATTATGTTAG
+ACAACTTTCAAAACTTTAATCCTTTACTAATAAACTTTTTTCTACTCTATTATTTCTTTC
+AGAAAGCGTGGAGTCTCTGGTGCGTCAGGCGGAGAACCACACCCTCTCCATCCTCCATCA
+GTCCCAGCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTTTTTCACAGA
+AGTGGCTCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTTCTT
+CAACGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTCTCCTCCATA
+CGCCGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGCCCCAATCCG
+CCTGGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCAAGCGCTCCA
+TTTGGGCATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGAGTGCAGACG
+TGGCCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAGCAAACCCTG
+CTTGGGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCTGAAGTGGATG
+> zDH62-283b13.p1k R13754262 uid=30384044
+CAGGCAACCTCGCATCACGTTGAGACATAGGCCTCCACATGGCCGGATCAGGGTCAGTCC
+TCGACAGTGAGGACAGAACAACATGCGCACTAGTGCACGTCCACACACTCGTCCCATGCC
+CACAGACTCTGTGATGTTAAGTACATCTGCACCGACTGCCAGTGCCCGGCTGAGGGCACG
+ACCAACCACAAGCGCCTTGGACAGTCCTTGAGCAAGTTCTTGTGGGTGATGGCCAAAGGG
+ATAGATATCATGCCGTGTGGCACGAAGGCACTCAGTTCCTTCGGCAGACCAGGTTGAAAC
+AGGTGAACCCAAGCCAGGATTGACCAGATGCTGGTACACCAATGGGAAGAGTTTGTCATA
+AAATCTGTAAACCGAGTGTTCCACAGAAACGTTATCATCGCCTCGAAGGTAGAGATCAAG
+GTCATTGAAGAGGGTGGACACCAGTGGTCTTGCATCTTGAGAGATTGTCTCGTAGGTGGT
+GTCGAAAAGTGAGTTGGTATGATTTAGAGTGAACGAGAGCAGGGAATGGAAGGTATCTGT
+GGGAAGAGGAAATAAAAGAAAGATTTTGGACTGAAGAAGCACTGAAAAAGACCTCCACGA
+ACAGCTATTTCATAGTCATCTTAGATGGATAAACATTCGTAACATG
+> zDH63-1230b14.p1k R13884671 uid=31017043
+AACCATGTGATCTGTGCAGTCCGACAAGTCGACTTCAATAAAGCAAGCATCATGGCAGAG
+CATTATAGTCGGCTATTCTGTGCAGCCCTTAGTATCAGTATATTTGATCTGTGAAAGCGT
+CTCTTGTACTTGAAAACAAGCAAACACAACTCAATTCTTTCAGCCATGAATCATATAAAC
+TCAAAATATTTTGAAATGTACATTTCTAGAAGAAAACTCTTGAGGCAATCTGGAAGAACT
+ACAATTGAGCCTATTGAAAAGAGTTCAGAAACCCGCTTATAGCAGAAGAGGTCTTTGTGC
+TTCATAACTCTGTAGACCTTTTTTCATGCTACAATACAAGCTAATGCTAGCTGTAAAAGC
+GTAAAAATGCTAGTACTCACTGTGGCAGTTAGCCTGGGCCCGTGAAGCTGAGCGTAGAGT
+ATGGCCTCCTCGACCTGACCTCTGATCCCCAGTAAGGCCAGCTCTAAATTGTGAGCTCCG
+GCAACCATTTGCGTGAGGTCCTGCAATATGGTGACATACTGTCTCCAGGGCTGGTGGAGC
+TCGGAGTAGCTCGCCAGGCACCCGCGCATGACATTAAGACAGTAGTTGCTGCACGCATGG
+ATCAGGGTGAGTCCACGGCAGTGAGAGCAGTAATGCATGCGTACCAGAGCCCGTGTGCAC
+TCTTTTGATAACCCTGCTGTTTCCGTAATGTTCATCACCTCTGACCCTTCGGCAAGTGCC
+AAGCTGAGCACCCGCCCAGCCCGCAATGCGTCCGCCAGATCTTTTGCCATTGCTTTTGGG
+TGCGGACCAAAGGGGTTTACGTCCTGC
+> zDH63-1351g09.p1k R13950954 uid=31084382
+CCTCTGCTTGTAGCACTCCACGCTCATCACAGAGCATTTTTTTTTTAATTCTGTGGTAGA
+CTTGACTCGAAAGAGGGGGATGTCATGGCCCTTTAAAATGGGACAAAAAACTGCTTTTAT
+TCTAGCAGTTATAAAAAATAAAACAAAGACTTAATAGAAGATATATTGTAGAAAATATCA
+TTGGAGACACTGTAAAAATTTCCTTGCGCTGTTAAACATCATTTGGGAAACATTTGAAAA
+AGTAAAACAAAATCACAGGAGGGCGAATAATTTTGACATCAGTTGTAGGCATACAGGTAC
+AGTCCCTGTCACTGGCAAGGCTGTGATAAAAAATGAAACTATATTGGCTGTTTTTTGGGA
+GGAGCTACTGTATGTCCTGCTCTCTCTTTATGTTTCAGTTGGGATTACGTCAAACTTTAA
+ATAAAAAAAAATGCACATTTCAAAGCACATTTAACATCTGCCCATGTGTGTTTATCCTGC
+AGGTCAATATTTCTCCAGGCTGCAGTAAAGCATTGACTAAAATGTGGTACTGCCCGTATT
+GTGGAGGAATGTCAGGACTCAAACCCTGCGCCAACTACTGCCAGAATGTGATGCGCGGCT
+GCCTGGCCAACCAAGCGGATCTGGACCCTGAGTGGAACCTCTTTATTGGTGAGATGCGCT
+TGCTATTGTACCTTAAGCTGGG
+> zDH62-691d23.p1k R14067417 uid=31203021
+TCAATCAACCCATCAATCAATCAATCAATCAATCAATCAATCAGTCAAACACAAAATAAA
+CTTGAGCAACAACTCAAACAGTCTCATTTCCAGTATTGTTTAAATAAAGAATACATAAAA
+TAATAAATAAAATAAAGTGTTTTTGATTGAAAAAAGGCACCCAACTGGAAGTTCTTTATA
+GGGGACATCTATATTAGAAAACCCAGCTTAAGGTACAATAGCAAGCGCATCTCACCAATA
+AAGAGGTTCCACTCAGGGTCCAGATCCGCTTGGTTGGCCAGGCAGCCGCGCATCACATTC
+TGGCAGTAGTTGGCGCAGGGTTTGAGTCCTGACATTCCTCCACAATACGGGCAGTACCAC
+ATTTTAGTCAATGCTTTACTGCAGCCTGGAGAAATATTGACCTGCAGGATAAACACACAT
+GGGCAGATGTTAAATGTGCTTTGAAATGTGCATTTTTTTTTATTTAAAGTTTGACGTAAT
+CCCAACTGAAACATAAAGAGAGAGCAGGACATACAGTAGCTCCTCCCAAAAAACAGCCAA
+TATAGTTTCATTTTTTATCACAGCCTTGCCAGTGACAGGGACTGTACCTGTATGCCTACA
+ACTGATGTCAAAATTATTCGCCCTCCTGTGATTTTGTTTTACTTTTTCAAATGTTTCCCA
+AATGATGTTTAACAGCGCAAGGAAATTTTTACAGTGTCTCCAATGATATTTTCTACAATA
+TATCTTCTATTAAGTCTTTGTTTTATTTTTTATAACTGCTAGAATAAAAGCAGTTTTTTG
+TCCCATTTTAAAGGGCCATGACATCCCCCTCTTTCGAGTCAGGTCTACCACAGAATTAAA
+AAAAAAATGC
+> zDH62-692b07.q1k R14086868 uid=31222836
+TCTTTCCATTTTATTTGTATATATTTTACTGGAACACATTAACTCTACAGGTGCCTAATA
+ATTAGCTGTGGAGCTAACATAAATCGTTTTATTCCATCTAGTAAACGCATAAAAATCGAC
+ATCATAATTTACTCAAGTGCACGCCTCAATGTCTCGCGTCCCTCTTAATAGGTGCTGGCA
+AGCCCCACAGTTTGAAACCCCTGGTGTATATATAGTTATTCTACTATAAAATCTGCTTTG
+TTAAATTTGTTGTTTGCTTTTGGCATCTGCTAGAGCTTTTGTACCAAGAAACAGTGACTT
+TTGATGTCAGACTTAAGCAAATAGAGTTGTTTATTGGTCCCGCCCACCTGCAAGGTTCCT
+CCACTCAGTGTCCAGGTCTGCTTGATTGGCGAGGCAGCCTTTTAAGACATTTCGACAGTA
+GTTTGAGCAGGGTTTGGCCAAGGCCACGCCACTACAGTGAGGACAATACGTCTGCTTCAT
+GACAGCACGCACACATTCAGTGCTCAGAGAAACCTGCAAAACACAAAAAACACAATTTAA
+AGAACAGCTCAACCATAATGAATCACTTAACAAGAAAAAAAAAGCCCTGTGAATTGTTTT
+GTGTCACACACAATATGCGATAATTGCACTGTGCAAATAATTGCTTGTCAGTACAGTTTC
+CCAAGAGGTCCAAGGATGTGGGATGGTACAGTTTGGTACAACTCTTGCAAAAGAATACCC
+ATGGTGCTTCTCTGAGACGTCTTTCACAATCATTCCTCTTTATCAGGAACCTCCACCCCT
+CTGATGTCAAAGCGTGGG
+> zDH63-36j03.q1k R14188081 uid=31325780
+AAGTATAAATGCACAGTTACGCGCAAGACAGGTGCTGTGGGTCACGGCAATCACTCGACA
+CAGAAGTATAAACCAGCCCTAACCCCGGCATCCTGGCCAAATTACCTCCGGTCCTTACCC
+ATCATGGCCTCCCAATCATCCCCATCCACCAAATTAGCTGTATCACTTTCTCTTCACTCC
+ACCTATAGCTGGTGTGTGGTGAGCGCACTGGCGCTGTTGTCATGTTGGTACGGTCACATC
+ATCCAAGTGGATTCTGCACACTGGGGGTGGTGTGAAGGGATCCCTGTCATGATTGTGGAG
+CTCTTTGGGTGTATGGCCATACACGATAAATGGGCTACATAAATACACACATATTACATT
+TCAGCACATTATCACTGTGGTGTTGAAATGTAACTAAAATCAAACTTTATAGTTACTCAA
+TCTCTCTTTTCTGTCTTTTTTCAGAGGCTTTTGACATGGTGCTTCGTCTGGGCCGTAATT
+CCACTCTGATGGTGTTACGCGAGGAGTTTCCGTGGTTTGGGGGCTGGAGCCAGTGGAGCC
+GTCACGCAGTTATTCCTGGATATGTCACTTTACATTCTGGGCTCTGATGCCAATGTAAAC
+GACATGGTCTCCACCTTCTTCTCTCGCCTTTTCCCTCTCACCTACCGTCGACTTCT
+> ZDH88-152b21.p1k R14216038 uid=31354335
+ACATGTATTGCTTCACAGGAGACCTCAGGCAGATAAAGGATCATCCTGTGAGCATGAAAA
+ACAGCGGACAAAAGCCAAATCTCCAAGTAACCTTGGAAAGTCATGATGTACAATGTAAGA
+AATGTTAAACACCACCTCTGTGTTTCCTATGCAATACATACAAAGTAATAACATGTCATA
+TGACCCACCTGCTGTGGCAGGGACTTGATCCCATGACCTACTACTGCTGCTGCTGCGAAT
+GCAAAAAGCACATGTCCTAGTGTTTGTTTGGCCAATAAGCTTCACTCCATCTCAATACAT
+ACCCTGGAAGGAAGAAGCATGGCCCAGGATGAGATACTTGAGTTCGAAGCTATAGGAGAG
+AATGTTTTGGAGTGTGTCTCTTTGAGCAGCTGAGTAGTAGCTCTCCTCCATCTTGCGGGT
+ACAGCATGTGGGACCCTGGTGTTTACAGATGAGAAGTTCTGCATCTGTGATGGATTAATC
+ATAGAAGGTGACTTAAGTAGAAACATTTGTGCCTATTTAAACCACATGTCTCATAACTTT
+CATATGTTGGATTTCTGAGTACAGTTTTTAACCCTCATGCAATACCTCCTCTAAAGTTTT
+TTTTCCAAGCTAACAAACTGATTATGAACACTGAATGGCTTTCCTGTGGTAAATGCAATT
+TGCAAAGTCAAGTGACATACTGTTTACATCGACTAAAAGTAGTTGTACAGCATTTTTACA
+TGTAAACCTAAAGGGGGTTTTTAGCAAGTTTGGACAAACAAATTGGATGAACTTATATAT
+TTGGTTGATCGAAGATTTGGAGTTTGTAATTGGAAGATTGGATGGTTTAGTAATGCGTAC
+AATTTTAATCTTCA
+> zDH62-917l23.q1k R14249845 uid=31391651
+AAAGGGACTAAGCTGACAAGGAAATTAATAAATGAATGAAATTGGGTTTTGCGCTTTTGG
+CTTATCATAAATGCATTATTTTTGAGATTGATCTGGCTCCATGATGCAATCTTTTGCATT
+TTCTGTCACAGTTATACACCAAATTCTATTTATGTCTGGATTCCTCAGTTTTGTCAGCAT
+TGTGTAAATCACAGGGCCCTAAATGAGCCTCTGTTGTTACATCAACATATATTCATTCAC
+ACATCAATCAACTTCATCTATTTGCCCATTCGTTTCACTTATCAATCATCCATTTCATCC
+TTCCACCATCCATTCAATCATCCATGCATCTGTGTACCCTGGAAGGCGGCGGCGTGTGCA
+GAAATGAGAAATTTGAGCTCATAGCTGTACGATCCGATGTTCTGGGTGGTGTCTCTCAGG
+ACCGCCGCTCTGTAACTGTCTTCCATTCTTCGTGTACAACATGATGGCCCCGCATGCTTG
+CACACCGACAGTTCCACATCTGCAGTAAAAGACAGAACAGTAGCTTGTTAGACAGATGCG
+CGTTCTTTATGAAGTTTCCGCAGCTTCATTGACCTTCTGGGGTCAGCAAATGCGCTGGAA
+TCTCACTGTCGACTTGCTTCACAGAAATTAAAAATATATCTAGAATTACATAATTCTTGA
+AATAAGCAAACCAACTACACTTGAAACATATGTTCTCTGGATTTGTAATGTTTTCTTCTT
+CAAGTATTTCCCAATGA
+> zDH63-621b07.p1k R14623704 uid=32271940
+CTCAATACATACCCTGGAAGGAAGAAGCATGGCCCAGGATGAGATACTTGAGTTCGAAGC
+TATAGGAGAGAATGTTTTGGAGTGTGTCTCTTTGAGCAGCTGAGTAGTAGCTCTCCTCCA
+TCTTGCGGGTACAGCATGTGGGACCCTGGTGTTTACAGATGAGAAGTTCTGCATCTGTGA
+TGGATTAATCATAGAAGGTGACTTAAGTAGAAACATTTGTGCCTATTTAAACCACATGTC
+TCATAACTTTCATATGTTGGATTTCTGAGTACAGTTTTTAACCCTCATGCAATACCTCCT
+CTAAAGTTTTTTTTCCAAGCTAACAAACTGATTATGAACACTGAATGGCTTTCCTGTGGT
+AAATGCAATTTGCAAAGTCAAGTGACATACTGTTTACATCGACTAAAAGTAGTTGTACAG
+CATTTTTACATGTAAACCTAAAGGGGGTTTTTAGCAAGTTTGGACAAACAAATTGGATGA
+ACTTATATATTTGGTTGATCGAAGATTTGGAGTTGTAAATTGGAAGATTGGATGGTTTAG
+TAATGCGTACAATTTTAATCTTCATGCAATGCCTTCCTCTAGAGCAGGGATCAACAAACT
+TGGAGGTTCGGTGTCCTGAAGAATTTAGCTCCAACCCTGATCAAACACACCTGAACAAGC
+TAATCAAGGTCTTACTAGGGATACTTGAAACACCAAGGCAGGTGTGTTGAGGCAAGTTGG
+AGCTAAACCATTGCAGGGCACCGGACCTCCAG
+> zDH62-1134p01.p1k R14756241 uid=32406378
+CAGCCACCAACACTAAATTAGGCAAAAAAAATAAAAATCTTACCCTTTAGGGAAACGAAC
+AAAAAAGGAGGAAGCACGCCCAGAGGGCTTTTGTGGGGAAGGAAAAAATTTAAGAATTTT
+CACAAAAGAAGGGCGAAAAAAAGAATGATCACCTAAAACAACGTTTGTCACCATTCTGCT
+AGCTGAAACAAAAAAAGTTAAGACCAAAATAACATTCAAAACCACGCCAGAGTGGATGAA
+AACATCCCCAGCAACACATAAGAGTTACCATATGATACCACTATGGATCCTCTTGGTTCT
+AATGCATGCTCTTTTAAGCATAAAAGTGTACCTTTTAAAAGGGTACCACCCCAGTGACAG
+GTTTCATACATTTCTGAGAGTGTGTTAAGAATTAATGTGTTCTTGACTCTAAGCATTTCA
+GCTTTCCGCCCAAGGGGATGCTAAAGGTTTAACTTATGACAAAAATGTACCCAAAAATGG
+CTTCACAAACAGAAATGTAGCAGAAACTCACCTTGAAAGAGGGCAGCATTCTGGATGATG
+AGCCCTTTGAGCTGAGCGCTGGTGGCCTGAAGGCTAGACTCCATATTCTGTTTGGCAATA
+AGCAGGTAACGCTCCTCCATTTTGCGAGAACAGCAAGTCAGGCCTTTTGGCTGGCACACC
+TGCAGATCTGAGCCTGTAGAATAACAGAGAGAAGATTTCTAACAGCCGTCACAATAAACA
+AGTAAACAGACCGCGGCATTTTATAAACTGAAGCTT
+> zDH64-614i02.p1k R14795221 uid=32445772
+AGCGCGCACACTGATGTCGTGAGTCGAAAACTCAGCTTATAGTGTCGATATGACCACGCT
+GCACAGTTTTGGAAAATAGTCACTCGGGTCGGAGTTTTCAGAAAGCATTGCTTTGTCACC
+TGACATTGCGTTTTTGGTGTGGACATTGCGTTTTGGTGTAGATAAAAAACCATGTGATCT
+GTGCAGTCCGACAAGTCGACTTCAATAAAGCAAGCATCATGGCAGAGCATTATAGTCGGC
+TATTCTGTGCAGCCCTTAGTATCAGTATATTTGATCTGTGAAAGCGTCTCTTGTACTTGA
+AAACAAGCAAACACAACTCAATTCTTTCAGCCATGAATCATATAAACTCAAAATATTTTG
+AAATGTACATTTCTAGAAGAAAACTCTTGAGGCAATCTGGAAGAACTACAATTGAGCCTA
+TTGAAAAGAGTTCAGAAACCCGCTTATAGCAGAAGAGGTCTTTGTGCTTCATAACTCTGT
+AGACCTTTTTTCATGCTACAATACAAGCTAATGCTAGCTGTAAAAGCGTAAAAATGCTAG
+TACTCACTGTGGCAGTTAGCCTGGGCCCGTGAAGCTGAGCGTAGAGTATGGCCTCCTCGA
+CCTGACCTCTGATCCCCAGTAAGGCCAGCTCTAAATTGTGAGCTCCGGCAACCATTTGCG
+TGAGGTCCTGCAATATGGTGACATACTGTCTCCAGGGCTGGTGGAGCTCGGAGTAGCTCG
+CCAGGCACCCGCGCATGACATTAAGACAGTAGTTGCTGCACGCATGGATCAGGGTGAGTC
+CACGGCAGTGAGAGCAGTAATGCATGCGTACCAGAGCCCGTGTGCACTCTTTTGATAACC
+CTGCTGTTT
+> Zdh24-61d24.p1k R18675850 uid=40432519
+ATGTTTACAGTGTTGAGTCCTGTGAAGGGGCACCAGCTGAAAAGTTTTGCGTTCACCTTA
+TGATTAATGTTGTTGCACGTACGCCGGTTTCCACCTCTAAATAAGCAAGATGTGGCTACA
+TGTACATTAAGGTAGCGTTCAGAAAAATCTCCATGAAGAAACTCGACACAGGATCATAAA
+AACCTACTGCTAGCTAGCGTTTTGGAAGTTTTACTGCAGAGCAACACAGCGCGCAGAAGT
+ATAAATGCATGACTACATGCTAGGCAGGCACCGTGGGTCACGACAATCACTCGACGCAGA
+AGTATAAACCAGCCTTGAGAGTTCTAGTGTTATAAGCCCTACCTATGAGGCTCTGCCACT
+CAGTGTCCAGGTCAGCCTGATTAGCCAGGCAGCCCTTCATCACATTTTTGCAGTAGTTGA
+TGCAAGGTTTGACTGATCCCAGACCTCTGCAATGAGGGCAGTACACCAGTTTCATAATGG
+CACGATTGCACTCTGGGCTCAGTGGGACCTGTGGAAAGAGTGACCATTGCCAAGGGTTCA
+TTTTTTTTAAGATAACAATATTAAGTTAAACAGTAACCATGGCATTTATCAGTGAGCAAG
+GCAATTAACTCAGTATATCTTCAGGGAAGCTGTCCTGATAAAAAAAAAAAACACTGGAAG
+TTGAAATAAGAGCACTGGTAAACACACTAGATGCGAGTTAGCTTGATTTACTGAATTGTA
+CCTGCTTATTACCTGCATGTTGATTCAGGTCATCTACTTCAAACTTTGAAGTCTTTTGGG
+AAAGCCAGGTATGGAGGGCAGA
+> zDH22-213h20.q1k R18691948 uid=40448877
+CGCGCGGGGCCAGAGTGTGTGCGCGCGCTCATGCGTCAGTGGTTCTGTCCTCTGTGTCGG
+GGTCTTCCGTCACTCAAGCCCTGTCATTCGCTGTGCCTGAACATCATGAAGGGCTGTCTG
+GCCAATCAGGCGGATCTAAACAGCGAGTGGAACAGCTTCATTGGTGAGAACAGAACACCT
+CTGCTTCATTTACTGTGTGTGTGTGTGTGTGTGTGTCCGCTGTGTGTGTGTGTGTGTGTG
+TGTCCGCTGTGTGTGTGTGTGTGTATGTCCGCTATGTGTCTGATGTGTGTGTGTGTGTGT
+GTGTGTCCGCTATGTGTCTGATGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTCTGATG
+TGTGTGTGTGTCTGATGTGTGTGTGTGTGTCCTGCAGATGCTCTGACAGTGGTGGTGGAG
+AAACTCGGCGGGCCGTTTAACTTTGAGCTGGCTGCGGACGCCATCGCTGTGACGGTTTCT
+GAAGGCATCATGAACATGCAAGAGAACAGCATCAGCATCTCTGCTAAGGTGAAGAAAACA
+CACACACACACACACACACACACACACACACACACACACTCTAGAAGATGAACCAAAACA
+AACACAGATGAGGAAGGGTTAGGACGATGTGAAACCCATATAAAACAGATGTCAGATCAG
+CTGTATCAGTGAAGCGTTCCCGCTCTGTTCTGCTGCCGCTCCTGTTC
+> zDH22-229f07.q1k R18750256 uid=41008337
+TGAACCCAAGCCAGGATTGACCAGATGCTGGTACACCAATGGGAAGAGTTTGTCATAAAA
+TCTGTAAACCGAGTGTTCCACAGAAACGTTATCATCGCCTCGAAGGTAGAGATCAAGGTC
+ATTGAAGAGGGTGGACACCAGTGGTCTTGCATCTTGGGAGATTGTCTCGTAGGTGGTGTC
+GAAAAGTGAGTTGGTATGATTTAGAGTGAACGAGAGCAGGGAATGGAAGGTATCTGTGGG
+AAGAGGAAATAAAAGAAAGATTTTGGACTGAAGAAGCACTGAAAAAGACCTCCACGAACA
+GCTATTTCATAGTCATCTTAGATGGATAAACATTCGTAACATGAGAGACTAACAATTGCT
+GTAATTTTGTTTGACATTTACGAGAGGGTCAAAGATACTAGTCTGTCATGGTGCACCTCT
+GCCTTGTCTCGCATTGCTTACGACTCTTTCTTGTGTATCTAATCTCTCTTTCCATTGGGC
+TAATGGGAGCTGACAACACTTAATCCATGGATCTTTTGGGCTGGCGCTATTGGGCTGAAG
+GTTAGTTTGGAGATATGTGACACGTGTGACTAGCTTATTACCAATTTTAGCAGTCAGGGC
+GTCATTTTATACCTCACTATGCCTATGGTCTTCAAATGGAAGTTGAGGATCATAGTCTGT
+TGTGCCTTATACATTATTTACAATGGCATATTAACATTTGTGTGACAAGTGACAGATGGG
+TGCTTAAGTAGACAGCTGGTAGAACCCTTCAAAGTACAGTTTGCTTTAGTGTCATCTCAT
+TCATAATGGCCAAAACATTCCAGCTCTGTCTGGTTTCTCTGTGAATGGCCCAAATGCTAA
+GAATGAATCGAAAGTTATGATTG
+> Zdh24-339i14.q1k R18805812 uid=41064884
+AAGACTGTTTTATGATGCATCTGTGCTTTTGTTAATTGTGCTGTAGTTTACATACAGAAC
+AGCCAAGCATACAGGTTACTGACCTCATCAAAACCCTGTATAAATGTGTGTGTGCTCGAG
+GTGTGTGTGTTCCTCTTACCGATAAATTTGCTCCATTCGTTGTTGAGATCGGCCTGGTTT
+GCCAAGCAGCCCTTCATGACATTCAGACAGTAGTTTCTGCAGGGCTTCAGTGTGAACAGA
+CCCTGACAATACGAGCAGTAGAGCATCTTCGTGAAGCCGCTGACACACGACGAGCTCATG
+CTGACCTGCGCACACACACACACGGCAATAATACAACAGTCACCACACTACTTGTAGTGA
+TGCTACAGCCTGACACTGGATGTCTCATAGTTTTGATTCGTACAATTGAATATAACTTTT
+AAAAATAAATAAATAAATAAAAAAAGTTAGAGAACAAAAAAATTATTTAGAGAAGAAAAA
+AAAATTTCAAGAAGAGGTTGGGGGTCATAAAATAAAATGATATAAAAAAAAAGTCACAAA
+CACAATTTAGGGTTTTTTCATCTCACCTGAGCGACTCTGTTAGCGACGTCACGTCCGACC
+GCAAGTCCCTGTACGAATGTGCGCGCCGCAATAAACGCGCG
+> Zdh24-84h24.q1k R18822295 uid=41081631
+ATCCAGAGAACATATGTTTCAAGTGTAGTTGGTTTGCTTATTTCAAGAATTATGTAATTC
+TAGATATATTTTTAATTTCTGTGAAGCAAGTCGACAGTGAGATTCCAGCGCATTTGCTGA
+CCCCAGAAGGTCAATGAAGCTGCGGAAACTTCATAAAGAACGCGCATCTGTCTAACAAGC
+TACTGTTCTGTCTTTTACTGCAGATGTGGAACTGTCGGTGTGCAAGCATGCGGGGCCATC
+ATGTTGTACACGAAGAATGGAAGACAGTTACAGAGCGGCGGTCCTGAGAGACACCACCCA
+GAACATCGGATCGTACAGCTATGAGCTCAAATTTCTCATTTCTGCACACGCCGCCGCCTT
+CCAGGGTACACAGATGCATGGATGATTGAATGGATGGTGGAAGGATGAAATGGATGATTG
+ATAAGTGAAACGAATGGGCAAATAGATGAAGTTGATTGATGTGTGAATGAATATATGTTG
+ATGTAACAACAGAGGCTCATTTAGGGCCCTGTGATTTACACAATGCTGACAAAACTGAGG
+AATCCAGACATAAATAGAATTTGGTGTATAACTGTGACAGAAAATGCAAAAGATTGCATC
+ATGGAGCCAGATCAATCTCAAAAATAATGCATTTATGATAAGCCAAAAGCGCAAAACCCA
+ATTTCATTCATTTATTAATTTCCTTGTCAGCTTAGTCCCTTTATTAATCCGGGGTCGCCA
+GCACGGAATGAACCGCCCAACTTATCCAGCAGTGGATGCCCTTCCAGC
+> Zdh24-512a06.q1k R18859367 uid=41119532
+TTTTTACAAAGCAATAAAAAAGAGGTGATGCAACAAAAATAGGAAAAAGCAAACCAACAA
+AAAAAAAAAGGCTGATTTATACTTCTGCATCAAGCGCACATGTATGCTCGGGTGCAGCCT
+TCGCACGGTCACATAGCCCTTGCCGTGGCTAATGCCGATGCTGACATGCACCTCTCAAAA
+AATTTAACTACACATCGCAACAACGCAAGCTGTGTGATTGGTAGGCTTGGTAGCTGTGAC
+GAGTGTGGAGCTACGAGCTCCATGGAGCCAATGTTTACAAGTGTTGAGTCCTGTGAAGGG
+GCACCAGCTGAAAAGTTTTGCGTTCACCTTATGATTAATGTTGTTGCACGTACGCCGGTT
+TCCACCTCTAAATAAGCAAGATGTGGCTACATGTACATTAAGGTAGCGTTCAGAAAAATC
+TCCATGAAGAAACTCGACACAGGATCATAAAAACCTACTGCTAGCTAGCGTTTTGGAAGT
+TTTACTGCAGAGCAACACAGCGCGCAGAAGTATAAATGCATGACTACATGCTAGGCAGGC
+ACCGTGGGTCACGACAATCACTCGACGCAGAAGTATAAACCAGCCTTGAGAGTTCTAGTG
+TTATAAGCCCTACCTATGAGGCTCTGCCACTCAGTGTCCAGGTCAGCCTGATTAGCCAGG
+CAGCCCTTCATCACATTTTTGCAGTAGTTGATGCAAGGTTTGACTGATCCCAGACCTCTG
+CAATGAGGGCAGTACA
+> zDH61-1372b03.p1k R18932433 uid=41194227
+GCTGCGGAACTTCATAAAGAACGCGCATCTGTCTAACAAGCTACTGTTCTGTCTTTTACT
+GCAGATGTGGAACTGTCGGTGTGCAAGCATGCGGGGCCATCATGTTGTACACGAAGAATG
+GAAGACAGTTACAGAGCGGCGGTCCTGAGAGACACCACCCAGAACATCGGATCGTACAGC
+TATGAGCTCAAATTTCTCATTTCTGCACACGCCGCCGCCTTCCAGGGTACACAGATGCAT
+GGATGATTGAATGGATGGTGGAAGGATGAAATGGATGATTGATAAGTGAAACGAATGGGC
+AAATAGATGAAGTTGATTGATGTGTGAATGAATATATGTTGATGTAACAACAGAGGCTCA
+TTTAGGGCCCTGTGATTTACACAATGCTGACAAAACTGAGGAATCCAGACATAAATAGAA
+TTTGGTGTATAACTGTGACAGAAAATGCAAAAGATTGCATCATGGAGCCAGATCAATCTC
+AAAAATAATGCATTTATGATAAGCCAAAAGCGCAAAACCCAATTTCATTCATTTATTAAT
+TTCCTTGTCAGCTTAGTCCCTTTATTAATCCGGGGTCGCCAGCACGGAATGAACCGCCAA
+CTTATCCAGCAGTGGATGCCCTTCCAGCAGCAACCTATCTCTGGGAAACATCCACACACA
+CATTCACACATACACACTCATACACTACTGACAATTTAGCCTACCCAATTCACCTGTACC
+GCTTGTCTTTGGACCTACTGCGCCACTATGTTGCACAAAACCCAATTTGTAAATTGAAAA
+CACAATTCATAAATGCACAAATCCAAAATACACACATCCAATTCATTGTTTTTCCTTTGG
+CTTAGTCACTTTACTC
+> zDH25-155a18.q1k R19130501 uid=41400241
+TTTTAAAAGGACTTTATAAAATATGAATCATCTAAAACATAGTTACTAAGGGAAGTTGCT
+TTCAAACTTTGAGGTGGCACATGTCTGAGTAGGTGGGTGTCTGAGTCGTTGTGTGTGGCA
+GTTTGTGTATGAGTTGTGTTTGTGTGTTTGGGCTGTTAGCTGAGGTGAGTGTGTGTTCAG
+GCTGATGGTGACAGAGAGAAGCTCATTAACACAGGCTTTGTCTCCTGCCGTGTGAGTGAC
+ATTGAGCTGCCTTCTGCCCCCTCTGTCCTGTACGGTTCCTCTCTCTCGTTCCCTCGCTCT
+GATGAGCAGGTGAGAGAGTGTGTGTAGGTAATGTCAATTAAAATCAAAGCATCTCAAAGC
+AACTTAGCCCGACAGGAAATGATATGTAATGGAGTATATCGTGCTTAACACTGCATTTGA
+CCCCAACTCTATTTTTTTCTCCTGATTCGTCGTTCTTCTTTCTCTAAGCCTCTACATTTT
+CTCATAAATCCCAGTATTTTGGATTCTTAATCTTGTCTCTTTGTGCACACCATCTAATTT
+CAATTTTCACTGAAGCCCATTCCTCTTTCTTCTTTCGCCTGCACTCAATACATTCTCAAT
+TTCCTCTCTGTCTGCTGCAGGGAGTTTATCTCGGGTCTAAGGGGCTTCAGTCAGTTCTAC
+AGTGGTCTCGGAGAAGCTTTGTGCAGCAAAGAGCCGACATCGCTGAACAGCTCCCTCTGC
+TGGAACGGACAGGAGATGACAGACAAGTGAGTAATTCATTTGTGGGAGCATTGATGCGAT
+GTAACCTCTACATTCCTTCATTGTGGACTCCTACAGCTCAAAGTAAGGGCATTGATGTTC
+A
+> zDH77-77a21.q1k R19184672 uid=41456654
+TATTTTTGAGATTGATCTGGCTCCTTGATGCTATCTTTTGCGTTTTCTGTCTCAGTTATA
+CGCCGGATTCTATTTATGTCTGGATTCCTCAGTTTTGTCAGCATTGTGTAAATCACAGGG
+CCCTAAATGAGCCTCTGTTGTTACATCAACATATATTCATTCACACATCAATCAACTTCA
+TCTATTTGCCCATTCGTTTCACTTATCAATCATCCATTTCATCCTTCCACCATCCATTCA
+ATCATCCATGCATCTGTGTACCCTGGAAGGCGGCGGCGTGTGCAGAAATGAGAAATTTGA
+GCTCATAGCTGTACGATCCGATGTTCTGGGTGGTGTCTCTCAGGACCGCCGCTCTGTAAC
+TGTCTTCCATTCTTCGTGTACAACATGATGGCCCCGCATGCTTGCACACCGACAGTTCCA
+CATCTGCAGTAAAAGACAGAACAGTAGCTTGTTAGACAGATGCGCGTTCTTTATGAAGTT
+TCCGCAGCTTCATTGACCTTCTGGGGTCAGCAAATGCGCTGGAATCTCACTGTCGACTTG
+CTTCACAGAAATTAAAAATATATCTAGAATTACATAATTCTTGAAATAAGCAAACCAACT
+ACACTTGAAACATATGTTCTCTGGATTTGTAATGTTTTCTTCTTCAAGTATTTCCCAAAT
+GATGTTTAACAGAGCAAGGAAATTTTCACAGAATGTCTGATAATATTTTTTCTTCTGGA
+> Zdh76-12n07.p1k R19345081 uid=42125012
+GTTGGATTTACAGAAATCAAATGTCATGCTGTCTGCACCTATATTTACACCTAAACAAAA
+CAGACTTTTTCTTTCAATATCCGTGAAATTAGATTCATTTAAACAACAAGCAAATGTCAA
+GTTCTACTTTCCTTCCCGAACTGCATTGCTTTTCCCTGAGGGACCCTATAAACCCCCACG
+CTTTGACATCAGAGGGGTGGAGGTTCCTGATAAAGAGGAATGATTGTGAAAGACGTCTCA
+GAGAAGCACCATGGGTATTCTTTTGCAAGAGTTGTACCAAACTGTACCATCCCACATCCT
+TGGACCTCTTGGGAAACTGTACTGACAAGCAATTATTTGCACAGTGCAATTATCGCATAT
+TGTGTGTGACACAAAACAATTCACAGGGCTTTTTTTTTCTTGTTAAGTGATTCATTATGG
+TTGAGCTGTTCTTTAAATTGTGTTTTTTGTGTTTTGCAGGTTTCTCTGAGCACTGAATGT
+GTGCGTGCTGTCATGAAGCAGACGTATTGTCCTCACTGTAGTGGCGTGGCCTTGGCCAAA
+CCCTGCTCAAACTACTGTCGAAATGTCTTAAAAGGCTGCCTCGCCAATCAAGCAGACCTG
+GACACTGAGTGGAGGAACCTTGCAGGTGGGCGGGACCAATAAACAACTCTATTTGCTTAA
+GTCTGACATCAAAAGTCACTGTTTCTTGGTACAAAAGCTCTAGCAGATGCCAGAAGCAAA
+CAACAAATTTAACAAAGCAGATTTTATAGTAGAATAACTATATATACACCAGGGGTTTCA
+AACT
+> zDH23-205m08.p1k R19437392 uid=42222409
+CTCACTACTCCCTGCTGCTTTCCAAATGAAAGAGGGCCAATGGTACCTCTCTGTTCGTTA
+AGGAATTTCTTACAGAATTGGAATCTTGGTCTCCCGCTGCCAAACTCTCGAGAGATTCCT
+GCTAAGCAGACCTAAATTCTTGCTGATGTTGGGAATAGATCAGTTCAGAATATTGCGTGC
+CTTGTAAAAAACATCAGTAAAATCTGAATTCCACTGCATGGCACGTTCATAGGGATTAGC
+ATTCAACATGAATACGTTTAGTCATGGCCATATTCAAGTTTGTTGAGCAGCATGACAGGT
+TCACATTCTGTCAGAATAAAGCGATTCAACTGAAGATGCCTTCAGCTAATATACAAGCAT
+GATTACTCTGCCCTCCATACCTGGCTTTCCCAAAAGACTTCAAAGTTTGAAGTAGATGAC
+CTGAATCAACATGCAGGTAATAAGCAGGTACAATTCAGTAAATCAAGCTAACTCGCATCT
+AGTGTGTTTACCAGTGCTCTTATTTCAACTTCCAGTGTTTTTTTTTTTTATCAGGACAGC
+TTCCCTGAAGATATACTGAGTTAATTGCCTTGCTCACTGATAAATGCCATGGTTACTGTT
+TAACTTAATATTGTTATCTTAAAAAAAATGAACCCTTGGCAATGGTCACTCTTTCCACAG
+GTCCCACTGAGCCCAGAGTGCAATCGTGCCATTATGAAACTGGTGTACTGCCCTCATTGC
+AGAGGTCTGGGATCAGTCAAACCTTGCATCAACTACTGCAAAAATGTGATGAAGGGCTGC
+CTGGCTAATC
+> ZDH51_49i11.q1k R19520355 uid=42309883
+TCTACTTTCCTTCCCGAACTGCATTGCTTTTCCCTGAGGGACCCTATAAACCCCCACGCT
+TTGACATCAGAGGGGTGGAGGTTCCTGATAAAGAGGAATGATTGTGAAAGACGTCTCAGA
+GAAGCACCATTGGTATTCTTTTGCAAGAGTTGTACCAAACTGTACCATCCCACATCCTTG
+GACCTCTTGGGAAACTGTACTGACAAGCAATTATTTGCACAGTGCAATTATCGCATATTG
+TGTGTGACACAAAACAATTCACAGGGCTTTTTTTTTCTTGTTAAGTGATTCATTATGGTT
+GAGCTGTTCTTTAAATTGTGTTTTTTGTGTTTTGCAGGTTTCTCTGAGCACTGAATGTGT
+GCGTGCTGTCATGAAGCAGACGTATTGTCCTCACTGTAGTGGCGTGGCCTTGGCCAAACC
+CTGCTCAAACTACTGTCGAAATGTCTTAAAAGGCTGCCTCGCCAATCAAGCAGACCTGGA
+CACTGAGTGGAGGAACCTTGCAGGTGGGCGGGACCAATAAACAACTCTATTTGCTTAAGT
+CTGACATCAAAAGTCACTGTT
+> ZDH51_192d17.p1k R19639950 uid=42435272
+TCTGATGTCTACAAAACACATTATTATTATTTTATTATTTTATTTTAGTTTAATAATTAA
+TAATAATCATTATTAATATTATTATTATTATTATTATTATTATTATTATTATTAATCTGC
+CTGCATTATTCAAAAGCAAAAACATTCAGAAAGCCATTATTTGCTTCACAAACCAAACCT
+GAAAAAATCTGCAAGAATATTACAAATATAACACTTTTTTTTTAGGTACACATATTGAAC
+CCTTGCCAATAACAAGGAAGCAAATATACCATAGAATGGTCTTCAATGGGGATATTTTTG
+TCCTGAGACAAACTTTTTAGTTCTTAGTGTAAAACAGATTTAAGACAGAAAATGAGTATT
+GCGAAACAATAATTCTAGTGTAGAGCTCATCAGTGAGGCTATTATGTGAAAAGCCTAAAT
+TAACACAGGAAAGAACTGAATTAAGCCCTTGGAGAGCCACCAGGGAACTCAATCACATAT
+TTTGAGTTTTAAAGAAAAATAAACACTGACAACACTGTACTGTACAACTAATGTCTGGAG
+ACAAACTGACATCATACTAAACAAGAGTACCGCAAACTACCAGCTTCACCAAGGCTGTAG
+ATAAACCACCCAAGCATGATTAACCAGCGCACCAACCTTGGAAAGCGGCCACATTTCGTG
+AGAAGAGGAACTTTAGGCTGGAGCTAGAGATCTGGAGAAGGTTCTGAATATCCCGCCGGG
+CCGCCACCTGGTAACGCTCCTCCATCTTTTTGGTGCAGCATGTTAGATTCCTGGATAAGC
+AAACCTGCAGGTCTGAACCTGAAAAAGAACAAATATTATTTGTTATCTAAAGTGGCAATG
+TAAAAAAACAACACTTAATACACAAATACACTCAATTGAACATGCACACATAGACATCAC
+CTATACTTTGTCATCACCTATACCTATACAACAGTACTTAGTCTCCCTT
+> ZDH51_6g24.p1k R19711629 uid=43009410
+CTCATTTTTATCATTGATTTTTTTTATCTGTGCCATAATCACAGTAAATAATATTTTACT
+AGATCCTTTTCAAGATACTAGTATTTAGCTTAGTGACATTTAAAGGCTTAACTAGGTTAA
+TTAGGAAAGTTAGGATAAATTAGGCAAGTTATTAACAATGGTTTGTTCTTTAGACAATCA
+AAAACAAAATTGCTAAAGGGGGGCTAATAATATTGACTTTAAAAGGGTTTAAAAAAAATC
+AAAACTGCTTTTATTCTAGCTGAAATAAAACAAAAGACTTTCTCCAGAAGAAAAAATATT
+ATCAGACATTCTGTGAAAATTTCCTTGCTCTGTTAAACATCATTTGGGAAATACTTGAAG
+AAGAAAACATTACAAATCCAGAGAACATATGTTTCAAGTGTAGTTGGTTTGCTTATTTCA
+AGAATTATGTAATTCTAGATATATTTTTAATTTCTGTGAAGCAAGTCGACAGTGAGATTC
+CAGCGCATTTGCTGACCCCAGAAGGTCAATGAAGCTGCGGAAACTTCATAAAGAACGCGC
+ATCTGTCTAACAAGCTACTGTTCTGTCTTTTACTGCAGATGTGGAACTGTCGGTGTGCAA
+GCATGCGGGGCCATCATGTTGTACACGAAGAATGGAAGACAGTTACAGAGCGGCGGTCCT
+GAGAGACACCACCCAGAACATCGGATCGTACAGCTATGAGCTCAAATTTCTCATTTCTGC
+ACACGCCGCCGCCTTCCAGGGTACACAGATGCATGGATGATTGAATGGATGGTGGAAGGA
+TGAAATGGATGATTGATAAGTGAAACGAATGGGCAAATAGATGAAGTTGATTGATGTGTG
+AATGAATATATGTTGATGTAACAACAGAGGCTCATTTAGGGCCCTGTGATTTACACAATG
+CTGACAAAACTGA
+> ZDH51_468l03.p1k R19729132 uid=43027337
+TGAGAGACTTAATTTTTTTATTATGTTAGACAACTTTCAAAACTTTATTCCGTTACTAAT
+AAACTTTTTTCTACTCTATTATTTCTTTCAGAAAGCGTGGAGTCTCTGGTGCGTCAGGCG
+GAGAACCACACCCTCTCCATCCTCCATCAGTCCCAGCGTGATCTCTCCAGCCCAGCAGCA
+TCAGCACCAGTCGGGGAGTTTTTCACAGAAGTGGCTCTGTTCATCCTGGGCTCTGAGCTC
+AGTCTAGAAGAGTCCTCTCAGAGCTTCTTCAACGCTCTTTTCCCCTTAATATACGAGCGT
+CTGATTGACTCCCGTCTGTCTCCTCCATACGCCGAATGCCTGCGCTCGTCTGCTCAAGAT
+CTAGCACCGTTCGGAGCAGCCCCAATCCGCCTGGCGTCCCAAATCGCCCATGCTTCTCTA
+CCTGCTCGCGTGTTTCTCCAAGCGCTCCATTTGGGCATCGAGATCATAAATACGACCGAT
+CACATCCAGCTGAGCCGCGAGTGCAGACGTGGCCTACTGAGGATGAGCTACTGCCCGCAC
+TGCAAGGCTCTGACCTCCAGCAAACCCTGCTTGGGATACTGCCTGAACGTGGTGCGCGGG
+TGTCTGGCTAACCTGGCTGAAGTGGATGCCCACTGGAGGGAGTTTGTACGCTCGCTGGAG
+ACGCTGGCAGTACGGATGCACGGAGAGCTGGATCTGGAGCAGGTGCTGCTGGGGGCGCAT
+GAGCTGGTGAGGGACGCTGTGGCGCACGCTCAGAGGAGCACAGCGAGGATACATGCG
+> ZDH51_901l16.p1k R19931825 uid=43234559
+ACATACTCATCCCTCATGTCGTCCATCTCCCCTCACATCGTCTGCCTCTTCACGGACCTC
+TCTCGCTTCCTCCAGGGCACCGGCAACGTCTCGGTGGAAGCTGCTGTGCACTGTTTCTTC
+GACAGCCTTTTCCCATTGGTCCACACTCAGATTGTCAATCCCGGTATGGAAGGAAGTATT
+GGGACAGATGCTTCTGAAGGCAACCAGCTTGGTGACTGTCTCCGAATGACCAGGCAGGAC
+GTAAACCCCTTTGGTCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGG
+GCTGGGCGGGTGCTCAGCTTGGCACTTGCCGAAGGGTCAGAGGTGATGAACATTACGGAA
+ACAGCAGGGTTATCAAAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCAC
+TGCCGTGGACTCACCCTGATCCATGCGTGCAGCAACTACTGTCTTAATGTCATGCGCGGG
+TGCCTGGCGAGCTACTCCGAGCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGCAG
+GACCTCACGCAAATGGTTGCCGGAGCTCACAATTTAGAGCTGGCCTTACTGGGGATCAGA
+GGTCAGGTCGAGGAGGCCATACTCTACGCTCAGCTTCACGGGCCCAGGCTAACTGCCACA
+GTGAGTACTAGCATTTTTACGCTTTTACAGCTAGCATTAGCTTGTATTGTAGCATGAAAA
+AAGGTCTACAGAGTTATGAAGCACAAAGACCTCTTCTGCTATAAGCGGGTTTCTGAACTC
+TTTTCAATAGGCTCAATTGTAGTTCT
+> ZDH51_977d16.p1k R20066747 uid=43371791
+TTATTTGATATATTTTACTGGAAACATTAACTCTACAGGTGCCTAATAATTAGCTGTGGA
+GCTAACATAAATCGTTTTATTCCATCTAGTAAACGCATAAAAATCGACATCATAATTTAC
+TCAAGTGCACGCCTCAATGTCTCGCGTCCCTCTTAATAGGTGCTGGCAAGCCCCACAGTT
+TGAAACCCCTGGTGTATATATAGTTATTCTACTATAAAATCTGCTTTGTTAAATTTGTTG
+TTTGCTTTTGGCATCTGCTAGAGCTTTTGTACCAAGAAACAGTGACTTTTGATGTCAGAC
+TTAAGCAAATAGAGTTGTTTATTGGTCCCGCCCACCTGCAAGGTTCCTCCACTCAGTGTC
+CAGGTCTGCTTGATTGGCGAGGCAGCCTTTTAAGACATTTCGACAGTAGTTTGAGCAGGG
+TTTGGCCAAGGCCACGCCACTACAGTGAGGACAATACGTCTGCTTCATGACAGCACGCAC
+ACATTCAGTGCTCAGAGAAACCTGCAAAACACAAAAAACACAATTTAAAGAACAGCTCAA
+CCATAATGAATCACTTAACAAGAAAAAAAAAGCCCTGTGAATTGTTTTGTGTCACACACA
+ATATGCGATAATTGCACTGTGCAAATAATTGCTTGTCAGTACAGTTTCCCAAGAGGTCCA
+AGGATGTGGGATGGTACAGTTTGGTACAACTCTTGCAAAAGAATACCCATGGTGCTTCTC
+TGAGACGTCTTTCACAATCATTCCTCTTTATCAGGAACCTCCACCCCTCTGATGTCAAAG
+CGTGGGGGTTTATAGGGTCCCTCAGGGAAAAGCAATGCAGTTCGGGAAGGAAAGTAGAAC
+TTGACATTTGCTTGTTGTTTAAATGAATCTAATTTCACGGATATTGAA
+> ZDH51_470a08.p1k R20099294 uid=43404866
+GAAAGGCGAGAGAAGAGGTGGAGACATGTCGTTTACATTGGCATCAGAGCCCAGAATGTA
+AAGTGACATATCCAGGAATAACTGCGTGACGGCTCCACTGGCTCCAGCCCCCAAACCAGG
+AAACTCCTCGCGTAACACCATCAGAGTGGAATTACGGCCCAGACGAAGCACCATGTCAAA
+AGCCTCTGAAAAAAGACAGAAAAGAGAGATTGAGTAACTATAAAGTTTGATTTTAGTTAC
+ATTTCAACACCACAGTGATAATGTGCTGAAATGTAATATGTGTGTATTTATGTAGCCCAT
+TTATCGTGTATGGCCATACACCCAAAGAGCTCCACAATCATGACAGGGATCCCTTCACAC
+CACCCCCAGTGTGCAGAATCCACTTGGATGATGTGACCGTACCAACATGACAACAGCGCC
+AGTGCGCTCACCACACACCAGCTATAGGTGGAGTGAAGAGAAAGTGATACAGCTAATTTG
+GTGGATGGGGATGATTGGGAGGCCATGATGGGTAAGGACCGGAGGTAATTTGGCCAGGAT
+GCCGGGGTTAGGGCTGGTTTATACTTCTGTGTCGAGTGATTGCCGTGACCCACAGCACCT
+GTCTTGCGCGTAACTGTGCATTTATACTTCTGTATGCTGTTTTTGTTGCTCTGCACTCT
+> zDH53-234d09.p1k R20285592 uid=44095236
+CGCATCTCACCAATAAAGAGGTTCCACTCAGGGTCCAGATCCGCTTGGTTGGCCAGGCAG
+CCGCGCATCACATTCTGGCAGTAGTTGGCGCAGGGTTTGAGTCCTGACATTCCTCCACAA
+TACGGGCAGTACCACATTTTAGTCAATGCTTTACTGCAGCCTGGAGAAATATTGACCTGC
+AGGATAAACACACATGGGCAGATGTTAAATGTGCTTTGAAATGTGCATTTTTTTTTATTT
+AAAGTTTGACGTAATCCCAACTGAAACATAAAGAGAGAGCAGGACATACAGTAGCTCCTC
+CCAAAAAACAGCCAATATAGTTTCATTTTTTATCACAGCCTTGCCAGTGACAGGGACTGT
+ACCTGTATGCCTACAACTGATGTCAAAATTATTCGCCCTCCTGTGATTTTGTTTTACTTT
+TTCAAATGTTTCCCAAATGATGTTTAACAGCGCAAGGAAATTTTTTACAGTGTCTCCAAT
+GATATTTTCTACAATATATCTTCTATTAAGTCTTTGTTTTATTTTTTATAACTGCT
+> zDH54-171n05.p1k R20391718 uid=44203880
+CCTTCAGCTAATATACAAGCATGATTACTCTGCCCTCCATACCTGGCTTTCCCAAAAGAC
+TTCAAAGTTTGAAGTAGATGACCTGAATCAACATGCAGGTAATAAGCAGGTACAATTCAG
+TAAATCAAGCTAACTCGCATCTAGTGTGTTTACCAGTGCTCTTATTTCAACTTCCAGTGT
+TTTTTTTTTTTATCAGGACAGCTTCCCTGAAGATATACTGAGTTAATTGCCTTGCTCACT
+GATAAATGCCATGGTTACTGTTTAACTTAATATTGTTATCTTAAAAAAAATGAACCCTTG
+GCAATGGTCACTCTTTCCACAGGTCCCACTGAGCCCAGAGTGCAATCGTGCCATTATGAA
+ACTGGTGTACTGCCCTCATTGCAGAGGTCTGGGATCAGTCAAACCTTGCATCAACTACTG
+CAAAAATGTGATGAAGGGCTGCCTGGCTAATCAGGCTGACCTGGACACTGAGTGGCAGAG
+CCTCATAGGTAGGGCTTATAACACTAGAACTCTCAAGGCTGGTTTATACTTCTGCGTCGA
+GTGATTGTCGTGACCCACGGTGCCTGCCTAGCATGTAGTCATGCATTTATACTTCTGCGC
+ACTGTGTTGCTCTGCAGTAAAACTTCCAAAACGCTAGCTAGCAGTAGGTTTTTATGATCC
+TGTGTCGAG
+> zDH52-513a01.q1ka R20550535 uid=44366456
+AAGGATCTCCTGTGAGCATGAAAAACAGCGGACAAAAGCCAAATCTCCAAGTAACCTTGG
+AAAGTCATGATGTACAATGTAAGAAATGTTAAACACCACCTCTGTGTTTCCTATGCAATA
+CATACAAAGTAATAACATGTCATATGACCCACCTGCTGTGGCAGGGACTTGATCCCATGA
+CCTACTACTGCTGCTGCTGCGAATGCAAAAAGCACATGTCCTAGTGTTTGTTTGGCCAAT
+AAGCTTCACTCCATCTCAATACATACCCTGGAAGGAAGAAGCATGGCCCAGGATGAGATA
+CTTGAGTTCGAAGCTATAGGAGAGAATGTTTTGGAGTGTGTCTCTTTGAGCAGCTGAGTA
+GTAGCTCTCCTCCATCTTGCGGGTACAGCATGTGGGACCCTGGTGTTTACAGATGAGAAG
+TTCTGCATCTGTGATGGATTAATCATAGAAGGTGACTTAAGTAGAAACATTTGTGCCTAT
+TTAAACCACCATGTCTCATAACTTTCATATGTTGGATTTCTGAGTACAGTTTTTAACCCT
+CATGCAAATACCTCCTCTAAAGTTTTTTTTTCCAAGCTAACAAACTGATTATGAACACCT
+GAATGGCTTTC
+> zDH52-125e06.p1k R20843539 uid=45164558
+TGCTCAGGACTGTCAAGGCGCTTGTGGTTGGTCGTGCCCTCAGCCGGGCACTGGCAGTCG
+GTGCAGATGTACTTAACATCACAGAGTCTGTGGGCATGGGACGAGTGTGTGGACGTGCAC
+TAGTGCGCATGTTGTTCTGTCCTCACTGTCGAGGACTGACCCTGATCCGGCCATGTGGAG
+GCCTATGTCTCAACGTGATGCGAGGTTGCCTGGCAGGCGTGGCTGAGCTGGATGCTCCCT
+GGCGAGACTATGTATCGCTTCTGGAGAAGCTGAGTGGGGCATTATCAGAGAGATATGAAG
+TGGAACTGGGACTTCTACGCATCCGGGAAAGAATTAATGATGCCATCCTCACTGCGCAAC
+TGCACGGGCCACATCTTAGCGCCGTGGTGAGTCATGCTACTCTCTGATTCATAGAACACA
+TTTATTTTTATTCCACGAACGAGCTGCACCATGTGTTGGACTAATCAGTTCTAGTGGGCA
+TGCACTTGAAGCAGCATGTTTGGTGACTGGTGCATATCAAATGTCTCGACCAATCGTAGT
+CTGTGCAGTTACAAGGCTGCCGTTTTGCACATTTAAGACAATTTGGCTTTAATCTAAAAT
+AAATAACTTGTATAAATTCGCATTTTAGCCTAAAGTTTTCAGTTCTAAATTGTGTAAAAC
+GAAGCCCTATGATTATTCTATCTGCAAGGGGTTTATTATTAGC
+> zDH52-1022f08.q1k R21200402 uid=46030880
+CTATCAAGCAATGCATCTCTCCGTCCATCAATCCATCCGTCAGAATCATTGTGTCTGAAG
+ACTGTTTTATGATGCATCTGTGCTTTTGTTAATTGTGCTGTAGTTTACATACAGAACAGC
+CAAGCATACAGGTTACTGACCTCATCAAAACCCTGTATAAATGTGTGTGTGCTCGAGGTG
+TGTGTGTTCCTCTTACCGATAAATTTGCTCCATTCGTTGTTGAGATCGGCCTGGTTTGCC
+AAGCAGCCCTTCATGACATTCAGACAGTAGTTTCTGCAGGGCTTCAGTGTGAACAGACCC
+TGACAATACGAGCAGTAGAGCATCTTCGTGAAGCCGCTGACACACGACGAGCTCATGCTG
+ACCTGCGCACACACACACACGGCAATAATACAACAGTCACCACACTACTTGTAGTGATGC
+TACAGCCTGACACTGGATGTCTCATAGTTTTGATTCGTACAATTGAATATAACTTTTAAA
+AATAAATAAATAAATAAAAAAAGTTAGAGAACAAAAAAATTATTTAGAGAAGAAAAAAAA
+ATTTCAAGAAGAGGTTGGGGGTCATAAAATAAAATGATATAAAAAAAAAGTCACAAACAC
+AATTTAGGGTTTTTTCATCTCACCTGAGCGACTCTGTTAGCGACGTCACGTCCGACCGCA
+AGTCCCTGTACGAATGTGCGCGCCGCAATAAACGCGCGAGTCACCTGTGATTTCAGCTTT
+TTAGGCACATCTCCAAACGGCCGCAGCTGCTCCGTGTATTTACCGATGCACTCCAAATAT
+TCGTCCGTGATCTGAAACTGAGAGTTGAGCAGCTGAAACATGCGCTCTAGTAATCGTGTC
+CAGAAGTCCTTTAGCATCT
+> zDH52-940l03.q1k R21278335 uid=46110316
+TTGCATGTACATGATGCCTTCAGAAACCGTCACATTTATGGCGTCCGCAGCCAGCTCAAA
+GTTAAACGGCCCGCCGAGATTTCTCCACCACCACTGATCAGAGCATCTGCAGGACACACA
+CACACACATCAGACACACACACACATCAGACACACACACACACACACAAACACACACACA
+CATCAGACACATAGCGGACACACACACACACACACACACATCAGACACATAGCGGACATA
+CACACACACACACACAGCGGACACACACACACACACACACACAGCGGACACACACACACA
+CACACACACAGTAAATGAAGCAGAGGTGTTCTGTTCTCACCAATGAAGCTGTTCCACTCG
+CTGTTTAGATCCGCCTGATTGGCCAGACAGCCCTTCATGATGTTCAGGCACAGCGAATGA
+CAGGGCTTGAGTGACGGAAGACCCCGACACAGAGGACAGAACCACTGACGCATGAGCGCG
+CGCACACCACTCTGGCCCCGCGCGCAGCTACACACACGTAGAGAGAGACACACACACACA
+CACACACCAGTGGCTGTGAGTGAGGCTGCAGGAGCACAGAGCTCTGCTGGATCTGAC
+> zDH52-1289d08.p1k R21331542 uid=46164747
+TACATTCATCCATAAATCTGTCAACCCATAAATCTAGCCATCAATCAATCCATAATTCTA
+TCAAGCAATGCATCTCTCCGTCCATCAATCCATCCGTCAGAATCATTGTGTCTGAAGACT
+GTTTTATGATGCATCTGTGCTTTTGTTAATTGTGCTGTAGTTTACATACAGAACAGCCAA
+GCATACAGGTTACTGACCTCATCAAAACCCTGTATAAATGTGTGTGTGCTCGAGGTGTGT
+GTGTTCCTCTTACCGATAAATTTGCTCCATTCGTTGTTGAGATCGGCCTGGTTTGCCAAG
+CAGCCCTTCATGACATTCAGACAGTAGTTTCTGCAGGGCTTCAGTGTGAACAGACCCTGA
+CAATACGAGCAGTAGAGCATCTTCGTGAAGCCGCTGACACACGACGAGCTCATGCTGACC
+TGCGCACACACACACACGGCAATAATACAACAGTCACCACACTACTTGTAGTGATGCTAC
+AGCCTGACACTGGATGTCTCATAGTTTTGATTCGTACAATTGAATATAACTTTTAAAAAT
+AAATAAATAAATAAAAAAAGTTAGAGAACAAAAAAATTATTTAGAGAAGAAAAAAAAATT
+TCAAGAAGAGGTTGGGGGTCATAAAATAAAATGATATAAAAAAAAAGTCACAAACACAAT
+TTAGGGTTTTTTCATCTCACCTGAGCGACTCTGTTAGCGACGTCACGTCCGACCGCAAGT
+CCCTGTACGAATGTGCGCGCCGCAATAAACGCGCGAGTCACCTGTGATTTCAGCTTTTTA
+GGCACATCTCCAAACGGCCGCAGCTGCTCCGTGTATTTACCGATGCACTCCAAATATTCG
+TCCGTGATCTGAAACTGAGAGTTGAGCAGCTGAAACAT
+> zDH52-970g14.q1k R21358471 uid=46192120
+TAAAAGATATCAGATATTAGAAATGAGTTACTGAAACTATTATACTTAGAAAAGTGTTAA
+AAAAAATCTTTCTGATAAACGAGAATATGTGGGAAAAAATATATACAGAGGAACTAACAA
+TTAAGGAGGGCTAATAATTACGGACACATTTAAAGCATGTTAATACTGCAGGTCTTTCTT
+ACCAAGGAAGTTATTCCACTCTGTGTCCAGATCGGCCTGATTGGCCAGACAGCCCCTCAT
+GACATTCAGACAGTAGTTCTTGCAGGGCTTCAGCGCCACCTGACCGCTACAGTACGGGCA
+GTATAACATCTTCATCGATGCGCGCACACAGCTCGGTGAGGCGCTCACCTGAGAAAAAGG
+ACGAACAGGAAGAGTAATTGAGCAGAGTCAGCAAAACAGACAGAAAAGGTTAATGAGTCC
+GTAACCTAATTCATATGCCTGATGTTGCTGATAAAACACTGAACAAAGAGCATTAGCGAC
+CCCACCACCTTTTATAAGGTCACTGCTGAACTCGTGTTTGCTCAATTTATCATTGAAGGT
+TCAATTGCTTCTGCTAACTCACAACACACACACACAGAGAAAGAGAAAGCCTTGGCCTCT
+GATCTTTTAATGCTAGAAGATAAGCCTTGATTGGTCCATCCAGGTGTCCACCTTCACATA
+CTGATAACCTGATAGAAAACCTTTACTTTTCATTTCTGCTGACTCGCTTAAAAACTACGA
+TTTGCCAAATTTGCTTTAGGGCTGGCTATTGATTAAGTTTTCCACGTTCAGATGGTATTT
+AACAAAAAAAAAATTTCAGCTTAGTCCCCTTATTAATCAGGGGTTGCCACAGCAGAATGA
+ACCGCAATTTATCCAGCATATGCTTT
+> zDH52-887e07.q1k R21384645 uid=46218818
+TGACAGATCAATGATAAAATAAAGCCTGGTGATTAAAAACCTGCAATACCTTGACAAGAA
+CTTTCATGTAAACTGAAGTACTAACTAAAAAAGGTGTCCTGAGAAATCTCGACAGTTTTT
+TGAGTTTGATAGCCCTGGGCTCAATCAGAAAACTAGCCAGTCAGAAACACTCTTCATTTC
+ACTCGTTCGGGTCTGCTGACACTGACTTTGCTGACAAGTCTTTGGAGGTTGAGTTTTGGA
+GAGAGATGGCGTTAGCAAAAATGGCTGAAGTTAGCAAAATGGCTGCAGTCGCCTACAGCA
+TTCGAATTCATACCTTGTTTCTGAGACCATGTGTCACTCACCTGGGCGCTGACTTTGCTC
+TTGCTTGCCACGGCTTGTTTGAGAGCCTGTCTGATAATGACGTGCAGTCGGAGCACCACA
+GCCTCGATGTCCTGTTCCCCCTTCATGGCAGCGGCGAGTGACCCCAGTTCATCCACATAT
+GCTCTCCAATGAGGCTGTACCTCCGTGGTTCCCCCCAAACATGCTCCCATGGTGCTGATA
+CACAGTGGACGGCACGGCCGGGCCTCCAGCAGGCTTTGACAGTGCGGGCAGTACCACAGT
+TTCAGAAGCGAGCGCCCACAATCTCTACCTGCCCGCAAATGCTGAGTGGTGTTGACCACT
+TCTATGCCCAAATTTAGCGCTTGCAGGAAGACCCGAGTGGCGAGGAGTGAGCGGGATAGT
+CGGGTCATCATCATCTTGGGAAATGACCCATACGCAGAGCTCCCTTTCCAGGCCCC
+> zDH40-924o11.q1k R21751331 uid=47094775
+ACTGATGTCCATGTAAATGTAGTCAGTATCTTCAAAGTACGTGAAAGATCCAAATGGGCA
+TTCTCCTGATTTGATTCAGAAGGGCACTTTTTTGTCAGATGGCTCAGCGGTTTGACTTTC
+ATTTATTCACCGTCATTAGTTTTAAAAAGCACTCTTTCCATTTTATTTGTATATATTTTA
+CTGGAACACATTAACTCTACAGGTGCCTAATAATTAGCTGTGGAGCTAACATAAATCGTT
+TTATTCCATCTAGTAAACGCATAAAAATCGACATCATAATTTACTCAAGTGCACGCCTCA
+ATGTCTCGCGTCCCTCTTAATAGGTGCTGGCAAGCCCCACAGTTTGAAACCCCTGGTGTA
+TATATAGTTATTCTACTATAAAATCTGCTTTGTTAAATTTGTTGTTTGCTTTTGGCATCT
+GCTAGAGCTTTTGTACCAAGAAACAGTGACTTTTGATGTCAGACTTAAGCAAATAGAGTT
+GTTTATTGGTCCCGCCCACCTGCAAGGTTCCTCCACTCAGTGTCCAGGTCTGCTTGATTG
+GCGAGGCAGCCTTTTAAGACATTTCGACAGTAGTTTGAGCAGGGTTTGGCCAAGGCCACG
+CCACTACAGTGAGGACAATACGTCTGCTTCATGACAGCACGCACACATTCAGTGCTCAGA
+GAAACCTGCAAAACACAAAAAACACAATTTAAAGAACAGCTCAACCATAATGAATCACTT
+AACAAGAAAAAAAAAGCCCTGTGAATTGTTTTGTGTCACACACAATATGCGATAATTGCA
+CTGTGCAAATAA
+> zDH41-20f07.p1k R21819503 uid=47164347
+CCGGTCCTTACCCATCATGGCCTCCCAATCATCCCCATCCACCAAATTAGCTGTATCACT
+TTCTCTTCACTCCACCTATAGCTGGTGTGTGGTGAGCGCACTGGCGCTGTTGTCATGTTG
+GTACGGTCACATCATCCAAGTGGATTCTGCACACTGGGGGTGGTGTGAAGGGATCCCTGT
+CATGATTGTGGAGCTCTTTGGGTGTATGGCCATACACGATAAATGGGCTACATAAATACA
+CACATATTACATTTCAGCACATTATCACTGTGGTGTTGAAATGTAACTAAAATCAAACTT
+TATAGTTACTCAATCTCTCTTTTCTGTCTTTTTTCAGAGGCTTTTGACATGGTGCTTCGT
+CTGGGCCGTAATTCCACTCTGATGGTGTTACGCGAGGAGTTTCCTGGTTTGGGGGCTGGA
+GCCAGTGGAGCCGTCACGCAGTTATTCCTGGATATGTCACTTTACATTCTGGGCTCTGAT
+GCCAATGTAAACGACATGGTCTCCACCTTCTTCTCTCGCCTTTTCCCTCTCACCTACCGT
+CGACTTCTGGGCAATGGGGCCGTGGCGGGCATCTCTGAAGAATGCCTCCGCGGGGCCTGG
+AAAGGGAGCTCTGCGTATGGGTCATTTCCCAAGATGATGATGACCCGACTATCCCGCTCA
+CTCCTCGCCACTCGGGTCTTCCTGCAAGCGCTAAATTTGGGCATAGAAGTGGTCAACACC
+ACTCAGCATTTGCGGGCAGGTAGAGATTGTGGGCGCTCGCTTCTGAAACTGTGGTACTGC
+CCGCACTGTTCAAGCCTGCTGGAGGCCCGGCCGTGCCGTCCACTGTGTATCAGC
+> zDH40-257l09.p1k R21839005 uid=47184151
+TTTTTCTTATTTTTCCTTTGTTTTTTTTGATTGTTTGGGTTTTTACCAAAATCTGGTTTC
+ATTTCAAGCAGCTCCATTTTGAATATTTTCCCCAGAAAAACAAAAATAAAAAACAAGATA
+TGTTGAATGCTTATTTCCCCCACTGTAAGTAAGTTCTTTATGCAAACTTGACACATTTTT
+TCGACCAAATCAAAAGTAATGTTGTACAATGCATTCAATTGGTTGGACTCGTGTTATATT
+ACCATCAATCATATTTTCATCAGACACCACACTGAAAAATTCTTCCAACAGACAAAAATC
+CTTGGGAAAACATGAGCTTTGAAAATTAAATGTGACCTTAAGCTATTCCAAATTATTTAT
+CAGGCTATACTCATTCCCTTGTGCGCTCATTTTTATTTACACATGCCATGTACCTTGACA
+AGGCTCCAAAGTAACCACAATGATGTGGAACAGTTATTCTGCACCGCTGCAAGCATACAG
+AAGAACTATTAATCTTAGTTTACATGTCTGCAAACTGAATGACGCCACCTAATGAATTTA
+CTCACGTTTTAATGAACATCAATGCCCTTACTTTGAGCTGTAGGAGTCCACAATGAAGGA
+ATGTAGAGGTTACATCGCATCAATGCTCCCACAAATGAATTACTCACTTGTCTGTCATCT
+CCTGTCCGTTCCAGCAGAGGGAGCTGTTCAGCGATGTCGGCTCTTTGCTGCACAAAGCTT
+CTCCGAGACCACTGTAGAACTGACTGAAGCCCCTTAGACCCGAGATAAACTCCCTGCAGC
+AGACAGAGAGGAAATTGAGAATGTATTGAGTG
+> zDH41-8i02.p1k R21945656 uid=47292942
+CTTTGAATTGAAAAAAATTAAGAATTTTCTCAAAATAAGTGTTAAAATAAGATTTATCAC
+CTAAAACAACGTTTGTCACCATTCTGCTAGCTGAAACAAAAAAAGTTAAGACCAAAATAA
+CATTCAAAACCACGCCAGAGTGGATGAAAACATCCCCAGCAACACATAAGAGTTACCATA
+TGATACCACTATGGATCCTCTTGGTTCTAATGCATGCTCTTTTAAGCATAAAAGTGTACC
+TTTTAAAAGGGTACCACCCCAGTGACAGGTTTCATACATTTCTGAGAGTGTGTTAAGAAT
+TAATGTGTTCTTGACTCTAAGCATTTCAGCTTTCCGCCCAAGGGGATGCTAAAGGTTTAA
+CTTATGACAAAAATGTACCCAAAAATGGCTTCACAAACAGAAATGTAGCAGAAACTCACC
+TTGAAAGAGGGCAGCATTCTGGATGATGAGCCCTTTGAGCTGAGCGCTGGTGGCCTGAAG
+GCTAGACTCCATATTCTGTTTGGCAATAAGCAGGTAACGCTCCTCCATTTTGCGAGAACA
+GCAAGTCAGGCCTTTTGGCTGGCACACCTGCAGATCTGAGCCTGTAGAATAACAGAGAGA
+AGATTTCTAACAGCCGTCACAATAAACAAGTAAACAGACCGCGGCATTTTATAAACTGAA
+GCTTGGCTTGTAAATCGAAAACAAAGAGAGCTGCAGAAAATGGTTTGTTTTATAGAGTAC
+ACATTGTTTACGCTACTTGTACAAATTTCAAAGAACGCCACAAAACAAATATCTGCAACT
+TAATCGAAACATGTTATTTAATTTCATTTCCACACATTGCATTTCATCTTGTTGCCTTGT
+GCCAAAATGATTAGCA
+> zDH41-767i19.q1k R22207143 uid=48077474
+TAAAGTGTTTTTGATTGAAAAAAGGCACCCAACTGGAAGTTCTTTATAGGGGACATCTAT
+ATTAGAAAACCCAGCTTAAGGTACAATAGCAAGCGCATCTCACCAATAAAGAGGTTCCAC
+TCAGGGTCCAGATCCGCTTGGTTGGCCAGGCAGCCGCGCATCACATTCTGGCAGTAGTTG
+GCGCAGGGTTTGAGTCCTGACATTCCTCCACAATACGGGCAGTACCACATTTTAGTCAAT
+GCTTTACTGCAGCCTGGAGAAATATTGACCTGCAGGATAAACACACATGGGCAGATGTTA
+AATGTGCTTTGAAATGTGCATTTTTTTTTATTTAAAGTTTGACGTAATCCCAACTGAAAC
+ATAAAGAGAGAGCAGGACATACAGTAGCTCCTCCCAAAAAACAGCCAATATAGTTTCATT
+TTTTATCACAGCCTTGCCAGTGACAGGGACTGTACCTGTATGCCTACAACTGATGTCAAA
+ATTATTCGCCCTCCTGTGATTTTGTTTTACTTTTTCAAATGTTTCCCAAATGATGTTTAA
+CAGCGCAAGGAAATTTTTACAGTGTCTCCAATGATATTTTCTACAATATATCTTCTATTA
+AGTCTTTGTTTTATTTTTTATAACTGCTAGAATAAAAGCAGTTTTTT
+> zDH41-114b04.p1k R22214027 uid=48084478
+GATTTCTTACAGAATTGGAATCTTGGTCTCCCGCTGCCAAACTCTCGAGAGATTCCTGCT
+AAGCAGACCTAAATTCTTGCTGATGTTGGGAATAGATCAGTTCAGAATATTGCGTGCCTT
+GTAAAAAACATCAGTAAAATCTGAATTCCACTGCATGGCACGTTCATAGGGATTAGCATT
+CAACATGAATACGTTTAGTCATGGCCATATTCAAGTTTGTTGAGCAGCATGACAGGTTCA
+CATTCTGTCAGAATAAAGCGATTCAACTGAAGATGCCTTCAGCTAATATACAAGCATGAT
+TACTCTGCCCTCCATACCTGGCTTTCCCAAAAGACTTCAAAGTTTGAAGTAGATGACCTG
+AATCAACATGCAGGTAATAAGCAGGTACAATTCAGTAAATCAAGCTAACTCGCATCTAGT
+GTGTTTACCAGTGCTCTTATTTCAACTTCCAGTGTTTTTTTTTTTTATCAGGACAGCTTC
+CCTGAAGATATACTGAGTTAATTGCCTTGCTCACTGATAAATGCCATGGTTACTGTTTAA
+CTTAATATTGTTATCTTAAAAAAAATGAACCCTTGGCAATGGTCACTCTTTCCACAGGTC
+CCACTGAGCCCAGAGTGCAATCGTGCCATTATGAAACTGGTGTACTGCCCTCATTGCAGA
+GGTCTGGGATCAGTCAAACCTTGCATCAACTACTGCAAAAATGTGATGAAGGGCTGCCTG
+GCTAATCAGGCTGACCTGGACACTGAGTGGCAGAGCCTCATAGGTAGGGCTTATAACACT
+AGAACTCTCAAGGCTGGTTTATACTTCTGCGTCGAGTGATTGTCGTG
+> zDH41-477l17.p1k R22344864 uid=48239577
+CCCTGCTTGGGATCTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCTGAAGTGG
+ATGCCCACTGGAGGGAGTTTGTACGCTCGCTGGAGACGCTGGCAGTACGGATGCACGGAG
+AGCTGGATCTGGAGCAGGTGCTGCTGGGGGCGCATGAGCTGGTGAGGGACGCTGTGGCGC
+ACGCTCAGAGGAGCACAGCGAGGATACATGCGCAGGTGAGAGGATGAGTGTGTGGTTAGC
+ACTGTCACCTCACAGCAAGAAGGTCACTGGTTCGAGCCCCGGCAGGGCCAGTTAGCATTA
+CTGTGTGGAGTTTGCATGTTCTCCCCGTGTTGACGTGGATTTCCTTCGGGTGTTCCGGTT
+TCCCCAAGTCCCCAAGTGAGAGTGTATGGATGTTTCCCAGTGAT
+> ZDH42-47d24.p1k R22384694 uid=48279915
+TCCTGCCTGGTCATTCGGAGACAGTCACCAAGCTGGTTGCCTTCAGAAGCATCTGTCCCA
+ATACTTCCTTCCATACCGGGATTGACAATCTGAGTGTGGACCAATGGGAAAAGGCTGTCG
+AAGAAACAGTGCACAGCAGCTTCCACCGAGACGTTGCCGGTGCCCTGGAGGAAGCGAGAG
+AGGTCCGTGAAGAGGCAGACGATGTGAGGGGAGATGGACGACATGAGGGATGAGTATGTG
+GTCTCAAACAGAGAGGTCAGGTGGTTCTGGGAGAAGGATATTAGGGACTGGAACGTATCT
+GAAAAAGAAGAAAGATTTAAATGAGTGATAATGATAGAATGATCAGTGGTCTTAATCCTT
+CTCTGCTGTTCAAATTGACTACCCCTTCATTATGTTGGTGGCTGTTTTTGCCCCATTGAC
+TTCCATCATAATCACATTTTTTGATTACAAAGCCAAGACATATAATTATGCATTCTTGAT
+TATTGTTGGTTTTCCTGTTGGGAAGAGGTCAAATGTTTAAGTTTTACTGTTGATCATCAG
+TTGTCACCATTAACCCTTTATATAGGCCTATCATACAAGTTTCTGGCTTTTATATGGAGT
+TCTATGGAGCAAACCAGCAGATTATAGTGTGTGTGTGTGTGTGTGTGTTTGTGTGTGTGT
+GTGTGTGTGTGTGTGTGTGTGTGTGTGTATATATATATACACTTACTGGGCCCTATCATA
+CACCCGGCGCAAAGTGGCGCAAGGCACAGCGCAATAGTCTTTTGCTAGTTTCAGCTTGGC
+GCAAGAGTCGTTTTGAGGCCGTGCGCTACGCTGTTTAAATAGCAAATGCATTAGCGCTCA
+TATGT
+> ZDH42-47h16.p1k R22384727 uid=48279950
+GTTTCGTCCTGCCTGGTCATTCGGAGACAGTCACCAAGCTGGTTGCCTTCAGAAGCATCT
+GTCCCAATACTTCCTTCCATACCGGGATTGACAATCTGAGTGTGGACCAATGGGAAAAGG
+CTGTCGAAGAAACAGTGCACAGCAGCTTCCACCGAGACGTTGCCGGTGCCCTGGAGGAAG
+CGAGAGAGGTCCGTGAAGAGGCAGACGATGTGAGGGGAGATGGACGACATGAGGGATGAG
+TATGTGGTCTCAAACAGAGAGGTCAGGTGGTTCTGGGAGAAGGATATTAGGGACTGGAAC
+GTATCTGAAAAAGAAGAAAGATTTAAATGAGTGATAATGATAGAATGATCAGTGGTCTTA
+ATCCTTCTCTGCTGTTCAAATTGACTACCCCTTCATTATGTTGGTGGCTGTTTTTGCCCC
+ATTGACTTCCATCATAATCACATTTTTTGATTACAAAGCCAAGACATATAATTATGCATT
+CTTGATTATTGTTGGTTTTCCTGTTGGGAAGAGGTCAAATGTTTAAGTTTTACTGTTGAT
+CATCAGTTGTCACCATTAACCCTTTATATAGGCCTATCATACAAGTTTCTGGCTTTTATA
+TGGAGTTCTATGGAGCAAACCAGCAGATTATAGTGTGTGTGTGTGTGTGTGTGTTTGTGT
+GTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTATATATATATACACTTACTGGGCCCT
+ATCATACACCCGGCGCAAAGTGGCGCAAGGCACAGCGCAATAGTCTTTTGCTAGTTTCAG
+CTTGGCGCAAGAGTCGTTTTGAGGCGTTGCGCT
+> ZDH42-44k03.p1k R22417670 uid=48313480
+CATCCATTTTCTCCTTCCACCATCCATTTCATCATCCATGCATCTGTGTACCCTGGAAGG
+CGGCGGCGTGTGCAGAAATGAGAAATTTGAGCTCATAGCTGTACGATCCGATGTTCTGGG
+TGGTGTCTCTCAGGACCGCCGCTCTGTAACTGTCTTCCATTCTTCGTGTACAACATGATG
+GCCCCGCATGCTTGCACACCGACAGTTCCACATCTGCAGTAAAAGACAGAACAGTAGCTT
+GTTAGACAGATGCGCGTTCTTTATGAAGTTTCCGCAGCTTCATTGACCTTCTGGGGTCAG
+CAAATGCGCTGGAATCTCACTGTCGACTTGCTTCACAGAAATTAAAAATATATCTAGAAT
+TACATAATTCTTGAAATAAGCAAACCAACTACACTTGAAACATATGTTCTCTGGATTTGT
+AATGTTTTCTTCTTCAAGTATTTCCCAAATGATGTTTAACAGAGCAAGGAAATTTTCACA
+GAATGTCTGATAATATTTTTTCTTCTGGAGAAAGTCTTTTGTTTTATTTCAGCTAGAATA
+AAAGCAGTTTTGATTTTTTTTAAACCCTTTTAAAGTCAATATTATTAGCCCCCCTTTAGC
+AATTTTGTTTTTGATTGTCTAAAGAACAAACCATTGTTAATAACTTGCCTAATTTATCCT
+AACTTTCCTAATTAACCTAGTTAAGCCTTTAAATGTCACTAAGCTAAATACTAGTATCTT
+GAAAAGGATCTAGTAAAATATTATTTACTGTGATTATGGCACAGATAAAAAAAATCAATG
+ATTAAAAATG
+> zDH41-119o22.q1k R22442765 uid=48338986
+GCCAACTTGGTTGCCTTTACCTTGTGCTGAAAATACTTTCCAAAATATTAAGTCATTCTA
+AATGGGAAACTATGCATGCTTGCATGTACCTGGAATTATTGAGAAGACTTATTTTTTTTA
+TTATGTTAGACAACTTTCAAAACTTTAATCCTTTACTAATAAACTTTTTTCTACTCTATT
+ATTTCTTTCAGAAAGCGTGGAGTCTCTGGTGCGTCAGGCGGAGAACCACACCCTCTCCAT
+CCTCCATCAGTCCCAGCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTT
+TTTCACAGAAGTGGCTCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCA
+GAGCTTCTTCAACGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTC
+TCCTCCATACGCCGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGC
+CCCAATCCGCCTGGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCA
+AGCGCTCCATTTGGGCATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGA
+GTGCAGACGTGGCCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAG
+CAAACCCTGCTTGGGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCT
+> zDH41-1075i12.p1k R22586662 uid=48488958
+TCAGCCCAATAGCGCCAGCCCAAAAGATCCATGGATTAAGTGTTGTCAGCTCCCATTAGC
+CCAATGGAAAGAGAGATTAGATACACAAGAAAGAGTCGTAAGCAATGCGAGACAAGGCAG
+AGGTGCACCATGACAGACTAGTATCTTTGACCCTCTCGTAAATGTCAAACAAAATTACAG
+CAATTGTTAGTCTCTCATGTTACGAATGTTTATCCATCTAAGATGACTATGAAATAGCTG
+TTCGTGGAGGTCTTTTTCAGTGCTTCTTCAGTCCAAAATCTTTCTTTTATTTCCTCTTCC
+CACAGATACCTTCCATTCCCTGCTCTCGTTCACTCTAAATCATACCAACTCACTTTTCGA
+CACCACCTACGAGACAATCTCCCAAGATGCAAGACCACTGGTGTCCACCCTCTTCAATGA
+CCTTGATCTCTACCTTCGAGGCGATGATAACGTTTCTGTGGAACACTCGGTTTACAGATT
+TTATGACAAACTCTTCCCATTGGTGTACCAGCATCTGGTCAATCCTGGCTTGGGTTCACC
+TGTTTCAACCTGGTCTGCCGAAGGAACTGAGTGCCTTCGTGCCACACGGCATGATATCTA
+TCCCTTTGGCCATCACCCACAAGAACTTGCTCAAGGACTGTCCAAGGCGCTTGTGGTTGG
+TCGTGCCCTCAGCCGGGCACTGGCAGTCGGTGCAGATGTACTTAACATCACAGAGTCTGT
+GGGCATGGGACGAGTGTGTGGACGTGCACTAGTGCGCATGTTGTTCTGTCCTCACTGTCG
+AGGACTGACCCTGATCCGGCCATGTGGAGGCCTATGTCTCAACGTGATGCGAGGTTGCCT
+GGCAGGCGTGGCTGAGCTGGATGCTCCCTGGCGAGACTATGTATCGCTT
+> zDH41-1238o07.p1k R22744210 uid=49158841
+AAATAAAATAAATAAATAAATAAATAAATAAATTAACAAATTAACAAATTAATAAATAAA
+TAAATAAATAAATAAATAAATAAATTAATTAATTAATTACAATATAATATTAAAAATTAA
+ATATTCATTATTGATTATTAAAGAATTTTATTCCACCCATATTTTGACAAAATTATATTT
+GAAAAAATAATAAAGTAGCCAACTTGGTTGCCTTTAATAATGTGCTGAAAATAAAACCCA
+AAATATTAAGTCATTCTAAATGGGAAACTATGCATGCTTGCATGTACCTGGAATTATTGA
+GAAGACTTAATTTTTTTATTATGTTAGACAACTTTCAAAACTTTAATCCTTTACTAATAA
+ACTTTTTTCTACTCTATTATTTCTTTCAGAAAGCGTGGAGTCTCTGGTGCGTCAGGCGGA
+GAACCACACCCTCTCCATCCTCCATCAGTCCCAGCGTGATCTCTCCAGCCCAGCAGCATC
+AGCACCAGTCGGGGAGTTTTTCACAGAAGTGGCTCTGTTCATCCTGGGCTCTGAGCTCAG
+TCTAGAAGAGTCCTCTCAGAGCTTCTTCAACGCTCTTTTCCCCTTAATATACGAGCGTCT
+GATTGACTCCCGTCTGTCTCCTCCATACGCCGAATGCCTGCGCTCGTCTGCTCAAGATCT
+AGCACCGTTCGGAGCAGCCCCAATCCGCCTGGCGTCCCAAATCGCCCATGCTTCTCTACC
+TGCTCGCGTGTTTCTCCAAGCGCTCCATTTGGGCATCGAGATCATAAATACGACCGATCA
+CATCCAGCTGAGCCGCGAGTGCAGACGTGGCCTACTGAGGATGAGCTACTGCCCGCACTG
+CAAGGCTCTGACCTCCCAGCAACCCTG
+> zDH41-1254i17.p1k R22745143 uid=49159804
+CATAGAACTCCATATAAAAGCCAGAAACTTGTATGATAGGCCTATATAAAGGGTTAATGG
+TGACAACTGATGATCAACAGTAAAACTTAAACATTTGACCTCTTCCCAACAGGAAAACCA
+ACAATAATCAAGAATGCATAATTATATGTCTTGGCTTTGTAATCAAAAAATGTGATTATG
+ATGGAAGTCAATGGGGCAAAAACAGCCACCAACATAATGAAGGGGTAGTCAATTTGAACA
+GCAGAGAAGGATTAAGACCACTGATCATTCTATCATTATCACTCATTTAAATCTTTCTTC
+TTTTTCAGATACGTTCCAGTCCCTAATATCCTTCTCCCAGAACCACCTGACCTCTCTGTT
+TGAGACCACATACTCATCCCTCATGTCGTCCATCTCCCCTCACATCGTCTGCCTCTTCAC
+GGACCTCTCTCGCTTCCTCCAGGGCACCGGCAACGTCTCGGTGGAAGCTGCTGTGCACTG
+TTTCTTCGACAGCCTTTTCCCATTGGTCCACACTCAGATTGTCAATCCCGGTATGGAAGG
+AAGTATTGGGACAGATGCTTCTGAAGGCAACCAGCTTGGTGACTGTCTCCGAATGACCAG
+GCAGGACGTAAACCCCTTTGGTCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGGACGC
+ATTGCGGGCTGGGCGGGTGCTCAGCTTGGCACTTGCCGAAGGGTCAGAGGTGATGAACAT
+TACGGAAACAGCAGGGTTATCAAAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTG
+CTCTCACTGCCGTGGACTCACCCTGATCCATGCGTGCAGCAACTACTGTCTTAATGTCAT
+GCGCGGGTGCCTGGCGAGCTA
+> zDH41-1106h04.p1k R22790263 uid=49207015
+TCTATCCATAAATCCATCTATCCATTCATCCATAAACCTATCCATCAATCCATCCATCCA
+TCCATCCATTTGTCGACGCATCATTAGTCCATCCCTTAATCCATTTATCTGTCCATACAT
+CTATCCATACATACAGCTATCCATCCATCCATTCATCCATCCATCCATCCATCCATCAGT
+CCATCCATAAATCTATCCATAAATCCATCCGTCCATACATTTATCCATAAATCAGTCCAT
+CAATAAATCCATTCAAACATCTGTCAACCAATGTATCCATTCATCCAGAAATCTATCCAT
+CAATGCATCCATCAGTCCATCCATAAATCCATCCATCCATCCAATCCATTCATCCATCTA
+TCCATAATTCTATCCATCGATCCATCCCCACATCTATCTACCCCTCCATCCATCCATCCA
+TCCATAAATCTATCAATTAATCCATCTATCCGTCCATACATTCATCCATAAATCTGTCAA
+CCCATAAATCTAGCCATCAATCAATCCATAATTCTATCAAGCAATGCATCTCTCCGTCCA
+TCAATCCATCCGTCAGAATCATTGTGTCTGAAGACTGTTTTATGATGCATCTGTGCTTTT
+GTTAATTGTGCTGTAGTTTACATACAGAACAGCCAAGCATACAGGTTACTGACCTCATCA
+AAACCCTGTATAAATGTGTGTGTGCTCGAGGTGTGTGTGTTCCTCTTACCGATAAATTTG
+CTCCATTCGTTGTTGAGATCGGCCTGGTTTGCCAAGCAGCCCTTCATGACATTCAGACAG
+TAGTTTCTGCAGGGCTTCAGTGTGAACAGACCCTGACAATACGAGCAGTAGAGCATCTTC
+GTGAAGCCGCTGACACACGACGAGCTCATGCTGACCTGCGCACACACACACACG
+> zDH41-1244f05.p1k R22793487 uid=49210291
+GCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTTTTTCACAGAAGTGGC
+TCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTTCTTCAACGC
+TCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTCTCCTCCATACGCCGA
+ATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGCCCCAATCCGCCTGGC
+GTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCAAGCGCTCCATTTGGG
+CATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGAGTGCAGACGTGGCCT
+ACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAGCAAACCCTGCTTGGG
+ATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCTGAAGTGGATGCCCACTG
+GAGGGAGTTTGTACGCTCGCTGGAGACGCTGGCAGTACGGATGCACGGAGAGCTGGATCT
+GGAGCAGGTGCTGCTGGGGGCGCATGAGCTGGTGAGGGACGCTGTGGCGCACGCTCAGAG
+GAGCACAGCGAGGATACATGCGCAGGTGAGAGGATGAGTGTGTGGTTAGCACTGTCACCT
+CACAGCAAGAAGGTCACTGGTTCGAGCCCCGGCAGGGCCAGTTAGCATTACTGTGTGGAG
+TTTGCATGTTCTCCCCGTGTTGACGTGGATTTCCTTCGGGTGTTCCGGTTTCCCCAAGTC
+CCAAGTGAGAGTGTATGGATGTTCCCAGT
+> zDH41-1123j17.q1k R22847968 uid=49266690
+TTCTACTATAAAATCTGCTTTGTAAATTTGTTGTTTGCTTTTGGCATCTGCTAGAGCTTT
+TGTACCAAGAAACAGTGACTTTTGATGTCAGACTTAAGCAAATAGAGTTGTTTATTGGTC
+CCGCCCACCTGCAAGGTTCCTCCACTCAGTGTCCAGGTCTGCTTGATTGGCGAGGCAGCC
+TTTTAAGACATTTCGACAGTAGTTTGAGCAGGGTTTGGCCAAGGCCACGCCACTACAGTG
+AGGACAATACGTCTGCTTCATGACAGCACGCACACATTCAGTGCTCAGAGAAACCTGCAA
+AACACAAAAAACACAATTTAAAGAACAGCTCAACCATAATGAATCACTTAACAAGAAAAA
+AAAAGCCCTGTGAATTGTTTTGTGTCACACACAATATGCGATAATTGCACTGTGCAAATA
+ATTGCTTGTCAGTACAGTTTCCCAAGAGGTCCAAGGATGTGGGATGGTACAGTTTGGTAC
+AACTCTTGCAAAAGAATACCCATGGTGCTTCTCTGAGACGTCTTTCACAATCATTCCTCT
+TTATCAGGAACCTCCACCCCTCTGATGTCAAAGCGTGGGGGTTTATAGGGTCCCTCAGGG
+AAAAGCAATGCAGTTCGGGAAGGAAAGTAGAACTTGACATTTGCTTGTTGTTTAAATGAA
+TCTAATTTCACGGATATTGAAAGAAAAAGTCTGTTTTGTTTAGGTGTAAATATAGGTGCA
+GACAGCATGACATTTGATTTCTGTAAATCCAACTGTTTTCTTTCAGTTGCAACTGCATTA
+GCCTGCGTGAAGCATTCAGTCGCAGCGGCGGCGTGTAACTTTGACACAATTTCACAAAGC
+TGAATGTCAGTTACTGTATATTGCAT
+> zDH41-1308f17.q1k R22919539 uid=49360603
+CTGCATTATTCCAATCGAGAGCATTCAGAAAGCCATTATTTGCTTCACAAACCAAACCTG
+AAAAAATCTGCAAGAATATTACAAATATAACACTTTTTTTTTAGGTACACATATTGAACC
+CTTGCCAATAACAAGGAAGCAAATATACCATAGAATGGTCTTCAATGGGGATATTTTTGT
+CCTGAGACAAACTTTTTAGTTCTTAGTGTAAAACAGATTTAAGACAGAAAATGAGTATTG
+CGAAACAATAATTCTAGTGTAGAGCTCATCAGTGAGGCTATTATGTGAAAAGCCTAAATT
+AACACAGGAAAGAACTGAATTAAGCCCTTGGAGAGCCACCAGGGAACTCAATCACATATT
+TTGAGTTTTAAAGAAAAATAAACACTGACAACACTGTACTGTACAACTAATGTCTGGAGA
+CAAACTGACATCATACTAAACAAGAGTACCGCAAACTACCAGCTTCACCAAGGCTGTAGA
+TAAACCACCCAAGCATGATTAACCAGCGCACCAACCTTGGAAAGCGGCCACATTTCGTGA
+GAAGAGGAACTTTAGGCTGGAGCTAGAGATCTGGAGAAGGTTCTGAATATCCCGCCGGGC
+CGCCACCTGGTAACGCTCCTCCATCTTTTTGGTGCAGCATGTTAGATTCCTGGATAAGCA
+AACCTGCAGGTCTGAACCTGAAAAAGAACAAATATTATTTGTTATCTAAAGTGGCAATGG
+TAAAAAACAACACTTAATACACAAATACACTCAATTGAACATGCACACATAGACATCACC
+TATACTTGTTCATCACCTATACCTATACAACAGT
+> zDH06-285a19.q1k R23139987 uid=50083817
+ATTTTATTCCCCCATATTTTGACAAAATTATATTTGAAAAAATAATAAAGTAGCCAACTT
+GGTTGCCTTTAATAATGTGCTGAAAATAAAACCCAAAATATTAAGTCATTCTAAATGGGA
+AACTATGCATGCTTGCATGTACCTGGAATTATTGAGAAGACTTAATTTTTTTATTATGTT
+AGACAACTTTCAAAACTTTAATCCTTTACTAATAAACTTTTTTCTACTCTATTATTTCTT
+TCAGAAAGCGTGGAGTCTCTGGTGCGTCAGGCGGAGAACCACACCCTCTCCATCCTCCAT
+CAGTCCCAGCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTTTTTCACA
+GAAGTGGCTCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTTC
+TTCAACGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTCTCCTCCA
+TACGCCGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGCCCCAATC
+CGCCTGGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCAAGCGCTC
+CATTTGGGCATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGAGTGCAGA
+CGTGGCCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAGCAAACCC
+TGCTTGGGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCTGAAGT
+> zDH006-297n22.p1k R23236569 uid=50181681
+CATATTACATTTCAGCACATTATCACTGTGGTGTTGAAATGTAACTAACCTTAACTTTAT
+AGTTACTCAATCTCTCTTTTCTGTCTTTTTTCAGAGGCTTTTGACATGGTGCTTCGTCTG
+GGCCGTAATTCCACTCTGATGGTGTTACGCGAGGAGTTTCCTGGTTTGGGGGCTGGAGCC
+AGTGGAGCCGTCACGCAGTTATTCCTGGATATGTCACTTTACATTCTGGGCTCTGATGCC
+AATGTAAACGACATGGTCTCCACCTTCTTCTCTCGCCTTTTCCCTCTCACCTACCGTCGA
+CTTCTGGGCAATGGGGCCGTGGCGGGCATCTCTGAAGAATGCCTCCGCGGGGCCTGGAAA
+GGGAGCTCTGCGTATGGGTCATTTCCCAAGATGATGATGACCCGACTATCCCGCTCACTC
+CTCGCCACTCGGGTCTTCCTGCAAGCGCTAAATTTGGGCATAGAAGTGGTCAACACCACT
+CAGCATTTGCGGGCAGGTAGAGATTGTGGGCGCTCGCTTCTGAAACTGTGGTACTGCCCG
+CACTGTCAAAGCCTGCTGGAGGCCCGGCCGTGCCGTCCACTGTGTATCAGCACCATGGGA
+GCATGTTTGGGGGGAACCACGGAGGTACAGCCTCATTGGAGAGCATATGTGGATGAACTG
+GGGTCACTCGCCGCTGCCATGAAGGGGGAACAGGACATCGAGGCTGTGGTGCTCCGACTG
+CACGTCATTATCAG
+> zDH006-285n20.q1k R23304018 uid=50250142
+AATCAATTAACCAACCAACCAACCAACCAACCAACCAACCAAACCACCAACAAATCAACT
+AAGCGACCCACTTCAGATAGATTTGTAGAATTGTTCATTATGACGGGTCAATCAATCAAT
+CAATCAATCAATCAATCAATCAATCAATCAATCAATCAATGAACTAAGCAACCAACTAAT
+CAACCAAGCAACCTTCCGACCAATCAACCAAAAAATAAGCAAGCAAGCAAACAAACAAAC
+AACCAAGTAACCAAGTAACCAACTAATCAACCAAGCAACAAAGTGTCCAAGCAACCTTCC
+GACCAATCAACCAATAAACTTACTAACCAACCTACCAACTGATGAATCAATCAATCAATC
+AATCAATCAATCAATCAATCAATCAATCAATCAATCAATCAATCAATCAATCAATCAATC
+AATCAATCAATCAATCAATCAATCAATCAATCAACCAATCAATCAATCAATCAACCAATC
+AATCAACCCATCAATCAATCAATCAATCAATCAATCAATCAGTCAAACACAAAATAAACT
+TGAGCAACAACTCAAACAGTCTCATTTCCAGTATTGTTTAAATAAAGAATACATAAAATA
+ATAAATAAAATAAAGTGTTTTTGATTGAAAAAAGGCACCCAACTGGAAGTTCTTTATAGG
+GGACATCTATATTAGAAAACCCAGCTTAAGGTACAATAGCAAGCGCATCTCACCAATAAA
+GAGGTTCCACTCAGGGTCCAGATCCGCTTGGTTGGCCAGGCAGCCGCGCATCACATTCTG
+GCAGTAGTTGGCGCAGGGTTTGAGTCCTGACATTCCTCCACAATACGGGCAGTACCACAT
+TTTAGTCAATGCTTTACTGCAGCCTGGAGAAATATTGACCTGCAGGATAAACACACATGG
+GCAGATGTTAAATGTGCTTTGAAATGTGC
+> zDH006-324p17.p1k R23311429 uid=50257667
+TACTCCATATGACAGTACTCCATACCTACAAACCAACTGTGCTGTCCAAACAGTGTCCAA
+AGCTTAATTTTGCATCATAGGTGCGCACTTTTAAAAAAAACATTGCAGATCCACTACACT
+AATATGATATCATCCACATCTCATTAAAGATCTTACCTTGGCCACCCTGTTGGCCACTTC
+TCGGCCCACCATAAGTCCCTGGACGAAGGATCTGGCCGCGATGAAAGCTTTGGTGACCTG
+CGCCTTGAGTTTTCGCGGCACGTCTCCGAACGGCTTGAGCTGGTCAGTGTATTTGCTGAT
+GCACTCCAGATAGTCGTCGCTGAAGGTGAACTGCGAGTTGAGCAGCTGGAACATTCTCTC
+CAGCAGACGCGACCAGAAGTCATTCAGCACCTCCTCCAGGTTGACGTTCCCACCGGTGTA
+GTAGCGCTTCAGCTCTGAGAACAGGTCCTCGAACATCTCCGAGTTGTGTGTGTAGAGTTT
+GCCATATGTGCGCACAAACATGTCGTTTAGAGACTTCTCAGAGTTGTCCAGCAACTCCAG
+GAAAAACTCTGGAAAAACAGAGAAATACTGATGTAAAAAAAATATGTAATTTGAGCATGT
+GTATATATATTTTAAATAATTACAAAAAAAAAAAAAAACGTAGTAGTTATTATTGTTATT
+ATTATTAATATTAATATTAATATTATATTAATATTGATATTATTATTATTATTATTATTA
+TTATTATTATTATTATTATTATCATCATTAGTGTCATAATCTACACATTATATATATATA
+TATATATATATATATATATATATATATATATATATATATAT
+> zDH006-739g13.q1k R23417741 uid=50365471
+TAGACACTTTCAAACTTTAATCCTTTACTAATAAACTTTTTTCTACTCTATTATTTCTTT
+CAGAAAGCGTGGAGTCTCTGGTGCGTCAGGCGGAGAACCACACCCTCTCCATCCTCCATC
+AGTCCCAGCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTTTTTCACAG
+AAGTGGCTCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTTCT
+TCAACGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTCTCCTCCAT
+ACGCCGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGCCCCAATCC
+GCCTGGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCAAGCGCTCC
+ATTTGGGCATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGAGTGCAGAC
+GTGGCCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAGCAAACCCT
+GCTTGGGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCTGAAGTGGATG
+CCCACTGGAGGGAGTTTGTACGCTCGCTGGAGACGCTGGCAGTACGGATGCACGGAGAGC
+TGGATCTGGAGCAGGTGCTGCTGGGGGCGCATGAGCTGGTGAGGGACGCTGTGGCGCACG
+CTCAGAGGAGCACAGCGAGGATACATGCGCAGGTGAGAGGATGAGTGTGTGGGTAGCACT
+GTCACCTCACAGCAAGAAGG
+> zDH006-921d02.p1k R23572403 uid=51022209
+AAGACAAGCGGTACAGGTGAATTGGGTACGCTAAATTGTCAGTAGTGTATGAGTGTGTAT
+GTGTGAATGTGTGTGTGGATGTTTCCCAGAGATAGGTTGCTGCTGGAAGGGCATCCACTG
+CTGGATAAGTTGGCGGTTCATTCCGTGCTGGCGACCCCGGATTAATAAAGGGACTAAGCT
+GACAAGGAAATTAATAAATGAATGAAATTGGGTTTTGCGCTTTTGGCTTATCATAAATGC
+ATTATTTTTGAGATTGATCTGGCTCCATGATGCAATCTTTTGCATTTTCTGTCACAGTTA
+TACACCAAATTCTATTTATGTCTGGATTCCTCAGTTTTGTCAGCATTGTGTAAATCACAG
+GGCCCTAAATGAGCCTCTGTTGTTACATCAACATATATTCATTCACACATCAATCAACTT
+CATCTATTTGCCCATTCGTTTCACTTATCAATCATCCATTTCATCCTTCCACCATCCATT
+CAATCATCCATGCATCTGTGTACCCTGGAAGGCGGCGGCGTGTGCAGAAATGAGAAATTT
+GAGCTCATAGCTGTACGATCCGATGTTCTGGGTGGTGTCTCTCAGGACCGCCGCTCTGTA
+ACTGTCTTCCATTCTTCGTGTACAACATGATGGCCCCGCATGCTTGCACACCGACAGTTC
+CACATCTGCAGTAAAAGACAGAACAGTAGCTTGTTAGACAGATGCGCGTTCTTTATGAAG
+TTTCCGCAGCTTCATTGACCTTCTGGGGTCAGCAAATGCGCTGGAATCTCACTGTCGACT
+TGCTTCACAG
+> zDH07-216b23.p1k R23827814 uid=51297755
+GGATGATTGTGAAAGACGTCTCAGAGAAGCACCATGGGTATTCTTTTGCAATTAGTTGTA
+CCAAACTGTACCATCCCACATCCTTGGACCTCTTGGGAAACTGTACTGACAAGCAATTAT
+TTGCACAGTGCAATTATCGCATATTGTGTGTGACACAAAACAATTCACAGGGCTTTTTTT
+TTCTTGTTAAGTGATTCATTATGGTTGAGCTGTTCTTTAAATTGTGTTTTTTGTGTTTTG
+CAGGTTTCTCTGAGCACTGAATGTGTGCGTGCTGTCATGAAGCAGACGTATTGTCCTCAC
+TGTAGTGGCGTGGCCTTGGCCAAACCCTGCTCAAACTACTGTCGAAATGTCTTAAAAGGC
+TGCCTCGCCAATCAAGCAGACCTGGACACTGAGTGGAGGAACCTTGCAGGTGGGCGGGAC
+CAATAAACAACTCTATTTGCTTAAGTCTGACATCAAAAGTCACTGTTTCTTGGTACAAAA
+GCTCTAGCAGATGCCAAAAGCAAACAACAAATTTAACAAAGCAGATTTTATAGTAGAATA
+ACTATATATACACCAGGGGTTTCAAACTGTGGGGCTTGCCAGCACCTATTAAGAGGGACG
+CGAGACATTGAGGCGTGCACTTGAGTAAATTATGATGTCGATTTTTATGCGTTTACTAGA
+TGGAATAAAACGATTTATGTTAGCTCCACAGCTAATTATTAGGCACCTGTAGAGTTAATG
+TGTTCCAGTAAAATATATACAAATAAAATGGAAAGAGTGCTT
+> zDH07-123j18.p1k R23869637 uid=51340297
+CATACAGCTATCCATCCATCCATTCATCCATCCATCCATCCATCCATCAGTCCATCCATA
+AATCTATCCATAAATCCATCCGTCCATACATTTATCCATAAATCAGTCCATCAATAAATC
+CATTCAAACATCTGTCAACCAATGTATCCATTCATCCAGAAATCTATCCATCAATGCATC
+CATCAGTCCATCCATAAATCCATCCATCCATCCAATCCATTCATCCATCTATCCATAATT
+CTATCCATCGATCCATCCCCACATCTATCTACCCCTCCATCCATCCATCCATCCATAAAT
+CTATCAATTAATCCATCTATCCGTCCATACATTCATCCATAAATCTGTCAACCCATAAAT
+CTAGCCATCAATCAATCCATAATTCTATCAAGCAATGCATCTCTCCGTCCATCAATCCAT
+CCGTCAGAATCATTGTGTCTGAAGACTGTTTTATGATGCATCTGTGCTTTTGTTAATTGT
+GCTGTAGTTTACATACAGAACAGCCAAGCATACAGGTTACTGACCTCATCAAAACCCTGT
+ATAAATGTGTGTGTGCTCGAGGTGTGTGTGTTCCTCTTACCGATAAATTTGCTCCATTCG
+TTGTTGAGATCGGCCTGGTTTGCCAAGCAGCCCTTCATGACATTCAGACAGTAGTTTCTG
+CAGGGCTTCAGTGTGAACAGACCCTGACAATACGAGCAGTAGAGCATCTTCGTGAAGCCG
+CTGACACACGACGAGCTCATGCTGACCTGCGCACACACACACACGGCAATAATACAACAG
+TCACCACACTACTTGTAGTGATGCTACAGCCTGACACTGGATGTCTCATAGTTTTG
+> zDH07-571c18.p1k R24048032 uid=52021938
+TTTCTCTCTATTATTTCTTTCAGAAAGCGTGGAGTCTCTGGTGCGTCAGGCGGCGATCCA
+CACCCTCTCCATCCTCCATCAGTCCCAGCGTGATCTCTCCAGCCCAGCAGCATCAGCACC
+AGTCGGGGAGTTTTTCACAGAAGTGGCTCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGA
+AGAGTCCTCTCAGAGCTTCTTCAACGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGA
+CTCCCGTCTGTCTCCTCCATACGCCGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACC
+GTTCGGAGCAGCCCCAATCCGCCTGGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCG
+CGTGTTTCTCCAAGCGCTCCATTTGGGCATCGAGATCATAAATACGACCGATCACATCCA
+GCTGAGCCGCGAGTGCAGACGTGGCCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGC
+TCTGACCTCCAGCAAACCCTGCTTGGGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGC
+TAACCTGGCTGAAGTGGATGCCCACTGGAGGGAGTTTGTACGCTCGCTGGAGACGCTGGC
+AGTACGGATGCACGGAGAGCTGGATCTGGAGCAGGTGCTGCTGGGGGCGCATGAGCTGGT
+GAGGGACGCTGTGGCGCACGCTCAGAGGAGCACAGCGAGGATACATGCGCAGGTGAGAGG
+ATGAGTGTGTGGTTAGCACTGTCACCTCACAGCAAGAAGGTCACTGGTTCGAGCCCCGGC
+AGGCCCAGTTAGCATTACTGTGTGGAGTTTGCATGTTCTCCCCGTGTTGACGTGGATTTC
+CTTCGGGTG
+> zDH07-1270k22.q1k R24136806 uid=52112387
+ATTTTATTCCACCCATATTTTGACAAAATTATATTTGAAAAAATAATAAAGTAGCCAACT
+TGGTTGCCTTTAATAATGTGCTGAAAATAAAACCCAAAATATTAAGTCATTCTAAATGGG
+AAACTATGCATGCTTGCATGTACCTGGAATTATTGAGAAGACTTAATTTTTTTATTATGT
+TAGACAACTTTCAAAACTTTAATCCTTTACTAATAAACTTTTTTCTACTCTATTATTTCT
+TTCAGAAAGCGTGGAGTCTCTGGTGCGTCAGGCGGAGAACCACACCCTCTCCATCCTCCA
+TCAGTCCCAGCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTTTTTCAC
+AGAAGTGGCTCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTT
+CTTCAACGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTCTCCTCC
+ATACGCCGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGCCCCAAT
+CCGCCTGGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCAAGCGCT
+CCATTTGGGCATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGAGTGCAG
+ACGTGGCCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAGCAAACC
+CTGCTTGGGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGCTGAAGTGGA
+TGCC
+> zDH07-1694m12.p1k R24177286 uid=52153452
+TCTTCTCTCGCCTTTTCCCTCTCACCTACCGTCGACTTCTGGGCAATGGGGCCGTGGCGG
+GCATCTCTGAAGAATGCCTCCGCGGGGCCTGGAAAGGGAGCTCTGCGTATGGGTCATTTC
+CCAAGATGATGATGACCCGACTATCCCGCTCACTCCTCGCCACTCGGGTCTTCCTGCAAG
+CGCTAAATTTGGGCATAGAAGTGGTCAACACCACTCAGCATTTGCGGGCAGGTAGAGATT
+GTGGGCGCTCGCTTCTGAAACTGTGGTACTGCCCGCACTGTCAAAGCCTGCTGGAGGCCC
+GGCCGTGCCGTCCACTGTGTATCAGCACCATGGGAGCATGTTTGGGGGGAACCACGGAGG
+TACAGCCTCATTGGAGAGCATATGTGGATGAACTGGGGTCACTCGCCGCTGCCATGAAGG
+GGGAACAGGACATCGAGGCTGTGGTGCTCCGACTGCACGTCATTATCAGACAGGCTCTCA
+AACAAGCCGTGGCAAGCAAGAGCAAAGTCAGCGCCCAGGTGAGTGACACATGGTCTCAGA
+AACAAGGTATGAATTCGAATGCTGTAGGCGACTGCAGCCATTTTGCTAACTTCAGCCATT
+TTTGCTAACGCCATCTCTCTCCAAAACTCAACCTCCAAAGACTTGTCAGCAAAGTCAGTG
+TCAGCAGACCCGAACGAGTGAAATGAAGAGTGTTTCTGACTGGCTAGTTTTCTGATTGAG
+CCCAGGGCTATCAAACTCAAAAAACTGTCGAGATTTCTCAGGACACCTTTTTTAGTTAGT
+ACTTCAGTTTACATGAGAGTTCTTGTCAAGGTATTGCAGGTTTTTAATCACCAGGCTTTA
+TTTTATCATTGATCTGTACACATGATAACATAACATTTAC
+> zDH07-1683h21.q1k R24195770 uid=52172170
+AACCACAATGATGTGGAACAGTTATTCTGCACCGCTGCAAGCATACAGAAGAACTATTAA
+TCTTAGTTTACATGTCTGCAAACTGAATGACGCCACCTAATGAATTTACTCACGTTTTAA
+TGAACATCAATGCCCTTACTTTGAGCTGTAGGAGTCCACAATGAAGGAATGTAGAGGTTA
+CATCGCATCAATGCTCCCACAAATGAATTACTCACTTGTCTGTCATCTCCTGTCCGTTCC
+AGCAGAGGGAGCTGTTCAGCGATGTCGGCTCTTTGCTGCACAAAGCTTCTCCGAGACCAC
+TGTAGAACTGACTGAAGCCCCTTAGACCCGAGATAAACTCCCTGCAGCAGACAGAGAGGA
+AATTGAGAATGTATTGAGTGCAGGCGAAAGAAGAAAGAGGAATGGGCTTCAGTGAAAATT
+GAAATTAGATGGTGTGCACAAAGAGACAAGATTAAGAATCCAAAATACTGGGATTTATGA
+GAAAATGTAGAGGCTTAGAGAAAGAAGAACGACGAATCAGGAGAAAAAAATAGAGTTGGG
+GTCAAATGCAGTGTTAAGCACGATATACTCCATTACATATCATTTCCTGTCGGGCTAAGT
+TGCTTTGAGATGCTTTGATTTTAATTGACATTACCTACACACACTCTCTCACCTGCTCAT
+CAGAGCGAGGGAACGAGAGAGAGGAACCGTACAGGACAGAGGGGGCAGAAGGCAGCTCAA
+TGTCACTCACACGGCAGGAGACAAAGCCTGTGTTAATGAGCTTCTCTCTGTCACCATCAG
+CCTGAACACACACTC
+> zDH07-1235p07.q1k R24226237 uid=52203086
+CCATTCTGCTAGCTGAAATAAAAAAAGTTAAGACCAAAATAACATTCAAAACCACGCCAG
+AGTGGATGAAAACATCCCCAGCAACACATAAGAGTTACCATATGATACCACTATGGATCC
+TCTTGGTTCTAATGCATGCTCTTTTAAGCATAAAAGTGTACCTTTTAAAAGGGTACCACC
+CCAGTGACAGGTTTCATACATTTCTGAGAGTGTGTTAAGAATTAATGTGTTCTTGACTCT
+AAGCATTTCAGCTTTCCGCCCAAGGGGATGCTAAAGGTTTAACTTATGACAAAAATGTAC
+CCAAAAATGGCTTCACAAACAGAAATGTAGCAGAAACTCACCTTGAAAGAGGGCAGCATT
+CTGGATGATGAGCCCTTTGAGCTGAGCGCTGGTGGCCTGAAGGCTAGACTCCATATTCTG
+TTTGGCAATAAGCAGGTAACGCTCCTCCATTTTGCGAGAACAGCAAGTCAGGCCTTTTGG
+CTGGCACACCTGCAGATCTGAGCCTGTAGAATAACAGAGAGAAGATTTCTAACAGCCGTC
+ACAATAAACAAGTAAACAGACCGCGGCATTTTATAAACTGAAGCTTGGCTTGTAAATCGA
+AAACAAAGAGAGCTGCAGAAAATGGTTTGTTTTATAGAGTACACATTGTTTACCGCTACT
+TGTACAAATTTCAAAGAACGCCACAAAAACAAATATCTGCAACTTAAT
+> zDH07-1264j06.q1k R24226708 uid=52203563
+AATGTGTGTGTGCTCGAGGTGTGTGTGTTCCTCTTACCGATAAATTTGCTCCATTCGTTG
+TTGAGATCGGCCTGGTTTGCCAAGCAGCCCTTCATGACATTCAGACAGTAGTTTCTGCAG
+GGCTTCAGTGTGAACAGACCCTGACAATACGAGCAGTAGAGCATCTTCGTGAAGCCGCTG
+ACACACGACGAGCTCATGCTGACCTGCGCACACACACACACGGCAATAATACAACAGTCA
+CCACACTACTTGTAGTGATGCTACAGCCTGACACTGGATGTCTCATAGTTTTGATTCGTA
+CAATTGAATATAACTTTTAAAAATAAATAAATAAATAAAAAAAGTTAGAGAACAAAAAAA
+TTATTTAGAGAAGAAAAAAAAATTTCAAGAAGAGGTTGGGGGTCATAAAATAAAATGATA
+TAAAAAAAAAGTCACAAACACAATTTAGGGTTTTTTCATCTCACCTGAGCGACTCTGTTA
+GCGACGTCACGTCCGACCGCAAGTCCCTGTACGAATGTGCGCGCCGCAATAAACGCGCGA
+GTCACCTGTGATTTCAGCTTTTTAGGCACATCTCCAAACGGCCGCAGCTGCTCCGTGTAT
+TTACCGATGCACTCCAAATATTCGTCCGTGATCTGAAACTGAGAGTTGAGCAGCTGAAAC
+ATGCGCTCTAGTAATCGTGTCCAGAAGTCCTTTAGCATCTCCTCCAGGTTGACGTTTCCG
+CCGGTGTAAAAACGCCGCAGCTCCGAGAACAGGCTCTGGAAGACCTCTGCGTTCTGCAGG
+TACGGTTTACCGTAAGTGCGGACAAACATCTCGTTCAGAGAGCGCTCGGCGCTCTCCAGC
+AGCTCCAAGAAGAAATCTAAAAAAATGTATAGAT
+> zDH07-1678a11.p1k R24522189 uid=53004064
+ATGGTGACATACTGTCTCCAGGGCTGGTGGAGCTCGGAGTAGCTCGCCTTGCACCCGCGC
+ATGACATTAAGACAGTAGTTGCTGCACGCATGGATCAGGGTGAGTCCACGGCAGTGAGAG
+CAGTAATGCATGCGTACCAGAGCCCGTGTGCACTCTTTTGATAACCCTGCTGTTTCCGTA
+ATGTTCATCACCTCTGACCCTTCGGCAAGTGCCAAGCTGAGCACCCGCCCAGCCCGCAAT
+GCGTCCGCCAGATCTTTTGCCATTGCTTTTGGGTGCGGACCAAAGGGGTTTACGTCCTGC
+CTGGTCATTCGGAGACAGTCACCAAGCTGGTTGCCTTCAGAAGCATCTGTCCCAATACTT
+CCTTCCATACCGGGATTGACAATCTGAGTGTGGACCAATGGGAAAAGGCTGTCGAAGAAA
+CAGTGCACAGCAGCTTCCACCGAGACGTTGCCGGTGCCCTGGAGGAAGCGAGAGAGGTCC
+GTGAAGAGGCAGACGATGTGAGGGGAGATGGACGACATGAGGGATGAGTATGTGGTCTCA
+AACAGAGAGGTCAGGTGGTTCTGGGAGAAGGATATTAGGGACTGGAACGTATCTGAAAAA
+GAAGAAAGATTTAAATGAGTGATAATGATAGAATGATCAGTGGTCTTAATCCTTCTCTGC
+TGTTCAAATTGACTACCCCTTCATTATGTTGGTGGCTGTTTTTGCCCCATTGACTTCCAT
+CATAATCACATTTTTTGATTACAAAGCCAAGACATATAATTATGCATTCTTGATTATTGT
+TGGTTTTCCCTGTTGGGAAGAGGTCAAATGTTTAAGTTTTACTGTTGATCATCAGTTGTC
+ACCATTTACCCTTTATATAGGCCTATCATACAAGTTTCTGGCTCTTATATGGAGTTCTAT
+GGAGCAAACCAGCAGATTATAATGTGTGTGTGTGTGTGTGTGTTTGTGTGTGTGTGTGTG
+TGTGTGTGTGTGTGTGT
+> zDH07-1376e20.q1k R24525987 uid=53007909
+ATATGCGATGCATTTGCTGCGAACGTACGGATTTTGCCTCACTCACATCTCCATGTTTGG
+TGTGAACCCAGCAGTGTTGACCAATCAGGAAGGAGAAAACAGCGCGCACACTGATGTCGT
+GAGTCGAAAACTCAGCTTATAGTGTCGATATGACCACGCTGCACAGTTTTGGAAAATAGT
+CACTCGGGTCGGAGTTTTCAGAAAGCATTGCTTTGTCACCTGACATTGCGTTTTTGGTGT
+GGACATTGCGTTTTGGTGTAGATAAAAAACCATGTGATCTGTGCAGTCCGACAAGTCGAC
+TTCAATAAAGCAAGCATCATGGCAGAGCATTATAGTCGGCTATTCTGTGCAGCCCTTAGT
+ATCAGTATATTTGATCTGTGAAAGCGTCTCTTGTACTTGAAAACAAGCAAACACAACTCA
+ATTCTTTCAGCCATGAATCATATAAACTCAAAATATTTTGAAATGTACATTTCTAGAAGA
+AAACTCTTGAGGCAATCTGGAAGAACTACAATTGAGCCTATTGAAAAGAGTTCAGAAACC
+CGCTTATAGCAGAAGAGGTCTTTGTGCTTCATAACTCTGTAGACCTTTTTTCATGCTACA
+ATACAAGCTAATGCTAGCTGTAAAAGCGTAAAAATGCTAGTACTCACTGTGGCAGTTAGC
+CTGGGCCCGTGAAGCTGAGCGTAGAGTATGGCCTCCTCGACCTGACCTCTGATCCCCAGT
+AAGGCCAGCTCTAAATTGTGAGCTCCGGCAACCATTTGCGTGAGGTCCTGCAATATGGTG
+ACATACTGTCTCCAGGGCTGGTGGAGCTCGGAGTAGCTCGCCAGGCACCCGCGCATGACA
+TTAAGACAGTAGTTGCTGCACGCATGGATCAGGGTGAGTCCACGGCAGTGAGAGCAGTAA
+TGCATGCG
+> zDH07-857n22.q1k R24592302 uid=53075233
+CGAGCTCATGCTGACCTGCGCACACACACACACGGCAATAATACAACAGTCACCACACTA
+CTTGTAGTGATGCTACAGCCTGACACTGGATGTCTCATAGTTTTGATTCGTACAATTGAA
+TATAACTTTTAAAAATAAATAAATAAATAAAAAAAGTTAGAGAACAAAAAAATTATTTAG
+AGAAGAAAAAAAAATTTCAAGAAGAGGTTGGGGGTCATAAAATAAAATGATATAAAAAAA
+AAGTCACAAACACAATTTAGGGTTTTTTCATCTCACCTGAGCGACTCTGTTAGCGACGTC
+ACGTCCGACCGCAAGTCCCTGTACGAATGTGCGCGCCGCAATAAACGCGCGAGTCACCTG
+TGATTTCAGCTTTTTAGGCACATCTCCAAACGGCCGCAGCTGCTCCGTGTATTTACCGAT
+GCACTCCAAATATTCGTCCGTGATCTGAAACTGAGAGTTGAGCAGCTGAAACATGCGCTC
+TAGTAATCGTGTCCAGAAGTCCTTTAGCATCTCCTCCAGGTTGACGTTTCCGCCGGTGTA
+AAAACGCCGCAGCTCCGAGAACAGGCTCTGGAAGACCTCTGCGTTCTGCAGGTACGGTTT
+ACCGTAAGTGCGGACAAACATCTCGTTCAGAGAGCGCTCGGCGCTCTCCAGCAGCTCCAA
+GAAGAAATCTAAAAAAATGTATAGATGTATAAATACTAAAATAAAAAAGAACAACTTATT
+ATGACAATATATCTCATTATTTTGACATACCGATATATTAGGTATGCGTTACTTTGCTGA
+AATAAGTTACTTCGACATGTCTATATATTACAAATGAGTTACTATACTGAAATAAGTTAT
+TTCGAC
+> zDH07-1601l07.q1k R24738176 uid=53223367
+TTCCACCCATATTTTGACAAAATTATATTTGAAAAAATAATAAAGTAGCCAACTTGGTTG
+CCTTTAATAATGTGCTGAAAATAAAACCCAAAATATTAAGTCATTCTAAATGGGAAACTA
+TGCATGCTTGCATGTACCTGGAATTATTGAGAAGACTTAATTTTTTTATTATGTTAGACA
+ACTTTCAAAACTTTAATCCTTTACTAATAAACTTTTTTCTACTCTATTATTTCTTTCAGA
+AAGCGTGGAGTCTCTGGTGCGTCAGGCGGAGAACCACACCCTCTCCATCCTCCATCAGTC
+CCAGCGTGATCTCTCCAGCCCAGCAGCATCAGCACCAGTCGGGGAGTTTTTCACAGAAGT
+GGCTCTGTTCATCCTGGGCTCTGAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTTCTTCAA
+CGCTCTTTTCCCCTTAATATACGAGCGTCTGATTGACTCCCGTCTGTCTCCTCCATACGC
+CGAATGCCTGCGCTCGTCTGCTCAAGATCTAGCACCGTTCGGAGCAGCCCCAATCCGCCT
+GGCGTCCCAAATCGCCCATGCTTCTCTACCTGCTCGCGTGTTTCTCCAAGCGCTCCATTT
+GGGCATCGAGATCATAAATACGACCGATCACATCCAGCTGAGCCGCGAGTGCAGACGTGG
+CCTACTGAGGATGAGCTACTGCCCGCACTGCAAGGCTCTGACCTCCAGCAAACCCTGCTT
+GAGATACTGCCTGAACGTGGTGCGCGGGTGTCTGGCTAACCTGGC
+> zDH07-1865p03.p1k R24772414 uid=53258061
+GTTTGTCACCATTCTGCTAGCGTGAAACAAAAAAAGTTAAGACCAAAATAACATTCAAAA
+CCACGCCAGAGTGGATGAAAACATCCCCAGCAACACATAAGAGTTACCATATGATACCAC
+TATGGATCCTCTTGGTTCTAATGCATGCTCTTTTAAGCATAAAAGTGTACCTTTTAAAAG
+GGTACCACCCCAGTGACAGGTTTCATACATTTCTGAGAGTGTGTTAAGAATTAATGTGTT
+CTTGACTCTAAGCATTTCAGCTTTCCGCCCAAGGGGATGCTAAAGGTTTAACTTATGACA
+AAAATGTACCCAAAAATGGCTTCACAAACAGAAATGTAGCAGAAACTCACCTTGAAAGAG
+GGCAGCATTCTGGATGATGAGCCCTTTGAGCTGAGCGCTGGTGGCCTGAAGGCTAGACTC
+CATATTCTGTTTGGCAATAAGCAGGTAACGCTCCTCCATTTTGCGAGAACAGCAAGTCAG
+GCCTTTTGGCTGGCACACCTGCAGATCTGAGCCTGTAGAATAACAGAGAGAAGATTTCTA
+ACAGCCGTCACAATAAACAAGTAAACAGACCGCGGCATTTTATAAACTGAAGCTTGGCTT
+GTAAATCGAAAACAAAGAGAGCTGCAGAAAATGGTTTGTTTTATAGAGTACACATTGTTT
+ACGCTACTTGTACAAATTTCAAAGAACGCCACAAAACAAATATCTGCGACTTAATCGAAA
+CATGTTATTTAATTTCATTTCCACACATTGCATTTCATCTTGTTGCCTTGTG
+> zDH07-1576k16.q1k R24858129 uid=53344901
+ACTAATAAACTTTTTTCTACTCTATTATTTCTTTCAGAAAGCGTGGAGTCTCTGGTGCGT
+CAGGCGGAGAACCACACCCTCTCCATCCTCCATCAGTCCCAGCGTGATCTCTCCAGCCCA
+GCAGCATCAGCACCAGTCGGGGAGTTTTTCACAGAAGTGGCTCTGTTCATCCTGGGCTCT
+GAGCTCAGTCTAGAAGAGTCCTCTCAGAGCTTCTTCAACGCTCTTTTCCCCTTAATATAC
+GAGCGTCTGATTGACTCCCGTCTGTCTCCTCCATACGCCGAATGCCTGCGCTCGTCTGCT
+CAAGATCTAGCACCGTTCGGAGCAGCCCCAATCCGCCTGGCGTCCCAAATCGCCCATGCT
+TCTCTACCTGCTCGCGTGTTTCTCCAAGCGCTCCATTTGGGCATCGAGATCATAAATACG
+ACCGATCACATCCAGCTGAGCCGCGAGTGCAGACGTGGCCTACTGAGGATGAGCTACTGC
+CCGCACTGCAAGGCTCTGACCTCCAGCAAACCCTGCTTGGGATACTGCCTGAACGTGGTG
+CGCGGGTGTCTGGCTAACCTGGCTGAAGTGGATGCCCACTGGAGGGAGTTTGTACGCTCG
+CTGGAGACGCTGGCAGTACGGAAGCACGGAGAGCTGGA
+> zDH07-2164d11.q1k R24875710 uid=53362729
+ATGCATAATTATATGTCTTGGCTTTGTAATCAAAAAATGTGATTATGATGGAAGTCAATG
+GGGCAAAAACAGCCACCAACATAATGAAGGGGTAGTCAATTTGAACAGCAGAGAAGGATT
+AAGACCACTGATCATTCTATCATTATCACTCATTTAAATCTTTCTTCTTTTTCAGATACG
+TTCCAGTCCCTAATATCCTTCTCCCAGAACCACCTGACCTCTCTGTTTGAGACCACATAC
+TCATCCCTCATGTCGTCCATCTCCCCTCACATCGTCTGCCTCTTCACGGACCTCTCTCGC
+TTCCTCCAGGGCACCGGCAACGTCTCGGTGGAAGCTGCTGTGCACTGTTTCTTCGACAGC
+CTTTTCCCATTGGTCCACACTCAGATTGTCAATCCCGGTATGGAAGGAAGTATTGGGACA
+GATGCTTCTGAAGGCAACCAGCTTGGTGACTGTCTCCGAATGACCAGGCAGGACGTAAAC
+CCCTTTGGTCCGCACCCAAAAGCAATGGCAAAAGATCTGGCGGACGCATTGCGGGCTGGG
+CGGGTGCTCAGCTTGGCACTTGCCGAAGGGTCAGAGGTGATGAACATTACGGAAACAGCA
+GGGTTATCAAAAGAGTGCACACGGGCTCTGGTACGCATGCATTACTGCTCTCACTGCCGT
+GGACTCACCCTGATCCATGCGTGCAGCAACTACTGTCTTAATGTCATGCGCGGGTGCCTG
+GCGAGCTACTCCGAGCTCCACCAGCCCTGGAGACAGTATGTCACCATATTGCAGGACCTC
+ACGCAAATGGTTGCCGGAGCTCACAA
+> zDH07-2057n12.p1k R24880586 uid=53367687
+TATATTAGAAAACCCAGCTTAAGGTACAATAGCAAGCGCATCTCACCAATAAAGAGGTTC
+CACTCAGGGTCCAGATCCGCTTGGTTGGCCAGGCAGCCGCGCATCACATTCTGGCAGTAG
+TTGGCGCAGGGTTTGAGTCCTGACATTCCTCCACAATACGGGCAGTACCACATTTTAGTC
+AATGCTTTACTGCAGCCTGGAGAAATATTGACCTGCAGGATAAACACACATGGGCAGATG
+TTAAATGTGCTTTGAAATGTGCATTTTTTTTTATTTAAAGTTTGACGTAATCCCAACTGA
+AACATAAAGAGAGAGCAGGACATACAGTAGCTCCTCCCAAAAAACAGCCAATATAGTTTC
+ATTTTTTATCACAGCCTTGCCAGTGACAGGGACTGTACCTGTATGCCTACAACTGATGTC
+AAAATTATTCGCCCTCCTGTGATTTTGTTTTACTTTTTCAAATGTTTCCCAAATGATGTT
+TAACAGCGCAAGGAAATTTTTACAGTGTCTCCAATGATATTTTCTACAATATATCTTCTA
+TTAAGTCTTTGTTTTATTTTTTATAACTGCTAGAATAAAAGCAGTTTTTTGTCCCATTTT
+AAAGGGCCATGACATCCCCCTCTTTCGAGTCAAGTCTACCACAGAATTAAAAAAAAAATG
+CTCTGTGATGGGCGTGGAGTGCTACAAGCAGAGGGAGGAGAGGGTGTGGCTGACAGAGCA
+GTGAATAAGAGGGGAGCAAAAAACTGCTGACAATTGGCTC
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/amos.git
More information about the debian-med-commit
mailing list